liusheng
6 天以前 af73b41c2b027d8d74ce417e2f10008337577128
新增服务补偿,用户查询BUG修改
已修改22个文件
357 ■■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/CommonTaskcallMQ.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScriptVO.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrTaskTemplateTargetoption.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubTaskAnswerReq.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtask.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtaskCountReq.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceSubtaskVO.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/SvyLibTemplateTargetoption.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/SvyTaskTemplateTargetoption.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrLibaTemplateTargetoptionMapper.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrTaskTemplateTargetoptionMapper.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/SvyLibTemplateTargetoptionMapper.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/SvyTaskTemplateTargetoptionMapper.xml 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java
@@ -141,9 +141,13 @@
            //将状态改成完成
            ServiceTask serviceTask = new ServiceTask();
            serviceTask.setTaskid(Long.valueOf(commonTaskcallMQ.getTaskid()));
            //在问卷中,选中某个选项要进行服务补偿时,只是借用该服务的外壳,不对该服务有任务影响
            if (commonTaskcallMQ.getUpdateSendstate() == null || commonTaskcallMQ.getUpdateSendstate() == 1) {
            serviceTask.setSendState(5L);
            serviceTask.setFail(1L);
            svyTaskMapper.updateServiceTask(serviceTask);
            }
        } catch (Exception e) {
            Integer integer = redisCache.getCacheObject(commonTaskcallMQ.getTaskid().toString());
            if (integer != null && integer == 3) {
@@ -651,7 +655,12 @@
            serviceSubtaskPreachform.setTaskid(serviceSubtask.getTaskid());
            serviceSubtaskPreachform.setOrgid(serviceSubtask.getOrgid());
            serviceSubtaskPreachform.setSendstate(failSendstate);
            if (serviceSubtask.getType().equals("3") || serviceSubtask.getType().equals("4")) {
                //如果是宣教或通知,并且发送成功,直接将发送状态改成9
                if (failSendstate.equals("2")) serviceSubtaskPreachform.setSendstate("9");
            }
            serviceSubtaskPreachformMapper.updateSSPByCondition(serviceSubtaskPreachform);
            return true;
        }
@@ -675,6 +684,10 @@
        if (CollectionUtils.isNotEmpty(serviceSubtaskPreachforms)) {
            ServiceSubtaskPreachform serviceSubtaskPreachform1 = serviceSubtaskPreachforms.get(0);
            serviceSubtaskPreachform1.setSendstate(failSendstate);
            if (serviceSubtask.getType().equals("3") || serviceSubtask.getType().equals("4")) {
                //如果是宣教或通知,并且发送成功,直接将发送状态改成9
                if (failSendstate.equals("2")) serviceSubtaskPreachform1.setSendstate("9");
            }
            serviceSubtaskPreachform1.setRemark(remark);
            serviceSubtaskPreachformMapper.updateServiceSubtaskPreachform(serviceSubtaskPreachform1);
            //如果当前的preachform已经是最后一个了,并且本次还是发送失败,那直接将serviceSubtask的sendstate状态改成5就行了(全失败了)
@@ -696,6 +709,12 @@
        serviceSubtask.setCurrentPreachform(preachform);
        serviceSubtask.setVisitTime(getNextVisitTime(serviceSubtask.getId(), serviceSubtask.getTaskid(), serviceSubtask.getVisitTime(), serviceSubtask.getCurrentPreachform()));
        serviceSubtask.setSendstate(3L);
        if (serviceSubtask.getType().equals("3") || serviceSubtask.getType().equals("4")) {
            //如果是宣教或通知,并且发送成功,则直接将serviceSubtask状态改成6L(这个患者是没有题做的,不会再触发接口进行状态修改)
            if (failSendstate.equals("2")) {
                serviceSubtask.setSendstate(6L);
            }
        }
        serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
        return true;
    }
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
@@ -1,6 +1,8 @@
package com.ruoyi.web.controller.system;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@@ -9,6 +11,7 @@
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
@@ -28,7 +31,9 @@
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@@ -63,13 +68,24 @@
     */
    //@PreAuthorize("@ss.hasPermi('system:user:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysUser user) {
        startPage();
    public Map<String, Object> list(SysUser user) {
        LoginUser loginUser = getLoginUser();
        String orgid = loginUser.getUser().getOrgid();
        user.setOrgid(orgid);
        List<SysUser> list = userService.selectUserList(user);
        return getDataTable(list);
        user.setPageNum(PageUtils.getOffset(user.getPageNum(), user.getPageSize()));
        List<SysUser> list = userService.getUserList(user);
        Map<String, Object> rspData = new HashMap();
        rspData.put("code", HttpStatus.SUCCESS);
        rspData.put("msg", "查询成功");
        rspData.put("rows", list);
        user.setPageNum(null);
        user.setPageSize(null);
        List<SysUser> total = userService.getUserList(user);
        rspData.put("total", total.size());
        return rspData;
    }
    @Log(title = "用户管理", businessType = BusinessType.EXPORT)
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
@@ -21,6 +21,8 @@
     */
    public List<SysUser> selectUserList(SysUser sysUser);
    public List<SysUser> getUserList(SysUser sysUser);
    /**
     * 根据条件分页查询已配用户角色列表
     *
@@ -44,6 +46,7 @@
     * @return 用户对象信息
     */
    public SysUser selectUserByUserName(String userName);
    /**
     * 通过用户名查询用户
     *
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -78,6 +78,12 @@
    @DataScope(deptAlias = "d", userAlias = "u")
    public List<SysUser> selectUserList(SysUser user) {
        return userMapper.selectUserList(user);
    }
    @Override
    public List<SysUser> getUserList(SysUser user) {
        return userMapper.getUserList(user);
    }
    /**
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -175,6 +175,69 @@
        <!-- 数据范围过滤 -->
        ${params.dataScope}
    </select>
    <select id="getUserList" parameterType="com.ruoyi.common.core.domain.entity.SysUser" resultMap="SysUserResult">
        select u.user_id,u.title,u.his_user_id,u.hosp_info,u.dept_info, u.searchscope, u.dept_id, u.user_type,
        u.nick_name, u.user_name,
        u.email,u.id_card,
        u.avatar,
        u.dept_name,
        u.dept_code,
        u.birthday,
        u.job_phone,
        u.phonenumber, u.sex, u.status,
        u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark from sys_user u
        where u.del_flag = '0'
        <if test="userId != null">
            AND u.user_id = #{userId}
        </if>
        <if test="orgid != null and orgid != ''">
            AND u.orgid = #{orgid}
        </if>
        <if test="userName != null and userName != ''">
            AND u.user_name like concat('%', #{userName}, '%')
        </if>
        <if test="nickName != null and nickName != ''">
            AND u.nick_name like concat('%', #{nickName}, '%')
        </if>
        <if test="status != null and status != ''">
            AND u.status = #{status}
        </if>
        <if test="idCard != null and idCard != ''">
            AND u.id_card = #{idCard}
        </if>
        <if test="title != null and title != ''">
            AND u.title = #{title}
        </if>
        <if test="jobPhone != null and jobPhone != ''">
            AND u.job_phone = #{jobPhone}
        </if>
        <if test="birthday != null and birthday != ''">
            AND u.birthday = #{birthday}
        </if>
        <if test="deptName != null and deptName != ''">
            AND u.dept_name = #{deptName}
        </if>
        <if test="deptCode != null and deptCode != ''">
            AND u.dept_code = #{deptCode}
        </if>
        <if test="hisUserId != null and hisUserId != ''">
            AND u.his_user_id = #{hisUserId}
        </if>
        <if test="phonenumber != null and phonenumber != ''">
            AND u.phonenumber like concat('%', #{phonenumber}, '%')
        </if>
        <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
            AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
        </if>
        <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
            AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
        </if>
        <if test="deptId != null and deptId != 0">
            AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId},
            ancestors) ))
        </if>
        <if test="pageSize != null  and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>
    </select>
    <select id="selectAllocatedList" parameterType="com.ruoyi.common.core.domain.entity.SysUser"
            resultMap="SysUserResult">
smartor/src/main/java/com/smartor/domain/CommonTaskcallMQ.java
@@ -64,5 +64,10 @@
     */
    @ApiModelProperty(value = "发送时间段 ")
    private TaskSendTimeVO sendTimeslot;
    /**
     * 服务状态修改:1修改  2不修改
     */
    @ApiModelProperty(value = "服务状态修改:1修改  2不修改 ")
    private Integer updateSendstate;
}
smartor/src/main/java/com/smartor/domain/IvrLibaTemplateTargetoption.java
@@ -245,5 +245,15 @@
    @ApiModelProperty(value = "是否结束 0:不结束   1:结束")
    private Integer isEnd;
    /**
     * 选中该选项后,需要给当前患者立即发送的服务的id
     */
    @ApiModelProperty(value = "选中该选项后,需要给当前患者立即发送的服务的id")
    private Integer sendTaskid;
    /**
     * 服务的名称
     */
    @ApiModelProperty(value = "服务的名称")
    private String sendTaskname;
}
smartor/src/main/java/com/smartor/domain/IvrTaskTemplateScriptVO.java
@@ -340,6 +340,8 @@
    @ApiModelProperty(value = "异常预警:0绿色;1红色;2黄色")
    private Long isabnormal;
    private List<Integer> sendTaskids;
    /**
     * 话术选项
     */
