From a382fedba62fa46b3d73c2e988fa6908412a99c9 Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期四, 27 三月 2025 14:44:47 +0800 Subject: [PATCH] bug修改 --- medicalWaste-system/src/main/java/com/sinata/system/service/biz/StaticsService.java | 71 +++++++++++++++++------------------ 1 files changed, 35 insertions(+), 36 deletions(-) diff --git a/medicalWaste-system/src/main/java/com/sinata/system/service/biz/StaticsService.java b/medicalWaste-system/src/main/java/com/sinata/system/service/biz/StaticsService.java index 402fece..9b75a92 100644 --- a/medicalWaste-system/src/main/java/com/sinata/system/service/biz/StaticsService.java +++ b/medicalWaste-system/src/main/java/com/sinata/system/service/biz/StaticsService.java @@ -6,6 +6,7 @@ import com.sinata.common.core.domain.entity.SysDictData; import com.sinata.common.utils.CollUtils; import com.sinata.common.utils.DateUtils; +import com.sinata.system.config.AutoColumnWidthStrategy; import com.sinata.system.domain.MwCollectRecord; import com.sinata.system.domain.MwWarningRecord; import com.sinata.system.domain.SysDepartment; @@ -19,8 +20,6 @@ import com.sinata.system.domain.vo.MwMedicalWasteBoxVO; import com.sinata.system.domain.vo.SysDictDataVO; import com.sinata.system.domain.vo.TransformVO; -import com.sinata.system.enums.DepartmentEnum; -import com.sinata.system.enums.MedicalWasteStatusEnum; import com.sinata.system.service.ISysDictDataService; import com.sinata.system.service.MwCheckoutRecordService; import com.sinata.system.service.MwCollectRecordService; @@ -82,8 +81,8 @@ } vo.setLegend(wasteTypeList.stream().map(SysDictDataVO::getDictLabel).collect(Collectors.toList())); vo.getLegend().add("小计"); - List<MwCollectRecord> collectRecordList = mwCollectRecordService.lambdaQuery().eq(query.getReportType().equals(1), MwCollectRecord::getStatus, MedicalWasteStatusEnum.TEMPORARILY_STORED.getCode()) - .ne(query.getReportType().equals(2), MwCollectRecord::getStatus, MedicalWasteStatusEnum.TEMPORARILY_STORED.getCode()) + List<MwCollectRecord> collectRecordList = mwCollectRecordService.lambdaQuery()/*.eq(query.getReportType().equals(1), MwCollectRecord::getStatus, MedicalWasteStatusEnum.TEMPORARILY_STORED.getCode()) + .ne(query.getReportType().equals(2), MwCollectRecord::getStatus, MedicalWasteStatusEnum.TEMPORARILY_STORED.getCode())*/ .eq(MwCollectRecord::getDepartmentId, query.getDepartmentId()) .between(query.getReportType().equals(1), MwCollectRecord::getCollectTime, query.getStartTime(), query.getEndTime()) .between(query.getReportType().equals(2), MwCollectRecord::getCheckoutTime, query.getStartTime(), query.getEndTime()) @@ -166,6 +165,7 @@ FastExcel.write(response.getOutputStream()) .head(head) .autoCloseStream(Boolean.TRUE) + .registerWriteHandler(new AutoColumnWidthStrategy()) .sheet("医院报表") .doWrite(getHospitalReportStaticsData(query)); } @@ -225,40 +225,36 @@ vo.setDepartmentName(department.getDepartmentName()); } SysDepartment region = sysDepartmentService.getDepartmentByParentId(department.getParentId()); - List<SysDepartment> hospitalList = sysDepartmentService.lambdaQuery().likeRight(SysDepartment::getTreeCode, region.getTreeCode()).eq(SysDepartment::getOrgType, DepartmentEnum.MEDICAL_INSTITUTION.getCode()).list(); - if (CollUtils.isNotEmpty(hospitalList)) { - List<TransformVO> checkoutRecordVOList = mwCheckoutRecordService.getCheckoutRecordList(query, region.getTreeCode()); - if (CollUtils.isNotEmpty(checkoutRecordVOList)) { - //查询医废类型 - List<SysDictData> wasteTypeList = sysDictDataService.lambdaQuery().in(SysDictData::getDictCode, query.getWasteTypeCodeList()).orderByDesc(SysDictData::getDictCode).list(); - if (CollUtils.isNotEmpty(wasteTypeList)) { - vo.setLegend(wasteTypeList.stream().map(SysDictData::getDictLabel).collect(Collectors.toList())); - vo.getLegend().add("小计"); - List<DepartmentReportItemVO> list = new ArrayList<>(); - for (TransformVO transformVO : checkoutRecordVOList) { - BigDecimal totalCount = BigDecimal.ZERO; - BigDecimal totalWeight = BigDecimal.ZERO; - DepartmentReportItemVO departmentReportItemVO = new DepartmentReportItemVO(); - departmentReportItemVO.setName(transformVO.getHospitalName()); - departmentReportItemVO.setData(new ArrayList<>()); - departmentReportItemVO.setDriverName(transformVO.getDriverName()); - departmentReportItemVO.setHospitalSignature(ImageToBase64.convertImageToBase64(transformVO.getHospitalSignature())); - departmentReportItemVO.setHandoverTime(transformVO.getCheckoutTime()); - for (SysDictData sysDictData : wasteTypeList) { - BigDecimal count = BigDecimal.valueOf(transformVO.getCollectRecordList().stream().filter(item -> item.getWasteType().equals(sysDictData.getDictCode())).count()); - BigDecimal weight = transformVO.getCollectRecordList().stream().filter(item -> item.getWasteType().equals(sysDictData.getDictCode())).map(MwMedicalWasteBoxVO::getTotalWeight).reduce(BigDecimal.ZERO, BigDecimal::add); - departmentReportItemVO.getData().add(count); - departmentReportItemVO.getData().add(weight); - totalCount = totalCount.add(count); - totalWeight = totalWeight.add(weight); - } - departmentReportItemVO.getData().add(totalCount); - departmentReportItemVO.getData().add(totalWeight); - list.add(departmentReportItemVO); - } - vo.setList(list); + //List<SysDepartment> hospitalList = sysDepartmentService.lambdaQuery().likeRight(SysDepartment::getTreeCode, region.getTreeCode()).eq(SysDepartment::getOrgType, DepartmentEnum.MEDICAL_INSTITUTION.getCode()).list(); + List<TransformVO> checkoutRecordVOList = mwCheckoutRecordService.getCheckoutRecordList(query, region.getTreeCode()); + //查询医废类型 + List<SysDictData> wasteTypeList = sysDictDataService.lambdaQuery().in(SysDictData::getDictCode, query.getWasteTypeCodeList()).orderByDesc(SysDictData::getDictCode).list(); + if (CollUtils.isNotEmpty(wasteTypeList)) { + vo.setLegend(wasteTypeList.stream().map(SysDictData::getDictLabel).collect(Collectors.toList())); + vo.getLegend().add("小计"); + List<DepartmentReportItemVO> list = new ArrayList<>(); + for (TransformVO transformVO : checkoutRecordVOList) { + BigDecimal totalCount = BigDecimal.ZERO; + BigDecimal totalWeight = BigDecimal.ZERO; + DepartmentReportItemVO departmentReportItemVO = new DepartmentReportItemVO(); + departmentReportItemVO.setName(transformVO.getHospitalName()); + departmentReportItemVO.setData(new ArrayList<>()); + departmentReportItemVO.setDriverName(transformVO.getDriverName()); + departmentReportItemVO.setHospitalSignature(ImageToBase64.convertImageToBase64(transformVO.getHospitalSignature())); + departmentReportItemVO.setHandoverTime(transformVO.getCheckoutTime()); + for (SysDictData sysDictData : wasteTypeList) { + BigDecimal count = BigDecimal.valueOf(transformVO.getCollectRecordList().stream().filter(item -> item.getWasteType().equals(sysDictData.getDictCode())).count()); + BigDecimal weight = transformVO.getCollectRecordList().stream().filter(item -> item.getWasteType().equals(sysDictData.getDictCode())).map(MwMedicalWasteBoxVO::getTotalWeight).reduce(BigDecimal.ZERO, BigDecimal::add); + departmentReportItemVO.getData().add(count); + departmentReportItemVO.getData().add(weight); + totalCount = totalCount.add(count); + totalWeight = totalWeight.add(weight); } + departmentReportItemVO.getData().add(totalCount); + departmentReportItemVO.getData().add(totalWeight); + list.add(departmentReportItemVO); } + vo.setList(list); } return vo; } @@ -276,6 +272,7 @@ FastExcel.write(response.getOutputStream()) .head(head) .autoCloseStream(Boolean.TRUE) + .registerWriteHandler(new AutoColumnWidthStrategy()) .sheet("转运联单") .doWrite(getTransformReportStaticsData(query)); } @@ -409,6 +406,7 @@ FastExcel.write(response.getOutputStream()) .head(head) .autoCloseStream(Boolean.TRUE) + .registerWriteHandler(new AutoColumnWidthStrategy()) .sheet("处置报表") .doWrite(getDisposalReportStaticsData(query)); } @@ -533,6 +531,7 @@ FastExcel.write(response.getOutputStream()) .head(head) .autoCloseStream(Boolean.TRUE) + .registerWriteHandler(new AutoColumnWidthStrategy()) .sheet("监管报表") .doWrite(getRegulationReportStaticsData(query)); } -- Gitblit v1.7.1