liusheng
2024-06-05 2cba0d00dc45998105129a0c26cb546282cd39a8
随访功能测试:模板、任务、定时发送、公众号发送,流程走通
已添加5个文件
已修改34个文件
1291 ■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/web/component/RabbitMqReceiver.java 75 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/HeTaskController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaTemplateController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskController.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskSingleController.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/tools/WeChatController.java 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/test/MQTest.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application-druid.yml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application.yml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/enums/ServiceFromEnum.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/utils/RSAPublicKeyExample.java 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/common/SendService.java 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/config/RabbitMQAckConfig.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/config/RabbitMqCallPhoneConfig.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrLibaTemplate.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrTask.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrTaskScriptQues.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrTaskSingle.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrTaskSingleVO.java 107 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrTaskVO.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrTaskcallMQ.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/PatArchiveReq.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/SendMagParam.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/SendTaskVO.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/TestVo.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/mapper/IvrTaskSingleMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IIvrTaskService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IIvrTaskSingleService.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/WeChatService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/HeTaskSingleServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/IvrTaskServiceImpl.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java 120 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/WeChatServiceImpl.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrLibaTemplateMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrTaskMapper.xml 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrTaskSingleMapper.xml 114 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/component/RabbitMqReceiver.java
@@ -1,10 +1,12 @@
package com.ruoyi.web.component;
import com.alibaba.fastjson2.JSON;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.rabbitmq.client.Channel;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.ServiceFromEnum;
import com.ruoyi.common.utils.RSAPublicKeyExample;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.web.task.PhoneTask;
import com.smartor.common.SendService;
@@ -27,7 +29,9 @@
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -37,6 +41,12 @@
    @Value("${phonePath}")
    private String phonePath;
    @Value("${pub_key}")
    private String pub_key;
    @Value("${req_path}")
    private String req_path;
    private static IIvrTaskTemplateService ivrTaskTemplateService;
@@ -51,6 +61,7 @@
    private static RabbitMqCallPhoneConfig rabbitMqCallPhoneConfig;
    private static RobotPhoneUtils robotPhoneUtils;
    // åˆ›å»ºå›ºå®šå¤§å°çš„线程池
    private static final ExecutorService executorService = Executors.newFixedThreadPool(10);
