Chief medical officer
The chief medical officer (CMO), first medical officer, senior medical officer, ship's physician, or ship's surgeon was senior staff-level medical practitioner with medical authority who was, by definition, "in command of medicine on [their assigned posting]." ()

A nurse could also hold this position if no qualified doctors were available. ()

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 were eligible to take the Bridge Officer's Test for promotion to full commander, which was not required for their CMO position. At this point, they were considered capable of assuming command of a starship. ()

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 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 the normal duties of an officer, Starfleet Order 104, Section C gave CMOs the power to relieve an officer or crewman, including a superior one, of their duties if in the CMO's professional judgment, the officer 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 was expected 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 captain who was later found to not have become unfit. (; ; )

The chief medical officer was able to impose medical physicals upon crewmembers if the mission lasted more than two weeks. ()

The CMO also seemed to have the authority to order officers to do things that would be beneficent to their health, like sleeping. ()

In the 23rd century, chief medical officers certified the health of research personnel on alien planets on a yearly interval. ()

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. ()

List of chief medical officers 
Named
 Dr. Sarah April
  (2245- before 2254)
 Dr. Julian Bashir
 Station Deep Space 9 (2369-)
  (2371-2375)
  (2375-)
 Dr. Phil Boyce
  (2254)
 Dr. 
  (2268)
 Dr. Christine Chapel
  (briefly as a nurse in 2269 (); 2270s)
 Dr. Arthur Coleman
 Ship unknown
 Dr. Beverly Crusher
  (2364, 2366-2371)
  (2372-2379)
 The Doctor
  (2371-2378)
 Dr. Frame
  (2375)

 Kee-Bhor
  (2369)
 Dr. Elizabeth Lense
  (2369-)
 Dr. Joseph M'Benga
  (2259)
 Dr. Leonard McCoy
  (2266-2270, 2270s-2285)
  (2286-2293)
 Dr. Moran 
  (2346)
 Dr. Phlox
  (2151-2161)
 Dr. Mark Piper
  (2265)
Dr. Katherine Pulaski
  (?-2365)
  (2365)
Dr. Martin Rackham
 
 Sulan 
 Chief surgeon of the Vidiian Sodality (2371)
Dr. T'Ana
  (2380-)

Unnamed
 Ship's surgeon of the  
 Medical officer of the 
 Chief medical officer of the

Alternate timelines and parallel universes 
Dr. 
 (2154)
Dr. Puri
 (2258)
Dr. 
USS Enterprise (2258-2263)
 (2263)
 (2260s)
Dr. 
 (2267)
Dr. Alyssa Ogawa
 (2370)

Appendices

See also 
 Senior medical director

Apocrypha 
Decipher's Customizable Card Game states that the ill-fated lieutenant commander who was chief medical officer of the USS Voyager was named Fitzgerald. The ization of  also listed him as Fitzgerald.
There have been several other chief medical officers of note in non-canon Star Trek stories, such as novels and comics:
Dr. 
 in Star Trek: Stargazer
Dr. 
 in 
Dr. 
 in Star Trek: Starfleet Corps of Engineers
Dr. Thaddeus Quint
  in Star Trek: Borg
Dr. 
 in Star Trek: Titan
Dr. 
 in Star Trek Online
Dr. 
 in Star Trek: New Frontier
Dr. 
 in The Lives of Dax

External link

cs:Hlavní lékař
de:Erster Medizinischer Offizier
fr:Médecin-chef
it:Primo ufficiale medico
ja:医療部長
nl:Hoofd der medische dienst
ru:Главный врач
Titles
Medical occupations