update invoicePlan set recyclingStatus = '待接收' where id in (select id from ForeignTousseApplication f where f.packagestatus = '待接收') and type = '外来器械包申请单' and endStatus is null; update invoicePlan set recyclingStatus = '已接收' where id in (select id from ForeignTousseApplication f where f.packagestatus = '已接收') and type = '外来器械包申请单' and deliverstatus = '待发货' and endStatus is null; update invoicePlan set recyclingStatus = '待回收' where id in (select id from ForeignTousseApplication f where f.packagestatus = '已接收') and type = '外来器械包申请单' and deliverstatus = '已发货' and endStatus is null; update invoicePlan set recyclingStatus = '已回收' where id in (select id from ForeignTousseApplication f where (f.packagestatus = '已回收' or f.packagestatus = '已归还')) and type = '外来器械包申请单' and deliverstatus = '已发货' and endStatus is null;