|
@ -84,12 +84,38 @@ public class QuestionService implements IQuestionService { |
|
|
} |
|
|
} |
|
|
HtQuestion question = questionList.get(0); |
|
|
HtQuestion question = questionList.get(0); |
|
|
QuestionVo.Question questionVo = QuestionVo.Question.toQuestionVo(question); |
|
|
QuestionVo.Question questionVo = QuestionVo.Question.toQuestionVo(question); |
|
|
|
|
|
//检查当前试题是否有答案,共享答案的试题是否有答案
|
|
|
|
|
|
boolean f = false; |
|
|
|
|
|
HtPatientScoreExample scoreExample = new HtPatientScoreExample(); |
|
|
|
|
|
scoreExample.createCriteria().andPatientIdEqualTo(query.getPatientReportId()).andQuestionIdEqualTo(question.getId()); |
|
|
|
|
|
if(htPatientScoreDao.countByExample(scoreExample) > 0){ |
|
|
|
|
|
f = true; |
|
|
|
|
|
questionVo.setShowShareAnswer((byte) 0); |
|
|
|
|
|
} |
|
|
|
|
|
//试题选项
|
|
|
|
|
|
List<QuestionVo.Option> optionList = htQuestionOptionDao.queryOption(question.getId(), query.getPatientReportId()); |
|
|
|
|
|
|
|
|
//查询可以共享答案的试题的id
|
|
|
//查询可以共享答案的试题的id
|
|
|
List<Long> shareAnswerIds = htQuestionDao.queryShareAnswer(question.getId()); |
|
|
List<Long> shareAnswerIds = new ArrayList<>(); |
|
|
log.info("答案关联的试题id:{}", questionVo); |
|
|
List<QuestionVo.ShareAnswer> shareAnswers = htQuestionDao.queryShareAnswer(question.getId(),query.getPatientReportId()); |
|
|
|
|
|
log.info("答案关联的试题id:{}", shareAnswers); |
|
|
|
|
|
if(CollectionUtil.isNotEmpty(shareAnswers)){ |
|
|
|
|
|
for(QuestionVo.ShareAnswer shareAnswer : shareAnswers){ |
|
|
|
|
|
shareAnswerIds.add(shareAnswer.getShareAnswerId()); |
|
|
|
|
|
if(!f){ |
|
|
|
|
|
if(shareAnswer.getShowShareAnswer() == 1){ |
|
|
|
|
|
questionVo.setShowShareAnswer(shareAnswer.getShowShareAnswer()); |
|
|
|
|
|
optionList = htQuestionOptionDao.queryOption(shareAnswer.getShareAnswerId(), query.getPatientReportId()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
questionVo.setShareAnswerIds(shareAnswerIds); |
|
|
questionVo.setShareAnswerIds(shareAnswerIds); |
|
|
log.info("试题:{}", questionVo); |
|
|
log.info("试题:{}", questionVo); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取评测信息
|
|
|
//获取评测信息
|
|
|
HtReportExample reportExample = new HtReportExample(); |
|
|
HtReportExample reportExample = new HtReportExample(); |
|
|
reportExample.createCriteria().andCodeEqualTo(question.getEvaluationCode()); |
|
|
reportExample.createCriteria().andCodeEqualTo(question.getEvaluationCode()); |
|
@ -129,8 +155,8 @@ public class QuestionService implements IQuestionService { |
|
|
introduceExample.setOrderByClause("sort"); |
|
|
introduceExample.setOrderByClause("sort"); |
|
|
List<HtQuestionIntroducer> introduces = htQuestionIntroducerDao.selectByExample(introduceExample); |
|
|
List<HtQuestionIntroducer> introduces = htQuestionIntroducerDao.selectByExample(introduceExample); |
|
|
List<QuestionVo.Introduce> introduceVos = QuestionVo.Introduce.toIntroduces(introduces); |
|
|
List<QuestionVo.Introduce> introduceVos = QuestionVo.Introduce.toIntroduces(introduces); |
|
|
//试题选项
|
|
|
// //试题选项
|
|
|
List<QuestionVo.Option> options = htQuestionOptionDao.queryOption(question.getId(), query.getPatientReportId()); |
|
|
// List<QuestionVo.Option> options = htQuestionOptionDao.queryOption(question.getId(), query.getPatientReportId());
|
|
|
|
|
|
|
|
|
//答题记录
|
|
|
//答题记录
|
|
|
List<QuestionVo.Record> recordVos; |
|
|
List<QuestionVo.Record> recordVos; |
|
@ -145,7 +171,7 @@ public class QuestionService implements IQuestionService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//封装返回
|
|
|
//封装返回
|
|
|
QuestionVo.Query data = new QuestionVo.Query(questionVo, options, introduceVos, recordVos,maxSort); |
|
|
QuestionVo.Query data = new QuestionVo.Query(questionVo, optionList, introduceVos, recordVos,maxSort); |
|
|
data.setReport(reportVo); |
|
|
data.setReport(reportVo); |
|
|
log.info("试题信息:{}", data); |
|
|
log.info("试题信息:{}", data); |
|
|
return data; |
|
|
return data; |
|
|