From c5286d60680e88a22fbe391385ad35cadb9ac874 Mon Sep 17 00:00:00 2001
From: zhaowenxuan <chacca165@163.com>
Date: 星期五, 18 四月 2025 19:38:37 +0800
Subject: [PATCH] 修改套餐id

---
 ltkj-admin/src/main/java/com/ltkj/web/controller/his/HisApiGetMethodService.java |   82 ++++++++++++++++++++++------------------
 1 files changed, 45 insertions(+), 37 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 f275a08..687021a 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
@@ -91,7 +91,7 @@
         try {
             Class.forName("com.mysql.cj.jdbc.Driver");
         } catch (ClassNotFoundException e) {
-            e.printStackTrace();
+            log.error(String.valueOf(e),e.getMessage());
         }
 //        try {
 //            InputStreamReader reader = new InputStreamReader(new FileInputStream(url), StandardCharsets.UTF_8);
@@ -217,36 +217,43 @@
 
 //    @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));
+//                    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),e.getMessage());
+            return AjaxResult.error();
         }
     }
 
@@ -329,16 +336,16 @@
             try {
                 creatTable(object, tabName, connection);
             } catch (SQLException e) {
-                e.printStackTrace();
-                return AjaxResult.error();
+                log.error(String.valueOf(e),e.getMessage());
+//                return AjaxResult.error();
             }
         }
         //鎻掑叆鏁版嵁
         try {
             operationTable(object,connection,hisApiConfig,paramsJson,code);
         } catch (SQLException e) {
-            e.printStackTrace();
-            return AjaxResult.error();
+            log.error(String.valueOf(e),e.getMessage());
+//            return AjaxResult.error();
         }finally {
             try {
                 connection.close();
@@ -454,7 +461,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")) {
@@ -474,7 +481,7 @@
             String key = entry.getKey().trim().toLowerCase();
             if (StrUtil.isBlank(defaultVal) || defaultVal.equals("null"))
                 continue;
-            String val = defaultVal.trim().replaceAll("\\s+", "");
+            String val = defaultVal.trim().replaceAll("\\s+", "").replaceAll("[^\\x00-\\x7F]", "");
             if (primaryKesList.contains(key)) {
                 deleteSqlBuilder.append(key).append(" = '").append(val).append("' and ");
             }
@@ -676,8 +683,9 @@
             statement.close();
             return next;
         } catch (SQLException throwables) {
-            throwables.printStackTrace();
+            log.error(String.valueOf(throwables),throwables.getMessage());
         }
+        log.error("鏌ヨ琛ㄦ墽琛宻ql杩斿洖涓簄ull ->{},{},{}",tabSql,DB_NAME,tableName);
         return null;
     }
 

--
Gitblit v1.8.0