I m not an expert but I think medical problem is out of your control that means its not your personal choice to leave your job but you are forced to do so due to a medical problem, so I dont think its gonna affect your visa and even if they investigate you will be covered with the documents from doctors