I am going to suggest three different routes through which you can look at this question.
The first is a Kantian route. Kant develops a moral theory around the idea that we are rational free creatures. For him, to act morally is to act rationally. Practically, this happens by acting in accordance with duty. For Kant, there are perfect and imperfect duties that attach to being the sort of creatures we are. Perfect duties describe those obligations that we can arrive at by excluding what is self-contradictory or contradictory in a world with the laws of nature (I am simplifying by leaving out some other formulations). Imperfect duties are those obligations that follow from our nature as fragile beings.
The question you are asking falls under the realm of imperfect duties for Kant. This can be shown as follows: if everyone became a medical doctor, then your becoming a medical doctor would not contribute to the alleviation of suffering (since presumably there would be an excess of medical care), therefore there's no perfect duty that people become medical doctors. Imperfect duties, by contrast, work on human limitations, viz., that we will all need help. This creates two types of obligations: (1) to improve yourself and (2) to provide aid in some circumstances. Here, the primary question relates to (1) but also touches on (2).
From a Kantian perspective, you have freedom in how you go about improving yourself and also in how you provide aid, but you are obligated to do both. Thus, there's no clear Kantian reason why you should pursue medicine over string theory. At the same time, if string theory is a talent you think cannot be of use to others, you will need to find other ways of helping others.
We can also look at your question in terms of a virtue theory approach to moral decision-making. The word "virtue" can be confusing in meaning due to its long history. In this type of approach, the goal is to maximize your human potential and through this to flourish (the Greek concept is eudaimonia). In order to do so, you must be committed to some idea of human potential. Thus, you would need to look at where your specific abilities lie and how you could maximize your humanity through them.
This would not be limited merely to your mental abilities. In other words, on this perspective, it matters if you would have to be an unhappy but effective doctor versus a highly effective and happy computer systems analyst. Moreover, you need to look at whether you are flourishing not just in areas you want to but in others like generosity and friendship. Moreover, depending on the type of virtue ethics we are referring to, your goal might also need to include the flourishing of your community.
On such a perspective, if concerns about whether you would enjoy such a life weigh heavily, you are probably better off not being a doctor -- as there's no specific requirement that you flourish in this way. (Save that you live in an obscure community where its flourishing requires you to become its doctor).
A further way of looking at this problem which seems close to some of the remarks you make is utilitarianism or its more contemporary cousin consequentialism. In both cases, your goal is to maximize or minimize some unit. In Peter Singer's contemporary version, this would be minimizing suffering. In John Stuart Mill's classical version, the goal is to maximize happiness.
At a first glance, it seems that on such an analysis the moral thing to do would be to pursue the career that can help the most people. But this is not necessarily the case. There are several reasons why. First, there is a distinction between acts that are obligatory ("you must do") and acts that are superogatory ("doing so means you're a great person worthy of praise"). If being a computer programmer would contribute to increasing the good, then it's not entirely clear that it is wrong to be one -- unless the version is severe to the point of always requiring you to maximize the good.
Second, many consequentialist accounts work by coming up with rules that would maximize the good rather than calculating every time. (We don't want to weigh whether it would make people happier or not every time we are deciding to kill someone , so we just evaluate the problem generally). So then, it's going to depend on certain calculations about how such acts will impact society generally.
Third, a utilitarian approach would also need to factor in how this choice will effect your productivity. In other words, a depressed doctor who sees one patient a year probably provides less good than a happy mathematician whose work dramatically improves our ability to deliver food around the world through his equations.
All of that to say, philosophy in generic terms cannot tell you that you must become a doctor. But it can give you tools to look at this problem in several different ways. And on most analyses, you are in no way required to become a doctor rather than a mathematician but it might be a noble choice to make in order to help others.