Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/javabeansource/MaterialTypeWorkloadReport.java =================================================================== diff -u -r13786 -r14473 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/javabeansource/MaterialTypeWorkloadReport.java (.../MaterialTypeWorkloadReport.java) (revision 13786) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/javabeansource/MaterialTypeWorkloadReport.java (.../MaterialTypeWorkloadReport.java) (revision 14473) @@ -13,6 +13,8 @@ private Integer amount;//数量 private Integer washUnqualifiedAmount = 0;//清洗不合数 + + private Double washUnqualifiedPercentage;//清洗不合格百分比 public Integer getRowNum() { return rowNum; @@ -62,4 +64,12 @@ this.washUnqualifiedAmount = washUnqualifiedAmount; } + public Double getWashUnqualifiedPercentage() { + return washUnqualifiedPercentage; + } + + public void setWashUnqualifiedPercentage(Double washUnqualifiedPercentage) { + this.washUnqualifiedPercentage = washUnqualifiedPercentage; + } + } Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java =================================================================== diff -u -r14464 -r14473 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 14464) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 14473) @@ -8952,7 +8952,7 @@ */ private void materialTypeWorkloadReportList(String statDate,String endDate,String querySupplyRoom,List list){ - String sql = "select m.type as type,(min(i.amount)*sum(ms.count)) as amount from "; + String sql = "select t1.type,sum(t1.amount) from ( select m.type as type,(min(i.amount)*sum(ms.count)) as amount from "; sql += "washanddisinfectrecord r,ClassifyBasket_WashRecord cw,ClassifyBasket b,ClassifiedItem i,"; sql += "TousseDefinition t,materialinstance ms,materialdefinition m "; sql += "where r.id = cw.washanddisinfectrecord_id and cw.classifybasket_id = b.id and "; @@ -8967,47 +8967,75 @@ sql += "m where r.id = cw.washanddisinfectrecord_id and cw.classifybasket_id = b.id and b.id = i.classifybasket_id and "; sql += "i.materialdefinition_id = m.id and r.enddate between " + dateQueryAdapter.dateConverAdapter2(statDate,"yyyy-mm-dd") + " and "; sql += dateQueryAdapter.dateConverAdapter2(endDate,"yyyy-mm-dd") + " and r.orgUnitCoding = '" + querySupplyRoom + "' group by m.type"; + sql += ") t1 group by t1.type"; - sql += " union all "; - - sql += "select '不合格数',sum(qu.amount)as amount from QualityMonitoring qu where qu.inspectitem in "; - sql += "(select qm.name from qualitymonitoringConfig qm where qm.departcodes like '%"+querySupplyRoom+"%'"; - sql += " and qm.responsibilitypart = '清洗消毒' and qm.type = '质量监测')"; - sql += " and qu.datetime between "+dateQueryAdapter.dateConverAdapter2(statDate,"yyyy-mm-dd"); - sql += " and "+dateQueryAdapter.dateConverAdapter2(endDate,"yyyy-mm-dd"); - sql += " and qu.orgUnitCoding = '"+querySupplyRoom+"'"; + String sql2 = "select qu.material,qu.amount as amount from QualityMonitoring qu where qu.inspectitem in "; + sql2 += "(select qm.name from qualitymonitoringConfig qm where qm.departcodes like '%" + querySupplyRoom + "%'"; + sql2 += " and qm.responsibilitypart = '清洗消毒' and qm.type = '质量监测')"; + sql2 += " and qu.datetime between "+dateQueryAdapter.dateConverAdapter2(statDate,"yyyy-mm-dd"); + sql2 += " and "+dateQueryAdapter.dateConverAdapter2(endDate,"yyyy-mm-dd"); + sql2 += " and qu.orgUnitCoding = '"+querySupplyRoom+"'"; + + ResultSet rs2 = objectDao.executeSql(sql2); + Map monitoringMap = new HashMap(); + try { + while(rs2.next()){ + String materialName = rs2.getString(1); + Integer washUnqualifiedAmount = rs2.getInt(2); + if(StringUtils.isNotBlank(materialName)){ + JSONObject obj = CssdUtils.getGoodsNameAndSp(materialName); + MaterialDefinition md = materialDefinitionManager.getMaterialDefinitionByName(obj.optString("materialName"), obj.optString("specification")); + if(md != null){ + String type = md.getType(); + Integer oldAmount = monitoringMap.get(type); + if(oldAmount == null){ + oldAmount = 0; + } + monitoringMap.put(type, oldAmount + washUnqualifiedAmount); + } + } + } + } catch (SQLException e) { + e.printStackTrace(); + } finally { + DatabaseUtil.closeResultSetAndStatement(rs2); + } Integer totalAmount = 0; - + Integer totalUnqualifiedAmount = 0; ResultSet rs = objectDao.executeSql(sql); + List tmpList = new ArrayList(); try { while(rs.next()){ + String materialType = rs.getString(1); + Integer amount = rs.getInt(2); MaterialTypeWorkloadReport data = new MaterialTypeWorkloadReport(); - data.setAmount(rs.getInt(2)); - if("不合格数".equals(rs.getString(1))){ - data.setColumnNum(3); - }else{ - data.setColumnNum(1); - } + data.setAmount(amount); + data.setColumnNum(1); data.setDayOfMonth(statDate); - data.setMaterialType(rs.getString(1)); - list.add(data); - if(!"不合格数".equals(data.getMaterialType())){ - totalAmount += data.getAmount(); + data.setMaterialType(materialType); + Integer washUnqualifiedAmount = monitoringMap.get(materialType); + if(washUnqualifiedAmount == null){ + washUnqualifiedAmount = 0; } + totalUnqualifiedAmount += washUnqualifiedAmount; + data.setWashUnqualifiedAmount(washUnqualifiedAmount); + totalAmount += amount; + tmpList.add(data); } } catch (SQLException e) { e.printStackTrace(); } finally { DatabaseUtil.closeResultSetAndStatement(rs); } - //日合计 - MaterialTypeWorkloadReport data = new MaterialTypeWorkloadReport(); - data.setAmount(totalAmount); - data.setColumnNum(2); - data.setDayOfMonth(statDate); - data.setMaterialType("合计"); - list.add(data); + + for (MaterialTypeWorkloadReport bean : tmpList) { + if(totalAmount > 0){ + Double d = MathTools.divide(totalUnqualifiedAmount, totalAmount, 4); + bean.setWashUnqualifiedPercentage(d); + } + } + list.addAll(tmpList); } /** * 获取的统计项 Index: ssts-web/src/main/webapp/jasperRtp/materialTypeWorkloadReport.jrxml =================================================================== diff -u -r13786 -r14473 --- ssts-web/src/main/webapp/jasperRtp/materialTypeWorkloadReport.jrxml (.../materialTypeWorkloadReport.jrxml) (revision 13786) +++ ssts-web/src/main/webapp/jasperRtp/materialTypeWorkloadReport.jrxml (.../materialTypeWorkloadReport.jrxml) (revision 14473) @@ -49,14 +49,17 @@ + + + <band height="30" splitType="Stretch"> <textField> <reportElement uuid="11ae082d-b215-43b4-aeaa-684ca09252d2" x="0" y="0" width="595" height="30"/> - <textElement textAlignment="Center" verticalAlignment="Middle"> + <textElement verticalAlignment="Middle"> <font size="14" isBold="true"/> </textElement> <textFieldExpression><![CDATA[$P{title}]]></textFieldExpression> @@ -66,19 +69,45 @@ <summary> <band height="118" splitType="Stretch"> <crosstab> - <reportElement uuid="88b0f90e-8d10-45e0-a7b6-57a3b4cba14f" x="0" y="0" width="595" height="118"/> + <reportElement uuid="151f1167-898d-4d9c-b4f8-68b02374c3ef" x="0" y="0" width="595" height="118"/> <crosstabHeaderCell> <cellContents> <staticText> - <reportElement uuid="955f8ec8-73dd-4d20-a0bf-030e9ecebc85" style="table_CH" x="0" y="0" width="90" height="30"/> + <reportElement uuid="c2669219-e345-46ab-a0d7-7de189751f5c" style="table_TH" mode="Opaque" x="0" y="0" width="78" height="39"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" isBold="true"/> </textElement> <text><![CDATA[日期]]></text> </staticText> </cellContents> </crosstabHeaderCell> - <rowGroup name="dayOfMonth" width="90" totalPosition="End"> + <rowGroup name="rowNum" width="0" totalPosition="End"> + <bucket class="java.lang.Integer"> + <bucketExpression><![CDATA[$F{rowNum}]]></bucketExpression> + </bucket> + <crosstabRowHeader> + <cellContents backcolor="#F0F8FF" mode="Opaque"> + <box> + <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> + </box> + </cellContents> + </crosstabRowHeader> + <crosstabTotalRowHeader> + <cellContents backcolor="#005FB3" mode="Opaque"> + <box> + <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> + </box> + <staticText> + <reportElement uuid="97241822-fb0d-42e9-a84d-8381e80f777a" x="0" y="0" width="78" height="25" forecolor="#FFFFFF"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="12" isBold="true"/> + </textElement> + <text><![CDATA[合计]]></text> + </staticText> + </cellContents> + </crosstabTotalRowHeader> + </rowGroup> + <rowGroup name="dayOfMonth" width="78" totalPosition="End"> <bucket class="java.lang.String"> <bucketExpression><![CDATA[$F{dayOfMonth}]]></bucketExpression> </bucket> @@ -88,7 +117,7 @@ <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> <textField> - <reportElement uuid="6597bf14-96ac-4c5e-988f-47dbc1015646" style="Crosstab Data Text" x="0" y="0" width="90" height="25"/> + <reportElement uuid="2b6b2d45-a5b0-4114-9ae4-9dbf63179b95" style="Crosstab Data Text" x="0" y="0" width="78" height="25"/> <textElement verticalAlignment="Middle"> <font size="12"/> </textElement> @@ -101,13 +130,6 @@ <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> - <staticText> - <reportElement uuid="db0a42a3-7dbf-42b8-805f-fef51d135b75" x="0" y="0" width="90" height="25"/> - <textElement textAlignment="Center" verticalAlignment="Middle"> - <font size="12" isBold="true"/> - </textElement> - <text><![CDATA[合计]]></text> - </staticText> </cellContents> </crosstabTotalRowHeader> </rowGroup> @@ -123,14 +145,35 @@ </cellContents> </crosstabColumnHeader> <crosstabTotalColumnHeader> - <cellContents backcolor="#005FB3" mode="Opaque"> + <cellContents backcolor="#FFFFFF" mode="Opaque" style="table_TH"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> + <staticText> + <reportElement uuid="60211ff5-5fc7-434c-b4a2-06a1beeea777" style="table_CH" x="0" y="0" width="112" height="39" forecolor="#333333"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="12" isBold="true"/> + </textElement> + <text><![CDATA[合计]]></text> + </staticText> + <staticText> + <reportElement uuid="743e9abd-450c-4f45-8e51-519a0b1154ce" style="table_CH" x="112" y="0" width="70" height="39" forecolor="#333333"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="12" isBold="true"/> + </textElement> + <text><![CDATA[不合格数]]></text> + </staticText> + <staticText> + <reportElement uuid="e4714c9c-32bf-46e5-98b9-7b23914de03c" style="table_CH" x="182" y="0" width="71" height="39" forecolor="#333333"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="12" isBold="true"/> + </textElement> + <text><![CDATA[不合格率]]></text> + </staticText> </cellContents> </crosstabTotalColumnHeader> </columnGroup> - <columnGroup name="materialType" height="30" totalPosition="End"> + <columnGroup name="materialType" height="39" totalPosition="End"> <bucket class="java.lang.String"> <bucketExpression><![CDATA[$F{materialType}]]></bucketExpression> </bucket> @@ -140,8 +183,8 @@ <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> <textField> - <reportElement uuid="1c175662-08ee-4eb1-aa63-37cb8f34acbc" style="table_CH" x="0" y="0" width="78" height="30"/> - <textElement textAlignment="Center" verticalAlignment="Middle"> + <reportElement uuid="da9ab996-9e89-4149-af75-e1cb21f974d2" style="Crosstab Data Text" x="0" y="0" width="77" height="39"/> + <textElement verticalAlignment="Middle"> <font size="12" isBold="true"/> </textElement> <textFieldExpression><![CDATA[$V{materialType}]]></textFieldExpression> @@ -159,56 +202,125 @@ <measure name="amountMeasure" class="java.lang.Integer" calculation="Sum"> <measureExpression><![CDATA[$F{amount}]]></measureExpression> </measure> - <crosstabCell width="78" height="25"> + <measure name="measure1" class="java.lang.Integer" calculation="Sum"> + <measureExpression><![CDATA[$F{washUnqualifiedAmount}]]></measureExpression> + </measure> + <measure name="measure2" class="java.lang.Double"> + <measureExpression><![CDATA[$F{washUnqualifiedPercentage}]]></measureExpression> + </measure> + <crosstabCell width="77" height="25"> <cellContents> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> <textField> - <reportElement uuid="6a5db441-d66b-4bf9-9860-30bb5739c166" style="Crosstab Data Text" x="0" y="0" width="78" height="25"/> + <reportElement uuid="e9da56b0-dd66-47fb-8c48-d6fffa8b2cb1" style="Crosstab Data Text" x="0" y="0" width="77" height="25"/> <textElement verticalAlignment="Middle"> <font size="12"/> </textElement> <textFieldExpression><![CDATA[$V{amountMeasure}]]></textFieldExpression> </textField> </cellContents> </crosstabCell> - <crosstabCell width="78" height="25" rowTotalGroup="dayOfMonth"> - <cellContents backcolor="#BFE1FF" mode="Opaque"> + <crosstabCell width="77" height="25" rowTotalGroup="rowNum"> + <cellContents backcolor="#005FB3" mode="Opaque"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> <textField> - <reportElement uuid="c49ec8e7-a96e-475b-acab-77e5c17e62f6" style="Crosstab Data Text" x="0" y="0" width="78" height="25"/> + <reportElement uuid="7f0c21e2-598c-465d-882d-5d3cf4b726b5" style="Crosstab Data Text" x="0" y="0" width="77" height="25" forecolor="#FFFFFF"/> <textElement verticalAlignment="Middle"> <font size="12" isBold="true"/> </textElement> <textFieldExpression><![CDATA[$V{amountMeasure}]]></textFieldExpression> </textField> </cellContents> </crosstabCell> - <crosstabCell width="0" columnTotalGroup="columnNum"> - <cellContents backcolor="#005FB3" mode="Opaque"> + <crosstabCell width="253" height="25" columnTotalGroup="columnNum"> + <cellContents backcolor="#FFFFFF" mode="Opaque"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> + <textField> + <reportElement uuid="20d589a9-e912-4298-bd9a-64639196e525" style="table_CH" mode="Opaque" x="0" y="0" width="112" height="25" forecolor="#000000"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="12" isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$V{amountMeasure}]]></textFieldExpression> + </textField> + <textField> + <reportElement uuid="d7fc8a26-7a39-4775-b3a2-d53319dd500f" style="table_CH" mode="Opaque" x="112" y="0" width="70" height="25" forecolor="#000000"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="12" isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$V{measure1}]]></textFieldExpression> + </textField> + <textField pattern="#,##0.0000 %"> + <reportElement uuid="d54ee6dc-1b2e-4dee-929d-74ab49596429" style="table_CH" mode="Opaque" x="182" y="0" width="71" height="25" forecolor="#000000"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="12" isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$V{measure2}]]></textFieldExpression> + </textField> </cellContents> </crosstabCell> - <crosstabCell width="0" rowTotalGroup="dayOfMonth" columnTotalGroup="columnNum"> + <crosstabCell width="253" height="25" rowTotalGroup="rowNum" columnTotalGroup="columnNum"> + <cellContents backcolor="#FFFFFF" mode="Opaque"> + <box> + <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> + </box> + <textField> + <reportElement uuid="1a03a50b-810b-4c79-844f-4f1bc76329cc" style="table_CH" x="0" y="0" width="112" height="25" forecolor="#000000"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="12" isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$V{amountMeasure}]]></textFieldExpression> + </textField> + <textField> + <reportElement uuid="688a9076-d67c-421c-965b-c26156753093" style="table_CH" x="112" y="0" width="71" height="25" forecolor="#000000"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="12" isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$V{measure1}]]></textFieldExpression> + </textField> + <textField pattern="#,##0.0000 %"> + <reportElement uuid="2994ce8d-85fb-4d8e-b2a5-7334a64e7e5c" style="table_CH" x="182" y="0" width="71" height="25" forecolor="#000000"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="12" isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$V{measure1}/$V{amountMeasure}]]></textFieldExpression> + </textField> + </cellContents> + </crosstabCell> + <crosstabCell width="0" height="25" columnTotalGroup="materialType"> + <cellContents backcolor="#BFE1FF" mode="Opaque"> + <box> + <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> + </box> + </cellContents> + </crosstabCell> + <crosstabCell width="0" height="25" rowTotalGroup="rowNum" columnTotalGroup="materialType"> <cellContents backcolor="#005FB3" mode="Opaque"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> </cellContents> </crosstabCell> - <crosstabCell width="0" columnTotalGroup="materialType"> + <crosstabCell width="77" height="0" rowTotalGroup="dayOfMonth"> <cellContents backcolor="#BFE1FF" mode="Opaque"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> </cellContents> </crosstabCell> - <crosstabCell width="0" rowTotalGroup="dayOfMonth" columnTotalGroup="materialType"> + <crosstabCell width="253" height="0" rowTotalGroup="dayOfMonth" columnTotalGroup="columnNum"> + <cellContents backcolor="#005FB3" mode="Opaque"> + <box> + <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> + </box> + </cellContents> + </crosstabCell> + <crosstabCell width="0" height="0" rowTotalGroup="dayOfMonth" columnTotalGroup="materialType"> <cellContents backcolor="#BFE1FF" mode="Opaque"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> @@ -218,4 +330,7 @@ </crosstab> </band> </summary> + <noData> + <band height="50"/> + </noData> </jasperReport> Index: ssts-web/src/main/webapp/jasperRtp/materialTypeWorkloadReport.jasper =================================================================== diff -u -r13786 -r14473 Binary files differ