Browse Source

试题答案是多个

recovery
zhizhi wu 4 years ago
parent
commit
d9a6b48d8b
  1. 5
      tcm/src/main/java/com/ccsens/tcm/api/QuestionController.java
  2. 17
      tcm/src/main/java/com/ccsens/tcm/bean/vo/QuestionVo.java
  3. 4
      tcm/src/main/java/com/ccsens/tcm/persist/dao/QuestionDao.java
  4. 2
      tcm/src/main/java/com/ccsens/tcm/service/IQuestionService.java
  5. 6
      tcm/src/main/java/com/ccsens/tcm/service/QuestionService.java
  6. 15
      tcm/src/main/resources/mapper_dao/QuestionDao.xml

5
tcm/src/main/java/com/ccsens/tcm/api/QuestionController.java

@ -2,7 +2,6 @@ package com.ccsens.tcm.api;
import com.ccsens.tcm.bean.dto.CodeVo; import com.ccsens.tcm.bean.dto.CodeVo;
import com.ccsens.tcm.bean.dto.QuestionDto; import com.ccsens.tcm.bean.dto.QuestionDto;
import com.ccsens.tcm.bean.po.Question;
import com.ccsens.tcm.bean.vo.QuestionVo; import com.ccsens.tcm.bean.vo.QuestionVo;
import com.ccsens.tcm.service.IImportService; import com.ccsens.tcm.service.IImportService;
import com.ccsens.tcm.service.IQuestionService; import com.ccsens.tcm.service.IQuestionService;
@ -57,9 +56,9 @@ public class QuestionController {
} }
@ApiOperation(value = "查询所有得题目的类型和题目相关信息",notes = "1007:查询所有试题") @ApiOperation(value = "查询所有得题目的类型和题目相关信息",notes = "1007:查询所有试题")
@RequestMapping(value="/queryQuestion",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"}) @RequestMapping(value="/queryQuestion",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"})
public JsonResponse<List<QuestionVo.subjectLists>> queryQuestion() throws Exception { public JsonResponse<List<QuestionVo.SubjectLists>> queryQuestion() throws Exception {
log.info("查询所有试题:{}"); log.info("查询所有试题:{}");
List<QuestionVo.subjectLists> subjectLists = questionService.queryQuestion(); List<QuestionVo.SubjectLists> subjectLists = questionService.queryQuestion();
log.info("查询所有试题"); log.info("查询所有试题");
return JsonResponse.newInstance().ok(subjectLists); return JsonResponse.newInstance().ok(subjectLists);
} }

17
tcm/src/main/java/com/ccsens/tcm/bean/vo/QuestionVo.java

@ -1,5 +1,7 @@
package com.ccsens.tcm.bean.vo; package com.ccsens.tcm.bean.vo;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -88,7 +90,7 @@ public class QuestionVo {
} }
@Data @Data
@ApiModel("所有试题类型的信息") @ApiModel("所有试题类型的信息")
public static class subjectLists{ public static class SubjectLists {
@ApiModelProperty("id") @ApiModelProperty("id")
private Long id; private Long id;
@ApiModelProperty("code") @ApiModelProperty("code")
@ -96,7 +98,7 @@ public class QuestionVo {
@ApiModelProperty("名称") @ApiModelProperty("名称")
private String name; private String name;
@ApiModelProperty("子类型") @ApiModelProperty("子类型")
private List<subjectLists> optionVos; private List<SubjectLists> optionVos;
} }
@Data @Data
@ApiModel("患者信息的试题类型") @ApiModel("患者信息的试题类型")
@ -156,13 +158,22 @@ public class QuestionVo {
private String remark; private String remark;
@ApiModelProperty("答题记录id") @ApiModelProperty("答题记录id")
private Long recordId; private Long recordId;
@ApiModelProperty("答案") @ApiModelProperty("默认答案")
private String answer; private String answer;
@ApiModelProperty("答案数组,不包含默认答案")
private List<String> domList;
@ApiModelProperty("说明") @ApiModelProperty("说明")
private String explains; private String explains;
@ApiModelProperty("选项信息") @ApiModelProperty("选项信息")
private List<PatientOption> optionVos; private List<PatientOption> optionVos;
public String getAnswer() {
if (StrUtil.isEmpty(answer) && CollectionUtil.isNotEmpty(domList)) {
this.answer = domList.get(0);
domList.remove(0);
}
return this.answer;
}
} }
@Data @Data

4
tcm/src/main/java/com/ccsens/tcm/persist/dao/QuestionDao.java

@ -56,7 +56,7 @@ public interface QuestionDao extends QuestionMapper {
* 查询所有的试题的相关信息 * 查询所有的试题的相关信息
* @return * @return
*/ */
List<QuestionVo.subjectLists> queryQuestion(); List<QuestionVo.SubjectLists> queryQuestion();
List<QuestionVo.subjectLists> queryQuestion1(); List<QuestionVo.SubjectLists> queryQuestion1();
} }

2
tcm/src/main/java/com/ccsens/tcm/service/IQuestionService.java

