Index: ssts-web/src/main/webapp/jasperRtp/tousseApplyDepartment.jasper =================================================================== diff -u Binary files differ Index: ssts-web/src/main/webapp/jasperRtp/tousseApplyDepartment.jrxml =================================================================== diff -u --- ssts-web/src/main/webapp/jasperRtp/tousseApplyDepartment.jrxml (revision 0) +++ ssts-web/src/main/webapp/jasperRtp/tousseApplyDepartment.jrxml (revision 21345) @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + <band height="40" splitType="Stretch"> + <textField> + <reportElement uuid="d8e60ec9-1c4a-40c1-ab15-fba2427aff26" x="0" y="0" width="590" height="40"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="14" isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$P{title}]]></textFieldExpression> + </textField> + </band> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java =================================================================== diff -u -r21210 -r21345 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 21210) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 21345) @@ -184,6 +184,8 @@ import com.forgon.disinfectsystem.jasperreports.javabeansource.SterilizingStove; import com.forgon.disinfectsystem.jasperreports.javabeansource.SterilizingStove_child; import com.forgon.disinfectsystem.jasperreports.javabeansource.SummaryUseRecordForGoodsVO; +import com.forgon.disinfectsystem.jasperreports.javabeansource.TousseApplyDepartment; +import com.forgon.disinfectsystem.jasperreports.javabeansource.TousseApplyDepartment_Child; import com.forgon.disinfectsystem.jasperreports.javabeansource.TousseApplySummary; import com.forgon.disinfectsystem.jasperreports.javabeansource.TousseItemVO; import com.forgon.disinfectsystem.jasperreports.javabeansource.TousseMorrowSendBean; @@ -18803,11 +18805,13 @@ + "from InvoicePlan ip join TousseItem ti on ti.recyclingApplication_ID=ip.id join TousseDefinition td on td.id=ti.tousseDefinitionId " + "where %s %s %s and ti.tousseType in('%s','%s') and (ti.isTerminated is null or ti.isTerminated<>1) " + "union all " - + "select ip.departCoding,ip.depart,ti.amount,(ti.amount*td2.price) subtotal " + + "select ip.departCoding,ip.depart,case when ip.type='%s' then ti.recyclingAmount else ti.amount end amount," + + "((case when ip.type='%s' then ti.recyclingAmount else ti.amount end)*td2.price) subtotal " + "from InvoicePlan ip join TousseItem ti on ti.recyclingApplication_ID=ip.id join TousseDefinition td on td.id=ti.tousseDefinitionId join TousseDefinition td2 on td2.id=td.ancestorID " + "where %s %s %s and ti.tousseType='%s' and (ti.isTerminated is null or ti.isTerminated<>1) ", InvoicePlan.TYPE_RECYCLINGCREATE_APPLICATION, InvoicePlan.TYPE_RECYCLINGCREATE_APPLICATION, typeSql, betweenSql, departmentCodeSql, TousseDefinition.PACKAGE_TYPE_INSIDE, TousseDefinition.PACKAGE_TYPE_DRESSING, + InvoicePlan.TYPE_RECYCLINGCREATE_APPLICATION, InvoicePlan.TYPE_RECYCLINGCREATE_APPLICATION, typeSql, betweenSql, departmentCodeSql, TousseDefinition.PACKAGE_TYPE_DISINFECTION); String separator = ";;"; @@ -18840,4 +18844,87 @@ } return list; } + + @Override + public List getTousseApplySummary2Data( + String startTime, String endTime, String departmentCode, String tousseDefinitionId) { + List list = new ArrayList(); + if (StringUtils.isNotBlank(startTime) + && StringUtils.isNotBlank(endTime)) { + String typeSql = String.format("ip.type in('%s','%s','%s','%s')", + InvoicePlan.TYPE_COMBO_FORM, InvoicePlan.TYPE_TOUSSE_APPLICATION_FORM,InvoicePlan.TYPE_DISINFECT_GOODS_APPLICATION_FORM,InvoicePlan.TYPE_RECYCLINGCREATE_APPLICATION); + String betweenSql = " and " + dateQueryAdapter.dateAreaSql("ip.applicationTime", startTime, endTime, true); + String departmentCodeSql = ""; + if (StringTools.isNotBlank(departmentCode)) { + departmentCodeSql = String.format(" and ip.departCoding='%s' ", departmentCode); + } + String tousseDefinitionIdSql = ""; + String tousseDefinitionIdSql2 = ""; + if (StringTools.isNotBlank(tousseDefinitionId)) { + tousseDefinitionIdSql = String.format(" and td.id=%s ", tousseDefinitionId); + tousseDefinitionIdSql2 = String.format(" and td2.id=%s ", tousseDefinitionId); + } + + String sql = String.format( + "select ip.departCoding,ip.depart,td.name tousseName,td.price price,case when ip.type='%s' then ti.recyclingAmount else ti.amount end amount," + + "((case when ip.type='%s' then ti.recyclingAmount else ti.amount end)*td.price) subtotal " + + "from InvoicePlan ip join TousseItem ti on ti.recyclingApplication_ID=ip.id join TousseDefinition td on td.id=ti.tousseDefinitionId " + + "where %s %s %s %s and ti.tousseType in('%s','%s') and (ti.isTerminated is null or ti.isTerminated<>1) " + + "union all " + + "select ip.departCoding,ip.depart,td.name tousseName,td2.price price,case when ip.type='%s' then ti.recyclingAmount else ti.amount end amount," + + "((case when ip.type='%s' then ti.recyclingAmount else ti.amount end)*td2.price) subtotal " + + "from InvoicePlan ip join TousseItem ti on ti.recyclingApplication_ID=ip.id join TousseDefinition td on td.id=ti.tousseDefinitionId join TousseDefinition td2 on td2.id=td.ancestorID " + + "where %s %s %s %s and ti.tousseType='%s' and (ti.isTerminated is null or ti.isTerminated<>1) ", + InvoicePlan.TYPE_RECYCLINGCREATE_APPLICATION, InvoicePlan.TYPE_RECYCLINGCREATE_APPLICATION, + typeSql, betweenSql, departmentCodeSql, tousseDefinitionIdSql, TousseDefinition.PACKAGE_TYPE_INSIDE, TousseDefinition.PACKAGE_TYPE_DRESSING, + InvoicePlan.TYPE_RECYCLINGCREATE_APPLICATION, InvoicePlan.TYPE_RECYCLINGCREATE_APPLICATION, + typeSql, betweenSql, departmentCodeSql, tousseDefinitionIdSql2, TousseDefinition.PACKAGE_TYPE_DISINFECTION); + + sql = String.format("select t.departCoding,min(t.depart) depart,t.tousseName,min(t.price) price,sum(t.amount) amount,sum(t.subtotal) subtotal from (%s) t group by t.departCoding,t.tousseName ", sql); + ResultSet result = objectDao.executeSql(sql); + + Map> map = new HashMap>(); + try { + while(result.next()){ + String departCoding = StringTools.defaultString(result.getString("departCoding")); + String depart = StringTools.defaultString(result.getString("depart")); + String tousseName = StringTools.defaultString(result.getString("tousseName")); + Double price = result.getDouble("price"); + Integer amount = result.getInt("amount"); + Double subtotal = result.getDouble("subtotal"); + + ArrayList items = map.get(departCoding); + if (CollectionUtils.isEmpty(items)) { + items = new ArrayList(); + map.put(departCoding, items); + } + + TousseApplyDepartment_Child child = new TousseApplyDepartment_Child(); + child.setDepartmentCode(departCoding); + child.setDepartmentName(depart); + child.setTousseName(tousseName); + child.setPrice(price); + child.setAmount(amount); + child.setTotalPrice(subtotal); + items.add(child); + } + } catch (SQLException e) { + e.printStackTrace(); + }finally { + DatabaseUtil.closeResultSetAndStatement(result); + } + + Set keySet = map.keySet(); + for (String key : keySet) { + ArrayList items = map.get(key); + TousseApplyDepartment tousseApplyDepartment = new TousseApplyDepartment(); + tousseApplyDepartment.setDepartmentCode(items.get(0).getDepartmentCode()); + tousseApplyDepartment.setDepartmentName(items.get(0).getDepartmentName()); + tousseApplyDepartment.setItems(items); + list.add(tousseApplyDepartment); + } + } + return list; + } + } Index: ssts-web/src/main/webapp/jasperRtp/tousseApplyDepartment_child.jrxml =================================================================== diff -u --- ssts-web/src/main/webapp/jasperRtp/tousseApplyDepartment_child.jrxml (revision 0) +++ ssts-web/src/main/webapp/jasperRtp/tousseApplyDepartment_child.jrxml (revision 21345) @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: ssts-web/src/main/webapp/disinfectsystem/reportforms/tousseApplySummary.js =================================================================== diff -u -r20514 -r21345 --- ssts-web/src/main/webapp/disinfectsystem/reportforms/tousseApplySummary.js (.../tousseApplySummary.js) (revision 20514) +++ ssts-web/src/main/webapp/disinfectsystem/reportforms/tousseApplySummary.js (.../tousseApplySummary.js) (revision 21345) @@ -12,23 +12,40 @@ return false; } + //统计类型 + var statisticsType = $Id('statisticsType').value; var startTime = $Id('startTime').value; var endTime = $Id('endTime').value; var departmentName = Ext.getCmp('department').getRawValue(); var departmentCode = Ext.getCmp('department').getValue(); + var tousseDefinitionName = Ext.getCmp('tousseName').getRawValue(); //器械包定义名称 + var tousseDefinitionId = ''; + if (tousseDefinitionName && statisticsType == '器械包汇总') { + tousseDefinitionId = Ext.getCmp('tousseName').getValue(); //器械包定义id + } + if (!departmentName) { departmentCode = ""; } + + var jasperreportName = 'tousseApplySummary.jasper'; + if (statisticsType == '器械包汇总') { + jasperreportName = 'tousseApplyDepartment.jasper'; + } + myMask = new Ext.LoadMask(Ext.getBody(), { msg: '正在加载,请稍候!', removeMask: true }); myMask.show(); window.open(WWWROOT + "/jasperreports/jasperreportsAction!createReportFromJavaBeanSource.do" + - "?jasperreportName=tousseApplySummary.jasper&reportName=tousseApplySummary" + + "?jasperreportName=" + jasperreportName + + "&reportName=tousseApplySummary" + + "&statisticsType=" + statisticsType + "&startTime=" + startTime + "&endTime=" + endTime + - "&departmentCode=" + departmentCode, + "&departmentCode=" + departmentCode + + "&tousseDefinitionId=" + tousseDefinitionId, 'thisIframe', '_self'); } @@ -122,6 +139,7 @@ name : 'department', valueField : 'departmentCode', displayField : 'departmentName', + anchor : '95%', store : new Ext.data.Store({ pageSize: 100, proxy : new Ext.data.HttpProxy({ @@ -149,6 +167,76 @@ typeAhead : false, allowBlank : true }] + },{ + layout : 'form', + width : 300, + id: 'tousseNameLabel', + hidden: true, + items : [{ + xtype : 'combo', + id : 'tousseName', + name : 'tousseName', + fieldLabel : '器械包名称', + queryParam : 'spell', + minChars : 0, + valueField : 'id', + displayField : 'name', + store : new Ext.data.Store({ + baseParams : { + tousseTypes : "器械包;敷料包;消毒物品" + }, + proxy : new Ext.data.HttpProxy({ + url : WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!searchTousseByTypeArr.do', + method : 'POST' + }), + reader : new Ext.data.JsonReader({ + totalProperty : 'totalCount', + root : 'data' + }, [ + {name : 'id',mapping : 'id'}, + {name : 'name',mapping : 'name'}] + ) + }), + forceSelection : true, + lazyInit : true, + triggerAction : 'all', + hideTrigger : true, + typeAhead : false, + anchor : '95%' + }] + },{ + width : 200, + layout : 'form', + labelSeparator : '统计类型:', + items : [{ + xtype : 'combo', + allowBlank : false, + id : 'statisticsType', + name : 'statisticsType', + valueField : 'statisticsType', + displayField : 'statisticsType', + store : new Ext.data.SimpleStore({ + fields : [ 'statisticsType'], + data : [['申请汇总'],['器械包汇总']] + }), + editable : false, + forceSelection : true, + allowBlank : false, + value : '申请汇总', + mode : 'local', + triggerAction : 'all', + anchor : '95%', + listeners: { + select : function(combo, record, index) { + if (combo.getValue() == '器械包汇总') { + Ext.getCmp('tousseNameLabel').show(); + } else { + Ext.getCmp('tousseNameLabel').hide(); + Ext.getCmp('tousseName').setValue(); + } + } + } + }] }] }], buttons:[{ Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/action/JasperreportsAction.java =================================================================== diff -u -r20872 -r21345 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/action/JasperreportsAction.java (.../JasperreportsAction.java) (revision 20872) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/action/JasperreportsAction.java (.../JasperreportsAction.java) (revision 21345) @@ -967,12 +967,18 @@ return jasperReportManager.getTousseSpecificationSizeStatisticsData(startDay, endDay, departmentCode); } }else if ("tousseApplySummary".equals(reportName)) { + String statisticsType = StrutsParamUtils.getPraramValue("statisticsType", ""); String startTime = StrutsParamUtils.getPraramValue("startTime", ""); String endTime = StrutsParamUtils.getPraramValue("endTime", ""); String departmentCode = StrutsParamUtils.getPraramValue("departmentCode", ""); + String tousseDefinitionId = StrutsParamUtils.getPraramValue("tousseDefinitionId", ""); if (StringUtils.isNotBlank(startTime) && StringUtils.isNotBlank(endTime)) { - return jasperReportManager.getTousseApplySummaryData(startTime, endTime, departmentCode); + if ("器械包汇总".equals(statisticsType)) { + return jasperReportManager.getTousseApplySummary2Data(startTime, endTime, departmentCode, tousseDefinitionId); + } else { + return jasperReportManager.getTousseApplySummaryData(startTime, endTime, departmentCode); + } } }else if("unqualifiedPretreatmentReport".equals(reportName)){ //预处理不合格统计报表 @@ -1636,9 +1642,14 @@ map.put("title", "器械包规格大小统计报表"); return map; }else if ("tousseApplySummary".equals(reportName)) { + String statisticsType = StrutsParamUtils.getPraramValue("statisticsType", ""); String startTime = StrutsParamUtils.getPraramValue("startTime", ""); String endTime = StrutsParamUtils.getPraramValue("endTime", ""); - map.put("title", String.format("各部门器械包申请汇总(%s~%s)", startTime, endTime)); + if ("器械包汇总".equals(statisticsType)) { + map.put("title", String.format("各部门器械包申请汇总(%s~%s)", startTime, endTime)); + } else { + map.put("title", String.format("各部门器械包申请明细(%s~%s)", startTime, endTime)); + } }else if("unqualifiedPretreatmentReport".equals(reportName)){ String startDate = StrutsParamUtils.getPraramValue("startDate", ""); String endDate = StrutsParamUtils.getPraramValue("endDate", ""); Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/javabeansource/TousseApplyDepartment_Child.java =================================================================== diff -u --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/javabeansource/TousseApplyDepartment_Child.java (revision 0) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/javabeansource/TousseApplyDepartment_Child.java (revision 21345) @@ -0,0 +1,88 @@ +package com.forgon.disinfectsystem.jasperreports.javabeansource; + +/** + * 各部门器械包申请明细报表的子报表javabean + * @author Chenjiaru 2017-12-09 + * + */ +public class TousseApplyDepartment_Child { + + /** + * 科室编码(用于分组) + */ + private String departmentCode; + + /** + * 科室名称(用于分组) + */ + private String departmentName; + + /** + * 器械包名称 + */ + private String tousseName; + + /** + * 数量 + */ + private Integer amount = 0; + + /** + * 单价 + */ + private Double price = 0.00D; + + /** + * 总价 + */ + private Double totalPrice = 0.00D; + + public String getTousseName() { + return tousseName; + } + + public void setTousseName(String tousseName) { + this.tousseName = tousseName; + } + + public Integer getAmount() { + return amount; + } + + public void setAmount(Integer amount) { + this.amount = amount; + } + + public Double getPrice() { + return price; + } + + public void setPrice(Double price) { + this.price = price; + } + + public Double getTotalPrice() { + return totalPrice; + } + + public void setTotalPrice(Double totalPrice) { + this.totalPrice = totalPrice; + } + + public String getDepartmentName() { + return departmentName; + } + + public void setDepartmentName(String departmentName) { + this.departmentName = departmentName; + } + + public String getDepartmentCode() { + return departmentCode; + } + + public void setDepartmentCode(String departmentCode) { + this.departmentCode = departmentCode; + } + +} Index: ssts-web/src/main/webapp/jasperRtp/tousseApplyDepartment_child.jasper =================================================================== diff -u Binary files differ Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManager.java =================================================================== diff -u -r20664 -r21345 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManager.java (.../JasperReportManager.java) (revision 20664) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManager.java (.../JasperReportManager.java) (revision 21345) @@ -52,6 +52,7 @@ import com.forgon.disinfectsystem.jasperreports.javabeansource.SterilizingStove; import com.forgon.disinfectsystem.jasperreports.javabeansource.SterilizingStove_child; import com.forgon.disinfectsystem.jasperreports.javabeansource.SummaryUseRecordForGoodsVO; +import com.forgon.disinfectsystem.jasperreports.javabeansource.TousseApplyDepartment; import com.forgon.disinfectsystem.jasperreports.javabeansource.TousseApplySummary; import com.forgon.disinfectsystem.jasperreports.javabeansource.TousseDeliverDetailVO; import com.forgon.disinfectsystem.jasperreports.javabeansource.TousseMorrowSendBean; @@ -632,5 +633,15 @@ */ public List getTousseApplySummaryData(String startTime, String endTime, String departmentCode); + /** + * 获取各部门器械包申请明细报表的数据 + * @param startTime 查询开始时间 格式'2017-07-26' + * @param endTime 查询结束时间 格式'2017-07-26' + * @param departmentCode 申请科室的科室编码 + * @param tousseDefinitionId器械包id + * @return + */ + public List getTousseApplySummary2Data(String startTime, String endTime, + String departmentCode, String tousseDefinitionId); } Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/javabeansource/TousseApplyDepartment.java =================================================================== diff -u --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/javabeansource/TousseApplyDepartment.java (revision 0) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/javabeansource/TousseApplyDepartment.java (revision 21345) @@ -0,0 +1,51 @@ +package com.forgon.disinfectsystem.jasperreports.javabeansource; + +import java.util.List; + +/** + * 各部门器械包申请明细报表的javabean + * @author Chenjiaru 2017-12-09 + * + */ +public class TousseApplyDepartment { + + /** + * 科室编码 + */ + private String departmentCode; + + /** + * 科室名称 + */ + private String departmentName; + + /** + * 子报表javabean的集合 + */ + private List items; + + public String getDepartmentName() { + return departmentName; + } + + public void setDepartmentName(String departmentName) { + this.departmentName = departmentName; + } + + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + public String getDepartmentCode() { + return departmentCode; + } + + public void setDepartmentCode(String departmentCode) { + this.departmentCode = departmentCode; + } + +}