0027005599 2 лет назад
Родитель
Сommit
121f4c097d

+ 21 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/Constant.java

@@ -133,4 +133,25 @@ public class Constant {
      * 费用类别对应项目类型
      */
     public static final String CATEGORY_PROJECTTYPE_KEY = "category-projectType";
+    /**
+     * project_type为2,为c开头,耗材
+     */
+    public static final String CONSUMABLE_START_KEY ="C";
+    /**
+     * project_type为1:药品 为 Z开头
+     */
+    public static final String RESTORATIVES_Z_START_KEY ="Z";
+
+    /**
+     * project_type为1:药品 为 T开头
+     */
+    public static final String RESTORATIVES_T_START_KEY ="T";
+
+    /**
+     * project_type为1:药品 为 T开头
+     */
+    public static final String RESTORATIVES_X_START_KEY ="X";
+
+
+
 }

+ 1 - 1
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/entity/MedicalInsRuleProject.java

@@ -261,7 +261,7 @@ public class MedicalInsRuleProject implements Serializable {
 
     @Excel(name = "医疗总发生费用", width = 15)
     @ApiModelProperty(value = "医疗总发生费用")
-    private java.math.BigDecimal medfeeSumamt;
+    private java.lang.Double medfeeSumamt;
 
 
 

+ 46 - 17
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/ruleengine/RuleEngine.java

@@ -135,7 +135,7 @@ public class RuleEngine {
          * 根据规则id加载规则并初始化到redis里
          * 后续提醒通过redis加载id,把id传入规则引擎,迅速调用对应规则
          */
-        List<Integer> medicalInsRuleInfoIdList = new ArrayList<>();
+        List<MedicalInsRuleInfo> midMedicalInsRuleInfoList = new ArrayList<>();
         Map<Integer, MedicalInsRuleInfo> medicalMap = new HashMap<>();
 //        redisTemplate.delete(Constant.MEDICAL_RULE_CACHE_KEY + "_" + Constant.TREATMEN_TYPE_ADVANCE_WARNING);
         for (MedicalInsRuleInfo medicalInsRuleInfo : medicalInsRuleInfoList) {
@@ -146,18 +146,37 @@ public class RuleEngine {
                 advanceWaringRuleIdList.add(medicalInsRuleInfo.getId());
             } else if (Constant.TREATMEN_TYPE_MID_INCIDENT_WARNING.equals(medicalInsRuleInfo.getCallScenario())
                     || Constant.TREATMEN_TYPE_MID_EX_POST_SUPERVISION.equals(medicalInsRuleInfo.getCallScenario())) {
-                medicalInsRuleInfoIdList.add(medicalInsRuleInfo.getId());
+                midMedicalInsRuleInfoList.add(medicalInsRuleInfo);
             }
         }
+
+        genItemCodeAndRuleIdMap(midMedicalInsRuleInfoList);
+        List<RuleAttr> ruleAttrList = ruleAttrService.list();
+        interfRuleAttrList = ruleAttrList.stream().collect(Collectors.groupingBy(RuleAttr::getInterfName));
+
+    }
+
+    public void genItemCodeAndRuleIdMap(List<MedicalInsRuleInfo> medicalInsRuleInfoList){
         try {
 
-            MemeryPageUtil.batchDeal(medicalInsRuleInfoIdList, 1000, pageDataList -> {
-                List<MedicalInsRuleProject> medicalInsRuleProjectList = medicalInsRuleProjectService.lambdaQuery().in(MedicalInsRuleProject::getMedicalInsRuleInfoId, pageDataList).list();
+            MemeryPageUtil.batchDeal(medicalInsRuleInfoList, 1000, pageDataList -> {
+                List<Integer> ruleIdList = pageDataList.stream().map(MedicalInsRuleInfo::getId).collect(Collectors.toList());
+                List<MedicalInsRuleProject> medicalInsRuleProjectList = medicalInsRuleProjectService.lambdaQuery().in(MedicalInsRuleProject::getMedicalInsRuleInfoId, ruleIdList).list();
                 if (CollectionUtil.isNotEmpty(medicalInsRuleProjectList)) {
                     MedicalInsRuleProject medicalInsRuleProject = null;
                     for (int index = 0; index < medicalInsRuleProjectList.size(); index++) {
                         medicalInsRuleProject = medicalInsRuleProjectList.get(index);
                         if (StringUtils.isNotBlank(medicalInsRuleProject.getProjectCode())) {
+                            if(medicalInsRuleProject.getProjectCode().startsWith(Constant.CONSUMABLE_START_KEY)){
+
+                            }else if(medicalInsRuleProject.getProjectCode().startsWith(Constant.RESTORATIVES_T_START_KEY) ||
+                                    medicalInsRuleProject.getProjectCode().startsWith(Constant.RESTORATIVES_X_START_KEY) ||
+                                    medicalInsRuleProject.getProjectCode().startsWith(Constant.RESTORATIVES_Z_START_KEY)){
+
+                                //耗材都是字母c开头, 药品是X或Z T, 医疗服务是数字开头
+                            }else if(SPELUtil.isNumeric(medicalInsRuleProject.getProjectCode())){
+
+                            }
                             if (itemCodeAndRuleIdMap.containsKey(medicalInsRuleProject.getProjectCode())) {
                                 itemCodeAndRuleIdMap.get(medicalInsRuleProject.getProjectCode()).add(medicalInsRuleProject.getMedicalInsRuleInfoId());
                             } else {
@@ -175,15 +194,26 @@ public class RuleEngine {
                                 itemCodeAndRuleIdMap.put(medicalInsRuleProject.getCorrelationProjectCode(), ruleIdSet);
                             }
                         }
-                        List<MedicalInsRuleProjectDiagnose> medicalInsRuleProjectDiagnoseList = medicalInsRuleProjectDiagnoseService.lambdaQuery().eq(MedicalInsRuleProjectDiagnose::getMedicalInsRuleInfoId, medicalInsRuleProject.getMedicalInsRuleInfoId()).list();
-                        if (CollectionUtil.isNotEmpty(medicalInsRuleProjectDiagnoseList)) {
-                            for (MedicalInsRuleProjectDiagnose medicalInsRuleProjectDiagnose : medicalInsRuleProjectDiagnoseList) {
-                                if (itemCodeAndRuleIdMap.containsKey(medicalInsRuleProjectDiagnose.getMedicalDiagnoseCode())) {
-                                    itemCodeAndRuleIdMap.get(medicalInsRuleProjectDiagnose.getMedicalDiagnoseCode()).add(medicalInsRuleProject.getMedicalInsRuleInfoId());
-                                } else {
-                                    Set<Integer> ruleIdSet = new HashSet<>();
-                                    ruleIdSet.add(medicalInsRuleProject.getMedicalInsRuleInfoId());
-                                    itemCodeAndRuleIdMap.put(medicalInsRuleProjectDiagnose.getMedicalDiagnoseCode(), ruleIdSet);
+
+
+                    }
+                }
+
+                for(MedicalInsRuleInfo medicalInsRuleInfo : medicalInsRuleInfoList) {
+                    if(StringUtils.isNotBlank(medicalInsRuleInfo.getSelectedRoles())) {
+                        String[] rolesArr = medicalInsRuleInfo.getSelectedRoles().split(",");
+                        boolean medicalDiagnoseCodeFlag = Arrays.stream(rolesArr).allMatch(role -> role.equals("medicalDiagnoseCode"));
+                        if(medicalDiagnoseCodeFlag) {
+                            List<MedicalInsRuleProjectDiagnose> medicalInsRuleProjectDiagnoseList = medicalInsRuleProjectDiagnoseService.lambdaQuery().eq(MedicalInsRuleProjectDiagnose::getMedicalInsRuleInfoId, medicalInsRuleInfo.getId()).list();
+                            if (CollectionUtil.isNotEmpty(medicalInsRuleProjectDiagnoseList)) {
+                                for (MedicalInsRuleProjectDiagnose medicalInsRuleProjectDiagnose : medicalInsRuleProjectDiagnoseList) {
+                                    if (itemCodeAndRuleIdMap.containsKey(medicalInsRuleProjectDiagnose.getMedicalDiagnoseCode())) {
+                                        itemCodeAndRuleIdMap.get(medicalInsRuleProjectDiagnose.getMedicalDiagnoseCode()).add(medicalInsRuleInfo.getId());
+                                    } else {
+                                        Set<Integer> ruleIdSet = new HashSet<>();
+                                        ruleIdSet.add(medicalInsRuleInfo.getId());
+                                        itemCodeAndRuleIdMap.put(medicalInsRuleProjectDiagnose.getMedicalDiagnoseCode(), ruleIdSet);
+                                    }
                                 }
                             }
                         }
@@ -193,10 +223,6 @@ public class RuleEngine {
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }
-
-        List<RuleAttr> ruleAttrList = ruleAttrService.list();
-        interfRuleAttrList = ruleAttrList.stream().collect(Collectors.groupingBy(RuleAttr::getInterfName));
-
     }
 
     /**
@@ -302,6 +328,9 @@ public class RuleEngine {
     }
 
 
+
+
+
     /**
      * 事后明细
      *

+ 36 - 23
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/medical/ruleengine/SPELUtil.java

@@ -20,6 +20,8 @@ import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * 集合匹配元素
@@ -303,31 +305,42 @@ public class SPELUtil {
         return false;
     }
 
+    public static boolean isNumeric(String str) {
+        Pattern pattern = Pattern.compile("[0-9]*");
+        Matcher isNum = pattern.matcher(str.charAt(0)+"");
+        if (!isNum.matches()) {
+            return false;
+        }
+        return true;
+    }
+
 
 
     public static void main(String[] args) {
-        SPELUtil spelUtil = new SPELUtil();
-        Map<String, Object> inMap = new HashMap<>();
-        inMap.put("1123", "342343");
-        inMap.put("1124", 2);
-        List<Map<String, Object>> memberList = new ArrayList<>();
-        Map<String, Object> itemMap = new HashMap<>();
-        itemMap.put("1123", "342343");
-        itemMap.put("1124", 2);
-        memberList.add(itemMap);
-        String[] keyArr = new String[]{"1123", "1124"};
-        System.out.println(spelUtil.isMemberLeftMap(inMap, memberList, keyArr));
-        System.out.println(new Integer(234).equals(new Integer(234)));
-        List<Long> lList = new ArrayList<>();
-        lList.add(1L);
-        lList.add(2L);
-        System.out.println(spelUtil.isMemberLeftLong(3L, lList));
-//        String condStr = "isMemberLeftObject(#medical_diagnose_code,#medical_ins_medicalDiagnoseCodeList) && #change_class<>#medical_ins_changeClass";
-        String condStr = "#isMemberListAndList(#medical_diagnose_code,#medical_ins_medicalDiagnoseCodeList) ";
-
-        Map<String, Object> itemMap1 = new HashMap<>();
-        itemMap1.put("medical_diagnose_code", Arrays.asList("1", "2", "3"));
-        itemMap1.put("medical_ins_medicalDiagnoseCodeList", Arrays.asList("3", "5", "6"));
-        System.out.println(spelUtil.runSpelExpression(itemMap1, condStr));
+//        SPELUtil spelUtil = new SPELUtil();
+//        Map<String, Object> inMap = new HashMap<>();
+//        inMap.put("1123", "342343");
+//        inMap.put("1124", 2);
+//        List<Map<String, Object>> memberList = new ArrayList<>();
+//        Map<String, Object> itemMap = new HashMap<>();
+//        itemMap.put("1123", "342343");
+//        itemMap.put("1124", 2);
+//        memberList.add(itemMap);
+//        String[] keyArr = new String[]{"1123", "1124"};
+//        System.out.println(spelUtil.isMemberLeftMap(inMap, memberList, keyArr));
+//        System.out.println(new Integer(234).equals(new Integer(234)));
+//        List<Long> lList = new ArrayList<>();
+//        lList.add(1L);
+//        lList.add(2L);
+//        System.out.println(spelUtil.isMemberLeftLong(3L, lList));
+////        String condStr = "isMemberLeftObject(#medical_diagnose_code,#medical_ins_medicalDiagnoseCodeList) && #change_class<>#medical_ins_changeClass";
+//        String condStr = "#isMemberListAndList(#medical_diagnose_code,#medical_ins_medicalDiagnoseCodeList) ";
+//
+//        Map<String, Object> itemMap1 = new HashMap<>();
+//        itemMap1.put("medical_diagnose_code", Arrays.asList("1", "2", "3"));
+//        itemMap1.put("medical_ins_medicalDiagnoseCodeList", Arrays.asList("3", "5", "6"));
+//        System.out.println(spelUtil.runSpelExpression(itemMap1, condStr));
+        String test ="A0123123";
+        System.out.println(isNumeric(test));
     }
 }