update TousseInstance set isRoutine='是' where invoice_id is not null
and sterilizationRecord_id in (
	select sr.id from SterilizationRecord sr,TousseInstance ti where ti.sterilizationRecord_id=sr.id
	and (sr.biologyResult is null or sr.biologyResult<>'不合格')
	and (sr.biologicalMonitoringStartDate is null or sr.biologicalMonitoringEndDate<ti.invoiceSendTime)
) and (isRoutine is null or isRoutine<>'是');
update TousseInstance set isRoutine='否' where invoice_id is not null
and sterilizationRecord_id in (
	select sr.id from SterilizationRecord sr,TousseInstance ti where ti.sterilizationRecord_id=sr.id
	and (sr.biologicalMonitoringEndDate>ti.invoiceSendTime or sr.biologyResult='不合格')
) and (isRoutine is null or isRoutine<>'否');