liusheng
2024-04-16 63e17909e1eee7ff54c38827a4096cbad82e5dad
代码提交
已添加5个文件
已删除1个文件
已修改13个文件
已重命名5个文件
1850 ■■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/web/component/RabbitMqReceiver.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaTemplateController.java 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskController.java 67 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskcallController.java 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/task/PhoneTask.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrTaskSingle.java 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrTaskSingleVO.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrTaskVO.java 192 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrVisitInfoVo.java 148 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatMedOuthosp.java 318 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/Test1Vo.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/TestVo.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/mapper/IvrTaskMapper.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/mapper/IvrTaskSingleMapper.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/mapper/IvrTaskcallMapper.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/mapper/PatMedInhospMapper.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/mapper/PatMedOuthospMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IIvrTaskService.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IIvrTaskSingleService.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/IvrTaskServiceImpl.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java 129 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrTaskMapper.xml 192 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrTaskSingleMapper.xml 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml 129 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/component/RabbitMqReceiver.java
@@ -3,21 +3,23 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.web.task.PhoneTask;
import com.smartor.config.RabbitMqConfig;
import com.smartor.domain.IvrLibaTemplateVO;
import com.smartor.domain.IvrTaskcall;
import com.smartor.domain.IvrTaskSingle;
import com.smartor.domain.IvrTaskcallMQ;
import com.smartor.mapper.IvrTaskcallMapper;
import com.smartor.mapper.IvrTaskSingleMapper;
import com.smartor.service.IIvrLibaTemplateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import java.io.IOException;
import java.util.List;
@@ -30,7 +32,7 @@
    private static IIvrLibaTemplateService ivrLibaTemplateService;
    private static IvrTaskcallMapper ivrTaskcallMapper;
    private static IvrTaskSingleMapper ivrTaskcallMapper;
    private static RedisCache redisCache;
