update GoodPurchaseItem set disposableGoodsId = (select id from DisposableGoods where GoodPurchaseItem.name= case when specification is null then name else name + '['+ specification +']' end)
where disposableGoodsId is null;

update GoodPurchaseItem set materialDefinitionId = (select id from MaterialDefinition where GoodPurchaseItem.name= case when specification is null then name else name + '['+ specification +']' end)
where materialDefinitionId is null;

update TousseDefinition set ancestorID=id where tousseType in ('器械包','敷料包') and ancestorID is null;
update TousseDefinition set ancestorID=id where tousseType in ('消毒物品') and forDisplay='1' and ancestorID is null;

select id , name into temp  from TousseDefinition where tousseType in ('消毒物品') and forDisplay='1';
update TousseDefinition set ancestorID=(select id from temp where name=TousseDefinition.name) where tousseType in ('消毒物品') and forDisplay='0' and ancestorID is null;
drop table temp;