I got sick and had surgery in the hospital. When I came out of the hospital the specialist told me that I should not wash myself with water for five months, which included the blessed month of Ramadan. I hope that you can advise me whether I should follow the doctor's advice for five months, or should I do ghusl and pray and fast Ramadan?.
It seems that you have an excuse for not doing ghusl, so you can do tayammum to purify yourself in the case of janaabah. But in order to be on the safe side, you should ask other doctors who specialise in this sickness. You should make sure by asking a second doctor, especially a Muslim doctor who can be trusted. But if what this is what the specialist who treated you said, and you feel comfortable with his experience and you did not see anything in him which would suggest that he take the matter of Islam lightly or that he hates Islam, then praise be to Allah. If this is the medicine and it is something thing that it is feared may pose a danger if you go against it, then there is nothing wrong with following his advice and not doing ghusl until that period ends, so as to be on the safe side with regard to your health and wellbeing.
Shaykh ‘Abd al-‘Azeez ibn Baaz (may Allah have mercy on him)