From what we've seen across Star Trek, Doctors only outrank captains when it comes to matters of the Captain's health, or presumably if the health of the crew is at stake and the Captain's orders foolishly jeopardize the crew (not dividing the ship in "Final Mission" and jeopardizing over 1000 people with fatal radiation exposure when it wasn't necessary or there were other options should've gotten Riker & Dr. Crusher court-martialed. That was one of the stupidest decisions made by a command officer in all of Star Trek, above even letting the Doctor leave Voyager for a full month in "Life Line". Gee, lucky nothing bad happened like a Borg attack, Borg who were known to be in the area a few months behind them and shortly ahead of them). We often see a captain ordering a doctor to revive an alien patient who is seriously injured and needs rest & recovery because they want answers now. It might be interesting for everyone to map out where the borders are between a doctor's authority over a captain and a captain's authority over a doctor in medical matters which might contradict their hippocratic oath.