A police officer has been killed after responding to a shooting at a central Pennsylvania hospital, officials say.