How pandemics shape healthcare systems