51 changed files with 2033 additions and 332 deletions
			
			
		| @ -0,0 +1,119 @@ | |||
| package com.epmet.dto; | |||
| 
 | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| import lombok.Data; | |||
| 
 | |||
| 
 | |||
| /** | |||
|  * 疫苗接种记录 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-04-06 | |||
|  */ | |||
| @Data | |||
| public class IcVaccineDTO implements Serializable { | |||
| 
 | |||
|     private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     /** | |||
|      * 唯一标识 | |||
|      */ | |||
| 	private String id; | |||
| 
 | |||
|     /** | |||
|      * 客户Id customer.id | |||
|      */ | |||
| 	private String customerId; | |||
| 
 | |||
|     /** | |||
|      * 姓名 | |||
|      */ | |||
| 	private String name; | |||
| 
 | |||
|     /** | |||
|      * 手机号 | |||
|      */ | |||
| 	private String mobile; | |||
| 
 | |||
|     /** | |||
|      * 身份证号 | |||
|      */ | |||
| 	private String idCard; | |||
| 
 | |||
|     /** | |||
|      * 是否客户下居民(0:否  1:是) | |||
|      */ | |||
| 	private String isResiUser; | |||
| 
 | |||
|     /** | |||
|      * 数据来源【导入的:import;】 | |||
|      */ | |||
| 	private String userType; | |||
| 
 | |||
|     /** | |||
|      * 接种时间 | |||
|      */ | |||
| 	private Date inoculateTime; | |||
| 
 | |||
|     /** | |||
|      * 接种地点 | |||
|      */ | |||
| 	private String inoculateAddress; | |||
| 
 | |||
|     /** | |||
|      * 疫苗厂家 | |||
|      */ | |||
| 	private String manufacturer; | |||
| 
 | |||
|     /** | |||
|      * 预留字段1 | |||
|      */ | |||
| 	private String field1; | |||
| 
 | |||
|     /** | |||
|      * 预留字段2 | |||
|      */ | |||
| 	private String field2; | |||
| 
 | |||
|     /** | |||
|      * 预留字段3 | |||
|      */ | |||
| 	private String field3; | |||
| 
 | |||
|     /** | |||
|      * 备注 | |||
|      */ | |||
| 	private String remaek; | |||
| 
 | |||
|     /** | |||
|      * 删除标识 0.未删除 1.已删除 | |||
|      */ | |||
| 	private Integer delFlag; | |||
| 
 | |||
|     /** | |||
|      * 乐观锁 | |||
|      */ | |||
| 	private Integer revision; | |||
| 
 | |||
|     /** | |||
|      * 创建人 | |||
|      */ | |||
| 	private String createdBy; | |||
| 
 | |||
|     /** | |||
|      * 创建时间 | |||
|      */ | |||
| 	private Date createdTime; | |||
| 
 | |||
|     /** | |||
|      * 更新人 | |||
|      */ | |||
| 	private String updatedBy; | |||
| 
 | |||
|     /** | |||
|      * 更新时间 | |||
|      */ | |||
| 	private Date updatedTime; | |||
| 
 | |||
| } | |||
| @ -0,0 +1,82 @@ | |||
| package com.epmet.dto; | |||
| 
 | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| import lombok.Data; | |||
| 
 | |||
| 
 | |||
| /** | |||
|  * 疫苗接种记录关系表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-04-06 | |||
|  */ | |||
| @Data | |||
| public class IcVaccineRelationDTO implements Serializable { | |||
| 
 | |||
|     private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     /** | |||
|      * ID | |||
|      */ | |||
| 	private String id; | |||
| 
 | |||
|     /** | |||
|      * 客户Id | |||
|      */ | |||
| 	private String customerId; | |||
| 
 | |||
|     /** | |||
|      * 居民端上报时存储用户所在网格的组织id.居民信息的人存储居民所在组织id.单个新增或者导入的存储登录用户所属的组织id | |||
|      */ | |||
| 	private String agencyId; | |||
| 
 | |||
|     /** | |||
|      * 组织pids,包含当前agencyId值 | |||
|      */ | |||
| 	private String pids; | |||
| 
 | |||
|     /** | |||
|      * 疫苗记录表Id(ic_vaccine.id) | |||
|      */ | |||
| 	private String icVaccineId; | |||
| 
 | |||
|     /** | |||
|      * 关系数据的绑定途径【 | |||
| 数字社区录入:icresi; | |||
| 导入的:import; | |||
| 同步的:synchro】 | |||
|      */ | |||
| 	private String userType; | |||
| 
 | |||
|     /** | |||
|      * 删除标识 | |||
|      */ | |||
| 	private Integer delFlag; | |||
| 
 | |||
|     /** | |||
|      * 乐观锁 | |||
|      */ | |||
| 	private Integer revision; | |||
| 
 | |||
|     /** | |||
|      * 创建人 | |||
|      */ | |||
| 	private String createdBy; | |||
| 
 | |||
|     /** | |||
|      * 创建时间 | |||
|      */ | |||
| 	private Date createdTime; | |||
| 
 | |||
|     /** | |||
|      * 更新人 | |||
|      */ | |||
| 	private String updatedBy; | |||
| 
 | |||
|     /** | |||
|      * 更新时间 | |||
|      */ | |||
| 	private Date updatedTime; | |||
| 
 | |||
| } | |||
| @ -0,0 +1,67 @@ | |||
| package com.epmet.dto.form; | |||
| 
 | |||
| import com.epmet.commons.tools.dto.form.PageFormDTO; | |||
| import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; | |||
| import lombok.Data; | |||
| 
 | |||
| import javax.validation.constraints.NotBlank; | |||
| 
 | |||
| /** | |||
|  * @Description 疫苗接种信息查询 | |||
|  * @Author sun | |||
|  */ | |||
| @Data | |||
| public class VaccineListFormDTO extends PageFormDTO { | |||
| 
 | |||
|     private static final long serialVersionUID = -6809065476616323072L; | |||
| 
 | |||
|     public interface Detail extends CustomerClientShowGroup { | |||
|     } | |||
|     public interface Del extends CustomerClientShowGroup { | |||
|     } | |||
|     public interface Synchro extends CustomerClientShowGroup { | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * 身份证号 | |||
|      */ | |||
|     private String idCard; | |||
|     /** | |||
|      * 当前组织:current 根组织:all | |||
|      */ | |||
|     private String searchType; | |||
|     private String agencyId; | |||
|     /** | |||
|      * 姓名 | |||
|      */ | |||
|     private String name; | |||
|     /** | |||
|      * 手机号 | |||
|      */ | |||
|     private String mobile; | |||
|     /** | |||
|      * 是否客户下居民(0:否  1:是) | |||
|      */ | |||
|     private String isResiUser; | |||
|     /** | |||
|      * 检测开始时间yyyy-MM-dd HH:mm | |||
|      */ | |||
|     private String startTime; | |||
|     /** | |||
|      * 检测结束时间yyyy-MM-dd HH:mm间yy-mm-dd | |||
|      */ | |||
|     private String endTime; | |||
| 
 | |||
|     /** | |||
|      * 核酸记录Id | |||
|      */ | |||
|     @NotBlank(message = "疫苗接种记录Id不能为空", groups = { Detail.class, Del.class, Synchro.class}) | |||
|     private String icVaccineId; | |||
| 
 | |||
|     /** | |||
|      * token里设置 | |||
|      */ | |||
|     private String customerId; | |||
|     private String userId; | |||
| 
 | |||
| } | |||
| @ -0,0 +1,27 @@ | |||
| package com.epmet.dto.result; | |||
| 
 | |||
| import com.alibaba.excel.annotation.ExcelProperty; | |||
| import com.alibaba.excel.annotation.write.style.ColumnWidth; | |||
| import com.alibaba.excel.annotation.write.style.HeadStyle; | |||
| import com.alibaba.excel.enums.poi.FillPatternTypeEnum; | |||
| import lombok.Data; | |||
| 
 | |||
| /** | |||
|  * @Description 疫苗接种-全局导出 | |||
|  * @Author sun | |||
|  */ | |||
| @HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 44) | |||
| @Data | |||
| public class IcVaccineListCommonExcelResultDTO extends IcVaccineListResultDTO{ | |||
|     private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     /** | |||
|      * 是否客户下居民(0:否  1:是) | |||
|      */ | |||
|     @ColumnWidth(20) | |||
|     @ExcelProperty(value = "本辖区居民",order = 6) | |||
|     private String isResiUser; | |||
| 
 | |||
| 
 | |||
| 
 | |||
| } | |||
| @ -0,0 +1,89 @@ | |||
| package com.epmet.dto.result; | |||
| 
 | |||
| import com.alibaba.excel.annotation.ExcelIgnore; | |||
| import com.alibaba.excel.annotation.ExcelProperty; | |||
| import com.alibaba.excel.annotation.write.style.ColumnWidth; | |||
| import com.alibaba.excel.annotation.write.style.HeadStyle; | |||
| import com.alibaba.excel.enums.poi.FillPatternTypeEnum; | |||
| import com.fasterxml.jackson.annotation.JsonFormat; | |||
| import lombok.Data; | |||
| 
 | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| 
 | |||
| /** | |||
|  * @Description 核酸检测-我的上报记录 | |||
|  * @Author sun | |||
|  */ | |||
| @HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 44) | |||
| @Data | |||
| public class IcVaccineListResultDTO implements Serializable { | |||
|     private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     /** | |||
|      * 组织Id | |||
|      */ | |||
|     @ExcelIgnore | |||
|     private String agencyId; | |||
| 
 | |||
|     private String vaccineId; | |||
| 
 | |||
|     private String userId; | |||
| 
 | |||
|     /** | |||
|      * 居民端小程序的人:resi;数字社区的居民:icresi;未关联上的:other | |||
|      */ | |||
|     @ExcelIgnore | |||
|     private String userType; | |||
| 
 | |||
|     /** | |||
|      * 姓名 | |||
|      */ | |||
|     @ColumnWidth(20) | |||
|     @ExcelProperty(value = "姓名",order = 1) | |||
|     private String name; | |||
| 
 | |||
|     /** | |||
|      * 手机号 | |||
|      */ | |||
|     @ColumnWidth(20) | |||
|     @ExcelProperty(value = "手机号",order = 2) | |||
|     private String mobile; | |||
| 
 | |||
|     /** | |||
|      * 身份证号 | |||
|      */ | |||
|     @ColumnWidth(25) | |||
|     @ExcelProperty(value = "身份证号",order = 3) | |||
|     private String idCard; | |||
| 
 | |||
|     /** | |||
|      * 检测时间,yyyy-MM-dd HH:mm | |||
|      */ | |||
|     @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") | |||
|     @ColumnWidth(25) | |||
|     @ExcelProperty(value = "接种时间",order = 4) | |||
|     private Date inoculateTime; | |||
| 
 | |||
|     /** | |||
|      * 检测结果 | |||
|      */ | |||
|     @ColumnWidth(20) | |||
|     @ExcelProperty(value = "接种地点",order = 5) | |||
|     private String inoculateAddress; | |||
| 
 | |||
|     /** | |||
|      * 是否客户下居民(0:否  1:是) | |||
|      */ | |||
|     @ExcelIgnore | |||
|     private String isResiUser; | |||
| 
 | |||
|     /** | |||
|      * 检测地点 | |||
|      */ | |||
|     @ColumnWidth(30) | |||
|     @ExcelProperty(value = "疫苗厂家",order = 7) | |||
|     private String manufacturer; | |||
| 
 | |||
| 
 | |||
| } | |||
| @ -0,0 +1,229 @@ | |||
| package com.epmet.controller; | |||
| 
 | |||
