Browse Source

Merge remote-tracking branch 'origin/master'

dev
sunyuchao 3 years ago
parent
commit
549268b602
  1. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
  2. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  3. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceRecordDao.java
  4. 1
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceProjectServiceImpl.java
  5. 21
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceRecordServiceImpl.java
  6. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceProjectDao.xml
  7. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordDao.xml
  8. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVaccineDTO.java
  9. 96
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcVaccineFormDTO.java
  10. 10
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EpidemicPreventionFormDTO.java
  11. 10
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinationListFormDTO.java
  12. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/EpidemicPreventionResultDTO.java
  13. 25
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java
  14. 39
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineController.java
  15. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcVaccineDao.java
  16. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVaccineEntity.java
  17. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/VaccinationExportExcel.java
  18. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcVaccineService.java
  19. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java
  20. 1
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java
  21. 1
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  22. 93
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcVaccineServiceImpl.java
  23. 6
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.59__alter_ic_vaccine.sql
  24. 10
      epmet-user/epmet-user-server/src/main/resources/mapper/IcEpidemicSpecialAttentionDao.xml
  25. 2
      epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml
  26. 7
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml
  27. 31
      epmet-user/epmet-user-server/src/main/resources/mapper/IcVaccineDao.xml

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java

@ -27,7 +27,9 @@ public interface NumConstant {
int ELEVEN = 11;
int TWELVE = 12;
int THIRTEEN = 13;
int SIXTEEN = 16;
int SEVENTEEN = 17;
int EIGHTEEN = 18;
int FIFTEEN = 15;
int FOURTEEN=14;
int TWENTY = 20;

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -258,6 +258,7 @@ public enum EpmetErrorCode {
IC_MOVE_IN(8926,"居民信息中房屋信息与当前选择房屋不一致,是否更新?"),
NOT_REGEIST_RESI(8927,"未注册居民"),
UNIT_EXIST_HOUSES_ERROR(8928,"单元下存在房屋,不可修改单元数"),
IC_VACCINE(8929,"已存在相同记录,请去修改原有记录"),
MISMATCH(10086,"人员与房屋信息不匹配,请与工作人员联系。"),

3
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcServiceRecordDao.java

@ -25,5 +25,6 @@ public interface IcServiceRecordDao extends BaseDao<IcServiceRecordEntity> {
@Param("serviceTimeStart") Date serviceTimeStart,
@Param("serviceTimeEnd") Date serviceTimeEnd,
@Param("serviceStatus") String serviceStatus,
@Param("satisfaction") String satisfaction);
@Param("satisfaction") String satisfaction,
@Param("searchOrgIdPath") String searchOrgIdPath);
}

1
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceProjectServiceImpl.java

