diff --git a/ht/src/main/java/com/ccsens/ht/api/ImportController.java b/ht/src/main/java/com/ccsens/ht/api/ImportController.java index 6e9a82c8..c6cd339e 100644 --- a/ht/src/main/java/com/ccsens/ht/api/ImportController.java +++ b/ht/src/main/java/com/ccsens/ht/api/ImportController.java @@ -19,7 +19,6 @@ import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.Part; import java.io.File; -import java.util.Collections; import java.util.List; @@ -69,7 +68,8 @@ public class ImportController { List codes = importService.importReport(excelFile, 2); long time5 = System.currentTimeMillis(); log.info("导入报告单耗时:{}", (time5 - time4)); - + importService.importReportRecord(excelFile, 3); + log.info("导入报告单其他记录耗时:{}", System.currentTimeMillis() - time5); if (CollectionUtil.isNotEmpty(codes)) { for (String code: codes) { importService.importQuestion(excelFile, code); @@ -99,11 +99,22 @@ public class ImportController { String dir = WebConstant.UPLOAD_PROJECT_WBS + File.separator; String path = UploadFileUtil_Servlet3.uploadFile(file, allowedExts, dir); File excelFile = new File(dir+path); - long time2 = System.currentTimeMillis(); - long time4 = System.currentTimeMillis(); importService.importReport(excelFile, 2); - long time5 = System.currentTimeMillis(); - log.info("导入报告单耗时:{}", (time5 - time4)); + return JsonResponse.newInstance().ok(); + } + + @ApiOperation(value = "单独导入报告单类型",notes = "文件大小不能超过20M,支持后缀:.xls|.xlsx") + @ApiImplicitParams({ + @ApiImplicitParam(name = "file", value = "医疗项目表", required = true, paramType = "form",dataType = "__file") + }) + @RequestMapping(value = "/importReportTypeRecord", method = RequestMethod.POST) + public JsonResponse importReportTypeRecord(@RequestParam(required = true) Part file) throws Exception{ + //1.上传文件 + String allowedExts = "xls,xlsx"; + String dir = WebConstant.UPLOAD_PROJECT_WBS + File.separator; + String path = UploadFileUtil_Servlet3.uploadFile(file, allowedExts, dir); + File excelFile = new File(dir+path); + importService.importReportRecord(excelFile, 3); return JsonResponse.newInstance().ok(); } diff --git a/ht/src/main/java/com/ccsens/ht/api/PatientReportController.java b/ht/src/main/java/com/ccsens/ht/api/PatientReportController.java index 55edf517..771d4df3 100644 --- a/ht/src/main/java/com/ccsens/ht/api/PatientReportController.java +++ b/ht/src/main/java/com/ccsens/ht/api/PatientReportController.java @@ -143,20 +143,10 @@ public class PatientReportController { return JsonResponse.newInstance().ok(authority); } - @ApiOperation(value = "导出报告单",notes = "导出报告单") - @ApiImplicitParams({ - @ApiImplicitParam(name = "json", value = "导出报告单", required = true) - }) - @RequestMapping(value="/exportReport", method = RequestMethod.POST) - public JsonResponse exportReport(@RequestBody @ApiParam @Valid QueryDto param){ - //查询报告单信息 - log.info("查询报告单详情:{}", param); - String path = patientReportService.exportReport(param.getParam(), param.getUserId()); - log.info("文件路径:{}", path); - PatientReportVo.Export export = new PatientReportVo.Export(); - export.setPath(path); - return JsonResponse.newInstance().ok(export); - } + + + + @ApiOperation(value = "分享报告单",notes = "分享报告单") @ApiImplicitParams({ diff --git a/ht/src/main/java/com/ccsens/ht/api/PatientReportExportController.java b/ht/src/main/java/com/ccsens/ht/api/PatientReportExportController.java new file mode 100644 index 00000000..6cb35235 --- /dev/null +++ b/ht/src/main/java/com/ccsens/ht/api/PatientReportExportController.java @@ -0,0 +1,59 @@ +package com.ccsens.ht.api; + +import com.ccsens.ht.bean.dto.PatientReportDto; +import com.ccsens.ht.bean.vo.PatientReportVo; +import com.ccsens.ht.service.IPatientReportService; +import com.ccsens.util.JsonResponse; +import com.ccsens.util.bean.dto.QueryDto; +import io.swagger.annotations.*; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import javax.validation.Valid; + +/** + * @description: + * @author: whj + * @time: 2021/4/21 19:01 + */ +@Slf4j +@Api(tags = "报告单导出",value = "报告单导出") +@RestController +public class PatientReportExportController { + @Resource + private IPatientReportService patientReportService; + + @ApiOperation(value = "导出报告单",notes = "导出报告单") + @ApiImplicitParams({ + @ApiImplicitParam(name = "json", value = "导出报告单", required = true) + }) + @RequestMapping(value="/exportReport", method = RequestMethod.POST) + public JsonResponse exportReport(@RequestBody @ApiParam @Valid QueryDto param){ + //查询报告单信息 + log.info("查询报告单详情:{}", param); + String path = patientReportService.exportReport(param.getParam(), param.getUserId()); + log.info("文件路径:{}", path); + PatientReportVo.Export export = new PatientReportVo.Export(); + export.setPath(path); + return JsonResponse.newInstance().ok(export); + } + + @ApiOperation(value = "导出指定报告单",notes = "导出报告单") + @ApiImplicitParams({ + @ApiImplicitParam(name = "json", value = "导出报告单", required = true) + }) + @RequestMapping(value="/export", method = RequestMethod.POST) + public JsonResponse export(@RequestBody @ApiParam @Valid QueryDto param){ + //查询报告单信息 + log.info("导出指定报告单:{}", param); + String path = patientReportService.export(param.getParam(), param.getUserId()); + log.info("文件路径:{}", path); + PatientReportVo.Export export = new PatientReportVo.Export(); + export.setPath(path); + return JsonResponse.newInstance().ok(export); + } +} diff --git a/ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java b/ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java index b3c18771..78c735a6 100644 --- a/ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java +++ b/ht/src/main/java/com/ccsens/ht/bean/dto/PatientReportDto.java @@ -86,7 +86,17 @@ public class PatientReportDto { @ApiModelProperty("报告单类型") private String report = "REPORT1.0"; } - + + @ApiModel("导出指定某一种报告单") + @Data + public static class ExportCode{ + @ApiModelProperty("病人报告单ID") + @NotNull(message = "病人报告单ID不能为空") + private Long id; + @ApiModelProperty("报告单类型") + private String code; + } + /**医生对报告单权限*/ @ApiModel("PatientReportDtoAuthority") diff --git a/ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java b/ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java index e57226d1..33daf6da 100644 --- a/ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java +++ b/ht/src/main/java/com/ccsens/ht/bean/vo/QuestionVo.java @@ -117,6 +117,8 @@ public class QuestionVo { public static class Question{ @ApiModelProperty("试题ID") private Long id; + @ApiModelProperty("一级评测类型") + private String evaluationCode; @ApiModelProperty("评测类型") private String parentCode; @ApiModelProperty("排序") @@ -141,8 +143,8 @@ public class QuestionVo { private Integer clearTimes; @ApiModelProperty("定时器时长") private Integer timingLength; - @ApiModelProperty("答案路径") - private String path; +// @ApiModelProperty("答案路径") +// private String path; @ApiModelProperty("共享答案的试题Id") private List shareAnswerIds; @ApiModelProperty("是否展示关联的试题的答案 0否 1是") @@ -186,9 +188,6 @@ public class QuestionVo { public static final class QuestionRecord{ @ApiModelProperty("id") private Long id; - private Byte recordType; - private Long questionId; - private Integer sort; @ApiModelProperty("0:点击过程 1:自动计算 2:手动计算") private Byte calcType; @ApiModelProperty("显示内容") @@ -201,6 +200,8 @@ public class QuestionVo { private Byte type; @ApiModelProperty("备注") private String remark; + @ApiModelProperty("答案") + private List answers; } @Data @@ -251,8 +252,13 @@ public class QuestionVo { private String answer; @ApiModelProperty("是否选中") private Byte choose; + @ApiModelProperty("选项补充") + private List optionDescList; + } + + @Data @ApiModel("QuestionVoIntroduce") public static class Introduce { diff --git a/ht/src/main/java/com/ccsens/ht/persist/dao/HtQuestionDao.java b/ht/src/main/java/com/ccsens/ht/persist/dao/HtQuestionDao.java index 400b2231..50bd2dda 100644 --- a/ht/src/main/java/com/ccsens/ht/persist/dao/HtQuestionDao.java +++ b/ht/src/main/java/com/ccsens/ht/persist/dao/HtQuestionDao.java @@ -28,4 +28,13 @@ public interface HtQuestionDao extends HtQuestionMapper { * 查询可以共享答案的试题id */ List queryShareAnswer(@Param("questionId")Long questionId, @Param("patientReportId") Long patientReportId); + + /** + * 查询试题和其他记录,以及其他记录的答案 + * @param code evaluation_code + * @param num sort + * @param patientReportId 报告单ID + * @return 试题 + */ + QuestionVo.Question queryQuestionAndRecord(@Param("code") String code, @Param("num") int num, @Param("patientReportId") Long patientReportId); } diff --git a/ht/src/main/java/com/ccsens/ht/persist/dao/HtReportDao.java b/ht/src/main/java/com/ccsens/ht/persist/dao/HtReportDao.java index 68e84f72..010b8dc1 100644 --- a/ht/src/main/java/com/ccsens/ht/persist/dao/HtReportDao.java +++ b/ht/src/main/java/com/ccsens/ht/persist/dao/HtReportDao.java @@ -2,10 +2,10 @@ package com.ccsens.ht.persist.dao; import com.ccsens.ht.bean.po.HtReport; import com.ccsens.ht.bean.vo.PatientReportSearchVo; +import com.ccsens.ht.bean.vo.QuestionVo; import com.ccsens.ht.persist.mapper.HtReportMapper; import org.apache.ibatis.annotations.Param; -import java.util.Collection; import java.util.List; /** @@ -45,4 +45,12 @@ public interface HtReportDao extends HtReportMapper { * @return code */ List queryCode(@Param("type") byte type); + + /** + * 查询报告单和记录 + * @param code code + * @param patientReportId patientReportId + * @return report+record + */ + QuestionVo.Report queryReportAndRecord(@Param("code") String code, @Param("patientReportId") Long patientReportId); } diff --git a/ht/src/main/java/com/ccsens/ht/service/IImportService.java b/ht/src/main/java/com/ccsens/ht/service/IImportService.java index 4cdb3e47..2af8951f 100644 --- a/ht/src/main/java/com/ccsens/ht/service/IImportService.java +++ b/ht/src/main/java/com/ccsens/ht/service/IImportService.java @@ -31,14 +31,14 @@ public interface IImportService { String importTitle(File file, int sheetIndex) throws Exception; /** *@Description:导入测评报告单分类 - *@param file 文件 - *@param sheetIndex 第几个sheet *@return: void *@Author: wuhuijuan *@date: 2019/10/21 15:08 * @return 报告单类型 + * @param file 文件 + * @param index report是第几个sheet */ - List importReport(File file, int sheetIndex) throws Exception; + List importReport(File file, int index) throws Exception; /** *@Description:导入测评报告单分类 @@ -49,4 +49,11 @@ public interface IImportService { *@date: 2019/10/21 15:08 */ void importQuestion(File file, String type) throws Exception; + + /** + * 导入报告单其他记录 + * @param excelFile excel + * @param sheetIndex 第几个 + */ + void importReportRecord(File excelFile, int sheetIndex) throws Exception; } diff --git a/ht/src/main/java/com/ccsens/ht/service/ImportService.java b/ht/src/main/java/com/ccsens/ht/service/ImportService.java index f89ac511..9d162fa6 100644 --- a/ht/src/main/java/com/ccsens/ht/service/ImportService.java +++ b/ht/src/main/java/com/ccsens/ht/service/ImportService.java @@ -9,9 +9,11 @@ import com.alibaba.fastjson.JSONObject; import com.ccsens.ht.bean.po.*; import com.ccsens.ht.persist.dao.*; import com.ccsens.ht.uitl.Constant; +import com.ccsens.util.CodeEnum; import com.ccsens.util.PoiUtil; import com.ccsens.util.PropUtil; import com.ccsens.util.StringUtil; +import com.ccsens.util.exception.BaseException; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; @@ -237,6 +239,40 @@ public class ImportService implements IImportService { } } + @Override + public void importReportRecord(File excelFile, int sheetIndex) throws Exception { + + List reports = PoiUtil.readExce(excelFile, sheetIndex, null,1, false); + log.info("导入报告单其他记录,读取数据完成"); + List htReports = htReportDao.selectByExample(new HtReportExample()); + Map reportMap = new HashMap<>(); + htReports.forEach(htReport -> reportMap.put(htReport.getCode(), htReport.getId())); + log.info("报告单类型查询完成"); + + List reportRecordList = new ArrayList<>(); + List optionList = new ArrayList<>(); + for (Object[] objs: reports) { + if (!pageData(objs)) { + log.info("测评报告单数据不足,跳转下一行"); + continue; + } + Long id = reportMap.get(String.valueOf(objs[0])); + if (id == null) { + log.info("报告单类型不存在:{}", objs[0]); + throw new BaseException(CodeEnum.PARAM_ERROR); + } + HtQuestionRecord record = initRecord(objs, id , optionList, Constant.Ht.QuestionRecord.RECORD_TYPE_CODE, 1); + reportRecordList.add(record); + + } + if (!reportRecordList.isEmpty()) { + htQuestionRecordDao.insertBatch(reportRecordList); + } + if (!optionList.isEmpty()) { + htQuestionRecordOptionDao.insertBatch(optionList); + } + } + /** * 保存试题 * */ @@ -259,60 +295,7 @@ public class ImportService implements IImportService { int sort = objs.length > 3 && StringUtil.checkNum(String.valueOf(objs[3]), false) ? Integer.parseInt(String.valueOf(objs[3])) : 1; String type = String.valueOf(objs[0]); - switch (type) { - case Constant.Import.EVALUATION_QUESTION : - HtQuestion question = initQuestion(objs, evaluationCode, sort); - question.setEvaluationCode(parentCode.getOrDefault(question.getParentCode(), question.getEvaluationCode())); - questionList.add(question); - break; - case Constant.Import.EVALUATION_RELATION: - HtQuestion relationQuestion = initQuestion(objs, evaluationCode, sort); - relationQuestion.setEvaluationCode(parentCode.getOrDefault(relationQuestion.getParentCode(), relationQuestion.getEvaluationCode())); - if (CollectionUtil.isNotEmpty(questionList)) { - HtQuestion prev = questionList.get(questionList.size() - 1); - if (prev.getRelationId() != null && prev.getRelationId() >0) { - prev.setRelationId(prev.getRelationId()); - } else { - prev.setRelationId(prev.getId()); - } - } - questionList.add(relationQuestion); - break; - case Constant.Import.EVALUATION_OPTION : - if (questionList.isEmpty()) { - break; - } - HtQuestionOption option = initOption(objs, questionList.get(questionList.size()-1).getId(), sort, optionDescList, optionDescDelList); - optionList.add(option); - break; - case Constant.Import.EVALUATION_PARSE : - if (questionList.isEmpty()) { - break; - } - HtQuestionIntroducer introduce = initIntroduce(objs, questionList.get(questionList.size()-1).getId(), sort); - introduceList.add(introduce); - break; - case Constant.Import.EVALUATION_RULE : - if (questionList.isEmpty()) { - break; - } - HtQuestionScoringRule rule = initRule(objs, questionList.get(questionList.size() - 1).getId()); - ruleList.add(rule); - break; - case Constant.Import.EVALUATION_RECORD: - if (questionList.isEmpty()) { - break; - } - HtQuestionRecord record = initRecord(objs, questionList.get(questionList.size() - 1).getId(), questionRecordOptionList); - questionRecordList.add(record); - break; - default: - log.info("{}类型未知,不解析", type); - break; - } - - - + initData(evaluationCode, questionList, optionList, introduceList, ruleList, questionRecordList, questionRecordOptionList, optionDescList, optionDescDelList, parentCode, objs, sort, type); } if (!questionList.isEmpty()) { @@ -341,6 +324,63 @@ public class ImportService implements IImportService { } } + /** + * 试题导入:将obj[] 转换成 对应的data + */ + private void initData(String evaluationCode, List questionList, List optionList, List introduceList, List ruleList, List questionRecordList, List questionRecordOptionList, List optionDescList, List optionDescDelList, Map parentCode, Object[] objs, int sort, String type) { + switch (type) { + case Constant.Import.EVALUATION_QUESTION : + HtQuestion question = initQuestion(objs, evaluationCode, sort); + question.setEvaluationCode(parentCode.getOrDefault(question.getParentCode(), question.getEvaluationCode())); + questionList.add(question); + break; + case Constant.Import.EVALUATION_RELATION: + HtQuestion relationQuestion = initQuestion(objs, evaluationCode, sort); + relationQuestion.setEvaluationCode(parentCode.getOrDefault(relationQuestion.getParentCode(), relationQuestion.getEvaluationCode())); + if (CollectionUtil.isNotEmpty(questionList)) { + HtQuestion prev = questionList.get(questionList.size() - 1); + if (prev.getRelationId() != null && prev.getRelationId() >0) { + prev.setRelationId(prev.getRelationId()); + } else { + prev.setRelationId(prev.getId()); + } + } + questionList.add(relationQuestion); + break; + case Constant.Import.EVALUATION_OPTION : + if (questionList.isEmpty()) { + break; + } + HtQuestionOption option = initOption(objs, questionList.get(questionList.size()-1).getId(), sort, optionDescList, optionDescDelList); + optionList.add(option); + break; + case Constant.Import.EVALUATION_PARSE : + if (questionList.isEmpty()) { + break; + } + HtQuestionIntroducer introduce = initIntroduce(objs, questionList.get(questionList.size()-1).getId(), sort); + introduceList.add(introduce); + break; + case Constant.Import.EVALUATION_RULE : + if (questionList.isEmpty()) { + break; + } + HtQuestionScoringRule rule = initRule(objs, questionList.get(questionList.size() - 1).getId()); + ruleList.add(rule); + break; + case Constant.Import.EVALUATION_RECORD: + if (questionList.isEmpty()) { + break; + } + HtQuestionRecord record = initRecord(objs, questionList.get(questionList.size() - 1).getId(), questionRecordOptionList, Constant.Ht.QuestionRecord.RECORD_TYPE_QUESTION, (byte)3); + questionRecordList.add(record); + break; + default: + log.info("{}类型未知,不解析", type); + break; + } + } + /** * 封装record 及 option * @param objs 一列 @@ -348,16 +388,16 @@ public class ImportService implements IImportService { * @param questionRecordOptions record选项 * @return record */ - private HtQuestionRecord initRecord(Object[] objs, Long id, List questionRecordOptions) { + private HtQuestionRecord initRecord(Object[] objs, Long id, List questionRecordOptions, byte recordType, int sortIndex ) { HtQuestionRecord record = new HtQuestionRecord(); String content = (String)objs[2]; JSONObject json = JSONObject.parseObject(content); BeanUtils.copyProperties(json, record); - record.setRecordType(Constant.Ht.QuestionRecord.RECORD_TYPE_QUESTION); + record.setRecordType(recordType); // 判断是否存在,设置id - int sortIndex = 3; int sort = StringUtil.checkNum(String.valueOf(objs[sortIndex]), false) ? Integer.parseInt(String.valueOf(objs[sortIndex])) : Constant.Ht.Question.RULE_TYPE_DEFAULT; + record.setSort(sort); HtQuestionRecordExample recordExample = new HtQuestionRecordExample(); recordExample.createCriteria().andQuestionIdEqualTo(id).andSortEqualTo(sort); List questionRecords = htQuestionRecordDao.selectByExample(recordExample); @@ -368,6 +408,7 @@ public class ImportService implements IImportService { record.setId(questionRecords.get(0).getId()); } + log.info("添加record:{}", record); if (!json.containsKey(Constant.Import.RELATION_OPTION)) { return record; diff --git a/ht/src/main/java/com/ccsens/ht/service/QuestionService.java b/ht/src/main/java/com/ccsens/ht/service/QuestionService.java index b3c7ca30..89988e81 100644 --- a/ht/src/main/java/com/ccsens/ht/service/QuestionService.java +++ b/ht/src/main/java/com/ccsens/ht/service/QuestionService.java @@ -75,25 +75,19 @@ public class QuestionService implements IQuestionService { @Override public QuestionVo.Query queryQuestion(QuestionDto.Query query, Long userId) { log.info("请求参数:{},{}", query, userId); - //TODO 1.根据类型和题号,查询试题 和 补充内容(含code的补充内容) - HtQuestionExample questionExample = new HtQuestionExample(); - questionExample.createCriteria().andEvaluationCodeEqualTo(query.getCode()).andSortEqualTo(query.getNum()); - List questionList = htQuestionDao.selectByExample(questionExample); - log.info("测评试题:{}", questionList); - - if (CollectionUtils.isEmpty(questionList)) { + //1.根据类型和题号,查询试题 和 补充内容 + QuestionVo.Question questionVo = htQuestionDao.queryQuestionAndRecord(query.getCode(), query.getNum(), query.getPatientReportId()); + if (questionVo == null) { throw new BaseException(CodeEnum.QUESTION_NOT_FOUND); } - HtQuestion question = questionList.get(0); - QuestionVo.Question questionVo = QuestionVo.Question.toQuestionVo(question); - - // TODO 查询code的补充内容,做缓存 + //获取code信息及补充信息 + QuestionVo.Report reportVo = htReportDao.queryReportAndRecord(questionVo.getParentCode(), query.getPatientReportId()); //检查当前试题是否有答案,共享答案的试题是否有答案 boolean f = false; if(ObjectUtil.isNotNull(query.getPatientReportId())){ HtPatientScoreExample scoreExample = new HtPatientScoreExample(); - scoreExample.createCriteria().andPatientReportIdEqualTo(query.getPatientReportId()).andQuestionIdEqualTo(question.getId()) + scoreExample.createCriteria().andPatientReportIdEqualTo(query.getPatientReportId()).andQuestionIdEqualTo(questionVo.getId()) .andTypeBetween((byte)0,(byte)1); if(htPatientScoreDao.countByExample(scoreExample) > 0){ f = true; @@ -103,7 +97,7 @@ public class QuestionService implements IQuestionService { //查询可以共享答案的试题的id List shareAnswerIds = new ArrayList<>(); - List shareAnswers = htQuestionDao.queryShareAnswer(question.getId(),query.getPatientReportId()); + List shareAnswers = htQuestionDao.queryShareAnswer(questionVo.getId(),query.getPatientReportId()); log.info("答案关联的试题id:{}", shareAnswers); if(CollectionUtil.isNotEmpty(shareAnswers)){ for(QuestionVo.ShareAnswer shareAnswer : shareAnswers){ @@ -122,22 +116,10 @@ public class QuestionService implements IQuestionService { - //TODO 获取评测信息及补充信息 - HtReportExample reportExample = new HtReportExample(); - reportExample.createCriteria().andCodeEqualTo(question.getEvaluationCode()); - List htReports = htReportDao.selectByExample(reportExample); - QuestionVo.Report reportVo = new QuestionVo.Report(); - if (CollectionUtil.isNotEmpty(htReports)) { - HtReport htReport = htReports.get(0); - reportVo.setCode(htReport.getCode()); - reportVo.setName(htReport.getName()); - } - - Integer maxSort = htQuestionDao.selectMaxSort(query.getCode()); //查询关联题目 HtQuestionExample example = new HtQuestionExample(); - example.createCriteria().andRelationIdEqualTo(question.getId()); + example.createCriteria().andRelationIdEqualTo(questionVo.getId()); example.setOrderByClause("id"); List relationQuestions = htQuestionDao.selectByExample(example); List vos = new ArrayList<>(); @@ -154,18 +136,18 @@ public class QuestionService implements IQuestionService { //试题引导语 HtQuestionIntroducerExample introduceExample = new HtQuestionIntroducerExample(); - introduceExample.createCriteria().andQuestionIdEqualTo(question.getId()); + introduceExample.createCriteria().andQuestionIdEqualTo(questionVo.getId()); introduceExample.setOrderByClause("sort"); List introduces = htQuestionIntroducerDao.selectByExample(introduceExample); List introduceVos = QuestionVo.Introduce.toIntroduces(introduces); - //TODO 试题选项 及补充 - List optionList = htQuestionOptionDao.queryOption(question.getId(), query.getPatientReportId()); + + List optionList = htQuestionOptionDao.queryOption(questionVo.getId(), query.getPatientReportId()); //答题记录 List recordVos; if (query.getPatientReportId() != null && query.getPatientReportId() != 0) { HtPatientQuestionRecordExample recordExample = new HtPatientQuestionRecordExample(); - recordExample.createCriteria().andPatientReportIdEqualTo(query.getPatientReportId()).andQuestionIdEqualTo(question.getId()); + recordExample.createCriteria().andPatientReportIdEqualTo(query.getPatientReportId()).andQuestionIdEqualTo(questionVo.getId()); recordExample.setOrderByClause("record_time"); List records = htPatientQuestionRecordMapper.selectByExample(recordExample); recordVos = QuestionVo.Record.toRecords(records); diff --git a/ht/src/main/resources/mapper_dao/HtQuestionDao.xml b/ht/src/main/resources/mapper_dao/HtQuestionDao.xml index 52cde333..9dd63370 100644 --- a/ht/src/main/resources/mapper_dao/HtQuestionDao.xml +++ b/ht/src/main/resources/mapper_dao/HtQuestionDao.xml @@ -1,29 +1,36 @@ - + - - + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - + replace into t_ht_question (id, evaluation_code, parent_code, sort, question, type, record_type, record_content, relation_code, @@ -60,4 +67,60 @@ r.question_id = #{questionId} GROUP BY r.relevance_id + \ No newline at end of file diff --git a/ht/src/main/resources/mapper_dao/HtQuestionOptionDao.xml b/ht/src/main/resources/mapper_dao/HtQuestionOptionDao.xml index 296ed4a8..3a8c3294 100644 --- a/ht/src/main/resources/mapper_dao/HtQuestionOptionDao.xml +++ b/ht/src/main/resources/mapper_dao/HtQuestionOptionDao.xml @@ -23,9 +23,14 @@ + + + + + - + replace into t_ht_question_option (id, question_id, sort, type, name, score, display, remark, create_time, @@ -41,11 +46,15 @@ \ No newline at end of file diff --git a/ht/src/main/resources/mapper_dao/HtReportDao.xml b/ht/src/main/resources/mapper_dao/HtReportDao.xml index 68da8ab4..33ac4736 100644 --- a/ht/src/main/resources/mapper_dao/HtReportDao.xml +++ b/ht/src/main/resources/mapper_dao/HtReportDao.xml @@ -1,23 +1,24 @@ - - + - - - - - - - - - - + + + + + + + + + + + + - + replace into t_ht_report (id, code, name, parent_code, description, total_score, type, is_show, sort, @@ -32,7 +33,7 @@ - select * from t_ht_report where is_show = 1 and is_del = 0 order by type,sort select code from t_ht_report where type = #{type} and is_del = 0 + \ No newline at end of file