State hospital or treatment facility personnel may treat a patient with prescribed medication or a less restrictive alternative if, in the opinion of a psychiatrist or physician, these treatments are necessary to prevent bodily harm to the patient or others or to prevent imminent deterioration of the respondent’s physical or mental condition and there is not time to obtain a court order. This chapter does not prohibit a hospital from rendering emergency medical care without the need for consultation, if in the exercise of sound medical judgment that care is immediately necessary and delay would endanger the life of or adversely and substantially affect the health of the patient.