diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java index e15f7f5057..05832141a4 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java @@ -41,4 +41,9 @@ public interface ImportTaskConstants { * 处理状态:完成,但未完全成功 */ String PROCESS_STATUS_FINISHED_FAIL = "finished_fail"; + + /** + * 疫苗接种 + */ + String BIZ_TYPE_IC_VACCINE = "vaccine"; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineController.java index 65f19fc3df..2a2aa2621d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineController.java @@ -196,11 +196,11 @@ public class IcVaccineController implements ResultDataResolver { Path fileSavePath; try { - Path importPath = FileUtils.getAndCreateDirUnderEpmetFilesDir("ic_nat", "import"); + Path importPath = FileUtils.getAndCreateDirUnderEpmetFilesDir("ic_vaccine", "import"); fileSavePath = importPath.resolve(UUID.randomUUID().toString().concat(extName)); } catch (IOException e) { String errorMsg = ExceptionUtils.getErrorStackTrace(e); - log.error("【核酸检测导入】创建临时存储文件失败:{}", errorMsg); + log.error("【疫苗接种导入】创建临时存储文件失败:{}", errorMsg); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "文件上传失败", "文件上传失败"); } @@ -221,14 +221,14 @@ public class IcVaccineController implements ResultDataResolver { // 2.生成导入任务记录 ImportTaskCommonFormDTO importTaskForm = new ImportTaskCommonFormDTO(); importTaskForm.setOperatorId(userId); - importTaskForm.setBizType(ImportTaskConstants.BIZ_TYPE_IC_NAT); + importTaskForm.setBizType(ImportTaskConstants.BIZ_TYPE_IC_VACCINE); importTaskForm.setOriginFileName(originalFilename); ImportTaskCommonResultDTO rstData = getResultDataOrThrowsException(commonServiceOpenFeignClient.createImportTask(importTaskForm), ServiceConstant.EPMET_COMMON_SERVICE, EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), - "excel导入核酸检测信息错误", - "导入居民核酸检测信息失败"); + "excel导入疫苗接种信息错误", + "导入居民疫苗接种信息失败"); // 3.执行导入 icVaccineService.execAsyncExcelImport(fileSavePath, rstData.getTaskId()); @@ -315,5 +315,4 @@ public class IcVaccineController implements ResultDataResolver { } - } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcVaccineImportExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcVaccineImportExcelData.java index 3c10ff69b7..6dca8bc4bb 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcVaccineImportExcelData.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/IcVaccineImportExcelData.java @@ -11,7 +11,7 @@ import java.io.Serializable; import java.util.Date; /** - * 核酸检测信息导入excel数据 + * 疫苗接种信息导入excel数据 */ @Data public class IcVaccineImportExcelData implements Serializable { @@ -30,16 +30,17 @@ public class IcVaccineImportExcelData implements Serializable { @Length(max = 18, message = "身份证号长度不正确,应小于18位") private String idCard; - @NotNull(message = "检测时间为必填项") - @ExcelProperty("检测时间") - private Date natTime; + @NotNull(message = "接种时间为必填项") + @ExcelProperty("接种时间") + private Date inoculateTime; - @ExcelProperty("检测地点") - private String natAddress; + @NotBlank(message = "接种地点为必填项") + @ExcelProperty("接种地点") + private String inoculateAddress; - @NotBlank(message = "检测结果为必填项") - @ExcelProperty("检测结果") - private String natResultZh; + @NotBlank(message = "疫苗厂家为必填项") + @ExcelProperty("疫苗厂家") + private String manufacturer; @Data public static class RowRemarkMessage { diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcVaccineExcelImportListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcVaccineExcelImportListener.java index 027040871e..e12d4549a9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcVaccineExcelImportListener.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcVaccineExcelImportListener.java @@ -46,11 +46,11 @@ public class IcVaccineExcelImportListener implements ReadListener errorRows = new ArrayList<>(); + private List errorRows = new ArrayList<>(); /** * 其他被标记出来的列表列表 */ - private List otherRows = new ArrayList<>(); + private List otherRows = new ArrayList<>(); private IcVaccineServiceImpl icVaccineService; @@ -68,35 +68,23 @@ public class IcVaccineExcelImportListener implements ReadListener getErrorRows() { + public List getErrorRows() { return errorRows; } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java index f6cab4ae48..63e092940f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java @@ -18,10 +18,7 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.utils.*; import com.epmet.constants.ImportTaskConstants; -import com.epmet.dao.IcNatRelationDao; -import com.epmet.dao.IcResiUserDao; -import com.epmet.dao.IcVaccineDao; -import com.epmet.dao.UserBaseInfoDao; +import com.epmet.dao.*; import com.epmet.dto.IcNatDTO; import com.epmet.dto.IcNoticeDTO; import com.epmet.dto.form.AddIcNatFormDTO; @@ -32,8 +29,9 @@ import com.epmet.dto.result.*; import com.epmet.entity.IcNatRelationEntity; import com.epmet.entity.IcResiUserEntity; import com.epmet.entity.IcVaccineEntity; +import com.epmet.entity.IcVaccineRelationEntity; import com.epmet.excel.data.IcNatImportExcelData; -import com.epmet.excel.handler.IcNatExcelImportListener; +import com.epmet.excel.data.IcVaccineImportExcelData; import com.epmet.excel.handler.IcVaccineExcelImportListener; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; @@ -85,6 +83,10 @@ public class IcVaccineServiceImpl extends BaseServiceImpl otherRows = listener.getOtherRows(); + public void persisVaccine(IcVaccineEntity e, String customerId, String currentUserId, IcVaccineExcelImportListener listener) { + List otherRows = listener.getOtherRows(); String agencyPids = listener.getCurrentAgencyPids(); String agencyId = listener.getCurrentAgencyId(); - Date natTime = e.getNatTime(); String idCard = e.getIdCard(); String name = e.getName(); String mobile = e.getMobile(); - String natResult = e.getNatResult(); - String natAddress = e.getNatAddress(); + String manufacturer = e.getManufacturer(); + Date inoculateTime = e.getInoculateTime(); + String inoculateAddress = e.getInoculateAddress(); //1.先看客户下有没有这个人 - IcVaccineEntity resiNat = getResiNat(customerId, idCard, natTime); - if (resiNat != null && !"import".equals(resiNat.getUserType())) { + IcVaccineEntity resiVaccine = getResiVaccine(customerId, idCard, inoculateTime); + if (resiVaccine != null && !"import".equals(resiVaccine.getUserType())) { // 有这个人,并且不是导入的 - String message = "已存在该次核酸检测录入记录,请到系统中修改"; + String message = "已存在该次疫苗接种录入记录,请到系统中修改"; - IcNatImportExcelData.RowRemarkMessage errorRow = new IcNatImportExcelData.RowRemarkMessage(); + IcVaccineImportExcelData.RowRemarkMessage errorRow = new IcVaccineImportExcelData.RowRemarkMessage(); errorRow.setName(name); errorRow.setMobile(mobile); errorRow.setIdCard(idCard); @@ -504,39 +506,35 @@ public class IcVaccineServiceImpl extends BaseServiceImpl changedFieldNames = new ArrayList<>(); - if (!name.equals(resiNat.getName())) { - changedFieldNames.add("姓名"); - resiNat.setName(name); + Boolean isNameChanged = false; + if (!name.equals(resiVaccine.getName())) { + isNameChanged = true; + resiVaccine.setName(name); needUpdate = true; } - if (!natResult.equals(resiNat.getNatResult())) { - changedFieldNames.add("检测结果"); - resiNat.setNatResult(natResult); + if (!inoculateAddress.equals(resiVaccine.getInoculateAddress())) { + resiVaccine.setInoculateAddress(inoculateAddress); needUpdate = true; } - // 检测地点和手机号先不提示,说需要提示再提示。需要考虑两个都不为空&&不相等 || 两个中一个为空一个不为空 - if ((com.baomidou.mybatisplus.core.toolkit.StringUtils.isBlank(natAddress) && com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(resiNat.getNatAddress())) - || (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(natAddress) && com.baomidou.mybatisplus.core.toolkit.StringUtils.isBlank(resiNat.getNatAddress())) - || (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(natAddress) && com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(resiNat.getNatAddress()) && !natAddress.equals(resiNat.getNatAddress()))) { - resiNat.setNatAddress(natAddress); + if (!manufacturer.equals(resiVaccine.getManufacturer())) { + resiVaccine.setManufacturer(manufacturer); needUpdate = true; } - if (!mobile.equals(resiNat.getMobile())) { - resiNat.setMobile(mobile); + if (!mobile.equals(resiVaccine.getMobile())) { + resiVaccine.setMobile(mobile); needUpdate = true; } - if (changedFieldNames.size() > 0) { - String fieldsStr = String.join(",", changedFieldNames); - String message = "该次核酸检测记录已存在,执行更新动作," + fieldsStr + "已成功更新"; - IcNatImportExcelData.RowRemarkMessage errorRow = new IcNatImportExcelData.RowRemarkMessage(); + if (isNameChanged) { + String message = "平台存在相同记录身份证号与姓名不一致,已更新最新姓名"; + IcVaccineImportExcelData.RowRemarkMessage errorRow = new IcVaccineImportExcelData.RowRemarkMessage(); errorRow.setName(name); errorRow.setMobile(mobile); errorRow.setIdCard(idCard); @@ -545,19 +543,18 @@ public class IcVaccineServiceImpl extends BaseServiceImpl query = new LambdaQueryWrapper<>(); query.eq(IcVaccineEntity::getCustomerId, customerId); query.eq(IcVaccineEntity::getIdCard, idCard); - query.eq(IcVaccineEntity::getNatTime, natTime); + query.eq(IcVaccineEntity::getInoculateTime, natTime); return baseDao.selectOne(query); } /** - * 创建nat关系 - * @param natId + * 创建关系 + * @param vaccineId * @param currentUserAgencyId */ - private void createNatRelation(String natId, String currentUserAgencyId, String agencyPids) { + private void createVaccineRelation(String vaccineId, String currentUserAgencyId, String agencyPids) { // 没有关系创建关系,有关系就跳过 - LambdaQueryWrapper query = new LambdaQueryWrapper<>(); - query.eq(IcNatRelationEntity::getIcNatId, natId); - query.eq(IcNatRelationEntity::getAgencyId, currentUserAgencyId); - if (icNatRelationDao.selectCount(query) > 0) { + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(IcVaccineRelationEntity::getIcVaccineId, vaccineId); + query.eq(IcVaccineRelationEntity::getAgencyId, currentUserAgencyId); + if (icVaccineRelationDao.selectCount(query) > 0) { return; } - IcNatRelationEntity relation = new IcNatRelationEntity(); + IcVaccineRelationEntity relation = new IcVaccineRelationEntity(); relation.setAgencyId(currentUserAgencyId); relation.setPids(String.join(":", Arrays.asList(agencyPids, currentUserAgencyId))); - relation.setIcNatId(natId); + relation.setIcVaccineId(vaccineId); relation.setUserType("import"); - icNatRelationDao.insert(relation); + icVaccineRelationDao.insert(relation); } } diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/ic_vaccine.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/ic_vaccine.xlsx new file mode 100644 index 0000000000..b1d0b56179 Binary files /dev/null and b/epmet-user/epmet-user-server/src/main/resources/excel/ic_vaccine.xlsx differ