From be33aca5689ced8e88138c2460296e143c382a56 Mon Sep 17 00:00:00 2001 From: wyb <1977763549@qq.com> Date: Thu, 24 Jul 2025 15:38:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20lis=E4=B8=8D=E5=90=88=E5=B9=B6=E4=B8=BA?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mzzyy/job/MzZyyReportCollectJob.java | 55 ++++++++++++------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/docus/server/mzzyy/job/MzZyyReportCollectJob.java b/src/main/java/com/docus/server/mzzyy/job/MzZyyReportCollectJob.java index eef2e59..b5e7cbc 100644 --- a/src/main/java/com/docus/server/mzzyy/job/MzZyyReportCollectJob.java +++ b/src/main/java/com/docus/server/mzzyy/job/MzZyyReportCollectJob.java @@ -42,8 +42,10 @@ import java.util.ArrayList; import java.util.Base64; import java.util.Collections; import java.util.Date; +import java.util.HashMap; import java.util.List; import java.util.Locale; +import java.util.Map; import java.util.Objects; /** @@ -82,7 +84,6 @@ public class MzZyyReportCollectJob { return; } - final String fileTitle = "LIS检查报告单"; ReportDownTwoDto downTwoDto = commonResult.getData(); ReportTaskTwoDto task = downTwoDto.getTasks().get(0); @@ -102,9 +103,13 @@ public class MzZyyReportCollectJob { String fileDirPath = TableJsonRead.currentPath(StaticResourceMapping.STATIC_RESOURCE_PREFIX + File.separator + StaticResourceMapping.LIS) + File.separator + formatDate + File.separator + patientId; - List httpUrls = new ArrayList<>(); + List fileKeys = new ArrayList<>(); + Map> httpUrlsMap = new HashMap<>(); + Map testFormPdfsMap = new HashMap<>(); int i = 1; + int count = 0; for (MzZyyTestDto testFormPdf : testFormPdfs) { + ArrayList urls = new ArrayList<>(); try { MzZyyLisType lisType = MzZyyLisType.getLisType(testFormPdf.getType()); List base64Files = mzZyyLisService.exportTestFormPdf(lisType, testFormPdf.getMachineId(), testFormPdf.getSampleId(), testFormPdf.getTestDate()); @@ -114,9 +119,14 @@ public class MzZyyReportCollectJob { String base64 = base64File.getBase64(); byte[] decode = Base64.getDecoder().decode(base64); FileUtil.writeBytes(decode, filePath); - httpUrls.add(httpUrl); + urls.add(httpUrl); i++; } + String fileKey = testFormPdf.getMachineId() + "|" + testFormPdf.getSampleId() + "|" + testFormPdf.getTestDate(); + fileKeys.add(fileKey); + httpUrlsMap.put(fileKey, urls); + testFormPdfsMap.put(fileKey, testFormPdf); + count += urls.size(); } catch (Exception ex) { log.error("梅州中医院Lis采集,住院号:" + inpatientNo + ",住院流水号:" + jzh + ",type=" + testFormPdf.getType() + ",machineId=" + testFormPdf.getMachineId() + ",sampleId=" + testFormPdf.getSampleId() + ",testDate=" + testFormPdf.getTestDate() @@ -124,10 +134,9 @@ public class MzZyyReportCollectJob { return; } } - log.info("住院号:{},住院流水号:{},采集了 {} 份文件。", inpatientNo, jzh, httpUrls.size()); + log.info("住院号:{},住院流水号:{},采集了 {} 份文件。", inpatientNo, jzh, count); - - String urls = String.join("|", httpUrls); + tBasicMapper.invalidFileBySource(patientId, collectorId); ReportDownPatientDto patient = new ReportDownPatientDto(); patient.setPatientid(patientId); @@ -137,20 +146,26 @@ public class MzZyyReportCollectJob { reportDownDto.setIp("java-lis-job"); reportDownDto.setPatient(patient); - ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto(); - reportDownScanFileDto.setFiletype(1); - reportDownScanFileDto.setDownurl(urls); - reportDownScanFileDto.setFiletitle(fileTitle); - reportDownScanFileDto.setSerialnum("lis_" + patientId); - reportDownScanFileDto.setFilesource(1); - reportDownScanFileDto.setFilestoragetype(1); - reportDownScanFileDto.setTaskid(task.getTaskId()); - reportDownScanFileDto.setSort(0); - List scanFiles = Collections.singletonList(reportDownScanFileDto); - reportDownDto.setAssortid(assortId); - reportDownDto.setScanfiles(scanFiles); - tBasicMapper.invalidFileBySource(patientId, collectorId); - downPlatformService.report(reportDownDto); + + for (String fileKey : fileKeys) { + MzZyyTestDto testDto = testFormPdfsMap.get(fileKey); + List httpUrls = httpUrlsMap.get(fileKey); + String urls = String.join("|", httpUrls); + String fileTitle = testDto.getHisItemNameList(); + ReportDownScanFileDto reportDownScanFileDto = new ReportDownScanFileDto(); + reportDownScanFileDto.setFiletype(1); + reportDownScanFileDto.setDownurl(urls); + reportDownScanFileDto.setFiletitle(fileTitle); + reportDownScanFileDto.setSerialnum(fileKey); + reportDownScanFileDto.setFilesource(1); + reportDownScanFileDto.setFilestoragetype(1); + reportDownScanFileDto.setTaskid(task.getTaskId()); + reportDownScanFileDto.setSort(0); + List scanFiles = Collections.singletonList(reportDownScanFileDto); + reportDownDto.setAssortid(assortId); + reportDownDto.setScanfiles(scanFiles); + downPlatformService.report(reportDownDto); + } } @XxlJob("MzZyyShouMaCollectJob")