Index: ssts-userecord/src/main/java/com/forgon/disinfectsystem/useRecord/service/UseRecordManagerImpl.java =================================================================== diff -u -r28466 -r28467 --- ssts-userecord/src/main/java/com/forgon/disinfectsystem/useRecord/service/UseRecordManagerImpl.java (.../UseRecordManagerImpl.java) (revision 28466) +++ ssts-userecord/src/main/java/com/forgon/disinfectsystem/useRecord/service/UseRecordManagerImpl.java (.../UseRecordManagerImpl.java) (revision 28467) @@ -4672,6 +4672,11 @@ //备注重新设置(病人巡回洗手护士需要将来自多条使用记录的数据拼接,手术数量与器械包数量进行重新设值) recyclingApplication.setRemark(getRemarkByRecyclingApplicationAndProjectConfig(recyclingApplication)); + + //追加申请项(相同物品的,则数量进行叠加) + appendTousseItemForRecyclingApplication(recyclingApplication , applyTousseMap, + tousseBarcodeToTdIdMap, applyUrgentTousseMap, tousseNameToIsInvoiceMap); + objectDao.saveOrUpdate(recyclingApplication); //将转换后申请单对象保存至集合中 @@ -4774,6 +4779,11 @@ //备注重新设置(病人巡回洗手护士需要将来自多条使用记录的数据拼接,手术数量与器械包数量进行重新设值) recyclingApplication.setRemark(getRemarkByRecyclingApplicationAndProjectConfig(recyclingApplication)); + + //追加申请项(相同物品的,则数量进行叠加) + appendTousseItemForRecyclingApplication(recyclingApplication , applyTousseMap, + tousseBarcodeToTdIdMap, applyUrgentTousseMap, tousseNameToIsInvoiceMap); + objectDao.saveOrUpdate(recyclingApplication); //将转换后申请单对象保存至集合中 @@ -4807,6 +4817,60 @@ updateTousseItemIdForTousseInstanceOfUseRecordAfterConvert(sterilizationModeToBelongToUseRecordList , recyclingApplicationListAfterConvert); } + private void appendTousseItemForRecyclingApplication(RecyclingApplication recyclingApplication , Map applyTousseMap, + Map tousseBarcodeToTdIdMap,Map applyUrgentTousseMap,Map tousseNameToIsInvoiceMap){ + List tousseItemList = + recyclingApplication.getApplicationItems() == null ? new ArrayList() : recyclingApplication.getApplicationItems(); + Map tousseNameToTousseItemMap = new HashMap(); + if(CollectionUtils.isNotEmpty(tousseItemList)){ + tousseItemList.stream().forEach(ti -> { + tousseNameToTousseItemMap.put(ti.getTousseName(), ti); + }); + } + Map nameToTdMap = new HashMap(); + List tdList = tousseDefinitionManager.getCollection(tousseBarcodeToTdIdMap.values()); + tdList.stream().forEach(td -> { + nameToTdMap.put(td.getName(), td); + }); + applyTousseMap.entrySet().forEach(entry -> { + String tousseName = entry.getKey(); + Integer amount = entry.getValue(); + TousseItem ti = tousseNameToTousseItemMap.get(tousseName); + if(ti == null){ + TousseDefinition td = nameToTdMap.get(tousseName); + ti = new TousseItem(); + ti.setAmount(amount); + ti.setAncestorID(td.getAncestorID()); + ti.setDiposable(TousseItem.DIPOSABLE_NO); + ti.setExpressInvoice(td.getExpressInvoice()); + ti.setExpressRecycling(td.getExpressRecycling()); + ti.setHideRecycling(td.getHideRecycling()); + ti.setInvoiceAmountMode(td.getInvoiceAmountMode()); + ti.setInvoicePlan(recyclingApplication); + ti.setIsApplyEntireTousse(td.getIsApplyEntireTousse()); + ti.setIsCleanedEntirely(td.getIsCleanedEntirely()); + ti.setIsInvoice(td.getIsInvoice()); + ti.setIsRecycling(td.getIsRecycling()); + ti.setIsThereIdentificationCard(td.isIDCardDisabled() ? Constants.STR_NO : Constants.STR_YES); + ti.setIsTraceable(td.getIsTraceable()); + ti.setPrice(td.getPrice()); + ti.setRowPrice(MathTools.mul(amount, td.getPrice()).doubleValue()); + ti.setTousseDefinitionId(td.getId()); + ti.setTousseName(tousseName); + ti.setTousseType(td.getTousseType()); + ti.setUrgentAmount(applyUrgentTousseMap.get(tousseName)); + ti.setUnit(td.getUnit()); + tousseItemList.add(ti); + }else{ + tousseItemList.remove(ti); + ti.setAmount(MathTools.add(ti.getAmount(), amount).intValue()); + ti.setRowPrice(MathTools.mul(amount, ti.getPrice()).doubleValue()); + tousseItemList.add(ti); + } + recyclingApplication.setApplicationItems(tousseItemList); + }); + } + /** * 使用记录转换申请单后对器械包实例更新tousseItemId字段值 * 考虑到敷料包及不转换的器械包也需要转换但不需要回收,所以也需要更新tousseItemId