That raises an interesting question. Do officers in the military who are doctors get referred to by their rank or simply as Dr.?
"Doctor," most of the time. My dad was a Major in the Army Medical Corps and he said that he was never referred to by his rank, always Doctor.
I'm sure there are certain unusual situations where the rank might be used, but he never encountered any in his time of service. And (unlike in Starfleet, apparently) he would not be in the chain of command, and would not normally be able to give orders to more junior officers. For example if he'd been a Navy doctor and serving on a ship, he would not be in that ship's chain of command. Not even if an emergency happened and all the senior officers were incapacitated - he'd have to take orders from even the greenest Ensign on board. Only line officers can give orders - doctors can't. Except when medicine/health issues are involved. Apparently Starfleet differs from this, since we've seen Crusher and Troi (and even Bashir) give orders that have nothing to do with their medical roles.