wangfeng 4 tahun lalu
induk
melakukan
3d7c23eddc

+ 34 - 29
src/main/java/com/diagbot/facade/SysRegularConfigFacade.java

@@ -116,13 +116,14 @@ public class SysRegularConfigFacade extends SysRegularConfigServiceImpl {
         if (ListUtil.isNotEmpty(regularConfigDatas)) {
             for (RegularValueDTO data : regularConfigDatas) {
                 if (data.getType().equals(RegularConfigEnum.lis.getKey())) {
-                    if(!data.getValue().equals("")){
-                    Lis lis = new Lis();
-                    lis.setUniqueName(data.getKey());
-                    lis.setDetailName(data.getKey());
-                    lis.setName(data.getKey());
-                    lis.setValue(Double.valueOf(data.getValue()));
-                    lisData.add(lis);}
+                    if (!data.getValue().equals("")) {
+                        Lis lis = new Lis();
+                        lis.setUniqueName(data.getKey());
+                        lis.setDetailName(data.getKey());
+                        lis.setName(data.getKey());
+                        lis.setValue(Double.valueOf(data.getValue()));
+                        lisData.add(lis);
+                    }
                 } else if (data.getType().equals(RegularConfigEnum.allergy.getKey())) {
                     AllergyMedicine allergy = new AllergyMedicine();
                     allergy.setName(data.getKey());
@@ -144,7 +145,7 @@ public class SysRegularConfigFacade extends SysRegularConfigServiceImpl {
                 allergies.add(allergy);
             }
         }
-        if (null!= allergyStr && !allergyStr.equals("")) {
+        if (null != allergyStr && !allergyStr.equals("")) {
             String[] result = allergyStr.split("[\\,\\,]");
             for (String r : result) {
                 AllergyMedicine allergyMedicine = new AllergyMedicine();
@@ -160,29 +161,33 @@ public class SysRegularConfigFacade extends SysRegularConfigServiceImpl {
         return wordCrfDTO;
     }
 
-    public boolean saverRegularConfigDatas(RegularConfigSaveVO regularConfigSaveVO) {
+    public boolean saverRegularConfigDatas(List<RegularConfigSaveVO> regularConfigSaveVOList) {
         boolean res = false;
-        List<String> name = regularConfigSaveVO.getName();
-        for (String str : name) {
-            int countTow = this.count(new QueryWrapper<SysRegularConfig>()
-                    .eq("is_deleted", IsDeleteEnum.N.getKey())
-                    .eq(str != null, "rules_name", str)
-                    .eq(regularConfigSaveVO.getRulesTepy() != null, "rules_tepy", regularConfigSaveVO.getRulesTepy()));
-            if (countTow > 0) {
-                throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, str + "该方案编码已存在");
-            } else {
-                SysRegularConfig regularConfig = new SysRegularConfig();
-                regularConfig.setRulesName(regularConfigSaveVO.getStandardName());
-                regularConfig.setRulesTepy(regularConfigSaveVO.getRulesTepy());
-                String rulesValue = "";
-                if (regularConfigSaveVO.getRulesTepy().equals(RegularConfigEnum.allergy.getKey())) {
-                    int num = str.length();
-                    rulesValue = "[\\、" + str + "过敏]{" + (num + 3) + "}|[无" + str + "过敏]{" + (num + 3) + "}|[否认" + str + "过敏]{" + (num + 4) + "}¥[" + str + "过敏]{" + (num + 2) + "}";
-                } else if (regularConfigSaveVO.getRulesTepy().equals(RegularConfigEnum.lis.getKey())) {
-                    rulesValue = "(" + str + ")\\s*[(\\-|\\+)?\\d+(\\.\\d+)?$]+";
+        for (RegularConfigSaveVO regularConfigSaveVO : regularConfigSaveVOList) {
+
+
+            List<String> name = regularConfigSaveVO.getName();
+            for (String str : name) {
+                int countTow = this.count(new QueryWrapper<SysRegularConfig>()
+                        .eq("is_deleted", IsDeleteEnum.N.getKey())
+                        .eq(str != null, "rules_name", str)
+                        .eq(regularConfigSaveVO.getRulesTepy() != null, "rules_tepy", regularConfigSaveVO.getRulesTepy()));
+                if (countTow > 0) {
+                    throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, str + "该方案编码已存在");
+                } else {
+                    SysRegularConfig regularConfig = new SysRegularConfig();
+                    regularConfig.setRulesName(regularConfigSaveVO.getStandardName());
+                    regularConfig.setRulesTepy(regularConfigSaveVO.getRulesTepy());
+                    String rulesValue = "";
+                    if (regularConfigSaveVO.getRulesTepy().equals(RegularConfigEnum.allergy.getKey())) {
+                        //int num = str.length();
+                        rulesValue = "(\\、" + str + "过敏)|(无" + str + "过敏)|(否认" + str + "过敏)¥(" + str + "过敏)";
+                    } else if (regularConfigSaveVO.getRulesTepy().equals(RegularConfigEnum.lis.getKey())) {
+                        rulesValue = "(" + str + ")\\s*[(\\-|\\+)?\\d+(\\.\\d+)?$]+";
+                    }
+                    regularConfig.setRulesValue(rulesValue);
+                    res = save(regularConfig);
                 }
-                regularConfig.setRulesValue(rulesValue);
-                res = save(regularConfig);
             }
         }
         return res;

+ 1 - 1
src/main/java/com/diagbot/web/SysRegularConfigController.java

@@ -48,7 +48,7 @@ public class SysRegularConfigController {
             notes = "保存相应正则数据")
     @PostMapping("/saverRegularConfigData")
     @Transactional
-    public RespDTO<Boolean> saverRegularConfigData(@Valid @RequestBody RegularConfigSaveVO regularConfigSaveVO) {
+    public RespDTO<Boolean> saverRegularConfigData(@Valid @RequestBody List<RegularConfigSaveVO> regularConfigSaveVO) {
         boolean res = sysRegularConfigFacade.saverRegularConfigDatas(regularConfigSaveVO);
         return RespDTO.onSuc(res);
     }