Преглед изворни кода

[task-6940] 试剂耗材出入库对接

huangws пре 1 недеља
родитељ
комит
3678fff035
20 измењених фајлова са 473 додато и 1640 уклоњено
  1. 15 2
      GetDataByRESTful/pom.xml
  2. 27 0
      GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/DataSyncScheduler.java
  3. 5 12
      GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/GetDataByRESTfulApplication.java
  4. 139 0
      GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/HandleData.java
  5. 0 33
      GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/controller/IBPSEnvirMonitorController.java
  6. 0 168
      GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/controller/IBPSLISController.java
  7. 0 72
      GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/controller/IBPSQualityIndicatorController.java
  8. 4 16
      GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/IBPSService.java
  9. 31 12
      GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/impl/ApiClientServiceImpl.java
  10. 0 405
      GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/impl/BasicMethod.java
  11. 194 57
      GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/impl/IBPSServiceImpl.java
  12. 0 96
      GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/impl/LISProcess/CriticalReport.java
  13. 0 99
      GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/impl/LISProcess/IncorrectLISReport.java
  14. 0 102
      GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/impl/LISProcess/OvertimeReport.java
  15. 0 101
      GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/impl/LISProcess/PostiveReport.java
  16. 0 179
      GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/impl/LISProcess/QCMonthReport.java
  17. 0 114
      GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/impl/LISProcess/RerunSampleRecord.java
  18. 0 140
      GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/impl/QualityIndicator/QualityIndicator.java
  19. 8 32
      GetDataByRESTful/src/main/resources/application.properties
  20. 50 0
      GetDataByRESTful/src/main/resources/logback-spring.xml

+ 15 - 2
GetDataByRESTful/pom.xml

@@ -58,13 +58,18 @@
                 <type>pom</type>
                 <scope>import</scope>
                 <exclusions>
-                    <!-- 排除冲突的SLF4J绑定 -->
                     <exclusion>
                         <groupId>org.slf4j</groupId>
                         <artifactId>slf4j-log4j12</artifactId>
                     </exclusion>
                 </exclusions>
             </dependency>
+            <dependency>
+                <groupId>org.projectlombok</groupId>
+                <artifactId>lombok</artifactId>
+                <version>1.18.24</version>
+                <scope>provided</scope>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 
@@ -86,7 +91,7 @@
                 <version>${spring-boot.version}</version>
                 <configuration>
                     <mainClass>com.jyxt.getdatabyrestful.GetDataByRESTfulApplication</mainClass>
-                    <skip>true</skip>
+
                 </configuration>
                 <executions>
                     <execution>
@@ -97,6 +102,14 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <version>2.22.2</version>
+            <configuration>
+                <skipTests>true</skipTests>
+            </configuration>
+            </plugin>
         </plugins>
     </build>
 

+ 27 - 0
GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/DataSyncScheduler.java

@@ -0,0 +1,27 @@
+package com.jyxt.getdatabyrestful;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+@Component
+public class DataSyncScheduler {
+    @Autowired
+    private HandleData handleData;
+
+    private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(DataSyncScheduler.class);
+
+    @Scheduled(fixedDelayString = "#{${loopMin}}",
+            initialDelayString = "#{${loopMin}}")
+    public void scheduledStart() {
+        log.info(">>> 定时任务触发,开始执行数据同步");
+        try {
+            handleData.start();
+            log.info("<<< 本次数据同步执行完毕");
+        } catch (Exception e) {
+            log.error("!!! 数据同步执行异常", e);
+        }
+    }
+}
+

+ 5 - 12
GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/GetDataByRESTfulApplication.java

@@ -4,30 +4,23 @@ import com.jyxt.getdatabyrestful.service.IBPSService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.CommandLineRunner;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.scheduling.annotation.EnableScheduling;
 
 import java.util.List;
 
 @SpringBootApplication