smartor/src/main/java/com/smartor/domain/IvrTaskTemplateTargetoption.java
@@ -266,4 +266,16 @@
    @ApiModelProperty(value = "是否结束 0:不结束   1:结束")
    private Integer isEnd;
    /**
     * 选中该选项后,需要给当前患者立即发送的服务的id
     */
    @ApiModelProperty(value = "选中该选项后,需要给当前患者立即发送的服务的id")
    private Integer sendTaskid;
    /**
     * 服务的名称
     */
    @ApiModelProperty(value = "服务的名称")
    private String sendTaskname;
}
smartor/src/main/java/com/smartor/domain/ServiceSubTaskAnswerReq.java
@@ -24,12 +24,20 @@
    @ApiModelProperty(value = "异常标识")
    private String excep;
    private String guid;
    private String orgid;
    @ApiModelProperty(value = "试卷类型:1 随访   2 问卷")
    private Integer type;
    /**
     * 异常预警:0绿色;1红色;2黄色
     */
    @ApiModelProperty(value = "异常预警:0绿色;1红色;2黄色")
    private Integer isabnormal;
    @ApiModelProperty(value = "问题结果详情")
    private List<ServiceSubtaskDetail> serviceSubtaskDetailList;
}
smartor/src/main/java/com/smartor/domain/ServiceSubtask.java
@@ -633,19 +633,15 @@
    @ApiModelProperty(value = "ps")
    private Integer ps;
    /**
     * 患者来源
     */
    @ApiModelProperty(value = "经管医生编码")
    private String managementDoctorCode;
    /**
     * 患者来源
     */
    @ApiModelProperty(value = "经管医生")
    private String managementDoctor;
    @ApiModelProperty(value = "随访情况:1正常语音,2患者拒接或拒访,3面访或者接诊,4微信随访,5随访电话不正确,6其他")
    private Integer taskSituation;
    @ApiModelProperty(value = "异常预警:0绿色;1红色;2黄色")
    private Integer isabnormal;
}
smartor/src/main/java/com/smartor/domain/ServiceSubtaskCountReq.java
@@ -23,8 +23,12 @@
    private Long userId;
    private Integer visitCount;
    private Integer isVisitAgain;
    @ApiModelProperty(value = "异常预警:0绿色;1红色;2黄色")
    private Integer isabnormal;
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "开始时间")
    private Date startTime;