@@ -96,7 +107,7 @@
     */
    @RabbitListener(queues = "task_queue", concurrency = "50")
    public void phoneVisit(String content, Message message, Channel channel) throws IOException {
        log.error("消息进来了--------------");
        try {
            IvrTaskcallMQ ivrTaskcallMQ = null;
@@ -118,34 +129,68 @@
                return;
            }
            if (StringUtils.isNotEmpty(ivrTaskcallMQ.getServicefrom())) {
            if (StringUtils.isNotEmpty(ivrTaskcallMQ.getPreachform())) {
                //如何任务发送方式不为空
                String[] split = ivrTaskcallMQ.getServicefrom().split(",");
                String[] split = ivrTaskcallMQ.getPreachform().split(",");
                for (String serviceFrom : split) {
                    String descByCode = ServiceFromEnum.getDescByCode(Integer.valueOf(serviceFrom));
                    //这里可以考虑用策略模式优化一下,不然太难看了
                    //通过模板ID获取模板问题
                    IvrTaskTemplateVO ivrTaskTemplateVO = new IvrTaskTemplateVO();
                    ivrTaskTemplateVO.setID(Long.valueOf(ivrTaskcallMQ.getTemplateid()));
                    IvrTaskTemplateVO ivrTaskTemplateVO1 = ivrTaskTemplateService.selectInfoByCondition(ivrTaskTemplateVO);
                    //通过任务ID拿到患者信息
                    IvrTaskSingle ivrTaskcall = new IvrTaskSingle();
                    ivrTaskcall.setTaskid(ivrTaskcallMQ.getTaskid());
                    List<IvrTaskSingle> ivrTaskcalls = ivrTaskcallMapper.selectIvrTaskcallList(ivrTaskcall);
                    if (descByCode.equals("电话")) {
                        //通过模板ID获取模板问题
                        IvrTaskTemplateVO ivrTaskTemplateVO = new IvrTaskTemplateVO();
                        ivrTaskTemplateVO.setID(Long.valueOf(ivrTaskcallMQ.getTemplateid()));
                        IvrTaskTemplateVO ivrTaskTemplateVO1 = ivrTaskTemplateService.selectInfoByCondition(ivrTaskTemplateVO);
                        //通过任务ID拿到患者信息
                        IvrTaskSingle ivrTaskcall = new IvrTaskSingle();
                        ivrTaskcall.setTaskid(ivrTaskcallMQ.getTaskid());
                        List<IvrTaskSingle> ivrTaskcalls = ivrTaskcallMapper.selectIvrTaskcallList(ivrTaskcall);
                        for (IvrTaskSingle ivrTaskcall1 : ivrTaskcalls) {
                            IvrTask ivrTask = ivrTaskMapper.selectIvrTaskByTaskid(ivrTaskcall1.getTaskid());
                            if (StringUtils.isNotEmpty(ivrTask.getSendState()) && ivrTask.getSendState().equals(3) || StringUtils.isNotEmpty(ivrTask.getSendState()) && ivrTask.getSendState().equals(4)) {
                            if (ivrTask.getSendState() != null && ivrTask.getSendState() == 3 || ivrTask.getSendState() != null && ivrTask.getSendState() == 4) {
                                //如何任务被“暂停”或“终止”
                                break;
                            }
                            //通过多线程的方式去打电话
                            executorService.submit(new PhoneTask(ivrTaskcall1, ivrTaskTemplateVO1, redisCache, rabbitMqCallPhoneConfig, message, sendService, phonePath, robotPhoneUtils));
                        }
                    } else if (descByCode.equals("公众号")) {
                    } else if (descByCode.equals("多媒体")) {
                        //多媒体
                    } else if (descByCode.equals("纸质")) {
                        //纸质
                    } else if (descByCode.equals("短信")) {
                        //短信
//                        http://localhost:8099/followvisit/particty?param1=3&param2=348
                        //对url中两个参数加密
                        RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
                        String taskId = rsaPublicKeyExample.encryptedData(ivrTask1.getTaskid().toString(), pub_key);
                        for (IvrTaskSingle ivrTaskSingle : ivrTaskcalls) {
                            String patid = rsaPublicKeyExample.encryptedData(ivrTaskSingle.getPatid().toString(), pub_key);
                            SendMagParam sendMagParam = new SendMagParam();
                            sendMagParam.setType("4");
                            sendMagParam.setUrl("192.168.2.10:8099/followvisit/particty?param1=" + taskId + "&param2=" + patid);
                            sendService.sendMsg(sendMagParam);
                        }
                    } else if (descByCode.equals("公众号")) {
                        //公众号
                        RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
                        String taskId = rsaPublicKeyExample.encryptedData(ivrTask1.getTaskid().toString(), pub_key);
                        for (IvrTaskSingle ivrTaskSingle : ivrTaskcalls) {
                            String patid = rsaPublicKeyExample.encryptedData(ivrTaskSingle.getPatid().toString(), pub_key);
                            SendMagParam sendMagParam = new SendMagParam();
                            sendMagParam.setType("5");
                            sendMagParam.setUrl(req_path + "/outsideChain?param1=" + taskId + "&param2=" + patid + "&param3=" + ivrTask1.getTaskName());
                            log.info("链接完整路径:{}", req_path + "/outsideChain?param1=" + taskId + "&param2=" + patid + "&param3=" + ivrTask1.getTaskName());
                            //这个模板ID先写死,后面做成可选
                            sendMagParam.setTmpCode("oG3pJHPVWpE81DmZsua_2tKwgJ97r0qz37z56ns7NB4");
                            Map map = new HashMap();
                            map.put("first", ivrTask1.getTaskName());
                            sendMagParam.setContent(JSON.toJSONString(map));
                            sendService.sendMsg(sendMagParam);
                        }
                    }
                    //通知 MQ æ¶ˆæ¯å·²è¢«æŽ¥æ”¶,可以ACK(从队列中删除)了   ï¼ˆè¿™ä¸ªéœ€è¦æ ¹æ®ä¸šåŠ¡å†åŽ»å¤„ç†ACK)
                    channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/HeTaskController.java
@@ -1,15 +1,13 @@
package com.ruoyi.web.controller.smartor;
import com.github.pagehelper.ISelect;
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.PageUtils;
import com.smartor.domain.HeTask;
import com.smartor.domain.HeTaskVO;
import com.smartor.domain.PatArchiveReq;
import com.smartor.domain.PatTaskRelevanceVO;
import com.smartor.domain.*;
import com.smartor.service.IHeTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -106,8 +104,14 @@
    @PostMapping("/getPatientInfo")
    public TableDataInfo getPatientInfo(@RequestBody PatArchiveReq patArchiveReq) {
        PageUtils.startPageByPost(patArchiveReq.getPageNum(), patArchiveReq.getPageSize());
        return getDataTable(heTaskService.getPatientInfo(patArchiveReq));
        List<PatTaskRelevance> patientInfo = heTaskService.getPatientInfo(patArchiveReq);
        long count = PageUtils.count(new ISelect() {
            @Override
            public void doSelect() {
                heTaskService.getPatientInfo(patArchiveReq);
            }
        });
        return getDataTable2(count, patientInfo);
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrLibaTemplateController.java
@@ -8,6 +8,7 @@
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.smartor.config.PhoneUtils;
import com.smartor.config.RabbitMqCallPhoneConfig;
@@ -56,7 +57,8 @@
    @PreAuthorize("@ss.hasPermi('smartor:template:list')")
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody IvrLibaTemplate ivrLibaTemplate) {
        startPage();
        //分页
        PageUtils.startPageByPost(ivrLibaTemplate.getPageNum(), ivrLibaTemplate.getPageSize());
        List<IvrLibaTemplate> list = ivrLibaTemplateService.selectIvrLibaTemplateList(ivrLibaTemplate);
        return getDataTable(list);
    }
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskController.java
@@ -1,5 +1,6 @@
package com.ruoyi.web.controller.smartor;
import com.github.pagehelper.ISelect;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.HttpStatus;
@@ -9,16 +10,20 @@
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.RSAPublicKeyExample;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.smartor.domain.IvrTask;
import com.smartor.domain.IvrTaskScriptQues;
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 lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
@@ -32,6 +37,7 @@
 * @author smartor
 * @date 2023-03-24
 */
@Slf4j
@Api(description = "随访任务")
@RestController
@RequestMapping("/smartor/ivrtask")
@@ -41,6 +47,12 @@
    @Autowired
    private IIvrTaskSingleService iIvrTaskCallService;
    @Value("${pub_key}")
    private String pub_key;
    @Value("${pri_key}")
    private String pri_key;
    /**
     * æŸ¥è¯¢è¯­éŸ³ä»»åŠ¡åˆ—è¡¨
@@ -52,13 +64,6 @@
        PageUtils.startPageByPost(ivrTask.getPageNum(), ivrTask.getPageSize());
        List<IvrTask> list = ivrTaskService.selectIvrTaskList(ivrTask);
        List<IvrTaskVO> ivrTaskVOS = DtoConversionUtils.sourceToTarget(list, IvrTaskVO.class);
        //设置分页
        TableDataInfo rspData = new TableDataInfo();
        rspData.setCode(HttpStatus.SUCCESS);
        rspData.setMsg("查询成功");
        rspData.setRows(null);
        rspData.setTotal(0);
        if (CollectionUtils.isNotEmpty(ivrTaskVOS)) {
            for (IvrTaskVO ivrTaskVO : ivrTaskVOS) {
@@ -74,18 +79,20 @@
                    ivrTaskVO.setWfs(wfs);
                }
            }
            //获取total
            long total = PageUtils.count(new ISelect() {
                @Override
                public void doSelect() {
                    ivrTask.setPageNum(null);
                    ivrTask.setPageSize(null);
                    ivrTaskService.selectIvrTaskList(ivrTask);
                }
            });
            //用于分页
            ivrTask.setPageNum(null);
            ivrTask.setPageSize(null);
            List<IvrTask> ivrTasks = ivrTaskService.selectIvrTaskList(ivrTask);
            rspData.setCode(HttpStatus.SUCCESS);
            rspData.setMsg("查询成功");
            rspData.setRows(ivrTaskVOS);
            rspData.setTotal(new PageInfo(ivrTasks).getTotal());
            return getDataTable2(total, ivrTaskVOS);
        }
        return rspData;
        return getDataTable2(0, ivrTaskVOS);
    }
    /**
@@ -156,5 +163,19 @@
        return toAjax(ivrTaskService.deleteIvrTaskByTaskid(taskId));
    }
    /**
     * é€šè¿‡ä»»åŠ¡ID和患者ID获取单个人的题目信息
     *
     * @return
     */
    @ApiOperation("通过任务ID和患者ID获取单个人的题目信息")
    @PostMapping("/getScriptInfoByCondition")
    public TableDataInfo getScriptInfoByCondition(@RequestBody IvrTaskScriptQues ivrTaskScriptQues) {
        RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
        Long tid = Long.valueOf(rsaPublicKeyExample.decryptedData(ivrTaskScriptQues.getParam1(), pri_key));
        Long pid = Long.valueOf(rsaPublicKeyExample.decryptedData(ivrTaskScriptQues.getParam2(), pri_key));
        log.info("tid和pid的值为:{},{}", tid, pid);
        return getDataTable(ivrTaskService.getScriptInfoByCondition(tid, pid));
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/IvrTaskSingleController.java
@@ -10,10 +10,7 @@
import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.smartor.domain.IvrTaskSingle;
import com.smartor.domain.IvrTaskSingleVO;
import com.smartor.domain.PhoneCallBackVO;
import com.smartor.domain.SendTaskVO;
import com.smartor.domain.*;
import com.smartor.domain.robot.back.RobotAIDialogBack;
import com.smartor.domain.robot.back.RobotCallBack;
import com.smartor.service.IIvrTaskSingleService;
@@ -80,12 +77,12 @@
    @PreAuthorize("@ss.hasPermi('system:task:add')")
    @Log(title = "单一任务(随访)", businessType = BusinessType.INSERT)
    @PostMapping("/insertOrUpdateTask")
    public AjaxResult insertOrUpdateHeTask(@RequestBody IvrTaskSingleVO ivrTaskcallVO) {
    public AjaxResult insertOrUpdateHeTask(@RequestBody IvrTaskVO ivrTaskVO) {
        LoginUser loginUser = getLoginUser();
        SysUser user = loginUser.getUser();
        ivrTaskcallVO.setCreateBy(user.getNickName());
        return toAjax(ivrTaskcallService.insertOrUpdateTask(ivrTaskcallVO));
        ivrTaskVO.setCreateBy(user.getNickName());
        return toAjax(ivrTaskcallService.insertOrUpdateTask(ivrTaskVO));
    }
    /**
@@ -96,8 +93,8 @@
    public AjaxResult queryTaskByCondition(@RequestBody IvrTaskSingleVO ivrTaskcallVO) {
        //根据入参查询信息
        IvrTaskSingle ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskcallVO, IvrTaskSingle.class);
        IvrTaskSingleVO ivrTaskSingleVO = ivrTaskcallService.queryTaskByCondition(ivrTaskcall);
        return success(ivrTaskSingleVO);
        IvrTaskVO ivrTaskVO = ivrTaskcallService.queryTaskByCondition(ivrTaskcall);
        return success(ivrTaskVO);
    }
    /**
@@ -105,7 +102,7 @@
     */
    @ApiOperation("任务的发送执行、暂停、终止")
    @PostMapping("/taskSend")
    public AjaxResult heTaskSend(@RequestBody SendTaskVO sendTaskVO) {
    public AjaxResult taskSend(@RequestBody SendTaskVO sendTaskVO) {
        return toAjax(ivrTaskcallService.heTaskSend(sendTaskVO));
    }
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/tools/WeChatController.java
@@ -3,7 +3,9 @@
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.smartor.domain.WeChatSendVo;
import com.smartor.service.WeChatService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import me.chanjar.weixin.common.exception.WxErrorException;
@@ -42,6 +44,9 @@
    @Value("${appSecret}")
    private String appSecret;
    @Autowired
    private WeChatService weChatService;
    /**
     * èŽ·å–æ¨¡æ¿ä¿¡æ¯
@@ -73,26 +78,8 @@
     */
    @ApiOperation("微信公众号信息发送")
    @PostMapping("/sendMessageToFollowers")
    public Boolean sendMessageToFollowers(@RequestBody WeChatSendVo weChatSendVo) {
        WxMpService wxMpService;
        wxMpService = new WxMpServiceImpl();
        wxMpService.setWxMpConfigStorage(new WxMpInMemoryConfigStorage());
        WxMpInMemoryConfigStorage wxMpConfigStorage = (WxMpInMemoryConfigStorage) wxMpService.getWxMpConfigStorage();
        wxMpConfigStorage.setAppId(appid);
        wxMpConfigStorage.setSecret(appSecret);
        try {
            List<String> openIdList = wxMpService.getUserService().userList(null).getOpenids();
            for (String openId : openIdList) {
                WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder().toUser(openId).templateId(weChatSendVo.getTemplateId()).url(weChatSendVo.getUrl()).build();
                for (String key : weChatSendVo.getContent().keySet()) {
                    templateMessage.addData(new WxMpTemplateData(key, weChatSendVo.getContent().get(key).toString()));
                }
                wxMpService.getTemplateMsgService().sendTemplateMsg(templateMessage);
            }
        } catch (WxErrorException e) {
            e.printStackTrace();
        }
        return true;
    public AjaxResult sendMessageToFollowers(@RequestBody WeChatSendVo weChatSendVo) {
        return toAjax(weChatService.sendMessageToFollowers(weChatSendVo));
    }
ruoyi-admin/src/main/java/com/ruoyi/web/test/MQTest.java
@@ -5,6 +5,13 @@
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import java.security.*;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.Base64;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -16,9 +23,45 @@
    @Test
    public void testSend() {
        String str = "absdf";
        String c = Character.toUpperCase(str.charAt(0)) + str.substring(1);
        System.out.println(c);
        try {
            // ç”ŸæˆRSA密钥对
            KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
            keyPairGenerator.initialize(2048);
            KeyPair keyPair = keyPairGenerator.generateKeyPair();
            // èŽ·å–å…¬é’¥å’Œç§é’¥
            PublicKey publicKey = keyPair.getPublic();
            PrivateKey privateKey = keyPair.getPrivate();
            String publicKeyString = Base64.getEncoder().encodeToString(privateKey.getEncoded());
            System.out.println(publicKeyString);
            // æ˜Žæ–‡
            String plainText = "Hello, World!";
            // åР坆
            Cipher encryptCipher = Cipher.getInstance("RSA");
            encryptCipher.init(Cipher.ENCRYPT_MODE, publicKey);
            byte[] encryptedBytes = encryptCipher.doFinal(plainText.getBytes());
            // å°†åŠ å¯†åŽçš„æ•°æ®è½¬æ¢ä¸ºBase64编码的字符串
            String encryptedText = Base64.getEncoder().encodeToString(encryptedBytes);
            System.out.println("加密后的数据:" + encryptedText);
            // è§£å¯†
            Cipher decryptCipher = Cipher.getInstance("RSA");
            decryptCipher.init(Cipher.DECRYPT_MODE, privateKey);
            byte[] decryptedBytes = decryptCipher.doFinal(Base64.getDecoder().decode(encryptedBytes));
            // æ˜Žæ–‡
            String decryptedText = new String(decryptedBytes);
            System.out.println("解密后的数据:" + decryptedText);
        } catch (Exception e) {
        }
//        String str = "absdf";
//        String c = Character.toUpperCase(str.charAt(0)) + str.substring(1);
//        System.out.println(c);
        "您好,我是浙二医院张医生,您是${name}吗?还是家属?".replaceAll("$$*variable", "AA");
//        Pattern pattern = Pattern.compile("^(?!.*(好|太好)).*$");
//        Matcher matcher = pattern.matcher("睡眠不好");
@@ -28,4 +71,24 @@
//
//        executorService.submit(new PhoneTask());
    }
    @Test
    public void testSend22() {
        try {
            byte[] privateKeyBytes = Base64.getDecoder().decode("");
            PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(privateKeyBytes);
            KeyFactory keyFactory = KeyFactory.getInstance("RSA");
            PrivateKey privateKey = keyFactory.generatePrivate(keySpec);
            // ä½¿ç”¨ç§é’¥è§£å¯†æ•°æ®
            Cipher decryptCipher = Cipher.getInstance("RSA");
            decryptCipher.init(Cipher.DECRYPT_MODE, privateKey);
            byte[] decryptedBytes = decryptCipher.doFinal(Base64.getDecoder().decode(""));
            // è§£å¯†åŽçš„æ•°æ®
            String decryptedData = new String(decryptedBytes);
            System.out.println("解密后的数据:" + decryptedData);
        } catch (Exception e) {
        }
    }
}
ruoyi-admin/src/main/resources/application-druid.yml
@@ -2,7 +2,7 @@
spring:
  rabbitmq:
    host: 116.62.18.175
    #    host: 127.0.0.1
    #    host: 192.168.2.8
    password: guest
    port: 5672
    username: guest
@@ -137,3 +137,12 @@
app_id: hz_ali
#授权 key(已加密过的 key)(杭州)
app_key: a2f3b5799d635216aa280362fafd8c35
pub_key: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALQzqW1EIXBKGMu+2oEYSB5gM7Ox/ihyYTeeoE0yPX1qtt4++5yNOeTBVd6EEM4iKzVEzWj6REIWVwaSNPn/SvUCAwEAAQ==
#这个是后端的私钥,用不到
#pri_key_me: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEAtDOpbUQhcEoYy77agRhIHmAzs7H+KHJhN56gTTI9fWq23j77nI055MFV3oQQziIrNUTNaPpEQhZXBpI0+f9K9QIDAQABAkB3n0fcWfrcoMN/FU3VnrnZOEF6CzFNxkgU9P8y36QECWKZ9JhYQkNpKrMC9oXlN3VSaRigV7B+L/I/a0Rs1W+tAiEA4jx7xcXJ4y4BNwAmVHt6NNiEkzIwWnwC/0qsEu8NsOsCIQDL6MMn1D2uznC6OuOWpxDCkBh1JL1NzZTZeH2G+hj7nwIgKGAC9tjFnvWm4dn0/T7MIIJDpsFeP8fCAS2iZ/6hwuECIAS/eLvWr1EAsZNEh8QcQ8GkBU3E+ztyjAK8UX/xFt/VAiBf79/1tDErX4/DChecM8w3c3DhbBcjuE3fHZn7p6/UKg==
pri_key: MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEApHTIe/StslZAT5Jzv8XClbrqox32pfaTrP5IOCRJ3FaH/UZsGgA/tsNBBEXq9eagqwPbJrjYfpdEtINcChrK4wIDAQABAkEAilDujdKshGGmlUZHs/NQRT6AOdDpsYxBiC4V76IVvQpw0IW6c4HGEvH4T+xRufika7/48L0eu0f06H+YtL5lgQIhANUd0a6oSsVxWifAjtKwMZcXD3OaIxQIQSCN4NT4VFY3AiEAxYxYrIhkIyg+UVw3WOSvBpXKxM4/WL9HRzkxDLvp2rUCIQCK23P8tgCJ5xJT5l3onw6goFDcBKkoazxsBqVgfjENPwIgWbuTd+OIYPPhwsE5ntZZrosSDO2GlsBkFzUiU59z7VUCIA0LL+9IFb+FWCl3DGTwIQ9SZYbv61T83LKjebUcSOfe
#请求IP和端口号
req_path: 192.168.2.10:8099
ruoyi-admin/src/main/resources/application.yml
@@ -122,6 +122,8 @@
  mapperLocations: classpath*:mapper/**/*Mapper.xml
  # åŠ è½½å…¨å±€çš„é…ç½®æ–‡ä»¶
  configLocation: classpath:mybatis/mybatis-config.xml
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# PageHelper分页插件
pagehelper:
ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java
@@ -3,6 +3,7 @@
import java.beans.PropertyEditorSupport;
import java.util.Date;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder;
@@ -23,25 +24,21 @@
/**
 * web层通用数据处理
 *
 *
 * @author ruoyi
 */
public class BaseController
{
public class BaseController {
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
    /**
     * å°†å‰å°ä¼ é€’过来的日期格式的字符串,自动转化为Date类型
     */
    @InitBinder
    public void initBinder(WebDataBinder binder)
    {
    public void initBinder(WebDataBinder binder) {
        // Date ç±»åž‹è½¬æ¢
        binder.registerCustomEditor(Date.class, new PropertyEditorSupport()
        {
        binder.registerCustomEditor(Date.class, new PropertyEditorSupport() {
            @Override
            public void setAsText(String text)
            {
            public void setAsText(String text) {
                setValue(DateUtils.parseDate(text));
            }
        });
@@ -50,19 +47,16 @@
    /**
     * è®¾ç½®è¯·æ±‚分页数据
     */
    protected void startPage()
    {
    protected void startPage() {
        PageUtils.startPage();
    }
    /**
     * è®¾ç½®è¯·æ±‚排序数据
     */
    protected void startOrderBy()
    {
    protected void startOrderBy() {
        PageDomain pageDomain = TableSupport.buildPageRequest();
        if (StringUtils.isNotEmpty(pageDomain.getOrderBy()))
        {
        if (StringUtils.isNotEmpty(pageDomain.getOrderBy())) {
            String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
            PageHelper.orderBy(orderBy);
        }
@@ -71,17 +65,15 @@
    /**
     * æ¸…理分页的线程变量
     */
    protected void clearPage()
    {
    protected void clearPage() {
        PageUtils.clearPage();
    }
    /**
     * å“åº”请求分页数据
     */
    @SuppressWarnings({ "rawtypes", "unchecked" })
    protected TableDataInfo getDataTable(List<?> list)
    {
    @SuppressWarnings({"rawtypes", "unchecked"})
    protected TableDataInfo getDataTable(List<?> list) {
        TableDataInfo rspData = new TableDataInfo();
        rspData.setCode(HttpStatus.SUCCESS);
        rspData.setMsg("查询成功");
@@ -93,124 +85,110 @@
    /**
     * å“åº”请求分页数据
     */
    @SuppressWarnings({ "rawtypes", "unchecked" })
    protected TableDataInfo getDataTable2(List<?> list,List<?> list2)
    {
    @SuppressWarnings({"rawtypes", "unchecked"})
    protected TableDataInfo getDataTable2(long total, List<?> list) {
        TableDataInfo rspData = new TableDataInfo();
        rspData.setCode(HttpStatus.SUCCESS);
        rspData.setMsg("查询成功");
        rspData.setRows(list2);
        rspData.setTotal(new PageInfo(list).getTotal());
        rspData.setRows(list);
        rspData.setTotal(total);
        return rspData;
    }
    /**
     * è¿”回成功
     */
    public AjaxResult success()
    {
    public AjaxResult success() {
        return AjaxResult.success();
    }
    /**
     * è¿”回失败消息
     */
    public AjaxResult error()
    {
    public AjaxResult error() {
        return AjaxResult.error();
    }
    /**
     * è¿”回成功消息
     */
    public AjaxResult success(String message)
    {
    public AjaxResult success(String message) {
        return AjaxResult.success(message);
    }
    /**
     * è¿”回成功消息
     */
    public AjaxResult success(Object data)
    {
    public AjaxResult success(Object data) {
        return AjaxResult.success(data);
    }
    /**
     * è¿”回失败消息
     */
    public AjaxResult error(String message)
    {
    public AjaxResult error(String message) {
        return AjaxResult.error(message);
    }
    /**
     * è¿”回警告消息
     */
    public AjaxResult warn(String message)
    {
    public AjaxResult warn(String message) {
        return AjaxResult.warn(message);
    }
    /**
     * å“åº”返回结果
     *
     *
     * @param rows å½±å“è¡Œæ•°
     * @return æ“ä½œç»“æžœ
     */
    protected AjaxResult toAjax(int rows)
    {
    protected AjaxResult toAjax(int rows) {
        return rows > 0 ? AjaxResult.success() : AjaxResult.error();
    }
    /**
     * å“åº”返回结果
     *
     *
     * @param result ç»“æžœ
     * @return æ“ä½œç»“æžœ
     */
    protected AjaxResult toAjax(boolean result)
    {
    protected AjaxResult toAjax(boolean result) {
        return result ? success() : error();
    }
    /**
     * é¡µé¢è·³è½¬
     */
    public String redirect(String url)
    {
    public String redirect(String url) {
        return StringUtils.format("redirect:{}", url);
    }
    /**
     * èŽ·å–ç”¨æˆ·ç¼“å­˜ä¿¡æ¯
     */
    public LoginUser getLoginUser()
    {
    public LoginUser getLoginUser() {
        return SecurityUtils.getLoginUser();
    }
    /**
     * èŽ·å–ç™»å½•ç”¨æˆ·id
     */
    public Long getUserId()
    {
    public Long getUserId() {
        return getLoginUser().getUserId();
    }
    /**
     * èŽ·å–ç™»å½•éƒ¨é—¨id
     */
    public Long getDeptId()
    {
    public Long getDeptId() {
        return getLoginUser().getDeptId();
    }
    /**
     * èŽ·å–ç™»å½•ç”¨æˆ·å
     */
    public String getUsername()
    {
    public String getUsername() {
        return getLoginUser().getUsername();
    }
}
ruoyi-common/src/main/java/com/ruoyi/common/enums/ServiceFromEnum.java
@@ -8,7 +8,7 @@
    ZZ(2, "纸质"),
    DH(3, "电话"),
    DX(4, "短信"),
    GZH(5, "微信公众号"),
    GZH(5, "公众号"),
    WXXCH(6, "微信小程序"),
    ZFB(7, "支付宝"),
    ZNXCH(8, "智能小程序"),
ruoyi-common/src/main/java/com/ruoyi/common/utils/RSAPublicKeyExample.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,82 @@
package com.ruoyi.common.utils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.crypto.Cipher;
import java.security.KeyFactory;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;
@Slf4j
@Component
public class RSAPublicKeyExample {
    /**
     * æ•°æ®è§£å¯†
     *
     * @param encryptedData
     * @return
     */
    public String decryptedData(String encryptedData, String pri_key) {
        String privateKeyString = "私钥的Base64编码字符串"; // åŽç«¯ç§é’¥çš„Base64编码字符串
        try {
            // å°†ç§é’¥Base64编码字符串转换为PrivateKey对象
            byte[] privateKeyBytes = Base64.getDecoder().decode(pri_key);
            PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(privateKeyBytes);
            KeyFactory keyFactory = KeyFactory.getInstance("RSA");
            PrivateKey privateKey = keyFactory.generatePrivate(keySpec);
            // ä½¿ç”¨ç§é’¥è§£å¯†æ•°æ®
            Cipher decryptCipher = Cipher.getInstance("RSA");
            decryptCipher.init(Cipher.DECRYPT_MODE, privateKey);
            byte[] decryptedBytes = decryptCipher.doFinal(Base64.getDecoder().decode(encryptedData));
            // è§£å¯†åŽçš„æ•°æ®
            String decryptedData = new String(decryptedBytes);
            System.out.println("解密后的数据:" + decryptedData);
            return decryptedData;
        } catch (Exception e) {
            log.error("解密报错了:{}", e.getMessage());
        }
        return null;
    }
    /**
     * è¦åŠ å¯†çš„æ˜Žæ–‡æ•°æ®
     *
     * @param plainText
     * @return
     */
    public String encryptedData(String plainText, String pub_key) {
        String publicKeyString = "公钥的Base64编码字符串"; // å‰ç«¯ä¼ é€’的公钥字符串
        // å°†å…¬é’¥Base64编码字符串转换为PublicKey对象
        try {
            byte[] publicKeyBytes = Base64.getDecoder().decode(pub_key);
            X509EncodedKeySpec keySpec = new X509EncodedKeySpec(publicKeyBytes);
            KeyFactory keyFactory = KeyFactory.getInstance("RSA");
            PublicKey publicKey = keyFactory.generatePublic(keySpec);
            // ä½¿ç”¨å…¬é’¥åŠ å¯†æ•°æ®
            Cipher encryptCipher = Cipher.getInstance("RSA");
            encryptCipher.init(Cipher.ENCRYPT_MODE, publicKey);
            byte[] encryptedBytes = encryptCipher.doFinal(plainText.getBytes());
            // å°†åŠ å¯†åŽçš„æ•°æ®è½¬æ¢ä¸ºBase64编码的字符串
            String encryptedText = Base64.getEncoder().encodeToString(encryptedBytes);
            System.out.println("加密后的数据:" + encryptedText);
            return encryptedText;
        } catch (Exception e) {
            log.error("加密失败了:{}", e.getMessage());
        }
        return null;
    }
}
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
@@ -108,7 +108,7 @@
                // è¿‡æ»¤è¯·æ±‚
                .authorizeRequests()
                // å¯¹äºŽç™»å½•login æ³¨å†Œregister éªŒè¯ç captchaImage å…è®¸åŒ¿åè®¿é—®
                .antMatchers("/login", "/register", "/captchaImage", "/qrcode/generateStaticHtml", "/qrcode/getQRcode", "/qrcode/getFormDate", "/chat", "/system/file/admin/uploadFile", "/smartor/dingtalk/sendNotification", "/patient/read/patientInfo","/socket","/API_ESB_Service","/API_ESB_Service/Run","/magic/web/**","/smartor/tasksingle/phoneCallBack","/smartor/robot/callstatus","/smartor/robot/aidialog","/smartor/robot/cdrinfo","/getToken").permitAll()
                .antMatchers("/login", "/register", "/captchaImage", "/qrcode/generateStaticHtml", "/qrcode/getQRcode", "/qrcode/getFormDate", "/chat", "/system/file/admin/uploadFile", "/smartor/dingtalk/sendNotification", "/patient/read/patientInfo","/socket","/API_ESB_Service","/API_ESB_Service/Run","/magic/web/**","/smartor/tasksingle/phoneCallBack","/smartor/robot/callstatus","/smartor/robot/aidialog","/smartor/robot/cdrinfo","/getToken","/smartor/ivrtask/getScriptInfoByCondition").permitAll()
                // é™æ€èµ„源,可匿名访问
                .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll().antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
                // é™¤ä¸Šé¢å¤–的所有请求全部需要鉴权认证
smartor/src/main/java/com/smartor/common/SendService.java
@@ -1,15 +1,20 @@
package com.smartor.common;
import com.aliyun.dysmsapi20170525.models.SendSmsResponseBody;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.smartor.domain.*;
import com.smartor.mapper.PatWildcardMapper;
import com.smartor.service.DingTalkService;
import com.smartor.service.WeChatService;
import com.smartor.service.impl.BaseSmsaccountServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * å‘送服务工具类
@@ -25,33 +30,48 @@
    @Autowired
    private PatWildcardMapper patWildcardMapper;
    @Autowired
    private WeChatService weChatService;
    public Boolean sendMsg(SendMagParam sendMagParam) {
        // 1,多媒体 2,纸质  3,电话  4,短信  5.微信公众号 6.微信小程序 7.支付宝  8.智能小程序  9.钉钉
        switch (sendMagParam.getType()) {
            case ("多媒体"):
            case ("1"):
            case ("纸质"):
            case ("2"):
            case ("电话"):
            case ("3"):
            case ("短信"):
            case ("4"):
                BaseSmsRequest baseSmsRequest = new BaseSmsRequest();
                baseSmsRequest.setPhoneNumber(sendMagParam.getPhone());
                baseSmsRequest.setTemplateCode("SMS_461860582");
                SendSmsResponseBody sendSmsResponseBody = baseSmsaccountService.sendMsg(baseSmsRequest);
                if (sendSmsResponseBody.getCode().equals("OK")) {
                    return true;
                }
                return false;
            case ("微信公众号"):
            case ("5"):
                WeChatSendVo weChatSendVo = new WeChatSendVo();
                weChatSendVo.setUrl(sendMagParam.getUrl());
                weChatSendVo.setTemplateId(sendMagParam.getTmpCode());
                ObjectMapper objectMapper=new ObjectMapper();
                Map map = null;
                try {
                    map = objectMapper.readValue(sendMagParam.getContent(), Map.class);
                } catch (JsonProcessingException e) {
                    e.printStackTrace();
                }
                weChatSendVo.setContent(map);
                Boolean aBoolean1 = weChatService.sendMessageToFollowers(weChatSendVo);
                return aBoolean1;
            case ("6"):
            case ("微信小程序"):
            case ("7"):
            case ("支付宝"):
            case ("8"):
            case ("智能小程序"):
            case ("钉钉"):
            case ("9"):
                DingTalkReqVo dingTalkReqVo = new DingTalkReqVo();
                Boolean aBoolean = dingTalkService.sendNotification(dingTalkReqVo);
                if (aBoolean) {
smartor/src/main/java/com/smartor/config/RabbitMQAckConfig.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,48 @@
//package com.smartor.config;
//
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.amqp.core.Message;
//import org.springframework.amqp.rabbit.connection.CorrelationData;
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.PostConstruct;
//
//@Slf4j
//@Component
//public class RabbitMQAckConfig implements RabbitTemplate.ConfirmCallback,RabbitTemplate.ReturnCallback {
//
//
//    @Autowired
//    private RabbitTemplate rabbitTemplate;
//
//    @PostConstruct
//    public void init(){
//        rabbitTemplate.setConfirmCallback(this);
//        rabbitTemplate.setReturnCallback(this);
//    }
//
//
//    //判断是否到达交换机
//    @Override
//    public void confirm(CorrelationData correlationData, boolean ack, String cause) {
//        if (ack){
//            log.info("消息到了交换机");
//            System.out.println("消息到了交换机 -------------");
//        }else {
//            log.info("消息没有到达交换机");
//            System.out.println("消息没有到交换机----------------- ");
//        }
//    }
//
//    //判断是否到达队列
//    @Override
//    public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) {
//        System.out.println("message消息 = " + new String(message.getBody()));
//        System.out.println("replyCode应答码 = " + replyCode);
//        System.out.println("replyText描述 = " + replyText);
//        System.out.println("exchange交换机 = " + exchange);
//        System.out.println("routingKey路由key = " + routingKey);
//    }
//}
smartor/src/main/java/com/smartor/config/RabbitMqCallPhoneConfig.java
@@ -1,12 +1,16 @@
package com.smartor.config;
import org.springframework.amqp.AmqpException;
import org.springframework.amqp.core.*;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@Component
public class RabbitMqCallPhoneConfig {
@@ -15,7 +19,7 @@
    private AmqpAdmin amqpAdmin;
    @Autowired
    private AmqpTemplate rabbitTemplate;
    private RabbitTemplate rabbitTemplate;
    /**
     * åˆ›å»ºäº¤æ¢æœº
@@ -59,7 +63,6 @@
     * @param data       æ¶ˆæ¯
     */
    public void sendMessage(String changeName, String routingKey, String data, Long times) {
        this.rabbitTemplate.convertAndSend(changeName, routingKey, data, message -> {
            //注意这里时间可以使long,而且是设置header
            message.getMessageProperties().setHeader("x-delay", times);
smartor/src/main/java/com/smartor/domain/IvrLibaTemplate.java
@@ -341,5 +341,19 @@
    @ApiModelProperty(value = "随访后话术(结束语)")
    private String revisitAfter;
    /**
     * pageNum
     */
    @ApiModelProperty(value = "pageNum")
    @Excel(name = "pageNum")
    private Integer pageNum;
    /**
     * pageSize
     */
    @ApiModelProperty(value = "pageSize")
    @Excel(name = "pageSize")
    private Integer pageSize;
}
smartor/src/main/java/com/smartor/domain/IvrTask.java
@@ -245,18 +245,18 @@
    private String preachform;
    /**
     * æ˜¯å¦å‘送 ï¼š 0 æš‚停发送  1 å®šæ—¶å‘送  2 ç«‹å³å‘送
     * å‘送类型: 1指定时间发送 2即刻发送
     */
    @Excel(name = " æ˜¯å¦å‘送 ï¼š 0 æš‚停发送  1 å®šæ—¶å‘送  2 ç«‹å³å‘送 ")
    @ApiModelProperty(value = "是否发送 ï¼š 0 æš‚停发送  1 å®šæ—¶å‘送  2 ç«‹å³å‘送 ")
    private Integer sendType;
    @Excel(name = " å‘送类型: 1指定时间发送 2即刻发送 ")
    @ApiModelProperty(value = "发送类型: 1指定时间发送 2即刻发送 ")
    private Long sendType;
    /**
     * å‘送状态:  0  å¤±è´¥   1成功
     */
    @Excel(name = " å‘送状态: 1创建   2执行中   3 æš‚停   4终止  5完成 ")
    @ApiModelProperty(value = "发送状态: 1创建   2执行中   3 æš‚停   4终止  5完成 ")
    private String sendState;
    private Integer sendState;
//    /**
//     * æ–‡æœ¬å˜é‡å‚æ•°
@@ -284,13 +284,6 @@
    @ApiModelProperty(value = "就诊类型(1门诊  2出院 3.专病)")
    private String hospType;
//    /**
//     * å°±è¯Šç¼–号(对应的outhospno、inhospno)
//     */
//    @Excel(name = "  å°±è¯Šç¼–号(对应的outhospno、inhospno)  ")
//    @ApiModelProperty(value = "就诊编号(对应的outhospno、inhospno)")
//    private String hospno;
    /**
     * ä»»åŠ¡æè¿°
     */
@@ -304,4 +297,23 @@
    @Excel(name = "暂停状态 ï¼š çŠ¶æ€å¦‚æžœå‘ç”Ÿä¿®æ”¹ï¼Œå€¼å°±åŠ 1")
    @ApiModelProperty(value = "暂停状态 ï¼š çŠ¶æ€å¦‚æžœå‘ç”Ÿä¿®æ”¹ï¼Œå€¼å°±åŠ 1")
    private Long stopState = 0L;
    /**
     * æ–‡æœ¬å˜é‡å‚æ•°
     */
    @Excel(name = "文本变量参数")
    @ApiModelProperty(value = "文本变量参数")
    private String textParam;
    @ApiModelProperty(value = "上午时间")
    private String showTimeMorn;
    @ApiModelProperty(value = "中午时间")
    private String showTimeNoon;
    @ApiModelProperty(value = "晚午时间")
    private String showTimeNight;
    @ApiModelProperty(value = "展示日期")
    private String showDate;
}
smartor/src/main/java/com/smartor/domain/IvrTaskScriptQues.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,35 @@
package com.smartor.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
 * è¯­éŸ³ä»»åŠ¡å¯¹è±¡ ivr_task
 *
 * @author smartor
 * @date 2023-03-24
 */
@ApiModel(value = "IvrTaskScriptQues", description = "任务对象")
@Data
public class IvrTaskScriptQues {
    /**
     * taskid
     */
    @ApiModelProperty(value = "taskid")
    private String param1;
    /**
     * patid
     */
    @Excel(name = "patid  ")
    @ApiModelProperty(value = "patid")
    private String param2;
}
smartor/src/main/java/com/smartor/domain/IvrTaskSingle.java
@@ -51,7 +51,7 @@
     */
    @Excel(name = "  æ€§åˆ«")
    @ApiModelProperty(value = "性别")
    private String sex;
    private Long sex;
    /**
     * å¹´é¾„
@@ -87,7 +87,6 @@
    @Excel(name = "任务类型(0通知、1宣教、2门诊、3出院、4复诊、5体检、6问卷、7医技……)")
    @ApiModelProperty(value = "任务类型(0通知、1宣教、2门诊、3出院、4复诊、5体检、6问卷、7医技……)")
    private String type;
    /**
     * æ¨¡æ¿ID
@@ -361,6 +360,13 @@
    private String diagname;
    /**
     * æ‚£è€…ID
     */
    @Excel(name = "  æ‚£è€…ID")
    @ApiModelProperty(value = "患者ID")
    private Long patid;
    /**
     * ç§‘室名称
     */
    @Excel(name = "科室名称")
smartor/src/main/java/com/smartor/domain/IvrTaskSingleVO.java
@@ -327,19 +327,20 @@
    @ApiModelProperty(value = "宣教形式 : 1,文本、2,图片、3,语音、4,视频、5,混合")
    private String serviceform;
    /**
     * æ‚£è€…与单一任务关联表集合
     */
    @Excel(name = " å®£æ‚£è€…与单一任务关联表集合")
    @ApiModelProperty(value = "患者与单一任务关联表集合")
    private List<PatTaskRelevance> patTaskRelevances;
//    /**
//     * åºŠå·
//     */
//    @Excel(name = "床号")
//    @ApiModelProperty(value = "床号")
//    private Long bedNo;
    /**
     * åºŠå·
     */
    @Excel(name = "床号")
    @ApiModelProperty(value = "床号")
    private Long bedNo;
    /**
     * æ‚£è€…ID
     */
    @Excel(name = "  æ‚£è€…ID")
    @ApiModelProperty(value = "患者ID")
    private Long patid;
//
//    /**
//     * ç–¾ç—…名称
@@ -383,35 +384,35 @@
    @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出院   3.专病)")
//    @ApiModelProperty(value = "就诊类型(1门诊  2出院   3.专病)")
//    private String hospType;
    /**
     * éšè®¿äºº
     */
    @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出院   3.专病)")
    @ApiModelProperty(value = "就诊类型(1门诊  2出院   3.专病)")
    private String hospType;
//
//    /**
//     * å¾®ä¿¡
@@ -421,12 +422,12 @@
//    private String wechat;
//
//
//    /**
//     * è¯Šæ–­åç§°
//     */
//    @Excel(name = "  è¯Šæ–­åç§°")
//    @ApiModelProperty(value = "诊断名称")
//    private String diagname;
    /**
     * è¯Šæ–­åç§°
     */
    @Excel(name = "  è¯Šæ–­åç§°")
    @ApiModelProperty(value = "诊断名称")
    private String diagname;
//
//    /**
//     * ç§‘室名称
@@ -442,10 +443,10 @@
//    @ApiModelProperty(value = "就诊日期")
//    private Date admindate;
//
//    /**
//     * ç—…房号
//     */
//    @Excel(name = "  ç—…房号")
//    @ApiModelProperty(value = "病房号")
//    private String roomno;
    /**
     * ç—…房号
     */
    @Excel(name = "  ç—…房号")
    @ApiModelProperty(value = "病房号")
    private String roomno;
}
smartor/src/main/java/com/smartor/domain/IvrTaskVO.java
@@ -10,6 +10,7 @@
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * è¯­éŸ³ä»»åŠ¡å¯¹è±¡ ivr_task
@@ -96,6 +97,14 @@
     */
    @Excel(name = "  ")
    private Long fail;
    /**
     * ä»»åŠ¡å½¢å¼ 1,多媒体   2,纸质  3,电话  4,短信  5.微信公众号 6.微信小程序  7.支付宝  8.智能小程序  9.钉钉
     */
    @Excel(name = "  ä»»åŠ¡å½¢å¼ 1,多媒体   2,纸质  3,电话  4,短信  5.微信公众号 6.微信小程序  7.支付宝  8.智能小程序  9.钉钉 ")
    @ApiModelProperty(value = " ä»»åŠ¡å½¢å¼ 1,多媒体   2,纸质  3,电话  4,短信  5.微信公众号 6.微信小程序  7.支付宝  8.智能小程序  9.钉钉 ")
    private String preachform;
    /**
     *
@@ -232,7 +241,47 @@
     */
    @Excel(name = " å‘送状态: 1创建   2执行中   3 æš‚停   4终止  5完成 ")
    @ApiModelProperty(value = "发送状态: 1创建   2执行中   3 æš‚停   4终止  5完成 ")
    private String sendState;
    private Integer sendState;
    /**
     * æ‚£è€…与单一任务关联表集合
     */
    @Excel(name = " å®£æ‚£è€…与单一任务关联表集合")
    @ApiModelProperty(value = "患者与单一任务关联表集合")
    private List<PatTaskRelevance> patTaskRelevances;
    /**
     * æ˜¯å¦å­˜åœ¨æ“ä½œï¼š1 æ–°å¢ž 2修改 3删除
     */
    @ApiModelProperty(value = "是否存在操作:1 æ–°å¢ž 2修改 3删除")
    private Integer isoperation;
    /**
     * æ–‡æœ¬å˜é‡å‚æ•°
     */
    @Excel(name = "文本变量参数")
    @ApiModelProperty(value = "文本变量参数")
    private Map<String, Map<String, String>> textParam;
    /**
     * å‘送类型: 1 æ—¶é—´æ®µ   2 æ—¶é—´ç‚¹   3 å³åˆ»å‘送
     */
    @ApiModelProperty(value = "发送类型: 1 æ—¶é—´æ®µ   2 å³åˆ»å‘送")
    private Long sendType;
    @ApiModelProperty(value = "上午时间")
    private String showTimeMorn;
    @ApiModelProperty(value = "中午时间")
    private String showTimeNoon;
    @ApiModelProperty(value = "晚午时间")
    private String showTimeNight;
    @ApiModelProperty(value = "展示日期")
    private String showDate;
}
smartor/src/main/java/com/smartor/domain/IvrTaskcallMQ.java
@@ -21,7 +21,7 @@
 */
@ApiModel(value = "IvrTaskcallMQ", description = "MQ任务")
@Data
public class IvrTaskcallMQ extends BaseEntity {
public class IvrTaskcallMQ {
    private static final long serialVersionUID = 1L;
    /**
@@ -42,8 +42,8 @@
     * ä»»åŠ¡å‘é€æ–¹å¼ï¼šâ€œç”µè¯ï¼ŒçŸ­ä¿¡ï¼Œå…¬ä¼—å·ï¼Œé“¾æŽ¥...”以逗号分隔
     */
    @Excel(name = "任务发送方式:电话,短信,公众号,链接...")
    @ApiModelProperty(value = "务发送方式:电话,短信,公众号,链接...   ä»¥é€—号分隔")
    private String servicefrom;
    @ApiModelProperty(value = "务发送方式:电话,短信,公众号...   ä»¥é€—号分隔")
    private String preachform;
    /**
smartor/src/main/java/com/smartor/domain/PatArchiveReq.java
@@ -31,6 +31,13 @@
    /**
     * å§“名
     */
    @ApiModelProperty("患者id集合")
    @Excel(name = " æ‚£è€…id集合(在选择病人时,过滤已经选择的pids) ")
    private List<Integer> pids;
    /**
     * å§“名
     */
    @ApiModelProperty("姓名")
    @Excel(name = " å§“名 ")
    private String name;
smartor/src/main/java/com/smartor/domain/SendMagParam.java
@@ -15,4 +15,6 @@
    //模板code ä¾‹å¦‚ ï¼š  SMS_461860582
    private String tmpCode;
    private String url;
}
smartor/src/main/java/com/smartor/domain/SendTaskVO.java
@@ -24,9 +24,7 @@
     */
    @Excel(name = " å‘送状态: 1创建   2执行中   3 æš‚停   4终止  5完成 ")
    @ApiModelProperty(value = "发送状态: 1创建   2执行中   3 æš‚停   4终止  5完成 ")
    private String sendState;
    private Integer sendState;
}
smartor/src/main/java/com/smartor/domain/TestVo.java
@@ -30,5 +30,9 @@
    private String type;
    private Long stopState;
    private Long servicefrom;
}
smartor/src/main/java/com/smartor/mapper/IvrTaskSingleMapper.java
@@ -45,6 +45,8 @@
     */
    public Boolean updateIvrTaskcall(IvrTaskSingle ivrTaskSingle);
    public Boolean updateIvrTaskcallByCondition(IvrTaskSingle ivrTaskSingle);
    /**
     * åˆ é™¤å•一任务(随访)
     *
@@ -53,6 +55,8 @@
     */
    public int deleteIvrTaskcallById(Long id);
    public int deleteIvrTaskcallByCondition(@Param("taskid") Long id, @Param("patid") Long patid);
    /**
     * åˆ é™¤å•一任务(随访)
     *
smartor/src/main/java/com/smartor/service/IIvrTaskService.java
@@ -2,7 +2,10 @@
import java.util.List;
import com.smartor.domain.IvrLibaTemplateScript;
import com.smartor.domain.IvrLibaTemplateScriptVO;
import com.smartor.domain.IvrTask;
import org.springframework.web.bind.annotation.PathVariable;
/**
 * è¯­éŸ³ä»»åŠ¡Service接口
@@ -58,4 +61,6 @@
     * @return ç»“æžœ
     */
    public Boolean deleteIvrTaskByTaskid(Long taskid);
    public  List<IvrLibaTemplateScriptVO> getScriptInfoByCondition(Long taskid, Long patid);
}
smartor/src/main/java/com/smartor/service/IIvrTaskSingleService.java
@@ -1,8 +1,9 @@
package com.smartor.service;
import com.smartor.domain.*;
import com.smartor.domain.robot.back.RobotAIDialogBack;
import com.smartor.domain.robot.back.RobotCallBack;
import com.smartor.domain.IvrTaskSingle;
import com.smartor.domain.IvrTaskVO;
import com.smartor.domain.PhoneCallBackVO;
import com.smartor.domain.SendTaskVO;
import java.util.List;
@@ -35,7 +36,7 @@
     * @param ivrTaskcall
     * @return
     */
    public IvrTaskSingleVO queryTaskByCondition(IvrTaskSingle ivrTaskcall);
    public IvrTaskVO queryTaskByCondition(IvrTaskSingle ivrTaskcall);
    /**
     * æŸ¥è¯¢æ‚£è€…随访信息
@@ -69,10 +70,10 @@
    /**
     * æ–°å¢žå®£æ•™ä»»åŠ¡
     *
     * @param ivrTaskcallVO å•一任务
     * @param ivrTaskVO å•一任务
     * @return ç»“æžœ
     */
    public int insertOrUpdateTask(IvrTaskSingleVO ivrTaskcallVO);
    public int insertOrUpdateTask(IvrTaskVO ivrTaskVO);
    /**
     * ä»»åŠ¡å‘é€æ‰§è¡Œ
smartor/src/main/java/com/smartor/service/WeChatService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,8 @@
package com.smartor.service;
import com.smartor.domain.WeChatSendVo;
import org.springframework.web.bind.annotation.RequestBody;
public interface WeChatService {
    public Boolean sendMessageToFollowers(@RequestBody WeChatSendVo weChatSendVo);
}
smartor/src/main/java/com/smartor/service/impl/HeTaskSingleServiceImpl.java
@@ -17,6 +17,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.fasterxml.jackson.core.type.TypeReference;
import java.util.ArrayList;
import java.util.List;
@@ -168,7 +169,7 @@
        try {
            //获取到发送时间的集合
            if (StringUtils.isNotEmpty(sendTimeSlot)) {
                List<TaskSendTimeVO> taskSendTimeVOList = objectMapper.readValue(sendTimeSlot, List.class);
                List<TaskSendTimeVO> taskSendTimeVOList = objectMapper.readValue(sendTimeSlot,  new TypeReference<List<TaskSendTimeVO>>() {});
                heTaskSingleVO.setSendTimeslot(taskSendTimeVOList);
            }
            //文本变量参数
smartor/src/main/java/com/smartor/service/impl/IvrTaskServiceImpl.java
@@ -1,15 +1,22 @@
package com.smartor.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.DateUtils;
import com.smartor.domain.IvrTaskSingle;
import com.smartor.mapper.IvrTaskSingleMapper;
import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.common.utils.StringUtils;
import com.smartor.domain.*;
import com.smartor.mapper.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.smartor.mapper.IvrTaskMapper;
import com.smartor.domain.IvrTask;
import com.smartor.service.IIvrTaskService;
import org.springframework.transaction.annotation.Transactional;
@@ -19,6 +26,7 @@
 * @author smartor
 * @date 2023-03-24
 */
@Slf4j
@Service
public class IvrTaskServiceImpl implements IIvrTaskService {
    @Autowired
@@ -26,6 +34,15 @@
    @Autowired
    private IvrTaskSingleMapper ivrTaskcallMapper;
    @Autowired
    private IvrLibaTemplateScriptMapper ivrLibaTemplateScriptMapper;
    @Autowired
    private PatArchiveMapper patArchiveMapper;
    @Autowired
    private IvrLibaTemplateTargetoptionMapper ivrLibaTemplateTargetOptionMapper;
    /**
     * æŸ¥è¯¢è¯­éŸ³ä»»åŠ¡
@@ -104,4 +121,63 @@
        isSuccess = ivrTaskMapper.deleteIvrTaskByTaskid(taskid);
        return isSuccess;
    }
    @Override
    public List<IvrLibaTemplateScriptVO> getScriptInfoByCondition(Long taskid, Long patid) {
        //通过任务ID获取模板ID
        IvrTask ivrTask = selectIvrTaskByTaskid(taskid);
        //通过模板ID获取问题信息
        IvrLibaTemplateScript ivrLibaTemplateScript = new IvrLibaTemplateScript();
        ivrLibaTemplateScript.setTemplateID(ivrTask.getTemplateid());
        ivrLibaTemplateScript.setDelFlag("0");
        List<IvrLibaTemplateScript> ivrLibaTemplateScripts = ivrLibaTemplateScriptMapper.selectIvrLibaTemplateScriptList(ivrLibaTemplateScript);
        if (CollectionUtils.isEmpty(ivrLibaTemplateScripts) || ivrLibaTemplateScripts.size() == 0) {
            log.info("ivrLibaTemplateScripts为空了,请尽快联系管理员处理");
            return new ArrayList<>();
        }
        List<IvrLibaTemplateScriptVO> ivrLibaTemplateScriptVOS = DtoConversionUtils.sourceToTarget(ivrLibaTemplateScripts, IvrLibaTemplateScriptVO.class);
        //获取患者信息
        PatArchive patArchive = patArchiveMapper.selectPatArchiveByPatid(patid);
        //通过患者信息和任务信息中的textParam对问题中的变量进行填充
        ObjectMapper objectMapper = new ObjectMapper();
        Map<String, Map<String, String>> ivrTaskMap = null;
        try {
            ivrTaskMap = objectMapper.readValue(ivrTask.getTextParam(), Map.class);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        List<Map<String, String>> mapList = new ArrayList<>();
        for (Map<String, String> map : ivrTaskMap.values()) {
            mapList.add(map);
        }
        //将模板问题话术里的通配符替换
        for (IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO : ivrLibaTemplateScriptVOS) {
            if (StringUtils.isNotEmpty(ivrLibaTemplateScriptVO.getQuestionText())) {
                for (Map<String, String> map : mapList) {
                    for (String key : map.keySet()) {
                        ivrLibaTemplateScriptVO.setQuestionText(ivrLibaTemplateScriptVO.getQuestionText().replace(key, StringUtils.isNotEmpty(map.get(key)) ? map.get(key) : ""));
                    }
                }
                //替换患者个人信息数据
                ivrLibaTemplateScriptVO.setQuestionText(ivrLibaTemplateScriptVO.getQuestionText().replace("${name}", StringUtils.isNotEmpty(patArchive.getName()) ? patArchive.getName() : ""));
                ivrLibaTemplateScriptVO.setQuestionText(ivrLibaTemplateScriptVO.getQuestionText().replace("${dzz}", StringUtils.isNotEmpty(patArchive.getPlaceOfResidence()) ? patArchive.getPlaceOfResidence() : ""));
                ivrLibaTemplateScriptVO.setQuestionText(ivrLibaTemplateScriptVO.getQuestionText().replace("${dhh}", StringUtils.isNotEmpty(patArchive.getTelcode()) ? patArchive.getTelcode() : ""));
                //获取问题选项
                IvrLibaTemplateTargetoption ivrLibaTemplateTargetoption = new IvrLibaTemplateTargetoption();
                ivrLibaTemplateTargetoption.setScriptid(ivrLibaTemplateScriptVO.getID());
                List<IvrLibaTemplateTargetoption> ivrLibaTemplateTargetoptions = ivrLibaTemplateTargetOptionMapper.selectIvrLibaTemplateTargetoptionList(ivrLibaTemplateTargetoption);
                ivrLibaTemplateScriptVO.setIvrLibaScriptTargetoptionList(ivrLibaTemplateTargetoptions);
            }
        }
        return ivrLibaTemplateScriptVOS;
    }
}
smartor/src/main/java/com/smartor/service/impl/IvrTaskSingleServiceImpl.java
@@ -21,6 +21,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.fasterxml.jackson.core.type.TypeReference;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -85,28 +86,33 @@
    }
    @Override
    public IvrTaskSingleVO queryTaskByCondition(IvrTaskSingle ivrTaskcall) {
    public IvrTaskVO queryTaskByCondition(IvrTaskSingle ivrTaskcall) {
        //定义患者与单一任务关联表集合
        List<PatTaskRelevance> patTaskRelevances = new ArrayList<>();
        List<IvrTaskSingle> list = selectIvrTaskcallList(ivrTaskcall);
        if (CollectionUtils.isEmpty(list)) {
            new BaseException("该任务不存在");
        if (CollectionUtils.isEmpty(list) || list.size() == 0) {
            return new IvrTaskVO();
        }
        IvrTask ivrTask = ivrTaskService.selectIvrTaskByTaskid(ivrTaskcall.getTaskid());
        //将查出来的数据倒入ivrTasksingleVO中
        IvrTaskSingleVO ivrTasksingleVO2 = DtoConversionUtils.sourceToTarget(list.get(0), IvrTaskSingleVO.class);
        IvrTaskVO ivrTaskVO = DtoConversionUtils.sourceToTarget(list.get(0), IvrTaskVO.class);
        ivrTaskVO.setShowDate(ivrTask.getShowDate());
        ivrTaskVO.setShowTimeMorn(ivrTask.getShowTimeMorn());
        ivrTaskVO.setShowTimeNoon(ivrTask.getShowTimeNoon());
        ivrTaskVO.setShowTimeNight(ivrTask.getShowTimeNight());
        String sendTimeSlot = ivrTask.getSendTimeSlot();
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            //获取到发送时间的集合
            if (com.ruoyi.common.utils.StringUtils.isNotEmpty(sendTimeSlot)) {
                List<TaskSendTimeVO> taskSendTimeVOList = objectMapper.readValue(sendTimeSlot, List.class);
                ivrTasksingleVO2.setSendTimeslot(taskSendTimeVOList);
                ivrTaskVO.setSendTimeslot(taskSendTimeVOList);
                ivrTaskVO.setSendType(ivrTask.getSendType());
            }
            //文本变量参数
            if (com.ruoyi.common.utils.StringUtils.isNotEmpty(list.get(0).getTextParam())) {
                Map<String, Map<String, String>> textParam = objectMapper.readValue(list.get(0).getTextParam(), Map.class);
                ivrTasksingleVO2.setTextParam(textParam);
            if (com.ruoyi.common.utils.StringUtils.isNotEmpty(ivrTask.getTextParam())) {
                Map<String, Map<String, String>> textParam = objectMapper.readValue(ivrTask.getTextParam(), Map.class);
                ivrTaskVO.setTextParam(textParam);
            }
        } catch (JsonProcessingException e) {
            e.printStackTrace();
@@ -123,6 +129,7 @@
                patTaskRelevance.setPhone(ivrTaskcall1.getPhone());
                patTaskRelevance.setAddr(ivrTaskcall1.getAddr());
                patTaskRelevance.setDiagname(ivrTaskcall1.getDiagname());
                patTaskRelevance.setPatid(ivrTaskcall1.getPatid());
                patTaskRelevances.add(patTaskRelevance);
            }
            if (ivrTaskcall1.getHospType().equals("2")) {
@@ -135,12 +142,13 @@
                patTaskRelevance.setDeptName(ivrTaskcall1.getDeptname());
                patTaskRelevance.setBedNo(ivrTaskcall1.getBedNo());
                patTaskRelevance.setDiagname(ivrTaskcall1.getDiagname());
                patTaskRelevance.setPatid(ivrTaskcall1.getPatid());
                patTaskRelevances.add(patTaskRelevance);
            }
        }
        ivrTasksingleVO2.setPatTaskRelevances(patTaskRelevances);
        return ivrTasksingleVO2;
        ivrTaskVO.setPatTaskRelevances(patTaskRelevances);
        return ivrTaskVO;
    }
    @Override
@@ -195,68 +203,78 @@
     */
    @Transactional(rollbackFor = Exception.class)
    @Override
    public int insertOrUpdateTask(IvrTaskSingleVO ivrTasksingleVO) {
        if (ObjectUtils.isEmpty(ivrTasksingleVO)) {
    public int insertOrUpdateTask(IvrTaskVO ivrTaskVO) {
        if (ObjectUtils.isEmpty(ivrTaskVO)) {
            log.info("任务入参为空,请检查入参");
            throw new BaseException("任务入参为空,请检查入参");
        }
        Integer integer = 0;
        if (ivrTasksingleVO.getIsoperation() != null && ivrTasksingleVO.getIsoperation() == 1) {
        Integer integer = 1;
        IvrTask ivrTask = DtoConversionUtils.sourceToTarget(ivrTaskVO, IvrTask.class);
        ivrTask.setTextParam(JSON.toJSONString(ivrTaskVO.getTextParam()));
        if (ivrTaskVO.getIsoperation() != null && ivrTaskVO.getIsoperation() == 1) {
            //往任务表中,新增任务
            IvrTask ivrTask = DtoConversionUtils.sourceToTarget(ivrTasksingleVO, IvrTask.class);
            if (ObjectUtils.isNotEmpty(ivrTasksingleVO.getSendTimeslot()))
                ivrTask.setSendTimeSlot(JSON.toJSONString(ivrTasksingleVO.getSendTimeslot()));
            if (ObjectUtils.isNotEmpty(ivrTaskVO.getSendTimeslot()))
                ivrTask.setSendTimeSlot(JSON.toJSONString(ivrTaskVO.getSendTimeslot()));
            if (ivrTask.getSendState() == null) ivrTask.setSendState(1);
            ivrTask.setTemplateid(ivrTaskVO.getLibtemplateid());
            ivrTaskService.insertIvrTask(ivrTask);
            ivrTasksingleVO.setTaskid(ivrTask.getTaskid().longValue());
            //将任务信息放到服务表中
            IvrTaskSingle ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskVO, IvrTaskSingle.class);
            ivrTaskcall.setTaskid(ivrTask.getTaskid().longValue());
            //新增
            if (CollectionUtils.isNotEmpty(ivrTasksingleVO.getPatTaskRelevances())) {
                for (PatTaskRelevance patTaskRelevance : ivrTasksingleVO.getPatTaskRelevances()) {
            if (CollectionUtils.isNotEmpty(ivrTaskVO.getPatTaskRelevances())) {
                for (PatTaskRelevance patTaskRelevance : ivrTaskVO.getPatTaskRelevances()) {
                    //将任务信息新增到随访服务表中
                    IvrTaskSingle ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTasksingleVO, IvrTaskSingle.class);
                    ivrTaskcall.setSendname(patTaskRelevance.getName());
                    ivrTaskcall.setAge(patTaskRelevance.getAge());
                    ivrTaskcall.setSfzh(patTaskRelevance.getSfzh());
                    ivrTaskcall.setPhone(patTaskRelevance.getPhone());
                    ivrTaskcall.setAddr(patTaskRelevance.getAddr());
                    ivrTaskcall.setPatid(patTaskRelevance.getPatid());
                    ivrTaskcall.setCreateTime(DateUtils.getNowDate());
                    ivrTaskcall.setTextParam(new Gson().toJson(patTaskRelevance.getTextParam()));
                    ivrTaskcall.setCreateTime(DateUtils.getNowDate());
                    ivrTaskcall.setType(ivrTaskVO.getHospType());
                    ivrTaskSingleMapper.insertIvrTaskcall(ivrTaskcall);
                    integer = ivrTaskcall.getId().intValue();
                }
            }
        } else if (ivrTasksingleVO.getIsoperation() != null && ivrTasksingleVO.getIsoperation() == 2) {
        } else if (ivrTaskVO.getIsoperation() != null && ivrTaskVO.getIsoperation() == 2) {
            //任务修改
            IvrTask ivrTask = DtoConversionUtils.sourceToTarget(ivrTasksingleVO, IvrTask.class);
            if (ObjectUtils.isNotEmpty(ivrTasksingleVO.getSendTimeslot()))
                ivrTask.setSendTimeSlot(JSON.toJSONString(ivrTasksingleVO.getSendTimeslot()));
            //获取表里的stopState数值  + 1
            if (ObjectUtils.isNotEmpty(ivrTaskVO.getSendTimeslot()))
                ivrTask.setSendTimeSlot(JSON.toJSONString(ivrTaskVO.getSendTimeslot()));
            IvrTask ivrTask1 = ivrTaskService.selectIvrTaskByTaskid(ivrTask.getTaskid());
            ivrTask.setStopState(ivrTask1.getStopState() + 1);
            ivrTask.setTemplateid(ivrTaskVO.getLibtemplateid());
            ivrTaskService.updateIvrTask(ivrTask);
            if (CollectionUtils.isNotEmpty(ivrTasksingleVO.getPatTaskRelevances())) {
                for (PatTaskRelevance patTaskRelevance : ivrTasksingleVO.getPatTaskRelevances()) {
            if (CollectionUtils.isNotEmpty(ivrTaskVO.getPatTaskRelevances())) {
                for (PatTaskRelevance patTaskRelevance : ivrTaskVO.getPatTaskRelevances()) {
                    IvrTaskSingle ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTasksingleVO, IvrTaskSingle.class);
                    IvrTaskSingle ivrTaskcall = DtoConversionUtils.sourceToTarget(ivrTaskVO, IvrTaskSingle.class);
                    ivrTaskcall.setSendname(patTaskRelevance.getName());
                    ivrTaskcall.setAge(patTaskRelevance.getAge());
                    ivrTaskcall.setSfzh(patTaskRelevance.getSfzh());
                    ivrTaskcall.setPhone(patTaskRelevance.getPhone());
                    ivrTaskcall.setAddr(patTaskRelevance.getAddr());
                    ivrTaskcall.setPatid(patTaskRelevance.getPatid());
                    ivrTaskcall.setType(ivrTaskVO.getHospType());
                    ivrTaskcall.setCreateTime(DateUtils.getNowDate());
                    ivrTaskcall.setTextParam(new Gson().toJson(ivrTasksingleVO.getTextParam()));
                    if (patTaskRelevance.getIsoperation() == 2) ivrTaskSingleMapper.updateIvrTaskcall(ivrTaskcall);
                    if (patTaskRelevance.getIsoperation() == 1) ivrTaskSingleMapper.insertIvrTaskcall(ivrTaskcall);
                    integer = ivrTaskcall.getId().intValue();
                    ivrTaskcall.setTextParam(new Gson().toJson(ivrTaskVO.getTextParam()));
                    if (patTaskRelevance.getIsoperation() != null) {
                        if (patTaskRelevance.getIsoperation() == 2)
                            ivrTaskSingleMapper.updateIvrTaskcallByCondition(ivrTaskcall);
                        if (patTaskRelevance.getIsoperation() == 1) ivrTaskSingleMapper.insertIvrTaskcall(ivrTaskcall);
                        if (patTaskRelevance.getIsoperation() == 3)
                            //  é€šè¿‡taskid和patid去删除该条数据
                            ivrTaskSingleMapper.deleteIvrTaskcallByCondition(ivrTaskVO.getTaskid(), patTaskRelevance.getPatid());
                    }
                    integer = ivrTaskcall.getTaskid().intValue();
                }
            }
        } else if (ivrTasksingleVO.getIsoperation() != null && ivrTasksingleVO.getIsoperation() == 3) {
            ivrTaskSingleMapper.deleteIvrTaskcallById(ivrTasksingleVO.getId());
            integer = ivrTasksingleVO.getId().intValue();
        }
        return integer;
    }
@@ -269,7 +287,7 @@
    public int heTaskSend(SendTaskVO sendTaskVO) {
        if (sendTaskVO.getTaskId() == null) throw new BaseException("任务ID不能为空,请检查后,再进行执行");
        IvrTask ivrTask = ivrTaskService.selectIvrTaskByTaskid(sendTaskVO.getTaskId());
        if (StringUtils.isNotEmpty(sendTaskVO.getSendState()) && sendTaskVO.getSendState().equals("3") || StringUtils.isNotEmpty(sendTaskVO.getSendState()) && sendTaskVO.getSendState().equals("4")) {
        if (sendTaskVO.getSendState() != null && sendTaskVO.getSendState() == 3 || sendTaskVO.getSendState() != null && sendTaskVO.getSendState() == 4) {
            //任务暂停或终止
            IvrTask ivrTask3 = new IvrTask();
            ivrTask3.setTaskid(sendTaskVO.getTaskId());
@@ -283,14 +301,15 @@
        if (StringUtils.isEmpty(sendTaskVO.getSendType())) {
            sendTaskVO.setSendType(ivrTask.getSendType().toString());
        }
        Long ss = ivrTask.getStopState() + 1;
        //判断任务是否是立即发送
        if (StringUtils.isNotEmpty(sendTaskVO.getSendType()) && sendTaskVO.getSendType().equals("2")) {
            IvrTaskcallMQ ivrTaskcallMQ = new IvrTaskcallMQ();
            ivrTaskcallMQ.setTaskid(sendTaskVO.getTaskId());
            ivrTaskcallMQ.setSendType(sendTaskVO.getSendType());
            ivrTaskcallMQ.setTemplateid(ivrTask.getTemplateid().toString());
            ivrTaskcallMQ.setStopState(ivrTask.getStopState());
            ivrTaskcallMQ.setStopState(ss);
            ivrTaskcallMQ.setPreachform(ivrTask.getPreachform());
            String ivrTaskcallMQJson = JSON.toJSONString(ivrTaskcallMQ);
            ivrTaskcallMQJson = ivrTaskcallMQJson.substring(1, ivrTaskcallMQJson.length() - 1);
@@ -300,8 +319,8 @@
            //将任务状态修改成执行中
            IvrTask ivrTask2 = new IvrTask();
            ivrTask2.setTaskid(ivrTask.getTaskid());
            ivrTask2.setSendState("2");
            ivrTask2.setStopState(ivrTask.getStopState() + 1);
            ivrTask2.setSendState(2);
            ivrTask2.setStopState(ss);
            ivrTaskService.updateIvrTask(ivrTask2);
        } else if (StringUtils.isNotEmpty(sendTaskVO.getSendType()) && sendTaskVO.getSendType().equals("1")) {
            //时间段发送
@@ -309,7 +328,8 @@
            if (StringUtils.isNotEmpty(ivrTask.getSendTimeSlot())) {
                List<TaskSendTimeVO> taskSendTimeVOList = null;
                try {
                    taskSendTimeVOList = objectMapper.readValue(ivrTask.getSendTimeSlot(), List.class);
                    taskSendTimeVOList = objectMapper.readValue(ivrTask.getSendTimeSlot(), new TypeReference<List<TaskSendTimeVO>>() {
                    });
                } catch (JsonProcessingException e) {
                    log.error("JsonProcessingException报错了:{}", e.getMessage());
                }
@@ -340,17 +360,17 @@
                    Long finalMilliseconds = milliseconds;
                    String ivrTaskcallMQJson = JSON.toJSONString(ivrTaskcallMQ);
                    ivrTaskcallMQJson = ivrTaskcallMQJson.substring(1, ivrTaskcallMQJson.length() - 1);
                    rabbitMqCallPhoneConfig.sendMessage("phone_exchange", "phone.123", ivrTaskcallMQJson, 0L);
                    rabbitMqCallPhoneConfig.sendMessage("phone_exchange", "phone.123", ivrTaskcallMQJson, milliseconds);
                }
                //将任务状态修改成执行中
                IvrTask ivrTask2 = new IvrTask();
                ivrTask2.setTaskid(ivrTask.getTaskid());
                ivrTask2.setSendState("2");
                ivrTask2.setStopState(ivrTask.getStopState() + 1);
                ivrTask2.setSendState(2);
                ivrTask2.setStopState(ss);
                ivrTaskService.updateIvrTask(ivrTask2);
            }
        }
        return 0;
        return 1;
    }
    @Override
smartor/src/main/java/com/smartor/service/impl/WeChatServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,48 @@
package com.smartor.service.impl;
import com.smartor.domain.WeChatSendVo;
import com.smartor.service.WeChatService;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class WeChatServiceImpl implements WeChatService {
    @Value("${appid}")
    private String appid;
    @Value("${appSecret}")
    private String appSecret;
    @Override
    public Boolean sendMessageToFollowers(WeChatSendVo weChatSendVo) {
        WxMpService wxMpService;
        wxMpService = new WxMpServiceImpl();
        wxMpService.setWxMpConfigStorage(new WxMpInMemoryConfigStorage());
        WxMpInMemoryConfigStorage wxMpConfigStorage = (WxMpInMemoryConfigStorage) wxMpService.getWxMpConfigStorage();
        wxMpConfigStorage.setAppId(appid);
        wxMpConfigStorage.setSecret(appSecret);
        try {
            List<String> openIdList = wxMpService.getUserService().userList(null).getOpenids();
            for (String openId : openIdList) {
                WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder().toUser(openId).templateId(weChatSendVo.getTemplateId()).url(weChatSendVo.getUrl()).build();
                for (String key : weChatSendVo.getContent().keySet()) {
                    templateMessage.addData(new WxMpTemplateData(key, weChatSendVo.getContent().get(key).toString()));
                }
                wxMpService.getTemplateMsgService().sendTemplateMsg(templateMessage);
            }
        } catch (WxErrorException e) {
            e.printStackTrace();
        }
        return true;
    }
}
smartor/src/main/resources/mapper/smartor/IvrLibaTemplateMapper.xml
@@ -228,7 +228,7 @@
            <if test="mateNum != null ">mate_num = #{mateNum},</if>
            <if test="revisitAfter != null ">revisit_after = #{revisitAfter},</if>
            <if test="revisitBefore != null ">revisit_before = #{revisitBefore},</if>
            <if test="noVoiceNum != null and noVoiceNum > 0 ">no_voice_num = #{noVoiceNum}</if>
            <if test="noVoiceNum != null and noVoiceNum > 0 ">no_voice_num = #{noVoiceNum},</if>
            <if test="silencetime != null">silencetime = #{silencetime}</if>
        </trim>
        where ID = #{ID}
smartor/src/main/resources/mapper/smartor/IvrTaskMapper.xml
@@ -41,14 +41,24 @@
        <result property="libtemplatename" column="libtemplatename"/>
        <result property="libtemplatename" column="libtemplatename"/>
        <result property="stopState" column="stop_state"/>
        <result property="showDate" column="show_date"/>
        <result property="showTimeMorn" column="show_time_morn"/>
        <result property="showTimeNoon" column="show_time_noon"/>
        <result property="showTimeNight" column="show_time_night"/>
        <result property="textParam" column="text_param"/>
    </resultMap>
    <sql id="selectIvrTaskVo">
        select taskid,
               task_name,
               show_date,
               show_time_morn,
               show_time_noon,
               show_time_night,
               libtemplateid,
               libtemplatename,
               stop_state,
               text_param,
               templateid,
               templatename,
               labelinfo,
@@ -85,7 +95,7 @@
        <include refid="selectIvrTaskVo"/>
        <where>
            <if test="taskName != null  and taskName != ''">and task_name like concat('%', #{taskName}, '%')</if>
            <if test="sendTimeSlot != null  and sendTimeSlot != ''">and sendTimeSlot like concat('%', #{sendTimeSlot},
            <if test="sendTimeSlot != null  and sendTimeSlot != ''">and send_time_slot like concat('%', #{sendTimeSlot},
                '%')
            </if>
            <if test="templateid != null  and templateid != ''">and templateid = #{templateid}</if>
@@ -111,7 +121,6 @@
            <if test="hospType != null  and hospType != ''">and hosp_type = #{hospType}</if>
            <if test="libtemplateid != null ">and libtemplateid = #{libtemplateid}</if>
            <if test="libtemplatename != null  and libtemplatename != ''">and libtemplatename = #{libtemplatename}</if>
            <if test="stopState != null  ">and stop_state = #{stopState}</if>
        </where>
        order by update_time desc,taskid desc
    </select>
@@ -157,8 +166,13 @@
            <if test="taskDesc != null  and taskDesc != ''">task_desc,</if>
            <if test="libtemplateid != null ">libtemplateid,</if>
            <if test="libtemplatename != null  and libtemplatename != ''">libtemplatename,</if>
            <if test="sendTimeSlot != null  and sendTimeSlot != ''">sendTimeSlot,</if>
            <if test="sendTimeSlot != null  and sendTimeSlot != ''">send_time_slot,</if>
            <if test="stopState != null">stop_state,</if>
            <if test="showDate != null and showDate != ''">show_date,</if>
            <if test="showTimeNight != null and showTimeNight != ''">show_time_night,</if>
            <if test="showTimeNoon != null and showTimeNoon != ''">show_time_noon,</if>
            <if test="showTimeMorn != null and showTimeMorn != ''">show_time_morn,</if>
            <if test="textParam != null and textParam != ''">text_param,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="taskName != null">#{taskName},</if>
@@ -194,6 +208,11 @@
            <if test="libtemplatename != null  and libtemplatename != ''">#{libtemplatename},</if>
            <if test="sendTimeSlot != null  and sendTimeSlot != ''">#{sendTimeSlot},</if>
            <if test="stopState != null">#{stopState},</if>
            <if test="showDate != null and showDate != ''">#{showDate},</if>
            <if test="showTimeNight != null and showTimeNight != ''">#{showTimeNight},</if>
            <if test="showTimeNoon != null and showTimeNoon != ''">#{showTimeNoon},</if>
            <if test="showTimeMorn != null and showTimeMorn != ''">#{showTimeMorn},</if>
            <if test="textParam != null and textParam != ''">#{textParam},</if>
        </trim>
    </insert>
@@ -233,6 +252,11 @@
            <if test="libtemplatename != null  and libtemplatename != ''">libtemplatename = #{libtemplatename},</if>
            <if test="sendTimeSlot != null  and sendTimeSlot != ''">send_time_slot=#{sendTimeSlot},</if>
            <if test="stopState != null ">stop_state=#{stopState},</if>
            <if test="showDate != null and showDate != ''">show_date=#{showDate},</if>
            <if test="showTimeNight != null and showTimeNight != ''">show_time_night=#{showTimeNight},</if>
            <if test="showTimeNoon != null and showTimeNoon != ''">show_time_noon=#{showTimeNoon},</if>
            <if test="showTimeMorn != null and showTimeMorn != ''">show_time_morn=#{showTimeMorn},</if>
            <if test="textParam != null and textParam != ''">text_param=#{textParam},</if>
        </trim>
        where taskid = #{taskid}
    </update>
smartor/src/main/resources/mapper/smartor/IvrTaskSingleMapper.xml
@@ -18,12 +18,6 @@
        <result property="templateid" column="templateid"/>
        <result property="templatename" column="templatename"/>
        <result property="senddate" column="senddate"/>
        <result property="sendlimitabegin" column="sendlimitabegin"/>
        <result property="sendlimitaend" column="sendlimitaend"/>
        <result property="sendlimitpbegin" column="sendlimitpbegin"/>
        <result property="sendlimitpend" column="sendlimitpend"/>
        <result property="sendlimitnbegin" column="sendlimitnbegin"/>
        <result property="sendlimitnend" column="sendlimitnend"/>
        <result property="senduuid" column="senduuid"/>
        <result property="result" column="result"/>
        <result property="finishtime" column="finishtime"/>
@@ -57,6 +51,7 @@
        <result property="deptname" column="deptname"/>
        <result property="admindate" column="admindate"/>
        <result property="roomno" column="roomno"/>
        <result property="patid" column="patid"/>
        <result property="libtemplatename" column="libtemplatename"/>
        <result property="libtemplateid" column="libtemplateid"/>
    </resultMap>
@@ -70,6 +65,7 @@
               phone,
               sex,
               age,
               patid,
               sfzh,
               addr,
               senderdetail,
@@ -78,12 +74,6 @@
               templateid,
               templatename,
               senddate,
               sendlimitabegin,
               sendlimitaend,
               sendlimitpbegin,
               sendlimitpend,
               sendlimitnbegin,
               sendlimitnend,
               senduuid,
               result,
               finishtime,
@@ -115,6 +105,7 @@
               roomno,
               admindate,
               deptname,
               stop_state,
               diagname
        from ivr_task_single
    </sql>
@@ -127,6 +118,7 @@
            <if test="phone != null  and phone != ''">and phone = #{phone}</if>
            <if test="sex != null  and sex != ''">and sex = #{sex}</if>
            <if test="age != null ">and age = #{age}</if>
            <if test="patid != null ">and patid = #{patid}</if>
            <if test="sfzh != null  and sfzh != ''">and sfzh = #{sfzh}</if>
            <if test="addr != null  and addr != ''">and addr = #{addr}</if>
            <if test="senderdetail != null  and senderdetail != ''">and senderdetail = #{senderdetail}</if>
@@ -137,12 +129,6 @@
                '%')
            </if>
            <if test="senddate != null ">and senddate = #{senddate}</if>
            <if test="sendlimitabegin != null  and sendlimitabegin != ''">and sendlimitabegin = #{sendlimitabegin}</if>
            <if test="sendlimitaend != null  and sendlimitaend != ''">and sendlimitaend = #{sendlimitaend}</if>
            <if test="sendlimitpbegin != null  and sendlimitpbegin != ''">and sendlimitpbegin = #{sendlimitpbegin}</if>
            <if test="sendlimitpend != null  and sendlimitpend != ''">and sendlimitpend = #{sendlimitpend}</if>
            <if test="sendlimitnbegin != null  and sendlimitnbegin != ''">and sendlimitnbegin = #{sendlimitnbegin}</if>
            <if test="sendlimitnend != null  and sendlimitnend != ''">and sendlimitnend = #{sendlimitnend}</if>
            <if test="senduuid != null  and senduuid != ''">and senduuid = #{senduuid}</if>
            <if test="result != null  and result != ''">and result = #{result}</if>
            <if test="finishtime != null ">and finishtime = #{finishtime}</if>
@@ -191,12 +177,6 @@
            <if test="templateid != null">templateid,</if>
            <if test="templatename != null">templatename,</if>
            <if test="senddate != null">senddate,</if>
            <if test="sendlimitabegin != null">sendlimitabegin,</if>
            <if test="sendlimitaend != null">sendlimitaend,</if>
            <if test="sendlimitpbegin != null">sendlimitpbegin,</if>
            <if test="sendlimitpend != null">sendlimitpend,</if>
            <if test="sendlimitnbegin != null">sendlimitnbegin,</if>
            <if test="sendlimitnend != null">sendlimitnend,</if>
            <if test="senduuid != null">senduuid,</if>
            <if test="result != null">result,</if>
            <if test="finishtime != null">finishtime,</if>
@@ -232,6 +212,7 @@
            <if test="diagname != null  and diagname != ''">diagname,</if>
            <if test="libtemplateid != null ">libtemplateid,</if>
            <if test="libtemplatename != null ">libtemplatename,</if>
            <if test="patid != null ">patid,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="sendname != null">#{sendname},</if>
@@ -246,12 +227,6 @@
            <if test="templateid != null">#{templateid},</if>
            <if test="templatename != null">#{templatename},</if>
            <if test="senddate != null">#{senddate},</if>
            <if test="sendlimitabegin != null">#{sendlimitabegin},</if>
            <if test="sendlimitaend != null">#{sendlimitaend},</if>
            <if test="sendlimitpbegin != null">#{sendlimitpbegin},</if>
            <if test="sendlimitpend != null">#{sendlimitpend},</if>
            <if test="sendlimitnbegin != null">#{sendlimitnbegin},</if>
            <if test="sendlimitnend != null">#{sendlimitnend},</if>
            <if test="senduuid != null">#{senduuid},</if>
            <if test="result != null">#{result},</if>
            <if test="finishtime != null">#{finishtime},</if>
@@ -287,7 +262,7 @@
            <if test="diagname != null  and diagname != ''">#{diagname},</if>
            <if test="libtemplateid != null ">#{libtemplateid},</if>
            <if test="libtemplatename != null ">#{libtemplatename},</if>
            <if test="stopState != null ">#{stopState},</if>
            <if test="patid != null ">#{patid},</if>
        </trim>
    </insert>
@@ -306,12 +281,6 @@
            <if test="templateid != null">templateid = #{templateid},</if>
            <if test="templatename != null">templatename = #{templatename},</if>
            <if test="senddate != null">senddate = #{senddate},</if>
            <if test="sendlimitabegin != null">sendlimitabegin = #{sendlimitabegin},</if>
            <if test="sendlimitaend != null">sendlimitaend = #{sendlimitaend},</if>
            <if test="sendlimitpbegin != null">sendlimitpbegin = #{sendlimitpbegin},</if>
            <if test="sendlimitpend != null">sendlimitpend = #{sendlimitpend},</if>
            <if test="sendlimitnbegin != null">sendlimitnbegin = #{sendlimitnbegin},</if>
            <if test="sendlimitnend != null">sendlimitnend = #{sendlimitnend},</if>
            <if test="senduuid != null">senduuid = #{senduuid},</if>
            <if test="result != null">result = #{result},</if>
            <if test="finishtime != null">finishtime = #{finishtime},</if>
@@ -347,8 +316,64 @@
            <if test="diagname != null  and diagname != ''">diagname = #{diagname},</if>
            <if test="libtemplateid != null ">libtemplateid = #{libtemplateid},</if>
            <if test="libtemplatename != null ">libtemplatename = #{libtemplatename},</if>
            <if test="patid != null ">patid = #{patid},</if>
        </trim>
        where id = #{id}
    </update>
    <update id="updateIvrTaskcallByCondition" parameterType="com.smartor.domain.IvrTaskSingle">
        update ivr_task_single
        <trim prefix="SET" suffixOverrides=",">
            <if test="sendname != null">sendname = #{sendname},</if>
            <if test="phone != null">phone = #{phone},</if>
            <if test="sex != null">sex = #{sex},</if>
            <if test="age != null">age = #{age},</if>
            <if test="sfzh != null">sfzh = #{sfzh},</if>
            <if test="addr != null">addr = #{addr},</if>
            <if test="senderdetail != null">senderdetail = #{senderdetail},</if>
            <if test="type != null">type = #{type},</if>
            <if test="taskid != null">taskid = #{taskid},</if>
            <if test="templateid != null">templateid = #{templateid},</if>
            <if test="templatename != null">templatename = #{templatename},</if>
            <if test="senddate != null">senddate = #{senddate},</if>
            <if test="senduuid != null">senduuid = #{senduuid},</if>
            <if test="result != null">result = #{result},</if>
            <if test="finishtime != null">finishtime = #{finishtime},</if>
            <if test="recordid != null">recordid = #{recordid},</if>
            <if test="exrecallcount != null">exrecallcount = #{exrecallcount},</if>
            <if test="pulltime != null">pulltime = #{pulltime},</if>
            <if test="deptcode != null">deptcode = #{deptcode},</if>
            <if test="labelstatus != null">labelstatus = #{labelstatus},</if>
            <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="isupload != null">isupload = #{isupload},</if>
            <if test="uploadTime != null">upload_time = #{uploadTime},</if>
            <if test="orgid != null">orgid = #{orgid},</if>
            <if test="pid != null">pid = #{pid},</if>
            <if test="guid != null">guid = #{guid},</if>
            <if test="textParam != null">text_param = #{textParam},</if>
            <if test="serviceform != null">serviceform = #{serviceform},</if>
            <if test="bedNo != null">bed_no = #{bedNo},</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>
            <if test="wechat != null  and wechat != ''">wechat = #{wechat},</if>
            <if test="roomno != null  and roomno != ''">roomno = #{roomno},</if>
            <if test="admindate != null  and admindate != ''">admindate = #{admindate},</if>
            <if test="deptname != null  and deptname != ''">deptname = #{deptname},</if>
            <if test="diagname != null  and diagname != ''">diagname = #{diagname},</if>
            <if test="libtemplateid != null ">libtemplateid = #{libtemplateid},</if>
            <if test="libtemplatename != null ">libtemplatename = #{libtemplatename},</if>
            <if test="patid != null ">patid = #{patid},</if>
        </trim>
        where patid = #{patid} and taskid = #{taskid}
    </update>
    <update id="deleteIvrTaskcallById" parameterType="Long">
@@ -357,6 +382,14 @@
            del_flag =1
        </trim>
        where id = #{id}
    </update>
    <update id="deleteIvrTaskcallByCondition" >
        update ivr_task_single
        <trim prefix="SET" suffixOverrides=",">
            del_flag =1
        </trim>
        where patid = #{patid} and taskid = #{taskid}
    </update>
    <select id="getDataByTime" resultMap="IvrTaskcallResult">
@@ -374,12 +407,6 @@
               templateid,
               templatename,
               senddate,
               sendlimitabegin,
               sendlimitaend,
               sendlimitpbegin,
               sendlimitpend,
               sendlimitnbegin,
               sendlimitnend,
               senduuid,
               result,
               finishtime,
@@ -411,6 +438,7 @@
               wechat,
               roomno,
               admindate,
               patid,
               deptname,
               diagname
        FROM ivr_task_single,
smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
@@ -341,7 +341,12 @@
            <if test="deptname != null and deptname != ''">
                AND d.deptname LIKE concat('%',#{deptname}, '%')
            </if>
            <if test="pids != null">
                AND a.patid NOT IN
                <foreach collection="pids" item="pid" open="(" separator="," close=")">
                    #{pid}
                </foreach>
            </if>
            AND d.del_flag != 1
            AND a.del_flag != 1
        </where>
@@ -351,8 +356,6 @@
            resultMap="PatArchiveResult">
        select
        -- c.tagname as tag,
        -- b.tagid as tagid,
        a.patid,
        d.deptname,
        a.name,
@@ -381,7 +384,6 @@
        a.isupload,
        a.upload_time,
        a.pattype
        -- from pat_archive a,pat_archivetag b ,base_tag c, pat_med_outhosp d
        from pat_archive a, pat_med_outhosp d
        <where>
            a.patid = d.patid
@@ -389,11 +391,6 @@
            <if test="name != null  and name != ''">and a.name like concat('%', #{name}, '%')</if>
            <if test="idcardno != null  and idcardno != ''">and a.idcardno = #{idcardno}</if>
            <if test="telcode != null  and telcode != ''">and a.telcode = #{telcode}</if>
            <!--            <if test="tagIds != null  and tagIds != ''">and c.tagid in-->
            <!--                <foreach collection="tagIds" item="tagId" open="(" separator="," close=")">-->
            <!--                    #{tagId}-->
            <!--                </foreach>-->
            <!--            </if>-->
            <if test="hospitaldistrictname != null and hospitaldistrictname != ''">
                AND d.hospitaldistrictname LIKE concat('%',#{hospitaldistrictname}, '%')
            </if>
@@ -412,10 +409,13 @@
            <if test="drname != null and drname != ''">
                AND d.drname LIKE concat('%',#{drname}, '%')
            </if>
            <if test="pids != null">
                AND a.patid NOT IN
                <foreach collection="pids" item="pid" open="(" separator="," close=")">
                    #{pid}
                </foreach>
            </if>
            AND d.del_flag != 1
            -- AND b.del_flag != 1
            -- AND c.del_flag != 1
            AND a.del_flag != 1
        </where>
    </select>
@@ -424,8 +424,6 @@
            resultMap="PatArchiveResult">
        select
        -- c.tagname as tag,
        -- b.tagid as tagid,
        a.patid as id,
        a.name,
        a.sex,
@@ -454,7 +452,6 @@
        a.isupload,
        a.upload_time,
        a.pattype
        -- from pat_archive a,pat_archivetag b ,base_tag c, pat_med_physical d
        from pat_archive a, pat_med_physical d
        <where>
            a.patid = d.patid
@@ -462,11 +459,6 @@
            <if test="name != null  and name != ''">and a.name like concat('%', #{name}, '%')</if>
            <if test="idcardno != null  and idcardno != ''">and a.idcardno = #{idcardno}</if>
            <if test="telcode != null  and telcode != ''">and a.telcode = #{telcode}</if>
<!--            <if test="tagIds != null  and tagIds != ''">and c.tagid in-->
<!--                <foreach collection="tagIds" item="tagId" open="(" separator="," close=")">-->
<!--                    #{tagId}-->
<!--                </foreach>-->
<!--            </if>-->
            <if test="hospitaldistrictname != null and hospitaldistrictname != ''">
                AND d.hospitaldistrictname LIKE concat('%',#{hospitaldistrictname}, '%')
            </if>
@@ -486,10 +478,13 @@
            <if test="drname != null and drname != ''">
                AND d.drname LIKE concat('%',#{drname}, '%')
            </if>
            <if test="pids != null">
                AND a.patid NOT IN
                <foreach collection="pids" item="pid" open="(" separator="," close=")">
                    #{pid}
                </foreach>
            </if>
            AND d.del_flag != 1
--             AND b.del_flag != 1
--             AND c.del_flag != 1
            AND a.del_flag != 1
        </where>