| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | 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.domain.ServiceDonatebaseinfo; |
| | | import com.ruoyi.project.domain.ServiceDonateorgan; |
| | | import com.ruoyi.project.domain.vo.DonationWitnessVO; |
| | | import com.ruoyi.project.domain.vo.TimeVO; |
| | | import com.ruoyi.project.domain.vo.WitnessStatsVO; |
| | | import com.ruoyi.project.mapper.ServiceDonatebaseinfoMapper; |
| | | import com.ruoyi.project.mapper.ServiceDonateorganMapper; |
| | | 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.ServiceDonationwitnessMapper; |
| | | import com.ruoyi.project.domain.ServiceDonationwitness; |
| | |
| | | |
| | | /** |
| | | * 捐献见证Service业务层处理 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | * @date 2021-11-17 |
| | | */ |
| | | @Service |
| | | public class ServiceDonationwitnessServiceImpl extends ServiceImpl<ServiceDonationwitnessMapper, ServiceDonationwitness> implements IServiceDonationwitnessService |
| | | { |
| | | public class ServiceDonationwitnessServiceImpl extends ServiceImpl<ServiceDonationwitnessMapper, ServiceDonationwitness> implements IServiceDonationwitnessService { |
| | | |
| | | |
| | | @Autowired |
| | |
| | | @Autowired |
| | | ServiceDonatebaseinfoMapper serviceDonatebaseinfoMapper; |
| | | |
| | | @Autowired |
| | | ServiceDonateorganServiceImpl serviceDonateorganService; |
| | | |
| | | /** |
| | | * 查询捐献见证列表 |
| | | * |
| | | * |
| | | * @param serviceDonationwitness 捐献见证 |
| | | * @return 捐献见证 |
| | | */ |
| | | @Override |
| | | public List<ServiceDonationwitness> queryList(ServiceDonationwitness serviceDonationwitness) { |
| | | LambdaQueryWrapper<ServiceDonationwitness> wrappers = Wrappers.lambdaQuery(); |
| | | if (StringUtils.isNotBlank(serviceDonationwitness.getDonorno())){ |
| | | wrappers.eq(ServiceDonationwitness::getDonorno ,serviceDonationwitness.getDonorno()); |
| | | if (StringUtils.isNotBlank(serviceDonationwitness.getDonorno())) { |
| | | wrappers.eq(ServiceDonationwitness::getDonorno, serviceDonationwitness.getDonorno()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonationwitness.getGainhospitalname())){ |
| | | wrappers.like(ServiceDonationwitness::getGainhospitalname ,serviceDonationwitness.getGainhospitalname()); |
| | | if (StringUtils.isNotBlank(serviceDonationwitness.getGainhospitalname())) { |
| | | wrappers.like(ServiceDonationwitness::getGainhospitalname, serviceDonationwitness.getGainhospitalname()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonationwitness.getOperationdoctor())){ |
| | | wrappers.eq(ServiceDonationwitness::getOperationdoctor ,serviceDonationwitness.getOperationdoctor()); |
| | | if (StringUtils.isNotBlank(serviceDonationwitness.getOperationdoctor())) { |
| | | wrappers.eq(ServiceDonationwitness::getOperationdoctor, serviceDonationwitness.getOperationdoctor()); |
| | | } |
| | | return this.list(wrappers); |
| | | } |
| | |
| | | public List<DonationWitnessVO> selectVOList(DonationWitnessVO donationWitnessVO) { |
| | | |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | List <SysRole> l = user.getRoles(); |
| | | List<SysRole> l = user.getRoles(); |
| | | Boolean b = false; |
| | | for(SysRole r : l){ |
| | | if(r.getRoleId().longValue() == 3){ |
| | | for (SysRole r : l) { |
| | | if (r.getRoleId().longValue() == 3) { |
| | | b = true; |
| | | } |
| | | } |
| | | if(b){ |
| | | if (b) { |
| | | donationWitnessVO.setBasecreateby(user.getUserName()); |
| | | } |
| | | |
| | | return serviceDonationwitnessMapper.selectVOList(donationWitnessVO); |
| | | List<DonationWitnessVO> donationWitnessVOS = serviceDonationwitnessMapper.selectVOList(donationWitnessVO); |
| | | return donationWitnessVOS; |
| | | } |
| | | |
| | | @Override |
| | |
| | | int XONumber = 0; |
| | | int XABNumber = 0; |
| | | int DothersNumber = 0; |
| | | for(ServiceDonationwitness l : list){ |
| | | for (ServiceDonationwitness l : list) { |
| | | ServiceDonatebaseinfo serviceDonatebaseinfo = serviceDonatebaseinfoMapper.getById(l.getInfoid()); |
| | | if(serviceDonatebaseinfo.getSex() != null && serviceDonatebaseinfo.getSex().equals("1")){ |
| | | if (serviceDonatebaseinfo.getSex() != null && serviceDonatebaseinfo.getSex().equals("1")) { |
| | | manNumber++; |
| | | } |
| | | if(serviceDonatebaseinfo.getSex() != null && serviceDonatebaseinfo.getSex().equals("2")){ |
| | | if (serviceDonatebaseinfo.getSex() != null && serviceDonatebaseinfo.getSex().equals("2")) { |
| | | womanNumber++; |
| | | } |
| | | if(serviceDonatebaseinfo.getDiseasetype() != null && serviceDonatebaseinfo.getDiseasetype().equals("0")){ |
| | | if (serviceDonatebaseinfo.getDiseasetype() != null && serviceDonatebaseinfo.getDiseasetype().equals("0")) { |
| | | D0Number++; |
| | | } |
| | | if(serviceDonatebaseinfo.getDiseasetype() != null && serviceDonatebaseinfo.getDiseasetype().equals("1")){ |
| | | if (serviceDonatebaseinfo.getDiseasetype() != null && serviceDonatebaseinfo.getDiseasetype().equals("1")) { |
| | | D1Number++; |
| | | } |
| | | if(serviceDonatebaseinfo.getDiseasetype() != null && serviceDonatebaseinfo.getDiseasetype().equals("2")){ |
| | | if (serviceDonatebaseinfo.getDiseasetype() != null && serviceDonatebaseinfo.getDiseasetype().equals("2")) { |
| | | D2Number++; |
| | | } |
| | | if(serviceDonatebaseinfo.getDiseasetype() != null && serviceDonatebaseinfo.getDiseasetype().equals("3")){ |
| | | if (serviceDonatebaseinfo.getDiseasetype() != null && serviceDonatebaseinfo.getDiseasetype().equals("3")) { |
| | | D3Number++; |
| | | } |
| | | if(serviceDonatebaseinfo.getDiseasetype() != null && serviceDonatebaseinfo.getDiseasetype().equals("4")){ |
| | | if (serviceDonatebaseinfo.getDiseasetype() != null && serviceDonatebaseinfo.getDiseasetype().equals("4")) { |
| | | D4Number++; |
| | | } |
| | | if(l.getDonationcategory() != null && l.getDonationcategory().equals("DBD")){ |
| | | if (l.getDonationcategory() != null && l.getDonationcategory().equals("DBD")) { |
| | | DBDNumber++; |
| | | } |
| | | if(l.getDonationcategory() != null && l.getDonationcategory().equals("DCD")){ |
| | | if (l.getDonationcategory() != null && l.getDonationcategory().equals("DCD")) { |
| | | DCDNumber++; |
| | | } |
| | | if(l.getDonationcategory() != null && l.getDonationcategory().equals("DBCD")){ |
| | | if (l.getDonationcategory() != null && l.getDonationcategory().equals("DBCD")) { |
| | | DBCDNumber++; |
| | | } |
| | | if(serviceDonatebaseinfo.getAge() != null && serviceDonatebaseinfo.getAge() >= 0 && serviceDonatebaseinfo.getAge() <= 17){ |
| | | if (serviceDonatebaseinfo.getAge() != null && serviceDonatebaseinfo.getAge() >= 0 && serviceDonatebaseinfo.getAge() <= 17) { |
| | | A1Number++; |
| | | } |
| | | if(serviceDonatebaseinfo.getAge() != null && serviceDonatebaseinfo.getAge() >= 18 && serviceDonatebaseinfo.getAge() <= 48){ |
| | | if (serviceDonatebaseinfo.getAge() != null && serviceDonatebaseinfo.getAge() >= 18 && serviceDonatebaseinfo.getAge() <= 48) { |
| | | A2Number++; |
| | | } |
| | | if(serviceDonatebaseinfo.getAge() != null && serviceDonatebaseinfo.getAge() >= 49 && serviceDonatebaseinfo.getAge() <= 69){ |
| | | if (serviceDonatebaseinfo.getAge() != null && serviceDonatebaseinfo.getAge() >= 49 && serviceDonatebaseinfo.getAge() <= 69) { |
| | | A3Number++; |
| | | } |
| | | if(serviceDonatebaseinfo.getBloodtype() != null && serviceDonatebaseinfo.getBloodtype().equals("1")){ |
| | | if (serviceDonatebaseinfo.getBloodtype() != null && serviceDonatebaseinfo.getBloodtype().equals("1")) { |
| | | XANumber++; |
| | | } |
| | | if(serviceDonatebaseinfo.getBloodtype() != null && serviceDonatebaseinfo.getBloodtype().equals("2")){ |
| | | if (serviceDonatebaseinfo.getBloodtype() != null && serviceDonatebaseinfo.getBloodtype().equals("2")) { |
| | | XBNumber++; |
| | | } |
| | | if(serviceDonatebaseinfo.getBloodtype() != null && serviceDonatebaseinfo.getBloodtype().equals("3")){ |
| | | if (serviceDonatebaseinfo.getBloodtype() != null && serviceDonatebaseinfo.getBloodtype().equals("3")) { |
| | | XONumber++; |
| | | } |
| | | if(serviceDonatebaseinfo.getBloodtype() != null && serviceDonatebaseinfo.getBloodtype().equals("4")){ |
| | | if (serviceDonatebaseinfo.getBloodtype() != null && serviceDonatebaseinfo.getBloodtype().equals("4")) { |
| | | XABNumber++; |
| | | } |
| | | } |
| | | DothersNumber = total - D0Number - D1Number - D2Number - D3Number - D4Number; |
| | | |
| | | if(total == 0){ |
| | | if (total == 0) { |
| | | w.setManRate(0); |
| | | w.setWomanRate(0); |
| | | w.setD0Rate(0); |
| | |
| | | w.setXORate(0); |
| | | w.setXABRate(0); |
| | | |
| | | } |
| | | |
| | | else{ |
| | | } else { |
| | | w.setManRate((double) manNumber / (double) total); |
| | | w.setWomanRate((double) womanNumber / (double) total); |
| | | w.setD0Rate((double) D0Number / (double) total); |