Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/javabeansource/BorrowingRecordVo.java =================================================================== diff -u -r12331 -r25084 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/javabeansource/BorrowingRecordVo.java (.../BorrowingRecordVo.java) (revision 12331) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/javabeansource/BorrowingRecordVo.java (.../BorrowingRecordVo.java) (revision 25084) @@ -1,6 +1,7 @@ package com.forgon.disinfectsystem.jasperreports.javabeansource; import java.util.ArrayList; +import java.util.Date; import java.util.List; /** @@ -14,6 +15,10 @@ public String depart; public String appTime; + /** + * 发货时间 + */ + public String lastInvoiceTime; public String status; @@ -69,5 +74,12 @@ this.borrowingItems = borrowingItems; } + public String getLastInvoiceTime() { + return lastInvoiceTime; + } + + public void setLastInvoiceTime(String lastInvoiceTime) { + this.lastInvoiceTime = lastInvoiceTime; + } } Index: ssts-web/src/main/webapp/jasperRtp/strengthenStatisticalWorkload.jasper =================================================================== diff -u -r18190 -r25084 Binary files differ Index: ssts-web/src/main/webapp/jasperRtp/strengthenStatisticalWorkload.jrxml =================================================================== diff -u -r18190 -r25084 --- ssts-web/src/main/webapp/jasperRtp/strengthenStatisticalWorkload.jrxml (.../strengthenStatisticalWorkload.jrxml) (revision 18190) +++ ssts-web/src/main/webapp/jasperRtp/strengthenStatisticalWorkload.jrxml (.../strengthenStatisticalWorkload.jrxml) (revision 25084) @@ -1,5 +1,5 @@ - + @@ -57,7 +57,7 @@ <band height="30" splitType="Stretch"> <textField> - <reportElement uuid="4f96bdd9-75d8-4bb7-b3c7-eed54a1c886a" x="0" y="0" width="1600" height="30"/> + <reportElement uuid="4f96bdd9-75d8-4bb7-b3c7-eed54a1c886a" x="0" y="0" width="1391" height="30"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font fontName="宋体" size="14" isBold="true"/> </textElement> @@ -68,7 +68,7 @@ <summary> <band height="30" splitType="Stretch"> <crosstab> - <reportElement uuid="648fe906-6aed-4eff-8977-38ddace66c2c" x="0" y="0" width="1600" height="30"/> + <reportElement uuid="648fe906-6aed-4eff-8977-38ddace66c2c" x="0" y="0" width="1800" height="30"/> <crosstabHeaderCell> <cellContents> <staticText> @@ -137,7 +137,7 @@ <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> <staticText> - <reportElement uuid="c23bc7e2-1f6c-465d-b1c5-e816b5a2167c" style="table_CH" x="0" y="0" width="59" height="40" forecolor="#000000"/> + <reportElement uuid="c23bc7e2-1f6c-465d-b1c5-e816b5a2167c" style="table_CH" x="0" y="0" width="43" height="40" forecolor="#000000"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="14" isBold="true"/> </textElement> @@ -156,7 +156,7 @@ <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> <textField> - <reportElement uuid="6eab765c-c933-44aa-8d42-7a1e876bca4e" style="Crosstab Data Text" x="0" y="0" width="180" height="20"/> + <reportElement uuid="6eab765c-c933-44aa-8d42-7a1e876bca4e" style="Crosstab Data Text" x="0" y="0" width="160" height="20"/> <box> <pen lineWidth="1.0"/> <topPen lineWidth="1.0"/> @@ -170,7 +170,7 @@ <textFieldExpression><![CDATA[$V{columnName}]]></textFieldExpression> </textField> <staticText> - <reportElement uuid="a33a36e9-3ed0-4a12-b2ba-5cae843bb127" style="Crosstab Data Text" x="0" y="20" width="70" height="20"/> + <reportElement uuid="a33a36e9-3ed0-4a12-b2ba-5cae843bb127" style="Crosstab Data Text" x="0" y="20" width="60" height="20"/> <box> <pen lineWidth="1.0"/> <topPen lineWidth="1.0"/> @@ -184,7 +184,7 @@ <text><![CDATA[器械包数]]></text> </staticText> <staticText> - <reportElement uuid="db370b31-880c-44a3-a8e1-ba9570c3262f" style="Crosstab Data Text" x="70" y="20" width="70" height="20"/> + <reportElement uuid="db370b31-880c-44a3-a8e1-ba9570c3262f" style="Crosstab Data Text" x="60" y="20" width="60" height="20"/> <box> <pen lineWidth="1.0"/> <topPen lineWidth="1.0"/> @@ -198,7 +198,7 @@ <text><![CDATA[器械件数]]></text> </staticText> <staticText> - <reportElement uuid="fb8589c5-0e02-42dd-a7a4-59b371a85877" style="Crosstab Data Text" mode="Opaque" x="140" y="20" width="40" height="20" backcolor="#CCFFCC"/> + <reportElement uuid="fb8589c5-0e02-42dd-a7a4-59b371a85877" style="Crosstab Data Text" mode="Opaque" x="120" y="20" width="40" height="20" backcolor="#CCFFCC"/> <box> <pen lineWidth="1.0"/> <topPen lineWidth="1.0"/> @@ -230,13 +230,13 @@ <measure name="scoreMeasure" class="java.lang.Integer" calculation="Sum"> <measureExpression><![CDATA[$F{score}]]></measureExpression> </measure> - <crosstabCell width="180" height="25"> + <crosstabCell width="160" height="25"> <cellContents> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> <textField pattern="" isBlankWhenNull="false"> - <reportElement uuid="1de502ee-792a-4517-ae65-33bb35ce3412" style="table_TD" mode="Opaque" x="0" y="0" width="70" height="25" forecolor="#000000" backcolor="#FFFFFF"/> + <reportElement uuid="1de502ee-792a-4517-ae65-33bb35ce3412" style="table_TD" mode="Opaque" x="0" y="0" width="60" height="25" forecolor="#000000" backcolor="#FFFFFF"/> <box> <pen lineWidth="1.0"/> <topPen lineWidth="1.0"/> @@ -251,7 +251,7 @@ <textFieldExpression><![CDATA[$V{amountMeasure}]]></textFieldExpression> </textField> <textField> - <reportElement uuid="7d295ce1-db02-45c3-8c3b-de0656a1887a" style="table_TD" x="70" y="0" width="70" height="25"/> + <reportElement uuid="7d295ce1-db02-45c3-8c3b-de0656a1887a" style="table_TD" x="60" y="0" width="60" height="25"/> <box> <pen lineWidth="1.0"/> <topPen lineWidth="1.0"/> @@ -265,7 +265,7 @@ <textFieldExpression><![CDATA[$V{materialAmountMeasure}]]></textFieldExpression> </textField> <textField> - <reportElement uuid="c0b0fff6-222c-40bc-aa1c-b4ce2e96b542" style="Crosstab Data Text" mode="Opaque" x="140" y="0" width="40" height="25" backcolor="#CCFFCC"/> + <reportElement uuid="c0b0fff6-222c-40bc-aa1c-b4ce2e96b542" style="Crosstab Data Text" mode="Opaque" x="120" y="0" width="40" height="25" backcolor="#CCFFCC"/> <box> <pen lineWidth="1.0"/> <topPen lineWidth="1.0"/> @@ -280,27 +280,27 @@ </textField> </cellContents> </crosstabCell> - <crosstabCell width="180" height="25" rowTotalGroup="operator"> + <crosstabCell width="160" height="25" rowTotalGroup="operator"> <cellContents backcolor="#BFE1FF" mode="Opaque"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> <textField> - <reportElement uuid="e277e6b2-eb9d-409f-b558-226f59b070e9" style="table_CH" x="0" y="0" width="70" height="25"/> + <reportElement uuid="e277e6b2-eb9d-409f-b558-226f59b070e9" style="table_CH" x="0" y="0" width="60" height="25"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="14" isBold="true"/> </textElement> <textFieldExpression><![CDATA[$V{amountMeasure}]]></textFieldExpression> </textField> <textField> - <reportElement uuid="4d5762e5-7d05-4067-a81e-93e4012380dd" style="table_CH" x="70" y="0" width="70" height="25"/> + <reportElement uuid="4d5762e5-7d05-4067-a81e-93e4012380dd" style="table_CH" x="60" y="0" width="60" height="25"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="14" isBold="true"/> </textElement> <textFieldExpression><![CDATA[$V{materialAmountMeasure}]]></textFieldExpression> </textField> <textField pattern="" isBlankWhenNull="false"> - <reportElement uuid="a564467a-ca21-4baa-a759-8dbe37e3ba9f" style="table_CH" mode="Opaque" x="140" y="0" width="40" height="25" forecolor="#000000" backcolor="#BFE1FF"/> + <reportElement uuid="a564467a-ca21-4baa-a759-8dbe37e3ba9f" style="table_CH" mode="Opaque" x="120" y="0" width="40" height="25" forecolor="#000000" backcolor="#BFE1FF"/> <textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none"> <font fontName="SansSerif" size="14" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/> <paragraph lineSpacing="Single"/> @@ -309,27 +309,27 @@ </textField> </cellContents> </crosstabCell> - <crosstabCell width="59" height="25" columnTotalGroup="sequence"> + <crosstabCell width="43" height="25" columnTotalGroup="sequence"> <cellContents backcolor="#005FB3" mode="Transparent"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> <textField> - <reportElement uuid="51ee9976-ad1a-4a02-bc10-1a0b58a09d9f" style="table_CH" x="0" y="0" width="59" height="25"/> + <reportElement uuid="51ee9976-ad1a-4a02-bc10-1a0b58a09d9f" style="table_CH" x="0" y="0" width="43" height="25"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="14"/> </textElement> <textFieldExpression><![CDATA[$V{scoreMeasure}]]></textFieldExpression> </textField> </cellContents> </crosstabCell> - <crosstabCell width="59" height="25" rowTotalGroup="operator" columnTotalGroup="sequence"> + <crosstabCell width="43" height="25" rowTotalGroup="operator" columnTotalGroup="sequence"> <cellContents backcolor="#005FB3" mode="Transparent" style="table_TH"> <box> <pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/> </box> <staticText> - <reportElement uuid="f9eeca90-2b09-46f3-a51f-2615aee39619" style="table_CH" x="0" y="0" width="59" height="25"/> + <reportElement uuid="f9eeca90-2b09-46f3-a51f-2615aee39619" style="table_CH" x="0" y="0" width="43" height="25"/> <textElement/> <text><![CDATA[]]></text> </staticText> Index: ssts-web/src/main/webapp/jasperRtp/borrowingReport_subreport1.jasper =================================================================== diff -u -r12331 -r25084 Binary files differ Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/action/JasperreportsAction.java =================================================================== diff -u -r25026 -r25084 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/action/JasperreportsAction.java (.../JasperreportsAction.java) (revision 25026) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/action/JasperreportsAction.java (.../JasperreportsAction.java) (revision 25084) @@ -908,7 +908,15 @@ } String goodsName = StrutsParamUtils.getPraramValue("goodsName", "");; String deptName = StrutsParamUtils.getPraramValue("deptName", "");; - return jasperReportManager.getBorrowingRecord(startDay, endDay, goodsName, deptName); + + String queryType = StrutsParamUtils.getPraramValue("queryType", ""); + if("汇总".equals(queryType)){ + return jasperReportManager.getBorrowingRecordSummary(startDay, endDay, goodsName, deptName); + }else{ + // 获取借物明细 + return jasperReportManager.getBorrowingRecord(startDay, endDay, goodsName, deptName); + } + }else if(reportName.equals("foreignTousseApplicationReport")){ String startDay = StrutsParamUtils.getPraramValue("startDay", ""); String endDay = StrutsParamUtils.getPraramValue("endDay", ""); @@ -1588,10 +1596,6 @@ String startTime = StrutsParamUtils.getPraramValue("startTime", ""); String endTime = StrutsParamUtils.getPraramValue("endTime", ""); map.put("title", "灭菌炉灭菌次数统计("+startTime+" ~ "+endTime+")"); - }else if(reportName.equals("sterilizingStoveUseCount")){ - String startTime = StrutsParamUtils.getPraramValue("startTime", ""); - String endTime = StrutsParamUtils.getPraramValue("endTime", ""); - map.put("title", "灭菌炉灭菌次数统计("+startTime+" ~ "+endTime+")"); }else if (reportName.equals("tousseWorkLoad")){ String startDay = StrutsParamUtils.getPraramValue("startDay", ""); String endDay = StrutsParamUtils.getPraramValue("endDay", ""); @@ -1616,7 +1620,12 @@ }else if(reportName.equals("borrowingReport")){ String startDay = StrutsParamUtils.getPraramValue("startDay", ""); String endDay = StrutsParamUtils.getPraramValue("endDay", ""); - map.put("title", "借还物品统计报表("+startDay+" ~ "+endDay+")"); + String queryType = StrutsParamUtils.getPraramValue("queryType", ""); + String title = "借还物品明细统计报表"; + if("汇总".equals(queryType)){ + title = "借还物品汇总统计报表";; + } + map.put("title", title + "(" + startDay + " ~ " + endDay +")"); }else if ("godownEntryStatistic".equals(reportName)) { String startDay = StrutsParamUtils.getPraramValue("timeStart", ""); String endDay = StrutsParamUtils.getPraramValue("timeEnd", ""); Index: ssts-web/src/main/webapp/jasperRtp/borrowingReport.jasper =================================================================== diff -u -r12331 -r25084 Binary files differ Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/javabeansource/ReturnRecordItemVo.java =================================================================== diff -u -r12331 -r25084 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/javabeansource/ReturnRecordItemVo.java (.../ReturnRecordItemVo.java) (revision 12331) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/javabeansource/ReturnRecordItemVo.java (.../ReturnRecordItemVo.java) (revision 25084) @@ -1,17 +1,37 @@ package com.forgon.disinfectsystem.jasperreports.javabeansource; + /** * @author WangYi * */ public class ReturnRecordItemVo { - + /** + * 归还数量 + */ public Integer returnAmount; + /** + * 归还日期 + */ public String returnTime; + /** + * 归还用户 + * + */ public String reveiveUser; + /** + * 借出天数 + */ + public Integer borrowDays; + + /** + * 借出的总价格 + */ + public Double totalPrice; + public Integer getReturnAmount() { return returnAmount; } @@ -35,6 +55,22 @@ public void setReveiveUser(String reveiveUser) { this.reveiveUser = reveiveUser; } + + public Integer getBorrowDays() { + return borrowDays; + } + + public void setBorrowDays(Integer borrowDays) { + this.borrowDays = borrowDays; + } + + public Double getTotalPrice() { + return totalPrice; + } + + public void setTotalPrice(Double totalPrice) { + this.totalPrice = totalPrice; + } Index: ssts-web/src/main/webapp/jasperRtp/statisticalWorkload.jrxml =================================================================== diff -u -r18190 -r25084 --- ssts-web/src/main/webapp/jasperRtp/statisticalWorkload.jrxml (.../statisticalWorkload.jrxml) (revision 18190) +++ ssts-web/src/main/webapp/jasperRtp/statisticalWorkload.jrxml (.../statisticalWorkload.jrxml) (revision 25084) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="statisticalWorkload" language="groovy" pageWidth="1250" pageHeight="1200" columnWidth="1250" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="cbf22cc0-e3ae-4485-a118-b438d682d7e3"> +<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="statisticalWorkload" language="groovy" pageWidth="1440" pageHeight="1200" columnWidth="1440" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="cbf22cc0-e3ae-4485-a118-b438d682d7e3"> <property name="ireport.zoom" value="1.0"/> - <property name="ireport.x" value="0"/> + <property name="ireport.x" value="108"/> <property name="ireport.y" value="0"/> <style name="Crosstab Data Text" hAlign="Center"/> <parameter name="title" class="java.lang.String"> @@ -29,7 +29,7 @@ <title> <band height="30" splitType="Stretch"> <textField> - <reportElement uuid="8a494fab-981d-4237-9e12-32835b7fa569" x="0" y="0" width="1250" height="30"/> + <reportElement uuid="8a494fab-981d-4237-9e12-32835b7fa569" x="0" y="0" width="1196" height="30"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="14" isBold="true"/> </textElement> @@ -40,7 +40,7 @@ <summary> <band height="30" splitType="Stretch"> <crosstab> - <reportElement uuid="bbefa993-f197-47ce-bf52-186e824d3ebc" x="0" y="0" width="1250" height="30"/> + <reportElement uuid="bbefa993-f197-47ce-bf52-186e824d3ebc" stretchType="RelativeToTallestObject" x="0" y="0" width="1440" height="30"/> <crosstabHeaderCell> <cellContents> <staticText> @@ -120,7 +120,7 @@ <crosstabColumnHeader> <cellContents backcolor="#FFFFFF" mode="Opaque"> <textField pattern="" isBlankWhenNull="false"> - <reportElement uuid="d01d2df8-4930-4455-b890-b9960056d2a5" style="Crosstab Data Text" mode="Transparent" x="0" y="0" width="140" height="30" forecolor="#000000" backcolor="#FFFFFF"/> + <reportElement uuid="d01d2df8-4930-4455-b890-b9960056d2a5" style="Crosstab Data Text" mode="Transparent" x="0" y="0" width="130" height="30" forecolor="#000000" backcolor="#FFFFFF"/> <box> <pen lineWidth="1.0"/> <topPen lineWidth="1.0"/> @@ -135,7 +135,7 @@ <textFieldExpression><![CDATA[$V{columnName}]]></textFieldExpression> </textField> <staticText> - <reportElement uuid="953e5c2e-da0c-4657-9059-0673ebe92e42" style="Crosstab Data Text" x="0" y="30" width="70" height="25"/> + <reportElement uuid="953e5c2e-da0c-4657-9059-0673ebe92e42" style="Crosstab Data Text" x="0" y="30" width="65" height="25"/> <box> <pen lineWidth="1.0"/> <topPen lineWidth="1.0"/> @@ -149,7 +149,7 @@ <text><![CDATA[器械包数]]></text> </staticText> <staticText> - <reportElement uuid="8c0a00c9-b16f-41d1-bf23-255c4d4028f5" style="Crosstab Data Text" mode="Opaque" x="70" y="30" width="70" height="25" backcolor="#CCFFCC"/> + <reportElement uuid="8c0a00c9-b16f-41d1-bf23-255c4d4028f5" style="Crosstab Data Text" mode="Opaque" x="65" y="30" width="65" height="25" backcolor="#CCFFCC"/> <box> <pen lineWidth="1.0"/> <topPen lineWidth="1.0"/> @@ -174,10 +174,10 @@ <measure name="materialAmountMeasure" class="java.lang.Integer" calculation="Sum"> <measureExpression><![CDATA[$F{materialAmount}]]></measureExpression> </measure> - <crosstabCell width="140" height="30"> + <crosstabCell width="130" height="30"> <cellContents> <textField> - <reportElement uuid="04ec2f5b-0dfc-4109-8616-6c09675dfa8c" style="Crosstab Data Text" x="0" y="0" width="70" height="30"/> + <reportElement uuid="04ec2f5b-0dfc-4109-8616-6c09675dfa8c" style="Crosstab Data Text" x="0" y="0" width="65" height="30"/> <box> <pen lineWidth="1.0"/> <topPen lineWidth="1.0"/> @@ -191,7 +191,7 @@ <textFieldExpression><![CDATA[$V{amountMeasure}]]></textFieldExpression> </textField> <textField> - <reportElement uuid="08f99324-322c-4918-a578-b6dcc1a91123" style="Crosstab Data Text" mode="Opaque" x="70" y="0" width="70" height="30" backcolor="#CCFFCC"/> + <reportElement uuid="08f99324-322c-4918-a578-b6dcc1a91123" style="Crosstab Data Text" mode="Opaque" x="65" y="0" width="65" height="30" backcolor="#CCFFCC"/> <box> <pen lineWidth="1.0"/> <topPen lineWidth="1.0"/> @@ -206,10 +206,10 @@ </textField> </cellContents> </crosstabCell> - <crosstabCell width="140" height="31" rowTotalGroup="operator"> + <crosstabCell width="130" height="31" rowTotalGroup="operator"> <cellContents backcolor="#FFFFFF" mode="Opaque"> <textField> - <reportElement uuid="2721048b-46bc-4214-929a-12b1bfc4255d" style="Crosstab Data Text" x="0" y="0" width="70" height="30"/> + <reportElement uuid="2721048b-46bc-4214-929a-12b1bfc4255d" style="Crosstab Data Text" x="0" y="0" width="65" height="30"/> <box> <pen lineWidth="1.0"/> <topPen lineWidth="1.0"/> @@ -223,7 +223,7 @@ <textFieldExpression><![CDATA[$V{amountMeasure}]]></textFieldExpression> </textField> <textField> - <reportElement uuid="08f99324-322c-4918-a578-b6dcc1a91123" style="Crosstab Data Text" mode="Opaque" x="70" y="0" width="70" height="30" backcolor="#CCFFCC"/> + <reportElement uuid="08f99324-322c-4918-a578-b6dcc1a91123" style="Crosstab Data Text" mode="Opaque" x="65" y="0" width="65" height="30" backcolor="#CCFFCC"/> <box> <pen lineWidth="1.0"/> <topPen lineWidth="1.0"/> Index: ssts-web/src/main/webapp/jasperRtp/borrowingReportSummary.jrxml =================================================================== diff -u --- ssts-web/src/main/webapp/jasperRtp/borrowingReportSummary.jrxml (revision 0) +++ ssts-web/src/main/webapp/jasperRtp/borrowingReportSummary.jrxml (revision 25084) @@ -0,0 +1,178 @@ +<?xml version="1.0" encoding="UTF-8"?> +<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="sterilizingStoveUseCount" language="groovy" pageWidth="700" pageHeight="842" columnWidth="700" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="aa979892-1856-4053-a698-5118f961f8a4"> + <property name="ireport.zoom" value="1.210000000000001"/> + <property name="ireport.x" value="0"/> + <property name="ireport.y" value="0"/> + <style name="table"> + <box> + <pen lineWidth="1.0" lineColor="#000000"/> + </box> + </style> + <style name="table_TH" mode="Opaque" backcolor="#F0F8FF"> + <box> + <pen lineWidth="0.5" lineColor="#000000"/> + </box> + </style> + <style name="table_CH" mode="Opaque" backcolor="#BFE1FF"> + <box> + <pen lineWidth="0.5" lineColor="#000000"/> + </box> + </style> + <style name="table_TD" mode="Opaque" backcolor="#FFFFFF"> + <box> + <pen lineWidth="0.5" lineColor="#000000"/> + </box> + </style> + <subDataset name="Table Dataset 1" uuid="bf60b979-a3e8-4a34-a61e-e172745dcd17"/> + <parameter name="title" class="java.lang.String"/> + <parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false"> + <defaultValueExpression><![CDATA["C:\\workspace\\sterile\\WebContent\\jasperRtp\\"]]></defaultValueExpression> + </parameter> + <queryString> + <![CDATA[]]> + </queryString> + <field name="goodsName" class="java.lang.String"> + <fieldDescription><![CDATA[goodsName]]></fieldDescription> + </field> + <field name="borrowingAmount" class="java.lang.Integer"> + <fieldDescription><![CDATA[borrowingAmount]]></fieldDescription> + </field> + <variable name="totalAmount" class="java.lang.Integer" calculation="Sum"> + <variableExpression><![CDATA[$F{borrowingAmount}]]></variableExpression> + </variable> + <title> + <band height="35" splitType="Stretch"> + <textField> + <reportElement uuid="ca358ad0-a064-4fbc-a5b2-ccd593e955f7" mode="Opaque" x="0" y="0" width="700" height="35"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="14" isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$P{title}]]></textFieldExpression> + </textField> + </band> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: ssts-web/src/main/webapp/jasperRtp/borrowingReport.jrxml =================================================================== diff -u -r12331 -r25084 --- ssts-web/src/main/webapp/jasperRtp/borrowingReport.jrxml (.../borrowingReport.jrxml) (revision 12331) +++ ssts-web/src/main/webapp/jasperRtp/borrowingReport.jrxml (.../borrowingReport.jrxml) (revision 25084) @@ -1,5 +1,5 @@ - + @@ -57,7 +57,7 @@ <band height="38" splitType="Stretch"> <textField> - <reportElement uuid="4dd1a765-4207-4079-8cf6-8b2dc4d91f3b" x="0" y="0" width="901" height="38"/> + <reportElement uuid="4dd1a765-4207-4079-8cf6-8b2dc4d91f3b" x="0" y="0" width="960" height="38"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="14" isBold="true"/> </textElement> @@ -75,61 +75,75 @@ <text><![CDATA[借物申请科室]]></text> </staticText> <staticText> - <reportElement uuid="d2c35607-bde5-4c14-92b1-e100f9a278cb" style="table_CH" x="121" y="0" width="100" height="27"/> + <reportElement uuid="d2c35607-bde5-4c14-92b1-e100f9a278cb" style="table_CH" x="121" y="0" width="88" height="27"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" isBold="true"/> </textElement> <text><![CDATA[借物申请时间]]></text> </staticText> <staticText> - <reportElement uuid="25eb82e0-820d-46f1-882f-fc3a993a4b38" style="table_CH" x="221" y="0" width="90" height="27"/> + <reportElement uuid="25eb82e0-820d-46f1-882f-fc3a993a4b38" style="table_CH" x="209" y="0" width="90" height="27"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" isBold="true"/> </textElement> <text><![CDATA[借物人]]></text> </staticText> <staticText> - <reportElement uuid="2c8117ec-fc8a-48be-91c4-0100d9ad3a4d" style="table_CH" x="311" y="0" width="90" height="27"/> + <reportElement uuid="2c8117ec-fc8a-48be-91c4-0100d9ad3a4d" style="table_CH" x="299" y="0" width="76" height="27"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" isBold="true"/> </textElement> <text><![CDATA[状态]]></text> </staticText> <staticText> - <reportElement uuid="f4ef1586-3c40-4495-a4c9-2d0149fe6de9" style="table_CH" x="401" y="0" width="120" height="27"/> + <reportElement uuid="05b54932-d414-4abf-ad3e-98882a2464b4" style="table_CH" x="509" y="0" width="56" height="27"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" isBold="true"/> </textElement> - <text><![CDATA[物品名称]]></text> + <text><![CDATA[借物数量]]></text> </staticText> <staticText> - <reportElement uuid="05b54932-d414-4abf-ad3e-98882a2464b4" style="table_CH" x="521" y="0" width="80" height="27"/> + <reportElement uuid="729fa6e0-f68e-4935-978a-5e47896b8d55" style="table_CH" x="565" y="0" width="56" height="27"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" isBold="true"/> </textElement> - <text><![CDATA[借物数量]]></text> + <text><![CDATA[归还数量]]></text> </staticText> <staticText> - <reportElement uuid="729fa6e0-f68e-4935-978a-5e47896b8d55" style="table_CH" x="601" y="0" width="99" height="27"/> + <reportElement uuid="78ac56ff-4436-42e5-b7e8-8b53c999f4be" style="table_CH" x="621" y="0" width="81" height="27"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" isBold="true"/> </textElement> - <text><![CDATA[归还数量]]></text> + <text><![CDATA[归还时间]]></text> </staticText> <staticText> - <reportElement uuid="78ac56ff-4436-42e5-b7e8-8b53c999f4be" style="table_CH" x="700" y="0" width="101" height="27"/> + <reportElement uuid="3526a3fb-abc6-43d0-98e4-2cefa6324c7a" style="table_CH" x="832" y="0" width="88" height="27"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" isBold="true"/> </textElement> - <text><![CDATA[归还时间]]></text> + <text><![CDATA[归还人]]></text> </staticText> <staticText> - <reportElement uuid="3526a3fb-abc6-43d0-98e4-2cefa6324c7a" style="table_CH" x="801" y="0" width="100" height="27"/> + <reportElement uuid="729fa6e0-f68e-4935-978a-5e47896b8d55" style="table_CH" x="702" y="0" width="57" height="27"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12" isBold="true"/> </textElement> - <text><![CDATA[归还人]]></text> + <text><![CDATA[借出天数]]></text> </staticText> + <staticText> + <reportElement uuid="f4ef1586-3c40-4495-a4c9-2d0149fe6de9" style="table_CH" x="375" y="0" width="134" height="27"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="12" isBold="true"/> + </textElement> + <text><![CDATA[物品名称]]></text> + </staticText> + <staticText> + <reportElement uuid="f4ef1586-3c40-4495-a4c9-2d0149fe6de9" style="table_CH" x="759" y="0" width="73" height="27"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="12" isBold="true"/> + </textElement> + <text><![CDATA[借物总价]]></text> + </staticText> </band> </columnHeader> <detail> @@ -142,28 +156,28 @@ <textFieldExpression><![CDATA[$F{depart}]]></textFieldExpression> </textField> <textField> - <reportElement uuid="1c0be745-af8b-44b7-9e0d-4789ab5184df" style="table_TD" stretchType="RelativeToBandHeight" x="121" y="0" width="100" height="28"/> + <reportElement uuid="1c0be745-af8b-44b7-9e0d-4789ab5184df" style="table_TD" stretchType="RelativeToBandHeight" x="121" y="0" width="88" height="28"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12"/> </textElement> <textFieldExpression><![CDATA[$F{appTime}]]></textFieldExpression> </textField> <textField> - <reportElement uuid="eef7d363-7929-4919-9657-f3e6f0723302" style="table_TD" stretchType="RelativeToBandHeight" x="221" y="0" width="90" height="28"/> + <reportElement uuid="eef7d363-7929-4919-9657-f3e6f0723302" style="table_TD" stretchType="RelativeToBandHeight" x="209" y="0" width="90" height="28"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12"/> </textElement> <textFieldExpression><![CDATA[$F{borrowingUser}]]></textFieldExpression> </textField> <textField> - <reportElement uuid="30773659-d5dc-40f9-b525-ff9054537676" style="table_TD" stretchType="RelativeToBandHeight" x="311" y="0" width="90" height="28"/> + <reportElement uuid="30773659-d5dc-40f9-b525-ff9054537676" style="table_TD" stretchType="RelativeToBandHeight" x="299" y="0" width="76" height="28"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12"/> </textElement> <textFieldExpression><![CDATA[$F{status}]]></textFieldExpression> </textField> <subreport> - <reportElement uuid="6046a19a-5f35-4d7b-94b2-1ca60775a46d" stretchType="RelativeToBandHeight" x="401" y="0" width="499" height="28" isPrintWhenDetailOverflows="true"/> + <reportElement uuid="6046a19a-5f35-4d7b-94b2-1ca60775a46d" stretchType="RelativeToBandHeight" x="375" y="0" width="545" height="28" isPrintWhenDetailOverflows="true"/> <subreportParameter name="SUBREPORT_DIR"> <subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression> </subreportParameter> Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManager.java =================================================================== diff -u -r24671 -r25084 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManager.java (.../JasperReportManager.java) (revision 24671) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManager.java (.../JasperReportManager.java) (revision 25084) @@ -15,6 +15,7 @@ import com.forgon.disinfectsystem.entity.stocktakerecordmanager.StockTakeRecord; import com.forgon.disinfectsystem.jasperreports.javabeansource.ApparatusInfusionisType; import com.forgon.disinfectsystem.jasperreports.javabeansource.BaseBean; +import com.forgon.disinfectsystem.jasperreports.javabeansource.BorrowingRecordItemVo; import com.forgon.disinfectsystem.jasperreports.javabeansource.BorrowingRecordVo; import com.forgon.disinfectsystem.jasperreports.javabeansource.CleaningAreaWorkloadForUser; import com.forgon.disinfectsystem.jasperreports.javabeansource.CrossTableBean; @@ -440,9 +441,27 @@ public List<ApparatusInfusionisType> getApparatusInfusionis(String startDay,String endDay,String departCoding,String showDetail); + /** + * 获取借物申请明细 + * @param startDay 开始日期 + * @param endDay 结束日期 + * @param goodsName 物品名称 + * @param deptName 科室名称 + * @return + */ public List<BorrowingRecordVo> getBorrowingRecord(String startDay,String endDay,String goodsName,String deptName); /** + * 获取借物申请的汇总信息 + * @param startDay 开始日期 + * @param endDay 结束日期 + * @param goodsName 物品名称 + * @param deptName 科室名称 + * @return + */ + public List<BorrowingRecordItemVo> getBorrowingRecordSummary(String startDay,String endDay,String goodsName,String deptName); + + /** * 外来器械申请单统计报表: * @param startDay 开始时间(仅年月日,如yyyy-MM-dd) * @param endDay 结束时间(仅年月日,如yyyy-MM-dd) Index: ssts-web/src/main/webapp/jasperRtp/borrowingReport_subreport1.jrxml =================================================================== diff -u -r12331 -r25084 --- ssts-web/src/main/webapp/jasperRtp/borrowingReport_subreport1.jrxml (.../borrowingReport_subreport1.jrxml) (revision 12331) +++ ssts-web/src/main/webapp/jasperRtp/borrowingReport_subreport1.jrxml (.../borrowingReport_subreport1.jrxml) (revision 25084) @@ -46,21 +46,21 @@ <detail> <band height="28" splitType="Stretch"> <textField> - <reportElement uuid="32a3c31f-0134-44c6-b960-a2feadca70be" style="table_TH" stretchType="RelativeToBandHeight" x="0" y="0" width="120" height="28"/> + <reportElement uuid="32a3c31f-0134-44c6-b960-a2feadca70be" style="table_TH" stretchType="RelativeToBandHeight" x="0" y="0" width="134" height="28"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12"/> </textElement> <textFieldExpression><![CDATA[$F{goodsName}]]></textFieldExpression> </textField> <textField> - <reportElement uuid="2d1f6a59-25c0-4eea-a2cf-50325bede263" style="table_TH" stretchType="RelativeToBandHeight" x="120" y="0" width="80" height="28"/> + <reportElement uuid="2d1f6a59-25c0-4eea-a2cf-50325bede263" style="table_TH" stretchType="RelativeToBandHeight" x="134" y="0" width="56" height="28"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12"/> </textElement> <textFieldExpression><![CDATA[$F{borrowingAmount}]]></textFieldExpression> </textField> <subreport runToBottom="false"> - <reportElement uuid="4a0e9aff-7b36-4edd-aa8d-934686abb247" stretchType="RelativeToBandHeight" mode="Transparent" x="200" y="0" width="355" height="28" isPrintWhenDetailOverflows="true"/> + <reportElement uuid="4a0e9aff-7b36-4edd-aa8d-934686abb247" stretchType="RelativeToBandHeight" mode="Transparent" x="190" y="0" width="365" height="28" isPrintWhenDetailOverflows="true"/> <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{returnItems})]]></dataSourceExpression> <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "borrowingReport_subreport1_subreport1.jasper"]]></subreportExpression> </subreport> Index: ssts-web/src/main/webapp/disinfectsystem/reportforms/borrowReportView.js =================================================================== diff -u -r17582 -r25084 --- ssts-web/src/main/webapp/disinfectsystem/reportforms/borrowReportView.js (.../borrowReportView.js) (revision 17582) +++ ssts-web/src/main/webapp/disinfectsystem/reportforms/borrowReportView.js (.../borrowReportView.js) (revision 25084) @@ -18,12 +18,17 @@ var endTime = $Id('endTime').value; var deptName = $Id('departSearch').value; var goodsName = $Id('goodsSearch').value; + var queryType = Ext.getCmp('queryType').getRawValue(); myMask = new Ext.LoadMask(Ext.getBody(), { msg: '正在加载,请稍候!', removeMask: true }); myMask.show(); - window.open(WWWROOT+"/jasperreports/jasperreportsAction!createReportFromJavaBeanSource.do?jasperreportName=borrowingReport.jasper&startDay="+startTime+"&endDay="+endTime+"&deptName="+deptName+"&goodsName="+goodsName+"&reportName=borrowingReport",'thisIframe','_self'); + var jasperReportName = "borrowingReport.jasper"; + if(queryType == "汇总"){ + jasperReportName = "borrowingReportSummary.jasper"; + } + window.open(WWWROOT+"/jasperreports/jasperreportsAction!createReportFromJavaBeanSource.do?jasperreportName="+jasperReportName+"&startDay="+startTime+"&endDay="+endTime+"&deptName="+deptName+"&goodsName="+goodsName+"&reportName=borrowingReport&queryType="+queryType,'thisIframe','_self'); } var dt = new Date(); @@ -60,6 +65,11 @@ ) }); + var queryTypeStore = new Ext.data.SimpleStore( { + fields : [ 'value' ], + data : [['汇总'], ['明细']] + }); + var form = new Ext.form.FormPanel({ title : entityName, region : 'north', @@ -74,7 +84,7 @@ height : 105, items : [{ layout : 'column', - height : 40, + height : 80, labelWidth : 70, items : [{ xtype : 'hidden', @@ -196,6 +206,28 @@ } } }] + },{ + layout:'form', + width:300, + labelWidth : 100, + labelSeparator : '查询类型:', + items:[{ + id : 'queryType', + name : 'queryType', + xtype : 'combo', + valueField : 'value', + displayField : 'value', + store : queryTypeStore, + triggerAction : 'all', + mode : 'local', + listWidth:170, + editable : false, + forceSelection : true, + allowBlank : true, + anchor : '95%' + }] + + }] }], buttons:[{ @@ -247,5 +279,5 @@ departSearch.setValue(orgUnitName); departSearch.disable(); } - + Ext.getCmp("queryType").setValue("明细"); }); \ No newline at end of file Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java =================================================================== diff -u -r24733 -r25084 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 24733) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 25084) @@ -25,6 +25,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import java.util.concurrent.TimeUnit; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JasperFillManager; @@ -149,6 +150,7 @@ import com.forgon.tools.db.DatabaseUtil; import com.forgon.tools.db.InitDbConnection; import com.forgon.tools.hibernate.ObjectDao; +import com.forgon.tools.json.JSONUtil; import com.forgon.tools.string.StringTools; import com.forgon.tools.util.ForgonDateUtils; import com.forgon.tools.util.SqlUtils; @@ -9753,7 +9755,7 @@ /** - * 获取“消毒供应中心工作量统计报表”的数据.. + * 获取“消毒供应中心员工工作量统计报表”的数据.. * @param startTime 统计的开始时间(精确到天如:2017-01-01) * @param endTime 统计的结束时间(精确到天如:2017-01-01) * @param querySupplyRoom 被统计消毒供应中心的科室编码(包括一级或者二级供应中心) @@ -9762,6 +9764,7 @@ @Override public List<StatisticalWorkload> getStatisticalWorkloadData(String startTime, String endTime, String querySupplyRoom, String tousseTypes, String packageSizes, boolean isStrengthen) { + List<StatisticalWorkload> list = new ArrayList<StatisticalWorkload>(); if (StringUtils.isNotBlank(startTime) && StringUtils.isNotBlank(endTime) @@ -9770,17 +9773,43 @@ String endDateTime = endTime + " 23:59:59"; + // 是否在装配界面显示检查人,默认值为false + boolean showInspectorField = CssdUtils.getSystemSetConfigByNameBool("showInspectorField", false); + + + // 是否在装配界面显示包装人,默认值为false + boolean showWrapperField = CssdUtils.getSystemSetConfigByNameBool("showWrapperField", false); + + // 是否显示发货下送责任人,默认值为true + boolean showInvoicePersonInCharge = CssdUtils.getSystemSetConfigByNameBool("showInvoicePersonInCharge", true); + Map<String, Integer> sequenceMap = new HashMap<String, Integer>(); - sequenceMap.put("回收数量", 1); - sequenceMap.put("清点数量", 2); - sequenceMap.put("清洗数量", 3); - sequenceMap.put("配包数量", 4); - sequenceMap.put("审核数量", 5); - sequenceMap.put("包装数量", 6); - sequenceMap.put("灭菌数量", 7); - sequenceMap.put("发货数量", 8); - sequenceMap.put("检查数量", 9); - sequenceMap.put("核对数量", 10); + + // 统计工作环节的数量 + int staticFieldsCount = 0; + + sequenceMap.put("回收数量", ++staticFieldsCount); + sequenceMap.put("清点数量", ++staticFieldsCount); + sequenceMap.put("清洗数量", ++staticFieldsCount); + sequenceMap.put("配包数量", ++staticFieldsCount); + + if (showInspectorField){ + sequenceMap.put("检查数量", ++staticFieldsCount); + } + + if (showWrapperField){ + sequenceMap.put("包装数量", ++staticFieldsCount); + } + + sequenceMap.put("审核数量", ++staticFieldsCount); + sequenceMap.put("灭菌数量", ++staticFieldsCount); + sequenceMap.put("发货数量", ++staticFieldsCount); + sequenceMap.put("核对数量", ++staticFieldsCount); + + if (showInvoicePersonInCharge){ + sequenceMap.put("下送数量", ++staticFieldsCount); + } + //查询的时间段 String betweenSql = String.format(" between %s and %s ", dateQueryAdapter.dateAdapter(startDateTime),dateQueryAdapter.dateAdapter(endDateTime)); @@ -9809,6 +9838,7 @@ } String tousseTypeAndPackageSizeSql = String.format(" and %s and %s ", tousseTypeSql, packageSizeSql); + //按包数量统计的SQL //回收记录 String tousseAmountSql = String.format("select '回收数量' type,rr.recyclingUser userName,sum(ti.amount) amount from RecyclingRecord rr,RecyclingItem ti,TousseDefinition td " + "where ti.recyclingRecord_id = rr.id and ti.tousseDefinitionId=td.id " @@ -9824,35 +9854,31 @@ tousseAmountSql += " union all "; + //清洗数量 tousseAmountSql += "select '清洗数量' type,t1.userName userName,sum(t1.materialCount) amount from ("; - tousseAmountSql += String.format("select case when (min(cb.personInCharge) is null or min(cb.personInCharge) = '') then min(wr.operator) else min(cb.personInCharge) end userName,min(ci.tousseAmountForMaterial) materialCount " - + "from WashAndDisinfectRecord wr,ClassifyBasket_WashRecord cw,ClassifyBasket cb,ClassifiedItem ci,TousseDefinition td " - + "where cw.WashAndDisinfectRecord_ID = wr.id and cb.id = cw.ClassifyBasket_ID and ci.classifybasket_id = cb.id and td.id=ci.tousseDefinitionID " - + "and ci.itemType = '材料' and wr.orgUnitCoding = '%s' and wr.endDate %s and wr.washMaterialAmount <> 0 %s " - + "group by ci.tousseDefinitionID,ci.recyclingRecordId", querySupplyRoom,betweenSql,tousseTypeAndPackageSizeSql); - tousseAmountSql += " union all "; - tousseAmountSql += String.format("select case when (cb.personInCharge is null or cb.personInCharge = '') then wr.operator else cb.personInCharge end userName,ci.amount materialCount " - + "from WashAndDisinfectRecord wr,ClassifyBasket_WashRecord cw,ClassifyBasket cb,ClassifiedItem ci,TousseDefinition td " - + "where cw.WashAndDisinfectRecord_ID = wr.id and cb.id = cw.ClassifyBasket_ID and ci.classifybasket_id = cb.id and td.id=ci.tousseDefinitionID " - + "and wr.orgUnitCoding = '%s' and ci.itemtype != '材料' and wr.endDate %s and wr.washMaterialAmount <> 0 %s ", querySupplyRoom,betweenSql,tousseTypeAndPackageSizeSql); + tousseAmountSql += getWashAmountByPackageSQL(querySupplyRoom, + betweenSql, tousseTypeAndPackageSizeSql); tousseAmountSql += ") t1 group by t1.userName "; + tousseAmountSql += " union all "; //装配记录(配包数量) tousseAmountSql += String.format("select '配包数量' type,pr.packer userName,sum(pr.amount) amount from PackingRecord pr join TousseDefinition td on td.id=pr.tousseDefinitionId " + "where pr.orgUnitCoding = '%s' and pr.packTime %s and pr.packer is not null and %s(pr.packer)<>0 %s " + "group by pr.packer ", querySupplyRoom,betweenSql,sqlLengthFunctionName,tousseTypeAndPackageSizeSql); - tousseAmountSql += " union all "; + //包装检查数量 + if(showInspectorField){ //中山六院的项目开启了 + tousseAmountSql += " union all "; + //检查数量 + tousseAmountSql += String.format("select '检查数量' type,pr.inspector userName,sum(pr.amount) amount from PackingRecord pr join TousseDefinition td on td.id=pr.tousseDefinitionId " + + "where pr.orgUnitCoding= '%s' and pr.packTime %s and %s(pr.inspector)<>0 %s " + + "group by pr.inspector ", querySupplyRoom,betweenSql,sqlLengthFunctionName,tousseTypeAndPackageSizeSql); + } - //审核记录 - tousseAmountSql += String.format("select '审核数量' type,ti.reviewer userName,count(*) amount from tousseInstance ti join TousseDefinition td on td.id=ti.tousseDefinition_id " - + "where ti.orgUnitCoding = '%s' and ti.reviewTime %s and %s(ti.reviewer) <> 0 %s " - + "group by ti.reviewer ", querySupplyRoom,betweenSql,sqlLengthFunctionName,tousseTypeAndPackageSizeSql); - //装配记录(包装数量) - if (CssdUtils.getSystemSetConfigByNameBool("showWrapperField", false)) { + if (showWrapperField) { tousseAmountSql += " union all "; tousseAmountSql += String.format("select '包装数量' type,pr.wrapper userName,sum(pr.amount) amount from PackingRecord pr join TousseDefinition td on td.id=pr.tousseDefinitionId " + "where pr.orgUnitCoding = '%s' and pr.packTime %s and pr.wrapper is not null and %s(pr.wrapper)<>0 %s " @@ -9861,6 +9887,16 @@ tousseAmountSql += " union all "; + //审核记录 +// tousseAmountSql += String.format("select '审核数量' type,ti.reviewer userName,count(*) amount from tousseInstance ti join TousseDefinition td on td.id=ti.tousseDefinition_id " +// + "where ti.orgUnitCoding = '%s' and ti.reviewTime %s and %s(ti.reviewer) <> 0 %s " +// + "group by ti.reviewer ", querySupplyRoom,betweenSql,sqlLengthFunctionName,tousseTypeAndPackageSizeSql); + String reviewSql = String.format("select '审核数量' type,tl.userName,tl.amount from (") + + getReviewAmountByPackageSQL(querySupplyRoom, betweenSql, sqlLengthFunctionName, tousseTypeAndPackageSizeSql); + reviewSql += ") tl "; + tousseAmountSql += reviewSql; + tousseAmountSql += " union all "; + //灭菌记录 tousseAmountSql += "select '灭菌数量' type,temp.userName userName,sum(temp.amount) amount from("; tousseAmountSql += String.format("select sr.sterilizationUser userName,count(*) amount from SterilizationRecord sr,sterilization_tousseInstance st,TousseInstance ti,TousseDefinition td " @@ -9890,17 +9926,18 @@ + "where ii.invoice_id = i.id and td.id=ii.tousseDefinitionId " + "and i.orgUnitCoding= '%s' and i.sendTime %s and %s(i.assistantSender) <> 0 %s " + "group by i.assistantSender ", querySupplyRoom,betweenSql,sqlLengthFunctionName,tousseTypeAndPackageSizeSql); - - if(CssdUtils.isProject("zsly")){ //中山六院的项目(4.0的代码) - SupplyRoomConfig cfg = supplyRoomConfigManager.getFirstSupplyRoomConfig(); - String supplyRoom_zsly = cfg.getOrgUnitCoding(); - tousseAmountSql += " union all "; - //检查数量 - tousseAmountSql += String.format("select '检查数量' type,pr.inspector userName,sum(pr.amount) amount from PackingRecord pr join TousseDefinition td on td.id=pr.tousseDefinitionId " - + "where pr.orgUnitCoding= '%s' and pr.packTime %s and %s(pr.inspector)<>0 %s " - + "group by pr.inspector ", supplyRoom_zsly,betweenSql,sqlLengthFunctionName,tousseTypeAndPackageSizeSql); - } + //发货下送责任人 + if(showInvoicePersonInCharge){ + tousseAmountSql += " union all "; + //下送数量 + tousseAmountSql += String.format("select '下送数量' type,i.personInCharge userName,sum(ii.amount) amount from Invoice i, InvoiceItem ii,TousseDefinition td " + + "where ii.invoice_id = i.id and td.id=ii.tousseDefinitionId " + + "and i.orgUnitCoding= '%s' and i.sendTime %s and %s(i.personInCharge) <> 0 %s " + + "group by i.personInCharge ", querySupplyRoom,betweenSql,sqlLengthFunctionName,tousseTypeAndPackageSizeSql); + + } + ResultSet rs = objectDao.executeSql(tousseAmountSql); if (rs != null) { try { @@ -9933,7 +9970,7 @@ } } - + // 按材料数量统计的SQL //回收记录 String materialAmountSql = String.format("select '回收数量' type,rr.recyclingUser userName,sum(ti.amount * ms.count) amount from RecyclingRecord rr,RecyclingItem ti,tousseDefinition td,materialInstance ms " + "where ti.recyclingRecord_id = rr.id and ti.tousseDefinitionId = td.id and td.id = ms.tousse_id and rr.orgUnitCoding = '%s' and rr.recyclingTime %s and %s(rr.recyclingUser) <> 0 %s " @@ -9948,45 +9985,48 @@ materialAmountSql += " union all "; //清洗记录 - materialAmountSql += "select '清洗数量' type,t1.userName userName,sum(t1.materialCount) amount from ("; - materialAmountSql += String.format("select case when (cb.personInCharge is null or cb.personInCharge = '') then wr.operator else cb.personInCharge end userName,ci.amount materialCount " - + "from WashAndDisinfectRecord wr,ClassifyBasket_WashRecord cw,ClassifyBasket cb,ClassifiedItem ci,TousseDefinition td " - + "where cw.WashAndDisinfectRecord_ID = wr.id and cb.id = cw.ClassifyBasket_ID and ci.classifybasket_id = cb.id and td.id=ci.tousseDefinitionID " - + "and ci.itemType = '材料' and wr.orgUnitCoding = '%s' and wr.endDate %s and wr.washMaterialAmount <> 0 %s ", querySupplyRoom,betweenSql,tousseTypeAndPackageSizeSql); - materialAmountSql += " union all "; - materialAmountSql += String.format("select case when (cb.personInCharge is null or cb.personInCharge = '') then wr.operator else cb.personInCharge end userName,(ci.amount*mi.count) materialCount " - + "from WashAndDisinfectRecord wr,ClassifyBasket_WashRecord cw,ClassifyBasket cb,ClassifiedItem ci,TousseDefinition td,MaterialInstance mi " - + "where cw.WashAndDisinfectRecord_ID = wr.id and cb.id = cw.ClassifyBasket_ID and ci.classifybasket_id = cb.id and td.id = ci.toussedefinition_id and mi.tousse_id = td.id " - + "and ci.itemType <> '材料' and wr.orgUnitCoding = '%s' and wr.endDate %s and wr.washMaterialAmount <> 0 %s ", querySupplyRoom,betweenSql,tousseTypeAndPackageSizeSql); - materialAmountSql += " union all "; - materialAmountSql += String.format("select wr.operator userName,wrm.amount materialCount " - + "from WashAndDisinfectRecord wr, WashRecord_WashMaterial wm,WashAndDisinfectRecordMaterial wrm " - + "where wm.WashAndDisinfectRecord_ID = wr.id and wrm.id = wm.WashAndDisinfectMaterial_ID " - + "and wr.orgUnitCoding = '%s' and wr.endDate %s", querySupplyRoom , betweenSql); - materialAmountSql += ") t1 group by t1.userName "; + String washAmountSql = "select '清洗数量' type,t1.userName userName,sum(t1.materialCount) amount from ("; + washAmountSql += getWashAmountByMaterialSQL(querySupplyRoom, betweenSql, + tousseTypeAndPackageSizeSql); + washAmountSql += ") t1 group by t1.userName "; + materialAmountSql += washAmountSql; + materialAmountSql += "union all "; //装配记录(配包数量) materialAmountSql += String.format("select '配包数量' type,pr.packer userName,sum(pr.amount * ms.count) amount from PackingRecord pr,tousseDefinition td,materialInstance ms " + "where pr.tousseDefinitionId = td.id and td.id = ms.tousse_id and pr.orgUnitCoding = '%s' and pr.packTime %s and pr.packer is not null and %s(pr.packer)<>0 %s " + "group by pr.packer ", querySupplyRoom,betweenSql,sqlLengthFunctionName,tousseTypeAndPackageSizeSql); - materialAmountSql += "union all "; - //审核记录 - materialAmountSql += String.format("select '审核数量' type,ti.reviewer userName,sum(ms.count) amount from tousseInstance ti,tousseDefinition td,materialInstance ms " - + "where ti.tousseDefinition_id = td.id and td.id = ms.tousse_id and ti.orgUnitCoding = '%s' and ti.reviewTime %s and ti.reviewer is not null and %s(ti.reviewer) <> 0 %s " - + "group by ti.reviewer ", querySupplyRoom,betweenSql,sqlLengthFunctionName,tousseTypeAndPackageSizeSql); + // 包装检查数量 + if(showInspectorField){ //中山六院的项目开启了 + materialAmountSql += " union all "; + //检查数量 + materialAmountSql += String.format("select '检查数量' type,pr.inspector userName,sum(pr.amount * ms.count) amount from PackingRecord pr,tousseDefinition td,materialInstance ms " + + "where pr.tousseDefinitionId = td.id and td.id = ms.tousse_id and pr.orgUnitCoding= '%s' and pr.packTime %s and pr.inspector is not null and %s(pr.inspector)<>0 %s " + + "group by pr.inspector ", querySupplyRoom,betweenSql,sqlLengthFunctionName,tousseTypeAndPackageSizeSql); + } //装配记录(包装数量) - if (CssdUtils.getSystemSetConfigByNameBool("showWrapperField", false)) { + if (showWrapperField) { materialAmountSql += " union all "; materialAmountSql += String.format("select '包装数量' type,pr.wrapper userName,sum(pr.amount * ms.count) amount from PackingRecord pr,tousseDefinition td,materialInstance ms " + "where pr.tousseDefinitionId = td.id and td.id = ms.tousse_id and pr.orgUnitCoding = '%s' and pr.packTime %s and pr.wrapper is not null and %s(pr.wrapper)<>0 %s " + "group by pr.wrapper ", querySupplyRoom,betweenSql,sqlLengthFunctionName,tousseTypeAndPackageSizeSql); } + materialAmountSql += "union all "; + + //审核记录 + String reviewAmountByMaterialSql = String.format("select '审核数量' type,ti.reviewer userName,sum(ms.count) amount from tousseInstance ti,tousseDefinition td,materialInstance ms " + + "where ti.tousseDefinition_id = td.id and td.id = ms.tousse_id and ti.orgUnitCoding = '%s' and ti.reviewTime %s and ti.reviewer is not null and %s(ti.reviewer) <> 0 %s " + + "group by ti.reviewer ", querySupplyRoom,betweenSql,sqlLengthFunctionName,tousseTypeAndPackageSizeSql); + + materialAmountSql += reviewAmountByMaterialSql; + + materialAmountSql += " union all "; materialAmountSql += "select '灭菌数量' type,tmp.userName,sum(tmp.amount) from ("; @@ -10021,17 +10061,24 @@ + "where ii.invoice_id = i.id and i.orgUnitCoding = '%s' and ii.tousseType = '一次性物品' and i.sendTime %s and %s(i.assistantSender) <> 0 " + "group by i.assistantSender ", querySupplyRoom,betweenSql,sqlLengthFunctionName); materialAmountSql += ")tmp group by tmp.userName"; - - if(CssdUtils.isProject("zsly")){ //中山六院的项目(4.0的代码) - SupplyRoomConfig cfg = supplyRoomConfigManager.getFirstSupplyRoomConfig(); - String supplyRoom_zsly = cfg.getOrgUnitCoding(); - materialAmountSql += " union all "; - //检查数量 - materialAmountSql += String.format("select '检查数量' type,pr.inspector userName,sum(pr.amount * ms.count) amount from PackingRecord pr,tousseDefinition td,materialInstance ms " - + "where pr.tousseDefinitionId = td.id and td.id = ms.tousse_id and pr.orgUnitCoding= '%s' and pr.packTime %s and pr.inspector is not null and %s(pr.inspector)<>0 %s " - + "group by pr.inspector ", supplyRoom_zsly,betweenSql,sqlLengthFunctionName,tousseTypeAndPackageSizeSql); - } + //发货下送责任人 + if(showInvoicePersonInCharge){ + materialAmountSql += " union all "; + + //下送数量 + materialAmountSql += "select '下送数量' type,tmp.userName,sum(tmp.amount) from ("; + materialAmountSql += String.format("select i.personInCharge userName,sum(ms.count) amount from Invoice i,tousseInstance ti,tousseDefinition td,materialInstance ms " + + "where ti.invoice_id = i.id and ti.tousseDefinition_id = td.id and td.id = ms.tousse_id and i.orgUnitCoding = '%s' and i.sendTime %s and %s(i.personInCharge) <> 0 %s " + + "group by i.personInCharge ", querySupplyRoom,betweenSql,sqlLengthFunctionName,tousseTypeAndPackageSizeSql); + materialAmountSql += " union all "; + materialAmountSql += String.format("select i.personInCharge userName,sum(ii.amount) amount from Invoice i,invoiceItem ii " + + "where ii.invoice_id = i.id and i.orgUnitCoding = '%s' and ii.tousseType = '一次性物品' and i.sendTime %s and %s(i.personInCharge) <> 0 " + + "group by i.personInCharge ", querySupplyRoom,betweenSql,sqlLengthFunctionName); + materialAmountSql += ")tmp group by tmp.userName"; + + } + ResultSet rs2 = objectDao.executeSql(materialAmountSql); if (rs2 != null) { try { @@ -10064,9 +10111,77 @@ } return list; + } + /** + * 获取按包统计审核数量的SQL + * @param querySupplyRoom + * @param betweenSql + * @param sqlLengthFunctionName + * @param extraAndQuery + * @return + */ + private String getReviewAmountByPackageSQL(String querySupplyRoom, + String betweenSql, String sqlLengthFunctionName, String extraAndQuery) { + String tousseAmountSql = String.format("select ti.reviewer userName,count(*) amount,td.name tousseName,td.tousseType from tousseInstance ti join TousseDefinition td on td.id=ti.tousseDefinition_id " + + "where ti.orgUnitCoding = '%s' and ti.reviewTime %s and %s(ti.reviewer) <> 0 %s " + + "group by ti.reviewer,td.name,td.tousseType ", querySupplyRoom,betweenSql,sqlLengthFunctionName,extraAndQuery); + return tousseAmountSql; + } + + /** + * 获取按包数量统计清洗数量的SQL,作为子查询,可被多个报表调用 + * @param querySupplyRoom 供应室的编码 + * @param betweenSql 查询的时间范围 + * @param extraAndQuery 更多的and查询条件 + * @return Select查询,结果集包含2列:userName(工作人员姓名),materialCount(所清洗的无菌包的包数量) + */ + private String getWashAmountByPackageSQL(String querySupplyRoom, + String betweenSql, String extraAndQuery) { + String tousseAmountSql = String.format("select case when (min(cb.personInCharge) is null or min(cb.personInCharge) = '') then min(wr.operator) else min(cb.personInCharge) end userName,min(ci.tousseAmountForMaterial) materialCount,min(ci.name) tousseName,min(ci.itemType) tousseType " + + "from WashAndDisinfectRecord wr,ClassifyBasket_WashRecord cw,ClassifyBasket cb,ClassifiedItem ci,TousseDefinition td " + + "where cw.WashAndDisinfectRecord_ID = wr.id and cb.id = cw.ClassifyBasket_ID and ci.classifybasket_id = cb.id and td.id=ci.tousseDefinitionID " + + "and ci.itemType = '材料' and wr.orgUnitCoding = '%s' and wr.endDate %s and wr.washMaterialAmount <> 0 %s " + + "group by ci.tousseDefinitionID,ci.recyclingRecordId", querySupplyRoom,betweenSql,extraAndQuery); + tousseAmountSql += " union all "; + tousseAmountSql += String.format("select case when (cb.personInCharge is null or cb.personInCharge = '') then wr.operator else cb.personInCharge end userName,ci.amount materialCount,ci.name tousseName,ci.itemType tousseType " + + "from WashAndDisinfectRecord wr,ClassifyBasket_WashRecord cw,ClassifyBasket cb,ClassifiedItem ci,TousseDefinition td " + + "where cw.WashAndDisinfectRecord_ID = wr.id and cb.id = cw.ClassifyBasket_ID and ci.classifybasket_id = cb.id and td.id=ci.tousseDefinitionID " + + "and wr.orgUnitCoding = '%s' and ci.itemtype != '材料' and wr.endDate %s and wr.washMaterialAmount <> 0 %s ", querySupplyRoom,betweenSql,extraAndQuery); + return tousseAmountSql; + } + + /** + * 获取按材料统计清洗数量的SQL,作为子查询,可被多个报表调用 + * + * @param querySupplyRoom 供应室的编码 + * @param betweenSql 查询的时间范围 + * @param extraAndQuery 更多的and查询条件 + * @return Select查询,结果集包含2列:userName(工作人员姓名),materialCount(所清洗的无菌包的包数量) + */ + private String getWashAmountByMaterialSQL(String querySupplyRoom, + String betweenSql, String extraAndQuery) { + String washByMaterialAmountSQL = String.format("select case when (cb.personInCharge is null or cb.personInCharge = '') then wr.operator else cb.personInCharge end userName,ci.amount materialCount,ci.tousseNameForMaterial tousseName,td.tousseType tousseType " + + "from WashAndDisinfectRecord wr,ClassifyBasket_WashRecord cw,ClassifyBasket cb,ClassifiedItem ci,TousseDefinition td " + + "where cw.WashAndDisinfectRecord_ID = wr.id and cb.id = cw.ClassifyBasket_ID and ci.classifybasket_id = cb.id and td.id=ci.tousseDefinitionID " + + "and ci.itemType = '材料' and wr.orgUnitCoding = '%s' and wr.endDate %s and wr.washMaterialAmount <> 0 %s ", querySupplyRoom,betweenSql,extraAndQuery); + washByMaterialAmountSQL += " union all "; + washByMaterialAmountSQL += String.format("select case when (cb.personInCharge is null or cb.personInCharge = '') then wr.operator else cb.personInCharge end userName,(ci.amount*mi.count) materialCount,ci.name tousseName,td.tousseType tousseType " + + "from WashAndDisinfectRecord wr,ClassifyBasket_WashRecord cw,ClassifyBasket cb,ClassifiedItem ci,TousseDefinition td,MaterialInstance mi " + + "where cw.WashAndDisinfectRecord_ID = wr.id and cb.id = cw.ClassifyBasket_ID and ci.classifybasket_id = cb.id and td.id = ci.toussedefinition_id and mi.tousse_id = td.id " + + "and ci.itemType <> '材料' and wr.orgUnitCoding = '%s' and wr.endDate %s and wr.washMaterialAmount <> 0 %s ", querySupplyRoom,betweenSql,extraAndQuery); + washByMaterialAmountSQL += " union all "; + washByMaterialAmountSQL += String.format("select wr.operator userName,wrm.amount materialCount,md.name tousseName,'材料' tousseType " + + "from WashAndDisinfectRecord wr, WashRecord_WashMaterial wm,WashAndDisinfectRecordMaterial wrm,MaterialDefinition md " + + "where wm.WashAndDisinfectRecord_ID = wr.id and wrm.id = wm.WashAndDisinfectMaterial_ID and wrm.materialDefinition_id = md.id " + + "and wr.orgUnitCoding = '%s' and wr.endDate %s", querySupplyRoom , betweenSql); + + return washByMaterialAmountSQL; + } + + /** * 器械包运作统计报表 */ @Override @@ -12245,7 +12360,7 @@ public List<TousseWorkLoadVO> getTousseWorkLoadData(String startTime, String endTime, String departCoding, String tousseTypes, String operator, String isDisableIDCard, String taskGroup, String tousseGroup) { - long ll = System.currentTimeMillis(); + long begin = System.currentTimeMillis(); if(StringUtils.isNotBlank(startTime) && startTime.trim().length() == 16){ startTime = startTime + ":00"; } @@ -12257,6 +12372,9 @@ String startDateSql = dateQueryAdapter.dateConverAdapter2(startTime,dateFormatter); String endDateSql = dateQueryAdapter.dateConverAdapter2(endTime,dateFormatter); + //数据库计算字符串长度的函数名 + String sqlLengthFunctionName = DatabaseUtil.getSqlLengthFunctionName(dbConnection); + String tousseTypeSqlWithAliasOfTousseDefinitionIsTd = ""; String tousseTypeSqlWithAliasOfTousseDefinitionIsTi = ""; boolean includeForeignTousse = false; //需要查询的器械包类型是否包含“外来器械包” @@ -12352,7 +12470,7 @@ //清洗数量(按包统计) sql += " union all "; - sql += String.format("select 'wash' as type,ti.tousseName,sum(ti.tousseAmount),ti.tousseType from (" + String wash = String.format("select 'wash' as type,ti.tousseName,sum(ti.tousseAmount),ti.tousseType from (" + "select ci.name as tousseName,ci.amount as tousseAmount,ci.itemType as tousseType," + "case when (cb.personInCharge is null or cb.personInCharge = '') then wdr.operator else cb.personInCharge end userName " + "from WashAndDisinfectRecord wdr,ClassifyBasket_WashRecord cw,ClassifyBasket cb,ClassifiedItem ci,TousseDefinition td " @@ -12370,27 +12488,20 @@ isDisableIDCardSqlWithAliasOfTousseDefinitionIsTd,taskGroupSqlWithAliasOfTousseDefinitionIsTd,tousseGroupSqlWithAliasOfTousseDefinitionIsTd,departCoding,startDateSql,endDateSql, isDisableIDCardSqlWithAliasOfTousseDefinitionIsTd,taskGroupSqlWithAliasOfTousseDefinitionIsTd,tousseGroupSqlWithAliasOfTousseDefinitionIsTd,departCoding,startDateSql,endDateSql, getAndSql("ti.userName", operator),tousseTypeSqlWithAliasOfTousseDefinitionIsTi); + sql += wash; //清洗数量(按材料统计) sql += " union all "; - sql += String.format("select 'wash-material' as type,ti.tousseName,sum(ti.tousseAmount),ti.tousseType from (" - + "select td.name as tousseName,ci.amount as tousseAmount,td.tousseType as tousseType," - + "case when (cb.personInCharge is null or cb.personInCharge = '') then wdr.operator else cb.personInCharge end userName " - + "from WashAndDisinfectRecord wdr,ClassifyBasket_WashRecord cw,ClassifyBasket cb,ClassifiedItem ci,tousseDefinition td " - + "where wdr.id = cw.WashAndDisinfectRecord_ID and cw.ClassifyBasket_ID = cb.id and cb.id = ci.classifybasket_id " - + " and ci.itemType = '"+ MaterialDefinition.TYPE_NAME +"' " - + " %s %s %s and wdr.orgUnitCoding = '%s' and wdr.endDate between %s and %s and wdr.washMaterialAmount<>0 " - + " union all " - + "select ci.name as tousseName,ci.amount as tousseAmount,td.tousseType as tousseType," - + "case when (cb.personInCharge is null or cb.personInCharge = '') then wdr.operator else cb.personInCharge end userName " - + "from WashAndDisinfectRecord wdr,ClassifyBasket_WashRecord cw,ClassifyBasket cb,ClassifiedItem ci,tousseDefinition td " - + "where wdr.id = cw.WashAndDisinfectRecord_ID and cw.ClassifyBasket_ID = cb.id and cb.id = ci.classifybasket_id and ci.tousseDefinitionID=td.id and ci.itemType = '"+ TousseDefinition.PACKAGE_TYPE_INSIDE +"' " - + " %s %s %s and wdr.orgUnitCoding = '%s' and wdr.endDate between %s and %s and wdr.washMaterialAmount<>0 " - + ") ti where 1=1 %s %s group by ti.tousseType,ti.tousseName ", - isDisableIDCardSqlWithAliasOfTousseDefinitionIsTd,taskGroupSqlWithAliasOfTousseDefinitionIsTd,tousseGroupSqlWithAliasOfTousseDefinitionIsTd,departCoding,startDateSql,endDateSql, - isDisableIDCardSqlWithAliasOfTousseDefinitionIsTd,taskGroupSqlWithAliasOfTousseDefinitionIsTd,tousseGroupSqlWithAliasOfTousseDefinitionIsTd,departCoding,startDateSql,endDateSql, - getAndSql("ti.userName", operator),tousseTypeSqlWithAliasOfTousseDefinitionIsTi); + String washMaterial = "select 'wash-material' as type,ti.tousseName,sum(ti.materialCount),ti.tousseType from ("; + + washMaterial += getWashAmountByMaterialSQL(departCoding, String.format(" between %s and %s ",startDateSql,endDateSql), + String.format(" %s %s %s ",isDisableIDCardSqlWithAliasOfTousseDefinitionIsTd,taskGroupSqlWithAliasOfTousseDefinitionIsTd, + tousseGroupSqlWithAliasOfTousseDefinitionIsTd)); + + washMaterial += String.format(") ti where 1=1 %s %s group by ti.tousseType,ti.tousseName ",getAndSql("ti.userName", operator),tousseTypeSqlWithAliasOfTousseDefinitionIsTi); + sql += washMaterial; + //装配数量(按包统计) sql += " union all "; sql += String.format("select 'packing' as type,ti.name tousseName,sum(pr.amount),ti.tousseType from PackingRecord pr,TousseDefinition ti " @@ -12401,13 +12512,21 @@ //审核数量(按包统计) sql += " union all "; - sql += String.format("select 'review' as type,t.tousseName,count(*),ti.tousseType from TousseInstance t,TousseDefinition ti " - +" where t.tousseDefinition_id=ti.id %s %s %s and t.orgUnitCoding = '%s' and t.reviewTime between %s and %s and t.foreignTousseApp_id is null " - + "and (ti.statisticsReviewWorkload='%s' or ti.statisticsReviewWorkload is null or ti.statisticsReviewWorkload='') and ti.isReview='%s' " - + "%s %s group by ti.tousseType,t.tousseName ", - isDisableIDCardSqlWithAliasOfTousseDefinitionIsTi,taskGroupSqlWithAliasOfTousseDefinitionIsTi,tousseGroupSqlWithAliasOfTousseDefinitionIsTi, - departCoding,startDateSql,endDateSql,Constants.STR_YES,Constants.STR_YES,getAndSql("t.reviewer", operator),tousseTypeSqlWithAliasOfTousseDefinitionIsTi); + // TODO:以下的代码加了包定义中是否统计审核的工作量的判断,需要考虑该属性是否需要 +// sql += String.format("select 'review' as type,t.tousseName,count(*),ti.tousseType from TousseInstance t,TousseDefinition ti " +// +" where t.tousseDefinition_id=ti.id %s %s %s and t.orgUnitCoding = '%s' and t.reviewTime between %s and %s and t.foreignTousseApp_id is null " +// + "and (ti.statisticsReviewWorkload='%s' or ti.statisticsReviewWorkload is null or ti.statisticsReviewWorkload='') and ti.isReview='%s' " +// + "%s %s group by ti.tousseType,t.tousseName ", +// isDisableIDCardSqlWithAliasOfTousseDefinitionIsTi,taskGroupSqlWithAliasOfTousseDefinitionIsTi,tousseGroupSqlWithAliasOfTousseDefinitionIsTi, +// departCoding,startDateSql,endDateSql,Constants.STR_YES,Constants.STR_YES,getAndSql("t.reviewer", operator),tousseTypeSqlWithAliasOfTousseDefinitionIsTi); + String reviewSql = String.format("select 'review' type,tl.tousseName,tl.amount,tl.tousseType from (") + + getReviewAmountByPackageSQL(departCoding, String.format(" between %s and %s ",startDateSql,endDateSql), + sqlLengthFunctionName, String.format(" %s %s %s %s",isDisableIDCardSqlWithAliasOfTousseDefinitionIsTd,taskGroupSqlWithAliasOfTousseDefinitionIsTd, + tousseGroupSqlWithAliasOfTousseDefinitionIsTd,tousseTypeSqlWithAliasOfTousseDefinitionIsTd)); + reviewSql += ") tl "; + sql += reviewSql; + if (includeForeignTousse) { sql += " union all "; sql += String.format("select 'review' as type,fta.tousseName,count(*),'外来器械包' from TousseInstance t,ForeignTousseApplication fta " @@ -12572,7 +12691,7 @@ } } - logger.debug("器械包工作量统计报表后台查询时间:" + (System.currentTimeMillis() - ll) + "毫秒"); + logger.debug("器械包工作量统计报表后台查询时间:" + (System.currentTimeMillis() - begin) + "毫秒"); return list; } @@ -12963,9 +13082,21 @@ @Override public List<BorrowingRecordVo> getBorrowingRecord(String startDay, String endDay, String goodsName, String deptName) { + + + // 判断项目是否开启借物按天收费 + boolean isBorrowChargeByDayAndShow = false; + String s = CssdUtils.getSystemSetConfigByName("isBorrowChargeByDayAndShow"); + + if (StringUtils.isNotBlank(s)){ + JSONObject json = JSONUtil.toJSONObject(s); + isBorrowChargeByDayAndShow = json.optBoolean("open"); + } if(StringUtils.isNotBlank(endDay)){ endDay += " 23:59:59"; } + + // 查询满足搜索条件的借物单 String sql = "select distinct p.id from invoiceplan p,tousseItem i where " + "p.id = i.recyclingApplication_ID and p.submitTime between " + dateQueryAdapter.dateAdapter(startDay) + " and " @@ -12980,50 +13111,91 @@ if(StringUtils.isNotBlank(deptName)){ sql += " and p.depart = '"+deptName+"'"; } + // 按借物单的创建顺序升序排列,早的排在前面,新的排在后面 + sql += " order by p.id asc"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); List<BorrowingRecordVo> vos = new ArrayList<BorrowingRecordVo>(); ResultSet rs = objectDao.executeSql(sql); try { + // 遍历每一张借物单 while (rs.next()) { String id = rs.getString(1); - RecyclingApplication app = (RecyclingApplication)objectDao.getByProperty( + // 获得借物单 + RecyclingApplication borrowApplication = (RecyclingApplication)objectDao.getByProperty( RecyclingApplication.class.getSimpleName(), "id", Long.valueOf(id)); BorrowingRecordVo vo = new BorrowingRecordVo(); - vo.setAppTime(sdf.format(app.getSubmitTime())); - vo.setBorrowingUser(app.getApplicant()); - vo.setDepart(app.getDepart()); - vo.setId(app.getId()); - vo.setStatus(app.getReturnStatus()); + + // 申请时间 + vo.setAppTime(sdf.format(borrowApplication.getSubmitTime())); + + // 发货时间 + Date lastInvoiceTime = borrowApplication.getLastInvoiceTime(); + if (lastInvoiceTime != null){ + vo.setLastInvoiceTime(sdf.format(borrowApplication.getLastInvoiceTime())); + } + + // 申请人 + vo.setBorrowingUser(borrowApplication.getApplicant()); + vo.setDepart(borrowApplication.getDepart()); + vo.setId(borrowApplication.getId()); + vo.setStatus(borrowApplication.getReturnStatus()); vos.add(vo); - List<TousseItem> appItems = app.getApplicationItems(); - List<RecyclingApplication> appList = app + List<TousseItem> appItems = borrowApplication.getApplicationItems(); + + // 获取还物申请单。一张借物单可以对应多张还物申请单,因为可以分多次还 + List<RecyclingApplication> returnApplyList = borrowApplication .getRecyclingApplications(); // 还物信息 Map<String, List<ReturnRecordItemVo>> returnItemMap = new HashMap<String, List<ReturnRecordItemVo>>(); - if (appList != null) { - for (RecyclingApplication recyclingApplication : appList) { - RecyclingRecord rRecord = recyclingApplication + if (returnApplyList != null) { + // 遍历还物申请单 + for (RecyclingApplication returnApplication : returnApplyList) { + // 回收记录 + RecyclingRecord recyclingRecord = returnApplication .getRecyclingRecord(objectDao); - if (rRecord != null) { - List<RecyclingItem> recyclingItems = rRecord + if (recyclingRecord != null) { + List<RecyclingItem> recyclingItems = recyclingRecord .getItems(); if (recyclingItems != null) { - for (RecyclingItem ti : recyclingItems) { - String tousseName = ti.getTousseName(); + for (RecyclingItem recyclingItem : recyclingItems) { + String tousseName = recyclingItem.getTousseName(); List<ReturnRecordItemVo> riVos = returnItemMap .get(tousseName); if (riVos == null) { riVos = new ArrayList<ReturnRecordItemVo>(); returnItemMap.put(tousseName, riVos); } ReturnRecordItemVo riVo = new ReturnRecordItemVo(); - riVo.setReturnAmount(ti.getAmount()); - String rTime = sdf.format(rRecord + riVo.setReturnAmount(recyclingItem.getAmount()); + + // 归还日期 + String returnDate = sdf.format(recyclingRecord .getRecyclingTime()); - riVo.setReturnTime(rTime); - riVo.setReveiveUser(rRecord.getOperator()); + riVo.setReturnTime(returnDate); + + + // 获取借物单中的记录的物品的借物价格 + Double borrowPrice = getBorrowPrice(appItems, + recyclingItem); + + // 计算借物的天数,根据发货时间和归还后回收时间的间隔,24小时内算1天,超过24小时不足48小时算2天 + int days = (int)DateTools.getDateDiff(borrowApplication.getLastInvoiceTime(),recyclingRecord + .getRecyclingTime(),TimeUnit.DAYS ) + 1; + riVo.setBorrowDays(days); + + double totalPrice = borrowPrice; + + // 按天收费 + if (isBorrowChargeByDayAndShow){ + // 计算借物总价格 + totalPrice = borrowPrice * days * recyclingItem.getAmount(); + } + + riVo.setTotalPrice(totalPrice); + + riVo.setReveiveUser(recyclingRecord.getOperator()); riVos.add(riVo); } } @@ -13054,7 +13226,76 @@ } return vos; } + + public List<BorrowingRecordItemVo> getBorrowingRecordSummary(String startDay, + String endDay, String goodsName, String deptName) { + + + if(StringUtils.isNotBlank(endDay)){ + endDay += " 23:59:59"; + } + + // 查询满足搜索条件的借物单 + String sql = "select i.tousseName, count(i.amount) from invoiceplan p,tousseItem i where " + + "p.id = i.recyclingApplication_ID and p.submitTime between " + + dateQueryAdapter.dateAdapter(startDay) + " and " + + dateQueryAdapter.dateAdapter(endDay); + + sql += " and p.committedStatus = 1 and p.type = '" + + InvoicePlan.TYPE_BORROWINGSINGLE + "'"; + + if(StringUtils.isNotBlank(goodsName)){ + sql += " and i.tousseName = '"+goodsName+"'"; + } + if(StringUtils.isNotBlank(deptName)){ + sql += " and p.depart = '"+deptName+"'"; + } + sql += " group by i.tousseName"; + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + List<BorrowingRecordItemVo> vos = new ArrayList<BorrowingRecordItemVo>(); + ResultSet rs = objectDao.executeSql(sql); + try { + // 遍历每一张借物单 + while (rs.next()) { + String tousseName = rs.getString(1); + + int borrowingAmount = rs.getInt(2); + BorrowingRecordItemVo vo = new BorrowingRecordItemVo(); + + vo.setGoodsName(tousseName); + vo.setBorrowingAmount(borrowingAmount); + vos.add(vo); + + } + } catch (SQLException e) { + e.printStackTrace(); + }finally { + DatabaseUtil.closeResultSetAndStatement(rs); + } + return vos; + } + + /** + * 获取借物单中的记录的物品的借物价格 + * @param appItems 借物单中的物品集合 + * @param recyclingItem 回收项 + * @return + */ + private Double getBorrowPrice(List<TousseItem> appItems, + RecyclingItem recyclingItem) { + Double price = 0D; + for (int i=0;i<appItems.size();i++){ + TousseItem appItem = appItems.get(i); + if (appItem.getTousseName().equals(recyclingItem.getTousseName())){ + price = appItem.getPrice(); + break; + } + } + return price; + } + @Override public List<ForeignTousseApplicationVO> getForeignTousseApplicationReport( String startDay, String endDay, String goodsName, String deptName , String patientName , String deliverStatus) { Index: ssts-web/src/main/webapp/jasperRtp/borrowingReportSummary.jasper =================================================================== diff -u Binary files differ Index: ssts-web/src/main/webapp/jasperRtp/borrowingReport_subreport1_subreport1.jrxml =================================================================== diff -u -r12331 -r25084 --- ssts-web/src/main/webapp/jasperRtp/borrowingReport_subreport1_subreport1.jrxml (.../borrowingReport_subreport1_subreport1.jrxml) (revision 12331) +++ ssts-web/src/main/webapp/jasperRtp/borrowingReport_subreport1_subreport1.jrxml (.../borrowingReport_subreport1_subreport1.jrxml) (revision 25084) @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="borrowingReport_subreport1_subreport1" language="groovy" pageWidth="300" pageHeight="802" columnWidth="300" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="0e20e121-5dde-4d64-9556-189241dd0120"> +<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="borrowingReport_subreport1_subreport1" language="groovy" pageWidth="355" pageHeight="802" columnWidth="355" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="0e20e121-5dde-4d64-9556-189241dd0120"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> @@ -36,32 +36,52 @@ <field name="reveiveUser" class="java.lang.String"> <fieldDescription><![CDATA[reveiveUser]]></fieldDescription> </field> + <field name="borrowDays" class="java.lang.String"> + <fieldDescription><![CDATA[borrowDays]]></fieldDescription> + </field> + <field name="totalPrice" class="java.lang.String"> + <fieldDescription><![CDATA[totalPrice]]></fieldDescription> + </field> <background> <band splitType="Stretch"/> </background> <detail> <band height="28" splitType="Stretch"> <textField isBlankWhenNull="true"> - <reportElement uuid="e085637d-70a5-4bd7-a830-de7589085aed" style="table_TD" x="0" y="0" width="100" height="28" backcolor="#CCCCCC"/> + <reportElement uuid="e085637d-70a5-4bd7-a830-de7589085aed" style="table_TD" x="0" y="0" width="56" height="28" backcolor="#CCCCCC"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12"/> </textElement> <textFieldExpression><![CDATA[$F{returnAmount}]]></textFieldExpression> </textField> <textField isBlankWhenNull="true"> - <reportElement uuid="4def2d4f-35e8-4fbc-8442-6722a345d249" style="table_TD" x="100" y="0" width="100" height="28" backcolor="#CCCCCC"/> + <reportElement uuid="4def2d4f-35e8-4fbc-8442-6722a345d249" style="table_TD" x="56" y="0" width="81" height="28" backcolor="#CCCCCC"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12"/> </textElement> <textFieldExpression><![CDATA[$F{returnTime}]]></textFieldExpression> </textField> <textField isBlankWhenNull="true"> - <reportElement uuid="59349407-08e5-4c51-9675-212760a26bf6" style="table_TD" x="200" y="0" width="100" height="28" backcolor="#CCCCCC"/> + <reportElement uuid="59349407-08e5-4c51-9675-212760a26bf6" style="table_TD" x="267" y="0" width="88" height="28" backcolor="#CCCCCC"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font size="12"/> </textElement> <textFieldExpression><![CDATA[$F{reveiveUser}]]></textFieldExpression> </textField> + <textField isBlankWhenNull="true"> + <reportElement uuid="4def2d4f-35e8-4fbc-8442-6722a345d249" style="table_TD" x="137" y="0" width="57" height="28" backcolor="#CCCCCC"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="12"/> + </textElement> + <textFieldExpression><![CDATA[$F{borrowDays}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement uuid="4def2d4f-35e8-4fbc-8442-6722a345d249" style="table_TD" x="194" y="0" width="73" height="28" backcolor="#CCCCCC"/> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="12"/> + </textElement> + <textFieldExpression><![CDATA[$F{totalPrice}]]></textFieldExpression> + </textField> </band> </detail> </jasperReport> Index: ssts-web/src/main/webapp/jasperRtp/statisticalWorkload.jasper =================================================================== diff -u -r18190 -r25084 Binary files differ Index: ssts-web/src/main/webapp/jasperRtp/borrowingReport_subreport1_subreport1.jasper =================================================================== diff -u -r12331 -r25084 Binary files differ