Index: ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/toussedefinition/service/TousseInstanceManagerImpl.java =================================================================== diff -u -r18764 -r18819 --- ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/toussedefinition/service/TousseInstanceManagerImpl.java (.../TousseInstanceManagerImpl.java) (revision 18764) +++ ssts-tousse/src/main/java/com/forgon/disinfectsystem/tousse/toussedefinition/service/TousseInstanceManagerImpl.java (.../TousseInstanceManagerImpl.java) (revision 18819) @@ -685,10 +685,11 @@ sql += " and po.reviewTime <= " + dateQueryAdapter.dateAdapter(endDate + " 23:59:59"); } - if (StringUtils.isNotBlank(orgUnitCode)) { //本科科室的器械包实例,外部代理的器械包实例,代理灭菌的一些器械包实例 - sql += " and (po.orgUnitCoding = '" + orgUnitCode - + "' or (po.orgUnitCoding != '" + orgUnitCode - + "' and po.foreignProxyItem_id is not null) or po.proxyDisinfection_id is not null) "; + if (StringUtils.isNotBlank(orgUnitCode)) { //本供应室处理的器械包实例,但是录入代理灭菌单的器械包实例(只有代理科室才能灭菌) + sql += " and (" + + "(po.proxyDisinfection_id is null and po.orgUnitCoding='"+orgUnitCode+"' and po.orgUnitCoding in (select cht.orgUnitCode from CssdHandleTousses cht where cht.tousseDefinitionId=po.tousseDefinition.ancestorID)) or " + + "(po.proxyDisinfection_id is not null and po.proxyDisinfection_id in (select ip.id from InvoicePlan ip where ip.handleDepartCoding='"+orgUnitCode+"'))" + + ") "; } if (StringUtils.isNotBlank(searchKeyWord)) { //按关键字检索(器械包名称,拼音码,五笔码) sql += " and (po.tousseName like '%" + searchKeyWord + "%' " @@ -883,10 +884,12 @@ + "where t.id = b.id and tt.tousseDefinitionId=td.ancestorID and t.tousseDefinition_id=td.id and t.reviewBasket_id =" + reviewedBasket.getId() + " and t.comboTousseInstanceId is null and td.tousseType in ('"+TousseDefinition.PACKAGE_TYPE_INSIDE+"','"+TousseDefinition.PACKAGE_TYPE_DISINFECTION+"','"+TousseDefinition.PACKAGE_TYPE_DRESSING+"','"+TousseDefinition.PACKAGE_TYPE_COMBO+"') " - //注意:别忘了提别的供应室代理灭菌的一些器械包 -// + " and t.orgUnitCoding='"+currentOrgUnitCode+"'" - + " and (t.orgUnitCoding='"+currentOrgUnitCode+"' or t.proxyDisinfection_id is not null) " - + " and tt.orgUnitCode='"+currentOrgUnitCode+"'" + //本供应室处理的器械包实例,但是录入代理灭菌单的器械包实例(只有代理科室才能灭菌) +// + " and t.orgUnitCoding='"+currentOrgUnitCode+"' and tt.orgUnitCode='"+currentOrgUnitCode+"'" + + " and (" + + "(t.proxyDisinfection_id is null and t.orgUnitCoding='"+currentOrgUnitCode+"' and tt.orgUnitCode='"+currentOrgUnitCode+"') or " + + "(t.proxyDisinfection_id is not null and t.proxyDisinfection_id in (select ip.id from invoicePlan ip where ip.handleDepartCoding='"+currentOrgUnitCode+"'))" + + ")" + " and t.status <> '" + TousseInstance.STATUS_DISCARD + "'"; if(StringUtils.isNotBlank(taskGroup)){