Index: ssts-operationmonitor/src/main/java/com/forgon/disinfectsystem/supplyroomcontrol/service/SupplyRoomControlManagerImpl.java =================================================================== diff -u -r27895 -r27994 --- ssts-operationmonitor/src/main/java/com/forgon/disinfectsystem/supplyroomcontrol/service/SupplyRoomControlManagerImpl.java (.../SupplyRoomControlManagerImpl.java) (revision 27895) +++ ssts-operationmonitor/src/main/java/com/forgon/disinfectsystem/supplyroomcontrol/service/SupplyRoomControlManagerImpl.java (.../SupplyRoomControlManagerImpl.java) (revision 27994) @@ -14,6 +14,8 @@ import java.util.Map.Entry; import java.util.Set; +import javax.servlet.http.HttpServletRequest; + import net.sf.json.JSONArray; import net.sf.json.JSONObject; @@ -25,8 +27,6 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem; import com.forgon.databaseadapter.service.DateQueryAdapter; -import com.forgon.directory.acegi.tools.AcegiHelper; -import com.forgon.disinfectsystem.basedatamanager.container.service.ContainerManager; import com.forgon.disinfectsystem.basedatamanager.supplyroomconfig.service.SupplyRoomConfigManager; import com.forgon.disinfectsystem.entity.basedatamanager.supplyroomconfig.SupplyRoomConfig; import com.forgon.disinfectsystem.entity.basedatamanager.toussedefinition.TousseDefinition; @@ -55,8 +55,13 @@ private DateQueryAdapter dateQueryAdapter; private ObjectDao objectDao; - private ContainerManager containerManager; - + + private SupplyRoomControlManager2 supplyRoomControlManagerImpl2; + + public void setSupplyRoomControlManagerImpl2( + SupplyRoomControlManager2 supplyRoomControlManagerImpl2) { + this.supplyRoomControlManagerImpl2 = supplyRoomControlManagerImpl2; + } //申请单类型 public static final String INVOICEPLAN_TYPE = "'" + InvoicePlan.TYPE_TOUSSE_APPLICATION_FORM+"','" @@ -87,12 +92,6 @@ SupplyRoomConfigManager supplyRoomConfigManager) { this.supplyRoomConfigManager = supplyRoomConfigManager; } - - - public void setContainerManager(ContainerManager containerManager) { - this.containerManager = containerManager; - } - public void setObjectDao(ObjectDao objectDao) { this.objectDao = objectDao; } @@ -104,48 +103,70 @@ // 申请单 @Override @SuppressWarnings("unchecked") - public Map getRecyclingApplicationList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName,String tousseType, String orgUnitCoding) { - - String dressing1 = ""; - String dressing2 = ""; - if(!TousseDefinition.PACKAGE_TYPE_DRESSING.equals(tousseType) && !"一次性物品".equals(tousseType)){ - dressing1 = ",rr.recyclingTime as \"recyclingTime\",po.basketName as \"basketName\""; - dressing2 = "po.recyclingAmount as \"recyclingAmount\","; - } - String startDateStr = dateQueryAdapter.dateAdapter(statDate); + public Map getRecyclingApplicationList(String startDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName,String tousseType, String orgUnitCoding, String comboTousseType) { + String startDateStr = dateQueryAdapter.dateAdapter(startDate); String endDateStr = dateQueryAdapter.dateAdapter(endDate); - - String countSql = "select count(*),sum(po.amount),sum(po.recyclingAmount) "; - - String sql = "select distinct ip.id as \"id\",po.tousseName as \"tousseName\",po.urgentAmount as \"urgentAmount\",po.sendOutAmount as \"sendOutAmount\"," + - "po.amount as \"amount\",ip.depart as \"depart\"," + dressing2 + - "ip.departCoding as \"departCoding\",ip.applicationTime as \"applicationTime\"," + - "ip.submitTime as \"submitTime\",ip.printTime as \"printTime\"," + - "ip.serialNumber as \"serialNumber\",ip.settleAccountsDepart as \"settleAccountsDepart\"," + - "replace(ip.remark,'\"',' ') as \"remark\",ip.applicant as \"applicant\",po.diposable as \"diposable\"" + dressing1; - - String whereSql = " from TousseItem po,invoicePlan ip left join RecyclingRecord rr" - +" on rr.recyclingApplication_id = ip.id where po.RecyclingApplication_id = ip.id " - +" and ip.type in (" + INVOICEPLAN_TYPE + ") and ip.applicationTime between " - + startDateStr +" and " + endDateStr - + " and ip.committedStatus = 1 and (ip.recyclingStatus != '" - + InvoicePlan.STATUS_END+"' or ip.recyclingStatus is null)"; - - whereSql = setDisinfectionGoodsQuerySql(tousseName, tousseType, whereSql); - - if(StringUtils.isNotBlank(departCoding)){ - whereSql += " and ip.depart = '"+departCoding+"'"; + String invoicePlanOrgUnitCodingSql = ""; + if(StringUtils.isNotBlank(orgUnitCoding)){ + if(!orgUnitCoding.contains(",")){ + invoicePlanOrgUnitCodingSql += " and ip.handleDepartCoding = '"+ orgUnitCoding +"'"; + }else{ + invoicePlanOrgUnitCodingSql += " and " + SqlUtils.getStringFieldInLargeCollectionsPredicate("ip.handleDepartCoding", SqlUtils.splitStringToSet(orgUnitCoding, ",")); + } } + String recyclingRecordOrgUnitCodingSql = ""; if(StringUtils.isNotBlank(orgUnitCoding)){ if(!orgUnitCoding.contains(",")){ - whereSql += " and ip.handleDepartCoding = '"+ orgUnitCoding +"'"; + recyclingRecordOrgUnitCodingSql += " and rr.orgUnitCoding = '"+ orgUnitCoding +"'"; }else{ - whereSql += " and " + SqlUtils.getStringFieldInLargeCollectionsPredicate("ip.handleDepartCoding", SqlUtils.splitStringToSet(orgUnitCoding, ",")); + recyclingRecordOrgUnitCodingSql += " and " + SqlUtils.getStringFieldInLargeCollectionsPredicate("rr.orgUnitCoding", SqlUtils.splitStringToSet(orgUnitCoding, ",")); } } - sql += whereSql; - countSql += whereSql; + String typeSql = supplyRoomControlManagerImpl2.getGoodsTypeByComboTousseType(comboTousseType, "tousseType", "po"); + if (StringUtils.isNotBlank(typeSql)) { + typeSql = String.format(" and %s", typeSql); + }else{ + typeSql = ""; + } + String typeSql2 = supplyRoomControlManagerImpl2.getGoodsTypeByComboTousseType(comboTousseType, "tousseType", "ri"); + if (StringUtils.isNotBlank(typeSql2)) { + typeSql2 = String.format(" and %s", typeSql2); + }else{ + typeSql2 = ""; + } + String sql = " select * from (select distinct ip.id as id,po.tousseName as tousseName,po.amount as amount,ip.depart as depart,po.recyclingAmount as recyclingAmount,ip.applicationTime as applicationTime,ip.submitTime as submitTime,ip.printTime as printTime,ip.applicant as applicant,po.diposable as diposable,rr.recyclingTime as recyclingTime,po.basketName as basketName " + + " from TousseItem po join invoicePlan ip on po.RecyclingApplication_id = ip.id " + +" left join RecyclingRecord rr on rr.recyclingApplication_id = ip.id " + +" left join RecyclingItem ri on rr.id = ri.recyclingRecord_id and ri.tousseDefinitionId = po.toussedefinitionid " + +" where (ip.applicationTime between " + + startDateStr +" and " + + endDateStr+" or ip.recyclingTime between " + + startDateStr+" and " + + endDateStr + +" ) " + + " and ip.committedStatus = 1 " + + invoicePlanOrgUnitCodingSql + + typeSql + + " union " + + " select distinct rr.recyclingApplication_id as id,ri.tousseName as tousseName,0 as amount,rr.depart as depart,ri.amount as recyclingAmount,rr.recyclingTime as applicationTime,rr.recyclingTime as submitTime,null as printTime,rr.operator as applicant,'否' as diposable,rr.recyclingTime as recyclingTime,null as basketName " + + " from RecyclingRecord rr join RecyclingItem ri on rr.id = ri.recyclingRecord_id " + + " where rr.recyclingApplication_id is null " + + recyclingRecordOrgUnitCodingSql + + typeSql2 + + "and rr.recyclingTime between " + + startDateStr + + " and " + + endDateStr + + " ) po where 1=1 "; + sql = setDisinfectionGoodsQuerySql(tousseName, tousseType, sql); + if(StringUtils.isNotBlank(departCoding)){ + sql += " and po.depart = '"+departCoding+"'"; + } + String countSql = "select count(*),sum(temp.amount),sum(temp.recyclingAmount) from (" + + sql + +" )temp "; + sql += " order by po.depart ,po.applicationTime desc "; Integer [] amountArry = countBySql(countSql); int totalCount = amountArry[0]; int totalAppAmount = amountArry[1]; @@ -158,32 +179,6 @@ } catch (Exception e) { e.printStackTrace(); } - - //供应室自己科室的回收申请单不统计 - /*if(!TousseDefinition.PACKAGE_TYPE_DRESSING.equals(tousseType) && !"一次性物品".equals(tousseType)){ - SupplyRoomConfig config = supplyRoomConfigManager.getFirstSupplyRoomConfig(); - String orgUnitCoding = config.getOrgUnitCoding(); - - String sql1 = "select ti.tousseName as \"tousseName\",ti.amount as \"amount\"," + - "rd.depart as \"depart\",rd.recyclingTime as \"recyclingTime\"," + - "ti.basketName as \"basketName\" "; - - sql1 += "from TousseItem ti,recyclingRecord rd where ti.recyclingRecord_id = rd.id " - + " and rd.orgUnitCoding = '"+orgUnitCoding+"'" - + " and rd.recyclingApplication_id is null" - + " and rd.recyclingTime between " - + startDateStr + " and " + endDateStr; - if(StringUtils.isNotBlank(tousseName)){ - sql1 += " and ti.tousseName = '"+tousseName+"'"; - } - if(StringUtils.isNotBlank(departCoding)){ - sql1 += " and rd.depart = '"+departCoding+"'"; - } - sql1 += " order by rd.RecyclingTime"; - List TousseOperateList = objectDao.findBySql(TousseOperate.class, sql1, Integer.parseInt(currentPage), Integer.parseInt(pageSize)); - totalCount += TousseOperateList.size(); - list.addAll(TousseOperateList); - }*/ Map applicationMap = new HashMap(); applicationMap.put("totalCount", totalCount); applicationMap.put("totalAppAmount", totalAppAmount); @@ -203,7 +198,7 @@ */ @Override @SuppressWarnings("unchecked") - public Map getWashDisinfectionList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName,String tousseType, String orgUnitCoding){ + public Map getWashDisinfectionList(String startDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName,String tousseType, String orgUnitCoding, String comboTousseType){ String whereSqlForOrgUnitCoding = null; if(StringUtils.isNotBlank(orgUnitCoding)){ if(!orgUnitCoding.contains(",")){ @@ -214,36 +209,105 @@ }else{ whereSqlForOrgUnitCoding = ""; } - String countSql = "select count(*),sum(ci.amount-case when numOfUnwashedStops is null then 0 else numOfUnwashedStops end),sum(ci.amount-case when numOfUnwashedStops is null then 0 else numOfUnwashedStops end) "; - String sql = "select wr.id as \"id\",ci.name as \"tousseName\",(ci.amount-case when numOfUnwashedStops is null then 0 else numOfUnwashedStops end) as \"amount\"," + + String countSql = "select count(*),sum(amount),sum(amount) "; + String selectSql = "select wr.id as \"id\",ci.name as \"tousseName\",(ci.amount-case when numOfUnwashedStops is null then 0 else numOfUnwashedStops end) as \"amount\"," + "wr.startDate as \"startDate\",wr.endDate as \"endDate\","+ "wr.operator as \"operator\",wr.disinfectIdentification as \"disinfectIdentification\"," + "wr.disinfectProgram as \"disinfectProgram\",cb.containerName as \"basketName\" " ; + //如果科室条件不为空,则增加科室的过滤条件 + String leftJoinSql = ""; + String departSql = ""; + if(StringUtils.isNotBlank(departCoding)){ + leftJoinSql = " left join RecyclingRecord rr on ci.recyclingRecordId=rr.id "; + departSql = " and rr.depart='"+ departCoding +"'"; + } + String tousseNameSql = ""; + if (StringUtils.isNotBlank(tousseName)) { + if (TousseDefinition.PACKAGE_TYPE_DISINFECTION.equals(tousseType)) { + tousseNameSql = " and (ci.tousseNameForMaterial like '%" + tousseName + "%' or (td.tousseType = '" + TousseDefinition.PACKAGE_TYPE_DISINFECTION + "' and ci.name = '" + tousseName + "'))"; + }else { + tousseNameSql = " and td.name = '" + tousseName + "'"; + } + } + String typeSql = supplyRoomControlManagerImpl2.getGoodsTypeByComboTousseType(comboTousseType,"tousseType", "td"); + if (StringUtils.isNotBlank(typeSql)){ + typeSql = " and " + typeSql; + }else{ + typeSql = ""; + } + String sql = selectSql + " from WashAndDisinfectRecord wr " + + " left join ClassifyBasket_WashRecord cw on wr.id = cw.WashAndDisinfectRecord_ID" + + " left join ClassifyBasket cb on cb.id = cw.ClassifyBasket_ID" + + " left join ClassifiedItem ci on cb.id = ci.classifybasket_id " + + " left join RecyclingRecord rr on ci.recyclingRecordId=rr.id " + + " left join TousseDefinition td on ci.tousseDefinitionID=td.id " + + " where ci.itemType = '材料' " + + whereSqlForOrgUnitCoding + + " and wr.washMaterialAmount <> 0 " + + " and wr.endDate between " + + dateQueryAdapter.dateAdapter(startDate) + + " and " + + dateQueryAdapter.dateAdapter(endDate) + + departSql + + tousseNameSql + + typeSql + + " union all " + + selectSql + + " from WashAndDisinfectRecord wr " + + " inner join ClassifyBasket_WashRecord cw on cw.WashAndDisinfectRecord_ID = wr.id " + + " inner join ClassifyBasket cb on cb.id = cw.ClassifyBasket_ID " + + " inner join ClassifiedItem ci on ci.classifybasket_id = cb.id " + + leftJoinSql + + " inner join TousseDefinition td on ci.toussedefinition_id = td.id " + + " where ci.tousseDefinitionID is null and ci.itemType = '材料' " + + whereSqlForOrgUnitCoding + + " and wr.washMaterialAmount <> 0 " + + " and wr.endDate between " + + dateQueryAdapter.dateAdapter(startDate) + + " and " + + dateQueryAdapter.dateAdapter(endDate) + + departSql + + tousseNameSql + + typeSql; + selectSql = " union all select wr.id as \"id\",ci.name as \"tousseName\",(ci.amount-case when numOfUnwashedStops is null then 0 else numOfUnwashedStops end)*ci.materialAmount as \"amount\"," + + "wr.startDate as \"startDate\",wr.endDate as \"endDate\"," + + "wr.operator as \"operator\",wr.disinfectIdentification as \"disinfectIdentification\"," + + "wr.disinfectProgram as \"disinfectProgram\",cb.containerName as \"basketName\" "; + sql += selectSql + + " from WashAndDisinfectRecord wr " + + " inner join ClassifyBasket_WashRecord cw on cw.WashAndDisinfectRecord_ID = wr.id " + + " inner join ClassifyBasket cb on cb.id = cw.ClassifyBasket_ID " + + " inner join ClassifiedItem ci on ci.classifybasket_id = cb.id " + + " inner join TousseDefinition td on td.id = ci.toussedefinition_id " + + leftJoinSql + + " where ci.itemType <> '材料' " + + whereSqlForOrgUnitCoding + + " and wr.washMaterialAmount <> 0 " + + " and wr.endDate between " + + dateQueryAdapter.dateAdapter(startDate) + + " and " + + dateQueryAdapter.dateAdapter(endDate) + + departSql + + tousseNameSql + + typeSql; + if(StringUtils.isBlank(typeSql) && StringUtils.isBlank(departSql) && StringUtils.isBlank(typeSql)){ + selectSql = "select wr.id as \"id\",md.name as \"tousseName\",wrm.amount as \"amount\"," + + "wr.startDate as \"startDate\",wr.endDate as \"endDate\"," + + "wr.operator as \"operator\",wr.disinfectIdentification as \"disinfectIdentification\"," + + "wr.disinfectProgram as \"disinfectProgram\",'' as \"basketName\" "; + sql += " union all " + + selectSql + + " from WashAndDisinfectRecord wr, WashRecord_WashMaterial wm,WashAndDisinfectRecordMaterial wrm,MaterialDefinition md, OrgUnit org " + + " where wm.WashAndDisinfectRecord_ID = wr.id and wrm.id = wm.WashAndDisinfectMaterial_ID and wrm.materialDefinition_id = md.id and org.orgUnitCoding = wr.orgUnitCoding " + + whereSqlForOrgUnitCoding + + " and wr.endDate between " + + dateQueryAdapter.dateAdapter(startDate) + + " and " + + dateQueryAdapter.dateAdapter(endDate); + } - String whereSql = "from WashAndDisinfectRecord wr " - +" left join ClassifyBasket_WashRecord cw on wr.id = cw.WashAndDisinfectRecord_ID" - +" left join ClassifyBasket cb on cb.id = cw.ClassifyBasket_ID" - +" left join ClassifiedItem ci on cb.id = ci.classifybasket_id " - +" where 1=1 " - + whereSqlForOrgUnitCoding - +" and (ci.itemType = '材料' or ci.itemType in ("+TOUSSE_TYPE+"))" - +" and wr.recordCreateDate between " - + dateQueryAdapter.dateAdapter(statDate) - +" and " - + dateQueryAdapter.dateAdapter(endDate); - - if(StringUtils.isNotBlank(tousseName)){ - if(TousseDefinition.PACKAGE_TYPE_DISINFECTION.equals(tousseType)){ - whereSql += " and (ci.tousseNameForMaterial like '%" + tousseName + "%' or (ci.itemType = '"+TousseDefinition.PACKAGE_TYPE_DISINFECTION+"' and ci.name = '"+tousseName+"'))"; - }else{ - whereSql += " and ci.name = '"+tousseName+"'"; - } - } - - countSql += whereSql; - whereSql += " order by wr.endDate desc"; - sql += whereSql; - + countSql = countSql + " from (" + sql + ")temp"; + sql += " order by wr.endDate desc "; Integer [] amountArray = countBySql(countSql); int totalCount = amountArray[0]; int totalWashAmount = amountArray[1]; @@ -279,7 +343,7 @@ //获取审核数量,器械包名称 @Override @SuppressWarnings("unchecked") - public Map getReviewList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName,String tousseType, String orgUnitCoding) { + public Map getReviewList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName,String tousseType, String orgUnitCoding, String comboTousseType) { String whereSqlForOrgUnitCoding = null; if(StringUtils.isNotBlank(orgUnitCoding)){ if(!orgUnitCoding.contains(",")){ @@ -304,8 +368,15 @@ + dateQueryAdapter.dateAdapter(statDate) + " and " + dateQueryAdapter.dateAdapter(endDate); - + //如果科室条件不为空,则增加科室的过滤条件 + if(StringUtils.isNotBlank(departCoding)){ + whereSql += " and po.depart='"+ departCoding +"'"; + } whereSql = setDisinfectionGoodsQuerySql(tousseName, tousseType, whereSql); + String typeSql = supplyRoomControlManagerImpl2.getGoodsTypeByComboTousseType(comboTousseType, "tousseType", "tf"); + if (StringUtils.isNotBlank(typeSql)) { + whereSql += String.format(" and %s", typeSql); + } totalCountSql += whereSql; whereSql += " group by po.tousseName,po.reviewer,po.reviewTime,po.sterilizationBasket"; @@ -330,7 +401,7 @@ //获取灭菌记录的已灭菌器械包 @Override @SuppressWarnings("unchecked") - public Map getSterilizationList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName,String tousseType, String orgUnitCoding) { + public Map getSterilizationList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName,String tousseType, String orgUnitCoding, String comboTousseType) { String whereSqlForOrgUnitCoding = null; if(StringUtils.isNotBlank(orgUnitCoding)){ if(!orgUnitCoding.contains(",")){ @@ -347,23 +418,18 @@ String notJoinedBasketSql = "select ti.tousseName as \"tousseName\",sr.id as \"id\",sr.sterilizationUser as \"operator\",s.name as \"disinfectIdentification\"," + "sr.frequency as \"frequency\",sr.sterilizationType as \"disinfectProgram\",sr.startDate as \"startDate\"," + "sr.endDate as \"endDate\",'' as \"basketName\" "; - - /*String whereSql = "from Container c,SterilizationRecord sr " - + "left join Sterilizer s on s.id = sr.sterilizer_id " - + "left join sterilization_reviewed st on st.sterilizationRecord_id = sr.id " - + "left join ReviewedBasket rb on rb.id = st.reviewedBasket_id " - + "left join TousseInstance ti on ti.reviewBasket_ID = rb.id,TousseDefinition td " - + "where ti.toussename = td.name " - + "and c.id = rb.container_id " - + "and sr.orgUnitCoding = '"+orgUnitCoding+"' " - + "and td.tousseType in (" + TOUSSE_TYPE + ") " - + "and sr.status = '"+SterilizationRecord.STERILIZATION_STATUS_END+"' " - + "and sr.endDate between " - + dateQueryAdapter.dateAdapter(statDate) - + " and " - + dateQueryAdapter.dateAdapter(endDate);*/ - - String joinedBasketWhereSql = "from TousseInstance ti left join TousseDefinition td on ti.toussename = td.name " + String typeSql = supplyRoomControlManagerImpl2.getGoodsTypeByComboTousseType(comboTousseType, "tousseType", "td"); + if (StringUtils.isNotBlank(typeSql)) { + typeSql = String.format(" and %s", typeSql); + }else{ + typeSql = ""; + } + //如果科室条件不为空,则增加科室的过滤条件 + String departCodingSql = ""; + if(StringUtils.isNotBlank(departCoding)){ + departCodingSql = " and ti.depart='"+ departCoding +"'"; + } + String joinedBasketWhereSql = "from TousseInstance ti left join TousseDefinition td on ti.tousseDefinition_id = td.id " + "left join ReviewedBasket rb on rb.id = ti.reviewBasket_id " + "left join Container c on c.id = rb.container_id " + "left join sterilization_reviewed st on st.reviewedBasket_id = rb.id " @@ -372,20 +438,22 @@ + "where 1=1 " //+ "and ti.status='"+ TousseInstance.STATUS_STERILED +"' " + whereSqlForOrgUnitCoding - + " and td.tousseType in (" + TOUSSE_TYPE + ") " + + typeSql + + departCodingSql + "and sr.status = '"+SterilizationRecord.STERILIZATION_STATUS_END+"' " + "and sr.endDate between " + dateQueryAdapter.dateAdapter(statDate) + " and " + dateQueryAdapter.dateAdapter(endDate); - String notJoinedBasketWhereSql = "from TousseInstance ti left join TousseDefinition td on ti.toussename = td.name " + String notJoinedBasketWhereSql = "from TousseInstance ti left join TousseDefinition td on ti.tousseDefinition_id = td.id " + "left join sterilization_tousseInstance st on st.tousseInstance_id = ti.id " + "left join SterilizationRecord sr on sr.id = st.sterilizationRecord_id " + "left join Sterilizer s on s.id = sr.sterilizer_id " + "where 1=1 " + whereSqlForOrgUnitCoding - + " and td.tousseType in (" + TOUSSE_TYPE + ") " + + typeSql + + departCodingSql + "and sr.status = '"+SterilizationRecord.STERILIZATION_STATUS_END+"' " + "and sr.endDate between " + dateQueryAdapter.dateAdapter(statDate) @@ -422,7 +490,7 @@ // 待装配任务列表 @Override @SuppressWarnings("unchecked") - public Map getPackingList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName,String tousseType, String orgUnitCoding) { + public Map getPackingList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName,String tousseType, String orgUnitCoding, String comboTousseType) { String whereSqlForOrgUnitCoding = null; if(StringUtils.isNotBlank(orgUnitCoding)){ if(!orgUnitCoding.contains(",")){ @@ -442,9 +510,15 @@ + " and " + dateQueryAdapter.dateAdapter(endDate) + whereSqlForOrgUnitCoding; - + //如果科室条件不为空,则增加科室的过滤条件 + if(StringUtils.isNotBlank(departCoding)){ + whereSql = whereSql + " and po.depart='"+ departCoding +"'"; + } whereSql = setDisinfectionGoodsQuerySql(tousseName, tousseType, whereSql); - + String typeSql = supplyRoomControlManagerImpl2.getGoodsTypeByComboTousseType(comboTousseType, "tousseType", "po"); + if (StringUtils.isNotBlank(typeSql)) { + whereSql += String.format(" and %s", typeSql); + } countSql += whereSql; whereSql += " order by po.packTime desc"; @@ -505,7 +579,7 @@ // 发货计划单 @Override @SuppressWarnings("unchecked") - public Map getInvoicePlanList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName,String tousseType, String orgUnitCoding) { + public Map getInvoicePlanList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName,String tousseType, String orgUnitCoding, String comboTousseType) { String whereSqlForOrgUnitCoding = null; if(StringUtils.isNotBlank(orgUnitCoding)){ if(!orgUnitCoding.contains(",")){ @@ -536,7 +610,16 @@ if(StringUtils.isNotBlank(departCoding)){ whereSql += " and i.depart = '"+departCoding+"'"; } - sql += whereSql; + //如果物品类型为空,则设置物品类型为"全部器械包" + if(StringUtils.isBlank(comboTousseType) + || StringUtils.equals("all", comboTousseType)){ + comboTousseType = "allTousse"; + } + String typeSql = supplyRoomControlManagerImpl2.getGoodsTypeByComboTousseType(comboTousseType, "tousseType", "po"); + if (StringUtils.isNotBlank(typeSql)) { + whereSql += String.format(" and %s", typeSql); + } + sql += whereSql + " order by depart,senderTime desc"; countSql += whereSql; Integer [] amountArray = countBySql(countSql); int totalCount = amountArray[0]; @@ -789,33 +872,34 @@ @Override @SuppressWarnings({ "unchecked", "deprecation" }) - public void createOperateData(OutputStream ops, String goodNmae, + public void createOperateData(HttpServletRequest request,OutputStream ops, String goodNmae, String tousseType, String department, String startDate, - String endDate, String orgUnitCoding) { - + String endDate, String orgUnitCoding, String comboTousseType) { + request.getSession().setAttribute("writeecreateOperateDataIsOver", false); + request.getSession().setAttribute("operationMonitoringExportMessage", ""); //获取申请和回收数据 List appAndRecycList = (List) getRecyclingApplicationList( - startDate,endDate,department,"0","0",goodNmae,tousseType,orgUnitCoding).get("data"); + startDate,endDate,department,"0","0",goodNmae,tousseType,orgUnitCoding,comboTousseType).get("data"); //获取清洗数据 List washDisinfectionList = (List) getWashDisinfectionList( - startDate,endDate,department,"0","0",goodNmae,tousseType,orgUnitCoding).get("data"); + startDate,endDate,department,"0","0",goodNmae,tousseType,orgUnitCoding,comboTousseType).get("data"); //获取装备数据 List packingList = (List) getPackingList( - startDate,endDate,department,"0","0",goodNmae,tousseType,orgUnitCoding).get("data"); + startDate,endDate,department,"0","0",goodNmae,tousseType,orgUnitCoding,comboTousseType).get("data"); //获取审核数据 List reviewList = (List)getReviewList( - startDate,endDate,department,"0","0",goodNmae,tousseType,orgUnitCoding).get("data"); + startDate,endDate,department,"0","0",goodNmae,tousseType,orgUnitCoding,comboTousseType).get("data"); //获取灭菌数据 List sterilizationList = (List)getSterilizationList( - startDate,endDate,department,"0","0",goodNmae,tousseType,orgUnitCoding).get("data"); + startDate,endDate,department,"0","0",goodNmae,tousseType,orgUnitCoding,comboTousseType).get("data"); //获取发货数据 List invoiceList = (List)getInvoicePlanList( - startDate,endDate,department,"0","0",goodNmae,tousseType,orgUnitCoding).get("data"); + startDate,endDate,department,"0","0",goodNmae,tousseType,orgUnitCoding,comboTousseType).get("data"); String inputFile = Path.getWebAppRoot() + "/disinfectsystem/reportforms/demo3.xls"; @@ -829,9 +913,6 @@ ExcelCellStyle.iniAllStyles(); int size = appAndRecycList.size(); if(appAndRecycList != null && size>0){ - - appAndRecycList = groupByTousseOperate(appAndRecycList); - Map toMap = new LinkedHashMap(); HSSFSheet sheet = wb.getSheetAt(0); @@ -869,9 +950,6 @@ size = washDisinfectionList.size(); if(washDisinfectionList != null && size>0){ - - washDisinfectionList = groupByTousseOperate(washDisinfectionList); - Map toMap = new HashMap(); HSSFSheet sheet = wb.getSheetAt(1); @@ -909,9 +987,6 @@ size = packingList.size(); if(packingList != null && packingList.size()>0){ - - packingList = groupByTousseOperate(packingList); - Map toMap = new HashMap(); HSSFSheet sheet = wb.getSheetAt(2); @@ -941,9 +1016,6 @@ size = reviewList.size(); if(reviewList != null && reviewList.size()>0){ - - reviewList = groupByTousseOperate(reviewList); - Map toMap = new HashMap(); HSSFSheet sheet = wb.getSheetAt(3); @@ -974,9 +1046,6 @@ size = sterilizationList.size(); if(sterilizationList != null && sterilizationList.size()>0){ - - sterilizationList = groupByTousseOperate(sterilizationList); - Map toMap = new HashMap(); HSSFSheet sheet = wb.getSheetAt(4); @@ -1016,8 +1085,6 @@ if(invoiceList != null && invoiceList.size()>0){ - invoiceList = groupByTousseOperate(invoiceList); - Map toMap = new HashMap(); HSSFSheet sheet = wb.getSheetAt(5); @@ -1047,15 +1114,20 @@ } wb.write(ops); - } catch (Exception e) { + }catch(IllegalArgumentException e){ + request.getSession().setAttribute("operationMonitoringExportMessage", "数据量过于庞大,已超出excel限制的65536行"); e.printStackTrace(); + }catch (Exception e) { + request.getSession().setAttribute("operationMonitoringExportMessage", "导出异常"); + e.printStackTrace(); }finally { try { ops.close(); fos.close(); } catch (IOException e) { e.printStackTrace(); } + request.getSession().setAttribute("writeecreateOperateDataIsOver", true); } } Index: ssts-operationmonitor/src/main/java/com/forgon/disinfectsystem/supplyroomcontrol/action/SupplyRoomControlAction.java =================================================================== diff -u -r27800 -r27994 --- ssts-operationmonitor/src/main/java/com/forgon/disinfectsystem/supplyroomcontrol/action/SupplyRoomControlAction.java (.../SupplyRoomControlAction.java) (revision 27800) +++ ssts-operationmonitor/src/main/java/com/forgon/disinfectsystem/supplyroomcontrol/action/SupplyRoomControlAction.java (.../SupplyRoomControlAction.java) (revision 27994) @@ -6,7 +6,10 @@ import java.util.Map; import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import net.sf.json.JSONObject; + import org.apache.commons.lang.StringUtils; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Namespace; @@ -433,7 +436,28 @@ outPrintJson(invoicePlanData); } - + /** + * 获取运作监控导出的状态信息 + * writeecreateOperateDataIsOver 导出是否成功 + * operationMonitoringExportMessage 导出信息提示 + */ + public void getCreateOperateDataStatus(){ + HttpSession session = StrutsParamUtils.getRequest().getSession(); + boolean writeecreateOperateDataIsOver = (boolean)session.getAttribute("writeecreateOperateDataIsOver"); + JSONObject obj = new JSONObject(); + if(writeecreateOperateDataIsOver){ + obj.put("success", true); + }else{ + obj.put("success", false); + } + String operationMonitoringExportMessage = (String)session.getAttribute("operationMonitoringExportMessage"); + if(StringUtils.isNotBlank(operationMonitoringExportMessage)){ + obj.put("operationMonitoringExportMessage", operationMonitoringExportMessage); + }else{ + obj.put("operationMonitoringExportMessage", ""); + } + outPrintJson(obj.toString()); + } @Override public SupplyRoomVo getModel() { return supplyRoomVo; Index: ssts-operationmonitor/src/main/java/com/forgon/disinfectsystem/supplyroomcontrol/service/RaRoomControlHelper.java =================================================================== diff -u -r27800 -r27994 --- ssts-operationmonitor/src/main/java/com/forgon/disinfectsystem/supplyroomcontrol/service/RaRoomControlHelper.java (.../RaRoomControlHelper.java) (revision 27800) +++ ssts-operationmonitor/src/main/java/com/forgon/disinfectsystem/supplyroomcontrol/service/RaRoomControlHelper.java (.../RaRoomControlHelper.java) (revision 27994) @@ -54,7 +54,7 @@ "ip.departCoding as \"departCoding\",ip.applicationTime as \"applicationTime\"," + "ip.submitTime as \"submitTime\",ip.printTime as \"printTime\"," + "ip.serialNumber as \"serialNumber\",ip.settleAccountsDepart as \"settleAccountsDepart\"," + - "replace(ip.remark,'\"',' ') as \"remark\",ip.applicant as \"applicant\",po.diposable as \"diposable\",po.tousseDefinitionId as \"tousseDefinitionId\""; + "ip.remark as \"remark\",ip.applicant as \"applicant\",po.diposable as \"diposable\",po.tousseDefinitionId as \"tousseDefinitionId\""; } /** @@ -85,7 +85,7 @@ String unionSelect = "select distinct rr.recyclingApplication_id as \"id\",ri.tousseName as \"tousseName\",ri.tousseType as \"tousseType\"," + "'回收申请单' AS \"formType\",ri.urgentAmount as \"urgentAmount\",0 as \"sendOutAmount\",0 as \"amount\",rr.depart as \"depart\"," + dressing + "rr.departCode as \"departCoding\",rr.recyclingTime as \"applicationTime\",rr.recyclingTime as \"submitTime\"," + - "null as \"printTime\",null as \"serialNumber\",null as \"settleAccountsDepart\",replace(ri.remark,'\"',' ') as \"remark\"," + + "null as \"printTime\",null as \"serialNumber\",null as \"settleAccountsDepart\",ri.remark as \"remark\"," + "rr.operator as \"applicant\",'否' as \"diposable\",ri.tousseDefinitionId as \"tousseDefinitionId\" "; String unionWhere = String.format(" from RecyclingRecord rr join RecyclingItem ri on rr.id = ri.recyclingRecord_id " + " where rr.recyclingApplication_id is null %s and rr.recyclingTime between %s and %s", whereSqlForOrgUnitCoding, startDateStr, endDateStr); Index: ssts-operationmonitor/src/main/java/com/forgon/disinfectsystem/supplyroomcontrol/service/SupplyRoomControlManager.java =================================================================== diff -u -r27800 -r27994 --- ssts-operationmonitor/src/main/java/com/forgon/disinfectsystem/supplyroomcontrol/service/SupplyRoomControlManager.java (.../SupplyRoomControlManager.java) (revision 27800) +++ ssts-operationmonitor/src/main/java/com/forgon/disinfectsystem/supplyroomcontrol/service/SupplyRoomControlManager.java (.../SupplyRoomControlManager.java) (revision 27994) @@ -3,6 +3,8 @@ import java.io.OutputStream; import java.util.Map; +import javax.servlet.http.HttpServletRequest; + public interface SupplyRoomControlManager { /** * @@ -14,9 +16,10 @@ * @param tousseName * @param tousseType * @param orgUnitCoding 供应室编码 + * @param comboTousseType 物品类型 * @return */ - public Map getRecyclingApplicationList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName, String tousseType, String orgUnitCoding); + public Map getRecyclingApplicationList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName, String tousseType, String orgUnitCoding, String comboTousseType); /** * * @param statDate @@ -27,9 +30,10 @@ * @param tousseName * @param tousseType * @param orgUnitCoding 供应室编码 + * @param comboTousseType 物品类型 * @return */ - public Map getWashDisinfectionList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName, String tousseType, String orgUnitCoding); + public Map getWashDisinfectionList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName, String tousseType, String orgUnitCoding, String comboTousseType); /** * * @param statDate @@ -40,9 +44,10 @@ * @param tousseName * @param tousseType * @param orgUnitCoding 供应室编码 + * @param comboTousseType 物品类型 * @return */ - public Map getReviewList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName, String tousseType, String orgUnitCoding); + public Map getReviewList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName, String tousseType, String orgUnitCoding, String comboTousseType); /** * * @param statDate @@ -53,9 +58,10 @@ * @param tousseName * @param tousseType * @param orgUnitCoding 供应室编码 + * @param comboTousseType 物品类型 * @return */ - public Map getSterilizationList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName, String tousseType, String orgUnitCoding); + public Map getSterilizationList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName, String tousseType, String orgUnitCoding, String comboTousseType); /** * * @param statDate @@ -66,9 +72,10 @@ * @param tousseName * @param tousseType * @param orgUnitCoding 供应室编码 + * @param comboTousseType 物品类型 * @return */ - public Map getPackingList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName, String tousseType, String orgUnitCoding); + public Map getPackingList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName, String tousseType, String orgUnitCoding, String comboTousseType); public Map getRecyclingList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName, String tousseType); /** @@ -81,9 +88,10 @@ * @param tousseName * @param tousseType * @param orgUnitCoding 供应室编码 + * @param comboTousseType 物品类型 * @return */ - public Map getInvoicePlanList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName, String tousseType, String orgUnitCoding); + public Map getInvoicePlanList(String statDate,String endDate,String departCoding,String currentPage, String pageSize, String tousseName, String tousseType, String orgUnitCoding, String comboTousseType); /** * * @param departCoding @@ -129,9 +137,20 @@ * @return */ public Map findUnInvoicePlan(String departCoding,String currentPage, String pageSize, String tousseName, String tousseType, String orgUnitCoding); - - public void createOperateData(OutputStream ops,String goodNmae,String tousseType,String department,String startDate,String endDate, String orgUnitCoding); /** + * + * @param request + * @param ops + * @param goodNmae + * @param tousseType + * @param department + * @param startDate + * @param endDate + * @param orgUnitCoding + * @param comboTousseType 物品类型 + */ + public void createOperateData(HttpServletRequest request,OutputStream ops,String goodNmae,String tousseType,String department,String startDate,String endDate, String orgUnitCoding, String comboTousseType); + /** * 查待清洗篮筐列表 * @param departCoding * @param currentPage