If a person read the Megillah in shul and the doctor told him he should not read the Megillah it’s dangerous for him... After Purim, he went to the doctor and the doctor told him nothing happened then it was totally fine that he read the megillah... Did he get a Mitzvah and were the people in the shul Yotzei the megillah?
לז"נ יונה שלמה ב"ר אברהם יוסף ז"ל Shalom, ב"ה The facts you presented are somewhat conflicting. On the one hand you said the doctor said reading the Megilla was dangerous and then you quote the same doctor who said doing so was fine. So, I will simply mention in short the classic example of one who was ordered by his doctor not to fast on Yom Kippur and fasted in any case, not only did he not commit a mitzvah but an aveira.(שו"ת מהר"ם שיק סי' רס, Shemirat Shabbat Kehilchata Ch. 39: 2 ) and it is as if he spilled his own blood .( שו"ת הרדב"ז ח"ג סי' תמד ואו"ה סי' ס סע' ח.). The Mishna Brura, (שו"ע או"ח תריח מ"ב ה). brings the poskim who say " ..the blood of your own lives I will demand an account"(בראשית ט:ה). As far as being Yotzei , the Bracha on the megilla, I wouldn't want to be the one give a ruling on this, especially from what you described the doctor went back on his own medical recommendation. But the closest case I found is in a question relevant to our upcoming Pessach. The Maharam Shik,(1807-1879) (שו"ת מהר"ם שיק סי' רס) was asked in regard to a person for whom eating Maror or Matzah is a medical danger, if he may eat the Matzah and make a Bracha on it, and he ruled that he may not eat it nor make the Bracha. I just, wish to add, that I planned to answer you yesterday but I was delayed. And I must say, that the delay was for the better, because I came across this important Maharam Shik. All the best. Have a happy and kosher Pessach.