소스 검색

病案首页添加规则:转归情况填写错误

hujing 5 년 전
부모
커밋
5d3346c0e7

+ 91 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0256.java

@@ -0,0 +1,91 @@
+package com.lantone.qc.kernel.catalogue.firstpagerecord;
+
+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.entity.BetterFinding;
+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.label.LeaveHospitalLabel;
+import com.lantone.qc.pub.model.label.ThreeLevelWardLabel;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ClassName : FIRP0256
+ * @Description : 转归情况填写错误
+ * @Author : 胡敬
+ * @Date: 2020-03-25 16:33
+ */
+@Component
+public class FIRP0256 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status = "0";
+        if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null
+                && inputInfo.getThreeLevelWardDocs().size() > 0
+                && inputInfo.getLeaveHospitalDoc() != null && inputInfo.getLeaveHospitalDoc().getLeaveHospitalLabel() != null
+                && inputInfo.getLeaveHospitalDoc().getLeaveHospitalLabel() != null) {
+            Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
+            String outcome = firstpageStructureMap.get(Content.outcome);    //病案首页转归情况
+            if (CatalogueUtil.isEmpty(outcome)) {
+                return;
+            }
+
+            List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+            //最后一次主任查房记录、出院小结转归情况
+            List<BetterFinding> betterFindings = new ArrayList<>();//好转表现
+            List<OutcomeToBetter> outcomeToBetters = new ArrayList<>();//转归情况-好转
+            List<OutcomeCure> outcomeCures = new ArrayList<>();//转归情况-治愈
+            List<PositiveFinding> positiveFindings = new ArrayList<>();//阳性表现
+            for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
+                if (!threeLevelWardDoc.getThreeLevelWardLabel().getTitle().contains("最后一次")) {
+                    continue;
+                }
+                ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardDoc.getThreeLevelWardLabel();
+                betterFindings = threeLevelWardLabel.getBetterFindings();
+                outcomeToBetters = threeLevelWardLabel.getOutcomeToBetters();
+                outcomeCures = threeLevelWardLabel.getOutcomeCures();
+                positiveFindings = threeLevelWardLabel.getPositiveFindings();
+            }
+
+            //出院小结转归情况
+            LeaveHospitalLabel leaveHospitalLabel = inputInfo.getLeaveHospitalDoc().getLeaveHospitalLabel();
+            betterFindings.addAll(leaveHospitalLabel.getBetterFindings());
+            outcomeToBetters.addAll(leaveHospitalLabel.getOutcomeToBetters());
+            outcomeCures.addAll(leaveHospitalLabel.getOutcomeCures());
+            positiveFindings.addAll(leaveHospitalLabel.getPositiveFindings());
+
+            //若出现死亡记录或死亡医嘱,则 转归情况 必须为 死亡。若未出现死亡记录或死亡医嘱,则 转归情况 必不为 死亡。
+            if (inputInfo.getDeathRecordDoc() != null && !"死亡".equals(outcome)
+                    || inputInfo.getDeathRecordDoc() == null && "死亡".equals(outcome)) {
+                status = "-1";
+                return;
+            }
+            //若出院小结或末次病程中明确记录转归情况 实体(转归情况-好转,转归情况-治愈,转归情况-未愈),则首页必须与其保持一致。
+            if (outcomeToBetters.size() > 0 && !"好转".equals(outcome)
+                    || outcomeCures.size() > 0 && !"治愈".equals(outcome)) {
+                status = "-1";
+                return;
+            }
+            //若出院小结或末次病程中没有明确记录转归情况
+            if (outcomeToBetters.size() == 0 && outcomeCures.size() == 0) {
+                //若末次病程中发现任一 阳性表现 实体,则转归情况必不为 治愈。
+                if (positiveFindings.size() > 0 && "治愈".equals(outcome)) {
+                    status = "-1";
+                    return;
+                }
+                //若末次病程中没有发现 阳性表现 实体,且发现任一 好转表现,则转归情况必不为 未愈。
+                if (positiveFindings.size() == 0 && betterFindings.size() > 0 && "未愈".equals(outcome)) {
+                    status = "-1";
+                }
+            }
+        }
+    }
+}

+ 37 - 5
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/ThreeLevelWardAI.java