| import com.alibaba.excel.EasyExcel; | |||
| import com.alibaba.excel.ExcelWriter; | |||
| import com.alibaba.excel.write.metadata.WriteSheet; | |||
| import com.epmet.commons.tools.annotation.LoginUser; | |||
| import com.epmet.commons.tools.aop.NoRepeatSubmit; | |||
| import com.epmet.commons.tools.constant.AppClientConstant; | |||
| import com.epmet.commons.tools.constant.NumConstant; | |||
| import com.epmet.commons.tools.constant.ServiceConstant; | |||
| import com.epmet.commons.tools.exception.EpmetErrorCode; | |||
| import com.epmet.commons.tools.exception.EpmetException; | |||
| import com.epmet.commons.tools.exception.ExceptionUtils; | |||
| import com.epmet.commons.tools.feign.ResultDataResolver; | |||
| import com.epmet.commons.tools.page.PageData; | |||
| import com.epmet.commons.tools.security.dto.TokenDto; | |||
| import com.epmet.commons.tools.utils.*; | |||
| import com.epmet.commons.tools.validator.ValidatorUtils; | |||
| import com.epmet.constants.ImportTaskConstants; | |||
| import com.epmet.dto.form.ImportTaskCommonFormDTO; | |||
| import com.epmet.dto.form.VaccineListFormDTO; | |||
| import com.epmet.dto.result.IcVaccineListCommonExcelResultDTO; | |||
| import com.epmet.dto.result.IcVaccineListResultDTO; | |||
| import com.epmet.dto.result.ImportTaskCommonResultDTO; | |||
| import com.epmet.feign.EpmetCommonServiceOpenFeignClient; | |||
| import com.epmet.service.IcVaccineService; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.collections4.CollectionUtils; | |||
| import org.apache.commons.io.IOUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.http.HttpHeaders; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import org.springframework.web.multipart.MultipartFile; | |||
| 
 | |||
| import javax.servlet.ServletOutputStream; | |||
| import javax.servlet.http.HttpServletResponse; | |||
| import java.io.FileOutputStream; | |||
| import java.io.IOException; | |||
| import java.io.InputStream; | |||
| import java.net.URLEncoder; | |||
| import java.nio.file.Path; | |||
| import java.util.List; | |||
| import java.util.UUID; | |||
| 
 | |||
| 
 | |||
| /** | |||
|  * 疫苗接种记录 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-04-06 | |||
|  */ | |||
| @Slf4j | |||
| @RestController | |||
| @RequestMapping("icVaccine") | |||
| public class IcVaccineController  implements ResultDataResolver { | |||
| 
 | |||
|     @Autowired | |||
|     private IcVaccineService icVaccineService; | |||
| 
 | |||
|     @Autowired | |||
|     private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; | |||
| 
 | |||
|     /** | |||
|      * @Author sun | |||
|      * @Description 【疫苗】疫苗接种信息列表 | |||
|      **/ | |||
|     @NoRepeatSubmit | |||
|     @PostMapping("vaccine-list") | |||
|     public Result<PageData<IcVaccineListResultDTO>> vaccineList(@LoginUser TokenDto tokenDto, @RequestBody VaccineListFormDTO formDTO) { | |||
|         formDTO.setCustomerId(tokenDto.getCustomerId()); | |||
|         formDTO.setUserId(tokenDto.getUserId()); | |||
|         return new Result<PageData<IcVaccineListResultDTO>>().ok(icVaccineService.icVaccineList(formDTO)); | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * @Author zxc | |||
|      * @Description 【疫苗】疫苗接种信息同步 | |||
|      **/ | |||
|     @NoRepeatSubmit | |||
|     @PostMapping("synchro") | |||
|     public Result synchro(@LoginUser TokenDto tokenDto, @RequestBody VaccineListFormDTO formDTO) { | |||
|         ValidatorUtils.validateEntity(formDTO, VaccineListFormDTO.Synchro.class); | |||
|         formDTO.setCustomerId(tokenDto.getCustomerId()); | |||
|         formDTO.setUserId(tokenDto.getUserId()); | |||
|         icVaccineService.synchro(formDTO); | |||
|         return new Result(); | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * @Author zxc | |||
|      * @Description 【疫苗】疫苗接种信息取消同步 | |||
|      **/ | |||
|     @NoRepeatSubmit | |||
|     @PostMapping("cancelsynchro") | |||
|     public Result cancelSynchro(@LoginUser TokenDto tokenDto, @RequestBody VaccineListFormDTO formDTO) { | |||
|         ValidatorUtils.validateEntity(formDTO, VaccineListFormDTO.Synchro.class); | |||
|         formDTO.setCustomerId(tokenDto.getCustomerId()); | |||
|         formDTO.setUserId(tokenDto.getUserId()); | |||
|         icVaccineService.cancelSynchro(formDTO); | |||
|         return new Result<>(); | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * 导入excel | |||
|      * @return | |||
|      */ | |||
|     @PostMapping("import") | |||
|     public Result importExcel(MultipartFile file) { | |||
|         String userId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID); | |||
| 
 | |||
|         // 1.暂存文件
 | |||
|         String originalFilename = file.getOriginalFilename(); | |||
|         String extName = originalFilename.substring(originalFilename.lastIndexOf(".")); | |||
| 
 | |||
|         Path fileSavePath; | |||
|         try { | |||
|             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); | |||
|             throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "文件上传失败", "文件上传失败"); | |||
|         } | |||
| 
 | |||
|         InputStream is = null; | |||
|         FileOutputStream os = null; | |||
| 
 | |||
|         try { | |||
|             is = file.getInputStream(); | |||
|             os = new FileOutputStream(fileSavePath.toString()); | |||
|             IOUtils.copy(is, os); | |||
|         } catch (Exception e) { | |||
|             log.error("importExcel exception", e); | |||
|         } finally { | |||
|             org.apache.poi.util.IOUtils.closeQuietly(is); | |||
|             org.apache.poi.util.IOUtils.closeQuietly(os); | |||
|         } | |||
| 
 | |||
|         // 2.生成导入任务记录
 | |||
|         ImportTaskCommonFormDTO importTaskForm = new ImportTaskCommonFormDTO(); | |||
|         importTaskForm.setOperatorId(userId); | |||
|         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导入疫苗接种信息错误", | |||
|                 "导入居民疫苗接种信息失败"); | |||
| 
 | |||
|         // 3.执行导入
 | |||
|         icVaccineService.execAsyncExcelImport(fileSavePath, rstData.getTaskId()); | |||
| 
 | |||
|         return new Result(); | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * @Author zxc | |||
|      * @Description 【疫苗】疫苗接种信息下载模板 | |||
|      **/ | |||
|     @RequestMapping(value = "import-template-download", method = {RequestMethod.GET, RequestMethod.POST}) | |||
|     public void downloadTemplate(HttpServletResponse response) throws IOException { | |||
|         response.setCharacterEncoding("UTF-8"); | |||
|         response.addHeader(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, "Content-Disposition"); | |||
|         response.setHeader(HttpHeaders.CONTENT_TYPE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); | |||
|         response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;filename=" + URLEncoder.encode("疫苗接种导入模板", "UTF-8") + ".xlsx"); | |||
| 
 | |||
|         InputStream is = this.getClass().getClassLoader().getResourceAsStream("excel/ic_vaccine.xlsx"); | |||
|         try { | |||
|             ServletOutputStream os = response.getOutputStream(); | |||
|             IOUtils.copy(is, os); | |||
|         } finally { | |||
|             if (is != null) { | |||
|                 is.close(); | |||
|             } | |||
|         } | |||
| 
 | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * @Author sun | |||
|      * @Description 【疫苗】疫苗接种信息列表 | |||
|      **/ | |||
|     @NoRepeatSubmit | |||
|     @PostMapping("export") | |||
|     public void export(@LoginUser TokenDto tokenDto, @RequestBody VaccineListFormDTO formDTO, HttpServletResponse response) { | |||
|         formDTO.setCustomerId(tokenDto.getCustomerId()); | |||
|         formDTO.setUserId(tokenDto.getUserId()); | |||
|         formDTO.setIsPage(false); | |||
|         ExcelWriter excelWriter = null; | |||
|         formDTO.setPageSize(NumConstant.TEN_THOUSAND); | |||
|         int pageNo = formDTO.getPageNo(); | |||
|         try { | |||
|             // 这里 需要指定写用哪个class去写
 | |||
|             String fileName = "疫苗接种信息.xlsx"; | |||
|             if ("all".equals(formDTO.getSearchType())) { | |||
|                 excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcVaccineListResultDTO.class).build(); | |||
|             }else { | |||
|                 excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcVaccineListCommonExcelResultDTO.class).build(); | |||
|             } | |||
| 
 | |||
|             WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").build(); | |||
|             PageData<IcVaccineListResultDTO> data = null; | |||
|             do { | |||
|                 data = icVaccineService.icVaccineList(formDTO); | |||
|                 data.getList().forEach(o-> { | |||
|                     o.setIsResiUser(NumConstant.ONE_STR.equals(o.getIsResiUser()) ? "是" : "否"); | |||
|                 }); | |||
|                 formDTO.setPageNo(++pageNo); | |||
|                 if ("current".equals(formDTO.getSearchType())) { | |||
|                     List<IcVaccineListResultDTO> list = ConvertUtils.sourceToTarget(data.getList(), IcVaccineListResultDTO.class); | |||
|                     excelWriter.write(list, writeSheet); | |||
|                 }else{ | |||
|                     excelWriter.write(data.getList(), writeSheet); | |||
|                 } | |||
|             } while (CollectionUtils.isNotEmpty(data.getList()) && data.getList().size() == formDTO.getPageSize()); | |||
| 
 | |||
|         }catch (Exception e){ | |||
|             log.error("export exception", e); | |||
|         }finally { | |||
|             // 千万别忘记finish 会帮忙关闭流
 | |||
|             if (excelWriter != null) { | |||
|                 excelWriter.finish(); | |||
|             } | |||
|         } | |||
|     } | |||
| 
 | |||
| 
 | |||
| } | |||
| @ -1,16 +0,0 @@ | |||
| package com.epmet.dao; | |||
| 
 | |||
| import com.epmet.commons.mybatis.dao.BaseDao; | |||
| import com.epmet.entity.IcResiVaccineEntity; | |||
| import org.apache.ibatis.annotations.Mapper; | |||
| 
 | |||
| /** | |||
|  * 居民疫苗情况 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-03-28 | |||
|  */ | |||
| @Mapper | |||
| public interface IcResiVaccineDao extends BaseDao<IcResiVaccineEntity> { | |||
| 	 | |||
| } | |||
| @ -0,0 +1,71 @@ | |||
| package com.epmet.dao; | |||
| 
 | |||
