Prechádzať zdrojové kódy

病历恢复和科室模板

DESKTOP-0GD05B0\Administrator 2 rokov pred
rodič
commit
cd09c2a913

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

@@ -36,7 +36,7 @@ public class EmrController {
     }
 
     @GetMapping("/getEmrTree")
-    public ResultVo<List<JSONObject>> getEmrTree() {
+    public ResultVo<Map<String, List<JSONObject>>> getEmrTree() {
         return server.getEmrTree();
     }
 
@@ -140,4 +140,9 @@ public class EmrController {
         return server.isDisReqEdit(patNo);
     }
 
+    @GetMapping("/getHistory")
+    public ResultVo<Object> getHistory(@RequestParam("documentId") String documentId) {
+        return server.getHistory(documentId);
+    }
+
 }

+ 8 - 6
src/main/java/thyyxxk/webserver/service/externalhttp/emr/EmrEditor.java

@@ -6,17 +6,15 @@ import com.dtflys.forest.annotation.*;
 
 
 public interface EmrEditor {
-    @Get("http://172.16.32.125:8001/emr/runtime/api/v1/category/tree")
+    @Get("http://172.16.32.125:8001/emr/runtime/api/v1/category/list/dept")
     JSONArray getEmrTree();
 
     @Get("http://172.16.32.125:8001/emr/runtime/api/v1/snippet/list/tree")
     JSONArray getSnippetTree();
 
-
     @Get("http://172.16.32.125:8001/emr/runtime/api/v1/document/docs/data/${id}?keyType=business")
     JSONObject getEditorJsonDataByDocumentId(@Query("id") String id);
 
-
     @Put("http://172.16.32.125:8001/emr/runtime/api/v1/document/recover/{id}")
     JSONObject resumeMedicalRecords(@Var("id") String id,
                                     @JSONBody JSONObject jsonObject);
@@ -24,12 +22,16 @@ public interface EmrEditor {
     @Get("http://172.16.32.125:8001/emr/runtime/api/v1/document/invalid/{id}")
     JSONObject getInvalidByDocumentIdApi(@Var("id") String id);
 
-
-    @Post("http://172.16.32.125:8001/emr/runtime/api/v1/document?history=0")
+    @Post("http://172.16.32.125:8001/emr/runtime/api/v1/document?history=1")
     JSONObject saveDocument(@JSONBody JSONObject jsonObject);
 
-
     @Delete("http://172.16.32.125:8001/emr/runtime/api/v1/document/{id}")
     JSONObject deleteEmr(@Var("id") String id);
 
+    @Get("http://172.16.32.125:8001/emr/runtime/api/v1/document/history/{id}")
+    Object getHistory(@Var("id") String id);
+
+    @Get("http://172.16.32.125:8001/emr/runtime/api/v1/category/list/dept?code={deptCode}")
+    JSONArray getDeptList(@Var("deptCode") String deptCode);
+
 }

+ 29 - 5
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/EmrServer.java

@@ -1,6 +1,5 @@
 package thyyxxk.webserver.service.zhuyuanyisheng;
 
-import cn.hutool.extra.spring.SpringUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -18,12 +17,14 @@ import thyyxxk.webserver.dao.his.zhuyuanyisheng.EmrPatientDao;
 import thyyxxk.webserver.entity.ResultVo;
 import thyyxxk.webserver.entity.dictionary.CodeName;
 import thyyxxk.webserver.entity.drg.AuxiliaryFillingOfDiagnosis;
+import thyyxxk.webserver.entity.login.UserInfo;
 import thyyxxk.webserver.entity.zhuyuanyisheng.emr.DischargedEmrModifyApply;
 import thyyxxk.webserver.entity.zhuyuanyisheng.emr.EmrDataElement;
 import thyyxxk.webserver.entity.zhuyuanyisheng.emr.EmrDataExtract;
 import thyyxxk.webserver.entity.zhuyuanyisheng.emr.EmrPatientData;
 import thyyxxk.webserver.service.PublicServer;
 import thyyxxk.webserver.service.externalhttp.emr.EmrEditor;
+import thyyxxk.webserver.service.redislike.RedisLikeService;
 import thyyxxk.webserver.utils.*;
 
 import java.util.*;
@@ -39,12 +40,14 @@ public class EmrServer {
     private final EmrEditor emr;
     private final PublicServer publicServer;
     private final LoginDao loginDao;
+    private final RedisLikeService realtimeService;
 
-    public EmrServer(EmrPatientDao dao, EmrEditor emr, PublicServer publicServer, LoginDao loginDao) {
+    public EmrServer(EmrPatientDao dao, EmrEditor emr, PublicServer publicServer, LoginDao loginDao, RedisLikeService realtimeService) {
         this.dao = dao;
         this.emr = emr;
         this.publicServer = publicServer;
         this.loginDao = loginDao;
+        this.realtimeService = realtimeService;
     }
 
     /**
@@ -75,15 +78,31 @@ public class EmrServer {
         return ResultVoUtil.success(data);
     }
 
+    public ResultVo<Map<String, List<JSONObject>>> getEmrTree() {
+        Map<String, List<JSONObject>> map = new HashMap<>();
+        map.put("all", wholeHospitalTemplate());
+        map.put("dept", getDeptTemplate());
+        return ResultVoUtil.success(map);
+    }
+
+    public List<JSONObject> getDeptTemplate() {
+        UserInfo user = realtimeService.getUserInfoByToken();
+        JSONArray data = emr.getDeptList(user.getDeptCode());
+        return emrToTree(data);
+    }
 
-    public ResultVo<List<JSONObject>> getEmrTree() {
+    public List<JSONObject> wholeHospitalTemplate() {
         JSONArray data = emr.getEmrTree();
+        return emrToTree(data);
+    }
+
+    public List<JSONObject> emrToTree(JSONArray data) {
         List<JSONObject> tree = new ArrayList<>();
         if (data.isEmpty()) {
-            return ResultVoUtil.success(tree);
+            return tree;
         }
         emrArrToTree(data, tree);
-        return ResultVoUtil.success(tree);
+        return tree;
     }
 
     private static void emrArrToTree(JSONArray data, List<JSONObject> tree) {
@@ -578,4 +597,9 @@ public class EmrServer {
         }
     }
 
+    public ResultVo<Object> getHistory(String documentId) {
+        return ResultVoUtil.success(emr.getHistory(documentId));
+    }
+
+
 }