| | |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.enums.ServiceFromEnum; |
| | | import com.ruoyi.common.utils.IPUtils; |
| | | import com.ruoyi.common.utils.RSAPublicKeyExample; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.web.task.PhoneTask; |
| | |
| | | import org.springframework.data.redis.connection.Message; |
| | | import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; |
| | | import org.springframework.data.redis.listener.RedisMessageListenerContainer; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.*; |
| | | import javax.annotation.Syntax; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.UUID; |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | | import java.util.concurrent.TimeUnit; |
| | |
| | | @Value("${pub_key}") |
| | | private String pub_key; |
| | | |
| | | @Value("${localIP}") |
| | | private String localIP; |
| | | |
| | | @Value("${req_path}") |
| | | private String req_path; |
| | | |
| | | private static IIvrTaskTemplateService ivrTaskTemplateService; |
| | | @Autowired |
| | | private IIvrTaskTemplateService ivrTaskTemplateService; |
| | | |
| | | private static ServiceSubtaskMapper ivrTaskcallMapper; |
| | | @Autowired |
| | | private ServiceSubtaskMapper ivrTaskcallMapper; |
| | | |
| | | private static ServiceTaskMapper ivrTaskMapper; |
| | | @Autowired |
| | | private ServiceTaskMapper ivrTaskMapper; |
| | | |
| | | private static SendService sendService; |
| | | @Autowired |
| | | private SendService sendService; |
| | | |
| | | private static RedisCache redisCache; |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | private static RobotPhoneUtils robotPhoneUtils; |
| | | @Autowired |
| | | private RobotPhoneUtils robotPhoneUtils; |
| | | |
| | | @Autowired |
| | | private SvyTaskMapper svyTaskMapper; |
| | |
| | | super(listenerContainer); |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | public void setIIvrTaskTemplateService(IIvrTaskTemplateService ivrTaskTemplateService) { |
| | | RedisMqReceiver.ivrTaskTemplateService = ivrTaskTemplateService; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setRobotPhoneUtilsService(RobotPhoneUtils robotPhoneUtils) { |
| | | RedisMqReceiver.robotPhoneUtils = robotPhoneUtils; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setSendService(SendService sendService) { |
| | | RedisMqReceiver.sendService = sendService; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setIvrTaskcallMapper(ServiceSubtaskMapper ivrTaskcallMapper) { |
| | | RedisMqReceiver.ivrTaskcallMapper = ivrTaskcallMapper; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setIvrTaskMapper(ServiceTaskMapper ivrTaskMapper) { |
| | | RedisMqReceiver.ivrTaskMapper = ivrTaskMapper; |
| | | } |
| | | |
| | | @Autowired |
| | | public void setRedisCache(RedisCache redisCache) { |
| | | RedisMqReceiver.redisCache = redisCache; |
| | | } |
| | | |
| | | @Override |
| | | public void onMessage(Message message, byte[] pattern) { |
| | | log.info("监听Redis key过期,key:{},channel:{}", message.toString(), new String(pattern)); |
| | | String ip = "116.62.18.175"; |
| | | log.error("本机的网络IP为:{}", ip); |
| | | String content = message.toString(); |
| | | //判断是不是任务信息,如果不是,直接返回,不需要执行 |
| | | if (!content.contains("taskid")) { |
| | | log.info("不是任务信息"); |
| | | return; |
| | | synchronized (RedisMqReceiver.class) { |
| | | String ip = localIP; |
| | | log.error("本机的网络IP为:{}", ip); |
| | | String content = message.toString(); |
| | | //判断是不是任务信息,如果不是,直接返回,不需要执行 |
| | | if (!content.contains("taskid")) { |
| | | log.info("不是任务信息"); |
| | | return; |
| | | } |
| | | CommonTaskcallMQ commonTaskcallMQ = null; |
| | | try { |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | if (!content.startsWith("{")) { |
| | | commonTaskcallMQ = mapper.readValue("{" + content + "}", CommonTaskcallMQ.class); |
| | | } else { |
| | | commonTaskcallMQ = mapper.readValue(content, CommonTaskcallMQ.class); |
| | | } |
| | | //这里之所以这样做一下,是搞不懂,为啥会进来两遍 |
| | | Boolean aBoolean = redisCache.hasKey(commonTaskcallMQ.getTaskid().toString()); |
| | | if (aBoolean) { |
| | | return; |
| | | } else { |
| | | redisCache.setCacheObject(commonTaskcallMQ.getTaskid().toString(), commonTaskcallMQ.getTaskid().toString(), 60, TimeUnit.SECONDS); |
| | | } |
| | | if (commonTaskcallMQ.getTaskType() == 1) { |
| | | //随访 |
| | | sfHandle(commonTaskcallMQ, ip); |
| | | } else if (commonTaskcallMQ.getTaskType() == 2) { |
| | | //问卷 |
| | | wjHandle(commonTaskcallMQ, ip); |
| | | } else if (commonTaskcallMQ.getTaskType() == 3) { |
| | | //宣教 |
| | | xjHandle(commonTaskcallMQ, ip); |
| | | } |
| | | //处理完成,移除redis |
| | | redisCache.deleteObject(message.toString()); |
| | | |
| | | } catch (Exception e) { |
| | | Integer integer = redisCache.getCacheObject(commonTaskcallMQ.getTaskid().toString()); |
| | | if (integer != null && integer == 2) { |
| | | //将消息从队列中删除 |
| | | } else if (integer == null) { |
| | | redisCache.setCacheObject(commonTaskcallMQ.getTaskid().toString(), 1, 120, TimeUnit.MINUTES); |
| | | } else { |
| | | redisCache.setCacheObject(commonTaskcallMQ.getTaskid().toString(), integer + 1, 120, TimeUnit.MINUTES); |
| | | } |
| | | |
| | | log.error("============消费失败,尝试消息补发再次消费!============== {}", e.getMessage()); |
| | | redisCache.setCacheObject(message.toString(), message.toString(), 60, TimeUnit.SECONDS); |
| | | } |
| | | } |
| | | CommonTaskcallMQ commonTaskcallMQ = null; |
| | | try { |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | if (!content.startsWith("{")) { |
| | | commonTaskcallMQ = mapper.readValue("{" + content + "}", CommonTaskcallMQ.class); |
| | | } else { |
| | | commonTaskcallMQ = mapper.readValue(content, CommonTaskcallMQ.class); |
| | | } |
| | | |
| | | if (commonTaskcallMQ.getTaskType() == 1) { |
| | | //随访 |
| | | sfHandle(commonTaskcallMQ, ip); |
| | | } else if (commonTaskcallMQ.getTaskType() == 2) { |
| | | //问卷 |
| | | wjHandle(commonTaskcallMQ, ip); |
| | | } else if (commonTaskcallMQ.getTaskType() == 3) { |
| | | //宣教 |
| | | xjHandle(commonTaskcallMQ, ip); |
| | | } |
| | | |
| | | |
| | | } catch (Exception e) { |
| | | Integer integer = redisCache.getCacheObject(commonTaskcallMQ.getTaskid().toString()); |
| | | if (integer != null && integer == 2) { |
| | | //将消息从队列中删除 |
| | | } else if (integer == null) { |
| | | redisCache.setCacheObject(commonTaskcallMQ.getTaskid().toString(), 1, 120, TimeUnit.MINUTES); |
| | | } else { |
| | | redisCache.setCacheObject(commonTaskcallMQ.getTaskid().toString(), integer + 1, 120, TimeUnit.MINUTES); |
| | | } |
| | | |
| | | log.error("============消费失败,尝试消息补发再次消费!============== {}", e.getMessage()); |
| | | redisCache.setCacheObject(message.toString(), message.toString(), 60, TimeUnit.SECONDS); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | //通过模板ID获取模板问题 |
| | | IvrTaskTemplateVO ivrTaskTemplateVO = new IvrTaskTemplateVO(); |
| | | ivrTaskTemplateVO.setID(Long.valueOf(commonTaskcallMQ.getTemplateid())); |
| | | ivrTaskTemplateVO.setId(Long.valueOf(commonTaskcallMQ.getTemplateid())); |
| | | IvrTaskTemplateVO ivrTaskTemplateVO1 = ivrTaskTemplateService.selectInfoByCondition(ivrTaskTemplateVO); |
| | | |
| | | //通过任务ID拿到患者信息 |
| | | ServiceSubtask ivrTaskcall = new ServiceSubtask(); |
| | | ivrTaskcall.setTaskid(commonTaskcallMQ.getTaskid()); |
| | | List<ServiceSubtask> ivrTaskcalls = ivrTaskcallMapper.selectServiceSubtaskList(ivrTaskcall); |
| | | List<ServiceSubtask> selectServiceSubtaskList = ivrTaskcallMapper.selectServiceSubtaskList(ivrTaskcall); |
| | | if (descByCode.equals("电话")) { |
| | | for (ServiceSubtask ivrTaskcall1 : ivrTaskcalls) { |
| | | ServiceTask ivrTask = ivrTaskMapper.selectServiceTaskByTaskid(ivrTaskcall1.getTaskid()); |
| | | for (ServiceSubtask serviceSubtask : selectServiceSubtaskList) { |
| | | ServiceTask ivrTask = ivrTaskMapper.selectServiceTaskByTaskid(serviceSubtask.getTaskid()); |
| | | if (ivrTask.getSendState() != null && ivrTask.getSendState() == 3 || ivrTask.getSendState() != null && ivrTask.getSendState() == 4) { |
| | | //如何任务被“暂停”或“终止” |
| | | break; |
| | |
| | | |
| | | //任务发送记录(这个代码应该写在phoneTask中,先写在这,后面再改) |
| | | ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord(); |
| | | serviceSubtaskRecord.setTaskid(ivrTaskcall1.getTaskid().toString()); |
| | | serviceSubtaskRecord.setTaskid(serviceSubtask.getTaskid().toString()); |
| | | serviceSubtaskRecord.setUuid(UUID.randomUUID().toString()); |
| | | serviceSubtaskRecord.setTasktype(ivrTaskcall1.getType()); |
| | | serviceSubtaskRecord.setTasktype(serviceSubtask.getType()); |
| | | serviceSubtaskRecord.setPreachform("3"); |
| | | serviceSubtaskRecord.setStartTime(System.currentTimeMillis()); |
| | | serviceSubtaskRecordService.insertServiceSubtaskRecord(serviceSubtaskRecord); |
| | | |
| | | //通过多线程的方式去打电话 |
| | | executorService.submit(new PhoneTask(ivrTaskcall1, ivrTaskTemplateVO1, redisCache, sendService, phonePath, robotPhoneUtils)); |
| | | executorService.submit(new PhoneTask(serviceSubtask, ivrTaskTemplateVO1, redisCache, sendService, phonePath, robotPhoneUtils)); |
| | | } |
| | | } else if (descByCode.equals("多媒体")) { |
| | | //多媒体 |
| | | return; |
| | | } else if (descByCode.equals("纸质")) { |
| | | //纸质 |
| | | return; |
| | | } else if (descByCode.equals("短信")) { |
| | | //短信 |
| | | // http://localhost:8099/followvisit/particty?param1=3¶m2=348 |
| | |
| | | RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample(); |
| | | String taskId = rsaPublicKeyExample.encryptedData(ivrTask1.getTaskid().toString(), pub_key); |
| | | |
| | | for (ServiceSubtask ivrTaskSingle : ivrTaskcalls) { |
| | | String patid = rsaPublicKeyExample.encryptedData(ivrTaskSingle.getPatid().toString(), pub_key); |
| | | for (ServiceSubtask serviceSubtask : selectServiceSubtaskList) { |
| | | String patid = rsaPublicKeyExample.encryptedData(serviceSubtask.getPatid().toString(), pub_key); |
| | | SendMagParam sendMagParam = new SendMagParam(); |
| | | sendMagParam.setType("4"); |
| | | sendMagParam.setUrl(ip + ":" + req_path + "/followvisit/particty?param1=" + taskId + "¶m2=" + patid); |
| | |
| | | |
| | | //任务发送记录 |
| | | ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord(); |
| | | serviceSubtaskRecord.setTaskid(ivrTaskSingle.getTaskid().toString()); |
| | | serviceSubtaskRecord.setTaskid(serviceSubtask.getTaskid().toString()); |
| | | serviceSubtaskRecord.setUuid(UUID.randomUUID().toString()); |
| | | serviceSubtaskRecord.setTasktype(ivrTaskSingle.getType()); |
| | | serviceSubtaskRecord.setTasktype(serviceSubtask.getType()); |
| | | serviceSubtaskRecord.setPreachform("4"); |
| | | serviceSubtaskRecord.setStartTime(System.currentTimeMillis()); |
| | | serviceSubtaskRecord.setResult(aBoolean == true ? "成功" : "失败"); |
| | |
| | | //公众号 |
| | | RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample(); |
| | | String taskId = rsaPublicKeyExample.encryptedData(ivrTask1.getTaskid().toString(), pub_key); |
| | | for (ServiceSubtask ivrTaskSingle : ivrTaskcalls) { |
| | | String patid = rsaPublicKeyExample.encryptedData(ivrTaskSingle.getPatid().toString(), pub_key); |
| | | for (ServiceSubtask serviceSubtask : selectServiceSubtaskList) { |
| | | String patid = rsaPublicKeyExample.encryptedData(serviceSubtask.getPatid().toString(), pub_key); |
| | | SendMagParam sendMagParam = new SendMagParam(); |
| | | sendMagParam.setType("5"); |
| | | sendMagParam.setUrl(ip + ":" + req_path + "/outsideChain?param1=" + ivrTask1.getTaskid().toString() + "¶m2=" + ivrTaskSingle.getPatid().toString() + "¶m3=" + ivrTask1.getTaskName()); |
| | | sendMagParam.setUrl(ip + ":" + req_path + "/outsideChain?param1=" + ivrTask1.getTaskid().toString() + "¶m2=" + serviceSubtask.getPatid().toString() + "¶m3=" + ivrTask1.getTaskName()); |
| | | log.info("链接完整路径:{}", req_path + "/outsideChain?param1=" + taskId + "¶m2=" + patid + "¶m3=" + ivrTask1.getTaskName()); |
| | | //这个模板ID先写死,后面做成可选 |
| | | sendMagParam.setTmpCode("oG3pJHPVWpE81DmZsua_2tKwgJ97r0qz37z56ns7NB4"); |
| | | Map map = new HashMap(); |
| | | map.put("first", ivrTask1.getTaskName()); |
| | | sendMagParam.setContent(JSON.toJSONString(map)); |
| | | sendMagParam.setOpenid(serviceSubtask.getOpenid()); |
| | | |
| | | Boolean aBoolean = sendService.sendMsg(sendMagParam); |
| | | |
| | | //任务发送记录 |
| | | ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord(); |
| | | serviceSubtaskRecord.setTaskid(ivrTaskSingle.getTaskid().toString()); |
| | | serviceSubtaskRecord.setTaskid(serviceSubtask.getTaskid().toString()); |
| | | serviceSubtaskRecord.setUuid(UUID.randomUUID().toString()); |
| | | serviceSubtaskRecord.setTasktype(ivrTaskSingle.getType()); |
| | | serviceSubtaskRecord.setTasktype(serviceSubtask.getType()); |
| | | serviceSubtaskRecord.setPreachform("4"); |
| | | serviceSubtaskRecord.setStartTime(System.currentTimeMillis()); |
| | | serviceSubtaskRecord.setResult(aBoolean == true ? "成功" : "失败"); |
| | |
| | | |
| | | //通过模板ID获取模板问题 |
| | | IvrTaskTemplateVO ivrTaskTemplateVO = new IvrTaskTemplateVO(); |
| | | ivrTaskTemplateVO.setID(Long.valueOf(commonTaskcallMQ.getTemplateid())); |
| | | ivrTaskTemplateVO.setId(Long.valueOf(commonTaskcallMQ.getTemplateid())); |
| | | IvrTaskTemplateVO ivrTaskTemplateVO1 = ivrTaskTemplateService.selectInfoByCondition(ivrTaskTemplateVO); |
| | | |
| | | //通过任务ID拿到患者信息 |
| | |
| | | if (socketMessage.getTemplateId() != null) { |
| | | //通过模板ID获取模板问题 |
| | | IvrTaskTemplateVO ivrTaskTemplateVO = new IvrTaskTemplateVO(); |
| | | ivrTaskTemplateVO.setID(socketMessage.getTemplateId()); |
| | | ivrTaskTemplateVO.setId(socketMessage.getTemplateId()); |
| | | IvrTaskTemplateVO ivrTaskTemplateVO1 = ivrTaskTemplateService.selectInfoByCondition(ivrTaskTemplateVO); |
| | | redisCache.setCacheObject(userId + "ivrTaskTemplateVO1", ivrTaskTemplateVO1, 120, TimeUnit.MINUTES); |
| | | //将查出来的问题,放到全局变量中去 |
| | |
| | | if (ivrLibaExtemplatescript.getIsEnd() == 1) { |
| | | //将问题置空 |
| | | IvrTaskTemplateScriptVO nowQuestion1 = returnQues.getNowQuestion(); |
| | | nowQuestion1.setQuestionText(null); |
| | | nowQuestion1.setQuestionVoice(null); |
| | | nowQuestion1.setScriptContent(null); |
| | | nowQuestion1.setScriptVoice(null); |
| | | returnQues.setNowQuestion(nowQuestion1); |
| | | redisCache.setCacheObject(userId + "returnQues", returnQues, 120, TimeUnit.MINUTES); |
| | | |
| | |
| | | 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.domain.IvrLibaScript; |
| | | import com.smartor.domain.IvrLibaScriptVO; |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:script:list')") |
| | | @PostMapping("/list") |
| | | public TableDataInfo list(@RequestBody IvrLibaScript ivrLibaScript) { |
| | | startPage(); |
| | | PageUtils.startPageByPost(ivrLibaScript.getPageNum(),ivrLibaScript.getPageSize()); |
| | | List<IvrLibaScript> list = ivrLibaScriptService.selectIvrLibaScriptList(ivrLibaScript); |
| | | return getDataTable(list); |
| | | } |
| | |
| | | * @param weChatSendVo |
| | | * @return |
| | | */ |
| | | @ApiOperation("微信公众号信息发送") |
| | | @PostMapping("/sendMessageToFollowers") |
| | | public AjaxResult sendMessageToFollowers(@RequestBody WeChatSendVo weChatSendVo) { |
| | | return toAjax(weChatService.sendMessageToFollowers(weChatSendVo)); |
| | | } |
| | | // @ApiOperation("微信公众号信息发送") |
| | | // @PostMapping("/sendMessageToFollowers") |
| | | // public AjaxResult sendMessageToFollowers(@RequestBody WeChatSendVo weChatSendVo) { |
| | | // return toAjax(weChatService.sendMessageToFollowers(weChatSendVo)); |
| | | // } |
| | | |
| | | |
| | | /** |
| | |
| | | for (IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO : ivrTaskTemplateScriptVO) { |
| | | for (Map<String, String> map : mapList) { |
| | | for (String key : map.keySet()) { |
| | | ivrTaskTemplateScriptVO.setQuestionText(ivrTaskTemplateScriptVO.getQuestionText().replace(key, map.get(key))); |
| | | ivrTaskTemplateScriptVO.setScriptContent(ivrTaskTemplateScriptVO.getScriptContent().replace(key, map.get(key))); |
| | | } |
| | | } |
| | | } |
| | |
| | | redisCache.setCacheObject(uuid + "returnQues", returnQues, 120, TimeUnit.MINUTES); |
| | | redisCache.setCacheObject(uuid + "ivrTaskTemplateVO", ivrTaskTemplateVO, 120, TimeUnit.MINUTES); |
| | | |
| | | System.out.println("----------------uuID为 :" + uuid + " " + ivrTaskSingle.getSendname() + " " + returnQues.getNowQuestion().getQuestionText() + " " + ivrTaskSingle.getPhone()); |
| | | System.out.println("----------------uuID为 :" + uuid + " " + ivrTaskSingle.getSendname() + " " + returnQues.getNowQuestion().getScriptContent() + " " + ivrTaskSingle.getPhone()); |
| | | |
| | | //先将话术放到ob_queue队列中 |
| | | IvrTaskcallPhoneMQ ivrTaskcallPhoneMQ = new IvrTaskcallPhoneMQ(); |
| | | ivrTaskcallPhoneMQ.setScript(ivrTaskTemplateVO.getRevisitBefore() + returnQues.getNowQuestion().getQuestionText()); |
| | | ivrTaskcallPhoneMQ.setScript(ivrTaskTemplateVO.getRevisitBefore() + returnQues.getNowQuestion().getScriptContent()); |
| | | ivrTaskcallPhoneMQ.setType("1"); |
| | | ivrTaskcallPhoneMQ.setUuid(uuid); |
| | | String data = JSON.toJSONString(ivrTaskcallPhoneMQ); |
| | |
| | | |
| | | //调用机器人电话,开始电话 |
| | | String ob = phoneUtils.ob("", "", "", "", "", "", "", ivrTaskSingle.getPhone(), uuid, true); |
| | | System.out.println("----------------uuID为 :" + uuid + " " + ivrTaskSingle.getSendname() + " " + returnQues.getNowQuestion().getQuestionText() + " " + ivrTaskSingle.getPhone() + "----------已经拨打"); |
| | | System.out.println("----------------uuID为 :" + uuid + " " + ivrTaskSingle.getSendname() + " " + returnQues.getNowQuestion().getScriptContent() + " " + ivrTaskSingle.getPhone() + "----------已经拨打"); |
| | | Map<String, String> obMap = objectMapper.readValue(ob, Map.class); |
| | | Thread.sleep(1000); |
| | | redisCache.setCacheObject(uuid + "state_id", "0", 10, TimeUnit.MINUTES); |
| | |
| | | map.put("keyword2", "12657698798797"); |
| | | map.put("remark", "啊啊撒啊啊啊"); |
| | | weChatSendVo.setContent(map); |
| | | weChatController.sendMessageToFollowers(weChatSendVo); |
| | | // weChatController.sendMessageToFollowers(weChatSendVo); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | #二维码路径 |
| | | qrpath: D:\qrcode |
| | | |
| | | localIP: 192.168.2.8 |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | weChatSendVo.setContent(map); |
| | | weChatSendVo.setOpenid(sendMagParam.getOpenid()); |
| | | Boolean aBoolean1 = weChatService.sendMessageToFollowers(weChatSendVo); |
| | | return aBoolean1; |
| | | case ("6"): |
| | |
| | | * 发送时间段 |
| | | */ |
| | | @ApiModelProperty(value = "发送时间段 ") |
| | | private List<TaskSendTimeVO> sendTimeslot; |
| | | private TaskSendTimeVO sendTimeslot; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "标签") |
| | | private String tag; |
| | | |
| | | /** |
| | | * pageNum |
| | | */ |
| | | @ApiModelProperty(value = "pageNum") |
| | | @Excel(name = "pageNum") |
| | | private Integer pageNum; |
| | | |
| | | /** |
| | | * pageSize |
| | | */ |
| | | @ApiModelProperty(value = "pageSize") |
| | | @Excel(name = "pageSize") |
| | | private Integer pageSize; |
| | | |
| | | } |
| | |
| | | @Excel(name = "分组ID") |
| | | @ApiModelProperty(value = "分组ID") |
| | | private String groupid; |
| | | |
| | | /** |
| | | * 适用题型(单选、多选、埴空、组合) |
| | | */ |
| | | @Excel(name = "适用题型(单选、多选、埴空、组合)") |
| | | @ApiModelProperty(value = "适用题型(单选、多选、埴空、组合)") |
| | | private String scriptType; |
| | | |
| | | /** |
| | | * 指标类型 |
| | |
| | | private String groupid; |
| | | |
| | | /** |
| | | * 适用题型(单选、多选、埴空、组合) |
| | | */ |
| | | @Excel(name = "适用题型(单选、多选、埴空、组合)") |
| | | @ApiModelProperty(value = "适用题型(单选、多选、埴空、组合)") |
| | | private String scriptType; |
| | | |
| | | /** |
| | | * 指标类型 |
| | | */ |
| | | @Excel(name = "指标类型") |
| | |
| | | */ |
| | | @Excel(name = "话术内容") |
| | | @ApiModelProperty(value = "话术内容") |
| | | private String scriptConten; |
| | | private String scriptContent; |
| | | |
| | | /** |
| | | * 话术描述 |
| | |
| | | * 主键 |
| | | */ |
| | | @ApiModelProperty(value = "主键") |
| | | private Long ID; |
| | | private Long id; |
| | | |
| | | /** |
| | | * 任务id |
| | |
| | | @ApiModelProperty(value = "任务id") |
| | | private Long taskid; |
| | | |
| | | /** |
| | | * 模板话术编号 |
| | | */ |
| | | @Excel(name = "模板话术编号") |
| | | @ApiModelProperty(value = "模板话术编号") |
| | | private Long templateQuestionNum; |
| | | |
| | | /** |
| | | * 模板ID |
| | |
| | | @ApiModelProperty(value = "模板ID") |
| | | private Long templateID; |
| | | |
| | | /** |
| | | * 话术ID |
| | | */ |
| | | @Excel(name = "话术ID") |
| | | @ApiModelProperty(value = "话术ID") |
| | | private Long scriptID; |
| | | |
| | | /** |
| | | * 问题点 |
| | |
| | | @Excel(name = "问题点") |
| | | @ApiModelProperty(value = "问题点") |
| | | private String questionPoint; |
| | | |
| | | /** |
| | | * 话术内容 |
| | | */ |
| | | @Excel(name = "话术内容") |
| | | @ApiModelProperty(value = "话术内容") |
| | | private String questionText; |
| | | |
| | | /** |
| | | * 话术语音 |
| | | */ |
| | | @Excel(name = "话术语音") |
| | | @ApiModelProperty(value = "话术语音") |
| | | private String questionVoice; |
| | | |
| | | /** |
| | | * 无匹配话术 |
| | |
| | | @Excel(name = "基础指标值") |
| | | @ApiModelProperty(value = "基础指标值") |
| | | private String targetvalue; |
| | | |
| | | /** |
| | | * 标题 |
| | | */ |
| | | @Excel(name = "标题") |
| | | @ApiModelProperty(value = "标题") |
| | | private String questiontitle; |
| | | |
| | | /** |
| | | * 下一题 |
| | | */ |
| | | @Excel(name = "下一题") |
| | | @ApiModelProperty(value = "下一题") |
| | | private Long nextQuestion; |
| | | |
| | | /** |
| | | * 其它数据(存储变量) |
| | |
| | | */ |
| | | @Excel(name = "模板话术编号") |
| | | @ApiModelProperty(value = "模板话术编号") |
| | | private Long templateQuestionNum; |
| | | private Long scriptno; |
| | | |
| | | /** |
| | | * 模板ID |
| | |
| | | */ |
| | | @Excel(name = "话术内容") |
| | | @ApiModelProperty(value = "话术内容") |
| | | private String questionText; |
| | | private String scriptContent; |
| | | |
| | | /** |
| | | * 话术语音 |
| | | */ |
| | | @Excel(name = "话术语音") |
| | | @ApiModelProperty(value = "话术语音") |
| | | private String questionVoice; |
| | | private String scriptVoice; |
| | | |
| | | /** |
| | | * 无匹配话术 |
| | |
| | | */ |
| | | @Excel(name = "标题") |
| | | @ApiModelProperty(value = "标题") |
| | | private String questiontitle; |
| | | private String scriptTopic; |
| | | |
| | | /** |
| | | * 下一题 |
| | | */ |
| | | @Excel(name = "下一题") |
| | | @ApiModelProperty(value = "下一题") |
| | | private Long nextQuestion; |
| | | private Long nextScriptno; |
| | | |
| | | /** |
| | | * 其它数据(存储变量) |
| | |
| | | * 主键 |
| | | */ |
| | | @ApiModelProperty(value = "主键") |
| | | private Long ID; |
| | | private Long id; |
| | | |
| | | /** |
| | | * 任务id |
| | |
| | | private Long patid; |
| | | |
| | | /** |
| | | * 微信公众号患者ID |
| | | */ |
| | | @Excel(name = "微信公众号患者ID") |
| | | @ApiModelProperty("微信公众号患者ID") |
| | | private String openid; |
| | | |
| | | /** |
| | | * 宣教任务ID |
| | | */ |
| | | @Excel(name = "宣教任务ID") |
| | |
| | | private String tmpCode; |
| | | |
| | | private String url; |
| | | |
| | | private String openid; |
| | | } |
| | |
| | | */ |
| | | @Excel(name = " 任务类型: 1 随访 2 问卷 3 宣教 ") |
| | | @ApiModelProperty(value = "任务类型: 1 随访 2 问卷 3 宣教 ") |
| | | private Integer taskType = 1; |
| | | private Integer taskType; |
| | | |
| | | |
| | | } |
| | |
| | | private String phone; |
| | | |
| | | /** |
| | | * 手机号 |
| | | */ |
| | | @Excel(name = " 手机号 ") |
| | | @ApiModelProperty(value = "手机号") |
| | | private String openid; |
| | | |
| | | /** |
| | | * 性别 |
| | | */ |
| | | @Excel(name = " 性别") |
| | |
| | | /** |
| | | * |
| | | */ |
| | | @Excel(name = " ") |
| | | @Excel(name = "类型名称") |
| | | private String typename; |
| | | |
| | | /** |
| | |
| | | private Long id; |
| | | |
| | | /** |
| | | * 老版本ID |
| | | */ |
| | | @ApiModelProperty("老版本ID") |
| | | private Long oldid; |
| | | |
| | | /** |
| | | * 问券题目分类ID |
| | | */ |
| | | @ApiModelProperty("分类ID") |
| | | private Long categoryid; |
| | | |
| | | /** |
| | | * 问卷ID |
| | | */ |
| | | @Excel(name = " 问卷ID ") |
| | | @ApiModelProperty("问卷ID") |
| | | private Long svyid; |
| | | |
| | | /** |
| | | * 题目类型;枚举 1.单选 2多选 3填空 |
| | | */ |
| | | @Excel(name = " 题目类型;枚举 1.单选 2多选 3填空 ") |
| | | @ApiModelProperty("题目类型;枚举 1.单选 2多选 3填空") |
| | | private String scripttype = ""; |
| | | private String scriptType = ""; |
| | | |
| | | /** |
| | | * 题目Code |
| | |
| | | @ApiModelProperty("自增ID") |
| | | private Long id; |
| | | |
| | | /** |
| | | * 问卷ID |
| | | */ |
| | | @Excel(name = " 问卷模板ID ") |
| | | @ApiModelProperty("问卷模板ID") |
| | | private Long svyid; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 题目类型;枚举 1.单选 2多选 3填空 4其它 |
| | |
| | | @ApiModelProperty(value = "跳转URL") |
| | | String url; |
| | | |
| | | /** |
| | | * 用户微信ID |
| | | */ |
| | | @ApiModelProperty(value = "用户微信ID") |
| | | String openid; |
| | | |
| | | } |
| | |
| | | serviceTask.setTaskid(sendTaskVO.getTaskId()); |
| | | serviceTask.setStopState(ivrTask.getStopState() + 1); |
| | | serviceTask.setSendState(sendTaskVO.getSendState()); |
| | | ivrTaskService.updateServiceTask(serviceTask); |
| | | return 0; |
| | | int i = ivrTaskService.updateServiceTask(serviceTask); |
| | | return i; |
| | | } |
| | | |
| | | //判断发送状态是否为空 |
| | |
| | | serviceTask.setTaskid(ivrTask.getTaskid()); |
| | | serviceTask.setSendState(2); |
| | | ivrTaskService.updateServiceTask(serviceTask); |
| | | log.error("消息发送成功"); |
| | | } else if (StringUtils.isNotEmpty(sendTaskVO.getSendType()) && sendTaskVO.getSendType().equals("1") || StringUtils.isNotEmpty(sendTaskVO.getSendType()) && sendTaskVO.getSendType().equals("3")) { |
| | | //时间段发送 |
| | | ObjectMapper objectMapper = new ObjectMapper(); |
| | |
| | | log.error("JsonProcessingException报错了:{}", e.getMessage()); |
| | | } |
| | | for (TaskSendTimeVO taskSendTimeVO : taskSendTimeVOList) { |
| | | //去SendTimeslot中,获取所有的时间段 |
| | | List<TaskSendTimeVO> list = new ArrayList<>(); |
| | | list.add(taskSendTimeVO); |
| | | // //去SendTimeslot中,获取所有的时间段 |
| | | // List<TaskSendTimeVO> list = new ArrayList<>(); |
| | | // list.add(taskSendTimeVO); |
| | | |
| | | //获取开始发送时间 |
| | | String begantime = taskSendTimeVO.getBegantime(); |
| | |
| | | Date date = sdf.parse(begantime); |
| | | milliseconds = date.getTime() - System.currentTimeMillis(); |
| | | System.out.println("日期毫秒数:" + milliseconds); |
| | | SendTaskVO sendTaskVO1 = DtoConversionUtils.sourceToTarget(sendTaskVO, SendTaskVO.class); |
| | | sendTaskVO1.setSendType("1"); |
| | | String content = sendMQContent(sendTaskVO1, ivrTask.getTemplateid().toString(), ivrTask.getPreachform(), ivrTask.getStopState(), taskSendTimeVO); |
| | | redisCache.setCacheObject(content, content, milliseconds / 1000, TimeUnit.SECONDS); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | if (milliseconds < 0) |
| | | throw new BaseException("请检查任务开始时间,不能小于当前时间"); |
| | | } |
| | | |
| | | SendTaskVO sendTaskVO1 = DtoConversionUtils.sourceToTarget(sendTaskVO, SendTaskVO.class); |
| | | sendTaskVO1.setSendType("1"); |
| | | String content = sendMQContent(sendTaskVO1, ivrTask.getTemplateid().toString(), ivrTask.getPreachform(), ivrTask.getStopState(), list); |
| | | redisCache.setCacheObject(content, content, milliseconds / 1000, TimeUnit.SECONDS); |
| | | } |
| | | //将任务状态修改成执行中 |
| | | ServiceTask serviceTask = new ServiceTask(); |
| | |
| | | serviceTask.setSendState(2); |
| | | ivrTaskService.updateServiceTask(serviceTask); |
| | | } |
| | | } |
| | | return 1; |
| | | } return 1; |
| | | } |
| | | |
| | | public int wjSend(SendTaskVO sendTaskVO) { |
| | |
| | | } |
| | | for (TaskSendTimeVO taskSendTimeVO : taskSendTimeVOList) { |
| | | //去SendTimeslot中,获取所有的时间段 |
| | | List<TaskSendTimeVO> list = new ArrayList<>(); |
| | | list.add(taskSendTimeVO); |
| | | // List<TaskSendTimeVO> list = new ArrayList<>(); |
| | | // list.add(taskSendTimeVO); |
| | | |
| | | //获取开始发送时间 |
| | | String begantime = taskSendTimeVO.getBegantime(); |
| | |
| | | |
| | | SendTaskVO sendTaskVO1 = DtoConversionUtils.sourceToTarget(sendTaskVO, SendTaskVO.class); |
| | | sendTaskVO1.setSendType("1"); |
| | | String content = sendMQContent(sendTaskVO1, serviceTask1.getTemplateid().toString(), serviceTask1.getPreachform(), serviceTask1.getStopState(), list); |
| | | String content = sendMQContent(sendTaskVO1, serviceTask1.getTemplateid().toString(), serviceTask1.getPreachform(), serviceTask1.getStopState(), taskSendTimeVO); |
| | | redisCache.setCacheObject(content, content, milliseconds / 1000, TimeUnit.SECONDS); |
| | | } |
| | | //将任务状态修改成执行中 |
| | |
| | | } |
| | | for (TaskSendTimeVO taskSendTimeVO : taskSendTimeVOList) { |
| | | //去SendTimeslot中,获取所有的时间段 |
| | | List<TaskSendTimeVO> list = new ArrayList<>(); |
| | | list.add(taskSendTimeVO); |
| | | // List<TaskSendTimeVO> list = new ArrayList<>(); |
| | | // list.add(taskSendTimeVO); |
| | | |
| | | //获取开始发送时间 |
| | | String begantime = taskSendTimeVO.getBegantime(); |
| | |
| | | |
| | | SendTaskVO sendTaskVO1 = DtoConversionUtils.sourceToTarget(sendTaskVO, SendTaskVO.class); |
| | | sendTaskVO1.setSendType("1"); |
| | | String content = sendMQContent(sendTaskVO1, serviceTask1.getTemplateid().toString(), serviceTask1.getPreachform(), serviceTask1.getStopState(), list); |
| | | String content = sendMQContent(sendTaskVO1, serviceTask1.getTemplateid().toString(), serviceTask1.getPreachform(), serviceTask1.getStopState(), taskSendTimeVO); |
| | | redisCache.setCacheObject(content, content, milliseconds / 1000, TimeUnit.SECONDS); |
| | | } |
| | | //将任务状态修改成执行中 |
| | |
| | | * @param sendTimeslot |
| | | * @return |
| | | */ |
| | | private String sendMQContent(SendTaskVO sendTaskVO, String templateid, String preachform, Long stopState, List<TaskSendTimeVO> sendTimeslot) { |
| | | private String sendMQContent(SendTaskVO sendTaskVO, String templateid, String preachform, Long stopState, TaskSendTimeVO sendTimeslot) { |
| | | CommonTaskcallMQ commonTaskcallMQ = new CommonTaskcallMQ(); |
| | | commonTaskcallMQ.setTaskid(sendTaskVO.getTaskId()); |
| | | commonTaskcallMQ.setSendType(sendTaskVO.getSendType()); |
| | |
| | | //新增 |
| | | ivrTaskTemplate.setCreateTime(new Date()); |
| | | insertIvrTaskTemplate(ivrTaskTemplate); |
| | | i = ivrTaskTemplate.getID().intValue(); |
| | | i = ivrTaskTemplate.getId().intValue(); |
| | | } else if (ivrTaskTemplateVO.getIsoperation() != null && ivrTaskTemplateVO.getIsoperation() == 2) { |
| | | //修改 |
| | | ivrTaskTemplate.setUpdateTime(new Date()); |
| | | updateIvrTaskTemplate(ivrTaskTemplate); |
| | | i = ivrTaskTemplate.getID().intValue(); |
| | | i = ivrTaskTemplate.getId().intValue(); |
| | | } |
| | | log.info("新增随访任务随访模板的id为:{}", ivrTaskTemplate.getID()); |
| | | log.info("新增随访任务随访模板的id为:{}", ivrTaskTemplate.getId()); |
| | | |
| | | //对模板话术和选项进行处理(话术表与指标表进行合并了,) |
| | | if (CollectionUtils.isNotEmpty(ivrTaskTemplateVO.getIvrTaskTemplateScriptVOList())) { |
| | |
| | | for (IvrTaskTemplateScriptVO ivrTaskTemplateScriptVO : ivrTaskTemplateVO.getIvrTaskTemplateScriptVOList()) { |
| | | if (ivrTaskTemplateScriptVO.getIsoperation() != null) { |
| | | IvrTaskTemplateScript ivrTaskTemplateScript = scriptHandle(ivrTaskTemplate, ivrTaskTemplateScriptVO, ivrTaskTemplateScriptVO.getIsoperation()); |
| | | dealOption(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList(), ivrTaskTemplateScript, ivrTaskTemplate.getID(), ivrTaskTemplateScriptVO.getIsoperation()); |
| | | dealOption(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList(), ivrTaskTemplateScript, ivrTaskTemplate.getId(), ivrTaskTemplateScriptVO.getIsoperation()); |
| | | } else { |
| | | IvrTaskTemplateScript ivrTaskTemplateScript = scriptHandle(ivrTaskTemplate, ivrTaskTemplateScriptVO, ivrTaskTemplateVO.getIsoperation()); |
| | | dealOption(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList(), ivrTaskTemplateScript, ivrTaskTemplate.getID(), ivrTaskTemplateVO.getIsoperation()); |
| | | dealOption(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList(), ivrTaskTemplateScript, ivrTaskTemplate.getId(), ivrTaskTemplateVO.getIsoperation()); |
| | | } |
| | | } |
| | | } |
| | | return ivrTaskTemplate.getID().intValue(); |
| | | return ivrTaskTemplate.getId().intValue(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | //查询话术 |
| | | IvrTaskTemplateScript ivrTaskTemplateScript = new IvrTaskTemplateScript(); |
| | | ivrTaskTemplateScript.setTemplateID(ivrTaskTemplates.get(0).getID()); |
| | | ivrTaskTemplateScript.setTemplateID(ivrTaskTemplates.get(0).getId()); |
| | | List<IvrTaskTemplateScript> ivrTaskTemplateScripts = ivrTaskTemplateScriptMapper.selectIvrTaskTemplateScriptList(ivrTaskTemplateScript); |
| | | List<IvrTaskTemplateScriptVO> ivrTaskTemplateScriptVOS = DtoConversionUtils.sourceToTarget(ivrTaskTemplateScripts, IvrTaskTemplateScriptVO.class); |
| | | |
| | |
| | | |
| | | if (isoperation == 1) { |
| | | //新增 |
| | | ivrTaskTemplateScript.setTemplateID(ivrTaskTemplate.getID()); |
| | | ivrTaskTemplateScript.setTemplateID(ivrTaskTemplate.getId()); |
| | | ivrTaskTemplateScript.setCreateTime(new Date()); |
| | | ivrTaskTemplateScriptMapper.insertIvrTaskTemplateScript(ivrTaskTemplateScript); |
| | | ivrTaskTemplateScript.setIsoperation(1); |
| | | } else if (isoperation == 2) { |
| | | //修改 |
| | | ivrTaskTemplateScript.setTemplateID(ivrTaskTemplate.getID()); |
| | | ivrTaskTemplateScript.setTemplateID(ivrTaskTemplate.getId()); |
| | | ivrTaskTemplateScript.setUpdateTime(new Date()); |
| | | ivrTaskTemplateScriptMapper.updateIvrTaskTemplateScript(ivrTaskTemplateScript); |
| | | ivrTaskTemplateScript.setIsoperation(2); |
| | |
| | | serviceSubtask.setSendstate(1L); |
| | | serviceSubtask.setType(serviceTaskVO.getHospType()); |
| | | serviceSubtask.setHospType(patTaskRelevance.getHospType()); |
| | | serviceSubtask.setOpenid(patTaskRelevance.getOpenid()); |
| | | serviceSubtaskMapper.insertServiceSubtask(serviceSubtask); |
| | | integer = serviceSubtask.getId().intValue(); |
| | | } |
| | |
| | | serviceSubtask.setPhone(patTaskRelevance.getPhone()); |
| | | serviceSubtask.setAddr(patTaskRelevance.getAddr()); |
| | | serviceSubtask.setPatid(patTaskRelevance.getPatid()); |
| | | serviceSubtask.setOpenid(patTaskRelevance.getOpenid()); |
| | | serviceSubtask.setType(serviceTaskVO.getHospType()); |
| | | serviceSubtask.setCreateTime(DateUtils.getNowDate()); |
| | | serviceSubtask.setHospType(patTaskRelevance.getHospType()); |
| | |
| | | // 问题, 去调用“tts合成和播放”接口 |
| | | String date = simpleDateFormat1.format(new Date()); |
| | | log.info("去调用tts合成和播放接口: {},uuid为:{}", date, phoneCallBackVO.getUuid()); |
| | | phoneUtils.ttsPlayback(nowQuestion.getQuestionText(), phoneCallBackVO.getUuid()); |
| | | phoneUtils.ttsPlayback(nowQuestion.getScriptContent(), phoneCallBackVO.getUuid()); |
| | | } |
| | | } else { |
| | | redisCache.setCacheObject(phoneCallBackVO.getUuid() + "noVoice", noVoice + 1, 120, TimeUnit.MINUTES); |
| | |
| | | //静默话术 + 问题, 去调用“tts合成和播放”接口 |
| | | String date = simpleDateFormat1.format(new Date()); |
| | | log.info("静默话术 + 问题,去调用tts合成和播放接口: {},uuid为:{}", date, phoneCallBackVO.getUuid()); |
| | | phoneUtils.ttsPlayback(slienceText + nowQuestion.getQuestionText(), phoneCallBackVO.getUuid()); |
| | | phoneUtils.ttsPlayback(slienceText + nowQuestion.getScriptContent(), phoneCallBackVO.getUuid()); |
| | | return; |
| | | } |
| | | |
| | |
| | | Pattern pattern2 = Pattern.compile(nowQuestion.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()); |
| | | matcher2 = pattern2.matcher(phoneCallBackVO.getTextResult()); |
| | | } |
| | | log.error("PCB--getQuestionText问题为:{},UUID:{}", nowQuestion.getQuestionText(), phoneCallBackVO.getUuid()); |
| | | log.error("PCB--getQuestionText问题为:{},UUID:{}", nowQuestion.getScriptContent(), phoneCallBackVO.getUuid()); |
| | | if (StringUtils.isNotEmpty(nowQuestion.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() && StringUtils.isNotEmpty(nowQuestion.getIvrTaskScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches() || StringUtils.isEmpty(nowQuestion.getIvrTaskScriptTargetoptionList().get(j).getTargetregex()) && StringUtils.isNotEmpty(nowQuestion.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() || StringUtils.isEmpty(nowQuestion.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()) && StringUtils.isNotEmpty(nowQuestion.getIvrTaskScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches()) { |
| | | //说明匹配正确了 |
| | | //这里应该先判断类型,去再修改,设置IsUserOperation是单选题的改法 |
| | |
| | | //将患者的回签写进表里 |
| | | IvrTaskVisitResult serviceTaskVisitResult = DtoConversionUtils.sourceToTarget(serviceSubtask, IvrTaskVisitResult.class); |
| | | serviceTaskVisitResult.setId(null); |
| | | serviceTaskVisitResult.setQuestion(nowQuestion.getQuestionText()); |
| | | serviceTaskVisitResult.setQuestion(nowQuestion.getScriptContent()); |
| | | serviceTaskVisitResult.setPatientAnswer(phoneCallBackVO.getTextResult()); |
| | | serviceTaskVisitResult.setCreateTime(new Date()); |
| | | serviceTaskVisitResult.setOptionResult(nowQuestion.getIvrTaskScriptTargetoptionList().get(j).getTargetvalue()); |
| | |
| | | questionMessage.setNowQuestion(script); |
| | | questionMessage.setQuestionList(IvrTaskTemplateScriptVOs); |
| | | redisCache.setCacheObject(phoneCallBackVO.getUuid() + "returnQues", questionMessage, 120, TimeUnit.MINUTES); |
| | | phoneUtils.ttsPlayback(script.getQuestionText(), phoneCallBackVO.getUuid()); |
| | | phoneUtils.ttsPlayback(script.getScriptContent(), phoneCallBackVO.getUuid()); |
| | | return; |
| | | } else if (nextQuestion > IvrTaskTemplateScriptVOs.size()) { |
| | | //没有下一题了,就结束了 |
| | |
| | | redisCache.setCacheObject(phoneCallBackVO.getUuid() + "mateNum", 0, 120, TimeUnit.MINUTES); |
| | | String date = simpleDateFormat1.format(new Date()); |
| | | log.info("如果下一题为空.则新的数据返回,并加上感谢语: {},uuid为:{}", date, phoneCallBackVO.getUuid()); |
| | | phoneUtils.ttsPlayback(nextQuestion.getQuestionText(), phoneCallBackVO.getUuid()); |
| | | phoneUtils.ttsPlayback(nextQuestion.getScriptContent(), phoneCallBackVO.getUuid()); |
| | | return; |
| | | } else { |
| | | //就可以挂断电话了 |
| | |
| | | if (ivrLibaExtemplatescript.getIsEnd() == 1) { |
| | | //将问题置空 |
| | | IvrTaskTemplateScriptVO nowQuestion1 = questionMessage.getNowQuestion(); |
| | | nowQuestion1.setQuestionText(null); |
| | | nowQuestion1.setQuestionVoice(null); |
| | | nowQuestion1.setScriptContent(null); |
| | | nowQuestion1.setScriptVoice(null); |
| | | questionMessage.setNowQuestion(nowQuestion1); |
| | | redisCache.setCacheObject(phoneCallBackVO.getUuid() + "returnQues", questionMessage, 120, TimeUnit.MINUTES); |
| | | |
| | |
| | | //调用“15、tts合成和播放, tts_playback”将结果传回 |
| | | String date = simpleDateFormat1.format(new Date()); |
| | | log.info("调用“15、tts合成和播放------: {},uuid为:{}", date, phoneCallBackVO.getUuid()); |
| | | phoneUtils.ttsPlayback(nowQuestion.getQuestionText() + ivrTaskTemplateScriptVO.getSubmoduleText(), phoneCallBackVO.getUuid()); |
| | | phoneUtils.ttsPlayback(nowQuestion.getScriptContent() + ivrTaskTemplateScriptVO.getSubmoduleText(), phoneCallBackVO.getUuid()); |
| | | } |
| | | break; |
| | | } |
| | | String date = simpleDateFormat1.format(new Date()); |
| | | log.info("最后的信息回复-: {},uuid为:{}", date, phoneCallBackVO.getUuid()); |
| | | phoneUtils.ttsPlayback(nowQuestion.getQuestionText(), phoneCallBackVO.getUuid()); |
| | | phoneUtils.ttsPlayback(nowQuestion.getScriptContent(), phoneCallBackVO.getUuid()); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | //将模板问题话术里的通配符替换 |
| | | for (IvrLibaTemplateScriptVO ivrLibaTemplateScriptVO : ivrLibaTemplateScriptVOS) { |
| | | if (StringUtils.isNotEmpty(ivrLibaTemplateScriptVO.getScriptConten())) { |
| | | if (StringUtils.isNotEmpty(ivrLibaTemplateScriptVO.getScriptContent())) { |
| | | for (Map<String, String> map : mapList) { |
| | | for (String key : map.keySet()) { |
| | | |
| | | ivrLibaTemplateScriptVO.setScriptConten(ivrLibaTemplateScriptVO.getScriptConten().replace(key, StringUtils.isNotEmpty(map.get(key)) ? map.get(key) : "")); |
| | | ivrLibaTemplateScriptVO.setScriptContent(ivrLibaTemplateScriptVO.getScriptContent().replace(key, StringUtils.isNotEmpty(map.get(key)) ? map.get(key) : "")); |
| | | } |
| | | } |
| | | //替换患者个人信息数据 |
| | | ivrLibaTemplateScriptVO.setScriptConten(ivrLibaTemplateScriptVO.getScriptConten().replace("${name}", StringUtils.isNotEmpty(patArchive.getName()) ? patArchive.getName() : "")); |
| | | ivrLibaTemplateScriptVO.setScriptConten(ivrLibaTemplateScriptVO.getScriptConten().replace("${dzz}", StringUtils.isNotEmpty(patArchive.getPlaceOfResidence()) ? patArchive.getPlaceOfResidence() : "")); |
| | | ivrLibaTemplateScriptVO.setScriptConten(ivrLibaTemplateScriptVO.getScriptConten().replace("${dhh}", StringUtils.isNotEmpty(patArchive.getTelcode()) ? patArchive.getTelcode() : "")); |
| | | ivrLibaTemplateScriptVO.setScriptContent(ivrLibaTemplateScriptVO.getScriptContent().replace("${name}", StringUtils.isNotEmpty(patArchive.getName()) ? patArchive.getName() : "")); |
| | | ivrLibaTemplateScriptVO.setScriptContent(ivrLibaTemplateScriptVO.getScriptContent().replace("${dzz}", StringUtils.isNotEmpty(patArchive.getPlaceOfResidence()) ? patArchive.getPlaceOfResidence() : "")); |
| | | ivrLibaTemplateScriptVO.setScriptContent(ivrLibaTemplateScriptVO.getScriptContent().replace("${dhh}", StringUtils.isNotEmpty(patArchive.getTelcode()) ? patArchive.getTelcode() : "")); |
| | | |
| | | //获取问题选项 |
| | | IvrLibaTemplateTargetoption ivrLibaTemplateTargetoption = new IvrLibaTemplateTargetoption(); |
| | |
| | | if (StringUtils.isNotEmpty(svyLibScripts.get(j).getIcd10Name())) |
| | | svyLibScripts.get(j).setIcd10NameList(JSONArray.parseArray(svyLibScripts.get(j).getIcd10Name(), String.class)); |
| | | |
| | | if (StringUtils.isNotEmpty(svyLibScripts.get(j).getScripttype()) && svyLibScripts.get(j).getScripttype().equals("3") || svyLibScripts.get(j).getId() == null) { |
| | | if (StringUtils.isNotEmpty(svyLibScripts.get(j).getScriptType()) && svyLibScripts.get(j).getScriptType().equals("3") || svyLibScripts.get(j).getId() == null) { |
| | | //作答题,不需要选项 |
| | | continue; |
| | | } else { |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | |
| | | List<SvyLibTemplate> svyLibTemplates = svyLibTemplateMapper.selectSvyLibTemplateList(svyLibTemplateReq); |
| | | //添加题目 |
| | | for (int i = 0; i < svyLibTemplates.size(); i++) { |
| | | // SvyLibScript svyLibScript = new SvyLibScript(); |
| | | // svyLibScript.setSvyid(svyLibTemplates.get(i).getSvyid()); |
| | | // List<SvyLibScript> svyLibTopics = svyLibScriptMapper.selectSvyLibScriptList(svyLibScript); |
| | | SvyLibTemplateScript svyLibTemplateScript = new SvyLibTemplateScript(); |
| | | svyLibTemplateScript.setId(svyLibTemplates.get(i).getSvyid()); |
| | | svyLibTemplateScript.setSvyid(svyLibTemplates.get(i).getSvyid()); |
| | | List<SvyLibTemplateScript> svyLibTemplateScripts = svyLibTemplateScriptMapper.selectSvyLibTemplateScriptList(svyLibTemplateScript); |
| | | //获取题目选项 |
| | | a: |
| | |
| | | return libTemplates; |
| | | } |
| | | |
| | | // /** |
| | | // * 新增问卷 |
| | | // * |
| | | // * @param svyLibTemplate 问卷 |
| | | // * @return 结果 |
| | | // */ |
| | | // @Transactional |
| | | // @Override |
| | | // public int insertSvyLibTemplate(SvyLibTemplate svyLibTemplate) { |
| | | // svyLibTemplate.setCreateTime(DateUtils.getNowDate()); |
| | | // svyLibTemplateMapper.insertSvyLibTemplate(svyLibTemplate); |
| | | // //关联问卷疾病 |
| | | // for (String icdId : svyLibTemplate.getIcdID()) { |
| | | // Icd10Association icd10Association = new Icd10Association(); |
| | | // icd10Association.setIcd10code(icdId); |
| | | // icd10Association.setSvyid(svyLibTemplate.getSvyid()); |
| | | // icd10AssociationMapper.insertIcd10Association(icd10Association); |
| | | // } |
| | | // //新增问题题目 |
| | | // for (int i = 0; i < svyLibTemplate.getSvyLibScripts().size(); i++) { |
| | | // SvyLibScript svyLibScript = svyLibTemplate.getSvyLibScripts().get(i); |
| | | // svyLibScript.setSvyid(svyLibTemplate.getSvyid()); |
| | | // //题目的选项目,直接用svy_topicoption表,用svyTopicidf去关联 |
| | | // svyLibScriptMapper.insertSvyLibScript(svyLibScript); |
| | | // } |
| | | // return 1; |
| | | // } |
| | | |
| | | /** |
| | | * 新增或修改问卷模板信息 |
| | | * |
| | | * @param svyLibTemplate |
| | | * @return |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public Integer saveOrUpdateTemplate(SvyLibTemplate svyLibTemplate) { |
| | | Integer i = null; |
| | |
| | | private void scriptHandle(Long svyid, SvyLibTemplateScript svyLibScript, Integer isoperation) { |
| | | if (isoperation == 1) { |
| | | //新增 |
| | | svyLibScript.setId(svyid); |
| | | svyLibScript.setSvyid(svyid); |
| | | svyLibScript.setId(null); |
| | | svyLibScript.setCreateTime(new Date()); |
| | | svyLibTemplateScriptMapper.insertSvyLibTemplateScript(svyLibScript); |
| | | |
| | | } else if (isoperation == 2) { |
| | | //修改 |
| | | svyLibScript.setId(svyid); |
| | | svyLibScript.setSvyid(svyid); |
| | | svyLibScript.setUpdateTime(new Date()); |
| | | svyLibTemplateScriptMapper.updateSvyLibTemplateScript(svyLibScript); |
| | | } else if (isoperation == 3) { |
| | |
| | | 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); |
| | | // for (String openId : openIdList) { |
| | | WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder().toUser(weChatSendVo.getOpenid()).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(); |
| | | } |
| | |
| | | <result property="suitWay" column="suitWay"/> |
| | | <result property="parameter" column="parameter"/> |
| | | <result property="reply" column="reply"/> |
| | | <result property="scriptType" column="script_type"/> |
| | | </resultMap> |
| | | |
| | | <resultMap type="com.smartor.domain.IvrLibaTargetVO" id="IvrLibaTargetVOResult"> |
| | | <result property="id" column="id"/> |
| | | <result property="groupid" column="groupid"/> |
| | | <result property="scriptType" column="script_type"/> |
| | | <result property="targettype" column="targettype"/> |
| | | <result property="targetname" column="targetname"/> |
| | | <result property="targetdesc" column="targetdesc"/> |
| | |
| | | <sql id="selectIvrLibaTargetVo"> |
| | | select id, |
| | | groupid, |
| | | script_type, |
| | | targettype, |
| | | targetname, |
| | | reply, |
| | |
| | | <if test="groupid != null and groupid != ''">and groupid = #{groupid}</if> |
| | | <if test="targettype != null and targettype != ''">and targettype = #{targettype}</if> |
| | | <if test="targetname != null and targetname != ''">and targetname like concat('%', #{targetname}, '%')</if> |
| | | <if test="scriptType != null and scriptType != ''">and script_type like concat('%', #{scriptType}, '%')</if> |
| | | <if test="targetdesc != null and targetdesc != ''">and targetdesc = #{targetdesc}</if> |
| | | <if test="language != null and language != ''">and language = #{language}</if> |
| | | <if test="version != null ">and version = #{version}</if> |
| | |
| | | a.groupid, |
| | | a.targettype, |
| | | a.targetname, |
| | | a.script_type, |
| | | a.targetdesc, |
| | | a.language, |
| | | a.version, |
| | |
| | | <if test="suitWay != null and suitWay != ''">suitWay,</if> |
| | | <if test="parameter != null and parameter != ''">parameter,</if> |
| | | <if test="reply != null and reply != ''">reply,</if> |
| | | <if test="scriptType != null and scriptType != ''">script_type,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="groupid != null">#{groupid},</if> |
| | |
| | | <if test="suitWay != null and suitWay != ''">#{suitWay},</if> |
| | | <if test="parameter != null and parameter != ''">#{parameter},</if> |
| | | <if test="reply != null and reply != ''">#{reply},</if> |
| | | <if test="scriptType != null and scriptType != ''">#{scriptType},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | |
| | | <if test="isAvailable != null and isAvailable != ''">isAvailable = #{isAvailable},</if> |
| | | <if test="parameter != null and parameter != ''">parameter = #{parameter},</if> |
| | | <if test="reply != null and reply != ''">reply = #{reply},</if> |
| | | <if test="scriptType != null and scriptType != ''">script_type = #{scriptType},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | |
| | | templateID, |
| | | scriptID, |
| | | script_point, |
| | | scrpt_content, |
| | | script_content, |
| | | script_desc, |
| | | script_voice, |
| | | noMatchText, |
| | |
| | | <mapper namespace="com.smartor.mapper.IvrTaskTemplateMapper"> |
| | | |
| | | <resultMap type="com.smartor.domain.IvrTaskTemplate" id="IvrTaskTemplateResult"> |
| | | <result property="ID" column="ID"/> |
| | | <result property="id" column="id"/> |
| | | <result property="taskid" column="taskid"/> |
| | | <result property="taskname" column="taskname"/> |
| | | <result property="targetid" column="targetid"/> |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="selectIvrTaskTemplateVo"> |
| | | select ID, |
| | | select id, |
| | | taskid, |
| | | recallcount, |
| | | instruction, |
| | |
| | | <include refid="selectIvrTaskTemplateVo"/> |
| | | <where> |
| | | <if test="taskid != null ">and taskid = #{taskid}</if> |
| | | <if test="id != null ">and id = #{id}</if> |
| | | <if test="taskname != null and taskname != ''">and taskname like concat('%', #{taskname}, '%')</if> |
| | | <if test="targetid != null ">and targetid = #{targetid}</if> |
| | | <if test="targetname != null and targetname != ''">and targetname like concat('%', #{targetname}, '%')</if> |
| | |
| | | |
| | | <select id="selectIvrTaskTemplateByID" parameterType="Long" resultMap="IvrTaskTemplateResult"> |
| | | <include refid="selectIvrTaskTemplateVo"/> |
| | | where ID = #{ID} |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertIvrTaskTemplate" parameterType="com.smartor.domain.IvrTaskTemplate" useGeneratedKeys="true" |
| | | keyProperty="ID"> |
| | | keyProperty="id"> |
| | | insert into ivr_task_template |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="taskid != null">taskid,</if> |
| | |
| | | <if test="libtemplatename != null ">libtemplatename = #{libtemplatename},</if> |
| | | <if test="instruction != null ">instruction = #{instruction},</if> |
| | | </trim> |
| | | where ID = #{ID} |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteIvrTaskTemplateByID" parameterType="Long"> |
| | | delete |
| | | from ivr_task_template |
| | | where ID = #{ID} |
| | | where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteIvrTaskTemplateByIDs" parameterType="String"> |
| | | delete from ivr_task_template where ID in |
| | | <foreach item="ID" collection="array" open="(" separator="," close=")"> |
| | | #{ID} |
| | | delete from ivr_task_template where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | </mapper> |
| | |
| | | <resultMap type="com.smartor.domain.IvrTaskTemplateScript" id="IvrTaskTemplateScriptResult"> |
| | | <result property="ID" column="ID" /> |
| | | <result property="taskid" column="taskid" /> |
| | | <result property="templateQuestionNum" column="templateQuestionNum" /> |
| | | <result property="templateID" column="templateID" /> |
| | | <result property="scriptID" column="scriptID" /> |
| | | <result property="questionPoint" column="questionPoint" /> |
| | | <result property="questionText" column="questionText" /> |
| | | <result property="questionVoice" column="questionVoice" /> |
| | | <result property="noMatchText" column="noMatchText" /> |
| | | <result property="noMatchVoice" column="noMatchVoice" /> |
| | | <result property="slienceText" column="slienceText" /> |
| | |
| | | <result property="targettype" column="targettype" /> |
| | | <result property="targetid" column="targetid" /> |
| | | <result property="targetvalue" column="targetvalue" /> |
| | | <result property="questiontitle" column="questiontitle" /> |
| | | <result property="nextQuestion" column="next_question" /> |
| | | <result property="otherdata" column="otherdata" /> |
| | | <result property="isMust" column="is_must" /> |
| | | <result property="questionResult" column="question_result" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectIvrTaskTemplateScriptVo"> |
| | | select ID, taskid, templateQuestionNum, templateID, scriptID, questionPoint, questionText, questionVoice, noMatchText, noMatchVoice, slienceText, slienceVoice, submoduleText, submoduleVoice, noClearlyText, noClearlyVoice, categoryName, targetOptions, language, playWavOnly, value_type, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time, orgid, pid, guid, targettype, targetid, targetvalue, questiontitle, next_question, otherdata, is_must, question_result from ivr_task_template_script |
| | | select ID, taskid, templateID, questionPoint, noMatchText, noMatchVoice, slienceText, slienceVoice, submoduleText, submoduleVoice, noClearlyText, noClearlyVoice, categoryName, targetOptions, language, playWavOnly, value_type, del_flag, update_by, update_time, create_by, create_time, isupload, upload_time, orgid, pid, guid, targettype, targetid, targetvalue, otherdata, is_must, question_result from ivr_task_template_script |
| | | </sql> |
| | | |
| | | <select id="selectIvrTaskTemplateScriptList" parameterType="com.smartor.domain.IvrTaskTemplateScript" resultMap="IvrTaskTemplateScriptResult"> |
| | | <include refid="selectIvrTaskTemplateScriptVo"/> |
| | | <where> |
| | | <if test="taskid != null "> and taskid = #{taskid}</if> |
| | | <if test="templateQuestionNum != null "> and templateQuestionNum = #{templateQuestionNum}</if> |
| | | <if test="templateID != null "> and templateID = #{templateID}</if> |
| | | <if test="scriptID != null "> and scriptID = #{scriptID}</if> |
| | | <if test="questionPoint != null and questionPoint != ''"> and questionPoint = #{questionPoint}</if> |
| | | <if test="questionText != null and questionText != ''"> and questionText = #{questionText}</if> |
| | | <if test="questionVoice != null and questionVoice != ''"> and questionVoice = #{questionVoice}</if> |
| | | <if test="noMatchText != null and noMatchText != ''"> and noMatchText = #{noMatchText}</if> |
| | | <if test="noMatchVoice != null and noMatchVoice != ''"> and noMatchVoice = #{noMatchVoice}</if> |
| | | <if test="slienceText != null and slienceText != ''"> and slienceText = #{slienceText}</if> |
| | |
| | | <if test="targettype != null and targettype != ''"> and targettype = #{targettype}</if> |
| | | <if test="targetid != null "> and targetid = #{targetid}</if> |
| | | <if test="targetvalue != null and targetvalue != ''"> and targetvalue = #{targetvalue}</if> |
| | | <if test="questiontitle != null and questiontitle != ''"> and questiontitle = #{questiontitle}</if> |
| | | <if test="nextQuestion != null "> and next_question = #{nextQuestion}</if> |
| | | <if test="otherdata != null and otherdata != ''"> and otherdata = #{otherdata}</if> |
| | | <if test="isMust != null and isMust != ''"> and is_must = #{isMust}</if> |
| | | <if test="questionResult != null and questionResult != ''"> and question_result = #{questionResult}</if> |
| | |
| | | insert into ivr_task_template_script |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="taskid != null">taskid,</if> |
| | | <if test="templateQuestionNum != null">templateQuestionNum,</if> |
| | | <if test="templateID != null">templateID,</if> |
| | | <if test="scriptID != null">scriptID,</if> |
| | | <if test="questionPoint != null">questionPoint,</if> |
| | | <if test="questionText != null">questionText,</if> |
| | | <if test="questionVoice != null">questionVoice,</if> |
| | | <if test="noMatchText != null">noMatchText,</if> |
| | | <if test="noMatchVoice != null">noMatchVoice,</if> |
| | | <if test="slienceText != null">slienceText,</if> |
| | |
| | | <if test="targettype != null">targettype,</if> |
| | | <if test="targetid != null">targetid,</if> |
| | | <if test="targetvalue != null">targetvalue,</if> |
| | | <if test="questiontitle != null">questiontitle,</if> |
| | | <if test="nextQuestion != null">next_question,</if> |
| | | <if test="otherdata != null">otherdata,</if> |
| | | <if test="isMust != null">is_must,</if> |
| | | <if test="questionResult != null">question_result,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="taskid != null">#{taskid},</if> |
| | | <if test="templateQuestionNum != null">#{templateQuestionNum},</if> |
| | | <if test="templateID != null">#{templateID},</if> |
| | | <if test="scriptID != null">#{scriptID},</if> |
| | | <if test="questionPoint != null">#{questionPoint},</if> |
| | | <if test="questionText != null">#{questionText},</if> |
| | | <if test="questionVoice != null">#{questionVoice},</if> |
| | | <if test="noMatchText != null">#{noMatchText},</if> |
| | | <if test="noMatchVoice != null">#{noMatchVoice},</if> |
| | | <if test="slienceText != null">#{slienceText},</if> |
| | |
| | | <if test="targettype != null">#{targettype},</if> |
| | | <if test="targetid != null">#{targetid},</if> |
| | | <if test="targetvalue != null">#{targetvalue},</if> |
| | | <if test="questiontitle != null">#{questiontitle},</if> |
| | | <if test="nextQuestion != null">#{nextQuestion},</if> |
| | | <if test="otherdata != null">#{otherdata},</if> |
| | | <if test="isMust != null">#{isMust},</if> |
| | | <if test="questionResult != null">#{questionResult},</if> |
| | |
| | | update ivr_task_template_script |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="taskid != null">taskid = #{taskid},</if> |
| | | <if test="templateQuestionNum != null">templateQuestionNum = #{templateQuestionNum},</if> |
| | | <if test="templateID != null">templateID = #{templateID},</if> |
| | | <if test="scriptID != null">scriptID = #{scriptID},</if> |
| | | <if test="questionPoint != null">questionPoint = #{questionPoint},</if> |
| | | <if test="questionText != null">questionText = #{questionText},</if> |
| | | <if test="questionVoice != null">questionVoice = #{questionVoice},</if> |
| | | <if test="noMatchText != null">noMatchText = #{noMatchText},</if> |
| | | <if test="noMatchVoice != null">noMatchVoice = #{noMatchVoice},</if> |
| | | <if test="slienceText != null">slienceText = #{slienceText},</if> |
| | |
| | | <if test="targettype != null">targettype = #{targettype},</if> |
| | | <if test="targetid != null">targetid = #{targetid},</if> |
| | | <if test="targetvalue != null">targetvalue = #{targetvalue},</if> |
| | | <if test="questiontitle != null">questiontitle = #{questiontitle},</if> |
| | | <if test="nextQuestion != null">next_question = #{nextQuestion},</if> |
| | | <if test="otherdata != null">otherdata = #{otherdata},</if> |
| | | <if test="isMust != null">is_must = #{isMust},</if> |
| | | <if test="questionResult != null">question_result = #{questionResult},</if> |
| | |
| | | <result property="patid" column="patid"/> |
| | | <result property="libtemplatename" column="libtemplatename"/> |
| | | <result property="libtemplateid" column="libtemplateid"/> |
| | | <result property="openid" column="openid"/> |
| | | </resultMap> |
| | | |
| | | <sql id="selectServiceSubtaskVo"> |
| | | select id, |
| | | hosp_type, |
| | | openid, |
| | | libtemplateid, |
| | | libtemplatename, |
| | | hospno, |
| | |
| | | <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 = #{libtemplatename},</if> |
| | | <if test="openid != null ">and openid = #{openid},</if> |
| | | </where> |
| | | order by update_time desc,id desc |
| | | </select> |
| | |
| | | <if test="libtemplateid != null ">libtemplateid,</if> |
| | | <if test="libtemplatename != null ">libtemplatename,</if> |
| | | <if test="patid != null ">patid,</if> |
| | | <if test="openid != null ">openid,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="sendname != null">#{sendname},</if> |
| | |
| | | <if test="libtemplateid != null ">#{libtemplateid},</if> |
| | | <if test="libtemplatename != null ">#{libtemplatename},</if> |
| | | <if test="patid != null ">#{patid},</if> |
| | | <if test="openid != null ">#{openid},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | |
| | | <if test="libtemplateid != null ">libtemplateid = #{libtemplateid},</if> |
| | | <if test="libtemplatename != null ">libtemplatename = #{libtemplatename},</if> |
| | | <if test="patid != null ">patid = #{patid},</if> |
| | | <if test="openid != null ">openid = #{openid},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | |
| | | <if test="libtemplateid != null ">libtemplateid = #{libtemplateid},</if> |
| | | <if test="libtemplatename != null ">libtemplatename = #{libtemplatename},</if> |
| | | <if test="patid != null ">patid = #{patid},</if> |
| | | <if test="openid != null ">openid = #{openid},</if> |
| | | </trim> |
| | | where patid = #{patid} and taskid = #{taskid} |
| | | </update> |
| | |
| | | phone, |
| | | sex, |
| | | age, |
| | | openid, |
| | | sfzh, |
| | | addr, |
| | | senderdetail, |
| | |
| | | |
| | | <resultMap type="com.smartor.domain.SvyLibScript" id="SvyLibScriptResult"> |
| | | <result property="id" column="id"/> |
| | | <result property="oldid" column="oldid"/> |
| | | <result property="svyid" column="svyid"/> |
| | | <result property="scripttype" column="script_type"/> |
| | | <result property="scriptType" column="script_type"/> |
| | | <result property="scriptcode" column="script_code"/> |
| | | <result property="scriptDesc" column="script_desc"/> |
| | | <result property="scriptPicture" column="script_picture"/> |
| | |
| | | |
| | | <sql id="selectSvyLibScriptVo"> |
| | | select id, |
| | | oldid, |
| | | scoretype, |
| | | score, |
| | | value_type, |
| | | reply, |
| | | svyid, |
| | | script_type, |
| | | script_code, |
| | | script_desc, |
| | |
| | | <where> |
| | | del_flag=0 |
| | | <if test="id != null ">and id = #{id}</if> |
| | | <if test="oldid != null ">and oldid = #{oldid}</if> |
| | | <if test="scripttype != null and scripttype != ''">and script_type = #{scripttype}</if> |
| | | <if test="scriptType != null and scriptType != ''">and script_type = #{scriptType}</if> |
| | | <if test="categoryid != null ">and categoryid = #{categoryid}</if> |
| | | <if test="script != null and script != ''">and script like concat('%', #{script}, '%')</if> |
| | | <if test="scriptContent != null and scriptContent != ''">and script_content like concat('%', #{scriptContent}, '%')</if> |
| | | <if test="icd10Name != null and icd10Name != ''">and icd10_name like concat('%', #{icd10Name}, '%')</if> |
| | | |
| | | <if test="ishide != null ">and ishide = #{ishide}</if> |
| | | <if test="orgid != null and orgid != ''">and orgid = #{orgid}</if> |
| | | <if test="svyid != null and svyid != ''">and svyid = #{svyid}</if> |
| | | <if test="scriptContent != null and scriptContent != ''">and script_content = #{scriptContent}</if> |
| | | <if test="suitway != null and suitway != ''">and suitway = #{suitway}</if> |
| | | <if test="isavailable != null and isavailable != ''">and isavailable = #{isavailable}</if> |
| | | <if test="language != null and language != ''">and language = #{language}</if> |
| | |
| | | keyProperty="id"> |
| | | insert into svy_lib_script |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="oldid != null">oldid,</if> |
| | | <if test="svyid != null">svyid,</if> |
| | | <if test="scripttype != null">script_type,</if> |
| | | <if test="scriptType != null">script_type,</if> |
| | | <if test="scriptcode != null">script_code,</if> |
| | | <if test="scriptDesc != null">script_desc,</if> |
| | | <if test="sort != null">sort,</if> |
| | |
| | | <if test="scriptTopic != null and scriptTopic != ''">script_topic,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="oldid != null">#{oldid},</if> |
| | | <if test="svyid != null">#{svyid},</if> |
| | | <if test="scripttype != null">#{scripttype},</if> |
| | | <if test="scriptType != null">#{scriptType},</if> |
| | | <if test="scriptcode != null">#{scriptcode},</if> |
| | | <if test="scriptDesc != null">#{scriptDesc},</if> |
| | | <if test="sort != null">#{sort},</if> |
| | |
| | | <update id="updateSvyLibScript" parameterType="com.smartor.domain.SvyLibScript"> |
| | | update svy_lib_script |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="oldid != null">oldid = #{oldid},</if> |
| | | <if test="svyid != null">svyid = #{svyid},</if> |
| | | <if test="scripttype != null">script_type = #{scripttype},</if> |
| | | <if test="scriptType != null">script_type = #{scriptType},</if> |
| | | <if test="scriptcode != null">script_code = #{scriptcode},</if> |
| | | <if test="scriptDesc != null">script_desc = #{scriptDesc},</if> |
| | | <if test="sort != null">sort = #{sort},</if> |
| | |
| | | <result property="nextScriptno" column="next_scriptno"/> |
| | | <result property="scriptno" column="scriptno"/> |
| | | <result property="scriptDesc" column="script_desc"/> |
| | | <result property="svyid" column="svyid"/> |
| | | <result property="tag" column="tag"/> |
| | | <result property="sort" column="sort"/> |
| | | <result property="ismandatory" column="ismandatory"/> |
| | |
| | | select id, |
| | | script_type, |
| | | scriptid, |
| | | svyid, |
| | | scriptno, |
| | | next_scriptno, |
| | | script_desc, |
| | |
| | | <if test="scoretype != null and scoretype != ''">and scoretype = #{scoretype}</if> |
| | | <if test="score != null and score != ''">and score = #{score}</if> |
| | | <if test="scriptTopic != null and scriptTopic != ''">and script_topic = #{scriptTopic}</if> |
| | | <if test="svyid != null ">and svyid = #{svyid}</if> |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | <if test="score != null">score,</if> |
| | | <if test="scriptPicture != null">script_picture,</if> |
| | | <if test="scriptTopic != null">script_topic,</if> |
| | | <if test="svyid != null">svyid,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="nextScriptno != null">#{nextScriptno},</if> |
| | |
| | | <if test="score != null">#{score},</if> |
| | | <if test="scriptPicture != null">#{scriptPicture},</if> |
| | | <if test="scriptTopic != null">#{scriptTopic},</if> |
| | | <if test="svyid != null">#{svyid},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | |
| | | <if test="score != null">score = #{score},</if> |
| | | <if test="scriptPicture != null">script_picture = #{scriptPicture},</if> |
| | | <if test="scriptTopic != null">script_topic = #{scriptTopic},</if> |
| | | <if test="svyid != null">svyid = #{svyid},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |