Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/util/ForeignTousseApplicationReportHelper.java =================================================================== diff -u -r36798 -r36806 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/util/ForeignTousseApplicationReportHelper.java (.../ForeignTousseApplicationReportHelper.java) (revision 36798) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/util/ForeignTousseApplicationReportHelper.java (.../ForeignTousseApplicationReportHelper.java) (revision 36806) @@ -153,8 +153,8 @@ queryDoctorAccountDepart = true; parametMap.put("queryDoctorAccountDepart", true); }else if("recyclingtime".equals(extendedColumnName.toLowerCase())){//二次回收时间 - queryExtendedColumnSQL += ",max(rr.recyclingTime) recyclingTime "; - queryExtendedColumnSQL2 += ",max(rr.recyclingTime) recyclingTime "; + queryExtendedColumnSQL += ",(select max(recyclingTime) from RecyclingRecord where recyclingApplication_id=f.id) recyclingTime "; + queryExtendedColumnSQL2 += ",(select max(recyclingTime) from RecyclingRecord where recyclingApplication_id=f.id) recyclingTime "; queryRecyclingTime = true; parametMap.put("queryRecyclingTime", true); } @@ -292,7 +292,7 @@ .format(" select * from (select tit.doctorName tiDoctorName %s , i.applicationtime,case when tit.invoiceSendTime2 is not null then tit.invoiceSendTime2 else tit.invoiceSendTime end invoiceSendTime,min(rr.recyclingTime) receiveTime,tit.tousseName,tit.price,f.id,ti.supplierName,i.applicant,i.remark,f.patient,f.surgery,f.hospitalNumber,i.depart,i.deliverStatus %s,f.doctor,f.processType,count(distinct tit.id) amount,f.bedNumber,tit.useRecord_id %s %s %s " + "from %s f join %s i on f.id=i.id join %s ti on ti.recyclingApplication_ID=i.id " + "join %s tit on tit.foreignTousseApp_id=f.id " - + "join TousseDefinition td on td.id = tit.tousseDefinition_id left join RecyclingRecord rr on rr.recyclingApplication_id=f.id " + + "join TousseDefinition td on td.id = tit.tousseDefinition_id left join RecyclingRecord rr on rr.recyclingApplication_id=f.id and rr.recyclingTimes is null " + " %s where (tit.id is null or td.parentID is null and ti.tousseDefinitionId=tit.tousseDefinition_id or ti.tousseDefinitionId=td.parentID) %s %s %s %s %s ", queryExtendedColumnSQL, customColumnName1Sql, @@ -369,7 +369,7 @@ TousseItem.class.getSimpleName() +" ti on ti.recyclingApplication_ID=i.id join "+ TousseDefinition.class.getSimpleName() - +" td on td.id = ti.tousseDefinitionId left join RecyclingRecord rr on rr.recyclingApplication_id=f.id " + +" td on td.id = ti.tousseDefinitionId left join RecyclingRecord rr on rr.recyclingApplication_id=f.id and rr.recyclingTimes is null " + joinMaterialInstanceSql + " where not exists (select id from "+ TousseInstance.class.getSimpleName()