Shulchan Aruch (OC 230:4, as explained by Magen Avraham ibid. :6) paskens that when one undergoes a medical procedure he should say the following prayer:
יהי רצון מלפניך ה׳ אלקי שיהא עסק זה לי לרפואה כי רופא חנם אתה
(See further here regarding the text of this prayer.)
Does this apply to procedures such as X-rays, CT scans, MRIs, endoscopies, blood tests, and strep tests? On the one hand, they are all medical procedures. On the other hand, they don’t inherently perform relief for the patient; they merely give the doctor additional data he or she wouldn’t have otherwise, and based on that additional data, other medical treatments, for which the prayer is certainly necessary, would be prescribed. Do any poskim discuss whether such tests, meant for gaining more information rather than providing relief, are included in the above Halacha for which a prayer is necessitated?
judaism.stackexchange.com