You ask about what's allowed, which may not be the same as what's right or ethical. In the absence of some course and/or university policy (and/or state law) stating otherwise, the decision of whether or not to allow a student to retake a missed exam is entirely at the professor's discretion.
As a first step, you should check to see whether any such policy exists at your school or for your course. If one does, then you're in luck. Refer your professor to it. If they still don't come around, involve an advisor, department head, or similar third-party to resolve the duspute.
If there is no such policy, you'll need to shift your perspective a bit.
The default scenario at this point is that you've failed the midterm. That's the outcome you have if the professor simply sits there and does nothing.
So while it's true that the professor cannot legally require or otherwise compel you to waive doctor-patient confidentiality, it may also be true (barring any university policies in your favor) that you cannot require or compel the professor to let you retake the midterm. They can deny your request for any reason, or for none at all.
You've got a stalemate; the professor is almost certainly allowed to ask you to waive doctor-patient confidentiality, and you're certainly allowed to refuse. In which case the stalemate continues, and you're stuck with the default outcome of a failed midterm.
In essence, nobody is requiring anything. You missed an exam, and you want to be allowed to retake it. You may have a completely valid and reasonable excuse for missing the exam, but in the absence of any policy to the contrary whether or not you get to an exam is at the professor's sole discretion. You're asking the professor for a favor, and they're asking one back.
None of which means that the professor has been reasonable or fair or ethical if they've not accepted a genuine medical excuse at face value, or that the incident couldn't have negative repercussions for the professor if the details get out, or that you wouldn't find support if you took the matter higher up in the university food-chain.
But your question is about what the professor can do. And they can ask you to let them speak to your doctor, yes. They can't force you to, but they can sit on their hands and do nothing if you refuse. They shouldn't do that sort of thing, but without a university policy stating otherwise they almost certainly can.