Having an ultrasound to examine the ovaries during the day in Ramadan
It is permissible for the sick person not to fast in Ramadan and to make up the days that he did not fast, because Allah says (interpretation of the meaning): “and whoever is ill or on a journey, the same number [of days which one did not observe Sawm (fasts) must be made up] from other days. Allaah intends for you ease, and He does not want to make things difficult for you” [al-Baqarah 2:185]. Istihaadah (irregular vaginal bleeding) and ongoing bleeding is a kind of sickness that affects the mind and body, hence there is nothing wrong with carrying out an examination on which the treatment will be based, even if that means that you have to break the fast during the day in Ramadan, although it is better to delay it until night if that is possible.
It should be noted that x-rays and ultrasounds do not break the fast in and of themselves, so long as the patient does not consume any drink or medicine through the mouth or nose.
In the answer to question 2299 we have explained in detail the things that do and do not break the fast of one who is fasting. Please refer to this question.
If the examination requires drinking water or taking medicine, and it is possible to do that before Fajr, then do that. Otherwise it is permissible for you to break the fast.
The maximum length of menses according to most of the scholars is 15 days, and it is not possible for it to be any longer than that. Based on that, what the doctor told you is correct, that the bleeding you are experiencing is istihaadah and not menstrual blood. For information on the ruling on istihaadah and when the blood is menses, please see the answer to question number 68818.
And Allah knows best.