update Invoice set isPrint = '是' where ((select count(*) from InvoiceItem po1 where po1.invoice_id = Invoice.id and po1.isPrint = '是') + (select count(*) from TousseInstance po2  where (po2.invoice_id=Invoice.id or po2.invoice2_id=Invoice.id) and po2.status in('已灭菌','已废弃')))=(select sum(po3.amount) from InvoiceItem po3 where po3.invoice_id = Invoice.id and po3.tousseDefinitionId in (select tousseDefinition_id from TousseInstance where (invoice_id=Invoice.id or invoice2_id=Invoice.id))) and isPrint = '部分打印';