瀏覽代碼

新增合理用药的配置

xiaochan 5 月之前
父節點
當前提交
37989bb447

+ 5 - 0
src/main/java/thyyxxk/webserver/config/SystemConfig.java

@@ -11,6 +11,11 @@ import org.springframework.stereotype.Component;
 @NoArgsConstructor
 public class SystemConfig {
 
+    /**
+     * 合理用药
+     */
+    private String rationalUseUrl;
+
     private YzConfig yzConfig = new YzConfig();
 
     @Data

+ 0 - 28
src/main/java/thyyxxk/webserver/service/externalhttp/RationalUseSrvc.java

@@ -1,28 +0,0 @@
-package thyyxxk.webserver.service.externalhttp;
-
-import com.alibaba.fastjson.JSONObject;
-import com.dtflys.forest.annotation.*;
-
-/**
- * <p>
- * 描述: 合理用药
- * </p>
- *
- * @author xc
- * @date 2022-03-29 11:42
- */
-public interface RationalUseSrvc {
-
-    /**
-     * 合理用药
-     *
-     * @param str 药品信息
-     * @return 返回
-     */
-    @Post("http://172.16.32.121:8016/Audit.ashx")
-    JSONObject rationalUse(@JSONBody String str);
-
-    @Get("${url}")
-    JSONObject auditingInterface(@Var("url") String url);
-
-}

+ 32 - 25
src/main/java/thyyxxk/webserver/service/heliyongyao/RationalUseServer.java

@@ -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;
     }

+ 2 - 0
src/main/resources/application-prod.yml

@@ -157,6 +157,8 @@ thyy:
       yz-allow-invalidation: true
       exceeding-discharge-days: 4
       prescribe-medical-advice-after-discharge: true
+    rational-use-url: http://172.16.32.121:8016/Audit.ashx
+
   archive:
     path: "/mnt/archive"
     archive-url: http://172.16.32.167:20921/thyy/api/archive