Browse Source

按医院查询 未测试

recovery
zhizhi wu 4 years ago
parent
commit
d08f0a5fee
  1. 2
      tcm/src/main/java/com/ccsens/tcm/bean/dto/QuestionDto.java
  2. 2
      tcm/src/main/java/com/ccsens/tcm/bean/vo/QuestionVo.java
  3. 3
      tcm/src/main/java/com/ccsens/tcm/persist/dao/QuestionDao.java
  4. 5
      tcm/src/main/java/com/ccsens/tcm/service/QuestionService.java
  5. 19
      tcm/src/main/resources/mapper_dao/QuestionDao.xml
  6. 31
      tcm/src/main/resources/mapper_dao/ReportCodeDao.xml

2
tcm/src/main/java/com/ccsens/tcm/bean/dto/QuestionDto.java

@ -20,6 +20,6 @@ public class QuestionDto {
@ApiModelProperty("试题code")
private String code;
@ApiModelProperty("第几次录入信息,默认为0查询第一次")
private Integer nums;
private Integer nums = 0;
}
}

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

@ -146,6 +146,8 @@ public class QuestionVo {
private String units;
@ApiModelProperty("类型 1单行文本,2多行文本,3单选,4多选,5下拉菜单,6日期,7图片(文件),8单选+其他,9多选+其他,10下拉+其他,11多选+其他+说明,12单选+关联其他内容 13数字类型")
private byte type;
@ApiModelProperty("填写状态 0:非必填 1:必填")
private byte fillType;
@ApiModelProperty("参考范围 下限")
private BigDecimal referenceLower;
@ApiModelProperty("参考范围 上限")

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

@ -39,9 +39,10 @@ public interface QuestionDao extends QuestionMapper {
* @param code 试题code
* @param patientId 患者id
* @param nums 采集次数
* @param hospitalId 医院ID
* @return 返回所有试题和答题记录
*/
List<QuestionVo.PatientQuestion> 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, @Param("hospitalId") Long hospitalId);
/**
* 通过选项id和采集次数查询选项关联试题信息和患者答题记录
* @param optionId 试题code

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

@ -3,7 +3,6 @@ package com.ccsens.tcm.service;
import cn.hutool.core.collection.CollectionUtil;
import com.ccsens.tcm.bean.dto.QuestionDto;
import com.ccsens.tcm.bean.po.PatientInformation;
import com.ccsens.tcm.bean.po.QuestionOption;
import com.ccsens.tcm.bean.vo.QuestionVo;
import com.ccsens.tcm.persist.dao.QuestionDao;
import com.ccsens.tcm.persist.dao.ReportCodeDao;
@ -50,7 +49,7 @@ public class QuestionService implements IQuestionService{
// param.setNums(0);
// }
//根据一级code查询试题及答案
List<QuestionVo.PatientQuestion> patientQuestionNumList = questionDao.getQuestionByCodeAndPatientId(patientCode.getCode(),param.getId(),param.getNums());
List<QuestionVo.PatientQuestion> patientQuestionNumList = questionDao.getQuestionByCodeAndPatientId(patientCode.getCode(),param.getId(),param.getNums(), patient.getHospitalId());
//查询选项关联的试题及答案
if(CollectionUtil.isNotEmpty(patientQuestionNumList)){
patientQuestionNumList.forEach(question -> {
@ -66,7 +65,7 @@ public class QuestionService implements IQuestionService{
if(CollectionUtil.isNotEmpty(patientCode.getSubReportCodes())){
patientCode.getSubReportCodes().forEach(subReportCode -> {
//查询二级code下的试题和答案
List<QuestionVo.PatientQuestion> subpatientQuestionNumList = questionDao.getQuestionByCodeAndPatientId(subReportCode.getCode(),param.getId(),param.getNums());
List<QuestionVo.PatientQuestion> subpatientQuestionNumList = questionDao.getQuestionByCodeAndPatientId(subReportCode.getCode(),param.getId(),param.getNums(), patient.getHospitalId());
//查询选项关联的试题及答案
if(CollectionUtil.isNotEmpty(subpatientQuestionNumList)){
subpatientQuestionNumList.forEach(question -> {

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

@ -113,6 +113,7 @@
<result column="qtype" jdbcType="TINYINT" property="type" />
<result column="referenceLower" jdbcType="DECIMAL" property="referenceLower" />
<result column="referenceUpper" jdbcType="DECIMAL" property="referenceUpper" />
<result column="fillType" jdbcType="TINYINT" property="fillType" />
<result column="qremark" jdbcType="VARCHAR" property="remark" />
<result column="recordId" jdbcType="VARCHAR" property="recordId" />
<result column="answer" jdbcType="VARCHAR" property="answer" />
@ -143,6 +144,7 @@
q.type as qtype,
q.reference_lower as referenceLower,
q.reference_upper as referenceUpper,
q.fillType,
q.remark as qremark,
o.id as oid,
o.sort as osort,
@ -163,17 +165,22 @@
) as otherInformation
FROM
t_question q
(
select q.*, h.fill_type as fillType
from t_question q, t_question_hospital h
WHERE
q.id = h.question_id
q.`code` = #{code}
h.hospital_id = #{hospitalId}
and q.relevance_option_id = 0
and q.rec_status = 0
and h.rec_status = 0
) q
LEFT JOIN t_question_option o on q.id = o.question_id and o.rec_status = 0
LEFT JOIN t_patient_record r on r.test_questions_id = q.id and r.rec_status = 0 and r.patient_id = #{patientId}
<if test="nums != null">
and collect_time = #{nums}
</if>
WHERE
q.relevance_option_id = 0
and q.rec_status = 0
and q.`code` = #{code}
) qq left join (
SELECT
test_questions_id,

31
tcm/src/main/resources/mapper_dao/ReportCodeDao.xml

@ -128,22 +128,31 @@
c2.report_type as sReportType,
c2.record_type as sRecordType
FROM
t_report_code c1
(
select c.* from t_report_code c, t_question_record_time t
WHERE
c.code = t.code
and c.`level` = 1
<if test="code != null and code != ''">
and (c.`code` = #{code})
</if>
and t.rec_status = 0
and c.rec_status = 0
) c1
LEFT JOIN (
SELECT
*
c.*
FROM
t_report_code
t_report_code c,
t_question_record_time t
WHERE
`level` = 2
and rec_status = 0
c.code = t.code
and t.recode_time = #{nums}
and c.`level` = 2
and crec_status = 0
and t.rec_status = 0
) c2 on c1.`code` = c2.parent_code
WHERE
c1.`level` = 1
and c1.rec_status = 0
<if test="code != null and code != ''">
and (c1.`code` = #{code})
</if>
<if test="code==null or code==''">
<if test="nums == 0">
and (c1.`report_type`in (0,1))

Loading…
Cancel
Save