A woman who punched a police officer in the privates at a hospital after being arrested on suspicion of domestic assault has avoided jail.