That's a great photo.
I'm sorry you had a run-in with security. They need to be informed that they are violating your Constitutional rights. Yup, as part of Freedom of Speech, you have the right to take photos in a public place. The train buffs have pushed that successfully, that police can not ban people from taking photos in public places. You are in a public place when you are outside of the hospital, there is no expectation of patient privacy that is covered under HIPAA. If questioned again, ask them to provide, in writing, information on exactly what law you are violating - they won't be able to do it.
This is not to condone arguing with police/security under any circumstances. But you do have rights, and they can't just make up laws that simply don't exist.
Great photo. Oh, I said that already!