@ -150,6 +150,7 @@ public class IcServiceProjectServiceImpl extends BaseServiceImpl<IcServiceProjec
if (null == staffInfo){
throw new EpmetException("未查询到此工作人员"+formDTO.getUserId());
}
//查询当前组织及下级 的数据
formDTO.setAgencyId(staffInfo.getAgencyId());
PageInfo<ServiceProjectListResultDTO> pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> baseDao.getServiceProjectList(formDTO));
if (CollectionUtils.isNotEmpty(pageInfo.getList())){

21
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcServiceRecordServiceImpl.java

@ -2,15 +2,18 @@ package com.epmet.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.DictTypeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
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.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.EpmetRequestHolder;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.*;
import com.epmet.dto.IcNeighborHoodDTO;
@ -147,8 +150,22 @@ public class IcServiceRecordServiceImpl extends BaseServiceImpl<IcServiceRecordD
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), msg, msg);
}
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(),
EpmetRequestHolder.getLoginUserId());
// 当前组织的PIDS。只查询当前组织及下级的服务记录
String searchOrgIdPath = "";
if (StringUtils.isBlank(staffInfo.getAgencyPIds()) || "0".equals(staffInfo.getAgencyPIds())) {
searchOrgIdPath = staffInfo.getAgencyId();
} else {
searchOrgIdPath = staffInfo.getAgencyPIds().concat(":").concat(staffInfo.getAgencyId());
}
PageHelper.startPage(pageNo, pageSize);
List<ServiceProjectRecordResultDTO> records = baseDao.listServiceRecords(serviceCategoryKey, serviceProjectName, serviceOrgName, serviceTimeStart, serviceTimeEnd, serviceStatus, satisfaction);
List<ServiceProjectRecordResultDTO> records = baseDao.listServiceRecords(
serviceCategoryKey, serviceProjectName, serviceOrgName, serviceTimeStart, serviceTimeEnd, serviceStatus, satisfaction, searchOrgIdPath);
PageInfo<ServiceProjectRecordResultDTO> pi = new PageInfo<>(records);
// 补充信息
@ -260,7 +277,7 @@ public class IcServiceRecordServiceImpl extends BaseServiceImpl<IcServiceRecordD
if ("0".equals(agencyInfo.getPid())) {
return new String[]{ agencyInfo.getId(), agencyInfo.getOrganizationName() };
}
return new String[]{ agencyInfo.getPids().concat(":").concat(agencyInfo.getPid()), agencyInfo.getOrganizationName() };
return new String[]{ agencyInfo.getPids().concat(":").concat(agencyInfo.getId()), agencyInfo.getOrganizationName() };
} else if ("grid".equals(scopeObjectType)) {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(scopeObjectId);
// 网格的pids是到社区的

2
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceProjectDao.xml

@ -43,7 +43,7 @@
AND ID = #{serviceProjectId}
</if>
<if test='null != agencyId and agencyId != "" '>
AND AGENCY_ID = #{agencyId}
AND AGENCY_ID_PATH like concat( '%',#{agencyId},'%')
</if>
<if test='null != serviceCategoryKey and serviceCategoryKey != "" '>
AND SERVICE_CATEGORY_KEY = #{serviceCategoryKey}

4
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcServiceRecordDao.xml

@ -36,6 +36,7 @@
record.SERVICE_STATUS,
record.SERVICE_PEOPLE_NUMBER
from ic_service_record record
inner join ic_service_scope scope on (scope.DEL_FLAG = '0' and record.ID = scope.SERVICE_RECORD_ID)
left join ic_service_feedback feedback on (record.ID = feedback.SERVICE_RECORD_ID)
<where>
record.DEL_FLAG = '0'
@ -61,6 +62,9 @@
<if test="satisfaction != null and satisfaction != ''">
and feedback.SATISFACTION = #{satisfaction}
</if>
<if test="searchOrgIdPath != null and searchOrgIdPath != ''">
and scope.OBJECT_ID_PATH like CONCAT(#{searchOrgIdPath}, '%')
</if>
</where>
order by record.CREATED_TIME desc
</select>

5
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVaccineDTO.java

@ -47,6 +47,11 @@ public class IcVaccineDTO implements Serializable {
*/
private String isResiUser;
/**
* 数字社区的icResiUserId其他情况无值
*/
private String userId;
/**
* 数据来源导入的import;
*/

96
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/AddIcVaccineFormDTO.java

@ -0,0 +1,96 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @Description 核酸检测-上报核酸记录
* @Author sun
*/
@Data
public class AddIcVaccineFormDTO implements Serializable {
private static final long serialVersionUID = 9156247659994638103L;
public interface Vaccine extends CustomerClientShowGroup {
}
public interface Edit extends CustomerClientShowGroup {
}
/**
* 核酸记录Id,修改时使用
*/
@NotBlank(message = "核酸记录Id不能为空", groups = Edit.class)
private String vaccineId;
/**
* 当前网格所属组织Id
*/
@NotBlank(message = "组织Id不能为空", groups = Vaccine.class)
private String agencyId;
/**
* 居民端小程序的用户id数字社区的icResiUserId其他情况无值
*/
private String userId;
/**
* 数据来源居民端小程序的人resi; 数字社区的居民icresi; 导入的import;
*/
@NotBlank(message = "居民来源不能为空", groups = Vaccine.class)
private String userType;
/**
* 姓名
*/
@NotBlank(message = "姓名不能为空", groups = Vaccine.class)
private String name;
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空", groups = Vaccine.class)
private String mobile;
/**
* 身份证号
*/
@NotBlank(message = "身份证号不能为空", groups = Vaccine.class)
private String idCard;
/**
* 接种时间
*/
@NotNull(message = "接种时间不能为空", groups = Vaccine.class)
@JsonFormat(pattern="yyyy-MM-dd HH:mm")
private Date inoculateTime;
/**
* 接种地点
*/
@NotBlank(message = "接种地点不能为空", groups = Vaccine.class)
private String inoculateAddress;
/**
* 疫苗厂家
*/
@NotBlank(message = "疫苗厂家不能为空", groups = Vaccine.class)
private String manufacturer;
/**
* 是否客户下居民(0: 1:)
*/
private String isResiUser = "0";
/**
* 通知渠道 0小程序通知1短信通知多选是数组
*/
private List<String> channel = new ArrayList<>();
/**
* 通知内容
*/
private String content = "";
//token中信息
private String customerId;
private String staffId;
private String client;
}

10
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/EpidemicPreventionFormDTO.java

@ -80,4 +80,14 @@ public class EpidemicPreventionFormDTO extends PageFormDTO implements Serializab
* 关注类型核酸检测2疫苗接种1
*/
private Integer attentionType;
/**
* 年龄段查询起始生日
*/
private String startBirthDay;
/**
* 年龄段查询截止生日
*/
private String endBirthDay;
}

10
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/VaccinationListFormDTO.java

@ -82,4 +82,14 @@ public class VaccinationListFormDTO extends PageFormDTO implements Serializable
* user所属组织ID
*/
private String orgId;
/**
* 开始时间 eg20220706
*/
private String startDate;
/**
* 结束时间 eg20220706
*/
private String endDate;
}

5
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/EpidemicPreventionResultDTO.java

@ -37,6 +37,9 @@ public class EpidemicPreventionResultDTO implements Serializable {
* 身份证
*/
private String idCard;
private String birthDay;
/**
* 疫苗接种次数
*/
@ -45,4 +48,6 @@ public class EpidemicPreventionResultDTO implements Serializable {
* 核酸检测次数
*/
private Integer natCount;
private String createdTime;
}

25
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/VaccinationListResultDTO.java

@ -2,6 +2,7 @@ package com.epmet.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
@ -39,6 +40,7 @@ public class VaccinationListResultDTO implements Serializable {
* 身份证
*/
private String idCard;
private String sex;
/**
* 备注
@ -110,4 +112,27 @@ public class VaccinationListResultDTO implements Serializable {
this.lastInformTime = "";
this.reason = "";
}
public void setSex(){
if (StringUtils.isBlank(getIdCard())){
this.sex = "未知";
}else {
if (this.idCard.length() == NumConstant.FIFTEEN){
if (Integer.parseInt(this.idCard.substring(NumConstant.FOURTEEN, NumConstant.FIFTEEN)) % NumConstant.TWO == NumConstant.ZERO) {
sex = "女";
} else {
sex = "男";
}
}else if (this.idCard.length() == NumConstant.EIGHTEEN){
if (Integer.parseInt(this.idCard.substring(NumConstant.SIXTEEN).substring(NumConstant.ZERO,NumConstant.ONE)) % NumConstant.TWO == NumConstant.ZERO) {
sex = "女";
} else {
sex = "男";
}
}else {
this.sex = "未知";
}
}
}
}

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

@ -20,6 +20,7 @@ import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.constants.ImportTaskConstants;
import com.epmet.dto.IcVaccineDTO;
import com.epmet.dto.form.AddIcVaccineFormDTO;
import com.epmet.dto.form.IcVaccineFormDTO;
import com.epmet.dto.form.VaccineListFormDTO;
import com.epmet.dto.result.IcVaccineListCommonExcelResultDTO;
@ -237,5 +238,43 @@ public class IcVaccineController implements ResultDataResolver {
return new Result<IcVaccineDTO>().ok(icVaccineService.detail(formDTO.getVaccineId()));
}
/**
* @Author sun
* @Description 疫苗疫苗接种信息新增
**/
@PostMapping("add")
public Result add(@LoginUser TokenDto tokenDto, @RequestBody AddIcVaccineFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, AddIcVaccineFormDTO.Vaccine.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setStaffId(tokenDto.getUserId());
formDTO.setClient(tokenDto.getClient());
icVaccineService.add(formDTO);
return new Result();
}
/**
* @Author sun
* @Description 疫苗疫苗接种信息修改
**/
@PostMapping("edit")
public Result edit(@LoginUser TokenDto tokenDto, @RequestBody AddIcVaccineFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, AddIcVaccineFormDTO.Edit.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setStaffId(tokenDto.getUserId());
icVaccineService.edit(formDTO);
return new Result();
}
/**
* @Author sun
* @Description 疫苗疫苗接种信息删除
**/
@PostMapping("del")
public Result del(@RequestBody IcVaccineFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, IcVaccineFormDTO.Detail.class);
icVaccineService.del(formDTO);
return new Result<>();
}
}

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

@ -2,6 +2,7 @@ package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.IcNatDTO;
import com.epmet.dto.IcVaccineDTO;
import com.epmet.dto.form.MyNatListFormDTO;
import com.epmet.dto.form.VaccineListFormDTO;
import com.epmet.dto.result.IcVaccineListResultDTO;
@ -44,7 +45,7 @@ public interface IcVaccineDao extends BaseDao<IcVaccineEntity> {
* @Author sun
* @Description 删除操作--物理删除业务数据
**/
int delById(@Param("icNatId") String icNatId);
int delById(@Param("icVaccineId") String icVaccineId);
/**
* @Author sun
@ -60,4 +61,7 @@ public interface IcVaccineDao extends BaseDao<IcVaccineEntity> {
* @return
*/
int updateIsResiFlag(@Param("customerId") String customerId, @Param("icResiUserId") String icResiUserId);
IcVaccineDTO getVaccineDTO(@Param("customerId") String customerId, @Param("icVaccineId") String icVaccineId, @Param("idCard") String idCard, @Param("inoculateTime") String inoculateTime);
}

5
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVaccineEntity.java

@ -48,6 +48,11 @@ public class IcVaccineEntity extends BaseEpmetEntity {
*/
private String isResiUser;
/**
* 数字社区的icResiUserId其他情况无值
*/
private String userId;
/**
* 数据来源导入的import;
*/

6
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/VaccinationExportExcel.java

@ -23,6 +23,12 @@ public class VaccinationExportExcel {
@Excel(name = "身份证",width = 30)
private String idCard;
@Excel(name = "性别",width = 30)
private String sex;
@Excel(name = "关注原因",width = 40)
private String reason;
@Excel(name = "备注",width = 40)
private String remark;

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

@ -3,6 +3,8 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcVaccineDTO;
import com.epmet.dto.form.AddIcVaccineFormDTO;
import com.epmet.dto.form.IcVaccineFormDTO;
import com.epmet.dto.form.VaccineListFormDTO;
import com.epmet.dto.result.IcVaccineListResultDTO;
import com.epmet.dto.result.VaccineListDTO;
@ -60,4 +62,10 @@ public interface IcVaccineService extends BaseService<IcVaccineEntity> {
* @Description 疫苗接种情况-列表点击查询详情
**/
IcVaccineDTO detail(String vaccineId);
void add(AddIcVaccineFormDTO formDTO);
void edit(AddIcVaccineFormDTO formDTO);
void del(IcVaccineFormDTO formDTO);
}

6
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcEpidemicSpecialAttentionServiceImpl.java

@ -165,7 +165,11 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi
result.setTotal(list.size());
}
}
if (CollectionUtils.isNotEmpty(result.getList())){
result.getList().forEach(v -> {
v.setSex();
});
}
//需求调整 列表和导出增加所属房屋(小区+楼栋+单元+房间)一列值 sun
Map<String, HouseInfoDTO> houseInfoMap = new HashMap<>();
//查询房屋信息

1
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcNatServiceImpl.java

@ -591,6 +591,7 @@ public class IcNatServiceImpl extends BaseServiceImpl<IcNatDao, IcNatEntity> imp
LambdaQueryWrapper<IcResiUserEntity> query = new LambdaQueryWrapper();
query.eq(IcResiUserEntity::getCustomerId, customerId);
query.eq(IcResiUserEntity::getIdCard, idCard);
query.eq(IcResiUserEntity::getStatus,NumConstant.ZERO_STR);
if (StringUtils.isNotBlank(pids)) {
query.likeRight(IcResiUserEntity::getPids, pids);
}

1
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -762,6 +762,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
}
LambdaQueryWrapper<IcResiUserEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcResiUserEntity::getHomeId, homeId);
wrapper.eq(IcResiUserEntity::getStatus,NumConstant.ZERO_STR);
wrapper.orderByAsc(IcResiUserEntity::getYhzgx);
List<IcResiUserEntity> list = baseDao.selectList(wrapper);

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

