update ForeignTousseApplication  set tousseName = (select min(i.tousseName) from TousseItem i where i.recyclingApplication_ID = ForeignTousseApplication.id) where tousseName is null;
update BeCleanItem set itemType='外部代理灭菌' where itemType='外来代理灭菌';
update ClassifiedItem set itemType='外部代理灭菌' where itemType='外来代理灭菌';
update ForeignProxyItem set tousseType='外部代理灭菌' where tousseType='外来代理灭菌';
update InvoiceItem set tousseType='外部代理灭菌' where tousseType='外来代理灭菌';
update PackingRecord set tousseType='外部代理灭菌' where tousseType='外来代理灭菌';
update RecallRecord set type='外部代理灭菌' where type='外来代理灭菌';
update TousseDefinition set tousseType='外部代理灭菌' where tousseType='外来代理灭菌';
update TousseItem set tousseType='外部代理灭菌' where tousseType='外来代理灭菌';

update TousseDefinition set isApplyEntireTousse = isCleanedEntirely where isApplyEntireTousse is null and tousseType = '消毒物品';
update TousseItem set isApplyEntireTousse = (select t.isApplyEntireTousse from TousseDefinition t where t.id = TousseItem.tousseDefinitionId) where tousseType = '消毒物品';
update TousseItem set isCleanedEntirely = (select t.isCleanedEntirely from TousseDefinition t where t.id = TousseItem.tousseDefinitionId) where  tousseType != '一次性物品';
update Tousseitem set isThereIdentificationCard = '否' where tousseType != '一次性物品';
update tousseitem  set isThereIdentificationCard = '是' where tousseDefinitionId in (
select d.tousseDefinitionID from IDCardInstance i,IDCardDefinition d,TousseDefinition t where i.idCardDefinitionID = d.id and t.id = d.tousseDefinitionID 
and d.deleted = 0 and (t.isDisableIDCard = '否' or t.isDisableIDCard is null) group by d.tousseDefinitionID having count(*) > 0 );