Index: ssts-web/src/main/webapp/disinfectsystem/config/xjjqzyy/reports/foreignTousseApplicationReport.js =================================================================== diff -u -r25740 -r25745 --- ssts-web/src/main/webapp/disinfectsystem/config/xjjqzyy/reports/foreignTousseApplicationReport.js (.../foreignTousseApplicationReport.js) (revision 25740) +++ ssts-web/src/main/webapp/disinfectsystem/config/xjjqzyy/reports/foreignTousseApplicationReport.js (.../foreignTousseApplicationReport.js) (revision 25745) @@ -26,10 +26,19 @@ formHeight = 100; } function reloadReport(){ + if (!form.form.isValid()) { + showResult('请正确填写表单各值'); + return false; + } var startTime= $Id('startTime').value; var endTime = $Id('endTime').value; var assemblingStartTime = $Id('assemblingStartTime').value; var assemblingEndTime = $Id('assemblingEndTime').value; + if(assemblingStartTime > assemblingEndTime !="" && assemblingEndTime != ""){ + showResult('装配开始时间不能大于装配结束时间'); + $Id('assemblingStartTime').focus(); + return false; + } var deptName = $Id('departSearch').value; var patientName = $Id('patientName').value; var deliverStatus = $Id('deliverStatus').value; @@ -100,7 +109,7 @@ name : 'departCoding', id : 'departCoding' },{ - width : 200, + width : 210, layout : 'form', labelWidth : 100, items : [ @@ -166,20 +175,20 @@ } ] }] },{ - width : 200, + width : 250, layout : 'form', labelWidth : 100, items : [{ layout : 'form', items : [ { - xtype : 'datefield', + xtype : 'datefieldWithMin', fieldLabel : '装配开始日期', id : 'assemblingStartTime', name : 'assemblingStartTime', editable : false, - format : 'Y-m-d', + format : 'Y-m-d H:i:s', altFormats:'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', - allowBlank : false, + allowBlank : true, anchor : '100%', value: new Date(startDayofMonth), listeners : { @@ -197,20 +206,20 @@ } ] }] },{ - width : 200, + width : 250, layout : 'form', labelWidth : 100, items : [{ layout : 'form', items : [ { - xtype : 'datefield', + xtype : 'datefieldWithMin', fieldLabel : '装配结束日期', id : 'assemblingEndTime', name : 'assemblingEndTime', editable : false, - format : 'Y-m-d', + format : 'Y-m-d H:i:s', altFormats:'Y-m-d|Y-n-j|y-n-j|y-m-j|y-m-d|y-n-d|Y-n-d|Y-m-j|Ymd|Ynj|ynj|ymj|ymd|ynd|Ynd|Ymj|Y/m/d|Y/n/j|y/n/j|y/m/j|y/m/d|y/n/d|Y/n/d|Y/m/j', - allowBlank : false, + allowBlank : true, anchor : '100%', value: new Date(), listeners : { Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/CustomReportsOfXjjqzyy.java =================================================================== diff -u -r25743 -r25745 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/CustomReportsOfXjjqzyy.java (.../CustomReportsOfXjjqzyy.java) (revision 25743) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/CustomReportsOfXjjqzyy.java (.../CustomReportsOfXjjqzyy.java) (revision 25745) @@ -20,7 +20,6 @@ import com.forgon.tools.db.DatabaseUtil; import com.forgon.tools.hibernate.ObjectDao; import com.forgon.tools.string.StringTools; -import com.forgon.tools.util.SqlUtils; @Component(value = "customReportsOfXjjqzyy") public class CustomReportsOfXjjqzyy { @@ -49,20 +48,33 @@ if (StringUtils.isNotBlank(endDay)) { endDay += " 23:59:59"; } - if (StringUtils.isNotBlank(assemblingEndTime)) { - assemblingEndTime += " 23:59:59"; + String operationTimeSql = "";//装配时间 + String joinSql = "";//连接器械包实例表 + boolean assemblingStartTimeBool = StringUtils.isNotBlank(assemblingStartTime); + boolean assemblingEndTimeBool = StringUtils.isNotBlank(assemblingEndTime); + if(assemblingStartTimeBool || assemblingEndTimeBool){//装配日期有值,连接器械包实例表,无值查询所有外来申请单 + joinSql = String.format(" inner join %s ti on ti.foreignTousseApp_id = f.id ", TousseInstance.class.getSimpleName()); } - StringBuilder sqlBuilder = new StringBuilder(); - String sql = String - .format("select distinct i.id from %s f join %s i on f.id=i.id inner join %s ti on ti.foreignTousseApp_id = f.id where (i.applicationTime between %s and %s) and (ti.operationTime between %s and %s) ", + //拼接装配条件 + if(assemblingStartTimeBool && assemblingEndTimeBool){ + operationTimeSql = String.format("and (ti.operationTime between %s and %s) ", + dateQueryAdapter.dateAdapter(assemblingStartTime), + dateQueryAdapter.dateAdapter(assemblingEndTime)); + }else if(assemblingStartTimeBool && !assemblingEndTimeBool){ + operationTimeSql = String.format("and (ti.operationTime > %s) ", + dateQueryAdapter.dateAdapter(assemblingStartTime)); + }else if(!assemblingStartTimeBool && assemblingEndTimeBool){ + operationTimeSql = String.format("and (ti.operationTime < %s) ", + dateQueryAdapter.dateAdapter(assemblingEndTime)); + } + String sql = String.format("select f.id from %s f join %s i on f.id=i.id %s where (i.applicationTime between %s and %s ) ", ForeignTousseApplication.class.getSimpleName(), InvoicePlan.class.getSimpleName(), - TousseInstance.class.getSimpleName(), + joinSql, dateQueryAdapter.dateAdapter(startDay), - dateQueryAdapter.dateAdapter(endDay), - dateQueryAdapter.dateAdapter(assemblingStartTime), - dateQueryAdapter.dateAdapter(assemblingEndTime)); - sqlBuilder.append(sql); + dateQueryAdapter.dateAdapter(endDay)); + StringBuilder sqlBuilder = new StringBuilder(); + sqlBuilder.append(sql).append(operationTimeSql); if (StringUtils.isNotBlank(goodsName)) { sql = String.format(" and f.id=(select t.recyclingApplication_ID from %s t where t.recyclingApplication_ID=f.id and t.tousseName = '%s')",TousseItem.class.getSimpleName(),goodsName); sqlBuilder.append(sql); @@ -125,6 +137,23 @@ if(vo.getProcessType() == null){ vo.setProcessType(""); } + //外来器械包价格,重量,是否包含植入物 + String sqlForPriceWeight = String.format("select weight, price, includeImplant from %s where tousseType='外来器械包' and invoicePlanID = %s" , TousseDefinitionClassName, id); + priceWeightIncludeImplantRs = objectDao.executeSql(sqlForPriceWeight); + try { + if(priceWeightIncludeImplantRs.next()) { + Double weight = priceWeightIncludeImplantRs.getDouble("weight"); + Double price = priceWeightIncludeImplantRs.getDouble("price"); + int includeImplant = priceWeightIncludeImplantRs.getInt("includeImplant"); + vo.setWeight(weight); + vo.setDisinfectionCost(price); + vo.setIsImplant(includeImplant == 0? "是":"否"); + } + } catch (Exception e) { + e.printStackTrace(); + }finally { + DatabaseUtil.closeResultSetAndStatement(priceWeightIncludeImplantRs); + } // 拆包信息 String tousseItemVOSql = String .format("select t.operator, t.reviewer, t.operationTime, t.tousseName, count(*) count,(select sum(count) from %s mi inner join %s td on mi.tousse_id=td.id where tousse_id in (select min(id) from %s where invoicePlanID =%s)) recoveryCount from %s t where t.foreignTousseApp_id=%s group by t.tousseName,t.operator,t.reviewer,t.operationTime", @@ -173,28 +202,6 @@ vo.setTousseItems(tousseItems); list.add(vo); } - if(rsNum != 1){//有关联的申请单id - //外来器械包价格,重量,是否包含植入物 - String sqlForPriceWeight = String.format("select weight, price, includeImplant from %s where tousseType='外来器械包' %s" , TousseDefinitionClassName, SqlUtils.get_InSql_Extra("invoicePlanID", invoicePlanIds.toString())); - priceWeightIncludeImplantRs = objectDao.executeSql(sqlForPriceWeight); - try { - int priceWeightRsNum = 0; - while (priceWeightIncludeImplantRs.next()) { - Double weight = priceWeightIncludeImplantRs.getDouble("weight"); - Double price = priceWeightIncludeImplantRs.getDouble("price"); - int includeImplant = priceWeightIncludeImplantRs.getInt("includeImplant"); - ForeignTousseApplicationVO vo = list.get(priceWeightRsNum); - vo.setWeight(weight); - vo.setDisinfectionCost(price); - vo.setIsImplant(includeImplant == 0? "是":"否"); - priceWeightRsNum++; - } - } catch (Exception e) { - e.printStackTrace(); - }finally { - DatabaseUtil.closeResultSetAndStatement(priceWeightIncludeImplantRs); - } - } } catch (SQLException e) { e.printStackTrace(); } finally {