It is very important to note that having x-rays done does not affect the fasting unless the patient is told to eat or drink something. Touching a non-mahram woman does not invalidate the ablution according to the correct view.

Sheikh M. S. Al-Munajjid, a prominent Muslim Saudi lecturer and author, states the following:

First, having x-rays done does not affect the fasting, and it is not regarded as one of the things that invalidate the fasting, unless the patient takes medicine or is told by the doctor to eat or drink something before the x-ray (or other procedure), in which case the fast is broken because of eating or drinking.

Second, carrying out the examination does not affect the fasting of the one who does it. Concerning touching a woman, the correct scholarly view is that touching a non-mahram woman does not invalidate ablution. It is not permissible for a man to treat a non-mahram woman or vice versa except in cases of necessity, and necessity should be evaluated in a proper manner.