A hospital had introduced measures to combat a rise in respiratory illness in the community, including wearing face masks and changes to visiting.