liusheng
9 天以前 035108ae9d6ea2c2daa860921f296fda02a8e410
1.满意度导出BUG处理
2.三汇电话接口部分
3.外链可以通过subid查询到
已修改17个文件
已添加5个文件
1198 ■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServicePhoneController.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskAnswerController.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SmsTempletController.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java 337 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/SmsTempletMapper.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PhoneCallBackSHVO.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PhoneCallResultYQVO.java 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceOutPath.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/VO/ServiceSubtaskVO.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IServicePhoneService.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServicPhoneServiceImpl.java 200 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java 233 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/ServiceOutPathMapper.xml 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServicePhoneController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
package com.ruoyi.web.controller.smartor;
import com.ruoyi.common.core.controller.BaseController;
import com.smartor.domain.OutboundConfigAddReqVO;
import com.smartor.domain.OutboundInstanceResVO;
import com.smartor.domain.PhoneCallBackSHVO;
import com.smartor.domain.PhoneCallReqYQVO;
import com.smartor.domain.PhoneCallResultYQVO;
import com.smartor.service.IServicePhoneService;
import com.smartor.service.IServiceSubtaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
 * ä¸‰æ±‡ç”µè¯æµç¨‹æœåŠ¡ Controller
 *
 * @author ls
 * @date 2026-08-26
 */
@Slf4j
@Api(description = "三汇电话流程服务")
@RestController
@RequestMapping("/smartor/shphone")
public class ServicePhoneController extends BaseController {
    @Autowired
    private IServiceSubtaskService serviceSubtaskService;
    @Autowired
    private IServicePhoneService iServicePhoneService;
    @ApiOperation("根据电话号码,获取首个问题")
    @PostMapping("/getFirstQues")
    public Map<String, Object> getFirstQues(@RequestBody PhoneCallReqYQVO phoneCallReqYQVO) {
        log.info("根据电话号码,获取首个问题?{}", phoneCallReqYQVO);
        PhoneCallBackSHVO phoneCallBackSHVO = serviceSubtaskService.getFirstQues(phoneCallReqYQVO);
        return success(phoneCallBackSHVO);
    }
    @ApiOperation("三汇 ASR ç»“果处理")
    @PostMapping("/processResust")
    public Map<String, Object> processResust(@RequestBody PhoneCallResultYQVO resultYQVO) {
        log.info("三汇 ASR ç»“果处理 (三汇)?{}", resultYQVO);
        PhoneCallBackSHVO phoneCallBackSHVO = serviceSubtaskService.processResust(resultYQVO);
        return success(phoneCallBackSHVO);
    }
    @ApiOperation("新增外呼实例配置")
    @PostMapping("/addOutboundInstance")
    public Map<String, Object> addOutboundInstance(@RequestBody OutboundConfigAddReqVO request) {
        log.info("新增外呼实例配置:{}", request);
        OutboundInstanceResVO outboundInstanceResVO = iServicePhoneService.addOutboundInstance(request);
        return success(outboundInstanceResVO);
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskAnswerController.java
@@ -114,11 +114,18 @@
        return toAjax(serviceSubtaskAnswerService.deleteServiceSubtaskAnswerByIds(ids));
    }
    @ApiOperation("患者问题结果记录(外链)")
    /**
     * æ‚£è€…问题结果记录 (外链) - å¼‚步处理
     */
    @ApiOperation("患者问题结果记录 (外链)")
    @PostMapping("/saveQuestionAnswer")
    public AjaxResult saveQuestionAnswer(@RequestBody ServiceSubTaskAnswerReq serviceSubTaskAnswerReq) {
        log.info("【saveQuestionCache-----saveQuestionAnswer】的入参为prarm1:{},prarm2:{},type:{},isabnormal:{}", serviceSubTaskAnswerReq.getParam1(), serviceSubTaskAnswerReq.getParam2(), serviceSubTaskAnswerReq.getType(), serviceSubTaskAnswerReq.getIsabnormal());
        return toAjax(serviceSubtaskAnswerService.saveQuestionAnswer(serviceSubTaskAnswerReq, 0L));
        log.info("【saveQuestionAnswer】的入参为 param1:{},param2:{},type:{},isabnormal:{}",
                serviceSubTaskAnswerReq.getParam1(), serviceSubTaskAnswerReq.getParam2(),
                serviceSubTaskAnswerReq.getType(), serviceSubTaskAnswerReq.getIsabnormal());
        // å¼‚步处理保存逻辑,立即返回成功消息
        serviceSubtaskAnswerService.saveQuestionAnswer(serviceSubTaskAnswerReq, 0L);
        return success("提交成功,正在处理中...");
    }
@@ -137,11 +144,16 @@
    }
    @ApiOperation("患者问题结果记录(小程充外链)")
    /**
     * æ‚£è€…问题结果记录 (小程序外链) - å¼‚步处理
     */
    @ApiOperation("患者问题结果记录 (小程充外链)")
    @PostMapping("/saveQuestionAnswerXCH")
    public AjaxResult saveQuestionAnswerXCH(@RequestBody ServiceSubTaskAnswerReq serviceSubTaskAnswerReq) {
        log.info("【saveQuestionCache-----saveQuestionAnswerXCH】的入参为:{}", serviceSubTaskAnswerReq);
        return toAjax(serviceSubtaskAnswerService.saveQuestionAnswer(serviceSubTaskAnswerReq, 1L));
        log.info("【saveQuestionAnswerXCH】的入参为:{}", serviceSubTaskAnswerReq);
        // å¼‚步处理保存逻辑,立即返回成功消息
        serviceSubtaskAnswerService.saveQuestionAnswer(serviceSubTaskAnswerReq, 1L);
        return success("提交成功,正在处理中...");
    }
    @ApiOperation("获取患者问题结果记录缓存(小程序外链)")
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceSubtaskController.java
@@ -276,9 +276,15 @@
                }
            }
            //获取serviceSubtaskList中的所有taskid
            List<Long> taskIds = serviceSubtaskList.stream().map(ServiceSubtaskRes::getTaskid).filter(ObjectUtils::isNotEmpty).distinct().collect(Collectors.toList());
            serviceSubtaskDetailRatioExports = serviceSubtaskService.statQuestionOption(taskIds, serviceSubtaskVO.getStartOutHospTime(), serviceSubtaskVO.getEndOutHospTime());
            if (StringUtils.isNotEmpty(serviceSubtaskVO.getServiceType()) && serviceSubtaskVO.getServiceType().equals("2")) {
                //获取serviceSubtaskList中的所有taskid
                List<Long> taskIds = serviceSubtaskList.stream().map(ServiceSubtaskRes::getTaskid).filter(ObjectUtils::isNotEmpty).distinct().collect(Collectors.toList());
                serviceSubtaskDetailRatioExports = serviceSubtaskService.statQuestionOption(taskIds, serviceSubtaskVO.getStartOutHospTime(), serviceSubtaskVO.getEndOutHospTime());
            } else if (StringUtils.isNotEmpty(serviceSubtaskVO.getServiceType()) && serviceSubtaskVO.getServiceType().equals("6")) {
                //满意度统计 ï¼ˆé€šè¿‡ subtask çš„ id åŽ»ç»Ÿè®¡ï¼‰
                List<Long> subtaskIds = serviceSubtaskList.stream().map(ServiceSubtaskRes::getId).collect(Collectors.toList());
                serviceSubtaskDetailRatioExports = serviceSubtaskService.statQuestionOptionBySubtaskIds(subtaskIds, serviceSubtaskVO.getStartOutHospTime(), serviceSubtaskVO.getEndOutHospTime());
            }
        }
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SmsTempletController.java
@@ -6,6 +6,7 @@
import cn.hutool.core.util.ObjectUtil;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -41,16 +42,18 @@
    //@PreAuthorize("@ss.hasPermi('smartor:smstemplet:list')")
    @PostMapping("/list")
    public Map<String, Object> list(@RequestBody SmsTemplet smsTemplet) {
        smsTemplet.setPageNum(PageUtils.getOffset(smsTemplet.getPageNum(), smsTemplet.getPageSize()));
        if (StringUtils.isEmpty(smsTemplet.getUserName()) && StringUtils.isEmpty(smsTemplet.getWardCode()) && StringUtils.isEmpty(smsTemplet.getDeptCode())) {
            SysUser user = getLoginUser().getUser();
            smsTemplet.setUserName(user.getUserName());
            smsTemplet.setNickName(user.getNickName());
        }
        List<SmsTemplet> list = smsTempletService.selectSmsTempletList(smsTemplet);
        //这个不需要分页,一个科室也不会有多少条短信模板
        smsTemplet.setPageNum(null);
        smsTemplet.setPageSize(null);
        List<SmsTemplet> list = smsTempletService.selectSmsTempletList(smsTemplet);
        return getDataTable3(ObjectUtil.isNotEmpty(list) ? list.size() : 0, list);
        List<SmsTemplet> total = smsTempletService.selectSmsTempletList(smsTemplet);
        return getDataTable3(ObjectUtil.isNotEmpty(total) ? total.size() : 0, list);
    }
    /**
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java
@@ -122,12 +122,14 @@
     */
