Hi Nat
The first thing I would do is talk to my union delegate or organizer about what your entitlements are to medical leave. If you do not wish to disclose that you are transgendered then you could ask in general terms (e.g. How many days off can I have without a medical certificate, do I have a right to unpaid leave, am I entitled to take annual leave at half pay (e.g. 6 weeks off on half pay, if you can afford it)). You could also ask your HR department or manager - especially in the public sector where it's not as if it's their money.
Also, out of curiosity, are you presenting as the gender you intend to live as post surgery? I would assume so as the standards of care require it. If so and you are a MTF, you could talk to the surgeon and see what they could do in terms of a medical certificate. If you have a legitimate medical problem many doctors, in the interest of privacy, will write you a medical certificate that is deliberately vague. E.G. I, Dr X, will be performing necessary surgery on Nat xx date. She will require 4-5 weeks off to recover. Perhaps they could mention it is due to your reproductive system. Often a little bit of information is enough to satisfy most people. They'll still gossip but they won't have to pry any further.
Just some ideas.
Which country are you in, employment rights differ greatly between jurisdictions.