From 5ad800162163c0edeaebabdf466d49ee47e47d51 Mon Sep 17 00:00:00 2001 From: zhuangyuanke Date: Tue, 17 Dec 2024 18:21:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=96=E5=91=BC=E5=9B=9E=E8=B0=83bug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xinelu/manage/dto/aiob/AiobRecord.java | 5 ++++ .../service/aiob/impl/AIOBServiceImpl.java | 23 +++++++++++++++---- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/dto/aiob/AiobRecord.java b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/aiob/AiobRecord.java index 0ae538c0..ef11baa1 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/dto/aiob/AiobRecord.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/aiob/AiobRecord.java @@ -31,4 +31,9 @@ public class AiobRecord { * 意图 */ private String intent; + + /** + * 回答内容文本 + */ + private String content; } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/aiob/impl/AIOBServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/aiob/impl/AIOBServiceImpl.java index 29871afa..9bc6f1c3 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/aiob/impl/AIOBServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/aiob/impl/AIOBServiceImpl.java @@ -351,7 +351,8 @@ public class AIOBServiceImpl implements IAIOBService { PhoneDialRecord phoneDialRecordQuery = new PhoneDialRecord(); phoneDialRecordQuery.setManageRouteNodeId(signPatientManageRouteNode.getId()); List phoneDialRecordList = phoneDialRecordMapper.selectPhoneDialRecordList(phoneDialRecordQuery); - if ((CollectionUtils.isEmpty(phoneDialRecordList) && PhoneRedialTimesEnum.getValueByInfo(signPatientManageRouteNode.getPhoneRedialTimes()).getValue() > 0) || phoneDialRecordList.size() + 1 < PhoneRedialTimesEnum.getValueByInfo(signPatientManageRouteNode.getPhoneRedialTimes()).getValue()) { + String redialTimes = StringUtils.isEmpty(signPatientManageRouteNode.getPhoneRedialTimes())?"NOT_REPLAY":signPatientManageRouteNode.getPhoneRedialTimes(); + if ((CollectionUtils.isEmpty(phoneDialRecordList) && PhoneRedialTimesEnum.getValueByInfo(redialTimes).getValue() > 0) || phoneDialRecordList.size() + 1 < PhoneRedialTimesEnum.getValueByInfo(signPatientManageRouteNode.getPhoneRedialTimes()).getValue()) { // 重拨 needRedial = true; } @@ -550,6 +551,9 @@ public class AIOBServiceImpl implements IAIOBService { .stream() .sorted(Comparator.comparing(AiobRecord::getTimestamp)) .collect(Collectors.toList()); + speechList.forEach(s->{ + if(StringUtils.isNull(s.getIntent())) s.setIntent(""); + }); // 查询患者画像信息 List labelFieldContentList = labelFieldContentMapper.selectByPatientId(patientInfoId); @@ -598,11 +602,17 @@ public class AIOBServiceImpl implements IAIOBService { } } if (hasQuestion) { + + String finalAiobQuestionName = aiobQuestionName; + AiobRecord nextRecord = getNextQuestion(speechList, finalAiobQuestionName); + PatientQuestionSubjectResult patientQuestionSubjectResult = new PatientQuestionSubjectResult(); BeanUtils.copyProperties(questionSubjectVO, patientQuestionSubjectResult); patientQuestionSubjectResult.setId(null); patientQuestionSubjectResult.setQuestionSubmitResultId(patientQuestionSubmitResult.getId()); patientQuestionSubjectResult.setCreateTime(LocalDateTime.now()); + //不管是否是 填空题,都 写入回答 文本 + patientQuestionSubjectResult.setFillBlanksAnswer(nextRecord.getContent()); patientQuestionSubjectResultMapper.insertPatientQuestionSubjectResult(patientQuestionSubjectResult); // 3、保存patient_question_option_result @@ -610,13 +620,12 @@ public class AIOBServiceImpl implements IAIOBService { questionSubjectOptionQuery.setQuestionnaireSubjectId(questionSubjectVO.getId()); List questionSubjectOptions = questionSubjectOptionMapper.selectQuestionSubjectOptionList(questionSubjectOptionQuery); List patientQuestionOptionResults = new ArrayList<>(); - String finalAiobQuestionName = aiobQuestionName; + questionSubjectOptions.forEach(questionSubjectOption -> { PatientQuestionOptionResult patientQuestionOptionResult = new PatientQuestionOptionResult(); BeanUtils.copyProperties(questionSubjectOption, patientQuestionOptionResult); // 设置是否选中, 通过通话记录中下一个问题的intent字段查询QuestionSubjectOption, List intents = Arrays.asList(questionSubjectOption.getIntent().split("\\|")); - AiobRecord nextRecord = getNextQuestion(speechList, finalAiobQuestionName); if (ObjectUtils.isNotEmpty(nextRecord) && intents.contains(nextRecord.getIntent())) { patientQuestionOptionResult.setOptionChooseSign(0); } else { @@ -641,7 +650,9 @@ public class AIOBServiceImpl implements IAIOBService { } } questionSubmitResultMapper.updatePatientQuestionSubmitResult(patientQuestionSubmitResult); - patientQuestionOptionResultMapper.saveQuestionOptionList(patientQuestionOptionResults); + if(patientQuestionOptionResults.size()>0) { + patientQuestionOptionResultMapper.saveQuestionOptionList(patientQuestionOptionResults); + } totalScore[0] = totalScore[0].add(questionSubjectVO.getQuestionScore() == null ? BigDecimal.ZERO : questionSubjectVO.getQuestionScore()); } else { // 没问到问卷中的问题,则保存空问题+空选项 @@ -667,7 +678,9 @@ public class AIOBServiceImpl implements IAIOBService { patientQuestionOptionResult.setQuestionSubjectResultId(patientQuestionSubjectResult.getId()); patientQuestionOptionResults.add(patientQuestionOptionResult); }); - patientQuestionOptionResultMapper.saveQuestionOptionList(patientQuestionOptionResults); + if(patientQuestionOptionResults.size()>0) { + patientQuestionOptionResultMapper.saveQuestionOptionList(patientQuestionOptionResults); + } totalScore[0] = totalScore[0].add(BigDecimal.ZERO); } });