smartor/src/main/java/com/smartor/domain/ServiceSubtaskVO.java
@@ -681,7 +681,6 @@
     * 结束出院日期
     */
    @ApiModelProperty(value = "结束出院日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endOutHospTime;
    /**
@@ -730,6 +729,9 @@
    @ApiModelProperty(value = "随访部门名称")
    private String visitDeptName;
    @ApiModelProperty(value = "异常预警:0绿色;1红色;2黄色")
    private Integer isabnormal;
    @ApiModelProperty(value = "随访部门编码集合")
    private List<String> visitDeptCodes;
}
smartor/src/main/java/com/smartor/domain/SvyLibTemplateTargetoption.java
@@ -266,4 +266,15 @@
    @ApiModelProperty(value = "选中提示")
    private String prompt;
    /**
     * 选中该选项后,需要给当前患者立即发送的服务的id
     */
    @ApiModelProperty(value = "选中该选项后,需要给当前患者立即发送的服务的id")
    private Integer sendTaskid;
    /**
     * 服务的名称
     */
    @ApiModelProperty(value = "服务的名称")
    private String sendTaskname;
}
smartor/src/main/java/com/smartor/domain/SvyTaskTemplateScriptVO.java
@@ -332,6 +332,8 @@
    @ApiModelProperty(value = "组别")
    private String groupName;
    @ApiModelProperty(value = "选中该选项后,需要给当前患者立即发送的服务的id集合")
    private List<Integer> sendTaskids;
    /**
     * 话术选项
smartor/src/main/java/com/smartor/domain/SvyTaskTemplateTargetoption.java
@@ -230,6 +230,18 @@
    private Integer isoperation;
    /**
     * 选中该选项后,需要给当前患者立即发送的服务的id
     */
    @ApiModelProperty(value = "选中该选项后,需要给当前患者立即发送的服务的id")
    private Integer sendTaskid;
    /**
     * 服务的名称
     */
    @ApiModelProperty(value = "服务的名称")
    private String sendTaskname;
    /**
     * 选项续号
     */
    @ApiModelProperty(value = "选项续号")
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
@@ -1,5 +1,8 @@
package com.smartor.service.impl;
import com.alibaba.fastjson2.JSON;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.DtoConversionUtils;
@@ -18,6 +21,7 @@
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
 * 任务问卷问题选项Service业务层处理
