Parcourir la source

处理三级查房模型入参出参,添加三级查房规则

hujing il y a 5 ans
Parent
commit
234fb1072a
19 fichiers modifiés avec 694 ajouts et 4 suppressions
  1. 39 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0130.java
  2. 39 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0131.java
  3. 42 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0132.java
  4. 39 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0133.java
  5. 39 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0134.java
  6. 44 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0135.java
  7. 39 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0136.java
  8. 42 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0137.java
  9. 39 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0138.java
  10. 39 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0139.java
  11. 75 0
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/ThreeLevelWardAI.java
  12. 3 1
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/model/EntityEnum.java
  13. 0 3
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessLeaveHospital.java
  14. 117 0
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessThreeLevelWard.java
  15. 44 0
      kernel/src/main/java/com/lantone/qc/kernel/util/CatalogueUtil.java
  16. 2 0
      public/src/main/java/com/lantone/qc/pub/model/doc/ThreeLevelWardDoc.java
  17. 12 0
      public/src/main/java/com/lantone/qc/pub/model/entity/Sign.java
  18. 10 0
      public/src/main/java/com/lantone/qc/pub/model/entity/TreatmentPlan.java
  19. 30 0
      public/src/main/java/com/lantone/qc/pub/model/label/ThreeLevelWardLabel.java

+ 39 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0130.java

@@ -0,0 +1,39 @@
+package com.lantone.qc.kernel.catalogue.threelevelward;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @ClassName : THR0130
+ * @Description : 上级医师(主治医师)首次查房对病史、查体无补充
+ * @Author : 胡敬
+ * @Date: 2020-03-23 14:16
+ */
+@Component
+public class THR0130 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getThreeLevelWardDocs().size() > 0) {
+            List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+            for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
+                if (StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
+                        || !Content.indications.equals(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())) {
+                    continue;
+                }
+                ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardDoc.getThreeLevelWardLabel();
+                if (threeLevelWardLabel.getClinicals().size() == 0 && threeLevelWardLabel.getSigns().size() == 0) {
+                    status = "-1";
+                    return;
+                }
+            }
+        }
+    }
+}

+ 39 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0131.java

@@ -0,0 +1,39 @@
+package com.lantone.qc.kernel.catalogue.threelevelward;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @ClassName : THR0131
+ * @Description : 上级医师(主治医师)首次查房无鉴别诊断
+ * @Author : 胡敬
+ * @Date: 2020-03-23 14:16
+ */
+@Component
+public class THR0131 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getThreeLevelWardDocs().size() > 0) {
+            List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+            for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
+                if (StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
+                        || !Content.indications.equals(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())) {
+                    continue;
+                }
+                ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardDoc.getThreeLevelWardLabel();
+                if (threeLevelWardLabel.getDiffDiag().size() == 0 && StringUtil.isBlank(threeLevelWardLabel.getDiffDiagText())) {
+                    status = "-1";
+                    return;
+                }
+            }
+        }
+    }
+}

+ 42 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0132.java

@@ -0,0 +1,42 @@
+package com.lantone.qc.kernel.catalogue.threelevelward;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @ClassName : THR0132
+ * @Description : 上级医师(主治医师)首次查房无病情分析/评估
+ * @Author : 胡敬
+ * @Date: 2020-03-23 14:16
+ */
+@Component
+public class THR0132 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getThreeLevelWardDocs().size() > 0) {
+            List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+            for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
+                if (StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
+                        || !Content.indications.equals(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())) {
+                    continue;
+                }
+                ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardDoc.getThreeLevelWardLabel();
+                if (threeLevelWardLabel.getDiags().size() == 0
+                        || StringUtil.isNotBlank(threeLevelWardLabel.getDiagBasisText()) && threeLevelWardLabel.getDiagBasisText().length() < 30
+                        || threeLevelWardLabel.getDiffDiag().size() == 0 && StringUtil.isBlank(threeLevelWardLabel.getDiffDiagText())
+                        || threeLevelWardLabel.getTreatmentPlans().size() == 0) {
+                    status = "-1";
+                    return;
+                }
+            }
+        }
+    }
+}

+ 39 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0133.java

