Browse Source

1、术语导入模板校验

zhaops 4 years atrás
parent
commit
0ad1e20a5b

+ 3 - 3
src/main/java/com/diagbot/entity/DeptConfig.java

@@ -61,20 +61,20 @@ public class DeptConfig implements Serializable {
     /**
      * 医院科室名称
      */
-    @Excel(name = "医院科室名称", width = 40, orderNum = "2")
+    @Excel(name = "医院科室名称", width = 40, orderNum = "2", isImportField = "true")
     @NotBlank(message = "请输入医院科室名称")
     private String hisName;
 
     /**
      * 医院科室编码
      */
-    @Excel(name = "医院科室编码", width = 40, orderNum = "1")
+    @Excel(name = "医院科室编码", width = 40, orderNum = "1", isImportField = "true")
     private String hisCode;
 
     /**
      * 标准科室名称
      */
-    @Excel(name = "标准科室名称", width = 40, orderNum = "4")
+    @Excel(name = "标准科室名称", width = 40, orderNum = "4", isImportField = "true")
     @NotBlank(message = "请输入标准科室名称")
     private String uniqueName;
 

+ 3 - 3
src/main/java/com/diagbot/entity/DiseaseConfig.java

@@ -61,21 +61,21 @@ public class DiseaseConfig implements Serializable {
     /**
      * 医院诊断名称
      */
-    @Excel(name = "医院诊断名称", width = 40, orderNum = "1")
+    @Excel(name = "医院诊断名称", width = 40, orderNum = "1", isImportField = "true")
     @NotBlank(message = "请输入医院诊断名称")
     private String hisName;
 
     /**
      * 标准诊断名称
      */
-    @Excel(name = "标准诊断名称", width = 40, orderNum = "3")
+    @Excel(name = "标准诊断名称", width = 40, orderNum = "3", isImportField = "true")
     @NotBlank(message = "请输入标准诊断名称")
     private String uniqueName;
 
     /**
      * ICD-10编码
      */
-    @Excel(name = "ICD-10编码", width = 40, orderNum = "2")
+    @Excel(name = "ICD-10编码", width = 40, orderNum = "2", isImportField = "true")
     private String icdCode;
 
     public Long getId() {

+ 3 - 3
src/main/java/com/diagbot/entity/DrugConfig.java

@@ -61,14 +61,14 @@ public class DrugConfig implements Serializable {
     /**
      * 医院药品名称
      */
-    @Excel(name = "医院药品名称", width = 40, orderNum = "1")
+    @Excel(name = "医院药品名称", width = 40, orderNum = "1", isImportField = "true")
     @NotBlank(message = "请输入医院药品名称")
     private String hisName;
 
     /**
      * 标准药品名称
      */
-    @Excel(name = "标准药品名称", width = 40, orderNum = "2")
+    @Excel(name = "标准药品名称", width = 40, orderNum = "2", isImportField = "true")
     @NotBlank(message = "请输入标准药品名称")
     private String uniqueName;
 
@@ -81,7 +81,7 @@ public class DrugConfig implements Serializable {
     /**
      * 剂型
      */
-    @Excel(name = "药品剂型", width = 20, orderNum = "3")
+    @Excel(name = "药品剂型", width = 20, orderNum = "3", isImportField = "true")
     private String form;
 
     public Long getId() {

+ 3 - 3
src/main/java/com/diagbot/entity/LisConfig.java

@@ -63,20 +63,20 @@ public class LisConfig implements Serializable {
     /**
      * 检验套餐
      */
-    @Excel(name = "检验套餐", width = 40, orderNum = "1")
+    @Excel(name = "检验套餐", width = 40, orderNum = "1", isImportField = "true")
     @NotBlank(message = "请输入检验套餐")
     private String hisName;
 
     /**
      * 检验细项
      */
-    @Excel(name = "检验细项", width = 40, orderNum = "2")
+    @Excel(name = "检验细项", width = 40, orderNum = "2", isImportField = "true")
     private String hisDetailName;
 
     /**
      * 标准检验项目
      */
-    @Excel(name = "标准检验项目", width = 40, orderNum = "4")
+    @Excel(name = "标准检验项目", width = 40, orderNum = "4", isImportField = "true")
     @NotBlank(message = "请输入标准检验项目")
     private String uniqueName;
 

+ 2 - 2
src/main/java/com/diagbot/entity/OperationConfig.java

@@ -61,14 +61,14 @@ public class OperationConfig implements Serializable {
     /**
      * 医院手术/操作名称
      */
-    @Excel(name = "医院手术/操作名称", width = 40, orderNum = "1")
+    @Excel(name = "医院手术/操作名称", width = 40, orderNum = "1", isImportField = "true")
     @NotBlank(message = "请输入医院手术/操作名称")
     private String hisName;
 
     /**
      * 标准手术/操作名称
      */
-    @Excel(name = "标准手术/操作名称", width = 40, orderNum = "3")
+    @Excel(name = "标准手术/操作名称", width = 40, orderNum = "3", isImportField = "true")
     @NotBlank(message = "请输入标准手术/操作名称")
     private String uniqueName;
 

+ 2 - 2
src/main/java/com/diagbot/entity/PacsConfig.java

@@ -61,14 +61,14 @@ public class PacsConfig implements Serializable {
     /**
      * 医院检查项目
      */
-    @Excel(name = "医院检查项目", width = 40, orderNum = "1")
+    @Excel(name = "医院检查项目", width = 40, orderNum = "1", isImportField = "true")
     @NotBlank(message = "请输入医院检查项目")
     private String hisName;
 
     /**
      * 标准检查项目
      */
-    @Excel(name = "标准检查项目", width = 40, orderNum = "3")
+    @Excel(name = "标准检查项目", width = 40, orderNum = "3", isImportField = "true")
     @NotBlank(message = "请输入标准检查项目")
     private String uniqueName;
 

+ 2 - 2
src/main/java/com/diagbot/entity/TransfusionConfig.java

@@ -61,14 +61,14 @@ public class TransfusionConfig implements Serializable {
     /**
      * 医院用血类型
      */
-    @Excel(name = "医院输血类型", width = 40, orderNum = "1")
+    @Excel(name = "医院输血类型", width = 40, orderNum = "1", isImportField = "true")
     @NotBlank(message = "请输入医院输血类型")
     private String hisName;
 
     /**
      * 标准用血术语
      */
-    @Excel(name = "标准输血类型", width = 40, orderNum = "3")
+    @Excel(name = "标准输血类型", width = 40, orderNum = "3", isImportField = "true")
     @NotBlank(message = "请输入标准输血类型")
     private String uniqueName;
 

+ 7 - 3
src/main/java/com/diagbot/util/ExcelUtils.java

@@ -7,6 +7,7 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
 import cn.afterturn.easypoi.excel.entity.ImportParams;
 import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
 import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
+import cn.afterturn.easypoi.exception.excel.ExcelImportException;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import org.apache.commons.lang3.StringUtils;
@@ -38,7 +39,7 @@ public class ExcelUtils {
     }
 
     public static void exportExcelDynamicCol(List<ExcelExportEntity> entityList, Collection<?> dataSet, String title, String sheetName, String fileName,
-                                    HttpServletResponse response) {
+                                             HttpServletResponse response) {
         ExportParams exportParams = new ExportParams(title, sheetName);
         dynamicColExport(entityList, dataSet, fileName, response, exportParams);
     }
@@ -72,7 +73,7 @@ public class ExcelUtils {
 
     private static void dynamicColExport(List<ExcelExportEntity> entityList, Collection<?> dataSet, String fileName, HttpServletResponse response,
                                          ExportParams exportParams) {
-        Workbook workbook = ExcelExportUtil.exportExcel(exportParams,entityList,dataSet);
+        Workbook workbook = ExcelExportUtil.exportExcel(exportParams, entityList, dataSet);
         if (workbook != null) {
             ;
         }
@@ -149,6 +150,8 @@ public class ExcelUtils {
         } catch (NoSuchElementException e) {
             // throw new NormalException("模板不能为空");
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "模板不能为空");
+        } catch (ExcelImportException e) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "校验失败,请使用模板进行数据导入");
         } catch (Exception e) {
             e.printStackTrace();
             // throw new NormalException(e.getMessage());
@@ -171,6 +174,8 @@ public class ExcelUtils {
         } catch (NoSuchElementException e) {
             // throw new NormalException("excel文件不能为空");
             throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "excel文件不能为空");
+        } catch (ExcelImportException e) {
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "校验失败,请使用模板进行数据导入");
         } catch (Exception e) {
             // throw new NormalException(e.getMessage());
             System.out.println(e.getMessage());
@@ -178,5 +183,4 @@ public class ExcelUtils {
         }
         return list;
     }
-
 }