Преглед на файлове

1.CRF修改辅检提取疾病
2.主诉与现病史发病部位不一致/入院记录体格检查与专科检查不一致修改逻辑

hujing преди 5 години
родител
ревизия
5e63ad5cf0

+ 27 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0011.java

@@ -9,7 +9,9 @@ import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.entity.Diag;
 import com.lantone.qc.pub.model.entity.GeneralDesc;
+import com.lantone.qc.pub.model.entity.Pacs;
 import com.lantone.qc.pub.model.label.DiagLabel;
+import com.lantone.qc.pub.model.label.PacsLabel;
 import com.lantone.qc.pub.model.label.PastLabel;
 import com.lantone.qc.pub.model.label.PresentLabel;
 import com.lantone.qc.pub.util.StringUtil;
@@ -17,7 +19,13 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 /**
  * @ClassName : BEH0011
@@ -45,6 +53,7 @@ public class BEH0011 extends QCCatalogue {
         PresentLabel presentLabel = inputInfo.getBeHospitalizedDoc().getPresentLabel();
         DiagLabel initialDiagLabel = inputInfo.getBeHospitalizedDoc().getInitialDiagLabel();
         PastLabel pastLabel = inputInfo.getBeHospitalizedDoc().getPastLabel();
+        PacsLabel pacsLabel = inputInfo.getBeHospitalizedDoc().getPacsLabel();
         if (initialDiagLabel == null) {
             status.set("0");
             return;
@@ -91,7 +100,7 @@ public class BEH0011 extends QCCatalogue {
                 }
             }
             a1 = structureMap.get("糖尿病");
-            if  (StringUtils.isNotEmpty(a1) && !"否认".equals(a1)) {
+            if (StringUtils.isNotEmpty(a1) && !"否认".equals(a1)) {
                 Diag diag = new Diag();
                 diag.setName("糖尿病");
                 diag.setHospitalDiagName("糖尿病");
@@ -101,6 +110,22 @@ public class BEH0011 extends QCCatalogue {
             }
             addDiagHospitalName(presentPastDiags, pastDiags);
         }
+
+        /* 取辅检中疾病名称 */
+        if (pacsLabel != null) {
+            List<Pacs> pacses = pacsLabel.getPacses();
+            if (pacses != null && pacses.size() > 0) {
+                List<List<Diag>> pacsDiags = pacses.stream().map(Pacs::getDiags).filter(x -> x.size() > 0).collect(Collectors.toList());
+                if (pacsDiags.size() > 1) {
+                    List<Diag> diagList = pacsDiags.get(pacsDiags.size() - 1);
+                    //把辅检提取出的疾病去除包含术后之后的疾病放入presentPastDiags
+                    Set<String> diagStringList = diagList.stream().map(Diag::getHospitalDiagName).filter(x -> StringUtil.isNotBlank(x) && !x.contains("术后")).collect(Collectors.toSet());
+                    presentPastDiags.addAll(diagStringList);
+                }
+            }
+        }
+
+
         /* 取初步诊断中疾病名称 */
         List<String> initDiags = new ArrayList<>();
         List<Diag> initialDiagDiags = initialDiagLabel.getDiags();

+ 1 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH03048.java

