hujing před 5 roky
rodič
revize
06faf848b9

+ 32 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/consultation/CON0280.java

@@ -1,10 +1,16 @@
 package com.lantone.qc.kernel.catalogue.consultation;
 
 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.model.doc.consultation.ConsultationDoc;
+import com.lantone.qc.pub.model.doc.consultation.ConsultationResultsDoc;
+import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
+import java.util.Date;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -16,6 +22,31 @@ import java.util.Map;
 @Component
 public class CON0280 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        if (inputInfo.getConsultationDocs() == null || inputInfo.getConsultationDocs().size() == 0) status.set("0");
+        status.set("0");
+        if (inputInfo.getConsultationDocs() == null) {
+            return;
+        }
+        List<ConsultationDoc> consultationDocs = inputInfo.getConsultationDocs();
+        for (ConsultationDoc consultationDoc : consultationDocs) {
+            ConsultationResultsDoc consultationResultsDoc = consultationDoc.getConsultationResultsDoc();
+            if (consultationResultsDoc == null) {
+                continue;
+            }
+            Map<String, String> structureMap = consultationResultsDoc.getStructureMap();
+            String applicationDateStr = structureMap.get("会诊申请日期");
+            String arrivalDateStr = structureMap.get("会诊到达时间");
+            if (StringUtil.isBlank(applicationDateStr) || StringUtil.isBlank(arrivalDateStr)) {
+                continue;
+            }
+            Date applicationDate = StringUtil.parseDateTime(applicationDateStr);
+            Date arrivalDate = StringUtil.parseDateTime(arrivalDateStr);
+            if (applicationDate == null || arrivalDate == null) {
+                continue;
+            }
+            if (CatalogueUtil.compareTime(applicationDate, arrivalDate, (long) (24 * 60))) {
+                status.set("-1");
+                return;
+            }
+        }
     }
 }

+ 4 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0166.java

