Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/departmentapplicationtemplate/service/DepartmentAppTemplateManagerImpl.java =================================================================== diff -u -r27674 -r28154 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/departmentapplicationtemplate/service/DepartmentAppTemplateManagerImpl.java (.../DepartmentAppTemplateManagerImpl.java) (revision 27674) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/departmentapplicationtemplate/service/DepartmentAppTemplateManagerImpl.java (.../DepartmentAppTemplateManagerImpl.java) (revision 28154) @@ -135,10 +135,14 @@ return null; } + @SuppressWarnings("unchecked") @Override public List getDepartmentAppTemplates(String departmentCode) { if(StringUtils.isNotBlank(departmentCode)){ - String sql = " where po.orgUnitCode like '%" + departmentCode + "%' order by po.sequence"; + String sql = String.format("where po.orgUnitCode like '%s' " + + "or po.orgUnitCode like '%s' " + + "or po.orgUnitCode like '%s' " + + "or po.orgUnitCode like '%s'", departmentCode, departmentCode+",%", "%,"+departmentCode, "%,"+departmentCode+",%"); List list = objectDao.findBySql(DepartmentAppTemplate.class.getSimpleName(), sql); if(list != null && list.size() > 0){ List returnList = new ArrayList(); Index: ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/action/RecyclingRecordAction.java =================================================================== diff -u -r28129 -r28154 --- ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/action/RecyclingRecordAction.java (.../RecyclingRecordAction.java) (revision 28129) +++ ssts-recyclingrecord/src/main/java/com/forgon/disinfectsystem/recyclingrecord/action/RecyclingRecordAction.java (.../RecyclingRecordAction.java) (revision 28154) @@ -347,9 +347,20 @@ */ public void loadDepartmentAppTemplateForRecycle(){ String orgUnitCoding = StrutsParamUtils.getPraramValue("orgUnitCoding", ""); + // 申领模板id + String templateId = StrutsParamUtils.getPraramValue("templateId", null); JSONArray array = new JSONArray(); - if(StringUtils.isNotBlank(orgUnitCoding)){ - List list = departmentAppTemplateManager.getDepartmentAppTemplates(orgUnitCoding); + List list = null; + if(DatabaseUtil.isPoIdValid(templateId)){ + // 申领模板id不为空,表示已经从模板下拉框选中申领模板 + list = new ArrayList(); + DepartmentAppTemplate departmentAppTemplate = departmentAppTemplateManager.getAppTemplateById(templateId); + list.add(departmentAppTemplate); + } else if(StringUtils.isNotBlank(orgUnitCoding)){ + // 申领模板id为空,并且科室编码不为空,表示选中科室后加载改科室下的所有申领模板 + list = departmentAppTemplateManager.getDepartmentAppTemplates(orgUnitCoding); + } + if(CollectionUtils.isNotEmpty(list)){ Map resultMap = new HashMap(); List resultList = new ArrayList(); if(list != null){ Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/action/RecyclingApplicationAction.java =================================================================== diff -u -r28122 -r28154 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/action/RecyclingApplicationAction.java (.../RecyclingApplicationAction.java) (revision 28122) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/recyclingapplication/action/RecyclingApplicationAction.java (.../RecyclingApplicationAction.java) (revision 28154) @@ -433,6 +433,7 @@ String goodType = tousseDefinitionHelper.setGoodTypeByFormType(applicationFormType); // 模板Id String templateId = StrutsParamUtils.getPraramValue("templateId", null); + templateId = DatabaseUtil.isPoIdValid(templateId) ? templateId : null; // 申请单Id String applicationId = StrutsParamUtils.getPraramValue("id", null); StringBuffer leftStoreJson = new StringBuffer(); @@ -456,13 +457,14 @@ } } boolean isUpdateStatus = true;// 是否更新借物单状态为已归还 - + boolean isOpenLoadTemplateByUnit = CssdUtils.getSystemSetConfigByNameBool("isOpenLoadTemplateByUnit", false); // 当前登录用户所属的科室 String orgunitCodes = ""; // 编辑时模板为申请科室模板 if (application != null) { orgunitCodes = application.getDepartCoding(); - } else { + } else if(!isOpenLoadTemplateByUnit){ + // 不开启申领模板下拉框功能并且没有选中科室时,显示当前登录科室的申领模板(FJSSSYY-2) orgunitCodes = AcegiHelper.getLoginUser().getCurrentOrgUnitCode(); } //判断是否需要重新加载模板,如果不为空,则根据对应的科室code来加载 @@ -558,8 +560,11 @@ if (templates != null){ JSONArray diposableJsonArray = new JSONArray(); for (DepartmentAppTemplate template : templates) { - departmentAppTemplateManager.diposableTemplateItems2JsonArray(handleDepartCoding, diposableJsonArray, - template.getDiposableGoodsTemplateItems(), disposableFloatPercent, specifyDisposableTypes); + // 只取一次性物品模板中的一次性物品(目前所有模板都可以添加一次性物品,以前是取所有模板的一次性物品) + if (DepartmentAppTemplate.TEMPLATE_TYPE_DIPOSABLEGOODS.equals(template.getTemplateType())) { + departmentAppTemplateManager.diposableTemplateItems2JsonArray(handleDepartCoding, diposableJsonArray, + template.getDiposableGoodsTemplateItems(), disposableFloatPercent, specifyDisposableTypes); + } } updateItemsApplyInfo(applicationItemMap, diposableJsonArray); @@ -593,6 +598,8 @@ //2、被科室申领模版过滤后的剩下的申请物品 Iterator iterator = applicationItemMap.keySet().iterator(); + StringBuffer rightStoreJsonTemp = new StringBuffer(); + StringBuffer leftStoreJsonTemp = new StringBuffer(); while (iterator.hasNext()) { String key = iterator.next(); TousseItem tousseItem = applicationItemMap.get(key); @@ -609,33 +616,39 @@ String urgentLevel = tousseItem.getUrgentLevel(); json.put("urgentAmount",urgentAmount); json.put("urgentLevel",urgentLevel); - appendJsonString(rightStoreJson, json.toString()); + appendJsonString(rightStoreJsonTemp, json.toString()); } else { TousseDefinition td = tousseDefinitionManager.getTousseDefinitionByTousseItem(tousseItem); JSONObject json = departmentAppTemplateManager.tousseItem2Json(tousseItem, td, tousseDefinitionFloatPercent); if (InvoicePlan.TYPE_RECYCLINGCREATE_APPLICATION.equals(applicationFormType)) { - appendJsonString(rightStoreJson, json.toString()); + appendJsonString(rightStoreJsonTemp, json.toString()); } else { - appendJsonString(leftStoreJson, json.toString()); + appendJsonString(leftStoreJsonTemp, json.toString()); } } } else { if (InvoicePlan.TYPE_DIPOSABLE_GOODS_APPLICATION_FORM.equals(applicationFormType)) { JSONObject json = this.getDisposableGoodMsg(tousseItem,disposableFloatPercent); - appendJsonString(rightStoreJson, json.toString()); + appendJsonString(rightStoreJsonTemp, json.toString()); } else { TousseDefinition td = tousseDefinitionManager.getTousseDefinitionByTousseItem(tousseItem); JSONObject json = departmentAppTemplateManager.tousseItem2Json(tousseItem, td, tousseDefinitionFloatPercent); if (tousseApplicationFormGridSplit) { - appendJsonString(leftStoreJson, json.toString()); + appendJsonString(leftStoreJsonTemp, json.toString()); } else { - appendJsonString(rightStoreJson, json.toString()); + appendJsonString(rightStoreJsonTemp, json.toString()); } } } } + // 使用科室申领模板后,提交申请单后再次打开申请单时,有申请数量的物品要置顶显示(FJSSSYY-2) + appendJsonString(leftStoreJsonTemp, leftStoreJson.toString()); + appendJsonString(rightStoreJsonTemp, rightStoreJson.toString()); + leftStoreJson = leftStoreJsonTemp; + rightStoreJson = rightStoreJsonTemp; + JSONObject obj = new JSONObject(); obj.put("disposableFloatPercent", disposableFloatPercent); obj.put("updateStatus", isUpdateStatus); @@ -720,7 +733,7 @@ } /** - * 遍历所定义的模板的物品的toussesJsonArray,查找其中的物品是否有已申领的物品,如果有,则更新数量和价格信息,并且从applicationItemMap删除. + * 遍历所定义的模板的物品的toussesJsonArray,查找其中的物品是否有已申领的物品,如果有,则从toussesJsonArray删除. * @param applicationItemMap 申请项的Map<如果是“消毒物品”=类型;名称,其他的物品=类型;id,申请项> * @param toussesJsonArray 科室申领模版配置的物品集合 */ @@ -730,6 +743,7 @@ if (applicationItemMap.size() <= 0) { return; } + JSONArray applicationToussesJsonArray = new JSONArray(); for (int i = 0; i < toussesJsonArray.size(); i++) { JSONObject obj = toussesJsonArray.getJSONObject(i); @@ -749,6 +763,10 @@ TousseItem tousseItem = applicationItemMap.get(key); if (tousseItem != null) { + applicationToussesJsonArray.add(obj); + } + + /*if (tousseItem != null) { String amountStr = tousseItem.getAmount().toString(); String urgentAmount = StringTools.handleNullOrZero(tousseItem.getUrgentAmount()); String urgentLevel = tousseItem.getUrgentLevel(); @@ -785,8 +803,9 @@ obj.put("checked", isTerminated); this.resetUnitAndCountAndRowPrice(tousseItem,obj); toussesJsonArray.set(i, obj); - } + }*/ } + toussesJsonArray.removeAll(applicationToussesJsonArray); } /** Index: ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/departmentapplicationtemplate/action/DepartmentAppTemplateAction.java =================================================================== diff -u -r22708 -r28154 --- ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/departmentapplicationtemplate/action/DepartmentAppTemplateAction.java (.../DepartmentAppTemplateAction.java) (revision 22708) +++ ssts-recyclingapplication/src/main/java/com/forgon/disinfectsystem/departmentapplicationtemplate/action/DepartmentAppTemplateAction.java (.../DepartmentAppTemplateAction.java) (revision 28154) @@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import net.sf.json.JSONArray; import net.sf.json.JSONObject; import net.sf.json.JsonConfig; import net.sf.json.processors.DefaultValueProcessor; @@ -90,10 +91,17 @@ String type = StrutsParamUtils.getPraramValue("type", ""); StringBuffer jsonbuff = new StringBuffer(); if(StringUtils.isNotBlank(departmentCode)){ + // 【选择模板】的下拉选项“全部模板”,当下拉选为“全部模板”时,显示当前申请单的申请科室下所有模板中的物品名称(FJSSSYY-2) + jsonbuff.append("{id:"); + jsonbuff.append("0"); + jsonbuff.append(",title:'"); + jsonbuff.append("全部模板"); + jsonbuff.append("'}"); List templateList = departmentAppTemplateManager.getDepartmentAppTemplates(departmentCode); if(templateList != null){ for (DepartmentAppTemplate template : templateList) { if(InvoicePlan.TYPE_DIPOSABLE_GOODS_APPLICATION_FORM.equals(type)){ + // 一次性物品申请单只显示“一次性物品模板”(FJSSSYY-2) boolean b1 = DepartmentAppTemplate.TEMPLATE_TYPE_DIPOSABLEGOODS.equals(template.getTemplateType()); if(b1){ if(jsonbuff.length()>0){ @@ -105,7 +113,9 @@ jsonbuff.append(template.getTitle()); jsonbuff.append("'}"); } - }else if(InvoicePlan.TYPE_TOUSSE_APPLICATION_FORM.equals(type)){ + }else if(InvoicePlan.TYPE_TOUSSE_APPLICATION_FORM.equals(type) || InvoicePlan.TYPE_RECYCLINGCREATE_APPLICATION.equals(type) + || InvoicePlan.TYPE_GOODS_RESERVATION_FORM.equals(type)){ + // 器械包申请单、物品预约单、回收申请单 显示“治疗包模板”和“散件器械模板”(FJSSSYY-2) boolean b1 = DepartmentAppTemplate.TEMPLATE_TYPE_TOUSSE1.equals(template.getTemplateType()); boolean b2 = DepartmentAppTemplate.TEMPLATE_TYPE_TOUSSE2.equals(template.getTemplateType()); if(b1 || b2){ @@ -118,6 +128,28 @@ jsonbuff.append(template.getTitle()); jsonbuff.append("'}"); } + } else if(InvoicePlan.TYPE_COMBO_FORM.equals(type)){ + // 通用申请单可以显示所有类型的模板(FJSSSYY-2) + if(jsonbuff.length()>0){ + jsonbuff.append(","); + } + jsonbuff.append("{id:"); + jsonbuff.append(template.getId()); + jsonbuff.append(",title:'"); + jsonbuff.append(template.getTitle()); + jsonbuff.append("'}"); + } else if(InvoicePlan.TYPE_DISINFECT_GOODS_APPLICATION_FORM.equals(type)){ + // 消毒物品申请单只显示包含消毒物品的模板(FJSSSYY-2) + if(templateContainDisinfectGoods(template)){ + if(jsonbuff.length()>0){ + jsonbuff.append(","); + } + jsonbuff.append("{id:"); + jsonbuff.append(template.getId()); + jsonbuff.append(",title:'"); + jsonbuff.append(template.getTitle()); + jsonbuff.append("'}"); + } } } @@ -132,7 +164,87 @@ e.printStackTrace(); } } + + /** + * 判断申领模板是否包含消毒物品 + * @param template + * @return + */ + private boolean templateContainDisinfectGoods(DepartmentAppTemplate template) { + if(template == null || DepartmentAppTemplate.TEMPLATE_TYPE_DIPOSABLEGOODS.equals(template.getTemplateType())){ + return false; + } + List items = template.getTousseDefinitionTemplateItems(); + if(CollectionUtils.isEmpty(items)){ + return false; + } + for (TousseDefinitionTemplateItem item : items) { + TousseDefinition td = item.getTousseDefinition(); + if(TousseDefinition.PACKAGE_TYPE_DISINFECTION.equals(td.getTousseType())){ + return true; + } + } + return false; + } + /** + * 触摸屏回收选择科室后加载模板标题 + */ + public void loadDepartmentTemplateTitle(){ + String departmentCode = StrutsParamUtils.getPraramValue("departmentCode", ""); + String type = StrutsParamUtils.getPraramValue("type", ""); + JSONArray jsonArr = new JSONArray(); + if(StringUtils.isNotBlank(departmentCode)){ + JSONObject json = new JSONObject(); + json.put("id", "0"); + json.put("title", "全部"); + jsonArr.add(json); + List templateList = departmentAppTemplateManager.getDepartmentAppTemplates(departmentCode); + if(templateList != null){ + for (DepartmentAppTemplate template : templateList) { + if(InvoicePlan.TYPE_DIPOSABLE_GOODS_APPLICATION_FORM.equals(type)){ + // 一次性物品申请单显示一次性物品的模板 + boolean b1 = DepartmentAppTemplate.TEMPLATE_TYPE_DIPOSABLEGOODS.equals(template.getTemplateType()); + if(b1){ + JSONObject jsonObj = new JSONObject(); + jsonObj.put("id", template.getId()); + jsonObj.put("title", template.getTitle()); + jsonArr.add(jsonObj); + } + }else if(InvoicePlan.TYPE_TOUSSE_APPLICATION_FORM.equals(type) || InvoicePlan.TYPE_RECYCLINGCREATE_APPLICATION.equals(type) + || InvoicePlan.TYPE_GOODS_RESERVATION_FORM.equals(type)){ + // 器械包申请单、 物品预约单、回收申请单 显示“治疗包模板”和“散件器械模板” + boolean b1 = DepartmentAppTemplate.TEMPLATE_TYPE_TOUSSE1.equals(template.getTemplateType()); + boolean b2 = DepartmentAppTemplate.TEMPLATE_TYPE_TOUSSE2.equals(template.getTemplateType()); + if(b1 || b2){ + JSONObject jsonObj = new JSONObject(); + jsonObj.put("id", template.getId()); + jsonObj.put("title", template.getTitle()); + jsonArr.add(jsonObj); + } + } else if(InvoicePlan.TYPE_COMBO_FORM.equals(type)){ + // 通用申请单可以显示所有类型的模板 + JSONObject jsonObj = new JSONObject(); + jsonObj.put("id", template.getId()); + jsonObj.put("title", template.getTitle()); + jsonArr.add(jsonObj); + } else if(InvoicePlan.TYPE_DISINFECT_GOODS_APPLICATION_FORM.equals(type)){ + // 消毒物品申请单只显示包含消毒物品的模板 + if(templateContainDisinfectGoods(template)){ + JSONObject jsonObj = new JSONObject(); + jsonObj.put("id", template.getId()); + jsonObj.put("title", template.getTitle()); + jsonArr.add(jsonObj); + } + } + + } + } + } + StrutsResponseUtils.output(true, jsonArr); + + } + public void saveAppTemplate(){ String departmentIds = StrutsParamUtils.getPraramValue("departmentIds", ""); String tousseIds = StrutsParamUtils.getPraramValue("tousseIds", "");//25476;1,2655;2器械包id;排序号