When there's danger to life, the mind naturally focuses on the danger until the situation resolves.
We all must learn to manage our own thoughts and stay productive. It will help you to get a few physicians' opinions about your prognosis, and good or bad, make plans to make the rest of your life meaningful. Anything from an rx to a short course of cbt may be helpful. Be strong & good luck.