Browse Source

1.添加规则:入院科别填写错误、离院方式选择错误

hujing 5 years ago
parent
commit
6f9d65bf39

+ 72 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0195.java

@@ -0,0 +1,72 @@
+package com.lantone.qc.kernel.catalogue.firstpagerecord;
+
+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.DeathCaseDiscussDoc;
+import com.lantone.qc.pub.model.doc.DeathRecordDoc;
+import com.lantone.qc.pub.model.doc.FirstPageRecordDoc;
+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;
+import java.util.Map;
+
+/**
+ * @ClassName : FIRP0195
+ * @Description :离院方式选择错误
+ * @Author : 胡敬
+ * @Date: 2020-06-03 16:54
+ */
+@Component
+public class FIRP0195 extends QCCatalogue {
+    public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
+        FirstPageRecordDoc firstPageRecordDoc = inputInfo.getFirstPageRecordDoc();
+        DeathRecordDoc deathRecordDoc = inputInfo.getDeathRecordDoc();
+        DeathCaseDiscussDoc deathCaseDiscussDoc = inputInfo.getDeathCaseDiscussDoc();
+        List<ThreeLevelWardDoc> threeLevelWardDocs = inputInfo.getThreeLevelWardDocs();
+        if (inputInfo.getFirstPageRecordDoc() == null) {
+            return;
+        }
+        Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
+        String outWay = firstpageStructureMap.get(Content.outWay);
+        if (StringUtil.isBlank(outWay)) {
+            return;
+        }
+        String wardOutWay;
+        if (deathRecordDoc != null || deathCaseDiscussDoc != null) {
+            wardOutWay = "死亡";
+            if (!match(outWay, wardOutWay)) {
+                status.set("-1");
+                return;
+            }
+        }
+
+        if (threeLevelWardDocs.size() > 0) {
+            List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDocs.get(0).getAllDoctorWradDocs();
+            ThreeLevelWardDoc lastWardDoc = allDoctorWradDocs.get(allDoctorWradDocs.size() - 1);
+            List<ThreeLevelWardLabel> threeLevelWardLabels = lastWardDoc.getThreeLevelWardLabel();
+            if (threeLevelWardLabels.size() > 0) {
+                ThreeLevelWardLabel threeLevelWardLabel = threeLevelWardLabels.get(0);
+                if (threeLevelWardLabel != null) {
+                    wardOutWay = threeLevelWardLabel.getDischargeMode();
+                    if (StringUtil.isNotBlank(wardOutWay)) {
+                        if (!match(outWay, wardOutWay)) {
+                            status.set("-1");
+                        }
+                    }
+                }
+            }
+        }
+
+
+    }
+
+    private boolean match(String str1, String str2) {
+        return str1.equals(str2) || str1.contains(str2) || str2.contains(str1);
+    }
+}

+ 21 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0222.java

@@ -1,10 +1,13 @@
 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.FirstPageRecordDoc;
+import com.lantone.qc.pub.model.doc.MedicalRecordInfoDoc;
+import com.lantone.qc.pub.model.doc.transferrecord.TransferRecordDoc;
+import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.Map;
@@ -19,6 +22,22 @@ import java.util.Map;
 public class FIRP0222 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
-
+        FirstPageRecordDoc firstPageRecordDoc = inputInfo.getFirstPageRecordDoc();
+        MedicalRecordInfoDoc medicalRecordInfoDoc = inputInfo.getMedicalRecordInfoDoc();
+        TransferRecordDoc transferRecordDocs = inputInfo.getTransferRecordDocs();
+        /* 如果有转入转出科室记录,则不判断 */
+        if (transferRecordDocs != null) {
+            return;
+        }
+        if (firstPageRecordDoc == null || medicalRecordInfoDoc == null) {
+            return;
+        }
+        Map<String, String> firpStructureMap = firstPageRecordDoc.getStructureMap();
+        Map<String, String> medStructureMap = medicalRecordInfoDoc.getStructureMap();
+        String admitDept = firpStructureMap.get(Content.admitDept);
+        String behDeptId = medStructureMap.get("behDeptId");
+        if (StringUtil.isNotBlank(admitDept) && StringUtil.isNotBlank(behDeptId) && !admitDept.equals(behDeptId)) {
+            status.set("-1");
+        }
     }
 }

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

@@ -65,6 +65,11 @@ public class ThreeLevelWardAI extends ModelAI {
         }
 
         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("病情记录"), "末次查房");
