From e0d4c203e4e1d59452b7ce10ea264443c6969a91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=8E=E4=BD=97?= Date: Fri, 5 Jun 2026 11:39:50 +0800 Subject: [PATCH 1/5] =?UTF-8?q?refactor:=20httpclient=204.x=20=E2=86=92=20?= =?UTF-8?q?5.x=20=E5=AE=8C=E6=95=B4=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Maven 依赖: - org.apache.httpcomponents:httpclient:4.5.14 - → org.apache.httpcomponents.client5:httpclient5:5.6.1 API 迁移 (14 文件): - org.apache.http.* → org.apache.hc.client5.http.* / org.apache.hc.core5.http.* - CloseableHttpResponse → ClassicHttpResponse - RequestConfig timeout API: 毫秒值 → TimeUnit - SSL: SSLSocketFactory → SSLConnectionSocketFactoryBuilder - DefaultHttpClient (已废弃) → HttpClients.custom() 工具类迁移: - HttpReques.java (基类) - HttpRequesPost.java (POST) - HttpRequesGet.java (GET) - HttpsClientUtil.java (HTTPS) - SSLClient.java (SSL) - CommonUtil.java (SSL 工具) 业务 Service 迁移: - YbHttpUtils.java (医保) - CrossSystemSendApplyUtil.java (跨系统) - YbEleHttpServiceImpl.java (医保电子) - EleInvoiceServiceImpl.java (电子票据) - ThreePartPayServiceImpl.java (三方支付) - GfStudentListAppServiceImpl.java (学生体检) - FoodborneAcquisitionAppServiceImpl.java (食品安全) 删除: WebClientDevWrapper.java (未使用) 验证: BUILD SUCCESS --- .../openhis-application/pom.xml | 4 +- .../FoodborneAcquisitionAppServiceImpl.java | 39 +++++++---- .../impl/GfStudentListAppServiceImpl.java | 19 +++--- .../impl/EleInvoiceServiceImpl.java | 18 ++--- .../impl/ThreePartPayServiceImpl.java | 28 ++++---- .../tencentJH/utils/httpUtil/HttpReques.java | 31 ++++----- .../utils/httpUtil/HttpRequesGet.java | 13 ++-- .../utils/httpUtil/HttpRequesPost.java | 49 +++++++------- .../utils/httpUtil/HttpsClientUtil.java | 50 +++++++------- .../tencentJH/utils/httpUtil/SSLClient.java | 57 +++++++--------- .../utils/httpUtil/WebClientDevWrapper.java | 49 -------------- .../service/impl/YbEleHttpServiceImpl.java | 21 +++--- openhis-server-new/openhis-common/pom.xml | 4 +- .../com/openhis/common/utils/CommonUtil.java | 4 +- openhis-server-new/openhis-domain/pom.xml | 4 +- .../utils/CrossSystemSendApplyUtil.java | 65 ++++++++++++++----- .../com/openhis/yb/service/YbHttpUtils.java | 21 +++--- openhis-server-new/pom.xml | 8 +-- 18 files changed, 236 insertions(+), 248 deletions(-) delete mode 100755 openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/WebClientDevWrapper.java diff --git a/openhis-server-new/openhis-application/pom.xml b/openhis-server-new/openhis-application/pom.xml index be6d31dba..a3f84fc31 100755 --- a/openhis-server-new/openhis-application/pom.xml +++ b/openhis-server-new/openhis-application/pom.xml @@ -81,8 +81,8 @@ compile - org.apache.httpcomponents - httpclient + org.apache.httpcomponents.client5 + httpclient5 diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/externalintegration/appservice/impl/FoodborneAcquisitionAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/externalintegration/appservice/impl/FoodborneAcquisitionAppServiceImpl.java index 370635328..e39c7112d 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/externalintegration/appservice/impl/FoodborneAcquisitionAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/externalintegration/appservice/impl/FoodborneAcquisitionAppServiceImpl.java @@ -12,12 +12,17 @@ import com.openhis.web.externalintegration.appservice.IFoodborneAcquisitionAppSe import com.openhis.web.externalintegration.dto.FaSimplediseaseAddNopwParam; import com.openhis.web.externalintegration.mapper.FoodborneAcquisitionAppMapper; import lombok.extern.slf4j.Slf4j; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; +import org.apache.hc.client5.http.config.RequestConfig; +import org.apache.hc.core5.http.ClassicHttpResponse; +import org.apache.hc.client5.http.classic.methods.HttpGet; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.client5.http.io.HttpClientConnectionManager; +import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder; +import org.apache.hc.client5.http.ssl.NoopHostnameVerifier; +import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder; +import org.apache.hc.core5.ssl.SSLContexts; +import org.apache.hc.core5.http.io.entity.EntityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -83,12 +88,24 @@ public class FoodborneAcquisitionAppServiceImpl implements IFoodborneAcquisition return R.fail("【食源性判断接口】未找到有效诊断"); } // 设置超时时间 - RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(5000).setConnectionRequestTimeout(3000) - .setSocketTimeout(30000).build(); + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(5000, java.util.concurrent.TimeUnit.MILLISECONDS).setConnectionRequestTimeout(3000, java.util.concurrent.TimeUnit.MILLISECONDS).setResponseTimeout(30000, java.util.concurrent.TimeUnit.MILLISECONDS).build(); // 创建无视SSL验证的HttpClient - CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig) - .setSSLSocketFactory(CommonUtil.createIgnoreSslSocketFactory()).build(); - CloseableHttpResponse response = null; + HttpClientConnectionManager connectionManager; + try { + connectionManager = PoolingHttpClientConnectionManagerBuilder.create() + .setSSLSocketFactory(SSLConnectionSocketFactoryBuilder.create() + .setSslContext(SSLContexts.custom().loadTrustMaterial(null, (chain, authType) -> true).build()) + .setHostnameVerifier(NoopHostnameVerifier.INSTANCE) + .build()) + .build(); + } catch (Exception e) { + throw new RuntimeException("Failed to create SSL connection manager", e); + } + CloseableHttpClient httpClient = HttpClients.custom() + .setDefaultRequestConfig(requestConfig) + .setConnectionManager(connectionManager) + .build(); + ClassicHttpResponse response = null; // 发起HTTP请求 try { // 对参数值进行URL编码 diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/nenu/appservice/impl/GfStudentListAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/nenu/appservice/impl/GfStudentListAppServiceImpl.java index 690f247b8..169b1ea5a 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/nenu/appservice/impl/GfStudentListAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/nenu/appservice/impl/GfStudentListAppServiceImpl.java @@ -32,13 +32,13 @@ import com.openhis.web.nenu.dto.GfStudentListImportDto; import com.openhis.web.nenu.dto.GfStudentPeisDto; import com.openhis.web.nenu.dto.PeisStudentPatientDto; import com.openhis.web.nenu.mapper.GfStudentListAppMapper; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; +import org.apache.hc.client5.http.config.RequestConfig; +import org.apache.hc.core5.http.ClassicHttpResponse; +import org.apache.hc.client5.http.classic.methods.HttpPost; +import org.apache.hc.core5.http.ContentType; +import org.apache.hc.core5.http.io.entity.StringEntity; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClients; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -576,10 +576,9 @@ public class GfStudentListAppServiceImpl implements IGfStudentListAppService { */ private boolean sendSingleBatchHttpRequest(PeisStudentPatientDto peisStudentPatientDto) { - RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(90000).setConnectionRequestTimeout(90000) - .setSocketTimeout(90000).build(); + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(90000, java.util.concurrent.TimeUnit.MILLISECONDS).setConnectionRequestTimeout(90000, java.util.concurrent.TimeUnit.MILLISECONDS).setResponseTimeout(90000, java.util.concurrent.TimeUnit.MILLISECONDS).build(); CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).build(); - CloseableHttpResponse response = null; + ClassicHttpResponse response = null; // 发送请求 try { HttpPost httpPost = new HttpPost(TenantOptionUtil.getOptionContent(TenantOptionDict.PEIS_SERVER_URL) + "/wx/auth/syncHisInfo"); diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/EleInvoiceServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/EleInvoiceServiceImpl.java index f471822c4..cdce108ae 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/EleInvoiceServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/EleInvoiceServiceImpl.java @@ -44,15 +44,15 @@ import org.apache.velocity.VelocityContext; import org.apache.velocity.app.Velocity; import org.apache.velocity.runtime.RuntimeConstants; import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader; -import org.apache.http.HttpResponse; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; +import org.apache.hc.core5.http.ClassicHttpResponse; +import org.apache.hc.client5.http.config.RequestConfig; +import org.apache.hc.core5.http.ClassicHttpResponse; +import org.apache.hc.client5.http.classic.methods.HttpPost; +import org.apache.hc.core5.http.ContentType; +import org.apache.hc.core5.http.io.entity.StringEntity; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.core5.http.io.entity.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/ThreePartPayServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/ThreePartPayServiceImpl.java index e3b867e20..a8d043e74 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/ThreePartPayServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/ThreePartPayServiceImpl.java @@ -26,15 +26,15 @@ import com.openhis.web.paymentmanage.mapper.PaymentMapper; import com.openhis.yb.dto.PaymentDetailDto; import com.openhis.yb.dto.ThreePartPayDto; import lombok.extern.slf4j.Slf4j; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; +import org.apache.hc.client5.http.config.RequestConfig; +import org.apache.hc.core5.http.ClassicHttpResponse; +import org.apache.hc.client5.http.classic.methods.HttpGet; +import org.apache.hc.client5.http.classic.methods.HttpPost; +import org.apache.hc.core5.http.ContentType; +import org.apache.hc.core5.http.io.entity.StringEntity; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.core5.http.io.entity.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -548,10 +548,9 @@ public class ThreePartPayServiceImpl implements ThreePartPayService { private String httpGet(String url) { String resultString = ""; // 创建Http请求(2025/10/13 师大会超时故此由30000-》60000) - RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(90000).setConnectionRequestTimeout(90000) - .setSocketTimeout(90000).build(); + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(90000, java.util.concurrent.TimeUnit.MILLISECONDS).setConnectionRequestTimeout(90000, java.util.concurrent.TimeUnit.MILLISECONDS).setResponseTimeout(90000, java.util.concurrent.TimeUnit.MILLISECONDS).build(); CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).build(); - CloseableHttpResponse response = null; + ClassicHttpResponse response = null; // 发送请求 try { HttpGet httpGet = new HttpGet(url); @@ -583,10 +582,9 @@ public class ThreePartPayServiceImpl implements ThreePartPayService { String resultString = ""; // 创建Http请求(2025/10/13 师大会超时故此由30000-》60000) - RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(90000).setConnectionRequestTimeout(90000) - .setSocketTimeout(90000).build(); + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(90000, java.util.concurrent.TimeUnit.MILLISECONDS).setConnectionRequestTimeout(90000, java.util.concurrent.TimeUnit.MILLISECONDS).setResponseTimeout(90000, java.util.concurrent.TimeUnit.MILLISECONDS).build(); CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).build(); - CloseableHttpResponse response = null; + ClassicHttpResponse response = null; // 发送请求 try { HttpPost httpPost = new HttpPost(url); diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/HttpReques.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/HttpReques.java index d4134e47c..56582f8be 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/HttpReques.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/HttpReques.java @@ -3,13 +3,12 @@ */ package com.openhis.web.tencentJH.utils.httpUtil; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.client.methods.HttpUriRequest; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.util.EntityUtils; +import org.apache.hc.client5.http.classic.methods.HttpUriRequestBase; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.core5.http.ClassicHttpResponse; +import org.apache.hc.core5.http.HttpEntity; +import org.apache.hc.core5.http.io.entity.EntityUtils; import java.io.IOException; import java.util.HashMap; @@ -17,28 +16,22 @@ import java.util.Map; public abstract class HttpReques { - // 创建HttpClientBuilder - private HttpClientBuilder httpClientBuilder = HttpClientBuilder.create(); // HttpClient - private CloseableHttpClient closeableHttpClient = httpClientBuilder.build(); + private CloseableHttpClient closeableHttpClient = HttpClients.createDefault(); + + protected HttpUriRequestBase httpReques; - protected HttpUriRequest httpReques; - // HttpUriRequest httpReques; @SuppressWarnings("finally") public Map executeResponse() { Map context = new HashMap<>(); try { -// closeableHttpClient= WebClientDevWrapper.wrapClient(closeableHttpClient); - // 设置请求头 - // 设置请求 - HttpResponse httpResponse = closeableHttpClient.execute(httpReques); + // 执行请求 + ClassicHttpResponse httpResponse = closeableHttpClient.executeOpen(null, httpReques, null); HttpEntity entity = httpResponse.getEntity(); // 响应状态 - int status = httpResponse.getStatusLine().getStatusCode(); + int status = httpResponse.getCode(); context.put("msg", EntityUtils.toString(entity,"utf-8")); context.put("status", status+""); - } catch (ClientProtocolException e) { - e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/HttpRequesGet.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/HttpRequesGet.java index 9a051361b..20ba64d46 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/HttpRequesGet.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/HttpRequesGet.java @@ -3,10 +3,11 @@ */ package com.openhis.web.tencentJH.utils.httpUtil; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.HttpGet; +import org.apache.hc.client5.http.classic.methods.HttpGet; +import org.apache.hc.client5.http.config.RequestConfig; import java.util.Map; +import java.util.concurrent.TimeUnit; public class HttpRequesGet extends HttpReques { @@ -29,9 +30,11 @@ public class HttpRequesGet extends HttpReques { } } HttpGet httpGet = new HttpGet(sb.toString()); - RequestConfig requestConfig = RequestConfig.custom() - .setConnectTimeout(20000).setConnectionRequestTimeout(15000) - .setSocketTimeout(20000).build(); + RequestConfig requestConfig = RequestConfig.custom() + .setConnectTimeout(20, TimeUnit.SECONDS) + .setConnectionRequestTimeout(15, TimeUnit.SECONDS) + .setResponseTimeout(20, TimeUnit.SECONDS) + .build(); httpGet.setConfig(requestConfig); if (headers != null) { diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/HttpRequesPost.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/HttpRequesPost.java index f6b69897e..f234308c4 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/HttpRequesPost.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/HttpRequesPost.java @@ -7,17 +7,18 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.alibaba.fastjson2.JSON; -import org.apache.http.NameValuePair; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.entity.UrlEncodedFormEntity; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.message.BasicNameValuePair; +import org.apache.hc.client5.http.classic.methods.HttpPost; +import org.apache.hc.client5.http.config.RequestConfig; +import org.apache.hc.core5.http.ContentType; +import org.apache.hc.core5.http.io.entity.StringEntity; +import org.apache.hc.core5.http.message.BasicNameValuePair; +import org.apache.hc.client5.http.entity.UrlEncodedFormEntity; -import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.concurrent.TimeUnit; @@ -27,11 +28,14 @@ public class HttpRequesPost extends HttpReques { public HttpRequesPost(String path, Map param, Map headers) { HttpPost httpPost = new HttpPost(path); try { - RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(20000) - .setConnectionRequestTimeout(20000).setSocketTimeout(20000).build(); + RequestConfig requestConfig = RequestConfig.custom() + .setConnectTimeout(20, TimeUnit.SECONDS) + .setConnectionRequestTimeout(20, TimeUnit.SECONDS) + .setResponseTimeout(20, TimeUnit.SECONDS) + .build(); httpPost.setConfig(requestConfig); // 创建参数队列 - List formparams = new ArrayList(); + List formparams = new ArrayList<>(); if (param != null) { for (String key : param.keySet()) { if (param.get(key) != null) { @@ -39,14 +43,14 @@ public class HttpRequesPost extends HttpReques { } } } - UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, "UTF-8"); + UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, StandardCharsets.UTF_8); httpPost.setEntity(entity); if (headers != null) { for (String key : headers.keySet()) { httpPost.addHeader(key, headers.get(key)); } } - } catch (UnsupportedEncodingException e) { + } catch (Exception e) { log.error("Exception occurred", e); } this.httpReques = httpPost; @@ -55,15 +59,16 @@ public class HttpRequesPost extends HttpReques { public HttpRequesPost(String path, Map param, Map headers, String requestType) { HttpPost httpPost = new HttpPost(path); try { - RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(5000) - .setConnectionRequestTimeout(5000).setSocketTimeout(5000).build(); + RequestConfig requestConfig = RequestConfig.custom() + .setConnectTimeout(5, TimeUnit.SECONDS) + .setConnectionRequestTimeout(5, TimeUnit.SECONDS) + .setResponseTimeout(5, TimeUnit.SECONDS) + .build(); httpPost.setConfig(requestConfig); // 创建参数队列 if ("json".equals(requestType.toLowerCase())) { // 解决中文乱码问题 - StringEntity entity = new StringEntity(JSON.toJSONString(param), "utf-8"); - entity.setContentEncoding("UTF-8"); - entity.setContentType("application/json"); + StringEntity entity = new StringEntity(JSON.toJSONString(param), ContentType.APPLICATION_JSON); httpPost.setEntity(entity); } else if("xml".equals(requestType.toLowerCase())){ StringBuffer xml=new StringBuffer(); @@ -75,14 +80,12 @@ public class HttpRequesPost extends HttpReques { } xml.append(""); // 解决中文乱码问题 - StringEntity entity = new StringEntity(xml.toString(), "utf-8"); - entity.setContentEncoding("UTF-8"); - entity.setContentType("text/xml"); + StringEntity entity = new StringEntity(xml.toString(), ContentType.TEXT_XML.withCharset(StandardCharsets.UTF_8)); log.info("----------xml:"+xml.toString()); httpPost.setEntity(entity); } else if ("".equals(requestType) || requestType == null) { - List formParams = new ArrayList(); + List formParams = new ArrayList<>(); if (param != null) { for (String key : param.keySet()) { if (param.get(key) != null) { @@ -90,7 +93,7 @@ public class HttpRequesPost extends HttpReques { } } } - UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formParams, "UTF-8"); + UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formParams, StandardCharsets.UTF_8); httpPost.setEntity(entity); } if (headers != null) { @@ -98,7 +101,7 @@ public class HttpRequesPost extends HttpReques { httpPost.addHeader(key, headers.get(key).toString()); } } - } catch (UnsupportedEncodingException e) { + } catch (Exception e) { log.error("Exception occurred", e); } this.httpReques = httpPost; diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/HttpsClientUtil.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/HttpsClientUtil.java index 4d550f656..504a73087 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/HttpsClientUtil.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/HttpsClientUtil.java @@ -1,13 +1,13 @@ package com.openhis.web.tencentJH.utils.httpUtil; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.message.BasicHeader; -import org.apache.http.util.EntityUtils; +import org.apache.hc.client5.http.classic.methods.HttpPost; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.core5.http.ClassicHttpResponse; +import org.apache.hc.core5.http.ContentType; +import org.apache.hc.core5.http.HttpEntity; +import org.apache.hc.core5.http.io.entity.EntityUtils; +import org.apache.hc.core5.http.io.entity.StringEntity; /** * @ClassName HttpsClientUtil @@ -18,27 +18,33 @@ import org.apache.http.util.EntityUtils; **/ public class HttpsClientUtil { - public static String doPost(String url,String jsonData){ - HttpClient httpClient = null; - HttpPost httpPost = null; + public static String doPost(String url, String jsonData) { + CloseableHttpClient httpClient = null; String result = null; - try{ - httpClient = new SSLClient(); - httpPost = new HttpPost(url); + try { + httpClient = SSLClient.create(); + HttpPost httpPost = new HttpPost(url); httpPost.addHeader("Content-Type", "application/json"); - StringEntity se = new StringEntity(jsonData); - se.setContentType("text/json"); - se.setContentEncoding(new BasicHeader("Content-Type", "application/json")); + StringEntity se = new StringEntity(jsonData, ContentType.APPLICATION_JSON); httpPost.setEntity(se); - HttpResponse response = httpClient.execute(httpPost); - if(response != null){ + ClassicHttpResponse response = httpClient.executeOpen(null, httpPost, null); + if (response != null) { HttpEntity resEntity = response.getEntity(); - if(resEntity != null){ - result = EntityUtils.toString(resEntity,"utf-8"); + if (resEntity != null) { + result = EntityUtils.toString(resEntity, "utf-8"); + } + response.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (httpClient != null) { + try { + httpClient.close(); + } catch (Exception e) { + e.printStackTrace(); } } - }catch (Exception e){ - e.printStackTrace(); } return result; } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/SSLClient.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/SSLClient.java index d3ea1b1ea..e1f55ccaa 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/SSLClient.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/SSLClient.java @@ -1,10 +1,12 @@ package com.openhis.web.tencentJH.utils.httpUtil; -import org.apache.http.conn.ClientConnectionManager; -import org.apache.http.conn.scheme.Scheme; -import org.apache.http.conn.scheme.SchemeRegistry; -import org.apache.http.conn.ssl.SSLSocketFactory; -import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder; +import org.apache.hc.client5.http.io.HttpClientConnectionManager; +import org.apache.hc.client5.http.ssl.NoopHostnameVerifier; +import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder; +import org.apache.hc.core5.ssl.SSLContexts; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; @@ -14,38 +16,27 @@ import java.security.cert.X509Certificate; /** * @ClassName SSLClient - * @Description TODO + * @Description SSL Client for HTTPS connections (trust all) * @Author raymond * @Date 2024/1/9 08:28 * @Version 1.0 **/ -@SuppressWarnings("deprecation") -public class SSLClient extends DefaultHttpClient { +public class SSLClient { - public SSLClient() throws Exception { - super(); - SSLContext ctx = SSLContext.getInstance("TLS"); - X509TrustManager tm = new X509TrustManager() { - @Override - public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { - - } - - @Override - public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { - - } - - @Override - public X509Certificate[] getAcceptedIssuers() { - return null; - } - }; - ctx.init(null,new TrustManager[]{tm},null); - SSLSocketFactory ssf = new SSLSocketFactory(ctx,SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); - ClientConnectionManager ccm = this.getConnectionManager(); - SchemeRegistry registry = ccm.getSchemeRegistry(); - registry.register(new Scheme("https",443,ssf)); + public static CloseableHttpClient create() throws Exception { + SSLContext ctx = SSLContexts.custom() + .loadTrustMaterial(null, (chain, authType) -> true) + .build(); + + HttpClientConnectionManager connectionManager = PoolingHttpClientConnectionManagerBuilder.create() + .setSSLSocketFactory(SSLConnectionSocketFactoryBuilder.create() + .setSslContext(ctx) + .setHostnameVerifier(NoopHostnameVerifier.INSTANCE) + .build()) + .build(); + + return HttpClients.custom() + .setConnectionManager(connectionManager) + .build(); } - } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/WebClientDevWrapper.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/WebClientDevWrapper.java deleted file mode 100755 index 78afa2315..000000000 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/tencentJH/utils/httpUtil/WebClientDevWrapper.java +++ /dev/null @@ -1,49 +0,0 @@ -/** -* @Title: WebClientDevWrapper.java -* @Package com.hmc.core.util.http_client -* @Description: TODO(用一句话描述该文件做什么) -* @author daniel -* @date 2016年9月26日 下午5:28:13 -* @version V1.0 -*/ -package com.openhis.web.tencentJH.utils.httpUtil; - -import org.apache.http.conn.scheme.Scheme; -import org.apache.http.conn.scheme.SchemeRegistry; -import org.apache.http.conn.ssl.SSLSocketFactory; -import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager; - -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; - - -public class WebClientDevWrapper { - public static DefaultHttpClient wrapClient(org.apache.http.client.HttpClient base) { - try { - SSLContext ctx = SSLContext.getInstance("TLS"); - X509TrustManager tm = new X509TrustManager() { - @Override - public X509Certificate[] getAcceptedIssuers() { - return null; - } - @Override - public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {} - @Override - public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {} - }; - ctx.init(null, new TrustManager[] { tm }, null); - SSLSocketFactory ssf = new SSLSocketFactory(ctx, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); - SchemeRegistry registry = new SchemeRegistry(); - registry.register(new Scheme("https", 443, ssf)); - ThreadSafeClientConnManager mgr = new ThreadSafeClientConnManager(registry); - return new DefaultHttpClient(mgr, base.getParams()); - } catch (Exception ex) { - ex.printStackTrace(); - return null; - } - } -} diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/ybmanage/service/impl/YbEleHttpServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/ybmanage/service/impl/YbEleHttpServiceImpl.java index 5b68a6b32..aafedf511 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/ybmanage/service/impl/YbEleHttpServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/ybmanage/service/impl/YbEleHttpServiceImpl.java @@ -15,14 +15,14 @@ import com.openhis.yb.dto.BaseInfo; import com.openhis.yb.dto.BaseParam; import com.openhis.yb.util.YbParamBuilderUtil; import com.openhis.ybelep.domain.*; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; +import org.apache.hc.client5.http.config.RequestConfig; +import org.apache.hc.core5.http.ClassicHttpResponse; +import org.apache.hc.client5.http.classic.methods.HttpPost; +import org.apache.hc.core5.http.ContentType; +import org.apache.hc.core5.http.io.entity.StringEntity; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.core5.http.io.entity.EntityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -232,10 +232,9 @@ public class YbEleHttpServiceImpl implements IYbEleHttpService { BaseParam baseParam = new BaseParam(); baseParam.setBaseInfo(baseInfo).setData(o); // 创建Http请求(2025/10/13 师大会超时故此由30000-》60000) - RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(90000).setConnectionRequestTimeout(90000) - .setSocketTimeout(90000).build(); + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(90000, java.util.concurrent.TimeUnit.MILLISECONDS).setConnectionRequestTimeout(90000, java.util.concurrent.TimeUnit.MILLISECONDS).setResponseTimeout(90000, java.util.concurrent.TimeUnit.MILLISECONDS).build(); CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).build(); - CloseableHttpResponse response = null; + ClassicHttpResponse response = null; // 发送请求 try { HttpPost httpPost = new HttpPost(url); diff --git a/openhis-server-new/openhis-common/pom.xml b/openhis-server-new/openhis-common/pom.xml index 67020cba1..4f32268fa 100755 --- a/openhis-server-new/openhis-common/pom.xml +++ b/openhis-server-new/openhis-common/pom.xml @@ -17,8 +17,8 @@ - org.apache.httpcomponents - httpclient + org.apache.httpcomponents.client5 + httpclient5 diff --git a/openhis-server-new/openhis-common/src/main/java/com/openhis/common/utils/CommonUtil.java b/openhis-server-new/openhis-common/src/main/java/com/openhis/common/utils/CommonUtil.java index bfd90f55c..48b7d6496 100755 --- a/openhis-server-new/openhis-common/src/main/java/com/openhis/common/utils/CommonUtil.java +++ b/openhis-server-new/openhis-common/src/main/java/com/openhis/common/utils/CommonUtil.java @@ -2,8 +2,8 @@ package com.openhis.common.utils; import com.core.common.core.domain.R; import com.core.common.utils.poi.ExcelUtil; -import org.apache.http.conn.ssl.NoopHostnameVerifier; -import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.hc.client5.http.ssl.NoopHostnameVerifier; +import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory; import org.springframework.web.multipart.MultipartFile; import javax.net.ssl.SSLContext; diff --git a/openhis-server-new/openhis-domain/pom.xml b/openhis-server-new/openhis-domain/pom.xml index 115c9f39b..4fa8572c4 100755 --- a/openhis-server-new/openhis-domain/pom.xml +++ b/openhis-server-new/openhis-domain/pom.xml @@ -45,8 +45,8 @@ compile - org.apache.httpcomponents - httpclient + org.apache.httpcomponents.client5 + httpclient5 diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/crosssystem/utils/CrossSystemSendApplyUtil.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/crosssystem/utils/CrossSystemSendApplyUtil.java index bbda5a9b1..f5f2c99fa 100755 --- a/openhis-server-new/openhis-domain/src/main/java/com/openhis/crosssystem/utils/CrossSystemSendApplyUtil.java +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/crosssystem/utils/CrossSystemSendApplyUtil.java @@ -12,14 +12,19 @@ import com.openhis.crosssystem.dto.*; import com.openhis.crosssystem.enums.LisAgeUnit; import com.openhis.crosssystem.enums.PacsAgeUnit; import lombok.extern.slf4j.Slf4j; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; +import org.apache.hc.client5.http.config.RequestConfig; +import org.apache.hc.core5.http.ClassicHttpResponse; +import org.apache.hc.client5.http.classic.methods.HttpPost; +import org.apache.hc.core5.http.ContentType; +import org.apache.hc.core5.http.io.entity.StringEntity; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder; +import org.apache.hc.client5.http.io.HttpClientConnectionManager; +import org.apache.hc.client5.http.ssl.NoopHostnameVerifier; +import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactoryBuilder; +import org.apache.hc.core5.ssl.SSLContexts; +import org.apache.hc.core5.http.io.entity.EntityUtils; import org.springframework.stereotype.Component; import java.io.IOException; @@ -104,12 +109,24 @@ public class CrossSystemSendApplyUtil { .setGroupName(lisApplyDto.getGroupList().stream().map(LisApplyGroupDto::getGroupName) .collect(Collectors.joining("+"))); // 设置超时时间 - RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(5000).setConnectionRequestTimeout(3000) - .setSocketTimeout(30000).build(); + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(5000, java.util.concurrent.TimeUnit.MILLISECONDS).setConnectionRequestTimeout(3000, java.util.concurrent.TimeUnit.MILLISECONDS).setResponseTimeout(30000, java.util.concurrent.TimeUnit.MILLISECONDS).build(); // 创建无视SSL验证的HttpClient - CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig) - .setSSLSocketFactory(CommonUtil.createIgnoreSslSocketFactory()).build(); - CloseableHttpResponse response = null; + HttpClientConnectionManager connectionManager; + try { + connectionManager = PoolingHttpClientConnectionManagerBuilder.create() + .setSSLSocketFactory(SSLConnectionSocketFactoryBuilder.create() + .setSslContext(SSLContexts.custom().loadTrustMaterial(null, (chain, authType) -> true).build()) + .setHostnameVerifier(NoopHostnameVerifier.INSTANCE) + .build()) + .build(); + } catch (Exception e) { + throw new RuntimeException("Failed to create SSL connection manager", e); + } + CloseableHttpClient httpClient = HttpClients.custom() + .setDefaultRequestConfig(requestConfig) + .setConnectionManager(connectionManager) + .build(); + ClassicHttpResponse response = null; // 发起HTTP请求 try { HttpPost httpPost = new HttpPost(apiUrl); @@ -207,12 +224,24 @@ public class CrossSystemSendApplyUtil { // 必填 【检查项目名称】 .setGroupName(pacsApplyDto.getGroupName()); // 设置超时时间 - RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(5000).setConnectionRequestTimeout(3000) - .setSocketTimeout(30000).build(); + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(5000, java.util.concurrent.TimeUnit.MILLISECONDS).setConnectionRequestTimeout(3000, java.util.concurrent.TimeUnit.MILLISECONDS).setResponseTimeout(30000, java.util.concurrent.TimeUnit.MILLISECONDS).build(); // 创建无视SSL验证的HttpClient - CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig) - .setSSLSocketFactory(CommonUtil.createIgnoreSslSocketFactory()).build(); - CloseableHttpResponse response = null; + HttpClientConnectionManager connectionManager; + try { + connectionManager = PoolingHttpClientConnectionManagerBuilder.create() + .setSSLSocketFactory(SSLConnectionSocketFactoryBuilder.create() + .setSslContext(SSLContexts.custom().loadTrustMaterial(null, (chain, authType) -> true).build()) + .setHostnameVerifier(NoopHostnameVerifier.INSTANCE) + .build()) + .build(); + } catch (Exception e) { + throw new RuntimeException("Failed to create SSL connection manager", e); + } + CloseableHttpClient httpClient = HttpClients.custom() + .setDefaultRequestConfig(requestConfig) + .setConnectionManager(connectionManager) + .build(); + ClassicHttpResponse response = null; // 发起HTTP请求 try { HttpPost httpPost = new HttpPost(apiUrl); diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/yb/service/YbHttpUtils.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/yb/service/YbHttpUtils.java index f57fa97b4..ae15c21e3 100755 --- a/openhis-server-new/openhis-domain/src/main/java/com/openhis/yb/service/YbHttpUtils.java +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/yb/service/YbHttpUtils.java @@ -23,14 +23,14 @@ import com.openhis.yb.dto.*; import com.openhis.yb.model.Clinic2207OrderModel; import com.openhis.yb.model.Clinic2207OrderParam; import com.openhis.yb.util.YbParamBuilderUtil; -import org.apache.http.client.config.RequestConfig; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.util.EntityUtils; +import org.apache.hc.client5.http.config.RequestConfig; +import org.apache.hc.core5.http.ClassicHttpResponse; +import org.apache.hc.client5.http.classic.methods.HttpPost; +import org.apache.hc.core5.http.ContentType; +import org.apache.hc.core5.http.io.entity.StringEntity; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.core5.http.io.entity.EntityUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -756,10 +756,9 @@ public class YbHttpUtils { baseParam.setBaseInfo(ybParamBuilderUtil.getBaseInfo(parseObject(JSON.toJSONString(o)), contract)).setData(o); logger.info("【请求路径】:" + url + ";【入参】: " + JSON.toJSONString(baseParam)); // 创建Http请求 - RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(300000) - .setConnectionRequestTimeout(300000).setSocketTimeout(300000).build(); + RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(300000, java.util.concurrent.TimeUnit.MILLISECONDS).setConnectionRequestTimeout(300000, java.util.concurrent.TimeUnit.MILLISECONDS).setResponseTimeout(300000, java.util.concurrent.TimeUnit.MILLISECONDS).build(); CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig).build(); - CloseableHttpResponse response = null; + ClassicHttpResponse response = null; // 发送请求 try { HttpPost httpPost = new HttpPost(url); diff --git a/openhis-server-new/pom.xml b/openhis-server-new/pom.xml index fb82e25dd..a275247dc 100755 --- a/openhis-server-new/pom.xml +++ b/openhis-server-new/pom.xml @@ -42,7 +42,7 @@ 7.1.0 42.7.10 5.3.3 - 4.5.14 + 5.6.1 2.0.61 2.5.1 2.12.4.1 @@ -351,9 +351,9 @@ - org.apache.httpcomponents - httpclient - ${httpclient.version} + org.apache.httpcomponents.client5 + httpclient5 + ${httpclient5.version} From 14cb913943c1d763defc8f53cacfba05a4fd70a5 Mon Sep 17 00:00:00 2001 From: chenqi Date: Fri, 5 Jun 2026 11:44:31 +0800 Subject: [PATCH 2/5] =?UTF-8?q?refactor(table):=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E7=BB=84=E4=BB=B6=E7=9A=84=E5=8D=95=E5=85=83?= =?UTF-8?q?=E6=A0=BC=E5=90=88=E5=B9=B6=E9=85=8D=E7=BD=AE=E5=92=8C=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将所有表格的单元格合并方法从数组格式 [rowspan, colspan] 改为对象格式 { rowspan, colspan } - 为 vxe-table 组件添加 checkbox-config 配置以支持复选框保留选择功能 - 移除复选框的 :reserve-selection 属性并改用 checkbox-config 配置 - 全局注册 VxeTableCompat 组件来归一化 cell-click 和 current-change 事件参数 - 更新技术执行和技术审批页面的表格组件配置和操作逻辑 - 优化 --- openhis-ui-vue3/src/main.js | 3 + .../src/template/FallBedFallAssessment.vue | 42 ++-- .../components/adviceBaseList.vue | 2 +- .../components/adviceBaseList.vue | 2 +- .../basicmanage/ordersCombination/index.vue | 2 +- .../components/tcmMedicineList.vue | 2 +- .../src/views/charge/cliniccharge/index.vue | 10 +- .../components/reprintDialog.vue | 2 +- .../src/views/charge/surgerycharge/index.vue | 10 +- .../bargain/component/adviceBaseList.vue | 2 +- .../views/clinicmanagement/disposal/index.vue | 10 +- .../clinicmanagement/returnDrug/index.vue | 8 +- .../clinicmanagement/techExecute/index.vue | 190 +++++++++++++++- .../techfundApprove/index.vue | 206 +++++++++++++++++- .../consultationapplication/index.vue | 2 +- .../consultationconfirmation/index.vue | 2 +- .../components/adviceBaseList.vue | 2 +- .../prescription/orderGroupDrawer.vue | 2 +- .../components/tcm/tcmMedicineList.vue | 2 +- .../components/MedicationDetails.vue | 8 +- .../components/MedicationSummary.vue | 4 +- .../components/ReturnDrug.vue | 8 +- .../charge/feeSettlement/index.vue | 10 +- .../home/components/diagnosis/index.vue | 4 +- .../drugDistribution/drugDistributionList.vue | 12 +- .../check/MedicalOrderManagement.vue | 12 +- .../execute/MedicalOrderManagement.vue | 12 +- .../inpatientNurse/medicineCollect/index.vue | 12 +- .../westernmedicine/index.vue | 8 +- .../src/views/surgerymanage/index.vue | 2 +- .../src/views/surgicalschedule/index.vue | 2 +- .../src/views/system/user copy/authRole.vue | 6 +- .../src/views/system/user/authRole.vue | 6 +- 33 files changed, 501 insertions(+), 106 deletions(-) diff --git a/openhis-ui-vue3/src/main.js b/openhis-ui-vue3/src/main.js index b9e307ac1..1e0506bf1 100755 --- a/openhis-ui-vue3/src/main.js +++ b/openhis-ui-vue3/src/main.js @@ -2,6 +2,7 @@ import {createApp, nextTick} from 'vue'; import VxeUIAll from 'vxe-table'; import 'vxe-table/lib/style.css'; +import VxeTableCompat from '@/components/VxeTableCompat'; import Cookies from 'js-cookie'; // 导入 hiprint 并挂载到全局 window 对象 @@ -122,6 +123,8 @@ app.use(ElementPlus, { size: Cookies.get('size') || 'default', }); app.use(VxeUIAll); +// 全局注册 vxe-table 兼容层:归一化 cell-click/current-change 事件参数 +app.component('vxe-table', VxeTableCompat); // 导入公告帮助工具 import { initNoticePopupAfterLogin } from '@/utils/noticeHelper' diff --git a/openhis-ui-vue3/src/template/FallBedFallAssessment.vue b/openhis-ui-vue3/src/template/FallBedFallAssessment.vue index 3ec14552e..b2f5f054f 100755 --- a/openhis-ui-vue3/src/template/FallBedFallAssessment.vue +++ b/openhis-ui-vue3/src/template/FallBedFallAssessment.vue @@ -1,4 +1,4 @@ -