@ -16,5 +16,5 @@ public interface IQuestionService {
*/ */
List<QuestionVo.PatientCode> getQuestionAndAnswer(QuestionDto.QueryQuestionAndAnswer param); List<QuestionVo.PatientCode> getQuestionAndAnswer(QuestionDto.QueryQuestionAndAnswer param);
List<QuestionVo.subjectLists> queryQuestion(); List<QuestionVo.SubjectLists> queryQuestion();
} }

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

@ -84,12 +84,12 @@ public class QuestionService implements IQuestionService{
} }
@Override @Override
public List<QuestionVo.subjectLists> queryQuestion() { public List<QuestionVo.SubjectLists> queryQuestion() {
// //
List<QuestionVo.subjectLists> subjectLists= questionDao.queryQuestion(); List<QuestionVo.SubjectLists> subjectLists= questionDao.queryQuestion();
List<QuestionVo.subjectLists> subjectLists1= questionDao.queryQuestion1(); List<QuestionVo.SubjectLists> subjectLists1= questionDao.queryQuestion1();
if(subjectLists1.size()>0){ if(subjectLists1.size()>0){
subjectLists1.forEach(subject1 -> { subjectLists1.forEach(subject1 -> {
for (int i = 0; i < subjectLists.size(); i++) { for (int i = 0; i < subjectLists.size(); i++) {

15
tcm/src/main/resources/mapper_dao/QuestionDao.xml

@ -116,8 +116,11 @@
<result column="fillType" jdbcType="TINYINT" property="fillType" /> <result column="fillType" jdbcType="TINYINT" property="fillType" />
<result column="qremark" jdbcType="VARCHAR" property="remark" /> <result column="qremark" jdbcType="VARCHAR" property="remark" />
<result column="recordId" jdbcType="VARCHAR" property="recordId" /> <result column="recordId" jdbcType="VARCHAR" property="recordId" />
<result column="answer" jdbcType="VARCHAR" property="answer" /> <!--<result column="answer" jdbcType="VARCHAR" property="answer" />-->
<result column="explains" jdbcType="VARCHAR" property="explains" /> <result column="explains" jdbcType="VARCHAR" property="explains" />
<collection property="domList" ofType="String">
<result column="answer"/>
</collection>
<collection property="optionVos" ofType="com.ccsens.tcm.bean.vo.QuestionVo$PatientOption"> <collection property="optionVos" ofType="com.ccsens.tcm.bean.vo.QuestionVo$PatientOption">
<id column="oid" jdbcType="BIGINT" property="id" /> <id column="oid" jdbcType="BIGINT" property="id" />
<result column="osort" jdbcType="INTEGER" property="sort" /> <result column="osort" jdbcType="INTEGER" property="sort" />
@ -259,15 +262,15 @@
)a )a
ORDER BY a.qsort,a.osort,a.choose DESC,-a.otherInformation DESC ORDER BY a.qsort,a.osort,a.choose DESC,-a.otherInformation DESC
</select> </select>
<resultMap id="queryQuestionMap" type="com.ccsens.tcm.bean.vo.QuestionVo$subjectLists"> <resultMap id="queryQuestionMap" type="com.ccsens.tcm.bean.vo.QuestionVo.SubjectLists">
<id column="id" property="id"/> <id column="id" property="id"/>
<result column="code" property="code"/> <result column="code" property="code"/>
<result column="name" property="name"/> <result column="name" property="name"/>
<collection property="optionVos" ofType="com.ccsens.tcm.bean.vo.QuestionVo$subjectLists"> <collection property="optionVos" ofType="com.ccsens.tcm.bean.vo.QuestionVo.SubjectLists">
<id column="id1" property="id"/> <id column="id1" property="id"/>
<result column="code1" property="code"/> <result column="code1" property="code"/>
<result column="name1" property="name"/> <result column="name1" property="name"/>
<collection property="optionVos" ofType="com.ccsens.tcm.bean.vo.QuestionVo$subjectLists"> <collection property="optionVos" ofType="com.ccsens.tcm.bean.vo.QuestionVo.SubjectLists">
<id property="id" column="id2"/> <id property="id" column="id2"/>
<result property="name" column="question"/> <result property="name" column="question"/>
</collection> </collection>
@ -295,11 +298,11 @@
AND trc.rec_status =0 AND trc.rec_status =0
order by trc.sort,trc1.sort,tq.sort order by trc.sort,trc1.sort,tq.sort
</select> </select>
<resultMap id="queryQuestion1Map" type="com.ccsens.tcm.bean.vo.QuestionVo$subjectLists"> <resultMap id="queryQuestion1Map" type="com.ccsens.tcm.bean.vo.QuestionVo.SubjectLists">
<id column="id" property="id"/> <id column="id" property="id"/>
<result column="code" property="code"/> <result column="code" property="code"/>
<result column="name" property="name"/> <result column="name" property="name"/>
<collection property="optionVos" ofType="com.ccsens.tcm.bean.vo.QuestionVo$subjectLists"> <collection property="optionVos" ofType="com.ccsens.tcm.bean.vo.QuestionVo.SubjectLists">
<id property="id" column="id2"/> <id property="id" column="id2"/>
<result column="question" property="name"/> <result column="question" property="name"/>
</collection> </collection>

Loading…
Cancel
Save