diff --git a/tcm/src/main/java/com/ccsens/tcm/service/QuestionService.java b/tcm/src/main/java/com/ccsens/tcm/service/QuestionService.java index 082094f5..f76bbedd 100644 --- a/tcm/src/main/java/com/ccsens/tcm/service/QuestionService.java +++ b/tcm/src/main/java/com/ccsens/tcm/service/QuestionService.java @@ -30,26 +30,42 @@ public class QuestionService implements IQuestionService{ public List getQuestionAndAnswer(QuestionDto.QueryQuestionAndAnswer param) { List patientCodeList = reportCodeDao.selectCodeByCode(param.getCode()); if(CollectionUtil.isNotEmpty(patientCodeList)){ + //循环一级code patientCodeList.forEach(patientCode -> { //查找此类型下的所有试题及该用户的答题信息 - if(patientCode.getReportType() == 0){ - param.setNums(0); - } -// List patientQuestionNumList = questionDao.getQuestionByCodeAndPatientId(patientCode.getCode(),param.getId(),param.getNums()); +// if(patientCode.getReportType() == 0){ +// param.setNums(0); +// } + //根据一级code查询试题及答案 List 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 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; diff --git a/tcm/src/main/resources/application.yml b/tcm/src/main/resources/application.yml index 33b76558..4ecd13fd 100644 --- a/tcm/src/main/resources/application.yml +++ b/tcm/src/main/resources/application.yml @@ -1,5 +1,5 @@ spring: profiles: - active: green - include: common, util-green + active: dev + include: common, util-dev diff --git a/tcm/src/main/resources/druid-dev.yml b/tcm/src/main/resources/druid-dev.yml index 22ad8233..d24b0155 100644 --- a/tcm/src/main/resources/druid-dev.yml +++ b/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 \ No newline at end of file +# env: CCSENS_TALL + env: CCSENS_GREENVALLEY \ No newline at end of file diff --git a/tcm/src/main/resources/druid-test.yml b/tcm/src/main/resources/druid-test.yml index 9210cf42..284a37d7 100644 --- a/tcm/src/main/resources/druid-test.yml +++ b/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 \ No newline at end of file + env: CCSENS_TALL