| | |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.project.common.CalculateDateUtils; |
| | | import com.ruoyi.project.domain.*; |
| | | import com.ruoyi.project.domain.dto.DonatebaseinfoProgressDTO; |
| | | import com.ruoyi.project.domain.vo.DonatebaseinfoProgressVO; |
| | | import com.ruoyi.project.domain.vo.TimeVO; |
| | | import com.ruoyi.project.domain.vo.countByRecordStateVO; |
| | | import com.ruoyi.project.mapper.*; |
| | |
| | | @Override |
| | | public List<ServiceDonatebaseinfo> queryList(ServiceDonatebaseinfo serviceDonatebaseinfo) { |
| | | LambdaQueryWrapper<ServiceDonatebaseinfo> wrappers = Wrappers.lambdaQuery(); |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getName())) { |
| | | wrappers.like(ServiceDonatebaseinfo::getName, serviceDonatebaseinfo.getName()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getIdcardno())) { |
| | | wrappers.like(ServiceDonatebaseinfo::getIdcardno, serviceDonatebaseinfo.getIdcardno()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getResidenceprovince())) { |
| | | wrappers.eq(ServiceDonatebaseinfo::getResidenceprovince, serviceDonatebaseinfo.getResidenceprovince()); |
| | | } |
| | | if (serviceDonatebaseinfo.getRecordstate() != null) { |
| | | wrappers.eq(ServiceDonatebaseinfo::getRecordstate, serviceDonatebaseinfo.getRecordstate()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getTreatmenthospitalname())) { |
| | | wrappers.like(ServiceDonatebaseinfo::getTreatmenthospitalname, serviceDonatebaseinfo.getTreatmenthospitalname()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getDonorno())) { |
| | | wrappers.eq(ServiceDonatebaseinfo::getDonorno, serviceDonatebaseinfo.getDonorno()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getReportername())) { |
| | | wrappers.like(ServiceDonatebaseinfo::getReportername, serviceDonatebaseinfo.getReportername()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getCaseNo())) { |
| | | wrappers.eq(ServiceDonatebaseinfo::getCaseNo, serviceDonatebaseinfo.getCaseNo()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getInfoName())) { |
| | | wrappers.like(ServiceDonatebaseinfo::getInfoName, serviceDonatebaseinfo.getInfoName()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getInfoNo())) { |
| | | wrappers.eq(ServiceDonatebaseinfo::getInfoNo, serviceDonatebaseinfo.getInfoNo()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getCoordinatorName())) { |
| | | wrappers.like(ServiceDonatebaseinfo::getCoordinatorName, serviceDonatebaseinfo.getCoordinatorName()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getCoordinatorNo())) { |
| | | wrappers.eq(ServiceDonatebaseinfo::getCoordinatorNo, serviceDonatebaseinfo.getCoordinatorNo()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getGcsScore())) { |
| | | wrappers.eq(ServiceDonatebaseinfo::getGcsScore, serviceDonatebaseinfo.getGcsScore()); |
| | | } |
| | | Map<String, Object> params = serviceDonatebaseinfo.getParams(); |
| | | if (params.get("beginReporttime") != null && params.get("endReporttime") != null) { |
| | | wrappers.between(ServiceDonatebaseinfo::getReporttime, params.get("beginReporttime"), params.get("endReporttime")); |
| | | } |
| | | setWrappers(wrappers, serviceDonatebaseinfo); |
| | | return this.list(wrappers); |
| | | } |
| | | |
| | | @Override |
| | | public Page<ServiceDonatebaseinfo> queryListPage(ServiceDonatebaseinfo serviceDonatebaseinfo) { |
| | | LambdaQueryWrapper<ServiceDonatebaseinfo> wrappers = Wrappers.lambdaQuery(); |
| | | setWrappers(wrappers, serviceDonatebaseinfo); |
| | | |
| | | // 创建分页对象,设置页码和每页大小 |
| | | int currentPage = (serviceDonatebaseinfo.getPageNum() == null || serviceDonatebaseinfo.getPageNum() < 1) ? 1 : serviceDonatebaseinfo.getPageNum(); |
| | | int size = (serviceDonatebaseinfo.getPageSize() == null || serviceDonatebaseinfo.getPageSize() < 1) ? 10 : serviceDonatebaseinfo.getPageSize(); |
| | | Page<ServiceDonatebaseinfo> page = new Page<>(currentPage, size); |
| | | |
| | | List<ServiceDonatebaseinfo> serviceDonatemaintenanceList = serviceDonatebaseinfoMapper.selectPage(page, wrappers).getRecords(); |
| | | return page.setRecords(serviceDonatemaintenanceList); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | String number = ""; |
| | | |
| | | // if (completeDonation < 10) { |
| | | // number = "000" + completeDonation; |
| | | // } else if (completeDonation >= 10 && completeDonation < 100) { |
| | | // number = "00" + completeDonation; |
| | | // } else if (completeDonation >= 100 && completeDonation < 1000) { |
| | | // number = "0" + completeDonation; |
| | | // } else { |
| | | // number = "" + completeDonation; |
| | | // } |
| | | Calendar calendar = Calendar.getInstance(); |
| | | int year = calendar.get(Calendar.YEAR); |
| | | BaseOnlyvalue baseOnlyvalue = new BaseOnlyvalue(); |
| | |
| | | serviceDonatebaseinfo.setDeptid(user.getDeptId()); |
| | | } |
| | | List<ServiceDonatebaseinfo> serviceDonatebaseinfos = serviceDonatebaseinfoMapper.selectServiceDonatebaseinfoList(serviceDonatebaseinfo); |
| | | for (ServiceDonatebaseinfo serviceDonatebaseinfo1 : serviceDonatebaseinfos) { |
| | | //这里不能再通过当前时间算年龄了,患者可能已经死亡了 |
| | | // if (serviceDonatebaseinfo1.getBirthday() != null) { |
| | | // Map<String, String> map = CalculateDateUtils.calculateAge(serviceDonatebaseinfo1.getBirthday().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), LocalDate.now()); |
| | | // serviceDonatebaseinfo1.setAge(org.apache.commons.lang3.ObjectUtils.isNotEmpty(map.get("age")) ? Long.valueOf(map.get("age")) : null); |
| | | // serviceDonatebaseinfo1.setAgeunit(map.get("ageUnit")); |
| | | // serviceDonatebaseinfo1.setAge2(org.apache.commons.lang3.ObjectUtils.isNotEmpty(map.get("age2")) ? Long.valueOf(map.get("age2")) : null); |
| | | // serviceDonatebaseinfo1.setAgeunit2(map.get("ageUnit2")); |
| | | // } |
| | | //先给个年龄默认值(因为age是数字类型,不能放横杠,所以就所横扛放到单位上) |
| | | serviceDonatebaseinfo1.setAgeunit("-"); |
| | | serviceDonatebaseinfo1.setAge(null); |
| | | serviceDonatebaseinfo1.setAge2(null); |
| | | |
| | | //获取死亡时间,如果获取见证里有死亡时间,则进行计算他的年龄 |
| | | ServiceDonationwitness sdw = new ServiceDonationwitness(); |
| | | sdw.setInfoid(serviceDonatebaseinfo1.getId()); |
| | | List<ServiceDonationwitness> serviceDonationwitnessList = serviceDonationwitnessMapper.selectServiceDonationwitnessList(sdw); |
| | | if (!CollectionUtils.isEmpty(serviceDonationwitnessList) && serviceDonatebaseinfo1.getBirthday() != null) { |
| | | Date deathtime = serviceDonationwitnessList.get(0).getDeathtime(); |
| | | if (ObjectUtils.isNotEmpty(deathtime)) { |
| | | Map<String, String> map = CalculateDateUtils.calculateAge(serviceDonatebaseinfo1.getBirthday().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), deathtime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate()); |
| | | if (Objects.isNull(map)) { |
| | | log.error("ServiceDonationwitness出生日期:{},ServiceDonationwitness死亡日期:{}", serviceDonatebaseinfo1.getBirthday(), deathtime); |
| | | continue; |
| | | } |
| | | serviceDonatebaseinfo1.setAge(org.apache.commons.lang3.ObjectUtils.isNotEmpty(map.get("age")) ? Long.valueOf(map.get("age")) : null); |
| | | serviceDonatebaseinfo1.setAgeunit(map.get("ageUnit")); |
| | | serviceDonatebaseinfo1.setAge2(org.apache.commons.lang3.ObjectUtils.isNotEmpty(map.get("age2")) ? Long.valueOf(map.get("age2")) : null); |
| | | serviceDonatebaseinfo1.setAgeunit2(map.get("ageUnit2")); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | return serviceDonatebaseinfos; |
| | | } |
| | |
| | | } |
| | | |
| | | return serviceDonatebaseinfoMapper.listForSearch(serviceDonatebaseinfo); |
| | | } |
| | | |
| | | /** |
| | | * 捐献进度基本信息 |
| | | * |
| | | * @param donatebaseinfoProgressVO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<DonatebaseinfoProgressDTO> donateBaseInfoProgressList(DonatebaseinfoProgressVO donatebaseinfoProgressVO) { |
| | | List<DonatebaseinfoProgressDTO> donatebaseinfoProgressDTOS = serviceDonatebaseinfoMapper.donateBaseInfoProgressList(donatebaseinfoProgressVO); |
| | | return donatebaseinfoProgressDTOS; |
| | | } |
| | | |
| | | @Override |
| | |
| | | //将数据封闭,并返回 |
| | | return map; |
| | | } |
| | | |
| | | |
| | | private void setWrappers(LambdaQueryWrapper<ServiceDonatebaseinfo> wrappers, ServiceDonatebaseinfo serviceDonatebaseinfo) { |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getName())) { |
| | | wrappers.like(ServiceDonatebaseinfo::getName, serviceDonatebaseinfo.getName()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getIdcardno())) { |
| | | wrappers.like(ServiceDonatebaseinfo::getIdcardno, serviceDonatebaseinfo.getIdcardno()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getResidenceprovince())) { |
| | | wrappers.eq(ServiceDonatebaseinfo::getResidenceprovince, serviceDonatebaseinfo.getResidenceprovince()); |
| | | } |
| | | if (serviceDonatebaseinfo.getRecordstate() != null) { |
| | | wrappers.eq(ServiceDonatebaseinfo::getRecordstate, serviceDonatebaseinfo.getRecordstate()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getTreatmenthospitalname())) { |
| | | wrappers.like(ServiceDonatebaseinfo::getTreatmenthospitalname, serviceDonatebaseinfo.getTreatmenthospitalname()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getDonorno())) { |
| | | wrappers.eq(ServiceDonatebaseinfo::getDonorno, serviceDonatebaseinfo.getDonorno()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getReportername())) { |
| | | wrappers.like(ServiceDonatebaseinfo::getReportername, serviceDonatebaseinfo.getReportername()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getCaseNo())) { |
| | | wrappers.eq(ServiceDonatebaseinfo::getCaseNo, serviceDonatebaseinfo.getCaseNo()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getInfoName())) { |
| | | wrappers.like(ServiceDonatebaseinfo::getInfoName, serviceDonatebaseinfo.getInfoName()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getInfoNo())) { |
| | | wrappers.eq(ServiceDonatebaseinfo::getInfoNo, serviceDonatebaseinfo.getInfoNo()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getCoordinatorName())) { |
| | | wrappers.like(ServiceDonatebaseinfo::getCoordinatorName, serviceDonatebaseinfo.getCoordinatorName()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getCoordinatorNo())) { |
| | | wrappers.eq(ServiceDonatebaseinfo::getCoordinatorNo, serviceDonatebaseinfo.getCoordinatorNo()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getGcsScore())) { |
| | | wrappers.eq(ServiceDonatebaseinfo::getGcsScore, serviceDonatebaseinfo.getGcsScore()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonatebaseinfo.getExtracontent())) { |
| | | wrappers.eq(ServiceDonatebaseinfo::getExtracontent, serviceDonatebaseinfo.getExtracontent()); |
| | | } |
| | | if (serviceDonatebaseinfo.getTerminationType()!=null) { |
| | | wrappers.eq(ServiceDonatebaseinfo::getTerminationType, serviceDonatebaseinfo.getTerminationType()); |
| | | } |
| | | Map<String, Object> params = serviceDonatebaseinfo.getParams(); |
| | | if (params.get("beginReporttime") != null && params.get("endReporttime") != null) { |
| | | wrappers.between(ServiceDonatebaseinfo::getReporttime, params.get("beginReporttime"), params.get("endReporttime")); |
| | | } |
| | | } |
| | | |
| | | } |