|
@@ -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");
|
|
|
}
|
|
|
}
|