Browse Source

1、术语关联映射

zhaops 3 years ago
parent
commit
8aec63a399

+ 1 - 0
src/main/java/com/diagbot/config/ResourceServerConfigurer.java

@@ -50,6 +50,7 @@ public class ResourceServerConfigurer extends ResourceServerConfigurerAdapter {
                 .antMatchers("/tran/mappingConfig/precDataMatch_remote").permitAll()
                 .antMatchers("/tran/mappingConfig/importExcelDataVerify").permitAll()
                 .antMatchers("/tran/mappingConfig/importExcel").permitAll()
+                .antMatchers("/tran/mappingConfig/importExcel_remote").permitAll()
                 .antMatchers("/tran/mappingConfig/exportExcel").permitAll()
                 .antMatchers("/tran/mappingConfig/exportExcel_remote").permitAll()
                 .antMatchers("/tran/mappingConfig/getPage").permitAll()

+ 1 - 0
src/main/java/com/diagbot/config/security/UrlAccessDecisionManager.java

@@ -93,6 +93,7 @@ public class UrlAccessDecisionManager implements AccessDecisionManager {
                 || matchers("/tran/mappingConfig/precDataMatch_remote", request)
                 || matchers("/tran/mappingConfig/importExcelDataVerify", request)
                 || matchers("/tran/mappingConfig/importExcel", request)
+                || matchers("/tran/mappingConfig/importExcel_remote", request)
                 || matchers("/tran/mappingConfig/exportExcel", request)
                 || matchers("/tran/mappingConfig/exportExcel_remote", request)
                 || matchers("/tran/mappingConfig/getPage", request)

+ 40 - 4
src/main/java/com/diagbot/facade/MappingConfigFacade.java

@@ -1091,7 +1091,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
      * @param hospitalId
      * @param type
      */
-    public Boolean importExcel(MultipartFile file, Long hospitalId, Integer type, String userId) {
+    public void importExcel(HttpServletResponse response, MultipartFile file, Long hospitalId, Integer type, String userId) {
         if (hospitalId == null) {
             hospitalId = Long.valueOf(SysUserUtils.getCurrentHospitalID());
         }
@@ -1105,7 +1105,34 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
         if (ListUtil.isEmpty(originList)) {
             throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
         }
-        Boolean data = importDataProcess(originList, hospitalId, type, userId);
+        List<MappingConfigWrapper> data = importDataProcess(originList, hospitalId, type, userId);
+        if (ListUtil.isNotEmpty(data)) {
+            exportExcel(response, data, type, "导入失败", 1);
+        }
+    }
+
+    /**
+     * 数据导入
+     *
+     * @param file
+     * @param hospitalId
+     * @param type
+     */
+    public List<MappingConfigWrapper> importExcel_remote(HttpServletResponse response, MultipartFile file, Long hospitalId, Integer type, String userId) {
+        if (hospitalId == null) {
+            hospitalId = Long.valueOf(SysUserUtils.getCurrentHospitalID());
+        }
+        if (StringUtil.isBlank(userId)) {
+            userId = SysUserUtils.getCurrentPrincipleID();
+        }
+        if (StringUtil.isBlank(userId)) {
+            userId = "0";
+        }
+        List<MappingConfigWrapper> originList = readImportData(file, type, 2);
+        if (ListUtil.isEmpty(originList)) {
+            throw new CommonException(CommonErrorCode.PARAM_IS_NULL, "校验失败,导入数据不能为空");
+        }
+        List<MappingConfigWrapper> data = importDataProcess(originList, hospitalId, type, userId);
         return data;
     }
 
@@ -1294,8 +1321,9 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
      * @param hospitalId
      * @param type
      */
-    public Boolean importDataProcess(List<MappingConfigWrapper> originList, Long hospitalId, Integer type, String userId) {
+    public List<MappingConfigWrapper> importDataProcess(List<MappingConfigWrapper> originList, Long hospitalId, Integer type, String userId) {
         List<MappingConfigWrapper> tempList = Lists.newLinkedList();
+        List<MappingConfigWrapper> errorList = Lists.newLinkedList();
 
         Date now = DateUtil.now();
 
@@ -1515,6 +1543,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
                             item.setIsMatch(1);
                         } else {
                             item.setIsMatch(0);
+                            errorList.add(item);
                         }
                     } else {
                         if (lisMap.containsKey(item.getUniqueName())) {
@@ -1522,6 +1551,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
                             item.setIsMatch(1);
                         } else {
                             item.setIsMatch(0);
+                            errorList.add(item);
                         }
                     }
 
@@ -1547,6 +1577,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
                             item.setIsMatch(1);
                         } else {
                             item.setIsMatch(0);
+                            errorList.add(item);
                         }
                     }
                 }