@@ -38,6 +38,7 @@ public class BEH03048 extends QCCatalogue {
         for (String vital : vitals) {
             String v = beHospitalStructureMap.get(vital);
             if (StringUtil.isNotBlank(v)) {
+                v = v.replace("无", "阴性");
                 v = vital + v;
                 if (vitalLabelSpecial.contains(vital) && !vitalLabelSpecial.contains(v)) {
                     status.set("-1");

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH03050.java

@@ -24,7 +24,7 @@ import java.util.List;
 public class BEH03050 extends QCCatalogue {
     private List<String> positions = Lists.newArrayList("左上", "左下", "右上", "右下", "上", "下", "左", "右");
     private List<String> containList = Arrays.asList("检查", "术后", "药物", "发现", "误服", "确诊", "经", "异常", "诊断"
-            , "示", "超", "伤", "术", "复查", "体检", "血透", "血液透析");
+            , "示", "超", "伤", "术", "复查", "体检", "血透", "血液透析", "诱因下");
 
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");

+ 14 - 6
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/BeHospitalizedAI.java

@@ -13,7 +13,6 @@ import com.lantone.qc.kernel.structure.ai.process.EntityProcessPacs;
 import com.lantone.qc.kernel.structure.ai.process.EntityProcessPast;
 import com.lantone.qc.kernel.structure.ai.process.EntityProcessPersonal;
 import com.lantone.qc.kernel.structure.ai.process.EntityProcessVital;
-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.BeHospitalizedDoc;
@@ -31,7 +30,6 @@ import com.lantone.qc.pub.model.label.PastLabel;
 import com.lantone.qc.pub.model.label.PersonalLabel;
 import com.lantone.qc.pub.model.label.PresentLabel;
 import com.lantone.qc.pub.util.StringUtil;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Component;
 
 import java.util.Arrays;
@@ -54,9 +52,10 @@ public class BeHospitalizedAI extends ModelAI {
      * chief_present[邵逸夫医院主诉]
      * Diagnoses_cx[诊断]
      * Present_cx[现病史]
+     * DiagnoseInAssistant[辅助检查]
      */
     public static List<String> medicalTextType = Arrays.asList("FirstCourseRecord_cx", "PastFamily_cx", "PersonalHistory_cx", "HPIForCX_cx",
-            "GeneralVital_cx", "chief_present", "Diagnoses_cx", "Present_cx");
+            "GeneralVital_cx", "chief_present", "Diagnoses_cx", "Present_cx", "DiagnoseInAssistant");
     public static String entityRelationObject = "entity_relation_object";
     public static String outputs = "outputs";
 
@@ -105,10 +104,11 @@ public class BeHospitalizedAI extends ModelAI {
                 String familyText = beHospitalizedDoc.getFamilyLabel().getText();
                 putContent(crfContent, medicalTextType.get(1), familyText, Content.family);
             }
-            /* 辅助检查(暂用主诉现病史模型,之后会新训练单独模型再做修改) */
+            /* 辅助检查 */
             if (beHospitalizedDoc.getPacsLabel() != null && beHospitalizedDoc.getPacsLabel().isCrfLabel()) {
                 String pacsText = beHospitalizedDoc.getPacsLabel().getText();
-                putContent(crfContent, medicalTextType.get(3), pacsText, Content.pacs);
+                putContent(crfContent, medicalTextType.get(3), pacsText, Content.pacs + "含时间地点");
+                putContent(crfContent, medicalTextType.get(8), pacsText, Content.pacs);
             }
             /* 专科检查(专科体格检查) */
             if (beHospitalizedDoc.getVitalLabelSpecial() != null && beHospitalizedDoc.getVitalLabelSpecial().isCrfLabel()) {
@@ -189,6 +189,8 @@ public class BeHospitalizedAI extends ModelAI {
             }
             /* 处理辅助检查 */
             if (beHospitalizedDoc.getPacsLabel() != null && beHospitalizedDoc.getPacsLabel().isCrfLabel()) {
+                /* 辅检提取时间、地点和提取疾病分为两个模型 */
+                putPacsCrfData(midData.getJSONObject(Content.pacs + "含时间地点"), inputInfo);
                 putPacsCrfData(midData.getJSONObject(Content.pacs), inputInfo);
             }
         }
@@ -437,7 +439,13 @@ public class BeHospitalizedAI extends ModelAI {
         }
         //放置入inputinfo
         PacsLabel pacsLabel = inputInfo.getBeHospitalizedDoc().getPacsLabel();
-        pacsLabel.setPacses(loadPacses(aiOut));
+        if (pacsLabel.getPacses() == null) {
+            pacsLabel.setPacses(loadPacses(aiOut));
+        } else {
+            List<Pacs> pacses = pacsLabel.getPacses();
+            pacses.addAll(loadPacses(aiOut));
+            pacsLabel.setPacses(pacses);
+        }
     }
 
     /**

+ 6 - 2
trans/src/main/java/com/lantone/qc/trans/shaoyf/ShaoyfBeHospitalizedDocTrans.java

@@ -23,6 +23,8 @@ import org.apache.commons.lang3.StringUtils;
 import java.util.List;
 import java.util.Map;
 
+import static com.lantone.qc.trans.comsis.ModelDocGenerate.structureMapJoin;
+
 /**
  * @Description: 入院记录文档生成
  * @author: rengb
@@ -171,8 +173,10 @@ public class ShaoyfBeHospitalizedDocTrans extends ModelDocTrans {
 
         // 走模型
         PacsLabel pacsLabel = new PacsLabel();
-        pacsLabel.setCrfLabel(false);
-        pacsLabel.setText(structureMap.get("辅助检查"));
+        pacsLabel.setCrfLabel(true);
+        List<String> keys = Lists.newArrayList("实验室检查", "影像学检查");
+        String pacsText = structureMapJoin(structureMap, keys);
+        pacsLabel.setText(pacsText);
         beHospitalizedDoc.setPacsLabel(pacsLabel);
         //        structureMap.remove("辅助检查");