liusheng
2025-02-19 a5661dee86ebb48c2ee282b7e0621bb313eab296
smartor/src/main/java/com/smartor/service/impl/SvyTaskSingleServiceImpl.java
@@ -6,6 +6,9 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.ruoyi.common.enums.HospTypeEnum;
import com.ruoyi.common.enums.ServiceTaskTypeEnum;
import com.ruoyi.common.enums.TaskTypeEnum;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.utils.http.HttpEntity;
@@ -16,6 +19,7 @@
import com.smartor.mapper.ServiceSubtaskMapper;
import com.smartor.service.IServiceTaskService;
import com.smartor.service.ISvyTaskSingleService;
import com.sun.org.apache.bcel.internal.generic.NEW;
import lombok.extern.slf4j.Slf4j;
import okhttp3.OkHttpClient;
import okhttp3.Request;
@@ -201,69 +205,27 @@
        else if (isoperation == 3) serviceSubtaskMapper.deleteServiceSubtaskByCondition(taskId, patid);
    }
    @Override
    public int insertTaskInfo(ServiceTaskInfo serviceTaskVO) {
        if (ObjectUtils.isEmpty(serviceTaskVO)) {
            log.info("新增任务入参为空,请检查入参");
            throw new BaseException("新增任务入参为空,请检查入参");
        }
        Integer integer = 1;
        //ServiceSubtask serviceTask = DtoConversionUtils.sourceToTarget(serviceTaskVO, ServiceSubtask.class);
        //serviceTask.setTextParam(JSON.toJSONString(serviceTaskVO.getTextParam()));
        //将任务信息放到服务表中
        ServiceSubtask serviceSubtask = DtoConversionUtils.sourceToTarget(serviceTaskVO, ServiceSubtask.class);
        serviceSubtask.setTaskid(serviceTaskVO.getTaskguid());
        ServiceSubtask serviceSubtask = new ServiceSubtask();
        serviceSubtask.setTaskGuid(serviceTaskVO.getTaskguid());
        String type = "0";
        if (serviceTaskVO.getServicetype().equals("监测评估")) {
            type = "1";
        } else if (serviceTaskVO.getServicetype().equals("出院随访")) {
            type = "2";
        } else if (serviceTaskVO.getServicetype().equals("门诊随访")) {
            type = "3";
        } else if (serviceTaskVO.getServicetype().equals("宣教关怀")) {
            type = "4";
        } else if (serviceTaskVO.getServicetype().equals("复诊通知")) {
            type = "5";
        } else if (serviceTaskVO.getServicetype().equals("满意度调查")) {
            type = "6";
        } else if (serviceTaskVO.getServicetype().equals("患者报告")) {
            type = "7";
        } else if (serviceTaskVO.getServicetype().equals("其他通知")) {
            type = "8";
        }
        if (type.equals("0")) {
            type = serviceTaskVO.getServicetype();
        }
        if (StringUtils.isNotEmpty(serviceTaskVO.getServicetype()))
            type = ServiceTaskTypeEnum.getDescByCode(serviceTaskVO.getServicetype());
        serviceSubtask.setServiceType(type);
        //0、1宣教、2门诊、3出院、4复诊、5体检、6问卷、7医技
        String tasktype = "-1";
        if (serviceTaskVO.getTasktype().equals("通知")) {
            tasktype = "0";
        } else if (serviceTaskVO.getTasktype().equals("宣教")) {
            tasktype = "1";
        } else if (serviceTaskVO.getTasktype().equals("门诊")) {
            tasktype = "2";
        } else if (serviceTaskVO.getTasktype().equals("出院")) {
            tasktype = "3";
        } else if (serviceTaskVO.getTasktype().equals("复诊")) {
            tasktype = "4";
        } else if (serviceTaskVO.getTasktype().equals("体检")) {
            tasktype = "5";
        } else if (serviceTaskVO.getTasktype().equals("问卷")) {
            tasktype = "6";
        } else if (serviceTaskVO.getTasktype().equals("医技")) {
            tasktype = "7";
        }
        if (tasktype.equals("-1")) {
            tasktype = serviceTaskVO.getTasktype();
        }
        if (StringUtils.isNotEmpty(serviceTaskVO.getTasktype()))
            tasktype = TaskTypeEnum.getDescByCode(serviceTaskVO.getTasktype());
        serviceSubtask.setType(tasktype);
        serviceSubtask.setLabelstatus(serviceTaskVO.getTaskstate());
        serviceSubtask.setTaskName(serviceTaskVO.getTaskname());
        serviceSubtask.setTaskDesc(serviceTaskVO.getTaskdesc());
        serviceSubtask.setPreachform(serviceTaskVO.getExemode());
        //serviceSubtask.setUploadTime(serviceTaskVO.setUploadTime());
        serviceSubtask.setCreateBy(serviceTaskVO.getCreateBy());
        serviceSubtask.setCreateTime(serviceTaskVO.getCreateTime());
        serviceSubtask.setOperatorNo(serviceTaskVO.getOperatorno());
@@ -272,6 +234,7 @@
        serviceSubtask.setEndtime(serviceTaskVO.getFinishtime());
        serviceSubtask.setResult(serviceTaskVO.getResult());
        serviceSubtask.setSuggest(serviceTaskVO.getSuggest());
        serviceSubtask.setDelFlag(serviceTaskVO.getDelflag());
        serviceSubtask.setOrgid(serviceTaskVO.getOrgguid());
        serviceSubtask.setPatid(serviceTaskVO.getPatguid());
        serviceSubtask.setSendname(serviceTaskVO.getPatname());
@@ -286,31 +249,25 @@
        serviceSubtask.setWechat(serviceTaskVO.getPatopenid());
        serviceSubtask.setInhospno(serviceTaskVO.getInhosno());
        String hosptype = "-1";
        if (serviceTaskVO.getVisittype().equals("门诊")) {
            hosptype = "1";
        } else if (serviceTaskVO.getVisittype().equals("出院")) {
            hosptype = "2";
        } else if (serviceTaskVO.getVisittype().equals("专病")) {
            hosptype = "3";
        } else if (serviceTaskVO.getVisittype().equals("外部导入")) {
            hosptype = "4";
        }
        if (hosptype.equals("-1")) {
            hosptype = serviceTaskVO.getVisittype();
        }
        hosptype = HospTypeEnum.getDescByCode(serviceTaskVO.getVisittype());
        serviceSubtask.setHospType(hosptype);
        serviceSubtask.setHospno(serviceTaskVO.getVisitno());
        serviceSubtask.setAdmindate(serviceTaskVO.getVisittime());
        serviceSubtask.setRoomno(serviceTaskVO.getRoomno());
        serviceSubtask.setBedNo(serviceTaskVO.getBedno());
        serviceSubtask.setDeptname(serviceTaskVO.getDeptname());
        //serviceSubtask.setSendname(serviceTaskVO.gets());
        //serviceSubtask.setPatid(serviceTaskVO.getPid());
        serviceSubtask.setSendstate(1L);
        //serviceSubtask.setHospType(serviceTask.getHospType());
        serviceSubtask.setCreateTime(new Date());
        serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
        integer = serviceSubtask.getId().intValue();
        //先查询一遍,该taskGuid是否存在
        ServiceSubtaskVO serviceSubtaskVO = new ServiceSubtaskVO();
        serviceSubtaskVO.setTaskGuid(serviceTaskVO.getTaskguid());
        List<ServiceSubtask> serviceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO);
        if (CollectionUtils.isNotEmpty(serviceSubtaskList)) {
            serviceSubtaskMapper.updateServiceSubtaskByTaskGuid(serviceSubtask);
        } else {
            serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
        }
        Integer integer = serviceSubtask.getId().intValue();
        log.error("插入的ID是:{}", integer);
        return integer;
    }