Kaynağa Gözat

Merge remote-tracking branch 'origin/dev'

louhr 5 yıl önce
ebeveyn
işleme
404d849db8
16 değiştirilmiş dosya ile 468 ekleme ve 322 silme
  1. 54 22
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0011.java
  2. 4 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0012.java
  3. 34 8
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH02909.java
  4. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH02969.java
  5. 2 2
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/consultation/CON0526.java
  6. 53 20
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstcourserecord/FIRC0095.java
  7. 4 0
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstcourserecord/FIRC0096.java
  8. 1 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstcourserecord/FIRC02970.java
  9. 31 5
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0175.java
  10. 10 8
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0192.java
  11. 5 2
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP02972.java
  12. 10 1
      kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0601.java
  13. 2 1
      kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessOperationDiscussion.java
  14. 3 3
      kernel/src/main/resources/application.yml
  15. 251 247
      public/src/main/java/com/lantone/qc/pub/util/StringUtil.java
  16. 3 1
      trans/src/main/java/com/lantone/qc/trans/shaoyf/ShaoyfConsultationDocTrans.java

+ 54 - 22
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0011.java

@@ -1,6 +1,9 @@
 package com.lantone.qc.kernel.catalogue.behospitalized;
 
+import com.alibaba.fastjson.JSONArray;
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.kernel.client.ChiefPresentSimilarityServiceClient;
+import com.lantone.qc.kernel.structure.ai.ModelAI;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.entity.Diag;
@@ -9,6 +12,7 @@ import com.lantone.qc.pub.model.label.DiagLabel;
 import com.lantone.qc.pub.model.label.PastLabel;
 import com.lantone.qc.pub.model.label.PresentLabel;
 import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
