Index: ssts-packing/src/main/java/com/forgon/disinfectsystem/packing/service/PackingManagerImpl.java =================================================================== diff -u -r35226 -r35248 --- ssts-packing/src/main/java/com/forgon/disinfectsystem/packing/service/PackingManagerImpl.java (.../PackingManagerImpl.java) (revision 35226) +++ ssts-packing/src/main/java/com/forgon/disinfectsystem/packing/service/PackingManagerImpl.java (.../PackingManagerImpl.java) (revision 35248) @@ -1512,8 +1512,9 @@ tdOfPackingTask = packingTask.getTousseDefinition(); } } + String recyclingAmountConfirmSql = buildRecyclingAmountConfirmSql(); if(!DatabaseUtil.isPoIdValid(packingTaskId) && pageSize != null && pageIndex != null && pageIndex > 0 && pageSize > 0){ - tousseNamesAndTaskTypes = getTousseNamesAndTaskType(taskGroup, basketBarcode, pageIndex, pageSize, queryTousseTypes, tousseOrDepart); + tousseNamesAndTaskTypes = getTousseNamesAndTaskType(taskGroup, basketBarcode, pageIndex, pageSize, queryTousseTypes, tousseOrDepart, recyclingAmountConfirmSql); if(CollectionUtils.isEmpty(tousseNamesAndTaskTypes)){ return taskVos; } @@ -1536,22 +1537,22 @@ if(tdOfPackingTask == null || !TousseDefinition.PACKAGE_TYPE_FOREIGN.equals(tdOfPackingTask.getTousseType()) && !TousseDefinition.PACKAGE_TYPE_SPLIT.equals(tdOfPackingTask.getTousseType()) && !TousseDefinition.PACKAGE_TYPE_CUSTOM.equals(tdOfPackingTask.getTousseType())){ - taskList = findPackingTaskFromCssdHandleToussesConfig(packingTaskId, showRecyclingPeopleColumnInPackingTasksList, taskGroup,basketBarcode,supplyRoomConfig, tousseNamesAndTaskTypes, tousseOrDepart); + taskList = findPackingTaskFromCssdHandleToussesConfig(packingTaskId, showRecyclingPeopleColumnInPackingTasksList, taskGroup,basketBarcode,supplyRoomConfig, tousseNamesAndTaskTypes, tousseOrDepart,recyclingAmountConfirmSql); } if(supplyRoomConfig != null){ //外来器械包默认处理科室及任务组 JSONObject foreignTousseHandleDepartAndTaskGroupJsonobject = supplyRoomConfig.getOneForeignTousseHandleDepartAndTaskGroupByDepartCode(AcegiHelper.getCurrentOrgUnitCode()); if(tdOfPackingTask != null && TousseDefinition.PACKAGE_TYPE_FOREIGN.equals(tdOfPackingTask.getTousseType()) || foreignTousseHandleDepartAndTaskGroupJsonobject != null && StringUtils.equals(taskGroup, foreignTousseHandleDepartAndTaskGroupJsonobject.optString("taskGroup"))){ //外来器械包的装配任务查询 - List foreignTousseTaskList = findForeignToussePackingTask(packingTaskId, showRecyclingPeopleColumnInPackingTasksList, basketBarcode, enableUrgentFunction, tousseNamesAndTaskTypes, tousseOrDepart); + List foreignTousseTaskList = findForeignToussePackingTask(packingTaskId, showRecyclingPeopleColumnInPackingTasksList, basketBarcode, enableUrgentFunction, tousseNamesAndTaskTypes, tousseOrDepart, recyclingAmountConfirmSql); if(CollectionUtils.isNotEmpty(foreignTousseTaskList)){ taskList.addAll(foreignTousseTaskList); } } if(tdOfPackingTask != null && TousseDefinition.PACKAGE_TYPE_CUSTOM.equals(tdOfPackingTask.getTousseType()) || StringUtils.equals(taskGroup, supplyRoomConfig.getCustomTousseDefaultTaskGroup())){ //自定义器械包的装配任务查询 - List customerTousseTaskList = findCustomerToussePackingTask(packingTaskId, showRecyclingPeopleColumnInPackingTasksList, basketBarcode, tousseNamesAndTaskTypes, tousseOrDepart); + List customerTousseTaskList = findCustomerToussePackingTask(packingTaskId, showRecyclingPeopleColumnInPackingTasksList, basketBarcode, tousseNamesAndTaskTypes, tousseOrDepart, recyclingAmountConfirmSql); if(CollectionUtils.isNotEmpty(customerTousseTaskList)){ taskList.addAll(customerTousseTaskList); } @@ -2016,7 +2017,7 @@ * @param pageSize 每页条数 * @return */ - public List getTousseNamesAndTaskType(String taskGroup, String basketBarcode, int pageIndex, int pageSize, Set queryTousseTypes, String tousseOrDepart){ + public List getTousseNamesAndTaskType(String taskGroup, String basketBarcode, int pageIndex, int pageSize, Set queryTousseTypes, String tousseOrDepart, String recyclingAmountConfirmSql){ String tousseTypeAndTaskGroupSql = ""; if(queryTousseTypes.contains(TousseDefinition.PACKAGE_TYPE_FOREIGN) && queryTousseTypes.contains(TousseDefinition.PACKAGE_TYPE_CUSTOM)){ tousseTypeAndTaskGroupSql = " and (po.tousseDefinition.tousseType in('"+ TousseDefinition.PACKAGE_TYPE_CUSTOM+ "','"+ TousseDefinition.PACKAGE_TYPE_FOREIGN +"','"+ TousseDefinition.PACKAGE_TYPE_FOREIGN +"') or po.tousseDefinition.ancestorID in(select tousseDefinitionId from CssdHandleTousses where taskGroup='"+ taskGroup +"' ) and po.tousseDefinition.tousseType not in('"+TousseDefinition.PACKAGE_TYPE_FOREIGN+"','"+TousseDefinition.PACKAGE_TYPE_SPLIT+"','"+TousseDefinition.PACKAGE_TYPE_CUSTOM+"')) "; //外来器械和自定义器械,有专门获取装配任务 @@ -2055,7 +2056,9 @@ String sql = String.format("select po.tousseDefinition.name,case when po.taskType="+ PackingTask.TASK_RECYCLINGRECORD +" then 1 else 0 end from %s po left join po.urgentLevelObj where " + " po.orgUnitCoding = '" + AcegiHelper.getLoginUser().getOrgUnitCodingFromSupplyRoomConfig() - + "' and po.tousseDefinition.ancestorID in (select id from TousseDefinition where (hidePackingTask is null or hidePackingTask<>'是') and forDisplay=1) %s %s %s group by po.tousseDefinition.name,case when po.taskType=1 then 1 else 0 end order by max(po.urgentLevelObj.grade) desc, case when po.taskType=1 then 1 else 0 end desc, po.tousseDefinition.name desc " + + "' " + + recyclingAmountConfirmSql + + " and po.tousseDefinition.ancestorID in (select id from TousseDefinition where (hidePackingTask is null or hidePackingTask<>'是') and forDisplay=1) %s %s %s group by po.tousseDefinition.name,case when po.taskType=1 then 1 else 0 end order by max(po.urgentLevelObj.grade) desc, case when po.taskType=1 then 1 else 0 end desc, po.tousseDefinition.name desc " , PackingTask.class.getSimpleName() ,StringUtils.isBlank(basketBarcode)?"":" and po.basketBarcode like '%" + basketBarcode + "%' " ,tousseTypeAndTaskGroupSql,tousseOrDepartSql); @@ -2064,6 +2067,17 @@ return tousseNamesAndTasks; } /** + * 构建对确认沟通是否隐藏装配任务的过滤条件 + * @return "" 或 and (po.recycleAmountNeedConfirm<>'是' or po.recycleAmountNeedConfirm is null) + */ + private String buildRecyclingAmountConfirmSql(){ + String recyclingAmountConfirmSql = ""; + if(CssdUtils.getSystemSetConfigByNameBool("confirmRecyclingAmount", false) && !CssdUtils.getSystemSetConfigByNameBool("doNotHidePackingTaskBeforeConfirmingCommunication", false)){ + recyclingAmountConfirmSql = String.format(" and (po.recycleAmountNeedConfirm<>'%s' or po.recycleAmountNeedConfirm is null) ",Constants.STR_YES); + } + return recyclingAmountConfirmSql; + } + /** * 获取是否查询自定义器械包 外来器械包和外来器械拆分小包 * @param taskGroup 任务组 * @param supplyRoomConfig @@ -2324,11 +2338,7 @@ * @param tousseNamesAndTaskTypes 包名称和装配任务类型 * @return 同时返回PackingTask和TousseDefintion两个实体类,避免多次查询 */ - private List findPackingTaskFromCssdHandleToussesConfig(Long packingTaskId, boolean showRecyclingPeopleColumnInPackingTasksList, String taskGroup,String basketBarcode,SupplyRoomConfig config, List tousseNamesAndTaskTypes, String tousseOrDepart) { - String recyclingAmountConfirmSql = "1=1"; - if(CssdUtils.getSystemSetConfigByNameBool("confirmRecyclingAmount", false)){ - recyclingAmountConfirmSql = String.format("(po.recycleAmountNeedConfirm<>'%s' or po.recycleAmountNeedConfirm is null)",Constants.STR_YES); - } + private List findPackingTaskFromCssdHandleToussesConfig(Long packingTaskId, boolean showRecyclingPeopleColumnInPackingTasksList, String taskGroup,String basketBarcode,SupplyRoomConfig config, List tousseNamesAndTaskTypes, String tousseOrDepart, String recyclingAmountConfirmSql) { boolean enableUrgentFunction = CssdUtils.getSystemSetConfigByNameBool("enableUrgentFunction", false); String orgCode = AcegiHelper.getLoginUser().getOrgUnitCodingFromSupplyRoomConfig(); String sql = ""; @@ -2363,7 +2373,7 @@ + "ct.tousseDefinitionId=td.ancestorID " //+ "and po.orgUnitCoding = ct.orgUnitCode " + "and (td.tousseType not in('"+TousseDefinition.PACKAGE_TYPE_FOREIGN+"','"+TousseDefinition.PACKAGE_TYPE_SPLIT+"','"+TousseDefinition.PACKAGE_TYPE_CUSTOM+"')) " //外来器械和自定义器械,有专门获取装配任务 - + "and ct.taskGroup = '"+taskGroup+"' and po.orgUnitCoding = '" + orgCode + "' and po.unPackAmount > 0 and " + recyclingAmountConfirmSql; + + "and ct.taskGroup = '"+taskGroup+"' and po.orgUnitCoding = '" + orgCode + "' and po.unPackAmount > 0 " + recyclingAmountConfirmSql; }else{ extraOrder = " po.urgentAmount desc, "; @@ -2379,7 +2389,7 @@ + leftJoinRecyclingRecordSql + "where po.orgUnitCoding = ct.orgUnitCode " + "and (td.tousseType not in('"+TousseDefinition.PACKAGE_TYPE_FOREIGN+"','"+TousseDefinition.PACKAGE_TYPE_SPLIT+"','"+TousseDefinition.PACKAGE_TYPE_CUSTOM+"')) " //外来器械和自定义器械,有专门获取装配任务 - + "and ct.taskGroup = '"+taskGroup+"' and po.orgUnitCoding = '" + orgCode + "' and po.unPackAmount > 0 and " + recyclingAmountConfirmSql; + + "and ct.taskGroup = '"+taskGroup+"' and po.orgUnitCoding = '" + orgCode + "' and po.unPackAmount > 0 " + recyclingAmountConfirmSql; } if(DatabaseUtil.isPoIdValid(packingTaskId)){ sql += " and po.id=" + packingTaskId; @@ -2464,13 +2474,8 @@ * @param tousseNamesAndTaskTypes 包名称和装配任务类型 * @return 同时返回PackingTask和TousseDefintion两个实体类,避免多次查询 */ - private List findForeignToussePackingTask(Long packingTaskId, boolean showRecyclingPeopleColumnInPackingTasksList, String basketBarcode, boolean enableUrgentFunction, List tousseNamesAndTaskTypes, String tousseOrDepart) { + private List findForeignToussePackingTask(Long packingTaskId, boolean showRecyclingPeopleColumnInPackingTasksList, String basketBarcode, boolean enableUrgentFunction, List tousseNamesAndTaskTypes, String tousseOrDepart, String recyclingAmountConfirmSql) { String orgCode = AcegiHelper.getLoginUser().getOrgUnitCodingFromSupplyRoomConfig(); - - String recyclingAmountConfirmSql = "1=1"; - if(CssdUtils.getSystemSetConfigByNameBool("confirmRecyclingAmount", false)){ - recyclingAmountConfirmSql = String.format("(po.recycleAmountNeedConfirm<>'%s' or po.recycleAmountNeedConfirm is null)",Constants.STR_YES); - } String urgentlevelQuery = null; String urgentlevelJoin = null; if(enableUrgentFunction){ @@ -2501,7 +2506,7 @@ + urgentlevelJoin + leftJoinRecyclingRecordSql + " where (td.tousseType='"+TousseDefinition.PACKAGE_TYPE_FOREIGN + "' or td.tousseType='" + TousseDefinition.PACKAGE_TYPE_SPLIT + "')" - + " and po.orgUnitCoding = '" + orgCode + "' and " + recyclingAmountConfirmSql; + + " and po.orgUnitCoding = '" + orgCode + "' " + recyclingAmountConfirmSql; Container basket = null; if(StringUtils.isNotBlank(basketBarcode)){ //验证篮筐是否清洗 @@ -2574,13 +2579,8 @@ * @param tousseNamesAndTaskTypes 包名称和装配任务类型 * @return 同时返回PackingTask和TousseDefintion两个实体类,避免多次查询 */ - private List findCustomerToussePackingTask(Long packingTaskId, boolean showRecyclingPeopleColumnInPackingTasksList, String basketBarcode, List tousseNamesAndTaskTypes, String tousseOrDepart) { + private List findCustomerToussePackingTask(Long packingTaskId, boolean showRecyclingPeopleColumnInPackingTasksList, String basketBarcode, List tousseNamesAndTaskTypes, String tousseOrDepart, String recyclingAmountConfirmSql) { String orgCode = AcegiHelper.getLoginUser().getOrgUnitCodingFromSupplyRoomConfig(); - - String recyclingAmountConfirmSql = "1=1"; - if(CssdUtils.getSystemSetConfigByNameBool("confirmRecyclingAmount", false)){ - recyclingAmountConfirmSql = String.format("(po.recycleAmountNeedConfirm<>'%s' or po.recycleAmountNeedConfirm is null)",Constants.STR_YES); - } String selectRecyclingUserSql = null; String leftJoinRecyclingRecordSql = null; if(showRecyclingPeopleColumnInPackingTasksList){ @@ -2599,7 +2599,7 @@ + " left join IDCardInstance ii on ii.id=ifp.idCardInstanceID " + " left join IDCardDefinition idn on idn.id=ii.idCardDefinitionID " + leftJoinRecyclingRecordSql - + "where td.tousseType='"+TousseDefinition.PACKAGE_TYPE_CUSTOM+"' and po.orgUnitCoding = '" + orgCode + "' and " + recyclingAmountConfirmSql; + + "where td.tousseType='"+TousseDefinition.PACKAGE_TYPE_CUSTOM+"' and po.orgUnitCoding = '" + orgCode + "' " + recyclingAmountConfirmSql; if(StringUtils.isNotBlank(basketBarcode)){ //验证篮筐是否清洗 Container basket = containerManager @@ -9519,8 +9519,9 @@ if(CollectionUtils.isEmpty(taskGroups)){ return; } + String recyclingAmountConfirmSql = buildRecyclingAmountConfirmSql(); for (TaskGroup taskGroup : taskGroups) { - int waitPackingTaskAmount = getWaitPackingTaskAmount(taskGroup); + int waitPackingTaskAmount = getWaitPackingTaskAmount(taskGroup, recyclingAmountConfirmSql); if(waitPackingTaskAmount > 0){ throw new SystemException("此任务组还有未完成的待装配任务,不能删除!"); } @@ -9546,14 +9547,10 @@ * @param taskGroup * @return */ - private int getWaitPackingTaskAmount(TaskGroup taskGroup) { + private int getWaitPackingTaskAmount(TaskGroup taskGroup, String recyclingAmountConfirmSql) { if(taskGroup == null || StringUtils.isBlank(taskGroup.getTaskGroupName())){ return 0; } - String recyclingAmountConfirmSql = "1=1"; - if(CssdUtils.getSystemSetConfigByNameBool("confirmRecyclingAmount", false)){ - recyclingAmountConfirmSql = String.format("(po.recycleAmountNeedConfirm<>'%s' or po.recycleAmountNeedConfirm is null)",Constants.STR_YES); - } int packTaskAmount = 0; // 普通器械包、消毒物品及敷料包的装配任务查询 String sqlCondition = "select count(*) from PackingTask po " @@ -9562,7 +9559,7 @@ + " where ct.tousseDefinitionId = td.ancestorID" + " and (td.tousseType not in('"+TousseDefinition.PACKAGE_TYPE_FOREIGN+"','"+TousseDefinition.PACKAGE_TYPE_SPLIT+"','"+TousseDefinition.PACKAGE_TYPE_CUSTOM+"')) " //外来器械和自定义器械,有专门获取装配任务 + " and ct.taskGroup = '" + taskGroup.getTaskGroupName() + "'" - + " and po.unPackAmount > 0 and " + recyclingAmountConfirmSql; + + " and po.unPackAmount > 0 " + recyclingAmountConfirmSql; packTaskAmount += objectDao.countBySql(sqlCondition); //科室供应室配置 @@ -9574,7 +9571,7 @@ String foreignTousseSql = "select count(*) from PackingTask po " + " join TousseDefinition td on po.tousseDefinition_id = td.id " + " where (td.tousseType='"+TousseDefinition.PACKAGE_TYPE_FOREIGN + "' or td.tousseType='" + TousseDefinition.PACKAGE_TYPE_SPLIT + "')" - + " and " + recyclingAmountConfirmSql; + + recyclingAmountConfirmSql; packTaskAmount += objectDao.countBySql(foreignTousseSql); } @@ -9583,7 +9580,7 @@ String customTousseSql = "select count(*) from PackingTask po " + " join TousseDefinition td on po.tousseDefinition_id = td.id " + " where td.tousseType='"+TousseDefinition.PACKAGE_TYPE_CUSTOM + "'" - + " and " + recyclingAmountConfirmSql; + + recyclingAmountConfirmSql; packTaskAmount += objectDao.countBySql(customTousseSql); }