陈昶聿
昨天 5db7759db3fa6792155d72139f9d5d9e56eb3436
smartor/src/main/java/com/smartor/service/impl/ServiceSubtaskServiceImpl.java
@@ -16,6 +16,7 @@
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.mapper.SysConfigMapper;
import com.smartor.common.DeepSeekApi;
import com.smartor.common.FtpService;
import com.smartor.common.MtSubmitSmUtil;
import com.smartor.config.PhoneUtils;
@@ -1666,20 +1667,39 @@
                    if (StringUtils.isEmpty(phoneCallReqYQVO.getAsrtext())) {
                        continue;
                    }
                    //包含
                    Matcher matcher = null;
                    if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex())) {
                        Pattern pattern = Pattern.compile(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex());
                        matcher = pattern.matcher(phoneCallReqYQVO.getAsrtext());
                    //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 {
                        //包含
                        Matcher matcher = null;
                        if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex())) {
                            Pattern pattern = Pattern.compile(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex());
                            matcher = pattern.matcher(phoneCallReqYQVO.getAsrtext());
                        }
                        //不包含
                        Matcher matcher2 = null;
                        if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2())) {
                            Pattern pattern2 = Pattern.compile(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2());
                            matcher2 = pattern2.matcher(phoneCallReqYQVO.getAsrtext());
                        }
                        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;
                        }
                    }
                    //不包含
                    Matcher matcher2 = null;
                    if (StringUtils.isNotEmpty(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2())) {
                        Pattern pattern2 = Pattern.compile(ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).getTargetregex2());
                        matcher2 = pattern2.matcher(phoneCallReqYQVO.getAsrtext());
                    }
                    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()) {
                        //说明匹配正确了
                    //说明匹配正确了
                    if(matchedFlag){
                        //这里应该先判断类型,去再修改,设置IsUserOperation是单选题的改法
                        log.info("匹配正确了吗--------------");
                        ivrTaskTemplateScriptVO.getIvrTaskScriptTargetoptionList().get(j).setIsUserOperation(1);
@@ -4791,20 +4811,9 @@
                List<ServiceTaskdept> serviceTaskdepts = serviceTaskdeptService.selectServiceTaskdeptList(serviceTaskdept);
                if (!CollectionUtils.isEmpty(serviceTaskdepts)) {
                    ServiceTaskdept serviceTaskdept1 = serviceTaskdepts.get(0);
                    PatArchive patArchiveVo = new PatArchive();
                    patArchiveVo.setViptype("-1");
                    List<PatArchive> patArchives = patArchiveMapper.selectPatArchiveList(patArchiveVo);
                    PatArchive patArchive = new PatArchive();
                    if(!ObjectUtils.isNotEmpty(patArchives)){
                        PatArchive newPatArchive = new PatArchive();
                        newPatArchive.setPatientno("00000000");
                        newPatArchive.setName("虚拟患者");
                        patArchiveMapper.insertPatArchiveSingle(newPatArchive);
                        patArchive = newPatArchive;
                    }else {
                        patArchive = patArchives.get(0);
                    }
                    patArchive.setId(-1L);
                    patArchive.setName("虚拟患者");
                    //封装serviceSubtask
                    ServiceSubtask serviceSubtask = boxedServiceSubtask(serviceTask, patArchive);
                    int i = serviceSubtaskMapper.insertServiceSubtask(serviceSubtask);