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