| import com.epmet.commons.mybatis.dao.BaseDao; | |||
| import com.epmet.dto.IcNatDTO; | |||
| import com.epmet.dto.form.MyNatListFormDTO; | |||
| import com.epmet.dto.form.VaccineListFormDTO; | |||
| import com.epmet.dto.result.IcVaccineListResultDTO; | |||
| import com.epmet.dto.result.MyNatListResultDTO; | |||
| import com.epmet.dto.result.NatListResultDTO; | |||
| import com.epmet.entity.IcVaccineEntity; | |||
| import org.apache.ibatis.annotations.Mapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| 
 | |||
| import java.util.List; | |||
| 
 | |||
| /** | |||
|  * 疫苗接种记录 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-04-06 | |||
|  */ | |||
| @Mapper | |||
| public interface IcVaccineDao extends BaseDao<IcVaccineEntity> { | |||
|     /** | |||
|      * @Author sun | |||
|      * @Description 核酸检测-按条件查询核酸记录 | |||
|      **/ | |||
|     List<MyNatListResultDTO> getMyNatList(MyNatListFormDTO formDTO); | |||
| 
 | |||
|     /** | |||
|      * @Author sun | |||
|      * @Description 【核酸】本辖区核酸检测信息列表 | |||
|      * | |||
|      * @param formDTO*/ | |||
|     List<IcVaccineListResultDTO> getIcVaccineList(VaccineListFormDTO formDTO); | |||
| 
 | |||
|     /** | |||
|      * @Author sun | |||
|      * @Description 【核酸】客户下核酸检测信息列表 | |||
|      * | |||
|      * @param formDTO*/ | |||
|     List<IcVaccineListResultDTO> getCustomerIcVaccineList(VaccineListFormDTO formDTO); | |||
| 
 | |||
|     /** | |||
|      * @Author sun | |||
|      * @Description 删除操作--物理删除业务数据 | |||
|      **/ | |||
|     int delById(@Param("icNatId") String icNatId); | |||
| 
 | |||
|     /** | |||
|      * 插入或者更新 | |||
|      * | |||
|      * @param e | |||
|      */ | |||
|     void insertOrUpdate(IcVaccineEntity e); | |||
| 
 | |||
|     /** | |||
|      * @Author sun | |||
|      * @Description 按条件查询业务数据 | |||
|      **/ | |||
|     IcNatDTO getNatDTO(@Param("customerId") String customerId, @Param("icNatId") String icNatId, @Param("idCard") String idCard, @Param("natTime") String natTime, @Param("natResult") String natResult); | |||
| 
 | |||
|     /** | |||
|      * desc:根据客户id 更新是否居民状态 | |||
|      * | |||
|      * @param customerId | |||
|      * @param icResiUserId 如果为空则更新全部 | |||
|      * @return | |||
|      */ | |||
|     int updateIsResiFlag(@Param("customerId") String customerId, @Param("icResiUserId") String icResiUserId); | |||
| } | |||
| @ -0,0 +1,17 @@ | |||
| package com.epmet.dao; | |||
| 
 | |||
| import com.epmet.commons.mybatis.dao.BaseDao; | |||
| import com.epmet.entity.IcVaccineRelationEntity; | |||
| import org.apache.ibatis.annotations.Mapper; | |||
| import org.apache.ibatis.annotations.Param; | |||
| 
 | |||
| /** | |||
|  * 疫苗接种记录关系表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-04-06 | |||
|  */ | |||
| @Mapper | |||
| public interface IcVaccineRelationDao extends BaseDao<IcVaccineRelationEntity> { | |||
|     int delRelation(@Param("icVaccineId") String icNatId, @Param("agencyId") String agencyId); | |||
| } | |||
| @ -0,0 +1,55 @@ | |||
| package com.epmet.entity; | |||
| 
 | |||
| import com.baomidou.mybatisplus.annotation.FieldFill; | |||
| import com.baomidou.mybatisplus.annotation.TableField; | |||
| import com.baomidou.mybatisplus.annotation.TableName; | |||
| 
 | |||
| import com.epmet.commons.mybatis.entity.BaseEpmetEntity; | |||
| import lombok.Data; | |||
| import lombok.EqualsAndHashCode; | |||
| 
 | |||
| import java.util.Date; | |||
| 
 | |||
| /** | |||
|  * 疫苗接种记录关系表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-04-06 | |||
|  */ | |||
| @Data | |||
| @EqualsAndHashCode(callSuper=false) | |||
| @TableName("ic_vaccine_relation") | |||
| public class IcVaccineRelationEntity extends BaseEpmetEntity { | |||
| 
 | |||
| 	private static final long serialVersionUID = 1L; | |||
| 
 | |||
|     /** | |||
|      * 客户Id | |||
|      */ | |||
|     @TableField(fill = FieldFill.INSERT) | |||
| 	private String customerId; | |||
| 
 | |||
|     /** | |||
|      * 居民端上报时存储用户所在网格的组织id.居民信息的人存储居民所在组织id.单个新增或者导入的存储登录用户所属的组织id | |||
|      */ | |||
| 	private String agencyId; | |||
| 
 | |||
|     /** | |||
|      * 组织pids,包含当前agencyId值 | |||
|      */ | |||
| 	private String pids; | |||
| 
 | |||
|     /** | |||
|      * 疫苗记录表Id(ic_vaccine.id) | |||
|      */ | |||
| 	private String icVaccineId; | |||
| 
 | |||
|     /** | |||
|      * 关系数据的绑定途径【 | |||
| 数字社区录入:icresi; | |||
| 导入的:import; | |||
| 同步的:synchro】 | |||
|      */ | |||
| 	private String userType; | |||
| 
 | |||
| } | |||
| @ -0,0 +1,64 @@ | |||
| package com.epmet.excel.data; | |||
| 
 | |||
| import com.alibaba.excel.annotation.ExcelProperty; | |||
| import com.alibaba.excel.annotation.write.style.ColumnWidth; | |||
| import lombok.Data; | |||
| import org.hibernate.validator.constraints.Length; | |||
| 
 | |||
| import javax.validation.constraints.NotBlank; | |||
| import javax.validation.constraints.NotNull; | |||
| import java.io.Serializable; | |||
| import java.util.Date; | |||
| 
 | |||
| /** | |||
|  * 疫苗接种信息导入excel数据 | |||
|  */ | |||
| @Data | |||
| public class IcVaccineImportExcelData implements Serializable { | |||
| 
 | |||
|     private static final long serialVersionUID = -700535059296633797L; | |||
|     @NotBlank(message = "姓名为必填项") | |||
|     @ExcelProperty("姓名") | |||
|     private String name; | |||
| 
 | |||
|     @NotBlank(message = "手机号为必填项") | |||
|     @ExcelProperty("手机号") | |||
|     private String mobile; | |||
| 
 | |||
|     @NotBlank(message = "身份证号为必填项") | |||
|     @ExcelProperty("身份证号") | |||
|     @Length(max = 18, message = "身份证号长度不正确,应小于18位") | |||
|     private String idCard; | |||
| 
 | |||
|     @NotNull(message = "接种时间为必填项") | |||
|     @ExcelProperty("接种时间") | |||
|     private Date inoculateTime; | |||
| 
 | |||
|     @NotBlank(message = "接种地点为必填项") | |||
|     @ExcelProperty("接种地点") | |||
|     private String inoculateAddress; | |||
| 
 | |||
|     @NotBlank(message = "疫苗厂家为必填项") | |||
|     @ExcelProperty("疫苗厂家") | |||
|     private String manufacturer; | |||
| 
 | |||
|     @Data | |||
|     public static class RowRemarkMessage { | |||
| 
 | |||
|         @ExcelProperty("姓名") | |||
|         @ColumnWidth(20) | |||
|         private String name; | |||
| 
 | |||
|         @ExcelProperty("手机号") | |||
|         @ColumnWidth(20) | |||
|         private String mobile; | |||
| 
 | |||
|         @ColumnWidth(20) | |||
|         @ExcelProperty("身份证号") | |||
|         private String idCard; | |||
| 
 | |||
|         @ColumnWidth(60) | |||
|         @ExcelProperty("错误信息") | |||
|         private String errorInfo; | |||
|     } | |||
| } | |||
| @ -0,0 +1,136 @@ | |||
| package com.epmet.excel.handler; | |||
| 
 | |||
| import com.alibaba.excel.context.AnalysisContext; | |||
| import com.alibaba.excel.read.listener.ReadListener; | |||
| import com.epmet.commons.tools.exception.ExceptionUtils; | |||
| import com.epmet.commons.tools.exception.ValidateException; | |||
| import com.epmet.commons.tools.utils.ConvertUtils; | |||
| import com.epmet.commons.tools.validator.ValidatorUtils; | |||
| import com.epmet.entity.IcVaccineEntity; | |||
| import com.epmet.excel.data.IcNatImportExcelData; | |||
| import com.epmet.excel.data.IcVaccineImportExcelData; | |||
| import com.epmet.service.impl.IcNatServiceImpl; | |||
| import com.epmet.service.impl.IcVaccineServiceImpl; | |||
| import lombok.Data; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| 
 | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| 
 | |||
