Преглед изворни кода

1.修改规则:加用抗生素未记录、减用抗生素未记录
2.接入查房记录新模型:新增所有查房记录抽取:实验室检查、辅助检查、药品等

huj пре 5 година
родитељ
комит
968227e4ac
17 измењених фајлова са 522 додато и 103 уклоњено
  1. 99 27
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03074.java
  2. 99 27
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03075.java
  3. 30 9
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/ThreeLevelWardAI.java
  4. 29 3
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/model/EntityEnum.java
  5. 68 14
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessThreeLevelWard.java
  6. 17 0
      public/src/main/java/com/lantone/qc/pub/model/entity/AuxiliaryExamination.java
  7. 15 0
      public/src/main/java/com/lantone/qc/pub/model/entity/AuxiliaryExaminationResults.java
  8. 15 0
      public/src/main/java/com/lantone/qc/pub/model/entity/CheckTime.java
  9. 16 0
      public/src/main/java/com/lantone/qc/pub/model/entity/Consumption.java
  10. 20 0
      public/src/main/java/com/lantone/qc/pub/model/entity/Drug.java
  11. 18 0
      public/src/main/java/com/lantone/qc/pub/model/entity/Laboratory.java
  12. 16 0
      public/src/main/java/com/lantone/qc/pub/model/entity/LaboratoryPackage.java
  13. 13 0
      public/src/main/java/com/lantone/qc/pub/model/entity/LaboratoryResults.java
  14. 16 0
      public/src/main/java/com/lantone/qc/pub/model/entity/ReasonsForAntibiotic.java
  15. 16 0
      public/src/main/java/com/lantone/qc/pub/model/entity/Stop.java
  16. 15 0
      public/src/main/java/com/lantone/qc/pub/model/entity/UsageWardRound.java
  17. 20 23
      public/src/main/java/com/lantone/qc/pub/model/label/ThreeLevelWardLabel.java

+ 99 - 27
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03074.java

