Przeglądaj źródła

Merge remote-tracking branch 'origin/dev-ai-input' into dev

hujing 5 lat temu
rodzic
commit
0d252ff64b

+ 49 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH02908.java

@@ -0,0 +1,49 @@
+package com.lantone.qc.kernel.catalogue.behospitalized;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.label.ChiefLabel;
+import com.lantone.qc.pub.model.label.PresentLabel;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @ClassName : BEH02908
+ * @Description : 现病史症状性质描述与主诉不符
+ * @Author : 胡敬
+ * @Date: 2020-06-11 15:54
+ */
+@Component
+public class BEH02908 extends QCCatalogue {
+    @Override
+    protected void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
+        if (inputInfo.getBeHospitalizedDoc() == null) {
+            return;
+        }
+        String chiefProperty = "";
+        ChiefLabel chiefLabel = inputInfo.getBeHospitalizedDoc().getChiefLabel();
+        PresentLabel presentLabel = inputInfo.getBeHospitalizedDoc().getPresentLabel();
+        if (chiefLabel == null || presentLabel == null) {
+            return;
+        }
+        String chiefText = chiefLabel.getText();
+        String presentText = presentLabel.getText();
+        if (StringUtil.isBlank(chiefText) || StringUtil.isBlank(presentText)) {
+            return;
+        }
+        String regex = "\\d+次";
+        Pattern pattern = Pattern.compile(regex);
+        Matcher matcher = pattern.matcher(chiefText);
+        if (matcher.find()) {
+            chiefProperty = matcher.group(0);
+        }
+        if (StringUtil.isNotBlank(chiefProperty) && !presentText.contains(chiefProperty)) {
+            status.set("-1");
+        }
+    }
+}

+ 79 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH02909.java

@@ -0,0 +1,79 @@
+package com.lantone.qc.kernel.catalogue.behospitalized;
+
+import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.pub.model.InputInfo;
+import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.model.entity.Medicine;
+import com.lantone.qc.pub.model.label.PresentLabel;
+import com.lantone.qc.pub.util.ListUtil;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @ClassName : BEH02909
+ * @Description : 目前使用药物情况与现病史描述不一致
+ * @Author : 胡敬
+ * @Date: 2020-06-11 16:10
+ */
+@Component
+public class BEH02909 extends QCCatalogue {
+
+    @Override
+    protected void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        if (inputInfo.getBeHospitalizedDoc() == null) {
+            status.set("0");
+            return;
+        }
+        String drugsCurrentlyInUse = inputInfo.getBeHospitalizedDoc().getStructureMap().get("目前使用的药物");
+        drugsCurrentlyInUse = StringUtil.isBlank(drugsCurrentlyInUse) ? "" : drugsCurrentlyInUse;
+        List<String> drug = getDrug(drugsCurrentlyInUse);
+        PresentLabel presentLabel = inputInfo.getBeHospitalizedDoc().getPresentLabel();
+        if (presentLabel == null) {
+            status.set("0");
+            return;
+        }
+        List<Medicine> medicines = presentLabel.getMedicines();
+        if (medicines != null && medicines.size() > 0) {
+            List<String> drugFromPresent = getDrugFromPresent(medicines);
+            if (ListUtil.equals(drug, drugFromPresent)) {
+                status.set("0");
+            }
+        }
+    }
+
+    private List<String> getDrug(String drugsCurrentlyInUse) {
+        List<String> drugs = new ArrayList<>();
+        String medicine = "药物名称", usage = "用法", continueUse = "本次住院是否继续使用";
+        while (drugsCurrentlyInUse.length() > 0) {
+            if (drugsCurrentlyInUse.contains(medicine) && drugsCurrentlyInUse.contains(usage) && drugsCurrentlyInUse.contains(continueUse)) {
+                int medicineIndex = drugsCurrentlyInUse.indexOf(medicine);
+                int usageIndex = drugsCurrentlyInUse.indexOf(usage);
+                int continueUseIndex = drugsCurrentlyInUse.indexOf(continueUse);
+                String drug = drugsCurrentlyInUse.substring(medicineIndex + medicine.length() + 1, usageIndex);
+                if (StringUtil.isNotBlank(drug)) {
+                    drug = StringUtil.removeBlank(drug);
+                    drugs.add(drug);
+                }
+                drugsCurrentlyInUse = drugsCurrentlyInUse.substring(continueUseIndex + continueUse.length() + 1);
+            } else {
+                break;
+            }
+        }
+        return drugs;
+    }
+
+    private List<String> getDrugFromPresent(List<Medicine> medicines) {
+        List<String> drugs = new ArrayList<>();
+        String name;
+        for (Medicine medicine : medicines) {
+            name = medicine.getName();
+            if (StringUtil.isNotBlank(name)) {
+                drugs.add(name.replaceAll("[“”\"]",""));
+            }
+        }
+        return drugs;
+    }
+}

