liusheng
2025-04-02 acd62c1684cbde71954252ffdf89d0918491e6fc
smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java
@@ -7,10 +7,7 @@
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.ServiceSubtaskMapper;
import com.smartor.mapper.*;
import com.smartor.service.IPatArchiveService;
import com.smartor.service.IPatMedInhospService;
import com.smartor.service.IPatMedOuthospService;
@@ -62,7 +59,7 @@
    private IPatMedInhospService patMedInhospService;
    @Autowired
    private IPatMedOuthospService patMedOuthospService;
    private PatArchivecontactMapper patArchivecontactMapper;
    @Autowired
    private IPatMedPhysicalService patMedPhysicalService;
@@ -149,6 +146,33 @@
            //修改
            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())) {
@@ -157,6 +181,22 @@
                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());
@@ -562,6 +602,12 @@
            patArchive1.setTagList(stringList.stream().collect(Collectors.toList()));
            patArchives.add(patArchive1);
        }
        //给患者联系人赋值
        for (PatArchive pa : patArchives) {
            PatArchivecontact patArchivecontact = new PatArchivecontact();
            patArchivecontact.setPatid(pa.getId());
            pa.setPatArchivecontactList(patArchivecontactMapper.selectPatArchivecontactList(patArchivecontact));
        }
        return patArchives;
    }