|
@@ -3,7 +3,6 @@ package com.diagbot.facade;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.diagbot.biz.push.entity.Lis;
|
|
|
-import com.diagbot.biz.push.entity.Pacs;
|
|
|
import com.diagbot.dto.RegularValueDTO;
|
|
|
import com.diagbot.dto.WordCrfDTO;
|
|
|
import com.diagbot.entity.KlRegularConfig;
|
|
@@ -27,11 +26,13 @@ import com.diagbot.vo.IndicationPushVO;
|
|
|
import com.diagbot.vo.RegularConfigSaveVO;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Maps;
|
|
|
-import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.collections4.MapUtils;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.util.*;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Iterator;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
@@ -127,7 +128,7 @@ public class KlRegularConfigFacade extends KlRegularConfigServiceImpl {
|
|
|
VitalLabel vitalLabel = wordCrfDTO.getVitalLabel();
|
|
|
List<Vital> vitals = vitalLabel.getVitals();
|
|
|
|
|
|
- if (StringUtil.isBlank(symptom) && StringUtil.isBlank(pasts)&& StringUtil.isBlank(pacs)) {
|
|
|
+ if (StringUtil.isBlank(symptom) && StringUtil.isBlank(pasts) && StringUtil.isBlank(pacs)) {
|
|
|
return wordCrfDTO;
|
|
|
}
|
|
|
|
|
@@ -162,25 +163,25 @@ public class KlRegularConfigFacade extends KlRegularConfigServiceImpl {
|
|
|
//辅检
|
|
|
List<KlRegularConfig> rulesTepy = EntityUtil.makeEntityListMap(regularConfigs, "rulesTepy").get(RegularConfigEnum.pacs.getKey());
|
|
|
Map<String, String> rulePacsCompiles = ruleAllCompile(rulesTepy, pacs);
|
|
|
- if(MapUtils.isNotEmpty(rulePacsCompiles)){
|
|
|
- if(ListUtil.isNotEmpty(pacsNumList)){
|
|
|
- for (PacsNum x: pacsNumList) {
|
|
|
+ if (MapUtils.isNotEmpty(rulePacsCompiles)) {
|
|
|
+ if (ListUtil.isNotEmpty(pacsNumList)) {
|
|
|
+ for (PacsNum x : pacsNumList) {
|
|
|
String name = x.getName();
|
|
|
PD pd = x.getPd();
|
|
|
- if(pd != null){
|
|
|
+ if (pd != null) {
|
|
|
String value = pd.getValue();
|
|
|
String unit = pd.getUnit();
|
|
|
String key = name + "_" + value;
|
|
|
- if(rulePacsCompiles.containsKey(key)){
|
|
|
- if(StringUtil.isBlank(unit)){
|
|
|
+ if (rulePacsCompiles.containsKey(key)) {
|
|
|
+ if (StringUtil.isBlank(unit)) {
|
|
|
unit = rulePacsCompiles.get(key);
|
|
|
pd.setUnit(unit);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }else {
|
|
|
- rulePacsCompiles.forEach((x,y)->{
|
|
|
+ } else {
|
|
|
+ rulePacsCompiles.forEach((x, y) -> {
|
|
|
String[] nameValue = x.split("_");
|
|
|
PacsNum pacsNum = new PacsNum();
|
|
|
pacsNum.setName(nameValue[0]);
|
|
@@ -197,19 +198,19 @@ public class KlRegularConfigFacade extends KlRegularConfigServiceImpl {
|
|
|
//体征
|
|
|
List<KlRegularConfig> rulesTepyVitals = EntityUtil.makeEntityListMap(regularConfigs, "rulesTepy").get(RegularConfigEnum.vital.getKey());
|
|
|
Map<String, String> rulevitalsCompiles = ruleAllCompile(rulesTepyVitals, vital);
|
|
|
- if(MapUtils.isNotEmpty(rulevitalsCompiles)){
|
|
|
- if(ListUtil.isNotEmpty(vitals)){
|
|
|
+ if (MapUtils.isNotEmpty(rulevitalsCompiles)) {
|
|
|
+ if (ListUtil.isNotEmpty(vitals)) {
|
|
|
Iterator<Vital> vitalIterator = vitals.iterator();
|
|
|
- while (vitalIterator.hasNext()){
|
|
|
+ while (vitalIterator.hasNext()) {
|
|
|
Vital next = vitalIterator.next();
|
|
|
String name = next.getName();
|
|
|
PD pd = next.getPd();
|
|
|
- if(pd != null){
|
|
|
+ if (pd != null) {
|
|
|
String value = pd.getValue();
|
|
|
String unit = pd.getUnit();
|
|
|
String key = name + "_" + value;
|
|
|
- if(rulevitalsCompiles.containsKey(key)){
|
|
|
- if(StringUtil.isBlank(unit)){
|
|
|
+ if (rulevitalsCompiles.containsKey(key)) {
|
|
|
+ if (StringUtil.isBlank(unit)) {
|
|
|
unit = rulevitalsCompiles.get(key);
|
|
|
pd.setUnit(unit);
|
|
|
}
|
|
@@ -217,8 +218,8 @@ public class KlRegularConfigFacade extends KlRegularConfigServiceImpl {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- }else {
|
|
|
- rulevitalsCompiles.forEach((x,y)->{
|
|
|
+ } else {
|
|
|
+ rulevitalsCompiles.forEach((x, y) -> {
|
|
|
String[] nameValue = x.split("_");
|
|
|
Vital pacsNum = new Vital();
|
|
|
pacsNum.setName(nameValue[0]);
|
|
@@ -295,34 +296,35 @@ public class KlRegularConfigFacade extends KlRegularConfigServiceImpl {
|
|
|
/**
|
|
|
* 把正则匹配出来的放在map里
|
|
|
* key:体温_37 value:℃
|
|
|
+ *
|
|
|
* @param regexGroupData
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String,String> ruleCompile(List<List<String>> regexGroupData){
|
|
|
- Map<String, String> ruleCompileMap = Maps.newHashMap();
|
|
|
- if(ListUtil.isNotEmpty(regexGroupData)){
|
|
|
- for (List<String> groupContents:regexGroupData) {
|
|
|
- if(ListUtil.isNotEmpty(groupContents)){
|
|
|
- String s = groupContents.get(2);
|
|
|
- if(StringUtil.isBlank(s)){
|
|
|
- s = "";
|
|
|
- }
|
|
|
- ruleCompileMap.put(groupContents.get(0)+"_"+groupContents.get(1),s);
|
|
|
- }
|
|
|
- }
|
|
|
+ public Map<String, String> ruleCompile(List<List<String>> regexGroupData) {
|
|
|
+ Map<String, String> ruleCompileMap = Maps.newHashMap();
|
|
|
+ if (ListUtil.isNotEmpty(regexGroupData)) {
|
|
|
+ for (List<String> groupContents : regexGroupData) {
|
|
|
+ if (ListUtil.isNotEmpty(groupContents)) {
|
|
|
+ String s = groupContents.get(2);
|
|
|
+ if (StringUtil.isBlank(s)) {
|
|
|
+ s = "";
|
|
|
+ }
|
|
|
+ ruleCompileMap.put(groupContents.get(0) + "_" + groupContents.get(1), s);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- return ruleCompileMap;
|
|
|
+ }
|
|
|
+ return ruleCompileMap;
|
|
|
}
|
|
|
|
|
|
- public Map<String,String> ruleAllCompile(List<KlRegularConfig> rulesTepy,String txt){
|
|
|
+ public Map<String, String> ruleAllCompile(List<KlRegularConfig> rulesTepy, String txt) {
|
|
|
Map<String, String> ruleAllCompileMap = Maps.newHashMap();
|
|
|
- if(ListUtil.isNotEmpty(rulesTepy)){
|
|
|
- for (KlRegularConfig klrc:rulesTepy) {
|
|
|
+ if (ListUtil.isNotEmpty(rulesTepy)) {
|
|
|
+ for (KlRegularConfig klrc : rulesTepy) {
|
|
|
String rulesValue = klrc.getRulesValue();
|
|
|
List<List<String>> regexGroupData = RegexUtil.getRegexGroupData(txt, rulesValue);
|
|
|
Map<String, String> ruleCompileMap = ruleCompile(regexGroupData);
|
|
|
- if(MapUtils.isNotEmpty(ruleCompileMap)){
|
|
|
+ if (MapUtils.isNotEmpty(ruleCompileMap)) {
|
|
|
ruleAllCompileMap.putAll(ruleCompileMap);
|
|
|
}
|
|
|
}
|