San Francisco officials plan to spend nearly $23 million this year to improve safety at the city's public hospitals and clinics, a response to the fatal stabbing of a social worker by a patient.