|
@@ -1,11 +1,13 @@
|
|
|
package thyyxxk.webserver.service.heliyongyao;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
+import cn.hutool.http.HttpRequest;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import thyyxxk.webserver.config.SystemConfig;
|
|
|
import thyyxxk.webserver.config.exception.BizException;
|
|
|
import thyyxxk.webserver.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.webserver.constants.Capacity;
|
|
@@ -18,7 +20,6 @@ import thyyxxk.webserver.entity.heliyongyao.YaoPin;
|
|
|
import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.XinZhenYiZhu;
|
|
|
import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.XinZhenYzActOrder;
|
|
|
import thyyxxk.webserver.service.PublicServer;
|
|
|
-import thyyxxk.webserver.service.externalhttp.RationalUseSrvc;
|
|
|
import thyyxxk.webserver.utils.*;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
@@ -35,18 +36,17 @@ import java.util.stream.Collectors;
|
|
|
*/
|
|
|
@Service
|
|
|
@Slf4j
|
|
|
+@RequiredArgsConstructor
|
|
|
public class RationalUseServer {
|
|
|
private final RationalUseDao dao;
|
|
|
- private final RationalUseSrvc http;
|
|
|
private final YiZhuLuRuDao orderDao;
|
|
|
+ private final SystemConfig systemConfig;
|
|
|
|
|
|
- public RationalUseServer(RationalUseDao dao, RationalUseSrvc http, YiZhuLuRuDao orderDao) {
|
|
|
- this.dao = dao;
|
|
|
- this.http = http;
|
|
|
- this.orderDao = orderDao;
|
|
|
- }
|
|
|
|
|
|
public ResultVo<JSONObject> rationalUseOfMedicine(String patNo, Integer times) {
|
|
|
+ if (systemConfig.getRationalUseUrl() == null) {
|
|
|
+ return ResultVoUtil.success(JSONObject.parseObject("{\"result_lv\": 0}"));
|
|
|
+ }
|
|
|
QueryWrapper<?> qw = new QueryWrapper<>();
|
|
|
// 查询药品医嘱
|
|
|
qw.eq("a.inpatient_no", patNo)
|
|
@@ -73,7 +73,11 @@ public class RationalUseServer {
|
|
|
* @return 返回提示
|
|
|
*/
|
|
|
public ResultVo<JSONObject> auditingInterface(String url) {
|
|
|
- return ResultVoUtil.success(http.auditingInterface(url));
|
|
|
+ if (systemConfig.getRationalUseUrl() == null) {
|
|
|
+ return ResultVoUtil.success(ExceptionEnum.SUCCESS, null, null);
|
|
|
+ }
|
|
|
+ String body = HttpRequest.get(url).execute().body();
|
|
|
+ return ResultVoUtil.success(JSONObject.parseObject(body));
|
|
|
}
|
|
|
|
|
|
public JSONObject verify(XinZhenYiZhu param, List<XinZhenYzActOrder> historicalData) {
|
|
@@ -96,7 +100,10 @@ public class RationalUseServer {
|
|
|
);
|
|
|
String detailsXml = drugInfoFunc(param.getInpatientNo(), param.getAdmissTimes(), param.getList(), doctXml, drugMap, historicalData);
|
|
|
String js = String.format("{\"BaseXml\": \"%s\", \"DetailsXml\" : \"%s\"}", baseXml, detailsXml);
|
|
|
- return http.rationalUse(js);
|
|
|
+
|
|
|
+ String text = HttpRequest.post(systemConfig.getRationalUseUrl()).body(js).execute().body();
|
|
|
+
|
|
|
+ return JSONObject.parseObject(text);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -125,23 +132,23 @@ public class RationalUseServer {
|
|
|
Map<String, String> map = new HashMap<>(Capacity.TWO);
|
|
|
|
|
|
String baseXml = "<base_xml>" +
|
|
|
- "<source>HIS</source>" +
|
|
|
- "<hosp_code>H43010500370</hosp_code>" +
|
|
|
- "<hosp_name>长沙泰和医院</hosp_name>" +
|
|
|
- "<dept_code>" + nullToBlank(doctorInfo.get("dept_code")) + "</dept_code>" +
|
|
|
- "<dept_name>" + nullToBlank(doctorInfo.get("dept_name")) + "</dept_name>" +
|
|
|
- "<doct>" +
|
|
|
- "<code>" + nullToBlank(doctorInfo.get("code")) + "</code>" +
|
|
|
- "<name>" + nullToBlank(doctorInfo.get("name")) + "</name>" +
|
|
|
- "<type>" + nullToBlank(doctorInfo.get("type")) + "</type>" +
|
|
|
- "<type_name>" + nullToBlank(doctorInfo.get("type_name")) + "</type_name>" +
|
|
|
- "</doct>" +
|
|
|
- "</base_xml>";
|
|
|
+ "<source>HIS</source>" +
|
|
|
+ "<hosp_code>H43010500370</hosp_code>" +
|
|
|
+ "<hosp_name>长沙泰和医院</hosp_name>" +
|
|
|
+ "<dept_code>" + nullToBlank(doctorInfo.get("dept_code")) + "</dept_code>" +
|
|
|
+ "<dept_name>" + nullToBlank(doctorInfo.get("dept_name")) + "</dept_name>" +
|
|
|
+ "<doct>" +
|
|
|
+ "<code>" + nullToBlank(doctorInfo.get("code")) + "</code>" +
|
|
|
+ "<name>" + nullToBlank(doctorInfo.get("name")) + "</name>" +
|
|
|
+ "<type>" + nullToBlank(doctorInfo.get("type")) + "</type>" +
|
|
|
+ "<type_name>" + nullToBlank(doctorInfo.get("type_name")) + "</type_name>" +
|
|
|
+ "</doct>" +
|
|
|
+ "</base_xml>";
|
|
|
map.put("baseXml", baseXml);
|
|
|
String sb = "<dept_code>" + nullToBlank(doctorInfo.get("dept_code")) + "</dept_code>" +
|
|
|
- "<dept_name>" + nullToBlank(doctorInfo.get("dept_name")) + "</dept_name>" +
|
|
|
- "<doct_code>" + nullToBlank(doctorInfo.get("code")) + "</doct_code>" +
|
|
|
- "<doct_name>" + nullToBlank(doctorInfo.get("name")) + "</doct_name>";
|
|
|
+ "<dept_name>" + nullToBlank(doctorInfo.get("dept_name")) + "</dept_name>" +
|
|
|
+ "<doct_code>" + nullToBlank(doctorInfo.get("code")) + "</doct_code>" +
|
|
|
+ "<doct_name>" + nullToBlank(doctorInfo.get("name")) + "</doct_name>";
|
|
|
map.put("doct", sb);
|
|
|
return map;
|
|
|
}
|