Browse Source

Merge branch 'dev_epidemic_situation' of http://git.elinkit.com.cn:7070/r/epmet-cloud into dev_epidemic_situation

 Conflicts:
	epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java
dev
wangxianzhang 3 years ago
parent
commit
68410b2467
  1. 1
      epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java
  2. 67
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccineListFormDTO.java
  3. 27
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcVaccineListCommonExcelResultDTO.java
  4. 95
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcVaccineListResultDTO.java
  5. 135
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineController.java
  6. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java
  7. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineRelationDao.java
  8. 57
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcVaccineService.java
  9. 245
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java
  10. 4
      epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml
  11. 10
      epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineRelationDao.xml

1
epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java

@ -22,6 +22,7 @@ public interface ImportTaskConstants {
* 核酸检测
*/
String BIZ_TYPE_IC_NAT = "ic_nat";
String BIZ_TYPE_IC_VACCINE = "ic_vaccine";
/**
* 行程上报
*/

67
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccineListFormDTO.java

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

27
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcVaccineListCommonExcelResultDTO.java

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

95
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcVaccineListResultDTO.java

@ -0,0 +1,95 @@
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 icNatId;
/**
* 组织Id
*/
@ExcelIgnore
private String agencyId;
/**
* 居民端小程序的用户id数字社区的icResiUserId其他情况无值
*/
@ExcelIgnore
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 natTime;
/**
* 检测结果
*/
@ColumnWidth(20)
@ExcelProperty(value = "检测结果",order = 5)
private String natResult;
/**
* 是否客户下居民(0: 1:)
*/
@ExcelIgnore
private String isResiUser;
/**
* 检测地点
*/
@ColumnWidth(30)
@ExcelProperty(value = "检测地点",order = 7)
private String natAddress;
}

135
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineController.java