-public class GetDataByRESTfulApplication implements CommandLineRunner {
+@EnableScheduling
+public class GetDataByRESTfulApplication {
 
     private static final Logger log = LoggerFactory.getLogger(GetDataByRESTfulApplication.class);
 
-
     public static void main(String[] args) {
         SpringApplication.run(GetDataByRESTfulApplication.class, args);
+        log.info("<-------------应用启动完成,定时任务已就绪------------->");
     }
-
-    @Autowired
-    private ConfigurableApplicationContext context;
-
-    @Override
-    public void run(String... args) throws Exception{
-        log.info("<-------------start...------------->");
-
-    }
-
 }

+ 139 - 0
GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/HandleData.java

@@ -0,0 +1,139 @@
+package com.jyxt.getdatabyrestful;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.jyxt.getdatabyrestful.service.ApiClientService;
+import com.jyxt.getdatabyrestful.service.IBPSService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+@Component
+public class HandleData {
+
+    private static final Logger log = LoggerFactory.getLogger(GetDataByRESTfulApplication.class);
+
+    @Autowired
+    private IBPSService iBPSservice;
+
+    @Autowired
+    private ApiClientService apiClientService;
+
+    @Autowired
+    private ObjectMapper objectMapper;
+
+    @Value("${reagentInPath}")
+    private String reagentInPath;
+
+    @Value("${reagentOutPath}")
+    private String reagentOutPath;
+
+    @Value("${testMode}")
+    private String testMode;
+
+    public HandleData(IBPSService ibpsService) {
+        this.iBPSservice = ibpsService;
+    }
+
+    public void start() throws JsonProcessingException {
+        // ========== 测试模式 ==========
+        if ("true".equals(testMode)) {
+            // 测试入库 - 单条
+            String jsonInTmp = "{\"parent\":{\"cdispatcherid\":\"0201\",\"cbiztype\":\"c001\",\"pk_corp\":\"010501\",\"cdptid\":\"公司\",\"vbillcode\":\"O-202609100001\",\"dbilldate\":\"2026-09-10\",\"pk_calbody\":\"010501\",\"cwarehouseid\":\"2F常温库房\",\"coperatorid\":\"18981814241\",\"cproviderid\":\"测试供应商\",\"vnote\":\"\",\"cbizName\":\"测试业务员\",\"mainID\":\"1547546244182704128\"},\"childrens\":[{\"cinventoryid\":\"10010011117\",\"ninnum\":20.0,\"nprice\":150.0,\"nictaxrate\":0.1,\"ntaxprice\":165.0,\"ntaxmny\":3300.0,\"nsalemny\":3000.0,\"vbatchcode\":\"256455\",\"scrq\":\"2026-09-10\",\"dvalidate\":\"2026-10-31\"}]}";
+            sendSingleTest(jsonInTmp, reagentInPath, "测试入库");
+
+            // 测试出库 - 单条
+            String jsonOutTmp = "{\"parent\":{\"pk_corp\":\"010501\",\"cdptid\":\"公司\",\"vbillcode\":\"LY-202609100008\",\"dbilldate\":\"2026-09-10\",\"pk_calbody\":\"010501\",\"cwarehouseid\":\"2F常温库房\",\"coperatorid\":\"18981814241\",\"vnote\":\"\",\"cbizName\":\"测试业务员\",\"cdispatcherid\":\"0101\",\"mainID\":\"1547576767814828032\"},\"childrens\":[{\"cinventoryid\":\"10010011117\",\"cprojectid\":\"\",\"noutnum\":80.0,\"vnotebody\":\"\",\"vbatchcode\":\"20260910\",\"scrq\":\"\",\"dvalidate\":\"\"},{\"cinventoryid\":\"10010011117\",\"cprojectid\":\"\",\"noutnum\":5.0,\"vnotebody\":\"\",\"vbatchcode\":\"256455\",\"scrq\":\"\",\"dvalidate\":\"\"}]}";
+            sendSingleTest(jsonOutTmp, reagentOutPath, "测试出库");
+        } else{
+            // ========== 1. 入库 - 逐条推送 ==========
+            List<Map<String, Object>> reagentInData = iBPSservice.getReagentInData();
+            if (reagentInData != null && !reagentInData.isEmpty()) {
+                log.info("待推送入库单据共 {} 条", reagentInData.size());
+                for (Map<String, Object> singleBill : reagentInData) {
+                    processSingleBill(singleBill, reagentInPath, "t_sjhxhclrkysdjb", "入库");
+                }
+            }
+            // ========== 2. 出库 - 逐条推送 ==========
+            List<Map<String, Object>> reagentOutData = iBPSservice.getReagentOutData();
+            if (reagentOutData != null && !reagentOutData.isEmpty()) {
+                log.info("待推送出库单据共 {} 条", reagentOutData.size());
+                for (Map<String, Object> singleBill : reagentOutData) {
+                    processSingleBill(singleBill, reagentOutPath, "t_sjhcly", "出库");
+                }
+            }
+        }
+    }
+
+    /**
+     * 处理单条单据的推送与标记更新
+     */
+    private void processSingleBill(Map<String, Object> singleBill, String path, String tableName, String bizType) {
+        try {
+            String json = objectMapper.writeValueAsString(singleBill);
+
+            @SuppressWarnings("unchecked")
+            Map<String, Object> parent = (Map<String, Object>) singleBill.get("parent");
+            Object mainID = parent != null ? parent.get("mainID") : null;
+
+            log.info("准备推送{}数据, mainID={}", bizType, mainID);
+            log.info("推送的数据: {}", json);
+            String response = apiClientService.sendPost(path, json);
+
+            if (response == null || response.isEmpty()) {
+                log.error("{}接口返回为空, mainID={}", bizType, mainID);
+                return;
+            }
+
+            Map<String, Object> respMap = objectMapper.readValue(response, Map.class);
+            Object codeObj = respMap.get("code");
+            int code = codeObj instanceof Number
+                    ? ((Number) codeObj).intValue()
+                    : Integer.parseInt(codeObj.toString());
+
+            if (code == 0) {
+                log.info("{}数据推送成功, mainID={}", bizType, mainID);
+                // 成功一条更新一条标记
+                if (mainID != null) {
+                    iBPSservice.updateFlag(Collections.singletonList(mainID), tableName, "1");
+                    log.info("已更新{}单据发送标记, mainID={}", bizType, mainID);
+                }
+            } else {
+                //失败更新状态,不反复重推
+                iBPSservice.updateFlag(Collections.singletonList(mainID), tableName, "0");
+                String message = String.valueOf(respMap.get("message"));
+                log.warn("{}数据推送失败, mainID={}, code={}, message={}", bizType, mainID, code, message);
+            }
+        } catch (Exception e) {
+            @SuppressWarnings("unchecked")
+            Map<String, Object> parent = (Map<String, Object>) singleBill.get("parent");
+            Object mainID = parent != null ? parent.get("mainID") : null;
+            log.error("{}数据处理异常, mainID={}", bizType, mainID, e);
+        }
+    }
+
+    /**
+     * 测试模式下的单条发送
+     */
+    private void sendSingleTest(String jsonTmp, String path, String bizDesc) {
+        try {
+            log.info("{}准备推送数据: {}", bizDesc, jsonTmp);
+            String response = apiClientService.sendPost(path, jsonTmp);
+            if (response == null || response.isEmpty()) {
+                log.error("{}接口返回为空", bizDesc);
+                return;
+            }
+            log.info("{}推送结束返回: {}", bizDesc, response);
+        } catch (Exception e) {
+            log.error("{}推送异常", bizDesc, e);
+        }
+    }
+}

+ 0 - 33
GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/controller/IBPSEnvirMonitorController.java

@@ -1,33 +0,0 @@
-package com.jyxt.getdatabyrestful.controller;
-
-import com.jyxt.getdatabyrestful.service.IBPSService;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-@RequestMapping("/EnvirMonitor") // 基础路径
-@Tag(name = "金源信通设施环境管理模块标准接口", description = "")
-@ConditionalOnProperty(
-        name = "interface.EnvirMonitor",
-        havingValue = "1",
-        matchIfMissing = false // 若配置不存在则禁用
-)
-public class IBPSEnvirMonitorController {
-    @Autowired
-    IBPSService ibpsService;
-
-    // 示例:GET接口
-    @GetMapping("/test")
-    @Operation(summary = "示例接口", description = "这是一个示例GET接口,点击右侧'try it out'测试接口能否正常调用")
-    public String hello(@Parameter(description = "用户名", required = true)
-                        @RequestParam String name) {
-        return "Hello, " + name;
-    }
-}

+ 0 - 168
GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/controller/IBPSLISController.java

@@ -1,168 +0,0 @@
-package com.jyxt.getdatabyrestful.controller;
-
-import com.jyxt.getdatabyrestful.service.IBPSService;
-import com.jyxt.getdatabyrestful.service.impl.ConditionalOnEndpoint;
-import io.swagger.v3.oas.annotations.media.Schema;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.web.bind.annotation.*;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.tags.Tag;
-
-import java.util.List;
-import java.util.Map;
-
-@RestController
-@RequestMapping("/LISProcess") // 基础路径
-@Tag(name = "金源信通检验过程管理模块标准接口", description = "")
-@ConditionalOnProperty(
-        name = "interface.LISProcess",
-        havingValue = "1",
-        matchIfMissing = false // 若配置不存在则禁用
-)
-public class IBPSLISController {
-    @Autowired
-    IBPSService ibpsService;
-
-    // 示例:GET接口
-    @GetMapping("/test")
-    @Operation(summary = "示例接口", description = "这是一个示例GET接口,点击右侧'try it out'测试接口能否正常调用")
-    @ConditionalOnEndpoint(property = "interface.test")
-    public String hello(@Parameter(description = "用户名", required = true)
-                            @RequestParam String name) {
-        return "Hello, " + name;
-    }
-
-    @PostMapping("/QCMonthReport")
-    @Operation(summary = "室内质控月分析总结报告", description = "")
-    @ConditionalOnEndpoint(property = "interface.QCMonthReport")
-    public String saveMonthReport(@RequestBody
-                                      @Schema(
-                                              name = "室内质控月分析总结报告",
-                                              description = "请求示例",
-                                              example = "[{\"CreateUser\":\"创建人张三\",\"CreateTime\":\"2025-07-08 08:30:22\",\"DeviceCode\":\"贝克曼DXI800\"," +
-                                                      "\"DeviceModel\":\"DXI800\",\"ReportDate\":\"2025年6月\",\"QCTestCode\":[{\"TestCode\":\"ALB\",\"QCMFG\":\"伯乐\"," +
-                                                      "\"QCName\":\"9901\",\"LotNumber\":\"220901L\",\"LotStartTime\":\"09-02\",\"QCRule\":\"13s、22s\",\"QCLevel\":\"低\"," +
-                                                      "\"QCChartAvg\":\"55.00\",\"QCChartSD\":\"3.99\",\"QCChartCV\":\"7\",\"RawDataAvg\":\"54.57\",\"RawDataSD\":\"1\"," +
-                                                      "\"RawDataCV\":\"1\",\"RawDataNum\":\"2\",\"OutControlNum\":\"1\",\"ControlDataAvg\":\"1\",\"ControlDataSD\":\"1\"," +
-                                                      "\"ControlDataCV\":\"1\",\"AccumDataAvg\":\"1\",\"AccumDataSD\":\"1\",\"AccumDataCV\":\"1\",\"AccumDataNum\":\"1\"," +
-                                                      "\"AccumDataPer\":\"1\",\"CVRange\":\"1\",\"pass\":\"是\"},{\"TestCode\":\"ALB\",\"QCMFG\":\"伯乐\",\"QCName\":\"9902\"," +
-                                                      "\"LotNumber\":\"220901H\",\"LotStartTime\":\"09-02\",\"QCRule\":\"13s、22s\",\"QCLevel\":\"高\",\"QCChartAvg\":\"55.00\"," +
-                                                      "\"QCChartSD\":\"3.99\",\"QCChartCV\":\"7\",\"RawDataAvg\":\"54.57\",\"RawDataSD\":\"1\",\"RawDataCV\":\"1\"," +
-                                                      "\"RawDataNum\":\"2\",\"OutControlNum\":\"1\",\"ControlDataAvg\":\"1\",\"ControlDataSD\":\"1\",\"ControlDataCV\":\"1\"," +
-                                                      "\"AccumDataAvg\":\"1\",\"AccumDataSD\":\"1\",\"AccumDataCV\":\"1\",\"AccumDataNum\":\"1\",\"AccumDataPer\":\"1\"," +
-                                                      "\"CVRange\":\"1\",\"pass\":\"是\"}]}]"
-                                      )
-                                      List<Map<String, Object>> inputList) {
-        String retValue = "fail";
-        if (inputList == null || inputList.isEmpty()) {
-            return "输入不能为空!";
-        }
-        // 处理业务逻辑(如保存到数据库)
-        retValue = ibpsService.saveMonthReport(inputList);
-        return retValue;
-    }
-
-    @PostMapping("/RerunSampleRecord")
-    @Operation(summary = "复检样品记录", description = "")
-    @ConditionalOnEndpoint(property = "interface.RerunSampleRecord")
-    public String saveRerunSample(@RequestBody
-                                    @Schema(
-                                        name = "复检样品记录",
-                                        description = "请求示例",
-                                        example = "[{\"CreateUser\":\"编制人张三\",\"CreateTime\":\"2025-07-08 08:30:22\",\"SampleCode\":\"20250708001\"," +
-                                                "\"PatName\":\"病人李四\",\"TestCode\":\"UA\",\"TestCodeName\":\"尿酸\",\"Unit\":\"g/ml\"," +
-                                                "\"InitialResult\":\"1.5\",\"RerunResult\":\"2.8\",\"ReportResult\":\"2.8\",\"Auditer\":\"审核人王五\"," +
-                                                "\"ReportTime\":\"15:02:02\",\"RerunMethod\":\"稀释复检\",\"RerunMethodNote\":\"稀释后复查\"}]"
-                                    )
-                                    List<Map<String, Object>> inputList) {
-        String retValue = "fail";
-        if (inputList == null || inputList.isEmpty()) {
-            return "输入不能为空!";
-        }
-        retValue = ibpsService.saveRerunSample(inputList);
-        return retValue;
-    }
-
-    @PostMapping("/IncorrectLISReport")
-    @Operation(summary = "不正确检验报告登记", description = "")
-    @ConditionalOnEndpoint(property = "interface.IncrrectLISReport")
-    public String saveIncorrectLISReport(@RequestBody
-                                  @Schema(
-                                          name = "不正确检验报告登记",
-                                          description = "请求示例",
-                                          example = "[{\"CreateUser\":\"编制人张三\",\"RegistTime\":\"2025-07-15 09:25\",\"SampleCode\":\"20250715001\"," +
-                                                  "\"PatName\":\"病人李四\",\"TestCode\":\"GLU\",\"InitialAuditTime\":\"2025-07-11 09:00\"," +
-                                                  "\"ReAuditTime\":\"2025-07-11 09:10\",\"FinalAuditTime\":\"2025-07-11 09:20\",\"Reason\":\"标本溶血\"}]"
-                                  )
-                                  List<Map<String, Object>> inputList) {
-        String retValue = "fail";
-        if (inputList == null || inputList.isEmpty()) {
-            return "输入不能为空!";
-        }
-        retValue = ibpsService.saveIncorrectLISReport(inputList);
-        return retValue;
-    }
-
-    @PostMapping("/CriticalReport")
-    @Operation(summary = "危急值漏报、上报超时登记", description = "")
-    @ConditionalOnEndpoint(property = "interface.CriticalReport")
-    public String saveCriticalReport(@RequestBody
-                                         @Schema(
-                                                 name = "危急值漏报、上报超时登记",
-                                                 description = "请求示例",
-                                                 example = "[{\"CreateUser\":\"编制人张三\",\"ResponsibleUser\":\"责任人李四\",\"RegistDate\":\"2025-07-01\"," +
-                                                         "\"RegistTime\":\"10:30\",\"PatName\":\"患者王五\",\"SampleCode\":\"202507011111\",\"Advice\":\"电解质5项\"," +
-                                                         "\"Type\":\"上报超时\",\"Reason\":\"溶血导致钾离子假性升高\"}]"
-                                         )
-                                         List<Map<String, Object>> inputList) {
-        String retValue = "fail";
-        if (inputList == null || inputList.isEmpty()) {
-            return "输入不能为空!";
-        }
-        retValue = ibpsService.saveCriticalReport(inputList);
-        return retValue;
-    }
-
-    @PostMapping("/OvertimeReport")
-    @Operation(summary = "急诊报告超时登记", description = "")
-    @ConditionalOnEndpoint(property = "interface.OvertimeReport")
-    public String saveOvertimeReport(@RequestBody
-                                     @Schema(
-                                             name = "急诊报告超时登记",
-                                             description = "请求示例",
-                                             example = "[{\"CreateUser\":\"编制人张三\",\"ResponsibleUser\":\"责任人李四\",\"RegistDate\":\"2025-07-01\"," +
-                                                     "\"RegistTime\":\"10:30\",\"PatName\":\"患者王五\",\"SampleCode\":\"202507011111\",\"Advice\":\"肝功能2项\"," +
-                                                     "\"TestCode\":\"AST ALB\",\"DelayMins\":\"30\",\"Reason\":\"仪器故障\",\"InfectMins\":\"30\"}]"
-                                     )
-                                     List<Map<String, Object>> inputList) {
-        String retValue = "fail";
-        if (inputList == null || inputList.isEmpty()) {
-            return "输入不能为空!";
-        }
-        retValue = ibpsService.saveOvertimeReport(inputList);
-        return retValue;
-    }
-
-
-    @PostMapping("/PostiveReport")
-    @Operation(summary = "传染病报告登记", description = "")
-    @ConditionalOnEndpoint(property = "interface.PostiveReport")
-    public String savePostiveReport(@RequestBody
-                                     @Schema(
-                                             name = "传染病报告登记",
-                                             description = "请求示例",
-                                             example = "[{\"CreateUser\":\"编制人张三\",\"RegistTime\":\"2025-07-01 10:30\",\"PatDept\":\"感染科\"," +
-                                                     "\"Doctor\":\"开单医生李四\",\"PatName\":\"患者王五\",\"PatGender\":\"男\",\"PatAge\":\"35岁\"," +
-                                                     "\"ReportDate\":\"2025-07-01\",\"ReportDocDate\":\"2025-07-01 10:10\",\"ReportPHMDate\":\"2025-07-01 10:20\",\"ReportResult\":\"抗戊型肝炎抗体IgM:1.03 S/CO。\"}]"
-                                     )
-                                     List<Map<String, Object>> inputList) {
-        String retValue = "fail";
-        if (inputList == null || inputList.isEmpty()) {
-            return "输入不能为空!";
-        }
-        retValue = ibpsService.savePostiveReport(inputList);
-        return retValue;
-    }
-}

+ 0 - 72
GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/controller/IBPSQualityIndicatorController.java

@@ -1,72 +0,0 @@
-package com.jyxt.getdatabyrestful.controller;
-
-import com.jyxt.getdatabyrestful.service.IBPSService;
-import com.jyxt.getdatabyrestful.service.impl.ConditionalOnEndpoint;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.Parameter;
-import io.swagger.v3.oas.annotations.media.Schema;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-import java.util.Map;
-
-@RestController
-@RequestMapping("/QualityIndicator") // 基础路径
-@Tag(name = "金源信通质量管理模块标准接口", description = "")
-@ConditionalOnProperty(
-        name = "interface.QualityIndicator",
-        havingValue = "1",
-        matchIfMissing = false // 若配置不存在则禁用
-)
-public class IBPSQualityIndicatorController {
-    @Autowired
-    IBPSService ibpsService;
-
-    @GetMapping("/test")
-    @Operation(summary = "示例接口", description = "这是一个示例GET接口,点击右侧'try it out'测试接口能否正常调用")
-    @ConditionalOnEndpoint(property = "interface.test")
-    public String hello(@Parameter(description = "用户名", required = true)
-                        @RequestParam String name) {
-        return "Hello, " + name;
-    }
-
-    @GetMapping("/GetQualityIndicatorItem")
-    @Operation(summary = "获取所有质量指标项目", description = "获取所有可以从对接方提供的质量指标项目,用于在接口发开阶段或者项目有调整时获取需要查询的内容")
-    @ConditionalOnEndpoint(property = "interface.getQualityIndicatorItem")
-    public String getQualityIndicatorItem() {
-        String QualityIndicatorItem = ibpsService.getQualityIndicatorItem();
-        return QualityIndicatorItem;
-    }
-
-
-    @GetMapping("/GetUndoQualityIndicator")
-    @Operation(summary = "获取未完成质量指标项目", description = "获取待处理的质量指标项目,根据里面的项目获取结果再调用:\"保存未完成质量指标项目\"接口返回值")
-    @ConditionalOnEndpoint(property = "interface.getUndoQualityIndicatorItem")
-    public String getUndoQualityIndicatorItem() {
-        String QualityIndicatorItem = ibpsService.getUndoQualityIndicatorItem();
-        return QualityIndicatorItem;
-    }
-
-    @PostMapping("/SaveQualityIndicator")
-    @Operation(summary = "保存未完成质量指标项目", description = "根据接口:\"获取未完成质量指标项目\"获取需要查询的质量指标项目后将结果通过此接口返回")
-    @ConditionalOnEndpoint(property = "interface.saveUndoQualityIndicator")
-    public String saveUndoQualityIndicator(@RequestBody
-                                     @Schema(
-                                             name = "保存未完成质量指标项目",
-                                             description = "请求示例",
-                                             example = "[{\"StatDate\":\"2024年5月份\",\"Frequency\":\"每月\",\"Target\":\"危急值通报及时率\",\"Result\":\"95\",\"Numerator\":\"95\",\"Denominator\":\"100\",\"Pass\":\"Y\"}," +
-                                                     "{\"StatDate\":\"2024年5月份\",\"Frequency\":\"每月\",\"Target\":\"危急值通报率\",\"Result\":\"100\",\"Numerator\":\"400\",\"Denominator\":\"400\",\"Pass\":\"N\"}," +
-                                                     "{\"StatDate\":\"2024年5月份\",\"Frequency\":\"每月\",\"Target\":\"实验室内周转时间中位数-急诊-凝血\",\"Result\":\"12\",\"Numerator\":\"123\",\"Denominator\":\"\",\"Pass\":\"Y\"}]"
-                                     )
-                                     List<Map<String, Object>> inputList) {
-        String retValue = "fail";
-        if (inputList == null || inputList.isEmpty()) {
-            return "输入不能为空!";
-        }
-        retValue = ibpsService.saveUndoQualityIndicator(inputList);
-        return retValue;
-    }
-}

+ 4 - 16
GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/IBPSService.java

@@ -1,28 +1,16 @@
 package com.jyxt.getdatabyrestful.service;
 
 
+import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
 import java.util.Map;
-
 public interface IBPSService {
 
-     String saveMonthReport(List<Map<String, Object>> inputList);
-
-     String saveRerunSample(List<Map<String, Object>> inputList);
-
-     String saveIncorrectLISReport(List<Map<String, Object>> inputList);
-
-     String saveCriticalReport(List<Map<String, Object>> inputList);
-
-     String saveOvertimeReport(List<Map<String, Object>> inputList);
-
-     String savePostiveReport(List<Map<String, Object>> inputList);
-
-     String getQualityIndicatorItem();
+     List<Map<String, Object>> getReagentInData();
 
-     String getUndoQualityIndicatorItem();
+     List<Map<String, Object>> getReagentOutData();
 
-     String saveUndoQualityIndicator(List<Map<String, Object>> QualityIndicatorList);
+     void updateFlag(List<Object>ids, String tableName, String flagName);
 }

+ 31 - 12
GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/impl/ApiClientServiceImpl.java

@@ -7,6 +7,9 @@ import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.MediaType;
 import org.springframework.stereotype.Service;
+import org.springframework.web.client.HttpClientErrorException;
+import org.springframework.web.client.HttpServerErrorException;
+import org.springframework.web.client.ResourceAccessException;
 import org.springframework.web.client.RestTemplate;
 
 
@@ -17,25 +20,41 @@ public class ApiClientServiceImpl implements ApiClientService {
 
     private static final Logger log = LoggerFactory.getLogger(ApiClientServiceImpl.class);
 
-
     // GET请求
     public String sendGet(String url) {
         String RetVal = restTemplate.getForObject(url, String.class);
         return RetVal;
     }
 
-
-    // POST请求
-    public String sendPost(String url, String request) {
-        // 设置请求头(如 JSON)
+    @Override
+    public String sendPost(String url, String json) {
         HttpHeaders headers = new HttpHeaders();
         headers.setContentType(MediaType.APPLICATION_JSON);
-        // 包装请求体和头
-        HttpEntity<Object> httpEntity = new HttpEntity<>(request, headers);
-        // 发送 POST 请求
-        String RetVal = restTemplate.postForObject(url, request, String.class);
-        return RetVal;
+        HttpEntity<String> httpEntity = new HttpEntity<>(json, headers);
+
+        try {
+            String response = restTemplate.postForObject(url, httpEntity, String.class);
+            log.info("POST请求成功, url={}, responseLength={}", url, response != null ? response.length() : 0);
+            return response;
+        } catch (HttpClientErrorException e) {
+            // 4xx 错误:对方接口返回了明确的业务错误或参数错误
+            log.error("POST请求客户端错误, url={}, statusCode={}, responseBody={}",
+                    url, e.getStatusCode(), e.getResponseBodyAsString());
+            // 返回对方错误响应体,让上层解析 code/message
+            return e.getResponseBodyAsString();
+        } catch (HttpServerErrorException e) {
+            // 5xx 错误:对方服务器内部异常
+            log.error("POST请求服务端错误, url={}, statusCode={}, responseBody={}",
+                    url, e.getStatusCode(), e.getResponseBodyAsString());
+            return null;
+        } catch (ResourceAccessException e) {
+            // 网络层异常:超时、连接拒绝、DNS解析失败等
+            log.error("POST请求网络异常, url={}, error={}", url, e.getMessage());
+            return null;
+        } catch (Exception e) {
+            // 兜底:其他未预期异常
+            log.error("POST请求未知异常, url={}, error={}", url, e.getMessage(), e);
+            return null;
+        }
     }
-
-
 }

+ 0 - 405
GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/impl/BasicMethod.java

@@ -1,405 +0,0 @@
-package com.jyxt.getdatabyrestful.service.impl;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.dao.DataAccessException;
-import org.springframework.jdbc.core.BatchPreparedStatementSetter;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.stereotype.Component;
-
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.sql.Timestamp;
-import java.sql.Types;
-import java.util.*;
-import java.util.stream.Collectors;
-
-@Component
-public class BasicMethod {
-    private static final Logger log = LoggerFactory.getLogger(BasicMethod.class);
-
-    public static List<Map<String, Object>> userList = new ArrayList<>();
-    public static List<Map<String, Object>> posiList = new ArrayList<>();
-
-
-    @Autowired
-    private JdbcTemplate jdbcTemplate;
-
-    @Value("${config.insertMode}")
-    private String insertMode;
-
-    public String saveToTable(List<Map<String, Object>> inputList, String TableName) {
-        String retValue = "fail";
-        if (inputList == null || inputList.isEmpty() || TableName == null || TableName.trim().isEmpty()) {
-            return retValue;
-        }
-        try {
-            // 获取第一个Map的字段名作为表字段
-            Map<String, Object> firstRow = inputList.get(0);
-            String columns = String.join(",", firstRow.keySet());
-
-            // 构建占位符部分 (?,?,...)
-            String placeholders = String.join(",", Collections.nCopies(firstRow.size(), "?"));
-
-            // 构建完整SQL语句
-            String sql = String.format("INSERT INTO %s (%s) VALUES (%s)", TableName, columns, placeholders);
-            log.info("executing sql: " + sql);
-            // 批量执行
-            jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
-                @Override
-                public void setValues(PreparedStatement ps, int i) throws SQLException {
-                    Map<String, Object> row = inputList.get(i);
-                    int index = 1;
-                    for (Map.Entry<String, Object> entry : row.entrySet()) {
-                        String key = entry.getKey();
-                        Object value = entry.getValue();
-
-                        if (key.contains("Time") && value instanceof Timestamp) {
-                            ps.setTimestamp(index++, (Timestamp) value);
-                        } else {
-                            ps.setString(index++, value.toString());
-                        }
-                    }
-                }
-                @Override
-                public int getBatchSize() {
-                    return inputList.size();
-                }
-            });
-            retValue = "success";
-        } catch (Exception e) {
-            e.printStackTrace();
-            return "insert failed:"+e.getMessage().split(";")[2];
-        }
-        return retValue;
-    }
-
-    /**
-     * 获取基础数据:
-     * LIS系统用户名对应金通用户信息
-     */
-    public void getBasicData(){
-        String sqlUser = "select id_,name_,positions_ from ibps_party_employee where status_='actived'";
-        userList = jdbcTemplate.queryForList(sqlUser);
-        String sqlPosi = "select * from ibps_party_position";
-        posiList = jdbcTemplate.queryForList(sqlPosi);
-    }
-
-    /**
-     * 返回用户ID@部门ID@部门名称
-     * @param userName
-     * @return
-     */
-    public String getUserInfoByName(String userName){
-        String retVal = "-1";
-        for (Map<String, Object> map : userList) {
-            if (map.get("name_").toString().equals(userName)) {
-                String userId = (String) map.get("id_");
-                String positionId = String.valueOf(map.get("positions_")).split(",")[0];
-                String positionName = (String) getPosiByID(positionId);
-                if (!positionName.equals("-1")) {
-                    retVal = userId+"@"+positionId+"@"+positionName;
-                }else{
-                    retVal = "-1^部门:"+positionName+"未找到!";
-                    return retVal;
-                }
-                return retVal;
-            }
-            retVal = "-1^用户:"+userName+"未找到!";
-        }
-        return retVal;
-    }
-
-    public String getPosiByID(String positionId){
-        String retVal = "-1";
-        for (Map<String, Object> map : posiList) {
-            if (map.get("id_").toString().equals(positionId)) {
-                retVal = map.get("name_").toString();
-                break;
-            }
-        }
-        return retVal;
-    }
-
-    public List<Map<String, Object>> getQualityIndicatorItem(){
-        String qryStr = "select tong_ji_pin_lv_ as Frequency,zhi_liang_zhi_bia as Target,yun_suan_fu_hao_ as Operator,zhi_biao_xian_zhi as LimitValue,dan_wei_ as Unit " +
-                "from t_zlzbpzzb where shi_fou_qi_yong_='Y' and bei_zhu_ like '%LIS导入%' and zhi_liang_zhi_bia is not null";
-        List<Map<String, Object>> QualityIndicatorList = jdbcTemplate.queryForList(qryStr);
-        return QualityIndicatorList;
-    }
-
-    public List<Map<String, Object>> getUndoQualityIndicatorItem(){
-        String qryStr = "select bian_zhi_shi_jian as StatDate,tong_ji_pin_lv_ as Frequency,zhi_liang_zhi_bia as Target," +
-                "SUBSTRING_INDEX(yuan_shi_shu_ju_, '@', 1) AS Operator," +
-                "SUBSTRING_INDEX(SUBSTRING_INDEX(yuan_shi_shu_ju_, '@', 2), '@', -1) AS LimitValue," +
-                "SUBSTRING_INDEX(yuan_shi_shu_ju_, '@', -1) AS Unit from t_zlzbpjzb where zhuang_tai_='待处理'";
-        List<Map<String, Object>> allUndoQualityIndicatorList = jdbcTemplate.queryForList(qryStr);
-        return allUndoQualityIndicatorList;
-    }
-
-    public String updateToTable(Map<String, Object> conditionData, Map<String, Object> updateData, String TableName){
-        String retVal = "fail";
-        // 验证输入数据有效性
-        if (updateData == null || updateData.isEmpty()) {
-            log.warn("Update failed: updateData is null or empty");
-            return "fail: updateData is null or empty";
-        }
-        if (conditionData == null || conditionData.isEmpty()) {
-            log.warn("Update failed: conditionData is null or empty");
-            return "fail: conditionData is null or empty";
-        }
-        try {
-            // 1. 构建动态SET子句
-            StringBuilder setClause = new StringBuilder();
-            List<Object> params = new ArrayList<>();
-            for (Map.Entry<String, Object> entry : updateData.entrySet()) {
-                String column = validateColumnName(entry.getKey());
-                if (column == null) {
-                    String error = "Invalid update column name: " + entry.getKey();
-                    log.warn("Update failed: {}", error);
-                    return "fail: " + error;
-                }
-                if (setClause.length() > 0) setClause.append(", ");
-                setClause.append(column).append(" = ?");
-                params.add(entry.getValue());
-            }
-            // 2. 构建动态WHERE子句
-            StringBuilder whereClause = new StringBuilder();
-            for (Map.Entry<String, Object> entry : conditionData.entrySet()) {
-                String column = validateColumnName(entry.getKey());
-                if (column == null) {
-                    String error = "Invalid condition column name: " + entry.getKey();
-                    log.warn("Update failed: {}", error);
-                    return "fail: " + error;
-                }
-                if (whereClause.length() > 0) whereClause.append(" AND ");
-                whereClause.append(column).append(" = ?");
-                params.add(entry.getValue());
-            }
-            // 3. 验证表名
-            if (!isValidTableName(TableName)) {
-                String error = "Invalid table name: " + TableName;
-                log.warn("Update failed: {}", error);
-                return "fail: " + error;
-            }
-            // 4. 构建完整SQL语句
-            String sql = "UPDATE " + TableName + " SET " + setClause +
-                    " WHERE " + whereClause;
-            // 5. 记录SQL语句和参数到日志
-            logSQLWithParams(sql, params);
-            // 6. 执行更新操作
-            int rowsAffected = jdbcTemplate.update(sql, params.toArray());
-
-            // 7. 记录更新结果
-            if (rowsAffected > 0) {
-                log.info("Update successful: {} row(s) affected in table '{}'", rowsAffected, TableName);
-                return "success";
-            } else {
-                log.warn("Update completed but no rows affected in table '{}'", TableName);
-                return "fail: no rows updated";
-            }
-        } catch (DataAccessException e) {
-            String error = "Database error: " + e.getMessage();
-            log.error("Update failed: {}", error, e);
-            return "fail: " + error;
-        } catch (Exception e) {
-            String error = "System error: " + e.getMessage();
-            log.error("Update failed: {}", error, e);
-            return "fail: " + error;
-        }
-    }
-
-    // 列名校验方法
-    private String validateColumnName(String columnName) {
-        // 只允许字母、数字和下划线
-        if (columnName == null || !columnName.matches("[a-zA-Z0-9_]+")) {
-            return null;
-        }
-        return columnName;
-    }
-
-    // 表名校验方法
-    private boolean isValidTableName(String tableName) {
-        // 可根据需要扩展校验规则
-        return tableName != null && tableName.matches("[a-zA-Z0-9_]+");
-    }
-
-    // 记录SQL语句和参数
-    private void logSQLWithParams(String sql, List<Object> params) {
-        if (log.isInfoEnabled()) {
-            StringBuilder logMessage = new StringBuilder("Executing SQL: \n");
-            logMessage.append(sql);
-
-            if (params != null && !params.isEmpty()) {
-                logMessage.append("\nParameters: [");
-                for (int i = 0; i < params.size(); i++) {
-                    if (i > 0) logMessage.append(", ");
-
-                    Object param = params.get(i);
-                    // 对字符串添加引号
-                    if (param instanceof String) {
-                        logMessage.append("'").append(param).append("'");
-                    } else {
-                        logMessage.append(param);
-                    }
-                }
-                logMessage.append("]");
-            }
-
-            log.info(logMessage.toString());
-        }
-    }
-
-    public String saveToTable(List<Map<String, Object>> inputList, String TableName, String saveType) {
-        String retValue = "fail";
-        if (inputList == null || inputList.isEmpty() || TableName == null || TableName.trim().isEmpty()) {
-            return retValue;
-        }
-
-        // 验证 saveType 参数
-        if (!"1".equals(saveType) && !"2".equals(saveType)) {
-            return "invalid saveType, must be '1' or '2'";
-        }
-
-        try {
-            if ("1".equals(saveType)) {
-                // 原有插入逻辑
-                retValue = executeInsert(inputList, TableName);
-            } else if ("2".equals(saveType)) {
-                // 新增更新逻辑
-                retValue = executeUpdate(inputList, TableName);
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            String errorMsg = "1".equals(saveType) ? "insert" : "update";
-            return errorMsg + " failed:" + (e.getMessage() != null ? e.getMessage().split(";")[0] : e.getMessage());
-        }
-        return retValue;
-    }
-
-    /**
-     * 执行插入操作
-     */
-    private String executeInsert(List<Map<String, Object>> inputList, String TableName) {
-        Map<String, Object> firstRow = inputList.get(0);
-        String columns = String.join(",", firstRow.keySet());
-        String placeholders = String.join(",", Collections.nCopies(firstRow.size(), "?"));
-        String sql = String.format("INSERT INTO %s (%s) VALUES (%s)", TableName, columns, placeholders);
-
-        log.info("executing insert sql: " + sql);
-
-        if (insertMode.equals("1")) {
-            log.info("ready to insert " + inputList.size() + " records");
-            jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
-                @Override
-                public void setValues(PreparedStatement ps, int i) throws SQLException {
-                    Map<String, Object> row = inputList.get(i);
-                    int index = 1;
-                    for (Map.Entry<String, Object> entry : row.entrySet()) {
-                        String key = entry.getKey();
-                        Object value = entry.getValue();
-
-                        if (value == null) {
-                            ps.setNull(index++, Types.VARCHAR);
-                        } else if (value instanceof Timestamp) {
-                            ps.setTimestamp(index++, (Timestamp) value);
-                        } else {
-                            // 其他所有类型转字符串(包括 Integer, Boolean, Date, String 等)
-                            ps.setString(index++, value.toString());
-                        }
-                    }
-                }
-                @Override
-                public int getBatchSize() {
-                    return inputList.size();
-                }
-            });
-            log.info("insert completed successfully");
-        } else {
-            log.info("------qry mode, pretend to insert " + inputList.size() + " records-------");
-            inputList.forEach(map -> {
-                StringBuilder sb = new StringBuilder();
-                map.forEach((k, v) -> sb.append(k).append(":").append(v).append(","));
-                if (sb.length() > 0) sb.deleteCharAt(sb.length() - 1);
-                log.info("Insert data: " + sb.toString());
-            });
-        }
-        return "success";
-    }
-
-    /**
-     * 执行更新操作
-     */
-    private String executeUpdate(List<Map<String, Object>> inputList, String TableName) {
-        // 检查是否包含 id_ 字段
-        Map<String, Object> firstRow = inputList.get(0);
-        if (!firstRow.containsKey("id_")) {
-            return "update failed: missing 'id_' field in input data";
-        }
-
-        // 构建更新SQL (排除id_字段,因为它作为WHERE条件)
-        List<String> columns = firstRow.keySet().stream()
-                .filter(key -> !"id_".equals(key))
-                .collect(Collectors.toList());
-
-        String setClause = columns.stream()
-                .map(column -> column + " = ?")
-                .collect(Collectors.joining(","));
-
-        String sql = String.format("UPDATE %s SET %s WHERE id_ = ?", TableName, setClause);
-
-        log.info("executing update sql: " + sql);
-
-        if (insertMode.equals("1")) {
-            log.info("ready to update " + inputList.size() + " records");
-            jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
-                @Override
-                public void setValues(PreparedStatement ps, int i) throws SQLException {
-                    Map<String, Object> row = inputList.get(i);
-                    int index = 1;
-
-                    // 设置SET部分的参数
-                    for (String column : columns) {
-                        Object value = row.get(column);
-                        if (value == null) {
-                            ps.setNull(index++, Types.VARCHAR);
-                        } else if (value instanceof Timestamp) {
-                            ps.setTimestamp(index++, (Timestamp) value);
-                        } else {
-                            ps.setString(index++, value.toString());
-                        }
-                    }
-
-                    // 设置WHERE条件的id_参数
-                    Object idValue = row.get("id_");
-                    if (idValue == null) {
-                        ps.setNull(index, Types.VARCHAR);
-                    } else if (idValue instanceof Timestamp) {
-                        ps.setTimestamp(index, (Timestamp) idValue);
-                    } else {
-                        ps.setString(index, idValue.toString());
-                    }
-                }
-
-                @Override
-                public int getBatchSize() {
-                    return inputList.size();
-                }
-            });
-            log.info("update completed successfully");
-        } else {
-            log.info("------qry mode, pretend to update " + inputList.size() + " records-------");
-            inputList.forEach(map -> {
-                StringBuilder sb = new StringBuilder();
-                map.forEach((k, v) -> sb.append(k).append(":").append(v).append(","));
-                if (sb.length() > 0) sb.deleteCharAt(sb.length() - 1);
-                log.info("Update data (id_=" + map.get("id_") + "): " + sb.toString());
-            });
-        }
-        return "success";
-    }
-
-
-}

