|
@@ -66,16 +66,14 @@ public class ParamsDataProxy {
|
|
|
}
|
|
|
}
|
|
|
//所有信息参与推送
|
|
|
-// searchData.setSymptom(searchData.getSymptom() + searchData.getVital()
|
|
|
-// + searchData.getLis() + searchData.getPacs() + searchData.getPast() + searchData.getOther() + searchData.getIndications());
|
|
|
- if (StringUtils.isNotEmpty(searchData.getSymptom())) {
|
|
|
- searchData.setSymptom(searchData.getSymptom().trim());
|
|
|
- }
|
|
|
+ // searchData.setSymptom(searchData.getSymptom() + searchData.getVital()
|
|
|
+ // + searchData.getLis() + searchData.getPacs() + searchData.getPast() + searchData.getOther() + searchData.getIndications());
|
|
|
+ searchData.setSymptom(searchData.getSymptom().trim());
|
|
|
//一次推送多个类别信息
|
|
|
String[] featureTypes = searchData.getFeatureType().split(",");
|
|
|
//featureType统一转换
|
|
|
String[] convertFeatureTypes = new String[featureTypes.length];
|
|
|
- for (int i = 0;i<featureTypes.length; i++) {
|
|
|
+ for (int i = 0; i < featureTypes.length; i++) {
|
|
|
convertFeatureTypes[i] = convertFeatureType(searchData.getSysCode(), featureTypes[i]);
|
|
|
}
|
|
|
searchData.setFeatureType(StringUtils.join(convertFeatureTypes, ","));
|
|
@@ -83,45 +81,37 @@ public class ParamsDataProxy {
|
|
|
|
|
|
//获取入参中的特征信息
|
|
|
FeatureAnalyze fa = new FeatureAnalyze();
|
|
|
- List<Map<String, Object>> featuresList = new ArrayList<>();
|
|
|
+
|
|
|
if (!StringUtils.isEmpty(searchData.getSymptom())) {
|
|
|
//提取现病史
|
|
|
- featuresList = fa.start(searchData.getSymptom(), FeatureType.FEATURE);
|
|
|
+ List<Map<String, Object>> featuresList = fa.start(searchData.getSymptom(), FeatureType.FEATURE);
|
|
|
paramFeatureInit(searchData, featuresList);
|
|
|
- }
|
|
|
- if (!StringUtils.isEmpty(searchData.getVital())) {
|
|
|
//提取体征
|
|
|
featuresList = fa.start(searchData.getVital(), FeatureType.FEATURE);
|
|
|
paramFeatureInit(searchData, featuresList);
|
|
|
- }
|
|
|
- if (!StringUtils.isEmpty(searchData.getPast())) {
|
|
|
//提取既往史
|
|
|
featuresList = fa.start(searchData.getPast(), FeatureType.FEATURE);
|
|
|
paramFeatureInit(searchData, featuresList);
|
|
|
- }
|
|
|
- if (!StringUtils.isEmpty(searchData.getOther()) || !StringUtils.isEmpty(searchData.getIndications())) {
|
|
|
//提取其他史等
|
|
|
- featuresList = fa.start(searchData.getOther() == null?"":searchData.getOther() + searchData.getIndications() == null?"":searchData.getIndications(), FeatureType.FEATURE);
|
|
|
+ featuresList = fa.start(searchData.getOther() + searchData.getIndications(), FeatureType.FEATURE);
|
|
|
paramFeatureInit(searchData, featuresList);
|
|
|
- }
|
|
|
- if (!StringUtils.isEmpty(searchData.getPacs())) {
|
|
|
+
|
|
|
featuresList = fa.start(searchData.getPacs(), FeatureType.PACS);
|
|
|
paramFeatureInit(searchData, featuresList);
|
|
|
- }
|
|
|
- if (!StringUtils.isEmpty(searchData.getLis())) {
|
|
|
+
|
|
|
featuresList = fa.start(searchData.getLis(), FeatureType.LIS);
|
|
|
paramFeatureInit(searchData, featuresList);
|
|
|
- }
|
|
|
+
|
|
|
// 清洗特征词,去除词性不匹配的词
|
|
|
searchData = cleanFeature(featuresList, fa, searchData);
|
|
|
- if (!StringUtils.isEmpty(searchData.getOther())) {
|
|
|
+
|
|
|
//如果既往史中诊断信息,需要提取这个特征
|
|
|
featuresList = fa.start(searchData.getOther(), FeatureType.DIAG);
|
|
|
paramFeatureInit(searchData, featuresList);
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(searchData.getDiag()) && StringUtils.isEmpty(searchData.getSymptom())) {
|
|
|
- featuresList = fa.start(searchData.getDiag(), FeatureType.DIAG);
|
|
|
+ List<Map<String, Object>> featuresList = fa.start(searchData.getDiag(), FeatureType.DIAG);
|
|
|
paramFeatureInit(searchData, featuresList);
|
|
|
}
|
|
|
}
|
|
@@ -138,7 +128,7 @@ public class ParamsDataProxy {
|
|
|
//下了诊断且其他信息全为空 反推标识
|
|
|
boolean reverse = !StringUtils.isEmpty(searchData.getDiag()) && StringUtils.isEmpty(searchData.getSymptom());
|
|
|
for (int i = 0; i < featureTypes.length; i++) {
|
|
|
-// featureTypes[i] = convertFeatureType(sysCode, featureTypes[i]);
|
|
|
+ // featureTypes[i] = convertFeatureType(sysCode, featureTypes[i]);
|
|
|
if (featureTypes[i] != null) {
|
|
|
//模型
|
|
|
switch (FeatureType.parse(featureTypes[i])) {
|
|
@@ -326,6 +316,7 @@ public class ParamsDataProxy {
|
|
|
}
|
|
|
}
|
|
|
//将标准词中体征指标值(数字)与分词结果中体征指标值(数字)比较
|
|
|
+ String newStandWord = "";
|
|
|
for (String f : featureType) {
|
|
|
String[] features = f.split("\t");
|
|
|
if (standWords.containsKey(features[0])) {
|
|
@@ -333,25 +324,47 @@ public class ParamsDataProxy {
|
|
|
for (Map<String, String> standWordMap : standWordList) {
|
|
|
if (standWordMap.containsKey("unit") && standWordMap.containsKey("value")) {
|
|
|
if (features.length == 2) {
|
|
|
- judgment(sData, features, standWordMap);
|
|
|
+ newStandWord = judgment(features, standWordMap,newStandWord);
|
|
|
} else {
|
|
|
- if (standWordMap.get("unit").equals(features[2])) {
|
|
|
- judgment(sData, features, standWordMap);
|
|
|
+ if (standWordMap.get("unit").equals(features[2].toLowerCase())) {
|
|
|
+ newStandWord = judgment(features, standWordMap,newStandWord);
|
|
|
}
|
|
|
}
|
|
|
} else if (standWordMap.containsKey("value")) {
|
|
|
if (features.length == 2) {
|
|
|
- judgment(sData, features, standWordMap);
|
|
|
+ newStandWord = judgment(features, standWordMap,newStandWord);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ String addStandWords = "";
|
|
|
+ String smallerStandWord = "";
|
|
|
+ boolean flag = true;
|
|
|
+ for (String standWord:newStandWord.split(",")) {
|
|
|
+ if (!"".equals(standWord) || standWord.length() > 0){
|
|
|
+ if (!standWord.contains("/")){
|
|
|
+ addStandWords += "," +standWord;
|
|
|
+ } else {
|
|
|
+ if (standWord.contains("<") || standWord.contains("<=")|| standWord.contains("小于")){
|
|
|
+ smallerStandWord = "," +standWord;
|
|
|
+ } else {
|
|
|
+ addStandWords += "," +standWord;
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (flag){
|
|
|
+ addStandWords += smallerStandWord;
|
|
|
+ }
|
|
|
+ sData.setSymptom(sData.getSymptom() + "," + addStandWords);
|
|
|
+ System.out.println(sData.getSymptom());
|
|
|
return sData;
|
|
|
}
|
|
|
|
|
|
//将标准词中体征指标值(数字)与分词结果中体征指标值(数字)比较
|
|
|
- private void judgment(SearchData sData, String[] features, Map<String, String> standWordMap) {
|
|
|
+ private String judgment(String[] features, Map<String, String> standWordMap,String standWord) {
|
|
|
if (hasDigit(features[1])) {
|
|
|
try {
|
|
|
if (">".equals(standWordMap.get("op"))) {
|
|
@@ -365,17 +378,14 @@ public class ParamsDataProxy {
|
|
|
String[] values = standWordMap.get("value").split("/");
|
|
|
Integer standWordSBP = Integer.valueOf(values[0]); //标准词收缩压
|
|
|
Integer standWordDBP = Integer.valueOf(values[1]); //标准词舒张压
|
|
|
- if (featuresSBP > standWordSBP && featuresDBP > standWordDBP) {
|
|
|
- sData.setSymptom(sData.getSymptom() + "," + standWordMap.get("standword"));
|
|
|
- System.out.println(sData.getSymptom());
|
|
|
+ if (featuresSBP > standWordSBP || featuresDBP > standWordDBP) {
|
|
|
+ standWord += "," + standWordMap.get("standword");
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
String num = getNum(standWordMap.get("value"));
|
|
|
if (Double.valueOf(getNum(features[1])) > Double.valueOf(num)) {
|
|
|
- sData.setSymptom(sData.getSymptom() + "," + standWordMap.get("standword"));
|
|
|
- System.out.println(sData.getSymptom());
|
|
|
-
|
|
|
+ standWord += "," + standWordMap.get("standword");
|
|
|
}
|
|
|
}
|
|
|
} else if ("<".equals(standWordMap.get("op"))) {
|
|
@@ -389,23 +399,64 @@ public class ParamsDataProxy {
|
|
|
String[] values = standWordMap.get("value").split("/");
|
|
|
Integer standWordSBP = Integer.valueOf(values[0]); //收缩压
|
|
|
Integer standWordDBP = Integer.valueOf(values[1]); //舒张压
|
|
|
- if (featuresSBP < standWordSBP && featuresDBP < standWordDBP) {
|
|
|
- sData.setSymptom(sData.getSymptom() + "," + standWordMap.get("standword"));
|
|
|
- System.out.println(sData.getSymptom());
|
|
|
+ if (featuresSBP < standWordSBP || featuresDBP < standWordDBP) {
|
|
|
+ standWord += "," + standWordMap.get("standword");
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
String num = getNum(standWordMap.get("value"));
|
|
|
if (Double.valueOf(getNum(features[1])) < Double.valueOf(num)) {
|
|
|
- sData.setSymptom(sData.getSymptom() + "," + standWordMap.get("standword"));
|
|
|
- System.out.println(sData.getSymptom());
|
|
|
+ standWord += "," + standWordMap.get("standword");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if (">=".equals(standWordMap.get("op"))) {
|
|
|
+ //单独处理 血压小于90/60mmHg 类似情况
|
|
|
+ if (standWordMap.get("value").contains("/")) {
|
|
|
+ if (features[1].contains("/")) {
|
|
|
+ String[] feature = features[1].split("/");
|
|
|
+ Integer featuresSBP = Integer.valueOf(feature[0]); //收缩压
|
|
|
+ Integer featuresDBP = Integer.valueOf(feature[1]); //舒张压
|
|
|
+
|
|
|
+ String[] values = standWordMap.get("value").split("/");
|
|
|
+ Integer standWordSBP = Integer.valueOf(values[0]); //收缩压
|
|
|
+ Integer standWordDBP = Integer.valueOf(values[1]); //舒张压
|
|
|
+ if (featuresSBP >= standWordSBP || featuresDBP >= standWordDBP) {
|
|
|
+ standWord += "," + standWordMap.get("standword");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ String num = getNum(standWordMap.get("value"));
|
|
|
+ if (Double.valueOf(getNum(features[1])) >= Double.valueOf(num)) {
|
|
|
+ standWord += "," + standWordMap.get("standword");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if ("<=".equals(standWordMap.get("op"))) {
|
|
|
+ //单独处理 血压小于90/60mmHg 类似情况
|
|
|
+ if (standWordMap.get("value").contains("/")) {
|
|
|
+ if (features[1].contains("/")) {
|
|
|
+ String[] feature = features[1].split("/");
|
|
|
+ Integer featuresSBP = Integer.valueOf(feature[0]); //收缩压
|
|
|
+ Integer featuresDBP = Integer.valueOf(feature[1]); //舒张压
|
|
|
+
|
|
|
+ String[] values = standWordMap.get("value").split("/");
|
|
|
+ Integer standWordSBP = Integer.valueOf(values[0]); //收缩压
|
|
|
+ Integer standWordDBP = Integer.valueOf(values[1]); //舒张压
|
|
|
+ if (featuresSBP <= standWordSBP || featuresDBP <= standWordDBP) {
|
|
|
+ standWord += "," + standWordMap.get("standword");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ String num = getNum(standWordMap.get("value"));
|
|
|
+ if (Double.valueOf(getNum(features[1])) <= Double.valueOf(num)) {
|
|
|
+ standWord += "," + standWordMap.get("standword");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }catch (NumberFormatException e){
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
+ return standWord;
|
|
|
}
|
|
|
|
|
|
private boolean hasDigit(String content) {
|
|
@@ -429,20 +480,20 @@ public class ParamsDataProxy {
|
|
|
private SearchData cleanFeature(List<Map<String, Object>> featuresList, FeatureAnalyze fa,
|
|
|
SearchData searchData) {
|
|
|
// 在输入的辅检文本中,只提取辅检信息
|
|
|
- String[] PACS_Feature = {Constants.word_property_PACS,
|
|
|
- Constants.word_property_PACS_Detail, Constants.word_property_PACS_Result};
|
|
|
- searchData = removeFeature(searchData.getLis(), fa, searchData, PACS_Feature, FeatureType.PACS);
|
|
|
+ String[] PACS_Feature = { Constants.word_property_PACS,
|
|
|
+ Constants.word_property_PACS_Detail, Constants.word_property_PACS_Result };
|
|
|
+ searchData = removeFeature(searchData.getLis(), fa, searchData, PACS_Feature, FeatureType.PACS);
|
|
|
|
|
|
// 在输入的化验文本中,只提取化验信息
|
|
|
- String[] LIS_Feature = {Constants.word_property_LIS,
|
|
|
- Constants.word_property_LIS_Detail, Constants.word_property_LIS_Result};
|
|
|
- searchData = removeFeature(searchData.getPacs(), fa, searchData, LIS_Feature, FeatureType.LIS);
|
|
|
+ String[] LIS_Feature = { Constants.word_property_LIS,
|
|
|
+ Constants.word_property_LIS_Detail, Constants.word_property_LIS_Result };
|
|
|
+ searchData = removeFeature(searchData.getPacs(), fa, searchData, LIS_Feature, FeatureType.LIS);
|
|
|
|
|
|
return searchData;
|
|
|
}
|
|
|
|
|
|
private SearchData removeFeature(String text, FeatureAnalyze fa,
|
|
|
- SearchData searchData, String[] properties, FeatureType featureType) {
|
|
|
+ SearchData searchData, String[] properties, FeatureType featureType) {
|
|
|
String name = "";
|
|
|
Boolean related = false;
|
|
|
|
|
@@ -454,17 +505,17 @@ public class ParamsDataProxy {
|
|
|
String[] property = item.get("property").toString().split(",");
|
|
|
for (String prop : property) {
|
|
|
if (Arrays.asList(properties).contains(prop)) {
|
|
|
-// related = true;
|
|
|
+ // related = true;
|
|
|
searchData.getInputs().remove(name);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// if (!related) {
|
|
|
-// searchData.getInputs().remove(name);
|
|
|
-// }
|
|
|
-//9
|
|
|
-// related = false;
|
|
|
+ // if (!related) {
|
|
|
+ // searchData.getInputs().remove(name);
|
|
|
+ // }
|
|
|
+ //9
|
|
|
+ // related = false;
|
|
|
}
|
|
|
}
|
|
|
|