Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java =================================================================== diff -u -r25282 -r25283 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 25282) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 25283) @@ -3035,7 +3035,7 @@ String sql = "select sum(qmd.amount) from QualityMonitoringInstance qi ,FormInstance fi," + "FormDefinition fd,QualityMonitoringGoods qmd where qi.id = fi.id " + " and fi.formDefinition_id = fd.id and qi.id=qmd.qualityMonitoringInstance_id " - + " and fi.orgUnitCoding = '"+querySupplyRoom+"' " + + SqlUtils.get_InSql_Extra("fi.orgUnitCoding", querySupplyRoom) + " and fd.formName like '%消毒物品不合格%' and qi.dateTime >= " + dateQueryAdapter.dateAdapter(startDay) + " and qi.dateTime <= " @@ -3045,10 +3045,11 @@ String totalSql = "select sum(p.amount) from packingrecord p,TousseDefinition td " + " where p.tousseDefinitionId = td.id and td.tousseType = '" + TousseDefinition.PACKAGE_TYPE_DISINFECTION + "'" - + " and p.orgUnitCoding = '"+querySupplyRoom+"' and p.packTime >= " + + " and p.packTime >= " + dateQueryAdapter.dateAdapter(startDay) + " and p.packTime <= " - + dateQueryAdapter.dateAdapter(endDay); + + dateQueryAdapter.dateAdapter(endDay) + + SqlUtils.get_InSql_Extra("p.orgUnitCoding", querySupplyRoom); // getAmountBySql bean.setTitle("消毒物品不合格数"); bean.setRowNum(list.size()+1); @@ -3098,7 +3099,7 @@ + " monthstr, sum(qmd.amount) from QualityMonitoringInstance qi ,FormInstance fi,FormDefinition fd " + " ,QualityMonitoringGoods qmd " + " where qi.id = fi.id and fi.formDefinition_id = fd.id and qi.id=qmd.qualityMonitoringInstance_id " - + " and fi.orgUnitCoding = '"+querySupplyRoom+"' " + + SqlUtils.get_InSql_Extra("fi.orgUnitCoding", querySupplyRoom) + " and fd.formName like '%消毒物品不合格%' and qi.dateTime >= " + dateQueryAdapter.dateAdapter(queryYear) + " and qi.dateTime <= " @@ -3183,7 +3184,7 @@ + dateQueryAdapter.dateAdapter(startDay) + " and p.packTime <= " + dateQueryAdapter.dateAdapter(endDay) - + " and p.orgUnitCoding = '"+querySupplyRoom+"'"; + + SqlUtils.get_InSql_Extra("p.orgUnitCoding", querySupplyRoom); Integer amount = getSumAmountBySql(sql); Integer amount2 = getSumAmountBySql(sql2); @@ -3297,7 +3298,7 @@ endDay = innerMap.get(keyOfInnerMap); } String sql = "select count(*) from invoiceplan p ,invoice i,tousseinstance t where p.id = i.invoiceplan_id and t.invoice_id = i.id " - + "and i.orgUnitCoding = '"+querySupplyRoom+"' and " + + SqlUtils.get_InSql_Extra("i.orgUnitCoding", querySupplyRoom)+" and " + dateQueryAdapter.dateToVarchar("p.applicationTime") + " != " + dateQueryAdapter.dateToVarchar("i.sendTime") @@ -3360,7 +3361,7 @@ String nextYear = dataIndex.getNextYear(year) + " 00:00:00"; String sql = "select " + dateQueryAdapter.dateConverAdapter3("p.applicationTime","mm") + " monthstr, count(*) from invoiceplan p ,invoice i,tousseinstance t where p.id = i.invoiceplan_id and t.invoice_id = i.id " - + "and i.orgUnitCoding = '"+querySupplyRoom+"' and " + + SqlUtils.get_InSql_Extra("i.orgUnitCoding", querySupplyRoom)+ " and " + dateQueryAdapter.dateToVarchar("p.applicationTime") + " != " + dateQueryAdapter.dateToVarchar("i.sendTime") @@ -3538,14 +3539,14 @@ + " and qi.dateTime <= " + dateQueryAdapter.dateAdapter(endDay) + " and fd.formType = '质量监测'" - + " and fi.orgUnitCoding = '"+querySupplyRoom+"'"; + + SqlUtils.get_InSql_Extra("fi.orgUnitCoding", querySupplyRoom); String totalSql = "select count(*) from sterilizationrecord r ,sterilizer s where r.sterilizer_id = s.id " + " and r.endDate >= " + dateQueryAdapter.dateAdapter(startDay) + " and r.endDate <= " + dateQueryAdapter.dateAdapter(endDay) + " and (r.status = '灭菌完成' or r.status = '灭菌失败') " - + " and r.orgUnitCoding = '"+querySupplyRoom+"'" + + SqlUtils.get_InSql_Extra("r.orgUnitCoding", querySupplyRoom) + " and s.name not like '%" + "4#" + "%' "; Integer amount = getSumAmountBySql(sql); @@ -3600,7 +3601,7 @@ + " and qi.dateTime <= " + dateQueryAdapter.dateAdapter(nextYear) + " and fd.formType = '质量监测'" - + " and fi.orgUnitCoding = '"+querySupplyRoom+"'" + + SqlUtils.get_InSql_Extra("fi.orgUnitCoding", querySupplyRoom) + " group by " + dateQueryAdapter.dateConverAdapter3("qi.dateTime","mm"); ResultSet result = objectDao.executeSql(sql); bean.setRowNum(list.size()+1); @@ -3670,7 +3671,7 @@ + " and qi.dateTime <= " + dateQueryAdapter.dateAdapter(endDay) + " and fd.formType = '质量监测'" - + " and fi.orgUnitCoding = '"+querySupplyRoom+"'"; + + SqlUtils.get_InSql_Extra("fi.orgUnitCoding", querySupplyRoom); return sql; } private void getGoodsDeliveryError( @@ -3749,7 +3750,7 @@ + " and qi.dateTime <= " + dateQueryAdapter.dateAdapter(nextYear) + " and fd.formType = '质量监测'" - + " and fi.orgUnitCoding = '"+querySupplyRoom+"'" + + SqlUtils.get_InSql_Extra("fi.orgUnitCoding", querySupplyRoom) + " group by " + dateQueryAdapter.dateConverAdapter3("qi.dateTime","mm"); ResultSet result = objectDao.executeSql(sql); bean.setRowNum(list.size()+1); @@ -3827,10 +3828,11 @@ String sql = buildQualityMonitoringSQL(querySupplyRoom, startDay, endDay, "回收器械丢失"); // 清洗总数量 String totalSql = "select sum(r.washmaterialamount) from washanddisinfectrecord r " - + "where r.orgUnitCoding = '"+querySupplyRoom+"' and r.endDate >= " + + "where r.endDate >= " + dateQueryAdapter.dateAdapter(startDay) + " and r.endDate <= " - + dateQueryAdapter.dateAdapter(endDay); + + dateQueryAdapter.dateAdapter(endDay) + + SqlUtils.get_InSql_Extra("r.orgUnitCoding", querySupplyRoom); Integer amount = getSumAmountBySql(sql); bean.setTitle("回收器械丢失发生件数"); bean.setRowNum(list.size()+1); @@ -3879,7 +3881,7 @@ + " monthstr, sum(qmd.amount) from QualityMonitoringInstance qi ,FormInstance fi," + "FormDefinition fd,QualityMonitoringGoods qmd where qi.id = fi.id and fi.formDefinition_id = fd.id " + " and qi.id=qmd.qualityMonitoringInstance_id " - + " and fi.orgUnitCoding = '"+querySupplyRoom+"' " + + SqlUtils.get_InSql_Extra("fi.orgUnitCoding", querySupplyRoom) + " and fd.formName like '%回收器械丢失%' " + "and qi.dateTime >= " + dateQueryAdapter.dateAdapter(queryYear) @@ -3959,10 +3961,11 @@ } String sql = buildQualityMonitoringSQL(querySupplyRoom, startDay, endDay, "器械损坏"); String sql2 = "select sum(r.washmaterialamount) from washanddisinfectrecord r " - + "where r.orgUnitCoding = '"+querySupplyRoom+"' and r.endDate >= " + + "where r.endDate >= " + dateQueryAdapter.dateAdapter(startDay) + " and r.endDate <= " - + dateQueryAdapter.dateAdapter(endDay);; + + dateQueryAdapter.dateAdapter(endDay) + + SqlUtils.get_InSql_Extra("r.orgUnitCoding", querySupplyRoom); Integer amount = getSumAmountBySql(sql); if (amount == null) { @@ -4012,7 +4015,7 @@ + " monthstr, sum(qmd.amount) from QualityMonitoringInstance qi ,FormInstance fi," + "FormDefinition fd,QualityMonitoringGoods qmd " + " where qi.id = fi.id and fi.formDefinition_id = fd.id and qi.id=qmd.qualityMonitoringInstance_id " - + " and fi.orgUnitCoding = '"+querySupplyRoom+"' " + + SqlUtils.get_InSql_Extra("fi.orgUnitCoding", querySupplyRoom) + " and fd.formName like '%器械损坏%'" + " and qi.dateTime >= " + dateQueryAdapter.dateAdapter(queryYear) + " and qi.dateTime <= " @@ -4087,7 +4090,7 @@ + dateQueryAdapter.dateAdapter(startDay) + " and p.packTime <= " + dateQueryAdapter.dateAdapter(endDay) - + " and p.orgUnitCoding = '"+querySupplyRoom+"'"; + + SqlUtils.get_InSql_Extra("p.orgUnitCoding", querySupplyRoom); Integer amount = getSumAmountBySql(sql); Integer amount2 = getSumAmountBySql(sql2); @@ -4203,7 +4206,7 @@ + dateQueryAdapter.dateAdapter(startDay) + " and p.packTime <= " + dateQueryAdapter.dateAdapter(endDay) - + " and p.orgUnitCoding = '"+querySupplyRoom+"'"; + + SqlUtils.get_InSql_Extra("p.orgUnitCoding", querySupplyRoom); Integer amount = getSumAmountBySql(sql); Integer amount2 = getSumAmountBySql(sql2); @@ -4321,7 +4324,7 @@ + dateQueryAdapter.dateAdapter(startDay) + " and p.packTime <= " + dateQueryAdapter.dateAdapter(endDay) - + " and p.orgUnitCoding = '"+querySupplyRoom+"'"; + + SqlUtils.get_InSql_Extra("p.orgUnitCoding", querySupplyRoom); Integer amount = getSumAmountBySql(sql); Integer amount2 = getSumAmountBySql(sql2); @@ -4437,7 +4440,7 @@ + dateQueryAdapter.dateAdapter(startDay) + " and p.packTime <= " + dateQueryAdapter.dateAdapter(endDay) - + " and p.orgUnitCoding = '"+querySupplyRoom+"'"; + + SqlUtils.get_InSql_Extra("p.orgUnitCoding", querySupplyRoom); Integer amount = getSumAmountBySql(sql); Integer amount2 = getSumAmountBySql(sql2); @@ -4484,7 +4487,7 @@ + " and qi.dateTime <= " + dateQueryAdapter.dateAdapter(nextYear) + " and fd.formType = '质量监测'" - + " and fi.orgUnitCoding = '"+querySupplyRoom+"'" + + SqlUtils.get_InSql_Extra("fi.orgUnitCoding", querySupplyRoom) + " group by " + dateQueryAdapter.dateConverAdapter3("qi.dateTime","mm"); ResultSet result = objectDao.executeSql(sql); @@ -4552,10 +4555,11 @@ String sql = buildQualityMonitoringSQL2(startDay, endDay, querySupplyRoom, "湿包"); // 装配总数 String sql2 = "select sum(p.amount) from packingrecord p" - + " where p.orgUnitCoding = '"+querySupplyRoom+"' and p.packTime >= " + + " where p.packTime >= " + dateQueryAdapter.dateAdapter(startDay) + " and p.packTime <= " - + dateQueryAdapter.dateAdapter(endDay); + + dateQueryAdapter.dateAdapter(endDay) + + SqlUtils.get_InSql_Extra("p.orgUnitCoding", querySupplyRoom); Integer amount = getSumAmountBySql(sql); Integer sterilizationAmount = getSumAmountBySql(sql2); @@ -4601,7 +4605,7 @@ + " and qi.dateTime <= " + dateQueryAdapter.dateAdapter(nextYear) + " and fd.formType = '质量监测'" - + " and fi.orgUnitCoding = '"+querySupplyRoom+"'" + + SqlUtils.get_InSql_Extra("fi.orgUnitCoding", querySupplyRoom) + " group by " + dateQueryAdapter.dateConverAdapter3("qi.dateTime","mm"); ResultSet result = objectDao.executeSql(sql); @@ -4670,10 +4674,11 @@ String sql = buildQualityMonitoringSQL2(startDay, endDay, querySupplyRoom, "破包"); // 灭菌总数 String sql2 = "select sum(p.amount) from packingrecord p" - + " where p.orgUnitCoding = '"+querySupplyRoom+"' and p.packTime >= " + + " where p.packTime >= " + dateQueryAdapter.dateAdapter(startDay) + " and p.packTime <= " - + dateQueryAdapter.dateAdapter(endDay); + + dateQueryAdapter.dateAdapter(endDay) + + SqlUtils.get_InSql_Extra("p.orgUnitCoding", querySupplyRoom); Integer amount = getSumAmountBySql(sql); Integer sterilizationAmount = getSumAmountBySql(sql2); @@ -4719,7 +4724,7 @@ + " and qi.dateTime <= " + dateQueryAdapter.dateAdapter(nextYear) + " and fd.formType = '质量监测'" - + " and fi.orgUnitCoding = '"+querySupplyRoom+"'" + + SqlUtils.get_InSql_Extra("fi.orgUnitCoding", querySupplyRoom) + " group by " + dateQueryAdapter.dateConverAdapter3("qi.dateTime","mm"); ResultSet result = objectDao.executeSql(sql); @@ -4799,7 +4804,7 @@ + " and qi.dateTime <= " + dateQueryAdapter.dateAdapter(endDay) + " and fd.formType = '质量监测'" - + " and fi.orgUnitCoding = '"+querySupplyRoom+"'"; + + SqlUtils.get_InSql_Extra("fi.orgUnitCoding", querySupplyRoom); Integer amount = getSumAmountBySql(sql); bean.setTitle("灭菌方式选择不正确发生数"); @@ -4814,10 +4819,11 @@ } //装配总数 String totalSql = "select sum(p.amount) from packingrecord p" - + " where p.orgUnitCoding = '"+querySupplyRoom+"' and p.packTime >= " + + " where p.packTime >= " + dateQueryAdapter.dateAdapter(startDay) + " and p.packTime <= " - + dateQueryAdapter.dateAdapter(endDay); + + dateQueryAdapter.dateAdapter(endDay) + + SqlUtils.get_InSql_Extra("p.orgUnitCoding", querySupplyRoom); Integer totalAmount = getAmountBySql(totalSql); // 设置百分比 if (totalAmount != null && totalAmount > 0) { @@ -4861,7 +4867,7 @@ + " and qi.dateTime <= " + dateQueryAdapter.dateAdapter(nextYear) + " and fd.formType = '质量监测'" - + " and fi.orgUnitCoding = '"+querySupplyRoom+"'" + + SqlUtils.get_InSql_Extra("fi.orgUnitCoding", querySupplyRoom) + " group by " + dateQueryAdapter.dateConverAdapter3("qi.dateTime","mm"); ResultSet result = objectDao.executeSql(sql); bean.setRowNum(list.size()+1); @@ -5017,7 +5023,7 @@ + dateQueryAdapter.dateAdapter(startDay) + " and p.packTime <= " + dateQueryAdapter.dateAdapter(endDay) - + " and p.orgUnitCoding = '"+querySupplyRoom+"'"; + + SqlUtils.get_InSql_Extra("p.orgUnitCoding", querySupplyRoom); Integer amount = getSumAmountBySql(sql); Integer amount2 = getSumAmountBySql(sql2); bean.setTitle("包内器械种类错误发生件数"); @@ -5130,7 +5136,7 @@ + dateQueryAdapter.dateAdapter(startDay) + " and p.packTime <= " + dateQueryAdapter.dateAdapter(endDay) - + " and p.orgUnitCoding = '"+querySupplyRoom+"'"; + + SqlUtils.get_InSql_Extra("p.orgUnitCoding", querySupplyRoom); Integer amount = getSumAmountBySql(sql); Integer amount2 = getSumAmountBySql(sql2); bean.setTitle("无菌包内器械功能不全件数"); @@ -5243,7 +5249,7 @@ + dateQueryAdapter.dateAdapter(startDay) + " and p.packTime <= " + dateQueryAdapter.dateAdapter(endDay) - + " and p.orgUnitCoding = '"+querySupplyRoom+"'"; + + SqlUtils.get_InSql_Extra("p.orgUnitCoding", querySupplyRoom); Integer amount = getSumAmountBySql(sql); Integer amount2 = getSumAmountBySql(sql2); bean.setTitle("无菌包内器械缺失发生件数"); @@ -5344,8 +5350,8 @@ + "FormInstanceItem fii,FormDefinitionItem fdi,QualityMonitoringGoods qmd " + " where qi.id = fi.id and fi.formDefinition_id = fd.id and qi.id=qmd.qualityMonitoringInstance_id " + " and fi.id = fii.formInstance_id and fii.formDefinitionItem_id = fdi.id " - + " and fi.orgUnitCoding = '" + querySupplyRoom - + "' and fii.answer like '%" + likeValue + "%' and qi.dateTime >= " + + SqlUtils.get_InSql_Extra("fi.orgUnitCoding", querySupplyRoom) + + " and fii.answer like '%" + likeValue + "%' and qi.dateTime >= " + dateQueryAdapter.dateAdapter(startDay) + " and qi.dateTime <= " + dateQueryAdapter.dateAdapter(endDay) @@ -5368,10 +5374,11 @@ String sql = buildQualityMonitoringSQL(querySupplyRoom, startDay, endDay, "包装密闭不合格"); String sql2 = "select sum(p.amount) from packingrecord p" - + " where p.orgUnitCoding = '"+querySupplyRoom+"' and p.packTime >= " + + " where p.packTime >= " + dateQueryAdapter.dateAdapter(startDay) + " and p.packTime <= " - + dateQueryAdapter.dateAdapter(endDay); + + dateQueryAdapter.dateAdapter(endDay) + + SqlUtils.get_InSql_Extra("p.orgUnitCoding", querySupplyRoom); Integer amount = getSumAmountBySql(sql); Integer amount2 = getSumAmountBySql(sql2); bean.setTitle("灭菌物品包装密闭不合格数"); @@ -5692,7 +5699,7 @@ + " where qi.id = fi.id and fi.formDefinition_id = fd.id " + " and qi.id=qmd.qualityMonitoringInstance_id" + " and fd.formName like '%器械清洗不合格%' " - + " and fi.orgUnitCoding = '"+querySupplyRoom+"'" + + SqlUtils.get_InSql_Extra("fi.orgUnitCoding", querySupplyRoom) + " and fd.formType = '质量监测' " + " and qi.dateTime >= " + dateQueryAdapter.dateAdapter(startDay) @@ -5701,10 +5708,11 @@ // 清洗总数量 String washAmountSql = "select sum(r.washmaterialamount) from washanddisinfectrecord r " - + "where r.orgUnitCoding = '"+querySupplyRoom+"' and r.endDate >= " + + "where r.endDate >= " + dateQueryAdapter.dateAdapter(startDay) + " and r.endDate <= " - + dateQueryAdapter.dateAdapter(endDay); + + dateQueryAdapter.dateAdapter(endDay) + + SqlUtils.get_InSql_Extra("r.orgUnitCoding", querySupplyRoom); bean.setTitle("器械清洗不合格数"); bean.setRowNum(list.size()+1); @@ -5764,7 +5772,7 @@ + " monthstr, sum(qmd.amount) from QualityMonitoringInstance qi ,FormInstance fi,FormDefinition fd,QualityMonitoringGoods qmd " + "where qi.id = fi.id and fi.formDefinition_id = fd.id " + " and qi.id=qmd.qualityMonitoringInstance_id and fd.formName like '%器械清洗不合格%' " - + " and fi.orgUnitCoding = '"+querySupplyRoom+"'" + + SqlUtils.get_InSql_Extra("fi.orgUnitCoding", querySupplyRoom) + " and fd.formType = '质量监测' " + " and qi.dateTime >= " + dateQueryAdapter.dateAdapter(queryYear) @@ -5931,10 +5939,11 @@ } String sql = "select sum(s.tousseAmount+s.dressingTousseAmount),sum(s.proxyTousseAmount)," + "sum(s.foreignTousseAmount) from sterilizationrecord s " - + " where s.orgUnitCoding = '"+querySupplyRoom+"' and s.endDate >= " + + " where s.endDate >= " + dateQueryAdapter.dateAdapter(startDay) + " and s.endDate <= " + dateQueryAdapter.dateAdapter(endDay) + + SqlUtils.get_InSql_Extra("s.orgUnitCoding", querySupplyRoom) + " and s.status = '灭菌完成'"; tousseBean.setRowNum(list.size()+1); @@ -5989,10 +5998,11 @@ + "sum(s.proxyTousseAmount)," + "sum(s.foreignTousseAmount) " + "from sterilizationrecord s " - + " where s.orgUnitCoding = '"+querySupplyRoom+"' and s.endDate >= " + + " where s.endDate >= " + dateQueryAdapter.dateAdapter(queryYear) + " and s.endDate <= " + dateQueryAdapter.dateAdapter(nextYear) + + SqlUtils.get_InSql_Extra("s.orgUnitCoding", querySupplyRoom) + " and s.status = '灭菌完成'" + " group by " + dateQueryAdapter.dateConverAdapter3("s.endDate","mm"); ResultSet result = objectDao.executeSql(sql); @@ -6207,7 +6217,8 @@ endDay = innerMap.get(keyOfInnerMap); } String sql = "select count(*) from sterilizationrecord sr,Sterilizer s " - + "where sr.sterilizer_id = s.id and sr.orgUnitCoding = '"+querySupplyRoom+"'" + + "where sr.sterilizer_id = s.id " + + SqlUtils.get_InSql_Extra("sr.orgUnitCoding", querySupplyRoom) + " and sr.endDate >= " + dateQueryAdapter.dateAdapter(startDay) + " and sr.endDate <= " @@ -6250,7 +6261,7 @@ String nextYear = dataIndex.getNextYear(year) + " 00:00:00"; String sql = "select " + dateQueryAdapter.dateConverAdapter3("sr.endDate","mm") + " montrstr, count(*) from sterilizationrecord sr,Sterilizer s " - + "where sr.sterilizer_id = s.id and sr.orgUnitCoding = '"+querySupplyRoom+"'" + + "where sr.sterilizer_id = s.id " + SqlUtils.get_InSql_Extra("sr.orgUnitCoding", querySupplyRoom) + " and sr.endDate >= " + dateQueryAdapter.dateAdapter(queryYear) + " and sr.endDate <= " @@ -8659,7 +8670,7 @@ String sql3 = "select count(*) from SterilizationRecord sr,Sterilizer s where " + " sr.sterilizer_id = s.id and (sr.status = '灭菌完成' or sr.status = '灭菌失败') and sr.enddate between " + startDay + " and " + endDay - + " and sr.orgUnitCoding = '"+querySupplyRoom+"'" + + SqlUtils.get_InSql_Extra("sr.orgUnitCoding", querySupplyRoom) + " and s.ownGroup = '" + ownGroup + "'"; ResultSet rs3 = objectDao.executeSql(sql3); String columnName5 = "灭菌器使用炉次 (" + ownGroup + ")"; @@ -13573,13 +13584,13 @@ params.querySupplyRoom = querySupplyRoom; - // 统计整包清洗的器械包和消毒物品的材料件数 + // 统计整包清洗的器械包、外来器械包、消毒物品、自定义器械包的材料件数 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 "; sql += "b.id = i.classifybasket_id and i.toussedefinition_id = t.id and t.id = ms.tousse_id and ms.materialdefinition_id = m.id "; - sql += "and (i.itemType='"+ ClassifiedItem.TYPE_TOUSSE +"' or i.itemType='"+ ClassifiedItem.TYPE_DISINFECTION_GOODS +"')"; + sql += "and i.itemType <> '材料' "; sql += "and r.enddate " + params.betweenSql ; sql += SqlUtils.get_InSql_Extra("r.orgUnitCoding", params.querySupplyRoom) + " group by i.id,m.type "; @@ -13588,8 +13599,8 @@ // 统计拆包清洗的材料件数(主要包括拆包清洗的器械包以及外来器械) sql += "select m.type as type,sum(i.amount) as amount from "; sql += "washanddisinfectrecord r ,ClassifyBasket_WashRecord cw ,ClassifyBasket b, ClassifiedItem i,materialdefinition "; - 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 " + params.betweenSql; + sql += "m where r.id = cw.washanddisinfectrecord_id and cw.classifybasket_id = b.id and b.id = i.classifybasket_id "; + sql += "and i.materialdefinition_id = m.id and i.itemType = '材料' and r.enddate " + params.betweenSql; sql += SqlUtils.get_InSql_Extra("r.orgUnitCoding", params.querySupplyRoom) + " group by m.type"; // 统计单独登记清洗的材料数量 Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/CustomReportsOfZsyy.java =================================================================== diff -u -r25235 -r25283 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/CustomReportsOfZsyy.java (.../CustomReportsOfZsyy.java) (revision 25235) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/CustomReportsOfZsyy.java (.../CustomReportsOfZsyy.java) (revision 25283) @@ -38,6 +38,7 @@ import com.forgon.tools.db.DatabaseUtil; import com.forgon.tools.db.InitDbConnection; import com.forgon.tools.hibernate.ObjectDao; +import com.forgon.tools.util.SqlUtils; /** * @author Terry @@ -734,7 +735,7 @@ String sql =" select sum(qmd.amount) amount " + " from QualityMonitoringInstance qmi,FormInstance fi,FormDefinition fd,QualityMonitoringGoods qmd" + " where qmi.id=fi.id and fi.formDefinition_id=fd.id and qmi.id = qmd.qualityMonitoringInstance_id " - + " and fd.orgUnitCoding = '" + querySupplyRoom + "'" + + SqlUtils.get_InSql_Extra("fd.orgUnitCoding", querySupplyRoom) + " and fd.formName like '%" + formName + "%'" + " and (qmi.dateTime between " +dateQueryAdapter.dateAdapter(startDay)+" and " + dateQueryAdapter.dateAdapter(endDay) + ")"; return sql; @@ -796,17 +797,18 @@ String sql = " select sum(tdc.amount*ri.amount) from RecyclingRecord rr join RecyclingItem ri on rr.id=ri.recyclingRecord_id join TousseDefinition td on td.id=ri.tousseDefinitionId " + " join (select td.id tid,td.name tdName, sum(mi.count) amount from MaterialInstance mi, tousseDefinition td where mi.tousse_id=td.id and td.forDisplay=1 group by td.id,td.name) tdc " + " on tdc.tid=td.id " - + " where rr.orgUnitCoding = '" + querySupplyRoom + "'" - + " and rr.recyclingTime between " + dateQueryAdapter.dateAdapter(startDay) +" and " + dateQueryAdapter.dateAdapter(endDay); + + " where rr.recyclingTime between " + dateQueryAdapter.dateAdapter(startDay) +" and " + dateQueryAdapter.dateAdapter(endDay) + + SqlUtils.get_InSql_Extra("rr.orgUnitCoding", querySupplyRoom); return sql; } // 获取清洗总数sql private String getTotalWashSql(String startDay,String endDay,String querySupplyRoom){ String sql = "select sum(r.washmaterialamount) from washanddisinfectrecord r " - + "where r.orgUnitCoding = '"+querySupplyRoom+"' and r.endDate >= " + + "where r.endDate >= " + dateQueryAdapter.dateAdapter(startDay) + " and r.endDate <= " - + dateQueryAdapter.dateAdapter(endDay); + + dateQueryAdapter.dateAdapter(endDay) + + SqlUtils.get_InSql_Extra("r.orgUnitCoding", querySupplyRoom); return sql; } // 获取装配总数sql