China keeps virus at bay at high cost ahead of Olympics