|
@@ -26,6 +26,7 @@ public class PreProcess {
|
|
private static String neg = "阴性";
|
|
private static String neg = "阴性";
|
|
|
|
|
|
private List<Map<String, Object>> vitlist = new ArrayList<>();
|
|
private List<Map<String, Object>> vitlist = new ArrayList<>();
|
|
|
|
+ private List<Map<String, Object>> pacslist = new ArrayList<>();
|
|
private String[] vitkeyset = {"index", "value", "unit"};
|
|
private String[] vitkeyset = {"index", "value", "unit"};
|
|
private String[] bptype = {"血压","收缩压","舒张压","/"};
|
|
private String[] bptype = {"血压","收缩压","舒张压","/"};
|
|
|
|
|
|
@@ -56,8 +57,13 @@ public class PreProcess {
|
|
try {
|
|
try {
|
|
Map<String, List<Rule>> rule = ApplicationCacheUtil.get_rule_filter_map();
|
|
Map<String, List<Rule>> rule = ApplicationCacheUtil.get_rule_filter_map();
|
|
|
|
|
|
|
|
+ // 用规则处理化验结果
|
|
reminder = applytolis(sData.getLisArr(), rule);
|
|
reminder = applytolis(sData.getLisArr(), rule);
|
|
|
|
|
|
|
|
+ // 用规则处理辅检结果
|
|
|
|
+ reminder.addAll(applytopacs(sData.getPacs(), rule));
|
|
|
|
+
|
|
|
|
+ // 用规则处理体征结果
|
|
reminder.addAll(applytovital(sData.getVital(), rule));
|
|
reminder.addAll(applytovital(sData.getVital(), rule));
|
|
|
|
|
|
ruleResponse.setMedicalIndications(reminder);
|
|
ruleResponse.setMedicalIndications(reminder);
|
|
@@ -92,6 +98,49 @@ public class PreProcess {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private List<MedicalIndication> applytopacs(String pacs, Map<String, List<Rule>> rule) {
|
|
|
|
+ List<MedicalIndication> reminder = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ Set<String> pacsResultList = new HashSet<>();
|
|
|
|
+ Lexeme lexeme;
|
|
|
|
+ LexemePath<Lexeme> lexemes = ParticipleUtil.participle(pacs);
|
|
|
|
+ for (int i = 0; i < lexemes.size(); i++) {
|
|
|
|
+ lexeme = lexemes.get(i);
|
|
|
|
+ List<String> propetys = Arrays.asList(lexeme.getProperty().split(","));
|
|
|
|
+ if (lexeme.getText().trim().length() > 0) {
|
|
|
|
+ if(propetys.contains(Constants.word_property_PACS_Result)){
|
|
|
|
+ pacsResultList.add(lexeme.getText());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(pacsResultList.size()>0){
|
|
|
|
+ for (String pacsResult:pacsResultList) {
|
|
|
|
+ if(rule.containsKey(pacsResult)){
|
|
|
|
+ List<Rule> rules = rule.get(pacsResult);
|
|
|
|
+
|
|
|
|
+ List<MedicalIndicationDetail> mds = new ArrayList<>();
|
|
|
|
+ MedicalIndicationDetail medicalIndicationDetail = new MedicalIndicationDetail();
|
|
|
|
+ medicalIndicationDetail.setType(4);
|
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
|
+ jsonObject.put("controlType",2);
|
|
|
|
+ jsonObject.put("name",rules.get(0).getIdx_name()+":"+rules.get(0).getRemind());
|
|
|
|
+ medicalIndicationDetail.setContent(jsonObject);
|
|
|
|
+ mds.add(medicalIndicationDetail);
|
|
|
|
+ MedicalIndication medicalIndication = new MedicalIndication();
|
|
|
|
+ medicalIndication.setName(pacsResult);
|
|
|
|
+ medicalIndication.setDetails(mds);
|
|
|
|
+ reminder.add(medicalIndication);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ ex.printStackTrace();
|
|
|
|
+ } finally {
|
|
|
|
+ return reminder;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
private List<MedicalIndication> applytovital(String vital, Map<String, List<Rule>> rule) {
|
|
private List<MedicalIndication> applytovital(String vital, Map<String, List<Rule>> rule) {
|
|
|
|
|
|
List<MedicalIndication> reminder = new ArrayList<>();
|
|
List<MedicalIndication> reminder = new ArrayList<>();
|
|
@@ -194,10 +243,11 @@ public class PreProcess {
|
|
try {
|
|
try {
|
|
if (null == numval && otherval.trim().length() > 0) {
|
|
if (null == numval && otherval.trim().length() > 0) {
|
|
for (Rule rule : rules) {
|
|
for (Rule rule : rules) {
|
|
- if (rule.getMin_operator().equals("=") && otherval.contains(rule.getMin_value())) {
|
|
|
|
|
|
+ if (rule.getEq_operator().equals("=") && otherval.contains(rule.getEq_value())) {
|
|
StringBuffer rulesContent = new StringBuffer();
|
|
StringBuffer rulesContent = new StringBuffer();
|
|
StringBuffer append = rulesContent.append(rule.getIdx_name()).append(rule.getMin_operator()).append(rule.getMin_value()).append(rule.getMin_unit())
|
|
StringBuffer append = rulesContent.append(rule.getIdx_name()).append(rule.getMin_operator()).append(rule.getMin_value()).append(rule.getMin_unit())
|
|
- .append(rule.getMax_operator()).append(rule.getMax_value()).append(rule.getMax_unit());
|
|
|
|
|
|
+ .append(rule.getMax_operator()).append(rule.getMax_value()).append(rule.getMax_unit())
|
|
|
|
+ .append(rule.getEq_operator()).append(rule.getEq_value()).append(rule.getEq_unit());
|
|
MedicalIndication medind = new MedicalIndication();
|
|
MedicalIndication medind = new MedicalIndication();
|
|
List<MedicalIndicationDetail> k = new ArrayList<>();
|
|
List<MedicalIndicationDetail> k = new ArrayList<>();
|
|
MedicalIndicationDetail mid = new MedicalIndicationDetail();
|
|
MedicalIndicationDetail mid = new MedicalIndicationDetail();
|
|
@@ -210,6 +260,7 @@ public class PreProcess {
|
|
k.add(mid);
|
|
k.add(mid);
|
|
medind.setName(rule.getRemind());
|
|
medind.setName(rule.getRemind());
|
|
medind.setDetails(k);
|
|
medind.setDetails(k);
|
|
|
|
+ medind.setRule(append.toString());
|
|
reminder.add(medind);
|
|
reminder.add(medind);
|
|
|
|
|
|
System.out.println(medind.getRule() + " -> " + medind.getName());
|
|
System.out.println(medind.getRule() + " -> " + medind.getName());
|
|
@@ -225,26 +276,34 @@ public class PreProcess {
|
|
minop = rule.getMin_operator();
|
|
minop = rule.getMin_operator();
|
|
maxop = rule.getMax_operator();
|
|
maxop = rule.getMax_operator();
|
|
|
|
|
|
- if ( String.valueOf(minval).trim().length() > 0 && minunit.equals(unit) ) {
|
|
|
|
- switch (minop) {
|
|
|
|
- case ">":
|
|
|
|
- if (numval > minval) { minmatch = true; }
|
|
|
|
- break;
|
|
|
|
- case ">=":
|
|
|
|
- if (numval >= minval) { minmatch = true; }
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
|
|
+ if ( String.valueOf(minval).trim().length() > 0) {
|
|
|
|
+ if (minunit.equals(unit) ) {
|
|
|
|
+ switch (minop) {
|
|
|
|
+ case ">":
|
|
|
|
+ if (numval > minval) { minmatch = true; }
|
|
|
|
+ break;
|
|
|
|
+ case ">=":
|
|
|
|
+ if (numval >= minval) { minmatch = true; }
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ } else { minmatch = false; }
|
|
} else { minmatch = false; }
|
|
} else { minmatch = false; }
|
|
|
|
|
|
- if (String.valueOf(maxval).trim().length() > 0 && maxunit.equals(unit) ) {
|
|
|
|
- switch (maxop) {
|
|
|
|
- case "<":
|
|
|
|
- if (numval < maxval) { maxmatch = true; }
|
|
|
|
- break;
|
|
|
|
- case "<=":
|
|
|
|
- if (numval <= maxval) { maxmatch = true; }
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
|
|
+ if (String.valueOf(maxval).trim().length() > 0 ) {
|
|
|
|
+ if (maxunit.equals(unit) ) {
|
|
|
|
+ switch (maxop) {
|
|
|
|
+ case "<":
|
|
|
|
+ if (numval < maxval) {
|
|
|
|
+ maxmatch = true;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case "<=":
|
|
|
|
+ if (numval <= maxval) {
|
|
|
|
+ maxmatch = true;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ } else { maxmatch = false; }
|
|
} else { maxmatch = false; }
|
|
} else { maxmatch = false; }
|
|
|
|
|
|
if (minmatch || maxmatch) {
|
|
if (minmatch || maxmatch) {
|
|
@@ -264,6 +323,7 @@ public class PreProcess {
|
|
k.add(mid);
|
|
k.add(mid);
|
|
medind.setName(rule.getRemind());
|
|
medind.setName(rule.getRemind());
|
|
medind.setDetails(k);
|
|
medind.setDetails(k);
|
|
|
|
+ medind.setRule(append.toString());
|
|
reminder.add(medind);
|
|
reminder.add(medind);
|
|
|
|
|
|
System.out.println(medind.getRule() + " -> " + medind.getName());
|
|
System.out.println(medind.getRule() + " -> " + medind.getName());
|