+        }
+
         List<Map<String, String>> directorDifficultRecord = new ArrayList<>();
         //疑难患者副高及以上查房记录
         if (inputInfo.getDifficultCaseDiscussDocs().size() > 0) {
@@ -96,6 +101,10 @@ public class ThreeLevelWardAI extends ModelAI {
         if (midData.get(Content.director + "最后一次") != null) {
             putWardRoundCrfData(midData.getJSONObject(Content.director + "最后一次"), inputInfo, 0);//最后一次查房记录
         }
+        //最后一次查房记录模型输出
+        if (midData.get("末次查房") != null) {
+            putWardRoundCrfData(midData.getJSONObject("末次查房"), inputInfo, 0);//最后一次查房记录
+        }
         //疑难患者副高及以上查房记录模型输出
         if (inputInfo.getDifficultCaseDiscussDocs().size() > 0 && ListUtil.isNotEmpty(directorDifficultRecord)) {
             for (int i = 0; i < directorDifficultRecord.size(); i++) {
@@ -111,7 +120,7 @@ public class ThreeLevelWardAI extends ModelAI {
                 if (midData.get(Content.rescuingPatients + i) == null) {
                     continue;
                 }
-                putWardRoundCrfData(midData.getJSONObject(Content.difficultPatients + i), inputInfo, 3);//查房记录
+                putWardRoundCrfData(midData.getJSONObject(Content.rescuingPatients + i), inputInfo, 3);//查房记录
             }
         }
 
@@ -150,13 +159,23 @@ public class ThreeLevelWardAI extends ModelAI {
         threeLevelWardLabel.setSerious(serious);
         ThreeLevelWardDoc threeLevelWardDoc = inputInfo.getThreeLevelWardDocs().get(0);
         if (serious == 0) {//处理主治/主任查房记录
-            if (Content.attend.equals(detailTitle)) {
-                threeLevelWardDoc.getAttendingDoctorWardDocs().get(0).setThreeLevelWardLabel(threeLevelWardLabel);
-            } else if (Content.director.equals(detailTitle)) {
-                threeLevelWardDoc.getDirectorDoctorWardDocs().get(0).setThreeLevelWardLabel(threeLevelWardLabel);
-            } else if ((Content.director + "最后一次").equals(detailTitle)) {
-                List<DirectorDoctorWardDoc> director = threeLevelWardDoc.getDirectorDoctorWardDocs();
-                director.get(director.size() - 1).setThreeLevelWardLabel(threeLevelWardLabel);
+            switch (detailTitle) {
+                case Content.attend:
+                    threeLevelWardDoc.getAttendingDoctorWardDocs().get(0).setThreeLevelWardLabel(threeLevelWardLabel);
+                    break;
+                case Content.director:
+                    threeLevelWardDoc.getDirectorDoctorWardDocs().get(0).setThreeLevelWardLabel(threeLevelWardLabel);
+                    break;
+                case Content.director + "最后一次":
+                    List<DirectorDoctorWardDoc> director = threeLevelWardDoc.getDirectorDoctorWardDocs();
+                    director.get(director.size() - 1).setThreeLevelWardLabel(threeLevelWardLabel);
+                    break;
+                case "末次查房":
+                    List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDoc.getAllDoctorWradDocs();
+                    List<ThreeLevelWardLabel> lastWardLebelList = new ArrayList<>();
+                    lastWardLebelList.add(threeLevelWardLabel);
+                    allDoctorWradDocs.get(allDoctorWradDocs.size() - 1).setThreeLevelWardLabel(lastWardLebelList);
+                    break;
             }
         } else {
             List<ThreeLevelWardDoc> allDoctorWradDocs = threeLevelWardDoc.getAllDoctorWradDocs();
@@ -257,7 +276,7 @@ public class ThreeLevelWardAI extends ModelAI {
         for (RescueDoc rescueDoc : rescueDocs) {
             Map<String, String> rescueStructureMap = rescueDoc.getStructureMap();
             recordTime = rescueStructureMap.get("抢救结束时间");
-            if(recordTime == null){
+            if (recordTime == null) {
                 continue;
             }
             Date recordDate = StringUtil.parseDateTime(recordTime);

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

@@ -28,7 +28,7 @@ public enum EntityEnum {
     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("检查项目");
+    INSPECTION_ITEMS("检查项目"),DISCHARGE_MODE("出院方式");
 
     private String value;
 
@@ -232,6 +232,9 @@ public enum EntityEnum {
             case "检查项目":
                 entityEnum = EntityEnum.INSPECTION_ITEMS;
                 break;
+            case "出院方式":
+                entityEnum = EntityEnum.DISCHARGE_MODE;
+                break;
         }
         return entityEnum;
     }

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

@@ -112,6 +112,14 @@ public class EntityProcessThreeLevelWard extends EntityProcess {
         }
         threeLevelWardLabel.setTreatmentPlans(treatmentPlans);
 
+        //离院方式
+        List<Lemma> dischargeMode = createEntityTree(aiOut, EntityEnum.DISCHARGE_MODE.toString());
+        for (Lemma lemma : dischargeMode) {
+            String text = lemma.getText();
+            threeLevelWardLabel.setDischargeMode(text);
+        }
+
+
         //好转表现
         List<Lemma> betterFindingLemmas = createEntityTree(aiOut, EntityEnum.BETTER_FINDING.toString());
         List<BetterFinding> betterFindings = new ArrayList<>();

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

@@ -89,6 +89,8 @@ public class InputInfo {
     private List<ReasonableDiagnosisDoc> reasonableDiagnosisDocs = new ArrayList<>();
     //日常病程录
     private List<DailyCourseRecordDoc> dailyCourseRecordDocs = Lists.newArrayList();
+    //住院病历信息
+    private MedicalRecordInfoDoc medicalRecordInfoDoc;
 
     //新增记录
     public <T> void addDoc(List<T> list, T obj) {

+ 19 - 0
public/src/main/java/com/lantone/qc/pub/model/doc/MedicalRecordInfoDoc.java

@@ -0,0 +1,19 @@
+package com.lantone.qc.pub.model.doc;
+
+import com.lantone.qc.pub.model.label.CaseCharacteristicLabel;
+import com.lantone.qc.pub.model.label.DiagLabel;
+import com.lantone.qc.pub.model.label.DiagnosisLabel;
+import com.lantone.qc.pub.model.label.TreatPlanLabel;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @ClassName : MedicalRecordInfoDoc
+ * @Description : 住院病历信息
+ * @Author : 胡敬
+ * @Date: 2020-06-03 15:46
+ */
+@Getter
+@Setter
+public class MedicalRecordInfoDoc extends ModelDoc {
+}

+ 2 - 1
public/src/main/java/com/lantone/qc/pub/model/label/ThreeLevelWardLabel.java

@@ -23,7 +23,7 @@ import java.util.List;
 @Getter
 @Setter
 public class ThreeLevelWardLabel {
-    int serious = 0;    //不严重患者:0,危重患者:1,疑难患者:2,抢救患者:3
+    int serious = 0;    //0:不严重患者,1:危重患者,2:疑难患者,3:抢救患者
     String title;   //医师职称
     List<Clinical> clinicals = new ArrayList<>();   //病史(临床表现)
     List<Sign> signs = new ArrayList<>();   //查体
@@ -31,6 +31,7 @@ public class ThreeLevelWardLabel {
     String diagBasisText;   //诊断依据文本
     String diffDiagText;    //鉴别诊断文本
     List<Diag> diags = new ArrayList<>();   //补充诊断/初步诊断/修正诊断
+    String dischargeMode;  //离院方式
     List<TreatmentPlan> treatmentPlans = new ArrayList<>();   //诊疗计划
     List<BetterFinding> betterFindings = new ArrayList<>();   //好转表现
     List<OutcomeToBetter> outcomeToBetters = new ArrayList<>();   //转归情况-好转

+ 4 - 0
trans/src/main/java/com/lantone/qc/trans/changx/ChangxDocTrans.java

@@ -127,6 +127,10 @@ public class ChangxDocTrans extends DocTrans {
                 ChangxDailyCourseRecordDocTrans dailyCourseRecordDocTrans = new ChangxDailyCourseRecordDocTrans();
                 inputInfo.setDailyCourseRecordDocs(dailyCourseRecordDocTrans.extract(i));
             }
+            if (i.getTitle().equals("住院病历信息")) {
+                ChangxMedicalRecordInfoDocTrans medicalRecordInfoDocTrans = new ChangxMedicalRecordInfoDocTrans();
+                inputInfo.setMedicalRecordInfoDoc(medicalRecordInfoDocTrans.extract(i));
+            }
         }
         pageDataHandle(inputInfo);
         return inputInfo;

+ 35 - 0
trans/src/main/java/com/lantone/qc/trans/changx/ChangxMedicalRecordInfoDocTrans.java

@@ -0,0 +1,35 @@
+package com.lantone.qc.trans.changx;
+
+import com.google.common.collect.Maps;
+import com.lantone.qc.dbanaly.util.ModuleMappingUtil;
+import com.lantone.qc.pub.Content;
+import com.lantone.qc.pub.model.doc.FirstPageRecordDoc;
+import com.lantone.qc.pub.model.doc.MedicalRecordInfoDoc;
+import com.lantone.qc.pub.model.vo.MedrecVo;
+import com.lantone.qc.pub.util.FastJsonUtils;
+import com.lantone.qc.pub.util.ListUtil;
+import com.lantone.qc.pub.util.StringUtil;
+import com.lantone.qc.trans.ModelDocTrans;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 住院病历信息
+ * @author: 胡敬
+ * @time: 2020/6/3 15:45
+ */
+public class ChangxMedicalRecordInfoDocTrans extends ModelDocTrans {
+
+    @Override
+    public MedicalRecordInfoDoc extract(MedrecVo medrecVo) {
+        Map<String, String> content = (Map) ((List) medrecVo.getContent().get("content")).get(0);
+        MedicalRecordInfoDoc medicalRecordInfoDoc = new MedicalRecordInfoDoc();
+        medicalRecordInfoDoc.setStructureMap(content);
+        medicalRecordInfoDoc.setPageData(medrecVo.getContent());
+        return medicalRecordInfoDoc;
+    }
+
+}