Sorry, just had problems with local food and was off for some days=)
First you should identify instructive thoughts of terminal illness as instructive thoughts. I mean you have to be aware that by thinking these thoughts you will not fix any problem. And by consulting doctor Google you will not do it either. On the contrary you will make some problems by thinking. So just go to some diagnostics to be sure that you have no terminal illness. Then just forget about it. When thoughts come, remember that they are just obsessions, they are not connected to reality and gently redirect your attention someone else. Do it every time when thoughts come. Don't try break these thoughts with logic and thinking, it's useless, your mind will increase the obsession. What you have to do it's stop involving with your mind in these thoughts, just let them come and don't pay attention to them. It seems hard and it seems hard, but it would be easier if you meditate every day. By meditating you increase the power of your attention, you better control it and notice when new obsession come.