To further this analogy, what if you went to the onsite barista and when you ordered your coffee the barista told you that you're allergic to one of the seasonings. That's helpful and relevant and I think this is where most people start panicking but if the Dr has a Lot of accountability which is what the top comment is suggesting is the main concern, then you will know that the Dr isn't sharing full medical history but rather just what is relevant, your allergies. This is convenient, and in my imaginary scenario just saved the person from a lot of trouble. Also in this imaginary scenario the patient opted-into this sharing of knowledge.
I know this may not be a popular opinion, please share why instead of down voting me. I'm eager to learn and a down vote won't help me :P