|
|
@ -30,26 +30,42 @@ public class QuestionService implements IQuestionService{ |
|
|
|
public List<QuestionVo.PatientCode> getQuestionAndAnswer(QuestionDto.QueryQuestionAndAnswer param) { |
|
|
|
List<QuestionVo.PatientCode> patientCodeList = reportCodeDao.selectCodeByCode(param.getCode()); |
|
|
|
if(CollectionUtil.isNotEmpty(patientCodeList)){ |
|
|
|
//循环一级code
|
|
|
|
patientCodeList.forEach(patientCode -> { |
|
|
|
//查找此类型下的所有试题及该用户的答题信息
|
|
|
|
if(patientCode.getReportType() == 0){ |
|
|
|
param.setNums(0); |
|
|
|
} |
|
|
|
// List<QuestionVo.PatientQuestionNum> patientQuestionNumList = questionDao.getQuestionByCodeAndPatientId(patientCode.getCode(),param.getId(),param.getNums());
|
|
|
|
// if(patientCode.getReportType() == 0){
|
|
|
|
// param.setNums(0);
|
|
|
|
// }
|
|
|
|
//根据一级code查询试题及答案
|
|
|
|
List<QuestionVo.PatientQuestion> patientQuestionNumList = questionDao.getQuestionByCodeAndPatientId(patientCode.getCode(),param.getId(),param.getNums()); |
|
|
|
//查询选项关联的试题及答案
|
|
|
|
if(CollectionUtil.isNotEmpty(patientQuestionNumList)){ |
|
|
|
// patientQuestionNumList.forEach(patientQuestionNum -> {
|
|
|
|
// if(CollectionUtil.isNotEmpty(patientQuestionNum.getQuestionList())){
|
|
|
|
patientQuestionNumList.forEach(question -> { |
|
|
|
if(CollectionUtil.isNotEmpty(question.getOptionVos())){ |
|
|
|
question.getOptionVos().forEach(patientOption -> patientOption.setQuestionVos(questionDao.getQuestionByOptionId(patientOption.getId(),param.getId(),param.getNums()))); |
|
|
|
} |
|
|
|
}); |
|
|
|
// }
|
|
|
|
// });
|
|
|
|
// patientCode.setQuestionNums(patientQuestionNumList);
|
|
|
|
//将题目放到一级code下
|
|
|
|
patientCode.setQuestionVos(patientQuestionNumList); |
|
|
|
} |
|
|
|
|
|
|
|
//判断是否有二级code
|
|
|
|
if(CollectionUtil.isNotEmpty(patientCode.getSubReportCodes())){ |
|
|
|
patientCode.getSubReportCodes().forEach(subReportCode -> { |
|
|
|
//查询二级code下的试题和答案
|
|
|
|
List<QuestionVo.PatientQuestion> subpatientQuestionNumList = questionDao.getQuestionByCodeAndPatientId(patientCode.getCode(),param.getId(),param.getNums()); |
|
|
|
//查询选项关联的试题及答案
|
|
|
|
if(CollectionUtil.isNotEmpty(subpatientQuestionNumList)){ |
|
|
|
subpatientQuestionNumList.forEach(question -> { |
|
|
|
if(CollectionUtil.isNotEmpty(question.getOptionVos())){ |
|
|
|
question.getOptionVos().forEach(patientOption -> patientOption.setQuestionVos(questionDao.getQuestionByOptionId(patientOption.getId(),param.getId(),param.getNums()))); |
|
|
|
} |
|
|
|
}); |
|
|
|
//将试题信息,放到二级code下
|
|
|
|
subReportCode.setQuestionVos(subpatientQuestionNumList); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
return patientCodeList; |
|
|
|