Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManagerImpl.java =================================================================== diff -u -r29356 -r29647 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManagerImpl.java (.../InvoicePlanManagerImpl.java) (revision 29356) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManagerImpl.java (.../InvoicePlanManagerImpl.java) (revision 29647) @@ -4240,4 +4240,10 @@ return list; } + @Override + public JSONObject savePrepareRecyleTousse(JSONObject params) { + // TODO Auto-generated method stub + return null; + } + } Index: ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/service/ServerInterfaceImpl.java =================================================================== diff -u -r27137 -r29647 --- ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/service/ServerInterfaceImpl.java (.../ServerInterfaceImpl.java) (revision 27137) +++ ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/service/ServerInterfaceImpl.java (.../ServerInterfaceImpl.java) (revision 29647) @@ -20,7 +20,9 @@ import com.forgon.directory.acegi.tools.AcegiHelper; import com.forgon.directory.model.LoginInfo; import com.forgon.disinfectsystem.common.CssdUtils; +import com.forgon.exception.BorrowUnRecturnException; import com.forgon.exception.SterilingModeNotTheSameException; +import com.forgon.exception.SystemException; import com.forgon.tools.cache.ForgonThreadLocalResourceManager; import com.forgon.tools.json.JSONUtil; import com.google.gson.Gson; @@ -69,6 +71,17 @@ e.printStackTrace(); logger.debug(e.getMessage()); result = obj.toString(); + }catch(BorrowUnRecturnException e){ + //有借物未归还的提示 + String msg = e.getMessage(); + JSONObject obj = JSONUtil.buildJsonObject(false, msg); + obj.put(JSONUtil.JSON_KEY_NOTICEMODE, Constants.NOTICE_MODE_CONFIRM); + e.printStackTrace(); + logger.debug(e.getMessage()); + result = obj.toString(); + } catch (SystemException e) { +// e.printStackTrace(); + result = buildErrorMsgJsonResult(e.getMessage()); } catch (RuntimeException e) { // e.printStackTrace(); result = buildErrorMsgJsonResult(e.getMessage()); Index: forgon-tools/src/main/java/com/forgon/exception/BorrowUnRecturnException.java =================================================================== diff -u --- forgon-tools/src/main/java/com/forgon/exception/BorrowUnRecturnException.java (revision 0) +++ forgon-tools/src/main/java/com/forgon/exception/BorrowUnRecturnException.java (revision 29647) @@ -0,0 +1,21 @@ +package com.forgon.exception; + +/** + * 某些包有借物未归还或待归还的异常(BJ307YY-41 预回收时要检查借物并进行归还提醒,预回收消毒物品申请单时只能添加消毒物品) + * @author syf + * @since 2020-11-23 + */ +public class BorrowUnRecturnException extends SystemException { + + private static final long serialVersionUID = 5935155678137846305L; + + public BorrowUnRecturnException(String message) { + super(message); + } + public BorrowUnRecturnException(Throwable e){ + super("发现有借物尚未归还",e); + } + public BorrowUnRecturnException(){ + super("发现有借物尚未归还"); + } +} Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManager.java =================================================================== diff -u -r28248 -r29647 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManager.java (.../InvoicePlanManager.java) (revision 28248) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/InvoicePlanManager.java (.../InvoicePlanManager.java) (revision 29647) @@ -27,6 +27,7 @@ import com.forgon.disinfectsystem.recyclingapplication.vo.InvoicePlanVo; import com.forgon.disinfectsystem.vo.ApplicationItemVO; import com.forgon.disinfectsystem.vo.RecyclingApplicationVo; +import com.forgon.exception.BorrowUnRecturnException; import com.forgon.tools.hibernate.BasePoManager; /** @@ -430,4 +431,25 @@ */ public List getAllApplyType(boolean needAllOption , boolean needCustomDeliveryType); + /** + * 保存预回收物品(BJ307YY-41 预回收时要检查借物并进行归还提醒,预回收消毒物品申请单时只能添加消毒物品) + * @param params,格式及说明如下: + * { + "app_id": 10687, //待预回收单id(即申请单id) + "comfirmor": "", //预回收确认人 + "isContinue": true, //是否继续(比如有借物未归还时,继续操作) + "operator": "杨丽梅", //操作人 + "tousseItems": [ //申请项集合(即预回收项) + { + "id": 11614, //包定义id + "prepareRecycleAmount": 2 //预回收数量 + } + ] + } + * @exception BorrowUnRecturnException 当科室供应室配置的发货参数【器械包发货时间】的值设置为【预回收后发货】且"有借物未归还是否继续"的参数不为true时,此时如果检查到有其中某一个或多个包有借物未归还完的情况,抛出此异常,并返回具体的业务消息内容 + * @exception SystemException 如果有其它业务异常,抛出该异常 + * @return 如果保存成功,返回{succesee:true},否则返回{succesee:false,message:"具体的消息"} + */ + public JSONObject savePrepareRecyleTousse(JSONObject params); + } Index: ssts-web/src/main/webapp/WEB-INF/spring/applicationContext-disinfectsystem-service.xml =================================================================== diff -u -r29640 -r29647 --- ssts-web/src/main/webapp/WEB-INF/spring/applicationContext-disinfectsystem-service.xml (.../applicationContext-disinfectsystem-service.xml) (revision 29640) +++ ssts-web/src/main/webapp/WEB-INF/spring/applicationContext-disinfectsystem-service.xml (.../applicationContext-disinfectsystem-service.xml) (revision 29647) @@ -1880,7 +1880,7 @@ - + @@ -1906,7 +1906,20 @@ class="com.forgon.disinfectsystem.recyclingapplication.service.ExpressInvoicePlanManagerImpl"> + + + + + + + + + + + Index: ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/service/ServiceManagerImpl.java =================================================================== diff -u -r29627 -r29647 --- ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/service/ServiceManagerImpl.java (.../ServiceManagerImpl.java) (revision 29627) +++ ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/service/ServiceManagerImpl.java (.../ServiceManagerImpl.java) (revision 29647) @@ -177,6 +177,7 @@ import com.forgon.disinfectsystem.washTransition.service.WashTransitionRecordManager; import com.forgon.disinfectsystem.washanddisinfectmanager.washanddisinfectrecord.action.WashAndDisinfectRecordAction; import com.forgon.disinfectsystem.washanddisinfectmanager.washanddisinfectrecord.service.WashAndDisinfectRecordManager; +import com.forgon.exception.BorrowUnRecturnException; import com.forgon.exception.OperationException; import com.forgon.exception.SterilingModeNotTheSameException; import com.forgon.exception.SystemException; @@ -260,6 +261,12 @@ @Autowired private InvoiceManager expressInvoiceManager; @Autowired + + /** + * 预回收业务实现类bean + */ + private InvoicePlanManager prepareRecycleTousseManager; + @Autowired private BarcodeManager barcodeManager; @Autowired private TousseInstanceManager tousseInstanceManager; @@ -430,6 +437,8 @@ // return buildErrorMsgJsonResult(targetException.getMessage()); if(targetException instanceof SterilingModeNotTheSameException){ retException = new SterilingModeNotTheSameException(targetException.getMessage()); + }else if(targetException instanceof BorrowUnRecturnException){ + retException = new BorrowUnRecturnException(targetException.getMessage()); }else{ retException = new RuntimeException(targetException.getMessage()); } @@ -626,91 +635,8 @@ * @return */ public String savePrepareRecyleTousse(JSONObject params){ - boolean success = false; - String error = ""; - if(params != null){ - JSONArray array = params.optJSONArray("tousseItems"); - if(array != null){ - String invoiceplanId = params.optString("app_id"); - InvoicePlan plan = invoicePlanManager.get(invoiceplanId); - for (int i = 0; i < array.size(); i++) { - JSONObject obj = array.getJSONObject(i); - String id = obj.optString("id"); - TousseItem item = null; - if(StringUtils.isNotEmpty(id)){ - item = tousseItemManager.get(id); - } - Integer prepareRecycleAmount = obj - .optInt("prepareRecycleAmount"); - if (item != null) { - item.setPrepareRecycleAmount(prepareRecycleAmount); - } else { - String td_id = obj.optString("td_id"); - TousseDefinition td = tousseDefinitionManager.get(td_id); - if (td != null) { - item = new TousseItem(); - item.setIsRecycling(td.getIsRecycling()); - item.setAmount(prepareRecycleAmount); - item.setPrepareRecycleAmount(prepareRecycleAmount); - String tousseName = td.getName(); - if (td.isDisinfection()) { - recyclingApplicationManager.addDisinfectTousseItem(plan, prepareRecycleAmount, - td,item); -// continue; - }else{ - item.setTousseDefinitionId(td.getId()); - item.setMaterialAmount(td.getMaterialAmount()); - item.setIsInvoice(td.getIsInvoice()); - } - item.setTousseName(tousseName); - item.setTousseType(td.getTousseType()); - item.setAncestorID(td.getAncestorID()); - //设置发货数量依据(取包定义的发货数量依据) - item.setInvoiceAmountMode(td.getInvoiceAmountMode()); - item.setHideRecycling(td.getHideRecycling()); - item.setDiposable("否"); - item.setExpressRecycling(td.getExpressRecycling()); - item.setIsApplyEntireTousse(td.getIsApplyEntireTousse()); - item.setIsCleanedEntirely(td.getIsCleanedEntirely()); - boolean isThereIDCard = tousseDefinitionManager.isThereIDCard(td); - item.setIsThereIdentificationCard(isThereIDCard?"是":"否"); - // 器械包取器械包定义中的价格 - double price = td.getPrice(); - // 消毒物品取材料的消毒价格之和 - if (TousseDefinition.PACKAGE_TYPE_DISINFECTION - .equals(td.getTousseType())) { - price = tousseDefinitionManager - .getDisinfectGoodsTotalPrice(td); - } - item.setPrice(price); - item.setRowPrice(MathTools.mul(price, - prepareRecycleAmount).doubleValue()); - item.setInvoicePlan(plan); - plan.getApplicationItems().add(item); - } else { - JSONUtil.buildErrorMsgJsonResult("未找到对应的器械包"); - } - } - tousseItemManager.save(item); - } - if (plan != null) { - plan.setIsPrepareRecycled(InvoicePlan.SIGNED_TRUE); - String comfirmor = params.optString("comfirmor"); - String operator = params.optString("operator"); - plan.setPrepareRecycleComfirmor(comfirmor); - plan.setPrepareRecycleOperator(operator); - plan.setPrepareRecycleDateTime(new Date()); - invoicePlanManager.save(plan); - success = true; - error = "保存成功"; - } else { - success = false; - error = "申请单不存在"; - } - } - } - return new JSONStringer().object().key("success").value(success) - .key("error").value(error).endObject().toString(); + JSONObject result = prepareRecycleTousseManager.savePrepareRecyleTousse(params); + return result.toString(); } /** @@ -860,6 +786,8 @@ obj.put("id", plan.getId()); obj.put("applicant", plan.getApplicant()); obj.put("department", plan.getDepart()); + //申请单类型 + obj.put("type", plan.getType()); obj.put("isPrepareRecycled", plan.getIsPrepareRecycled()); String appTime = ""; try { @@ -1006,6 +934,8 @@ boolean success = false; String msg = ""; if(params != null){ + //消毒物品申请单 + String applicationFormType = params.optString("applicationFormType"); String spell = params.optString("spell"); if(StringUtils.isNotBlank(spell)){ List> mapList = tousseDefinitionManager.searchTousseOrDiposableGoodsBySpellAndWbCode( @@ -1015,6 +945,12 @@ Map map = mapList.get(i); String isCleanedEntirely = map.get("isCleanedEntirely").toString(); String tousseType = map.get("type").toString(); + //BJ307YY-41 预回收时要检查借物并进行归还提醒,预回收消毒物品申请单时只能添加消毒物品.如果单类型为消毒物品申请单,则将非消毒物品的包定义过滤掉 + if(StringUtils.equals(applicationFormType, InvoicePlan.TYPE_DISINFECT_GOODS_APPLICATION_FORM)){ + if(!StringUtils.equals(tousseType, TousseDefinition.PACKAGE_TYPE_DISINFECTION)){ + continue; + } + } String name = map.get("name").toString(); String id = map.get("id").toString(); if (TousseDefinition.PACKAGE_TYPE_DISINFECTION Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/PrepareRecycleTousseManagerImpl.java =================================================================== diff -u --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/PrepareRecycleTousseManagerImpl.java (revision 0) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/service/PrepareRecycleTousseManagerImpl.java (revision 29647) @@ -0,0 +1,128 @@ +package com.forgon.disinfectsystem.recyclingapplication.service; + +import java.util.Date; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; + +import com.forgon.disinfectsystem.entity.basedatamanager.toussedefinition.TousseDefinition; +import com.forgon.disinfectsystem.entity.invoicemanager.InvoicePlan; +import com.forgon.disinfectsystem.entity.tousseitem.TousseItem; +import com.forgon.exception.BorrowUnRecturnException; +import com.forgon.exception.SystemException; +import com.forgon.tools.MathTools; +import com.forgon.tools.json.JSONUtil; + +/** + * 预回收业务实现类 + * @author syf + * @since 2020-11-23 + * + */ +public class PrepareRecycleTousseManagerImpl extends InvoicePlanManagerImpl { + + @Autowired + private RecyclingApplicationManager recyclingApplicationManager; + + public JSONObject savePrepareRecyleTousse(JSONObject params){ + //仅用于各种不同返回结果(或异常)场景测试本地模拟,正式代码时不会进入 + boolean condition = false; + if(condition){ + //return JSONUtil.buildJsonObject(true, ""); +// return JSONUtil.buildJsonObject(false, ""); +// return JSONUtil.buildJsonObject(false, "测试消息"); +// throw new SystemException("测试包还有多少个未归还"); + throw new BorrowUnRecturnException("测试包还有多少个未归还,是否继续?"); + } + + //以下代码为原serviceManager实现方法的代码,现已移值到此manager实现类中,在此基础上做新增的需求内容 + boolean success = false; + String error = ""; + if(params != null){ + JSONArray array = params.optJSONArray("tousseItems"); + if(array != null){ + String invoiceplanId = params.optString("app_id"); + InvoicePlan plan = get(invoiceplanId); + for (int i = 0; i < array.size(); i++) { + JSONObject obj = array.getJSONObject(i); + String id = obj.optString("id"); + TousseItem item = null; + if(StringUtils.isNotEmpty(id)){ + item = tousseItemManager.get(id); + } + Integer prepareRecycleAmount = obj + .optInt("prepareRecycleAmount"); + if (item != null) { + item.setPrepareRecycleAmount(prepareRecycleAmount); + } else { + String td_id = obj.optString("td_id"); + TousseDefinition td = tousseDefinitionManager.get(td_id); + if (td != null) { + item = new TousseItem(); + item.setIsRecycling(td.getIsRecycling()); + item.setAmount(prepareRecycleAmount); + item.setPrepareRecycleAmount(prepareRecycleAmount); + String tousseName = td.getName(); + if (td.isDisinfection()) { + recyclingApplicationManager.addDisinfectTousseItem(plan, prepareRecycleAmount, + td,item); +// continue; + }else{ + item.setTousseDefinitionId(td.getId()); + item.setMaterialAmount(td.getMaterialAmount()); + item.setIsInvoice(td.getIsInvoice()); + } + item.setTousseName(tousseName); + item.setTousseType(td.getTousseType()); + item.setAncestorID(td.getAncestorID()); + //设置发货数量依据(取包定义的发货数量依据) + item.setInvoiceAmountMode(td.getInvoiceAmountMode()); + item.setHideRecycling(td.getHideRecycling()); + item.setDiposable("否"); + item.setExpressRecycling(td.getExpressRecycling()); + item.setIsApplyEntireTousse(td.getIsApplyEntireTousse()); + item.setIsCleanedEntirely(td.getIsCleanedEntirely()); + boolean isThereIDCard = tousseDefinitionManager.isThereIDCard(td); + item.setIsThereIdentificationCard(isThereIDCard?"是":"否"); + // 器械包取器械包定义中的价格 + double price = td.getPrice(); + // 消毒物品取材料的消毒价格之和 + if (TousseDefinition.PACKAGE_TYPE_DISINFECTION + .equals(td.getTousseType())) { + price = tousseDefinitionManager + .getDisinfectGoodsTotalPrice(td); + } + item.setPrice(price); + item.setRowPrice(MathTools.mul(price, + prepareRecycleAmount).doubleValue()); + item.setInvoicePlan(plan); + plan.getApplicationItems().add(item); + } else { + JSONUtil.buildErrorMsgJsonResult("未找到对应的器械包"); + } + } + tousseItemManager.save(item); + } + if (plan != null) { + plan.setIsPrepareRecycled(InvoicePlan.SIGNED_TRUE); + String comfirmor = params.optString("comfirmor"); + String operator = params.optString("operator"); + plan.setPrepareRecycleComfirmor(comfirmor); + plan.setPrepareRecycleOperator(operator); + plan.setPrepareRecycleDateTime(new Date()); + save(plan); + success = true; + error = "保存成功"; + } else { + success = false; + error = "申请单不存在"; + } + } + } + return JSONUtil.buildJsonObject(success, error); + } + +}