Browse Source

新增配置

xiaochan 3 months ago
parent
commit
60fb7af8d1

+ 1 - 1
pom.xml

@@ -10,7 +10,7 @@
     </parent>
     <groupId>thyyxxk</groupId>
     <artifactId>web-server</artifactId>
-    <version>13.1.2</version>
+    <version>13.1.4</version>
     <name>web-server</name>
     <description>server for yibao-web</description>
     <properties>

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

@@ -28,4 +28,9 @@ public class ApiUrl {
      * 创智的drg接口地址
      */
     private String drgWebApi;
+
+    /**
+     * 电子病历模板的地址
+     */
+    private String emrEditorTemplateUrl;
 }

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

@@ -31,4 +31,9 @@ public class SystemConfig {
      * 机构领域
      */
     private String institutionArea;
+
+    /**
+     * 电子病历的住院编码
+     */
+    private String emrZyDeptCode;
 }

+ 14 - 1
src/main/java/thyyxxk/webserver/controller/zhuyuanyizheng/emr/EmrController.java

@@ -1,9 +1,12 @@
 package thyyxxk.webserver.controller.zhuyuanyizheng.emr;
 
+import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONObject;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import thyyxxk.webserver.config.auth.PassToken;
+import thyyxxk.webserver.config.envionment.ApiUrl;
+import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.dictionary.CodeName;
 import thyyxxk.webserver.entity.fluorescenceTest.FluorescenceSpecimenResult;
@@ -27,9 +30,11 @@ import java.util.Map;
 @RestController
 public class EmrController {
     private final EmrServer server;
+    private final ApiUrl apiUrl;
 
-    public EmrController(EmrServer server) {
+    public EmrController(EmrServer server, ApiUrl apiUrl) {
         this.server = server;
+        this.apiUrl = apiUrl;
     }
 
     @GetMapping("/getPatientDataTree")
@@ -291,4 +296,12 @@ public class EmrController {
         return server.rename(name, documentId);
     }
 
+    @GetMapping("/getEmrTemplateUrl")
+    public ResultVo<String> getEmrTemplateUrl() {
+        String url = apiUrl.getEmrEditorTemplateUrl();
+        if (StrUtil.isBlank(url)) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "未配置电子病历模板编辑地址");
+        }
+        return ResultVoUtil.success(url);
+    }
 }

+ 0 - 2
src/main/java/thyyxxk/webserver/service/ca/CaServer.java

@@ -287,8 +287,6 @@ public class CaServer implements Assertion {
             item.setIdCard(idCardRsa.decryptStr(item.getIdCard(), KeyType.PrivateKey));
         });
         String redisKey = getRedisKey(moreEventSign.getDocumentId());