//    @IpWhitelist
    @GetMapping("/SSOLogin")
    public RedirectView SSOLogin(@RequestParam(required = false) String campusid, @RequestParam(required = false) String deptId, String orgid, String userName, String token) {
    public RedirectView SSOLogin(@RequestParam(required = false) String campusid, @RequestParam(required = false) String deptId, @RequestParam(required = false) String systype, String orgid, String userName, String token) {
        if (StringUtils.isEmpty(userName) && StringUtils.isEmpty(token) && StringUtils.isEmpty(orgid)) {
            throw new BaseException("参数不能为空");
        }
        String path = null;
        if (StringUtils.isEmpty(systype)) path = sysConfigService.selectConfigByKey("sys.qddz");
        else path = sysConfigService.selectConfigByKey("sys.qddz.yd");
        String path = sysConfigService.selectConfigByKey("sys.qddz");
        if (StringUtils.isEmpty(path)) {
            throw new BaseException("请配置前端地址");
        }
ruoyi-admin/src/main/java/com/ruoyi/web/controller/tool/TestController.java
@@ -1,183 +1,154 @@
package com.ruoyi.web.controller.tool;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.utils.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
/**
 * swagger ç”¨æˆ·æµ‹è¯•方法
 *
 * @author ruoyi
 */
@Api("用户信息管理")
@RestController
@RequestMapping("/test/user")
public class TestController extends BaseController
{
    private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
    {
        users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
        users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
    }
    @ApiOperation("获取用户列表")
    @GetMapping("/list")
    public R<List<UserEntity>> userList()
    {
        List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
        return R.ok(userList);
    }
    @ApiOperation("获取用户详细")
    @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
    @GetMapping("/{userId}")
    public R<UserEntity> getUser(@PathVariable Integer userId)
    {
        if (!users.isEmpty() && users.containsKey(userId))
        {
            return R.ok(users.get(userId));
        }
        else
        {
            return R.fail("用户不存在");
        }
    }
    @ApiOperation("新增用户")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class),
        @ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class),
        @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class),
        @ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)
    })
    @PostMapping("/save")
    public R<String> save(UserEntity user)
    {
        if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
        {
            return R.fail("用户ID不能为空");
        }
        users.put(user.getUserId(), user);
        return R.ok();
    }
    @ApiOperation("更新用户")
    @PutMapping("/update")
    public R<String> update(@RequestBody UserEntity user)
    {
        if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
        {
            return R.fail("用户ID不能为空");
        }
        if (users.isEmpty() || !users.containsKey(user.getUserId()))
        {
            return R.fail("用户不存在");
        }
        users.remove(user.getUserId());
        users.put(user.getUserId(), user);
        return R.ok();
    }
    @ApiOperation("删除用户信息")
    @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
    @DeleteMapping("/{userId}")
    public R<String> delete(@PathVariable Integer userId)
    {
        if (!users.isEmpty() && users.containsKey(userId))
        {
            users.remove(userId);
            return R.ok();
        }
        else
        {
            return R.fail("用户不存在");
        }
    }
}
@ApiModel(value = "UserEntity", description = "用户实体")
class UserEntity
{
    @ApiModelProperty("用户ID")
    private Integer userId;
    @ApiModelProperty("用户名称")
    private String username;
    @ApiModelProperty("用户密码")
    private String password;
    @ApiModelProperty("用户手机")
    private String mobile;
    public UserEntity()
    {
    }
    public UserEntity(Integer userId, String username, String password, String mobile)
    {
        this.userId = userId;
        this.username = username;
        this.password = password;
        this.mobile = mobile;
    }
    public Integer getUserId()
    {
        return userId;
    }
    public void setUserId(Integer userId)
    {
        this.userId = userId;
    }
    public String getUsername()
    {
        return username;
    }
    public void setUsername(String username)
    {
        this.username = username;
    }
    public String getPassword()
    {
        return password;
    }
    public void setPassword(String password)
    {
        this.password = password;
    }
    public String getMobile()
    {
        return mobile;
    }
    public void setMobile(String mobile)
    {
        this.mobile = mobile;
    }
}
//package com.ruoyi.web.controller.tool;
//
//import java.util.ArrayList;
//import java.util.LinkedHashMap;
//import java.util.List;
//import java.util.Map;
//
//import org.springframework.web.bind.annotation.DeleteMapping;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.PutMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import com.ruoyi.common.core.controller.BaseController;
//import com.ruoyi.common.core.domain.R;
//import com.ruoyi.common.utils.StringUtils;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiImplicitParam;
//import io.swagger.annotations.ApiImplicitParams;
//import io.swagger.annotations.ApiModel;
//import io.swagger.annotations.ApiModelProperty;
//import io.swagger.annotations.ApiOperation;
//
///**
// * swagger ç”¨æˆ·æµ‹è¯•方法
// *
// * @author ruoyi
// */
//@Api("用户信息管理")
//@RestController
//@RequestMapping("/test/user")
//public class TestController extends BaseController {
//    private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
//
//    {
//        users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
//        users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
//    }
//
//    @ApiOperation("获取用户列表")
//    @GetMapping("/list")
//    public R<List<UserEntity>> userList() {
//        List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
//        return R.ok(userList);
//    }
//
//    @ApiOperation("获取用户详细")
//    @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
//    @GetMapping("/{userId}")
//    public R<UserEntity> getUser(@PathVariable Integer userId) {
//        if (!users.isEmpty() && users.containsKey(userId)) {
//            return R.ok(users.get(userId));
//        } else {
//            return R.fail("用户不存在");
//        }
//    }
//
//    @ApiOperation("新增用户")
//    @ApiImplicitParams({@ApiImplicitParam(name = "userId", value = "用户id", dataType = "Integer", dataTypeClass = Integer.class), @ApiImplicitParam(name = "username", value = "用户名称", dataType = "String", dataTypeClass = String.class), @ApiImplicitParam(name = "password", value = "用户密码", dataType = "String", dataTypeClass = String.class), @ApiImplicitParam(name = "mobile", value = "用户手机", dataType = "String", dataTypeClass = String.class)})
//    @PostMapping("/save")
//    public R<String> save(UserEntity user) {
//        if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) {
//            return R.fail("用户ID不能为空");
//        }
//        users.put(user.getUserId(), user);
//        return R.ok();
//    }
//
//    @ApiOperation("更新用户")
//    @PutMapping("/update")
//    public R<String> update(@RequestBody UserEntity user) {
//        if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId())) {
//            return R.fail("用户ID不能为空");
//        }
//        if (users.isEmpty() || !users.containsKey(user.getUserId())) {
//            return R.fail("用户不存在");
//        }
//        users.remove(user.getUserId());
//        users.put(user.getUserId(), user);
//        return R.ok();
//    }
//
//    @ApiOperation("删除用户信息")
//    @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path", dataTypeClass = Integer.class)
//    @GetMapping("/{userId}")
//    public R<String> delete(@PathVariable Integer userId) {
//        if (!users.isEmpty() && users.containsKey(userId)) {
//            users.remove(userId);
//            return R.ok();
//        } else {
//            return R.fail("用户不存在");
//        }
//    }
//}
//
//@ApiModel(value = "UserEntity", description = "用户实体")
//class UserEntity {
//    @ApiModelProperty("用户ID")
//    private Integer userId;
//
//    @ApiModelProperty("用户名称")
//    private String username;
//
//    @ApiModelProperty("用户密码")
//    private String password;
//
//    @ApiModelProperty("用户手机")
//    private String mobile;
//
//    public UserEntity() {
//
//    }
//
//    public UserEntity(Integer userId, String username, String password, String mobile) {
//        this.userId = userId;
//        this.username = username;
//        this.password = password;
//        this.mobile = mobile;
//    }
//
//    public Integer getUserId() {
//        return userId;
//    }
//
//    public void setUserId(Integer userId) {
//        this.userId = userId;
//    }
//
//    public String getUsername() {
//        return username;
//    }
//
//    public void setUsername(String username) {
//        this.username = username;
//    }
//
//    public String getPassword() {
//        return password;
//    }
//
//    public void setPassword(String password) {
//        this.password = password;
//    }
//
//    public String getMobile() {
//        return mobile;
//    }
//
//    public void setMobile(String mobile) {
//        this.mobile = mobile;
//    }
//}
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
@@ -108,7 +108,7 @@
                // è¿‡æ»¤è¯·æ±‚
                .authorizeRequests()
                // å¯¹äºŽç™»å½•login æ³¨å†Œregister éªŒè¯ç captchaImage å…è®¸åŒ¿åè®¿é—®
                .antMatchers("/login","/test/**", "/register", "/captchaImage", "/qrcode/generateStaticHtml", "/qrcode/getQRcode", "/qrcode/getFormDate", "/chat", "/system/file/admin/uploadFile", "/smartor/dingtalk/sendNotification", "/patient/read/patientInfo", "/socket", "/API_ESB_Service", "/API_ESB_Service/Run", "/magic/web/**", "/smartor/serviceSubtask/phoneCallBack", "/smartor/serviceSubtask/taskPull", "/smartor/serviceSubtask/phoneCallBackYQ", "/smartor/robot/callstatus", "/smartor/robot/aidialog", "/smartor/robot/cdrinfo", "/getToken", "/smartor/subtaskAnswer/getQuestionCache", "/smartor/subtaskAnswer/saveQuestionCache", "/smartor/servicetask/getScriptInfoByCondition", "/smartor/subtaskAnswer/saveQuestionAnswer", "/smartor/import/download", "/smartor/serviceSubtask/recordAccept", "/smartor/outPath/getInfoByParam", "/smartor/serviceExternal/addDeptInfo", "/smartor/serviceExternal/**", "/sso/**","/smartor/sltdHealthcareRecord/**","/smartor/servicetask/getScriptByCondition","/smartor/subtaskAnswer/saveMYDQuestionAnswer","smartor/serviceSubtask/goSfRelay","/smartor/serviceSubtask/scanGenerateSubtask").permitAll()
                .antMatchers("/login","/test/**", "/register", "/captchaImage", "/qrcode/generateStaticHtml", "/qrcode/getQRcode", "/qrcode/getFormDate", "/chat", "/system/file/admin/uploadFile", "/smartor/dingtalk/sendNotification", "/patient/read/patientInfo", "/socket", "/API_ESB_Service", "/API_ESB_Service/Run", "/magic/web/**", "/smartor/serviceSubtask/phoneCallBack", "/smartor/serviceSubtask/taskPull", "/smartor/serviceSubtask/phoneCallBackYQ", "/smartor/robot/callstatus", "/smartor/robot/aidialog", "/smartor/robot/cdrinfo", "/getToken", "/smartor/subtaskAnswer/getQuestionCache", "/smartor/subtaskAnswer/saveQuestionCache", "/smartor/servicetask/getScriptInfoByCondition", "/smartor/subtaskAnswer/saveQuestionAnswer", "/smartor/import/download", "/smartor/serviceSubtask/recordAccept", "/smartor/outPath/getInfoByParam", "/smartor/serviceExternal/addDeptInfo", "/smartor/serviceExternal/**", "/sso/**","/smartor/sltdHealthcareRecord/**","/smartor/servicetask/getScriptByCondition","/smartor/subtaskAnswer/saveMYDQuestionAnswer","smartor/serviceSubtask/goSfRelay","/smartor/serviceSubtask/scanGenerateSubtask","/smartor/shphone/getFirstQues","/smartor/shphone/processResust","/smartor/shphone/addOutboundInstance").permitAll()
                // é™æ€èµ„源,可匿名访问