+ 194 - 57
GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/impl/IBPSServiceImpl.java

@@ -1,8 +1,6 @@
 package com.jyxt.getdatabyrestful.service.impl;
 
 import com.jyxt.getdatabyrestful.service.IBPSService;
-import com.jyxt.getdatabyrestful.service.impl.LISProcess.*;
-import com.jyxt.getdatabyrestful.service.impl.QualityIndicator.QualityIndicator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -14,70 +12,209 @@ import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.sql.Timestamp;
 import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 public class IBPSServiceImpl implements IBPSService {
-    private static final Logger log = LoggerFactory.getLogger(IBPSServiceImpl.class);
-
-    @Autowired
-    RerunSampleRecord rerunSampleRecord;
-
-    @Autowired
-    QCMonthReport qcMonthReport;
-
-    @Autowired
-    IncorrectLISReport incorrectLISReport;
-
-    @Autowired
-    CriticalReport criticalReport;
-
-    @Autowired
-    OvertimeReport overtimeReport;
-
-    @Autowired
-    QualityIndicator qualityIndicator;
-
     @Autowired
-    PostiveReport postiveReport;
-
-    public static final Map<String, String> fieldConnect = new HashMap<>();
-
-    //检验过程管理---------------------------------------------------------------------------
-    public String saveMonthReport(List<Map<String, Object>> inputList) {
-        return qcMonthReport.saveMonthReport(inputList);
-    }
-
-
-    public String saveRerunSample(List<Map<String, Object>> inputList) {
-        return rerunSampleRecord.saveRerunSample(inputList);
-    }
-
-    public String saveIncorrectLISReport(List<Map<String, Object>> inputList) {
-        return incorrectLISReport.saveIncorrectLISReport(inputList);
-    }
-
-    public String saveCriticalReport(List<Map<String, Object>> inputList) {
-        return criticalReport.saveCriticalReport(inputList);
-    }
-
-    public String saveOvertimeReport(List<Map<String, Object>> inputList) {
-        return overtimeReport.saveOvertimeReport(inputList);
-    }
-
-    public String savePostiveReport(List<Map<String, Object>> inputList) {
-        return postiveReport.savePostiveReport(inputList);
+    private JdbcTemplate jdbcTemplate;
+    @Override
+    public List<Map<String, Object>> getReagentInData() {
+        String qryStr = "SELECT\n" +
+                "    a.parent_id_ AS parent_id_,\n" +
+                "    b.bian_zhi_bu_men_ AS bian_zhi_bu_men_,\n" +
+                "    d.name_ AS cdptid,\n" +
+                "    b.bian_hao_ AS vbillcode,\n" +
+                "    CONCAT(SUBSTRING(b.bian_hao_, 3, 4), '-', SUBSTRING(b.bian_hao_, 7, 2), '-', SUBSTRING(b.bian_hao_, 9, 2)) AS dbilldate,\n" +
+                "    b.cang_ku_ming_chen AS cwarehouseid,\n" +
+                "    e.MOBILE_ AS coperatorid,\n" +
+                "    SUBSTRING_INDEX(a.s_c_chang_jia_, '/', 1) AS cproviderid,\n" +
+                "    b.bei_zhu_ AS vnote,\n" +
+                "    e.name_ AS cbizName,\n" +
+                "    a.bian_ma_ AS cinventoryid,\n" +
+                "    a.shu_liang_ AS ninnum,\n" +
+                "    a.bu_han_shui_dan_j AS nprice,\n" +
+                "    c.shui_mu_ AS nictaxrate,\n" +
+                "    c.han_shui_dan_jia_ AS ntaxprice,\n" +
+                "    a.shu_liang_*c.han_shui_dan_jia_ as ntaxmny,\n" +
+                "    a.bu_han_shui_jin_e AS nsalemny,\n" +
+                "    a.pi_hao_ as vbatchcode,\n" +
+                "    a.sheng_chan_ri_qi_ as scrq,\n" +
+                "    a.xiao_qi_ as dvalidate,\n" +
+                "    b.shi_fou_guo_shen_ AS shi_fou_guo_shen_zhu_,\n" +
+                "    b.fa_song_biao_ji_ AS fa_song_biao_ji_,\n" +
+                "    b.id_ as mainID\n" +
+                "FROM\n" +
+                "    t_sjhxhclrkysdjbzb a\n" +
+                "    LEFT JOIN t_sjhxhclrkysdjb b ON a.parent_id_ = b.id_\n" +
+                "    LEFT JOIN t_sjhcjcsjpz c ON a.hao_cai_id_ = c.id_\n" +
+                "    LEFT JOIN ibps_party_position d ON b.bian_zhi_bu_men_ = d.id_\n" +
+                "    LEFT JOIN ibps_party_employee e ON b.jing_shou_ren_one = e.id_\n" +
+                "WHERE\n" +
+                "    b.shi_fou_guo_shen_ = '已完成'\n" +
+                "    AND (b.fa_song_biao_ji_ IS NULL or b.fa_song_biao_ji_='')\n" +
+                "    AND b.update_time_ >= DATE_SUB(NOW(), INTERVAL 7 DAY)";
+
+        List<Map<String, Object>> flatList = jdbcTemplate.queryForList(qryStr);
+
+        Map<Object, List<Map<String, Object>>> groupedMap = flatList.stream()
+                .collect(Collectors.groupingBy(
+                        row -> row.get("parent_id_"),
+                        LinkedHashMap::new,
+                        Collectors.toList()
+                ));
+
+        List<Map<String, Object>> resultList = new ArrayList<>();
+
+        for (Map.Entry<Object, List<Map<String, Object>>> entry : groupedMap.entrySet()) {
+            List<Map<String, Object>> rows = entry.getValue();
+            Map<String, Object> firstRow = rows.get(0);
+
+            // ========== 构建 parent ==========
+            Map<String, Object> parent = new LinkedHashMap<>();
+            parent.put("cdispatcherid", "0201");
+            parent.put("cbiztype", "c001");
+            parent.put("pk_corp", "010501");
+            String cdptid = String.valueOf(firstRow.get("cdptid"));
+            parent.put("cdptid", "普检中心".equals(cdptid) ? "普检中心(2楼)"
+                    : "分子中心".equals(cdptid) ? "分子中心(4楼)"
+                    : cdptid);
+            parent.put("vbillcode", firstRow.get("vbillcode"));
+            parent.put("dbilldate", firstRow.get("dbilldate"));
+            parent.put("pk_calbody", "010501");
+            parent.put("cwarehouseid", firstRow.get("cwarehouseid"));
+            parent.put("coperatorid", firstRow.get("coperatorid"));
+            parent.put("cproviderid", firstRow.get("cproviderid"));
+            parent.put("vnote", firstRow.get("vnote"));
+            parent.put("cbizName", firstRow.get("cbizName"));
+            parent.put("mainID", firstRow.get("mainID")); // 保留原有字段
+
+            // ========== 构建 childrens ==========
+            List<Map<String, Object>> childrens = new ArrayList<>();
+            for (Map<String, Object> row : rows) {
+                Map<String, Object> child = new LinkedHashMap<>();
+                child.put("cinventoryid", row.get("cinventoryid"));
+                child.put("ninnum", toNumber(row.get("ninnum")));
+                child.put("nprice", toNumber(row.get("nprice")));
+                child.put("nictaxrate", toNumber(row.get("nictaxrate")));
+                child.put("ntaxprice", toNumber(row.get("ntaxprice")));
+                child.put("ntaxmny", toNumber(row.get("ntaxmny")));
+                child.put("nsalemny", toNumber(row.get("nsalemny")));
+                child.put("vbatchcode", row.get("vbatchcode"));
+                child.put("scrq", row.get("scrq"));
+                child.put("dvalidate", row.get("dvalidate"));
+                childrens.add(child);
+            }
+
+            Map<String, Object> result = new LinkedHashMap<>();
+            result.put("parent", parent);
+            result.put("childrens", childrens);
+            resultList.add(result);
+        }
+        return resultList;
     }
 
-    //质量管理---------------------------------------------------------------------------
-    public String getQualityIndicatorItem() {
-        return qualityIndicator.getQualityIndicatorItem();
+    public List<Map<String, Object>> getReagentOutData() {
+        String qryStr = "SELECT \n" +
+                "    a.parent_id_, \n" +
+                "    b.bian_zhi_bu_men_ AS bian_zhi_bu_men_, \n" +
+                "    d.name_ AS cdptid, \n" +
+                "    b.bian_hao_ AS vbillcode, \n" +
+                "    CONCAT(SUBSTRING(b.bian_hao_, 4, 4),'-',SUBSTRING(b.bian_hao_, 8, 2),'-',SUBSTRING(b.bian_hao_, 10, 2)) AS dbilldate, \n" +
+                "    a.cun_chu_wei_zhi_ as cwarehouseid,\n" +
+                "    e.MOBILE_ AS coperatorid, \n" +
+                "    b.bei_zhu_ AS vnote, \n" +
+                "    f.name_ AS cbizName, \n" +
+                "    a.bian_ma_ AS cinventoryid, \n" +
+                "    a.xiang_mu_bian_ma_ AS cprojectid, \n" +
+                "    a.shu_liang_ AS noutnum, \n" +
+                "    a.bei_zhu_ AS vnotebody, \n" +
+                "    a.pi_hao_ AS vbatchcode, \n" +
+                "    b.id_ AS mainID  \n" +
+                "FROM \n" +
+                "    t_sjhclyzb a \n" +
+                "    LEFT JOIN t_sjhcly b ON a.parent_id_ = b.id_ \n" +
+                "    LEFT JOIN ibps_party_position d ON b.bian_zhi_bu_men_ = d.id_ \n" +
+                "    LEFT JOIN ibps_party_employee e ON a.jing_shou_ren_ = e.id_ \n" +
+                "    LEFT JOIN ibps_party_employee f ON b.bian_zhi_ren_ = f.id_  \n" +
+                "WHERE \n" +
+                "    b.shi_fou_guo_shen_ = '已完成'  \n" +
+                "    AND (b.fa_song_biao_ji_ IS NULL or b.fa_song_biao_ji_='')  \n" +
+                "    AND b.update_time_ >= DATE_SUB(NOW(),INTERVAL 7 DAY)";
+
+        List<Map<String, Object>> flatList = jdbcTemplate.queryForList(qryStr);
+
+        Map<Object, List<Map<String, Object>>> groupedMap = flatList.stream()
+                .collect(Collectors.groupingBy(
+                        row -> row.get("parent_id_"),
+                        LinkedHashMap::new,
+                        Collectors.toList()
+                ));
+
+        List<Map<String, Object>> resultList = new ArrayList<>();
+
+        for (Map.Entry<Object, List<Map<String, Object>>> entry : groupedMap.entrySet()) {
+            List<Map<String, Object>> rows = entry.getValue();
+            Map<String, Object> firstRow = rows.get(0);
+
+            Map<String, Object> parent = new LinkedHashMap<>();
+            parent.put("pk_corp", "010501");
+            String cdptid = String.valueOf(firstRow.get("cdptid"));
+            parent.put("cdptid", "普检中心".equals(cdptid) ? "普检中心(2楼)"
+                    : "分子中心".equals(cdptid) ? "分子中心(4楼)"
+                    : cdptid);
+            parent.put("vbillcode", firstRow.get("vbillcode"));
+            parent.put("dbilldate", firstRow.get("dbilldate"));
+            parent.put("pk_calbody", "010501");
+            parent.put("cwarehouseid", Optional.ofNullable(firstRow.get("cwarehouseid")).map(v -> String.valueOf(v).split(" ")[0]).orElse(null));
+            parent.put("coperatorid", firstRow.get("coperatorid"));
+            parent.put("vnote", firstRow.get("vnote"));
+            parent.put("cbizName", firstRow.get("cbizName"));
+            parent.put("cdispatcherid", "0101");
+            parent.put("mainID", firstRow.get("mainID"));
+
+            List<Map<String, Object>> childrens = new ArrayList<>();
+            for (Map<String, Object> row : rows) {
+                Map<String, Object> child = new LinkedHashMap<>();
+                child.put("cinventoryid", row.get("cinventoryid"));
+                child.put("cprojectid", row.get("cprojectid"));
+                child.put("noutnum", toNumber(row.get("noutnum")));
+                child.put("vnotebody", row.get("vnotebody"));
+                child.put("vbatchcode", row.get("vbatchcode"));
+                child.put("scrq", "");
+                child.put("dvalidate", "");
+                childrens.add(child);
+            }
+
+            Map<String, Object> result = new LinkedHashMap<>();
+            result.put("parent", parent);
+            result.put("childrens", childrens);
+            resultList.add(result);
+        }
+        return resultList;
     }
 
-    public String getUndoQualityIndicatorItem() {
-        return qualityIndicator.getUndoQualityIndicatorItem();
+    public void updateFlag(List<Object> ids, String tableName, String sendFLag) {
+        if (ids == null || ids.isEmpty()) return;
+        String placeholders = ids.stream()
+                .map(id -> "?")
+                .collect(Collectors.joining(", "));
+        String sql = "UPDATE " + tableName
+                + " SET fa_song_biao_ji_ = '" + sendFLag + "' WHERE id_ IN (" + placeholders + ") AND (fa_song_biao_ji_ IS NULL OR fa_song_biao_ji_ = '')";
+        jdbcTemplate.update(sql, ids.toArray());
     }
 
-    public String saveUndoQualityIndicator(List<Map<String, Object>> QualityIndicatorList){
-        return qualityIndicator.saveUndoQualityIndicator(QualityIndicatorList);
+    /**
+     * 工具方法:将数据库返回的数值统一转为Number类型
+     * 防止Jackson/Fastjson序列化时因BigDecimal/Long等类型被转为字符串
+     */
+    private Number toNumber(Object value) {
+        if (value == null) return null;
+        if (value instanceof Number) return (Number) value;
+        try {
+            return Double.parseDouble(value.toString());
+        } catch (NumberFormatException e) {
+            return null;
+        }
     }
 }

+ 0 - 96
GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/impl/LISProcess/CriticalReport.java

@@ -1,96 +0,0 @@
-package com.jyxt.getdatabyrestful.service.impl.LISProcess;
-
-import com.jyxt.getdatabyrestful.service.impl.BasicMethod;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.sql.Timestamp;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.*;
-@Component
-public class CriticalReport {
-    private static final Logger log = LoggerFactory.getLogger(CriticalReport.class);
-
-    @Autowired
-    BasicMethod basicMethod;
-
-    public static final Map<String, String> fieldConnect = new HashMap<>();
-
-    static {
-        // 静态初始化块中填充数据
-        fieldConnect.put("CreateUser", "create_by_");
-        fieldConnect.put("ResponsibleUser", "ze_ren_ren_");
-        fieldConnect.put("RegistDate", "ri_qi_");
-        fieldConnect.put("RegistTime", "deng_ji_shi_jian_");
-        fieldConnect.put("PatName", "huan_zhe_xing_min");
-        fieldConnect.put("SampleCode", "jian_yan_hao_");
-        fieldConnect.put("Advice", "yi_zhu_ming_cheng");
-        fieldConnect.put("Type", "lei_xing_");
-        fieldConnect.put("Reason", "chao_shi_yuan_yin");
-
-    }
-
-    public String saveCriticalReport(List<Map<String, Object>> inputList) {
-        // 新增校验逻辑:检查必填字段
-        if (inputList == null) {
-            return "入参为空!";
-        }
-        for (Map<String, Object> map : inputList) {
-            for (String requiredKey : fieldConnect.keySet()) {
-                // 检查键是否存在且值非空
-                if (!map.containsKey(requiredKey) ||
-                        map.get(requiredKey) == null ||
-                        String.valueOf(map.get(requiredKey)).trim().isEmpty()) {
-                    return "参数:"+requiredKey+"为空或不存在!"; // 返回缺失或为空的key
-                }
-            }
-        }
-        basicMethod.getBasicData();
-        String retValue = "-1";
-        List<Map<String, Object>> insertList = new ArrayList<Map<String, Object>>();
-        String fieldName = null;
-        String fieldValue = null;
-        Timestamp timeValue = null;
-        for (Map<String, Object> inputMap : inputList) {
-            Map<String, Object> insertMap = new HashMap<>();
-            //部分字段直接添加
-            LocalDateTime currentDate = LocalDateTime.now();
-            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-            String formattedDate = currentDate.format(formatter);
-            insertMap.put("id_", UUID.randomUUID().toString().replace("-", ""));
-            String userInfo = basicMethod.getUserInfoByName(String.valueOf(inputMap.get("CreateUser")));
-            if(userInfo.contains("-1^")){
-                return userInfo.split("\\^")[1];
-            }
-            insertMap.put("ze_ren_ren_", basicMethod.getUserInfoByName(String.valueOf(inputMap.get("CreateUser"))).split("@")[0]);
-            insertMap.put("shi_fou_guo_shen_", "已完成");
-            insertMap.put("bian_zhi_ren_", userInfo.split("@")[0]);
-            insertMap.put("bian_zhi_shi_jian", Timestamp.valueOf(formattedDate));
-            insertMap.put("create_by_", userInfo.split("@")[0]);
-            insertMap.put("create_time_", Timestamp.valueOf(formattedDate));
-            insertMap.put("bian_zhi_bu_men_", userInfo.split("@")[1]);
-            insertMap.put("di_dian_", userInfo.split("@")[1]);
-            for (Map.Entry<String, Object> entry : inputMap.entrySet()) {
-                fieldName = null;
-                fieldValue = null;
-                timeValue = null;
-                fieldName = fieldConnect.get(entry.getKey());
-                fieldValue = String.valueOf(entry.getValue());
-                if(fieldName!=null){
-                    fieldValue = String.valueOf(fieldValue);
-                    String existingValue = String.valueOf(insertMap.get(fieldName)); // 获取当前值
-                    if (existingValue == "null" || existingValue.isEmpty()) {
-                        insertMap.put(fieldName, fieldValue);
-                    }
-                }
-            }
-            insertList.add(insertMap);
-        }
-        log.info("ready save to: t_jzbg");
-        retValue = basicMethod.saveToTable(insertList, "t_jzbg");
-        return retValue;
-    }
-}

+ 0 - 99
GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/impl/LISProcess/IncorrectLISReport.java

@@ -1,99 +0,0 @@
-package com.jyxt.getdatabyrestful.service.impl.LISProcess;
-
-import com.jyxt.getdatabyrestful.service.impl.BasicMethod;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.sql.Timestamp;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.*;
-
-@Component
-public class IncorrectLISReport {
-
-    private static final Logger log = LoggerFactory.getLogger(IncorrectLISReport.class);
-
-    @Autowired
-    BasicMethod basicMethod;
-
-    public static final Map<String, String> fieldConnect = new HashMap<>();
-
-    static {
-        // 静态初始化块中填充数据
-        fieldConnect.put("CreateUser", "create_by_");
-        fieldConnect.put("RegistTime", "deng_ji_shi_jian_");
-        fieldConnect.put("PatName", "huan_zhe_xing_min");
-        fieldConnect.put("SampleCode", "jian_yan_hao_");
-        fieldConnect.put("TestCode", "jian_yan_xiang_mu");
-        fieldConnect.put("InitialAuditTime", "shen_he_shi_jian_");
-        fieldConnect.put("ReAuditTime", "chong_shen_shi_ji");
-        fieldConnect.put("FinalAuditTime", "shen_he_shijian_");
-        fieldConnect.put("Reason", "chong_shen_yuan_y");
-
-    }
-
-    public String saveIncorrectLISReport(List<Map<String, Object>> inputList) {
-        // 新增校验逻辑:检查必填字段
-        if (inputList == null) {
-            return "入参为空!";
-        }
-        for (Map<String, Object> map : inputList) {
-            for (String requiredKey : fieldConnect.keySet()) {
-                // 检查键是否存在且值非空
-                if (!map.containsKey(requiredKey) ||
-                        map.get(requiredKey) == null ||
-                        String.valueOf(map.get(requiredKey)).trim().isEmpty()) {
-                    return "参数:"+requiredKey+"为空或不存在!"; // 返回缺失或为空的key
-                }
-            }
-        }
-        basicMethod.getBasicData();
-        String retValue = "-1";
-        List<Map<String, Object>> insertList = new ArrayList<Map<String, Object>>();
-        String fieldName = null;
-        String fieldValue = null;
-        Timestamp timeValue = null;
-        for (Map<String, Object> inputMap : inputList) {
-            Map<String, Object> insertMap = new HashMap<>();
-            //部分字段直接添加
-            LocalDateTime currentDate = LocalDateTime.now();
-            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-            String formattedDate = currentDate.format(formatter);
-            insertMap.put("id_", UUID.randomUUID().toString().replace("-", ""));
-            String userInfo = basicMethod.getUserInfoByName(String.valueOf(inputMap.get("CreateUser")));
-            if(userInfo.contains("-1^")){
-                return userInfo.split("\\^")[1];
-            }
-            insertMap.put("shi_fou_guo_shen_", "已完成");
-            insertMap.put("bian_zhi_ren_", userInfo.split("@")[0]);
-            insertMap.put("bian_zhi_shi_jian", Timestamp.valueOf(formattedDate));
-            insertMap.put("create_by_", userInfo.split("@")[0]);
-            insertMap.put("create_time_", Timestamp.valueOf(formattedDate));
-            insertMap.put("ze_ren_ren_", userInfo.split("@")[0]);
-            insertMap.put("bian_zhi_bu_men_", userInfo.split("@")[1]);
-            insertMap.put("di_dian_", userInfo.split("@")[1]);
-            for (Map.Entry<String, Object> entry : inputMap.entrySet()) {
-                fieldName = null;
-                fieldValue = null;
-                timeValue = null;
-                fieldName = fieldConnect.get(entry.getKey());
-                fieldValue = String.valueOf(entry.getValue());
-                if(fieldName!=null){
-                    fieldValue = String.valueOf(fieldValue);
-                    String existingValue = String.valueOf(insertMap.get(fieldName)); // 获取当前值
-                    if (existingValue == "null" || existingValue.isEmpty()) {
-                        insertMap.put(fieldName, fieldValue);
-                    }
-                }
-            }
-            insertList.add(insertMap);
-        }
-        log.info("ready save to: t_bzqjybgdjb");
-        retValue = basicMethod.saveToTable(insertList, "t_bzqjybgdjb");
-        return retValue;
-    }
-}

+ 0 - 102
GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/impl/LISProcess/OvertimeReport.java

@@ -1,102 +0,0 @@
-package com.jyxt.getdatabyrestful.service.impl.LISProcess;
-
-import com.jyxt.getdatabyrestful.service.impl.BasicMethod;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.sql.Timestamp;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.*;
-@Component
-public class OvertimeReport {
-    private static final Logger log = LoggerFactory.getLogger(OvertimeReport.class);
-
-    @Autowired
-    BasicMethod basicMethod;
-
-    public static final Map<String, String> fieldConnect = new HashMap<>();
-
-    static {
-        // 静态初始化块中填充数据
-        fieldConnect.put("CreateUser", "create_by_");
-        fieldConnect.put("ResponsibleUser", "ze_ren_ren_");
-        fieldConnect.put("RegistDate", "ri_qi_");
-        fieldConnect.put("RegistTime", "deng_ji_shi_jian_");
-        fieldConnect.put("PatName", "huan_zhe_xing_min");
-        fieldConnect.put("SampleCode", "jian_yan_hao_");
-        fieldConnect.put("Advice", "yi_zhu_ming_cheng");
-        fieldConnect.put("TestCode", "xiang_mu_");
-//        fieldConnect.put("Type", "lei_xing_");
-        fieldConnect.put("DelayMins", "chao_shi_shi_chan");
-        fieldConnect.put("Reason", "chao_shi_yuan_yin");
-        fieldConnect.put("InfectMins", "ying_xiang_shi_ch");
-    }
-
-    public String saveOvertimeReport(List<Map<String, Object>> inputList) {
-        // 新增校验逻辑:检查必填字段
-        if (inputList == null) {
-            return "入参为空!";
-        }
-        for (Map<String, Object> map : inputList) {
-            for (String requiredKey : fieldConnect.keySet()) {
-                // 检查键是否存在且值非空
-                if (!map.containsKey(requiredKey) ||
-                        map.get(requiredKey) == null ||
-                        String.valueOf(map.get(requiredKey)).trim().isEmpty()) {
-                    return "参数:"+requiredKey+"为空或不存在!"; // 返回缺失或为空的key
-                }
-            }
-        }
-        basicMethod.getBasicData();
-        String retValue = "-1";
-        List<Map<String, Object>> insertList = new ArrayList<Map<String, Object>>();
-        String fieldName = null;
-        String fieldValue = null;
-        Timestamp timeValue = null;
-        for (Map<String, Object> inputMap : inputList) {
-            Map<String, Object> insertMap = new HashMap<>();
-            //部分字段直接添加
-            LocalDateTime currentDate = LocalDateTime.now();
-            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-            String formattedDate = currentDate.format(formatter);
-            insertMap.put("id_", UUID.randomUUID().toString().replace("-", ""));
-            String userInfo = basicMethod.getUserInfoByName(String.valueOf(inputMap.get("CreateUser")));
-            if(userInfo.contains("-1^")){
-                return userInfo.split("\\^")[1];
-            }
-            insertMap.put("ze_ren_ren_", basicMethod.getUserInfoByName(String.valueOf(inputMap.get("CreateUser"))).split("@")[0]);
-            insertMap.put("shi_fou_guo_shen_", "已完成");
-            insertMap.put("bian_zhi_ren_", userInfo.split("@")[0]);
-            insertMap.put("bian_zhi_shi_jian", Timestamp.valueOf(formattedDate));
-            insertMap.put("create_by_", userInfo.split("@")[0]);
-            insertMap.put("create_time_", Timestamp.valueOf(formattedDate));
-            insertMap.put("bian_zhi_bu_men_", userInfo.split("@")[1]);
-            insertMap.put("di_dian_", userInfo.split("@")[1]);
-            for (Map.Entry<String, Object> entry : inputMap.entrySet()) {
-                fieldName = null;
-                fieldValue = null;
-                timeValue = null;
-                fieldName = fieldConnect.get(entry.getKey());
-                fieldValue = String.valueOf(entry.getValue());
-                //急诊超时数据避免插到危急值超时漏报数据
-                if(fieldName.equals("lei_xing_")){
-                    continue;
-                }
-                if(fieldName!=null){
-                    fieldValue = String.valueOf(fieldValue);
-                    String existingValue = String.valueOf(insertMap.get(fieldName)); // 获取当前值
-                    if (existingValue == "null" || existingValue.isEmpty()) {
-                        insertMap.put(fieldName, fieldValue);
-                    }
-                }
-            }
-            insertList.add(insertMap);
-        }
-        log.info("ready save to: t_jzbg");
-        retValue = basicMethod.saveToTable(insertList, "t_jzbg");
-        return retValue;
-    }
-}

+ 0 - 101
GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/impl/LISProcess/PostiveReport.java

@@ -1,101 +0,0 @@
-package com.jyxt.getdatabyrestful.service.impl.LISProcess;
-
-import com.jyxt.getdatabyrestful.service.impl.BasicMethod;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.sql.Timestamp;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.*;
-
-@Component
-public class PostiveReport {
-    private static final Logger log = LoggerFactory.getLogger(PostiveReport.class);
-
-    @Autowired
-    BasicMethod basicMethod;
-
-    public static final Map<String, String> fieldConnect = new HashMap<>();
-
-    static {
-        // 静态初始化块中填充数据
-        fieldConnect.put("CreateUser", "create_by_");
-        fieldConnect.put("RegistTime", "bian_zhi_shi_jian");
-        fieldConnect.put("PatDept", "song_jian_ke_shi_");
-        fieldConnect.put("Doctor", "song_jian_yi_shen");
-        fieldConnect.put("PatName", "bing_ren_xing_min");
-        fieldConnect.put("PatGender", "xing_bie_");
-        fieldConnect.put("PatAge", "nian_ling_");
-        fieldConnect.put("ReportDate", "bao_gao_ri_qi_");
-        fieldConnect.put("ReportDocDate", "feed_back_dr_time");
-        fieldConnect.put("ReportPHMDate", "feed_back_hosp_ti");
-        fieldConnect.put("ReportResult", "jian_yan_jie_guo_");
-    }
-
-    public String savePostiveReport(List<Map<String, Object>> inputList) {
-        // 新增校验逻辑:检查必填字段
-        if (inputList == null) {
-            return "入参为空!";
-        }
-        for (Map<String, Object> map : inputList) {
-            for (String requiredKey : fieldConnect.keySet()) {
-                // 检查键是否存在且值非空
-                if (!map.containsKey(requiredKey) ||
-                        map.get(requiredKey) == null ||
-                        String.valueOf(map.get(requiredKey)).trim().isEmpty()) {
-                    return "参数:"+requiredKey+"为空或不存在!"; // 返回缺失或为空的key
-                }
-            }
-        }
-        basicMethod.getBasicData();
-        String retValue = "-1";
-        List<Map<String, Object>> insertList = new ArrayList<Map<String, Object>>();
-        String fieldName = null;
-        String fieldValue = null;
-        Timestamp timeValue = null;
-        for (Map<String, Object> inputMap : inputList) {
-            Map<String, Object> insertMap = new HashMap<>();
-            //部分字段直接添加
-            LocalDateTime currentDate = LocalDateTime.now();
-            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-            DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
-            String formattedDate = currentDate.format(formatter);
-            insertMap.put("id_", UUID.randomUUID().toString().replace("-", ""));
-            String userInfo = basicMethod.getUserInfoByName(String.valueOf(inputMap.get("CreateUser")));
-            if(userInfo.contains("-1^")){
-                return userInfo.split("\\^")[1];
-            }
-            insertMap.put("shi_fou_guo_shen_", "已完成");
-            insertMap.put("bian_zhi_ren_", userInfo.split("@")[0]);
-            insertMap.put("create_by_", userInfo.split("@")[0]);
-            insertMap.put("create_time_", Timestamp.valueOf(formattedDate));
-            insertMap.put("bian_zhi_bu_men_", userInfo.split("@")[1]);
-            insertMap.put("di_dian_", userInfo.split("@")[1]);
-            for (Map.Entry<String, Object> entry : inputMap.entrySet()) {
-                fieldName = null;
-                fieldValue = null;
-                timeValue = null;
-                fieldName = fieldConnect.get(entry.getKey());
-                fieldValue = String.valueOf(entry.getValue());
-                if(fieldName!=null){
-                    String existingValue = String.valueOf(insertMap.get(fieldName)); // 获取当前值
-                    if (existingValue == "null" || existingValue.isEmpty()) {
-                        insertMap.put(fieldName, fieldValue);
-                    }
-                }
-            }
-            String registTimeStr = inputMap.get("RegistTime").toString();
-            if (registTimeStr.length() == 16) { // 格式为"yyyy-MM-dd HH:mm"
-                registTimeStr += ":00";
-            }
-            insertMap.put("bian_zhi_shi_jian", Timestamp.valueOf(registTimeStr));
-            insertList.add(insertMap);
-        }
-        log.info("ready save to: t_crbbgdjb");
-        retValue = basicMethod.saveToTable(insertList, "t_crbbgdjb");
-        return retValue;
-    }
-}

+ 0 - 179
GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/impl/LISProcess/QCMonthReport.java

@@ -1,179 +0,0 @@
-package com.jyxt.getdatabyrestful.service.impl.LISProcess;
-
-import com.jyxt.getdatabyrestful.service.impl.BasicMethod;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.sql.Timestamp;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.*;
-
-@Component
-public class QCMonthReport {
-    private static final Logger log = LoggerFactory.getLogger(QCMonthReport.class);
-
-    public static List<Map<String, Object>> userList = new ArrayList<>();
-    public static List<Map<String, Object>> posiList = new ArrayList<>();
-
-    @Autowired
-    BasicMethod basicMethod;
-
-    public static final Map<String, String> fieldConnect = new HashMap<>();
-
-    static {
-        // 静态初始化块中填充数据
-        fieldConnect.put("CreateUser", "create_by_");
-        fieldConnect.put("CreateTime", "create_time_");
-        fieldConnect.put("DeviceCode", "she_bei_ming_cheng");
-        fieldConnect.put("DeviceModel", "gui_ge_xing_hao_");
-        fieldConnect.put("ReportDate", "ri_qi_");
-
-        fieldConnect.put("TestCode", "xiang_mu_");
-        fieldConnect.put("QCMFG", "zhi_kong_pin_chan");
-        fieldConnect.put("QCName", "zhi_kong_pin_");
-        fieldConnect.put("LotNumber", "zhi_kong_pin_pi_h");
-        fieldConnect.put("LotStartTime", "pi_hao_kai_shi_sh");
-        fieldConnect.put("QCRule", "pan_duan_fa_ze_");
-        fieldConnect.put("QCUnit", "zhi_kong_tu_dan_w");
-        fieldConnect.put("QCLevel", "zhi_kong_tu_shui_");
-        fieldConnect.put("QCChartAvg", "zhi_kong_tu_jun_z");
-        fieldConnect.put("QCChartSD", "zhi_kong_tu_sd_");
-        fieldConnect.put("QCChartCV", "zhi_kong_tu_cv_");
-        fieldConnect.put("RawDataAvg", "yuan_shi_jun_zhi_");
-        fieldConnect.put("RawDataSD", "yuan_shi_sd_");
-        fieldConnect.put("RawDataCV", "yuan_shi_cv_");
-        fieldConnect.put("RawDataNum", "yuan_shi_n_");
-        fieldConnect.put("OutControlNum", "shi_kong_shu_");
-        fieldConnect.put("ControlDataAvg", "chu_jun_zhi_");
-        fieldConnect.put("ControlDataSD", "chu_sd_");
-        fieldConnect.put("ControlDataCV", "chu_cv_");
-        fieldConnect.put("AccumDataAvg", "lei_jun_zhi_");
-        fieldConnect.put("AccumDataSD", "lei_sd_");
-        fieldConnect.put("AccumDataCV", "lei_cv_");
-        fieldConnect.put("AccumDataNum", "lei_n_");
-        fieldConnect.put("AccumDataPer", "zai_kong_lv_");
-        fieldConnect.put("CVRange", "cv_kong_zhi_fan_w");
-        fieldConnect.put("pass", "shi_fou_he_ge_");
-    }
-
-
-    public String saveMonthReport(List<Map<String, Object>> inputList) {
-        basicMethod.getBasicData();
-        String retValue = "fail";
-        List<Map<String, Object>> insertList = new ArrayList<>();
-        List<Map<String, Object>> insertSubList = new ArrayList<>();
-        String fieldName;
-        String fieldValue;
-        Timestamp timeValue;
-
-        for (Map<String, Object> inputMap : inputList) {
-            Map<String, Object> insertMap = new HashMap<>();
-            // 公共字段初始化
-            LocalDateTime currentDate = LocalDateTime.now();
-            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-            String formattedDate = currentDate.format(formatter);
-            insertMap.put("id_", UUID.randomUUID().toString().replace("-", ""));
-            String userInfo = basicMethod.getUserInfoByName(String.valueOf(inputMap.get("CreateUser")));
-            if (userInfo.contains("-1^")) {
-                return userInfo.split("\\^")[1];
-            }
-            insertMap.put("shi_fou_guo_shen_", "待编制");
-            insertMap.put("bian_zhi_ren_", userInfo.split("@")[0]);
-            insertMap.put("bian_zhi_shi_jian", Timestamp.valueOf(formattedDate));
-            insertMap.put("create_by_", userInfo.split("@")[0]);
-            insertMap.put("create_time_", Timestamp.valueOf(formattedDate));
-            insertMap.put("bian_zhi_bu_men_", userInfo.split("@")[1]);
-            insertMap.put("di_dian_", userInfo.split("@")[1]);
-
-            // 遍历主表字段
-            for (Map.Entry<String, Object> entry : inputMap.entrySet()) {
-                String key = entry.getKey();
-                Object value = entry.getValue();
-
-                if ("QCTestCode".equals(key)) {
-                    // 关键修改:处理子表List结构
-                    if (value instanceof List) {
-                        List<Map<String, Object>> subList = (List<Map<String, Object>>) value;
-                        for (Map<String, Object> subMap : subList) {
-                            Map<String, Object> subInsertMap = new HashMap<>();
-                            // 子表公共字段
-                            subInsertMap.put("id_", UUID.randomUUID().toString().replace("-", ""));
-                            subInsertMap.put("shi_fou_guo_shen_", "已完成");
-                            subInsertMap.put("bian_zhi_ren_", userInfo.split("@")[0]);
-                            subInsertMap.put("bian_zhi_shi_jian", Timestamp.valueOf(formattedDate));
-                            subInsertMap.put("create_by_", userInfo.split("@")[0]);
-                            subInsertMap.put("create_time_", Timestamp.valueOf(formattedDate));
-                            subInsertMap.put("bian_zhi_bu_men_", userInfo.split("@")[1]);
-                            subInsertMap.put("di_dian_", userInfo.split("@")[1]);
-                            subInsertMap.put("parent_id_", insertMap.get("id_"));
-
-                            // 处理子表字段
-                            for (Map.Entry<String, Object> subEntry : subMap.entrySet()) {
-                                String subKey = subEntry.getKey();
-                                Object subValue = subEntry.getValue();
-                                fieldName = fieldConnect.get(subKey);
-                                if (fieldName == null) continue;
-
-                                if (!subKey.contains("Time")) {
-                                    subInsertMap.put(fieldName, String.valueOf(subValue));
-                                } else {
-                                    try {
-                                        timeValue = Timestamp.valueOf(String.valueOf(subValue));
-                                        subInsertMap.put(fieldName, timeValue);
-                                    } catch (Exception e) {
-                                        subInsertMap.put(fieldName, subValue);
-                                    }
-                                }
-                            }
-                            insertSubList.add(subInsertMap);
-//                            retValue = basicMethod.saveToTable(insertSubList, "t_dlxmsnzkyfxzb");
-                            // 打印子表数据(测试用)
-                            StringBuilder sb = new StringBuilder();
-                            for (Map.Entry<String, Object> subEntry : subInsertMap.entrySet()) {
-                                sb.append(subEntry.getKey()).append(":")
-                                        .append(String.valueOf(subEntry.getValue())).append(",");
-                            }
-                            System.out.println("子表:" + sb);
-                        }
-                        retValue = "success"; // 子表处理成功标志
-                    }
-                } else {
-                    // 主表字段处理(保持原逻辑)
-                    fieldName = fieldConnect.get(key);
-                    if (fieldName == null) continue;
-
-                    if (!key.contains("Time")) {
-                        fieldValue = String.valueOf(value);
-                        String existingValue = String.valueOf(insertMap.get(fieldName)); // 获取当前值
-                        if (existingValue == null || existingValue.isEmpty()) {
-                            insertMap.put(fieldName, fieldValue);
-                        }
-                    } else {
-                        try {
-                            timeValue = Timestamp.valueOf(String.valueOf(value));
-                            insertMap.put(fieldName, timeValue);
-                        } catch (Exception e) {
-                            insertMap.put(fieldName, value);
-                        }
-                    }
-                }
-            }
-            if ("success".equals(retValue)) {
-                insertList.add(insertMap);
-//                retValue = basicMethod.saveToTable(insertList, "t_dlxmsnzkyfx");
-                // 打印主表数据(测试用)
-                StringBuilder sb2 = new StringBuilder();
-                for (Map.Entry<String, Object> entry : insertMap.entrySet()) {
-                    sb2.append(entry.getKey()).append(":")
-                            .append(String.valueOf(entry.getValue())).append(",");
-                }
-                System.out.println("主表:" + sb2);
-            }
-        }
-        return retValue;
-    }
-
-}

+ 0 - 114
GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/impl/LISProcess/RerunSampleRecord.java

@@ -1,114 +0,0 @@
-package com.jyxt.getdatabyrestful.service.impl.LISProcess;
-
-import com.jyxt.getdatabyrestful.service.impl.BasicMethod;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.sql.Timestamp;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.*;
-
-@Component
-public class RerunSampleRecord {
-
-    private static final Logger log = LoggerFactory.getLogger(RerunSampleRecord.class);
-
-    @Autowired
-    BasicMethod basicMethod;
-
-    public static final Map<String, String> fieldConnect = new HashMap<>();
-
-    static {
-        // 静态初始化块中填充数据
-        fieldConnect.put("CreateUser", "create_by_");
-        fieldConnect.put("CreateTime", "create_time_");
-//        fieldConnect.put("DeviceCode", "gui_ge_xing_hao_");
-        fieldConnect.put("SampleCode", "biao_ben_bian_hao");
-        fieldConnect.put("TestCode", "xiang_mu_id_");
-        fieldConnect.put("TestCodeName", "fu_jian_xiang_mu_");
-//        fieldConnect.put("TestCodeName", "fu_jian_xiang_mu_");
-        fieldConnect.put("InitialResult", "ce_ding_zhi_chu_j");
-        fieldConnect.put("RerunResult", "ce_ding_zhi_fu_ji");
-        fieldConnect.put("ReportResult", "bao_gao_zhi_");
-        fieldConnect.put("Auditer", "jian_yan_zhe_");
-        fieldConnect.put("ReportTime", "bao_gao_shi_jian_");
-        fieldConnect.put("RerunMethodNote", "bei_zhu_fu_jian_f");
-        fieldConnect.put("PatName", "xing_ming_");
-        fieldConnect.put("RerunMethod", "fu_jian_fang_shi_");
-        fieldConnect.put("Unit", "dan_wei_");
-    }
-
-    public String saveRerunSample(List<Map<String, Object>> inputList) {
-        // 新增校验逻辑:检查必填字段
-        if (inputList == null) {
-            return "入参为空!";
-        }
-        for (Map<String, Object> map : inputList) {
-            for (String requiredKey : fieldConnect.keySet()) {
-                // 检查键是否存在且值非空
-                if (!map.containsKey(requiredKey) ||
-                        map.get(requiredKey) == null ||
-                        String.valueOf(map.get(requiredKey)).trim().isEmpty()) {
-                    return "参数:"+requiredKey+"为空或不存在!"; // 返回缺失或为空的key
-                }
-            }
-        }
-        basicMethod.getBasicData();
-        String retValue = "-1";
-        List<Map<String, Object>> insertList = new ArrayList<Map<String, Object>>();
-        String fieldName = null;
-        String fieldValue = null;
-        Timestamp timeValue = null;
-        for (Map<String, Object> inputMap : inputList) {
-            Map<String, Object> insertMap = new HashMap<>();
-            //部分字段直接添加
-            insertMap.put("id_", UUID.randomUUID().toString().replace("-", ""));
-            String userInfo = basicMethod.getUserInfoByName(String.valueOf(inputMap.get("CreateUser")));
-            if(userInfo.contains("-1^")){
-                return userInfo.split("\\^")[1];
-            }
-            insertMap.put("shi_fou_guo_shen_", "已完成");
-            LocalDateTime currentDateTime = LocalDateTime.now();
-            DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-            String formattedDateTime = currentDateTime.format(formatter2);
-            insertMap.put("bian_zhi_ren_", userInfo.split("@")[0]);
-            insertMap.put("bian_zhi_shi_jian", Timestamp.valueOf(String.valueOf(inputMap.get("CreateTime"))));
-            insertMap.put("create_by_", userInfo.split("@")[0]);
-            insertMap.put("create_time_", Timestamp.valueOf(String.valueOf(formattedDateTime)));
-            insertMap.put("bian_zhi_bu_men_", userInfo.split("@")[1]);
-            String jian_yan_yuan_ = basicMethod.getUserInfoByName(String.valueOf(inputMap.get("Auditer")));
-            if(jian_yan_yuan_.contains("-1^")){
-                return jian_yan_yuan_.split("\\^")[1];
-            }
-            insertMap.put("jian_yan_yuan_", jian_yan_yuan_.split("@")[0]);
-            insertMap.put("di_dian_", userInfo.split("@")[1]);
-            insertMap.put("bu_men_", userInfo.split("@")[2]);
-            LocalDate currentDate = LocalDate.now();
-            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-            String formattedDate = currentDate.format(formatter);
-            insertMap.put("ri_qi_", formattedDate);
-            insertMap.put("bao_gao_shi_jian_", inputMap.get("ReportTime"));
-            for (Map.Entry<String, Object> entry : inputMap.entrySet()) {
-                fieldName = null;
-                fieldValue = null;
-                timeValue = null;
-                fieldName = fieldConnect.get(entry.getKey());
-                if (!entry.getKey().contains("Time")) {
-                    fieldValue = String.valueOf(entry.getValue());
-                    if(fieldName!=null){
-                        insertMap.put(fieldName, String.valueOf(fieldValue));
-                    }
-                }
-            }
-            insertList.add(insertMap);
-        }
-        log.info("ready save to: t_fjbbjlb");
-        retValue = basicMethod.saveToTable(insertList, "t_fjbbjlb");
-        return retValue;
-    }
-
-}

+ 0 - 140
GetDataByRESTful/src/main/java/com/jyxt/getdatabyrestful/service/impl/QualityIndicator/QualityIndicator.java

@@ -1,140 +0,0 @@
-package com.jyxt.getdatabyrestful.service.impl.QualityIndicator;
-
-import com.jyxt.getdatabyrestful.service.impl.BasicMethod;
-import com.jyxt.getdatabyrestful.service.impl.LISProcess.QCMonthReport;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.sql.Timestamp;
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.*;
-
-@Component
-public class QualityIndicator {
-
-    private static final Logger log = LoggerFactory.getLogger(QualityIndicator.class);
-
-    @Autowired
-    BasicMethod basicMethod;
-
-    public String getQualityIndicatorItem() {
-        String retVal = null;
-        List<Map<String, Object>> qualityIndicatorList = basicMethod.getQualityIndicatorItem();
-        if (qualityIndicatorList == null) return "[]";
-        StringBuilder sbRet = new StringBuilder();
-        sbRet.append("[");
-        for (Map<String, Object> qualityIndicator : qualityIndicatorList) {
-            sbRet.append("{");
-            int entryCount = 0;
-            for (Map.Entry<String, Object> entry : qualityIndicator.entrySet()) {
-                entryCount++;
-                sbRet.append("\"").append(entry.getKey()).append("\":\"")
-                        .append(entry.getValue()).append("\"");
-                if (entryCount < qualityIndicator.size()) {
-                    sbRet.append(",");
-                }
-            }
-            sbRet.append("},");  // 注意这里的逗号分隔对象
-        }
-        // 移除最后一个多余的逗号
-        if (sbRet.charAt(sbRet.length() - 1) == ',') {
-            sbRet.deleteCharAt(sbRet.length() - 1);
-        }
-        sbRet.append("]");
-        retVal = String.valueOf(sbRet);
-        return retVal;
-    }
-
-    public String getUndoQualityIndicatorItem(){
-        String retVal = null;
-        List<Map<String, Object>> undoQualityIndicatorList =  getUndoQualityIndicatorList();
-        StringBuilder sbRet = new StringBuilder();
-        sbRet.append("[");
-        for (Map<String, Object> qualityIndicator : undoQualityIndicatorList) {
-            sbRet.append("{");
-            int entryCount = 0;
-            for (Map.Entry<String, Object> entry : qualityIndicator.entrySet()) {
-                entryCount++;
-                sbRet.append("\"").append(entry.getKey()).append("\":\"")
-                        .append(entry.getValue()).append("\"");
-                if (entryCount < qualityIndicator.size()) {
-                    sbRet.append(",");
-                }
-            }
-            sbRet.append("},");  // 注意这里的逗号分隔对象
-        }
-        // 移除最后一个多余的逗号
-        if (sbRet.charAt(sbRet.length() - 1) == ',') {
-            sbRet.deleteCharAt(sbRet.length() - 1);
-        }
-        sbRet.append("]");
-        retVal = String.valueOf(sbRet);
-        return retVal;
-    }
-
-    public List<Map<String, Object>> getUndoQualityIndicatorList() {
-        List<Map<String, Object>> undoQualityIndicatorList = new ArrayList<>();
-        List<Map<String, Object>> qualityIndicatorList = basicMethod.getQualityIndicatorItem();
-        List<Map<String, Object>> allUndoQualityIndicatorList = basicMethod.getUndoQualityIndicatorItem();
-        // 1. 构建qualityIndicatorList的Target值集合(去重)
-        Set<Object> targetSet = new HashSet<>();
-        for (Map<String, Object> map : qualityIndicatorList) {
-            if (map.containsKey("Target") && map.get("Target") != null) {
-                targetSet.add(map.get("Target"));
-            }
-        }
-        // 2. 筛选allQualityIndicatorList中匹配的记录
-        for (Map<String, Object> indicator : allUndoQualityIndicatorList) {
-            String targetValue = indicator.get("Target").toString();
-            if (targetValue != null && targetSet.contains(targetValue)) {
-                undoQualityIndicatorList.add(indicator);
-            }
-        }
-        return undoQualityIndicatorList;
-    }
-
-    public String saveUndoQualityIndicator(List<Map<String, Object>> QualityIndicatorList){
-        String retVal = "fail";
-        List<Map<String, Object>> undoQualityIndicatorList =  getUndoQualityIndicatorList();
-        List<Map<String, Object>> updateList = new ArrayList<Map<String, Object>>();
-        LocalDateTime currentDate = LocalDateTime.now();
-        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-        String formattedDate = currentDate.format(formatter);
-        for (Map<String, Object> qualityIndicator : QualityIndicatorList) {
-            String targetValue = qualityIndicator.get("Target").toString();
-            String StatDate = qualityIndicator.get("StatDate").toString();
-            for (Map<String, Object> undoMap : undoQualityIndicatorList) {
-                String undoTarget = undoMap.get("Target").toString();
-                String undoDate = undoMap.get("StatDate").toString();
-                if (targetValue.equals(undoTarget) && StatDate.equals(undoDate)) {
-                    // 创建更新数据Map(不包含条件字段)
-                    Map<String, Object> updateData = new HashMap<>();
-                    Map<String, Object> conditionData = new HashMap<>();
-                    updateData.put("shi_ji_shu_zhi_", qualityIndicator.get("Result"));
-                    updateData.put("fen_zi_", qualityIndicator.get("Numerator"));
-                    updateData.put("fen_mu_", qualityIndicator.get("Denominator"));
-                    updateData.put("da_biao_qing_kuan", qualityIndicator.get("Pass"));
-                    updateData.put("zhuang_tai_", "已完成");
-                    updateData.put("update_time_", Timestamp.valueOf(formattedDate));
-                    updateData.put("bei_zhu_2_", "自动导入");
-                    conditionData.put("zhi_liang_zhi_bia", targetValue);
-                    conditionData.put("bian_zhi_shi_jian", StatDate);
-                    // 立即执行更新(使用当前的条件值)
-                    retVal = basicMethod.updateToTable(conditionData, updateData, "t_zlzbpjzb");
-                    // 遇到失败立即返回
-                    if (!"success".equals(retVal)) {
-                        return "fail";
-                    }
-                    break; // 找到匹配后跳出内层循环
-                }
-            }
-
-
-        }
-
-        return retVal;
-    }
-}

+ 8 - 32
GetDataByRESTful/src/main/resources/application.properties

@@ -1,11 +1,9 @@
 spring.application.name=GetDataByRESTful
 #spring.datasource.jdbc-url = jdbc:mysql://demo2.local:3306/klims-ibps3?characterEncoding=utf8&useSSL=false
-spring.datasource.jdbc-url = jdbc:mysql://192.168.2.212:3306/klims-ibps3?characterEncoding=utf8&useSSL=false
+spring.datasource.jdbc-url = jdbc:mysql://192.168.2.164:3306/klims-ibps3?characterEncoding=utf8&useSSL=false
 spring.datasource.username = root
 spring.datasource.password = test001
 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
-
-logging.file.name=logs/GetDataByRESTful.log
 # level:TRACE < DEBUG < INFO < WARN < ERROR < FATAL
 logging.level.root=INFO
 server.servlet.context-path=/jyxt
@@ -14,36 +12,14 @@ springdoc.api-docs.description=JYXT API Description
 #??API:http://localhost:8080/jyxt/swagger-ui/index.html
 springdoc.swagger-ui.path=/swagger-ui.html
 # ??Swagger UI????????
-springdoc.swagger-ui.enabled=true
+springdoc.swagger-ui.enabled=false
 server.port=8080
 #1 or 0,0 means only output logs,1 means insert
-config.insertMode=0
 UrlAddr=http://coolaf.com/tool
 api.resources.path=/ibps/platform/v3/auth/resources/getDefaultResources
-#??????(1 enable,0 disable)
-#????,?????????????
-interface.test=1
-#-------------????????------------------
-interface.LISProcess=1
-#??????
-interface.RerunSampleRecord=1
-#???????
-interface.IncrrectLISReport=1
-#????????????
-interface.CriticalReport=1
-#????????
-interface.OvertimeReport=1
-#???????
-interface.PostiveReport=1
-#???????????
-interface.QCMonthReport=1
-#-------------??????------------------
-interface.QualityIndicator=1
-#??????????
-interface.getQualityIndicatorItem=1
-#???????????
-interface.getUndoQualityIndicatorItem=1
-#???????????
-interface.saveUndoQualityIndicator=1
-#-------------????????------------------
-interface.EnvirMonitor=0
+loopMin=5000
+reagentInPath=/api/Ic_general/InsertGeneral
+reagentOutPath=/api/Ic_materialout/InsertMaterialout
+app.log.path=/src/logs/getDataByRESTful
+app.log.max-history=30
+testMode=false

+ 50 - 0
GetDataByRESTful/src/main/resources/logback-spring.xml

@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+    <!-- ========== 从 application.properties 读取配置 ========== -->
+    <!-- source 对应 properties 中的 key,defaultValue 为未配置时的兜底值 -->
+    <springProperty scope="context" name="LOG_PATH"
+                    source="app.log.path"
+                    defaultValue="/src/getDataByRESTful/log"/>
+    <springProperty scope="context" name="MAX_HISTORY"
+                    source="app.log.max-history"
+                    defaultValue="30"/>
+    <!-- ========== 日志格式与文件名常量 ========== -->
+    <property name="LOG_FILE_NAME" value="application"/>
+    <property name="TOTAL_SIZE_CAP" value="5GB"/>
+    <property name="LOG_PATTERN"
+              value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"/>
+    <!-- ========== 控制台输出 ========== -->
+    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>${LOG_PATTERN}</pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+    </appender>
+    <!-- ========== 文件输出:按天滚动 + 自动清理 ========== -->
+    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <!-- 当前活跃日志文件 -->
+        <file>${LOG_PATH}/${LOG_FILE_NAME}.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 按天生成归档文件,自动 gzip 压缩 -->
+            <fileNamePattern>${LOG_PATH}/${LOG_FILE_NAME}-%d{yyyy-MM-dd}.log</fileNamePattern>
+            <!-- 保留天数,值来自 application.properties -->
+            <maxHistory>${MAX_HISTORY}</maxHistory>
+            <!-- 所有归档日志总大小上限,超出优先删除最旧文件 -->
+            <totalSizeCap>${TOTAL_SIZE_CAP}</totalSizeCap>
+            <!-- ✅ 应用启动时立即检查并清理过期日志 -->
+            <cleanHistoryOnStart>true</cleanHistoryOnStart>
+        </rollingPolicy>
+
+        <encoder>
+            <pattern>${LOG_PATTERN}</pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+    </appender>
+
+    <!-- ========== Root Logger ========== -->
+    <root level="INFO">
+        <appender-ref ref="CONSOLE"/>
+        <appender-ref ref="FILE"/>
+    </root>
+
+</configuration>