1: 修改 AskTemplateQuestionLibrary中的question

pull/1/head
xueqingkun 11 months ago
parent d1b52135ac
commit 7ae55c79a7

@ -298,22 +298,20 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService {
AskTemplateQuestionLibrary questionLibrary = askQuestionMap.get(medicalRecQaVO.getLibraryQuestionId()); AskTemplateQuestionLibrary questionLibrary = askQuestionMap.get(medicalRecQaVO.getLibraryQuestionId());
if (ObjectUtil.isNotEmpty(questionLibrary)) { if (ObjectUtil.isNotEmpty(questionLibrary)) {
// 问题 // 问题
List<String> question = libraryMapQuestion.get(medicalRecQaVO.getLibraryQuestionId());
if (CollUtil.isNotEmpty(medicalRecQaVO.getQuestionList())){ if (CollUtil.isNotEmpty(medicalRecQaVO.getQuestionList())){
if (CollUtil.isNotEmpty(questionLibrary.getQuestion())){ if (CollUtil.isNotEmpty(question)){
List<String> question = questionLibrary.getQuestion();
question.remove(CollUtil.getFirst(medicalRecQaVO.getQuestionList())); question.remove(CollUtil.getFirst(medicalRecQaVO.getQuestionList()));
medicalRecQaVO.getQuestionList().addAll(question); medicalRecQaVO.getQuestionList().addAll(question);
} }
}else { }else {
medicalRecQaVO.setQuestionList(questionLibrary.getQuestion()); medicalRecQaVO.setQuestionList(question);
} }
// 类目 // 类目
medicalRecQaVO.setDictId(questionLibrary.getDictId()); medicalRecQaVO.setDictId(questionLibrary.getDictId());
// 类目名称 // 类目名称
medicalRecQaVO.setDictNamePath(dictMap.getOrDefault(questionLibrary.getDictId(), new CommonDic()).getNameZhPath()); medicalRecQaVO.setDictNamePath(dictMap.getOrDefault(questionLibrary.getDictId(), new CommonDic()).getNameZhPath());
// 默认回答
medicalRecQaVO.setDefaultAnswer(questionLibrary.getDefaultAnswer());
// 回答视频 // 回答视频
medicalRecQaVO.setAnswerResourceName(videoInfoMaps.get(medicalRecQaVO.getAnswerResourceId())); medicalRecQaVO.setAnswerResourceName(videoInfoMaps.get(medicalRecQaVO.getAnswerResourceId()));
} }
@ -349,17 +347,20 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService {
.eq(CommonDic::getParentId, systemDic.getId()).list(); .eq(CommonDic::getParentId, systemDic.getId()).list();
Assert.notNull(childCommonDicList, "未找到系统问题下的子问题"); Assert.notNull(childCommonDicList, "未找到系统问题下的子问题");
Map<Long, CommonDic> childCommonDicMap = childCommonDicList.stream().collect(Collectors.toMap(CommonDic::getId, Function.identity())); Map<Long, CommonDic> childCommonDicMap = childCommonDicList.stream().collect(Collectors.toMap(CommonDic::getId, Function.identity()));
final Map<String, List<String>> libraryMapQuestion = new HashMap<>();
// 从疾病问题记录中查询数据 // 从疾病问题记录中查询数据
if (StrUtil.isNotEmpty(medicalRecId)) { if (StrUtil.isNotEmpty(medicalRecId)) {
List<AskPatientAnswer> askPatientAnswerList = askPatientAnswerService.lambdaQuery() List<AskPatientAnswer> askPatientAnswerList = askPatientAnswerService.lambdaQuery()
.eq(AskPatientAnswer::getMedicalId, medicalRecId).eq(AskPatientAnswer::getAnswerType, 0).list(); .eq(AskPatientAnswer::getMedicalId, medicalRecId).eq(AskPatientAnswer::getAnswerType, 0).list();
final Map<String, AskTemplateQuestionLibrary> libraryMap = new HashMap<>(); final Map<String, AskTemplateQuestionLibrary> libraryMap = new HashMap<>();
if (CollUtil.isNotEmpty(askPatientAnswerList)){ if (CollUtil.isNotEmpty(askPatientAnswerList)){
// 查询问题库信息 // 查询问题库信息
List<String> questionIds = askPatientAnswerList.stream() List<String> questionIds = askPatientAnswerList.stream()
.map(AskPatientAnswer::getLibraryQuestionId).filter(Objects::nonNull).collect(Collectors.toList()); .map(AskPatientAnswer::getLibraryQuestionId).filter(Objects::nonNull).collect(Collectors.toList());
Map<String, List<String>> libraryMapQuestionTmp = askTemplateQuestionSimilarityService.querySimilarityQuestionMapByLibraryIds(questionIds);
libraryMapQuestion.putAll(libraryMapQuestionTmp);
Map<String, AskTemplateQuestionLibrary> libraryMapTemp = askTemplateQuestionLibraryService.listByIds(questionIds) Map<String, AskTemplateQuestionLibrary> libraryMapTemp = askTemplateQuestionLibraryService.listByIds(questionIds)
.stream().collect(Collectors.toMap(AskTemplateQuestionLibrary::getId, Function.identity())); .stream().collect(Collectors.toMap(AskTemplateQuestionLibrary::getId, Function.identity()));
libraryMap.putAll(libraryMapTemp); libraryMap.putAll(libraryMapTemp);
@ -372,7 +373,7 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService {
// 组装问题列表 和 字典数据 // 组装问题列表 和 字典数据
AskTemplateQuestionLibrary askTemplateQuestionLibrary = libraryMap.get(e.getLibraryQuestionId()); AskTemplateQuestionLibrary askTemplateQuestionLibrary = libraryMap.get(e.getLibraryQuestionId());
if (Objects.nonNull(askTemplateQuestionLibrary)){ if (Objects.nonNull(askTemplateQuestionLibrary)){
medicalRecQaVO.setQuestionList(askTemplateQuestionLibrary.getQuestion()); medicalRecQaVO.setQuestionList(libraryMapQuestion.get(e.getLibraryQuestionId()));
Long dictId = askTemplateQuestionLibrary.getDictId(); Long dictId = askTemplateQuestionLibrary.getDictId();
if (Objects.nonNull(dictId)){ if (Objects.nonNull(dictId)){
medicalRecQaVO.setDictId(dictId); medicalRecQaVO.setDictId(dictId);
@ -390,8 +391,7 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService {
MedicalRecQaVO medicalRecQaVO = new MedicalRecQaVO(); MedicalRecQaVO medicalRecQaVO = new MedicalRecQaVO();
medicalRecQaVO.setLibraryQuestionId(e.getId()); medicalRecQaVO.setLibraryQuestionId(e.getId());
medicalRecQaVO.setDictNamePath(childCommonDicMap.getOrDefault(e.getDictId(), new CommonDic()).getNameZhPath()); medicalRecQaVO.setDictNamePath(childCommonDicMap.getOrDefault(e.getDictId(), new CommonDic()).getNameZhPath());
medicalRecQaVO.setMedicalRecAnswer(e.getDefaultAnswer()); medicalRecQaVO.setQuestionList(libraryMapQuestion.get(e.getId()));
medicalRecQaVO.setQuestionList(e.getQuestion());
return medicalRecQaVO; return medicalRecQaVO;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }

Loading…
Cancel
Save