Browse Source

规则做统一过滤

louhr 5 years ago
parent
commit
a25d8cd57f

+ 1 - 1
bigdata-web/src/main/java/org/diagbot/bigdata/common/ApplicationCacheUtil.java

@@ -236,7 +236,7 @@ public class ApplicationCacheUtil {
         for (String line:fileContents) {
         for (String line:fileContents) {
             String[] content = line.split("\\|");
             String[] content = line.split("\\|");
             Rule rule = new Rule();
             Rule rule = new Rule();
-            if (content.length == 10) {
+            if (content.length == 14) {
                 rule.setIdx_name(content[0]);
                 rule.setIdx_name(content[0]);
                 rule.setSet_name(content[1]);
                 rule.setSet_name(content[1]);
                 rule.setSet_status(content[2]);
                 rule.setSet_status(content[2]);

+ 0 - 3
bigdata-web/src/main/java/org/diagbot/bigdata/work/AlgorithmCore.java

@@ -26,9 +26,6 @@ import java.util.*;
 public class AlgorithmCore {
 public class AlgorithmCore {
     Logger logger = LoggerFactory.getLogger(AlgorithmCore.class);
     Logger logger = LoggerFactory.getLogger(AlgorithmCore.class);
     public ResponseData algorithm(HttpServletRequest request, SearchData searchData, ResponseData responseData) throws Exception {
     public ResponseData algorithm(HttpServletRequest request, SearchData searchData, ResponseData responseData) throws Exception {
-        if (responseData == null) {
-            responseData = new ResponseData();
-        }
         //录入文本处理,包括提取特征、推送类型转换等
         //录入文本处理,包括提取特征、推送类型转换等
         ParamsDataProxy paramsDataProxy = new ParamsDataProxy();
         ParamsDataProxy paramsDataProxy = new ParamsDataProxy();
         logger.info("页面文本信息:" + searchData.getSymptom());
         logger.info("页面文本信息:" + searchData.getSymptom());

+ 12 - 12
bigdata-web/src/main/java/org/diagbot/bigdata/work/ParamsDataProxy.java

@@ -77,18 +77,18 @@ public class ParamsDataProxy {
         if (StringUtils.isEmpty(searchData.getResourceType())) {
         if (StringUtils.isEmpty(searchData.getResourceType())) {
             searchData.setResourceType(BigDataConstants.resource_type_o);
             searchData.setResourceType(BigDataConstants.resource_type_o);
         }
         }
-        //给症状末尾添加诊断依据标准词
-        String[] items = { searchData.getSymptom(), searchData.getOther(), searchData.getVital()
-                , searchData.getLis(), searchData.getPacs(), searchData.getDiag() };
-        String[] itemsType = { "symptom", "other", "vital", "lis", "pacs", "diag" };
-        for (int i = 0; i < items.length; i++) {
-            if (items[i] != null) {
-                LexemePath<Lexeme> featureData = ParticipleUtil.participle(items[i]);
-                if (featureData != null) {
-                    addStandWord(featureData, ApplicationCacheUtil.getKl_result_mapping_standword_map(), searchData, itemsType[i]);
-                }
-            }
-        }
+//        //给症状末尾添加诊断依据标准词
+//        String[] items = { searchData.getSymptom(), searchData.getOther(), searchData.getVital()
+//                , searchData.getLis(), searchData.getPacs(), searchData.getDiag() };
+//        String[] itemsType = { "symptom", "other", "vital", "lis", "pacs", "diag" };
+//        for (int i = 0; i < items.length; i++) {
+//            if (items[i] != null) {
+//                LexemePath<Lexeme> featureData = ParticipleUtil.participle(items[i]);
+//                if (featureData != null) {
+//                    addStandWord(featureData, ApplicationCacheUtil.getKl_result_mapping_standword_map(), searchData, itemsType[i]);
+//                }
+//            }
+//        }
         //所有信息参与推送
         //所有信息参与推送
         //        searchData.setSymptom(searchData.getSymptom() + searchData.getVital()
         //        searchData.setSymptom(searchData.getSymptom() + searchData.getVital()
         //                + searchData.getLis() + searchData.getPacs() + searchData.getPast() + searchData.getOther() + searchData.getIndications());
         //                + searchData.getLis() + searchData.getPacs() + searchData.getPast() + searchData.getOther() + searchData.getIndications());

+ 4 - 4
bigdata-web/src/main/java/org/diagbot/bigdata/work/PretreatmentFilter.java

@@ -98,10 +98,10 @@ public class PretreatmentFilter {
         if (compareEqual(result.getValue(), rule.getSet_value())) {
         if (compareEqual(result.getValue(), rule.getSet_value())) {
             content = content + rule.getSet_concept_text();
             content = content + rule.getSet_concept_text();
         }
         }
-        if (compareMin(rule.getMin_value(), result.getValue())) {
+        if (compareMin(result.getValue(), rule.getMin_value())) {
             content = content + rule.getMin_concept_text();
             content = content + rule.getMin_concept_text();
         }
         }
-        if (compareMax(rule.getMax_value(), result.getValue())) {
+        if (compareMax(result.getValue(), rule.getMax_value())) {
             content = content + rule.getMax_concept_text();
             content = content + rule.getMax_concept_text();
         }
         }
         return content;
         return content;
@@ -116,12 +116,12 @@ public class PretreatmentFilter {
             crisisDetail.setRemindText(rule.getSetRemind());
             crisisDetail.setRemindText(rule.getSetRemind());
             crisis = true;
             crisis = true;
         }
         }
-        if (compareMin(rule.getMin_value(), result.getValue())) {
+        if (compareMin(result.getValue(), rule.getMin_value())) {
             crisisDetail.setStandardText(result.getDetailName() + " <= " + rule.getMin_value() + rule.getUnit());
             crisisDetail.setStandardText(result.getDetailName() + " <= " + rule.getMin_value() + rule.getUnit());
             crisisDetail.setRemindText(rule.getMinRemind());
             crisisDetail.setRemindText(rule.getMinRemind());
             crisis = true;
             crisis = true;
         }
         }
-        if (compareMax(rule.getMax_value(), result.getValue())) {
+        if (compareMax(result.getValue(), rule.getMax_value())) {
             crisisDetail.setStandardText(result.getDetailName() + " >= " + rule.getMax_value() + rule.getUnit());
             crisisDetail.setStandardText(result.getDetailName() + " >= " + rule.getMax_value() + rule.getUnit());
             crisisDetail.setRemindText(rule.getMaxRemind());
             crisisDetail.setRemindText(rule.getMaxRemind());
             crisis = true;
             crisis = true;

+ 1 - 1
common-push/src/main/java/org/diagbot/common/push/cache/CacheFileManager.java

@@ -332,7 +332,7 @@ public class CacheFileManager {
 
 
             //规则过滤信息
             //规则过滤信息
             sql = "SELECT idx_name, set_name, set_status, min_value, min_concept_text, max_value, max_concept_text, set_value, " +
             sql = "SELECT idx_name, set_name, set_status, min_value, min_concept_text, max_value, max_concept_text, set_value, " +
-                    " , set_concept_text, unit, type_value, min_remind, max_remind, set_remind FROM kl_rule_new ";
+                    "set_concept_text, unit, type_value, min_remind, max_remind, set_remind FROM kl_rule_new ";
             st = conn.createStatement();
             st = conn.createStatement();
             rs = st.executeQuery(sql);
             rs = st.executeQuery(sql);
             fw = new FileWriter(path + "bigdata_rule_filter.dict");
             fw = new FileWriter(path + "bigdata_rule_filter.dict");

+ 4 - 8
push-web/src/main/java/org/diagbot/push/controller/AlgorithmController.java

@@ -122,19 +122,15 @@ public class AlgorithmController extends BaseController {
     }
     }
 
 
     public Response<ResponseData> combine(HttpServletRequest request, SearchData searchData) throws Exception {
     public Response<ResponseData> combine(HttpServletRequest request, SearchData searchData) throws Exception {
-
+        ResponseData responseData = new ResponseData();
+        //数据预处理
         PretreatmentFilter pretreatmentFilter = new PretreatmentFilter();
         PretreatmentFilter pretreatmentFilter = new PretreatmentFilter();
-        pretreatmentFilter.crisisFilter(searchData, new ResponseData());
-
-        logger.info("开始规则转换......");
-        PreProcess prepro = new PreProcess();
-        searchData = prepro.processClinicalData(searchData);
-        ResponseData RuleResponseData = prepro.applyrules(searchData);
+        pretreatmentFilter.crisisFilter(searchData, responseData);
 
 
         logger.info("开始推送服务......");
         logger.info("开始推送服务......");
         Response<ResponseData> response = new Response();
         Response<ResponseData> response = new Response();
         AlgorithmCore core = new AlgorithmCore();
         AlgorithmCore core = new AlgorithmCore();
-        ResponseData bigDataResponseData = core.algorithm(request, searchData, RuleResponseData);
+        ResponseData bigDataResponseData = core.algorithm(request, searchData, responseData);
 
 
         GraphCalculate graphCalculate = new GraphCalculate();
         GraphCalculate graphCalculate = new GraphCalculate();
         ResponseData graphResponseData = graphCalculate.calculate(request, searchData);
         ResponseData graphResponseData = graphCalculate.calculate(request, searchData);

+ 1 - 1
push-web/src/main/java/org/diagbot/push/controller/CacheFileManagerController.java

@@ -43,7 +43,7 @@ public class CacheFileManagerController extends BaseController {
         ApplicationCacheUtil.createDoc_result_mapping_diag_map();
         ApplicationCacheUtil.createDoc_result_mapping_diag_map();
         ApplicationCacheUtil.createDoc_result_mapping_filter_map();
         ApplicationCacheUtil.createDoc_result_mapping_filter_map();
         ApplicationCacheUtil.createKl_result_mapping_standword_map();
         ApplicationCacheUtil.createKl_result_mapping_standword_map();
-        ApplicationCacheUtil.create_rule_filter_map();
+        ApplicationCacheUtil.create_kl_rule_filter_map();
         return response;
         return response;
     }
     }
 }
 }

+ 264 - 264
push-web/src/main/java/org/diagbot/push/convert/PreProcess.java

@@ -38,12 +38,12 @@ public class PreProcess {
     public SearchData processClinicalData(SearchData searchdata) {
     public SearchData processClinicalData(SearchData searchdata) {
         SearchData sData = searchdata;
         SearchData sData = searchdata;
 
 
-        sData.setLisArr(processLis(sData.getLisArr()));
-
-        if (sData.getLisArr().size() > 0) {
-            List<String> otherVal = sData.getLisArr().stream().map(lisArr -> lisArr.getOtherValue()).collect(Collectors.toList());
-            sData.setLis(String.join(",", otherVal));
-        }
+//        sData.setLisArr(processLis(sData.getLisArr()));
+//
+//        if (sData.getLisArr().size() > 0) {
+//            List<String> otherVal = sData.getLisArr().stream().map(lisArr -> lisArr.getOtherValue()).collect(Collectors.toList());
+//            sData.setLis(String.join(",", otherVal));
+//        }
 
 
         return sData;
         return sData;
     }
     }
@@ -51,265 +51,265 @@ public class PreProcess {
     public ResponseData applyrules(SearchData sData) {
     public ResponseData applyrules(SearchData sData) {
 
 
         ResponseData ruleResponse = new ResponseData();
         ResponseData ruleResponse = new ResponseData();
-
-        List<MedicalIndication> reminder;
-        try {
-            Map<String, List<Rule>> rule = ApplicationCacheUtil.get_rule_filter_map();
-
-            reminder = applytolis(sData.getLisArr(), rule);
-
-            reminder.addAll(applytovital(sData.getVital(), rule));
-
-            ruleResponse.setMedicalIndications(reminder);
-
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        } finally {
+//
+//        List<MedicalIndication> reminder;
+//        try {
+//            Map<String, List<Rule>> rule = ApplicationCacheUtil.get_rule_filter_map();
+//
+//            reminder = applytolis(sData.getLisArr(), rule);
+//
+//            reminder.addAll(applytovital(sData.getVital(), rule));
+//
+//            ruleResponse.setMedicalIndications(reminder);
+//
+//        } catch (Exception ex) {
+//            ex.printStackTrace();
+//        } finally {
             return ruleResponse;
             return ruleResponse;
-        }
-    }
-
-    private List<MedicalIndication> applytolis(List<LisDetail> lisarr, Map<String, List<Rule>> rule) {
-
-        List<MedicalIndication> reminder = new ArrayList<>();
-        try {
-            String name;
-            String detail;
-
-            for (LisDetail lis : lisarr) {
-                detail = lis.getDetailName();
-//                name = lis.getName();
-                String key = detail;
-                if (rule.get(key) != null) {
-                    reminder.addAll(comparelis(rule.get(key), lis));
-                }
-            }
-
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        } finally {
-            return reminder;
-        }
+//        }
     }
     }
 
 
-    private List<MedicalIndication> applytovital(String vital, Map<String, List<Rule>> rule) {
-
-        List<MedicalIndication> reminder = new ArrayList<>();
-
-        try {
-            Map<String, Object> vitobj = new HashMap<>();
-            Lexeme lexeme;
-            LexemePath<Lexeme> lexemes = ParticipleUtil.participle(vital);
-            for (int i=0; i<lexemes.size(); i++) {
-                lexeme = lexemes.get(i);
-                if (lexeme.getText().trim().length() > 0) {
-                    if (lexeme.getProperty().equals(Constants.word_property_vital_idx)) {
-                        vitobj = new HashMap<>();
-                        vitobj.put(vitkeyset[0], lexeme.getText());
-                    } else if (lexeme.getProperty().equals(Constants.word_property_number) &&
-                            vitobj.get(vitkeyset[0]) != null) {
-                        vitobj.put(vitkeyset[1], lexeme.getText());
-                    } else if (lexeme.getProperty().equals(Constants.word_property_unit) &&
-                            vitobj.get(vitkeyset[1]) != null) {
-                        vitobj.put(vitkeyset[2], lexeme.getText());
-
-                        if (vitobj.get(vitkeyset[0]).toString().equals(bptype[0]) &&
-                                vitobj.get(vitkeyset[1]).toString().contains(bptype[3])) {
-                            String[] idx = Arrays.asList(bptype).subList(1,3).toArray(new String[2]);
-                            String[] vals = vitobj.get(vitkeyset[1]).toString().split(bptype[3]);
-                            String unit = vitobj.get(vitkeyset[2]).toString();
-
-                            if (idx.length == vals.length) {
-                                for (int j=0; j<idx.length; j++) {
-                                    vitobj = new HashMap<>();
-                                    vitobj.put(vitkeyset[0], idx[j]);
-                                    vitobj.put(vitkeyset[1], vals[j]);
-                                    vitobj.put(vitkeyset[2], unit);
-                                    vitlist.add(vitobj);
-                                }
-                            }
-                        } else {
-                            vitlist.add(vitobj);
-                        }
-                    }
-                }
-//                System.out.println(lexeme.getText() + ": " + lexeme.getProperty());
-            }
-
-            for (Map<String, Object> obj : vitlist) {
-                String idx = obj.get(vitkeyset[0]).toString();
-                if (rule.get(idx) != null) {
-                    reminder.addAll(comparevit(rule.get(idx), obj));
-                }
-            }
-            System.out.println("\n");
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        } finally {
-            return reminder;
-        }
-    }
-
-
-    private List<MedicalIndication> comparelis(List<Rule> rules, LisDetail lis) {
-        List<MedicalIndication> reminder = new ArrayList<>();
-
-        try {
-            String detailname = lis.getDetailName();
-            Double numval = lis.getValue();
-            String unit = lis.getUnits();
-            String otherval = lis.getOtherValue();
-
-            reminder = compare(rules, reminder, detailname, numval, unit, otherval);
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        } finally {
-            return reminder;
-        }
-    }
-
-    private List<MedicalIndication> comparevit(List<Rule> rules, Map<String, Object> vit) {
-        List<MedicalIndication> reminder = new ArrayList<>();
-
-        try {
-            String detailname = vit.get(vitkeyset[0]).toString();
-            Double numval = Double.valueOf(vit.get(vitkeyset[1]).toString());
-            String unit = vit.get(vitkeyset[2]).toString();
-            String otherval = "";
-
-            reminder = compare(rules, reminder, detailname, numval, unit, otherval);
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        } finally {
-            return reminder;
-        }
-    }
-
-    private List<MedicalIndication> compare(List<Rule> rules, List<MedicalIndication> reminder,
-                                            String detailname, Double numval, String unit, String otherval) {
-        boolean minmatch, maxmatch;
-        Double minval, maxval;
-        String minop, maxop, minunit, maxunit;
-
-        try {
-            if (null == numval && otherval.trim().length() > 0) {
-                for (Rule rule : rules) {
-                    if (rule.getMin_operator().equals("=") && otherval.contains(rule.getMin_value())) {
-                        StringBuffer rulesContent = new StringBuffer();
-                        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());
-                        MedicalIndication medind = new MedicalIndication();
-                        List<MedicalIndicationDetail> k = new ArrayList<>();
-                        MedicalIndicationDetail mid = new MedicalIndicationDetail();
-                        JSONObject jsonObject = new JSONObject();
-//                        jsonObject.put("name",detailname + ": " + otherval+ ", " +rule.getRemind());
-                        jsonObject.put("name",append.toString());
-                        jsonObject.put("controlType",2);
-                        mid.setType(4);
-                        mid.setContent(jsonObject);
-                        k.add(mid);
-                        medind.setName(rule.getRemind());
-                        medind.setDetails(k);
-                        reminder.add(medind);
-
-                        System.out.println(medind.getRule() + " -> " + medind.getName());
-                    }
-                }
-            } else if (String.valueOf(numval).trim().length() > 0 && unit.length() > 0){
-                for (Rule rule : rules) {
-                    minmatch = maxmatch = false;
-                    minval = (rule.getMin_value().length()==0)?0:Double.valueOf(rule.getMin_value());
-                    maxval = (rule.getMax_value().length()==0)?0:Double.valueOf(rule.getMax_value());
-                    minunit = rule.getMin_unit();
-                    maxunit = rule.getMax_unit();
-                    minop = rule.getMin_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;
-                        }
-                    } else { minmatch = true; }
-
-                    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;
-                        }
-                    } else { maxmatch = true; }
-
-                    if (minmatch && maxmatch) {
-                        StringBuffer rulesContent = new StringBuffer();
-                        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());
-
-                        MedicalIndication medind = new MedicalIndication();
-                        List<MedicalIndicationDetail> k = new ArrayList<>();
-                        MedicalIndicationDetail mid = new MedicalIndicationDetail();
-                        JSONObject jsonObject = new JSONObject();
-//                        jsonObject.put("name",detailname + ": " + numval + " " + unit+ "," +rule.getRemind());
-                        jsonObject.put("name", append.toString());
-                        jsonObject.put("controlType",2);
-                        mid.setType(4);
-                        mid.setContent(jsonObject);
-                        k.add(mid);
-                        medind.setName(rule.getRemind());
-                        medind.setDetails(k);
-                        reminder.add(medind);
-
-                        System.out.println(medind.getRule() + " -> " + medind.getName());
-                    }
-                }
-            }
-
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        } finally {
-            return reminder;
-        }
-    }
-
-    private List<LisDetail> processLis(List<LisDetail> lisArr) {
-        if (lisArr == null) {
-            return new ArrayList<>();
-        }
-        if (lisArr.size() == 0) {
-            return lisArr;
-        }
-
-        String Otherval = "";
-
-        for (int i = 0; i < lisArr.size(); i++) {
-            LisDetail lisres = lisArr.get(i);
-
-//            Otherval = (lisres.getOtherValue().trim().length() > 0) ? lisres.getOtherValue().trim() + "\n" : "";
-            Otherval = lisres.getOtherValue();
-
-            if (Otherval.indexOf(pos) >= 0 || Otherval.indexOf(neg) >= 0) {
-                lisres.setOtherValue(lisres.getDetailName() + Otherval);
-            } else {
-                Otherval = (Otherval.trim().length() > 0) ? Otherval.trim() + "\n" : "";
-                if (lisres.getValue() == null) {
-                    continue;
-                } else if (lisres.getMaxValue() != null && lisres.getValue() > lisres.getMaxValue()) {
-                    lisres.setOtherValue(Otherval + lisres.getDetailName() + up);
-                } else if (lisres.getMinValue() != null && lisres.getValue() < lisres.getMinValue()) {
-                    lisres.setOtherValue(Otherval + lisres.getDetailName() + down);
-                } else {
-                    lisres.setOtherValue(Otherval + lisres.getDetailName() + normal);
-                }
-            }
-        }
-
-        return lisArr;
-    }
+//    private List<MedicalIndication> applytolis(List<LisDetail> lisarr, Map<String, List<Rule>> rule) {
+//
+//        List<MedicalIndication> reminder = new ArrayList<>();
+//        try {
+//            String name;
+//            String detail;
+//
+//            for (LisDetail lis : lisarr) {
+//                detail = lis.getDetailName();
+////                name = lis.getName();
+//                String key = detail;
+//                if (rule.get(key) != null) {
+//                    reminder.addAll(comparelis(rule.get(key), lis));
+//                }
+//            }
+//
+//        } catch (Exception ex) {
+//            ex.printStackTrace();
+//        } finally {
+//            return reminder;
+//        }
+//    }
+//
+//    private List<MedicalIndication> applytovital(String vital, Map<String, List<Rule>> rule) {
+//
+//        List<MedicalIndication> reminder = new ArrayList<>();
+//
+//        try {
+//            Map<String, Object> vitobj = new HashMap<>();
+//            Lexeme lexeme;
+//            LexemePath<Lexeme> lexemes = ParticipleUtil.participle(vital);
+//            for (int i=0; i<lexemes.size(); i++) {
+//                lexeme = lexemes.get(i);
+//                if (lexeme.getText().trim().length() > 0) {
+//                    if (lexeme.getProperty().equals(Constants.word_property_vital_idx)) {
+//                        vitobj = new HashMap<>();
+//                        vitobj.put(vitkeyset[0], lexeme.getText());
+//                    } else if (lexeme.getProperty().equals(Constants.word_property_number) &&
+//                            vitobj.get(vitkeyset[0]) != null) {
+//                        vitobj.put(vitkeyset[1], lexeme.getText());
+//                    } else if (lexeme.getProperty().equals(Constants.word_property_unit) &&
+//                            vitobj.get(vitkeyset[1]) != null) {
+//                        vitobj.put(vitkeyset[2], lexeme.getText());
+//
+//                        if (vitobj.get(vitkeyset[0]).toString().equals(bptype[0]) &&
+//                                vitobj.get(vitkeyset[1]).toString().contains(bptype[3])) {
+//                            String[] idx = Arrays.asList(bptype).subList(1,3).toArray(new String[2]);
+//                            String[] vals = vitobj.get(vitkeyset[1]).toString().split(bptype[3]);
+//                            String unit = vitobj.get(vitkeyset[2]).toString();
+//
+//                            if (idx.length == vals.length) {
+//                                for (int j=0; j<idx.length; j++) {
+//                                    vitobj = new HashMap<>();
+//                                    vitobj.put(vitkeyset[0], idx[j]);
+//                                    vitobj.put(vitkeyset[1], vals[j]);
+//                                    vitobj.put(vitkeyset[2], unit);
+//                                    vitlist.add(vitobj);
+//                                }
+//                            }
+//                        } else {
+//                            vitlist.add(vitobj);
+//                        }
+//                    }
+//                }
+////                System.out.println(lexeme.getText() + ": " + lexeme.getProperty());
+//            }
+//
+//            for (Map<String, Object> obj : vitlist) {
+//                String idx = obj.get(vitkeyset[0]).toString();
+//                if (rule.get(idx) != null) {
+//                    reminder.addAll(comparevit(rule.get(idx), obj));
+//                }
+//            }
+//            System.out.println("\n");
+//        } catch (Exception ex) {
+//            ex.printStackTrace();
+//        } finally {
+//            return reminder;
+//        }
+//    }
+//
+//
+//    private List<MedicalIndication> comparelis(List<Rule> rules, LisDetail lis) {
+//        List<MedicalIndication> reminder = new ArrayList<>();
+//
+//        try {
+//            String detailname = lis.getDetailName();
+//            Double numval = lis.getValue();
+//            String unit = lis.getUnits();
+//            String otherval = lis.getOtherValue();
+//
+//            reminder = compare(rules, reminder, detailname, numval, unit, otherval);
+//        } catch (Exception ex) {
+//            ex.printStackTrace();
+//        } finally {
+//            return reminder;
+//        }
+//    }
+//
+//    private List<MedicalIndication> comparevit(List<Rule> rules, Map<String, Object> vit) {
+//        List<MedicalIndication> reminder = new ArrayList<>();
+//
+//        try {
+//            String detailname = vit.get(vitkeyset[0]).toString();
+//            Double numval = Double.valueOf(vit.get(vitkeyset[1]).toString());
+//            String unit = vit.get(vitkeyset[2]).toString();
+//            String otherval = "";
+//
+//            reminder = compare(rules, reminder, detailname, numval, unit, otherval);
+//        } catch (Exception ex) {
+//            ex.printStackTrace();
+//        } finally {
+//            return reminder;
+//        }
+//    }
+//
+//    private List<MedicalIndication> compare(List<Rule> rules, List<MedicalIndication> reminder,
+//                                            String detailname, Double numval, String unit, String otherval) {
+//        boolean minmatch, maxmatch;
+//        Double minval, maxval;
+//        String minop, maxop, minunit, maxunit;
+//
+//        try {
+//            if (null == numval && otherval.trim().length() > 0) {
+//                for (Rule rule : rules) {
+//                    if (rule.getMin_operator().equals("=") && otherval.contains(rule.getMin_value())) {
+//                        StringBuffer rulesContent = new StringBuffer();
+//                        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());
+//                        MedicalIndication medind = new MedicalIndication();
+//                        List<MedicalIndicationDetail> k = new ArrayList<>();
+//                        MedicalIndicationDetail mid = new MedicalIndicationDetail();
+//                        JSONObject jsonObject = new JSONObject();
+////                        jsonObject.put("name",detailname + ": " + otherval+ ", " +rule.getRemind());
+//                        jsonObject.put("name",append.toString());
+//                        jsonObject.put("controlType",2);
+//                        mid.setType(4);
+//                        mid.setContent(jsonObject);
+//                        k.add(mid);
+//                        medind.setName(rule.getRemind());
+//                        medind.setDetails(k);
+//                        reminder.add(medind);
+//
+//                        System.out.println(medind.getRule() + " -> " + medind.getName());
+//                    }
+//                }
+//            } else if (String.valueOf(numval).trim().length() > 0 && unit.length() > 0){
+//                for (Rule rule : rules) {
+//                    minmatch = maxmatch = false;
+//                    minval = (rule.getMin_value().length()==0)?0:Double.valueOf(rule.getMin_value());
+//                    maxval = (rule.getMax_value().length()==0)?0:Double.valueOf(rule.getMax_value());
+//                    minunit = rule.getMin_unit();
+//                    maxunit = rule.getMax_unit();
+//                    minop = rule.getMin_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;
+//                        }
+//                    } else { minmatch = true; }
+//
+//                    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;
+//                        }
+//                    } else { maxmatch = true; }
+//
+//                    if (minmatch && maxmatch) {
+//                        StringBuffer rulesContent = new StringBuffer();
+//                        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());
+//
+//                        MedicalIndication medind = new MedicalIndication();
+//                        List<MedicalIndicationDetail> k = new ArrayList<>();
+//                        MedicalIndicationDetail mid = new MedicalIndicationDetail();
+//                        JSONObject jsonObject = new JSONObject();
+////                        jsonObject.put("name",detailname + ": " + numval + " " + unit+ "," +rule.getRemind());
+//                        jsonObject.put("name", append.toString());
+//                        jsonObject.put("controlType",2);
+//                        mid.setType(4);
+//                        mid.setContent(jsonObject);
+//                        k.add(mid);
+//                        medind.setName(rule.getRemind());
+//                        medind.setDetails(k);
+//                        reminder.add(medind);
+//
+//                        System.out.println(medind.getRule() + " -> " + medind.getName());
+//                    }
+//                }
+//            }
+//
+//        } catch (Exception ex) {
+//            ex.printStackTrace();
+//        } finally {
+//            return reminder;
+//        }
+//    }
+//
+//    private List<LisDetail> processLis(List<LisDetail> lisArr) {
+//        if (lisArr == null) {
+//            return new ArrayList<>();
+//        }
+//        if (lisArr.size() == 0) {
+//            return lisArr;
+//        }
+//
+//        String Otherval = "";
+//
+//        for (int i = 0; i < lisArr.size(); i++) {
+//            LisDetail lisres = lisArr.get(i);
+//
+////            Otherval = (lisres.getOtherValue().trim().length() > 0) ? lisres.getOtherValue().trim() + "\n" : "";
+//            Otherval = lisres.getOtherValue();
+//
+//            if (Otherval.indexOf(pos) >= 0 || Otherval.indexOf(neg) >= 0) {
+//                lisres.setOtherValue(lisres.getDetailName() + Otherval);
+//            } else {
+//                Otherval = (Otherval.trim().length() > 0) ? Otherval.trim() + "\n" : "";
+//                if (lisres.getValue() == null) {
+//                    continue;
+//                } else if (lisres.getMaxValue() != null && lisres.getValue() > lisres.getMaxValue()) {
+//                    lisres.setOtherValue(Otherval + lisres.getDetailName() + up);
+//                } else if (lisres.getMinValue() != null && lisres.getValue() < lisres.getMinValue()) {
+//                    lisres.setOtherValue(Otherval + lisres.getDetailName() + down);
+//                } else {
+//                    lisres.setOtherValue(Otherval + lisres.getDetailName() + normal);
+//                }
+//            }
+//        }
+//
+//        return lisArr;
+//    }
 }
 }