@ -17,14 +17,11 @@ 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.IcNatDTO;
import com.epmet.dto.form.AddIcNatFormDTO;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.form.MyNatListFormDTO;
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.dto.result.MyNatListResultDTO;
import com.epmet.dto.result.NatListCommonExcelResultDTO;
import com.epmet.dto.result.NatListResultDTO;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.service.IcVaccineService;
import lombok.extern.slf4j.Slf4j;
@ -63,105 +60,26 @@ public class IcVaccineController implements ResultDataResolver {
@Autowired
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient;
/**
* 记录一下核酸记录模块的业务程序逻辑防止后续理不清 ic_nat:基础信息表 ic_nat_relation:关系表
* 1.数字平台导入时按身份证检测时间查询数据查到数据不是导入的状态则记录下并跳过是导入数据更新结果未查到直接新增
* 是否居民以及userId值查询数据平台居民能查到就相应的赋值
* 2.居民端录入可以录自己的或别人的但是数据属于当前录入的组织
* 3.数据平台录入可以为已有居民录入也可以录新数据新数据则是否居民和userId无值
* 4.导入数据不允许修改删除录入数据可以修改删除删除时相应的删除基础表和可能存在的所有关心表数据
* 数据同步可多次重复只是修改对应的关系表数据基础信息表数据公用
* 5.同一条数据被A街道和A社区都同步了街道在看本辖区数据时会看到两条但是只有A街道的那一条才能看到取消同步按钮
* 6.数据库一个人一个检测时间只存在一条记录以导入数据结果为准已导入的各项值都不能修改即使错误也只能通过导入修改
* 7.新增删除居民时会相应的修改基础信息表是否居民以及userId的值
* 1.导入数据不允许修改是觉得导入数据是官方提供的且没有问题的数据不需要在平台有维护操作只要看就可以了
* 2.是否居民的查询条件以及是否居民的列标题在看整个客户列表数据时这两个都隐藏
*
*/
/**
* @Author sun
* @Description 核酸检测-上报核酸记录
**/
//@NoRepeatSubmit
@PostMapping("add")
public Result add(@LoginUser TokenDto tokenDto, @RequestBody AddIcNatFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, AddIcNatFormDTO.Nat.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setStaffId(tokenDto.getUserId());
icVaccineService.add(formDTO);
return new Result();
}
/**
* @Author sun
* @Description 核酸检测-居民端我的上报
**/
@NoRepeatSubmit
@PostMapping("mynatlist")
public Result<List<MyNatListResultDTO>> myNatList(@LoginUser TokenDto tokenDto, @RequestBody MyNatListFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
return new Result<List<MyNatListResultDTO>>().ok(icVaccineService.myNatList(formDTO));
}
/**
* @Author sun
* @Description 核酸核酸检测信息列表
**/
@NoRepeatSubmit
@PostMapping("natlist")
public Result<PageData<NatListResultDTO>> natList(@LoginUser TokenDto tokenDto, @RequestBody MyNatListFormDTO formDTO) {
public Result<PageData<IcVaccineListResultDTO>> natList(@LoginUser TokenDto tokenDto, @RequestBody VaccineListFormDTO formDTO) {
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
return new Result<PageData<NatListResultDTO>>().ok(icVaccineService.natList(formDTO));
return new Result<PageData<IcVaccineListResultDTO>>().ok(icVaccineService.icVaccineList(formDTO));
}
/**
* @Author sun
* @Description 核酸核酸检测信息详情
**/
@NoRepeatSubmit
@PostMapping("detail")
public Result<IcNatDTO> detail(@RequestBody MyNatListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, MyNatListFormDTO.Detail.class);
return new Result<IcNatDTO>().ok(icVaccineService.detail(formDTO));
}
/**
* @Author sun
* @Description 核酸核酸检测信息修改
**/
@NoRepeatSubmit
@PostMapping("edit")
public Result edit(@LoginUser TokenDto tokenDto, @RequestBody AddIcNatFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, AddIcNatFormDTO.Edit.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setStaffId(tokenDto.getUserId());
icVaccineService.edit(formDTO);
return new Result();
}
/**
* @Author sun
* @Description 核酸核酸检测信息删除/取消同步
**/
@NoRepeatSubmit
@PostMapping("del")
public Result del(@RequestBody MyNatListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, MyNatListFormDTO.Del.class);
icVaccineService.del(formDTO);
return new Result<>();
}
/**
* @Author sun
* @Author zxc
* @Description 核酸核酸检测信息同步
**/
@NoRepeatSubmit
@PostMapping("synchro")
public Result synchro(@LoginUser TokenDto tokenDto, @RequestBody MyNatListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, MyNatListFormDTO.Synchro.class);
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);
@ -169,13 +87,13 @@ public class IcVaccineController implements ResultDataResolver {
}
/**
* @Author sun
* @Author zxc
* @Description 核酸核酸检测信息取消同步
**/
@NoRepeatSubmit
@PostMapping("cancelsynchro")
public Result cancelSynchro(@LoginUser TokenDto tokenDto, @RequestBody MyNatListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, MyNatListFormDTO.Synchro.class);
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);
@ -237,18 +155,17 @@ public class IcVaccineController implements ResultDataResolver {
}
/**
* @Author sun
* @Description 核酸核酸检测信息下载模板
* @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.ms-excel");
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_nat.xlsx");
InputStream is = this.getClass().getClassLoader().getResourceAsStream("excel/ic_vaccine.xlsx");
try {
ServletOutputStream os = response.getOutputStream();
IOUtils.copy(is, os);
@ -266,38 +183,32 @@ public class IcVaccineController implements ResultDataResolver {
**/
@NoRepeatSubmit
@PostMapping("export")
public void export(@LoginUser TokenDto tokenDto, @RequestBody MyNatListFormDTO formDTO, HttpServletResponse response) {
public void export(@LoginUser TokenDto tokenDto, @RequestBody VaccineListFormDTO formDTO, HttpServletResponse response) {
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setUserId(tokenDto.getUserId());
//formDTO.setCustomerId("45687aa479955f9d06204d415238f7cc");
//formDTO.setUserId("73ae6280e46a6653a5605d51d5462725");
formDTO.setIsPage(false);
ExcelWriter excelWriter = null;
formDTO.setPageSize(NumConstant.TEN_THOUSAND);
int pageNo = formDTO.getPageNo();
try {
// 这里 需要指定写用哪个class去写
String fileName = "核酸检测信息.xlsx";
if ("all".equals(formDTO.getOrgType())) {
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), NatListResultDTO.class).build();
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), NatListCommonExcelResultDTO.class).build();
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel(fileName, response), IcVaccineListCommonExcelResultDTO.class).build();
}
WriteSheet writeSheet = EasyExcel.writerSheet("Sheet1").build();
PageData<NatListResultDTO> data = null;
PageData<IcVaccineListResultDTO> data = null;
do {
data = icVaccineService.natList(formDTO);
data = icVaccineService.icVaccineList(formDTO);
data.getList().forEach(o-> {
o.setNatResult(NumConstant.ONE_STR.equals(o.getNatResult()) ? "阳性" : "阴性");
o.setIsResiUser(NumConstant.ONE_STR.equals(o.getIsResiUser()) ? "是" : "否");
});
formDTO.setPageNo(++pageNo);
if ("current".equals(formDTO.getOrgType())) {
List<NatListResultDTO> list = ConvertUtils.sourceToTarget(data.getList(), NatListResultDTO.class);
if ("current".equals(formDTO.getSearchType())) {
List<IcVaccineListResultDTO> list = ConvertUtils.sourceToTarget(data.getList(), IcVaccineListResultDTO.class);
excelWriter.write(list, writeSheet);
}else{
excelWriter.write(data.getList(), writeSheet);

12
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java

@ -3,10 +3,10 @@ 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.MyNatListResultDTO;
import com.epmet.dto.result.NatListResultDTO;
import com.epmet.entity.IcVaccineEntity;
import com.epmet.entity.IcVaccineEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -29,14 +29,16 @@ public interface IcVaccineDao extends BaseDao<IcVaccineEntity> {
/**
* @Author sun
* @Description 核酸本辖区核酸检测信息列表
**/
List<NatListResultDTO> getNatList(MyNatListFormDTO formDTO);
*
* @param formDTO*/
List<NatListResultDTO> getIcVaccineList(VaccineListFormDTO formDTO);
/**
* @Author sun
* @Description 核酸客户下核酸检测信息列表
**/
List<NatListResultDTO> getCustomerNatList(MyNatListFormDTO formDTO);
*
* @param formDTO*/
List<NatListResultDTO> getCustomerIcVaccineList(VaccineListFormDTO formDTO);
/**
* @Author sun

3
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineRelationDao.java

@ -3,6 +3,7 @@ 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;
/**
* 疫苗接种记录关系表
@ -12,5 +13,5 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IcVaccineRelationDao extends BaseDao<IcVaccineRelationEntity> {
int delRelation(@Param("icNatId") String icNatId, @Param("agencyId") String agencyId);
}

57
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcVaccineService.java

@ -2,12 +2,10 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcNatDTO;
import com.epmet.dto.form.AddIcNatFormDTO;
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.NatListDTO;
import com.epmet.dto.result.NatListResultDTO;
import com.epmet.entity.IcVaccineEntity;
import java.nio.file.Path;
@ -21,12 +19,6 @@ import java.util.List;
*/
public interface IcVaccineService extends BaseService<IcVaccineEntity> {
/**
* @Author sun
* @Description 核酸检测-上报核酸记录
**/
void add(AddIcNatFormDTO formDTO);
/**
* @Author sun
* @Description 核酸检测-居民端我的上报
@ -37,38 +29,21 @@ public interface IcVaccineService extends BaseService<IcVaccineEntity> {
* @Author sun
* @Description 核酸核酸检测信息列表
*
* @param formDTO
* @return*/
PageData<NatListResultDTO> natList(MyNatListFormDTO formDTO);
/**
* @Author sun
* @Description 核酸核酸检测信息详情
**/
IcNatDTO detail(MyNatListFormDTO formDTO);
/**
* @Author sun
* @Description 核酸核酸检测信息修改
**/
void edit(AddIcNatFormDTO formDTO);
PageData<IcVaccineListResultDTO> icVaccineList(VaccineListFormDTO formDTO);
/**
* @Author sun
* @Description 核酸核酸检测信息删除/取消同步
**/
void del(MyNatListFormDTO formDTO);
/**
* @Author sun
* @Author zxc
* @Description 核酸核酸检测信息同步
**/
void synchro(MyNatListFormDTO formDTO);
void synchro(VaccineListFormDTO formDTO);
/**
* @Author sun
* @Author zxc
* @Description 核酸核酸检测信息取消同步
**/
void cancelSynchro(MyNatListFormDTO formDTO);
void cancelSynchro(VaccineListFormDTO formDTO);
/**
* 执行Excel导入
@ -76,20 +51,4 @@ public interface IcVaccineService extends BaseService<IcVaccineEntity> {
*/
void execAsyncExcelImport(Path filePath, String importTaskId);
/**
* 核酸检测信息
* @Param idCard
* @Return {@link List<NatListDTO>}
* @Author zhaoqifeng
* @Date 2022/3/29 16:29
*/
List<NatListDTO> getNatList(String customerId, String idCard);
/**
* desc:根据用户id 更新核酸中是否居民状态
* @param customerId
* @param icResiUserId 如果为空则更新全部
* @return
*/
Integer updateIsResiFlag(String customerId, String icResiUserId);
}

245
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java

@ -10,15 +10,14 @@ 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.exception.RenException;
import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
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.*;
import com.epmet.dto.form.*;
import com.epmet.dao.*;
import com.epmet.dto.IcNatDTO;
import com.epmet.dto.IcNoticeDTO;
import com.epmet.dto.form.AddIcNatFormDTO;
@ -42,7 +41,6 @@ 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;
@ -58,7 +56,6 @@ import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
import java.util.stream.Collectors;
/**
* 疫苗接种记录
@ -73,8 +70,6 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
@Autowired
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private IcNoticeService icNoticeService;
@Autowired
private OssFeignClient ossFeignClient;
@ -93,55 +88,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
/**
* @Author sun
* @Description 核酸检测-上报核酸记录
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void add(AddIcNatFormDTO formDTO) {
//0.先根据身份证号和检查时间以及检测结果校验数据是否存在
IcNatDTO icNatDTO = baseDao.getNatDTO(formDTO.getCustomerId(), null, formDTO.getIdCard(), DateUtils.format(formDTO.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE), null);
//按身份证号核酸时间存在记录的 核酸结果相同的提示已存在相同记录核酸结果不同的提示已存在去修改【业务要求的】
if (null != icNatDTO && icNatDTO.getNatResult().equals(formDTO.getNatResult())) {
throw new RenException(EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getCode(), EpmetErrorCode.IC_NAT_IDCARD_NATTIME.getMsg());
} else if (null != icNatDTO && !icNatDTO.getNatResult().equals(formDTO.getNatResult())) {
throw new RenException(EpmetErrorCode.IC_NAT.getCode(), EpmetErrorCode.IC_NAT.getMsg());
}
//1.获取所填居民所属组织缓存信息
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getAgencyId());
if (null == agencyInfo) {
throw new RenException(String.format("获取组织缓存信息失败%s", formDTO.getAgencyId()));
}
//2.新增核酸基础信息数据
IcVaccineEntity entity = ConvertUtils.sourceToTarget(formDTO, IcVaccineEntity.class);
if (com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(formDTO.getUserId())) {
entity.setIsResiUser("1");
}
insert(entity);
//3.核酸记录关系表新增与组织的关系数据
IcNatRelationEntity relationEntity = ConvertUtils.sourceToTarget(formDTO, IcNatRelationEntity.class);
relationEntity.setIcNatId(entity.getId());
relationEntity.setPids(com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(agencyInfo.getPids()) ? agencyInfo.getPids() + ":" + formDTO.getAgencyId() : formDTO.getAgencyId());
icNatRelationDao.insert(relationEntity);
//3.新增通知表信息
if (formDTO.getChannel().size() > NumConstant.ZERO) {
SendNoticeFormDTO dto = new SendNoticeFormDTO();
List<SendNoticeFormDTO.UserListBean> userList = new ArrayList<>();
userList.add(ConvertUtils.sourceToTarget(formDTO, SendNoticeFormDTO.UserListBean.class));
dto.setCustomerId(formDTO.getCustomerId());
dto.setUserList(userList);
dto.setChannel(formDTO.getChannel());
dto.setOrigin("2");
dto.setContent(formDTO.getContent());
dto.setStaffId(formDTO.getStaffId());
icNoticeService.sendNotice(dto);
}
}
/**
* @Author sun
* @Description 核酸检测-居民端我的上报
* @Description 疫苗接种-居民端我的上报
**/
@Override
public List<MyNatListResultDTO> myNatList(MyNatListFormDTO formDTO) {
@ -157,13 +104,14 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
/**
* @Author sun
* @Description 核酸本组织及下级核酸检测信息列表
* @Description 疫苗本组织及下级疫苗接种信息列表
*
* @param formDTO
* @return*/
@Override
public PageData<NatListResultDTO> natList(MyNatListFormDTO formDTO) {
public PageData<IcVaccineListResultDTO> icVaccineList(VaccineListFormDTO formDTO) {
//1.根据是查询客户数据还是本辖区数据走不同逻辑
if ("current".equals(formDTO.getOrgType())) {
if ("current".equals(formDTO.getSearchType())) {
//本辖区数据
//2.获取工作人员缓存信息
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId());
@ -172,13 +120,13 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
}
formDTO.setAgencyId(staffInfo.getAgencyId());
//3.按条件查询业务数据
PageInfo<NatListResultDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage())
.doSelectPageInfo(() -> baseDao.getNatList(formDTO));
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.getOrgType())) {
} else if ("all".equals(formDTO.getSearchType())) {
//客户下数据
PageInfo<NatListResultDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage())
.doSelectPageInfo(() -> baseDao.getCustomerNatList(formDTO));
PageInfo<IcVaccineListResultDTO> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage())
.doSelectPageInfo(() -> baseDao.getCustomerIcVaccineList(formDTO));
return new PageData(data.getList(), data.getTotal());
}
@ -186,93 +134,17 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
}
/**
* @Author sun
* @Description 核酸核酸检测信息详情
**/
@Override
public IcNatDTO detail(MyNatListFormDTO formDTO) {
IcNatDTO resultDTO = new IcNatDTO();
//1.查询核酸记录信息
IcVaccineEntity entity = baseDao.selectById(formDTO.getIcNatId());
if (null == resultDTO) {
return resultDTO;
}
resultDTO = ConvertUtils.sourceToTarget(entity, IcNatDTO.class);
//2.查询对应的通知记录信息
IcNoticeDTO dto = icNoticeService.getNotice(entity.getCustomerId(), entity.getIdCard());
if (null != dto) {
resultDTO.setChannel(dto.getChannelList());
resultDTO.setContent(dto.getContent());
}
return resultDTO;
}
/**
* @Author sun
* @Description 核酸核酸检测信息修改
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void edit(AddIcNatFormDTO formDTO) {
//0.先根据身份证号和检测时间以及检测结果校验除当前数据是否还存在相同数据
IcNatDTO icNatDTO = baseDao.getNatDTO(formDTO.getCustomerId(), formDTO.getIcNatId(), formDTO.getIdCard(), DateUtils.format(formDTO.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE), formDTO.getNatResult());
if (null != icNatDTO) {
throw new RenException(EpmetErrorCode.IC_NAT.getCode(), EpmetErrorCode.IC_NAT.getMsg());
}
//1.更新核酸记录基础信息表数据
IcVaccineEntity entity = ConvertUtils.sourceToTarget(formDTO, IcVaccineEntity.class);
entity.setId(formDTO.getIcNatId());
if (!updateById(entity)) {
log.error(String.format("数据修改失败,核酸记录Id->%s", formDTO.getIcNatId()));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "核酸记录修改失败");
}
//修改只涉及到基础信息的修改 不会修改关系数据 关系表不涉及更新
//3.新增通知表信息
if (CollectionUtils.isNotEmpty(formDTO.getChannel())) {
SendNoticeFormDTO dto = new SendNoticeFormDTO();
List<SendNoticeFormDTO.UserListBean> userList = new ArrayList<>();
userList.add(ConvertUtils.sourceToTarget(formDTO, SendNoticeFormDTO.UserListBean.class));
dto.setCustomerId(formDTO.getCustomerId());
dto.setUserList(userList);
dto.setChannel(formDTO.getChannel());
dto.setOrigin("2");
dto.setContent(formDTO.getContent());
dto.setStaffId(formDTO.getStaffId());
icNoticeService.sendNotice(dto);
}
}
/**
* @Author sun
* @Description 核酸核酸检测信息删除/取消同步
* @Author zxc
* @Description 疫苗疫苗接种信息同步
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void del(MyNatListFormDTO formDTO) {
//1.确定删除则需要删除基础数据以及所有可能存在的关系数据,物理删除业务数据
if (baseDao.delById(formDTO.getIcNatId()) < NumConstant.ONE) {
log.error(String.format("数据删除失败,核酸记录Id->%s", formDTO.getIcNatId()));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "数据删除失败");
}
//关系数据删除
icNatRelationDao.delRelation(formDTO.getIcNatId(), null);
}
/**
* @Author sun
* @Description 核酸核酸检测信息同步
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void synchro(MyNatListFormDTO formDTO) {
//1.检验核酸基础信息是否存在
IcVaccineEntity entity = baseDao.selectById(formDTO.getIcNatId());
public void synchro(VaccineListFormDTO formDTO) {
//1.检验疫苗基础信息是否存在
IcVaccineEntity entity = baseDao.selectById(formDTO.getIcVaccineId());
if (null == entity) {
log.error(String.format("核酸记录数据不存在同步失败,核酸记录Id->%s", formDTO.getIcNatId()));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "数据同步失败,核酸记录数据不存在");
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());
@ -280,32 +152,33 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId()));
}
//2.不管是否已存在关系数据都是先删后增
icNatRelationDao.delRelation(formDTO.getIcNatId(), staffInfo.getAgencyId());
icVaccineRelationDao.delRelation(formDTO.getIcVaccineId(), staffInfo.getAgencyId());
//3.新增关系数据
IcNatRelationEntity relationEntity = new IcNatRelationEntity();
relationEntity.setCustomerId(formDTO.getCustomerId());
relationEntity.setIcNatId(formDTO.getIcNatId());
relationEntity.setAgencyId(staffInfo.getAgencyId());
relationEntity.setPids(com.baomidou.mybatisplus.core.toolkit.StringUtils.isNotBlank(staffInfo.getAgencyPIds())?staffInfo.getAgencyPIds()+":"+staffInfo.getAgencyId():staffInfo.getAgencyId());
relationEntity.setUserType("synchro");
icNatRelationDao.insert(relationEntity);
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 sun
* @Description 核酸核酸检测信息取消同步
**/
* @Author zxc
* @Description 疫苗疫苗接种信息取消同步
*
* @param formDTO*/
@Override
@Transactional(rollbackFor = Exception.class)
public void cancelSynchro(MyNatListFormDTO formDTO) {
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 (icNatRelationDao.delRelation(formDTO.getIcNatId(), staffInfo.getAgencyId()) < NumConstant.ONE) {
log.error(String.format("数据取消同步失败,核酸记录Id->%s", formDTO.getIcNatId()));
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(), "取消同步操作失败");
}
}
@ -314,7 +187,6 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
@Override
public void execAsyncExcelImport(Path filePath, String importTaskId) {
String userId = null;
try {
userId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID);
String app = EpmetRequestHolder.getHeader(AppClientConstant.APP);
@ -374,11 +246,11 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm);
if (!result.success()) {
log.error("【核酸检测导入】finishImportTask失败");
log.error("【疫苗接种导入】finishImportTask失败");
}
} catch (Exception e) {
String errorMsg = ExceptionUtils.getErrorStackTrace(e);
log.error("【核酸检测导入】出错:{}", errorMsg);
log.error("【疫苗接种导入】出错:{}", errorMsg);
ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO();
importFinishTaskForm.setTaskId(importTaskId);
@ -388,7 +260,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm);
if (!result.success()) {
log.error("【核酸检测导入】导入记录状态修改为'完成'失败");
log.error("【疫苗接种导入】导入记录状态修改为'完成'失败");
}
} finally {
// 删除临时文件
@ -403,49 +275,6 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
}
/**
* 核酸检测信息
*
* @param idCard
* @Param idCard
* @Return {@link List< NatListDTO >}
* @Author zhaoqifeng
* @Date 2022/3/29 16:29
*/
@Override
public List<NatListDTO> getNatList(String customerId, String idCard) {
LambdaQueryWrapper<IcVaccineEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcVaccineEntity::getCustomerId, customerId);
wrapper.eq(IcVaccineEntity::getIdCard, idCard);
wrapper.orderByDesc(IcVaccineEntity::getNatTime);
List<IcVaccineEntity> list = baseDao.selectList(wrapper);
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
return list.stream().map(item -> {
NatListDTO dto = new NatListDTO();
dto.setAddress(item.getNatAddress());
dto.setTestTime(DateUtils.format(item.getNatTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE));
switch (item.getNatResult())
{
case NumConstant.ZERO_STR:
dto.setResult("阴性");
break;
case NumConstant.ONE_STR:
dto.setResult("阳性");
break;
default:
dto.setResult("未知");
}
return dto;
}).collect(Collectors.toList());
}
@Override
public Integer updateIsResiFlag(String customerId, String icResiUserId) {
return baseDao.updateIsResiFlag(customerId,icResiUserId);
}
/**
* 批量持久化
* @param entities

4
epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml

@ -30,7 +30,7 @@
ORDER BY nat_time DESC
</select>
<select id="getNatList" resultType="com.epmet.dto.result.NatListResultDTO">
<select id="getIcVaccineList" resultType="com.epmet.dto.result.NatListResultDTO">
SELECT
a.ic_nat_id icNatId,
a.agency_id agencyId,
@ -72,7 +72,7 @@
ORDER BY b.nat_time DESC, b.id ASC
</select>
<select id="getCustomerNatList" resultType="com.epmet.dto.result.NatListResultDTO">
<select id="getCustomerIcVaccineList" resultType="com.epmet.dto.result.NatListResultDTO">
SELECT
id icNatId,
user_id userId,

10
epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineRelationDao.xml

@ -3,4 +3,14 @@
<mapper namespace="com.epmet.dao.IcVaccineRelationDao">
<delete id="delRelation">
DELETE
FROM ic_nat_relation
WHERE
ic_nat_id = #{icNatId}
<if test='null != agencyId and "" != agencyId'>
AND AGENCY_ID = #{agencyId}
</if>
</delete>
</mapper>
Loading…
Cancel
Save