If you have more than the statutory limit OR you don't have a MMP ID card from the local authorities (not a doctors card/note or a club card) then you can be arrested and prosecuted. Then you would have to go to court and prove that the quantity you had is reasonably necessary for your medical needs. The prosecutor wont be able to argue to the jury that you were over any limits, however. See People v. Kelly.
I have no idea how lenient the cops are if you're under the limit but have just a doctors note and no MMP ID card, it probably varies quite a bit. I doubt they'll let you slide if you're over the limit though, no matter what your doctor says. Just guessing though.