So, you've got a few issues with that macro; 1) too many opening curly braces 2) the wrong template field label for two of your options 3)an extraneous opening parentheses. I'd personally rewrite the macro like this:
&{template:sf_generic} {{name=@{selected|character_name} }} {{title=Medicine}} {{r1=[[?{tools|
Basic,1d20+@{medicine_ranks}[RANKS]+[[({0,@{medicine_ranks}}>1)*@{medicine_class_skill}]][CS]+@{medicine_ability}[ABILITY]@{medicine_misc}]]
|Advanced,1d20+@{medicine_ranks}[RANKS]+[[({0,@{medicine_ranks}}>1)*@{medicine_class_skill}]][CS]+@{medicine_ability}[ABILITY]@{medicine_misc}]] needs a 20 with an Advanced Medkit
|medpatch,d20+@{medicine_ranks}[RANKS]+[[({0,@{medicine_ranks}}>1)*@{medicine_class_skill}]][CS]+@{medicine_ability}[ABILITY]@{medicine_misc}+10[medpatch] ]] needs a 25 with a Basic Medkit and receives a bonus with a medpatch
|ADV MP, 1d20+@{medicine_ranks}[RANKS]+[[({0,@{medicine_ranks}}>1)*@{medicine_class_skill}]][CS]+@{medicine_ability}[ABILITY]@{medicine_misc}+10[medpatch] ]] needs a 20 with an advanced Medkit with a bonus from the medpatch & # 125; & # 125;
} }}
I'd also seriously consider using the buff handling capability of the sheet to address this instead of making the macro, then you can just use the sheet generated menus instead of needing to reinvent the wheel. Something like this should work for a medpatch buff:
+?{Using Med Patch|No,0|Yes,10} medpatch to medicine.