Forráskód Böngészése

术语扩展修改

rgb 6 éve
szülő
commit
f1e1c24b92

+ 29 - 2
knowledgeman-service/src/main/java/com/diagbot/facade/ConceptFacade.java

@@ -463,7 +463,7 @@ public class ConceptFacade extends ConceptServiceImpl {
 
         return true;
     }
-
+    
     /**
      * 医学术语命名excel文件导入
      *
@@ -494,8 +494,9 @@ public class ConceptFacade extends ConceptServiceImpl {
 
                             Sheet sheet = wb.getSheetAt(0);
                             int count = 0;
-                            String libName, libType, otherNames, remark;
+                            String libName, libType, otherNames, remark,sexType,minAge,maxAge;
                             String regEx = "[0-9]+|[`~·!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]+";
+                            String regExAge = "[0-9]|[1-9][0-9]|1[0-9]{2}|200";
                             for (Row row : sheet) {
                                 count++;
                                 if (row == null) {
@@ -512,6 +513,9 @@ public class ConceptFacade extends ConceptServiceImpl {
                                 libType = getValue(row.getCell(1)).trim().replace(" ", "");
                                 otherNames = getValue(row.getCell(2)).trim().replace(" ", "");
                                 remark = getValue(row.getCell(3)).trim().replace(" ", "");
+                                sexType = getValue(row.getCell(4)).trim().replace(" ", "");
+                                minAge = getValue(row.getCell(5)).trim().replace(" ", "");
+                                maxAge = getValue(row.getCell(6)).trim().replace(" ", "");
                                 if (StringUtil.isEmpty(libName) && StringUtil.isEmpty(libType)
                                         && StringUtil.isEmpty(otherNames) && StringUtil.isEmpty(remark)) {
                                     continue;
@@ -524,11 +528,34 @@ public class ConceptFacade extends ConceptServiceImpl {
                                     sbf.append("第" + count + "行导入错误,说明最大可输入120个字;").append("<br/>");
                                     continue;
                                 }
+                                if(StringUtil.isNotEmpty(sexType)&&!sexType.matches("男|女|通用")){
+                                	sbf.append("第" + count + "行导入错误,性别须是男、女或者通用;").append("<br/>");
+                                }
+                                if((StringUtil.isNotEmpty(minAge)&&!minAge.matches(regExAge))
+                                		||(StringUtil.isNotEmpty(maxAge)&&!maxAge.matches(regExAge))){
+                                	 sbf.append("第" + count + "行导入错误,年龄须是0-200;").append("<br/>");
+                                     continue;
+                                }
+                                if(StringUtil.isNotEmpty(minAge)
+                                		&&StringUtil.isNotEmpty(maxAge)
+                                		&&Integer.parseInt(minAge)>Integer.parseInt(maxAge)){
+                                	sbf.append("第" + count + "行导入错误,症状发生的最小年龄大于症状发生的最大年龄;").append("<br/>");
+                                    continue;
+                                }
 
                                 AddConceptInfoVO addConceptInfoVO = new AddConceptInfoVO();
                                 addConceptInfoVO.setLineNum(count);
                                 addConceptInfoVO.setName(libName);
                                 addConceptInfoVO.setType(libType);
+                                addConceptInfoVO.setMinAge(Integer.parseInt(minAge));
+                                addConceptInfoVO.setMaxAge(Integer.parseInt(maxAge));
+                                if(sexType.equals("男")){
+                                	addConceptInfoVO.setSexType(1);
+                                }else if(sexType.equals("女")){
+                                	addConceptInfoVO.setSexType(2);
+                                }else{
+                                	addConceptInfoVO.setSexType(3);
+                                }
                                 List<AddConceptInfoDetailVO> detailList = new ArrayList<>();
                                 for (String nm : otherNames.split(",")) {
                                     if (StringUtil.isBlank(nm)) {