liusheng
2024-10-17 723d38375c45d24737bfef6f33a9686254abf99b
代码提交
已修改12个文件
301 ■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveImportController.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application-druid.yml 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatArchiveImport.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PhoneCallReqYQVO.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PullTaskVO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/PatArchiveImportServiceImpl.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java 128 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/PatArchiveImportMapper.xml 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java
@@ -6,6 +6,7 @@
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration;
import org.springframework.scheduling.annotation.EnableAsync;
/**
 * 启动程序
@@ -14,6 +15,7 @@
 */
//@SpringBootApplication(scanBasePackages="com.smartor",exclude = { DataSourceAutoConfiguration.class })
@SpringBootApplication(scanBasePackages = {"com.ruoyi", "com.smartor"}, exclude = {DataSourceAutoConfiguration.class, MultipartAutoConfiguration.class})
@EnableAsync
@MapperScan(value = "com.smartor.mapper")
public class RuoYiApplication {
    public static void main(String[] args) {
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveImportController.java
@@ -1,37 +1,23 @@
package com.ruoyi.web.controller.smartor;
import java.util.List;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.smartor.domain.SvyLibScriptRes;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
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.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.smartor.domain.PatArchiveImport;
import com.smartor.service.IPatArchiveImportService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
 * Excel导入患者档案Controller
@@ -106,7 +92,7 @@
     * @param response
     */
    @ApiOperation("获取导入患者模板")
    @GetMapping("/getImportPatTemplate")
    @PostMapping("/getImportPatTemplate")
    public void getImportPatTemplate(HttpServletResponse response) {
        ExcelUtil<PatArchiveImport> util = new ExcelUtil<PatArchiveImport>(PatArchiveImport.class);
        util.importTemplateExcel(response, "导入患者");
@@ -128,7 +114,7 @@
    @ApiOperation("导入Excel患者信息")
    //@PreAuthorize("@ss.hasPermi('smartor:import:list')")
    @PostMapping("/importPatInfo")
    public TableDataInfo importPatInfo(MultipartFile multipartFile) {
        return getDataTable(patArchiveImportService.importPatInfo(multipartFile));
    public TableDataInfo importPatInfo(MultipartFile file) {
        return getDataTable(patArchiveImportService.importPatInfo(file));
    }
}
ruoyi-admin/src/main/resources/application-druid.yml
@@ -11,28 +11,26 @@
        #        username: root
        #        password: 123456
        #        公司
#        url: jdbc:mysql://450scrp46939.vicp.fun:59876/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
#        url: jdbc:mysql://192.168.1.16:3308/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
        url: jdbc:mysql://192.168.191.181:3308/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
        ##        url: jdbc:mysql://450scrp46939.vicp.fun:59876/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
        url: jdbc:mysql://192.168.2.9:3308/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
        #        url: jdbc:mysql://192.168.191.181:3308/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
        username: smartor
        password: Smartor.2023
        driverClassName: com.mysql.cj.jdbc.Driver
      # 从库数据源
      slave:
        # 从数据源开关/默认关闭(公司)
        enabled: true
        url: jdbc:sqlserver://116.62.18.175:6001;DatabaseName=iv-ywey;encrypt=false;SelectMethod=cursor
        username: sa
        password: Hxerp2000
        driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
        # 从数据源开关/默认关闭(义乌二院)
      #        enabled: true
      #        url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=IntelligentVoice;encrypt=false;SelectMethod=cursor
        #        url: jdbc:sqlserver://116.62.18.175:6001;DatabaseName=iv-ywey;encrypt=false;SelectMethod=cursor
      #        username: sa
      #        password: sfxt#2023
        #        password: Hxerp2000
      #        driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
        # 从数据源开关/默认关闭(义乌二院)
        enabled: true
        url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=IntelligentVoice;encrypt=false;SelectMethod=cursor
        username: sa
        password: sfxt#2023
        driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
      # 初始连接数
      initialSize: 5
      # 最小连接池数量
@@ -138,16 +136,21 @@
#二维码路径
qrpath: D:\qrcode
##公司内外链请求IP和端口号
#req_path: 8096
#localIP: 192.168.1.10
#公司内外链请求IP和端口号
req_path: 8095
localIP: 192.168.2.10
#新华医院外链请求IP和端口号
req_path: 8093
localIP: 218.108.11.22
##新华医院外链请求IP和端口号
#req_path: 8093
#localIP: 218.108.11.22
#获取患者信息URL(华卓提供)
hosp_info_url: http://esb-core-rest.wowjoy.cn/esb/exchange
# 0代表走默认的上传    1 代码走新华医院的上传
uploadSwitch: 1
#  指定asr回调的url路径
ASRCallBackPath: http://192.168.2.10:8095/smartor/serviceSubtask/phoneCallBackYQ
#挂断IP
hangup: http://192.168.2.10:8091/hangup
smartor/src/main/java/com/smartor/domain/PatArchiveImport.java
@@ -35,7 +35,7 @@
     * 证件号码
     */
    @ApiModelProperty("证件号码")
    @Excel(name = "证件号码(必填)",cellType = Excel.ColumnType.NUMERIC)
    @Excel(name = "证件号码(必填)",cellType = Excel.ColumnType.STRING)
    private String idcardno;
    /**
@@ -49,7 +49,7 @@
     * 批次名称
     */
    @ApiModelProperty("批次名称")
    @Excel(name = "批次名称(必填)",cellType = Excel.ColumnType.STRING)
    @Excel(name = "批次名称",cellType = Excel.ColumnType.STRING)
    private String batchName;
smartor/src/main/java/com/smartor/domain/PhoneCallReqYQVO.java
@@ -128,4 +128,34 @@
    @ApiModelProperty(value = "当前句子的录音文件路径,句子未结束时为空")
    private String recordpath;
    /**
     * 放音的路径
     */
    @ApiModelProperty(value = "放音的路径")
    private String path;
    /**
     * 放音事件名称,PLAYBACK_START 或 PLAYBACK_STOP
     */
    @ApiModelProperty(value = "放音事件名称,PLAYBACK_START 或 PLAYBACK_STOP")
    private String evName;
    /**
     * 播放开始
     */
    @ApiModelProperty(value = "播放开始")
    private Boolean playstart;
    /**
     * 播放结束
     */
    @ApiModelProperty(value = "播放结束")
    private Boolean playstop = false;
    /**
     * 放音的原始文本内容
     */
    @ApiModelProperty(value = "放音的原始文本内容")
    private String origin;
}
smartor/src/main/java/com/smartor/domain/PullTaskVO.java
@@ -67,5 +67,5 @@
     * 指定asr的url路径(这个路径需要我们这边提供,入参可以参考文档)
     */
    @ApiModelProperty(value = " 指定asr的url路径(这个路径需要我们这边提供,入参可以参考文档)")
    private String asrcallback = "http://192.168.2.2:8095/smartor/serviceSubtask/phoneCallBackYQ";
    private String asrcallback;
}
smartor/src/main/java/com/smartor/service/IServiceSubtaskService.java
@@ -100,6 +100,7 @@
     */
    public List<PullTaskVO> taskPull();
    public Integer saveQuestionAnswerPhone(ServiceSubTaskDetailReq serviceSubTaskDetailReq);
    /**
smartor/src/main/java/com/smartor/service/impl/PatArchiveImportServiceImpl.java
@@ -6,6 +6,7 @@
import com.smartor.mapper.PatArchiveImportMapper;
import com.smartor.service.IPatArchiveImportService;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
@@ -15,6 +16,7 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@@ -103,11 +105,14 @@
    public List<PatArchiveImport> importPatInfo(MultipartFile multipartFile) {
        //用于返回
        List<PatArchiveImport> patArchiveImports = new ArrayList<>();
        //去重
        List<String> qc = new ArrayList<>();
        try {
            Workbook workbook = new XSSFWorkbook(multipartFile.getInputStream());
            Sheet sheet = workbook.getSheetAt(0);
            for (int i = sheet.getFirstRowNum() + 1; i < sheet.getLastRowNum(); i++) {
            for (int i = sheet.getFirstRowNum() + 1; i <= sheet.getLastRowNum(); i++) {
                //导入患者对象
                PatArchiveImport patArchiveImport = new PatArchiveImport();
                Row row = sheet.getRow(i);
@@ -123,10 +128,16 @@
                }
                if (ObjectUtils.isNotEmpty(row.getCell(1))) {
                    patArchiveImport.setIdcardno(row.getCell(1).toString());
                    boolean contains = qc.contains(row.getCell(1).toString());
                    if (contains) continue;
                }
                if (ObjectUtils.isNotEmpty(row.getCell(2))) {
                    patArchiveImport.setTelcode(row.getCell(2).toString());
                    Cell cell = row.getCell(2);
                    double numericCellValue = cell.getNumericCellValue();
                    DecimalFormat decimalFormat = new DecimalFormat("#");
                    String formattedValue = decimalFormat.format(numericCellValue);
                    patArchiveImport.setTelcode(formattedValue);
                }
                if (ObjectUtils.isNotEmpty(row.getCell(3))) {
                    patArchiveImport.setBatchName(row.getCell(3).toString());
@@ -145,13 +156,13 @@
                    patArchiveImport.setAge(Long.valueOf(row.getCell(7).toString()));
                }
                patArchiveImports.add(patArchiveImport);
                patArchiveImport.setCreateTime(new Date());
                patArchiveImport.setUpdateTime(new Date());
                //批量号(当前时间)
                patArchiveImport.setBatchNo(new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()));
                insertPatArchiveImport(patArchiveImport);
                patArchiveImports.add(patArchiveImport);
            }
        } catch (Exception e) {
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -7,10 +7,8 @@
import com.google.gson.Gson;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.common.utils.RSAPublicKeyExample;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.*;
import com.ruoyi.common.utils.http.HttpUtils;
import com.smartor.config.PhoneUtils;
import com.smartor.domain.*;
import com.smartor.mapper.*;
@@ -24,6 +22,7 @@
import org.apache.commons.lang3.StringUtils;
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 org.springframework.transaction.annotation.Transactional;
@@ -76,6 +75,12 @@
    @Value("${pri_key}")
    private String pri_key;
    @Value("${ASRCallBackPath}")
    private String ASRCallBackPath;
    @Value("${hangup}")
    private String hangup;
    /**
@@ -200,8 +205,8 @@
    public List<ServiceSubtask> patItem(ServiceSubtaskVO serviceSubtaskVO) {
        List<ServiceSubtask> selectServiceSubtaskList = this.selectServiceSubtaskList(serviceSubtaskVO);
        //根据出院 时间倒序
        List<ServiceSubtask> sortedServiceSubtaskList = selectServiceSubtaskList.stream().sorted(Comparator.comparing(ServiceSubtask::getEndtime).reversed()).collect(Collectors.toList());
        return sortedServiceSubtaskList;
//        List<ServiceSubtask> sortedServiceSubtaskList = selectServiceSubtaskList.stream().sorted(Comparator.comparing(ServiceSubtask::getEndtime).reversed()).collect(Collectors.toList());
        return selectServiceSubtaskList;
    }
    @Override
@@ -642,12 +647,43 @@
    public PhoneCallBackYQVO phoneCallBackYQ(PhoneCallReqYQVO phoneCallReqYQVO) {
        //定义一个分数的变量
        Boolean aBoolean1 = redisCache.hasKey(phoneCallReqYQVO.getUuid() + "SCORE");
        if (!aBoolean1) redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", 0);
        if (!aBoolean1) redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", 0.0, 120, TimeUnit.MINUTES);
        PhoneCallBackYQVO phoneCallBackYQVO = new PhoneCallBackYQVO();
        //channel_create 通道创建的时候,可以执行一些其它操作,譬如发个短信之类的;  我们的业务可以不用管    PlayEventCallback 这个是播放语音的,暂时用不到     End_time()= -1或null表示当前的asrtext不是一句完整的话
        if (phoneCallReqYQVO.getOperate().equals("channel_create") || phoneCallReqYQVO.getOperate().equals("PlayEventCallback") || phoneCallReqYQVO.getEnd_time() == null || phoneCallReqYQVO.getEnd_time() == -1) {
        if (phoneCallReqYQVO.getOperate().equals("channel_create")) {
            return phoneCallBackYQVO;
        }
        //PlayEventCallback 这个是播放语音的    playstart:放音开始(问题播报开始)    playstop: 放音结束(问题播报结束)
        if (phoneCallReqYQVO.getOperate().equals("PlayEventCallback")) {
            String cacheJSY = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "- jsy");
            if (phoneCallReqYQVO.getOperate().equals("PlayEventCallback") && phoneCallReqYQVO.getPlaystop() == false) {
                //判断redis中是否有结束语
                if (StringUtils.isEmpty(cacheJSY)) {
                    redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop", false, 120, TimeUnit.MINUTES);
                    log.error("PlayEventCallbackPlaystop的值为-------:{}", false);
                }
            } else {
                //如果结束语不为空,则要挂电话了
                if (StringUtils.isNotEmpty(cacheJSY)) {
                    Map<String, String> req = new HashMap<>();
                    req.put("uuid", phoneCallReqYQVO.getUuid());
                    req.put("caller", phoneCallReqYQVO.getPhone());
                    HttpUtils.sendPost(hangup, new Gson().toJson(req));
                    //删除结束语的患存
                    redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "- jsy");
                } else {
                    redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop", true, 120, TimeUnit.MINUTES);
                    log.error("-------PlayEventCallbackPlaystop的值为:{}", true);
                }
            }
            return phoneCallBackYQVO;
        }
        //获取放音是否结束
        boolean isPlayEventOver = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
        if (!isPlayEventOver) {
            return phoneCallBackYQVO;
        }
        //通过子任务ID获取到模板信息
        ServiceSubtask serviceSubtask = serviceSubtaskMapper.selectServiceSubtaskById(Long.valueOf(phoneCallReqYQVO.getTaskid()));
        IvrTaskTemplate ivrTaskTemplate = ivrTaskTemplateService.selectIvrTaskTemplateByID(serviceSubtask.getTemplateid());
@@ -678,14 +714,16 @@
                phoneCallBackYQVO.setType("text");
                phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
                String scriptContent = ivrTaskTemplateScriptVO.getScriptContent();
                log.error("SilentCallback的问题内容scriptContent:{}", scriptContent);
                phoneCallBackYQVO.setValue(getObject(serviceSubtask, scriptContent));
                //将静默次数加1
                Integer noVoiceNum = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "noVoice");
                redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "noVoice", noVoiceNum + 1, 120, TimeUnit.MINUTES);
                return phoneCallBackYQVO;
            } else {
                log.error("静默次数达到,挂掉电话:{}", num);
                //大与等于的话,直接挂断
                phoneCallBackYQVO.setType("hangup");
                phoneCallBackYQVO.setType("text");
                phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
                phoneCallBackYQVO.setValue(ivrTaskTemplate.getRevisitAfter());
                //将结果写到detail中
@@ -705,9 +743,28 @@
                redisCache.setCacheObject(map.get("cacheName"), map.get("val"));
                redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
                redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
                redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
                //在redis中保存一下结束语,在调用挂电话的方法时删除
                redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", ivrTaskTemplate.getRevisitAfter(), 120, TimeUnit.MINUTES);
            }
            return phoneCallBackYQVO;
        } else if ("AsrCallback".equals(phoneCallReqYQVO.getOperate())) {
        } else if ("AsrCallback".equals(phoneCallReqYQVO.getOperate()) && phoneCallReqYQVO.getEnd_time() != null && phoneCallReqYQVO.getEnd_time() != -1) {
            //播报第一题
            Integer integer = redisCache.getCacheObject(phoneCallReqYQVO.getTaskid().trim() + "-" + phoneCallReqYQVO.getPhone().trim() + "-firstSort");
//            if(integer==0){
//                //integer==0,表示开场白刚播报完,需要停顿一下,等患者说话
//                redisCache.setCacheObject(phoneCallReqYQVO.getTaskid().trim() + "-" + phoneCallReqYQVO.getPhone().trim() + "-firstSort", 1, 120, TimeUnit.MINUTES);
//                return phoneCallBackYQVO;
//            }
            if (ivrTaskTemplateScriptVO.getSort() == 1 && integer == 1) {
                phoneCallBackYQVO.setType("text");
                phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
                String scriptContent = ivrTaskTemplateScriptVO.getScriptContent();
                phoneCallBackYQVO.setValue(getObject(serviceSubtask, scriptContent));
                redisCache.setCacheObject(phoneCallReqYQVO.getTaskid().trim() + "-" + phoneCallReqYQVO.getPhone().trim() + "-firstSort", 2, 120, TimeUnit.MINUTES);
                return phoneCallBackYQVO;
            }
            //如果是文本回调
            //根据问题ID获取该问题的类型
            if (ivrTaskTemplateScriptVO.getScriptType().equals("1")) {
@@ -742,9 +799,11 @@
                        serviceSubtaskDetailList.add(getServiceSubtaskDetail(phoneCallReqYQVO, ivrTaskTemplateScriptVO, serviceSubtask, ivrTaskTemplate));
                        serviceSubTaskDetailReq.setServiceSubtaskDetailList(serviceSubtaskDetailList);
                        saveQuestionAnswerPhone(serviceSubTaskDetailReq);
//
                        //将当前前的播报状态删除,给下一题让位
                        redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
//                        //获取下一题
                        if (ivrTaskTemplateScriptVO.getBranchFlag().equals("1") || ivrTaskTemplateScriptVO.getBranchFlag().equals("0") && ivrTaskTemplateScriptVO.getNextScriptno() != 0) {
                        log.error("获取下一题的信息:{}", ivrTaskTemplateScriptVO);
                        if (ivrTaskTemplateScriptVO.getBranchFlag().equals("1") || ivrTaskTemplateScriptVO.getBranchFlag().equals("0") && ivrTaskTemplateScriptVO.getNextScriptno() != null && ivrTaskTemplateScriptVO.getNextScriptno() != 0) {
                            Long nextQuestion = null;
                            if (ivrTaskTemplateScriptVO.getBranchFlag().equals("1")) {
                                nextQuestion = ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getNextQuestion();
@@ -755,7 +814,8 @@
                            } else {
                                nextQuestion = ivrTaskTemplateScriptVO.getNextScriptno();
                                //更新分数
                                double score = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
                                Object obj = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
                                Double score = (obj == null ? new Double(0.00) : new Double(((Double) obj).doubleValue()));
                                score = BigDecimal.valueOf(score).add(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getScore()).doubleValue();
                                redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "SCORE", score);
                            }
@@ -765,6 +825,7 @@
                                    phoneCallBackYQVO.setType("text");
                                    phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
                                    String scriptContent = script.getScriptContent();
                                    log.error("下一题问题:{}", scriptContent);
                                    phoneCallBackYQVO.setValue(getObject(serviceSubtask, scriptContent));
                                    //将该患者的Redis中的题目ID,进行修改
                                    redisCache.setCacheObject(phoneCallReqYQVO.getTaskid().trim() + "-" + phoneCallReqYQVO.getPhone().trim(), script.getId().toString(), 120, TimeUnit.MINUTES);
@@ -773,8 +834,8 @@
                                }
                            }
                        } else if (ivrTaskTemplateScriptVO.getBranchFlag().equals("0")) {
                            if (ivrTaskTemplateScriptVO.getNextScriptno() == 0 || ivrTaskTemplateScriptVO.getNextScriptno() == null) {
                                phoneCallBackYQVO.setType("hangup");
                            if (ivrTaskTemplateScriptVO.getNextScriptno() == null || ivrTaskTemplateScriptVO.getNextScriptno() == 0) {
                                phoneCallBackYQVO.setType("text");
                                phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
                                //更新一下分数
                                double score = redisCache.getCacheObject(phoneCallReqYQVO.getUuid() + "SCORE");
@@ -789,6 +850,9 @@
                                redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
                                redisCache.deleteObject(phoneCallReqYQVO.getTaskid().trim() + "&&" + "mate" + "&&" + phoneCallReqYQVO.getUuid());
                                redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
                                redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "PlayEventCallbackPlaystop");
                                //在redis中保存一下结束语,在调用挂电话的方法时删除
                                redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", ivrTaskTemplate.getRevisitAfter(), 120, TimeUnit.MINUTES);
//                                return phoneCallBackYQVO;
                            }
                        }
@@ -803,7 +867,7 @@
                        //如果count已经大于或等于没有匹配次数
                        if (ivrTaskTemplateScriptVO.getBranchFlag().equals("0") && ivrTaskTemplateScriptVO.getNextScriptno() == null || ivrTaskTemplateScriptVO.getBranchFlag().equals("0") && ivrTaskTemplateScriptVO.getNextScriptno() == 0 || ivrTaskTemplateScriptVO.getBranchFlag().equals("1") && ivrTaskTemplateScriptVO.getNextScriptno() == null || ivrTaskTemplateScriptVO.getBranchFlag().equals("1") && ivrTaskTemplateScriptVO.getNextScriptno() == 0) {
                            //如果是最后一道题,或者没有下一题了,就直接挂机
                            phoneCallBackYQVO.setType("hangup");
                            phoneCallBackYQVO.setType("text");
                            phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
                            if (StringUtils.isNotEmpty(phoneCallBackYQVO.getValue()))
                                phoneCallBackYQVO.setValue(phoneCallBackYQVO.getValue() + ivrTaskTemplate.getRevisitAfter());
@@ -815,6 +879,8 @@
                            serviceSubtask.setFinishtime(new Date());
                            serviceSubtaskMapper.updateServiceSubtask(serviceSubtask);
                            //在redis中保存一下结束语,在调用挂电话的方法时删除
                            redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", ivrTaskTemplate.getRevisitAfter(), 120, TimeUnit.MINUTES);
                            //去redis中,把该子任务ID删除
                            Long id = serviceSubtask.getId();
                            Map<String, String> map = delRedisValue(null, id.toString());
@@ -863,7 +929,7 @@
                //如果选项分支为1的话,则需要根据问题上的nextScriptno进行跳转
                //问答题没有跳转
                if (ivrTaskTemplateScriptVO.getNextScriptno() != null || ivrTaskTemplateScriptVO.getNextScriptno() != 0) {
                if (ivrTaskTemplateScriptVO.getNextScriptno() != null && ivrTaskTemplateScriptVO.getNextScriptno() != 0) {
                    for (IvrTaskTemplateScript ivrTaskTemplateScript1 : ivrTaskTemplateScripts) {
                        if (ivrTaskTemplateScriptVO.getNextScriptno().intValue() == ivrTaskTemplateScript1.getSort()) {
                            phoneCallBackYQVO.setType("text");
@@ -881,9 +947,9 @@
//                            return phoneCallBackYQVO;
                        }
                    }
                } else if (ivrTaskTemplateScriptVO.getNextScriptno() == null) {
                } else if (ivrTaskTemplateScriptVO.getNextScriptno() == null || ivrTaskTemplateScriptVO.getNextScriptno() == 0) {
                    //没有下一题了,就结束了
                    phoneCallBackYQVO.setType("hangup");
                    phoneCallBackYQVO.setType("text");
                    phoneCallBackYQVO.setSilent_interval(ivrTaskTemplate.getSilencetime().intValue());
                    phoneCallBackYQVO.setValue(ivrTaskTemplate.getRevisitAfter());
@@ -897,16 +963,18 @@
                    Long id = serviceSubtask.getId();
                    Map<String, String> map = delRedisValue(null, id.toString());
                    redisCache.setCacheObject(map.get("cacheName"), map.get("val"));
                    //在redis中保存一下结束语,在调用挂电话的方法时删除
                    redisCache.setCacheObject(phoneCallReqYQVO.getUuid() + "- jsy", ivrTaskTemplate.getRevisitAfter(), 120, TimeUnit.MINUTES);
                    redisCache.deleteObject(serviceSubtask.getId() + "-" + serviceSubtask.getPhone());
                    redisCache.deleteObject(phoneCallReqYQVO.getUuid() + "SCORE");
                }
                //选项匹配完成后,需要再去通过库再进行匹配一次
                String extemplateID = ivrTaskTemplate.getSubmoduleID();
                if (StringUtils.isNotEmpty(extemplateID)) {
                String[] split = extemplateID.split(",");
                List<String> list = Arrays.asList(split);
                List<Long> list1 = new ArrayList<>();
                if (StringUtils.isNotEmpty(extemplateID)) {
                    for (String str : list) {
                        list1.add(Long.valueOf(str));
                    }
@@ -934,6 +1002,7 @@
        }
        return phoneCallBackYQVO;
    }
    private String getObject(ServiceSubtask serviceSubtask, String scriptContent) {
        Map<String, Map<String, String>> param = getParam(serviceSubtask.getTaskid());
@@ -1014,9 +1083,11 @@
        if (!StringUtils.isEmpty(value0)) {
            pullTaskVOList = getPullTaskList(value0, "cache-0");
            //将cache-0的数据,转移不对劲cache-00中
            redisCache.deleteObject("cache-00");
            String cache00 = redisCache.getCacheObject("cache-00");
            if (!StringUtils.isEmpty(cache00)) redisCache.setCacheObject("cache-00", cache00 + "," + value0);
            else redisCache.setCacheObject("cache-00", value0);
            if (!StringUtils.isEmpty(cache00))
                redisCache.setCacheObject("cache-00", cache00 + "," + value0, 120, TimeUnit.MINUTES);
            else redisCache.setCacheObject("cache-00", value0, 120, TimeUnit.MINUTES);
            redisCache.deleteObject("cache-0");
        } else {
            for (int i = 1; i < 6; i++) {
@@ -1034,7 +1105,12 @@
                redisCache.deleteObject("cache-" + i);
            }
        }
        if (CollectionUtils.isNotEmpty(pullTaskVOList)) {
            //给回调参数赋值
            for (PullTaskVO pullTaskVO : pullTaskVOList) {
                pullTaskVO.setAsrcallback(ASRCallBackPath);
            }
        }
        return pullTaskVOList;
    }
@@ -1068,8 +1144,9 @@
                //如果ivrTaskTemplateScript为空,也就没有往下执行的必要了
                if (ObjectUtils.isEmpty(ivrTaskTemplateScript)) return null;
                //获取通配符匹配过后的问题
                String scrContent = getObject(serviceSubtask, ivrTaskTemplateScript.getScriptContent());
                String kcb = ivrTaskTemplate.getRevisitBefore() + "," + scrContent;
//                String scrContent = getObject(serviceSubtask, ivrTaskTemplateScript.getScriptContent());
//                String kcb = ivrTaskTemplate.getRevisitBefore() + "," + scrContent;
                String kcb = ivrTaskTemplate.getRevisitBefore();
                //封装返回数据
                //taskId = 子任务ID + 问题ID +问题序号
@@ -1081,6 +1158,7 @@
                pullTaskVO.setDisplayNo("85129866");
                pullTaskVOList.add(pullTaskVO);
                redisCache.setCacheObject(subId.trim() + "-" + serviceSubtask.getPhone().trim(), ivrTaskTemplateScript.getId().toString());
                redisCache.setCacheObject(subId.trim() + "-" + serviceSubtask.getPhone().trim() + "-firstSort", 1, 120, TimeUnit.MINUTES);
            } else {
                if (StringUtils.isEmpty(newValue0)) {
                    newValue0 = "," + split[i].trim() + ",";
smartor/src/main/java/com/smartor/service/impl/ServiceTaskServiceImpl.java
@@ -4,16 +4,19 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import org.apache.commons.lang3.StringUtils;
import com.smartor.domain.*;
import com.smartor.mapper.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import com.smartor.service.IServiceTaskService;
import org.springframework.transaction.annotation.Transactional;
smartor/src/main/resources/mapper/smartor/PatArchiveImportMapper.xml
@@ -24,7 +24,22 @@
    </resultMap>
    <sql id="selectPatArchiveImportVo">
        select id, patientno, pattype, name, sex, idcardno, age, telcode, openid, del_flag, update_by, update_time, create_by, create_time, batch_name, batch_no
        select id,
               patientno,
               pattype,
               name,
               sex,
               idcardno,
               age,
               telcode,
               openid,
               del_flag,
               update_by,
               update_time,
               create_by,
               create_time,
               batch_name,
               batch_no
        from pat_archive_import
    </sql>
@@ -71,7 +86,8 @@
            where id = #{id}
    </select>
    <insert id="insertPatArchiveImport" parameterType="com.smartor.domain.PatArchiveImport"            useGeneratedKeys="true" keyProperty="id">
    <insert id="insertPatArchiveImport" parameterType="com.smartor.domain.PatArchiveImport" useGeneratedKeys="true"
            keyProperty="id">
        insert into pat_archive_import
        <trim prefix="(" suffix=")" suffixOverrides=",">
                    <if test="patientno != null">patientno,
@@ -209,8 +225,6 @@
            #{id}
        </foreach>
    </update>
</mapper>
smartor/src/main/resources/mapper/smartor/ServiceSubtaskMapper.xml
@@ -238,7 +238,12 @@
            <if test="remark != null">and remark = #{remark}</if>
            <if test="suggest != null">and suggest = #{suggest}</if>
        </where>
        order by update_time desc,id desc
        <if test="serviceType != null  and serviceType != ''and serviceType != '2'and serviceType != '3'">order by
            long_send_time desc
        </if>
        <if test="serviceType != null  and serviceType != ''and serviceType == '2'">order by endtime desc</if>
        <if test="serviceType != null  and serviceType != ''and serviceType == '3'">order by admindate desc</if>
        -- order by update_time desc,id desc
    </select>
    <select id="selectServiceSubtaskById" parameterType="Long" resultMap="ServiceSubtaskResult">