|
|
|
@ -318,15 +318,19 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService {
|
|
|
|
|
|
|
|
|
|
CommonDic systemDic = commonDicService.lambdaQuery().eq(CommonDic::getGroupCode, "AQT").eq(CommonDic::getCode, "system").one();
|
|
|
|
|
Assert.notNull(systemDic, "未找到系统问题");
|
|
|
|
|
List<CommonDic> childCommonDicList = commonDicService.lambdaQuery().eq(CommonDic::getGroupCode, "AQT")
|
|
|
|
|
.eq(CommonDic::getParentId, systemDic.getId()).list();
|
|
|
|
|
Assert.notNull(childCommonDicList, "未找到系统问题下的子问题");
|
|
|
|
|
Map<Long, CommonDic> childCommonDicMap = childCommonDicList.stream().collect(Collectors.toMap(CommonDic::getId, Function.identity()));
|
|
|
|
|
|
|
|
|
|
Long systemDicId = systemDic.getId();
|
|
|
|
|
|
|
|
|
|
// 从疾病问题记录中查询数据
|
|
|
|
|
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, AskTemplateQuestionLibrary> libraryMapTemp = askTemplateQuestionLibraryService.listByIds(questionIds)
|
|
|
|
@ -337,22 +341,28 @@ public class MedicalRecManageServiceImpl implements MedicalRecManageService {
|
|
|
|
|
MedicalRecQaVO medicalRecQaVO = new MedicalRecQaVO();
|
|
|
|
|
medicalRecQaVO.setId(e.getId());
|
|
|
|
|
medicalRecQaVO.setLibraryQuestionId(e.getLibraryQuestionId());
|
|
|
|
|
medicalRecQaVO.setDictId(systemDicId);
|
|
|
|
|
medicalRecQaVO.setDictNamePath(systemDic.getNameZhPath());
|
|
|
|
|
medicalRecQaVO.setMedicalRecAnswer(e.getAnswer());
|
|
|
|
|
// 组装问题列表 和 字典数据
|
|
|
|
|
AskTemplateQuestionLibrary askTemplateQuestionLibrary = libraryMap.get(e.getLibraryQuestionId());
|
|
|
|
|
if (Objects.nonNull(askTemplateQuestionLibrary)){
|
|
|
|
|
medicalRecQaVO.setQuestionList(askTemplateQuestionLibrary.getQuestion());
|
|
|
|
|
Long dictId = askTemplateQuestionLibrary.getDictId();
|
|
|
|
|
if (Objects.nonNull(dictId)){
|
|
|
|
|
medicalRecQaVO.setDictId(dictId);
|
|
|
|
|
medicalRecQaVO.setDictNamePath(childCommonDicMap.getOrDefault(dictId, new CommonDic()).getNameZhPath());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return medicalRecQaVO;
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
}
|
|
|
|
|
List<AskTemplateQuestionLibrary> askTemplateQuestionLibraryList = askTemplateQuestionLibraryService.lambdaQuery().eq(AskTemplateQuestionLibrary::getDictId, systemDicId).list();
|
|
|
|
|
|
|
|
|
|
// 从问题库中查询数据
|
|
|
|
|
List<Long> commonDicIdList = childCommonDicList.stream().map(CommonDic::getId).collect(Collectors.toList());
|
|
|
|
|
List<AskTemplateQuestionLibrary> askTemplateQuestionLibraryList = askTemplateQuestionLibraryService.lambdaQuery().in(AskTemplateQuestionLibrary::getDictId, commonDicIdList).list();
|
|
|
|
|
return askTemplateQuestionLibraryList.stream().map(e -> {
|
|
|
|
|
MedicalRecQaVO medicalRecQaVO = new MedicalRecQaVO();
|
|
|
|
|
medicalRecQaVO.setLibraryQuestionId(e.getId());
|
|
|
|
|
medicalRecQaVO.setDictId(systemDicId);
|
|
|
|
|
medicalRecQaVO.setDictNamePath(systemDic.getNameZhPath());
|
|
|
|
|
medicalRecQaVO.setDictNamePath(childCommonDicMap.getOrDefault(e.getDictId(), new CommonDic()).getNameZhPath());
|
|
|
|
|
medicalRecQaVO.setMedicalRecAnswer(e.getDefaultAnswer());
|
|
|
|
|
medicalRecQaVO.setQuestionList(e.getQuestion());
|
|
|
|
|
return medicalRecQaVO;
|
|
|
|
|