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.Base64;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
/** /**
@ -82,7 +84,6 @@ public class MzZyyReportCollectJob {
return; return;
} }
final String fileTitle = "LIS检查报告单";
ReportDownTwoDto downTwoDto = commonResult.getData(); ReportDownTwoDto downTwoDto = commonResult.getData();
ReportTaskTwoDto task = downTwoDto.getTasks().get(0); 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) String fileDirPath = TableJsonRead.currentPath(StaticResourceMapping.STATIC_RESOURCE_PREFIX + File.separator + StaticResourceMapping.LIS)
+ File.separator + formatDate + File.separator + formatDate
+ File.separator + patientId; + 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 i = 1;
int count = 0;
for (MzZyyTestDto testFormPdf : testFormPdfs) { for (MzZyyTestDto testFormPdf : testFormPdfs) {
ArrayList<String> urls = new ArrayList<>();
try { try {
MzZyyLisType lisType = MzZyyLisType.getLisType(testFormPdf.getType()); MzZyyLisType lisType = MzZyyLisType.getLisType(testFormPdf.getType());
List<MzZyyLisExportDto> base64Files = mzZyyLisService.exportTestFormPdf(lisType, testFormPdf.getMachineId(), testFormPdf.getSampleId(), testFormPdf.getTestDate()); List<MzZyyLisExportDto> base64Files = mzZyyLisService.exportTestFormPdf(lisType, testFormPdf.getMachineId(), testFormPdf.getSampleId(), testFormPdf.getTestDate());
@ -114,9 +119,14 @@ public class MzZyyReportCollectJob {
String base64 = base64File.getBase64(); String base64 = base64File.getBase64();
byte[] decode = Base64.getDecoder().decode(base64); byte[] decode = Base64.getDecoder().decode(base64);
FileUtil.writeBytes(decode, filePath); FileUtil.writeBytes(decode, filePath);
httpUrls.add(httpUrl); urls.add(httpUrl);
i++; 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) { } catch (Exception ex) {
log.error("梅州中医院Lis采集住院号" + inpatientNo + ",住院流水号:" + jzh + "type=" + testFormPdf.getType() log.error("梅州中医院Lis采集住院号" + inpatientNo + ",住院流水号:" + jzh + "type=" + testFormPdf.getType()
+ "machineId=" + testFormPdf.getMachineId() + ",sampleId=" + testFormPdf.getSampleId() + ",testDate=" + testFormPdf.getTestDate() + "machineId=" + testFormPdf.getMachineId() + ",sampleId=" + testFormPdf.getSampleId() + ",testDate=" + testFormPdf.getTestDate()
@ -124,10 +134,9 @@ public class MzZyyReportCollectJob {
return; return;
} }
} }
log.info("住院号:{},住院流水号:{},采集了 {} 份文件。", inpatientNo, jzh, httpUrls.size()); log.info("住院号:{},住院流水号:{},采集了 {} 份文件。", inpatientNo, jzh, count);
tBasicMapper.invalidFileBySource(patientId, collectorId);
String urls = String.join("|", httpUrls);
ReportDownPatientDto patient = new ReportDownPatientDto(); ReportDownPatientDto patient = new ReportDownPatientDto();
patient.setPatientid(patientId); patient.setPatientid(patientId);
@ -137,11 +146,17 @@ public class MzZyyReportCollectJob {
reportDownDto.setIp("java-lis-job"); reportDownDto.setIp("java-lis-job");
reportDownDto.setPatient(patient); reportDownDto.setPatient(patient);
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 reportDownScanFileDto = new ReportDownScanFileDto();
reportDownScanFileDto.setFiletype(1); reportDownScanFileDto.setFiletype(1);
reportDownScanFileDto.setDownurl(urls); reportDownScanFileDto.setDownurl(urls);
reportDownScanFileDto.setFiletitle(fileTitle); reportDownScanFileDto.setFiletitle(fileTitle);
reportDownScanFileDto.setSerialnum("lis_" + patientId); reportDownScanFileDto.setSerialnum(fileKey);
reportDownScanFileDto.setFilesource(1); reportDownScanFileDto.setFilesource(1);
reportDownScanFileDto.setFilestoragetype(1); reportDownScanFileDto.setFilestoragetype(1);
reportDownScanFileDto.setTaskid(task.getTaskId()); reportDownScanFileDto.setTaskid(task.getTaskId());
@ -149,9 +164,9 @@ public class MzZyyReportCollectJob {
List<ReportDownScanFileDto> scanFiles = Collections.singletonList(reportDownScanFileDto); List<ReportDownScanFileDto> scanFiles = Collections.singletonList(reportDownScanFileDto);
reportDownDto.setAssortid(assortId); reportDownDto.setAssortid(assortId);
reportDownDto.setScanfiles(scanFiles); reportDownDto.setScanfiles(scanFiles);
tBasicMapper.invalidFileBySource(patientId, collectorId);
downPlatformService.report(reportDownDto); downPlatformService.report(reportDownDto);
} }
}
@XxlJob("MzZyyShouMaCollectJob") @XxlJob("MzZyyShouMaCollectJob")
public void shouMaCollectJob() { public void shouMaCollectJob() {

Loading…
Cancel
Save