That raises an interesting question. Do officers in the military who are doctors get referred to by their rank or simply as Dr.?
M*A*S*H would be a good guide on this. It depends how gung-ho the particular officer is.
Are they in it to be a doctor or military?
Maybe less "military" in 24th century Starfleet though.
Sam Carter wasn't called Dr. Carter on stargaze despite having a Ph.D.