//                .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**","/getDept/*","/SSOLogin/**").permitAll().antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
                .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**","/getDept/*","/SSOLogin/**","/system/dict/data/typeout/*").permitAll().antMatchers( "/druid/**").permitAll()
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ThreadPoolConfig.java
@@ -1,6 +1,7 @@
package com.ruoyi.framework.config;
import com.ruoyi.common.utils.Threads;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -15,6 +16,7 @@
 *
 * @author ruoyi
 **/
@Slf4j
@Configuration
public class ThreadPoolConfig
{
@@ -34,12 +36,22 @@
    public ThreadPoolTaskExecutor threadPoolTaskExecutor()
    {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setMaxPoolSize(maxPoolSize);
        // æ ¸å¿ƒçº¿ç¨‹æ± å¤§å°
        executor.setCorePoolSize(corePoolSize);
        // æœ€å¤§å¯åˆ›å»ºçš„线程数
        executor.setMaxPoolSize(maxPoolSize);
        // é˜Ÿåˆ—最大长度
        executor.setQueueCapacity(queueCapacity);
        // çº¿ç¨‹æ± ç»´æŠ¤çº¿ç¨‹æ‰€å…è®¸çš„空闲时间
        executor.setKeepAliveSeconds(keepAliveSeconds);
        // çº¿ç¨‹æ± å¯¹æ‹’绝任务(无线程可用)的处理策略
        // çº¿ç¨‹åç§°å‰ç¼€
        executor.setThreadNamePrefix("async-task-executor-");
        // è®¾ç½®çº¿ç¨‹å·¥åŽ‚ (用于给线程命名,便于排查问题)
        executor.setThreadFactory(new BasicThreadFactory.Builder().namingPattern("async-task-%d").daemon(true).build());
        // çº¿ç¨‹æ± å¯¹æ‹’绝任务 (无线程可用) çš„处理策略 - è°ƒç”¨è€…运行策略
        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
        // åˆå§‹åŒ–
        executor.initialize();
        return executor;
    }
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -133,6 +133,7 @@
        SysUserDept sysUserDept = new SysUserDept();
        sysUserDept.setUserId(sysUser.getUserId());
        sysUserDept.setDeptType(sysUser.getSearchscope());
        sysUserDept.setOrgid(sysUser.getOrgid());
        List<SysUserDept> sysUserDeptKSs = null;
        List<SysUserDept> sysUserDeptBQs = null;
        if (StringUtils.isNotEmpty(sysUser.getSearchscope()) && sysUser.getSearchscope().equals("0")) {
ruoyi-system/src/main/resources/mapper/system/SmsTempletMapper.xml
@@ -67,6 +67,7 @@
        <if test="wardCode != null  and wardCode != ''">and ward_code = #{wardCode}</if>
        <if test="userName != null  and userName != ''">and user_name = #{userName}</if>
        <if test="nickName != null  and nickName != ''">and nick_name = #{nickName}</if>
        <if test="pageSize != null  and pageNum != null">limit ${pageSize} OFFSET ${pageNum}</if>
    </select>
    <select id="selectSmsTempletByTempletid" parameterType="Long" resultMap="SmsTempletResult">
smartor/src/main/java/com/smartor/domain/PhoneCallBackSHVO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,50 @@
package com.smartor.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * ç”µè¯é—®é¢˜å“åº”(三汇)
 *
 * @author ls
 * 26
 */
@Data
public class PhoneCallBackSHVO {
    /**
     * å­ä»»åŠ¡ID
     */
    @ApiModelProperty(value = "子任务ID")
    private Long subId;
    /**
     * é—®é¢˜ID
     */
    @ApiModelProperty(value = "问题ID")
    private Long scriptId;
    /**
     * ä»»åŠ¡æ¨¡æ¿ID
     */
    @ApiModelProperty(value = "任务模板ID")
    private Long taskTemplateid;
    /**
     * å¯ä»¥å¯¹å½“前通道的音量进行适当调整,取值范围【-4,4】
     */
    @ApiModelProperty(value = "序号")
    private Integer sort;
    @ApiModelProperty(value = "问题内容")
    private String scriptContent;
    @ApiModelProperty(value = "选项")
    private String option;
    @ApiModelProperty(value = "流程状态:0结束   1进行中")
    private String status = "1";
}
smartor/src/main/java/com/smartor/domain/PhoneCallResultYQVO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,74 @@
package com.smartor.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * ç”µè¯ASR回调请求(雨绮)
 *
 * @author ls
 * @date 2024-08-8
 */
@Data
public class PhoneCallResultYQVO {
    @ApiModelProperty(value = "任务编号(这里存在的就是subtaskID)")
    private String taskid;
    /**
     * å½“前呼叫的目标号码
     */
    @ApiModelProperty(value = "当前呼叫的目标号码")
    private String phone;
    /**
     * å½“前回调的请求类型,包括:AsrCallback: ASR文本回调    DtmfCallback:收到按键回调       SilentCallback:静默回调      PlayEvent:音乐播放开始、结束事件回调
     */
    @ApiModelProperty(value = "当前回调的请求类型,包括:AsrCallback: ASR文本回调    DtmfCallback:收到按键回调       SilentCallback:静默回调      PlayEvent:音乐播放开始、结束事件回调")
    private String operate;
    /**
     * asr回答的内容
     */
    @ApiModelProperty(value = "asr回答的内容")
    private String asrResult;
    /**
     * å­ä»»åŠ¡ID
     */
    @ApiModelProperty(value = "子任务ID")
    private Long subId;
    /**
     * é—®é¢˜ID
     */
    @ApiModelProperty(value = "问题ID")
    private Long scriptId;
    /**
     * ä»»åŠ¡æ¨¡æ¿ID
     */
    @ApiModelProperty(value = "任务模板ID")
    private Long taskTemplateid;
    /**
     * å¯ä»¥å¯¹å½“前通道的音量进行适当调整,取值范围【-4,4】
     */
    @ApiModelProperty(value = "序号")
    private Integer sort;
    @ApiModelProperty(value = "通过库匹配的结果")
    private String scriptContent;
    @ApiModelProperty(value = "机构ID")
    private String orgid;
    @ApiModelProperty(value = "uuid")
    private String uuid;
    @ApiModelProperty(value = "guid")
    private String guid;
}
smartor/src/main/java/com/smartor/domain/ServiceOutPath.java
@@ -85,5 +85,21 @@
    @ApiModelProperty(value = "病人信息")
    private PatArchive patArchive;
    /**
     * æœªåŠ å¯†çš„ä»»åŠ¡ID
     */
    @ApiModelProperty("未加密的任务ID")
    @Excel(name = "未加密的任务ID")
    private Long taskId;
    /**
     * æœªåŠ å¯†çš„å­ä»»åŠ¡ID
     */
    @ApiModelProperty("未加密的子任务ID")
    @Excel(name = "未加密的子任务ID")
    private Long subId;
}
smartor/src/main/java/com/smartor/domain/VO/ServiceSubtaskVO.java
@@ -94,8 +94,8 @@
    /**
     * æœåŠ¡ç±»åž‹(1、监测评估;2、出院随访;3、门诊随访;4、宣教关怀;5、复诊通知;6、满意度调查;7、患者报告; 8、其他通知)
     */
    @Excel(name = "服务类型(1、监测评估;2、出院随访;3、门诊随访;4、宣教关怀;5、复诊管理;6、满意度调查;7、患者报告; 8、其他通知 9体检随访 10.医技随访  11,影像专科随访  12、心电专科随访, 13专科随访)")
    @ApiModelProperty(value = "服务类型(1、监测评估;2、出院随访;3、门诊随访;4、宣教关怀;5、复诊管理;6、满意度调查;7、患者报告; 8、其他通知 9体检随访 10.医技随访  11,影像专科随访  12、心电专科随访, 13专科随访)")
    @Excel(name = "服务类型(服务类型(1、监测评估;2、出院随访;3、门诊随访;4、宣教关怀(出院)  5、复诊管理;6、住院满意度调查;7、患者报告; 8、其他通知 9体检随访 10.医技随访  11,影像专科随访  12、心电专科随访, 13专科随访   14、门诊满意度调查  15投诉建议 16课题随访  17、宣教关怀(入院)  18、入院随访)")
    @ApiModelProperty(value = "服务类型(服务类型(1、监测评估;2、出院随访;3、门诊随访;4、宣教关怀(出院)  5、复诊管理;6、住院满意度调查;7、患者报告; 8、其他通知 9体检随访 10.医技随访  11,影像专科随访  12、心电专科随访, 13专科随访   14、门诊满意度调查  15投诉建议 16课题随访  17、宣教关怀(入院)  18、入院随访  19手术随访  20 æ‚£è€…异常报告表)")
    private String serviceType;
    /**
smartor/src/main/java/com/smartor/mapper/ServiceSubtaskMapper.java
@@ -259,9 +259,21 @@
    /**
     * ç»Ÿè®¡é—®é¢˜çš„选项的百分比
     *
     * @param taskIds
     * @param taskIds           ä»»åŠ¡ ID åˆ—表 (用于服务类型 2)
     * @param startOutHospTime
     * @param endOutHospTime
     * @return
     */
    List<ServiceSubtaskDetailRatioExport> statQuestionOption(@Param("taskIds") List<Long> taskIds, @Param("startOutHospTime") Date startOutHospTime, @Param("endOutHospTime") Date endOutHospTime);
    /**
     * æ ¹æ®å­ä»»åŠ¡ ID ç»Ÿè®¡é—®é¢˜çš„选项的百分比(用于满意度统计 serviceType=6)
     *
     * @param subtaskIds        å­ä»»åŠ¡ ID åˆ—表 (只能单个 taskid ä¸‹çš„æ‰€æœ‰å­ä»»åŠ¡ id)
     * @param startOutHospTime
     * @param endOutHospTime
     * @return
     */
    List<ServiceSubtaskDetailRatioExport> statQuestionOptionBySubtaskIds(@Param("subtaskIds") List<Long> subtaskIds, @Param("startOutHospTime") Date startOutHospTime, @Param("endOutHospTime") Date endOutHospTime);
}
smartor/src/main/java/com/smartor/service/IServicePhoneService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
package com.smartor.service;
import com.smartor.domain.*;
import com.smartor.domain.VO.HeLibraryCountVO;
import com.smartor.domain.VO.ServiceSubtaskCotinueCountVO;
import com.smartor.domain.VO.TransferDeptVO;
import com.smartor.domain.entity.ServiceSubtaskEntity;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * ä¸‰æ±‡ç”µè¯æœåŠ¡
 *
 * @author ruoyi
 * @date 2026-08-27
 */
