From c00a5c22a3eacb6319a82d3ddabbde226f81a572 Mon Sep 17 00:00:00 2001
From: zhaowenxuan <chacca165@163.com>
Date: 星期六, 15 二月 2025 20:41:50 +0800
Subject: [PATCH] 20250215

---
 src/main/java/com/example/service/shanxiqin/xian/MeiJiHisService.java                |    8 ++++++--
 src/main/java/com/example/service/shanxiqin/xian/MeiJiLisService.java                |   14 +++++++++-----
 src/main/java/com/example/service/shanxiqin/weinan/PbkwyyHisService.java             |   10 +++++++---
 src/main/java/com/example/utils/HttpClientUtils.java                                 |   10 ++++++++--
 src/main/java/com/example/service/gansu/pingliang/JingChuanXianRenMinHisService.java |    4 +++-
 5 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/src/main/java/com/example/service/gansu/pingliang/JingChuanXianRenMinHisService.java b/src/main/java/com/example/service/gansu/pingliang/JingChuanXianRenMinHisService.java
index 3a5dfd1..0525025 100644
--- a/src/main/java/com/example/service/gansu/pingliang/JingChuanXianRenMinHisService.java
+++ b/src/main/java/com/example/service/gansu/pingliang/JingChuanXianRenMinHisService.java
@@ -182,7 +182,9 @@
     public void syncDict(String hospName) {
         HashMap<String, Object> map = new HashMap<>();
         map.put("hosp","shanxiqinxamjyy");
-        String post = HttpClientUtils.sendPost(TJ_URL + "/callBack/getZdList", map);
+        HashMap<String, Object> headers = new HashMap<>();
+        headers.put("hospId","gspljcxyy");
+        String post = HttpClientUtils.sendPost(TJ_URL + "/callBack/getZdList", map,headers);
         JSONArray jsonArray = JSONUtil.parseObj(post).getJSONArray("data");
         if (jsonArray != null && !jsonArray.isEmpty()) {
             List<HisSyncDict> list = jsonArray.toList(HisSyncDict.class);
diff --git a/src/main/java/com/example/service/shanxiqin/weinan/PbkwyyHisService.java b/src/main/java/com/example/service/shanxiqin/weinan/PbkwyyHisService.java
index e8deef4..351be76 100644
--- a/src/main/java/com/example/service/shanxiqin/weinan/PbkwyyHisService.java
+++ b/src/main/java/com/example/service/shanxiqin/weinan/PbkwyyHisService.java
@@ -50,7 +50,7 @@
         this.applicationContext = applicationContext;
         this.configValue = configValue;
         HIS_URL = configValue.getConfigValue("ShanXi_Qin_WeiNan_Pbkwyy.his_api_url") + ":" + configValue.getConfigValue("ShanXi_Qin_WeiNan_Pbkwyy.his_api_port") + configValue.getConfigValue("ShanXi_Qin_WeiNan_Pbkwyy.hisapiappend");
-        TJ_URL = configValue.getConfigValue("ShanXi_Qin_WeiNan_Pbkwyy.tjUrl");
+        TJ_URL = configValue.getConfigValue("tjUrl");
         CZY = configValue.getConfigValue("ShanXi_Qin_WeiNan_Pbkwyy.czy");
     }
 
@@ -406,7 +406,9 @@
         map.put ("yeWuLx",string);
         // 鍙傛暟绫诲瀷鍖哄垎
         map.put("type","1");
-        String post = HttpClientUtils.sendPost(TJ_URL + "/callBack/pushZhiFuMsg", map);
+        HashMap<String, Object> headers = new HashMap<>();
+        headers.put("hospId","pbkwyy");
+        String post = HttpClientUtils.sendPost(TJ_URL + "/callBack/pushZhiFuMsg", map,headers);
         JSONObject jsonObject = JSONUtil.parseObj(post);
         JSONObject obj = JSONUtil.createObj();
         if (jsonObject.getStr("code").equals("200")) {
@@ -535,7 +537,9 @@
     public void syncDict(String hospName) {
         HashMap<String, Object> map = new HashMap<>();
         map.put("hosp","shanxiqinpbkwyy");
-        String post = HttpClientUtils.sendPost(TJ_URL + "/callBack/getZdList", map);
+        HashMap<String, Object> headers = new HashMap<>();
+        headers.put("hospId","pbkwyy");
+        String post = HttpClientUtils.sendPost(TJ_URL + "/callBack/getZdList", map,headers);
         JSONArray jsonArray = JSONUtil.parseObj(post).getJSONArray("data");
         if (jsonArray != null && !jsonArray.isEmpty()) {
             List<HisSyncDict> list = jsonArray.toList(HisSyncDict.class);
diff --git a/src/main/java/com/example/service/shanxiqin/xian/MeiJiHisService.java b/src/main/java/com/example/service/shanxiqin/xian/MeiJiHisService.java
index 4edfead..5609acb 100644
--- a/src/main/java/com/example/service/shanxiqin/xian/MeiJiHisService.java
+++ b/src/main/java/com/example/service/shanxiqin/xian/MeiJiHisService.java
@@ -408,7 +408,9 @@
         map.put ("yeWuLx",string);
         // 鍙傛暟绫诲瀷鍖哄垎
         map.put("type","1");
-        String post = HttpClientUtils.sendPost(TJ_URL + "/callBack/pushZhiFuMsg", map);
+        HashMap<String, Object> headers = new HashMap<>();
+        headers.put("hospId","xamjyy");
+        String post = HttpClientUtils.sendPost(TJ_URL + "/callBack/pushZhiFuMsg", map,headers);
         JSONObject jsonObject = JSONUtil.parseObj(post);
         JSONObject obj = JSONUtil.createObj();
         if (jsonObject.getStr("code").equals("200")) {
@@ -537,7 +539,9 @@
     public void syncDict(String hospName) {
         HashMap<String, Object> map = new HashMap<>();
         map.put("hosp","shanxiqinxamjyy");
-        String post = HttpClientUtils.sendPost(TJ_URL + "/callBack/getZdList", map);
+        HashMap<String, Object> headers = new HashMap<>();
+        headers.put("hospId","xamjyy");
+        String post = HttpClientUtils.sendPost(TJ_URL + "/callBack/getZdList", map,headers);
         JSONArray jsonArray = JSONUtil.parseObj(post).getJSONArray("data");
         if (jsonArray != null && !jsonArray.isEmpty()) {
             List<HisSyncDict> list = jsonArray.toList(HisSyncDict.class);
diff --git a/src/main/java/com/example/service/shanxiqin/xian/MeiJiLisService.java b/src/main/java/com/example/service/shanxiqin/xian/MeiJiLisService.java
index 7caffaf..8a5fc0a 100644
--- a/src/main/java/com/example/service/shanxiqin/xian/MeiJiLisService.java
+++ b/src/main/java/com/example/service/shanxiqin/xian/MeiJiLisService.java
@@ -115,7 +115,7 @@
         }
         hashMap.put("OderInfoList",orderInfoList);
         log.info("鐢宠鍗� ->{}",JSONUtil.toJsonStr(hashMap));
-        String post = sendPost(LIS_URL + "/lisinterface" + "/HisApplyList", hashMap);
+        String post = sendPost(LIS_URL + "/lisinterface" + "/HisApplyList", hashMap,new HashMap<>());
         JSONObject entries = JSONUtil.parseObj(post);
         if (entries.getStr("MsgCode").equals("0"))
             return AjaxResult.success();
@@ -126,7 +126,9 @@
     public String getXmlList(Map<String, Object> map) {
         Map<String, Object> request = (Map<String, Object>) map.get("Request");
         String hospitalId = request.get("HospitalId").toString();
-        String json = sendPost(TJ_URL + "/callBack/getZdList", new HashMap<>());
+        HashMap<String, Object> headers = new HashMap<>();
+        headers.put("hospId","xamjyy");
+        String json = sendPost(TJ_URL + "/callBack/getZdList", new HashMap<>(),headers);
         JSONObject entries = JSONUtil.parseObj(json);
         JSONObject result = JSONUtil.createObj();
         if (entries.getStr("code").equals("200")){
@@ -200,7 +202,9 @@
         hashMap.put("keys",keys);
         hashMap.put("czy",personid);
         hashMap.put("hospid",hospitalid);
-        String post = sendPost(TJ_URL + "/callBack/lisRevoke", hashMap);
+        HashMap<String, Object> headers = new HashMap<>();
+        headers.put("hospId","xamjyy");
+        String post = sendPost(TJ_URL + "/callBack/lisRevoke", hashMap,headers);
         JSONObject entries = JSONUtil.parseObj(post);
         JSONObject object = JSONUtil.createObj();
         if (entries.getStr("code").equals("200")){
@@ -212,7 +216,7 @@
         }
     }
 
-    private String sendPost(String url, Map<String, Object> hashMap){
-        return HttpClientUtils.sendPost(url, hashMap);
+    private String sendPost(String url, Map<String, Object> hashMap,Map<String ,Object> headers){
+        return HttpClientUtils.sendPost(url, hashMap,headers);
     }
 }
diff --git a/src/main/java/com/example/utils/HttpClientUtils.java b/src/main/java/com/example/utils/HttpClientUtils.java
index 5ee483f..6cb36c2 100644
--- a/src/main/java/com/example/utils/HttpClientUtils.java
+++ b/src/main/java/com/example/utils/HttpClientUtils.java
@@ -97,7 +97,7 @@
     }
 
 
-    public static String sendPost(String httpUrl, Map<String, Object> maps) {
+    public static String sendPost(String httpUrl, Map<String, Object> maps,Map<String ,Object> headers) {
 
         try {
             // 1. 鍒涘缓 URL 瀵硅薄
@@ -108,11 +108,17 @@
             connection.setRequestMethod("POST");
             // 4. 璁剧疆 Content-Type 澶撮儴瀛楁
             connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8");
+            if (headers != null && !headers.isEmpty()){
+                for (Map.Entry<String, Object> entry : headers.entrySet()) {
+                    connection.setRequestProperty(entry.getKey(), entry.getValue().toString());
+                }
+            }
             // 6. 鍚戞湇鍔″櫒鍙戦�佹暟鎹�
             String requestBody = JSONUtil.toJsonStr(maps);
             log.info(httpUrl+"鍏ュ弬:   "+requestBody);
+            log.info("璇锋眰澶� ->{}",JSONUtil.toJsonStr(headers));
 //            String requestBody1 = maps.toString();
-            byte[] postData = requestBody.getBytes("UTF-8");
+            byte[] postData = requestBody.getBytes(StandardCharsets.UTF_8);
             connection.setDoOutput(true);
             try (OutputStream outputStream = connection.getOutputStream()) {
                 outputStream.write(postData);

--
Gitblit v1.8.0