| | |
| | | private ServiceSubtaskMapper serviceSubtaskMapper; |
| | | |
| | | @Autowired |
| | | private IvrTaskcalldetailMapper ivrTaskcalldetailMapper; |
| | | @Autowired |
| | | private SvyTasksingledetailMapper svyTasksingledetailMapper; |
| | | private ServiceSubtaskDetailMapper ivrTaskcalldetailMapper; |
| | | |
| | | @Autowired |
| | | private IServiceTaskService serviceTaskService; |
| | | |
| | | @Autowired |
| | | private IvrTaskTemplateTargetoptionMapper serviceTaskScriptTargetoptionMapper; |
| | | |
| | | @Autowired |
| | | private IvrLibaTemplateScriptMapper ivrLibaTemplateScriptMapper; |
| | | |
| | | @Autowired |
| | | private IvrTaskVisitResultMapper serviceTaskVisitResultMapper; |
| | |
| | | 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()); |
| | | } |
| | | } |
| | | } |
| | |
| | | // } |
| | | |
| | | @Override |
| | | public Integer saveQuestionAnswer(ServiceSubTaskDetailReq serviceSubTaskDetailReq) { |
| | | public Integer saveQuestionAnswerPhone(ServiceSubTaskDetailReq serviceSubTaskDetailReq) { |
| | | RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample(); |
| | | Long tid = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceSubTaskDetailReq.getParam1(), pri_key)); |
| | | Long pid = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceSubTaskDetailReq.getParam2(), pri_key)); |
| | | ServiceSubtask ivrTaskSingle = new ServiceSubtask(); |
| | | ivrTaskSingle.setTaskid(tid); |
| | | ivrTaskSingle.setPatid(pid); |
| | | List<ServiceSubtask> ivrTaskSingles = serviceSubtaskMapper.selectServiceSubtaskList(ivrTaskSingle); |
| | | if (CollectionUtils.isEmpty(ivrTaskSingles) || ivrTaskSingles.size() == 0) { |
| | | log.error("报错了,ivrTaskSingles数据为空了:{}", ivrTaskSingle); |
| | | List<ServiceSubtask> selectServiceSubtaskList = serviceSubtaskMapper.selectServiceSubtaskList(ivrTaskSingle); |
| | | if (CollectionUtils.isEmpty(selectServiceSubtaskList) || selectServiceSubtaskList.size() == 0) { |
| | | log.error("报错了,selectServiceSubtaskList数据为空了:{}", ivrTaskSingle); |
| | | return 0; |
| | | } |
| | | int i = 0; |
| | | if (CollectionUtils.isNotEmpty(serviceSubTaskDetailReq.getIvrTaskcalldetailList())) { |
| | | //随访 |
| | | for (IvrTaskcalldetail ivrTaskcalldetail : serviceSubTaskDetailReq.getIvrTaskcalldetailList()) { |
| | | ivrTaskcalldetail.setCallid(ivrTaskSingles.get(0).getId().toString()); |
| | | ivrTaskcalldetail.setCalldetailid(UUID.randomUUID().toString()); |
| | | ivrTaskcalldetail.setCreateTime(new Date()); |
| | | i = ivrTaskcalldetailMapper.insertIvrTaskcalldetail(ivrTaskcalldetail); |
| | | } |
| | | } else if (CollectionUtils.isNotEmpty(serviceSubTaskDetailReq.getSvyTasksingledetailList())) { |
| | | //问卷 |
| | | for (SvyTasksingledetail svyTasksingledetail : serviceSubTaskDetailReq.getSvyTasksingledetailList()) { |
| | | svyTasksingledetail.setCallid(ivrTaskSingles.get(0).getId().toString()); |
| | | svyTasksingledetail.setCalldetailid(UUID.randomUUID().toString()); |
| | | svyTasksingledetail.setCreateTime(new Date()); |
| | | i = svyTasksingledetailMapper.insertSvyTasksingledetail(svyTasksingledetail); |
| | | } |
| | | //随访 |
| | | for (ServiceSubtaskDetail serviceSubtaskDetail : serviceSubTaskDetailReq.getServiceSubtaskDetailList()) { |
| | | serviceSubtaskDetail.setSubId(selectServiceSubtaskList.get(0).getId()); |
| | | serviceSubtaskDetail.setId(UUID.randomUUID().toString()); |
| | | serviceSubtaskDetail.setCreateTime(new Date()); |
| | | i = ivrTaskcalldetailMapper.insertServiceSubtaskDetail(serviceSubtaskDetail); |
| | | } |
| | | return i; |
| | | } |