public interface IServicePhoneService {
    OutboundInstanceResVO addOutboundInstance(OutboundConfigAddReqVO request);
}
smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java
@@ -129,6 +129,10 @@
     */
    public PhoneCallBackYQVO phoneCallBackYQ(PhoneCallReqYQVO phoneCallReqYQVO);
    public PhoneCallBackSHVO getFirstQues(PhoneCallReqYQVO phoneCallReqYQVO);
    public PhoneCallBackSHVO processResust(PhoneCallResultYQVO phoneCallReqYQVO);
    /**
     * é›¨ç»®ä»»åŠ¡æ‹‰å–
     *
@@ -202,13 +206,21 @@
    Map<String, Object> smsSubTask(Long subid);
    /**
     * ç»Ÿè®¡é—®é¢˜çš„选项的百分比
     * ç»Ÿè®¡é—®é¢˜çš„选项的百分比 (用于服务类型 2)
     *
     * @param taskIds
     * @return
     */
    public List<ServiceSubtaskDetailRatioExport> statQuestionOption(List<Long> taskIds, Date startOutHospTime, Date endOutHospTime);
    /**
     * æ ¹æ®å­ä»»åŠ¡ ID ç»Ÿè®¡é—®é¢˜çš„选项的百分比(用于满意度统计 serviceType=6)
     *
     * @param subtaskIds        å­ä»»åŠ¡ ID åˆ—表
     * @return
     */
    public List<ServiceSubtaskDetailRatioExport> statQuestionOptionBySubtaskIds(List<Long> subtaskIds, Date startOutHospTime, Date endOutHospTime);
    public String scanGenerateSubtask(ServiceTask serviceTaskVo);
    public Integer matchOptionIndex(String url, String questionText, String voiceText, List<IvrTaskTemplateTargetoption> options, String uuid);
