| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.panzhihua.common.model.dtos.vaccines.EnrollUserByAppDTO; |
| | |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.vaccines.VaccinesEnrollByAdminVO; |
| | | import com.panzhihua.common.model.vos.vaccines.VaccinesEnrollUserByAppVO; |
| | | import com.panzhihua.common.utlis.AgeUtils; |
| | | import com.panzhihua.common.utlis.IdCard; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import com.panzhihua.service_community.dao.ComMngVaccinesDAO; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @auther lyq |
| | |
| | | if(user.getIsUser() == null){ |
| | | user.setIsUser(2); |
| | | } |
| | | if(StringUtils.isEmpty(user.getJob())){ |
| | | user.setJob("暂无"); |
| | | } |
| | | //查询当前用户是否已经报名 |
| | | ComMngVaccinesEnrollRecordDO enrollRecordDO = this.baseMapper.selectOne(new QueryWrapper<ComMngVaccinesEnrollRecordDO>() |
| | | .lambda().eq(ComMngVaccinesEnrollRecordDO::getFamilyUserId,user.getUserId()).eq(ComMngVaccinesEnrollRecordDO::getType,enrollUserByAppDTO.getVaccinesId())); |
| | | .lambda().eq(ComMngVaccinesEnrollRecordDO::getFamilyUserId,user.getUserId()) |
| | | .eq(ComMngVaccinesEnrollRecordDO::getType,enrollUserByAppDTO.getVaccinesId()) |
| | | .eq(ComMngVaccinesEnrollRecordDO::getFamilyUserType,user.getIsUser())); |
| | | if(enrollRecordDO != null){ |
| | | user.setIsEnroll(VaccinesEnrollUserByAppVO.isEnroll.yes); |
| | | }else{ |
| | | user.setIsEnroll(VaccinesEnrollUserByAppVO.isEnroll.no); |
| | | } |
| | | |
| | | if(StringUtils.isEmpty(user.getJob())){ |
| | | user.setJob("暂无"); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | return R.ok(userLists); |
| | | |
| | | List<VaccinesEnrollUserByAppVO> newUserLists = userLists.stream().sorted(Comparator.comparing(VaccinesEnrollUserByAppVO::getIsEnroll).reversed() |
| | | .thenComparing(Comparator.comparing(VaccinesEnrollUserByAppVO::getCreateAt).reversed())).collect(Collectors.toList()); |
| | | return R.ok(newUserLists); |
| | | } |
| | | |
| | | /** |
| | |
| | | vaccinesEnrollRecordDO.setUserId(enrollByAppDTO.getUserId()); |
| | | vaccinesEnrollRecordDO.setFamilyUserId(userByAppDTO.getUserId()); |
| | | vaccinesEnrollRecordDO.setType(enrollByAppDTO.getVaccinesId()); |
| | | vaccinesEnrollRecordDO.setCommunityId(enrollByAppDTO.getCommunityId()); |
| | | vaccinesEnrollRecordDOList.add(vaccinesEnrollRecordDO); |
| | | } |
| | | } |
| | |
| | | * @param vaccinesByAdminDTO 请求参数 |
| | | * @return 登记列表 |
| | | */ |
| | | @Override |
| | | public R getVaccinesEnrollListByAdmin(VaccinesEnrollByAdminDTO vaccinesByAdminDTO){ |
| | | return R.ok(this.baseMapper.getVaccinesEnrollListByAdmin(new Page<VaccinesEnrollByAdminVO>(vaccinesByAdminDTO.getPageNum(),vaccinesByAdminDTO.getPageSize()),vaccinesByAdminDTO)); |
| | | IPage<VaccinesEnrollByAdminVO> enrollByAdminVOIPage = this.baseMapper.getVaccinesEnrollListByAdmin(new Page<VaccinesEnrollByAdminVO>(vaccinesByAdminDTO.getPageNum(),vaccinesByAdminDTO.getPageSize()),vaccinesByAdminDTO); |
| | | if(!enrollByAdminVOIPage.getRecords().isEmpty()){ |
| | | for (VaccinesEnrollByAdminVO enroll:enrollByAdminVOIPage.getRecords()) { |
| | | if(enroll.getIdCard().length() != 18){ |
| | | enroll.setSex(3); |
| | | }else{ |
| | | enroll.setSex(IdCard.sex(enroll.getIdCard())); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(enrollByAdminVOIPage); |
| | | } |
| | | |
| | | /** |
| | | * 根据条件导出疫苗登记记录 |
| | | * @param vaccinesByAdminDTO 请求参数 |
| | | * @return 导出登记列表 |
| | | */ |
| | | @Override |
| | | public R exportVaccinesEnrollListByAdmin(VaccinesEnrollByAdminDTO vaccinesByAdminDTO){ |
| | | return R.ok(this.baseMapper.exportVaccinesEnrollListByAdmin(vaccinesByAdminDTO)); |
| | | } |
| | | } |