+ 4 - 12
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0438.java

@@ -1,12 +1,11 @@
 package com.lantone.qc.kernel.catalogue.behospitalized;
 
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
-import com.lantone.qc.kernel.util.CatalogueUtil;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
+import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
-import java.util.Collection;
 import java.util.Map;
 
 
@@ -24,16 +23,9 @@ public class BEH0438 extends QCCatalogue {
             return;
         }
         Map<String, String> bhMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
-        if(bhMap != null){
-            String birthDate = bhMap.get("出生时间");
-            if(birthDate != null){
-                if(CatalogueUtil.isEmpty(birthDate)){
-                    status.set("-1");
-                }
-            }else {
-                status.set("-1");
-            }
+        String birthDate = bhMap.get("出生日期");
+        if (StringUtil.isBlank(birthDate)) {
+            status.set("-1");
         }
-
     }
 }

+ 3 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0173.java

@@ -35,6 +35,9 @@ public class FIRP0173 extends QCCatalogue {
             //现病史所有诊断
             List<Diag> presentDiags = inputInfo.getBeHospitalizedDoc().getPresentLabel().getDiags();
             for (Diag diag : presentDiags) {
+                if (diag.getNegative() != null){
+                    continue;
+                }
                 if (diag.getHospitalDiagName().equals(outpatientEmergencyDiag)) {
                     status.set("0");
                     return;

+ 5 - 16
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/FirstCourseRecordAI.java

@@ -43,6 +43,7 @@ public class FirstCourseRecordAI extends ModelAI {
         FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
         if (firstCourseRecordDoc != null) {
             Map<String, String> structureMap = firstCourseRecordDoc.getStructureMap();
+
             //病历特点
             //putContent(crfContent, medicalTextType.get(0), firstCourseRecordDoc.getCaseCharacteristicLabel().getText(), Content.case_feature);
             //初步诊断
@@ -77,9 +78,10 @@ public class FirstCourseRecordAI extends ModelAI {
                 putContent(crfContent, medicalTextType.get(1), diffDiag, "鉴别诊断");
             }
             //诊疗计划
-            List<String> keys = Lists.newArrayList("需求评估", "预期目标", "诊疗计划", "治疗监测计划");
-            String treatPlanJoin = treatPlanJoin(structureMap, keys);
-            putContent(crfContent, medicalTextType.get(2), treatPlanJoin, "诊疗计划");
+            TreatPlanLabel treatPlanLabel = firstCourseRecordDoc.getTreatPlanLabel();
+            if (treatPlanLabel != null && StringUtil.isNotBlank(treatPlanLabel.getAiText())) {
+                putContent(crfContent, medicalTextType.get(2), treatPlanLabel.getAiText(), "诊疗计划");
+            }
             /*
             if (StringUtils.isNotEmpty(structureMap.get("诊疗计划")) && StringUtils.isNotEmpty(structureMap.get("需求评估"))) {
                 putContent(crfContent, medicalTextType.get(2), structureMap.get("诊疗计划") + structureMap.get("需求评估"), "诊疗计划");
@@ -227,17 +229,4 @@ public class FirstCourseRecordAI extends ModelAI {
         treatPlanLabel.setText(inputInfo.getFirstCourseRecordDoc().getTreatPlanLabel().getText());
         inputInfo.getFirstCourseRecordDoc().setTreatPlanLabel(treatPlanLabel);
     }
-
-    /**
-     * 拼接诊疗计划
-     **/
-    private String treatPlanJoin(Map<String, String> structureMap, List<String> keys) {
-        String treatPlan = "";
-        for (String key : keys) {
-            if (StringUtil.isNotBlank(structureMap.get(key))) {
-                treatPlan += key + ":" + structureMap.get(key) + "\n";
-            }
-        }
-        return treatPlan;
-    }
 }

+ 1 - 0
public/src/main/java/com/lantone/qc/pub/model/label/GeneralLabel.java

@@ -17,6 +17,7 @@ import java.util.Map;
 @Getter
 public class GeneralLabel {
     private String text;
+    private String aiText;
     private boolean crfLabel = true;
     protected  <T> void add(List<T> list, T obj) {
         list.add(obj);

+ 19 - 3
trans/src/main/java/com/lantone/qc/trans/comsis/ModelDocGenerate.java

@@ -1,5 +1,6 @@
 package com.lantone.qc.trans.comsis;
 
+import com.google.common.collect.Lists;
 import com.lantone.qc.pub.model.doc.*;
 import com.lantone.qc.pub.model.doc.consultation.ConsultationApplicationDoc;
 import com.lantone.qc.pub.model.doc.consultation.ConsultationRecordDoc;
@@ -9,9 +10,6 @@ import com.lantone.qc.pub.model.doc.operation.OperationInformedConsentDoc;
 import com.lantone.qc.pub.model.doc.operation.OperationRecordDoc;
 import com.lantone.qc.pub.model.doc.operation.OperationSafetyChecklistDoc;
 import com.lantone.qc.pub.model.doc.operation.PreoperativeDiscussionDoc;
-import com.lantone.qc.pub.model.doc.transferrecord.TransferIntoDoc;
-import com.lantone.qc.pub.model.doc.transferrecord.TransferOutDoc;
-import com.lantone.qc.pub.model.doc.transferrecord.TransferRecordDoc;
 import com.lantone.qc.pub.model.label.CaseCharacteristicLabel;
 import com.lantone.qc.pub.model.label.ChiefLabel;
 import com.lantone.qc.pub.model.label.DiagLabel;
@@ -26,7 +24,9 @@ import com.lantone.qc.pub.model.label.PresentLabel;
 import com.lantone.qc.pub.model.label.TreatPlanLabel;
 import com.lantone.qc.pub.model.label.VitalLabel;
 import com.lantone.qc.pub.model.label.VitalLabelSpecial;
+import com.lantone.qc.pub.util.StringUtil;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -365,6 +365,9 @@ public class ModelDocGenerate {
 
         TreatPlanLabel treatPlanLabel = new TreatPlanLabel();
         treatPlanLabel.setText(structureMap.get("诊疗计划"));
+        List<String> keys = Lists.newArrayList("需求评估", "预期目标", "诊疗计划", "治疗监测计划");
+        String treatPlanJoin = structureMapJoin(structureMap, keys);
+        treatPlanLabel.setAiText(treatPlanJoin);
         firstCourseRecordDoc.setTreatPlanLabel(treatPlanLabel);
 //        structureMap.remove("诊疗计划");
 
@@ -454,4 +457,17 @@ public class ModelDocGenerate {
         return threeLevelWardDoc;
     }
 
+    /**
+     * 拼接结构化数据
+     **/
+    private static String structureMapJoin(Map<String, String> structureMap, List<String> keys) {
+        String textJoin = "";
+        for (String key : keys) {
+            if (StringUtil.isNotBlank(structureMap.get(key))) {
+                textJoin += key + ":" + structureMap.get(key) + "\n";
+            }
+        }
+        return textJoin;
+    }
+
 }

+ 1 - 0
trans/src/main/java/com/lantone/qc/trans/taizhou/TaiZhouBeHospitalizedDocTrans.java

@@ -65,6 +65,7 @@ public class TaiZhouBeHospitalizedDocTrans extends ModelDocTrans {
             "工作场所=工作单位",
             "信息来源=病史陈述者",
             "生日=出生日期",
+            "出生时间=出生日期",
             "病人出生日期=出生日期",
             "新生儿出生日期=出生日期",
             "出生地址=户口地址",