@@ -8,9 +8,12 @@ import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.DoctorAdviceDoc;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.model.entity.Drug;
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -32,6 +35,8 @@ public class THR03074 extends QCCatalogue {
         if (doctorAdviceDocs.size() == 0 || threeLevelWardDocs.size() == 0) {
             return;
         }
+        //抗生素及开医嘱时间(包括加用过抗生素的时间)     key:抗生素名    "2020-08-20,2020-08-21 ..."
+        Map<String, List<String>> antibioticDate = Maps.newHashMap();
         //抗生素加用集合   key:抗生素名    value:  0:未加用,1及以上:加用次数
         Map<String, Integer> antibioticStatus = Maps.newHashMap();
         //抗生素及各初始剂量     key:抗生素名    value:抗生素第一次使用时剂量
@@ -49,51 +54,118 @@ public class THR03074 extends QCCatalogue {
                 .map(x -> x.get("医嘱项目名称"))
                 .forEach(y -> antibioticStatus.put(y.replaceAll("[\\[国产\\]\\[进口\\]\\[合信\\]\\[合资\\]]", ""), 0));
 
-        String drugName = null, value = null;
+        String drugName = null, value = null, startDateStr = null;
         for (Map<String, String> structMap : docAdvStruct) {
             drugName = structMap.get("医嘱项目名称");
             value = structMap.get("医嘱单次剂量");
+            startDateStr = structMap.get("医嘱开始时间");
             drugName = drugName.replaceAll("[\\[国产\\]\\[进口\\]\\[合信\\]\\[合资\\]]", "");
-            double v = -1;
-            try {
-                v = Double.parseDouble(getNumber(value));
-            } catch (Exception e) {
-                System.out.println("THR03074:       " + drugName + ":" + value + "医嘱单次剂量解析异常");
-            }
-            if (!antibioticValue.containsKey(drugName) && v > 0) {
-                antibioticValue.put(drugName, v);
-            } else {
-                double beforeValue = antibioticValue.get(drugName);
-                if (beforeValue < v) {
-                    antibioticValue.put(drugName, v);//更新该抗生素使用值为更大的值
-                    antibioticStatus.put(drugName, antibioticStatus.get(drugName) + 1);
-                }
-            }
+            collectAntibioticInfo(antibioticDate, antibioticStatus, antibioticValue, drugName, value, startDateStr);
         }
 
-        //抗生素加用过的集合
-        List<String> addedAntibiotic = Lists.newArrayList();
-        //把抗生素加用次数过的抗生素塞进抗生素加用过的集合
+        //把抗生素没加用过的抗生素塞进抗生素加用过的集合
         for (Map.Entry<String, Integer> as : antibioticStatus.entrySet()) {
-            if (as.getValue() > 0) {
-                addedAntibiotic.add(as.getKey());
+            if (as.getValue() == 0) {
+                antibioticDate.remove(as.getKey());
             }
         }
         //抗生素加用过的集合如果为空,则一个抗生素都没有加用过,直接返回0
-        if (addedAntibiotic.size() == 0) {
+        if (antibioticDate.size() == 0) {
             return;
         }
 
+        //查房记录中抗生素及查房时间(包括加用过抗生素的时间)     key:抗生素名    "2020-08-20,2020-08-21 ..."
+        Map<String, List<String>> antibioticDateWard = Maps.newHashMap();
+        //查房记录中抗生素加用集合   key:抗生素名    value:  0:未加用,1及以上:加用次数
+        Map<String, Integer> antibioticStatusWard = Maps.newHashMap();
+        //查房记录中抗生素及各初始剂量     key:抗生素名    value:抗生素第一次使用时剂量
+        Map<String, Double> antibioticValueWard = Maps.newHashMap();
         List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
         for (ThreeLevelWardDoc doc : allDoctorWradDocs) {
-            Map<String, String> structureMap = doc.getStructureMap();
-            String content = CatalogueUtil.structureMapJoin(structureMap, Lists.newArrayList("体检", "病情记录"));
-            addedAntibiotic.removeIf(content::contains);//如果查房文本包含该抗生素,则从抗生素加用过的集合中删除该抗生素
+            if (doc.getThreeLevelWardLabel().size() == 0) {
+                continue;
+            }
+            ThreeLevelWardLabel label = doc.getThreeLevelWardLabel().get(0);
+            List<Drug> drugs = label.getDrugs();
+            for (Drug drug : drugs) {
+                if (drug.getConsumption() != null) {
+                    String consumption = drug.getConsumption().getName();
+                    collectAntibioticInfo(antibioticDateWard, antibioticStatusWard, antibioticValueWard, drug.getName(), consumption, doc.getStructureMap().get("查房日期"));
+                }
+            }
+        }
+        //把查房记录中没加用过的抗生素删除
+        for (Map.Entry<String, Integer> as : antibioticStatusWard.entrySet()) {
+            if (as.getValue() == 0) {
+                antibioticDateWard.remove(as.getKey());
+            }
         }
 
-        if (addedAntibiotic.size() > 0) {
+        List<String> miss = Lists.newArrayList();
+        String drugKey = null, start = null, change = null, wardStartStr = null, wardChangeStr = null;
+        List<String> dateList = null;
+        for (Map.Entry<String, List<String>> ad : antibioticDate.entrySet()) {
+            drugKey = ad.getKey();
+            if (!antibioticDateWard.containsKey(drugKey)) {
+                miss.add(drugKey);
+                continue;
+            }
+            dateList = ad.getValue();
+            int matchNum = 0;
+            for (int i = 0; i < dateList.size() - 1; i++) {
+                start = dateList.get(i);        //抗生素开医嘱时间
+                change = dateList.get(i + 1);   //抗生素用量改变时间
+                Date adStart = StringUtil.parseDateTime(start);
+                Date adChange = StringUtil.parseDateTime(change);
+                List<String> wardDateStr = antibioticDateWard.get(drugKey);
+                for (int j = 0; j < wardDateStr.size() - 1; j++) {
+                    wardStartStr = wardDateStr.get(j);         //查房记录开抗生素时间
+                    wardChangeStr = wardDateStr.get(j + 1);    //查房记录改变抗生素用量时间
+                    Date wardStart = StringUtil.parseDateTime(wardStartStr);
+                    Date wardChange = StringUtil.parseDateTime(wardChangeStr);
+                    if (!CatalogueUtil.compareTime(adStart, wardStart, 48 * 60L) && !CatalogueUtil.compareTime(adChange, wardChange, 48 * 60L)) {
+                        matchNum++;
+                    }
+                }
+            }
+            if (dateList.size() - 1 != matchNum) {
+                miss.add(drugKey);
+            }
+        }
+
+        if (miss.size() > 0) {
             status.set("-1");
-            info.set(addedAntibiotic.toString().replaceAll("[\\[\\]]", ""));
+            info.set(miss.toString().replaceAll("[\\[\\]]", ""));
+        }
+    }
+
+    /**
+     * 收集抗生素各种信息
+     *
+     * @param antibioticDate   抗生素使用所有时间
+     * @param antibioticStatus 抗生素用量改变状态
+     * @param antibioticValue  抗生素及用量
+     * @param drugName         抗生素名称
+     * @param value            抗生素用量
+     * @param startDateStr     抗生素使用时间(医嘱开始时间或查房时间)
+     */
+    private void collectAntibioticInfo(Map<String, List<String>> antibioticDate, Map<String, Integer> antibioticStatus, Map<String, Double> antibioticValue, String drugName, String value, String startDateStr) {
+        double v = -1;
+        try {
+            v = Double.parseDouble(getNumber(value));
+        } catch (Exception e) {
+            System.out.println("THR03074:       " + drugName + ":" + value + "解析异常");
+        }
+        if (!antibioticValue.containsKey(drugName) && v > 0) {
+            antibioticValue.put(drugName, v);
+            antibioticDate.put(drugName, Lists.newArrayList(startDateStr));
+        } else {
+            double beforeValue = antibioticValue.get(drugName);
+            if (beforeValue < v) {
+                antibioticValue.put(drugName, v);//更新该抗生素使用值为更大的值
+                antibioticStatus.put(drugName, antibioticStatus.get(drugName) + 1);
+                antibioticDate.get(drugName).add(startDateStr);
+            }
         }
     }
 

+ 99 - 27
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR03075.java

@@ -8,9 +8,12 @@ import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.doc.DoctorAdviceDoc;
 import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.model.entity.Drug;
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
 import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -32,6 +35,8 @@ public class THR03075 extends QCCatalogue {
         if (doctorAdviceDocs.size() == 0 || threeLevelWardDocs.size() == 0) {
             return;
         }
+        //抗生素及开医嘱时间(包括减用过抗生素的时间)     key:抗生素名    "2020-08-20,2020-08-21 ..."
+        Map<String, List<String>> antibioticDate = Maps.newHashMap();
         //抗生素减用集合   key:抗生素名    value:  0:未减用,1及以上:减用次数
         Map<String, Integer> antibioticStatus = Maps.newHashMap();
         //抗生素及各初始剂量     key:抗生素名    value:抗生素第一次使用时剂量
@@ -49,51 +54,118 @@ public class THR03075 extends QCCatalogue {
                 .map(x -> x.get("医嘱项目名称"))
                 .forEach(y -> antibioticStatus.put(y.replaceAll("[\\[国产\\]\\[进口\\]\\[合信\\]\\[合资\\]]", ""), 0));
 
-        String drugName = null, value = null;
+        String drugName = null, value = null, startDateStr = null;
         for (Map<String, String> structMap : docAdvStruct) {
             drugName = structMap.get("医嘱项目名称");
             value = structMap.get("医嘱单次剂量");
+            startDateStr = structMap.get("医嘱开始时间");
             drugName = drugName.replaceAll("[\\[国产\\]\\[进口\\]\\[合信\\]\\[合资\\]]", "");
-            double v = -1;
-            try {
-                v = Double.parseDouble(getNumber(value));
-            } catch (Exception e) {
-                System.out.println("THR03075:       " + drugName + ":" + value + "医嘱单次剂量解析异常");
-            }
-            if (!antibioticValue.containsKey(drugName) && v > 0) {
-                antibioticValue.put(drugName, v);
-            } else {
-                double beforeValue = antibioticValue.get(drugName);
-                if (beforeValue > v) {
-                    antibioticValue.put(drugName, v);//更新该抗生素使用值为更小的值
-                    antibioticStatus.put(drugName, antibioticStatus.get(drugName) + 1);
-                }
-            }
+            collectAntibioticInfo(antibioticDate, antibioticStatus, antibioticValue, drugName, value, startDateStr);
         }
 
-        //抗生素减用过的集合
-        List<String> reduceAntibiotic = Lists.newArrayList();
-        //把抗生素减用次数过的抗生素塞进抗生素减用过的集合
+        //把抗生素没减用过的抗生素塞进抗生素减用过的集合
         for (Map.Entry<String, Integer> as : antibioticStatus.entrySet()) {
-            if (as.getValue() > 0) {
-                reduceAntibiotic.add(as.getKey());
+            if (as.getValue() == 0) {
+                antibioticDate.remove(as.getKey());
             }
         }
         //抗生素减用过的集合如果为空,则一个抗生素都没有减用过,直接返回0
-        if (reduceAntibiotic.size() == 0) {
+        if (antibioticDate.size() == 0) {
             return;
         }
 
+        //查房记录中抗生素及查房时间(包括减用过抗生素的时间)     key:抗生素名    "2020-08-20,2020-08-21 ..."
+        Map<String, List<String>> antibioticDateWard = Maps.newHashMap();
+        //查房记录中抗生素减用集合   key:抗生素名    value:  0:未减用,1及以上:减用次数
+        Map<String, Integer> antibioticStatusWard = Maps.newHashMap();
+        //查房记录中抗生素及各初始剂量     key:抗生素名    value:抗生素第一次使用时剂量
+        Map<String, Double> antibioticValueWard = Maps.newHashMap();
         List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
         for (ThreeLevelWardDoc doc : allDoctorWradDocs) {
-            Map<String, String> structureMap = doc.getStructureMap();
-            String content = CatalogueUtil.structureMapJoin(structureMap, Lists.newArrayList("体检", "病情记录"));
-            reduceAntibiotic.removeIf(content::contains);//如果查房文本包含该抗生素,则从抗生素减用过的集合中删除该抗生素
+            if (doc.getThreeLevelWardLabel().size() == 0) {
+                continue;
+            }
+            ThreeLevelWardLabel label = doc.getThreeLevelWardLabel().get(0);
+            List<Drug> drugs = label.getDrugs();
+            for (Drug drug : drugs) {
+                if (drug.getConsumption() != null) {
+                    String consumption = drug.getConsumption().getName();
+                    collectAntibioticInfo(antibioticDateWard, antibioticStatusWard, antibioticValueWard, drug.getName(), consumption, doc.getStructureMap().get("查房日期"));
+                }
+            }
+        }
+        //把查房记录中没减用过的抗生素删除
+        for (Map.Entry<String, Integer> as : antibioticStatusWard.entrySet()) {
+            if (as.getValue() == 0) {
+                antibioticDateWard.remove(as.getKey());
+            }
         }
 
-        if (reduceAntibiotic.size() > 0) {
+        List<String> miss = Lists.newArrayList();
+        String drugKey = null, start = null, change = null, wardStartStr = null, wardChangeStr = null;
+        List<String> dateList = null;
+        for (Map.Entry<String, List<String>> ad : antibioticDate.entrySet()) {
+            drugKey = ad.getKey();
+            if (!antibioticDateWard.containsKey(drugKey)) {
+                miss.add(drugKey);
+                continue;
+            }
+            dateList = ad.getValue();
+            int matchNum = 0;
+            for (int i = 0; i < dateList.size() - 1; i++) {
+                start = dateList.get(i);        //抗生素开医嘱时间
+                change = dateList.get(i + 1);   //抗生素用量改变时间
+                Date adStart = StringUtil.parseDateTime(start);
+                Date adChange = StringUtil.parseDateTime(change);
+                List<String> wardDateStr = antibioticDateWard.get(drugKey);
+                for (int j = 0; j < wardDateStr.size() - 1; j++) {
+                    wardStartStr = wardDateStr.get(j);         //查房记录开抗生素时间
+                    wardChangeStr = wardDateStr.get(j + 1);    //查房记录改变抗生素用量时间
+                    Date wardStart = StringUtil.parseDateTime(wardStartStr);
+                    Date wardChange = StringUtil.parseDateTime(wardChangeStr);
+                    if (!CatalogueUtil.compareTime(adStart, wardStart, 48 * 60L) && !CatalogueUtil.compareTime(adChange, wardChange, 48 * 60L)) {
+                        matchNum++;
+                    }
+                }
+            }
+            if (dateList.size() - 1 != matchNum) {
+                miss.add(drugKey);
+            }
+        }
+
+        if (miss.size() > 0) {
             status.set("-1");
-            info.set(reduceAntibiotic.toString().replaceAll("[\\[\\]]", ""));
+            info.set(miss.toString().replaceAll("[\\[\\]]", ""));
+        }
+    }
+
+    /**
+     * 收集抗生素各种信息
+     *
+     * @param antibioticDate   抗生素使用所有时间
+     * @param antibioticStatus 抗生素用量改变状态
+     * @param antibioticValue  抗生素及用量
+     * @param drugName         抗生素名称
+     * @param value            抗生素用量
+     * @param startDateStr     抗生素使用时间(医嘱开始时间或查房时间)
+     */
+    private void collectAntibioticInfo(Map<String, List<String>> antibioticDate, Map<String, Integer> antibioticStatus, Map<String, Double> antibioticValue, String drugName, String value, String startDateStr) {
+        double v = -1;
+        try {
+            v = Double.parseDouble(getNumber(value));
+        } catch (Exception e) {
+            System.out.println("THR03074:       " + drugName + ":" + value + "解析异常");
+        }
+        if (!antibioticValue.containsKey(drugName) && v > 0) {
+            antibioticValue.put(drugName, v);
+            antibioticDate.put(drugName, Lists.newArrayList(startDateStr));
+        } else {
+            double beforeValue = antibioticValue.get(drugName);
+            if (beforeValue > v) {
+                antibioticValue.put(drugName, v);//更新该抗生素使用值为更小的值
+                antibioticStatus.put(drugName, antibioticStatus.get(drugName) + 1);
+                antibioticDate.get(drugName).add(startDateStr);
+            }
         }
     }
 

+ 30 - 9
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/ThreeLevelWardAI.java

@@ -2,6 +2,7 @@ package com.lantone.qc.kernel.structure.ai;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.google.common.collect.Lists;
 import com.lantone.qc.kernel.client.CRFServiceClient;
 import com.lantone.qc.kernel.structure.ai.process.EntityProcessThreeLevelWard;
 import com.lantone.qc.kernel.util.CatalogueUtil;
@@ -16,13 +17,9 @@ import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
 import com.lantone.qc.pub.util.ListUtil;
 import com.lantone.qc.pub.util.StringUtil;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * @ClassName : ThreeLevelWardAI
@@ -34,7 +31,7 @@ public class ThreeLevelWardAI extends ModelAI {
     /**
      *
      */
-    public static List<String> medicalTextType = Arrays.asList("CourseRecord_cx", "CourseRecordLast_cx");
+    public static List<String> medicalTextType = Arrays.asList("CourseRecord_cx", "CourseRecordLast_cx", "CourseRecordSRR");
     public static String entityRelationObject = "entity_relation_object";
     public static String outputs = "outputs";
     public static String content = "content";
@@ -64,10 +61,18 @@ public class ThreeLevelWardAI extends ModelAI {
             putContent(crfContent, medicalTextType.get(0), lastDirStructureMap.get("病情记录"), Content.director + "最后一次");
         }
 
-        List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDoc.getAllDoctorWradDocs();//所有查房记录
+        //所有查房记录,2020/08/20新增所有查房记录抽取:实验室检查、辅助检查、药品等
+        List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDoc.getAllDoctorWradDocs();
         if (allDoctorWradDocs.size() > 0) {
             Map<String, String> lastWardStructureMap = allDoctorWradDocs.get(allDoctorWradDocs.size() - 1).getStructureMap();
             putContent(crfContent, medicalTextType.get(1), lastWardStructureMap.get("病情记录"), "末次查房");
+            //2020/08/20新增所有查房记录抽取:实验室检查、辅助检查、药品等
+            for (int i = 0; i < allDoctorWradDocs.size(); i++) {
+                Map<String, String> structureMap = allDoctorWradDocs.get(i).getStructureMap();
+                String content = CatalogueUtil.structureMapJoin(structureMap, Lists.newArrayList("体检", "病情记录", "治疗计划和措施"));
+                putContent(crfContent, medicalTextType.get(2), content, "第" + i + "次查房");
+            }
+
         }
 
         List<Map<String, String>> directorDifficultRecord = new ArrayList<>();
@@ -124,6 +129,14 @@ public class ThreeLevelWardAI extends ModelAI {
             }
         }
 
+        //2020/08/20新增所有查房记录抽取:实验室检查、辅助检查、药品等
+        for (int i = 0; i < allDoctorWradDocs.size(); i++) {
+            if (midData.get("第" + i + "次查房") == null) {
+                continue;
+            }
+            putWardRoundCrfData(midData.getJSONObject("第" + i + "次查房"), inputInfo, 0);//查房记录
+        }
+
     }
 
     protected void putContent(JSONArray crfContent, String medicalTextType, String text, String sign, String wardDate) {
@@ -177,6 +190,14 @@ public class ThreeLevelWardAI extends ModelAI {
                     allDoctorWradDocs.get(allDoctorWradDocs.size() - 1).setThreeLevelWardLabel(lastWardLebelList);
                     break;
             }
+            //2020/08/20新增所有查房记录抽取:实验室检查、辅助检查、药品等
+            Pattern p = Pattern.compile("\\d");
+            Matcher matcher = p.matcher(detailTitle);
+            if (matcher.find()) {
+                String num = matcher.group(0);
+                int n = Integer.parseInt(num);
+                threeLevelWardDoc.getAllDoctorWradDocs().get(n).setThreeLevelWardLabel(Lists.newArrayList(threeLevelWardLabel));
+            }
         } else {
             List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDoc.getAllDoctorWradDocs();
             for (ThreeLevelWardDoc wardDoc : allDoctorWradDocs) {

+ 29 - 3
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/model/EntityEnum.java

@@ -18,7 +18,7 @@ public enum EntityEnum {
     UNKNOWN("情况不详"), HEALTH("健康情况"), AGE("年龄"), SMOKING_HISTORY("吸烟史"),
     HISTORY_OF_ALCOHOL_INTAKE("饮酒史"), USAGE("用量"), MENSES("月经"), LEUKORRHEA("白带"),
     BIRTH_HIS("生育情况"), CONJUGAL_RELATION("夫妻关系"), RELATIVES("家属"), GROUP_CONSULTATION("会诊"), ORGANISM("生物体"),
-    OCCUPATION("职业"), LOCATION("地点"), DEAD("死亡"), DEAD_REASON("死亡原因"),TUMOUR("肿瘤病史"),
+    OCCUPATION("职业"), LOCATION("地点"), DEAD("死亡"), DEAD_REASON("死亡原因"), TUMOUR("肿瘤病史"),
     SIMILAR_DISEASE_KEYWORD("相似疾病"), GENETIC_DISEASE_KEYWORD("家族遗传病"), EPIDEMIC_AREA_HISTORY("疫区史"), SPECIAL_HOBBY("特殊嗜好"),
     CONTACT_HISTORY("接触史"), MARITAL_HISTORY("冶游史"), MARITAL_STATUS("婚姻情况"), MARRYIAGE("结婚年龄"), NEAR_RELATION("近亲史"),
     CURE_AIM("治疗目的"), OTHER("其他"), OUTERCOURTYARD("外院"), NURSING_LEVEL("护理级别"), CHIEF("主诉"), NOTES("注意事项"),
@@ -27,8 +27,10 @@ public enum EntityEnum {
     TITLE_FOR_DIFF("鉴别诊断标题"), TITLE_FOR_TREAT("诊疗计划标题"), TITLE("标题"), TREATMENT_PLAN("诊疗计划"),
     TITLE_OF_OPERATIVE_FINDINGS("手术经过标题"), TITLE_OF_MEASURES_AFTER_OP("术后处理措施标题"),
     TITLE_OF_RISK_AFTER_OP("术后风险标题"), TITLE_OF_ATTENTION_AFTER_OP("术后注意事项标题"), VITAL("生命体征"),
-    BETTER_FINDING("好转表现"),OUTCOME_TO_BETTER("转归情况-好转"),OUTCOME_CURE("转归情况-治愈"),POSITIVE_FINDING("阳性表现"),
-    INSPECTION_ITEMS("检查项目"),DISCHARGE_MODE("出院方式");
+    BETTER_FINDING("好转表现"), OUTCOME_TO_BETTER("转归情况-好转"), OUTCOME_CURE("转归情况-治愈"), POSITIVE_FINDING("阳性表现"),
+    INSPECTION_ITEMS("检查项目"), DISCHARGE_MODE("出院方式"), LABORATORY_PACKAGE("实验室检查套餐"), LABORATORY_RESULTS("实验室检查结果"),
+    AUXILIARY_EXAMINATION_RESULTS("辅检结果"), CONSUMPTION("用量-查房"), USAGE_WARD_ROUND("用法"), STOP("停用"),
+    REASONS_FOR_ANTIBIOTIC("抗生素使用原因"),CHECK_TIME("检查时间");
 
     private String value;
 
@@ -235,6 +237,30 @@ public enum EntityEnum {
             case "出院方式":
                 entityEnum = EntityEnum.DISCHARGE_MODE;
                 break;
+            case "实验室检查套餐":
+                entityEnum = EntityEnum.LABORATORY_PACKAGE;
+                break;
+            case "实验室检查结果":
+                entityEnum = EntityEnum.LABORATORY_RESULTS;
+                break;
+            case "辅检结果":
+                entityEnum = EntityEnum.AUXILIARY_EXAMINATION_RESULTS;
+                break;
+            case "用量-查房":
+                entityEnum = EntityEnum.CONSUMPTION;
+                break;
+            case "用法":
+                entityEnum = EntityEnum.USAGE_WARD_ROUND;
+                break;
+            case "停用":
+                entityEnum = EntityEnum.STOP;
+                break;
+            case "抗生素使用原因":
+                entityEnum = EntityEnum.REASONS_FOR_ANTIBIOTIC;
+                break;
+            case "检查时间":
+                entityEnum = EntityEnum.CHECK_TIME;
+                break;
         }
         return entityEnum;
     }

+ 68 - 14
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessThreeLevelWard.java

@@ -3,21 +3,11 @@ package com.lantone.qc.kernel.structure.ai.process;
 import com.alibaba.fastjson.JSONObject;
 import com.lantone.qc.kernel.structure.ai.model.EntityEnum;
 import com.lantone.qc.kernel.structure.ai.model.Lemma;
-import com.lantone.qc.pub.model.entity.BetterFinding;
-import com.lantone.qc.pub.model.entity.Clinical;
-import com.lantone.qc.pub.model.entity.Diag;
-import com.lantone.qc.pub.model.entity.OutcomeCure;
-import com.lantone.qc.pub.model.entity.OutcomeToBetter;
-import com.lantone.qc.pub.model.entity.PositiveFinding;
-import com.lantone.qc.pub.model.entity.Sign;
-import com.lantone.qc.pub.model.entity.TreatmentPlan;
+import com.lantone.qc.pub.model.entity.*;
 import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import lombok.extern.slf4j.Slf4j;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * @ClassName : EntityProcessThreeLevelWard
@@ -25,6 +15,7 @@ import java.util.Map;
  * @Author : 胡敬
  * @Date: 2020-03-20 11:20
  */
+@Slf4j
 public class EntityProcessThreeLevelWard extends EntityProcess {
     private List<String> titleList = Arrays.asList(
             EntityEnum.TITLE_FOR_SIGN.toString(),
@@ -56,7 +47,7 @@ public class EntityProcessThreeLevelWard extends EntityProcess {
         }
 
         //诊断文本
-        if (titleText.get(EntityEnum.TITLE_FOR_DIAG.toString()) != null){
+        if (titleText.get(EntityEnum.TITLE_FOR_DIAG.toString()) != null) {
             List<String> diagList = titleText.get(EntityEnum.TITLE_FOR_DIAG.toString());
             String text = textJoin(content, diagList);
             //诊断文本
@@ -167,6 +158,69 @@ public class EntityProcessThreeLevelWard extends EntityProcess {
             positiveFindings.add(positiveFinding);
         }
         threeLevelWardLabel.setPositiveFindings(positiveFindings);
+
+        try {
+            //实验室检查套餐
+            List<LaboratoryPackage> laboratoryPackages = new ArrayList<>();
+            List<Lemma> laboratoryPackageLemmas = createEntityTree(aiOut, EntityEnum.LABORATORY_PACKAGE.toString());
+            for (Lemma lemma : laboratoryPackageLemmas) {
+                LaboratoryPackage laboratoryPackage = new LaboratoryPackage();
+                laboratoryPackage.setName(lemma.getText());
+                laboratoryPackage.setCheckTime(findT(lemma, new CheckTime(), EntityEnum.CHECK_TIME.toString()));
+                laboratoryPackages.add(laboratoryPackage);
+            }
+            threeLevelWardLabel.setLaboratoryPackages(laboratoryPackages);
+
+            //实验室检查
+            List<Laboratory> laboratories = new ArrayList<>();
+            List<Lemma> laboratoryLemmas = createEntityTree(aiOut, EntityEnum.LABORATORY.toString());
+            for (Lemma lemma : laboratoryLemmas) {
+                Laboratory laboratory = new Laboratory();
+                laboratory.setName(lemma.getText());
+                for (Lemma relationLemma : lemma.getRelationLemmas()) {
+                    if (relationLemma.getProperty().equals(EntityEnum.LABORATORY_PACKAGE.toString())) {
+                        LaboratoryPackage laboratoryPackage = new LaboratoryPackage();
+                        laboratoryPackage.setCheckTime(findT(lemma, new CheckTime(), EntityEnum.CHECK_TIME.toString()));
+                        laboratory.setLaboratoryPackage(findT(lemma, laboratoryPackage, EntityEnum.LABORATORY_PACKAGE.toString()));//实验室检查套餐
+                    }
+                }
+                laboratory.setCheckTime(findT(lemma, new CheckTime(), EntityEnum.CHECK_TIME.toString()));//检查时间
+                laboratory.setLaboratoryResults(findT(lemma, new LaboratoryResults(), EntityEnum.LABORATORY_RESULTS.toString()));//实验室检查结果
+                laboratories.add(laboratory);
+            }
+            threeLevelWardLabel.setLaboratories(laboratories);
+
+            //辅助检查
+            List<AuxiliaryExamination> auxiliaryExaminations = new ArrayList<>();
+            List<Lemma> auxiliaryExaminationLemmas = createEntityTree(aiOut, EntityEnum.AUXILIARY_EXAMINATION.toString());
+            for (Lemma lemma : auxiliaryExaminationLemmas) {
+                AuxiliaryExamination auxiliaryExamination = new AuxiliaryExamination();
+                auxiliaryExamination.setName(lemma.getText());
+                auxiliaryExamination.setCheckTime(findT(lemma, new CheckTime(), EntityEnum.CHECK_TIME.toString()));
+                auxiliaryExamination.setAuxiliaryExaminationResults(findT(lemma, new AuxiliaryExaminationResults(), EntityEnum.AUXILIARY_EXAMINATION_RESULTS.toString()));
+                auxiliaryExaminations.add(auxiliaryExamination);
+            }
+            threeLevelWardLabel.setAuxiliaryExaminations(auxiliaryExaminations);
+
+            //药物
+            List<Drug> drugs = new ArrayList<>();
+            List<Lemma> DrugLemmas = createEntityTree(aiOut, EntityEnum.DRUG.toString());
+            for (Lemma lemma : DrugLemmas) {
+                Drug drug = new Drug();
+                drug.setName(lemma.getText());
+                drug.setConsumption(findT(lemma, new Consumption(), EntityEnum.CONSUMPTION.toString().split("-")[0]));
+                drug.setUsageWardRound(findT(lemma, new UsageWardRound(), EntityEnum.USAGE_WARD_ROUND.toString()));
+                drug.setFrequency(findT(lemma, new Frequency(), EntityEnum.FREQUENCY.toString()));
+                drug.setStop(findT(lemma, new Stop(), EntityEnum.STOP.toString()));
+                drug.setReasonsForAntibiotic(findT(lemma, new ReasonsForAntibiotic(), EntityEnum.REASONS_FOR_ANTIBIOTIC.toString()));
+                drugs.add(drug);
+            }
+            threeLevelWardLabel.setDrugs(drugs);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error(e.getMessage(), e);
+        }
         return threeLevelWardLabel;
     }
 

+ 17 - 0
public/src/main/java/com/lantone/qc/pub/model/entity/AuxiliaryExamination.java

@@ -0,0 +1,17 @@
+package com.lantone.qc.pub.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : AuxiliaryExamination
+ * @Description : 辅助检查
+ * @Author : 胡敬
+ * @Date: 2020-08-20 10:09
+ */
+@Setter
+@Getter
+public class AuxiliaryExamination extends General {
+    private CheckTime checkTime;
+    private AuxiliaryExaminationResults auxiliaryExaminationResults;
+}

+ 15 - 0
public/src/main/java/com/lantone/qc/pub/model/entity/AuxiliaryExaminationResults.java

@@ -0,0 +1,15 @@
+package com.lantone.qc.pub.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : AuxiliaryExamination
+ * @Description : 辅助检查结果
+ * @Author : 胡敬
+ * @Date: 2020-08-20 10:09
+ */
+@Setter
+@Getter
+public class AuxiliaryExaminationResults extends General {
+}

+ 15 - 0
public/src/main/java/com/lantone/qc/pub/model/entity/CheckTime.java

@@ -0,0 +1,15 @@
+package com.lantone.qc.pub.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : CheckTime
+ * @Description : 检查时间
+ * @Author : 胡敬
+ * @Date: 2020-08-20 10:09
+ */
+@Setter
+@Getter
+public class CheckTime extends General {
+}

+ 16 - 0
public/src/main/java/com/lantone/qc/pub/model/entity/Consumption.java

@@ -0,0 +1,16 @@
+package com.lantone.qc.pub.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : Consumption
+ * @Description : 药物用量
+ * @Author : 胡敬
+ * @Date: 2020-08-20 10:09
+ */
+@Setter
+@Getter
+public class Consumption extends General {
+    
+}

+ 20 - 0
public/src/main/java/com/lantone/qc/pub/model/entity/Drug.java

@@ -0,0 +1,20 @@
+package com.lantone.qc.pub.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : Drug
+ * @Description : 药物名称
+ * @Author : 胡敬
+ * @Date: 2020-08-20 10:09
+ */
+@Setter
+@Getter
+public class Drug extends General {
+    private Consumption consumption;        //用量
+    private UsageWardRound usageWardRound;  //用法
+    private Frequency frequency;            //频率
+    private Stop stop;                      //停用
+    private ReasonsForAntibiotic reasonsForAntibiotic;  //抗生素使用原因
+}

+ 18 - 0
public/src/main/java/com/lantone/qc/pub/model/entity/Laboratory.java

@@ -0,0 +1,18 @@
+package com.lantone.qc.pub.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : Laboratory
+ * @Description : 实验室检查
+ * @Author : 胡敬
+ * @Date: 2020-08-20 10:09
+ */
+@Setter
+@Getter
+public class Laboratory extends General {
+    private LaboratoryPackage laboratoryPackage;
+    private CheckTime checkTime;
+    private LaboratoryResults laboratoryResults;
+}

+ 16 - 0
public/src/main/java/com/lantone/qc/pub/model/entity/LaboratoryPackage.java

@@ -0,0 +1,16 @@
+package com.lantone.qc.pub.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : LaboratoryResults
+ * @Description : 实验室检查套餐
+ * @Author : 胡敬
+ * @Date: 2020-08-20 10:09
+ */
+@Getter
+@Setter
+public class LaboratoryPackage extends General {
+    private CheckTime checkTime;
+}

+ 13 - 0
public/src/main/java/com/lantone/qc/pub/model/entity/LaboratoryResults.java

@@ -0,0 +1,13 @@
+package com.lantone.qc.pub.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : LaboratoryResults
+ * @Description : 实验室检查结果
+ * @Author : 胡敬
+ * @Date: 2020-08-20 10:09
+ */
+public class LaboratoryResults extends General {
+}

+ 16 - 0
public/src/main/java/com/lantone/qc/pub/model/entity/ReasonsForAntibiotic.java

@@ -0,0 +1,16 @@
+package com.lantone.qc.pub.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : ReasonsForAntibiotic
+ * @Description : 抗生素使用原因
+ * @Author : 胡敬
+ * @Date: 2020-08-20 10:09
+ */
+@Setter
+@Getter
+public class ReasonsForAntibiotic extends General {
+    
+}

+ 16 - 0
public/src/main/java/com/lantone/qc/pub/model/entity/Stop.java

@@ -0,0 +1,16 @@
+package com.lantone.qc.pub.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : Stop
+ * @Description : 停用
+ * @Author : 胡敬
+ * @Date: 2020-08-20 10:09
+ */
+@Setter
+@Getter
+public class Stop extends General {
+    
+}

+ 15 - 0
public/src/main/java/com/lantone/qc/pub/model/entity/UsageWardRound.java

@@ -0,0 +1,15 @@
+package com.lantone.qc.pub.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : UsageWardRound
+ * @Description : 用法
+ * @Author : 胡敬
+ * @Date: 2020-08-20 10:09
+ */
+@Setter
+@Getter
+public class UsageWardRound extends General {
+}

+ 20 - 23
public/src/main/java/com/lantone/qc/pub/model/label/ThreeLevelWardLabel.java

@@ -1,13 +1,6 @@
 package com.lantone.qc.pub.model.label;
 
-import com.lantone.qc.pub.model.entity.BetterFinding;
-import com.lantone.qc.pub.model.entity.Clinical;
-import com.lantone.qc.pub.model.entity.Diag;
-import com.lantone.qc.pub.model.entity.OutcomeCure;
-import com.lantone.qc.pub.model.entity.OutcomeToBetter;
-import com.lantone.qc.pub.model.entity.PositiveFinding;
-import com.lantone.qc.pub.model.entity.Sign;
-import com.lantone.qc.pub.model.entity.TreatmentPlan;
+import com.lantone.qc.pub.model.entity.*;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -23,19 +16,23 @@ import java.util.List;
 @Getter
 @Setter
 public class ThreeLevelWardLabel {
-    int serious = 0;    //0:不严重患者,1:危重患者,2:疑难患者,3:抢救患者
-    String title;   //医师职称
-    List<Clinical> clinicals = new ArrayList<>();   //病史(临床表现)
-    List<Sign> signs = new ArrayList<>();   //查体
-    List<Diag> diffDiag = new ArrayList<>();   //鉴别诊断
-    String diagBasisText;   //诊断依据文本
-    String diffDiagText;    //鉴别诊断文本
-    String diagText;    //诊断文本
-    List<Diag> diags = new ArrayList<>();   //补充诊断/初步诊断/修正诊断
-    String dischargeMode;  //离院方式
-    List<TreatmentPlan> treatmentPlans = new ArrayList<>();   //诊疗计划
-    List<BetterFinding> betterFindings = new ArrayList<>();   //好转表现
-    List<OutcomeToBetter> outcomeToBetters = new ArrayList<>();   //转归情况-好转
-    List<OutcomeCure> outcomeCures = new ArrayList<>();   //转归情况-治愈
-    List<PositiveFinding> positiveFindings = new ArrayList<>();   //阳性表现
+    private int serious = 0;    //0:不严重患者,1:危重患者,2:疑难患者,3:抢救患者
+    private String title;   //医师职称
+    private List<Clinical> clinicals = new ArrayList<>();   //病史(临床表现)
+    private List<Sign> signs = new ArrayList<>();   //查体
+    private List<Diag> diffDiag = new ArrayList<>();   //鉴别诊断
+    private String diagBasisText;   //诊断依据文本
+    private String diffDiagText;    //鉴别诊断文本
+    private String diagText;    //诊断文本
+    private List<Diag> diags = new ArrayList<>();   //补充诊断/初步诊断/修正诊断
+    private String dischargeMode;  //离院方式
+    private List<TreatmentPlan> treatmentPlans = new ArrayList<>();   //诊疗计划
+    private List<BetterFinding> betterFindings = new ArrayList<>();   //好转表现
+    private List<OutcomeToBetter> outcomeToBetters = new ArrayList<>();   //转归情况-好转
+    private List<OutcomeCure> outcomeCures = new ArrayList<>();   //转归情况-治愈
+    private List<PositiveFinding> positiveFindings = new ArrayList<>();   //阳性表现
+    private List<LaboratoryPackage> laboratoryPackages = new ArrayList<>();  //实验室检查套餐
+    private List<Laboratory> laboratories = new ArrayList<>();  //实验室检查
+    private List<AuxiliaryExamination> auxiliaryExaminations = new ArrayList<>();  //辅助检查
+    private List<Drug> drugs = new ArrayList<>();  //药物
 }