@@ -0,0 +1,39 @@
+package com.lantone.qc.kernel.catalogue.threelevelward;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @ClassName : THR0133
+ * @Description : 上级医师(主治医师)首次查房无诊疗计划
+ * @Author : 胡敬
+ * @Date: 2020-03-23 14:16
+ */
+@Component
+public class THR0133 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getThreeLevelWardDocs().size() > 0) {
+            List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+            for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
+                if (StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
+                        || !Content.indications.equals(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())) {
+                    continue;
+                }
+                ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardDoc.getThreeLevelWardLabel();
+                if (threeLevelWardLabel.getTreatmentPlans().size() == 0) {
+                    status = "-1";
+                    return;
+                }
+            }
+        }
+    }
+}

+ 39 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0134.java

@@ -0,0 +1,39 @@
+package com.lantone.qc.kernel.catalogue.threelevelward;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @ClassName : THR0134
+ * @Description : 上级医师(主治医师)首次查房无补充诊断/初步诊断/修正诊断
+ * @Author : 胡敬
+ * @Date: 2020-03-23 14:16
+ */
+@Component
+public class THR0134 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getThreeLevelWardDocs().size() > 0) {
+            List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+            for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
+                if (StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
+                        || !Content.indications.equals(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())) {
+                    continue;
+                }
+                ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardDoc.getThreeLevelWardLabel();
+                if (threeLevelWardLabel.getDiags().size() == 0) {
+                    status = "-1";
+                    return;
+                }
+            }
+        }
+    }
+}

+ 44 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0135.java

@@ -0,0 +1,44 @@
+package com.lantone.qc.kernel.catalogue.threelevelward;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.kernel.util.CatalogueUtil;
+import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName : THR0135
+ * @Description : 上级医师(副主任医师/主任医师)首次查房对病史、查体无补充
+ * @Author : 胡敬
+ * @Date: 2020-03-23 14:16
+ */
+@Component
+public class THR0135 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getThreeLevelWardDocs().size() > 0) {
+            List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+            for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
+                if (StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
+                        || !Content.director.equals(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())) {
+                    continue;
+                }
+                ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardDoc.getThreeLevelWardLabel();
+                if (threeLevelWardLabel.getClinicals().size() == 0 && threeLevelWardLabel.getSigns().size() == 0) {
+                    status = "-1";
+                    return;
+                }
+            }
+        }
+    }
+}

+ 39 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0136.java

@@ -0,0 +1,39 @@
+package com.lantone.qc.kernel.catalogue.threelevelward;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @ClassName : THR0136
+ * @Description : 上级医师(副主任医师/主任医师)首次查房无鉴别诊断
+ * @Author : 胡敬
+ * @Date: 2020-03-23 14:16
+ */
+@Component
+public class THR0136 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getThreeLevelWardDocs().size() > 0) {
+            List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+            for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
+                if (StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
+                        || !Content.director.equals(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())) {
+                    continue;
+                }
+                ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardDoc.getThreeLevelWardLabel();
+                if (threeLevelWardLabel.getDiffDiag().size() == 0 && StringUtil.isBlank(threeLevelWardLabel.getDiffDiagText())) {
+                    status = "-1";
+                    return;
+                }
+            }
+        }
+    }
+}

+ 42 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0137.java

@@ -0,0 +1,42 @@
+package com.lantone.qc.kernel.catalogue.threelevelward;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @ClassName : THR0137
+ * @Description : 上级医师(副主任医师/主任医师)首次查房无病情分析/评估
+ * @Author : 胡敬
+ * @Date: 2020-03-23 14:16
+ */
+@Component
+public class THR0137 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getThreeLevelWardDocs().size() > 0) {
+            List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+            for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
+                if (StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
+                        || !Content.director.equals(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())) {
+                    continue;
+                }
+                ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardDoc.getThreeLevelWardLabel();
+                if (threeLevelWardLabel.getDiags().size() == 0
+                        || StringUtil.isNotBlank(threeLevelWardLabel.getDiagBasisText()) && threeLevelWardLabel.getDiagBasisText().length() < 30
+                        || threeLevelWardLabel.getDiffDiag().size() == 0 && StringUtil.isBlank(threeLevelWardLabel.getDiffDiagText())
+                        || threeLevelWardLabel.getTreatmentPlans().size() == 0) {
+                    status = "-1";
+                    return;
+                }
+            }
+        }
+    }
+}

+ 39 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0138.java

