Parcourir la source

首次病程录AI修改bug

hujing il y a 5 ans
Parent
commit
1f23b150ba

+ 1 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstcourserecord/FIRC0083.java

@@ -23,7 +23,7 @@ public class FIRC0083 extends QCCatalogue {
             return;
         }
         double likeRate = firstCourseRecordDoc.getCaseCharacteristicLabel().getLikeRate();
-        if (likeRate > 0.8d) {
+        if (likeRate > 0.5) {
             status.set("-1");
         }
     }

+ 44 - 27
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/FirstCourseRecordAI.java

@@ -18,6 +18,7 @@ import org.apache.commons.lang3.StringUtils;
 
 import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @ClassName : FirstCourseRecordAI
@@ -38,48 +39,64 @@ public class FirstCourseRecordAI extends ModelAI {
         JSONArray crfContent = new JSONArray();
         JSONArray similarContent = new JSONArray();
         FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
-        if (firstCourseRecordDoc != null && StringUtils.isNotEmpty(firstCourseRecordDoc.getText())) {
-//            //病历特点
-//            putContent(crfContent, medicalTextType.get(0), firstCourseRecordDoc.getCaseCharacteristicLabel().getText(), Content.case_feature);
+        if (firstCourseRecordDoc != null) {
+            Map<String, String> structureMap = firstCourseRecordDoc.getStructureMap();
+            //病历特点
+            //putContent(crfContent, medicalTextType.get(0), firstCourseRecordDoc.getCaseCharacteristicLabel().getText(), Content.case_feature);
             //初步诊断
-            putContent(crfContent, medicalTextType.get(1), firstCourseRecordDoc.getInitialDiagLabel().getText(), Content.initial_diag);
-//            //诊断依据
-//            putContent(crfContent, medicalTextType.get(0), firstCourseRecordDoc.getDiagnosisLabel().getText(), Content.diag_basis);
+            if (StringUtils.isNotEmpty(structureMap.get(Content.initial_diag))) {
+                putContent(crfContent, medicalTextType.get(1), structureMap.get(Content.initial_diag), Content.initial_diag);
+            } else if (firstCourseRecordDoc.getInitialDiagLabel() != null && StringUtil.isNotBlank(firstCourseRecordDoc.getInitialDiagLabel().getText())) {
+                putContent(crfContent, medicalTextType.get(1), firstCourseRecordDoc.getInitialDiagLabel().getText(), Content.initial_diag);
+            }
+
+            //诊断依据
+            //putContent(crfContent, medicalTextType.get(0), firstCourseRecordDoc.getDiagnosisLabel().getText(), Content.diag_basis);
             //鉴别诊断
-            putContent(crfContent, medicalTextType.get(1), firstCourseRecordDoc.getDifferentialDiagLabel().getText(), Content.differential_diag_basis);
+            if (StringUtils.isNotEmpty(structureMap.get("鉴别诊断"))) {
+                putContent(crfContent, medicalTextType.get(1), structureMap.get("鉴别诊断"), "鉴别诊断");
+            } else if (firstCourseRecordDoc.getDifferentialDiagLabel() != null && StringUtil.isNotBlank(firstCourseRecordDoc.getDifferentialDiagLabel().getText())) {
+                putContent(crfContent, medicalTextType.get(1), firstCourseRecordDoc.getDifferentialDiagLabel().getText(), "鉴别诊断");
+            }
             //诊疗计划
-            if (StringUtils.isNotEmpty(firstCourseRecordDoc.getStructureMap().get("诊疗计划")) && StringUtils.isNotEmpty(firstCourseRecordDoc.getStructureMap().get("需求评估"))) {
-                putContent(crfContent, medicalTextType.get(2), firstCourseRecordDoc.getStructureMap().get("需求评估") + StringUtils.isNotEmpty(firstCourseRecordDoc.getStructureMap().get("诊疗计划")), Content.treat_plan);
-                firstCourseRecordDoc.getTreatPlanLabel().setText(firstCourseRecordDoc.getStructureMap().get("需求评估") + StringUtils.isNotEmpty(firstCourseRecordDoc.getStructureMap().get("诊疗计划")));
-            } else if (StringUtils.isNotEmpty(firstCourseRecordDoc.getStructureMap().get("诊疗计划"))) {
-                putContent(crfContent, medicalTextType.get(2), firstCourseRecordDoc.getStructureMap().get("诊疗计划"), Content.treat_plan);
-            } else if (StringUtils.isNotEmpty(firstCourseRecordDoc.getStructureMap().get("需求评估"))) {
-                putContent(crfContent, medicalTextType.get(2), firstCourseRecordDoc.getStructureMap().get("需求评估"), Content.treat_plan);
-                firstCourseRecordDoc.getTreatPlanLabel().setText(firstCourseRecordDoc.getStructureMap().get("需求评估"));
+            if (StringUtils.isNotEmpty(structureMap.get("诊疗计划")) && StringUtils.isNotEmpty(structureMap.get("需求评估"))) {
+                putContent(crfContent, medicalTextType.get(2), structureMap.get("需求评估") + StringUtils.isNotEmpty(structureMap.get("诊疗计划")), "诊疗计划");
+                firstCourseRecordDoc.getTreatPlanLabel().setText(structureMap.get("需求评估") + StringUtils.isNotEmpty(structureMap.get("诊疗计划")));
+            } else if (StringUtils.isNotEmpty(structureMap.get("诊疗计划"))) {
+                putContent(crfContent, medicalTextType.get(2), structureMap.get("诊疗计划"), "诊疗计划");
+            } else if (StringUtils.isNotEmpty(structureMap.get("需求评估"))) {
+                putContent(crfContent, medicalTextType.get(2), structureMap.get("需求评估"), "诊疗计划");
+                firstCourseRecordDoc.getTreatPlanLabel().setText(structureMap.get("需求评估"));
             } else {
-                putContent(crfContent, medicalTextType.get(2), firstCourseRecordDoc.getTreatPlanLabel().getText(), Content.treat_plan);
+                putContent(crfContent, medicalTextType.get(2), firstCourseRecordDoc.getTreatPlanLabel().getText(), "诊疗计划");
             }
 
             //病历特点与现病史比较相似度
             if (inputInfo.getBeHospitalizedDoc() != null && StringUtil.isNotBlank(inputInfo.getBeHospitalizedDoc().getPresentLabel().getText())) {
-                putContent(similarContent, firstCourseRecordDoc.getCaseCharacteristicLabel().getText(), inputInfo.getBeHospitalizedDoc().getPresentLabel().getText());
+                //先从结构化数据找病例特点
+                if (StringUtil.isNotBlank(structureMap.get("病例特点"))) {
+                    putContent(similarContent, structureMap.get("病例特点"), inputInfo.getBeHospitalizedDoc().getPresentLabel().getText());
+                } else if (firstCourseRecordDoc.getCaseCharacteristicLabel() != null && StringUtil.isNotBlank(firstCourseRecordDoc.getCaseCharacteristicLabel().getText())) {
+                    //再从doc找病例特点
+                    putContent(similarContent, firstCourseRecordDoc.getCaseCharacteristicLabel().getText(), inputInfo.getBeHospitalizedDoc().getPresentLabel().getText());
+                }
             }
 
             JSONObject midData = loadAI(crfContent, crfServiceClient);//crf返回数据
-//            if (midData.containsKey(Content.case_feature)) {
-//                putCaseCharacteristicCrfData(midData.getJSONObject(Content.case_feature), inputInfo);//处理病历特点
-//            }
+            //if (midData.containsKey(Content.case_feature)) {
+            //  putCaseCharacteristicCrfData(midData.getJSONObject(Content.case_feature), inputInfo);//处理病历特点
+            //}
             if (midData.containsKey(Content.initial_diag)) {
                 putInitialDiagCrfData(midData.getJSONObject(Content.initial_diag), inputInfo);//处理初步诊断
             }
-//            if (midData.containsKey(Content.diag_basis)) {
-//                putDiagnosisCrfData(midData.getJSONObject(Content.diag_basis), inputInfo);//处理诊断依据
-//            }
-            if (midData.containsKey(Content.differential_diag_basis)) {
-                putDifferentialDiagCrfData(midData.getJSONObject(Content.differential_diag_basis), inputInfo);//处理鉴别诊断
+            //if (midData.containsKey(Content.diag_basis)) {
+            //    putDiagnosisCrfData(midData.getJSONObject(Content.diag_basis), inputInfo);//处理诊断依据
+            //}
+            if (midData.containsKey("鉴别诊断")) {
+                putDifferentialDiagCrfData(midData.getJSONObject("鉴别诊断"), inputInfo);//处理鉴别诊断
             }
-            if (midData.containsKey(Content.treat_plan)) {
-                putTreatPlanCrfData(midData.getJSONObject(Content.treat_plan), inputInfo);//处理诊疗计划
+            if (midData.containsKey("诊疗计划")) {
+                putTreatPlanCrfData(midData.getJSONObject("诊疗计划"), inputInfo);//处理诊疗计划
             }
 
             double likeRate = loadSimilarAI(similarContent, similarityServiceClient);