When the medical officer of, or any physician, physician assistant or advanced practice registered nurse employed in, any correctional or charitable institution reports in writing to the warden, superintendent or other officer in charge of such institution that any inmate thereof committed thereto by any court or supported therein in whole or in part at public expense is afflicted with any sexually transmitted disease so that such inmate’s discharge from such institution would be dangerous to the public health, such inmate shall, with the approval of such warden, superintendent or other officer in charge, be detained in such institution until such medical officer, physician, physician assistant or advanced practice registered nurse reports in writing to the warden, superintendent or officer in charge of such institution that such inmate may be discharged therefrom without danger to the public health. During detention the person so detained shall be supported in the same manner as before such detention.