瀏覽代碼

电子病历不在后端分组了。

xiaochan 2 年之前
父節點
當前提交
de8a473b95

+ 4 - 5
src/main/java/thyyxxk/webserver/dao/his/zhuyuanyisheng/EmrPatientDao.java

@@ -28,12 +28,13 @@ public interface EmrPatientDao {
             "       modify_id, " +
             "       modify_date, " +
             "       name," +
-            "       submit " +
+            "       submit," +
+            "       sort " +
             "from emr_patient_data " +
             "where pat_no = #{patNo} " +
             "  and times = #{times}" +
             "  and del_flag = 0 " +
-            "  order by create_date ")
+            "  order by sort ")
     List<EmrPatientData> getPatientData(@Param("patNo") String patNo,
                                         @Param("times") Integer times);
 
@@ -150,12 +151,10 @@ public interface EmrPatientDao {
             "       ''                                                                                                     as xserytz, " +
             "       ''                                                                                                     as bzyzsnl " +
             "from zy_actpatient a, " +
-            "     a_patient_mi b, " +
-            "     mz_zy_req c " +
+            "     a_patient_mi b left join mz_zy_req c on (b.mz_no = c.patient_id) " +
             "where a.inpatient_no = #{patNo} " +
             "  and admiss_times = #{times} " +
             "  and a.inpatient_no = b.inpatient_no " +
-            "  and b.mz_no = c.patient_id " +
             "order by confirm_date desc")
     Map<String, String> drgPatientInfo(String patNo, int times, int ledgerSn);
 

+ 3 - 19
src/main/java/thyyxxk/webserver/service/zhuyuanyisheng/emr/EmrServer.java

@@ -7,6 +7,7 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.client.RestTemplate;
@@ -30,6 +31,7 @@ import thyyxxk.webserver.service.redislike.RedisLikeService;
 import thyyxxk.webserver.utils.*;
 import thyyxxk.webserver.websocket.WebSocketServer;
 
+import javax.annotation.PostConstruct;
 import javax.websocket.Session;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -39,7 +41,6 @@ import java.util.stream.Collectors;
 @Slf4j
 @DS("his")
 public class EmrServer {
-
     private final EmrPatientDao dao;
     private final EmrEditor emr;
     private final PublicServer publicServer;
@@ -62,24 +63,7 @@ public class EmrServer {
      * @return 数据
      */
     public ResultVo<List<EmrPatientData>> getPatientDataTree(String patNo, Integer times) {
-        List<EmrPatientData> data = new ArrayList<>();
-        Map<String, List<EmrPatientData>> map = dao.getPatientData(patNo, times).stream().collect(Collectors.groupingBy(EmrPatientData::getEmrCategoryCode));
-        for (Map.Entry<String, List<EmrPatientData>> key : map.entrySet()) {
-            if (key.getValue().size() == 1) {
-                data.add(key.getValue().get(0));
-            } else {
-                EmrPatientData item = new EmrPatientData();
-                List<EmrPatientData> children = new ArrayList<>();
-                for (int i = 0, len = key.getValue().size(); i < len; i++) {
-                    EmrPatientData childNode = key.getValue().get(i);
-                    children.add(childNode);
-                }
-                item.setName(key.getValue().get(0).getEmrName());
-                item.setChildren(new ArrayList<>()).getChildren().addAll(children);
-                data.add(item);
-            }
-        }
-        return ResultVoUtil.success(data);
+        return ResultVoUtil.success(dao.getPatientData(patNo, times));
     }
 
     public ResultVo<Map<String, List<JSONObject>>> getEmrTree(String type) {