update TousseDefinition set includeImplant=0
where id in (
	select distinct case when md.isImplant='是' then td.id else 0 end
	from TousseDefinition td
	inner join MaterialInstance mi on mi.tousse_id=td.id
	inner join MaterialDefinition md on md.id=mi.materialDefinition_id
);
update TousseDefinition set includeImplant=1
where id not in (
	select distinct case when md.isImplant='是' then td.id else 0 end
	from TousseDefinition td
	inner join MaterialInstance mi on mi.tousse_id=td.id
	inner join MaterialDefinition md on md.id=mi.materialDefinition_id
);