@@ -0,0 +1,39 @@
+package com.lantone.qc.kernel.catalogue.threelevelward;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @ClassName : THR0138
+ * @Description : 上级医师(副主任医师/主任医师)首次查房无诊疗计划
+ * @Author : 胡敬
+ * @Date: 2020-03-23 14:16
+ */
+@Component
+public class THR0138 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getThreeLevelWardDocs().size() > 0) {
+            List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+            for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
+                if (StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
+                        || !Content.director.equals(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())) {
+                    continue;
+                }
+                ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardDoc.getThreeLevelWardLabel();
+                if (threeLevelWardLabel.getTreatmentPlans().size() == 0) {
+                    status = "-1";
+                    return;
+                }
+            }
+        }
+    }
+}

+ 39 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0139.java

@@ -0,0 +1,39 @@
+package com.lantone.qc.kernel.catalogue.threelevelward;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @ClassName : THR0139
+ * @Description : 上级医师(副主任医师/主任医师)首次查房无补充诊断/初步诊断/修正诊断
+ * @Author : 胡敬
+ * @Date: 2020-03-23 14:16
+ */
+@Component
+public class THR0139 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getThreeLevelWardDocs().size() > 0) {
+            List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+            for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
+                if (StringUtil.isBlank(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())
+                        || !Content.director.equals(threeLevelWardDoc.getThreeLevelWardLabel().getTitle())) {
+                    continue;
+                }
+                ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardDoc.getThreeLevelWardLabel();
+                if (threeLevelWardLabel.getDiags().size() == 0) {
+                    status = "-1";
+                    return;
+                }
+            }
+        }
+    }
+}

+ 75 - 0
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/ThreeLevelWardAI.java

@@ -0,0 +1,75 @@
+package com.lantone.qc.kernel.structure.ai;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.lantone.qc.kernel.client.CRFServiceClient;
+import com.lantone.qc.kernel.structure.ai.process.EntityProcessThreeLevelWard;
+import com.lantone.qc.kernel.util.CatalogueUtil;
+import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.doc.ThreeLevelWardDoc;
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName : ThreeLevelWardAI
+ * @Description :
+ * @Author : 胡敬
+ * @Date: 2020-03-23 09:52
+ */
+public class ThreeLevelWardAI extends ModelAI {
+    /**
+     *
+     */
+    public static List<String> medicalTextType = Arrays.asList("CourseRecord");
+    public static String entityRelationObject = "entity_relation_object";
+    public static String outputs = "outputs";
+    public static String content = "content";
+
+    public void medrec(InputInfo inputInfo, CRFServiceClient crfServiceClient) {
+        JSONArray crfContent = new JSONArray();
+        List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+        //主治/主任首次查房记录
+        Map<String, Map<String, String>> firstWardRecord = CatalogueUtil.extractWardRecord(threeLevelWardDocs);
+        //主治医师首次查房记录
+        if (firstWardRecord.get(Content.indications) != null) {
+            putContent(crfContent, medicalTextType.get(0), firstWardRecord.get(Content.indications).get("病情记录"), Content.indications);
+        }
+        //主任医师首次查房记录
+        if (firstWardRecord.get(Content.director) != null) {
+            putContent(crfContent, medicalTextType.get(0), firstWardRecord.get(Content.director).get("病情记录"), Content.director);
+        }
+
+        JSONObject midData = loadAI(crfContent, crfServiceClient);//crf返回数据
+
+        //主治医师首次查房记录模型输出
+        if (midData.get(Content.indications) != null) {
+            putWardRoundCrfData(midData.getJSONObject(Content.indications), inputInfo, Content.indications);//查房记录
+        }
+        //主任医师首次查房记录模型输出
+        if (midData.get(Content.director) != null) {
+            putWardRoundCrfData(midData.getJSONObject(Content.director), inputInfo, Content.indications);//查房记录
+        }
+    }
+
+    /**
+     * 处理查房记录
+     *
+     * @param jsonObject
+     * @param inputInfo
+     */
+    public void putWardRoundCrfData(JSONObject jsonObject, InputInfo inputInfo, String detailTitle) {
+        JSONObject aiOut = loadEntity(jsonObject, entityRelationObject, outputs, content);
+        //使用现病史结构来处理病历特点
+        EntityProcessThreeLevelWard entityProcessThreeLevelWard = new EntityProcessThreeLevelWard();
+        ThreeLevelWardLabel threeLevelWardLabel = entityProcessThreeLevelWard.extractEntity(aiOut);
+        threeLevelWardLabel.setTitle(detailTitle);
+        ThreeLevelWardDoc threeLevelWardDoc = new ThreeLevelWardDoc();
+        threeLevelWardDoc.setThreeLevelWardLabel(threeLevelWardLabel);
+        //临床表现
+        inputInfo.getThreeLevelWardDocs().add(threeLevelWardDoc);
+    }
+}

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