@@ -278,6 +282,7 @@
            serviceSubtask.setTaskid(tid);
            serviceSubtask.setPatid(pid);
            serviceSubtask.setSubmit(1L);
            serviceSubtask.setIsabnormal(serviceSubTaskAnswerReq.getIsabnormal());
            serviceSubtask.setSendstate(6L);
            serviceSubtask.setExcep(serviceSubTaskAnswerReq.getExcep());
            serviceSubtask.setFinishtime(new Date());
@@ -665,10 +670,6 @@
            }
            serviceSubtaskDetailVO.setAsrtext(StringUtils.isEmpty(svyTaskTemplateScriptVO.getScriptResult()) ? "" : svyTaskTemplateScriptVO.getScriptResult().replaceAll("^\"|\"$", ""));
            serviceSubtaskDetailVO.setMatchedtext(StringUtils.isEmpty(svyTaskTemplateScriptVO.getScriptResult()) ? "" : svyTaskTemplateScriptVO.getScriptResult().replaceAll("^\"|\"$", ""));
            //            if (StringUtils.isEmpty(serviceSubtaskDetailVO.getAsrtext())) {
//                nextScriptNo = svyTaskTemplateScriptVO.getNextScriptno().toString();
//            }
//            serviceSubtaskDetailVO.setSvyTaskTemplateTargetoptions(svyTaskTemplateScriptVO.getSvyTaskTemplateTargetoptions());
        } else {
            //非单多选
            if (StringUtils.isNotEmpty(svyTaskTemplateScriptVO.getScriptResult())) {
@@ -699,11 +700,86 @@
        ServiceSubtaskDetail serviceSubtaskDetail = DtoConversionUtils.sourceToTarget(serviceSubtaskDetailVO, ServiceSubtaskDetail.class);
        serviceSubtaskDetailMapper.insertServiceSubtaskDetail(serviceSubtaskDetail);
        //如何这需要服务补偿的服务ID不为空的话,则进行立即发送
        if (CollectionUtils.isNotEmpty(svyTaskTemplateScriptVO.getSendTaskids()) && CollectionUtils.isNotEmpty(selectServiceSubtaskList)) {
            sendTaskIds(svyTaskTemplateScriptVO.getSendTaskids(), selectServiceSubtaskList.get(0));
        }
        Map<String, String> map = new HashMap<>();
        map.put("nextScriptNo", nextScriptNo);
        map.put("score", score);
        map.put("id", "" + serviceSubtaskDetail.getId());
        return map;
    }
    private Boolean sendTaskIds(List<Integer> sendTaskids, ServiceSubtask serviceSubtask) {
        for (Integer taskId : sendTaskids) {
            ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(Long.valueOf(taskId));
            String content = sendMQContent(serviceTask, null);
            //先修改状态
            insertServiceSubtask(serviceTask, new Date(), serviceSubtask);
            //立即发送
            redisCache.setCacheObject(content, content, 1, TimeUnit.SECONDS);
            serviceTask.setStopState(null);
            log.info("消息发送成功");
        }
        return null;
    }
    private void insertServiceSubtask(ServiceTask serviceTask, Date date, ServiceSubtask serviceSubtask) {
        //只要进入队列就算待发送
        serviceSubtask.setTaskid(serviceTask.getTaskid());
        serviceSubtask.setTaskName(serviceTask.getTaskName());
        serviceSubtask.setLibtemplateid(StringUtils.isNotEmpty(serviceTask.getLibtemplateid()) ? Long.valueOf(serviceTask.getLibtemplateid()) : null);
        serviceSubtask.setTemplatename(serviceTask.getTemplatename());
        serviceSubtask.setTemplateid(serviceTask.getTemplateid());
        serviceSubtask.setSendstate(2L);
        serviceSubtask.setVisitTime(date);
        serviceSubtask.setId(null);
        serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
        //设置发送补偿方式(这个完全按照服务的发送方式来走)
        if (StringUtils.isNotEmpty(serviceTask.getPreachformDesc())) {
            ObjectMapper objectMapper = new ObjectMapper();
            try {
                List<Map<String, Object>> pfList = objectMapper.readValue(serviceTask.getPreachformDesc(), List.class);
                for (Map<String, Object> map : pfList) {
                    ServiceSubtaskPreachform serviceSubtaskPreachform = new ServiceSubtaskPreachform();
                    serviceSubtaskPreachform.setSort(ObjectUtils.isEmpty(map.get("sort")) ? 0 : Long.valueOf(map.get("sort").toString()));
                    serviceSubtaskPreachform.setPreachform(ObjectUtils.isEmpty(map.get("preachform")) ? "" : map.get("preachform").toString());
                    serviceSubtaskPreachform.setCompensateTime(ObjectUtils.isEmpty(map.get("compensateTime")) ? "" : map.get("compensateTime").toString());
                    serviceSubtaskPreachform.setTaskid(serviceTask.getTaskid());
                    serviceSubtaskPreachform.setSubid(serviceSubtask.getId());
                    //这个sendstate需要在数据库设置一个默认值为“1”
                    serviceSubtaskPreachform.setSendstate("1");
                    serviceSubtaskPreachform.setOrgid(serviceTask.getOrgid());
                    serviceSubtaskPreachform.setCreateTime(new Date());
                    serviceSubtaskPreachformMapper.insertServiceSubtaskPreachform(serviceSubtaskPreachform);
                }
            } catch (JsonProcessingException e) {
                e.printStackTrace();
            }
        }
    }
    private String sendMQContent(ServiceTask serviceTask, TaskSendTimeVO sendTimeslot) {
        CommonTaskcallMQ commonTaskcallMQ = new CommonTaskcallMQ();
        commonTaskcallMQ.setTaskid(serviceTask.getTaskid());
        commonTaskcallMQ.setSendType("2");
        commonTaskcallMQ.setTemplateid(ObjectUtils.isNotEmpty(serviceTask.getTemplateid()) ? serviceTask.getTemplateid().toString() : null);
        commonTaskcallMQ.setPreachform(serviceTask.getPreachform());
        commonTaskcallMQ.setStopState(serviceTask.getStopState());
        commonTaskcallMQ.setTaskType(StringUtils.isNotEmpty(serviceTask.getType()) ? Integer.valueOf(serviceTask.getType()) : null);
        commonTaskcallMQ.setSendTimeslot(sendTimeslot);
        commonTaskcallMQ.setUpdateSendstate(2);
        String commonTaskcallMQJson = JSON.toJSONString(commonTaskcallMQ);
        commonTaskcallMQJson = commonTaskcallMQJson.substring(1, commonTaskcallMQJson.length() - 1);
        return commonTaskcallMQJson;
    }
    private Map<String, String> setSFInfo(IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO, Long taskid, Long patid) {
@@ -764,6 +840,12 @@
        ServiceSubtaskDetail serviceSubtaskDetail = DtoConversionUtils.sourceToTarget(serviceSubtaskDetailVO, ServiceSubtaskDetail.class);
        serviceSubtaskDetailMapper.insertServiceSubtaskDetail(serviceSubtaskDetail);
        //如何这需要服务补偿的服务ID不为空的话,则进行立即发送
        if (CollectionUtils.isNotEmpty(ivrTaskTemplateScriptVO.getSendTaskids()) && CollectionUtils.isNotEmpty(selectServiceSubtaskList)) {
            sendTaskIds(ivrTaskTemplateScriptVO.getSendTaskids(), selectServiceSubtaskList.get(0));
        }
        Map<String, String> map = new HashMap<>();
        map.put("nextScriptNo", nextScriptNo);
        map.put("score", score);
smartor/src/main/resources/mapper/smartor/IvrLibaTemplateTargetoptionMapper.xml
@@ -39,11 +39,15 @@
        <result property="score" column="score"/>
        <result property="prompt" column="prompt"/>
        <result property="isEnd" column="is_end"/>
        <result property="sendTaskid" column="send_taskid"/>
        <result property="sendTaskname" column="send_taskname"/>
    </resultMap>
    <sql id="selectIvrLibaTemplateTargetoptionVo">
        select id,
               targetid,
               send_taskid,
               send_taskname,
               is_end,
               score,
               appendflag,
@@ -98,6 +102,8 @@
            <if test="appendflag != null">and appendflag = #{appendflag}</if>
            <if test="appenddesc != null">and appenddesc = #{appenddesc}</if>
            <if test="optionNo != null">and option_no = #{optionNo}</if>
            <if test="sendTaskid != null">and send_taskid= #{sendTaskid}</if>
            <if test="sendTaskname != null">and send_taskname = #{sendTaskname}</if>
        </where>
    </select>
@@ -143,6 +149,8 @@
            <if test="optionNo != null">option_no,</if>
            <if test="score != null">score,</if>
            <if test="isEnd != null ">is_end,</if>
            <if test="sendTaskid != null">send_taskid,</if>
            <if test="sendTaskname != null">send_taskname,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="targetid != null">#{targetid},</if>
@@ -177,6 +185,8 @@
            <if test="optionNo != null">#{optionNo},</if>
            <if test="score != null">#{score},</if>
            <if test="isEnd != null ">#{isEnd},</if>
            <if test="sendTaskid != null">#{sendTaskid},</if>
            <if test="sendTaskname != null">#{sendTaskname},</if>
        </trim>
    </insert>
@@ -215,6 +225,8 @@
            <if test="optionNo != null">option_no = #{optionNo},</if>
            <if test="score != null">score = #{score},</if>
            <if test="isEnd != null ">is_end = #{isEnd},</if>
            <if test="sendTaskid != null">send_taskid= #{sendTaskid},</if>
            <if test="sendTaskname != null">send_taskname = #{sendTaskname},</if>
        </trim>
        where id = #{id}
    </update>
smartor/src/main/resources/mapper/smartor/IvrTaskTemplateTargetoptionMapper.xml
@@ -42,11 +42,15 @@
        <result property="score" column="score"/>
        <result property="prompt" column="prompt"/>
        <result property="isEnd" column="is_end"/>
        <result property="sendTaskid" column="send_taskid"/>
        <result property="sendTaskname" column="send_taskname"/>
    </resultMap>
    <sql id="selectIvrTaskTemplateTargetoptionVo">
        select id,
               taskid,
               send_taskid,
               send_taskname,
               is_end,
               templateID,
               score,
@@ -102,6 +106,8 @@
            <if test="optionCode != null ">and option_code = #{optionCode}</if>
            <if test="isUserOperation != null ">and is_user_operation = #{isUserOperation}</if>
            <if test="score != null ">and score = #{score}</if>
            <if test="sendTaskid != null">and send_taskid= #{sendTaskid}</if>
            <if test="sendTaskname != null">and send_taskname = #{sendTaskname}</if>
        </where>
    </select>
@@ -150,6 +156,8 @@
            <if test="isUserOperation != null ">is_user_operation,</if>
            <if test="score != null ">score,</if>
            <if test="isEnd != null ">is_end,</if>
            <if test="sendTaskid != null">send_taskid,</if>
            <if test="sendTaskname != null">send_taskname,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="taskid != null">#{taskid},</if>
@@ -187,6 +195,8 @@
            <if test="isUserOperation != null ">#{isUserOperation},</if>
            <if test="score != null ">#{score},</if>
            <if test="isEnd != null ">#{isEnd},</if>
            <if test="sendTaskid != null">#{sendTaskid},</if>
            <if test="sendTaskname != null">#{sendTaskname},</if>
        </trim>
    </insert>
@@ -228,6 +238,8 @@
            <if test="isUserOperation != null ">is_user_operation = #{isUserOperation},</if>
            <if test="score != null ">score = #{score},</if>
            <if test="isEnd != null ">is_end = #{isEnd},</if>
            <if test="sendTaskid != null">send_taskid= #{sendTaskid},</if>
            <if test="sendTaskname != null">send_taskname = #{sendTaskname},</if>
        </trim>
        where id = #{id}
    </update>
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -86,6 +86,7 @@
        <result property="managementDoctorCode" column="management_doctor_code"/>
        <result property="currentPreachform" column="current_preachform"/>
        <result property="taskSituation" column="task_situation"/>
        <result property="isabnormal" column="isabnormal"/>
    </resultMap>
    <resultMap type="com.smartor.domain.ServiceSubtaskCount" id="ServiceSubtaskResult2">
@@ -108,6 +109,7 @@
               management_doctor_code,
               current_preachform,
               upid,
               isabnormal,
               visit_dept_name,
               visit_dept_code,
               visit_time,
@@ -361,6 +363,7 @@
            <if test="suggest != null">and suggest = #{suggest}</if>
            <if test="createBy != null">and create_by = #{createBy}</if>
            <if test="taskGuid != null">and task_guid = #{taskGuid}</if>
            <if test="isabnormal != null">and isabnormal = #{isabnormal}</if>
            <if test="isVisitAgain != null">and is_visit_again = #{isVisitAgain}</if>
            <!-- <if test="visitTime != null">and visit_time = #{visitTime}</if> -->
            <!--<if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if>
@@ -406,6 +409,7 @@
            <if test="managementDoctorCode != null">and management_doctor_code = #{managementDoctorCode}</if>
            <if test="managementDoctor != null">and management_doctor = #{managementDoctor}</if>
            <if test="currentPreachform != null">and current_preachform = #{currentPreachform}</if>
            <if test="isabnormal != null">and isabnormal = #{isabnormal}</if>
        </where>
    </select>
@@ -462,6 +466,7 @@
            <if test="visitDeptName != null">and visit_dept_name = #{visitDeptName}</if>
            <if test="currentPreachform != null">and current_preachform = #{currentPreachform}</if>
            <if test="managementDoctorCode != null">and management_doctor_code = #{managementDoctorCode}</if>
            <if test="isabnormal != null">and isabnormal = #{isabnormal}</if>
            <if test="managementDoctor != null">and management_doctor like concat('%',#{managementDoctor}, '%')</if>
        </where>
@@ -492,6 +497,7 @@
        <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
        <if test="deptcode != null  and deptcode != ''">and deptcode = #{deptcode}</if>
        <if test="deptname != null  and deptname != ''">and deptname = #{deptname}</if>
        <if test="isabnormal != null">and isabnormal = #{isabnormal}</if>
        <if test="leavehospitaldistrictcode != null  and leavehospitaldistrictcode != ''">and
            leavehospitaldistrictcode = #{leavehospitaldistrictcode}
        </if>
@@ -521,6 +527,7 @@
                AND date_format(visit_time,'%y%m%d') &lt;= date_format(#{endtime},'%y%m%d')
            </if>
            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
            <if test="isabnormal != null ">and isabnormal = #{isabnormal}</if>
            <if test="deptcode != null  and deptcode != ''">and deptcode = #{deptcode}</if>
            <if test="deptname != null  and deptname != ''">and deptname = #{deptname}</if>
            <if test="leavehospitaldistrictcode != null  and leavehospitaldistrictcode != ''">and
@@ -627,6 +634,7 @@
            <if test="managementDoctor != null">management_doctor,</if>
            <if test="currentPreachform != null">current_preachform,</if>
            <if test="taskSituation != null">task_situation,</if>
            <if test="isabnormal != null">isabnormal,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="sendname != null">#{sendname},</if>
@@ -712,6 +720,7 @@
            <if test="managementDoctor != null">#{managementDoctor},</if>
            <if test="currentPreachform != null">#{currentPreachform},</if>
            <if test="taskSituation != null">#{taskSituation},</if>
            <if test="isabnormal != null">#{isabnormal},</if>
        </trim>
    </insert>
@@ -802,6 +811,7 @@
            <if test="managementDoctor != null">management_doctor=#{managementDoctor},</if>
            <if test="currentPreachform != null">current_preachform=#{currentPreachform},</if>
            <if test="taskSituation != null">task_situation=#{taskSituation},</if>
            <if test="isabnormal != null">isabnormal=#{isabnormal},</if>
        </trim>
        where id = #{id}
    </update>
@@ -893,6 +903,7 @@
            <if test="managementDoctor != null">management_doctor=#{managementDoctor},</if>
            <if test="currentPreachform != null">current_preachform=#{currentPreachform},</if>
            <if test="taskSituation != null">task_situation=#{taskSituation},</if>
            <if test="isabnormal != null">isabnormal=#{isabnormal},</if>
        </trim>
        <where>
            <if test="patid != null ">and patid = #{patid}</if>
@@ -986,6 +997,7 @@
            <if test="managementDoctor != null">management_doctor=#{managementDoctor},</if>
            <if test="currentPreachform != null">current_preachform=#{currentPreachform},</if>
            <if test="taskSituation != null">task_situation=#{taskSituation},</if>
            <if test="isabnormal != null">isabnormal=#{isabnormal},</if>
        </trim>
        where patid = #{patid} and taskid = #{taskid}
    </update>
@@ -1076,6 +1088,7 @@
            <if test="managementDoctor != null">management_doctor=#{managementDoctor},</if>
            <if test="currentPreachform != null">current_preachform=#{currentPreachform},</if>
            <if test="taskSituation != null">task_situation=#{taskSituation},</if>
            <if test="isabnormal != null">isabnormal=#{isabnormal},</if>
        </trim>
        where task_guid = #{taskGuid} and task_name = #{taskName}
    </update>
@@ -1129,13 +1142,15 @@
            </if>
            <if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if>
            <if test="visitDeptName != null">abd visit_dept_name = #{visitDeptName}</if>
            <if test="isabnormal != null">abd isabnormal = #{isabnormal}</if>
        </where>
    </select>
    <select id="getSfStatisticsJoy" parameterType="com.smartor.domain.ServiceSubtaskCountReq"
            resultMap="ServiceSubtaskResult2">
        SELECT sub_id as subTaskId,COUNT(sub_id) joyCount,
             (SELECT COUNT(1) FROM ivr_liba_target WHERE assortid IN (SELECT config_value FROM sys_config WHERE config_key='joyCount')) joyAllCount
        (SELECT COUNT(1) FROM ivr_liba_target WHERE assortid IN (SELECT config_value FROM sys_config WHERE
        config_key='joyCount')) joyAllCount
        FROM service_subtask_detail a
        WHERE sub_id IN(SELECT id FROM service_subtask t
        <where>
@@ -1167,9 +1182,11 @@
            </if>
            <if test="visitDeptCode != null">and visit_dept_code = #{visitDeptCode}</if>
            <if test="visitDeptName != null">abd visit_dept_name = #{visitDeptName}</if>
            <if test="isabnormal != null">abd isabnormal = #{isabnormal}</if>
        </where>
        )
        AND targetid IN ( SELECT id FROM ivr_liba_target WHERE assortid IN (SELECT config_value FROM sys_config WHERE config_key='joyCount'))
        AND targetid IN ( SELECT id FROM ivr_liba_target WHERE assortid IN (SELECT config_value FROM sys_config WHERE
        config_key='joyCount'))
        GROUP BY sub_id
    </select>
@@ -1321,6 +1338,7 @@
               visitDeptName,
               management_doctor_code,
               management_doctor,
               isabnormal,
               leaveicd10code
        FROM service_subtask,
             JSON_TABLE(send_time_slot, '$[*]' COLUMNS (
smartor/src/main/resources/mapper/smartor/SvyLibTemplateTargetoptionMapper.xml
@@ -41,11 +41,15 @@
        <result property="appenddesc" column="appenddesc"/>
        <result property="optionNo" column="option_no"/>
        <result property="prompt" column="prompt"/>
        <result property="sendTaskid" column="send_taskid"/>
        <result property="sendTaskname" column="send_taskname"/>
    </resultMap>
    <sql id="selectSvyLibTemplateTargetoptionVo">
        select id,
               groupid,
               send_taskid,
               send_taskname,
               score,
               prompt,
               option_no,
@@ -109,6 +113,8 @@
            <if test="appendflag != null">and appendflag = #{appendflag}</if>
            <if test="appenddesc != null">and appenddesc = #{appenddesc}</if>
            <if test="optionNo != null">and option_no = #{optionNo}</if>
            <if test="sendTaskid != null">and send_taskid= #{sendTaskid}</if>
            <if test="sendTaskname != null">and send_taskname = #{sendTaskname}</if>
        </where>
    </select>
@@ -156,6 +162,8 @@
            <if test="appenddesc != null">appenddesc,</if>
            <if test="optionNo != null">option_no,</if>
            <if test="prompt != null">prompt,</if>
            <if test="sendTaskid != null">send_taskid,</if>
            <if test="sendTaskname != null">send_taskname,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="groupid != null">#{groupid},</if>
@@ -193,6 +201,8 @@
            <if test="appenddesc != null">#{appenddesc},</if>
            <if test="optionNo != null">#{optionNo},</if>
            <if test="prompt != null">#{prompt},</if>
            <if test="sendTaskid != null">#{sendTaskid},</if>
            <if test="sendTaskname != null">#{sendTaskname},</if>
        </trim>
    </insert>
@@ -234,6 +244,8 @@
            <if test="appenddesc != null">appenddesc = #{appenddesc},</if>
            <if test="optionNo != null">option_no = #{optionNo},</if>
            <if test="prompt != null">prompt = #{prompt},</if>
            <if test="sendTaskid != null">send_taskid= #{sendTaskid},</if>
            <if test="sendTaskname != null">send_taskname = #{sendTaskname},</if>
        </trim>
        where id = #{id}
    </update>
smartor/src/main/resources/mapper/smartor/SvyTaskTemplateTargetoptionMapper.xml
@@ -43,11 +43,15 @@
        <result property="score" column="score"/>
        <result property="score" column="score"/>
        <result property="prompt" column="prompt"/>
        <result property="sendTaskid" column="send_taskid"/>
        <result property="sendTaskname" column="send_taskname"/>
    </resultMap>
    <sql id="selectSvyTaskTemplateTargetoptionVo">
        select id,
               option_code,
               send_taskid,
               send_taskname,
               score,
               prompt,
               appendflag,
@@ -102,6 +106,8 @@
            <if test="optionCode != null">and option_code = #{optionCode}</if>
            <if test="appendflag != null">and appendflag = #{appendflag}</if>
            <if test="appenddesc != null">and appenddesc = #{appenddesc}</if>
            <if test="sendTaskid != null">and send_taskid= #{sendTaskid}</if>
            <if test="sendTaskname != null">and send_taskname = #{sendTaskname}</if>
        </where>
    </select>
@@ -151,7 +157,8 @@
            <if test="appenddesc != null">appenddesc,</if>
            <if test="score != null">score,</if>
            <if test="prompt != null">prompt,</if>
            <if test="sendTaskid != null">send_taskid,</if>
            <if test="sendTaskname != null">send_taskname,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="taskid != null">#{taskid},</if>
@@ -190,7 +197,8 @@
            <if test="appenddesc != null">#{appenddesc},</if>
            <if test="score != null">#{score},</if>
            <if test="prompt != null">#{prompt},</if>
            <if test="sendTaskid != null">#{sendTaskid}</if>
            <if test="sendTaskname != null">#{sendTaskname}</if>
        </trim>
    </insert>
@@ -233,6 +241,8 @@
            <if test="appenddesc != null">appenddesc = #{appenddesc},</if>
            <if test="score != null">score = #{score},</if>
            <if test="prompt != null">score = #{prompt},</if>
            <if test="sendTaskid != null">send_taskid= #{sendTaskid},</if>
            <if test="sendTaskname != null">send_taskname = #{sendTaskname},</if>
        </trim>
        where id = #{id}
    </update>