|
@@ -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;
|
|
|
}
|
|
|
|
|
|
/**
|