Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManagerImpl.java =================================================================== diff -u -r30802 -r30837 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManagerImpl.java (.../InvoicePlanManagerImpl.java) (revision 30802) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManagerImpl.java (.../InvoicePlanManagerImpl.java) (revision 30837) @@ -1761,6 +1761,7 @@ InvoicePlan.RECYCLINGSTATUS_AWAITRECYCLE, InvoicePlan.RECYCLINGSTATUS_PARTRECYCLE, InvoicePlan.RECYCLINGSTATUS_AWAITRECEIVE, + InvoicePlan.RECYCLINGSTATUS_PARTAWAITRECEIVE, InvoicePlan.RECYCLINGSTATUS_TALLIED }; whereSql += " and po.recyclingStatus in('" + StringUtils.join(recycleStatus, "','") + "')"; @@ -1779,7 +1780,7 @@ if(StringUtils.isNotBlank(applicationType)){ if(FOREIGNTOUSSE_APP_AWAITRECEIVE.equals(applicationType)){ whereSql += " and po.type = '" + InvoicePlan.TYPE_FOREIGNTOUSSEAPPLIACTION + "'"; - whereSql += " and po.recyclingStatus = '" + InvoicePlan.RECYCLINGSTATUS_AWAITRECEIVE + "'"; + whereSql += " and po.recyclingStatus in( '" + InvoicePlan.RECYCLINGSTATUS_AWAITRECEIVE + "','"+ InvoicePlan.RECYCLINGSTATUS_PARTAWAITRECEIVE +"')"; }else if(FOREIGNTOUSSE_APP_AWAITRECYCLE.equals(applicationType)){ whereSql += " and po.type = '" + InvoicePlan.TYPE_FOREIGNTOUSSEAPPLIACTION + "'"; whereSql += " and po.recyclingStatus = '" + InvoicePlan.RECYCLINGSTATUS_AWAITRECYCLE + "'"; Index: ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/invoicemanager/InvoicePlan.java =================================================================== diff -u -r30137 -r30837 --- ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/invoicemanager/InvoicePlan.java (.../InvoicePlan.java) (revision 30137) +++ ssts-basedata/src/main/java/com/forgon/disinfectsystem/entity/invoicemanager/InvoicePlan.java (.../InvoicePlan.java) (revision 30837) @@ -201,8 +201,11 @@ * 外来器械申请单专用状态,待接收 */ public static final String RECYCLINGSTATUS_AWAITRECEIVE = "待接收"; - /** + * 外来器械申请单专用状态,部分接收 + */ + public static final String RECYCLINGSTATUS_PARTAWAITRECEIVE = "部分接收"; + /** * 外来器械申请单专用状态,已接收 */ public static final String RECYCLINGSTATUS_AWAITRECEIVED = "已接收"; Index: ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/service/RecyclingRecordManagerImpl.java =================================================================== diff -u -r30680 -r30837 --- ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/service/RecyclingRecordManagerImpl.java (.../RecyclingRecordManagerImpl.java) (revision 30680) +++ ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/service/RecyclingRecordManagerImpl.java (.../RecyclingRecordManagerImpl.java) (revision 30837) @@ -29,8 +29,10 @@ import org.apache.commons.collections.MapUtils; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.Predicate; +import org.apache.commons.collections4.PredicateUtils; import org.apache.commons.collections4.map.MultiValueMap; import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.BooleanUtils; import org.apache.log4j.Logger; import com.forgon.Constants; @@ -4469,11 +4471,91 @@ ForeignTousseApplication ftApplication = (ForeignTousseApplication)application; String oldRecyclingStatus = ftApplication.getRecyclingStatus(); //外来器械接收器械包时回收记录不关联申请单 - if(InvoicePlan.RECYCLINGSTATUS_AWAITRECEIVE.equals(oldRecyclingStatus)){ - ftApplication.setRecyclingStatus(InvoicePlan.RECYCLINGSTATUS_AWAITRECEIVED); + if(InvoicePlan.RECYCLINGSTATUS_AWAITRECEIVE.equals(oldRecyclingStatus) || InvoicePlan.RECYCLINGSTATUS_PARTAWAITRECEIVE.equals(oldRecyclingStatus)){ + Predicate terminatePred1 = new Predicate() { + @Override + public boolean evaluate(TousseItem vo) { + return (BooleanUtils.isTrue(vo.getIsTerminated())); + } + }; + /* 计算回收状态 */ + // 需回收的物品,包括已终止的 + Collection needRecycleTousseItemsIncludeTerminated = CollectionUtils + .select(application.getApplicationItems(), + new Predicate() { + @Override + public boolean evaluate(TousseItem tousseItem) { + if(tousseItem.disposable()) + return false; + + String tousseName = tousseItem.getTousseName(); + if(StringUtils.isBlank(tousseName)) + return false; + if(TousseDefinition.STR_NO.equals(tousseItem.getIsRecycling())) + return false; + + switch(tousseItem.getTousseType()){ + case TousseDefinition.PACKAGE_TYPE_DRESSING: + return false; + case TousseDefinition.PACKAGE_TYPE_HOMEMADE: + return false; + } + return true; + } + }); + + // 需回收的物品,不包括已终止的 + Collection needRecycleTousseItemsExcludeTerminated = CollectionUtils + .select(needRecycleTousseItemsIncludeTerminated, + PredicateUtils.notPredicate(terminatePred1)); + + Predicate recycledPred = new Predicate() { + @Override + public boolean evaluate(TousseItem vo) { + return (vo.getRecyclingAmount() != null); + } + }; + + String recyclingStatus = application.getRecyclingStatus(); + if(needRecycleTousseItemsIncludeTerminated.isEmpty()){ + // 不存在应回收的物品 + recyclingStatus = null; + + } else if(needRecycleTousseItemsExcludeTerminated.isEmpty()){ + // 所有应回收的物品已终止 + if(!application.recyclingStatusRecycled()){ + recyclingStatus = InvoicePlan.STATUS_END; + } + + } else if (CollectionUtils.matchesAll(needRecycleTousseItemsExcludeTerminated, PredicateUtils.notPredicate(recycledPred))){ + // 所有应回收的物品,都未回收 + recyclingStatus = InvoicePlan.RECYCLINGSTATUS_AWAITRECEIVE; + + } else if (CollectionUtils.matchesAll(needRecycleTousseItemsExcludeTerminated, recycledPred)){ + //回收时允许保存未入筐的消毒包(必须开启了部分回收功能enablePartRecycle:true) + boolean recyclingAllowsSaveOfNonBasketDisinfectionTousse = CssdUtils.getSystemSetConfigByNameBool("recyclingAllowsSaveOfNonBasketDisinfectionTousse", false); + boolean enablePartRecycle = CssdUtils.getSystemSetConfigByNameBool("enablePartRecycle", false); + Predicate recycledPredOfAmount = new Predicate() { + @Override + public boolean evaluate(TousseItem vo) { + return (vo.getRecyclingAmount() != 0); + } + }; + //所有应回收的物品,都已回收(如果开启了回收时允许保存未入筐的消毒包和部分回收功能,回收数量都不为0,状态才算已回收,否则就是部分回收) + if(recyclingAllowsSaveOfNonBasketDisinfectionTousse && enablePartRecycle + && !CollectionUtils.matchesAll(needRecycleTousseItemsExcludeTerminated, recycledPredOfAmount)){ + recyclingStatus = InvoicePlan.RECYCLINGSTATUS_PARTAWAITRECEIVE; + }else{ + recyclingStatus = InvoicePlan.RECYCLINGSTATUS_AWAITRECEIVED; + } + } else { + // 其他情况为部分接收 + recyclingStatus = InvoicePlan.RECYCLINGSTATUS_PARTAWAITRECEIVE; + } + ftApplication.setRecyclingStatus(recyclingStatus); ftApplication.setReceiveMan(AcegiHelper.getLoginUserFullName()); ftApplication.setReceiveTime(new Date()); - ftApplication.setPackageStatus(ForeignTousseApplication.APPLICATION_STATUS_SIGNED); + ftApplication.setPackageStatus(recyclingStatus); ftApplication.setOrderByFiled(InvoicePlan.DELIVER_DELIVERED); // record.setRecyclingApplication(null); }else if(InvoicePlan.RECYCLINGSTATUS_AWAITRECYCLE.equals(oldRecyclingStatus)){ Index: ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/dwr/table/RecyclingRecordTableManager.java =================================================================== diff -u -r28549 -r30837 --- ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/dwr/table/RecyclingRecordTableManager.java (.../RecyclingRecordTableManager.java) (revision 28549) +++ ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/dwr/table/RecyclingRecordTableManager.java (.../RecyclingRecordTableManager.java) (revision 30837) @@ -486,8 +486,8 @@ JSONArray array = new JSONArray(); String filterRecyclingStatusSql = null; if(filterRecyclingStatus){ - filterRecyclingStatusSql = String.format("po.recyclingStatus in('%s','%s','%s') and ", InvoicePlan.RECYCLINGSTATUS_AWAITRECYCLE, - InvoicePlan.RECYCLINGSTATUS_PARTRECYCLE,InvoicePlan.RECYCLINGSTATUS_AWAITRECEIVE); + filterRecyclingStatusSql = String.format("po.recyclingStatus in('%s','%s','%s','%s') and ", InvoicePlan.RECYCLINGSTATUS_AWAITRECYCLE, + InvoicePlan.RECYCLINGSTATUS_PARTRECYCLE,InvoicePlan.RECYCLINGSTATUS_AWAITRECEIVE,InvoicePlan.RECYCLINGSTATUS_PARTAWAITRECEIVE); }else{ filterRecyclingStatusSql = ""; } Index: ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/action/RecyclingRecordAction.java =================================================================== diff -u -r30742 -r30837 --- ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/action/RecyclingRecordAction.java (.../RecyclingRecordAction.java) (revision 30742) +++ ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/action/RecyclingRecordAction.java (.../RecyclingRecordAction.java) (revision 30837) @@ -3858,7 +3858,7 @@ + " ti.amount,ti.recyclingAmount,ti.unit,ip.recyclingStatus " + " from invoicePlan ip join TousseItem ti on ip.id=ti.recyclingApplication_ID " + " where ip.handleDepartCoding='"+ AcegiHelper.getCurrentOrgUnitCode() +"' and ti.timeoutprocesstype is null " - + " and (ip.type='"+ InvoicePlan.TYPE_FOREIGNTOUSSEAPPLIACTION +"' and ip.recyclingStatus in ('"+ InvoicePlan.RECYCLINGSTATUS_AWAITRECEIVE +"') " + + " and (ip.type='"+ InvoicePlan.TYPE_FOREIGNTOUSSEAPPLIACTION +"' and ip.recyclingStatus in ('"+ InvoicePlan.RECYCLINGSTATUS_AWAITRECEIVE +"','"+ InvoicePlan.RECYCLINGSTATUS_PARTAWAITRECEIVE +"') " + " or (ip.type<>'"+ InvoicePlan.TYPE_FOREIGNTOUSSEAPPLIACTION +"' and ip.recyclingStatus in ('"+ InvoicePlan.RECYCLINGSTATUS_AWAITRECYCLE +"','"+ InvoicePlan.RECYCLINGSTATUS_PARTRECYCLE +"'))) " + " and ti.isRecycling='"+ Constants.STR_YES +"' and (ti.recyclingAmount is null or (ti.recyclingAmount <> 0 and ti.recyclingAmount < ti.amount)) " + " and ip.applicationTime <= "+ dateQueryAdapter.dateAdapter(cal.getTime()); Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/foreigntousseapplication/dwr/table/ForeignTousseApplicationTableManager.java =================================================================== diff -u -r30833 -r30837 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/foreigntousseapplication/dwr/table/ForeignTousseApplicationTableManager.java (.../ForeignTousseApplicationTableManager.java) (revision 30833) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/foreigntousseapplication/dwr/table/ForeignTousseApplicationTableManager.java (.../ForeignTousseApplicationTableManager.java) (revision 30837) @@ -274,8 +274,9 @@ public int getUnFinishedForeignTousseApplicationCountForSelfDepart(){ String sql = "select count(0) from "+ ForeignTousseApplication.class.getSimpleName() +" fta join "+ InvoicePlan.class.getSimpleName() +" ip on fta.id=ip.id" + " where (ip.endStatus is null or ip.endStatus <> '"+ InvoicePlan.STATUS_END +"')" - + " and ip.recyclingstatus = '"+ InvoicePlan.RECYCLINGSTATUS_AWAITRECEIVE +"'" - + " and ip.handleDepartCoding='"+ AcegiHelper.getCurrentOrgUnitCode() +"'"; + + " and ip.recyclingstatus in('"+ InvoicePlan.RECYCLINGSTATUS_AWAITRECEIVE +"','" + + InvoicePlan.RECYCLINGSTATUS_PARTAWAITRECEIVE + + "') and ip.handleDepartCoding='"+ AcegiHelper.getCurrentOrgUnitCode() +"'"; return objectDao.countBySql(sql); }