Can a female patient undress before male doctors

Firstly, this problem can only be solved if women understand their roles and stand by them and understand that it is obligatory upon women to specialize so that there are enough female doctors/nurses to treat female patients. If there were enough female medical staff there would be no need for women to undress in front of male doctors, but the sad state of the nation is that we have been forced to live through a lot of circumstances due to necessity.

Secondly, it is widespread in our communities that female doctors are incompetent. This has spread so far that women themselves believe this, when the reality is that this generalization is not true. There are many female doctors who are competent, and it is simply rumour which spread the opposite.

Thirdly, if we are certain or it has come to our attention that so and so female doctor isn’t trustworthy, then we should search for another female Muslim doctor, if we cannot find a female Muslim doctor, then we should search for a non Muslim female doctor, if we cannot find a non-Muslim female doctor then we should search for a trustworthy, male, Muslim doctor, if you find him untrustworthy then search for a trustworthy, male, Muslim doctor, and if you still cannot find a trustworthy Muslim doctor then you may look for a trustworthy non-Muslim male doctor.  

This order has been made by the compilation of Islamic fiqh and here is the concerning text:

If a specialist female doctor has been provided then she should perform the diagnosis on the female patient, and if there isn’t a female doctor available for this then a trustworthy non-muslim female doctor should perform the diagnosis, and if there isn’t a non-muslim female doctor then it should be done by a male muslim doctor, and if there isn’t a male muslim doctor then it is permissible for a non-muslim male doctor to perform the check up, and he shouldn’t look at the woman’s body unnecessarily to his best capability when performing the checkup, and he should not go beyond this and should turn away as much as he is able to. The checkup should be done in the presence of a -mahram- or her husband or another woman so that the patient may not fear being alone in the presence of the male doctor.