@@ -5,6 +5,7 @@ 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.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.Map;
@@ -25,6 +26,9 @@ public class FIRP0166 extends QCCatalogue {
             Map<String, String> beHospitalStructureMap = inputInfo.getBeHospitalizedDoc().getStructureMap();
             String firstAdmissionMarry = firstpageStructureMap.get(Content.marry);
             String admissionMarry = beHospitalStructureMap.get(Content.marry);
+            if (StringUtil.isBlank(firstAdmissionMarry) || StringUtil.isBlank(admissionMarry)) {
+                return;
+            }
             if (!CatalogueUtil.compareToken(firstAdmissionMarry, admissionMarry)) {
                 status.set("-1");
             }

+ 7 - 5
kernel/src/main/java/com/lantone/qc/kernel/catalogue/preoperativediscussion/PRE0330.java

@@ -9,6 +9,7 @@ import org.springframework.stereotype.Component;
 
 import java.text.ParseException;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @Description: 术前讨论记录无拟行术式
@@ -22,15 +23,16 @@ public class PRE0330 extends QCCatalogue {
     protected void start(InputInfo inputInfo, OutputInfo outputInfo) throws ParseException {
         status.set("0");
         List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
-        if(operationDocs == null || operationDocs.size()== 0){
+        if (operationDocs == null || operationDocs.size() == 0) {
             return;
         }
         for (OperationDoc operationDoc : operationDocs) {
-            if (operationDoc.getPreoperativeDiscussionDoc() != null
-                    && StringUtil.isEmpty(operationDoc.getPreoperativeDiscussionDoc().getStructureMap().get("拟行术式"))) {
-                status.set("-1");
+            if (operationDoc.getPreoperativeDiscussionDoc() != null) {
+                Map<String, String> structureMap = operationDoc.getPreoperativeDiscussionDoc().getStructureMap();
+                if (StringUtil.isEmpty(structureMap.get("拟行术式")) && StringUtil.isEmpty(structureMap.get("可能的变更"))) {
+                    status.set("-1");
+                }
             }
         }
     }
-
 }

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

@@ -41,7 +41,7 @@ public class BeHospitalizedAI extends ModelAI {
      * Present_cx[现病史]
      */
     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");
     public static String entityRelationObject = "entity_relation_object";
     public static String outputs = "outputs";
 
@@ -89,7 +89,7 @@ public class BeHospitalizedAI extends ModelAI {
             }
             //月经史
             String concatMenstrual = "";
-            if(personal_text != null){
+            if (personal_text != null) {
                 if (personal_text.length() > 30) {
                     concatMenstrual = personal_text.substring(personal_text.length() - 30);
                 } else {
@@ -169,6 +169,9 @@ public class BeHospitalizedAI extends ModelAI {
             return;
         }
         JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        if (aiOut == null) {
+            return;
+        }
         //使用现病史结构
         EntityProcessClinic entityProcessClinic = new EntityProcessClinic();
         PresentLabel presentLabel = entityProcessClinic.extractEntity(aiOut);
@@ -184,6 +187,9 @@ public class BeHospitalizedAI extends ModelAI {
             return;
         }
         JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        if (aiOut == null) {
+            return;
+        }
         //放置入inputinfo
         EntityProcessClinic entityProcessClinic = new EntityProcessClinic();
         PresentLabel presentLabel = entityProcessClinic.extractEntity(aiOut);
@@ -202,6 +208,9 @@ public class BeHospitalizedAI extends ModelAI {
             return;
         }
         JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        if (aiOut == null) {
+            return;
+        }
         //家族史信息处理
         EntityProcessFamily entityProcess = new EntityProcessFamily();
         FamilyLabel familyLabel = entityProcess.extractEntity(aiOut);
@@ -220,6 +229,9 @@ public class BeHospitalizedAI extends ModelAI {
             return;
         }
         JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        if (aiOut == null) {
+            return;
+        }
         //家族史信息处理
         EntityProcessMarital entityProcess = new EntityProcessMarital();
         MaritalLabel maritalLabel = entityProcess.extractEntity(aiOut);
@@ -232,6 +244,9 @@ public class BeHospitalizedAI extends ModelAI {
             return;
         }
         JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        if (aiOut == null) {
+            return;
+        }
         //放置入inputinfo
         EntityProcessPast entityProcessPast = new EntityProcessPast();
         PastLabel pastLabel = entityProcessPast.extractEntity(aiOut);
@@ -251,6 +266,9 @@ public class BeHospitalizedAI extends ModelAI {
             return;
         }
         JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        if (aiOut == null) {
+            return;
+        }
         //个人史信息提取
         EntityProcessPersonal entityProcessPersonal = new EntityProcessPersonal();
         PersonalLabel personalLabel = entityProcessPersonal.extractEntity(aiOut);
@@ -269,6 +287,9 @@ public class BeHospitalizedAI extends ModelAI {
             return;
         }
         JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        if (aiOut == null) {
+            return;
+        }
         //月经史信息处理
         EntityProcessMenses entityProcess = new EntityProcessMenses();
         MenstrualLabel menstrualLabel = entityProcess.extractEntity(aiOut);
@@ -287,6 +308,9 @@ public class BeHospitalizedAI extends ModelAI {
             return;
         }
         JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        if (aiOut == null) {
+            return;
+        }
         //诊断信息
         EntityProcessDiag entityProcessDiag = new EntityProcessDiag();
         List<Diag> diags = entityProcessDiag.extractEntity(aiOut);
@@ -296,18 +320,18 @@ public class BeHospitalizedAI extends ModelAI {
         initialDiagLabel.setDiags(diags);
         inputInfo.getBeHospitalizedDoc().setInitialDiagLabel(initialDiagLabel);
 
-//        //因为关系抽取未标注完成,先用规则
-//        String diagString = inputInfo.getBeHospitalizedDoc().getInitialDiagLabel().getText();
-//        if (StringUtils.isNotEmpty(diagString)) {
-//            String[] diagArray = diagString.split(",");
-//            List<Diag> diags = new ArrayList<>();
-//            for (String d : diagArray) {
-//                Diag diag = DiagEnhancer.create(d);
-//                diags.add(diag);
-//            }
-//            InitialDiagLabel initialDiagLabel = new InitialDiagLabel();
-//            initialDiagLabel.setDiags(diags);
-//        }
+        //        //因为关系抽取未标注完成,先用规则
+        //        String diagString = inputInfo.getBeHospitalizedDoc().getInitialDiagLabel().getText();
+        //        if (StringUtils.isNotEmpty(diagString)) {
+        //            String[] diagArray = diagString.split(",");
+        //            List<Diag> diags = new ArrayList<>();
+        //            for (String d : diagArray) {
+        //                Diag diag = DiagEnhancer.create(d);
+        //                diags.add(diag);
+        //            }
+        //            InitialDiagLabel initialDiagLabel = new InitialDiagLabel();
+        //            initialDiagLabel.setDiags(diags);
+        //        }
     }
 
     /**
@@ -352,6 +376,9 @@ public class BeHospitalizedAI extends ModelAI {
             return;
         }
         JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        if (aiOut == null) {
+            return;
+        }
         //诊断信息
         EntityProcessDiag entityProcessDiag = new EntityProcessDiag();
         List<Diag> diags = entityProcessDiag.extractEntity(aiOut);
@@ -373,6 +400,9 @@ public class BeHospitalizedAI extends ModelAI {
             return;
         }
         JSONObject aiOut = jsonObject.getJSONObject(entityRelationObject).getJSONObject(BeHospitalizedAI.outputs);
+        if (aiOut == null) {
+            return;
+        }
         //放置入inputinfo
         PacsLabel pacsLabel = inputInfo.getBeHospitalizedDoc().getPacsLabel();
         pacsLabel.setPacses(loadPacses(aiOut));