From 6b73ef6f82fa10747c29bdec04cb43d0f7e91598 Mon Sep 17 00:00:00 2001
From: zjh <1084500556@qq.com>
Date: 星期三, 05 三月 2025 16:43:55 +0800
Subject: [PATCH] zjh20250305

---
 ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiGetMethodService.java |   70 ++++++++++++++++++-----------------
 1 files changed, 36 insertions(+), 34 deletions(-)

diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiGetMethodService.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiGetMethodService.java
index 6ead066..9aa67d2 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiGetMethodService.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiGetMethodService.java
@@ -217,36 +217,42 @@
 
 //    @Transactional
     public AjaxResult getHISDataNew(String type, Map<String, Object> params){
-        LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
-        lambdaQueryWrapper.eq(HisApiConfig::getApiMethod, type);
-        HisApiConfig hisApiConfig = hisApiConfigService.getOne(lambdaQueryWrapper);
-        String responseJson = HttpClientUtils.sendPost(HIS_URL + hisApiConfig.getApiUrl(), params);
-        Integer isResponse = hisApiConfig.getIsResponse();
-        JSONObject response = null;
-        if (isResponse == 1) {
-            response = JSONUtil.parseObj(responseJson).getJSONObject("Response");
-        } else{
-            response = JSONUtil.parseObj(responseJson);
-        }
-        if (response.getStr(hisApiConfig.getResultCodeKey()).equals("0")) {
-            AjaxResult ajaxResult = AjaxResult.success();
-            JSONArray resultData = response.getJSONArray(hisApiConfig.getResultDataKey());
-            List<Map<String, String>> list = new ArrayList<>();
-            for (Object resultDatum : resultData) {
-                JSONObject object = (JSONObject) resultDatum;
-                ajaxResult = save(object, type,hisApiConfig,JSONUtil.toJsonStr(params));
-                Map<String, String> map = new HashMap<>();
-                for (String key : object.keySet()) {
-                    String defaultVal = object.get(key).toString();
-                    String val = defaultVal.trim().replaceAll("\\s+", "");
-                    map.put(key, val);
-                }
-                list.add(map);
+        try {
+            LambdaQueryWrapper<HisApiConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+            lambdaQueryWrapper.eq(HisApiConfig::getApiMethod, type);
+            HisApiConfig hisApiConfig = hisApiConfigService.getOne(lambdaQueryWrapper);
+            String responseJson = HttpClientUtils.sendPost(HIS_URL + hisApiConfig.getApiUrl(), params);
+            Integer isResponse = hisApiConfig.getIsResponse();
+            JSONObject response = null;
+            if (isResponse == 1) {
+                response = JSONUtil.parseObj(responseJson).getJSONObject("Response");
+            } else{
+                response = JSONUtil.parseObj(responseJson);
             }
-            ajaxResult.put("data", list);
-            return ajaxResult;
-        } else {
-            return AjaxResult.error().put("result", JSONUtil.parseObj(responseJson));
+            if (response.getStr(hisApiConfig.getResultCodeKey()).equals("0")) {
+                AjaxResult ajaxResult = AjaxResult.success();
+                JSONArray resultData = response.getJSONArray(hisApiConfig.getResultDataKey());
+                List<Map<String, String>> list = new ArrayList<>();
+                for (Object resultDatum : resultData) {
+                    JSONObject object = (JSONObject) resultDatum;
+                    ajaxResult = save(object, type,hisApiConfig,JSONUtil.toJsonStr(params));
+                    Map<String, String> map = new HashMap<>();
+                    for (String key : object.keySet()) {
+                        String defaultVal = object.get(key).toString();
+                        String val = defaultVal.trim().replaceAll("\\s+", "");
+                        map.put(key, val);
+                    }
+                    list.add(map);
+                }
+                ajaxResult.put("data", list);
+                return ajaxResult;
+            } else {
+                return AjaxResult.error().put("result", JSONUtil.parseObj(responseJson));
+            }
+        } catch (Exception e) {
+//            throw new RuntimeException(e);
+            log.error(String.valueOf(e));
+            return AjaxResult.error();
         }
     }
 
@@ -275,7 +281,6 @@
                 responseJson = HttpClientUtils.sendPost(LIS_URL + apiConfig.getApiUrl(), params);
                 break;
         }
-        log.info("璇锋眰杩斿洖鍊�1 ->{}",responseJson);
         Integer isResponse = apiConfig.getIsResponse();
         JSONObject response = null;
         if (isResponse == 1) {
@@ -287,10 +292,8 @@
             AjaxResult ajaxResult = AjaxResult.success();
             if (response.getStr(apiConfig.getResultDataKey()) != null && StrUtil.isNotBlank(response.getStr(apiConfig.getResultDataKey()))){
                 JSONArray resultData = response.getJSONArray(apiConfig.getResultDataKey());
-                log.info("璇锋眰杩斿洖鍊�2 ->{}",JSONUtil.toJsonStr(resultData));
                 List<Map<String, String>> list = new ArrayList<>();
                 for (Object resultDatum : resultData) {
-                    log.info("璇锋眰杩斿洖鍊�3 ->{}",JSONUtil.toJsonStr(resultDatum));
                     JSONObject object = (JSONObject) resultDatum;
                     ajaxResult = save(object, type,apiConfig,JSONUtil.toJsonStr(params));
                     Map<String, String> map = new HashMap<>();
@@ -324,7 +327,6 @@
         if (code.equals("lis") || code.equals("pacs"))
             tabName = ((ApiConfig)hisApiConfig).getTabName();
         else tabName = ((HisApiConfig) hisApiConfig).getTabName();
-        log.info("save鏂规硶 ->{}", tabName);
         Connection connection = getConnection();
         Boolean isExists = tabIsExists(connection, tabName);
         if (null == isExists)
@@ -458,7 +460,7 @@
      * @throws SQLException
      */
     @Transactional
-    private void insertDataNew(Connection connection, JSONObject jsonObject,Object hisApiConfig,String paramsJson,String code) throws SQLException {
+    public void insertDataNew(Connection connection, JSONObject jsonObject, Object hisApiConfig, String paramsJson, String code) throws SQLException {
         String tabName = "";
         List<String> primaryKesList;
         if (code.equals("lis") || code.equals("pacs")) {

--
Gitblit v1.8.0