Consent is a large part of the equation with your doctor analogy. If I'm going to the doctor for an issue pertaining to, or in the area of, my genitalia, I'm walking into that examination knowing where it will go.
If I'm having pain in a testicle, I know that the doctor is going to touch my genitalia. If I'm having pain in my throat, however, I can't imagine a circumstance where a doctor could convince me that he or she needs to examine my genitalia. If the doctor forces the issue, or performs the exam without my knowledge or consent (anesthesia, for example), I'm feel like I'd be able to argue that I was sexually assaulted. The reason is that an exam of that type wouldn't be reasonably expected based on my symptoms. If a doctor had reason to perform the exam, then a) I'd most likely be informed, and b) it would no longer meet your "without medical necessity" requirement.
Also, I really doubt many doctors are in medicine to be able to fondle their patients. I know it's a common joke that men go into gynecology to be able to grope women, but the level of commitment required to get through medical school in order to do it is huge compared to the expected non-medical "benefits." I think there was an AMA on reddit a while ago, and I know I've read articles about this before, which said that you sort of get sick of seeing so much vagina. It's like working at a mint, the sort of person who sees the newly minted cash as cash and not "just the product" after their first week is the sort of person that doesn't keep their job long.
The same can't be said of the TSA. I don't know how apocryphal the references are, since I'm not American, but reddit has me believing that TSA screeners have roughly the same qualifications as the average McDonald's employee. You certainly don't need a college degree to get the job. This leaves open the possibility of people taking the job mainly for sexual satisfaction. Again I'm reference apocryphal reddit anecdotes, but there was a post recently about a guy whose whole strategy for getting through security was to stand directly behind the hottest girls in line, because they tended to be "randomly" pulled into the scan-or-grope line.