In all the Star Trek series the medical bay is a large, open area where the doctor talks to and examines the patient, where just about anyone can walk in uninvited, and often does. Sometimes confidentiality is discussed and the doctor always says "Of course what you're telling me/your condition is confidential", but unless this is explicitly mentioned it can't be assumed. So, why no automatic confidentiality for everybody when in real society it is a breach of medical ethics to talk about a patient without their permission?
We are talking about a medical station in a naval context here. I guess that privacy isn't that great a concern in the military (which ST is in large parts modelled after).
See for example this picture from the USS Yorktown.
Well I have 2 explanations.
1)It's still more or less military organization, that operates in extremely dangerous environment. When your chief engineer starts having blackouts, it's not just his issue. The dude fiddles with anti-matter generator and warheads and his actions can cost hundreds of lives, including civilians. And things like work ethics can shift.
2) It's still TV show. Yes I know it's lame, but some plots are too stupid to deserve any in-lore explanation what so ever and medical drama tends to be on that list. Star Trek always struggled with it's continuity and some changes were literally changed on whim.