diff --git a/src/main/java/com/docus/server/collect/collector/LisSystemCollector.java b/src/main/java/com/docus/server/collect/collector/LisSystemCollector.java index 2a8d33c..44c52a2 100644 --- a/src/main/java/com/docus/server/collect/collector/LisSystemCollector.java +++ b/src/main/java/com/docus/server/collect/collector/LisSystemCollector.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Objects; +import java.util.concurrent.TimeUnit; /** * 检验报告采集 @@ -44,6 +45,9 @@ public class LisSystemCollector { @Autowired private FileReportService fileReportService; + @Value("${docus.report.lis.incrDays:}") + private String incrDays; + /** * 采集检验报告的参数 * @@ -62,11 +66,44 @@ public class LisSystemCollector { LocalDateTime endLocalDateTime = Func.parseDateTime(disDate).plusDays(15L); String endDateTime = Func.formatDateTime(endLocalDateTime); // 普通的检验报告和 微生物检验报告 - String collectDataNormal = collectData(new Jzh(jzh), beginDateTime, endDateTime, 0); - String collectDataMtf = collectData(new Jzh(jzh), beginDateTime, endDateTime, 1); - List reportFileInfoDTOList = LisSystemCollectConverter.convert(collectDataNormal); - List reportFileInfoDtoList2 = LisSystemCollectConverter.convert(collectDataMtf); - reportFileInfoDTOList.addAll(reportFileInfoDtoList2); + + List reportFileInfoDTOList = new ArrayList<>(); + if (Func.isNotBlank(incrDays)) { + LocalDateTime qrBeginLocalDateTime = Func.parseDateTime(beginDateTime); + int limitDays = Integer.parseInt(incrDays); + while (true) { + LocalDateTime qrEndLocalDateTime = qrBeginLocalDateTime.plusDays(limitDays); + if (qrBeginLocalDateTime.isAfter(endLocalDateTime)) { + break; + } + boolean endFlag = false; + if (qrEndLocalDateTime.isAfter(endLocalDateTime)) { + qrEndLocalDateTime = endLocalDateTime; + endFlag = true; + } + String qrBeginDateTime = Func.formatDateTime(qrBeginLocalDateTime); + String qrEndDateTime = Func.formatDateTime(qrEndLocalDateTime); + String collectDataNormal = collectData(new Jzh(jzh), qrBeginDateTime, qrEndDateTime, 0); + String collectDataMtf = collectData(new Jzh(jzh), qrBeginDateTime, qrEndDateTime, 1); + List reportFileInfoDtoList1 = LisSystemCollectConverter.convert(collectDataNormal); + List reportFileInfoDtoList2 = LisSystemCollectConverter.convert(collectDataMtf); + reportFileInfoDTOList.addAll(reportFileInfoDtoList1); + reportFileInfoDTOList.addAll(reportFileInfoDtoList2); + if (endFlag) { + break; + } + qrBeginLocalDateTime = qrEndLocalDateTime; + } + } else { + String collectDataNormal = collectData(new Jzh(jzh), beginDateTime, endDateTime, 0); + String collectDataMtf = collectData(new Jzh(jzh), beginDateTime, endDateTime, 1); + List reportFileInfoDtoList1 = LisSystemCollectConverter.convert(collectDataNormal); + List reportFileInfoDtoList2 = LisSystemCollectConverter.convert(collectDataMtf); + reportFileInfoDTOList.addAll(reportFileInfoDtoList1); + reportFileInfoDTOList.addAll(reportFileInfoDtoList2); + } + + for (ReportFileInfoDTO reportFileInfoDTO : reportFileInfoDTOList) { if (!isBelongToPatient(reportFileInfoDTO, basic)) { continue; @@ -101,12 +138,44 @@ public class LisSystemCollector { LocalDateTime endLocalDateTime = Func.parseDateTime(disDateStr).plusDays(15L); endDateTime = Func.formatDateTime(endLocalDateTime); } + LocalDateTime endLocalDateTime = Func.parseDateTime(endDateTime); // 普通的检验报告和 微生物检验报告 - String collectDataNormal = collectData(new Jzh(jzh), beginDateTime, endDateTime, 0); - String collectDataMtf = collectData(new Jzh(jzh), beginDateTime, endDateTime, 1); - List reportFileInfoDTOList = LisSystemCollectConverter.convert(collectDataNormal); - List reportFileInfoDtoList2 = LisSystemCollectConverter.convert(collectDataMtf); - reportFileInfoDTOList.addAll(reportFileInfoDtoList2); + List reportFileInfoDTOList = new ArrayList<>(); + if (Func.isNotBlank(incrDays)) { + LocalDateTime qrBeginLocalDateTime = Func.parseDateTime(beginDateTime); + int limitDays = Integer.parseInt(incrDays); + while (true) { + LocalDateTime qrEndLocalDateTime = qrBeginLocalDateTime.plusDays(limitDays); + if (qrBeginLocalDateTime.isAfter(endLocalDateTime)) { + break; + } + boolean endFlag = false; + if (qrEndLocalDateTime.isAfter(endLocalDateTime)) { + qrEndLocalDateTime = endLocalDateTime; + endFlag = true; + } + String qrBeginDateTime = Func.formatDateTime(qrBeginLocalDateTime); + String qrEndDateTime = Func.formatDateTime(qrEndLocalDateTime); + String collectDataNormal = collectData(new Jzh(jzh), qrBeginDateTime, qrEndDateTime, 0); + String collectDataMtf = collectData(new Jzh(jzh), qrBeginDateTime, qrEndDateTime, 1); + List reportFileInfoDtoList1 = LisSystemCollectConverter.convert(collectDataNormal); + List reportFileInfoDtoList2 = LisSystemCollectConverter.convert(collectDataMtf); + reportFileInfoDTOList.addAll(reportFileInfoDtoList1); + reportFileInfoDTOList.addAll(reportFileInfoDtoList2); + if (endFlag) { + break; + } + qrBeginLocalDateTime = qrEndLocalDateTime; + } + } else { + String collectDataNormal = collectData(new Jzh(jzh), beginDateTime, endDateTime, 0); + String collectDataMtf = collectData(new Jzh(jzh), beginDateTime, endDateTime, 1); + List reportFileInfoDtoList1 = LisSystemCollectConverter.convert(collectDataNormal); + List reportFileInfoDtoList2 = LisSystemCollectConverter.convert(collectDataMtf); + reportFileInfoDTOList.addAll(reportFileInfoDtoList1); + reportFileInfoDTOList.addAll(reportFileInfoDtoList2); + } + for (ReportFileInfoDTO reportFileInfoDTO : reportFileInfoDTOList) { reportFileInfoDTO.setPatientId(tSeal.getPatientId()); reportFileInfoDTO.setAssortId(assortId); @@ -282,54 +351,36 @@ public class LisSystemCollector { } public static void main(String[] args) { - String param1 = "" + - " " + - " 1" + - " WZHBAGL" + - " WZHBAGL_1127" + - " BS03102" + - " BS03102S51001" + - " GZ" + - " " + - " " + - " BS03102" + - " BS03102S51001" + - " S51" + - " S00" + - " " + "2025-03-14 00:50:29" + "" + - " " + - " " + - " 0" + - " 500" + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + "17762804477" + "" + - " " + - " " + - " " + 0 + "" + - " " + "2025-01-21 12:10:54" + "" + - " " + "2025-03-14 10:00:00" + "" + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - " " + - ""; - System.out.println(param1); + + + String beginDateTime = "2025-02-06 19:48:52"; + LocalDateTime endLocalDateTime = Func.parseDateTime("2025-04-04 12:00:00").plusDays(15L); + String endDateTime = Func.formatDateTime(endLocalDateTime); + // 普通的检验报告和 微生物检验报告 + LocalDateTime qrBeginLocalDateTime = Func.parseDateTime(beginDateTime); + int limitDays = 10; + List reportFileInfoDTOList = new ArrayList<>(); + while (true) { + LocalDateTime qrEndLocalDateTime = qrBeginLocalDateTime.plusDays(limitDays); + if (qrBeginLocalDateTime.isAfter(endLocalDateTime)) { + break; + } + boolean endFlag = false; + if (qrEndLocalDateTime.isAfter(endLocalDateTime)) { + qrEndLocalDateTime = endLocalDateTime; + endFlag = true; + } + System.out.println(Func.formatDateTime(qrBeginLocalDateTime) + ">>>>>>>" + Func.formatDateTime(qrEndLocalDateTime)); + if (endFlag) { + break; + } + qrBeginLocalDateTime = qrEndLocalDateTime; + try { + TimeUnit.MILLISECONDS.sleep(500); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } } public static class LisSystemCollectConverter { diff --git a/src/main/resources/bootstrap.yml b/src/main/resources/bootstrap.yml index 5ce9c2c..0863fae 100644 --- a/src/main/resources/bootstrap.yml +++ b/src/main/resources/bootstrap.yml @@ -56,6 +56,7 @@ docus: url: http://192.168.198.101:7827/Ewell_WS_S51?wsdl method: OperationA namespaceUri: + incrDays: 10 mybatis-plus: