| | |
| | | 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.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 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 { |
| | | |
| | |
| | | private SysDictDataMapper dictDataMapper; |
| | | |
| | | @Autowired |
| | | private IServiceMedicalevaluationService serviceMedicalevaluationService; |
| | | |
| | | @Autowired |
| | | private IServiceRelativesconfirmationService serviceRelativesconfirmationService; |
| | | |
| | | @Autowired |
| | | private IServiceEthicalreviewopinionsService serviceEthicalreviewopinionsService; |
| | | |
| | | @Autowired |
| | | private IServiceOrganallocationService serviceOrganallocationService; |
| | | |
| | | @Autowired |
| | | private IServiceDonationwitnessService serviceDonationwitnessService; |
| | | |
| | | @Autowired |
| | | private IServiceDonatecompletioninfoService serviceDonatecompletioninfoService; |
| | | IServiceOrganallocationService serviceOrganallocationService; |
| | | |
| | | |
| | | /** |
| | |
| | | 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)); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getWorkFlow(Long id) { |
| | | //用于返回 |
| | | Map<String, Object> map = new ConcurrentHashMap<>(); |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public List<ServiceDonateorgan> saveData(List<ServiceDonateorgan> serviceDonateorgans) { |
| | | for (ServiceDonateorgan serviceDonateorgan : serviceDonateorgans) { |
| | | if (serviceDonateorgan.getInfoid() == null) { |
| | | throw new BaseException("未关联捐献基础信息,infoid为空了" + serviceDonateorgan); |
| | | } |
| | | |
| | | ServiceDonateorgan serviceDonateorgan = getById(id); |
| | | if (ObjectUtils.isEmpty(serviceDonateorgan)) { |
| | | return null; |
| | | 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); |
| | | } |
| | | //封装serviceDonateorgan潜在捐献数据 |
| | | Map<String, String> donateorgan = new HashMap<>(); |
| | | donateorgan.put("createtime", serviceDonateorgan.getCreateTime().toString()); |
| | | donateorgan.put("updatetime", serviceDonateorgan.getUpdateTime().toString()); |
| | | donateorgan.put("process", ""); |
| | | return serviceDonateorgans; |
| | | } |
| | | |
| | | //封装医学评估 |
| | | Map<String, String> medicalevaluation = new HashMap<>(); |
| | | ServiceMedicalevaluation serviceMedicalevaluation = new ServiceMedicalevaluation(); |
| | | serviceMedicalevaluation.setInfoid(id); |
| | | List<ServiceMedicalevaluation> serviceMedicalevaluations = serviceMedicalevaluationService.queryList(serviceMedicalevaluation); |
| | | if (!CollectionUtils.isEmpty(serviceMedicalevaluations)) { |
| | | medicalevaluation.put("createtime", serviceMedicalevaluations.get(0).getCreateTime().toString()); |
| | | medicalevaluation.put("updatetime", serviceMedicalevaluations.get(0).getUpdateTime().toString()); |
| | | medicalevaluation.put("process", ""); |
| | | @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); |
| | | } |
| | | |
| | | //封装捐献确认 |
| | | Map<String, String> relativesconfirmation = new HashMap<>(); |
| | | ServiceRelativesconfirmation serviceRelativesconfirmation = new ServiceRelativesconfirmation(); |
| | | serviceRelativesconfirmation.setInfoid(id); |
| | | List<ServiceRelativesconfirmation> serviceRelativesconfirmations = serviceRelativesconfirmationService.queryList(serviceRelativesconfirmation); |
| | | if (!CollectionUtils.isEmpty(serviceRelativesconfirmations)) { |
| | | relativesconfirmation.put("createtime", serviceRelativesconfirmations.get(0).getCreateTime().toString()); |
| | | relativesconfirmation.put("updatetime", serviceRelativesconfirmations.get(0).getUpdateTime().toString()); |
| | | relativesconfirmation.put("process", ""); |
| | | } |
| | | |
| | | |
| | | //封装伦理审查 |
| | | Map<String, String> ethicalreviewopinions = new HashMap<>(); |
| | | ServiceEthicalreviewopinions serviceEthicalreviewopinions = new ServiceEthicalreviewopinions(); |
| | | serviceEthicalreviewopinions.setInfoid(id); |
| | | List<ServiceEthicalreviewopinions> serviceEthicalreviewopinionsList = serviceEthicalreviewopinionsService.queryList(serviceEthicalreviewopinions); |
| | | if (!CollectionUtils.isEmpty(serviceEthicalreviewopinionsList)) { |
| | | ethicalreviewopinions.put("createtime", serviceEthicalreviewopinionsList.get(0).getCreateTime().toString()); |
| | | ethicalreviewopinions.put("updatetime", serviceEthicalreviewopinionsList.get(0).getUpdateTime().toString()); |
| | | ethicalreviewopinions.put("process", ""); |
| | | } |
| | | |
| | | //封装器官分配 |
| | | Map<String, String> organallocationService = new HashMap<>(); |
| | | ServiceOrganallocation serviceOrganallocation = new ServiceOrganallocation(); |
| | | serviceOrganallocation.setOrganid(id); |
| | | List<ServiceOrganallocation> serviceOrganallocations = serviceOrganallocationService.selectServiceOrganallocationList(serviceOrganallocation); |
| | | if (!CollectionUtils.isEmpty(serviceOrganallocations)) { |
| | | organallocationService.put("createtime", serviceOrganallocations.get(0).getCreateTime().toString()); |
| | | organallocationService.put("updatetime", serviceOrganallocations.get(0).getUpdateTime().toString()); |
| | | organallocationService.put("process", ""); |
| | | } |
| | | |
| | | //封装获取见证 |
| | | Map<String, String> donationwitness = new HashMap<>(); |
| | | ServiceDonationwitness serviceDonationwitness = serviceDonationwitnessService.getByInfoId(id); |
| | | if (!ObjectUtils.isEmpty(serviceDonationwitness)) { |
| | | donationwitness.put("createtime", serviceDonationwitness.getCreateTime().toString()); |
| | | donationwitness.put("updatetime", serviceDonationwitness.getUpdateTime().toString()); |
| | | donationwitness.put("process", ""); |
| | | } |
| | | |
| | | //封装完成登记 |
| | | Map<String, String> donatecompletioninfo = new HashMap<>(); |
| | | ServiceDonatecompletioninfo serviceDonatecompletioninfo = new ServiceDonatecompletioninfo(); |
| | | serviceDonatecompletioninfo.setInfoid(id); |
| | | List<ServiceDonatecompletioninfo> serviceDonatecompletioninfos = serviceDonatecompletioninfoService.queryList(serviceDonatecompletioninfo); |
| | | if (!CollectionUtils.isEmpty(serviceDonatecompletioninfos)) { |
| | | donatecompletioninfo.put("createtime", serviceDonatecompletioninfos.get(0).getCreateTime().toString()); |
| | | donatecompletioninfo.put("updatetime", serviceDonatecompletioninfos.get(0).getUpdateTime().toString()); |
| | | donatecompletioninfo.put("process", ""); |
| | | } |
| | | |
| | | //将数据封闭,并返回 |
| | | map.put("donateorgan", donateorgan); |
| | | map.put("medicalevaluation", medicalevaluation); |
| | | map.put("relativesconfirmation", relativesconfirmation); |
| | | map.put("ethicalreviewopinions", ethicalreviewopinions); |
| | | map.put("organallocationService", organallocationService); |
| | | map.put("donationwitness", donationwitness); |
| | | map.put("donatecompletioninfo", donatecompletioninfo); |
| | | |
| | | return map; |
| | | //将带ID的数据返回 |
| | | return true; |
| | | } |
| | | |
| | | |