Venod Skantha lied about the death of his mother - a lie which ultimately saved his job, the High Court at Dunedin has heard.
The 32-year-old denies murdering 16-year-old Amber-Rose Rush in February last year.
The Crown says he stabbed her to death shortly before midnight on 2 February to stop her coming forward to the police and his employer, the Southern DHB, with claims he was "touching up" minors, supplying them alcohol and offering money for sex.
A key prosecution witness, a teenager with name suppression, says he drove Mr Skantha to Miss Rush's address on the night of her murder and gave him the location of a spare key to enter her house.
The defence says that witness is responsible for stabbing the 16-year-old.
Today, Southern DHB chief medical officer Nigel Millar told the court Mr Skantha was issued with a final warning after an incident in early July 2017.
Mr Skantha worked for Southern DHB between May 2016 and May 2018, when he resigned three months after his arrest for Miss Rush's murder.
Mr Millar said Mr Skantha called in sick three days in a row between 3 and 5 July, 2017.
On the third day he contacted his supervisor and claimed his mother had died and asked for a meeting the following day.
Instead he showed up to Dunedin Hospital that day, Mr Millar said.
When his supervisor was unavailable, he went to the orthopaedic department where he worked and flushed the IV line of a patient.
Mr Skantha was emotional and took his two friends into the patient's room, Mr Millar said.
"Whilst it cannot be proved that he was affected by alcohol at the time of treating the patient, he injected the saline knowing he had two beers at lunch.
"The patient describes Skantha as acting strangely."
A subsequent investigation found Mr Skantha's behaviour amounted to multiple breaches of the Southern DHB's code of conduct, including serious misconduct.
Mr Millar said his preliminary decision was to dismiss Mr Skantha for his actions, but he backed down after being contact by Mr Skantha's lawyer saying such a course of action would be unfair considering the recent loss of his mother.
It later emerged Mr Skantha had lied about his mother's death.
Smartphone evidence
The jury also heard from a police digital forensic analyst, Bevin Pelvin.
Mr Pelvin reconstructed Miss Rush's phone after it was discarded into a swamp at Blackhead Quarry, just outside of Dunedin.
Data extracted from the phone included a photo taken at 12.01am on 3 February.
The Crown case is her last use of the phone was 11.53pm on 2 February, when she messaged her boyfriend on social media.
The Crown says she was killed before midnight.
The court was shown the image, which was extremely dark with some light in the centre.
Prosecutor Richard Smith asked Mr Pelvin if Miss Rush's smartphone allowed the use of its camera without accessing the rest of its functions.
Mr Pelvin said he was not sure if Miss Rush's phone had such a function, but he was aware many smartphones did.
Metadata from the photo suggested it was taken on the pavement of outside of 99 Clermiston Avenue, just a few metres down the road from where Miss Rush lived.
Mr Pelvin said the GPS data could not be considered 100 percent reliable.
The prosecution's key witness earlier told the trial Mr Skantha emerged from Miss Rush's home with her phone and tried to smash it on the pavement.
Mr Pelvin also gave evidence that location history on Mr Skantha's phone was missing for 2 and 3 February 2018.
"In my opinion it's either been turned off or deleted," he said.