also you could use somthing like this :
execute @a[score_medic_min=1,score_medic=1] ~ ~ ~ effect @a[r=5,score_medic_min=0,score_medic=0] 10 5 4
so the intern things:
everybody with the score for medic=1 --> is the medic
everybody with the score for medic=0 --> is not an medic
also you should add the teams to it so they cant heal enemies!
execute @a[score_medic_min=1,score_medic=1,team=blue] ~ ~ ~ effect @a[r=5,score_medic_min=0,score_medic=0,team=blue] 10 5 4
=]