@@ -22,7 +22,9 @@ public enum EntityEnum {
     SIMILAR_DISEASE_KEYWORD("相似疾病"), GENETIC_DISEASE_KEYWORD("家族遗传病"), EPIDEMIC_AREA_HISTORY("疫区史"), SPECIAL_HOBBY("特殊嗜好"),
     CONTACT_HISTORY("接触史"), MARITAL_HISTORY("冶游史"), MARITAL_STATUS("婚姻情况"), MARRYIAGE("结婚年龄"), NEAR_RELATION("近亲史"),
     CURE_AIM("治疗目的"), OTHER("其他"), OUTERCOURTYARD("外院"), NURSINGLEVEL("护理级别"), CHIEF("主诉"), NOTES("注意事项"),
-    KEY_WORD_FOR_DOCTOR_ADVICES("出院医嘱标题"), DOCTORADVICE("医嘱"), KEY_WORD_FOR_PART("大标题"), OUTCOME("转归情况");
+    KEY_WORD_FOR_DOCTOR_ADVICES("出院医嘱标题"), DOCTORADVICE("医嘱"), KEY_WORD_FOR_PART("大标题"), OUTCOME("转归情况"),
+    PHYSICAL_EXAMINATION("查体"),TITLE_FOR_DIAG_BASIS("诊断依据标题"),TITLE_FOR_DIFF("鉴别诊断标题"),TITLE_FOR_TREAT("诊疗计划标题"),
+    TREATMENT_PLAN("诊疗计划");
 
     private String value;
 

+ 0 - 3
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessLeaveHospital.java

@@ -5,12 +5,9 @@ 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.Chief;
 import com.lantone.qc.pub.model.entity.DoctorAdvice;
-import com.lantone.qc.pub.model.entity.Medicine;
 import com.lantone.qc.pub.model.entity.Notes;
-import com.lantone.qc.pub.model.entity.NursingLevel;
 import com.lantone.qc.pub.model.entity.Outcome;
 import com.lantone.qc.pub.model.label.LeaveHospitalLabel;
-import com.lantone.qc.pub.model.label.TreatPlanLabel;
 
 import java.util.ArrayList;
 import java.util.List;

+ 117 - 0
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessThreeLevelWard.java

@@ -0,0 +1,117 @@
+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.Clinical;
+import com.lantone.qc.pub.model.entity.Diag;
+import com.lantone.qc.pub.model.entity.Sign;
+import com.lantone.qc.pub.model.entity.TreatmentPlan;
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName : EntityProcessThreeLevelWard
+ * @Description : 查房记录
+ * @Author : 胡敬
+ * @Date: 2020-03-20 11:20
+ */
+public class EntityProcessThreeLevelWard extends EntityProcess {
+    public ThreeLevelWardLabel extractEntity(JSONObject aiOut) {
+        ThreeLevelWardLabel threeLevelWardLabel = new ThreeLevelWardLabel();
+        String content = aiOut.getString("content");
+        int titleForDiagBasisIndex = 0, titleForDiffIndex = 0, titleForTreatIndex = 0;
+        List<Lemma> diagBasisLemmas = createEntityTree(aiOut, EntityEnum.TITLE_FOR_DIAG_BASIS.toString());
+        List<Lemma> diagDiffLemmas = createEntityTree(aiOut, EntityEnum.TITLE_FOR_DIFF.toString());
+        List<Lemma> treatLemmas = createEntityTree(aiOut, EntityEnum.TITLE_FOR_TREAT.toString());
+        if (diagBasisLemmas.size() > 0) {
+            titleForDiagBasisIndex = content.indexOf(diagBasisLemmas.get(0).getText());//诊断依据标题起始位置
+        }
+        if (diagDiffLemmas.size() > 0) {
+            titleForDiffIndex = content.indexOf(diagDiffLemmas.get(0).getText());//鉴别诊断标题起始位置
+        }
+        if (treatLemmas.size() > 0) {
+            titleForTreatIndex = content.indexOf(treatLemmas.get(0).getText());//诊疗计划标题起始位置
+        }
+
+        //诊断依据文本
+        if (titleForDiagBasisIndex > 0 && titleForDiffIndex > 0) {
+            threeLevelWardLabel.setDiagBasisText(content.substring(titleForDiagBasisIndex, titleForDiffIndex));
+        }
+        //病史(在 诊断依据,鉴别诊断 以外的片段中出现 任一 临床表现)
+        if (titleForDiagBasisIndex > 0) {
+            List<Lemma> clinicalLemmas = createEntityTree(aiOut, EntityEnum.CLINICAL_FEATURE.toString());
+            List<Clinical> clinicals = new ArrayList<>();
+            for (Lemma lemma : clinicalLemmas) {
+                if (Integer.parseInt(lemma.getPosition()) > titleForDiagBasisIndex) {
+                    continue;
+                }
+                Clinical clinical = new Clinical();
+                clinical.setName(lemma.getText());
+                clinicals.add(clinical);
+            }
+            threeLevelWardLabel.setClinicals(clinicals);
+        }
+
+        //查体
+        List<Lemma> signLemmas = createEntityTree(aiOut, EntityEnum.PHYSICAL_EXAMINATION.toString());
+        List<Sign> signs = new ArrayList<>();
+        for (Lemma lemma : signLemmas) {
+            Sign sign = new Sign();
+            sign.setName(lemma.getText());
+            signs.add(sign);
+        }
+        threeLevelWardLabel.setSigns(signs);
+
+        //鉴别诊断
+        if (titleForDiffIndex > 0) {
+            List<Diag> diags = new ArrayList<>();
+            List<Lemma> dieaseLemmas = createEntityTree(aiOut, EntityEnum.DIEASE.toString());
+            for (Lemma dieaseLemma : dieaseLemmas) {
+                if (Integer.parseInt(dieaseLemma.getPosition()) < titleForDiffIndex
+                        || Integer.parseInt(dieaseLemma.getPosition()) > titleForTreatIndex) {
+                    continue;
+                }
+                Diag diag = new Diag();
+                diag.setName(dieaseLemma.getText());
+                diags.add(diag);
+            }
+            threeLevelWardLabel.setDiffDiag(diags);
+
+            for (Lemma lemma : diagDiffLemmas) {
+                if (lemma.getText().contains("诊断明确") || lemma.getText().contains("无需鉴别")) {
+                    threeLevelWardLabel.setDiffDiagText(lemma.getText());
+                    break;
+                }
+            }
+        }
+
+        //补充诊断/初步诊断/修正诊断
+        if (titleForDiagBasisIndex > 0 && titleForTreatIndex > 0) {
+            List<Lemma> dieaseLemmas = createEntityTree(aiOut, EntityEnum.DIEASE.toString());
+            List<Diag> diags = new ArrayList<>();
+            for (Lemma dieaseLemma : dieaseLemmas) {
+                if (Integer.parseInt(dieaseLemma.getPosition()) < titleForDiagBasisIndex
+                        || Integer.parseInt(dieaseLemma.getPosition()) > titleForTreatIndex) {
+                    Diag diag = new Diag();
+                    diag.setName(dieaseLemma.getText());
+                    diags.add(diag);
+                }
+            }
+            threeLevelWardLabel.setDiags(diags);
+        }
+
+        //诊疗计划
+        List<Lemma> treatmentPlanLemmas = createEntityTree(aiOut, EntityEnum.TREATMENT_PLAN.toString());
+        List<TreatmentPlan> treatmentPlans = new ArrayList<>();
+        for (Lemma lemma : treatmentPlanLemmas) {
+            TreatmentPlan treatmentPlan = new TreatmentPlan();
+            treatmentPlan.setName(lemma.getText());
+            treatmentPlans.add(treatmentPlan);
+        }
+        threeLevelWardLabel.setTreatmentPlans(treatmentPlans);
+        return threeLevelWardLabel;
+    }
+}

+ 44 - 0
kernel/src/main/java/com/lantone/qc/kernel/util/CatalogueUtil.java

@@ -217,6 +217,50 @@ public class CatalogueUtil {
         return overtime;
     }
 
+    /**
+     * 第一条主治医师查房记录以及第一条主任/副主任医师查房记录
+     *
+     * @param threeLevelWardDocs
+     * @return
+     */
+    public static Map<String, Map<String, String>> extractWardRecord(List<ThreeLevelWardDoc> threeLevelWardDocs) {
+        Map<Date, Map<String, String>> dateRecord = new HashMap<>();
+        List<Map<String, String>> sortRecord = new ArrayList<>();
+        Map<String, Map<String, String>> doctorRecord = new HashMap<>();
+        String recordTime = "";
+        for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
+            Map<String, String> threeLevelWardStructureMap = threeLevelWardDoc.getStructureMap();
+            recordTime = threeLevelWardStructureMap.get("查房日期");
+            Date recordDate = StringUtil.parseDateTime(recordTime);
+            if (recordDate == null) {
+                continue;
+            }
+            dateRecord.put(recordDate, threeLevelWardStructureMap);
+        }
+        dateRecord.entrySet().stream().sorted(Map.Entry.comparingByKey()).forEachOrdered(
+                x -> sortRecord.add(x.getValue())
+        );
+        //按时间排好序查房记录的第一条主治医师查房记录存进doctorRecord
+        for (Map<String, String> record : sortRecord) {
+            String roundTitle = record.get("查房标题");
+            if (!isEmpty(roundTitle) && !CatalogueUtil.subTitle(record.get("查房标题")).contains(Content.indications)) {
+                continue;
+            }
+            doctorRecord.put(Content.indications, record);
+            break;
+        }
+        //按时间排好序查房记录的第一条主任医师/副主任医师查房记录存进doctorRecord
+        for (Map<String, String> record : sortRecord) {
+            String roundTitle = record.get("查房标题");
+            if (!isEmpty(roundTitle) && !CatalogueUtil.subTitle(record.get("查房标题")).contains(Content.director)) {
+                continue;
+            }
+            doctorRecord.put(Content.director, record);
+            break;
+        }
+        return doctorRecord;
+    }
+
     /**
      * 获取查房记录标题中医师职称
      *

+ 2 - 0
public/src/main/java/com/lantone/qc/pub/model/doc/ThreeLevelWardDoc.java

@@ -1,5 +1,6 @@
 package com.lantone.qc.pub.model.doc;
 
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -12,4 +13,5 @@ import lombok.Setter;
 @Getter
 @Setter
 public class ThreeLevelWardDoc extends ModelDoc {
+    private ThreeLevelWardLabel threeLevelWardLabel;
 }

+ 12 - 0
public/src/main/java/com/lantone/qc/pub/model/entity/Sign.java

@@ -0,0 +1,12 @@
+package com.lantone.qc.pub.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 查体
+*/
+@Setter
+@Getter
+public class Sign extends General{
+}

