Browse Source

20210205修改查看试题及答案的接口

recovery
zy_Java 4 years ago
parent
commit
a18648e728
  1. 4
      tcm/src/main/java/com/ccsens/tcm/bean/dto/QuestionDto.java
  2. 6
      tcm/src/main/java/com/ccsens/tcm/bean/vo/QuestionVo.java
  3. 2
      tcm/src/main/java/com/ccsens/tcm/persist/dao/QuestionDao.java
  4. 3
      tcm/src/main/java/com/ccsens/tcm/service/PatientService.java
  5. 41
      tcm/src/main/java/com/ccsens/tcm/service/QuestionService.java
  6. 7
      tcm/src/main/resources/mapper_dao/PatientDao.xml
  7. 20
      tcm/src/main/resources/mapper_dao/QuestionDao.xml

4
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;
}
}

6
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<PatientQuestionNum> questionNums;
@ApiModelProperty("题目信息")
private List<PatientQuestionNum> questionNums;
private List<PatientQuestion> questionList;
@ApiModelProperty("子类型")
private List<PatientCode> subCodes;
}
@ -129,6 +131,8 @@ public class QuestionVo {
private byte type;
@ApiModelProperty("备注")
private String remark;
@ApiModelProperty("答题记录id")
private Long recordId;
@ApiModelProperty("答案")
private String answer;
@ApiModelProperty("选项信息")

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

@ -41,7 +41,7 @@ public interface QuestionDao extends QuestionMapper {
* @param nums 采集次数
* @return 返回所有试题和答题记录
*/
List<QuestionVo.PatientQuestionNum> getQuestionByCodeAndPatientId(@Param("code")String code, @Param("patientId")Long patientId, @Param("nums")Integer nums);
List<QuestionVo.PatientQuestion> getQuestionByCodeAndPatientId(@Param("code")String code, @Param("patientId")Long patientId, @Param("nums")Integer nums);
/**
* 通过选项id和采集次数查询选项关联试题信息和患者答题记录
* @param optionId 试题code

3
tcm/src/main/java/com/ccsens/tcm/service/PatientService.java

@ -241,8 +241,9 @@ public class PatientService implements IPatientService {
@Override
public List<StatisticVo.SelGroupNum> countAnalysis(StatisticDto.SelBinLCount param, Long userId) {
List<StatisticVo.SelGroupNum> selGroupNumsList= new ArrayList<StatisticVo.SelGroupNum>();
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<StatisticVo.SelGroupList> selGroupList= patientDao.countAnalysis(param.getConditionList(),param.getConditionListDate(),param.getInpatientId()[i],param.getTestQuestionsId(),param.getHospitalization(),param.getInputStatus(),param.getHospitalId());

41
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<QuestionVo.PatientQuestionNum> patientQuestionNumList = questionDao.getQuestionByCodeAndPatientId(patientCode.getCode(),param.getId(),param.getNums());
if(patientCode.getReportType() == 0){
param.setNums(0);
}
// List<QuestionVo.PatientQuestionNum> patientQuestionNumList = questionDao.getQuestionByCodeAndPatientId(patientCode.getCode(),param.getId(),param.getNums());
List<QuestionVo.PatientQuestion> 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<QuestionVo.PatientQuestion> patientQuestionList = getPatientQuestionByCode(patientCode.getCode(),param.getId());
// reportCodeVo.setQuestionVos(questionVos);
// //查询子类型下的题目
// if(CollectionUtil.isNotEmpty(reportCodeVo.getSubReportCodes())){
// reportCodeVo.getSubReportCodes().forEach(subReportCode -> {
// List<QuestionVo.CodeQuestionVo> subCodeQuestionVos = getQuestionByCode(subReportCode.getCode());
// subReportCode.setQuestionVos(subCodeQuestionVos);
// });
// }
// });
// }
return patientCodeList;
}

7
tcm/src/main/resources/mapper_dao/PatientDao.xml

@ -156,7 +156,12 @@
</select>
<select id="countAnalysis" resultType="com.ccsens.tcm.bean.vo.StatisticVo$SelGroupList">
<if test="testQuestionsId!=null and testQuestionsId!=0">
select if(locate('其他',tpr.contents),'其他',tpr.contents) as content,count(*) as nums from t_patient_information tpi left join t_patient_record tpr on tpi.id=tpr.patient_id and tpr.rec_status=0
select
if(locate('其他',tpr.contents),
'其他',tpr.contents) as content,
count(*) as nums
from t_patient_information tpi
left join t_patient_record tpr on tpi.id=tpr.patient_id and tpr.rec_status=0
where tpi.rec_status=0
<if test="testQuestionsId!=null and testQuestionsId!=0">
and tpr.test_questions_id=#{testQuestionsId}

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

@ -99,15 +99,14 @@
and q.relevance_option_id = #{optionId}
</select>
<resultMap id="getQuestionByCodeAndPatientId" type="com.ccsens.tcm.bean.vo.QuestionVo$PatientQuestionNum">
<id column="collect_time" property="reportNums" />
<collection property="questionList" ofType="com.ccsens.tcm.bean.vo.QuestionVo$PatientQuestion">
<resultMap id="getQuestionByCodeAndPatientId" type="com.ccsens.tcm.bean.vo.QuestionVo$PatientQuestion">
<id column="qid" jdbcType="BIGINT" property="id" />
<result column="qquestion" jdbcType="VARCHAR" property="question" />
<result column="qsort" jdbcType="INTEGER" property="sort" />
<result column="qunits" jdbcType="VARCHAR" property="units" />
<result column="qtype" jdbcType="TINYINT" property="type" />
<result column="qremark" jdbcType="VARCHAR" property="remark" />
<result column="recordId" jdbcType="VARCHAR" property="recordId" />
<result column="answer" jdbcType="VARCHAR" property="answer" />
<collection property="optionVos" ofType="com.ccsens.tcm.bean.vo.QuestionVo$PatientOption">
<id column="oid" jdbcType="BIGINT" property="id" />
@ -117,7 +116,6 @@
<result column="oafter_operation" jdbcType="TINYINT" property="afterOperation" />
<result column="choose" jdbcType="TINYINT" property="choose" />
</collection>
</collection>
</resultMap>
@ -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 &gt; 2 and q.type &lt;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 @@
<result column="qunits" jdbcType="VARCHAR" property="units" />
<result column="qtype" jdbcType="TINYINT" property="type" />
<result column="qremark" jdbcType="VARCHAR" property="remark" />
<result column="recordId" jdbcType="VARCHAR" property="recordId" />
<result column="answer" jdbcType="VARCHAR" property="answer" />
<collection property="optionVos" ofType="com.ccsens.tcm.bean.vo.QuestionVo$PatientOption">
<id column="oid" jdbcType="BIGINT" property="id" />
@ -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 &gt; 2 and q.type &lt; 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}
</if>
WHERE
q.relevance_option_id = 0
and q.rec_status = 0
q.rec_status = 0
and q.relevance_option_id = #{optionId}
</select>

Loading…
Cancel
Save