Browse Source

修改逻辑及bug

hujing 5 years ago
parent
commit
5973eb6f16

+ 31 - 37
kernel/src/main/java/com/lantone/qc/kernel/catalogue/behospitalized/BEH0005.java

@@ -1,17 +1,16 @@
 package com.lantone.qc.kernel.catalogue.behospitalized;
 
+import com.google.common.collect.Lists;
 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.entity.Clinical;
 import com.lantone.qc.pub.model.entity.PD;
+import com.lantone.qc.pub.model.label.ChiefLabel;
+import com.lantone.qc.pub.util.StringUtil;
 import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
-import java.util.Map;
 
 
 /**
@@ -23,48 +22,43 @@ import java.util.Map;
 @Component
 public class BEH0005 extends QCCatalogue {
     public void start(InputInfo inputInfo, OutputInfo outputInfo) {
-        if(inputInfo.getBeHospitalizedDoc() == null){
+        if (inputInfo.getBeHospitalizedDoc() == null) {
             status.set("0");
             return;
         }
-        List<Integer> time_index = new ArrayList<>();
-        String chief_text = inputInfo.getBeHospitalizedDoc().getChiefLabel().getText();
-        if(chief_text.contains("检查") || chief_text.contains("术后") || chief_text.contains("药物")){
+        List<Integer> timeIndex = new ArrayList<>();
+        ChiefLabel chiefLabel = inputInfo.getBeHospitalizedDoc().getChiefLabel();
+        if (chiefLabel == null) {
             status.set("0");
-        }else {
-            int year = chief_text.indexOf("年");
-            if (year != -1) {
-                time_index.add(year);
-            }
-            int month = chief_text.indexOf("月");
-            if (month != -1) {
-                time_index.add(month);
-            }
-            int week = chief_text.indexOf("周");
-            if (week != -1) {
-                time_index.add(week);
-            }
-            int day = chief_text.indexOf("天");
-            if (day != -1) {
-                time_index.add(day);
-            }
-            int ri = chief_text.indexOf("日");
-            if (ri != -1) {
-                time_index.add(ri);
-            }
-            int hour = chief_text.indexOf("时");
-            if (hour != -1) {
-                time_index.add(hour);
+            return;
+        }
+        List<PD> pds = chiefLabel.getPds();
+        String chiefText = chiefLabel.getText();
+        if (chiefText.contains("检查") || chiefText.contains("术后") || chiefText.contains("药物")) {
+            status.set("0");
+        } else {
+            List<String> words = Lists.newArrayList("年", "月", "周", "天", "日", "时");
+            String name;
+            for (PD pd : pds) {
+                name = pd.getName();
+                if (StringUtil.isNotBlank(name)) {
+                    for (String word : words) {
+                        if (name.contains(word)) {
+                            timeIndex.add(chiefText.indexOf(word));
+                            break;
+                        }
+                    }
+                }
             }
         }
-        if(time_index.size()>0){
-            int min = time_index.get(0);
-            for (Integer data:time_index) {
-                if(data<min){
+        if (timeIndex.size() > 0) {
+            int min = timeIndex.get(0);
+            for (Integer data : timeIndex) {
+                if (data < min) {
                     min = data;
                 }
             }
-            if(min == time_index.get(0)){
+            if (min == timeIndex.get(0)) {
                 status.set("0");
             }
         }

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

@@ -34,7 +34,8 @@ public class BEH0441 extends QCCatalogue {
         }
         String presentText = presentLabel.getText();
         if (StringUtil.isNotBlank(presentText)) {
-            List<String> words = Lists.newArrayList("胃纳", "食纳", "食欲", "未纳", "纳眠", "饮食", "纳眠","禁食","未食","鼻饲","食");
+            List<String> words = Lists.newArrayList("胃纳", "食纳", "食欲", "未纳", "纳眠", "饮食", "纳眠"
+                    ,"禁食","未食","鼻饲","食","吃","饮");
             for (String word : words) {
                 if (presentText.contains(word)) {
                     status.set("0");

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

@@ -1,10 +1,10 @@
 package com.lantone.qc.kernel.catalogue.firstpagerecord;
 
 import com.lantone.qc.kernel.catalogue.QCCatalogue;
-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;
@@ -22,7 +22,10 @@ public class FIRP0162 extends QCCatalogue {
         if (inputInfo.getFirstPageRecordDoc() != null && inputInfo.getFirstPageRecordDoc().getStructureMap() != null) {
             Map<String, String> firstpageStructureMap = inputInfo.getFirstPageRecordDoc().getStructureMap();
             String idNumber = firstpageStructureMap.get(Content.idNumber);
-            if (!CatalogueUtil.isEmpty(idNumber)) {
+            if (StringUtil.isNotBlank(idNumber)) {
+                if ("-".equals(idNumber) || "—".equals(idNumber)) {
+                    return;
+                }
                 String regex = "\\d{15}|\\d{17}[\\dxX]";
                 if (!idNumber.matches(regex)) {
                     status.set("-1");