Browse Source

20210303修改查询试题及答案的接口

recovery
zy_Java 4 years ago
parent
commit
14919b0247
  1. 34
      tcm/src/main/java/com/ccsens/tcm/service/QuestionService.java
  2. 4
      tcm/src/main/resources/application.yml
  3. 9
      tcm/src/main/resources/druid-dev.yml
  4. 2
      tcm/src/main/resources/druid-test.yml

34
tcm/src/main/java/com/ccsens/tcm/service/QuestionService.java

@ -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;

4
tcm/src/main/resources/application.yml

@ -1,5 +1,5 @@
spring:
profiles:
active: green
include: common, util-green
active: dev
include: common, util-dev

9
tcm/src/main/resources/druid-dev.yml

@ -16,7 +16,8 @@ spring:
minEvictableIdleTimeMillis: 300000
minIdle: 5
# password: 37080c1f223685592316b02dad8816c019290a476e54ebb638f9aa3ba8b6bdb9
password: 68073a279b399baa1fa12cf39bfbb65bfc1480ffee7b659ccc81cf19be8c4473
# password: 68073a279b399baa1fa12cf39bfbb65bfc1480ffee7b659ccc81cf19be8c4473
password: 6ba13d9930a6ad888a3704376c920a75
poolPreparedStatements: true
servletLogSlowSql: true
servletLoginPassword: 111111
@ -28,9 +29,11 @@ spring:
testOnReturn: false
testWhileIdle: true
timeBetweenEvictionRunsMillis: 60000
url: jdbc:mysql://49.233.89.188:3306/tcm?useUnicode=true&characterEncoding=UTF-8
# url: jdbc:mysql://49.233.89.188:3306/tcm?useUnicode=true&characterEncoding=UTF-8
url: jdbc:mysql://49.232.6.143:3306/tcm?useUnicode=true&characterEncoding=UTF-8
# url: jdbc:mysql://127.0.0.1/mt?useUnicode=true&characterEncoding=UTF-8
username: root
validationQuery: SELECT 1 FROM DUAL
# env: CCSENS_GAME
env: CCSENS_TALL
# env: CCSENS_TALL
env: CCSENS_GREENVALLEY

2
tcm/src/main/resources/druid-test.yml

@ -30,4 +30,4 @@ spring:
url: jdbc:mysql://test.tall.wiki/tcm?useUnicode=true&characterEncoding=UTF-8
username: root
validationQuery: SELECT 1 FROM DUAL
env: CCSENS_TALL
env: CCSENS_TALL

Loading…
Cancel
Save