Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
27
openhis-server-new/AGENTS.md
Normal file
27
openhis-server-new/AGENTS.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# OpenHIS 铁律
|
||||
|
||||
## 铁律 #1: 修改完必须测试
|
||||
**任何代码修改后,必须完成以下测试才能提交:**
|
||||
|
||||
### 白盒测试
|
||||
- `mvn clean compile` 编译通过
|
||||
- 单元测试通过(如有)
|
||||
|
||||
### 黑盒测试
|
||||
- 启动应用,验证无启动报错
|
||||
- 测试关键接口(登录、核心业务接口)
|
||||
- 验证请求响应正确
|
||||
|
||||
### 冒烟测试
|
||||
- 应用正常启动(端口监听)
|
||||
- 健康检查接口返回正常
|
||||
- 基础 CRUD 操作正常
|
||||
|
||||
## 铁律 #2: Flyway 迁移
|
||||
但凡遇到有新建表和字段的,通过 Flyway 框架去实现。
|
||||
|
||||
## 铁律 #3: 先分解再行动
|
||||
任何非平凡任务先出 plan 再执行。
|
||||
|
||||
## 铁律 #4: 验证后信
|
||||
每次修改后必须验证编译通过,不信记忆。
|
||||
@@ -81,8 +81,8 @@
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<groupId>org.apache.httpcomponents.client5</groupId>
|
||||
<artifactId>httpclient5</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -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编码
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -0,0 +1,337 @@
|
||||
package com.openhis.web.techstation.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.core.common.core.controller.BaseController;
|
||||
import com.core.common.core.domain.AjaxResult;
|
||||
import com.core.common.core.page.TableDataInfo;
|
||||
import com.openhis.check.domain.ExamApply;
|
||||
import com.openhis.check.domain.ExamApplyItem;
|
||||
import com.openhis.check.service.IExamApplyItemService;
|
||||
import com.openhis.check.service.IExamApplyService;
|
||||
import com.openhis.lab.domain.InspectionLabApply;
|
||||
import com.openhis.lab.service.IInspectionLabApplyService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 医技工作站 Controller
|
||||
* <p>
|
||||
* 职责:
|
||||
* 1. 医技执行 — 查询待执行的检查/检验申请单,执行确认
|
||||
* 2. 医技退费审批 — 查询待退费审批的申请单,审批通过/驳回
|
||||
* </p>
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/tech-station")
|
||||
public class TechStationController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IExamApplyService examApplyService;
|
||||
|
||||
@Autowired
|
||||
private IExamApplyItemService examApplyItemService;
|
||||
|
||||
@Autowired
|
||||
private IInspectionLabApplyService inspectionLabApplyService;
|
||||
|
||||
// ========== 医技执行 ==========
|
||||
|
||||
/**
|
||||
* 待执行列表(检查 + 检验)
|
||||
* 查询已收费但未执行的申请单
|
||||
*/
|
||||
@GetMapping("/execute/list")
|
||||
public TableDataInfo executeList(
|
||||
@RequestParam(value = "applyType", required = false) String applyType,
|
||||
@RequestParam(value = "patientName", required = false) String patientName,
|
||||
@RequestParam(value = "applyNo", required = false) String applyNo,
|
||||
@RequestParam(value = "startTime", required = false) String startTime,
|
||||
@RequestParam(value = "endTime", required = false) String endTime) {
|
||||
|
||||
startPage();
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
|
||||
// 查询检查申请单(exam_apply)
|
||||
// applyStatus: 1=已收费, 2=已预约, 3=已签到 → 待执行
|
||||
if (applyType == null || "exam".equals(applyType)) {
|
||||
LambdaQueryWrapper<ExamApply> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(ExamApply::getIsCharged, 1)
|
||||
.eq(ExamApply::getIsExecuted, 0)
|
||||
.ne(ExamApply::getApplyStatus, 6); // 排除作废
|
||||
if (patientName != null && !patientName.isEmpty()) {
|
||||
wrapper.like(ExamApply::getPatientId, patientName);
|
||||
}
|
||||
if (applyNo != null && !applyNo.isEmpty()) {
|
||||
wrapper.like(ExamApply::getApplyNo, applyNo);
|
||||
}
|
||||
wrapper.orderByDesc(ExamApply::getApplyTime);
|
||||
List<ExamApply> examList = examApplyService.list(wrapper);
|
||||
for (ExamApply exam : examList) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("applyNo", exam.getApplyNo());
|
||||
item.put("applyType", "exam");
|
||||
item.put("applyTypeName", "检查");
|
||||
item.put("patientId", exam.getPatientId());
|
||||
item.put("visitNo", exam.getVisitNo());
|
||||
item.put("applyDeptCode", exam.getApplyDeptCode());
|
||||
item.put("applyDocCode", exam.getApplyDocCode());
|
||||
item.put("applyTime", exam.getApplyTime());
|
||||
item.put("clinicDesc", exam.getClinicDesc());
|
||||
item.put("examTypeCode", exam.getExamTypeCode());
|
||||
item.put("inspectionArea", exam.getInspectionArea());
|
||||
item.put("inspectionMethod", exam.getInspectionMethod());
|
||||
item.put("applyStatus", exam.getApplyStatus());
|
||||
item.put("isUrgent", exam.getIsUrgent());
|
||||
item.put("applyRemark", exam.getApplyRemark());
|
||||
resultList.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
// 查询检验申请单(lab_apply)
|
||||
// applyStatus: 2=已收费 → 待执行
|
||||
if (applyType == null || "lab".equals(applyType)) {
|
||||
LambdaQueryWrapper<InspectionLabApply> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(InspectionLabApply::getApplyStatus, 2L);
|
||||
if (patientName != null && !patientName.isEmpty()) {
|
||||
wrapper.like(InspectionLabApply::getPatientName, patientName);
|
||||
}
|
||||
if (applyNo != null && !applyNo.isEmpty()) {
|
||||
wrapper.like(InspectionLabApply::getApplyNo, applyNo);
|
||||
}
|
||||
wrapper.orderByDesc(InspectionLabApply::getApplyTime);
|
||||
List<InspectionLabApply> labList = inspectionLabApplyService.list(wrapper);
|
||||
for (InspectionLabApply lab : labList) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("applyNo", lab.getApplyNo());
|
||||
item.put("applyType", "lab");
|
||||
item.put("applyTypeName", "检验");
|
||||
item.put("patientId", lab.getPatientId());
|
||||
item.put("patientName", lab.getPatientName());
|
||||
item.put("medicalrecordNumber", lab.getMedicalrecordNumber());
|
||||
item.put("applyDeptCode", lab.getApplyDeptCode());
|
||||
item.put("applyDepartment", lab.getApplyDepartment());
|
||||
item.put("applyDocCode", lab.getApplyDocCode());
|
||||
item.put("applyDocName", lab.getApplyDocName());
|
||||
item.put("applyTime", lab.getApplyTime());
|
||||
item.put("clinicDiag", lab.getClinicDiag());
|
||||
item.put("inspectionItem", lab.getInspectionItem());
|
||||
item.put("specimenName", lab.getSpecimenName());
|
||||
item.put("priorityCode", lab.getPriorityCode());
|
||||
item.put("applyStatus", lab.getApplyStatus());
|
||||
item.put("applyRemark", lab.getApplyRemark());
|
||||
resultList.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
// 按申请时间倒序排序
|
||||
resultList.sort((a, b) -> {
|
||||
Object timeA = a.get("applyTime");
|
||||
Object timeB = b.get("applyTime");
|
||||
if (timeA == null && timeB == null) return 0;
|
||||
if (timeA == null) return 1;
|
||||
if (timeB == null) return -1;
|
||||
if (timeA instanceof LocalDateTime && timeB instanceof LocalDateTime) {
|
||||
return ((LocalDateTime) timeB).compareTo((LocalDateTime) timeA);
|
||||
}
|
||||
if (timeA instanceof Date && timeB instanceof Date) {
|
||||
return ((Date) timeB).compareTo((Date) timeA);
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
return getDataTable(resultList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行确认(检查申请单)
|
||||
*/
|
||||
@PutMapping("/execute/exam/{applyNo}")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult executeExam(@PathVariable String applyNo) {
|
||||
ExamApply examApply = examApplyService.getById(applyNo);
|
||||
if (examApply == null) {
|
||||
return AjaxResult.error("申请单不存在");
|
||||
}
|
||||
if (examApply.getIsExecuted() == 1) {
|
||||
return AjaxResult.error("该申请单已执行");
|
||||
}
|
||||
examApply.setIsExecuted(1);
|
||||
examApply.setApplyStatus(5); // 已完成
|
||||
examApplyService.updateById(examApply);
|
||||
return AjaxResult.success("执行成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行确认(检验申请单)
|
||||
*/
|
||||
@PutMapping("/execute/lab/{applyNo}")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult executeLab(@PathVariable String applyNo) {
|
||||
LambdaQueryWrapper<InspectionLabApply> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(InspectionLabApply::getApplyNo, applyNo);
|
||||
InspectionLabApply labApply = inspectionLabApplyService.getOne(wrapper);
|
||||
if (labApply == null) {
|
||||
return AjaxResult.error("申请单不存在");
|
||||
}
|
||||
if (labApply.getApplyStatus() == 3L) {
|
||||
return AjaxResult.error("该申请单已执行");
|
||||
}
|
||||
labApply.setApplyStatus(3L); // 已执行/已完成
|
||||
inspectionLabApplyService.updateById(labApply);
|
||||
return AjaxResult.success("执行成功");
|
||||
}
|
||||
|
||||
// ========== 医技退费审批 ==========
|
||||
|
||||
/**
|
||||
* 待退费审批列表
|
||||
* 查询 isRefunded=1(已申请退费)且需要审批的申请单
|
||||
*/
|
||||
@GetMapping("/refund-approve/list")
|
||||
public TableDataInfo refundApproveList(
|
||||
@RequestParam(value = "applyType", required = false) String applyType,
|
||||
@RequestParam(value = "patientName", required = false) String patientName,
|
||||
@RequestParam(value = "applyNo", required = false) String applyNo,
|
||||
@RequestParam(value = "approveStatus", required = false) Integer approveStatus) {
|
||||
|
||||
startPage();
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
|
||||
// 查询已申请退费的检查申请单
|
||||
if (applyType == null || "exam".equals(applyType)) {
|
||||
LambdaQueryWrapper<ExamApply> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(ExamApply::getIsRefunded, 1);
|
||||
// applyStatus=6 表示作废(退费申请)
|
||||
if (approveStatus != null) {
|
||||
wrapper.eq(ExamApply::getApplyStatus, approveStatus);
|
||||
}
|
||||
if (patientName != null && !patientName.isEmpty()) {
|
||||
wrapper.like(ExamApply::getPatientId, patientName);
|
||||
}
|
||||
if (applyNo != null && !applyNo.isEmpty()) {
|
||||
wrapper.like(ExamApply::getApplyNo, applyNo);
|
||||
}
|
||||
wrapper.orderByDesc(ExamApply::getApplyTime);
|
||||
List<ExamApply> examList = examApplyService.list(wrapper);
|
||||
for (ExamApply exam : examList) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("applyNo", exam.getApplyNo());
|
||||
item.put("applyType", "exam");
|
||||
item.put("applyTypeName", "检查");
|
||||
item.put("patientId", exam.getPatientId());
|
||||
item.put("visitNo", exam.getVisitNo());
|
||||
item.put("applyDeptCode", exam.getApplyDeptCode());
|
||||
item.put("applyDocCode", exam.getApplyDocCode());
|
||||
item.put("applyTime", exam.getApplyTime());
|
||||
item.put("clinicDesc", exam.getClinicDesc());
|
||||
item.put("applyStatus", exam.getApplyStatus());
|
||||
item.put("isRefunded", exam.getIsRefunded());
|
||||
item.put("applyRemark", exam.getApplyRemark());
|
||||
resultList.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
// 查询已申请退费的检验申请单(applyStatus=5 表示待退)
|
||||
if (applyType == null || "lab".equals(applyType)) {
|
||||
LambdaQueryWrapper<InspectionLabApply> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(InspectionLabApply::getApplyStatus, 5L);
|
||||
if (patientName != null && !patientName.isEmpty()) {
|
||||
wrapper.like(InspectionLabApply::getPatientName, patientName);
|
||||
}
|
||||
if (applyNo != null && !applyNo.isEmpty()) {
|
||||
wrapper.like(InspectionLabApply::getApplyNo, applyNo);
|
||||
}
|
||||
wrapper.orderByDesc(InspectionLabApply::getApplyTime);
|
||||
List<InspectionLabApply> labList = inspectionLabApplyService.list(wrapper);
|
||||
for (InspectionLabApply lab : labList) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
item.put("applyNo", lab.getApplyNo());
|
||||
item.put("applyType", "lab");
|
||||
item.put("applyTypeName", "检验");
|
||||
item.put("patientId", lab.getPatientId());
|
||||
item.put("patientName", lab.getPatientName());
|
||||
item.put("medicalrecordNumber", lab.getMedicalrecordNumber());
|
||||
item.put("applyDeptCode", lab.getApplyDeptCode());
|
||||
item.put("applyDepartment", lab.getApplyDepartment());
|
||||
item.put("applyDocCode", lab.getApplyDocCode());
|
||||
item.put("applyDocName", lab.getApplyDocName());
|
||||
item.put("applyTime", lab.getApplyTime());
|
||||
item.put("clinicDiag", lab.getClinicDiag());
|
||||
item.put("applyStatus", lab.getApplyStatus());
|
||||
item.put("applyRemark", lab.getApplyRemark());
|
||||
resultList.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
return getDataTable(resultList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退费审批通过(检查)
|
||||
*/
|
||||
@PutMapping("/refund-approve/approve/exam/{applyNo}")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult approveExamRefund(@PathVariable String applyNo) {
|
||||
ExamApply examApply = examApplyService.getById(applyNo);
|
||||
if (examApply == null) {
|
||||
return AjaxResult.error("申请单不存在");
|
||||
}
|
||||
examApply.setApplyStatus(6); // 作废(退费完成)
|
||||
examApplyService.updateById(examApply);
|
||||
return AjaxResult.success("审批通过");
|
||||
}
|
||||
|
||||
/**
|
||||
* 退费审批驳回(检查)
|
||||
*/
|
||||
@PutMapping("/refund-approve/reject/exam/{applyNo}")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult rejectExamRefund(@PathVariable String applyNo) {
|
||||
ExamApply examApply = examApplyService.getById(applyNo);
|
||||
if (examApply == null) {
|
||||
return AjaxResult.error("申请单不存在");
|
||||
}
|
||||
examApply.setIsRefunded(0); // 恢复为未退费
|
||||
examApplyService.updateById(examApply);
|
||||
return AjaxResult.success("已驳回");
|
||||
}
|
||||
|
||||
/**
|
||||
* 退费审批通过(检验)
|
||||
*/
|
||||
@PutMapping("/refund-approve/approve/lab/{applyNo}")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult approveLabRefund(@PathVariable String applyNo) {
|
||||
LambdaQueryWrapper<InspectionLabApply> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(InspectionLabApply::getApplyNo, applyNo);
|
||||
InspectionLabApply labApply = inspectionLabApplyService.getOne(wrapper);
|
||||
if (labApply == null) {
|
||||
return AjaxResult.error("申请单不存在");
|
||||
}
|
||||
labApply.setApplyStatus(6L); // 作废(退费完成)
|
||||
inspectionLabApplyService.updateById(labApply);
|
||||
return AjaxResult.success("审批通过");
|
||||
}
|
||||
|
||||
/**
|
||||
* 退费审批驳回(检验)
|
||||
*/
|
||||
@PutMapping("/refund-approve/reject/lab/{applyNo}")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult rejectLabRefund(@PathVariable String applyNo) {
|
||||
LambdaQueryWrapper<InspectionLabApply> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(InspectionLabApply::getApplyNo, applyNo);
|
||||
InspectionLabApply labApply = inspectionLabApplyService.getOne(wrapper);
|
||||
if (labApply == null) {
|
||||
return AjaxResult.error("申请单不存在");
|
||||
}
|
||||
labApply.setApplyStatus(2L); // 恢复为已收费
|
||||
inspectionLabApplyService.updateById(labApply);
|
||||
return AjaxResult.success("已驳回");
|
||||
}
|
||||
}
|
||||
@@ -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<String, String> executeResponse() {
|
||||
Map<String, String> 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 {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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<String, Object> param, Map<String, String> 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<NameValuePair> formparams = new ArrayList<NameValuePair>();
|
||||
List<BasicNameValuePair> 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<String, Object> param, Map<String, Object> 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("</xml>");
|
||||
// 解决中文乱码问题
|
||||
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<NameValuePair> formParams = new ArrayList<NameValuePair>();
|
||||
List<BasicNameValuePair> 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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<groupId>org.apache.httpcomponents.client5</groupId>
|
||||
<artifactId>httpclient5</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -45,8 +45,8 @@
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<groupId>org.apache.httpcomponents.client5</groupId>
|
||||
<artifactId>httpclient5</artifactId>
|
||||
</dependency>
|
||||
<!-- 共通-->
|
||||
<dependency>
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
<flowable.version>7.1.0</flowable.version>
|
||||
<postgresql.version>42.7.10</postgresql.version>
|
||||
<aviator.version>5.3.3</aviator.version>
|
||||
<httpclient.version>4.5.14</httpclient.version>
|
||||
<httpclient5.version>5.6.1</httpclient5.version>
|
||||
<fastjson2.version>2.0.61</fastjson2.version>
|
||||
<pinyin4j.version>2.5.1</pinyin4j.version>
|
||||
<liteflow-spring-boot-starter.version>2.12.4.1</liteflow-spring-boot-starter.version>
|
||||
@@ -351,9 +351,9 @@
|
||||
</dependency>
|
||||
<!-- JSQlParser - MyBatis Plus 3.5.9+ 需要 4.6+ -->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>${httpclient.version}</version>
|
||||
<groupId>org.apache.httpcomponents.client5</groupId>
|
||||
<artifactId>httpclient5</artifactId>
|
||||
<version>${httpclient5.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
Reference in New Issue
Block a user