On the USS Voyager, one of the new innovations is the Emergency Medical Hologram, capable of treating any known injury or disease, as it was programmed with the medical knowledge of every member world in the Federation and that of over five million surgical procedures

Although his program was originally designed to function in emergency situations only, the Voyager's sudden relocation to the Delta Quadrant resulted in a large number of fatalities including the actual doctor on board, so The Doctor's program now runs on a full-time basis, effectively becoming Voyager's chief medical officer.

Over the course of the series, the character grew from an occasional comic relief to a full-fledged member of the crew becoming self-aware and gaining autonomous rights as a sentient being.

More Info: memory-alpha.fandom.com