Notwithstanding the provisions of Sections 4011 and 4011.5, when it appears that the prisoner in need of medical or surgical treatment necessitating hospitalization or in need of medical or hospital care was arrested for, charged with, or convicted of an offense constituting a misdemeanor, the court in proceedings under Section 4011 or the sheriff or jailer in action taken under Section 4011.5 may direct that the guard be removed from the prisoner while he or she is in the hospital. If that direction is given, any prisoner who knowingly escapes or attempts to escape from that hospital shall upon conviction thereof be guilty of a misdemeanor and punishable by imprisonment for not to exceed one year in the county jail if the escape or attempt to escape was not by force or violence. However, if the escape is by force or violence the prisoner shall be guilty of a felony and punishable by imprisonment pursuant to subdivision (h) of Section 1170, or in the county jail for not exceeding one year; provided, that when that second term of imprisonment is to be served in the county jail it shall commence from the time that prisoner would otherwise be discharged from that jail.
Ca. Pen. Code § 4011.7