+ 10 - 0
public/src/main/java/com/lantone/qc/pub/model/entity/TreatmentPlan.java

@@ -0,0 +1,10 @@
+package com.lantone.qc.pub.model.entity;
+
+/**
+ * @ClassName : Trend
+ * @Description : 诊疗计划
+ * @Author : 胡敬
+ * @Date: 2020-03-23 10:51
+ */
+public class TreatmentPlan extends General{
+}

+ 30 - 0
public/src/main/java/com/lantone/qc/pub/model/label/ThreeLevelWardLabel.java

@@ -0,0 +1,30 @@
+package com.lantone.qc.pub.model.label;
+
+import com.lantone.qc.pub.model.entity.Clinical;
+import com.lantone.qc.pub.model.entity.Diag;
+import com.lantone.qc.pub.model.entity.Sign;
+import com.lantone.qc.pub.model.entity.TreatmentPlan;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName : ThreeLevelWardLabel
+ * @Description :
+ * @Author : 胡敬
+ * @Date: 2020-03-23 10:21
+ */
+@Getter
+@Setter
+public class ThreeLevelWardLabel {
+    String title;   //医师职称
+    List<Clinical> clinicals = new ArrayList<>();   //病史(临床表现)
+    List<Sign> signs = new ArrayList<>();   //查体
+    List<Diag> diffDiag = new ArrayList<>();   //鉴别诊断
+    String diagBasisText;   //诊断依据文本
+    String diffDiagText;    //鉴别诊断文本
+    List<Diag> diags = new ArrayList<>();   //补充诊断/初步诊断/修正诊断
+    List<TreatmentPlan> treatmentPlans = new ArrayList<>();   //诊疗计划
+}