1203.096.
(a) Upon conviction of any felony in which the defendant is sentenced to state prison and in which the court makes the findings set forth in subdivision (b), a court shall, in addition to any other terms of imprisonment, fine, and conditions, recommend in writing that the defendant participate in a counseling or education program having a substance abuse component while imprisoned.(b) The court shall make the recommendation specified in subdivision (a) if it finds that any of the following are true:
(1) That the defendant at the time of the commission of the offense was under the
influence of any alcoholic beverages.
(2) That the defendant at the time of the commission of the offense was under the influence of any controlled substance.
(3) That the defendant has a demonstrated history of substance abuse.
(4) That the offense or offenses for which the defendant was convicted are drug related.
(c) Upon conviction of any felony in which the defendant is sentenced to state prison and in which the court makes the findings set forth in subdivision (d), a court shall, in addition to any other terms of imprisonment, fine, and conditions, recommend in writing that the defendant
receive a mental health evaluation.
(d) The court shall make the recommendation specified in subdivision (c) if it finds that either of the following are true:
(1) That the defendant at the time of the commission of the offense was suffering from a serious mental illness.
(2) The defendant has a demonstrated history of mental illness.