fix: lis不合并为一个文件

master
wyb 3 days ago
parent 704efdeb70
commit be33aca568

@ -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<String> httpUrls = new ArrayList<>();
List<String> fileKeys = new ArrayList<>();
Map<String, List<String>> httpUrlsMap = new HashMap<>();
Map<String, MzZyyTestDto> testFormPdfsMap = new HashMap<>();
int i = 1;
int count = 0;
for (MzZyyTestDto testFormPdf : testFormPdfs) {
ArrayList<String> urls = new ArrayList<>();
try {
MzZyyLisType lisType = MzZyyLisType.getLisType(testFormPdf.getType());
List<MzZyyLisExportDto> 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<ReportDownScanFileDto> 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<String> 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<ReportDownScanFileDto> scanFiles = Collections.singletonList(reportDownScanFileDto);
reportDownDto.setAssortid(assortId);
reportDownDto.setScanfiles(scanFiles);
downPlatformService.report(reportDownDto);
}
}
@XxlJob("MzZyyShouMaCollectJob")

Loading…
Cancel
Save