The Dunedin doctor accused of murdering 16-year-old Amber-Rose Rush treated patients after drinking and lied about his mother dying to escape being fired.
Venod Skantha, 32, is on trial at the High Court of Dunedin, charged with one count of murder and four of threatening to kill.
Southern District Health Board chief medical officer Dr Nigel Millar told the court on Tuesday Skantha missed three days of work in July 2017, saying he had a stomach bug.
On the third day, he told his supervisor his mother had died. The pair agreed to meet the following day to discuss matters.
But Skantha arrived at the hospital a day early.
Rather than leave when he discovered he had the date wrong, he went to the orthopaedic ward and treated a patient.
He flushed a woman's IV line, reattached it too tightly and then dated it with the wrong date - all while smelling of alcohol.
The woman was so concerned about his erratic behaviour, she asked if he was using normal saline.
The incident warranted an independent investigation, Millar said. During the investigation, Skantha admitted he had two beers at lunch.
The junior doctor very nearly lost his job. However, via his lawyer, Skantha said he was suffering from the unforeseen loss of his mother and Millar relented to a final warning.
"Had I known this was not true, I would have stayed with my original position [to fire him]," Millar told the court.
The prosecution argues Skantha murdered Rush in February 2018 after she threatened to go to his employer and the police with allegations about him supplying minors with drugs and alcohol.
She also accused him of touching her inappropriately.
Had these allegations reached his employer, he would have lost his job.
Skantha denies all four charges against him, and the trial continues.