| | |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.mapper.BaseTagMapper; |
| | | import com.smartor.mapper.PatArchiveMapper; |
| | | import com.smartor.mapper.PatArchivetagMapper; |
| | | import com.smartor.mapper.*; |
| | | import com.smartor.service.IPatArchiveService; |
| | | import com.smartor.service.IPatMedInhospService; |
| | | import com.smartor.service.IPatMedOuthospService; |
| | |
| | | private PatArchiveMapper patArchiveMapper; |
| | | |
| | | @Autowired |
| | | private ServiceSubtaskMapper serviceSubtaskMapper; |
| | | |
| | | @Autowired |
| | | private BaseTagMapper baseTagMapper; |
| | | |
| | | @Autowired |
| | |
| | | private IPatMedInhospService patMedInhospService; |
| | | |
| | | @Autowired |
| | | private IPatMedOuthospService patMedOuthospService; |
| | | private PatArchivecontactMapper patArchivecontactMapper; |
| | | |
| | | @Autowired |
| | | private IPatMedPhysicalService patMedPhysicalService; |
| | |
| | | * @param patArchive 患者档案 |
| | | * @return 结果 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public Integer insertPatArchive(PatArchive patArchive) { |
| | | patArchive.setCreateTime(DateUtils.getNowDate()); |
| | |
| | | return patArchive.getId().intValue(); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public Boolean update(PatArchive patArchive) { |
| | | int i = patArchiveMapper.updatePatArchive(patArchive); |
| | | if (i != 1) { |
| | | return false; |
| | | } else { |
| | | ServiceSubtask serviceSubtask = new ServiceSubtask(); |
| | | serviceSubtask.setPatid(patArchive.getId()); |
| | | serviceSubtask.setSendname(patArchive.getName()); |
| | | serviceSubtask.setPhone(patArchive.getTelcode()); |
| | | serviceSubtask.setSex(patArchive.getSex()); |
| | | serviceSubtask.setAge(patArchive.getAge()); |
| | | serviceSubtask.setSfzh(patArchive.getIdcardno()); |
| | | serviceSubtask.setAddr(patArchive.getPlaceOfResidence()); |
| | | serviceSubtaskMapper.updateServiceSubtaskByPatId(serviceSubtask); |
| | | } |
| | | return true; |
| | | } |
| | |
| | | //修改 |
| | | patArchiveVO.setIsoperation(2); |
| | | patArchiveMapper.updatePatArchive(patArchive); |
| | | if (StringUtils.isNotEmpty(patArchive.getNotrequiredFlag()) && patArchive.getNotrequiredFlag().equals("1")) { |
| | | //不需要服务了,需要通过patid和sendstate=2或者sendstate=1去查询一下,service_subtask里是否有正在执行的任务,有的话,立即停了 |
| | | ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO(); |
| | | serviceSubtaskVO.setPatid(patArchive.getId()); |
| | | serviceSubtaskVO.setSendstate(2L); |
| | | List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO); |
| | | serviceSubtaskVO.setSendstate(1L); |
| | | List<ServiceSubtask> serviceSubtaskList1 = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO); |
| | | if (CollectionUtils.isNotEmpty(serviceSubtaskList)) { |
| | | if (CollectionUtils.isNotEmpty(serviceSubtaskList1)) serviceSubtaskList.addAll(serviceSubtaskList1); |
| | | } else { |
| | | if (CollectionUtils.isNotEmpty(serviceSubtaskList1)) serviceSubtaskList = serviceSubtaskList1; |
| | | } |
| | | //去redis中,查询是否有subid,有的话移除cache-exist |
| | | if (CollectionUtils.isNotEmpty(serviceSubtaskList)) { |
| | | for (ServiceSubtask serviceSubtask : serviceSubtaskList) { |
| | | log.error("需要移除的subId为:{}", serviceSubtask.getId().toString()); |
| | | serviceSubtaskMapper.deleteServiceSubtaskById(serviceSubtask.getId()); |
| | | redisCache.removeElementFromList("cache-exist", serviceSubtask.getId().toString()); |
| | | redisCache.removeElementFromList("cache-0", serviceSubtask.getId().toString()); |
| | | redisCache.removeElementFromList("cache-1", serviceSubtask.getId().toString()); |
| | | redisCache.removeElementFromList("cache-2", serviceSubtask.getId().toString()); |
| | | redisCache.removeElementFromList("cache-3", serviceSubtask.getId().toString()); |
| | | redisCache.removeElementFromList("cache-4", serviceSubtask.getId().toString()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (CollectionUtils.isNotEmpty(patArchiveVO.getTagList())) { |
| | |
| | | patArchivetag.setGuid(patArchiveVO.getGuid()); |
| | | patArchivetag.setOrgid(patArchiveVO.getOrgid()); |
| | | if (patArchivetag.getIsoperation() != null && patArchivetag.getIsoperation() == 1 || patArchivetag.getIsoperation() == null && patArchiveVO.getIsoperation() == 1) { |
| | | //判断一下base_tag里是不是存在,如果不存在,先新增 |
| | | BaseTag baseTag = new BaseTag(); |
| | | baseTag.setTagname(patArchivetag.getTagname().trim()); |
| | | List<BaseTag> baseTags = baseTagMapper.selectBaseTagListByTagname(baseTag); |
| | | if (CollectionUtils.isEmpty(baseTags)) { |
| | | //先给放到未分类中 |
| | | baseTag.setTagcategoryid(6L); |
| | | baseTag.setOrgid(patArchiveVO.getOrgid()); |
| | | baseTag.setDelFlag("0"); |
| | | baseTag.setUpdateTime(new Date()); |
| | | baseTag.setCreateTime(new Date()); |
| | | baseTagMapper.insertBaseTag(baseTag); |
| | | patArchivetag.setTagid(baseTag.getTagid()); |
| | | } else { |
| | | patArchivetag.setTagid(baseTags.get(0).getTagid()); |
| | | } |
| | | //新增 |
| | | patArchivetag.setUpdateBy(null); |
| | | patArchivetag.setCreateTime(new Date()); |
| | |
| | | patArchive1.setTagList(stringList.stream().collect(Collectors.toList())); |
| | | patArchives.add(patArchive1); |
| | | } |
| | | //将patArchives里的tagList放到patArchiveList的对象里 |
| | | for (PatArchiveOthreInfo poi : patArchiveList) { |
| | | for (PatArchive pa : patArchives) { |
| | | if (poi.getId() == pa.getId()) { |
| | | poi.setTagList(pa.getTagList()); |
| | | |
| | | return patArchives; |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<PatArchive> patArchiveList1 = DtoConversionUtils.sourceToTarget(patArchiveList, PatArchive.class); |
| | | //给患者联系人赋值 |
| | | // for (PatArchive pa : patArchives) { |
| | | for (PatArchive pa : patArchiveList1) { |
| | | PatArchivecontact patArchivecontact = new PatArchivecontact(); |
| | | patArchivecontact.setPatid(pa.getId()); |
| | | pa.setPatArchivecontactList(patArchivecontactMapper.selectPatArchivecontactList(patArchivecontact)); |
| | | } |
| | | |
| | | return patArchiveList1; |
| | | } |
| | | |
| | | @Override |