@@ -24,8 +28,10 @@ import java.util.List;
  */
 @Component
 public class BEH0011 extends QCCatalogue {
-//    @Autowired
-//    private SpecialStorageUtil specialStorageUtil;
+    //    @Autowired
+    //    private SpecialStorageUtil specialStorageUtil;
+    @Autowired
+    ChiefPresentSimilarityServiceClient chiefPresentSimilarityServiceClient;
 
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         if (inputInfo.getBeHospitalizedDoc() == null) {
@@ -35,39 +41,65 @@ public class BEH0011 extends QCCatalogue {
         PresentLabel presentLabel = inputInfo.getBeHospitalizedDoc().getPresentLabel();
         DiagLabel initialDiagLabel = inputInfo.getBeHospitalizedDoc().getInitialDiagLabel();
         PastLabel pastLabel = inputInfo.getBeHospitalizedDoc().getPastLabel();
-        if (initialDiagLabel == null || pastLabel == null || presentLabel == null) {
+        if (initialDiagLabel == null) {
             status.set("0");
             return;
         }
-        String presentText = presentLabel.getText();
-        List<Diag> presentDiags = presentLabel.getDiags();
-        List<String> presentPastDiag = new ArrayList<>();
-        /* 取现病史中一般情况之后的疾病名称 */
-        if (StringUtil.isNotBlank(presentText) && presentDiags.size() > 0) {
+        List<String> presentPastDiags = new ArrayList<>();
+        if (presentLabel != null) {
             List<GeneralDesc> generals = presentLabel.getGenerals();
-            String lastGeneral = generals.get(generals.size() - 1).getName();
-            int lastGeneralIndex = presentText.indexOf(lastGeneral);
-            for (Diag presentDiag : presentDiags) {
-                if (presentDiag.getNegative() != null) {
-                    continue;
-                }
-                /* 现病史中一般情况之后的疾病名称 */
-                if (presentText.indexOf(presentDiag.getHospitalDiagName()) > lastGeneralIndex) {
-                    presentPastDiag.add(presentDiag.getHospitalDiagName());
+            if (generals.size() > 0) {
+                String presentText = presentLabel.getText();
+                List<Diag> presentDiags = presentLabel.getDiags();
+                /* 取现病史中一般情况之后的疾病名称 */
+                if (StringUtil.isNotBlank(presentText) && presentDiags.size() > 0) {
+                    String lastGeneral = generals.get(generals.size() - 1).getName();
+                    int lastGeneralIndex = presentText.indexOf(lastGeneral);
+                    for (Diag presentDiag : presentDiags) {
+                        if (presentDiag.getNegative() != null) {
+                            continue;
+                        }
+                        /* 现病史中一般情况之后的疾病名称 */
+                        if (presentText.indexOf(presentDiag.getHospitalDiagName()) > lastGeneralIndex) {
+                            presentPastDiags.add(presentDiag.getHospitalDiagName());
+                        }
+                    }
                 }
             }
         }
         /* 取既往史中疾病名称 */
-        List<Diag> pastDiags = pastLabel.getDiags();
-        addDiagHospitalName(presentPastDiag, pastDiags);
+        if (pastLabel != null) {
+            List<Diag> pastDiags = pastLabel.getDiags();
+            addDiagHospitalName(presentPastDiags, pastDiags);
+        }
         /* 取初步诊断中疾病名称 */
-        List<String> initDiag = new ArrayList<>();
+        List<String> initDiags = new ArrayList<>();
         List<Diag> initialDiagDiags = initialDiagLabel.getDiags();
-        addDiagHospitalName(initDiag, initialDiagDiags);
+        addDiagHospitalName(initDiags, initialDiagDiags);
 
-        if (initDiag.containsAll(presentPastDiag)){
+        int matchSum = 0;
+        ModelAI modelAI = new ModelAI();
+        for (String presentPastDiag : presentPastDiags) {
+            JSONArray jsonArray = modelAI.loadChiefPresentSimilarAI(presentPastDiag, initDiags, false
+                    , "diagnose", chiefPresentSimilarityServiceClient);
+            if (jsonArray.size() == 2) {
+                /* 相似度最高症状 */
+                String symptom = jsonArray.getString(0);
+                /* 相似度分数 */
+                double likeRate = jsonArray.getDoubleValue(1);
+                if (likeRate > 0.9) {
+                    matchSum++;
+                }
+            }
+        }
+        if (matchSum == presentPastDiags.size()){
+            status.set("0");
+        }
+        /*
+        if (initDiags.containsAll(presentPastDiags)) {
             status.set("0");
         }
+         */
     }
 
     private void addDiagHospitalName(List<String> presentPastDiag, List<Diag> pastDiags) {

+ 4 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0012.java

@@ -35,6 +35,10 @@ public class BEH0012 extends QCCatalogue {
         }
         List<String> diags_out = new ArrayList<>();
         Map<String, String> hostpital_standDiag = specialStorageUtil.getJsonStringValue(KernelConstants.HOSPITAL_DIAG_MAP);
+        if (hostpital_standDiag == null){
+            status.set("0");
+            return;
+        }
         List<Diag> diags = inputInfo.getBeHospitalizedDoc().getInitialDiagLabel().getDiags();
         if (diags != null && diags.size() > 0) {
             for (Diag diag : diags) {

+ 34 - 8
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH02909.java

@@ -3,9 +3,9 @@ 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.GeneralDesc;
 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;
 
@@ -28,17 +28,43 @@ public class BEH02909 extends QCCatalogue {
             return;
         }
         String drugsCurrentlyInUse = inputInfo.getBeHospitalizedDoc().getStructureMap().get("目前使用的药物");
-        drugsCurrentlyInUse = StringUtil.isBlank(drugsCurrentlyInUse) ? "" : drugsCurrentlyInUse;
-        List<String> drug = getDrug(drugsCurrentlyInUse);
+        if (StringUtil.isBlank(drugsCurrentlyInUse)) {
+            status.set("0");
+            return;
+        }
+        /*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)) {
+        List<String> drugFromPresent = new ArrayList<>();
+        List<GeneralDesc> generals = presentLabel.getGenerals();
+        if (generals.size() > 0) {
+            String presentText = presentLabel.getText();
+            List<Medicine> medicines = presentLabel.getMedicines();
+            /* 取现病史中一般情况之后的药品名称 */
+            if (StringUtil.isNotBlank(presentText) && medicines != null && medicines.size() > 0) {
+                String lastGeneral = generals.get(generals.size() - 1).getName();
+                int lastGeneralIndex = presentText.indexOf(lastGeneral);
+                for (Medicine medicine : medicines) {
+                    /* 现病史中一般情况之后的药品名称,并且不包含不详 */
+                    if (presentText.indexOf(medicine.getName()) > lastGeneralIndex && !medicine.getName().contains("不详")) {
+                        drugFromPresent.add(medicine.getName());
+                    }
+                }
+            }
+        }
+        if (drugFromPresent.size() == 0) {
+            status.set("0");
+        } else {
+            int matchSum = 0;
+            for (String drug : drugFromPresent) {
+                if (drugsCurrentlyInUse.contains(drug)) {
+                    matchSum++;
+                }
+            }
+            if (matchSum == drugFromPresent.size()) {
                 status.set("0");
             }
         }
@@ -71,7 +97,7 @@ public class BEH02909 extends QCCatalogue {
         for (Medicine medicine : medicines) {
             name = medicine.getName();
             if (StringUtil.isNotBlank(name)) {
-                drugs.add(name.replaceAll("[“”\"]",""));
+                drugs.add(name.replaceAll("[“”\"]", ""));
             }
         }
         return drugs;

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

@@ -31,7 +31,7 @@ public class BEH02969 extends QCCatalogue {
         treatPlan = StringUtil.isBlank(treatPlan) ? "" : treatPlan;
         treatmentMonitoringPlan = StringUtil.isBlank(treatmentMonitoringPlan) ? "" : treatPlan;
         String text = treatPlan + "," + treatmentMonitoringPlan;
-        if (text.contains("生命体征") && (!text.contains("测") || !text.contains("血压") || !text.contains("心率"))) {
+        if (text.contains("生命体征") && (!text.contains("血压") || !text.contains("心率"))) {
             status.set("-1");
         }
     }

+ 2 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/consultation/CON0526.java

@@ -16,7 +16,7 @@ import java.util.*;
 
 /**
  * @ClassName : CON0526
- * @Description : 急诊室急会诊未在10分钟内完成
+ * @Description : 急会诊未在10分钟内到达
  * @Author : 楼辉荣
  * @Date: 2020-03-06 17:28
  */
@@ -24,7 +24,7 @@ import java.util.*;
 public class CON0526 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) throws ParseException {
         status.set("0");
-        if (inputInfo.getConsultationDocs() == null) {
+        if (inputInfo.getConsultationDocs().size() == 0) {
             return;
         }
         //会诊单按日会诊申请日期排序

+ 53 - 20
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstcourserecord/FIRC0095.java

@@ -1,6 +1,9 @@
 package com.lantone.qc.kernel.catalogue.firstcourserecord;
 
+import com.alibaba.fastjson.JSONArray;
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
+import com.lantone.qc.kernel.client.ChiefPresentSimilarityServiceClient;
+import com.lantone.qc.kernel.structure.ai.ModelAI;
 import com.lantone.qc.pub.model.InputInfo;
 import com.lantone.qc.pub.model.OutputInfo;
 import com.lantone.qc.pub.model.entity.Diag;
@@ -9,6 +12,7 @@ import com.lantone.qc.pub.model.label.DiagLabel;
 import com.lantone.qc.pub.model.label.PastLabel;
 import com.lantone.qc.pub.model.label.PresentLabel;
 import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
@@ -23,6 +27,9 @@ import java.util.List;
  */
 @Component
 public class FIRC0095 extends QCCatalogue {
+    @Autowired
+    ChiefPresentSimilarityServiceClient chiefPresentSimilarityServiceClient;
+
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         if (inputInfo.getBeHospitalizedDoc() == null) {
             status.set("0");
@@ -31,39 +38,65 @@ public class FIRC0095 extends QCCatalogue {
         PresentLabel presentLabel = inputInfo.getBeHospitalizedDoc().getPresentLabel();
         DiagLabel initialDiagLabel = inputInfo.getBeHospitalizedDoc().getInitialDiagLabel();
         PastLabel pastLabel = inputInfo.getBeHospitalizedDoc().getPastLabel();
-        if (initialDiagLabel == null || pastLabel == null || presentLabel == null) {
+        if (initialDiagLabel == null) {
             status.set("0");
             return;
         }
-        String presentText = presentLabel.getText();
-        List<Diag> presentDiags = presentLabel.getDiags();
-        List<String> presentPastDiag = new ArrayList<>();
-        /* 取现病史中一般情况之后的疾病名称 */
-        if (StringUtil.isNotBlank(presentText) && presentDiags.size() > 0) {
+        List<String> presentPastDiags = new ArrayList<>();
+        if (presentLabel != null) {
             List<GeneralDesc> generals = presentLabel.getGenerals();
-            String lastGeneral = generals.get(generals.size() - 1).getName();
-            int lastGeneralIndex = presentText.indexOf(lastGeneral);
-            for (Diag presentDiag : presentDiags) {
-                if (presentDiag.getNegative() != null) {
-                    continue;
-                }
-                /* 现病史中一般情况之后的疾病名称 */
-                if (presentText.indexOf(presentDiag.getHospitalDiagName()) > lastGeneralIndex) {
-                    presentPastDiag.add(presentDiag.getHospitalDiagName());
+            if (generals.size() > 0) {
+                String presentText = presentLabel.getText();
+                List<Diag> presentDiags = presentLabel.getDiags();
+                /* 取现病史中一般情况之后的疾病名称 */
+                if (StringUtil.isNotBlank(presentText) && presentDiags.size() > 0) {
+                    String lastGeneral = generals.get(generals.size() - 1).getName();
+                    int lastGeneralIndex = presentText.indexOf(lastGeneral);
+                    for (Diag presentDiag : presentDiags) {
+                        if (presentDiag.getNegative() != null) {
+                            continue;
+                        }
+                        /* 现病史中一般情况之后的疾病名称 */
+                        if (presentText.indexOf(presentDiag.getHospitalDiagName()) > lastGeneralIndex) {
+                            presentPastDiags.add(presentDiag.getHospitalDiagName());
+                        }
+                    }
                 }
             }
         }
         /* 取既往史中疾病名称 */
-        List<Diag> pastDiags = pastLabel.getDiags();
-        addDiagHospitalName(presentPastDiag, pastDiags);
+        if (pastLabel != null) {
+            List<Diag> pastDiags = pastLabel.getDiags();
+            addDiagHospitalName(presentPastDiags, pastDiags);
+        }
         /* 取初步诊断中疾病名称 */
-        List<String> initDiag = new ArrayList<>();
+        List<String> initDiags = new ArrayList<>();
         List<Diag> initialDiagDiags = initialDiagLabel.getDiags();
-        addDiagHospitalName(initDiag, initialDiagDiags);
+        addDiagHospitalName(initDiags, initialDiagDiags);
 
-        if (initDiag.containsAll(presentPastDiag)){
+        int matchSum = 0;
+        ModelAI modelAI = new ModelAI();
+        for (String presentPastDiag : presentPastDiags) {
+            JSONArray jsonArray = modelAI.loadChiefPresentSimilarAI(presentPastDiag, initDiags, false
+                    , "diagnose", chiefPresentSimilarityServiceClient);
+            if (jsonArray.size() == 2) {
+                /* 相似度最高症状 */
+                String symptom = jsonArray.getString(0);
+                /* 相似度分数 */
+                double likeRate = jsonArray.getDoubleValue(1);
+                if (likeRate > 0.9) {
+                    matchSum++;
+                }
+            }
+        }
+        if (matchSum == presentPastDiags.size()) {
+            status.set("0");
+        }
+        /*
+        if (initDiags.containsAll(presentPastDiags)) {
             status.set("0");
         }
+         */
     }
 
     private void addDiagHospitalName(List<String> presentPastDiag, List<Diag> pastDiags) {

+ 4 - 0
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstcourserecord/FIRC0096.java

@@ -32,6 +32,10 @@ public class FIRC0096 extends QCCatalogue {
         }
         List<String> diags_out = new ArrayList<>();
         Map<String, String> hostpital_standDiag = specialStorageUtil.getJsonStringValue(KernelConstants.HOSPITAL_DIAG_MAP);
+        if (hostpital_standDiag == null){
+            status.set("0");
+            return;
+        }
         FirstCourseRecordDoc firstCourseRecordDoc = inputInfo.getFirstCourseRecordDoc();
         if(firstCourseRecordDoc != null){
             DiagLabel initialDiagLabel = firstCourseRecordDoc.getInitialDiagLabel();

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

@@ -32,7 +32,7 @@ public class FIRC02970 extends QCCatalogue {
         treatPlan = StringUtil.isBlank(treatPlan) ? "" : treatPlan;
         treatmentMonitoringPlan = StringUtil.isBlank(treatmentMonitoringPlan) ? "" : treatPlan;
         String text = treatPlan + "," + treatmentMonitoringPlan;
-        if (text.contains("生命体征") && (!text.contains("测") || !text.contains("血压") || !text.contains("心率"))) {
+        if (text.contains("生命体征") && (!text.contains("血压") || !text.contains("心率"))) {
             status.set("-1");
         }
     }

+ 31 - 5
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0175.java

@@ -1,15 +1,20 @@
 package com.lantone.qc.kernel.catalogue.firstpagerecord;
 
+import com.alibaba.fastjson.JSONArray;
 import com.google.common.collect.Lists;
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
-import com.lantone.qc.kernel.util.CatalogueUtil;
+import com.lantone.qc.kernel.client.ChiefPresentSimilarityServiceClient;
+import com.lantone.qc.kernel.structure.ai.ModelAI;
 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.entity.Diag;
 import com.lantone.qc.pub.util.ListUtil;
+import com.lantone.qc.pub.util.StringUtil;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
@@ -21,6 +26,9 @@ import java.util.Map;
  */
 @Component
 public class FIRP0175 extends QCCatalogue {
+    @Autowired
+    ChiefPresentSimilarityServiceClient chiefPresentSimilarityServiceClient;
+
     List<String> diags = Lists.newArrayList("2型糖尿病");
 
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
@@ -37,16 +45,34 @@ public class FIRP0175 extends QCCatalogue {
             if (ListUtil.isEmpty(dischargeDiag) || ListUtil.isEmpty(leaveDiags)) {
                 return;
             }
-            String firstpageleaveDiag = dischargeDiag.get(0).get(Content.diagnoseName);
+            String firstpageleaveDiag = "";
+            for (Map<String, String> diag : dischargeDiag) {
+                String diagCategory = diag.get("诊断类别");
+                if (StringUtil.isNotBlank(diagCategory) && "主要诊断".equals(diagCategory)) {
+                    firstpageleaveDiag = diag.get(Content.diagnoseName);
+                    break;
+                }
+            }
             String leaveDiag = leaveDiags.get(0).getHospitalDiagName();
             //判断是否有2型糖尿病这种病如果没有,把疾病前的数字去掉
             if (!diags.contains(leaveDiag)) {
                 leaveDiag = leaveDiag.replaceAll("^[0-9]", "");
             }
-            if (!CatalogueUtil.compareToken(firstpageleaveDiag, leaveDiag)) {
-                status.set("-1");
+            /* 存放出院小结主要诊断,为了调用疾病相似度接口,特意存成list格式 */
+            List<String> firstLeaveDiag = new ArrayList<>();
+            firstLeaveDiag.add(leaveDiag);
+            ModelAI modelAI = new ModelAI();
+            JSONArray jsonArray = modelAI.loadChiefPresentSimilarAI(firstpageleaveDiag, firstLeaveDiag, false
+                    , "diagnose", chiefPresentSimilarityServiceClient);
+            if (jsonArray.size() == 2) {
+                /* 相似度最高症状 */
+                String symptom = jsonArray.getString(0);
+                /* 相似度分数 */
+                double likeRate = jsonArray.getDoubleValue(1);
+                if (likeRate < 0.9) {
+                    status.set("-1");
+                }
             }
-
         }
     }
 }

+ 10 - 8
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP0192.java

@@ -5,9 +5,8 @@ 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.operation.OperationDiscussionDoc;
 import com.lantone.qc.pub.model.doc.operation.OperationDoc;
-import org.apache.commons.lang3.StringUtils;
+import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.List;
@@ -22,10 +21,10 @@ import java.util.Map;
 @Component
 public class FIRP0192 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
+        status.set("0");
         FirstPageRecordDoc firstPageRecordDoc = inputInfo.getFirstPageRecordDoc();
         List<OperationDoc> operationDocs = inputInfo.getOperationDocs();
         if (firstPageRecordDoc == null || operationDocs.size() == 0) {
-            status.set("0");
             return;
         }
         Map<String, Object> firstPageRecordDocStructureMap = firstPageRecordDoc.getStructureExtMap();
@@ -33,13 +32,16 @@ public class FIRP0192 extends QCCatalogue {
         if (mapList != null && mapList.size() > 0) {
             Map<String, String> op = mapList.get(0);
             String oName = op.get(Content.operative_name);
+            String operationName = "";
             for (OperationDoc operationDoc : operationDocs) {
-                if (operationDoc.getOperationRecordDoc() == null) {
-                    continue;
+                if (operationDoc.getOperationRecordDoc() != null) {
+                    operationName = operationDoc.getOperationRecordDoc().getStructureMap().get("手术名称");
                 }
-                String operationName = operationDoc.getOperationRecordDoc().getStructureMap().get("手术名称");
-                if (operationName.contains(oName)){
-                    status.set("0");
+                if (StringUtil.isBlank(operationName) && operationDoc.getOperationDiscussionDoc() != null){
+                    operationName = operationDoc.getOperationDiscussionDoc().getStructureMap().get("手术名称");
+                }
+                if (StringUtil.isNotBlank(operationName) && !operationName.contains(oName)){
+                    status.set("-1");
                     return;
                 }
             }

+ 5 - 2
kernel/src/main/java/com/lantone/qc/kernel/catalogue/firstpagerecord/FIRP02972.java

@@ -8,6 +8,8 @@ import com.lantone.qc.pub.model.OutputInfo;
 import org.springframework.stereotype.Component;
 
 import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * @ClassName : FIRP02972
@@ -24,8 +26,9 @@ public class FIRP02972 extends QCCatalogue {
             String address = firstpageStructureMap.get(Content.current_address);
             if (!CatalogueUtil.isEmpty(address)) {
                 String suffix = (address.length()<=5)?address:(address.substring(address.length()-5));
-                String regex = "[\\d]+(-[\\d]+)*";
-                if (!suffix.matches(regex)) {
+                Pattern p = Pattern.compile("[0-9一二三四五六七八九]");
+                Matcher m = p.matcher(suffix);
+                if (!m.find()) {
                     status.set("-1");
                 }
             }

+ 10 - 1
kernel/src/main/java/com/lantone/qc/kernel/catalogue/threelevelward/THR0601.java

@@ -22,9 +22,18 @@ import java.util.Map;
 public class THR0601 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
         status.set("0");
-        if (inputInfo.getThreeLevelWardDocs().size() == 0) {
+        if (inputInfo.getLeaveHospitalDoc() == null || inputInfo.getThreeLevelWardDocs().size() == 0) {
             return;
         }
+        Map<String, String> leaveHospitalStructureMap = inputInfo.getLeaveHospitalDoc().getStructureMap();
+        String lengthOfStay = leaveHospitalStructureMap.get("住院天数");
+        if (StringUtil.isNotBlank(lengthOfStay) && CatalogueUtil.numbersOnly(lengthOfStay)) {
+            //如果住院天数小于2天则不判断该条规则
+            if (Integer.parseInt(lengthOfStay) <= 2) {
+                return;
+            }
+        }
+
         List<ThreeLevelWardDoc> allDoctorWradDocs = inputInfo.getThreeLevelWardDocs().get(0).getAllDoctorWradDocs();//查房记录
         String title, record;
         boolean findIndications = false;

+ 2 - 1
kernel/src/main/java/com/lantone/qc/kernel/structure/ai/process/EntityProcessOperationDiscussion.java

@@ -107,7 +107,8 @@ public class EntityProcessOperationDiscussion extends EntityProcess {
                     start = Integer.parseInt(lemma.getPosition());
                     title = lemma.getProperty();//截取的这一段文本的标题
                 } else {
-                    subContentIndex = start + lemma.getText().length() + 1 + "," + Integer.parseInt(lemma.getPosition());
+                    /*subContentIndex = start + lemma.getText().length() + 1 + "," + Integer.parseInt(lemma.getPosition());*/
+                    subContentIndex = start + "," + Integer.parseInt(lemma.getPosition());
                     putSubContent(titleText, title, subContentIndex);
                     start = Integer.parseInt(lemma.getPosition());
                     title = lemma.getProperty();//截取的这一段文本的标题

+ 3 - 3
kernel/src/main/resources/application.yml

@@ -18,13 +18,13 @@ qc:
   hospital_id: 1,2,3
 
 CRF:
-  url: http://192.168.2.234:3456/api/mr_info_ex/entity_predict
+  url: http://192.168.3.150:3456/api/mr_info_ex/entity_predict
 
 Similarity:
-  url: http://192.168.2.234:3456/api/mr_info_ex/similarity
+  url: http://192.168.3.150:3456/api/mr_info_ex/similarity
 
 ChiefPresentSimilarity:
-  url: http://192.168.2.234:3456/api/mr_info_ex/chief_present_similarity
+  url: http://192.168.3.150:3456/api/mr_info_ex/chief_present_similarity
 
 logging:          # 日志
   config: classpath:logback-spring.xml

+ 251 - 247
public/src/main/java/com/lantone/qc/pub/util/StringUtil.java

@@ -1,248 +1,252 @@
-package com.lantone.qc.pub.util;
-
-import com.lantone.qc.pub.Content;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.time.DateUtils;
-
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * @Description: 字符串有关帮助类 封装了第三方帮助类
- * @author: gaodm
- * @time: 2018/8/6 11:15
- */
-public class StringUtil {
-    /**
-     * 判断某字符串是否为空或长度为0或由空白符(whitespace) 构成
-     *
-     * @param str 需要判断的字符串
-     * @return
-     */
-    public static boolean isBlank(String str) {
-        return StringUtils.isBlank(str);
-    }
-
-    /**
-     * 判断某字符串是否不是为空或长度为0或由空白符(whitespace) 构成
-     *
-     * @param str 需要判断的字符串
-     * @return
-     */
-    public static boolean isNotBlank(String str) {
-        return StringUtils.isNotBlank(str);
-    }
-
-    /**
-     * 判断某字符串是否为空,为空的标准是 str==null 或 str.length()==0
-     *
-     * @param str 需要判断的字符串
-     * @return
-     */
-    public static boolean isEmpty(String str) {
-        return StringUtils.isEmpty(str);
-    }
-
-    /**
-     * 判断某字符串是否不为空,为空的标准是 str==null 或 str.length()==0
-     *
-     * @param str 需要判断的字符串
-     * @return
-     */
-    public static boolean isNotEmpty(String str) {
-        return StringUtils.isNotEmpty(str);
-    }
-
-    /**
-     * 删除字符串中的换行和控制字符
-     *
-     * @param str
-     */
-    public static String remove_ctl(String str) {
-        return str.replaceAll("\r|\n|\r\n|/r/n", "").trim();
-    }
-
-    /**
-     * 清除字符串中的空白
-     *
-     * @param str
-     * @return
-     */
-    public static String removeBlank(String str) {
-        if (isBlank(str)) {
-            return str;
-        }
-        return str.replaceAll("[\\s\\p{Zs}]", "");
-    }
-
-    /**
-     * 比较两个列表的内容
-     */
-    public static List<String> compareList(List<String> A, List<String> B) {
-        List<String> res = new ArrayList<>();
-
-        for (String i : A) {
-            if (!B.contains(i)) {
-                res.add(i);
-            }
-        }
-
-        for (String j : B) {
-            if (!A.contains(j)) {
-                res.add(j);
-            }
-        }
-
-        return res;
-    }
-
-    /**
-     * 列表A是否包含列表B
-     */
-    public static boolean containList(List<String> A, List<String> B) {
-        boolean res = true;
-
-        try {
-            for (String item : B) {
-                if (!A.contains(item)) {
-                    res = false;
-                    break;
-                }
-            }
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        } finally {
-            return res;
-        }
-    }
-
-    /**
-     * 比较两个字符串集合是否一模一样:个数一样、顺序一样
-     *
-     * @param source
-     * @param target
-     * @return
-     */
-    public static boolean isEqually(List<String> source, List<String> target) {
-        boolean ret = false;
-        if (ListUtil.isNotEmpty(source) && ListUtil.isNotEmpty(target)) {
-            String[] sourceArray = source.toArray(new String[] {});
-            String[] targetArray = target.toArray(new String[] {});
-            ret = Arrays.equals(sourceArray, targetArray);
-        }
-        return ret;
-    }
-
-    /**
-     * 判断字符串是否包含数字
-     *
-     * @param company
-     * @return
-     */
-    public static boolean isContainNumber(String company) {
-        Pattern p = Pattern.compile("[0-9]");
-        Matcher m = p.matcher(company);
-        if (m.find()) {
-            return true;
-        }
-        return false;
-    }
-
-    /**
-     * 标点符号空格等转逗号分割
-     *
-     * @param content
-     * @return
-     */
-    public static String specialCharComma(String content) {
-        if (StringUtil.isNotBlank(content)) {
-            content = content.replaceAll("(\\d+)|[、,。.;;??]", " ").replaceAll("(\\s+)", ",");
-            if (content.indexOf(",") == 0) {
-                content = content.substring(1);
-            }
-            if (content.lastIndexOf(",") == content.length() - 1) {
-                content = content.substring(0, content.length() - 1);
-            }
-        }
-        return content;
-    }
-
-    /**
-     * 判断两个字符串是否相同
-     *
-     * @param arg1
-     * @param arg2
-     * @return
-     */
-    public static boolean equals(String arg1, String arg2) {
-        return StringUtils.equals(arg1, arg2);
-    }
-
-    /**
-     * 比较两个字符串集合是否内容一样,即A包含B,B包含A,交集为空
-     * 个数、顺序不考虑
-     *
-     * @param source
-     * @param target
-     * @return
-     */
-//    public static boolean isSameContent(List<String> source, List<String> target) {
-//        Set<String> sourceSet = Sets.newHashSet(source);
-//        Set<String> targetSet = Sets.newHashSet(target);
-//        return Sets.difference(sourceSet, targetSet).isEmpty() && Sets.difference(targetSet, sourceSet).isEmpty();
-//    }
-
-    /**
-     * 解析时间
-     *
-     * @param datetime
-     * @return
-     */
-    public static Date parseDateTime(String datetime) {
-        Date date = null;
-        try {
-            datetime = remove_ctl(datetime);
-
-            if (datetime.contains("至")) {
-                datetime = datetime.split("至")[1].replaceAll("[\\u4e00-\\u9fa5]", "");
-            }
-
-            if (datetime.length() > 0) {
-                date = DateUtils.parseDate(datetime, Content.dateFormats);
-            }
-        } catch (ParseException ex) {
-            ex.printStackTrace();
-        }
-        return date;
-    }
-
-    /**
-     * 根据给定的时间格式解析时间
-     *
-     * @param datetime
-     * @return
-     */
-    public static Date parseDateTime(String datetime,String[] dateFormats) {
-        Date date = null;
-        try {
-            datetime = remove_ctl(datetime);
-
-            if (datetime.contains("至")) {
-                datetime = datetime.split("至")[1].replaceAll("[\\u4e00-\\u9fa5]", "");
-            }
-            if (datetime.length() > 0) {
-                date = DateUtils.parseDate(datetime, dateFormats);
-            }
-        } catch (ParseException ex) {
-            ex.printStackTrace();
-        } finally {
-            return date;
-        }
-    }
-
+package com.lantone.qc.pub.util;
+
+import com.lantone.qc.pub.Content;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateUtils;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @Description: 字符串有关帮助类 封装了第三方帮助类
+ * @author: gaodm
+ * @time: 2018/8/6 11:15
+ */
+public class StringUtil {
+    /**
+     * 判断某字符串是否为空或长度为0或由空白符(whitespace) 构成
+     *
+     * @param str 需要判断的字符串
+     * @return
+     */
+    public static boolean isBlank(String str) {
+        return StringUtils.isBlank(str);
+    }
+
+    /**
+     * 判断某字符串是否不是为空或长度为0或由空白符(whitespace) 构成
+     *
+     * @param str 需要判断的字符串
+     * @return
+     */
+    public static boolean isNotBlank(String str) {
+        return StringUtils.isNotBlank(str);
+    }
+
+    /**
+     * 判断某字符串是否为空,为空的标准是 str==null 或 str.length()==0
+     *
+     * @param str 需要判断的字符串
+     * @return
+     */
+    public static boolean isEmpty(String str) {
+        return StringUtils.isEmpty(str);
+    }
+
+    /**
+     * 判断某字符串是否不为空,为空的标准是 str==null 或 str.length()==0
+     *
+     * @param str 需要判断的字符串
+     * @return
+     */
+    public static boolean isNotEmpty(String str) {
+        return StringUtils.isNotEmpty(str);
+    }
+
+    /**
+     * 删除字符串中的换行和控制字符
+     *
+     * @param str
+     */
+    public static String remove_ctl(String str) {
+        String trim = "";
+        if(StringUtils.isNotEmpty(str)){
+            trim = str.replaceAll("\r|\n|\r\n|/r/n", "").trim();
+        }
+        return trim;
+    }
+
+    /**
+     * 清除字符串中的空白
+     *
+     * @param str
+     * @return
+     */
+    public static String removeBlank(String str) {
+        if (isBlank(str)) {
+            return str;
+        }
+        return str.replaceAll("[\\s\\p{Zs}]", "");
+    }
+
+    /**
+     * 比较两个列表的内容
+     */
+    public static List<String> compareList(List<String> A, List<String> B) {
+        List<String> res = new ArrayList<>();
+
+        for (String i : A) {
+            if (!B.contains(i)) {
+                res.add(i);
+            }
+        }
+
+        for (String j : B) {
+            if (!A.contains(j)) {
+                res.add(j);
+            }
+        }
+
+        return res;
+    }
+
+    /**
+     * 列表A是否包含列表B
+     */
+    public static boolean containList(List<String> A, List<String> B) {
+        boolean res = true;
+
+        try {
+            for (String item : B) {
+                if (!A.contains(item)) {
+                    res = false;
+                    break;
+                }
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        } finally {
+            return res;
+        }
+    }
+
+    /**
+     * 比较两个字符串集合是否一模一样:个数一样、顺序一样
+     *
+     * @param source
+     * @param target
+     * @return
+     */
+    public static boolean isEqually(List<String> source, List<String> target) {
+        boolean ret = false;
+        if (ListUtil.isNotEmpty(source) && ListUtil.isNotEmpty(target)) {
+            String[] sourceArray = source.toArray(new String[] {});
+            String[] targetArray = target.toArray(new String[] {});
+            ret = Arrays.equals(sourceArray, targetArray);
+        }
+        return ret;
+    }
+
+    /**
+     * 判断字符串是否包含数字
+     *
+     * @param company
+     * @return
+     */
+    public static boolean isContainNumber(String company) {
+        Pattern p = Pattern.compile("[0-9]");
+        Matcher m = p.matcher(company);
+        if (m.find()) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * 标点符号空格等转逗号分割
+     *
+     * @param content
+     * @return
+     */
+    public static String specialCharComma(String content) {
+        if (StringUtil.isNotBlank(content)) {
+            content = content.replaceAll("(\\d+)|[、,。.;;??]", " ").replaceAll("(\\s+)", ",");
+            if (content.indexOf(",") == 0) {
+                content = content.substring(1);
+            }
+            if (content.lastIndexOf(",") == content.length() - 1) {
+                content = content.substring(0, content.length() - 1);
+            }
+        }
+        return content;
+    }
+
+    /**
+     * 判断两个字符串是否相同
+     *
+     * @param arg1
+     * @param arg2
+     * @return
+     */
+    public static boolean equals(String arg1, String arg2) {
+        return StringUtils.equals(arg1, arg2);
+    }
+
+    /**
+     * 比较两个字符串集合是否内容一样,即A包含B,B包含A,交集为空
+     * 个数、顺序不考虑
+     *
+     * @param source
+     * @param target
+     * @return
+     */
+//    public static boolean isSameContent(List<String> source, List<String> target) {
+//        Set<String> sourceSet = Sets.newHashSet(source);
+//        Set<String> targetSet = Sets.newHashSet(target);
+//        return Sets.difference(sourceSet, targetSet).isEmpty() && Sets.difference(targetSet, sourceSet).isEmpty();
+//    }
+
+    /**
+     * 解析时间
+     *
+     * @param datetime
+     * @return
+     */
+    public static Date parseDateTime(String datetime) {
+        Date date = null;
+        try {
+            datetime = remove_ctl(datetime);
+
+            if (datetime.contains("至")) {
+                datetime = datetime.split("至")[1].replaceAll("[\\u4e00-\\u9fa5]", "");
+            }
+
+            if (datetime.length() > 0) {
+                date = DateUtils.parseDate(datetime, Content.dateFormats);
+            }
+        } catch (ParseException ex) {
+            ex.printStackTrace();
+        }
+        return date;
+    }
+
+    /**
+     * 根据给定的时间格式解析时间
+     *
+     * @param datetime
+     * @return
+     */
+    public static Date parseDateTime(String datetime,String[] dateFormats) {
+        Date date = null;
+        try {
+            datetime = remove_ctl(datetime);
+
+            if (datetime.contains("至")) {
+                datetime = datetime.split("至")[1].replaceAll("[\\u4e00-\\u9fa5]", "");
+            }
+            if (datetime.length() > 0) {
+                date = DateUtils.parseDate(datetime, dateFormats);
+            }
+        } catch (ParseException ex) {
+            ex.printStackTrace();
+        } finally {
+            return date;
+        }
+    }
+
 }

+ 3 - 1
trans/src/main/java/com/lantone/qc/trans/shaoyf/ShaoyfConsultationDocTrans.java

@@ -147,10 +147,12 @@ public class ShaoyfConsultationDocTrans extends ModelDocTrans {
             "医生=医师签名",
             "本人姓名=姓名",
             "病史描述=病史回顾描述",
+            "简要病情=病史回顾描述",
             "病历日期=会诊日期及时间",
             "记录及建议=会诊意见",
             "临床科室1=临床科室",
-            "申请医生1=申请医生"
+            "申请医生1=申请医生",
+            "临床科室=申请科室"
     );