Chief Medical Officer

The Chief Medical Officer (CMO), ship's physician, or ship's surgeon, was a senior staff-level medical practitioner with medical authority who was, by definition, "in command of medicine on [their assigned posting]." ()
A nurse practitioner could also hold this position if no qualified doctors were available (). Though, this was extraordinary rare, only usually happening for brief periods of time during medical emergencies or deep-space missions.
== Typical ranks ==
Chief medical officers have held a variety of ranks. They could hold any rank from lieutenant junior grade to lieutenant commander (; ). 
Chief medical officers could even hold the rank of commander, though this rank was not required by any means for the CMO position. This rank could be achieved by passing the Bridge Officer's Test at which point they were promoted to the rank of full commander. Upon promotion to full commander, chief medical officers were considered capable of assuming command their posting, whether it be a ship, starbase, or other installation ().
== Specific duties ==
Chief medical officers aboard a starship or starbase were directly in charge of the sickbay or infirmary, commanding Medical department personnel and activities. The CMOs' primary duties were the oversight and maintenance of the overall health, physical, and mental fitness of crew and passengers (). Furthermore, as a standard medical procedure, the CMO had full medical authority over any patient officially admitted into their care in their facility, including superior officers, until they were formally released from care (; ).
Officers likely to be assigned as the CMO over long-duration missions of exploration had scientific training in disciplines outside of medicine, allowing them to take on major, extended research projects, or to better participate in a wider variety of encounters.
== Medical authority ==
According to Starfleet's handbook on personal relationships, "All Starfleet personnel must obtain authorization from their CO, as well as clearance from their Medical Officer, before initiating an intimate relationship (or intimate relations) with an alien species." Such a waiver also required the captain's approval (). 
In addition to normal duties of a officer, Starfleet Order 104, Section C, gave chief medical officers the power to relieve an officer or crewman, including a superior one, of their duties if in the CMO's professional judgment, the individual in question was medically unfit. The CMO in question would need to officially certify and provide evidence of unfitness at a subsequent board of inquiry (; ). Typically, the CMO would expect to have the support of a senior command officer or detailed medical documentation to justify this course of action. Geordi La Forge noted that this could blow back on the CMO in question if they used this power to remove a commanding officer who was later found to not have become unfit (; ; )
The chief medical officer was able to impose medical physicals upon crew members if the mission lasted more than two weeks ().
The CMO also seemed to have the authority to order individuals to do things that would be beneficent to their health, like sleeping ().
In an alternate timeline on Stardate 51425, The Doctor cited Starfleet Medical Regulation 121, Section A in an attempt to relieve Captain Kathryn Janeway of her command. She refused his order, stating that he had no way to actually "implement this protocol". He countered, by saying that he would note the incident in his official log, and that it could lead to her general court martial (). Due to the nature of this alternate timeline, Starfleet Medical Regulation 121, Section A certainly exists and the refusal of any Starfleet personnel of this order is a court-martial offence.