@@ -32,7 +32,7 @@ public class ThreeLevelWardAI extends ModelAI {
     /**
      *
      */
-    public static List<String> medicalTextType = Arrays.asList("CourseRecord_cx");
+    public static List<String> medicalTextType = Arrays.asList("CourseRecord_cx", "CourseRecordLast_cx");
     public static String entityRelationObject = "entity_relation_object";
     public static String outputs = "outputs";
     public static String content = "content";
@@ -53,6 +53,9 @@ public class ThreeLevelWardAI extends ModelAI {
         if (firstWardRecord.get(Content.director) != null) {
             putContent(crfContent, medicalTextType.get(0), firstWardRecord.get(Content.director).get("病情记录"), Content.director);
         }
+        Map<String, String> lastCourseRecord = getLastCourseRecord(threeLevelWardDocs);
+        //主任医师最后一次查房记录
+        putContent(crfContent, medicalTextType.get(1), lastCourseRecord.get("病情记录"), "最后一次" + Content.director);
 
         List<Map<String, String>> directorDifficultRecord = new ArrayList<>();
         //疑难患者副高及以上查房记录
@@ -81,6 +84,7 @@ public class ThreeLevelWardAI extends ModelAI {
         if (midData.get(Content.director) != null) {
             putWardRoundCrfData(midData.getJSONObject(Content.director), inputInfo, Content.director, 0);//查房记录
         }
+        putWardRoundCrfData(midData.getJSONObject("最后一次" + Content.director), inputInfo, "最后一次" + Content.director, 0);//最后一次查房记录
         //疑难患者副高及以上查房记录模型输出
         if (inputInfo.getDifficultCaseDiscussDocs().size() > 0 && ListUtil.isNotEmpty(directorDifficultRecord)) {
             for (int i = 0; i < directorDifficultRecord.size(); i++) {
@@ -134,7 +138,7 @@ public class ThreeLevelWardAI extends ModelAI {
         Map<Date, Map<String, String>> dateRecord = new TreeMap<>(new Comparator<Date>() {
             @Override
             public int compare(Date o1, Date o2) {
-                // 序排列
+                // 序排列
                 return o1.compareTo(o2);
             }
         });//按时间key排序,存放抢救记录、查房记录
@@ -195,10 +199,9 @@ public class ThreeLevelWardAI extends ModelAI {
         List<Map<String, String>> record = new ArrayList<>();
         List<RescueDoc> rescueDocs = inputInfo.getRescueDocs(); //抢救记录
         Map<Date, Map<String, String>> dateRecord = new TreeMap<>(new Comparator<Date>() {
-
             @Override
             public int compare(Date o1, Date o2) {
-                // 序排列
+                // 序排列
                 return o1.compareTo(o2);
             }
         });//按时间key排序,存放抢救记录、查房记录
@@ -257,7 +260,7 @@ public class ThreeLevelWardAI extends ModelAI {
         Map<Date, Map<String, String>> record = new TreeMap<>(new Comparator<Date>() {
             @Override
             public int compare(Date o1, Date o2) {
-                // 序排列
+                // 序排列
                 return o1.compareTo(o2);
             }
         });
@@ -271,4 +274,33 @@ public class ThreeLevelWardAI extends ModelAI {
         }
         return record;
     }
+
+    /**
+     * 获取查房记录最后一条记录
+     *
+     * @param threeLevelWardDocs
+     * @return
+     */
+    private Map<String, String> getLastCourseRecord(List<ThreeLevelWardDoc> threeLevelWardDocs) {
+        Map<Date, Map<String, String>> dateRecord = new TreeMap<>(new Comparator<Date>() {
+            @Override
+            public int compare(Date o1, Date o2) {
+                // 降序排列
+                return o2.compareTo(o1);
+            }
+        });//按时间key排序,存放抢救记录、查房记录
+        String recordTime = "", title = "";
+        for (ThreeLevelWardDoc threeLevelWardDoc : threeLevelWardDocs) {
+            Map<String, String> rescueStructureMap = threeLevelWardDoc.getStructureMap();
+            recordTime = rescueStructureMap.get("查房日期");
+            title = CatalogueUtil.subTitle(rescueStructureMap.get("查房标题"));
+            Date recordDate = StringUtil.parseDateTime(recordTime);
+            if (recordDate == null || StringUtil.isBlank(title) || !title.contains(Content.director)) {//只存副高以上查房记录) {
+                continue;
+            }
+            dateRecord.put(recordDate, rescueStructureMap);
+        }
+        List<Map<String, String>> dateRecordList = new ArrayList<>(dateRecord.values());
+        return dateRecordList.get(0);
+    }
 }

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

@@ -26,7 +26,8 @@ public enum EntityEnum {
     PHYSICAL_EXAMINATION("查体"), TITLE_FOR_SIGN("查体标题"), TITLE_FOR_DIAG("诊断标题"), TITLE_FOR_DIAG_BASIS("诊断依据标题"),
     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("生命体征");
+    TITLE_OF_RISK_AFTER_OP("术后风险标题"), TITLE_OF_ATTENTION_AFTER_OP("术后注意事项标题"), VITAL("生命体征"),
+    BETTER_FINDING("好转表现"),OUTCOME_TO_BETTER("转归情况-好转"),OUTCOME_CURE("转归情况-治愈"),POSITIVE_FINDING("阳性表现");
 
     private String value;
 

+ 42 - 8
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessLeaveHospital.java

@@ -3,10 +3,14 @@ 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.Chief;
 import com.lantone.qc.pub.model.entity.DoctorAdvice;
 import com.lantone.qc.pub.model.entity.Notes;
 import com.lantone.qc.pub.model.entity.Outcome;
+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.label.LeaveHospitalLabel;
 
 import java.util.ArrayList;
@@ -57,15 +61,45 @@ public class EntityProcessLeaveHospital extends EntityProcess {
         String doctorAdviceContent = content.substring(keyWordForDoctorAdvicesesStart, minPart);
         doctorAdvice.setName(doctorAdviceContent);
         leaveHospitalLabel.setDoctorAdvices(doctorAdvice);
-        //转归情况
-        List<Lemma> outcomeLemmas = createEntityTree(aiOut, EntityEnum.OUTCOME.toString());
-        List<Outcome> outcomes = new ArrayList<>();
-        for (Lemma lemma : outcomeLemmas) {
-            Outcome outcome = new Outcome();
-            outcome.setName(lemma.getText());
-            outcomes.add(outcome);
+        //好转表现
+        List<Lemma> betterFindingLemmas = createEntityTree(aiOut, EntityEnum.BETTER_FINDING.toString());
+        List<BetterFinding> betterFindings = new ArrayList<>();
+        for (Lemma lemma : betterFindingLemmas) {
+            BetterFinding betterFinding = new BetterFinding();
+            betterFinding.setName(lemma.getText());
+            betterFindings.add(betterFinding);
         }
-        leaveHospitalLabel.setOutcomes(outcomes);
+        leaveHospitalLabel.setBetterFindings(betterFindings);
+
+        //转归情况-好转
+        List<Lemma> outcomeToBetterLemmas = createEntityTree(aiOut, EntityEnum.OUTCOME_TO_BETTER.toString());
+        List<OutcomeToBetter> outcomeToBetters = new ArrayList<>();
+        for (Lemma lemma : outcomeToBetterLemmas) {
+            OutcomeToBetter outcomeToBetter = new OutcomeToBetter();
+            outcomeToBetter.setName(lemma.getText());
+            outcomeToBetters.add(outcomeToBetter);
+        }
+        leaveHospitalLabel.setOutcomeToBetters(outcomeToBetters);
+
+        //转归情况-治愈
+        List<Lemma> outcomeCureLemmas = createEntityTree(aiOut, EntityEnum.OUTCOME_CURE.toString());
+        List<OutcomeCure> outcomeCures = new ArrayList<>();
+        for (Lemma lemma : outcomeCureLemmas) {
+            OutcomeCure outcomeCure = new OutcomeCure();
+            outcomeCure.setName(lemma.getText());
+            outcomeCures.add(outcomeCure);
+        }
+        leaveHospitalLabel.setOutcomeCures(outcomeCures);
+
+        //阳性表现
+        List<Lemma> positiveFindingLemmas = createEntityTree(aiOut, EntityEnum.POSITIVE_FINDING.toString());
+        List<PositiveFinding> positiveFindings = new ArrayList<>();
+        for (Lemma lemma : positiveFindingLemmas) {
+            PositiveFinding positiveFinding = new PositiveFinding();
+            positiveFinding.setName(lemma.getText());
+            positiveFindings.add(positiveFinding);
+        }
+        leaveHospitalLabel.setPositiveFindings(positiveFindings);
         return leaveHospitalLabel;
     }
 }

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

@@ -3,8 +3,12 @@ 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.label.ThreeLevelWardLabel;
@@ -101,6 +105,46 @@ public class EntityProcessThreeLevelWard extends EntityProcess {
             treatmentPlans.add(treatmentPlan);
         }
         threeLevelWardLabel.setTreatmentPlans(treatmentPlans);
+
+        //好转表现
+        List<Lemma> betterFindingLemmas = createEntityTree(aiOut, EntityEnum.BETTER_FINDING.toString());
+        List<BetterFinding> betterFindings = new ArrayList<>();
+        for (Lemma lemma : betterFindingLemmas) {
+            BetterFinding betterFinding = new BetterFinding();
+            betterFinding.setName(lemma.getText());
+            betterFindings.add(betterFinding);
+        }
+        threeLevelWardLabel.setBetterFindings(betterFindings);
+
+        //转归情况-好转
+        List<Lemma> outcomeToBetterLemmas = createEntityTree(aiOut, EntityEnum.OUTCOME_TO_BETTER.toString());
+        List<OutcomeToBetter> outcomeToBetters = new ArrayList<>();
+        for (Lemma lemma : outcomeToBetterLemmas) {
+            OutcomeToBetter outcomeToBetter = new OutcomeToBetter();
+            outcomeToBetter.setName(lemma.getText());
+            outcomeToBetters.add(outcomeToBetter);
+        }
+        threeLevelWardLabel.setOutcomeToBetters(outcomeToBetters);
+
+        //转归情况-治愈
+        List<Lemma> outcomeCureLemmas = createEntityTree(aiOut, EntityEnum.OUTCOME_CURE.toString());
+        List<OutcomeCure> outcomeCures = new ArrayList<>();
+        for (Lemma lemma : outcomeCureLemmas) {
+            OutcomeCure outcomeCure = new OutcomeCure();
+            outcomeCure.setName(lemma.getText());
+            outcomeCures.add(outcomeCure);
+        }
+        threeLevelWardLabel.setOutcomeCures(outcomeCures);
+
+        //阳性表现
+        List<Lemma> positiveFindingLemmas = createEntityTree(aiOut, EntityEnum.POSITIVE_FINDING.toString());
+        List<PositiveFinding> positiveFindings = new ArrayList<>();
+        for (Lemma lemma : positiveFindingLemmas) {
+            PositiveFinding positiveFinding = new PositiveFinding();
+            positiveFinding.setName(lemma.getText());
+            positiveFindings.add(positiveFinding);
+        }
+        threeLevelWardLabel.setPositiveFindings(positiveFindings);
         return threeLevelWardLabel;
     }
 

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

@@ -0,0 +1,15 @@
+package com.lantone.qc.pub.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : BetterFinding
+ * @Description : 好转表现
+ * @Author : 胡敬
+ * @Date: 2020-03-25 16:54
+ */
+@Setter
+@Getter
+public class BetterFinding extends General {
+}

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

@@ -0,0 +1,15 @@
+package com.lantone.qc.pub.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : OutcomeCure
+ * @Description : 转归情况-治愈
+ * @Author : 胡敬
+ * @Date: 2020-03-25 16:54
+ */
+@Setter
+@Getter
+public class OutcomeCure extends General {
+}

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

@@ -0,0 +1,15 @@
+package com.lantone.qc.pub.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : OutcomeToBetter
+ * @Description : 转归情况-好转
+ * @Author : 胡敬
+ * @Date: 2020-03-25 16:54
+ */
+@Setter
+@Getter
+public class OutcomeToBetter extends General {
+}

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

@@ -0,0 +1,15 @@
+package com.lantone.qc.pub.model.entity;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : PositiveFinding
+ * @Description : 阳性表现
+ * @Author : 胡敬
+ * @Date: 2020-03-25 16:54
+ */
+@Setter
+@Getter
+public class PositiveFinding extends General {
+}

+ 8 - 1
public/src/main/java/com/lantone/qc/pub/model/label/LeaveHospitalLabel.java

@@ -1,9 +1,13 @@
 package com.lantone.qc.pub.model.label;
 
+import com.lantone.qc.pub.model.entity.BetterFinding;
 import com.lantone.qc.pub.model.entity.Chief;
 import com.lantone.qc.pub.model.entity.DoctorAdvice;
 import com.lantone.qc.pub.model.entity.Notes;
 import com.lantone.qc.pub.model.entity.Outcome;
+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 lombok.Getter;
 import lombok.Setter;
 
@@ -22,5 +26,8 @@ public class LeaveHospitalLabel {
     List<Chief> chiefs = new ArrayList<>();   //主诉
     List<Notes> noteses = new ArrayList<>();   //注意事项
     DoctorAdvice doctorAdvices;   //医嘱信息
-    List<Outcome> outcomes = new ArrayList<>();   //转归情况
+    List<BetterFinding> betterFindings = new ArrayList<>();   //好转表现
+    List<OutcomeToBetter> outcomeToBetters = new ArrayList<>();   //转归情况-好转
+    List<OutcomeCure> outcomeCures = new ArrayList<>();   //转归情况-治愈
+    List<PositiveFinding> positiveFindings = new ArrayList<>();   //阳性表现
 }

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

@@ -1,7 +1,11 @@
 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 lombok.Getter;
@@ -28,4 +32,8 @@ public class ThreeLevelWardLabel {
     String diffDiagText;    //鉴别诊断文本
     List<Diag> diags = new ArrayList<>();   //补充诊断/初步诊断/修正诊断
     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<>();   //阳性表现
 }