| /** | |||
|  * 核酸检测excel导入监听器 | |||
|  */ | |||
| @Data | |||
| @Slf4j | |||
| public class IcVaccineExcelImportListener implements ReadListener<IcVaccineImportExcelData> { | |||
| 
 | |||
|     /** | |||
|      * 最大条数阈值 | |||
|      */ | |||
|     public static final int MAX_THRESHOLD = 200; | |||
| 
 | |||
|     private String currentUserId; | |||
|     /** | |||
|      * 当前组织ID | |||
|      */ | |||
|     private String currentAgencyId; | |||
| 
 | |||
|     private String currentAgencyPids; | |||
| 
 | |||
|     /** | |||
|      * 数据 | |||
|      */ | |||
|     private List<IcVaccineEntity> datas = new ArrayList<>(); | |||
| 
 | |||
|     /** | |||
|      * 错误项列表 | |||
|      */ | |||
|     private List<IcVaccineImportExcelData.RowRemarkMessage> errorRows = new ArrayList<>(); | |||
|     /** | |||
|      * 其他被标记出来的列表列表 | |||
|      */ | |||
|     private List<IcVaccineImportExcelData.RowRemarkMessage> otherRows = new ArrayList<>(); | |||
| 
 | |||
|     private IcVaccineServiceImpl icVaccineService; | |||
| 
 | |||
|     public IcVaccineExcelImportListener(String currentUserId, String currentAgencyId, String currentAgencyPids, IcVaccineServiceImpl icVaccineService) { | |||
|         this.currentUserId = currentUserId; | |||
|         this.currentAgencyId = currentAgencyId; | |||
|         this.currentAgencyPids = currentAgencyPids; | |||
|         this.icVaccineService = icVaccineService; | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     public void invoke(IcVaccineImportExcelData data, AnalysisContext context) { | |||
| 
 | |||
|         try { | |||
|             // 先校验数据
 | |||
|             ValidatorUtils.validateEntity(data); | |||
| 
 | |||
|             // 取出前后空格
 | |||
|             if (StringUtils.isNotBlank(data.getName())) { | |||
|                 data.setName(data.getName().trim()); | |||
|             } | |||
|             if (StringUtils.isNotBlank(data.getMobile())) { | |||
|                 data.setMobile(data.getMobile().trim()); | |||
|             } | |||
|             if (StringUtils.isNotBlank(data.getInoculateAddress())) { | |||
|                 data.setInoculateAddress(data.getInoculateAddress().trim()); | |||
|             } | |||
|             if (StringUtils.isNotBlank(data.getIdCard())) { | |||
|                 data.setIdCard(data.getIdCard().trim()); | |||
|             } | |||
| 
 | |||
|             IcVaccineEntity icVaccineEntity = ConvertUtils.sourceToTarget(data, IcVaccineEntity.class); | |||
|             icVaccineEntity.setUserType("import"); | |||
|             datas.add(icVaccineEntity); | |||
| 
 | |||
|             if (datas.size() == MAX_THRESHOLD) { | |||
|                 execPersist(); | |||
|             } | |||
|         } catch (Exception e) { | |||
|             String errorMsg = null; | |||
|             if (e instanceof ValidateException) { | |||
|                 errorMsg = ((ValidateException) e).getMsg(); | |||
|             } else { | |||
|                 errorMsg = "未知错误"; | |||
|                 log.error("【疫苗接种信息导入】出错:{}", ExceptionUtils.getErrorStackTrace(e)); | |||
|             } | |||
| 
 | |||
|             IcVaccineImportExcelData.RowRemarkMessage errorRow = new IcVaccineImportExcelData.RowRemarkMessage(); | |||
|             errorRow.setName(data.getName()); | |||
|             errorRow.setMobile(data.getMobile()); | |||
|             errorRow.setIdCard(data.getIdCard()); | |||
|             errorRow.setErrorInfo(errorMsg); | |||
|             errorRows.add(errorRow); | |||
|         } | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     public void doAfterAllAnalysed(AnalysisContext context) { | |||
|         // 最后几条达不到阈值,这里必须再调用一次
 | |||
|         execPersist(); | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * 执行持久化 | |||
|      */ | |||
|     private void execPersist() { | |||
|         try { | |||
|             if (datas != null && datas.size() > 0) { | |||
|                 icVaccineService.batchPersist(datas, this); | |||
|             } | |||
|         } finally { | |||
|             datas.clear(); | |||
|         } | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * 获取错误行 | |||
|      * @return | |||
|      */ | |||
|     public List<IcVaccineImportExcelData.RowRemarkMessage> getErrorRows() { | |||
|         return errorRows; | |||
|     } | |||
| } | |||
| @ -1,89 +0,0 @@ | |||
| package com.epmet.service; | |||
| 
 | |||
| import com.epmet.commons.mybatis.service.BaseService; | |||
| import com.epmet.commons.tools.page.PageData; | |||
| import com.epmet.dto.IcResiVaccineDTO; | |||
| import com.epmet.dto.result.VaccineListDTO; | |||
| import com.epmet.entity.IcResiVaccineEntity; | |||
| 
 | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| 
 | |||
| /** | |||
|  * 居民疫苗情况 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-03-28 | |||
|  */ | |||
| public interface IcResiVaccineService extends BaseService<IcResiVaccineEntity> { | |||
| 
 | |||
|     /** | |||
|      * 默认分页 | |||
|      * | |||
|      * @param params | |||
|      * @return PageData<IcResiVaccineDTO> | |||
|      * @author generator | |||
|      * @date 2022-03-28 | |||
|      */ | |||
|     PageData<IcResiVaccineDTO> page(Map<String, Object> params); | |||
| 
 | |||
|     /** | |||
|      * 默认查询 | |||
|      * | |||
|      * @param params | |||
|      * @return java.util.List<IcResiVaccineDTO> | |||
|      * @author generator | |||
|      * @date 2022-03-28 | |||
|      */ | |||
|     List<IcResiVaccineDTO> list(Map<String, Object> params); | |||
| 
 | |||
|     /** | |||
|      * 单条查询 | |||
|      * | |||
|      * @param id | |||
|      * @return IcResiVaccineDTO | |||
|      * @author generator | |||
|      * @date 2022-03-28 | |||
|      */ | |||
|     IcResiVaccineDTO get(String id); | |||
| 
 | |||
|     /** | |||
|      * 默认保存 | |||
|      * | |||
|      * @param dto | |||
|      * @return void | |||
|      * @author generator | |||
|      * @date 2022-03-28 | |||
|      */ | |||
|     void save(IcResiVaccineDTO dto); | |||
| 
 | |||
|     /** | |||
|      * 默认更新 | |||
|      * | |||
|      * @param dto | |||
|      * @return void | |||
|      * @author generator | |||
|      * @date 2022-03-28 | |||
|      */ | |||
|     void update(IcResiVaccineDTO dto); | |||
| 
 | |||
|     /** | |||
|      * 批量删除 | |||
|      * | |||
|      * @param ids | |||
|      * @return void | |||
|      * @author generator | |||
|      * @date 2022-03-28 | |||
|      */ | |||
|     void delete(String[] ids); | |||
| 
 | |||
|     /** | |||
|      * 获取居民疫苗接种信息 | |||
|      * | |||
|      * @Param idCard | |||
|      * @Return {@link List< VaccineListDTO>} | |||
|      * @Author zhaoqifeng | |||
|      * @Date 2022/3/30 10:24 | |||
|      */ | |||
|     List<VaccineListDTO> getVaccineList(String customerId, String idCard); | |||
| } | |||
| @ -0,0 +1,78 @@ | |||
| package com.epmet.service; | |||
| 
 | |||
| import com.epmet.commons.mybatis.service.BaseService; | |||
| import com.epmet.commons.tools.page.PageData; | |||
| import com.epmet.dto.IcVaccineRelationDTO; | |||
| import com.epmet.entity.IcVaccineRelationEntity; | |||
| 
 | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| 
 | |||
| /** | |||
|  * 疫苗接种记录关系表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-04-06 | |||
|  */ | |||
| public interface IcVaccineRelationService extends BaseService<IcVaccineRelationEntity> { | |||
| 
 | |||
|     /** | |||
|      * 默认分页 | |||
|      * | |||
|      * @param params | |||
|      * @return PageData<IcVaccineRelationDTO> | |||
|      * @author generator | |||
|      * @date 2022-04-06 | |||
|      */ | |||
|     PageData<IcVaccineRelationDTO> page(Map<String, Object> params); | |||
| 
 | |||
|     /** | |||
|      * 默认查询 | |||
|      * | |||
|      * @param params | |||
|      * @return java.util.List<IcVaccineRelationDTO> | |||
|      * @author generator | |||
|      * @date 2022-04-06 | |||
|      */ | |||
|     List<IcVaccineRelationDTO> list(Map<String, Object> params); | |||
| 
 | |||
|     /** | |||
|      * 单条查询 | |||
|      * | |||
|      * @param id | |||
|      * @return IcVaccineRelationDTO | |||
|      * @author generator | |||
|      * @date 2022-04-06 | |||
|      */ | |||
|     IcVaccineRelationDTO get(String id); | |||
| 
 | |||
|     /** | |||
|      * 默认保存 | |||
|      * | |||
|      * @param dto | |||
|      * @return void | |||
|      * @author generator | |||
|      * @date 2022-04-06 | |||
|      */ | |||
|     void save(IcVaccineRelationDTO dto); | |||
| 
 | |||
|     /** | |||
|      * 默认更新 | |||
|      * | |||
|      * @param dto | |||
|      * @return void | |||
|      * @author generator | |||
|      * @date 2022-04-06 | |||
|      */ | |||
|     void update(IcVaccineRelationDTO dto); | |||
| 
 | |||
|     /** | |||
|      * 批量删除 | |||
|      * | |||
|      * @param ids | |||
|      * @return void | |||
|      * @author generator | |||
|      * @date 2022-04-06 | |||
|      */ | |||
|     void delete(String[] ids); | |||
| } | |||
| @ -0,0 +1,56 @@ | |||
| package com.epmet.service; | |||
| 
 | |||
| import com.epmet.commons.mybatis.service.BaseService; | |||
| import com.epmet.commons.tools.page.PageData; | |||
| import com.epmet.dto.form.VaccineListFormDTO; | |||
| import com.epmet.dto.result.IcVaccineListResultDTO; | |||
| import com.epmet.dto.result.VaccineListDTO; | |||
| import com.epmet.entity.IcVaccineEntity; | |||
| 
 | |||
| import java.nio.file.Path; | |||
| import java.util.List; | |||
| 
 | |||
| /** | |||
|  * 疫苗接种记录 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-04-06 | |||
|  */ | |||
| public interface IcVaccineService extends BaseService<IcVaccineEntity> { | |||
| 
 | |||
|     /** | |||
|      * @Author sun | |||
|      * @Description 【核酸】核酸检测信息列表 | |||
|      * | |||
|      * @param formDTO | |||
|      * @return*/ | |||
|     PageData<IcVaccineListResultDTO> icVaccineList(VaccineListFormDTO formDTO); | |||
| 
 | |||
|     /** | |||
|      * @Author zxc | |||
|      * @Description 【核酸】核酸检测信息同步 | |||
|      **/ | |||
|     void synchro(VaccineListFormDTO formDTO); | |||
| 
 | |||
|     /** | |||
|      * @Author zxc | |||
|      * @Description 【核酸】核酸检测信息取消同步 | |||
|      **/ | |||
|     void cancelSynchro(VaccineListFormDTO formDTO); | |||
| 
 | |||
|     /** | |||
|      * 执行Excel导入 | |||
|      * @param filePath | |||
|      */ | |||
|     void execAsyncExcelImport(Path filePath, String importTaskId); | |||
| 
 | |||
|     /** | |||
|      * 获取居民疫苗接种信息 | |||
|      * | |||
|      * @Param idCard | |||
|      * @Return {@link List <VaccineListDTO>} | |||
|      * @Author zhaoqifeng | |||
|      * @Date 2022/3/30 10:24 | |||
|      */ | |||
|     List<VaccineListDTO> getVaccineList(String customerId, String idCard); | |||
| } | |||
| @ -1,116 +0,0 @@ | |||
| package com.epmet.service.impl; | |||
| 
 | |||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.baomidou.mybatisplus.core.metadata.IPage; | |||
| import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | |||
| import com.epmet.commons.tools.constant.FieldConstant; | |||
| import com.epmet.commons.tools.page.PageData; | |||
| import com.epmet.commons.tools.utils.ConvertUtils; | |||
| import com.epmet.commons.tools.utils.DateUtils; | |||
| import com.epmet.dao.IcResiVaccineDao; | |||
| import com.epmet.dto.IcResiVaccineDTO; | |||
| import com.epmet.dto.result.VaccineListDTO; | |||
| import com.epmet.entity.IcResiVaccineEntity; | |||
| import com.epmet.service.IcResiVaccineService; | |||
| import org.apache.commons.collections4.CollectionUtils; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| 
 | |||
| import java.util.Arrays; | |||
| import java.util.Collections; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.stream.Collectors; | |||
| 
 | |||
| /** | |||
|  * 居民疫苗情况 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-03-28 | |||
|  */ | |||
| @Service | |||
| public class IcResiVaccineServiceImpl extends BaseServiceImpl<IcResiVaccineDao, IcResiVaccineEntity> implements IcResiVaccineService { | |||
| 
 | |||
|     @Override | |||
|     public PageData<IcResiVaccineDTO> page(Map<String, Object> params) { | |||
|         IPage<IcResiVaccineEntity> page = baseDao.selectPage( | |||
|                 getPage(params, FieldConstant.CREATED_TIME, false), | |||
|                 getWrapper(params) | |||
|         ); | |||
|         return getPageData(page, IcResiVaccineDTO.class); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     public List<IcResiVaccineDTO> list(Map<String, Object> params) { | |||
|         List<IcResiVaccineEntity> entityList = baseDao.selectList(getWrapper(params)); | |||
| 
 | |||
|         return ConvertUtils.sourceToTarget(entityList, IcResiVaccineDTO.class); | |||
|     } | |||
| 
 | |||
|     private QueryWrapper<IcResiVaccineEntity> getWrapper(Map<String, Object> params){ | |||
|         String id = (String)params.get(FieldConstant.ID_HUMP); | |||
| 
 | |||
|         QueryWrapper<IcResiVaccineEntity> wrapper = new QueryWrapper<>(); | |||
|         wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); | |||
| 
 | |||
|         return wrapper; | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     public IcResiVaccineDTO get(String id) { | |||
|         IcResiVaccineEntity entity = baseDao.selectById(id); | |||
|         return ConvertUtils.sourceToTarget(entity, IcResiVaccineDTO.class); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     @Transactional(rollbackFor = Exception.class) | |||
|     public void save(IcResiVaccineDTO dto) { | |||
|         IcResiVaccineEntity entity = ConvertUtils.sourceToTarget(dto, IcResiVaccineEntity.class); | |||
|         insert(entity); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     @Transactional(rollbackFor = Exception.class) | |||
|     public void update(IcResiVaccineDTO dto) { | |||
|         IcResiVaccineEntity entity = ConvertUtils.sourceToTarget(dto, IcResiVaccineEntity.class); | |||
|         updateById(entity); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     @Transactional(rollbackFor = Exception.class) | |||
|     public void delete(String[] ids) { | |||
|         // 逻辑删除(@TableLogic 注解)
 | |||
|         baseDao.deleteBatchIds(Arrays.asList(ids)); | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * 获取居民疫苗接种信息 | |||
|      * | |||
|      * @param idCard | |||
|      * @Param idCard | |||
|      * @Return {@link List<  VaccineListDTO >} | |||
|      * @Author zhaoqifeng | |||
|      * @Date 2022/3/30 10:24 | |||
|      */ | |||
|     @Override | |||
|     public List<VaccineListDTO> getVaccineList(String customerId, String idCard) { | |||
|         LambdaQueryWrapper<IcResiVaccineEntity> wrapper = new LambdaQueryWrapper<>(); | |||
|         wrapper.eq(IcResiVaccineEntity::getCustomerId, customerId); | |||
|         wrapper.eq(IcResiVaccineEntity::getIdCard, idCard); | |||
|         wrapper.orderByDesc(IcResiVaccineEntity::getInoculateTime); | |||
|         List<IcResiVaccineEntity> list = baseDao.selectList(wrapper); | |||
|         if (CollectionUtils.isEmpty(list)) { | |||
|             return Collections.emptyList(); | |||
|         } | |||
|         return list.stream().map(item -> { | |||
|             VaccineListDTO dto = new VaccineListDTO(); | |||
|             dto.setAddress(item.getInoculateAddress()); | |||
|             dto.setManufactor(item.getManufacturer()); | |||
|             dto.setVaccinateTime(DateUtils.format(item.getInoculateTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE)); | |||
|             return dto; | |||
|         }).collect(Collectors.toList()); | |||
|     } | |||
| 
 | |||
| } | |||
| @ -0,0 +1,82 @@ | |||
| package com.epmet.service.impl; | |||
| 
 | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.baomidou.mybatisplus.core.metadata.IPage; | |||
| import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | |||
| import com.epmet.commons.tools.page.PageData; | |||
| import com.epmet.commons.tools.utils.ConvertUtils; | |||
| import com.epmet.commons.tools.constant.FieldConstant; | |||
| import com.epmet.dao.IcVaccineRelationDao; | |||
| import com.epmet.dto.IcVaccineRelationDTO; | |||
| import com.epmet.entity.IcVaccineRelationEntity; | |||
| import com.epmet.service.IcVaccineRelationService; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| 
 | |||
| import java.util.Arrays; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| 
 | |||
| /** | |||
|  * 疫苗接种记录关系表 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-04-06 | |||
|  */ | |||
| @Service | |||
| public class IcVaccineRelationServiceImpl extends BaseServiceImpl<IcVaccineRelationDao, IcVaccineRelationEntity> implements IcVaccineRelationService { | |||
| 
 | |||
|     @Override | |||
|     public PageData<IcVaccineRelationDTO> page(Map<String, Object> params) { | |||
|         IPage<IcVaccineRelationEntity> page = baseDao.selectPage( | |||
|                 getPage(params, FieldConstant.CREATED_TIME, false), | |||
|                 getWrapper(params) | |||
|         ); | |||
|         return getPageData(page, IcVaccineRelationDTO.class); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     public List<IcVaccineRelationDTO> list(Map<String, Object> params) { | |||
|         List<IcVaccineRelationEntity> entityList = baseDao.selectList(getWrapper(params)); | |||
| 
 | |||
|         return ConvertUtils.sourceToTarget(entityList, IcVaccineRelationDTO.class); | |||
|     } | |||
| 
 | |||
|     private QueryWrapper<IcVaccineRelationEntity> getWrapper(Map<String, Object> params){ | |||
|         String id = (String)params.get(FieldConstant.ID_HUMP); | |||
| 
 | |||
|         QueryWrapper<IcVaccineRelationEntity> wrapper = new QueryWrapper<>(); | |||
|         wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); | |||
| 
 | |||
|         return wrapper; | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     public IcVaccineRelationDTO get(String id) { | |||
|         IcVaccineRelationEntity entity = baseDao.selectById(id); | |||
|         return ConvertUtils.sourceToTarget(entity, IcVaccineRelationDTO.class); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     @Transactional(rollbackFor = Exception.class) | |||
|     public void save(IcVaccineRelationDTO dto) { | |||
|         IcVaccineRelationEntity entity = ConvertUtils.sourceToTarget(dto, IcVaccineRelationEntity.class); | |||
|         insert(entity); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     @Transactional(rollbackFor = Exception.class) | |||
|     public void update(IcVaccineRelationDTO dto) { | |||
|         IcVaccineRelationEntity entity = ConvertUtils.sourceToTarget(dto, IcVaccineRelationEntity.class); | |||
|         updateById(entity); | |||
|     } | |||
| 
 | |||
|     @Override | |||
|     @Transactional(rollbackFor = Exception.class) | |||
|     public void delete(String[] ids) { | |||
|         // 逻辑删除(@TableLogic 注解)
 | |||
|         baseDao.deleteBatchIds(Arrays.asList(ids)); | |||
|     } | |||
| 
 | |||
| } | |||
| @ -0,0 +1,466 @@ | |||
| package com.epmet.service.impl; | |||
| 
 | |||
| import com.alibaba.excel.EasyExcel; | |||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
| import com.baomidou.mybatisplus.core.toolkit.StringUtils; | |||
| import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; | |||
| import com.epmet.commons.tools.constant.AppClientConstant; | |||
| import com.epmet.commons.tools.constant.NumConstant; | |||
| import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; | |||
| import com.epmet.commons.tools.exception.EpmetErrorCode; | |||
| import com.epmet.commons.tools.exception.EpmetException; | |||
| import com.epmet.commons.tools.exception.ExceptionUtils; | |||
| import com.epmet.commons.tools.feign.ResultDataResolver; | |||
| import com.epmet.commons.tools.page.PageData; | |||
| import com.epmet.commons.tools.redis.common.CustomerStaffRedis; | |||
| import com.epmet.commons.tools.utils.DateUtils; | |||
| import com.epmet.commons.tools.utils.EpmetRequestHolder; | |||
| import com.epmet.commons.tools.utils.FileUtils; | |||
| import com.epmet.commons.tools.utils.Result; | |||
| import com.epmet.constants.ImportTaskConstants; | |||
| import com.epmet.dao.IcResiUserDao; | |||
| import com.epmet.dao.IcVaccineDao; | |||
| import com.epmet.dao.IcVaccineRelationDao; | |||
| import com.epmet.dto.form.ImportTaskCommonFormDTO; | |||
| import com.epmet.dto.form.VaccineListFormDTO; | |||
| import com.epmet.dto.result.IcVaccineListResultDTO; | |||
| import com.epmet.dto.result.LoginUserDetailsResultDTO; | |||
| import com.epmet.dto.result.UploadImgResultDTO; | |||
| import com.epmet.dto.result.VaccineListDTO; | |||
| 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.data.IcVaccineImportExcelData; | |||
| import com.epmet.excel.handler.IcVaccineExcelImportListener; | |||
| import com.epmet.feign.EpmetCommonServiceOpenFeignClient; | |||
| import com.epmet.feign.OssFeignClient; | |||
| import com.epmet.service.IcVaccineService; | |||
| import com.epmet.service.UserService; | |||
| import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.collections4.CollectionUtils; | |||
| import org.apache.commons.fileupload.FileItem; | |||
| import org.apache.commons.fileupload.FileItemFactory; | |||
| import org.apache.commons.fileupload.disk.DiskFileItemFactory; | |||
| import org.apache.http.entity.ContentType; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.scheduling.annotation.Async; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import org.springframework.web.multipart.commons.CommonsMultipartFile; | |||
| 
 | |||
| import java.io.IOException; | |||
| import java.io.OutputStream; | |||
| import java.nio.file.Files; | |||
| import java.nio.file.Path; | |||
| import java.util.*; | |||
| import java.util.stream.Collectors; | |||
| 
 | |||
| /** | |||
|  * 疫苗接种记录 | |||
|  * | |||
|  * @author generator generator@elink-cn.com | |||
|  * @since v1.0.0 2022-04-06 | |||
|  */ | |||
| @Slf4j | |||
| @Service | |||
| public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccineEntity> implements IcVaccineService, ResultDataResolver { | |||
| 
 | |||
|     @Autowired | |||
|     private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; | |||
|     @Autowired | |||
|     private OssFeignClient ossFeignClient; | |||
|     @Autowired | |||
|     private IcVaccineRelationDao icVaccineRelationDao; | |||
|     @Autowired | |||
|     private IcResiUserDao icResiUserDao; | |||
|     @Autowired | |||
|     private UserService userService; | |||
| 
 | |||
|     /** | |||
|      * @Author sun | |||
|      * @Description 【疫苗】本组织及下级疫苗接种信息列表 | |||
|      * | |||
|      * @param formDTO | |||
|      * @return*/ | |||
|     @Override | |||
|     public PageData<IcVaccineListResultDTO> icVaccineList(VaccineListFormDTO formDTO) { | |||
|         //1.根据是查询客户数据还是本辖区数据走不同逻辑
 | |||
|         if ("current".equals(formDTO.getSearchType())) { | |||
|             //本辖区数据
 | |||
|             //2.获取工作人员缓存信息
 | |||
|             CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); | |||
|             if (null == staffInfo) { | |||
|                 throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); | |||
|             } | |||
|             formDTO.setAgencyId(staffInfo.getAgencyId()); | |||
|             //3.按条件查询业务数据
 | |||
|             PageInfo<IcVaccineListResultDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()) | |||
|                     .doSelectPageInfo(() -> baseDao.getIcVaccineList(formDTO)); | |||
|             return new PageData(data.getList(), data.getTotal()); | |||
|         } else if ("all".equals(formDTO.getSearchType())) { | |||
|             //客户下数据
 | |||
|             PageInfo<IcVaccineListResultDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()) | |||
|                     .doSelectPageInfo(() -> baseDao.getCustomerIcVaccineList(formDTO)); | |||
|             return new PageData(data.getList(), data.getTotal()); | |||
|         } | |||
| 
 | |||
|         return new PageData(new ArrayList(), 0); | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * @Author zxc | |||
|      * @Description 【疫苗】疫苗接种信息同步 | |||
|      **/ | |||
|     @Override | |||
|     @Transactional(rollbackFor = Exception.class) | |||
|     public void synchro(VaccineListFormDTO formDTO) { | |||
|         //1.检验疫苗基础信息是否存在
 | |||
|         IcVaccineEntity entity = baseDao.selectById(formDTO.getIcVaccineId()); | |||
|         if (null == entity) { | |||
|             log.error(String.format("疫苗记录数据不存在同步失败,疫苗记录Id->%s", formDTO.getIcVaccineId())); | |||
|             throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "数据同步失败,疫苗记录数据不存在"); | |||
|         } | |||
|         //获取工作人员缓存数据
 | |||
|         CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); | |||
|         if (null == staffInfo) { | |||
|             throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); | |||
|         } | |||
|         //2.不管是否已存在关系数据都是先删后增
 | |||
|         icVaccineRelationDao.delRelation(formDTO.getIcVaccineId(), staffInfo.getAgencyId()); | |||
|         //3.新增关系数据
 | |||
|         IcVaccineRelationEntity icVaccineRelationEntity = new IcVaccineRelationEntity(); | |||
|         icVaccineRelationEntity.setCustomerId(formDTO.getCustomerId()); | |||
|         icVaccineRelationEntity.setIcVaccineId(formDTO.getIcVaccineId()); | |||
|         icVaccineRelationEntity.setAgencyId(staffInfo.getAgencyId()); | |||
|         icVaccineRelationEntity.setPids(com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(staffInfo.getAgencyPIds())?staffInfo.getAgencyPIds()+":"+staffInfo.getAgencyId():staffInfo.getAgencyId()); | |||
|         icVaccineRelationEntity.setUserType("synchro"); | |||
|         icVaccineRelationDao.insert(icVaccineRelationEntity); | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * @Author zxc | |||
|      * @Description 【疫苗】疫苗接种信息取消同步 | |||
|      * | |||
|      * @param formDTO*/ | |||
|     @Override | |||
|     @Transactional(rollbackFor = Exception.class) | |||
|     public void cancelSynchro(VaccineListFormDTO formDTO) { | |||
|         //1.获取工作人员缓存数据
 | |||
|         CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); | |||
|         if (null == staffInfo) { | |||
|             throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); | |||
|         } | |||
|         //1.物理删除关系数据
 | |||
|         if (icVaccineRelationDao.delRelation(formDTO.getIcVaccineId(), staffInfo.getAgencyId()) < NumConstant.ONE) { | |||
|             log.error(String.format("数据取消同步失败,疫苗记录Id->%s", formDTO.getAgencyId())); | |||
|             throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "取消同步操作失败"); | |||
|         } | |||
|     } | |||
| 
 | |||
|     @Async | |||
|     @Override | |||
|     public void execAsyncExcelImport(Path filePath, String importTaskId) { | |||
|         String userId = null; | |||
|         try { | |||
|             userId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID); | |||
|             String app = EpmetRequestHolder.getHeader(AppClientConstant.APP); | |||
|             String client = EpmetRequestHolder.getHeader(AppClientConstant.CLIENT); | |||
| 
 | |||
|             LoginUserDetailsResultDTO loginUserDetails = userService.getLoginUserDetails(app, client, userId); | |||
| 
 | |||
|             String agencyId = loginUserDetails.getAgencyId(); | |||
| 
 | |||
|             IcVaccineExcelImportListener listener = new IcVaccineExcelImportListener(userId, agencyId, loginUserDetails.getOrgIdPath().replace(":".concat(agencyId), ""), this); | |||
| 
 | |||
|             EasyExcel.read(filePath.toFile(), IcVaccineImportExcelData.class, listener).headRowNumber(2).sheet(0).doRead(); | |||
| 
 | |||
|             Path errorDescFile = null; | |||
|             String errorDesFileUrl = null; | |||
| 
 | |||
|             List<IcVaccineImportExcelData.RowRemarkMessage> errorRows = listener.getErrorRows(); | |||
|             List<IcVaccineImportExcelData.RowRemarkMessage> otherRows = listener.getOtherRows(); | |||
| 
 | |||
|             boolean failed = errorRows.size() > 0; | |||
| 
 | |||
|             // 合并到一起写入
 | |||
|             errorRows.addAll(otherRows); | |||
| 
 | |||
|             // 生成并上传描述文件
 | |||
|             if (errorRows.size() > 0) { | |||
|                 try { | |||
|                     // 文件生成
 | |||
|                     Path errorDescDir = FileUtils.getAndCreateDirUnderEpmetFilesDir("ic_vaccine", "import", "error_des"); | |||
|                     String fileName = UUID.randomUUID().toString().concat(".xlsx"); | |||
|                     errorDescFile = errorDescDir.resolve(fileName); | |||
| 
 | |||
|                     FileItemFactory factory = new DiskFileItemFactory(16, errorDescDir.toFile()); | |||
|                     FileItem fileItem = factory.createItem("file", ContentType.APPLICATION_OCTET_STREAM.toString(), true, fileName); | |||
|                     OutputStream os = fileItem.getOutputStream(); | |||
| 
 | |||
|                     EasyExcel.write(os, IcNatImportExcelData.RowRemarkMessage.class).sheet("信息列表").doWrite(errorRows); | |||
|                     // 文件上传oss
 | |||
|                     Result<UploadImgResultDTO> errorDesFileUploadResult = ossFeignClient.uploadImportTaskDescFile(new CommonsMultipartFile(fileItem)); | |||
|                     if (errorDesFileUploadResult.success()) { | |||
|                         errorDesFileUrl = errorDesFileUploadResult.getData().getUrl(); | |||
|                     } | |||
| 
 | |||
|                 } finally { | |||
|                     if (Files.exists(errorDescFile)) { | |||
|                         Files.delete(errorDescFile); | |||
|                     } | |||
|                 } | |||
|             } | |||
| 
 | |||
|             ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO(); | |||
|             importFinishTaskForm.setTaskId(importTaskId); | |||
|             importFinishTaskForm.setProcessStatus(failed ? ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL : ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS); | |||
|             importFinishTaskForm.setOperatorId(userId); | |||
|             importFinishTaskForm.setResultDesc(""); | |||
|             importFinishTaskForm.setResultDescFilePath(errorDesFileUrl); | |||
| 
 | |||
|             Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm); | |||
|             if (!result.success()) { | |||
|                 log.error("【疫苗接种导入】finishImportTask失败"); | |||
|             } | |||
|         } catch (Exception e) { | |||
|             String errorMsg = ExceptionUtils.getErrorStackTrace(e); | |||
|             log.error("【疫苗接种导入】出错:{}", errorMsg); | |||
| 
 | |||
|             ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO(); | |||
|             importFinishTaskForm.setTaskId(importTaskId); | |||
|             importFinishTaskForm.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); | |||
|             importFinishTaskForm.setOperatorId(userId); | |||
|             importFinishTaskForm.setResultDesc("导入失败"); | |||
| 
 | |||
|             Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm); | |||
|             if (!result.success()) { | |||
|                 log.error("【疫苗接种导入】导入记录状态修改为'完成'失败"); | |||
|             } | |||
|         } finally { | |||
|             // 删除临时文件
 | |||
|             if (Files.exists(filePath)) { | |||
|                 try { | |||
|                     Files.delete(filePath); | |||
|                 } catch (IOException e) { | |||
|                     e.printStackTrace(); | |||
|                 } | |||
|             } | |||
|         } | |||
| 
 | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * 批量持久化 | |||
|      * @param entities | |||
|      */ | |||
|     public void batchPersist(List<IcVaccineEntity> entities, IcVaccineExcelImportListener listener) { | |||
|         String customerId = EpmetRequestHolder.getHeader(AppClientConstant.CUSTOMER_ID); | |||
|         String currentUserId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID); | |||
| 
 | |||
|         entities.forEach(e -> { | |||
|             try { | |||
|                 persisVaccine(e, customerId, currentUserId, listener); | |||
|             } catch (Exception exception) { | |||
|                 String errorMsg = ExceptionUtils.getErrorStackTrace(exception); | |||
|                 log.error(errorMsg); | |||
| 
 | |||
|                 IcVaccineImportExcelData.RowRemarkMessage errorRow = new IcVaccineImportExcelData.RowRemarkMessage(); | |||
|                 errorRow.setName(e.getName()); | |||
|                 errorRow.setMobile(e.getMobile()); | |||
|                 errorRow.setIdCard(e.getIdCard()); | |||
|                 errorRow.setErrorInfo("未知系统错误"); | |||
|                 listener.getErrorRows().add(errorRow); | |||
|             } | |||
|         }); | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * 单条持久化 | |||
|      * @param e | |||
|      * @param customerId | |||
|      * @param currentUserId | |||
|      * @param listener | |||
|      */ | |||
|     @Transactional(rollbackFor = Exception.class) | |||
|     public void persisVaccine(IcVaccineEntity e, String customerId, String currentUserId, IcVaccineExcelImportListener listener) { | |||
|         List<IcVaccineImportExcelData.RowRemarkMessage> otherRows = listener.getOtherRows(); | |||
|         String agencyPids = listener.getCurrentAgencyPids(); | |||
|         String agencyId = listener.getCurrentAgencyId(); | |||
| 
 | |||
|         String idCard = e.getIdCard(); | |||
|         String name = e.getName(); | |||
|         String mobile = e.getMobile(); | |||
|         String manufacturer = e.getManufacturer(); | |||
|         Date inoculateTime = e.getInoculateTime(); | |||
|         String inoculateAddress = e.getInoculateAddress(); | |||
| 
 | |||
|         // 居民信息
 | |||
|         IcResiUserEntity resi = getResi(customerId, idCard, null); | |||
| 
 | |||
|         //1.先看客户下有没有这个人
 | |||
|         IcVaccineEntity resiVaccine = getResiVaccine(customerId, idCard, inoculateTime); | |||
|         if (resiVaccine != null && !"import".equals(resiVaccine.getUserType())) { | |||
|             // 有这个人,并且不是导入的
 | |||
|             String message = "已存在该次疫苗接种录入记录,请到系统中修改"; | |||
| 
 | |||
|             IcVaccineImportExcelData.RowRemarkMessage errorRow = new IcVaccineImportExcelData.RowRemarkMessage(); | |||
|             errorRow.setName(name); | |||
|             errorRow.setMobile(mobile); | |||
|             errorRow.setIdCard(idCard); | |||
|             errorRow.setErrorInfo(message); | |||
|             otherRows.add(errorRow); | |||
|             return; | |||
|         } | |||
| 
 | |||
|         if (resiVaccine != null) { | |||
|             boolean needUpdate = false; | |||
| 
 | |||
|             // 有这个人,也是导入的,那就要更新le
 | |||
|             Boolean isNameChanged = false; | |||
|             if (!name.equals(resiVaccine.getName())) { | |||
|                 isNameChanged = true; | |||
|                 resiVaccine.setName(name); | |||
|                 needUpdate = true; | |||
|             } | |||
| 
 | |||
|             if (!inoculateAddress.equals(resiVaccine.getInoculateAddress())) { | |||
|                 resiVaccine.setInoculateAddress(inoculateAddress); | |||
|                 needUpdate = true; | |||
|             } | |||
| 
 | |||
|             if (!manufacturer.equals(resiVaccine.getManufacturer())) { | |||
|                 resiVaccine.setManufacturer(manufacturer); | |||
|                 needUpdate = true; | |||
|             } | |||
| 
 | |||
|             if (!mobile.equals(resiVaccine.getMobile())) { | |||
|                 resiVaccine.setMobile(mobile); | |||
|                 needUpdate = true; | |||
|             } | |||
| 
 | |||
|             if (isNameChanged) { | |||
|                 String message = "平台存在相同记录身份证号与姓名不一致,已更新最新姓名"; | |||
|                 IcVaccineImportExcelData.RowRemarkMessage errorRow = new IcVaccineImportExcelData.RowRemarkMessage(); | |||
|                 errorRow.setName(name); | |||
|                 errorRow.setMobile(mobile); | |||
|                 errorRow.setIdCard(idCard); | |||
|                 errorRow.setErrorInfo(message); | |||
|                 otherRows.add(errorRow); | |||
|             } | |||
| 
 | |||
|             if (needUpdate) { | |||
|                 resiVaccine.setUpdatedBy(currentUserId); | |||
|                 resiVaccine.setUpdatedTime(new Date()); | |||
| 
 | |||
|                 resiVaccine.setIsResiUser(resi != null ? "1" : "0"); | |||
| 
 | |||
|                 baseDao.updateById(resiVaccine); | |||
|             } | |||
| 
 | |||
|             // 建立关系
 | |||
|             if (resi != null) { | |||
|                 createVaccineRelation(resiVaccine.getId(), resi.getAgencyId(), resi.getPids()); | |||
|             } | |||
| 
 | |||
|             return; | |||
|         } | |||
| 
 | |||
|         // 执行新增操作
 | |||
|         e.setIsResiUser(resi != null ? "1" : "0"); | |||
|         e.setUserType("import"); | |||
| 
 | |||
|         baseDao.insert(e); | |||
| 
 | |||
|         // 只要是居民,就创建上关系
 | |||
|         if (resi != null) { | |||
|             createVaccineRelation(e.getId(), resi.getAgencyId(), resi.getPids()); | |||
|         } | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * 是否是指定条件下的居民; | |||
|      * 0:否 | |||
|      * 1:是 | |||
|      * @param customerId | |||
|      * @param idCard | |||
|      * @return | |||
|      */ | |||
|     public IcResiUserEntity getResi(String customerId, String idCard, String pids) { | |||
|         LambdaQueryWrapper<IcResiUserEntity> query = new LambdaQueryWrapper(); | |||
|         query.eq(IcResiUserEntity::getCustomerId, customerId); | |||
|         query.eq(IcResiUserEntity::getIdCard, idCard); | |||
|         if (StringUtils.isNotBlank(pids)) { | |||
|             query.likeRight(IcResiUserEntity::getPids, pids); | |||
|         } | |||
|         return icResiUserDao.selectOne(query); | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * | |||
|      * @param customerId | |||
|      * @param idCard | |||
|      * @return | |||
|      */ | |||
|     public IcVaccineEntity getResiVaccine(String customerId, String idCard, Date natTime) { | |||
|         LambdaQueryWrapper<IcVaccineEntity> query = new LambdaQueryWrapper<>(); | |||
|         query.eq(IcVaccineEntity::getCustomerId, customerId); | |||
|         query.eq(IcVaccineEntity::getIdCard, idCard); | |||
|         query.eq(IcVaccineEntity::getInoculateTime, natTime); | |||
|         return baseDao.selectOne(query); | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * 创建关系 | |||
|      * @param vaccineId | |||
|      * @param currentUserAgencyId | |||
|      */ | |||
|     private void createVaccineRelation(String vaccineId, String currentUserAgencyId, String agencyPids) { | |||
| 
 | |||
|         // 没有关系创建关系,有关系就跳过
 | |||
|         LambdaQueryWrapper<IcVaccineRelationEntity> query = new LambdaQueryWrapper<>(); | |||
|         query.eq(IcVaccineRelationEntity::getIcVaccineId, vaccineId); | |||
|         query.eq(IcVaccineRelationEntity::getAgencyId, currentUserAgencyId); | |||
|         if (icVaccineRelationDao.selectCount(query) > 0) { | |||
|             return; | |||
|         } | |||
| 
 | |||
|         IcVaccineRelationEntity relation = new IcVaccineRelationEntity(); | |||
|         relation.setAgencyId(currentUserAgencyId); | |||
|         relation.setPids(String.join(":", Arrays.asList(agencyPids, currentUserAgencyId))); | |||
|         relation.setIcVaccineId(vaccineId); | |||
|         relation.setUserType("import"); | |||
|         icVaccineRelationDao.insert(relation); | |||
|     } | |||
| 
 | |||
|     /** | |||
|      * 获取居民疫苗接种信息 | |||
|      * | |||
|      * @param idCard | |||
|      * @Param idCard | |||
|      * @Return {@link List<  VaccineListDTO >} | |||
|      * @Author zhaoqifeng | |||
|      * @Date 2022/3/30 10:24 | |||
|      */ | |||
|     @Override | |||
|     public List<VaccineListDTO> getVaccineList(String customerId, String idCard) { | |||
|         LambdaQueryWrapper<IcVaccineEntity> wrapper = new LambdaQueryWrapper<>(); | |||
|         wrapper.eq(IcVaccineEntity::getCustomerId, customerId); | |||
|         wrapper.eq(IcVaccineEntity::getIdCard, idCard); | |||
|         wrapper.orderByDesc(IcVaccineEntity::getInoculateTime); | |||
|         List<IcVaccineEntity> list = baseDao.selectList(wrapper); | |||
|         if (CollectionUtils.isEmpty(list)) { | |||
|             return Collections.emptyList(); | |||
|         } | |||
|         return list.stream().map(item -> { | |||
|             VaccineListDTO dto = new VaccineListDTO(); | |||
|             dto.setAddress(item.getInoculateAddress()); | |||
|             dto.setManufactor(item.getManufacturer()); | |||
|             dto.setVaccinateTime(DateUtils.format(item.getInoculateTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE)); | |||
|             return dto; | |||
|         }).collect(Collectors.toList()); | |||
|     } | |||
| 
 | |||
| } | |||
| @ -0,0 +1,21 @@ | |||
| CREATE TABLE `ic_epidemic_special_attention` ( | |||
|   `ID` varchar(64) NOT NULL COMMENT 'ID', | |||
|   `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', | |||
|   `ORG_ID` varchar(64) NOT NULL COMMENT '当前工作人员所属组织ID', | |||
|   `PID` varchar(64) NOT NULL COMMENT '组织ID上级', | |||
|   `PIDS` varchar(255) NOT NULL COMMENT '组织ID所有上级', | |||
|   `IS_ATTENTION` tinyint(1) NOT NULL COMMENT '是否关注 1:关注,0:取消关注', | |||
|   `ATTENTION_TYPE` tinyint(1) NOT NULL COMMENT '关注类型,核酸检测:2,疫苗接种:1,行程上报:0', | |||
|   `NAME` varchar(64) NOT NULL COMMENT '姓名', | |||
|   `MOBILE` varchar(11) NOT NULL COMMENT '手机号', | |||
|   `ID_CARD` varchar(18) NOT NULL COMMENT '身份证号', | |||
|   `REASON` varchar(1000) DEFAULT NULL COMMENT '原因', | |||
|   `REMARK` varchar(1000) DEFAULT NULL COMMENT '备注', | |||
|   `DEL_FLAG` int(11) NOT NULL, | |||
|   `REVISION` int(11) NOT NULL COMMENT '乐观锁', | |||
|   `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', | |||
|   `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', | |||
|   `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', | |||
|   `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', | |||
|   PRIMARY KEY (`ID`) | |||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='疫情特别关注'; | |||
| @ -0,0 +1,41 @@ | |||
| #添加 疫苗接种相关表 | |||
| CREATE TABLE `ic_vaccine` ( | |||
|                               `ID` varchar(64) NOT NULL COMMENT '唯一标识', | |||
|                               `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id customer.id', | |||
|                               `NAME` varchar(64) NOT NULL COMMENT '姓名', | |||
|                               `MOBILE` varchar(11) NOT NULL COMMENT '手机号', | |||
|                               `ID_CARD` varchar(18) NOT NULL COMMENT '身份证号', | |||
|                               `IS_RESI_USER` varchar(1) NOT NULL DEFAULT '0' COMMENT '是否客户下居民(0:否  1:是)', | |||
|                               `USER_TYPE` varchar(32) NOT NULL COMMENT '数据来源【导入的:import;】', | |||
|                               `INOCULATE_TIME` datetime NOT NULL COMMENT '接种时间', | |||
|                               `INOCULATE_ADDRESS` varchar(32) NOT NULL DEFAULT '' COMMENT '接种地点', | |||
|                               `MANUFACTURER` varchar(32) NOT NULL DEFAULT '' COMMENT '疫苗厂家', | |||
|                               `FIELD1` varchar(32) DEFAULT NULL COMMENT '预留字段1', | |||
|                               `FIELD2` varchar(255) DEFAULT NULL COMMENT '预留字段2', | |||
|                               `FIELD3` varchar(255) DEFAULT NULL COMMENT '预留字段3', | |||
|                               `REMARK` varchar(255) DEFAULT NULL COMMENT '备注', | |||
|                               `DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除', | |||
|                               `REVISION` int(2) NOT NULL COMMENT '乐观锁', | |||
|                               `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', | |||
|                               `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', | |||
|                               `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', | |||
|                               `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', | |||
|                               PRIMARY KEY (`ID`) USING BTREE, | |||
|                               KEY `idx_ic_card` (`ID_CARD`) USING BTREE | |||
| ) COMMENT='疫苗接种记录'; | |||
| 
 | |||
| CREATE TABLE `ic_vaccine_relation` ( | |||
|                                        `ID` varchar(64) NOT NULL COMMENT 'ID', | |||
|                                        `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户Id', | |||
|                                        `AGENCY_ID` varchar(64) NOT NULL COMMENT '居民端上报时存储用户所在网格的组织id.居民信息的人存储居民所在组织id.单个新增或者导入的存储登录用户所属的组织id', | |||
|                                        `PIDS` varchar(255) NOT NULL COMMENT '组织pids,包含当前agencyId值', | |||
|                                        `IC_VACCINE_ID` varchar(64) NOT NULL COMMENT '疫苗记录表Id(ic_vaccine.id)', | |||
|                                        `USER_TYPE` varchar(32) NOT NULL COMMENT '关系数据的绑定途径【\r\n数字社区录入:icresi;\r\n导入的:import;\r\n同步的:synchro】', | |||
|                                        `DEL_FLAG` int(1) NOT NULL COMMENT '删除标识', | |||
|                                        `REVISION` int(2) NOT NULL COMMENT '乐观锁', | |||
|                                        `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', | |||
|                                        `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', | |||
|                                        `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', | |||
|                                        `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', | |||
|                                        PRIMARY KEY (`ID`) USING BTREE | |||
| )  COMMENT='疫苗接种记录关系表'; | |||
| @ -0,0 +1,2 @@ | |||
| alter table ic_epidemic_special_attention modify column remark VARCHAR(500); | |||
| alter table ic_epidemic_special_attention modify column reason VARCHAR(500); | |||
								
									Binary file not shown.
								
							
						
					| @ -1,28 +0,0 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| 
 | |||
| <mapper namespace="com.epmet.dao.IcResiVaccineDao"> | |||
| 
 | |||
|     <resultMap type="com.epmet.entity.IcResiVaccineEntity" id="icResiVaccineMap"> | |||
|         <result property="id" column="ID"/> | |||
|         <result property="customerId" column="CUSTOMER_ID"/> | |||
|         <result property="name" column="NAME"/> | |||
|         <result property="mobile" column="MOBILE"/> | |||
|         <result property="idCard" column="ID_CARD"/> | |||
|         <result property="inoculateTime" column="INOCULATE_TIME"/> | |||
|         <result property="inoculateAddress" column="INOCULATE_ADDRESS"/> | |||
|         <result property="manufacturer" column="MANUFACTURER"/> | |||
|         <result property="field1" column="FIELD1"/> | |||
|         <result property="field2" column="FIELD2"/> | |||
|         <result property="field3" column="FIELD3"/> | |||
|         <result property="remaek" column="REMAEK"/> | |||
|         <result property="delFlag" column="DEL_FLAG"/> | |||
|         <result property="revision" column="REVISION"/> | |||
|         <result property="createdBy" column="CREATED_BY"/> | |||
|         <result property="createdTime" column="CREATED_TIME"/> | |||
|         <result property="updatedBy" column="UPDATED_BY"/> | |||
|         <result property="updatedTime" column="UPDATED_TIME"/> | |||
|     </resultMap> | |||
| 
 | |||
| 
 | |||
| </mapper> | |||
| @ -0,0 +1,165 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| 
 | |||
| <mapper namespace="com.epmet.dao.IcVaccineDao"> | |||
| <select id="getMyNatList" resultType="com.epmet.dto.result.MyNatListResultDTO"> | |||
|         SELECT | |||
|             id icNatId, | |||
|             user_id userId, | |||
|             user_type userType, | |||
|             `name` `name`, | |||
|             mobile mobile, | |||
|             id_card idCard, | |||
|             nat_time natTime, | |||
|             nat_result natResult, | |||
|             nat_address natAddress, | |||
|             file_name fileName, | |||
|             attachment_url attachmentUrl, | |||
|             created_time reportTime | |||
|         FROM | |||
|             ic_nat | |||
|         WHERE | |||
|             del_flag = '0' | |||
|         AND customer_id = #{customerId} | |||
|         AND ( | |||
|             CREATED_BY = #{userId} | |||
|         <if test='null != idCard and "" != idCard'> | |||
|             OR id_card = #{idCard} | |||
|         </if> | |||
|             ) | |||
|         ORDER BY nat_time DESC | |||
|     </select> | |||
| 
 | |||
|     <select id="getIcVaccineList" resultType="com.epmet.dto.result.IcVaccineListResultDTO"> | |||
|         SELECT | |||
|             a.IC_VACCINE_ID AS vaccineId, | |||
|             a.agency_id, | |||
|             a.user_type, | |||
|             b.`name`, | |||
|             b.mobile, | |||
|             b.id_card, | |||
|             b.INOCULATE_TIME, | |||
|             b.INOCULATE_ADDRESS, | |||
|             b.MANUFACTURER | |||
|         FROM ic_vaccine_relation a | |||
|         INNER JOIN ic_vaccine b ON a.IC_VACCINE_ID = b.ID AND b.DEL_FLAG = '0' | |||
|         WHERE a.DEL_FLAG = '0' | |||
|             AND a.customer_id = #{customerId} | |||
|             AND a.pids like concat('%', #{agencyId}, '%') | |||
|             <if test='null != name and "" != name'> | |||
|                 AND b.name like concat('%', #{name}, '%') | |||
|             </if> | |||
|             <if test='null != mobile and "" != mobile'> | |||
|                 AND b.mobile = #{mobile} | |||
|             </if> | |||
|             <if test='null != idCard and "" != idCard'> | |||
|                 AND b.id_card = #{idCard} | |||
|             </if> | |||
|             <if test='null != startTime and "" != startTime'> | |||
|                 AND b.INOCULATE_TIME <![CDATA[ >= ]]> #{startTime} | |||
|             </if> | |||
|             <if test='null != endTime and "" != endTime'> | |||
|                 AND b.INOCULATE_TIME <![CDATA[ <= ]]> #{endTime} | |||
|             </if> | |||
|         ORDER BY b.INOCULATE_TIME DESC, b.id ASC | |||
|     </select> | |||
| 
 | |||
|     <select id="getCustomerIcVaccineList" resultType="com.epmet.dto.result.IcVaccineListResultDTO"> | |||
|         SELECT | |||
|             id vaccineId, | |||
|             is_resi_user isResiUser, | |||
|             user_type userType, | |||
|             `name` `name`, | |||
|             mobile mobile, | |||
|             id_card idCard, | |||
|             INOCULATE_TIME , | |||
|             INOCULATE_ADDRESS, | |||
|             MANUFACTURER | |||
|         FROM ic_vaccine | |||
|         WHERE del_flag = '0' | |||
|             AND customer_id = #{customerId} | |||
|             <if test='null != name and "" != name'> | |||
|                 AND name like concat('%', #{name}, '%') | |||
|             </if> | |||
|             <if test='null != mobile and "" != mobile'> | |||
|                 AND mobile = #{mobile} | |||
|             </if> | |||
|             <if test='null != idCard and "" != idCard'> | |||
|                 AND id_card = #{idCard} | |||
|             </if> | |||
|             <if test='null != startTime and "" != startTime'> | |||
|                 AND INOCULATE_TIME <![CDATA[ >= ]]> #{startTime} | |||
|             </if> | |||
|             <if test='null != endTime and "" != endTime'> | |||
|                 AND INOCULATE_TIME <![CDATA[ <= ]]> #{endTime} | |||
|             </if> | |||
|         ORDER BY INOCULATE_TIME DESC, id ASC | |||
|     </select> | |||
| 
 | |||
|     <select id="getNatDTO" resultType="com.epmet.dto.IcNatDTO"> | |||
|         SELECT | |||
|             id, | |||
|             user_id, | |||
|             user_type, | |||
|             `name`, | |||
|             mobile, | |||
|             id_card, | |||
|             nat_time, | |||
|             nat_result, | |||
|             nat_address | |||
|         FROM | |||
|             ic_nat | |||
|         WHERE | |||
|             del_flag = '0' | |||
|         AND customer_id = #{customerId} | |||
|         AND id_card = #{idCard} | |||
|         AND DATE_FORMAT(nat_time, '%Y-%m-%d %h:%i') = DATE_FORMAT(#{natTime}, '%Y-%m-%d %h:%i') | |||
|         <if test='null != natResult and "" != natResult'> | |||
|             AND nat_result = #{natResult} | |||
|         </if> | |||
|         <if test='null != icNatId and "" != icNatId'> | |||
|             AND id != #{icNatId} | |||
|         </if> | |||
|         LIMIT 1 | |||
|     </select> | |||
| 
 | |||
|     <delete id="delById"> | |||
|         DELETE FROM ic_nat WHERE id = #{icNatId} | |||
|     </delete> | |||
| 
 | |||
|     <insert id="insertOrUpdate"> | |||
|         INSERT INTO epmet_user.ic_nat | |||
|         (ID, CUSTOMER_ID, AGENCY_ID, PIDS, USER_ID, | |||
|          USER_TYPE, NAME, MOBILE, ID_CARD, NAT_TIME, NAT_RESULT, NAT_ADDRESS, FILE_NAME, ATTACHMENT_TYPE, ATTACHMENT_URL, | |||
|          DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) | |||
|         VALUES (#{id}, #{customerId}, #{agencyId}, #{pids}, #{userId}, | |||
|                 #{userType}, #{name}, #{mobile}, #{idCard}, #{natTime}, | |||
|                 #{natResult}, #{natAddress}, #{fileName}, #{attachmentType}, #{attachmentUrl}, | |||
|                 #{delFlag}, #{revision}, #{createdBy}, #{createdTime}, #{updatedBy}, | |||
|                 #{updatedTime}) | |||
|         ON DUPLICATE KEY update | |||
|             NAME=#{name}, | |||
|             MOBILE=#{mobile}, | |||
|             NAT_ADDRESS=#{natAddress}, | |||
|             NAT_RESULT=#{natResult}, | |||
|             UPDATED_BY=#{updatedBy}, | |||
|             UPDATED_TIME=NOW() | |||
|     </insert> | |||
|     <update id="updateIsResiFlag"> | |||
|         UPDATE ic_nat m, | |||
|         ( | |||
|         SELECT if(DEL_FLAG,0,1) resiFlag, ID_CARD FROM ic_resi_user | |||
|         WHERE | |||
|             1=1 | |||
|             <if test="icResiUserId != null and icResiUserId != ''"> | |||
|                 AND ID = #{icResiUserId} | |||
|             </if> | |||
|             AND CUSTOMER_ID = #{customerId} | |||
|             AND DEL_FLAG = '0' | |||
|         ) t | |||
|         SET m.IS_RESI_USER = t.resiFlag | |||
|         WHERE | |||
|             m.ID_CARD = t.ID_CARD | |||
|             AND m.DEL_FLAG = '0' | |||
|     </update> | |||
| </mapper> | |||
| @ -0,0 +1,16 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | |||
| <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
| 
 | |||
| <mapper namespace="com.epmet.dao.IcVaccineRelationDao"> | |||
| 
 | |||
|     <delete id="delRelation"> | |||
|         DELETE | |||
|         FROM ic_vaccine_relation | |||
|         WHERE | |||
|         ic_vaccine_id = #{icVaccineId} | |||
|         <if test='null != agencyId and "" != agencyId'> | |||
|             AND AGENCY_ID = #{agencyId} | |||
|         </if> | |||
|     </delete> | |||
| 
 | |||
| </mapper> | |||
					Loading…
					
					
				
		Reference in new issue