|
|
@ -199,7 +199,8 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati |
|
|
|
VaccinationInfoAllExcel epidemicReportUserInfoAllExcel; |
|
|
|
VaccinationInfoDTO vaccinationInfoDTO; |
|
|
|
VaccineDto vimCompanyOrSiteByExcel; |
|
|
|
String idCard; |
|
|
|
String excelIdCard; |
|
|
|
Integer excelDose; |
|
|
|
Integer maxDose; |
|
|
|
|
|
|
|
for (int i = 0; i < recordList.size(); i++) { |
|
|
@ -207,21 +208,20 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati |
|
|
|
vaccinationInfoDTO = ConvertUtils.sourceToTarget(epidemicReportUserInfoAllExcel, VaccinationInfoDTO.class); |
|
|
|
// 校验是否存在空单元格(校验必填)
|
|
|
|
if (checkNullCell(epidemicReportUserInfoAllExcel)) { |
|
|
|
// checkInfo.append("第").append(i + 1).append("条、");
|
|
|
|
epidemicReportUserInfoAllExcel.setErrorInfo("存在空单元格"); |
|
|
|
addErrorList.add(epidemicReportUserInfoAllExcel); |
|
|
|
continue; |
|
|
|
} |
|
|
|
idCard = epidemicReportUserInfoAllExcel.getIdentityNo(); |
|
|
|
excelIdCard = epidemicReportUserInfoAllExcel.getIdentityNo(); |
|
|
|
// 人员校验
|
|
|
|
if (!allUserIdCards.contains(idCard)) { |
|
|
|
if (!allUserIdCards.contains(excelIdCard)) { |
|
|
|
epidemicReportUserInfoAllExcel.setErrorInfo("查无此人"); |
|
|
|
addErrorList.add(epidemicReportUserInfoAllExcel); |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
// 校验身份证号是否合法
|
|
|
|
if (StringUtils.isBlank(idCard) || idCard.length() != 18) { |
|
|
|
if (StringUtils.isBlank(excelIdCard) || excelIdCard.length() != 18) { |
|
|
|
epidemicReportUserInfoAllExcel.setErrorInfo("身份证号不合法"); |
|
|
|
addErrorList.add(epidemicReportUserInfoAllExcel); |
|
|
|
continue; |
|
|
@ -259,20 +259,21 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati |
|
|
|
addErrorList.add(epidemicReportUserInfoAllExcel); |
|
|
|
continue; |
|
|
|
} |
|
|
|
excelDose = epidemicReportUserInfoAllExcel.getDose(); |
|
|
|
|
|
|
|
// map用来记录身份证号的最大剂次
|
|
|
|
if (maxDoseMap.containsKey(epidemicReportUserInfoAllExcel.getIdentityNo())) { |
|
|
|
if (maxDoseMap.get(epidemicReportUserInfoAllExcel.getIdentityNo()).getVaccinationNum() < epidemicReportUserInfoAllExcel.getDose()) { |
|
|
|
if (maxDoseMap.containsKey(excelIdCard)) { |
|
|
|
if (maxDoseMap.get(excelIdCard).getVaccinationNum() < excelDose) { |
|
|
|
EpidemicUserInfoDTO dto = new EpidemicUserInfoDTO(); |
|
|
|
dto.setVaccinationNum(epidemicReportUserInfoAllExcel.getDose()); |
|
|
|
dto.setVaccinationNum(excelDose); |
|
|
|
dto.setMaxDose(maxDose); |
|
|
|
maxDoseMap.put(epidemicReportUserInfoAllExcel.getIdentityNo(), dto); |
|
|
|
maxDoseMap.put(excelIdCard, dto); |
|
|
|
} |
|
|
|
} else { |
|
|
|
EpidemicUserInfoDTO dto = new EpidemicUserInfoDTO(); |
|
|
|
dto.setVaccinationNum(epidemicReportUserInfoAllExcel.getDose()); |
|
|
|
dto.setVaccinationNum(excelDose); |
|
|
|
dto.setMaxDose(maxDose); |
|
|
|
maxDoseMap.put(epidemicReportUserInfoAllExcel.getIdentityNo(), dto); |
|
|
|
maxDoseMap.put(excelIdCard, dto); |
|
|
|
} |
|
|
|
|
|
|
|
addList.add(epidemicReportUserInfoAllExcel); |
|
|
@ -287,18 +288,29 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati |
|
|
|
|
|
|
|
List<String> idCards = new ArrayList<>(maxDoseMap.keySet()); |
|
|
|
List<EpidemicUserInfoDTO> updateList = new ArrayList<>(); |
|
|
|
EpidemicUserInfoDTO epidemicUserInfo; |
|
|
|
String idCard; |
|
|
|
|
|
|
|
if (!idCards.isEmpty()) { |
|
|
|
List<EpidemicUserInfoDTO> existUserList = epidemicUserInfoDao.selectByIdCards(idCards); |
|
|
|
EpidemicUserInfoDTO updateDto; |
|
|
|
for (EpidemicUserInfoDTO item : existUserList) { |
|
|
|
if (null == item) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
idCard = item.getIdCard(); |
|
|
|
epidemicUserInfo = maxDoseMap.get(idCard); |
|
|
|
if (null == epidemicUserInfo) { |
|
|
|
log.error(idCard); |
|
|
|
continue; |
|
|
|
} |
|
|
|
updateDto = new EpidemicUserInfoDTO(); |
|
|
|
|
|
|
|
epidemicUserInfo = maxDoseMap.get(idCard); |
|
|
|
// 已经接种完的不需要处理,excel的剂次数据小于数据库时不需要处理,已经接种完的不需要处理
|
|
|
|
if (item.getVaccinationState() != NumConstant.TWO && item.getVaccinationNum() <= maxDoseMap.get(item.getIdCard()).getVaccinationNum()) { |
|
|
|
updateDto.setIdCard(item.getIdCard()); |
|
|
|
updateDto.setVaccinationNum(maxDoseMap.get(item.getIdCard()).getVaccinationNum()); |
|
|
|
if (maxDoseMap.get(item.getIdCard()).getVaccinationNum().equals(maxDoseMap.get(item.getIdCard()).getMaxDose())) { |
|
|
|
if (item.getVaccinationState() != NumConstant.TWO && item.getVaccinationNum() <= epidemicUserInfo.getVaccinationNum()) { |
|
|
|
updateDto.setIdCard(idCard); |
|
|
|
updateDto.setVaccinationNum(epidemicUserInfo.getVaccinationNum()); |
|
|
|
if (epidemicUserInfo.getVaccinationNum().equals(epidemicUserInfo.getMaxDose())) { |
|
|
|
// 如果最大剂次同于excel的剂次就是接种完成,否则是接种中
|
|
|
|
updateDto.setVaccinationState(2); |
|
|
|
} else { |
|
|
@ -335,6 +347,7 @@ public class VaccinationInfoServiceImpl extends BaseVimCurdServiceImpl<Vaccinati |
|
|
|
return new Result().ok("数据异常,请下载Excel后重新导入!"); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
return new Result().error("数据异常,解析Excel文件失败"); |
|
|
|
} finally { |
|
|
|
// 删除文件
|
|
|
|