Penal Code PC § 2685
Upon the receipt of a prisoner, as herein provided, the superintendent of the state hospital shall notify the Director of Corrections of that fact, giving his name, the date, the prison from which he was received, and from whose hands he was received. When in the opinion of the superintendent the mentally ill, mentally deficient or insane prisoner has been treated to such an extent that such person will not benefit by further care and treatment in the state hospital, the superintendent shall immediately notify the Director of Corrections of that fact. The Director of Corrections shall immediately send for, take and receive the prisoner back into prison. The time passed at the state hospital shall count as part of the prisoner’s sentence.