|
|
@ -203,7 +203,7 @@ public class AskServiceImpl implements AskService {
|
|
|
|
String rasaResult = RasaUtil.talkRasa(talkReqVO.getText(), UserUtil.getUser().getId(), process.getPatientId());
|
|
|
|
String rasaResult = RasaUtil.talkRasa(talkReqVO.getText(), UserUtil.getUser().getId(), process.getPatientId());
|
|
|
|
// 如果rasa没有识别出来,则返回默认值
|
|
|
|
// 如果rasa没有识别出来,则返回默认值
|
|
|
|
if (StrUtil.isBlank(rasaResult)) {
|
|
|
|
if (StrUtil.isBlank(rasaResult)) {
|
|
|
|
downloadTalkVideo(defaultNoMatchId,response);
|
|
|
|
downloadTalkVideo(defaultNoMatchId, response);
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", null, talkReqVO.getText(), null, "您好,我没有听懂您说什么");
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", null, talkReqVO.getText(), null, "您好,我没有听懂您说什么");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TalkResultResVO talkResultResVO = new TalkResultResVO();
|
|
|
|
TalkResultResVO talkResultResVO = new TalkResultResVO();
|
|
|
@ -225,7 +225,7 @@ public class AskServiceImpl implements AskService {
|
|
|
|
AskTemplateQuestionLibrary library = askTemplateQuestionLibraryService.getById(rasaResult);
|
|
|
|
AskTemplateQuestionLibrary library = askTemplateQuestionLibraryService.getById(rasaResult);
|
|
|
|
if (ObjectUtil.isEmpty(library)) {
|
|
|
|
if (ObjectUtil.isEmpty(library)) {
|
|
|
|
log.info("{}:未从问题库中找到,回答未识别语句", rasaResult);
|
|
|
|
log.info("{}:未从问题库中找到,回答未识别语句", rasaResult);
|
|
|
|
downloadTalkVideo(defaultNoMatchId,response);
|
|
|
|
downloadTalkVideo(defaultNoMatchId, response);
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", null, talkReqVO.getText(), null, "您好,我没有听懂您说什么");
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", null, talkReqVO.getText(), null, "您好,我没有听懂您说什么");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
AskPatientAnswer askPatientAnswer = askPatientAnswerService.lambdaQuery().eq(AskPatientAnswer::getPatientId, process.getPatientId())
|
|
|
|
AskPatientAnswer askPatientAnswer = askPatientAnswerService.lambdaQuery().eq(AskPatientAnswer::getPatientId, process.getPatientId())
|
|
|
@ -236,7 +236,7 @@ public class AskServiceImpl implements AskService {
|
|
|
|
// 首先看看default里面是不是存在,如果存在,就从default里面去找
|
|
|
|
// 首先看看default里面是不是存在,如果存在,就从default里面去找
|
|
|
|
if (StrUtil.isNotEmpty(library.getDefaultAnswer())) {
|
|
|
|
if (StrUtil.isNotEmpty(library.getDefaultAnswer())) {
|
|
|
|
String resText = library.getDefaultAnswer();
|
|
|
|
String resText = library.getDefaultAnswer();
|
|
|
|
downloadTalkVideo(defaultNoMatchId,response);
|
|
|
|
downloadTalkVideo(library.getDefaultAnswerResourceId(), response);
|
|
|
|
// 保存记录
|
|
|
|
// 保存记录
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", library.getId(), talkReqVO.getText(), library, resText);
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", library.getId(), talkReqVO.getText(), library, resText);
|
|
|
|
log.info("{}:找到了默认答案:{}", rasaResult, talkReqVO.getText());
|
|
|
|
log.info("{}:找到了默认答案:{}", rasaResult, talkReqVO.getText());
|
|
|
@ -257,13 +257,14 @@ public class AskServiceImpl implements AskService {
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", library.getId(), talkReqVO.getText(), library, resText);
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", library.getId(), talkReqVO.getText(), library, resText);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
log.info("{}:病历配置的回答:{}:为空不为空,但在获取的时候,答案为空,但是获取默认语句也为空,那么回复未识别语句", rasaResult, askPatientAnswer.getId());
|
|
|
|
log.info("{}:病历配置的回答:{}:为空不为空,但在获取的时候,答案为空,但是获取默认语句也为空,那么回复未识别语句", rasaResult, askPatientAnswer.getId());
|
|
|
|
downloadTalkVideo(defaultNoMatchId,response);
|
|
|
|
downloadTalkVideo(defaultNoMatchId, response);
|
|
|
|
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", null, talkReqVO.getText(), library, "您好,我没有听懂您说什么");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
String resText = askPatientAnswer.getAnswer();
|
|
|
|
String resText = askPatientAnswer.getAnswer();
|
|
|
|
log.info("{}:找到了病历配置的回答语句:{},回答内容:{}", rasaResult, askPatientAnswer.getId(), resText);
|
|
|
|
log.info("{}:找到了病历配置的回答语句:{},回答内容:{}", rasaResult, askPatientAnswer.getId(), resText);
|
|
|
|
downloadTalkVideo(askPatientAnswer.getAnswerResourceId(),response);
|
|
|
|
downloadTalkVideo(askPatientAnswer.getAnswerResourceId(), response);
|
|
|
|
// 保存记录
|
|
|
|
// 保存记录
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "patient", askPatientAnswer.getId(), talkReqVO.getText(), library, resText);
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "patient", askPatientAnswer.getId(), talkReqVO.getText(), library, resText);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -273,9 +274,6 @@ public class AskServiceImpl implements AskService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
talkResultResVO.setType(1);
|
|
|
|
talkResultResVO.setType(1);
|
|
|
|
return talkResultResVO;
|
|
|
|
return talkResultResVO;
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void downloadTalkVideo(String fileId, HttpServletResponse response) {
|
|
|
|
private void downloadTalkVideo(String fileId, HttpServletResponse response) {
|
|
|
|