package com.ruoyi.project.service.impl; import java.time.LocalDate; import java.time.ZoneId; import java.util.List; 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.ServiceDonatebaseinfo; import com.ruoyi.project.domain.vo.MedicalEvaluationVO; import com.ruoyi.project.domain.vo.RelativeConfirmationVO; import com.ruoyi.project.mapper.ServiceDonatebaseinfoMapper; import com.ruoyi.project.service.IServiceDonatebaseinfoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import java.util.ArrayList; import java.util.Map; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.project.mapper.ServiceRelativesconfirmationMapper; import com.ruoyi.project.domain.ServiceRelativesconfirmation; import com.ruoyi.project.service.IServiceRelativesconfirmationService; /** * 捐献亲属确认Service业务层处理 * * @author ruoyi * @date 2021-11-15 */ @Service public class ServiceRelativesconfirmationServiceImpl extends ServiceImpl implements IServiceRelativesconfirmationService { @Autowired IServiceDonatebaseinfoService serviceDonatebaseinfoService; @Autowired ServiceRelativesconfirmationMapper serviceRelativesconfirmationMapper; @Autowired ServiceDonatebaseinfoMapper serviceDonatebaseinfoMapper; /** * 查询捐献亲属确认列表 * * @param serviceRelativesconfirmation 捐献亲属确认 * @return 捐献亲属确认 */ @Override public List queryList(ServiceRelativesconfirmation serviceRelativesconfirmation) { LambdaQueryWrapper wrappers = Wrappers.lambdaQuery(); if (serviceRelativesconfirmation.getId() != null) { wrappers.eq(ServiceRelativesconfirmation::getId, serviceRelativesconfirmation.getId()); } if (serviceRelativesconfirmation.getInfoid() != null) { wrappers.eq(ServiceRelativesconfirmation::getInfoid, serviceRelativesconfirmation.getInfoid()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getDonorno())) { wrappers.eq(ServiceRelativesconfirmation::getDonorno, serviceRelativesconfirmation.getDonorno()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getName())) { wrappers.like(ServiceRelativesconfirmation::getName, serviceRelativesconfirmation.getName()); } if (serviceRelativesconfirmation.getIdcardtype() != null) { wrappers.eq(ServiceRelativesconfirmation::getIdcardtype, serviceRelativesconfirmation.getIdcardtype()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getIdcardno())) { wrappers.eq(ServiceRelativesconfirmation::getIdcardno, serviceRelativesconfirmation.getIdcardno()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getPhone())) { wrappers.eq(ServiceRelativesconfirmation::getPhone, serviceRelativesconfirmation.getPhone()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidenceaddress())) { wrappers.eq(ServiceRelativesconfirmation::getResidenceaddress, serviceRelativesconfirmation.getResidenceaddress()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidenceprovince())) { wrappers.eq(ServiceRelativesconfirmation::getResidenceprovince, serviceRelativesconfirmation.getResidenceprovince()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidenceprovincename())) { wrappers.like(ServiceRelativesconfirmation::getResidenceprovincename, serviceRelativesconfirmation.getResidenceprovincename()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencecity())) { wrappers.eq(ServiceRelativesconfirmation::getResidencecity, serviceRelativesconfirmation.getResidencecity()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencecityname())) { wrappers.like(ServiceRelativesconfirmation::getResidencecityname, serviceRelativesconfirmation.getResidencecityname()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencetown())) { wrappers.eq(ServiceRelativesconfirmation::getResidencetown, serviceRelativesconfirmation.getResidencetown()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencetownname())) { wrappers.like(ServiceRelativesconfirmation::getResidencetownname, serviceRelativesconfirmation.getResidencetownname()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencecommunity())) { wrappers.eq(ServiceRelativesconfirmation::getResidencecommunity, serviceRelativesconfirmation.getResidencecommunity()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencecommunityname())) { wrappers.like(ServiceRelativesconfirmation::getResidencecommunityname, serviceRelativesconfirmation.getResidencecommunityname()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencecountycode())) { wrappers.eq(ServiceRelativesconfirmation::getResidencecountycode, serviceRelativesconfirmation.getResidencecountycode()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResidencecountyname())) { wrappers.like(ServiceRelativesconfirmation::getResidencecountyname, serviceRelativesconfirmation.getResidencecountyname()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getKinship())) { wrappers.eq(ServiceRelativesconfirmation::getKinship, serviceRelativesconfirmation.getKinship()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getSignfamilyrelations())) { wrappers.eq(ServiceRelativesconfirmation::getSignfamilyrelations, serviceRelativesconfirmation.getSignfamilyrelations()); } if (serviceRelativesconfirmation.getKinshipChildrennum() != null) { wrappers.eq(ServiceRelativesconfirmation::getKinshipChildrennum, serviceRelativesconfirmation.getKinshipChildrennum()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getKinshipconfirmationsign())) { wrappers.eq(ServiceRelativesconfirmation::getKinshipconfirmationsign, serviceRelativesconfirmation.getKinshipconfirmationsign()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getOrgandecision())) { wrappers.eq(ServiceRelativesconfirmation::getOrgandecision, serviceRelativesconfirmation.getOrgandecision()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getOrgandecisionOther())) { wrappers.eq(ServiceRelativesconfirmation::getOrgandecisionOther, serviceRelativesconfirmation.getOrgandecisionOther()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getRelativeconfirmationsign())) { wrappers.eq(ServiceRelativesconfirmation::getRelativeconfirmationsign, serviceRelativesconfirmation.getRelativeconfirmationsign()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getFamilyrelations())) { wrappers.eq(ServiceRelativesconfirmation::getFamilyrelations, serviceRelativesconfirmation.getFamilyrelations()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getAcquisitiontissueno())) { wrappers.eq(ServiceRelativesconfirmation::getAcquisitiontissueno, serviceRelativesconfirmation.getAcquisitiontissueno()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getAcquisitiontissuename())) { wrappers.like(ServiceRelativesconfirmation::getAcquisitiontissuename, serviceRelativesconfirmation.getAcquisitiontissuename()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResponsibleuserid())) { wrappers.eq(ServiceRelativesconfirmation::getResponsibleuserid, serviceRelativesconfirmation.getResponsibleuserid()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getResponsibleusername())) { wrappers.like(ServiceRelativesconfirmation::getResponsibleusername, serviceRelativesconfirmation.getResponsibleusername()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getCoordinateduserido())) { wrappers.eq(ServiceRelativesconfirmation::getCoordinateduserido, serviceRelativesconfirmation.getCoordinateduserido()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getCoordinatedusernameo())) { wrappers.eq(ServiceRelativesconfirmation::getCoordinatedusernameo, serviceRelativesconfirmation.getCoordinatedusernameo()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getCoordinateduseridt())) { wrappers.eq(ServiceRelativesconfirmation::getCoordinateduseridt, serviceRelativesconfirmation.getCoordinateduseridt()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getCoordinatedusernamet())) { wrappers.eq(ServiceRelativesconfirmation::getCoordinatedusernamet, serviceRelativesconfirmation.getCoordinatedusernamet()); } Map params = serviceRelativesconfirmation.getParams(); if (params.get("beginSigndate") != null && params.get("endSigndate") != null) { wrappers.between(ServiceRelativesconfirmation::getSigndate, params.get("beginSigndate"), params.get("endSigndate")); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getCreateBy())) { wrappers.eq(ServiceRelativesconfirmation::getCreateBy, serviceRelativesconfirmation.getCreateBy()); } if (serviceRelativesconfirmation.getCreateTime() != null) { wrappers.eq(ServiceRelativesconfirmation::getCreateTime, serviceRelativesconfirmation.getCreateTime()); } if (StringUtils.isNotBlank(serviceRelativesconfirmation.getUpdateBy())) { wrappers.eq(ServiceRelativesconfirmation::getUpdateBy, serviceRelativesconfirmation.getUpdateBy()); } if (serviceRelativesconfirmation.getUpdateTime() != null) { wrappers.eq(ServiceRelativesconfirmation::getUpdateTime, serviceRelativesconfirmation.getUpdateTime()); } return this.list(wrappers); } @Override public String addH4H5(Long infoid) { String oldDonateNumber = serviceDonatebaseinfoService.getDonateNumberById(infoid); String coordinateUserId = serviceRelativesconfirmationMapper.getCoordinateUserByInfoId(infoid); String adjustcoordinateUserId = coordinateUserId.substring(coordinateUserId.length() - 2); int first = oldDonateNumber.indexOf("*"); if (first == -1) { return oldDonateNumber; } else { StringBuilder newDonateNumber = new StringBuilder(oldDonateNumber); newDonateNumber.replace(first, first + 2, adjustcoordinateUserId); String updateNumber = newDonateNumber.toString(); int result = serviceDonatebaseinfoMapper.updateDonateNumber(infoid, updateNumber); return updateNumber; } } @Override public List selectVOList(RelativeConfirmationVO relativeConfirmationVO) { SysUser user = SecurityUtils.getLoginUser().getUser(); List l = user.getRoles(); Boolean b = false; for (SysRole r : l) { if (r.getRoleId().longValue() == 3) { b = true; } } if (b) { relativeConfirmationVO.setReporterno(user.getUserName()); } List relativeConfirmationVOS = serviceRelativesconfirmationMapper.selectVOList(relativeConfirmationVO); for (RelativeConfirmationVO relativeConfirmationVO1 : relativeConfirmationVOS) { if (relativeConfirmationVO1.getBirthday() != null) { Map map = CalculateDateUtils.calculateAge(relativeConfirmationVO1.getBirthday().toInstant().atZone(ZoneId.systemDefault()).toLocalDate(), LocalDate.now()); relativeConfirmationVO1.setAge(org.apache.commons.lang3.ObjectUtils.isNotEmpty(map.get("age")) ? Long.valueOf(map.get("age")) : null); relativeConfirmationVO1.setAgeunit(map.get("ageUnit")); relativeConfirmationVO1.setAge2(org.apache.commons.lang3.ObjectUtils.isNotEmpty(map.get("age2")) ? Long.valueOf(map.get("age2")) : null); relativeConfirmationVO1.setAgeunit2(map.get("ageUnit2")); } } return relativeConfirmationVOS; } }