|
|
|
@ -66,7 +66,7 @@ public class AskServiceImpl implements AskService {
|
|
|
|
|
// 这里调用京东数字人接口首先根据token获取房间号
|
|
|
|
|
String roomId = HumanUtil.queryRoomId(talkReqVO.getRoomKey(), talkReqVO.getRoomToken());
|
|
|
|
|
HumanUtil.textDriven("您好,我没有听懂您说什么", roomId);
|
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", null, talkReqVO.getText(), "您好,我没有听懂您说什么");
|
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", null, talkReqVO.getText(), null, "您好,我没有听懂您说什么");
|
|
|
|
|
}
|
|
|
|
|
TalkResultResVO talkResultResVO = new TalkResultResVO();
|
|
|
|
|
// 这里校验,rasa回复的结果是不是action
|
|
|
|
@ -88,7 +88,7 @@ public class AskServiceImpl implements AskService {
|
|
|
|
|
if (ObjectUtil.isEmpty(library)) {
|
|
|
|
|
log.info("{}:未从问题库中找到,回答未识别语句", rasaResult);
|
|
|
|
|
HumanUtil.textDriven("您好,我没有听懂您说什么", roomId);
|
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", null, talkReqVO.getText(), "您好,我没有听懂您说什么");
|
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", null, talkReqVO.getText(), null, "您好,我没有听懂您说什么");
|
|
|
|
|
} else {
|
|
|
|
|
AskPatientAnswer askPatientAnswer = askPatientAnswerService.lambdaQuery().eq(AskPatientAnswer::getPatientId, process.getPatientId())
|
|
|
|
|
.eq(AskPatientAnswer::getLibraryQuestionId, library.getId()).last("limit 1").one();
|
|
|
|
@ -100,12 +100,12 @@ public class AskServiceImpl implements AskService {
|
|
|
|
|
String resText = library.getDefaultAnswer();
|
|
|
|
|
HumanUtil.textDriven(resText, roomId);
|
|
|
|
|
// 保存记录
|
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", library.getId(), talkReqVO.getText(), resText);
|
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", library.getId(), talkReqVO.getText(), library, resText);
|
|
|
|
|
log.info("{}:找到了默认答案:{}", rasaResult, talkReqVO.getText());
|
|
|
|
|
} else {
|
|
|
|
|
log.info("{}:没有从默认答案中找到找到默认内容,回复未识别语句", rasaResult);
|
|
|
|
|
HumanUtil.textDriven("您好,我没有听懂您说什么", roomId);
|
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", null, talkReqVO.getText(), "您好,我没有听懂您说什么");
|
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", null, talkReqVO.getText(), library, "您好,我没有听懂您说什么");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (CollUtil.isEmpty(askPatientAnswer.getAnswer())) {
|
|
|
|
@ -115,7 +115,7 @@ public class AskServiceImpl implements AskService {
|
|
|
|
|
log.info("{}:病历配置的回答:{}:为空不为空不为空,但在获取的时候,答案为空,开始回复默认语句,默认语句内容:{}", rasaResult, askPatientAnswer.getId(), resText);
|
|
|
|
|
HumanUtil.textDriven(resText, roomId);
|
|
|
|
|
// 保存记录
|
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", library.getId(), talkReqVO.getText(), resText);
|
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "default", library.getId(), talkReqVO.getText(), library, resText);
|
|
|
|
|
} else {
|
|
|
|
|
log.info("{}:病历配置的回答:{}:为空不为空,但在获取的时候,答案为空,但是获取默认语句也为空,那么回复未识别语句", rasaResult, askPatientAnswer.getId());
|
|
|
|
|
HumanUtil.textDriven("您好,我没有听懂您说什么", roomId);
|
|
|
|
@ -126,7 +126,7 @@ public class AskServiceImpl implements AskService {
|
|
|
|
|
log.info("{}:找到了病历配置的回答语句:{},回答内容:{}", rasaResult, askPatientAnswer.getId(), resText);
|
|
|
|
|
HumanUtil.textDriven(resText, roomId);
|
|
|
|
|
// 保存记录
|
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "patient", askPatientAnswer.getId(), talkReqVO.getText(), resText);
|
|
|
|
|
saveQaRecord(talkReqVO.getProcessId(), "patient", askPatientAnswer.getId(), talkReqVO.getText(), library, resText);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -136,11 +136,14 @@ public class AskServiceImpl implements AskService {
|
|
|
|
|
return talkResultResVO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void saveQaRecord(String processId, String answerType, String answerId, String question, String resText) {
|
|
|
|
|
private void saveQaRecord(String processId, String answerType, String answerId, String question, AskTemplateQuestionLibrary library, String resText) {
|
|
|
|
|
DiagnosisQaRecord record = new DiagnosisQaRecord();
|
|
|
|
|
record.setProcessId(processId);
|
|
|
|
|
record.setAnswerType(answerType);
|
|
|
|
|
record.setAnswerId(answerId);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(library)) {
|
|
|
|
|
record.setQuestionLibraryId(library.getId());
|
|
|
|
|
}
|
|
|
|
|
record.setQuestion(question);
|
|
|
|
|
record.setAnswer(resText);
|
|
|
|
|
record.setCreateUserId(UserUtil.getUser().getId());
|
|
|
|
|