-
-
         String redisData = Convert.toStr(cache.get(redisKey), null);
 
         if (redisData != null) {

+ 0 - 13
src/main/java/thyyxxk/webserver/service/externalhttp/emr/EmrEditor.java

@@ -58,17 +58,4 @@ public interface EmrEditor {
 
     @Get("/category/list/dept?code={deptCode}")
     JSONArray getDeptList(@Var("deptCode") String deptCode);
-
-    @Get("/document/history/destroy/{countDay}")
-    JSONObject historyDelete(@Var("countDay") Integer countDay);
-
-    /**
-     * @param id    文档id
-     * @param codes 编码
-     * @return 患者数据元
-     */
-    @Get("/document/docs/data/{id}?keyType=business&codes={codes}")
-    JSONObject getEmrBusinessByDocumentId(@Var("id") String id,
-                                          @Var("codes") String codes);
-
 }

+ 15 - 2
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/emr/EmrServer.java

@@ -2,6 +2,7 @@ package thyyxxk.webserver.service.zhuyuanyisheng.emr;
 
 import cn.hutool.core.codec.Base64;
 import cn.hutool.core.convert.Convert;
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.http.HttpRequest;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
@@ -22,6 +23,8 @@ import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.client.RestTemplate;
+import thyyxxk.webserver.config.envionment.ApiUrl;
+import thyyxxk.webserver.config.envionment.SystemConfig;
 import thyyxxk.webserver.config.exception.ExceptionEnum;
 import thyyxxk.webserver.constants.Capacity;
 import thyyxxk.webserver.constants.EmrType;
@@ -63,13 +66,14 @@ public class EmrServer {
     private final LoginDao loginDao;
     private final ExtraCache extraCache;
     private final UserCache userCache;
-    private final RestTemplate template;
 
     private static String emrToken = null;
     private static String EMR_URL;
 
     public static final String THIS_IS_DIR = "This is Dir";
     private final DrgWebApi drgWebApi;
+    private final ApiUrl apiUrl;
+    private final SystemConfig systemConfig;
 
     @Value("${forest.variables.emrUrl}")
     public void setUrl(String key) {
@@ -188,7 +192,12 @@ public class EmrServer {
      * 获取 整个医院模板
      */
     private List<JSONObject> wholeHospitalTemplate() {
-        JSONArray data = emr.getEmrTree();
+        JSONArray data;
+        if (StrUtil.isBlank(systemConfig.getEmrZyDeptCode())) {
+            data = emr.getEmrTree();
+        } else {
+            data = emr.getDeptList(systemConfig.getEmrZyDeptCode());
+        }
         return emrToTree(data);
     }
 
@@ -551,6 +560,10 @@ public class EmrServer {
 
 
     public ResultVo<String> getDrgIntelligentGrouping(String patNo, Integer times) {
+        if (StrUtil.isBlank(apiUrl.getDrgWebApi())) {
+            return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "未找到DRG服务");
+        }
+
         // 获取诊断
         JSONArray diagnosis = getEmrData(patNo, times, EmrType.DIAGNOSIS);
         // 获取手术

+ 12 - 10
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/yizhuverify/YiZhuCheckData.java

@@ -3,6 +3,7 @@ package thyyxxk.webserver.service.zhuyuanyisheng.yizhuverify;
 import cn.hutool.extra.spring.SpringUtil;
 import lombok.Getter;
 import lombok.extern.slf4j.Slf4j;
+import thyyxxk.webserver.config.envionment.YzConfig;
 import thyyxxk.webserver.constants.Capacity;
 import thyyxxk.webserver.dao.his.zhuyuanyisheng.YiZhuLuRuDao;
 import thyyxxk.webserver.entity.login.UserInfo;
@@ -19,6 +20,7 @@ import java.util.function.Consumer;
 public class YiZhuCheckData {
     private final YiZhuLuRuDao dao;
     private final ExtraCache extraCache = SpringUtil.getBean(ExtraCache.class);
+    private final YzConfig yzConfig = SpringUtil.getBean(YzConfig.class);
 
 
     /**
@@ -193,21 +195,21 @@ public class YiZhuCheckData {
                 repel.setDate(item.getStartTime());
             }
 
-            List<String> strings = extraCache.getYzZdOrderItemMap().get("出院");
+            if (yzConfig.getExceedingDischargeDays() != -1) {
+                List<String> strings = extraCache.getYzZdOrderItemMap().get("出院");
+                if (strings.contains(item.getOrderCode())) {
+                    Date admissDate = cn.hutool.core.date.DateUtil.beginOfDay(patientInformation.getAdmissDate());
+                    Date orderTime = cn.hutool.core.date.DateUtil.beginOfDay(item.getOrderTime());
 
-            if (strings.contains(item.getOrderCode())) {
-                Date admissDate = cn.hutool.core.date.DateUtil.beginOfDay(patientInformation.getAdmissDate());
-                Date orderTime = cn.hutool.core.date.DateUtil.beginOfDay(item.getOrderTime());
+                    long betweenDay = cn.hutool.core.date.DateUtil.betweenDay(orderTime, admissDate, false);
 
-                long betweenDay = cn.hutool.core.date.DateUtil.betweenDay(orderTime, admissDate, false);
-
-                if (betweenDay <= 4) {
-                    if (item.getSuperiorDoctor() == null || !item.getSuperiorDoctor().equals(patientInformation.getDeptDirector())) {
-                        errorMessage.add("患者的住院天数小于等于4请科主任授权,开出院医嘱。");
+                    if (betweenDay <= yzConfig.getExceedingDischargeDays()) {
+                        if (item.getSuperiorDoctor() == null || !item.getSuperiorDoctor().equals(patientInformation.getDeptDirector())) {
+                            errorMessage.add("患者的住院天数小于等于4请科主任授权,开出院医嘱。");
+                        }
                     }
                 }
             }
-
         }
         item.setDrugOcc(item.getDrugQuan());
     }

+ 3 - 1
src/main/resources/application-dev.yml

@@ -14,7 +14,7 @@ spring:
     cache: false
   datasource:
     dynamic:
-      primary: his
+      primary: demo
       strict: false
       datasource:
         his:
@@ -174,6 +174,8 @@ thyy:
     socket-api: http://demo.hnthyy.cn:20922/thyy/api/socket
     scheduled-api: http://172.16.32.133:21702/thyy/scheduled/api
     tirdpart-api: http://172.16.32.160:21701/thyy/thirdpart/api
+    emr-editor-template-url: "http://webhis.thyy.cn:9281/"
+#    drg-web-api:
   archive:
     path: "Z:\\"
     archive-url: "http://172.16.32.197:20921/thyy/api/archive"

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

@@ -156,6 +156,7 @@ thyy:
     institution-name: "长沙泰和医院"
     institution-id: "H43010500370"
     institution-area: "430105"
+    emr-zy-dept-code:
   archive:
     path: "/mnt/archive"
     archive-url: http://172.16.32.197:20921/thyy/api/archive
@@ -164,6 +165,7 @@ thyy:
     scheduled-api: http://172.16.32.133:21702/thyy/scheduled/api
     tirdpart-api: http://172.16.32.160:21701/thyy/thirdpart/api
     drg-web-api: "http://172.16.32.126:8080"
+    emr-editor-template-url: "http://webhis.thyy.cn:9281/"
   jcptmobile:
     address: "https://emr.hnthyy.cn:8080"
     agentid: 1000050