@@ -1571,6 +1602,11 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
                         }
                         if (formMap.containsKey(item.getForm())) {
                             item.setFormConceptId(formMap.get(item.getForm()).get(0));
+                        } else {
+                            if (item.getIsMatch().equals(1)) {
+                                item.setIsMatch(0);
+                                errorList.add(item);
+                            }
                         }
                     }
                 }
@@ -1611,7 +1647,7 @@ public class MappingConfigFacade extends MappingConfigServiceImpl {
                 mappingConfigService.saveOrUpdateBatch(saveList);
             }
         }
-        return true;
+        return errorList;
     }
 
     /**

+ 25 - 7
src/main/java/com/diagbot/web/MappingConfigController.java

@@ -85,11 +85,11 @@ public class MappingConfigController {
     }
 
     @ApiOperation(value = "预匹配(非文件匹配)[by:zhaops]",
-            notes = "type(必填): 类型:1-化验、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、10-量表、11-护理、12-中医诊断、13-中医证候、14-麻醉 <br>"+
+            notes = "type(必填): 类型:1-化验、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、10-量表、11-护理、12-中医诊断、13-中医证候、14-麻醉 <br>" +
                     "hisName(必填):医院术语名称 <br>" +
                     "hisDetailName(选填):医院术语名称-细项 <br>" +
                     "code(选填):诊断ICD10编码、手术编码、中医疾病编码、中医证候编码 <br>" +
-                    "approval(选填):药品国药准字 <br>" )
+                    "approval(选填):药品国药准字 <br>")
     @PostMapping(value = "/precData")
     @SysLogger("precData")
     public RespDTO<List<MappingConfigWrapper>> precData(@Valid @RequestBody PrecDataVO precDataVO) {
@@ -120,11 +120,29 @@ public class MappingConfigController {
     @PostMapping(value = "/importExcel", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
     @SysLogger("importExcel")
     @Transactional
-    public RespDTO<Boolean> importExcel(@RequestParam("file") MultipartFile file,
-                                        @RequestParam("hospitalId") Long hospitalId,
-                                        @RequestParam("type") Integer type,
-                                        @RequestParam("uesrId") String userId) {
-        Boolean data = mappingConfigFacade.importExcel(file, hospitalId, type, userId);
+    public void importExcel(HttpServletResponse response,
+                            @RequestParam("file") MultipartFile file,
+                            @RequestParam("hospitalId") Long hospitalId,
+                            @RequestParam("type") Integer type,
+                            @RequestParam("uesrId") String userId) {
+        mappingConfigFacade.importExcel(response, file, hospitalId, type, userId);
+    }
+
+    @ApiOperation(value = "数据导入_远程调用[by:zhaops]",
+            notes = "file(必填):导入文件 <br>" +
+                    "hospitalId(必填):医院id <br>" +
+                    "uesrId(必填):操作人id <br>" +
+                    "type(必填): 类型:1-化验、3-辅检、4-诊断、5-药品、6-手术和操作、7-科室、8-输血、10-量表、11-护理、12-中医诊断、13-中医证候、14-麻醉 <br>")
+    @PostMapping(value = "/importExcel_remote", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
+    @SysLogger("importExcel_remote")
+    @Transactional
+    @ApiIgnore
+    public RespDTO<List<MappingConfigWrapper>> importExcel_remote(HttpServletResponse response,
+                                                                  @RequestParam("file") MultipartFile file,
+                                                                  @RequestParam("hospitalId") Long hospitalId,
+                                                                  @RequestParam("type") Integer type,
+                                                                  @RequestParam("uesrId") String userId) {
+        List<MappingConfigWrapper> data = mappingConfigFacade.importExcel_remote(response, file, hospitalId, type, userId);
         return RespDTO.onSuc(data);
     }