@ -10,21 +10,25 @@ 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.IcResiUserDao;
import com.epmet.dao.IcVaccineDao;
import com.epmet.dao.IcVaccineRelationDao;
import com.epmet.dto.IcNatDTO;
import com.epmet.dto.IcVaccineDTO;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.form.VaccineListFormDTO;
import com.epmet.dto.form.*;
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.IcNatEntity;
import com.epmet.entity.IcResiUserEntity;
import com.epmet.entity.IcVaccineEntity;
import com.epmet.entity.IcVaccineRelationEntity;
@ -33,6 +37,7 @@ 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.IcNoticeService;
import com.epmet.service.IcVaccineService;
import com.epmet.service.UserService;
import com.epmet.utils.ImportTaskUtils;
@ -77,6 +82,8 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
private IcResiUserDao icResiUserDao;
@Autowired
private UserService userService;
@Autowired
private IcNoticeService icNoticeService;
/**
* @Author sun
@ -394,6 +401,7 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
LambdaQueryWrapper<IcResiUserEntity> query = new LambdaQueryWrapper();
query.eq(IcResiUserEntity::getCustomerId, customerId);
query.eq(IcResiUserEntity::getIdCard, idCard);
query.eq(IcResiUserEntity::getStatus,NumConstant.ZERO_STR);
if (StringUtils.isNotBlank(pids)) {
query.likeRight(IcResiUserEntity::getPids, pids);
}
@ -475,4 +483,85 @@ public class IcVaccineServiceImpl extends BaseServiceImpl<IcVaccineDao, IcVaccin
return ConvertUtils.sourceToTarget(entity, IcVaccineDTO.class);
}
@Override
public void add(AddIcVaccineFormDTO formDTO) {
//0.先根据身份证号和接种时间校验数据是否存在
IcVaccineDTO icVaccineDTO = baseDao.getVaccineDTO(formDTO.getCustomerId(), null, formDTO.getIdCard(), DateUtils.format(formDTO.getInoculateTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE));
if (null != icVaccineDTO) {
throw new RenException(EpmetErrorCode.IC_VACCINE.getCode(), EpmetErrorCode.IC_VACCINE.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 (StringUtils.isNotBlank(formDTO.getUserId())) {
entity.setIsResiUser("1");
}
insert(entity);
//3.疫苗记录关系表新增与组织的关系数据
IcVaccineRelationEntity relationEntity = ConvertUtils.sourceToTarget(formDTO, IcVaccineRelationEntity.class);
relationEntity.setIcVaccineId(entity.getId());
relationEntity.setPids(StringUtils.isNotBlank(agencyInfo.getPids()) ? agencyInfo.getPids() + ":" + formDTO.getAgencyId() : formDTO.getAgencyId());
icVaccineRelationDao.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("1");
dto.setContent(formDTO.getContent());
dto.setStaffId(formDTO.getStaffId());
icNoticeService.sendNotice(dto);
}
}
@Override
public void edit(AddIcVaccineFormDTO formDTO) {
//0.先根据身份证号和接种时间校验除当前数据是否还存在相同数据
IcVaccineDTO icVaccineDTO = baseDao.getVaccineDTO(formDTO.getCustomerId(), formDTO.getVaccineId(), formDTO.getIdCard(), DateUtils.format(formDTO.getInoculateTime(), DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE));
if (null != icVaccineDTO) {
throw new RenException(EpmetErrorCode.IC_VACCINE.getCode(), EpmetErrorCode.IC_VACCINE.getMsg());
}
//1.更新核酸记录基础信息表数据
IcVaccineEntity entity = ConvertUtils.sourceToTarget(formDTO, IcVaccineEntity.class);
entity.setId(formDTO.getVaccineId());
if (!updateById(entity)) {
log.error(String.format("数据修改失败,核酸记录Id->%s", formDTO.getVaccineId()));
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("1");
dto.setContent(formDTO.getContent());
dto.setStaffId(formDTO.getStaffId());
icNoticeService.sendNotice(dto);
}
}
@Override
public void del(IcVaccineFormDTO formDTO) {
//1.确定删除则需要删除基础数据以及所有可能存在的关系数据,物理删除业务数据
if (baseDao.delById(formDTO.getVaccineId()) < NumConstant.ONE) {
log.error(String.format("数据删除失败,疫苗接种记录Id->%s", formDTO.getVaccineId()));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "数据删除失败");
}
//关系数据删除
icVaccineRelationDao.delRelation(formDTO.getVaccineId(), null);
}
}

6
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.59__alter_ic_vaccine.sql

@ -0,0 +1,6 @@
ALTER TABLE `ic_vaccine`
ADD COLUMN `USER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '数字社区的icResiUserId、其他情况无值' AFTER `USER_TYPE`;

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

@ -24,7 +24,7 @@
a.`NAME`,
a.MOBILE,
a.ID_CARD,
a.reason,
IFNULL(a.reason,'') AS reason,
a.REMARK,
b.VILLAGE_ID,
b.BUILD_ID,
@ -34,7 +34,7 @@
IFNULL(v.vaccinationCount,0) AS vaccinationCount
FROM ic_epidemic_special_attention a
LEFT JOIN ic_resi_user b ON a.id_card = b.id_card AND b.del_flag = '0' and b.CUSTOMER_ID=a.CUSTOMER_ID
LEFT JOIN (SELECT id_card , CUSTOMER_ID, count(1) AS vaccinationCount FROM ic_vaccine WHERE DEL_FLAG = 0 GROUP BY ID_CARD, CUSTOMER_ID) v ON (v.ID_CARD = a.ID_CARD and v.CUSTOMER_ID=a.CUSTOMER_ID)
LEFT JOIN (SELECT id_card , CUSTOMER_ID, count(1) AS vaccinationCount, CREATED_TIME FROM ic_vaccine WHERE DEL_FLAG = 0 GROUP BY ID_CARD, CUSTOMER_ID) v ON (v.ID_CARD = a.ID_CARD and v.CUSTOMER_ID=a.CUSTOMER_ID)
WHERE a.DEL_FLAG = 0
AND a.ORG_ID = #{orgId}
AND a.ATTENTION_TYPE = #{attentionType}
@ -59,6 +59,12 @@
<if test='null != homeId and "" != homeId'>
AND b.home_id = #{homeId}
</if>
<if test='null != startDate and "" != startDate'>
AND DATE_FORMAT(v.CREATED_TIME,'%Y%m%d') >= #{startDate}
</if>
<if test='null != endDate and "" != endDate'>
AND DATE_FORMAT(v.CREATED_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{endDate}
</if>
<if test=' null != vaccinationCount'>
HAVING vaccinationCount = #{vaccinationCount}
</if>

2
epmet-user/epmet-user-server/src/main/resources/mapper/IcNatDao.xml

@ -142,7 +142,7 @@
<update id="updateIsResiFlag">
UPDATE ic_nat m,
(
SELECT if(DEL_FLAG,0,1) resiFlag, ID_CARD FROM ic_resi_user
SELECT if(STATUS ='0', 1, 0) resiFlag, ID_CARD FROM ic_resi_user
WHERE
1=1
<if test="icResiUserId != null and icResiUserId != ''">

7
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

@ -824,6 +824,7 @@
HOME_ID,
MOBILE,
a.ID_CARD,
a.BIRTHDAY,
IFNULL( b.count, 0 ) AS vaccineCount,
IFNULL( c.count, 0 ) AS natCount
FROM
@ -886,6 +887,12 @@
<if test="idCard != null and idCard != ''">
AND a.ID_CARD LIKE concat( '%', #{idCard}, '%' )
</if>
<if test=" null != startBirthDay and startBirthDay != '' ">
AND a.BIRTHDAY <![CDATA[ >= ]]> #{startBirthDay}
</if>
<if test="null != endBirthDay and endBirthDay != '' ">
AND a.BIRTHDAY <![CDATA[ <= ]]> #{endBirthDay}
</if>
ORDER BY GRID_ID,VILLAGE_ID,BUILD_ID,UNIT_ID,HOME_ID, convert(NAME using gbk)
) t
WHERE

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

@ -40,7 +40,8 @@
b.id_card,
b.INOCULATE_TIME,
b.INOCULATE_ADDRESS,
b.MANUFACTURER
b.MANUFACTURER,
b.user_id
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'
@ -71,6 +72,7 @@
SELECT
id vaccineId,
is_resi_user isResiUser,
user_id userId,
user_type userType,
`name` `name`,
mobile mobile,
@ -126,8 +128,33 @@
LIMIT 1
</select>
<select id="getVaccineDTO" resultType="com.epmet.dto.IcVaccineDTO">
SELECT
id,
is_resi_user,
user_type,
`name`,
mobile,
id_card,
is_resi_user,
inoculate_time,
inoculate_time,
manufacturer
FROM
ic_vaccine
WHERE
del_flag = '0'
AND customer_id = #{customerId}
AND id_card = #{idCard}
AND DATE_FORMAT(inoculate_time, '%Y-%m-%d %h:%i') = DATE_FORMAT(#{inoculateTime}, '%Y-%m-%d %h:%i')
<if test='null != icVaccineId and "" != icVaccineId'>
AND id != #{icVaccineId}
</if>
LIMIT 1
</select>
<delete id="delById">
DELETE FROM ic_nat WHERE id = #{icNatId}
DELETE FROM ic_vaccine WHERE id = #{icVaccineId}
</delete>
<update id="updateIsResiFlag">

Loading…
Cancel
Save