| | |
| | | package com.ruoyi.project.service.impl; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | 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.BaseOrganization; |
| | | import com.ruoyi.project.domain.ServiceDonationwitness; |
| | | import com.ruoyi.project.domain.*; |
| | | import com.ruoyi.project.domain.vo.TimeVO; |
| | | import com.ruoyi.project.domain.vo.countByRecordStateVO; |
| | | import com.ruoyi.project.mapper.*; |
| | | import com.ruoyi.project.service.*; |
| | | 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.domain.ServiceDonatebaseinfo; |
| | | import com.ruoyi.project.mapper.BaseOrganizationMapper; |
| | | import com.ruoyi.project.service.IServiceDonatebaseinfoService; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | /** |
| | | * 捐献基础Service业务层处理 |
| | |
| | | |
| | | @Autowired |
| | | ServiceDonationwitnessMapper serviceDonationwitnessMapper; |
| | | |
| | | @Autowired |
| | | private IBaseOnlyvalueService baseOnlyvalueService; |
| | | |
| | | @Autowired |
| | | private IServiceMedicalevaluationService serviceMedicalevaluationService; |
| | | |
| | | @Autowired |
| | | private IServiceRelativesconfirmationService serviceRelativesconfirmationService; |
| | | |
| | | @Autowired |
| | | private IServiceEthicalreviewopinionsService serviceEthicalreviewopinionsService; |
| | | |
| | | @Autowired |
| | | private IServiceOrganallocationService serviceOrganallocationService; |
| | | |
| | | @Autowired |
| | | private IServiceDonateorganService serviceDonateorganService; |
| | | |
| | | @Autowired |
| | | private IServiceDonationwitnessService serviceDonationwitnessService; |
| | | |
| | | @Autowired |
| | | private IServiceDonatecompletioninfoService serviceDonatecompletioninfoService; |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | 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; |
| | | // 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(); |
| | | baseOnlyvalue.setAppentvalue(String.valueOf(year)); |
| | | baseOnlyvalue.setBusinesstype("donationwitness"); |
| | | List<BaseOnlyvalue> baseOnlyvalues = baseOnlyvalueService.queryList(baseOnlyvalue); |
| | | Long currentvalue = baseOnlyvalues.get(0).getCurrentvalue(); |
| | | if (currentvalue == null) { |
| | | log.error("唯一值为空了!"); |
| | | return null; |
| | | } |
| | | //如果currentvalue不满足4位,则在前面补0 |
| | | String formattedNumber = String.format("%04d", currentvalue); |
| | | |
| | | int last = oldDonateNumber.lastIndexOf("*"); |
| | | if (last == -1) { |
| | | return oldDonateNumber; |
| | | } else { |
| | | StringBuilder newDonateNumber = new StringBuilder(oldDonateNumber); |
| | | newDonateNumber.replace(last - 3, last + 1, number); |
| | | // newDonateNumber.replace(last - 3, last + 1, number); |
| | | newDonateNumber.replace(last - 3, last + 1, formattedNumber); |
| | | |
| | | String updateNumber = newDonateNumber.toString(); |
| | | int result = serviceDonatebaseinfoMapper.updateDonateNumber(id, updateNumber); |
| | |
| | | return serviceDonatebaseinfoMapper.getDonateNameById(infoid); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getWorkFlow(Long id) { |
| | | //用于返回 |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | |
| | | ServiceDonatebaseinfo serviceDonatebaseinfo = getById(id); |
| | | if (ObjectUtils.isEmpty(serviceDonatebaseinfo)) { |
| | | return null; |
| | | } |
| | | //封装serviceDonateorgan潜在捐献数据 |
| | | Map<String, String> donatebaseinfo = new HashMap<>(); |
| | | donatebaseinfo.put("createtime", DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", serviceDonatebaseinfo.getCreateTime())); |
| | | donatebaseinfo.put("updatetime", serviceDonatebaseinfo.getUpdateTime() != null ? DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", serviceDonatebaseinfo.getUpdateTime()) : ""); |
| | | donatebaseinfo.put("process", ""); |
| | | //封装serviceDonateorgan潜在捐献返回数据 |
| | | map.put("donatebaseinfo", donatebaseinfo); |
| | | |
| | | //封装医学评估 |
| | | Map<String, String> medicalevaluation = new HashMap<>(); |
| | | if (serviceDonatebaseinfo.getWorkflow() >= 1) { |
| | | ServiceMedicalevaluation serviceMedicalevaluation = new ServiceMedicalevaluation(); |
| | | serviceMedicalevaluation.setInfoid(id); |
| | | List<ServiceMedicalevaluation> serviceMedicalevaluations = serviceMedicalevaluationService.queryList(serviceMedicalevaluation); |
| | | if (!CollectionUtils.isEmpty(serviceMedicalevaluations)) { |
| | | medicalevaluation.put("createtime", DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", serviceMedicalevaluations.get(0).getCreateTime())); |
| | | medicalevaluation.put("updatetime", serviceMedicalevaluations.get(0).getUpdateTime() != null ? DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", serviceMedicalevaluations.get(0).getUpdateTime()) : null); |
| | | medicalevaluation.put("process", ""); |
| | | } |
| | | } |
| | | //封装医学评估返回数据 |
| | | map.put("medicalevaluation", medicalevaluation); |
| | | |
| | | //封装捐献确认 |
| | | Map<String, String> relativesconfirmation = new HashMap<>(); |
| | | if (serviceDonatebaseinfo.getWorkflow() >= 2) { |
| | | ServiceRelativesconfirmation serviceRelativesconfirmation = new ServiceRelativesconfirmation(); |
| | | serviceRelativesconfirmation.setInfoid(id); |
| | | List<ServiceRelativesconfirmation> serviceRelativesconfirmations = serviceRelativesconfirmationService.queryList(serviceRelativesconfirmation); |
| | | if (!CollectionUtils.isEmpty(serviceRelativesconfirmations)) { |
| | | relativesconfirmation.put("createtime", DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", serviceRelativesconfirmations.get(0).getCreateTime())); |
| | | relativesconfirmation.put("updatetime", serviceRelativesconfirmations.get(0).getUpdateTime() != null ? DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", serviceRelativesconfirmations.get(0).getUpdateTime()) : ""); |
| | | relativesconfirmation.put("process", ""); |
| | | } |
| | | } |
| | | //封装捐献确认返回数据 |
| | | map.put("relativesconfirmation", relativesconfirmation); |
| | | |
| | | |
| | | //封装伦理审查 |
| | | Map<String, String> ethicalreviewopinions = new HashMap<>(); |
| | | if (serviceDonatebaseinfo.getWorkflow() >= 3) { |
| | | ServiceEthicalreviewopinions serviceEthicalreviewopinions = new ServiceEthicalreviewopinions(); |
| | | serviceEthicalreviewopinions.setInfoid(id); |
| | | List<ServiceEthicalreviewopinions> serviceEthicalreviewopinionsList = serviceEthicalreviewopinionsService.queryList(serviceEthicalreviewopinions); |
| | | if (!CollectionUtils.isEmpty(serviceEthicalreviewopinionsList)) { |
| | | ethicalreviewopinions.put("createtime", DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", serviceEthicalreviewopinionsList.get(0).getCreateTime())); |
| | | ethicalreviewopinions.put("updatetime", serviceEthicalreviewopinionsList.get(0).getUpdateTime() != null ? DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", serviceEthicalreviewopinionsList.get(0).getUpdateTime()) : ""); |
| | | ethicalreviewopinions.put("process", ""); |
| | | } |
| | | } |
| | | //封装伦理审查返回数据 |
| | | map.put("ethicalreviewopinions", ethicalreviewopinions); |
| | | |
| | | //封装器官分配 |
| | | Map<String, String> donateorgansService = new HashMap<>(); |
| | | if (serviceDonatebaseinfo.getWorkflow() >= 4) { |
| | | ServiceDonateorgan serviceDonateorgan = new ServiceDonateorgan(); |
| | | serviceDonateorgan.setInfoid(id); |
| | | List<ServiceDonateorgan> serviceDonateorgans = serviceDonateorganService.queryList(serviceDonateorgan); |
| | | if (!CollectionUtils.isEmpty(serviceDonateorgans)) { |
| | | donateorgansService.put("createtime", DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", serviceDonateorgans.get(0).getCreateTime())); |
| | | donateorgansService.put("updatetime", serviceDonateorgans.get(0).getUpdateTime() != null ? DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", serviceDonateorgans.get(0).getUpdateTime()) : ""); |
| | | donateorgansService.put("process", ""); |
| | | } |
| | | } |
| | | //封装器官分配返回数据 |
| | | map.put("donateorgansService", donateorgansService); |
| | | |
| | | //封装获取见证 |
| | | Map<String, String> donationwitness = new HashMap<>(); |
| | | if (serviceDonatebaseinfo.getWorkflow() >= 5) { |
| | | ServiceDonationwitness serviceDonationwitness = serviceDonationwitnessService.getByInfoId(id); |
| | | if (!ObjectUtils.isEmpty(serviceDonationwitness)) { |
| | | donationwitness.put("createtime", DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", serviceDonationwitness.getCreateTime())); |
| | | donationwitness.put("updatetime", serviceDonationwitness.getUpdateTime() != null ? DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", serviceDonationwitness.getUpdateTime()) : ""); |
| | | donationwitness.put("process", ""); |
| | | } |
| | | } |
| | | //封装获取见证返回数据 |
| | | map.put("donationwitness", donationwitness); |
| | | |
| | | //封装完成登记 |
| | | Map<String, String> donatecompletioninfo = new HashMap<>(); |
| | | if (serviceDonatebaseinfo.getWorkflow() >= 6) { |
| | | ServiceDonatecompletioninfo serviceDonatecompletioninfo = new ServiceDonatecompletioninfo(); |
| | | serviceDonatecompletioninfo.setInfoid(id); |
| | | List<ServiceDonatecompletioninfo> serviceDonatecompletioninfos = serviceDonatecompletioninfoService.queryList(serviceDonatecompletioninfo); |
| | | if (!CollectionUtils.isEmpty(serviceDonatecompletioninfos)) { |
| | | donatecompletioninfo.put("createtime", DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", serviceDonatecompletioninfos.get(0).getCreateTime())); |
| | | donatecompletioninfo.put("updatetime", serviceDonatecompletioninfos.get(0).getUpdateTime() != null ? DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", serviceDonatecompletioninfos.get(0).getUpdateTime()) : ""); |
| | | donatecompletioninfo.put("process", ""); |
| | | } |
| | | } |
| | | //封装完成登记返回数据 |
| | | map.put("donatecompletioninfo", donatecompletioninfo); |
| | | |
| | | //将数据封闭,并返回 |
| | | return map; |
| | | } |
| | | } |
| | | |
| | | |