diff --git a/tcm/src/main/java/com/ccsens/tcm/bean/dto/QuestionDto.java b/tcm/src/main/java/com/ccsens/tcm/bean/dto/QuestionDto.java index f5684451..3959982a 100644 --- a/tcm/src/main/java/com/ccsens/tcm/bean/dto/QuestionDto.java +++ b/tcm/src/main/java/com/ccsens/tcm/bean/dto/QuestionDto.java @@ -19,7 +19,7 @@ public class QuestionDto { private Long id; @ApiModelProperty("试题code") private String code; - @ApiModelProperty("第几次录入信息,默认null则查询全部") - private Integer nums; + @ApiModelProperty("第几次录入信息,默认为0查询第一次") + private Integer nums = 0; } } diff --git a/tcm/src/main/java/com/ccsens/tcm/bean/vo/QuestionVo.java b/tcm/src/main/java/com/ccsens/tcm/bean/vo/QuestionVo.java index d12ac358..a025a963 100644 --- a/tcm/src/main/java/com/ccsens/tcm/bean/vo/QuestionVo.java +++ b/tcm/src/main/java/com/ccsens/tcm/bean/vo/QuestionVo.java @@ -98,8 +98,10 @@ public class QuestionVo { private String remark; @ApiModelProperty("记录类型 0:只记录1次数据,1:记录3次,分别为0,14,90天 ,2:记录两次,分别是180,365") private byte reportType; +// @ApiModelProperty("题目信息") +// private List questionNums; @ApiModelProperty("题目信息") - private List questionNums; + private List questionList; @ApiModelProperty("子类型") private List subCodes; } @@ -129,10 +131,13 @@ public class QuestionVo { private byte type; @ApiModelProperty("备注") private String remark; + @ApiModelProperty("答题记录id") + private Long recordId; @ApiModelProperty("答案") private String answer; @ApiModelProperty("选项信息") private List optionVos; + } @Data diff --git a/tcm/src/main/java/com/ccsens/tcm/persist/dao/QuestionDao.java b/tcm/src/main/java/com/ccsens/tcm/persist/dao/QuestionDao.java index e1762100..a3cc94fd 100644 --- a/tcm/src/main/java/com/ccsens/tcm/persist/dao/QuestionDao.java +++ b/tcm/src/main/java/com/ccsens/tcm/persist/dao/QuestionDao.java @@ -41,7 +41,7 @@ public interface QuestionDao extends QuestionMapper { * @param nums 采集次数 * @return 返回所有试题和答题记录 */ - List getQuestionByCodeAndPatientId(@Param("code")String code, @Param("patientId")Long patientId, @Param("nums")Integer nums); + List getQuestionByCodeAndPatientId(@Param("code")String code, @Param("patientId")Long patientId, @Param("nums")Integer nums); /** * 通过选项id和采集次数,查询选项关联试题信息和患者答题记录 * @param optionId 试题code diff --git a/tcm/src/main/java/com/ccsens/tcm/service/PatientService.java b/tcm/src/main/java/com/ccsens/tcm/service/PatientService.java index df6078ea..c9c7586c 100644 --- a/tcm/src/main/java/com/ccsens/tcm/service/PatientService.java +++ b/tcm/src/main/java/com/ccsens/tcm/service/PatientService.java @@ -242,8 +242,9 @@ public class PatientService implements IPatientService { @Override public List countAnalysis(StatisticDto.SelBinLCount param, Long userId) { List selGroupNumsList= new ArrayList(); - if(param.getInpatientId()!=null && param.getInpatientId().length==0) + if(param.getInpatientId()!=null && param.getInpatientId().length==0) { return selGroupNumsList; + } for (int i = 0; i < param.getInpatientId().length; i++) { StatisticVo.SelGroupNum selGroupNum =new StatisticVo.SelGroupNum(); List selGroupList= patientDao.countAnalysis(param.getConditionList(),param.getConditionListDate(),param.getInpatientId()[i],param.getTestQuestionsId(),param.getHospitalization(),param.getInputStatus(),param.getHospitalId()); 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 1e4d644b..32f92fc5 100644 --- a/tcm/src/main/java/com/ccsens/tcm/service/QuestionService.java +++ b/tcm/src/main/java/com/ccsens/tcm/service/QuestionService.java @@ -32,39 +32,26 @@ public class QuestionService implements IQuestionService{ if(CollectionUtil.isNotEmpty(patientCodeList)){ patientCodeList.forEach(patientCode -> { //查找此类型下的所有试题及该用户的答题信息 - List patientQuestionNumList = questionDao.getQuestionByCodeAndPatientId(patientCode.getCode(),param.getId(),param.getNums()); + if(patientCode.getReportType() == 0){ + param.setNums(0); + } +// List patientQuestionNumList = questionDao.getQuestionByCodeAndPatientId(patientCode.getCode(),param.getId(),param.getNums()); + List patientQuestionNumList = questionDao.getQuestionByCodeAndPatientId(patientCode.getCode(),param.getId(),param.getNums()); if(CollectionUtil.isNotEmpty(patientQuestionNumList)){ - patientQuestionNumList.forEach(patientQuestionNum -> { - if(CollectionUtil.isNotEmpty(patientQuestionNum.getQuestionList())){ - patientQuestionNum.getQuestionList().forEach(question -> { - if(CollectionUtil.isNotEmpty(question.getOptionVos())){ - question.getOptionVos().forEach(patientOption -> { - patientOption.setQuestionVos(questionDao.getQuestionByOptionId(patientOption.getId(),param.getId(),param.getNums())); - }); - } - }); +// 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); +// } +// }); +// patientCode.setQuestionNums(patientQuestionNumList); + patientCode.setQuestionList(patientQuestionNumList); } }); } - -// if(CollectionUtil.isNotEmpty(patientCodes)){ -// patientCodes.forEach(patientCode -> { -// //查询类型下的题目和患者的答案 -// List patientQuestionList = getPatientQuestionByCode(patientCode.getCode(),param.getId()); -// reportCodeVo.setQuestionVos(questionVos); -// //查询子类型下的题目 -// if(CollectionUtil.isNotEmpty(reportCodeVo.getSubReportCodes())){ -// reportCodeVo.getSubReportCodes().forEach(subReportCode -> { -// List subCodeQuestionVos = getQuestionByCode(subReportCode.getCode()); -// subReportCode.setQuestionVos(subCodeQuestionVos); -// }); -// } -// }); -// } - return patientCodeList; } diff --git a/tcm/src/main/resources/mapper_dao/PatientDao.xml b/tcm/src/main/resources/mapper_dao/PatientDao.xml index 5ab2b46f..4e77508d 100644 --- a/tcm/src/main/resources/mapper_dao/PatientDao.xml +++ b/tcm/src/main/resources/mapper_dao/PatientDao.xml @@ -156,6 +156,7 @@ - - - + + @@ -117,7 +116,6 @@ - @@ -134,10 +132,11 @@ o.show_value as oshow_value, o.submit_value as osubmit_value, o.after_operation as oafter_operation, - if(o.submit_value = r.contents,true,false) as choose, + if(q.type > 2 and q.type <13 and q.type != 6,if(o.submit_value = r.contents,true,false),null) as choose, r.patient_id, + r.id as recordId, if(r.collect_time is null, 0,r.collect_time) as collect_time, - if(LEFT(r.contents,3) = '其他:',SUBSTRING(r.contents,4),'') as answer + if(LEFT(r.contents,3) = '其他:',SUBSTRING(r.contents,4),r.contents) as answer FROM t_question q LEFT JOIN t_question_option o on q.id = o.question_id and o.rec_status = 0 @@ -158,6 +157,7 @@ + @@ -182,9 +182,10 @@ o.show_value as oshow_value, o.submit_value as osubmit_value, o.after_operation as oafter_operation, - if(o.submit_value = r.contents,true,false) as choose, + if(q.type > 2 and q.type < 13 and q.type != 6,if(o.submit_value = r.contents,true,false),null) as choose, r.patient_id, - if(LEFT(r.contents,3) = '其他:',SUBSTRING(r.contents,4),'') as answer + r.id as recordId, + if(LEFT(r.contents,3) = '其他:',SUBSTRING(r.contents,4),r.contents) as answer FROM t_question q LEFT JOIN t_question_option o on q.id = o.question_id and o.rec_status = 0 @@ -193,8 +194,7 @@ and collect_time = #{nums} WHERE - q.relevance_option_id = 0 - and q.rec_status = 0 + q.rec_status = 0 and q.relevance_option_id = #{optionId}