smartor/src/main/java/com/smartor/service/impl/ServicPhoneServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,200 @@
package com.smartor.service.impl;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.core.service.IConfigService;
import com.ruoyi.common.dx.MessageSend;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.mapper.SysConfigMapper;
import com.ruoyi.system.service.ISysConfigService;
import com.smartor.common.FtpService;
import com.smartor.common.MtSubmitSmUtil;
import com.smartor.common.ScheduleSubtaskBuilder;
import com.smartor.config.PhoneUtils;
import com.smartor.domain.DTO.ServiceSubtaskDetailDTO;
import com.smartor.domain.*;
import com.smartor.domain.VO.HeLibraryCountVO;
import com.smartor.domain.VO.ServiceSubtaskCotinueCountVO;
import com.smartor.domain.VO.TransferDeptVO;
import com.smartor.domain.entity.ServiceSubtaskEntity;
import com.smartor.mapper.*;
import com.smartor.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.ListOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
 * å•一任务(随访)Service业务层处理
 *
 * @author ruoyi
 * @date 2024-02-02
 */
@Slf4j
@Service
public class ServicPhoneServiceImpl implements IServicePhoneService {
    @Value("${shurl}")
    private String shurl;
    @Value("${shversion}")
    private String shversion;
    /**
     * æ–°å¢žå¤–呼实例配置
     *
     * @param request å¤–呼实例配置请求对象
     * @return å¤–呼实例配置结果
     * @throws BaseException æŽ¥å£è°ƒç”¨å¤±è´¥æˆ–数据解析异常时抛出
     */
    @Override
    public OutboundInstanceResVO addOutboundInstance(OutboundConfigAddReqVO request) {
        // 1. å‚数校验
        validateRequest(request);
        // 2. å‘送 HTTP è¯·æ±‚
        String responseJson = sendHttpPostRequest(shurl + shversion + "/config/addOutboundInstance", request);
        // 3. è§£æžå“åº”并返回结果
        return parseResponse(responseJson);
    }
    /**
     * å‚数校验
     */
    private void validateRequest(OutboundConfigAddReqVO request) {
        if (request == null) {
            throw new BaseException("请求参数不能为空");
        }
        // å¿…传参数校验
        assertNotBlank(request.getName(), "项目名称不能为空");
        assertNotBlank(request.getAgent(), "坐席号不能为空");
        assertNotBlank(request.getTenantId(), "资源组号不能为空");
        assertNotBlank(request.getCallType(), "呼叫类型不能为空");
        assertNotBlank(request.getActionID(), "actionID ä¸èƒ½ä¸ºç©º");
        // æ¡ä»¶å¿…填校验:isVgc=0 æ—¶ï¼ŒqueueId å’Œ ratio ä¸ºå¿…å¡«
        if ("0".equals(request.getIsVgc())) {
            assertNotBlank(request.getQueueId(), "isVgc=0 æ—¶ï¼Œæ‰§è¡Œåå¸­ç»„ ID ä¸èƒ½ä¸ºç©º");
            assertNotBlank(request.getRatio(), "isVgc=0 æ—¶ï¼Œå¤–呼速率不能为空");
        }
        // æ¡ä»¶å¿…填校验:isVgc=1 æ—¶ï¼ŒivrId ä¸ºå¿…å¡«
        else if ("1".equals(request.getIsVgc())) {
            assertNotBlank(request.getIvrId(), "isVgc=1 æ—¶ï¼ŒIVR æµç¨‹ ID ä¸èƒ½ä¸ºç©º");
        }
    }
    /**
     * å‘送 POST HTTP è¯·æ±‚
     *
     * @param url     API åœ°å€
     * @param request è¯·æ±‚对象
     * @return æœåŠ¡å™¨å“åº” JSON å­—符串
     */
    private String sendHttpPostRequest(String url, Object request) {
        log.info("开始调用外呼实例配置接口,URL: {}", url);
        Map<String, String> headers = buildHeaders();
        String requestBody = new Gson().toJson(request);
        String response = HttpUtils.sendPostByHeader(url, requestBody, headers);
        if (StringUtils.isEmpty(response)) {
            log.error("外呼实例配置接口调用失败,未返回有效数据,URL: {}", url);
            throw new BaseException("接口调用失败,未返回有效数据");
        }
        log.info("外呼实例配置接口调用成功,响应:{}", response);
        return response;
    }
    /**
     * æž„建 HTTP è¯·æ±‚头
     */
    private Map<String, String> buildHeaders() {
        Map<String, String> headers = new HashMap<>(1);
        headers.put("Content-Type", "application/json; charset=UTF-8");
        return headers;
    }
    /**
     * è§£æž HTTP å“åº”并转换为 OutboundInstanceResVO
     *
     * @param responseJson å“åº” JSON å­—符串
     * @return å¤–呼实例配置响应对象
     * @throws BaseException å½“响应码不为 200 æˆ–响应数据解析失败时抛出
     */
    private OutboundInstanceResVO parseResponse(String responseJson) {
        try {
            JSONObject response = JSON.parseObject(responseJson);
            // æ£€æŸ¥å“åº”码
            Integer code = response.getInteger("code");
            if (!"200".equals(code.toString())) {
                String message = response.getString("message");
                log.error("外呼实例配置接口返回失败,code: {}, message: {}", code, message);
                throw new BaseException("新增外呼实例配置失败:" + message);
            }
            // è§£æž data å­—段
            JSONObject data = response.getJSONObject("data");
            if (data == null || data.isEmpty()) {
                throw new BaseException("接口返回数据为空");
            }
            return data.toJavaObject(OutboundInstanceResVO.class);
        } catch (BaseException e) {
            throw e;
        } catch (Exception e) {
            log.error("解析外呼实例配置响应异常,response: {}", responseJson, e);
            throw new BaseException("解析响应数据异常:" + e.getMessage());
        }
    }
    /**
     * æ–­è¨€å­—符串非空工具方法
     *
     * @param value   å¾…检查的值
     * @param message æ–­è¨€å¤±è´¥æ—¶çš„错误消息
     * @throws BaseException å½“值为空时抛出
     */
    private void assertNotBlank(String value, String message) {
        if (StringUtils.isBlank(value)) {
            throw new BaseException(message);
        }
    }
}
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskAnswerServiceImpl.java
@@ -21,6 +21,7 @@
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
@@ -163,8 +164,19 @@
        return serviceSubtaskAnswerMapper.deleteServiceSubtaskAnswerById(id);
    }
    /**
     * ä¿å­˜é—®å·ç­”案 (异步处理,快速返回)
     *
     * @param serviceSubTaskAnswerReq ç­”案请求
     * @param flag æ ‡å¿—位
     * @return ç»“æžœ
     */
    @Override
    @Async("threadPoolTaskExecutor")
    public Integer saveQuestionAnswer(ServiceSubTaskAnswerReq serviceSubTaskAnswerReq, Long flag) {
        String threadName = Thread.currentThread().getName();
        log.info("[{}] å¼€å§‹å¼‚步处理保存问卷答案", threadName);
        try {
        //参数解密
        Long tid = null;
        Long pid = null;
@@ -401,9 +413,13 @@
            }
        }
        log.info("[{}] å®Œæˆå¼‚步处理保存问卷答案", Thread.currentThread().getName());
        return 1;
    } catch (Exception e) {
        log.error("[{}] å¼‚步处理保存问卷答案发生异常 : {},请求的对象为:{}", Thread.currentThread().getName(), e.getMessage(), e,serviceSubTaskAnswerReq);
        throw new RuntimeException("保存问卷答案失败", e);
    }
}
    @Override
    public Integer saveQuestionDetail(ServiceSubTaskCacheReq serviceSubTaskCacheReq, Long flag) {
        Long tid = Long.valueOf(serviceSubTaskCacheReq.getParam1());
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -8,10 +8,10 @@
import com.google.gson.Gson;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.core.service.IConfigService;
import com.ruoyi.common.dx.MessageSend;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.core.service.IConfigService;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.SysConfig;
@@ -33,6 +33,7 @@
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -41,10 +42,8 @@
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;
@@ -204,6 +203,8 @@
    @Value("${spring.profiles.active}")
    private String active;
    @Autowired
    private ServiceOutPathMapper serviceOutPathMapper;
    /**
     * æŸ¥è¯¢å•一任务(随访)
@@ -628,9 +629,42 @@
     */
    @Override
    public Map<String, Object> insertServiceSubtask(ServiceSubtask serviceSubtask) {
        serviceSubtask.setCreateTime(DateUtils.getNowDate());
        serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
        //先查询一下该患者是否已经创建根据serviceType,sendstate,inhospid,patid,orgid
        ServiceSubtaskEntity serviceSubtaskVO = new ServiceSubtaskEntity();
        serviceSubtaskVO.setServiceType(serviceSubtask.getServiceType());
        serviceSubtaskVO.setSendstates(new ArrayList<>(Arrays.asList(1L, 2L, 3L, 5L, 7L)));
        serviceSubtaskVO.setPatid(serviceSubtask.getPatid());
        serviceSubtaskVO.setOrgid(serviceSubtask.getOrgid());
        serviceSubtaskVO.setCampusid(serviceSubtask.getCampusid());
        List<ServiceSubtask> serviceSubtasks = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO);
        RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
        String format = null;
        if (CollectionUtils.isNotEmpty(serviceSubtasks)) {
            ServiceSubtask serviceSubtask1 = serviceSubtasks.get(0);
            ServiceOutPath serviceOutPath = new ServiceOutPath();
            serviceOutPath.setSubId(serviceSubtask1.getId());
            List<ServiceOutPath> serviceOutPaths = serviceOutPathMapper.selectServiceOutPathList(serviceOutPath);
            if (CollectionUtils.isNotEmpty(serviceOutPaths))
                format = String.format("%03X", serviceOutPaths.get(0).getId());
            else format = getOutPath(serviceSubtask1, rsaPublicKeyExample);
            serviceSubtask = serviceSubtask1;
        } else {
            //如果不存在,则新增
            serviceSubtask.setCreateTime(DateUtils.getNowDate());
            serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);
            format = getOutPath(serviceSubtask, rsaPublicKeyExample);
        }
        Map<String, Object> result = new HashMap<>();
        if (StringUtils.isNotEmpty(format))
            result.put("url", StringUtils.isNotEmpty(req_path) ? localIP + ":" + req_path + "/wt?p=" + format : localIP + "/wt?p=" + format);
        else result.put("url", null);
        result.put("subId", serviceSubtask.getId());
        return result;
    }
    private String getOutPath(ServiceSubtask serviceSubtask, RSAPublicKeyExample rsaPublicKeyExample) {
        String format;
        String taskId = rsaPublicKeyExample.encryptedData(serviceSubtask.getTaskid().toString(), pub_key);
        String patid = rsaPublicKeyExample.encryptedData(serviceSubtask.getPatid().toString(), pub_key);
        String subId = rsaPublicKeyExample.encryptedData(serviceSubtask.getId().toString(), pub_key);
@@ -640,17 +674,15 @@
        serviceOutPath.setCreateTime(new Date());
        serviceOutPath.setParam6(subId);
        serviceOutPath.setOrgid(serviceSubtask.getOrgid());
        serviceOutPath.setTaskId(serviceSubtask.getTaskid());
        serviceOutPath.setSubId(serviceSubtask.getId());
        iServiceOutPathService.insertServiceOutPath(serviceOutPath);
        //转成16进制
        String format = String.format("%03X", serviceOutPath.getId());
        format = String.format("%03X", serviceOutPath.getId());
        serviceOutPath.setRadix(format);
        serviceOutPath.setUpdateTime(new Date());
        iServiceOutPathService.updateServiceOutPath(serviceOutPath);
        Map<String, Object> result = new HashMap<>();
        result.put("url", StringUtils.isNotEmpty(req_path) ? localIP + ":" + req_path + "/wt?p=" + format : localIP + "/wt?p=" + format);
        result.put("subId", serviceSubtask.getId());
        return result;
        return format;
    }
    /**
@@ -1071,8 +1103,7 @@
                }
            }
        }
        else if (serviceTaskVO.getIsoperation() != null && serviceTaskVO.getIsoperation() == 2) {
        } else if (serviceTaskVO.getIsoperation() != null && serviceTaskVO.getIsoperation() == 2) {
            //任务修改
            if (ObjectUtils.isNotEmpty(serviceTaskVO.getSendTimeslot()))
                serviceTask.setSendTimeSlot(JSON.toJSONString(serviceTaskVO.getSendTimeslot()));
@@ -4941,6 +4972,16 @@
        return serviceSubtaskMapper.statQuestionOption(taskIds, startOutHospTime, endOutHospTime);
    }
    @Override
    public List<ServiceSubtaskDetailRatioExport> statQuestionOptionBySubtaskIds(List<Long> subtaskIds, Date startOutHospTime, Date endOutHospTime) {
        //先清理一下重复数据
        List<Long> repeatIds = serviceSubtaskDetailMapper.selectRepeatDetailIds();
        if (!CollectionUtils.isEmpty(repeatIds)) {
            serviceSubtaskDetailMapper.deleteRepeatDetailByIds(repeatIds);
        }
        return serviceSubtaskMapper.statQuestionOptionBySubtaskIds(subtaskIds, startOutHospTime, endOutHospTime);
    }
    /**
     * æ ‡å‡†åŒ–问卷答案文本:去掉 A/B/C/D å•字母前缀和后续空格
     * ä¾‹å¦‚ "A æ˜¯" -> "是","B å¦" -> "否"
@@ -5225,7 +5266,7 @@
        String jsonString = jsonObject.toJSONString();
        String result = null;
//        String url = "http://localhost:8099/matchOptionIndex";
//        String url = "cc";
        if (StringUtils.isNotEmpty(url)) {
            try {
                Map<String, String> headers = new HashMap<>();
@@ -5242,6 +5283,163 @@
            return -1;
        }
    }
    public PhoneCallBackSHVO getFirstQues(PhoneCallReqYQVO phoneCallReqYQVO) {
        //用于返回
        PhoneCallBackSHVO phoneCallBackSHVO = new PhoneCallBackSHVO();
        //根据手机号获取用户的的子任务信息
        ServiceSubtaskEntity serviceSubtaskVO = new ServiceSubtaskEntity();
        serviceSubtaskVO.setPhone(phoneCallReqYQVO.getPhone());
        serviceSubtaskVO.setType("1");
        serviceSubtaskVO.setSendstate(2L);
        List<ServiceSubtask> serviceSubtasks = serviceSubtaskMapper.selectServiceSubtaskList(serviceSubtaskVO);
        if (CollectionUtils.isNotEmpty(serviceSubtasks)) {
            ServiceSubtask serviceSubtask = serviceSubtasks.get(0);
            IvrTaskTemplate ivrTaskTemplate = ivrTaskTemplateService.selectIvrTaskTemplateByID(serviceSubtask.getTemplateid());
            //通过任务模板中的"第一次问题编号"获取第一个问题;
            IvrTaskTemplateScript ivrTaskTemplateScript = null;
            IvrTaskTemplateScript ivrTaskTemplateScript1 = new IvrTaskTemplateScript();
            ivrTaskTemplateScript1.setTemplateID(ivrTaskTemplate.getId());
            List<IvrTaskTemplateScript> ivrTaskTemplateScripts = iIvrTaskTemplateScriptService.selectIvrTaskTemplateScriptList(ivrTaskTemplateScript1);
            for (IvrTaskTemplateScript ivrTaskTemplateScript2 : ivrTaskTemplateScripts) {
                if (ivrTaskTemplate.getFirstQuestionNum() == Long.valueOf(ivrTaskTemplateScript2.getSort())) {
                    ivrTaskTemplateScript = ivrTaskTemplateScript2;
                    break;
                }
            }
            //获取开场白
            ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
            phoneCallBackSHVO.setSubId(serviceSubtask.getId());
            phoneCallBackSHVO.setScriptId(ivrTaskTemplateScript.getId());
            phoneCallBackSHVO.setSort(ivrTaskTemplateScript.getSort());
            phoneCallBackSHVO.setTaskTemplateid(ivrTaskTemplateScript.getTemplateID());
            phoneCallBackSHVO.setScriptContent(serviceTask.getKcb() + "," + ivrTaskTemplateScript.getScriptContent());
        }
        return phoneCallBackSHVO;
    }
    /**
     * ä¸‰æ±‡ASR结果处理
     *
     * @param phoneCallResultYQVO
     * @return
     */
    public PhoneCallBackSHVO processResust(PhoneCallResultYQVO phoneCallResultYQVO) {
        PhoneCallBackSHVO phoneCallBackSHVO = new PhoneCallBackSHVO();
        //通过scriptid,获取所有的结果
        String url = configService.selectConfigByKey("sys.voice.match.ai.url", phoneCallResultYQVO.getOrgid());
        ServiceSubtask serviceSubtask = serviceSubtaskMapper.selectServiceSubtaskById(phoneCallResultYQVO.getSubId());
        IvrTaskTemplate ivrTaskTemplate = ivrTaskTemplateService.selectIvrTaskTemplateByID(serviceSubtask.getTemplateid());
        IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO = iIvrTaskTemplateScriptService.getTaskTempScriptInfoByid(Long.valueOf(phoneCallResultYQVO.getScriptId()));
        Integer i = matchOptionIndex(url, phoneCallResultYQVO.getScriptContent(), phoneCallResultYQVO.getAsrResult(), ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList(), phoneCallResultYQVO.getUuid());
        if (i >= 0) {
            String optiondesc = ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(i).getOptiondesc();
            //将患者的回答写进service_subtask_detail中
            ServiceSubTaskDetailReq serviceSubTaskDetailReq = new ServiceSubTaskDetailReq();
            List<ServiceSubtaskDetail> serviceSubtaskDetailList = new ArrayList<>();
            ivrTaskTemplateScriptVO.setQuestionResult(optiondesc);
            PhoneCallReqYQVO phoneCallReqYQVO = new PhoneCallReqYQVO();
            phoneCallReqYQVO.setTaskid("" + serviceSubtask.getId());
            phoneCallReqYQVO.setPhone(phoneCallResultYQVO.getPhone());
            phoneCallReqYQVO.setAsrtext(phoneCallResultYQVO.getAsrResult());
            ServiceSubtaskDetail serviceSubtaskDetail = getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate);
            //修改一下语音路径(改成前端可以访问的,存到数据库中)
            if (StringUtils.isNotEmpty(serviceSubtaskDetail.getQuestionvoice())) {
                String questionvoice = serviceSubtaskDetail.getQuestionvoice();
                String[] split = questionvoice.split("\\\\");
                if (split.length > 0) {
                    String lastPart = split[split.length - 1];
                    serviceSubtaskDetail.setQuestionvoice(voicePathPrefix + lastPart);
                }
            }
            serviceSubtaskDetailList.add(serviceSubtaskDetail);
            serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
            serviceSubTaskDetailReq.setGuid(phoneCallResultYQVO.getGuid());
            serviceSubTaskDetailReq.setOrgid(phoneCallResultYQVO.getOrgid());
            saveQuestionAnswerPhone(serviceSubTaskDetailReq);
            IvrTaskTemplateScript ivrTaskTemplateScript = new IvrTaskTemplateScript();
            ivrTaskTemplateScript.setTemplateID(ivrTaskTemplateScriptVO.getTemplateID());
            List<IvrTaskTemplateScript> ivrTaskTemplateScripts = iIvrTaskTemplateScriptService.selectIvrTaskTemplateScriptList(ivrTaskTemplateScript);
            //获取下一题
            for (IvrTaskTemplateScript script : ivrTaskTemplateScripts) {
                if (ivrTaskTemplateScriptVO.getNextScriptno() == null || ivrTaskTemplateScriptVO.getNextScriptno() == 0) {
                    ServiceTask serviceTask = serviceTaskService.selectServiceTaskByTaskid(serviceSubtask.getTaskid());
                    phoneCallBackSHVO.setScriptContent(serviceTask.getJsy());
                    phoneCallBackSHVO.setTaskTemplateid(script.getTemplateID());
                    phoneCallBackSHVO.setSort(script.getSort());
                    phoneCallBackSHVO.setScriptId(script.getId());
                    phoneCallBackSHVO.setSubId(serviceSubtask.getId());
                    phoneCallBackSHVO.setStatus("0");
                } else if (script.getSort() == ivrTaskTemplateScriptVO.getNextScriptno().intValue()) {
                    phoneCallBackSHVO.setScriptContent(script.getScriptContent());
                    phoneCallBackSHVO.setTaskTemplateid(script.getTemplateID());
                    phoneCallBackSHVO.setSort(script.getSort());
                    phoneCallBackSHVO.setScriptId(script.getId());
                    phoneCallBackSHVO.setSubId(serviceSubtask.getId());
                    break;
                }
            }
            //把缓存清除
            redisCache.deleteObject(phoneCallResultYQVO.getSubId() + "-" + phoneCallResultYQVO.getScriptId());
        } else {
            //再将重复询问
            //记录一下这个问题被问题的次数
            Object cacheObject = redisCache.getCacheObject(phoneCallResultYQVO.getSubId() + "-" + phoneCallResultYQVO.getScriptId());
            if (cacheObject == null || (Integer) cacheObject < ivrTaskTemplate.getMateNum()) {
                // èŽ·å–é€‰é¡¹é›†åˆä¸­çš„ optiondesc ç”¨äºŽå¼•导患者
                List<IvrTaskTemplateTargetoption> optionList = ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList();
                String optionDescStr = "";
                if (optionList != null && !optionList.isEmpty()) {
                    optionDescStr = optionList.stream().map(IvrTaskTemplateTargetoption::getTargetvalue).filter(StringUtils::isNotEmpty).collect(Collectors.joining("或"));
                }
                String scriptContent = "请问" + phoneCallResultYQVO.getScriptContent();
                if (StringUtils.isNotEmpty(optionDescStr)) {
                    scriptContent += ",你可以回答:" + optionDescStr;
                }
                phoneCallBackSHVO.setScriptContent(scriptContent);
                phoneCallBackSHVO.setTaskTemplateid(phoneCallResultYQVO.getTaskTemplateid());
                phoneCallBackSHVO.setSort(phoneCallResultYQVO.getSort());
                phoneCallBackSHVO.setScriptId(phoneCallResultYQVO.getScriptId());
                phoneCallBackSHVO.setSubId(phoneCallResultYQVO.getSubId());
                if (cacheObject == null)
                    redisCache.setCacheObject(phoneCallResultYQVO.getSubId() + "-" + phoneCallResultYQVO.getScriptId(), 1, 120, TimeUnit.MINUTES);
                else
                    redisCache.setCacheObject(phoneCallResultYQVO.getSubId() + "-" + phoneCallResultYQVO.getScriptId(), (Integer) cacheObject + 1, 120, TimeUnit.MINUTES);
            } else if ((Integer) cacheObject >= ivrTaskTemplate.getMateNum()) {
                //如果已经问了规定次数,就不问了,继续问下一题(这个要商量一下,是继续问下一题,还是停了,是不是要做个开关)
                IvrTaskTemplateScript ivrTaskTemplateScript = new IvrTaskTemplateScript();
                ivrTaskTemplateScript.setTemplateID(ivrTaskTemplateScriptVO.getTemplateID());
                List<IvrTaskTemplateScript> ivrTaskTemplateScripts = iIvrTaskTemplateScriptService.selectIvrTaskTemplateScriptList(ivrTaskTemplateScript);
                //获取下一题
                for (IvrTaskTemplateScript script : ivrTaskTemplateScripts) {
                    if (script.getSort() == ivrTaskTemplateScriptVO.getNextScriptno().intValue()) {
                        phoneCallBackSHVO.setScriptContent(script.getScriptContent());
                        phoneCallBackSHVO.setTaskTemplateid(script.getTemplateID());
                        phoneCallBackSHVO.setSort(script.getSort());
                        phoneCallBackSHVO.setScriptId(script.getId());
                        phoneCallBackSHVO.setSubId(serviceSubtask.getId());
                        break;
                    }
                }
                //把缓存清除
                redisCache.deleteObject(phoneCallResultYQVO.getSubId() + "-" + phoneCallResultYQVO.getScriptId());
            }
        }
        return phoneCallBackSHVO;
    }
    public PhoneCallBackYQVO AiMatch(String url, PhoneCallReqYQVO phoneCallReqYQVO, PhoneCallBackYQVO phoneCallBackYQVO, IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO, ServiceSubtask serviceSubtask, IvrTaskTemplate ivrTaskTemplate, List<IvrTaskTemplateScript> ivrTaskTemplateScripts, String scriptId, Integer flag, String uuid) {
        PhoneCallBackYQVO back = null;
@@ -5470,14 +5668,13 @@
    }
    //获取任务组信息
    private void findServiceTaskScheduleVO(ServiceTaskVO serviceTaskVO){
        if(StringUtils.isNotEmpty(serviceTaskVO.getAppltype()) && serviceTaskVO.getAppltype().equals("5")){
    private void findServiceTaskScheduleVO(ServiceTaskVO serviceTaskVO) {
        if (StringUtils.isNotEmpty(serviceTaskVO.getAppltype()) && serviceTaskVO.getAppltype().equals("5")) {
            //任务组信息
            ServiceTaskSchedule schedule = serviceTaskScheduleService.selectByTaskid(serviceTaskVO.getTaskid());
            if (ObjectUtils.isNotEmpty(schedule)) {
                ServiceTaskScheduleVO serviceTaskScheduleVO = DtoConversionUtils.sourceToTarget(schedule, ServiceTaskScheduleVO.class);
                List<ServiceTaskScheduleDetail> scheduleDetailList =
                        serviceTaskScheduleService.selectDetailByScheduleid(schedule.getId());
                List<ServiceTaskScheduleDetail> scheduleDetailList = serviceTaskScheduleService.selectDetailByScheduleid(schedule.getId());
                serviceTaskScheduleVO.setDetailList(scheduleDetailList);
                serviceTaskVO.setServiceTaskScheduleVO(serviceTaskScheduleVO);
            }
smartor/src/main/resources/mapper/smartor/ServiceOutPathMapper.xml
@@ -22,6 +22,9 @@
        <result property="wardName" column="ward_name"/>
        <result property="deptCode" column="dept_code"/>
        <result property="deptName" column="dept_name"/>
        <result property="taskId" column="task_id"/>
        <result property="subId" column="sub_id"/>
    </resultMap>
    <sql id="selectServiceOutPathVo">
@@ -31,6 +34,8 @@
               param3,
               param5,
               param6,
               task_id,
               sub_id,
               create_time,
               update_time,
               radix,
@@ -87,6 +92,12 @@
        <if test="deptName != null  and deptName != ''">
            and dept_name=#{deptName}
        </if>
        <if test="subId != null">
            and sub_id=#{subId}
        </if>
        <if test="taskId != null">
            and task_id=#{taskId}
        </if>
    </select>
    <select id="selectServiceOutPathById" parameterType="Long"
@@ -125,7 +136,12 @@
            </if>
            <if test="deptName != null">dept_name,
            </if>
            <if test="subId != null">
                sub_id,
            </if>
            <if test="taskId != null ">
                task_id,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="param1 != null">#{param1},
@@ -153,6 +169,12 @@
            <if test="deptCode != null">#{deptCode},
            </if>
            <if test="deptName != null">#{deptName},
            </if>
            <if test="subId != null ">
                #{subId},
            </if>
            <if test="taskId != null ">
                #{taskId},
            </if>
        </trim>
    </insert>
@@ -202,6 +224,12 @@
            <if test="deptName != null">dept_name =
                #{deptName},
            </if>
            <if test="subId != null">
                sub_id=#{subId},
            </if>
            <if test="taskId != null">
                task_id=#{taskId},
            </if>
        </trim>
        where id = #{id}
    </update>
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -396,7 +396,7 @@
        </if>
        <if test="deptOrDistrict==2">
            AND (1=1
            <if test="leavehospitaldistrictcodes != null and leavehospitaldistrictcodes.size() > 0">
            <if test="leavehospitaldistrictcodes != null">
                AND leavehospitaldistrictcode IN
                <foreach collection="leavehospitaldistrictcodes" item="leavehospitaldistrictcode" open="("
                         separator=","
@@ -404,7 +404,7 @@
                    #{leavehospitaldistrictcode}
                </foreach>
            </if>
            <if test=" leaveldeptcodes != null and leaveldeptcodes.size()>0">
            <if test=" leaveldeptcodes != null">
                OR deptcode IN
                <foreach collection="leaveldeptcodes" item="leaveldeptcode" open="(" separator=","
                         close=")">
@@ -3089,6 +3089,56 @@
        t.taskid
    </select>
    <!-- æ–°æ–¹æ³•:根据子任务 ID ç»Ÿè®¡é—®é¢˜é€‰é¡¹ç™¾åˆ†æ¯” (用于满意度统计 serviceType=6) -->
    <select id="statQuestionOptionBySubtaskIds" resultType="com.smartor.domain.ServiceSubtaskDetailRatioExport">
        SELECT
        d.questiontext AS questiontext,
        t.taskid AS taskid,
        t.task_name AS taskName,
        d.asrtext AS optionresult,
        COUNT(*) AS count,
        CONCAT(ROUND(COUNT(*) * 100.0 / t2.total_count, 2), '%') AS ratio
        FROM
        service_task t
        INNER JOIN service_subtask s ON s.taskid = t.taskid
        INNER JOIN service_subtask_detail d ON d.sub_id = s.id
        INNER JOIN (
        SELECT
            d.questiontext,
            COUNT(*) AS total_count
        FROM
            service_task t
            INNER JOIN service_subtask s ON s.taskid = t.taskid
            INNER JOIN service_subtask_detail d ON d.sub_id = s.id
            WHERE s.id IN
            <foreach collection="subtaskIds" item="subtaskId" open="(" separator="," close=")">
                #{subtaskId}
            </foreach>
            AND s.sendstate = 6
            AND d.del_flag=0
            GROUP BY d.questiontext  -- â† å…³é”®ä¿®æ”¹ï¼šæŒ‰é¢˜ç›®åˆ†ç»„统计每个题目的总数
        ) t2 ON t2.questiontext = d.questiontext  -- â† å…³è”到当前题目
        WHERE s.id IN
        <foreach collection="subtaskIds" item="subtaskId" open="(" separator="," close=")">
            #{subtaskId}
        </foreach>
        AND s.sendstate = 6
        AND d.del_flag=0
      <if test="startOutHospTime != null">
        AND date_format(s.endtime,'%y%m%d') &gt;= date_format(#{startOutHospTime},'%y%m%d')
    </if>
        <if test="endOutHospTime != null">
            AND date_format(s.endtime,'%y%m%d') &lt;= date_format(#{endOutHospTime},'%y%m%d')
        </if>
        GROUP BY
        t.taskid,
        d.questiontext,
        d.asrtext
        ORDER BY
        d.questiontext,
        t.taskid
    </select>
    <select id="selectServiceSubtaskListDeadLine" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity"
            resultMap="ServiceSubtaskResult">
        <include refid="selectServiceSubtaskVo"/>