| | |
| | | package com.ruoyi.project.service.impl; |
| | | |
| | | import java.sql.Time; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | import com.ruoyi.common.core.domain.entity.BasePrcaddressDict; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.entity.SysDictData; |
| | | 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.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.project.domain.*; |
| | | import com.ruoyi.project.domain.vo.*; |
| | | import com.ruoyi.project.mapper.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.core.parameters.P; |
| | | 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 com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.project.service.IServiceDonateorganService; |
| | | import com.ruoyi.project.service.*; |
| | | import com.ruoyi.system.mapper.SysDictDataMapper; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.logging.Logger; |
| | | |
| | | /** |
| | | * 捐献器官管理Service业务层处理 |
| | | * |
| | | * |
| | | * @author ruoyi |
| | | * @date 2021-11-10 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ServiceDonateorganServiceImpl extends ServiceImpl<ServiceDonateorganMapper, ServiceDonateorgan> implements IServiceDonateorganService |
| | | { |
| | | public class ServiceDonateorganServiceImpl extends ServiceImpl<ServiceDonateorganMapper, ServiceDonateorgan> implements IServiceDonateorganService { |
| | | |
| | | @Autowired |
| | | ServiceDonateorganMapper serviceDonateorganMapper; |
| | |
| | | @Autowired |
| | | ServiceDonatecompletioninfoMapper serviceDonatecompletioninfoMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private SysDictDataMapper dictDataMapper; |
| | | |
| | | @Autowired |
| | | IServiceOrganallocationService serviceOrganallocationService; |
| | | |
| | | |
| | | /** |
| | | * 查询捐献器官管理列表 |
| | | * |
| | | * |
| | | * @param serviceDonateorgan 捐献器官管理 |
| | | * @return 捐献器官管理 |
| | | */ |
| | | @Override |
| | | public List<ServiceDonateorgan> queryList(ServiceDonateorgan serviceDonateorgan) { |
| | | LambdaQueryWrapper<ServiceDonateorgan> wrappers = Wrappers.lambdaQuery(); |
| | | if (StringUtils.isNotNull(serviceDonateorgan.getInfoid())){ |
| | | wrappers.eq(ServiceDonateorgan::getInfoid ,serviceDonateorgan.getInfoid()); |
| | | if (StringUtils.isNotNull(serviceDonateorgan.getInfoid())) { |
| | | wrappers.eq(ServiceDonateorgan::getInfoid, serviceDonateorgan.getInfoid()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonateorgan.getDonorno())){ |
| | | wrappers.eq(ServiceDonateorgan::getDonorno ,serviceDonateorgan.getDonorno()); |
| | | if (StringUtils.isNotBlank(serviceDonateorgan.getDonorno())) { |
| | | wrappers.eq(ServiceDonateorgan::getDonorno, serviceDonateorgan.getDonorno()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonateorgan.getOrganno())){ |
| | | wrappers.eq(ServiceDonateorgan::getOrganno ,serviceDonateorgan.getOrganno()); |
| | | if (StringUtils.isNotBlank(serviceDonateorgan.getOrganno())) { |
| | | wrappers.eq(ServiceDonateorgan::getOrganno, serviceDonateorgan.getOrganno()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonateorgan.getOrganname())){ |
| | | wrappers.like(ServiceDonateorgan::getOrganname ,serviceDonateorgan.getOrganname()); |
| | | if (StringUtils.isNotBlank(serviceDonateorgan.getOrganname())) { |
| | | wrappers.like(ServiceDonateorgan::getOrganname, serviceDonateorgan.getOrganname()); |
| | | } |
| | | if (serviceDonateorgan.getOrganstate() != null){ |
| | | wrappers.eq(ServiceDonateorgan::getOrganstate ,serviceDonateorgan.getOrganstate()); |
| | | if (serviceDonateorgan.getOrganstate() != null) { |
| | | wrappers.eq(ServiceDonateorgan::getOrganstate, serviceDonateorgan.getOrganstate()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonateorgan.getOrgannumber())){ |
| | | wrappers.eq(ServiceDonateorgan::getOrgannumber ,serviceDonateorgan.getOrgannumber()); |
| | | if (StringUtils.isNotBlank(serviceDonateorgan.getOrgannumber())) { |
| | | wrappers.eq(ServiceDonateorgan::getOrgannumber, serviceDonateorgan.getOrgannumber()); |
| | | } |
| | | if (serviceDonateorgan.getOrgangettime() != null){ |
| | | wrappers.eq(ServiceDonateorgan::getOrgangettime ,serviceDonateorgan.getOrgangettime()); |
| | | if (serviceDonateorgan.getOrgangettime() != null) { |
| | | wrappers.eq(ServiceDonateorgan::getOrgangettime, serviceDonateorgan.getOrgangettime()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonateorgan.getOrgangetdoct())){ |
| | | wrappers.eq(ServiceDonateorgan::getOrgangetdoct ,serviceDonateorgan.getOrgangetdoct()); |
| | | if (StringUtils.isNotBlank(serviceDonateorgan.getOrgangetdoct())) { |
| | | wrappers.eq(ServiceDonateorgan::getOrgangetdoct, serviceDonateorgan.getOrgangetdoct()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonateorgan.getGainhospitalno())){ |
| | | wrappers.eq(ServiceDonateorgan::getGainhospitalno ,serviceDonateorgan.getGainhospitalno()); |
| | | if (StringUtils.isNotBlank(serviceDonateorgan.getGainhospitalno())) { |
| | | wrappers.eq(ServiceDonateorgan::getGainhospitalno, serviceDonateorgan.getGainhospitalno()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonateorgan.getGainhospitalname())){ |
| | | wrappers.like(ServiceDonateorgan::getGainhospitalname ,serviceDonateorgan.getGainhospitalname()); |
| | | if (StringUtils.isNotBlank(serviceDonateorgan.getGainhospitalname())) { |
| | | wrappers.like(ServiceDonateorgan::getGainhospitalname, serviceDonateorgan.getGainhospitalname()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonateorgan.getTransplanthospitalno())){ |
| | | wrappers.eq(ServiceDonateorgan::getTransplanthospitalno ,serviceDonateorgan.getTransplanthospitalno()); |
| | | if (StringUtils.isNotBlank(serviceDonateorgan.getTransplanthospitalno())) { |
| | | wrappers.eq(ServiceDonateorgan::getTransplanthospitalno, serviceDonateorgan.getTransplanthospitalno()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonateorgan.getTransplanthospitalname())){ |
| | | wrappers.like(ServiceDonateorgan::getTransplanthospitalname ,serviceDonateorgan.getTransplanthospitalname()); |
| | | if (StringUtils.isNotBlank(serviceDonateorgan.getTransplanthospitalname())) { |
| | | wrappers.like(ServiceDonateorgan::getTransplanthospitalname, serviceDonateorgan.getTransplanthospitalname()); |
| | | } |
| | | if (StringUtils.isNotBlank(serviceDonateorgan.getTransplantdoct())){ |
| | | wrappers.eq(ServiceDonateorgan::getTransplantdoct ,serviceDonateorgan.getTransplantdoct()); |
| | | if (StringUtils.isNotBlank(serviceDonateorgan.getTransplantdoct())) { |
| | | wrappers.eq(ServiceDonateorgan::getTransplantdoct, serviceDonateorgan.getTransplantdoct()); |
| | | } |
| | | if (serviceDonateorgan.getTransplanttime() != null){ |
| | | wrappers.eq(ServiceDonateorgan::getTransplanttime ,serviceDonateorgan.getTransplanttime()); |
| | | if (serviceDonateorgan.getTransplanttime() != null) { |
| | | wrappers.eq(ServiceDonateorgan::getTransplanttime, serviceDonateorgan.getTransplanttime()); |
| | | } |
| | | return this.list(wrappers); |
| | | } |
| | |
| | | Map<String, Integer> map_donate = new HashMap<String, Integer>(); |
| | | Map<String, Integer> map_accept = new HashMap<String, Integer>(); |
| | | |
| | | for(ServiceDonateorgan s : serviceDonateorgans) { |
| | | for (ServiceDonateorgan s : serviceDonateorgans) { |
| | | BaseOrganization org_donate = baseOrganizationMapper.getOrganizationByNumber(s.getGainhospitalno()); |
| | | if (org_donate != null) { |
| | | map_donate.put(org_donate.getCity(), map_donate.getOrDefault(org_donate.getCity(), 0) + 1); |
| | |
| | | regions.add("9"); |
| | | regions.add("A"); |
| | | regions.add("B"); |
| | | for(String r : regions){ |
| | | for (String r : regions) { |
| | | NumberOfOrgans numberOfOrgans = new NumberOfOrgans(); |
| | | numberOfOrgans.setDistrict(r); |
| | | numberOfOrgans.setNumberOfHospitals(baseOrganizationMapper.getOrganizationByCity(r)); |
| | | numberOfOrgans.setDonateNumber(map_donate.getOrDefault(r,0)); |
| | | numberOfOrgans.setAcceptNumber(map_accept.getOrDefault(r,0)); |
| | | numberOfOrgans.setDonateNumber(map_donate.getOrDefault(r, 0)); |
| | | numberOfOrgans.setAcceptNumber(map_accept.getOrDefault(r, 0)); |
| | | list.add(numberOfOrgans); |
| | | } |
| | | |
| | |
| | | Map<String, Integer> map_donate = new HashMap<String, Integer>(); |
| | | Map<String, Integer> map_accept = new HashMap<String, Integer>(); |
| | | |
| | | for(ServiceDonateorgan s : serviceDonateorgans){ |
| | | map_donate.put(s.getGainhospitalno(), map_donate.getOrDefault(s.getGainhospitalno(),0) + 1); |
| | | for (ServiceDonateorgan s : serviceDonateorgans) { |
| | | map_donate.put(s.getGainhospitalno(), map_donate.getOrDefault(s.getGainhospitalno(), 0) + 1); |
| | | |
| | | map_accept.put(s.getTransplanthospitalno(), map_accept.getOrDefault(s.getTransplanthospitalno(), 0) + 1); |
| | | |
| | | } |
| | | List<BaseOrganization> baseOrganization = baseOrganizationMapper.getBaseOrganizationList(); |
| | | for(BaseOrganization o : baseOrganization){ |
| | | for (BaseOrganization o : baseOrganization) { |
| | | OrgansOfHospital organsOfHospital = new OrgansOfHospital(); |
| | | if(cityName.equals(o.getCityname())) { |
| | | if (cityName.equals(o.getCityname())) { |
| | | organsOfHospital.setHospitalName(o.getOrganizationname()); |
| | | organsOfHospital.setHospitalNo(o.getMedicalcode()); |
| | | organsOfHospital.setDonateNumber(map_donate.getOrDefault(o.getMedicalcode(),0)); |
| | | organsOfHospital.setAcceptNumber(map_accept.getOrDefault(o.getMedicalcode(),0)); |
| | | organsOfHospital.setDonateNumber(map_donate.getOrDefault(o.getMedicalcode(), 0)); |
| | | organsOfHospital.setAcceptNumber(map_accept.getOrDefault(o.getMedicalcode(), 0)); |
| | | list.add(organsOfHospital); |
| | | } |
| | | } |
| | |
| | | int transferNumber = serviceDonationwitnessMapper.countThisYearByTime(timeVO); |
| | | //本年度潜在捐献者数量 |
| | | int donateNumber = serviceDonatebaseinfoMapper.getDonateBaseCountThisYear(timeVO); |
| | | if(donateNumber == 0){ |
| | | if (donateNumber == 0) { |
| | | og.setDonateTransferRate(0.0); |
| | | } |
| | | else { |
| | | } else { |
| | | double transferRate = (double) transferNumber / (double) donateNumber; |
| | | og.setDonateTransferRate(transferRate); |
| | | } |
| | |
| | | int DCDDonaterNumber = serviceDonationwitnessMapper.getDCDDonaterNumberThisYear(timeVO); |
| | | //本年度DBCD来源器官捐献者 |
| | | int DBCDDonaterNumber = serviceDonationwitnessMapper.getDBCDDonaterNumberThisYear(timeVO); |
| | | if(transferNumber == 0){ |
| | | if (transferNumber == 0) { |
| | | og.setOrganProductionRate(0.0); |
| | | og.setDBDDonateRate(0.0); |
| | | og.setDCDDonateRate(0.0); |
| | | og.setDBCDDonateRate(0.0); |
| | | } |
| | | else{ |
| | | } else { |
| | | double productionRate = (double) organTransplantNumber / (double) transferNumber; |
| | | og.setOrganProductionRate(productionRate); |
| | | |
| | |
| | | //本年度病原菌阳性数量 |
| | | int pathogenPositiveNumber = serviceDonateorganMapper.getPathogenPositiveNumberThisYear(timeVO); |
| | | |
| | | if(getOrganNumber == 0){ |
| | | if (getOrganNumber == 0) { |
| | | og.setOrganUsedRate(0.0); |
| | | og.setOrganBeforeGetCheckRate(0.0); |
| | | og.setOrganAfterGetCheckRate(0.0); |
| | | og.setMarginOrganRate(0.0); |
| | | og.setGermPositiveRate(0.0); |
| | | } |
| | | else{ |
| | | } else { |
| | | double organUsedRate = (double) organTransplantNumber / (double) getOrganNumber; |
| | | og.setOrganUsedRate(organUsedRate); |
| | | |
| | |
| | | |
| | | //本年度总PNF数量 |
| | | int PNFNumber = serviceDonateorganMapper.getPNFNumberThisYear(timeVO); |
| | | if(organTransplantNumber == 0){ |
| | | if (organTransplantNumber == 0) { |
| | | og.setTotalPNFRate(0.0); |
| | | } |
| | | else{ |
| | | } else { |
| | | double PNFRate = (double) PNFNumber / (double) organTransplantNumber; |
| | | og.setTotalPNFRate(PNFRate); |
| | | } |
| | |
| | | int countDCD = 0; |
| | | //本年度DBCD来源器官数量 |
| | | int countDBCD = 0; |
| | | for(ServiceDonateorgan l : list){ |
| | | for (ServiceDonateorgan l : list) { |
| | | Long InfoId = l.getInfoid(); |
| | | |
| | | String category = serviceDonationwitnessMapper.getDonationCategoryByInfoId(InfoId); |
| | | if(category != null && category.equals("DBD")){ |
| | | if (category != null && category.equals("DBD")) { |
| | | countDBD += 1; |
| | | } |
| | | if(category != null && category.equals("DCD")){ |
| | | if (category != null && category.equals("DCD")) { |
| | | countDCD += 1; |
| | | } |
| | | if(category != null && category.equals("DBCD")){ |
| | | if (category != null && category.equals("DBCD")) { |
| | | countDBCD += 1; |
| | | } |
| | | } |
| | |
| | | int countDCDPNF = 0; |
| | | //本年度DBCD来源器官PNF数量 |
| | | int countDBCDPNF = 0; |
| | | for(ServiceDonateorgan s : list_PNF){ |
| | | for (ServiceDonateorgan s : list_PNF) { |
| | | Long InfoId = s.getInfoid(); |
| | | String category = serviceDonationwitnessMapper.getDonationCategoryByInfoId(InfoId); |
| | | if(category != null && category.equals("DBD")){ |
| | | if (category != null && category.equals("DBD")) { |
| | | countDBDPNF += 1; |
| | | } |
| | | if(category != null && category.equals("DCD")){ |
| | | if (category != null && category.equals("DCD")) { |
| | | countDCDPNF += 1; |
| | | } |
| | | if(category != null && category.equals("DBCD")){ |
| | | if (category != null && category.equals("DBCD")) { |
| | | countDBCDPNF += 1; |
| | | } |
| | | } |
| | |
| | | //本年度总DGF数量 |
| | | int DGFNumber = serviceDonateorganMapper.getDGFNumberThisYear(timeVO); |
| | | |
| | | if(organTransplantNumber == 0){ |
| | | if (organTransplantNumber == 0) { |
| | | og.setTotalDGFRate(0.0); |
| | | } |
| | | else{ |
| | | } else { |
| | | double DGFRate = (double) DGFNumber / (double) organTransplantNumber; |
| | | og.setTotalDGFRate(DGFRate); |
| | | } |
| | | |
| | | |
| | | |
| | | //本年度DBD来源器官DGF数量 |
| | |
| | | int countDCDDGF = 0; |
| | | //本年度DBCD来源器官DGF数量 |
| | | int countDBCDDGF = 0; |
| | | for(ServiceDonateorgan d : list_DGF){ |
| | | for (ServiceDonateorgan d : list_DGF) { |
| | | Long InfoId = d.getInfoid(); |
| | | String category = serviceDonationwitnessMapper.getDonationCategoryByInfoId(InfoId); |
| | | if(category != null && category.equals("DBD")){ |
| | | if (category != null && category.equals("DBD")) { |
| | | countDBDDGF += 1; |
| | | } |
| | | if(category != null && category.equals("DCD")){ |
| | | if (category != null && category.equals("DCD")) { |
| | | countDCDDGF += 1; |
| | | } |
| | | if(category != null && category.equals("DBCD")){ |
| | | if (category != null && category.equals("DBCD")) { |
| | | countDBCDDGF += 1; |
| | | } |
| | | } |
| | | |
| | | if(countDBD == 0){ |
| | | if (countDBD == 0) { |
| | | og.setDBDPNFRate(0.0); |
| | | og.setDBDDGFRate(0.0); |
| | | } |
| | | else{ |
| | | } else { |
| | | double DBDPNFRate = (double) countDBDPNF / (double) countDBD; |
| | | og.setDBDPNFRate(DBDPNFRate); |
| | | |
| | |
| | | og.setDBDDGFRate(DBDDGFRate); |
| | | } |
| | | |
| | | if(countDCD == 0){ |
| | | if (countDCD == 0) { |
| | | og.setDCDPNFRate(0.0); |
| | | og.setDCDDGFRate(0.0); |
| | | } |
| | | else{ |
| | | } else { |
| | | double DCDPNFRate = (double) countDCDPNF / (double) countDCD; |
| | | og.setDCDPNFRate(DCDPNFRate); |
| | | |
| | |
| | | og.setDCDDGFRate(DCDDGFRate); |
| | | } |
| | | |
| | | if(countDBCD == 0){ |
| | | if (countDBCD == 0) { |
| | | og.setDBCDPNFRate(0.0); |
| | | og.setDBCDDGFRate(0.0); |
| | | } |
| | | else{ |
| | | } else { |
| | | double DBCDPNFRate = (double) countDBCDPNF / (double) countDBCD; |
| | | og.setDBCDPNFRate(DBCDPNFRate); |
| | | |
| | |
| | | donateNumber.setNumberOfDonate(serviceDonatebaseinfoMapper.countNumber(timeVO)); |
| | | donateNumber.setNumberOfMedicalEvaluation(serviceMedicalevaluationMapper.countNumber(timeVO)); |
| | | donateNumber.setNumberOfRelativeConfirmation(serviceRelativesconfirmationMapper.countNumber(timeVO)); |
| | | donateNumber.setNumberOfDonatePeople(serviceOrganallocationMapper.countNumber(timeVO)); |
| | | // donateNumber.setNumberOfDonatePeople(serviceOrganallocationMapper.countNumber(timeVO)); |
| | | donateNumber.setNumberOfDonatePeople(serviceDonateorganMapper.countNumber(timeVO)); |
| | | donateNumber.setNumberOfOrgans(serviceDonateorganMapper.countNumber(timeVO)); |
| | | donateNumber.setNumberOfWitness(serviceDonationwitnessMapper.countNumber(timeVO)); |
| | | donateNumber.setNumberOfEthicalReview(serviceEthicalreviewopinionsMapper.countNumber(timeVO)); |
| | |
| | | List<ServiceDonatebaseinfo> serviceDonatebaseinfos = serviceDonatebaseinfoMapper.getAllDonateBaseInfo(); |
| | | HashMap<String, Integer> map_baseinfo_count = new HashMap<String, Integer>(); |
| | | |
| | | for(ServiceDonatebaseinfo s : serviceDonatebaseinfos){ |
| | | for (ServiceDonatebaseinfo s : serviceDonatebaseinfos) { |
| | | Date dt = s.getReporttime(); |
| | | SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String date = formatter.format(dt); |
| | | String month = date.substring(0, 7); |
| | | map_baseinfo_count.put(month, map_baseinfo_count.getOrDefault(month,0) + 1); |
| | | map_baseinfo_count.put(month, map_baseinfo_count.getOrDefault(month, 0) + 1); |
| | | } |
| | | |
| | | for(Map.Entry<String, Integer> entry: map_baseinfo_count.entrySet()) { |
| | | for (Map.Entry<String, Integer> entry : map_baseinfo_count.entrySet()) { |
| | | DonateNumberByMonth d = new DonateNumberByMonth(); |
| | | d.setDonatemonth(entry.getKey()); |
| | | d.setDonatecount(entry.getValue()); |
| | |
| | | List<DonateByRegionVO> l = new ArrayList<>(); |
| | | List<ServiceDonatebaseinfo> serviceDonatebaseinfos = serviceDonatebaseinfoMapper.getAllDonateBaseInfoByTime(timeVO); |
| | | |
| | | for(BaseOrganization b : baseOrganizations){ |
| | | for (BaseOrganization b : baseOrganizations) { |
| | | HashMap<String, Integer> map_baseinfo_count = new HashMap<String, Integer>(); |
| | | HashMap<String, Integer> map_completion_count = new HashMap<String, Integer>(); |
| | | //List<ServiceDonatebaseinfo> serviceDonatebaseinfos = serviceDonatebaseinfoMapper.getBaseInfoByHospital(b.getOrganizationid()); |
| | | List<ServiceDonatebaseinfo> serviceDonatebaseinfoOfThisHospital = new ArrayList<>(); |
| | | for(ServiceDonatebaseinfo sd : serviceDonatebaseinfos){ |
| | | if(b.getOrganizationid().equals(sd.getTreatmenthospitalno())){ |
| | | for (ServiceDonatebaseinfo sd : serviceDonatebaseinfos) { |
| | | if (b.getOrganizationid().equals(sd.getTreatmenthospitalno())) { |
| | | serviceDonatebaseinfoOfThisHospital.add(sd); |
| | | } |
| | | } |
| | | for(ServiceDonatebaseinfo s : serviceDonatebaseinfoOfThisHospital){ |
| | | for (ServiceDonatebaseinfo s : serviceDonatebaseinfoOfThisHospital) { |
| | | Date dt = s.getReporttime(); |
| | | SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String date = formatter.format(dt); |
| | | String month = date.substring(0, 7); |
| | | map_baseinfo_count.put(month, map_baseinfo_count.getOrDefault(month,0) + 1); |
| | | map_baseinfo_count.put(month, map_baseinfo_count.getOrDefault(month, 0) + 1); |
| | | ServiceDonatecompletioninfo sc = serviceDonatecompletioninfoMapper.getByInfoId(s.getId()); |
| | | if(sc != null){ |
| | | map_completion_count.put(month, map_completion_count.getOrDefault(month,0) + 1); |
| | | } |
| | | else{ |
| | | map_completion_count.put(month, map_completion_count.getOrDefault(month,0)); |
| | | if (sc != null) { |
| | | map_completion_count.put(month, map_completion_count.getOrDefault(month, 0) + 1); |
| | | } else { |
| | | map_completion_count.put(month, map_completion_count.getOrDefault(month, 0)); |
| | | } |
| | | |
| | | } |
| | | |
| | | for(Map.Entry<String, Integer> entry: map_baseinfo_count.entrySet()) { |
| | | for (Map.Entry<String, Integer> entry : map_baseinfo_count.entrySet()) { |
| | | DonateByRegionVO d = new DonateByRegionVO(); |
| | | d.setHospitalNumber(b.getOrganizationid()); |
| | | d.setHospitalName(b.getOrganizationname()); |
| | |
| | | List<ServiceDonatebaseinfo> serviceDonatebaseinfos = serviceDonatebaseinfoMapper.getAllDonateBaseInfoByTime(timeVO); |
| | | List<String> completeTreatmenthospitalnos = serviceDonatebaseinfoMapper.gettreatmenthospitalnoCompleteByTime(timeVO); |
| | | |
| | | for(BaseOrganization b : baseOrganizations){ |
| | | for (BaseOrganization b : baseOrganizations) { |
| | | HashMap<String, Integer> map_baseinfo_count = new HashMap<String, Integer>(); |
| | | HashMap<String, Integer> map_completion_count = new HashMap<String, Integer>(); |
| | | |
| | | String Organizationid = b.getOrganizationid(); |
| | | for(ServiceDonatebaseinfo s : serviceDonatebaseinfos){ |
| | | for (ServiceDonatebaseinfo s : serviceDonatebaseinfos) { |
| | | |
| | | if(Organizationid.equals(s.getTreatmenthospitalno())){ |
| | | map_baseinfo_count.put(Organizationid, map_baseinfo_count.getOrDefault(Organizationid,0) + 1); |
| | | if (Organizationid.equals(s.getTreatmenthospitalno())) { |
| | | map_baseinfo_count.put(Organizationid, map_baseinfo_count.getOrDefault(Organizationid, 0) + 1); |
| | | } |
| | | } |
| | | |
| | | for(String sc : completeTreatmenthospitalnos){ |
| | | if(Organizationid.equals(sc)){ |
| | | map_completion_count.put(Organizationid, map_completion_count.getOrDefault(Organizationid,0) + 1); |
| | | for (String sc : completeTreatmenthospitalnos) { |
| | | if (Organizationid.equals(sc)) { |
| | | map_completion_count.put(Organizationid, map_completion_count.getOrDefault(Organizationid, 0) + 1); |
| | | } |
| | | } |
| | | |
| | | if(map_baseinfo_count.size()==0) |
| | | { |
| | | map_baseinfo_count.put(Organizationid, map_baseinfo_count.getOrDefault(Organizationid,0)); |
| | | if (map_baseinfo_count.size() == 0) { |
| | | map_baseinfo_count.put(Organizationid, map_baseinfo_count.getOrDefault(Organizationid, 0)); |
| | | } |
| | | |
| | | if(map_completion_count.size()==0) |
| | | { |
| | | map_completion_count.put(Organizationid, map_completion_count.getOrDefault(Organizationid,0)); |
| | | if (map_completion_count.size() == 0) { |
| | | map_completion_count.put(Organizationid, map_completion_count.getOrDefault(Organizationid, 0)); |
| | | } |
| | | |
| | | // for(Map.Entry<String, Integer> entry: map_baseinfo_count.entrySet()) { |
| | | if(map_baseinfo_count.get(b.getOrganizationid())>0 || map_completion_count.get(b.getOrganizationid())>0) |
| | | { |
| | | if (map_baseinfo_count.get(b.getOrganizationid()) > 0 || map_completion_count.get(b.getOrganizationid()) > 0) { |
| | | DonateByRegionVO d = new DonateByRegionVO(); |
| | | d.setHospitalNumber(b.getOrganizationid()); |
| | | d.setHospitalName(b.getOrganizationname()); |
| | |
| | | List<String> l2 = serviceDonatebaseinfoMapper.getDistrictComplete(); |
| | | List<String> l3 = serviceDonatebaseinfoMapper.getDistrictOrgans(); |
| | | |
| | | for(String s1 : l1){ |
| | | for (String s1 : l1) { |
| | | map_donate.put(s1, map_donate.getOrDefault(s1, 0) + 1); |
| | | } |
| | | for(String s2 : l2){ |
| | | for (String s2 : l2) { |
| | | map_complete.put(s2, map_complete.getOrDefault(s2, 0) + 1); |
| | | } |
| | | for(String s3 : l3){ |
| | | for (String s3 : l3) { |
| | | map_organs.put(s3, map_organs.getOrDefault(s3, 0) + 1); |
| | | } |
| | | |
| | |
| | | regions.add("A"); |
| | | regions.add("B"); |
| | | |
| | | for(String r : regions){ |
| | | for (String r : regions) { |
| | | DistrictDonateCalculateVO d = new DistrictDonateCalculateVO(); |
| | | d.setDistrict(r); |
| | | d.setDonateCount(map_donate.getOrDefault(r,0)); |
| | | d.setCompleteCount(map_complete.getOrDefault(r,0)); |
| | | d.setDonateCount(map_donate.getOrDefault(r, 0)); |
| | | d.setCompleteCount(map_complete.getOrDefault(r, 0)); |
| | | d.setTotalOrganCount(map_organs.getOrDefault(r, 0)); |
| | | l.add(d); |
| | | } |
| | |
| | | List<String> l2 = serviceDonatebaseinfoMapper.getDistrictCompleteByTime(timeVO); |
| | | List<String> l3 = serviceDonatebaseinfoMapper.getDistrictOrgansByTime(timeVO); |
| | | |
| | | for(String s1 : l1){ |
| | | for (String s1 : l1) { |
| | | map_donate.put(s1, map_donate.getOrDefault(s1, 0) + 1); |
| | | } |
| | | for(String s2 : l2){ |
| | | for (String s2 : l2) { |
| | | map_complete.put(s2, map_complete.getOrDefault(s2, 0) + 1); |
| | | } |
| | | for(String s3 : l3){ |
| | | for (String s3 : l3) { |
| | | map_organs.put(s3, map_organs.getOrDefault(s3, 0) + 1); |
| | | } |
| | | |
| | |
| | | regions.add("A"); |
| | | regions.add("B"); |
| | | |
| | | for(String r : regions){ |
| | | for (String r : regions) { |
| | | DistrictDonateCalculateVO d = new DistrictDonateCalculateVO(); |
| | | d.setDistrict(r); |
| | | d.setDonateCount(map_donate.getOrDefault(r,0)); |
| | | d.setCompleteCount(map_complete.getOrDefault(r,0)); |
| | | d.setDonateCount(map_donate.getOrDefault(r, 0)); |
| | | d.setCompleteCount(map_complete.getOrDefault(r, 0)); |
| | | d.setTotalOrganCount(map_organs.getOrDefault(r, 0)); |
| | | l.add(d); |
| | | } |
| | |
| | | map_organs.put(b.getOrganizationid(), count); |
| | | } |
| | | |
| | | for (Map.Entry<String, Integer> entry : map_organs.entrySet()){ |
| | | for (Map.Entry<String, Integer> entry : map_organs.entrySet()) { |
| | | organNumberByOrgVO o = new organNumberByOrgVO(); |
| | | o.setOrgId(entry.getKey()); |
| | | o.setOrgName(baseOrganizationMapper.getNameByNo(entry.getKey())); |
| | |
| | | Map<String, Integer> map_organs = new HashMap<String, Integer>(); |
| | | //List<String> organNo = new ArrayList<>(); |
| | | |
| | | List<SysDictData> data = dictDataMapper.selectDictDataByType("sys_Organ"); |
| | | if (StringUtils.isNull(data)) |
| | | { |
| | | List<SysDictData> data = dictDataMapper.selectDictDataByType("sys_Organ"); |
| | | if (StringUtils.isNull(data)) { |
| | | data = new ArrayList<SysDictData>(); |
| | | } |
| | | |
| | | |
| | | for(SysDictData sysDictData : data){ |
| | | if(!sysDictData.getDictValue().equals("C00")) |
| | | { |
| | | int count = serviceDonateorganMapper.getDistinctOrgansCount(sysDictData.getDictValue(),timeVO.getStarttime(),timeVO.getEndtime(),timeVO.getCity(),timeVO.getReporterno()); |
| | | for (SysDictData sysDictData : data) { |
| | | if (!sysDictData.getDictValue().equals("C00")) { |
| | | int count = serviceDonateorganMapper.getDistinctOrgansCount(sysDictData.getDictValue(), timeVO.getStarttime(), timeVO.getEndtime(), timeVO.getCity(), timeVO.getReporterno()); |
| | | map_organs.put(sysDictData.getDictValue(), count); |
| | | } |
| | | } |
| | | for (Map.Entry<String, Integer> entry : map_organs.entrySet()){ |
| | | for (Map.Entry<String, Integer> entry : map_organs.entrySet()) { |
| | | organInfoVO organ = new organInfoVO(); |
| | | organ.setOrganNo(entry.getKey()); |
| | | //organ.setOrganName(serviceDonateorganMapper.getOrganNameByNo(entry.getKey())); |
| | |
| | | } |
| | | |
| | | return l; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public List<ServiceDonateorgan> saveData(List<ServiceDonateorgan> serviceDonateorgans) { |
| | | for (ServiceDonateorgan serviceDonateorgan : serviceDonateorgans) { |
| | | if (serviceDonateorgan.getInfoid() == null) { |
| | | throw new BaseException("未关联捐献基础信息,infoid为空了" + serviceDonateorgan); |
| | | } |
| | | |
| | | String organNumber = serviceDonateorgan.getDonorno() + "." + serviceDonateorgan.getOrganno(); |
| | | if (StringUtils.isEmpty(serviceDonateorgan.getDonorno()) || StringUtils.isEmpty(serviceDonateorgan.getOrganno())) { |
| | | throw new BaseException("新增时生成的编号为空,创建失败(请检查捐献者编号和器官类别)! :" + serviceDonateorgan.toString()); |
| | | } else { |
| | | ServiceDonateorgan serviceDonateorgan1 = new ServiceDonateorgan(); |
| | | serviceDonateorgan1.setOrgannumber(organNumber); |
| | | List<ServiceDonateorgan> listrecord = this.queryList(serviceDonateorgan); |
| | | if (listrecord.size() > 0) { |
| | | continue; |
| | | } |
| | | } |
| | | serviceDonateorgan.setOrgannumber(organNumber); |
| | | log.info("serviceDonateorgan的数据为: {}", serviceDonateorgan); |
| | | boolean save = this.save(serviceDonateorgan); |
| | | |
| | | |
| | | // //保存service_organallocation |
| | | // ServiceOrganallocation serviceOrganallocation = new ServiceOrganallocation(); |
| | | // serviceOrganallocation.setAgeunit(serviceDonateorgan.getAgeunit()); |
| | | // serviceOrganallocation.setApplicanttime(serviceDonateorgan.getApplicanttime()); |
| | | // serviceOrganallocation.setIdcardno(serviceDonateorgan.getIdcardno()); |
| | | // serviceOrganallocation.setIdcardtype(Long.valueOf(serviceDonateorgan.getIdcardtype())); |
| | | // serviceOrganallocation.setOrganid(serviceDonateorgan.getId()); |
| | | // serviceOrganallocation.setOrgannumber(serviceDonateorgan.getOrgannumber()); |
| | | // log.info("serviceOrganallocation的数据为: {}", serviceOrganallocation); |
| | | // serviceOrganallocationService.save(serviceOrganallocation); |
| | | } |
| | | return serviceDonateorgans; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean editArrayData(List<ServiceDonateorgan> serviceDonateorgans) { |
| | | for (ServiceDonateorgan serviceDonateorgan : serviceDonateorgans) { |
| | | if (serviceDonateorgan.getId() == null) { |
| | | throw new BaseException("id为空了 :" + serviceDonateorgan); |
| | | } |
| | | this.updateById(serviceDonateorgan); |
| | | } |
| | | //将带ID的数据返回 |
| | | return true; |
| | | } |
| | | |
| | | |
| | |
| | | List<ServiceDonationwitness> serviceDonationwitnesses = serviceDonationwitnessMapper.getAllDonatePeopleByTime(timeVO); |
| | | HashMap<String, Integer> map_organ_count = new HashMap<String, Integer>(); |
| | | |
| | | for(ServiceDonationwitness s : serviceDonationwitnesses){ |
| | | for (ServiceDonationwitness s : serviceDonationwitnesses) { |
| | | Date dt = s.getOperationbegtime(); |
| | | SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String date = formatter.format(dt); |
| | | String month = date.substring(0, 7); |
| | | map_organ_count.put(month, map_organ_count.getOrDefault(month,0) + 1); |
| | | map_organ_count.put(month, map_organ_count.getOrDefault(month, 0) + 1); |
| | | } |
| | | |
| | | for(Map.Entry<String, Integer> entry: map_organ_count.entrySet()) { |
| | | for (Map.Entry<String, Integer> entry : map_organ_count.entrySet()) { |
| | | DonateNumberByMonth d = new DonateNumberByMonth(); |
| | | d.setDonatemonth(entry.getKey()); |
| | | d.setDonatecount(entry.getValue()); |
| | |
| | | List<ServiceDonatecompletioninfo> serviceDonatecompletioninfos = serviceDonatecompletioninfoMapper.getCompletionDonatePeopleByTime(timeVO); |
| | | HashMap<String, Integer> map_organ_count = new HashMap<String, Integer>(); |
| | | |
| | | for(ServiceDonatecompletioninfo s : serviceDonatecompletioninfos){ |
| | | for (ServiceDonatecompletioninfo s : serviceDonatecompletioninfos) { |
| | | Date dt = s.getCompletetime(); |
| | | SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String date = formatter.format(dt); |
| | | String month = date.substring(0, 7); |
| | | map_organ_count.put(month, map_organ_count.getOrDefault(month,0) + 1); |
| | | map_organ_count.put(month, map_organ_count.getOrDefault(month, 0) + 1); |
| | | } |
| | | |
| | | for(Map.Entry<String, Integer> entry: map_organ_count.entrySet()) { |
| | | for (Map.Entry<String, Integer> entry : map_organ_count.entrySet()) { |
| | | DonateNumberByMonth d = new DonateNumberByMonth(); |
| | | d.setDonatemonth(entry.getKey()); |
| | | d.setDonatecount(entry.getValue()); |
| | |
| | | List<ServiceDonateorgan> serviceDonateorgans = serviceDonateorganMapper.getAllDonateOrgansByTime(timeVO); |
| | | HashMap<String, Integer> map_organ_count = new HashMap<String, Integer>(); |
| | | |
| | | for(ServiceDonateorgan s : serviceDonateorgans){ |
| | | for (ServiceDonateorgan s : serviceDonateorgans) { |
| | | Date dt = s.getOrgangettime(); |
| | | SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String date = formatter.format(dt); |
| | | String month = date.substring(0, 7); |
| | | map_organ_count.put(month, map_organ_count.getOrDefault(month,0) + 1); |
| | | map_organ_count.put(month, map_organ_count.getOrDefault(month, 0) + 1); |
| | | } |
| | | |
| | | for(Map.Entry<String, Integer> entry: map_organ_count.entrySet()) { |
| | | for (Map.Entry<String, Integer> entry : map_organ_count.entrySet()) { |
| | | DonateNumberByMonth d = new DonateNumberByMonth(); |
| | | d.setDonatemonth(entry.getKey()); |
| | | d.setDonatecount(entry.getValue()); |
| | |
| | | HashMap<String, Integer> map_organ_count = new HashMap<String, Integer>(); |
| | | List<String> hospitals = new ArrayList<>(); |
| | | |
| | | for(ServiceDonateorgan s : serviceDonateorgans){ |
| | | for (ServiceDonateorgan s : serviceDonateorgans) { |
| | | Date dt = s.getOrgangettime(); |
| | | SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String date = formatter.format(dt); |
| | | String month = date.substring(0, 7); |
| | | String gainHospital = s.getGainhospitalno(); |
| | | if(!hospitals.contains(gainHospital)) { |
| | | if (!hospitals.contains(gainHospital)) { |
| | | map_organ_count.put(month, map_organ_count.getOrDefault(month, 0) + 1); |
| | | hospitals.add(gainHospital); |
| | | } |
| | | } |
| | | |
| | | for(Map.Entry<String, Integer> entry: map_organ_count.entrySet()) { |
| | | for (Map.Entry<String, Integer> entry : map_organ_count.entrySet()) { |
| | | DonateNumberByMonth d = new DonateNumberByMonth(); |
| | | d.setDonatemonth(entry.getKey()); |
| | | d.setDonatecount(entry.getValue()); |
| | |
| | | HashMap<String, Integer> map_organ_count = new HashMap<String, Integer>(); |
| | | List<String> hospitals = new ArrayList<>(); |
| | | |
| | | for(ServiceDonateorgan s : serviceDonateorgans){ |
| | | for (ServiceDonateorgan s : serviceDonateorgans) { |
| | | Date dt = s.getOrgangettime(); |
| | | SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String date = formatter.format(dt); |
| | | String month = date.substring(0, 7); |
| | | String acceptHospital = s.getTransplanthospitalno(); |
| | | if(!hospitals.contains(acceptHospital)) { |
| | | if (!hospitals.contains(acceptHospital)) { |
| | | map_organ_count.put(month, map_organ_count.getOrDefault(month, 0) + 1); |
| | | hospitals.add(acceptHospital); |
| | | } |
| | | } |
| | | |
| | | for(Map.Entry<String, Integer> entry: map_organ_count.entrySet()) { |
| | | for (Map.Entry<String, Integer> entry : map_organ_count.entrySet()) { |
| | | DonateNumberByMonth d = new DonateNumberByMonth(); |
| | | d.setDonatemonth(entry.getKey()); |
| | | d.setDonatecount(entry.getValue()); |
| | |
| | | |
| | | return l; |
| | | } |
| | | |
| | | |
| | | |
| | | } |