| | |
| | | ServiceSubtask serviceSubtask = serviceSubtaskMapper.selectServiceSubtaskById(serviceSubtaskTemplateVO.getSubId()); |
| | | if (serviceSubtask == null || serviceSubtask.getSendstate() != 2L) |
| | | throw new BaseException("该任务已发送给患者,不能再进行修改模板"); |
| | | |
| | | serviceSubtaskTemplateVO.getSvyTaskTemplateVO().setIntroduce("该问卷是替换后的问题,替换前的问题是:" + serviceSubtask.getTemplateid()); |
| | | Integer taskTempid = svyTaskTemplateService.saveOrUpdateTemplate(serviceSubtaskTemplateVO.getSvyTaskTemplateVO()); |
| | | if (taskTempid == null) return false; |
| | | |
| | | //每次都新建一个也可以,但新建之后要把之前的删除 |
| | | if (serviceSubtask.getType().equals("2")) { |
| | | svyTaskTemplateService.deleteSvyTaskTemplateBySvyid(serviceSubtask.getTemplateid()); |
| | | } else if (serviceSubtask.getType().equals("1")) |
| | | ivrTaskTemplateService.deleteIvrTaskTemplateByID(serviceSubtask.getTemplateid()); |
| | | |
| | | |
| | | String tempName = svyTaskTemplateService.selectSvyTaskTemplateBySvyid(Long.valueOf(taskTempid)).getSvyname(); |
| | | serviceSubtask.setTemplateid(taskTempid.longValue()); |
| | |
| | | } |
| | | } |
| | | |
| | | // //2-AI识别 |
| | | // SysConfig configVoiceMatchType = new SysConfig(); |
| | | // configVoiceMatchType.setOrgid(phoneCallReqYQVO.getOrgid()); |
| | | // configVoiceMatchType.setConfigKey("sys.voice.match.type"); |
| | | // SysConfig matchType = sysConfigMapper.selectConfig(configVoiceMatchType); |
| | | |
| | | //如果是文本回调 |
| | | //根据问题ID获取该问题的类型 |
| | | if (ivrTaskTemplateScriptVO.getScriptType().equals("1")) { |
| | |
| | | if (StringUtils.isEmpty(phoneCallReqYQVO.getAsrtext())) { |
| | | continue; |
| | | } |
| | | //2-AI识别 |
| | | SysConfig configVoiceMatchType = new SysConfig(); |
| | | configVoiceMatchType.setOrgid(phoneCallReqYQVO.getOrgid()); |
| | | configVoiceMatchType.setConfigKey("sys.voice.match.type"); |
| | | SysConfig matchType = sysConfigMapper.selectConfig(configVoiceMatchType); |
| | | boolean matchedFlag = false; |
| | | // if(ObjectUtils.isNotEmpty(matchType) && StringUtils.isNotEmpty(matchType.getConfigValue()) && matchType.getConfigValue().equals("2")){ |
| | | // int checkFlag = DeepSeekApi.matchQuestionAnswer(ivrTaskTemplateScriptVO.getScriptContent(), |
| | | // phoneCallReqYQVO.getAsrtext(), |
| | | // ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetvalue()); |
| | | // if(checkFlag == 1){ |
| | | // matchedFlag = true; |
| | | // } |
| | | // }else { |
| | | if (ObjectUtils.isNotEmpty(matchType) && StringUtils.isNotEmpty(matchType.getConfigValue()) && matchType.getConfigValue().equals("2")) { |
| | | int checkFlag = DeepSeekApi.matchQuestionAnswer(ivrTaskTemplateScriptVO.getScriptContent(), |
| | | phoneCallReqYQVO.getAsrtext(), |
| | | ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetvalue()); |
| | | if (checkFlag == 1) { |
| | | matchedFlag = true; |
| | | } |
| | | } else { |
| | | //包含 |
| | | Matcher matcher = null; |
| | | if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex())) { |
| | |
| | | if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() && StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches() || StringUtils.isEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex()) && StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()) && matcher2.matches() || StringUtils.isEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2()) && StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex()) && matcher.matches()) { |
| | | matchedFlag = true; |
| | | } |
| | | // } |
| | | } |
| | | //说明匹配正确了 |
| | | if(matchedFlag){ |
| | | //这里应该先判断类型,去再修改,设置IsUserOperation是单选题的改法 |