@@ -44,7 +46,7 @@
    }
    @Autowired
    public void setIvrTaskcallMapper(IvrTaskcallMapper ivrTaskcallMapper) {
    public void setIvrTaskcallMapper(IvrTaskSingleMapper ivrTaskcallMapper) {
        RabbitMqReceiver.ivrTaskcallMapper = ivrTaskcallMapper;
    }
@@ -78,31 +80,32 @@
     */
    @RabbitListener(queues = RabbitMqConfig.phone_queue, concurrency = "50")
    public void phoneVisit(String content, Message message, Channel channel) throws IOException {
//        System.out.println(content);
//        IvrTaskcallMQ ivrTaskcallMQ = null;
//        ObjectMapper mapper = new ObjectMapper();
//        try {
//            ivrTaskcallMQ = mapper.readValue(content, IvrTaskcallMQ.class);
//        } catch (JsonProcessingException e) {
//            e.printStackTrace();
//        }
//        //通过模板ID获取模板问题
//        IvrLibaTemplateVO ivrLibaTemplateVO = new IvrLibaTemplateVO();
//        ivrLibaTemplateVO.setID(Long.valueOf(ivrTaskcallMQ.getTemplateid()));
//        IvrLibaTemplateVO ivrLibaTemplateVO1 = ivrLibaTemplateService.selectInfoByCondition(ivrLibaTemplateVO);
//
//        //通过任务ID拿到患者信息
//        IvrTaskcall ivrTaskcall = new IvrTaskcall();
//        ivrTaskcall.setTaskid(ivrTaskcallMQ.getTaskid());
//        List<IvrTaskcall> ivrTaskcalls = ivrTaskcallMapper.selectIvrTaskcallList(ivrTaskcall);
//
//        for (IvrTaskcall ivrTaskcall1 : ivrTaskcalls) {
//            //通过多线程的方式去打电话
//            executorService.submit(new PhoneTask(ivrTaskcall1, ivrLibaTemplateVO1, redisCache));
//        }
        //通知 MQ æ¶ˆæ¯å·²è¢«æŽ¥æ”¶,可以ACK(从队列中删除)了   ï¼ˆè¿™ä¸ªéœ€è¦æ ¹æ®ä¸šåŠ¡å†åŽ»å¤„ç†ACK)
        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
        try {
            IvrTaskcallMQ ivrTaskcallMQ = null;
            ObjectMapper mapper = new ObjectMapper();
            try {
                ivrTaskcallMQ = mapper.readValue("{" + content + "}", IvrTaskcallMQ.class);
            } catch (JsonProcessingException e) {
                e.printStackTrace();
            }
            //通过模板ID获取模板问题
            IvrLibaTemplateVO ivrLibaTemplateVO = new IvrLibaTemplateVO();
            ivrLibaTemplateVO.setID(Long.valueOf(ivrTaskcallMQ.getTemplateid()));
            IvrLibaTemplateVO ivrLibaTemplateVO1 = ivrLibaTemplateService.selectInfoByCondition(ivrLibaTemplateVO);
            //通过任务ID拿到患者信息
            IvrTaskSingle ivrTaskcall = new IvrTaskSingle();
            ivrTaskcall.setTaskid(ivrTaskcallMQ.getTaskid());
            List<IvrTaskSingle> ivrTaskcalls = ivrTaskcallMapper.selectIvrTaskcallList(ivrTaskcall);
            for (IvrTaskSingle ivrTaskcall1 : ivrTaskcalls) {
                //通过多线程的方式去打电话
                executorService.submit(new PhoneTask(ivrTaskcall1, ivrLibaTemplateVO1, redisCache, channel, message));
            }
            //通知 MQ æ¶ˆæ¯å·²è¢«æŽ¥æ”¶,可以ACK(从队列中删除)了   ï¼ˆè¿™ä¸ªéœ€è¦æ ¹æ®ä¸šåŠ¡å†åŽ»å¤„ç†ACK)
            channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
            log.info("=============Do Something==============");
        } catch (Exception e) {
            log.error("============消费失败,尝试消息补发再次消费!==============");
@@ -115,4 +118,12 @@
            channel.basicRecover(false);
        }
    }
    @Bean
    public SimpleRabbitListenerContainerFactory jsonContainerFactory(ConnectionFactory connectionFactory) {
        SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
        factory.setConnectionFactory(connectionFactory);
        factory.setMessageConverter(new Jackson2JsonMessageConverter());
        return factory;
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaTemplateController.java
@@ -1,5 +1,7 @@
package com.ruoyi.web.controller.smartor;
import com.alibaba.fastjson2.JSON;
import com.google.gson.Gson;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
@@ -10,6 +12,7 @@
import com.smartor.config.RabbitMqConfig;
import com.smartor.domain.IvrLibaTemplate;
import com.smartor.domain.IvrLibaTemplateVO;
import com.smartor.domain.Test1Vo;
import com.smartor.service.IIvrLibaTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -17,6 +20,7 @@
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.amqp.AmqpException;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageBuilder;
import org.springframework.amqp.core.MessagePostProcessor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
@@ -24,7 +28,9 @@
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * éšè®¿æ¨¡æ¿åº“Controller
@@ -139,8 +145,8 @@
    /**
     * å¼€å§‹æ‰§è¡Œ(测试用)
     */
    @GetMapping("/queryRabbitmq")
    public AjaxResult queryRabbitmq(@RequestParam("routintKey") String routintKey, @RequestParam("content") String content, @RequestParam("times") Long times) {
    @PostMapping("/queryRabbitmq")
    public AjaxResult queryRabbitmq(@RequestBody Test1Vo test1Vo) {
//        rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_NAME, "phone.001", "测试数据001");
//        rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_NAME, "phone.002", "测试数据002");
@@ -156,12 +162,15 @@
//        });
        log.info("-------------启动咨询应答超时提醒延迟队列-------------");
        this.rabbitTemplate.convertAndSend(RabbitMqConfig.phone_exchange, RabbitMqConfig.routing_key, content, message -> {
        String data = JSON.toJSONString(test1Vo.getTestVo());
        String substring = data.substring(1, data.length() - 1);
        this.rabbitTemplate.convertAndSend(RabbitMqConfig.phone_exchange, RabbitMqConfig.routing_key, substring, message -> {
            //注意这里时间可以使long,而且是设置header
            message.getMessageProperties().setHeader("x-delay", times);
            message.getMessageProperties().setHeader("x-delay", test1Vo.getTimes());
            return message;
        });
        log.info("-------------延迟队列{}ms后执行.-------------", times);
        log.info("-------------延迟队列{}ms后执行.-------------", test1Vo.getTimes());
        return success();
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskController.java
@@ -1,19 +1,26 @@
package com.smartor.controller;
package com.ruoyi.web.controller.smartor;
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.DtoConversionUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.smartor.domain.IvrTask;
import com.smartor.domain.IvrTaskVO;
import com.smartor.domain.IvrTaskSingle;
import com.smartor.service.IIvrTaskService;
import com.smartor.service.IIvrTaskSingleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.stream.Collectors;
/**
 * éšè®¿ä»»åŠ¡Controller
@@ -21,26 +28,45 @@
 * @author smartor
 * @date 2023-03-24
 */
@Api(description = "随访任务")
@RestController
@RequestMapping("/smartor/ivrtask")
public class IvrTaskController extends BaseController {
    @Autowired
    private IIvrTaskService ivrTaskService;
    @Autowired
    private IIvrTaskSingleService iIvrTaskCallService;
    /**
     * æŸ¥è¯¢è¯­éŸ³ä»»åŠ¡åˆ—è¡¨
     */
    @ApiOperation("查询语音任务列表")
    @PreAuthorize("@ss.hasPermi('smartor:ivrtask:list')")
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody IvrTask ivrTask) {
        startPage();
        List<IvrTask> list = ivrTaskService.selectIvrTaskList(ivrTask);
        return getDataTable(list);
        List<IvrTaskVO> ivrTaskVOS = DtoConversionUtils.sourceToTarget(list, IvrTaskVO.class);
        for (IvrTaskVO ivrTaskVO : ivrTaskVOS) {
            IvrTaskSingle ivrTaskcall = new IvrTaskSingle();
            ivrTaskcall.setTaskid(ivrTaskVO.getTaskid());
            List<IvrTaskSingle> ivrTaskcalls = iIvrTaskCallService.selectIvrTaskcallList(ivrTaskcall);
            //已发送
            long yfs = ivrTaskcalls.stream().filter(ivrTaskcall1 -> ivrTaskcall1.getSendstate() == 3L).collect(Collectors.toList()).stream().count();
            //未发送
            long wfs = ivrTaskcalls.stream().filter(ivrTaskcall1 -> ivrTaskcall1.getSendstate() == 2L).collect(Collectors.toList()).stream().count();
            ivrTaskVO.setYfs(yfs);
            ivrTaskVO.setWfs(wfs);
        }
        return getDataTable(ivrTaskVOS);
    }
    /**
     * å¯¼å‡ºè¯­éŸ³ä»»åŠ¡åˆ—è¡¨
     * å¯¼å‡ºä»»åŠ¡åˆ—è¡¨
     */
    @ApiOperation("导出任务列表")
    @PreAuthorize("@ss.hasPermi('smartor:ivrtask:export')")
    @Log(title = "语音任务", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
@@ -51,8 +77,9 @@
    }
    /**
     * èŽ·å–è¯­éŸ³ä»»åŠ¡è¯¦ç»†ä¿¡æ¯
     * èŽ·å–ä»»åŠ¡è¯¦ç»†ä¿¡æ¯
     */
    @ApiOperation("获取任务详细信息")
    @PreAuthorize("@ss.hasPermi('smartor:ivrtask:query')")
    @GetMapping(value = "/{taskid}")
    public AjaxResult getInfo(@PathVariable("taskid") Long taskid) {
@@ -60,8 +87,9 @@
    }
    /**
     * æ–°å¢žè¯­éŸ³ä»»åŠ¡
     * æ–°å¢žä»»åŠ¡
     */
    @ApiOperation("新增任务")
    @PreAuthorize("@ss.hasPermi('smartor:ivrtask:add')")
    @Log(title = "语音任务", businessType = BusinessType.INSERT)
    @PostMapping("/add")
@@ -72,20 +100,39 @@
    /**
     * ä¿®æ”¹è¯­éŸ³ä»»åŠ¡
     */
    @ApiOperation("修改任务")
    @PreAuthorize("@ss.hasPermi('smartor:ivrtask:edit')")
    @Log(title = "语音任务", businessType = BusinessType.UPDATE)
    @Log(title = "任务", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody IvrTask ivrTask) {
        return toAjax(ivrTaskService.updateIvrTask(ivrTask));
    }
//    /**
//     * åˆ é™¤è¯­éŸ³ä»»åŠ¡
//     */
//    @ApiOperation("删除任务")
//    @PreAuthorize("@ss.hasPermi('smartor:ivrtask:remove')")
//    @Log(title = "语音任务", businessType = BusinessType.DELETE)
//    @GetMapping("/remove/{taskids}")
//    public AjaxResult remove(@PathVariable Long[] taskids) {
//        return toAjax(ivrTaskService.deleteIvrTaskByTaskids(taskids));
//    }
//
    /**
     * åˆ é™¤è¯­éŸ³ä»»åŠ¡
     * åˆ é™¤ä»»åŠ¡(包括它对应的患者信息)
     */
    @ApiOperation("删除任务(包括它对应的患者信息)")
    @PreAuthorize("@ss.hasPermi('smartor:ivrtask:remove')")
    @Log(title = "语音任务", businessType = BusinessType.DELETE)
    @GetMapping("/remove/{taskids}")
    public AjaxResult remove(@PathVariable Long[] taskids) {
        return toAjax(ivrTaskService.deleteIvrTaskByTaskids(taskids));
    @GetMapping("/remove/{removeTask}")
    public AjaxResult removeTask(@PathVariable Long taskId) {
        return toAjax(ivrTaskService.deleteIvrTaskByTaskid(taskId));
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskcallController.java
@@ -2,19 +2,17 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
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.DateUtils;
import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.smartor.domain.*;
import com.smartor.service.IIvrTaskcallService;
import com.smartor.service.IIvrTaskSingleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -34,21 +32,21 @@
 */
@Api(description = "单一任务(随访宣教)")
@RestController
@RequestMapping("/smartor/taskcall")
@RequestMapping("/smartor/tasksingle")
public class IvrTaskcallController extends BaseController {
    @Autowired
    private IIvrTaskcallService ivrTaskcallService;
    private IIvrTaskSingleService ivrTaskcallService;
    /**
     * æŸ¥è¯¢å•一任务(随访)列表
     * æŸ¥è¯¢æ‚£è€…随访信息
     */
    @ApiOperation("查询单一任务(随访宣教)列表")
    @ApiOperation("查询患者随访信息")
    @PreAuthorize("@ss.hasPermi('system:taskcall:list')")
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody IvrTaskcall ivrTaskcall) {
    @PostMapping("/patItem")
    public TableDataInfo patItem(@RequestBody IvrTaskSingle ivrTaskcall) {
        PageUtils.startPageByPost(ivrTaskcall.getPageNum(), ivrTaskcall.getPageSize());
        List<IvrTaskcall> list = ivrTaskcallService.selectIvrTaskcallList(ivrTaskcall);
        return getDataTable(list);
        return getDataTable(ivrTaskcallService.patItem(ivrTaskcall));
    }
    /**
@@ -57,9 +55,9 @@
    @PreAuthorize("@ss.hasPermi('system:taskcall:export')")
    @Log(title = "单一任务(随访宣教)", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, IvrTaskcall ivrTaskcall) {
        List<IvrTaskcall> list = ivrTaskcallService.selectIvrTaskcallList(ivrTaskcall);
        ExcelUtil<IvrTaskcall> util = new ExcelUtil<IvrTaskcall>(IvrTaskcall.class);
    public void export(HttpServletResponse response, IvrTaskSingle ivrTaskcall) {
        List<IvrTaskSingle> list = ivrTaskcallService.selectIvrTaskcallList(ivrTaskcall);
        ExcelUtil<IvrTaskSingle> util = new ExcelUtil<IvrTaskSingle>(IvrTaskSingle.class);
        util.exportExcel(response, list, "单一任务(随访)数据");
    }
@@ -79,7 +77,7 @@
    @PreAuthorize("@ss.hasPermi('system:task:add')")
    @Log(title = "单一任务(随访)", businessType = BusinessType.INSERT)
    @PostMapping("/insertOrUpdateTask")
    public AjaxResult insertOrUpdateHeTask(@RequestBody IvrTaskcallVO ivrTaskcallVO) {
    public AjaxResult insertOrUpdateHeTask(@RequestBody IvrTaskSingleVO ivrTaskcallVO) {
        return toAjax(ivrTaskcallService.insertOrUpdateTask(ivrTaskcallVO));
    }
@@ -89,16 +87,16 @@
     */
    @ApiOperation("根据条件查询任务信息")
    @PostMapping("/queryTaskByCondition")
    public AjaxResult queryTaskByCondition(@RequestBody IvrTaskcallVO ivrTaskcallVO) {
    public AjaxResult queryTaskByCondition(@RequestBody IvrTaskSingleVO ivrTaskcallVO) {
        //根据入参查询信息
        IvrTaskcall ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTaskcall.class);
        List<IvrTaskcall> list = ivrTaskcallService.selectIvrTaskcallList(ivrTaskcall);
        IvrTaskSingle ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTaskSingle.class);
        List<IvrTaskSingle> list = ivrTaskcallService.selectIvrTaskcallList(ivrTaskcall);
        //定义患者与单一任务关联表集合
        List<PatTaskRelevance> patTaskRelevances = new ArrayList<>();
        //将查出来的数据倒入IvrTaskcallVO中
        IvrTaskcallVO ivrTaskcallVO2 = DtoConversionUtils.sourceToTarget(list.get(0), IvrTaskcallVO.class);
        IvrTaskSingleVO ivrTaskcallVO2 = DtoConversionUtils.sourceToTarget(list.get(0), IvrTaskSingleVO.class);
        String sendTimeSlot = list.get(0).getSendTimeSlot();
        ObjectMapper objectMapper = new ObjectMapper();
        try {
@@ -116,7 +114,7 @@
            e.printStackTrace();
        }
        for (IvrTaskcall ivrTaskcall1 : list) {
        for (IvrTaskSingle ivrTaskcall1 : list) {
            PatTaskRelevance patTaskRelevance = new PatTaskRelevance();
            //获取到患者信息,并放入到集合中
            patTaskRelevance.setName(ivrTaskcall1.getSendname());
@@ -137,7 +135,7 @@
     */
    @ApiOperation("任务发送执行")
    @PostMapping("/heTaskSend")
    public AjaxResult heTaskSend(@RequestBody IvrTaskcallVO ivrTaskcallVO) {
    public AjaxResult heTaskSend(@RequestBody IvrTaskSingleVO ivrTaskcallVO) {
        return toAjax(ivrTaskcallService.heTaskSend(ivrTaskcallVO));
    }
ruoyi-admin/src/main/java/com/ruoyi/web/task/PhoneTask.java
@@ -1,57 +1,71 @@
package com.ruoyi.web.task;
import com.rabbitmq.client.Channel;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.smartor.config.PhoneUtils;
import com.smartor.domain.IvrLibaTemplateScriptVO;
import com.smartor.domain.IvrLibaTemplateVO;
import com.smartor.domain.IvrTaskcall;
import com.smartor.domain.IvrTaskSingle;
import com.smartor.domain.QuestionMessage;
import org.springframework.amqp.core.Message;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
public class PhoneTask implements Runnable {
    private IvrTaskcall ivrTaskcall;
    private IvrTaskSingle ivrTaskcall;
    private List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVO;
    private RedisCache redisCache;
    private IvrLibaTemplateVO ivrLibaTemplateVO;
    private Channel channel;
    private Message message;
    public PhoneTask(IvrTaskcall ivrTaskcall, IvrLibaTemplateVO ivrLibaTemplateVO, RedisCache redisCache) {
    public PhoneTask(IvrTaskSingle ivrTaskcall, IvrLibaTemplateVO ivrLibaTemplateVO, RedisCache redisCache, Channel channel, Message message) {
        this.ivrTaskcall = ivrTaskcall;
        this.ivrLibaTemplateScriptVO = ivrLibaTemplateVO.getIvrLibaTemplateScriptVOList();
        this.ivrLibaTemplateVO = ivrLibaTemplateVO;
        this.redisCache = redisCache;
        this.channel = channel;
        this.message = message;
    }
    @Override
    public void run() {
        //获取电话组,查看哪些电话可以使用
        PhoneUtils phoneUtils = new PhoneUtils();
        String uuid = IdUtils.randomUUID();
        Map<String, Object> objectMap = new HashMap<>();
        objectMap.put("ivrTaskcall", ivrTaskcall);
        objectMap.put("ivrLibaTemplateScriptVO", ivrLibaTemplateScriptVO);
        //将数据放到redis中,方便在回调方法里获取
        redisCache.setCacheObject(uuid, objectMap, 120, TimeUnit.MINUTES);
        try {
            //获取电话组,查看哪些电话可以使用
            PhoneUtils phoneUtils = new PhoneUtils();
            String uuid = IdUtils.randomUUID();
            Map<String, Object> objectMap = new HashMap<>();
            objectMap.put("ivrTaskcall", ivrTaskcall);
            objectMap.put("ivrLibaTemplateScriptVO", ivrLibaTemplateScriptVO);
            //将数据放到redis中,方便在回调方法里获取
            redisCache.setCacheObject(uuid, objectMap, 120, TimeUnit.MINUTES);
        //记录首次问题
        QuestionMessage returnQues = new QuestionMessage();
        returnQues.setKcb(ivrLibaTemplateVO.getRevisitBefore());
        for (IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO : ivrLibaTemplateScriptVO) {
            if (ivrLibaTemplateScriptVO.getTargetid() == ivrLibaTemplateVO.getFirstQuestionNum().intValue()) {
                returnQues.setNowQuestion(ivrLibaTemplateScriptVO);
            //记录首次问题
            QuestionMessage returnQues = new QuestionMessage();
            returnQues.setKcb(ivrLibaTemplateVO.getRevisitBefore());
            for (IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO : ivrLibaTemplateScriptVO) {
                if (ivrLibaTemplateScriptVO.getTargetid() == ivrLibaTemplateVO.getFirstQuestionNum().intValue()) {
                    returnQues.setNowQuestion(ivrLibaTemplateScriptVO);
                }
            }
        }
        returnQues.setQuestionList(ivrLibaTemplateScriptVO);
        //将问题,和模板信息放到redis中
        redisCache.setCacheObject(uuid + "returnQues", returnQues, 120, TimeUnit.MINUTES);
        redisCache.setCacheObject(uuid + "ivrLibaTemplateVO", ivrLibaTemplateVO, 120, TimeUnit.MINUTES);
            returnQues.setQuestionList(ivrLibaTemplateScriptVO);
            //将问题,和模板信息放到redis中
            redisCache.setCacheObject(uuid + "returnQues", returnQues, 120, TimeUnit.MINUTES);
            redisCache.setCacheObject(uuid + "ivrLibaTemplateVO", ivrLibaTemplateVO, 120, TimeUnit.MINUTES);
        //调用机器人电话,开始电话(需要将回调方法传入,这个等”电话方“告诉怎么传,现在先空着,还有第一句问题话术)
        phoneUtils.ob(uuid, null, ivrTaskcall.getPhone(), null, null, null, null, null, null, null, null);
            //调用机器人电话,开始电话(需要将回调方法传入,这个等”电话方“告诉怎么传,现在先空着,还有第一句问题话术)
            phoneUtils.ob(uuid, null, ivrTaskcall.getPhone(), null, null, null, null, null, null, null, null);
            //通知 MQ æ¶ˆæ¯å·²è¢«æŽ¥æ”¶,可以ACK(从队列中删除)了   ï¼ˆè¿™ä¸ªéœ€è¦æ ¹æ®ä¸šåŠ¡å†åŽ»å¤„ç†ACK)
            channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
smartor/src/main/java/com/smartor/domain/IvrTaskSingle.java
ÎļþÃû´Ó smartor/src/main/java/com/smartor/domain/IvrTaskcall.java ÐÞ¸Ä
@@ -1,13 +1,10 @@
package com.smartor.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
@@ -18,7 +15,7 @@
 * @date 2024-02-02
 */
@Data
public class IvrTaskcall extends BaseEntity {
public class IvrTaskSingle extends BaseEntity {
    @ApiModelProperty(value = "拉取时间")
    private static final long serialVersionUID = 1L;
@@ -86,8 +83,8 @@
    /**
     * ä»»åŠ¡ç±»åž‹(门诊,住院,复诊…)
     */
    @Excel(name = "任务类型(门诊,住院,复诊…)")
    @ApiModelProperty(value = "任务类型(门诊,住院,复诊…)")
    @Excel(name = "任务类型(0通知、1宣教、2门诊、3出院、4复诊、5体检、6问卷、7医技……)")
    @ApiModelProperty(value = "任务类型(0通知、1宣教、2门诊、3出院、4复诊、5体检、6问卷、7医技……)")
    private String type;
@@ -159,7 +156,7 @@
     * å‘送状态
     */
    @Excel(name = " å‘送状态 ")
    @ApiModelProperty(value = "发送状态")
    @ApiModelProperty(value = "发送状态 1 è¢«é¢†å–  2 å¾…发送  3 å·²å‘送")
    private Long sendstate;
    /**
@@ -368,7 +365,6 @@
    private String sendType;
    /**
     * å‘送时间段
     */
@@ -376,4 +372,46 @@
    @ApiModelProperty(value = "发送时间段")
    private String sendTimeSlot;
    /**
     * ä»»åŠ¡åç§°
     */
    @Excel(name = "任务名称")
    @ApiModelProperty(value = "任务名称")
    private String taskName;
    /**
     * ä»»åŠ¡æè¿°
     */
    @Excel(name = "任务描述")
    @ApiModelProperty(value = "任务描述")
    private String taskDesc;
    /**
     * éšè®¿äºº
     */
    @Excel(name = "  éšè®¿äºº  ")
    @ApiModelProperty(value = "随访人")
    private String operator;
    /**
     * éšè®¿äºº
     */
    @Excel(name = "  éšè®¿äººç¼–号  ")
    @ApiModelProperty(value = "随访人编号")
    private String operatorNo;
    /**
     * å°±è¯Šç¼–号(对应的outhospno、inhospno)
     */
    @Excel(name = "  å°±è¯Šç¼–号(对应的outhospno、inhospno)  ")
    @ApiModelProperty(value = "就诊编号(对应的outhospno、inhospno)")
    private String hospno;
    /**
     * å°±è¯Šç±»åž‹ï¼ˆ1门诊  2出院)
     */
    @Excel(name = "  å°±è¯Šç±»åž‹ï¼ˆ1门诊  2出院)")
    @ApiModelProperty(value = "就诊类型(1门诊  2出院)")
    private String hospType;
}
smartor/src/main/java/com/smartor/domain/IvrTaskSingleVO.java
ÎļþÃû´Ó smartor/src/main/java/com/smartor/domain/IvrTaskcallVO.java ÐÞ¸Ä
@@ -19,7 +19,7 @@
 * @date 2024-02-02
 */
@Data
public class IvrTaskcallVO extends BaseEntity {
public class IvrTaskSingleVO extends BaseEntity {
    private static final long serialVersionUID = 1L;
    /**
@@ -373,6 +373,49 @@
    @ApiModelProperty(value = "发送时间段 ")
    private List<TaskSendTimeVO> sendTimeslot;
    /**
     * ä»»åŠ¡åç§°
     */
    @Excel(name = "任务名称")
    @ApiModelProperty(value = "任务名称")
    private String taskName;
    /**
     * ä»»åŠ¡æè¿°
     */
    @Excel(name = "任务描述")
    @ApiModelProperty(value = "任务描述")
    private String taskDesc;
    /**
     * éšè®¿äºº
     */
    @Excel(name = "  éšè®¿äºº  ")
    @ApiModelProperty(value = "随访人")
    private String operator;
    /**
     * éšè®¿äºº
     */
    @Excel(name = "  éšè®¿äººç¼–号  ")
    @ApiModelProperty(value = "随访人编号")
    private String operatorNo;
    /**
     * å°±è¯Šç¼–号(对应的outhospno、inhospno)
     */
    @Excel(name = "  å°±è¯Šç¼–号(对应的outhospno、inhospno)  ")
    @ApiModelProperty(value = "就诊编号(对应的outhospno、inhospno)")
    private String hospno;
    /**
     * å°±è¯Šç±»åž‹ï¼ˆ1门诊  2出院)
     */
    @Excel(name = "  å°±è¯Šç±»åž‹ï¼ˆ1门诊  2出院)")
    @ApiModelProperty(value = "就诊类型(1门诊  2出院)")
    private String hospType;
    @Override
    public String toString() {
smartor/src/main/java/com/smartor/domain/IvrTaskVO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,192 @@
package com.smartor.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
 * è¯­éŸ³ä»»åŠ¡å¯¹è±¡ ivr_task
 *
 * @author smartor
 * @date 2023-03-24
 */
@Data
public class IvrTaskVO extends BaseEntity {
    private static final long serialVersionUID = 1L;
    /**
     *
     */
    private Long taskid;
    /**
     *
     */
    @Excel(name = "  ")
    private String taskname;
    /**
     *
     */
    @Excel(name = "  ")
    private String templateid;
    /**
     *
     */
    @Excel(name = "  ")
    private String templatename;
    /**
     *
     */
    @Excel(name = "  ")
    private String labelinfo;
    /**
     *
     */
    @Excel(name = "  ")
    private Long state;
    /**
     *
     */
    @Excel(name = "  ")
    private Long count;
    /**
     *
     */
    @Excel(name = "  ")
    private Long executed;
    /**
     *
     */
    @Excel(name = "  ")
    private Long unexecuted;
    /**
     *
     */
    @Excel(name = "  ")
    private Long fail;
    /**
     *
     */
    @Excel(name = "  ")
    private String userid;
    /**
     *
     */
    @Excel(name = "  ")
    private String username;
    /**
     *
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "  ", width = 30, dateFormat = "yyyy-MM-dd")
    private Date addtime;
    /**
     *
     */
    @Excel(name = "  ")
    private String checkuserid;
    /**
     *
     */
    @Excel(name = "  ")
    private String checkusername;
    /**
     *
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "  ", width = 30, dateFormat = "yyyy-MM-dd")
    private Date checktime;
    /**
     * 1,出院随访;2,体检通知;3,满意度调查;4,宣教;
     */
    @Excel(name = " 1,出院随访;2,体检通知;3,满意度调查;4,宣教; ")
    private String type;
    /**
     *
     */
    @Excel(name = "  ")
    private String typename;
    /**
     * 0.不使用播前短信 1.使用播前短信
     */
    @Excel(name = " 0.不使用播前短信 1.使用播前短信 ")
    private Long usebqsms;
    /**
     * 0.不使用播后短信 1.使用播前短信
     */
    @Excel(name = " 0.不使用播后短信 1.使用播前短信 ")
    private Long usebhsms;
    /**
     *
     */
    @Excel(name = "  ")
    private Long usesendsms;
    /**
     *
     */
    @Excel(name = "  ")
    private String deptcode;
    /**
     * åˆ é™¤æ ‡è®°
     */
    private String delFlag;
    /**
     * ä¸Šä¼ æ ‡è®°
     */
    @Excel(name = " ä¸Šä¼ æ ‡è®° ")
    private Long isupload;
    /**
     * ä¸Šä¼ æ—¶é—´
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = " ä¸Šä¼ æ—¶é—´ ", width = 30, dateFormat = "yyyy-MM-dd")
    private Date uploadTime;
    /**
     * æœºæž„ID
     */
    @Excel(name = " æœºæž„ID ")
    private String orgid;
    /**
     * å·²å‘送
     */
    @Excel(name = " å·²å‘送 ")
    private Long yfs;
    /**
     * æœªå‘送
     */
    @Excel(name = " æœªå‘送 ")
    private Long wfs;
}
smartor/src/main/java/com/smartor/domain/IvrVisitInfoVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,148 @@
package com.smartor.domain;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
 * æ‚£è€…随访信息
 */
@Data
public class IvrVisitInfoVo {
    /**
     * ä»»åŠ¡åç§°
     */
    @Excel(name = "任务名称(随访方案)")
    @ApiModelProperty(value = "任务名称(随访方案)")
    private String taskName;
    /**
     * ä»»åŠ¡æè¿°
     */
    @Excel(name = "任务描述")
    @ApiModelProperty(value = "任务描述")
    private String taskDesc;
    /**
     * å‘送人
     */
    @Excel(name = " å‘送人(患者) ")
    @ApiModelProperty(value = "发送人(患者)")
    private String patientName;
    /**
     * æ‰‹æœºå·
     */
    @Excel(name = " æ‰‹æœºå· ")
    @ApiModelProperty(value = "手机号")
    private String phone;
    /**
     * æ€§åˆ«
     */
    @Excel(name = "  æ€§åˆ«")
    @ApiModelProperty(value = "性别")
    private String sex;
    /**
     * å¹´é¾„
     */
    @Excel(name = " å¹´é¾„ ")
    @ApiModelProperty(value = "年龄")
    private Long age;
    /**
     * èº«ä»½è¯å·
     */
    @Excel(name = " èº«ä»½è¯å· ")
    @ApiModelProperty(value = "身份证号")
    private String sfzh;
    /**
     * åœ°å€
     */
    @Excel(name = " åœ°å€ ")
    @ApiModelProperty(value = "地址")
    private String addr;
    /**
     * ç–¾ç—…名称
     */
    @Excel(name = " ç–¾ç—…名称 ")
    @ApiModelProperty(value = "疾病名称")
    private String diagname;
    /**
     * æˆ¿é—´å·
     */
    @Excel(name = "  æˆ¿é—´å·  ")
    @ApiModelProperty(value = " æˆ¿é—´å· ")
    private String roomno;
    /**
     * åºŠå·
     */
    @Excel(name = " åºŠå· ")
    @ApiModelProperty(value = "床号")
    private String bedno;
    /**
     * åºŠå·
     */
    @Excel(name = "  å…¥é™¢ç§‘室名称  ")
    @ApiModelProperty(value = " å…¥é™¢ç§‘室名称 ")
    private String deptname;
    /**
     * éšè®¿æ–¹å¼
     */
    @Excel(name = "  éšè®¿æ–¹å¼  ")
    @ApiModelProperty(value = " éšè®¿æ–¹å¼  1,短信、2,线下、3,语音、4,视频、5,纸质  6.链接  7.钉钉   8.微信")
    private String serviceform;
    /**
     * éšè®¿äºº
     */
    @Excel(name = "  éšè®¿äºº  ")
    @ApiModelProperty(value = "随访人")
    private String operator;
    /**
     * éšè®¿äºº
     */
    @Excel(name = "  éšè®¿äººç¼–号  ")
    @ApiModelProperty(value = "随访人编号")
    private String operatorNo;
    /**
     * å°±è¯Šæ—¶é—´
     */
    @Excel(name = "  å°±è¯Šæ—¶é—´  ")
    @ApiModelProperty(value = "就诊时间")
    private Date admitdate;
    /**
     * éšè®¿æ—¶é—´
     */
    @Excel(name = "  éšè®¿æ—¶é—´  ")
    @ApiModelProperty(value = "随访时间")
    private String visitTime;
    /**
     * éšè®¿çŠ¶æ€
     */
    @Excel(name = "  éšè®¿çŠ¶æ€  1 è¢«é¢†å–  2 å¾…发送  3 å·²å‘送")
    @ApiModelProperty(value = "随访状态")
    private Long state;
    /**
     * éšè®¿çŠ¶æ€
     */
    @Excel(name = "  å°±è¯Šç¼–号")
    @ApiModelProperty(value = "就诊编号")
    private String hospno;
}
smartor/src/main/java/com/smartor/domain/PatMedOuthosp.java
@@ -1,9 +1,11 @@
package com.smartor.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
@@ -11,322 +13,150 @@
/**
 * æ‚£è€…门诊记录对象 pat_med_outhosp
 *
 *
 * @author smartor
 * @date 2023-03-04
 */
@Data
@ApiModel(value = "PatMedOuthosp", description = "患者门诊记录对象")
public class PatMedOuthosp extends BaseEntity
{
public class PatMedOuthosp extends BaseEntity {
    private static final long serialVersionUID = 1L;
    /**  è‡ªå¢žID  */
    /**
     * è‡ªå¢žID
     */
    @ApiModelProperty(value = "自增ID")
    private Long id;
    /**  æµæ°´å·  */
    /**
     * é—¨è¯Šç¼–号
     */
    @ApiModelProperty(value = "门诊编号")
    private String outhospno;
    /**
     * æµæ°´å·
     */
    @ApiModelProperty(value = "流水号")
    private String serialnum;
    /**  æ¡£æ¡ˆID  */
    /**
     * æ¡£æ¡ˆID
     */
    @ApiModelProperty(value = "档案ID")
    private Long patid;
    /**  åŒ»é™¢åç§°  */
    /**
     * åŒ»é™¢åç§°
     */
    @ApiModelProperty(value = "医院名称")
    private String hospitalname;
    /**  åŒ»é™¢ç¼–号  */
    /**
     * åŒ»é™¢ç¼–号
     */
    @ApiModelProperty(value = "医院编号")
    private String hospitalcode;
    /**  è¯Šæ–­ICD值  */
    /**
     * è¯Šæ–­ICD值
     */
    @ApiModelProperty(value = "诊断ICD值")
    private String icd10code;
    /**  è¯Šæ–­åç§°  */
    /**
     * è¯Šæ–­åç§°
     */
    @ApiModelProperty(value = "诊断名称")
    private String diagname;
    /**  ç§‘室代码  */
    /**
     * ç§‘室代码
     */
    @ApiModelProperty(value = "科室代码")
    private String deptcode;
    /**  ç§‘室名称  */
    /**
     * ç§‘室名称
     */
    @ApiModelProperty(value = "科室名称")
    @Excel(name = " ç§‘室名称 ")
    private String deptname;
    /**  åŒ»ç”Ÿå·¥å·  */
    /**
     * åŒ»ç”Ÿå·¥å·
     */
    @ApiModelProperty(value = "医生工号")
    private String drcode;
    /**  åŒ»ç”Ÿåç§°  */
    /**
     * åŒ»ç”Ÿåç§°
     */
    @ApiModelProperty(value = "医生名称")
    private String drname;
    /**  å°±è¯Šæ—¥æœŸ  */
    /**
     * å°±è¯Šæ—¥æœŸ
     */
    @ApiModelProperty(value = "就诊日期")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = " å°±è¯Šæ—¥æœŸ ", width = 30, dateFormat = "yyyy-MM-dd")
    private Date admitdate;
    /**  æœºæž„ID  */
    /**
     * æœºæž„ID
     */
    @ApiModelProperty(value = "机构ID")
    private String orgid;
    /**  åˆ é™¤æ ‡è®°  */
    /**
     * åˆ é™¤æ ‡è®°
     */
    @ApiModelProperty(value = "删除标记")
    private String delFlag;
    /**  ä¸Šä¼ æ ‡è®°  */
    /**
     * ä¸Šä¼ æ ‡è®°
     */
    @ApiModelProperty(value = "上传标记")
    private Long isupload;
    /**  ä¸Šä¼ æ—¶é—´  */
    /**
     * ä¸Šä¼ æ—¶é—´
     */
    @ApiModelProperty(value = "上传时间")
    private Date uploadTime;
    /**  æ˜¯å¦ç”Ÿæˆæ–¹æ¡ˆçŠ¶æ€;0未生成 1生成就诊 9无匹配方案  */
    /**
     * æ˜¯å¦ç”Ÿæˆæ–¹æ¡ˆçŠ¶æ€;0未生成 1生成就诊 9无匹配方案
     */
    @ApiModelProperty(value = "是否生成方案状态;0未生成 1生成就诊 9无匹配方案")
    private Long schemestatus;
    /**  ç§‘室ID  */
    /**
     * ç§‘室ID
     */
    @ApiModelProperty(value = "科室ID")
    private Long deptid;
    /**  æ–¹æ¡ˆçŠ¶æ€æ“ä½œæ—¶é—´  */
    /**
     * æ–¹æ¡ˆçŠ¶æ€æ“ä½œæ—¶é—´
     */
    @ApiModelProperty(value = "方案状态操作时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = " æ–¹æ¡ˆçŠ¶æ€æ“ä½œæ—¶é—´ ", width = 30, dateFormat = "yyyy-MM-dd")
    private Date schemetime;
    /**  çŽ°ç—…å²  */
    /**
     * çŽ°ç—…å²
     */
    @ApiModelProperty(value = "现病史")
    private String hpi;
    /**  ä¸»è¿°  */
    /**
     * ä¸»è¿°
     */
    @ApiModelProperty(value = "主述")
    private String mainsuit;
    public void setId(Long id)
    {
        this.id = id;
    }
    public Long getId()
    {
        return id;
    }
    public void setSerialnum(String serialnum)
    {
        this.serialnum = serialnum;
    }
    public String getSerialnum()
    {
        return serialnum;
    }
    public void setPatid(Long patid)
    {
        this.patid = patid;
    }
    public Long getPatid()
    {
        return patid;
    }
    public void setHospitalname(String hospitalname)
    {
        this.hospitalname = hospitalname;
    }
    public String getHospitalname()
    {
        return hospitalname;
    }
    public void setHospitalcode(String hospitalcode)
    {
        this.hospitalcode = hospitalcode;
    }
    public String getHospitalcode()
    {
        return hospitalcode;
    }
    public void setIcd10code(String icd10code)
    {
        this.icd10code = icd10code;
    }
    public String getIcd10code()
    {
        return icd10code;
    }
    public void setDiagname(String diagname)
    {
        this.diagname = diagname;
    }
    public String getDiagname()
    {
        return diagname;
    }
    public void setDeptcode(String deptcode)
    {
        this.deptcode = deptcode;
    }
    public String getDeptcode()
    {
        return deptcode;
    }
    public void setDeptname(String deptname)
    {
        this.deptname = deptname;
    }
    public String getDeptname()
    {
        return deptname;
    }
    public void setDrcode(String drcode)
    {
        this.drcode = drcode;
    }
    public String getDrcode()
    {
        return drcode;
    }
    public void setDrname(String drname)
    {
        this.drname = drname;
    }
    public String getDrname()
    {
        return drname;
    }
    public void setAdmitdate(Date admitdate)
    {
        this.admitdate = admitdate;
    }
    public Date getAdmitdate()
    {
        return admitdate;
    }
    public void setOrgid(String orgid)
    {
        this.orgid = orgid;
    }
    public String getOrgid()
    {
        return orgid;
    }
    public void setDelFlag(String delFlag)
    {
        this.delFlag = delFlag;
    }
    public String getDelFlag()
    {
        return delFlag;
    }
    public void setIsupload(Long isupload)
    {
        this.isupload = isupload;
    }
    public Long getIsupload()
    {
        return isupload;
    }
    public void setUploadTime(Date uploadTime)
    {
        this.uploadTime = uploadTime;
    }
    public Date getUploadTime()
    {
        return uploadTime;
    }
    public void setSchemestatus(Long schemestatus)
    {
        this.schemestatus = schemestatus;
    }
    public Long getSchemestatus()
    {
        return schemestatus;
    }
    public void setDeptid(Long deptid)
    {
        this.deptid = deptid;
    }
    public Long getDeptid()
    {
        return deptid;
    }
    public void setSchemetime(Date schemetime)
    {
        this.schemetime = schemetime;
    }
    public Date getSchemetime()
    {
        return schemetime;
    }
    public void setHpi(String hpi)
    {
        this.hpi = hpi;
    }
    public String getHpi()
    {
        return hpi;
    }
    public void setMainsuit(String mainsuit)
    {
        this.mainsuit = mainsuit;
    }
    public String getMainsuit()
    {
        return mainsuit;
    }
    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("serialnum", getSerialnum())
            .append("patid", getPatid())
            .append("hospitalname", getHospitalname())
            .append("hospitalcode", getHospitalcode())
            .append("icd10code", getIcd10code())
            .append("diagname", getDiagname())
            .append("deptcode", getDeptcode())
            .append("deptname", getDeptname())
            .append("drcode", getDrcode())
            .append("drname", getDrname())
            .append("admitdate", getAdmitdate())
            .append("orgid", getOrgid())
            .append("delFlag", getDelFlag())
            .append("updateBy", getUpdateBy())
            .append("updateTime", getUpdateTime())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("isupload", getIsupload())
            .append("uploadTime", getUploadTime())
            .append("schemestatus", getSchemestatus())
            .append("deptid", getDeptid())
            .append("schemetime", getSchemetime())
            .append("hpi", getHpi())
            .append("mainsuit", getMainsuit())
            .toString();
    }
}
smartor/src/main/java/com/smartor/domain/Test1Vo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
package com.smartor.domain;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class Test1Vo {
    private TestVo testVo;
    private Long times;
}
smartor/src/main/java/com/smartor/domain/TestVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,32 @@
package com.smartor.domain;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class TestVo {
    /**
     * ä»»åŠ¡ID
     */
    @Excel(name = " ä»»åŠ¡ID ")
    @ApiModelProperty(value = "任务ID")
    private Long taskid;
    /**
     * æ¨¡æ¿ID
     */
    @Excel(name = "  æ¨¡æ¿ID")
    @ApiModelProperty(value = "模板ID")
    private String templateid;
    /**
     * å‘送类型: 1 æ—¶é—´æ®µ   2 æ—¶é—´ç‚¹   3 å³åˆ»å‘送
     */
    @ApiModelProperty(value = "发送类型: 1 æ—¶é—´æ®µ   2 å³åˆ»å‘送")
    private String sendType;
}
smartor/src/main/java/com/smartor/mapper/IvrTaskMapper.java
@@ -5,15 +5,15 @@
/**
 * è¯­éŸ³ä»»åŠ¡Mapper接口
 *
 *
 * @author smartor
 * @date 2023-03-24
 */
public interface IvrTaskMapper
public interface IvrTaskMapper
{
    /**
     * æŸ¥è¯¢è¯­éŸ³ä»»åŠ¡
     *
     *
     * @param taskid è¯­éŸ³ä»»åС䏻键
     * @return è¯­éŸ³ä»»åŠ¡
     */
@@ -21,7 +21,7 @@
    /**
     * æŸ¥è¯¢è¯­éŸ³ä»»åŠ¡åˆ—è¡¨
     *
     *
     * @param ivrTask è¯­éŸ³ä»»åŠ¡
     * @return è¯­éŸ³ä»»åŠ¡é›†åˆ
     */
@@ -29,7 +29,7 @@
    /**
     * æ–°å¢žè¯­éŸ³ä»»åŠ¡
     *
     *
     * @param ivrTask è¯­éŸ³ä»»åŠ¡
     * @return ç»“æžœ
     */
@@ -37,7 +37,7 @@
    /**
     * ä¿®æ”¹è¯­éŸ³ä»»åŠ¡
     *
     *
     * @param ivrTask è¯­éŸ³ä»»åŠ¡
     * @return ç»“æžœ
     */
@@ -45,15 +45,15 @@
    /**
     * åˆ é™¤è¯­éŸ³ä»»åŠ¡
     *
     *
     * @param taskid è¯­éŸ³ä»»åС䏻键
     * @return ç»“æžœ
     */
    public int deleteIvrTaskByTaskid(Long taskid);
    public Boolean deleteIvrTaskByTaskid(Long taskid);
    /**
     * æ‰¹é‡åˆ é™¤è¯­éŸ³ä»»åŠ¡
     *
     *
     * @param taskids éœ€è¦åˆ é™¤çš„æ•°æ®ä¸»é”®é›†åˆ
     * @return ç»“æžœ
     */
smartor/src/main/java/com/smartor/mapper/IvrTaskSingleMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
package com.smartor.mapper;
import com.smartor.domain.IvrTaskSingle;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * å•一任务(随访)Mapper接口
 *
 * @author ruoyi
 * @date 2024-02-02
 */
@Mapper
public interface IvrTaskSingleMapper {
    /**
     * æŸ¥è¯¢å•一任务(随访)
     *
     * @param id å•一任务(随访)主键
     * @return å•一任务(随访)
     */
    public IvrTaskSingle selectIvrTaskcallById(Long id);
    /**
     * æŸ¥è¯¢å•一任务(随访)列表
     *
     * @param ivrTaskSingle å•一任务(随访)
     * @return å•一任务(随访)集合
     */
    public List<IvrTaskSingle> selectIvrTaskcallList(IvrTaskSingle ivrTaskSingle);
    /**
     * æ–°å¢žå•一任务(随访)
     *
     * @param ivrTaskSingle å•一任务(随访)
     * @return ç»“æžœ
     */
    public int insertIvrTaskcall(IvrTaskSingle ivrTaskSingle);
    /**
     * ä¿®æ”¹å•一任务(随访)
     *
     * @return ç»“æžœ
     */
    public Boolean updateIvrTaskcall(IvrTaskSingle ivrTaskSingle);
    /**
     * åˆ é™¤å•一任务(随访)
     *
     * @param id å•一任务(随访)主键
     * @return ç»“æžœ
     */
    public int deleteIvrTaskcallById(Long id);
    /**
     * åˆ é™¤å•一任务(随访)
     *
     * @return ç»“æžœ
     */
    public List<IvrTaskSingle> getDataByTime(@Param("beganTime") String beganTime, @Param("endTime") String endTime);
}
smartor/src/main/java/com/smartor/mapper/IvrTaskcallMapper.java
ÎļþÒÑɾ³ý
smartor/src/main/java/com/smartor/mapper/PatMedInhospMapper.java
@@ -1,19 +1,21 @@
package com.smartor.mapper;
import java.util.List;
import com.smartor.domain.PatMedInhosp;
import org.apache.ibatis.annotations.Mapper;
/**
 * æ‚£è€…住院记录Mapper接口
 *
 *
 * @author smartor
 * @date 2023-03-04
 */
public interface PatMedInhospMapper
{
@Mapper
public interface PatMedInhospMapper {
    /**
     * æŸ¥è¯¢æ‚£è€…住院记录
     *
     *
     * @param inhospid æ‚£è€…住院记录主键
     * @return æ‚£è€…住院记录
     */
@@ -21,7 +23,7 @@
    /**
     * æŸ¥è¯¢æ‚£è€…住院记录列表
     *
     *
     * @param patMedInhosp æ‚£è€…住院记录
     * @return æ‚£è€…住院记录集合
     */
@@ -29,7 +31,7 @@
    /**
     * æ–°å¢žæ‚£è€…住院记录
     *
     *
     * @param patMedInhosp æ‚£è€…住院记录
     * @return ç»“æžœ
     */
@@ -37,7 +39,7 @@
    /**
     * ä¿®æ”¹æ‚£è€…住院记录
     *
     *
     * @param patMedInhosp æ‚£è€…住院记录
     * @return ç»“æžœ
     */
@@ -45,7 +47,7 @@
    /**
     * åˆ é™¤æ‚£è€…住院记录
     *
     *
     * @param inhospid æ‚£è€…住院记录主键
     * @return ç»“æžœ
     */
@@ -53,7 +55,7 @@
    /**
     * æ‰¹é‡åˆ é™¤æ‚£è€…住院记录
     *
     *
     * @param inhospids éœ€è¦åˆ é™¤çš„æ•°æ®ä¸»é”®é›†åˆ
     * @return ç»“æžœ
     */
smartor/src/main/java/com/smartor/mapper/PatMedOuthospMapper.java
@@ -2,18 +2,20 @@
import java.util.List;
import com.smartor.domain.PatMedOuthosp;
import org.apache.ibatis.annotations.Mapper;
/**
 * æ‚£è€…门诊记录Mapper接口
 *
 *
 * @author smartor
 * @date 2023-03-04
 */
public interface PatMedOuthospMapper
@Mapper
public interface PatMedOuthospMapper
{
    /**
     * æŸ¥è¯¢æ‚£è€…门诊记录
     *
     *
     * @param id æ‚£è€…门诊记录主键
     * @return æ‚£è€…门诊记录
     */
@@ -21,7 +23,7 @@
    /**
     * æŸ¥è¯¢æ‚£è€…门诊记录列表
     *
     *
     * @param patMedOuthosp æ‚£è€…门诊记录
     * @return æ‚£è€…门诊记录集合
     */
@@ -29,7 +31,7 @@
    /**
     * æ–°å¢žæ‚£è€…门诊记录
     *
     *
     * @param patMedOuthosp æ‚£è€…门诊记录
     * @return ç»“æžœ
     */
@@ -37,7 +39,7 @@
    /**
     * ä¿®æ”¹æ‚£è€…门诊记录
     *
     *
     * @param patMedOuthosp æ‚£è€…门诊记录
     * @return ç»“æžœ
     */
@@ -45,7 +47,7 @@
    /**
     * åˆ é™¤æ‚£è€…门诊记录
     *
     *
     * @param id æ‚£è€…门诊记录主键
     * @return ç»“æžœ
     */
@@ -53,7 +55,7 @@
    /**
     * æ‰¹é‡åˆ é™¤æ‚£è€…门诊记录
     *
     *
     * @param ids éœ€è¦åˆ é™¤çš„æ•°æ®ä¸»é”®é›†åˆ
     * @return ç»“æžœ
     */
smartor/src/main/java/com/smartor/service/IIvrTaskService.java
@@ -1,19 +1,19 @@
package com.smartor.service;
import java.util.List;
import com.smartor.domain.IvrTask;
/**
 * è¯­éŸ³ä»»åŠ¡Service接口
 *
 *
 * @author smartor
 * @date 2023-03-24
 */
public interface IIvrTaskService
{
public interface IIvrTaskService {
    /**
     * æŸ¥è¯¢è¯­éŸ³ä»»åŠ¡
     *
     *
     * @param taskid è¯­éŸ³ä»»åС䏻键
     * @return è¯­éŸ³ä»»åŠ¡
     */
@@ -21,7 +21,7 @@
    /**
     * æŸ¥è¯¢è¯­éŸ³ä»»åŠ¡åˆ—è¡¨
     *
     *
     * @param ivrTask è¯­éŸ³ä»»åŠ¡
     * @return è¯­éŸ³ä»»åŠ¡é›†åˆ
     */
@@ -29,7 +29,7 @@
    /**
     * æ–°å¢žè¯­éŸ³ä»»åŠ¡
     *
     *
     * @param ivrTask è¯­éŸ³ä»»åŠ¡
     * @return ç»“æžœ
     */
@@ -37,7 +37,7 @@
    /**
     * ä¿®æ”¹è¯­éŸ³ä»»åŠ¡
     *
     *
     * @param ivrTask è¯­éŸ³ä»»åŠ¡
     * @return ç»“æžœ
     */
@@ -45,7 +45,7 @@
    /**
     * æ‰¹é‡åˆ é™¤è¯­éŸ³ä»»åŠ¡
     *
     *
     * @param taskids éœ€è¦åˆ é™¤çš„语音任务主键集合
     * @return ç»“æžœ
     */
@@ -53,9 +53,9 @@
    /**
     * åˆ é™¤è¯­éŸ³ä»»åŠ¡ä¿¡æ¯
     *
     *
     * @param taskid è¯­éŸ³ä»»åС䏻键
     * @return ç»“æžœ
     */
    public int deleteIvrTaskByTaskid(Long taskid);
    public Boolean deleteIvrTaskByTaskid(Long taskid);
}
smartor/src/main/java/com/smartor/service/IIvrTaskSingleService.java
ÎļþÃû´Ó smartor/src/main/java/com/smartor/service/IIvrTaskcallService.java ÐÞ¸Ä
@@ -1,9 +1,6 @@
package com.smartor.service;
import com.smartor.domain.HeTaskVO;
import com.smartor.domain.IvrTaskcall;
import com.smartor.domain.IvrTaskcallVO;
import com.smartor.domain.PhoneCallBackVO;
import com.smartor.domain.*;
import java.util.List;
@@ -13,14 +10,14 @@
 * @author ruoyi
 * @date 2024-02-02
 */
public interface IIvrTaskcallService {
public interface IIvrTaskSingleService {
    /**
     * æŸ¥è¯¢å•一任务(随访)
     *
     * @param id å•一任务(随访)主键
     * @return å•一任务(随访)
     */
    public IvrTaskcall selectIvrTaskcallById(Long id);
    public IvrTaskSingle selectIvrTaskcallById(Long id);
    /**
     * æŸ¥è¯¢å•一任务(随访)列表
@@ -28,7 +25,12 @@
     * @param ivrTaskcall å•一任务(随访)
     * @return å•一任务(随访)集合
     */
    public List<IvrTaskcall> selectIvrTaskcallList(IvrTaskcall ivrTaskcall);
    public List<IvrTaskSingle> selectIvrTaskcallList(IvrTaskSingle ivrTaskcall);
    /**
     * æŸ¥è¯¢æ‚£è€…随访信息
     */
    public List<IvrVisitInfoVo> patItem(IvrTaskSingle ivrTaskcall);
    /**
     * æ–°å¢žå•一任务(随访)
@@ -36,7 +38,7 @@
     * @param ivrTaskcall å•一任务(随访)
     * @return ç»“æžœ
     */
    public int insertIvrTaskcall(IvrTaskcall ivrTaskcall);
    public int insertIvrTaskcall(IvrTaskSingle ivrTaskcall);
    /**
     * ä¿®æ”¹å•一任务(随访)
@@ -44,7 +46,7 @@
     * @param ivrTaskcall å•一任务(随访)
     * @return ç»“æžœ
     */
    public int updateIvrTaskcall(IvrTaskcall ivrTaskcall);
    public Boolean updateIvrTaskcall(IvrTaskSingle ivrTaskcall);
    /**
     * æ‰¹é‡åˆ é™¤å•一任务(随访)
@@ -60,7 +62,7 @@
     * @param ivrTaskcallVO å•一任务
     * @return ç»“æžœ
     */
    public int insertOrUpdateTask(IvrTaskcallVO ivrTaskcallVO);
    public int insertOrUpdateTask(IvrTaskSingleVO ivrTaskcallVO);
    /**
     * ä»»åŠ¡å‘é€æ‰§è¡Œ
@@ -68,7 +70,7 @@
     * @param ivrTaskcallVO
     * @return ç»“æžœ
     */
    public int heTaskSend(IvrTaskcallVO ivrTaskcallVO);
    public int heTaskSend(IvrTaskSingleVO ivrTaskcallVO);
    /**
     * ä»»åŠ¡å‘é€æ‰§è¡Œ
smartor/src/main/java/com/smartor/service/impl/IvrTaskServiceImpl.java
@@ -1,96 +1,107 @@
package com.smartor.service.impl;
import java.util.List;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.DateUtils;
import com.smartor.domain.IvrTaskSingle;
import com.smartor.mapper.IvrTaskSingleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.smartor.mapper.IvrTaskMapper;
import com.smartor.domain.IvrTask;
import com.smartor.service.IIvrTaskService;
import org.springframework.transaction.annotation.Transactional;
/**
 * è¯­éŸ³ä»»åŠ¡Service业务层处理
 *
 *
 * @author smartor
 * @date 2023-03-24
 */
@Service
public class IvrTaskServiceImpl implements IIvrTaskService
{
public class IvrTaskServiceImpl implements IIvrTaskService {
    @Autowired
    private IvrTaskMapper ivrTaskMapper;
    @Autowired
    private IvrTaskSingleMapper ivrTaskcallMapper;
    /**
     * æŸ¥è¯¢è¯­éŸ³ä»»åŠ¡
     *
     *
     * @param taskid è¯­éŸ³ä»»åС䏻键
     * @return è¯­éŸ³ä»»åŠ¡
     */
    @Override
    public IvrTask selectIvrTaskByTaskid(Long taskid)
    {
    public IvrTask selectIvrTaskByTaskid(Long taskid) {
        return ivrTaskMapper.selectIvrTaskByTaskid(taskid);
    }
    /**
     * æŸ¥è¯¢è¯­éŸ³ä»»åŠ¡åˆ—è¡¨
     *
     *
     * @param ivrTask è¯­éŸ³ä»»åŠ¡
     * @return è¯­éŸ³ä»»åŠ¡
     */
    @Override
    public List<IvrTask> selectIvrTaskList(IvrTask ivrTask)
    {
    public List<IvrTask> selectIvrTaskList(IvrTask ivrTask) {
        return ivrTaskMapper.selectIvrTaskList(ivrTask);
    }
    /**
     * æ–°å¢žè¯­éŸ³ä»»åŠ¡
     *
     *
     * @param ivrTask è¯­éŸ³ä»»åŠ¡
     * @return ç»“æžœ
     */
    @Override
    public int insertIvrTask(IvrTask ivrTask)
    {
    public int insertIvrTask(IvrTask ivrTask) {
        ivrTask.setCreateTime(DateUtils.getNowDate());
        return ivrTaskMapper.insertIvrTask(ivrTask);
    }
    /**
     * ä¿®æ”¹è¯­éŸ³ä»»åŠ¡
     *
     *
     * @param ivrTask è¯­éŸ³ä»»åŠ¡
     * @return ç»“æžœ
     */
    @Override
    public int updateIvrTask(IvrTask ivrTask)
    {
    public int updateIvrTask(IvrTask ivrTask) {
        ivrTask.setUpdateTime(DateUtils.getNowDate());
        return ivrTaskMapper.updateIvrTask(ivrTask);
    }
    /**
     * æ‰¹é‡åˆ é™¤è¯­éŸ³ä»»åŠ¡
     *
     *
     * @param taskids éœ€è¦åˆ é™¤çš„语音任务主键
     * @return ç»“æžœ
     */
    @Override
    public int deleteIvrTaskByTaskids(Long[] taskids)
    {
    public int deleteIvrTaskByTaskids(Long[] taskids) {
        return ivrTaskMapper.deleteIvrTaskByTaskids(taskids);
    }
    /**
     * åˆ é™¤è¯­éŸ³ä»»åŠ¡ä¿¡æ¯
     *
     *
     * @param taskid è¯­éŸ³ä»»åС䏻键
     * @return ç»“æžœ
     */
    @Transactional(rollbackFor = Exception.class)
    @Override
    public int deleteIvrTaskByTaskid(Long taskid)
    {
        return ivrTaskMapper.deleteIvrTaskByTaskid(taskid);
    public Boolean deleteIvrTaskByTaskid(Long taskid) {
        IvrTaskSingle ivrTaskcall = new IvrTaskSingle();
        ivrTaskcall.setTaskid(taskid);
        ivrTaskcall.setDelFlag("1");
        Boolean aBoolean = ivrTaskcallMapper.updateIvrTaskcall(ivrTaskcall);
        Boolean isSuccess = false;
        if (!aBoolean) {
            new BaseException("任务删除失败");
        }
        isSuccess = ivrTaskMapper.deleteIvrTaskByTaskid(taskid);
        return isSuccess;
    }
}
smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java
ÎļþÃû´Ó smartor/src/main/java/com/smartor/service/impl/IvrTaskcallServiceImpl.java ÐÞ¸Ä
@@ -1,5 +1,6 @@
package com.smartor.service.impl;
import com.alibaba.fastjson2.JSON;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
@@ -11,17 +12,13 @@
import com.smartor.config.PhoneUtils;
import com.smartor.config.RabbitMqConfig;
import com.smartor.domain.*;
import com.smartor.mapper.IvrLibaExtemplatescriptMapper;
import com.smartor.mapper.IvrLibaTemplateTargetoptionMapper;
import com.smartor.mapper.IvrTaskcallMapper;
import com.smartor.service.IIvrTaskcallService;
import com.smartor.mapper.*;
import com.smartor.service.IIvrTaskService;
import com.smartor.service.IIvrTaskSingleService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.amqp.AmqpException;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessagePostProcessor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -41,9 +38,12 @@
 */
@Slf4j
@Service
public class IvrTaskcallServiceImpl implements IIvrTaskcallService {
public class IvrTaskSingleServiceImpl implements IIvrTaskSingleService {
    @Autowired
    private IvrTaskcallMapper ivrTaskcallMapper;
    private IvrTaskSingleMapper ivrTaskSingleMapper;
    @Autowired
    private IIvrTaskService ivrTaskService;
    @Autowired
    private IvrLibaTemplateTargetoptionMapper ivrLibaScriptTargetoptionMapper;
@@ -58,6 +58,13 @@
    private RabbitTemplate rabbitTemplate;
    @Autowired
    private PatMedOuthospMapper patMedOuthospMapper;
    @Autowired
    private PatMedInhospMapper patMedInhospMapper;
    /**
     * æŸ¥è¯¢å•一任务(随访)
     *
@@ -65,8 +72,8 @@
     * @return å•一任务(随访)
     */
    @Override
    public IvrTaskcall selectIvrTaskcallById(Long id) {
        return ivrTaskcallMapper.selectIvrTaskcallById(id);
    public IvrTaskSingle selectIvrTaskcallById(Long id) {
        return ivrTaskSingleMapper.selectIvrTaskcallById(id);
    }
    /**
@@ -76,8 +83,46 @@
     * @return å•一任务(随访)
     */
    @Override
    public List<IvrTaskcall> selectIvrTaskcallList(IvrTaskcall ivrTaskcall) {
        return ivrTaskcallMapper.selectIvrTaskcallList(ivrTaskcall);
    public List<IvrTaskSingle> selectIvrTaskcallList(IvrTaskSingle ivrTaskcall) {
        return ivrTaskSingleMapper.selectIvrTaskcallList(ivrTaskcall);
    }
    @Override
    public List<IvrVisitInfoVo> patItem(IvrTaskSingle ivrTaskcall) {
        List<IvrTaskSingle> list = this.selectIvrTaskcallList(ivrTaskcall);
        //定义返参数据
        List<IvrVisitInfoVo> visitInfoVos = new ArrayList<>();
        for (IvrTaskSingle ivrTaskcall1 : list) {
            IvrVisitInfoVo ivrVisitInfoVo = DtoConversionUtils.sourceToTarget(ivrTaskcall1, IvrVisitInfoVo.class);
            ivrVisitInfoVo.setPatientName(ivrTaskcall1.getSendname());
            if (ivrTaskcall.getRecordid() != null) {
                if (ivrTaskcall1.getHospType().equals("1")) {
                    //门诊随访
                    PatMedOuthosp patMedOuthosp = patMedOuthospMapper.selectPatMedOuthospById(ivrTaskcall.getRecordid());
                    ivrVisitInfoVo.setDiagname(patMedOuthosp.getDiagname());
                    ivrVisitInfoVo.setDeptname(patMedOuthosp.getDeptname());
                    ivrVisitInfoVo.setAdmitdate(patMedOuthosp.getAdmitdate());
                    ivrVisitInfoVo.setVisitTime(ivrTaskcall1.getSendTimeSlot());
                    ivrVisitInfoVo.setState(ivrTaskcall1.getSendstate());
                    ivrVisitInfoVo.setHospno(patMedOuthosp.getOuthospno());
                    visitInfoVos.add(ivrVisitInfoVo);
                } else if (ivrTaskcall1.getHospType().equals("2")) {
                    //出院
                    PatMedInhosp patMedInhosp = patMedInhospMapper.selectPatMedInhospByInhospid(ivrTaskcall.getRecordid());
                    ivrVisitInfoVo.setDiagname(patMedInhosp.getDiagname());
                    ivrVisitInfoVo.setDeptname(patMedInhosp.getDeptname());
                    ivrVisitInfoVo.setAdmitdate(patMedInhosp.getStarttime());
                    ivrVisitInfoVo.setVisitTime(ivrTaskcall1.getSendTimeSlot());
                    ivrVisitInfoVo.setState(ivrTaskcall1.getSendstate());
                    ivrVisitInfoVo.setHospno(patMedInhosp.getInhospno());
                    ivrVisitInfoVo.setRoomno(patMedInhosp.getRoomno());
                    ivrVisitInfoVo.setBedno(patMedInhosp.getBedno());
                    visitInfoVos.add(ivrVisitInfoVo);
                }
            }
        }
        return visitInfoVos;
    }
    /**
@@ -87,9 +132,9 @@
     * @return ç»“æžœ
     */
    @Override
    public int insertIvrTaskcall(IvrTaskcall ivrTaskcall) {
    public int insertIvrTaskcall(IvrTaskSingle ivrTaskcall) {
        ivrTaskcall.setCreateTime(DateUtils.getNowDate());
        return ivrTaskcallMapper.insertIvrTaskcall(ivrTaskcall);
        return ivrTaskSingleMapper.insertIvrTaskcall(ivrTaskcall);
    }
    /**
@@ -99,9 +144,9 @@
     * @return ç»“æžœ
     */
    @Override
    public int updateIvrTaskcall(IvrTaskcall ivrTaskcall) {
    public Boolean updateIvrTaskcall(IvrTaskSingle ivrTaskcall) {
        ivrTaskcall.setUpdateTime(DateUtils.getNowDate());
        return ivrTaskcallMapper.updateIvrTaskcall(ivrTaskcall);
        return ivrTaskSingleMapper.updateIvrTaskcall(ivrTaskcall);
    }
    /**
@@ -114,7 +159,7 @@
    public int deleteIvrTaskcallByIds(Long[] ids) {
        Integer i = 0;
        for (Long id : ids) {
            i = ivrTaskcallMapper.deleteIvrTaskcallById(id);
            i = ivrTaskSingleMapper.deleteIvrTaskcallById(id);
        }
        return i;
    }
@@ -127,18 +172,23 @@
     */
    @Transactional(rollbackFor = Exception.class)
    @Override
    public int insertOrUpdateTask(IvrTaskcallVO ivrTaskcallVO) {
    public int insertOrUpdateTask(IvrTaskSingleVO ivrTaskcallVO) {
        if (ObjectUtils.isEmpty(ivrTaskcallVO)) {
            log.info("任务入参为空,请检查入参");
            throw new BaseException("任务入参为空,请检查入参");
        }
        Integer integer = 0;
        if (ivrTaskcallVO.getIsoperation() != null && ivrTaskcallVO.getIsoperation() == 1) {
            //往任务表中,新增任务
            IvrTask ivrTask = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTask.class);
            Integer taskId = ivrTaskService.insertIvrTask(ivrTask);
            ivrTaskcallVO.setTaskid(taskId.longValue());
            //新增
            if (CollectionUtils.isNotEmpty(ivrTaskcallVO.getPatTaskRelevances())) {
                for (PatTaskRelevance patTaskRelevance : ivrTaskcallVO.getPatTaskRelevances()) {
                    //将任务信息新增到宣教任务表中
                    IvrTaskcall ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTaskcall.class);
                    IvrTaskSingle ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTaskSingle.class);
                    ivrTaskcall.setSendname(patTaskRelevance.getName());
                    ivrTaskcall.setAge(patTaskRelevance.getAge());
                    ivrTaskcall.setSfzh(patTaskRelevance.getSfzh());
@@ -149,15 +199,20 @@
                    if (CollectionUtils.isNotEmpty(ivrTaskcallVO.getSendTimeslot())) {
                        ivrTaskcall.setSendTimeSlot(ivrTaskcallVO.getSendTimeslot().toString());
                    }
                    ivrTaskcallMapper.insertIvrTaskcall(ivrTaskcall);
                    ivrTaskSingleMapper.insertIvrTaskcall(ivrTaskcall);
                    integer = ivrTaskcall.getId().intValue();
                }
            }
        } else if (ivrTaskcallVO.getIsoperation() != null && ivrTaskcallVO.getIsoperation() == 2) {
            //任务修改
            IvrTask ivrTask = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTask.class);
            ivrTaskService.updateIvrTask(ivrTask);
            if (CollectionUtils.isNotEmpty(ivrTaskcallVO.getPatTaskRelevances())) {
                for (PatTaskRelevance patTaskRelevance : ivrTaskcallVO.getPatTaskRelevances()) {
                    IvrTaskcall ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTaskcall.class);
                    IvrTaskSingle ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTaskSingle.class);
                    ivrTaskcall.setSendname(patTaskRelevance.getName());
                    ivrTaskcall.setAge(patTaskRelevance.getAge());
                    ivrTaskcall.setSfzh(patTaskRelevance.getSfzh());
@@ -168,13 +223,14 @@
                        ivrTaskcall.setSendTimeSlot(ivrTaskcallVO.getSendTimeslot().toString());
                    }
                    ivrTaskcall.setTextParam(new Gson().toJson(ivrTaskcallVO.getTextParam()));
                    ivrTaskcallMapper.updateIvrTaskcall(ivrTaskcall);
                    if (patTaskRelevance.getIsoperation() == 2) ivrTaskSingleMapper.updateIvrTaskcall(ivrTaskcall);
                    if (patTaskRelevance.getIsoperation() == 1) ivrTaskSingleMapper.insertIvrTaskcall(ivrTaskcall);
                    integer = ivrTaskcall.getId().intValue();
                }
            }
        } else if (ivrTaskcallVO.getIsoperation() != null && ivrTaskcallVO.getIsoperation() == 3) {
            ivrTaskcallMapper.deleteIvrTaskcallById(ivrTaskcallVO.getId());
            ivrTaskSingleMapper.deleteIvrTaskcallById(ivrTaskcallVO.getId());
            integer = ivrTaskcallVO.getId().intValue();
        }
@@ -187,7 +243,7 @@
     * @return
     */
    @Override
    public int heTaskSend(IvrTaskcallVO ivrTaskcallVO) {
    public int heTaskSend(IvrTaskSingleVO ivrTaskcallVO) {
        //判断任务是否是立即发送
        if (ivrTaskcallVO.getSendType().equals("2") && ivrTaskcallVO.getSendstate() == 1) {
            IvrTaskcallMQ ivrTaskcallMQ = new IvrTaskcallMQ();
@@ -195,16 +251,19 @@
            ivrTaskcallMQ.setSendType("1");
            ivrTaskcallMQ.setTemplateid(ivrTaskcallVO.getTemplateid());
            String ivrTaskcallMQJson = JSON.toJSONString(ivrTaskcallMQ);
            ivrTaskcallMQJson = ivrTaskcallMQJson.substring(1, ivrTaskcallMQJson.length() - 1);
            //立即发送
            rabbitTemplate.convertAndSend(RabbitMqConfig.phone_exchange, RabbitMqConfig.routing_key, new Gson().toJson(ivrTaskcallMQ), message -> {
            rabbitTemplate.convertAndSend(RabbitMqConfig.phone_exchange, RabbitMqConfig.routing_key, ivrTaskcallMQJson, message -> {
                //注意这里时间可以使long,而且是设置header
                message.getMessageProperties().setHeader("x-delay", 0);
                return message;
            });
        } else if (ivrTaskcallVO.getSendType().equals("2") && ivrTaskcallVO.getSendstate() == 1) {
        } else if (ivrTaskcallVO.getSendType().equals("1") && ivrTaskcallVO.getSendstate() == 1) {
            //时间段发送
            if (CollectionUtils.isNotEmpty(ivrTaskcallVO.getSendTimeslot())) {
                for (TaskSendTimeVO taskSendTimeVO : ivrTaskcallVO.getSendTimeslot()) {
                    //去SendTimeslot中,获取所有的时间段
                    List<TaskSendTimeVO> list = new ArrayList<>();
                    list.add(taskSendTimeVO);
@@ -222,12 +281,14 @@
                    }
                    IvrTaskcallMQ ivrTaskcallMQ = new IvrTaskcallMQ();
                    ivrTaskcallMQ.setTaskid(ivrTaskcallVO.getTaskid());
                    ivrTaskcallMQ.setSendType("2");
                    ivrTaskcallMQ.setSendType("1");
                    ivrTaskcallMQ.setTemplateid(ivrTaskcallVO.getTemplateid());
                    ivrTaskcallMQ.setSendTimeslot(list);
                    Long finalMilliseconds = milliseconds;
                    rabbitTemplate.convertAndSend(RabbitMqConfig.phone_exchange, RabbitMqConfig.routing_key, new Gson().toJson(ivrTaskcallMQ), message -> {
                    String ivrTaskcallMQJson = JSON.toJSONString(ivrTaskcallMQ);
                    ivrTaskcallMQJson = ivrTaskcallMQJson.substring(1, ivrTaskcallMQJson.length() - 1);
                    rabbitTemplate.convertAndSend(RabbitMqConfig.phone_exchange, RabbitMqConfig.routing_key, ivrTaskcallMQJson, message -> {
                        //注意这里时间可以使long,而且是设置header
                        message.getMessageProperties().setHeader("x-delay", finalMilliseconds);
                        return message;
@@ -264,11 +325,11 @@
            e.printStackTrace();
        }
        IvrTaskcall ivrTaskcall = (IvrTaskcall) map.get("ivrTaskcall");
        IvrTaskSingle ivrTaskcall = (IvrTaskSingle) map.get("ivrTaskcall");
        List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVOs = (List<IvrLibaTemplateScriptVO>) map.get("ivrLibaTemplateScriptVO");
        //将uuid更新到数据库中
        ivrTaskcall.setSenduuid(phoneCallBackVO.getUuid());
        ivrTaskcallMapper.updateIvrTaskcall(ivrTaskcall);
        ivrTaskSingleMapper.updateIvrTaskcall(ivrTaskcall);
        //获取模板信息
        IvrLibaTemplateVO ivrLibaTemplateVO = redisCache.getCacheObject(phoneCallBackVO.getUuid() + "ivrLibaTemplateVO");
@@ -290,7 +351,7 @@
                    log.info("无人接听:{},   {}", phoneCallBackVO.getErrResult(), phoneCallBackVO.getUuid());
                    //连续打规定次,如果要没人接,那就结束
                    ivrTaskcall.setResult(phoneCallBackVO.getErrResult());
                    ivrTaskcallMapper.updateIvrTaskcall(ivrTaskcall);
                    ivrTaskSingleMapper.updateIvrTaskcall(ivrTaskcall);
                    redisCache.deleteObject(phoneCallBackVO.getUuid() + "uint8");
                } else if (integer != null && integer < ivrTaskcall.getRecallcount().intValue()) {
                    //进行重拨
@@ -311,14 +372,14 @@
                    redisCache.setCacheObject(phoneCallBackVO.getUuid() + "enumState", 1, 120, TimeUnit.MINUTES);
                } else if (integer != null && integer == ivrTaskcall.getRecallcount().intValue()) {
                    ivrTaskcall.setResult("无人接听");
                    ivrTaskcallMapper.updateIvrTaskcall(ivrTaskcall);
                    ivrTaskSingleMapper.updateIvrTaskcall(ivrTaskcall);
                    redisCache.deleteObject(phoneCallBackVO.getUuid() + "enumState");
                }
            } else if (phoneCallBackVO.getEnumState() == 2) {
                //患者挂断电话
                log.info("患者挂断电话:{}", phoneCallBackVO.getUuid());
                ivrTaskcall.setResult(phoneCallBackVO.getHangUpResult());
                ivrTaskcallMapper.updateIvrTaskcall(ivrTaskcall);
                ivrTaskSingleMapper.updateIvrTaskcall(ivrTaskcall);
                redisCache.deleteObject(phoneCallBackVO.getUuid() + "enumState");
            }
smartor/src/main/resources/mapper/smartor/IvrTaskMapper.xml
@@ -1,82 +1,118 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.smartor.mapper.IvrTaskMapper">
    <resultMap type="IvrTask" id="IvrTaskResult">
        <result property="taskid"    column="taskid"    />
        <result property="taskname"    column="taskname"    />
        <result property="templateid"    column="templateid"    />
        <result property="templatename"    column="templatename"    />
        <result property="labelinfo"    column="labelinfo"    />
        <result property="state"    column="state"    />
        <result property="count"    column="count"    />
        <result property="executed"    column="executed"    />
        <result property="unexecuted"    column="unexecuted"    />
        <result property="fail"    column="fail"    />
        <result property="userid"    column="userid"    />
        <result property="username"    column="username"    />
        <result property="addtime"    column="addtime"    />
        <result property="checkuserid"    column="checkuserid"    />
        <result property="checkusername"    column="checkusername"    />
        <result property="checktime"    column="checktime"    />
        <result property="type"    column="type"    />
        <result property="typename"    column="typename"    />
        <result property="usebqsms"    column="usebqsms"    />
        <result property="usebhsms"    column="usebhsms"    />
        <result property="usesendsms"    column="usesendsms"    />
        <result property="deptcode"    column="deptcode"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="isupload"    column="isupload"    />
        <result property="uploadTime"    column="upload_time"    />
        <result property="orgid"    column="orgid"    />
    <resultMap type="com.smartor.domain.IvrTask" id="IvrTaskResult">
        <result property="taskid" column="taskid"/>
        <result property="taskname" column="taskname"/>
        <result property="templateid" column="templateid"/>
        <result property="templatename" column="templatename"/>
        <result property="labelinfo" column="labelinfo"/>
        <result property="state" column="state"/>
        <result property="count" column="count"/>
        <result property="executed" column="executed"/>
        <result property="unexecuted" column="unexecuted"/>
        <result property="fail" column="fail"/>
        <result property="userid" column="userid"/>
        <result property="username" column="username"/>
        <result property="addtime" column="addtime"/>
        <result property="checkuserid" column="checkuserid"/>
        <result property="checkusername" column="checkusername"/>
        <result property="checktime" column="checktime"/>
        <result property="type" column="type"/>
        <result property="typename" column="typename"/>
        <result property="usebqsms" column="usebqsms"/>
        <result property="usebhsms" column="usebhsms"/>
        <result property="usesendsms" column="usesendsms"/>
        <result property="deptcode" column="deptcode"/>
        <result property="delFlag" column="del_flag"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="isupload" column="isupload"/>
        <result property="uploadTime" column="upload_time"/>
        <result property="orgid" column="orgid"/>
    </resultMap>
    <sql id="selectIvrTaskVo">
        select taskid, taskname, templateid, templatename, labelinfo, state, count, executed, unexecuted, fail, userid, username, addtime, checkuserid, checkusername, checktime, type, typename, usebqsms, usebhsms, usesendsms, deptcode, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time, orgid from ivr_task
        select taskid,
               taskname,
               templateid,
               templatename,
               labelinfo,
               state,
               count,
               executed,
               unexecuted,
               fail,
               userid,
               username,
               addtime,
               checkuserid,
               checkusername,
               checktime,
               type,
               typename,
               usebqsms,
               usebhsms,
               usesendsms,
               deptcode,
               del_flag,
               update_by,
               update_time,
               create_by,
               create_time,
               isupload,
               upload_time,
               orgid
        from ivr_task
    </sql>
    <select id="selectIvrTaskList" parameterType="IvrTask" resultMap="IvrTaskResult">
    <select id="selectIvrTaskList" parameterType="com.smartor.domain.IvrTask" resultMap="IvrTaskResult">
        <include refid="selectIvrTaskVo"/>
        <where>
            <if test="taskname != null  and taskname != ''"> and taskname like concat('%', #{taskname}, '%')</if>
            <if test="templateid != null  and templateid != ''"> and templateid = #{templateid}</if>
            <if test="templatename != null  and templatename != ''"> and templatename like concat('%', #{templatename}, '%')</if>
            <if test="labelinfo != null  and labelinfo != ''"> and labelinfo = #{labelinfo}</if>
            <if test="state != null "> and state = #{state}</if>
            <if test="count != null "> and count = #{count}</if>
            <if test="executed != null "> and executed = #{executed}</if>
            <if test="unexecuted != null "> and unexecuted = #{unexecuted}</if>
            <if test="fail != null "> and fail = #{fail}</if>
            <if test="userid != null  and userid != ''"> and userid = #{userid}</if>
            <if test="username != null  and username != ''"> and username like concat('%', #{username}, '%')</if>
            <if test="addtime != null "> and addtime = #{addtime}</if>
            <if test="checkuserid != null  and checkuserid != ''"> and checkuserid = #{checkuserid}</if>
            <if test="checkusername != null  and checkusername != ''"> and checkusername like concat('%', #{checkusername}, '%')</if>
            <if test="checktime != null "> and checktime = #{checktime}</if>
            <if test="type != null  and type != ''"> and type = #{type}</if>
            <if test="typename != null  and typename != ''"> and typename like concat('%', #{typename}, '%')</if>
            <if test="usebqsms != null "> and usebqsms = #{usebqsms}</if>
            <if test="usebhsms != null "> and usebhsms = #{usebhsms}</if>
            <if test="usesendsms != null "> and usesendsms = #{usesendsms}</if>
            <if test="deptcode != null  and deptcode != ''"> and deptcode = #{deptcode}</if>
            <if test="isupload != null "> and isupload = #{isupload}</if>
            <if test="uploadTime != null "> and upload_time = #{uploadTime}</if>
            <if test="orgid != null  and orgid != ''"> and orgid = #{orgid}</if>
        <where>
            <if test="taskname != null  and taskname != ''">and taskname like concat('%', #{taskname}, '%')</if>
            <if test="templateid != null  and templateid != ''">and templateid = #{templateid}</if>
            <if test="templatename != null  and templatename != ''">and templatename like concat('%', #{templatename},
                '%')
            </if>
            <if test="labelinfo != null  and labelinfo != ''">and labelinfo = #{labelinfo}</if>
            <if test="state != null ">and state = #{state}</if>
            <if test="count != null ">and count = #{count}</if>
            <if test="executed != null ">and executed = #{executed}</if>
            <if test="unexecuted != null ">and unexecuted = #{unexecuted}</if>
            <if test="fail != null ">and fail = #{fail}</if>
            <if test="userid != null  and userid != ''">and userid = #{userid}</if>
            <if test="username != null  and username != ''">and username like concat('%', #{username}, '%')</if>
            <if test="addtime != null ">and addtime = #{addtime}</if>
            <if test="checkuserid != null  and checkuserid != ''">and checkuserid = #{checkuserid}</if>
            <if test="checkusername != null  and checkusername != ''">and checkusername like concat('%',
                #{checkusername}, '%')
            </if>
            <if test="checktime != null ">and checktime = #{checktime}</if>
            <if test="type != null  and type != ''">and type = #{type}</if>
            <if test="typename != null  and typename != ''">and typename like concat('%', #{typename}, '%')</if>
            <if test="usebqsms != null ">and usebqsms = #{usebqsms}</if>
            <if test="usebhsms != null ">and usebhsms = #{usebhsms}</if>
            <if test="usesendsms != null ">and usesendsms = #{usesendsms}</if>
            <if test="deptcode != null  and deptcode != ''">and deptcode = #{deptcode}</if>
            <if test="isupload != null ">and isupload = #{isupload}</if>
            <if test="uploadTime != null ">and upload_time = #{uploadTime}</if>
            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
        </where>
        order by upeate_time desc,taskid desc
    </select>
    <select id="selectIvrTaskByTaskid" parameterType="Long" resultMap="IvrTaskResult">
        <include refid="selectIvrTaskVo"/>
        where taskid = #{taskid}
    </select>
    <insert id="insertIvrTask" parameterType="IvrTask">
    <insert id="insertIvrTask" parameterType="com.smartor.domain.IvrTask" useGeneratedKeys="true"
            keyProperty="taskid">
        insert into ivr_task
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="taskid != null">taskid,</if>
@@ -109,7 +145,7 @@
            <if test="isupload != null">isupload,</if>
            <if test="uploadTime != null">upload_time,</if>
            <if test="orgid != null">orgid,</if>
         </trim>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="taskid != null">#{taskid},</if>
            <if test="taskname != null">#{taskname},</if>
@@ -141,10 +177,10 @@
            <if test="isupload != null">#{isupload},</if>
            <if test="uploadTime != null">#{uploadTime},</if>
            <if test="orgid != null">#{orgid},</if>
         </trim>
        </trim>
    </insert>
    <update id="updateIvrTask" parameterType="IvrTask">
    <update id="updateIvrTask" parameterType="com.smartor.domain.IvrTask">
        update ivr_task
        <trim prefix="SET" suffixOverrides=",">
            <if test="taskname != null">taskname = #{taskname},</if>
@@ -180,14 +216,22 @@
        where taskid = #{taskid}
    </update>
    <delete id="deleteIvrTaskByTaskid" parameterType="Long">
        delete from ivr_task where taskid = #{taskid}
    </delete>
    <update id="deleteIvrTaskByTaskid" parameterType="Long">
        update ivr_task
        <trim prefix="SET" suffixOverrides=",">
            del_flag =1
        </trim>
        where taskid = #{taskid}
    </update>
    <delete id="deleteIvrTaskByTaskids" parameterType="String">
        delete from ivr_task where taskid in
    <update id="deleteIvrTaskByTaskids" parameterType="String">
        update ivr_task
        <trim prefix="SET" suffixOverrides=",">
            del_flag =1
        </trim>
        where taskid in
        <foreach item="taskid" collection="array" open="(" separator="," close=")">
            #{taskid}
        </foreach>
    </delete>
</mapper>
    </update>
</mapper>
smartor/src/main/resources/mapper/smartor/IvrTaskSingleMapper.xml
ÎļþÃû´Ó smartor/src/main/resources/mapper/smartor/IvrTaskcallMapper.xml ÐÞ¸Ä
@@ -2,9 +2,9 @@
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.smartor.mapper.IvrTaskcallMapper">
<mapper namespace="com.smartor.mapper.IvrTaskSingleMapper">
    <resultMap type="com.smartor.domain.IvrTaskcall" id="IvrTaskcallResult">
    <resultMap type="com.smartor.domain.IvrTaskSingle" id="IvrTaskcallResult">
        <result property="id" column="id"/>
        <result property="sendname" column="sendname"/>
        <result property="phone" column="phone"/>
@@ -57,11 +57,19 @@
        <result property="preachcontent" column="preachcontent"/>
        <result property="sendType" column="send_type"/>
        <result property="sendTimeSlot" column="send_time_slot"/>
        <result property="taskName" column="task_name"/>
        <result property="taskDesc" column="task_desc"/>
        <result property="operator" column="operator"/>
        <result property="operatorNo" column="operator_no"/>
        <result property="hospno" column="hospno"/>
        <result property="hospType" column="hosp_type"/>
    </resultMap>
    <sql id="selectIvrTaskcallVo">
        select id,
               sendname,
               hosp_type,
               hospno,
               phone,
               sex,
               age,
@@ -111,11 +119,15 @@
               send_type,
               medical_record_no,
               send_time_slot,
               task_name,
               task_desc,
               operator_no,
               operator,
               preachcontent
        from ivr_taskcall
    </sql>
    <select id="selectIvrTaskcallList" parameterType="com.smartor.domain.IvrTaskcall" resultMap="IvrTaskcallResult">
    <select id="selectIvrTaskcallList" parameterType="com.smartor.domain.IvrTaskSingle" resultMap="IvrTaskcallResult">
        <include refid="selectIvrTaskcallVo"/>
        <where>
            <if test="sendname != null  and sendname != ''">and sendname like concat('%', #{sendname}, '%')</if>
@@ -166,7 +178,10 @@
            </if>
            <if test="preachcontent != null  and preachcontent != ''">and preachcontent = #{preachcontent}</if>
            <if test="sendType != null  and sendType != ''">and send_type = #{sendType}</if>
            <if test="operator != null  and operator != ''">and operator = #{operator}</if>
            <if test="operatorNo != null  and operatorNo != ''">and operator_no = #{operatorNo}</if>
        </where>
        order by update_time desc,id desc
    </select>
    <select id="selectIvrTaskcallById" parameterType="Long" resultMap="IvrTaskcallResult">
@@ -174,7 +189,8 @@
        where id = #{id}
    </select>
    <insert id="insertIvrTaskcall" parameterType="com.smartor.domain.IvrTaskcall"  useGeneratedKeys="true" keyProperty="id">
    <insert id="insertIvrTaskcall" parameterType="com.smartor.domain.IvrTaskSingle" useGeneratedKeys="true"
            keyProperty="id">
        insert into ivr_taskcall
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="sendname != null">sendname,</if>
@@ -227,6 +243,12 @@
            <if test="medicalRecordNo != null  and medicalRecordNo != ''">medical_record_no,</if>
            <if test="preachcontent != null  and preachcontent != ''">preachcontent,</if>
            <if test="sendType != null  and sendType != ''">send_type,</if>
            <if test="taskName != null  and taskName != ''">task_name,</if>
            <if test="taskDesc != null  and taskDesc != ''">task_desc,</if>
            <if test="operator != null  and operator != ''">operator,</if>
            <if test="operatorNo != null  and operatorNo != ''">operator_no,</if>
            <if test="hospType != null  and hospType != ''">hosp_type,</if>
            <if test="hospno != null  and hospno != ''">hospno,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="sendname != null">#{sendname},</if>
@@ -279,10 +301,16 @@
            <if test="medicalRecordNo != null  and medicalRecordNo != ''">#{medicalRecordNo},</if>
            <if test="preachcontent != null  and preachcontent != ''">#{preachcontent},</if>
            <if test="sendType != null  and sendType != ''">#{sendType},</if>
            <if test="taskName != null  and taskName != ''">#{taskName},</if>
            <if test="taskDesc != null  and taskDesc != ''">#{taskDesc},</if>
            <if test="operator != null  and operator != ''">#{operator},</if>
            <if test="operatorNo != null  and operatorNo != ''">#{operatorNo},</if>
            <if test="hospType != null  and hospType != ''">#{hospType},</if>
            <if test="hospno != null  and hospno != ''">#{hospno},</if>
        </trim>
    </insert>
    <update id="updateIvrTaskcall" parameterType="com.smartor.domain.IvrTaskcall">
    <update id="updateIvrTaskcall" parameterType="com.smartor.domain.IvrTaskSingle">
        update ivr_taskcall
        <trim prefix="SET" suffixOverrides=",">
            <if test="sendname != null">sendname = #{sendname},</if>
@@ -335,6 +363,12 @@
            <if test="medicalRecordNo != null  and medicalRecordNo != ''">medical_record_no = #{medicalRecordNo},</if>
            <if test="preachcontent != null  and preachcontent != ''">preachcontent = #{preachcontent},</if>
            <if test="sendType != null  and sendType != ''">send_type = #{sendType},</if>
            <if test="taskName != null  and taskName != ''">task_name = #{taskName},</if>
            <if test="taskDesc != null  and taskDesc != ''">task_desc = #{taskDesc},</if>
            <if test="operatorNo != null  and operatorNo != ''">operator_no = #{operatorNo},</if>
            <if test="operator != null  and operator != ''">operator = #{operator},</if>
            <if test="hospType != null  and hospType != ''">hosp_type = #{hospType},</if>
            <if test="hospno != null  and hospno != ''">hospno = #{hospno},</if>
        </trim>
        where id = #{id}
    </update>
@@ -400,6 +434,12 @@
               send_type,
               medical_record_no,
               preachcontent,
               task_name,
               task_desc,
               operator_no,
               operator,
               hospno,
               hosp_type,
               send_time_slot
        FROM ivr_taskcall,
             JSON_TABLE(send_time_slot, '$[*]' COLUMNS (
@@ -412,4 +452,4 @@
    </select>
</mapper>
</mapper>
smartor/src/main/resources/mapper/smartor/PatMedOuthospMapper.xml
@@ -1,58 +1,90 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.smartor.mapper.PatMedOuthospMapper">
    <resultMap type="PatMedOuthosp" id="PatMedOuthospResult">
        <result property="id"    column="id"    />
        <result property="serialnum"    column="serialnum"    />
        <result property="patid"    column="patid"    />
        <result property="hospitalname"    column="hospitalname"    />
        <result property="hospitalcode"    column="hospitalcode"    />
        <result property="icd10code"    column="icd10code"    />
        <result property="diagname"    column="diagname"    />
        <result property="deptcode"    column="deptcode"    />
        <result property="deptname"    column="deptname"    />
        <result property="drcode"    column="drcode"    />
        <result property="drname"    column="drname"    />
        <result property="admitdate"    column="admitdate"    />
        <result property="orgid"    column="orgid"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="isupload"    column="isupload"    />
        <result property="uploadTime"    column="upload_time"    />
        <result property="schemestatus"    column="schemestatus"    />
        <result property="deptid"    column="deptid"    />
        <result property="schemetime"    column="schemetime"    />
        <result property="hpi"    column="hpi"    />
        <result property="mainsuit"    column="mainsuit"    />
    <resultMap type="com.smartor.domain.PatMedOuthosp" id="PatMedOuthospResult">
        <result property="id" column="id"/>
        <result property="serialnum" column="serialnum"/>
        <result property="patid" column="patid"/>
        <result property="hospitalname" column="hospitalname"/>
        <result property="hospitalcode" column="hospitalcode"/>
        <result property="icd10code" column="icd10code"/>
        <result property="diagname" column="diagname"/>
        <result property="deptcode" column="deptcode"/>
        <result property="deptname" column="deptname"/>
        <result property="drcode" column="drcode"/>
        <result property="drname" column="drname"/>
        <result property="admitdate" column="admitdate"/>
        <result property="orgid" column="orgid"/>
        <result property="delFlag" column="del_flag"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="isupload" column="isupload"/>
        <result property="uploadTime" column="upload_time"/>
        <result property="schemestatus" column="schemestatus"/>
        <result property="deptid" column="deptid"/>
        <result property="schemetime" column="schemetime"/>
        <result property="hpi" column="hpi"/>
        <result property="mainsuit" column="mainsuit"/>
        <result property="outhospno" column="outhospno"/>
    </resultMap>
    <sql id="selectPatMedOuthospVo">
        select id, serialnum, patid, hospitalname, hospitalcode, icd10code, diagname, deptcode, deptname, drcode, drname, admitdate, orgid, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time, schemestatus, deptid, schemetime, hpi, mainsuit from pat_med_outhosp
        select id,
               outhospno,
               serialnum,
               patid,
               hospitalname,
               hospitalcode,
               icd10code,
               diagname,
               deptcode,
               deptname,
               drcode,
               drname,
               admitdate,
               orgid,
               del_flag,
               update_by,
               update_time,
               create_by,
               create_time,
               isupload,
               upload_time,
               schemestatus,
               deptid,
               schemetime,
               hpi,
               mainsuit
        from pat_med_outhosp
    </sql>
    <select id="selectPatMedOuthospList" parameterType="PatMedOuthosp" resultMap="PatMedOuthospResult">
    <select id="selectPatMedOuthospList" parameterType="com.smartor.domain.PatMedOuthosp"
            resultMap="PatMedOuthospResult">
        <include refid="selectPatMedOuthospVo"/>
        <where>
            <if test="hospitalname != null  and hospitalname != ''"> and hospitalname like concat('%', #{hospitalname}, '%')</if>
            <if test="deptname != null  and deptname != ''"> and deptname like concat('%', #{deptname}, '%')</if>
            <if test="drname != null  and drname != ''"> and drname like concat('%', #{drname}, '%')</if>
            <if test="admitdate != null "> and admitdate = #{admitdate}</if>
            <if test="orgid != null  and orgid != ''"> and orgid = #{orgid}</if>
        <where>
            <if test="hospitalname != null  and hospitalname != ''">and hospitalname like concat('%', #{hospitalname},
                '%')
            </if>
            <if test="deptname != null  and deptname != ''">and deptname like concat('%', #{deptname}, '%')</if>
            <if test="drname != null  and drname != ''">and drname like concat('%', #{drname}, '%')</if>
            <if test="admitdate != null ">and admitdate = #{admitdate}</if>
            <if test="orgid != null  and orgid != ''">and orgid = #{orgid}</if>
            <if test="outhospno != null  and outhospno != ''">and outhospno = #{outhospno}</if>
        </where>
    </select>
    <select id="selectPatMedOuthospById" parameterType="Long" resultMap="PatMedOuthospResult">
        <include refid="selectPatMedOuthospVo"/>
        where id = #{id}
    </select>
    <insert id="insertPatMedOuthosp" parameterType="PatMedOuthosp" useGeneratedKeys="true" keyProperty="id">
    <insert id="insertPatMedOuthosp" parameterType="com.smartor.domain.PatMedOuthosp" useGeneratedKeys="true"
            keyProperty="id">
        insert into pat_med_outhosp
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="serialnum != null">serialnum,</if>
@@ -79,7 +111,8 @@
            <if test="schemetime != null">schemetime,</if>
            <if test="hpi != null">hpi,</if>
            <if test="mainsuit != null">mainsuit,</if>
         </trim>
            <if test="outhospno != null">outhospno,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="serialnum != null">#{serialnum},</if>
            <if test="patid != null">#{patid},</if>
@@ -105,10 +138,11 @@
            <if test="schemetime != null">#{schemetime},</if>
            <if test="hpi != null">#{hpi},</if>
            <if test="mainsuit != null">#{mainsuit},</if>
         </trim>
            <if test="outhospno != null">#{outhospno},</if>
        </trim>
    </insert>
    <update id="updatePatMedOuthosp" parameterType="PatMedOuthosp">
    <update id="updatePatMedOuthosp" parameterType="com.smartor.domain.PatMedOuthosp">
        update pat_med_outhosp
        <trim prefix="SET" suffixOverrides=",">
            <if test="serialnum != null">serialnum = #{serialnum},</if>
@@ -135,18 +169,21 @@
            <if test="schemetime != null">schemetime = #{schemetime},</if>
            <if test="hpi != null">hpi = #{hpi},</if>
            <if test="mainsuit != null">mainsuit = #{mainsuit},</if>
            <if test="outhospno != null">outhospno = #{outhospno},</if>
        </trim>
        where id = #{id}
    </update>
    <delete id="deletePatMedOuthospById" parameterType="Long">
        delete from pat_med_outhosp where id = #{id}
        delete
        from pat_med_outhosp
        where id = #{id}
    </delete>
    <delete id="deletePatMedOuthospByIds" parameterType="String">
        delete from pat_med_outhosp where id in
        delete from pat_med_outhosp where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
</mapper>