|
|
|
@ -165,19 +165,53 @@ |
|
|
|
LEFT JOIN t_doctor d on d.user_id = tpi.user_id and d.rec_status = 0 |
|
|
|
WHERE |
|
|
|
tpi.rec_status =0 |
|
|
|
<if test="id != null and id!=0"> |
|
|
|
and tpi.id=#{id} |
|
|
|
<if test="param.id != null and param.id!=0"> |
|
|
|
and tpi.id=#{param.id} |
|
|
|
</if> |
|
|
|
<if test="id == null"> |
|
|
|
<if test="hospitalization!=null and hospitalization!='' "> |
|
|
|
and tpi.hospitalization=#{hospitalization} |
|
|
|
<if test="param.id == null"> |
|
|
|
<if test="param.hospitalization!=null and param.hospitalization!='' "> |
|
|
|
and tpi.hospitalization like concat('%', #{param.hospitalization}, '%') |
|
|
|
</if> |
|
|
|
<if test="inpatientId!=null and inpatientId!=0 "> |
|
|
|
and tpi.inpatient_id= #{inpatientId} |
|
|
|
<if test="param.code!=null and param.code!='' "> |
|
|
|
and tpi.code like concat('%',#{param.code}, '%') |
|
|
|
</if> |
|
|
|
<if test="inputStatus!=null and inputStatus!=0 "> |
|
|
|
and tpi.input_status= #{inputStatus} |
|
|
|
<if test="param.inpatientId!=null and param.inpatientId!=0 "> |
|
|
|
and tpi.inpatient_id= #{param.inpatientId} |
|
|
|
</if> |
|
|
|
<if test="param.inputStatus!=null and param.inputStatus!=0 "> |
|
|
|
and tpi.input_status= #{param.inputStatus} |
|
|
|
</if> |
|
|
|
<if test="param.doctorName!=null and param.doctorName!='' "> |
|
|
|
and d.name like concat('%',#{param.doctorName},'%') |
|
|
|
</if> |
|
|
|
<choose> |
|
|
|
<when test="param.queryAuthority == 0"> |
|
|
|
and tpi.user_id = #{userId} |
|
|
|
</when> |
|
|
|
<when test="param.queryAuthority == 1"> |
|
|
|
<if test="param.hospitalIds != null and param.hospitalIds.size() > 0"> |
|
|
|
<choose> |
|
|
|
<when test="param.hospitalIds.size() == 1"> |
|
|
|
and tpi.hospital_id=#{param.hospitalIds[0]} |
|
|
|
</when> |
|
|
|
<otherwise> |
|
|
|
and tpi.hospital_id in |
|
|
|
<foreach collection="param.hospitalIds" item="item" separator="," open="(" close=")"> |
|
|
|
#{item} |
|
|
|
</foreach> |
|
|
|
</otherwise> |
|
|
|
</choose> |
|
|
|
|
|
|
|
</if> |
|
|
|
</when> |
|
|
|
<when test="param.queryAuthority == 2"> |
|
|
|
|
|
|
|
</when> |
|
|
|
<otherwise> |
|
|
|
and tpi.user_id = #{userId} |
|
|
|
</otherwise> |
|
|
|
</choose> |
|
|
|
|
|
|
|
</if> |
|
|
|
order by tpi.update_at desc |
|
|
|
</select> |
|
|
|
@ -399,7 +433,7 @@ |
|
|
|
t.user_id |
|
|
|
</select> |
|
|
|
<select id="selBiologicalSamples" resultType="com.ccsens.tcm.bean.vo.BiologicalSamplesVo$selBiolog"> |
|
|
|
select th.name,tbs.sample_type as sampleType, tpi.hospitalization, tpi.code as patientCode, tbs.code, tbs.collect_time as collectTime, |
|
|
|
select th.name,tbs.sample_type as sampleType, tpi.hospitalization, tpi.code as patientCode, tbs.collect_time as collectTime, |
|
|
|
tbs.update_at as updateAt, |
|
|
|
tbs.user_id as userId, |
|
|
|
d.`name` as doctorName |
|
|
|
@ -417,6 +451,9 @@ |
|
|
|
<if test="hospitalization!=null and hospitalization!=''"> |
|
|
|
and tpi.hospitalization like concat('%',#{hospitalization},'%') |
|
|
|
</if> |
|
|
|
<if test="code!=null and code!=''"> |
|
|
|
and tpi.code like concat('%',#{code},'%') |
|
|
|
</if> |
|
|
|
<if test="collectTime!=null"> |
|
|
|
and tbs.collect_time=#{collectTime} |
|
|
|
</if> |
|
|
|
@ -434,28 +471,28 @@ |
|
|
|
tpr.id, |
|
|
|
( |
|
|
|
CASE |
|
|
|
WHEN ( DATEDIFF( now( ), tpr.contents ) >= 11 AND DATEDIFF( now( ), tpr.contents ) <= 17 ) THEN |
|
|
|
WHEN ( DATEDIFF( now( ), tpr.contents ) >= 9 AND DATEDIFF( now( ), tpr.contents ) <= 19 ) THEN |
|
|
|
DATE_FORMAT( FROM_UNIXTIME( UNIX_TIMESTAMP( tpr.contents ) + 14 * 24 * 60 * 60 ), '%Y-%m-%d' ) |
|
|
|
WHEN ( DATEDIFF( now( ), tpr.contents ) >= 87 AND DATEDIFF( now( ), tpr.contents ) <= 93 ) THEN |
|
|
|
WHEN ( DATEDIFF( now( ), tpr.contents ) >= 85 AND DATEDIFF( now( ), tpr.contents ) <= 95 ) THEN |
|
|
|
DATE_FORMAT( FROM_UNIXTIME( UNIX_TIMESTAMP( tpr.contents ) + 90 * 24 * 60 * 60 ), '%Y-%m-%d' ) |
|
|
|
WHEN ( DATEDIFF( now( ), tpr.contents ) >= 177 AND DATEDIFF( now( ), tpr.contents ) <= 183 ) THEN |
|
|
|
WHEN ( DATEDIFF( now( ), tpr.contents ) >= 175 AND DATEDIFF( now( ), tpr.contents ) <= 185 ) THEN |
|
|
|
DATE_FORMAT( FROM_UNIXTIME( UNIX_TIMESTAMP( tpr.contents ) + 180 * 24 * 60 * 60 ), '%Y-%m-%d' ) |
|
|
|
WHEN ( DATEDIFF( now( ), tpr.contents ) >= 362 AND DATEDIFF( now( ), tpr.contents ) <= 368 ) THEN |
|
|
|
WHEN ( DATEDIFF( now( ), tpr.contents ) >= 360 AND DATEDIFF( now( ), tpr.contents ) <= 370 ) THEN |
|
|
|
DATE_FORMAT( FROM_UNIXTIME( UNIX_TIMESTAMP( tpr.contents ) + 365 * 24 * 60 * 60 ), '%Y-%m-%d' ) |
|
|
|
WHEN ( DATEDIFF( now( ), tpr.contents ) >= 0 AND DATEDIFF( now( ), tpr.contents ) <= 3 ) THEN |
|
|
|
WHEN ( DATEDIFF( now( ), tpr.contents ) >= 0 AND DATEDIFF( now( ), tpr.contents ) <= 5 ) THEN |
|
|
|
DATE_FORMAT( FROM_UNIXTIME( UNIX_TIMESTAMP( tpr.contents ) + 1 * 24 * 60 * 60 ), '%Y-%m-%d' ) |
|
|
|
END |
|
|
|
) as shijian,tpi.hospitalization,( |
|
|
|
) as shijian,tpi.hospitalization, tpi.code, ( |
|
|
|
CASE |
|
|
|
WHEN ( DATEDIFF( now( ), tpr.contents ) >= 11 AND DATEDIFF( now( ), tpr.contents ) <= 17 ) THEN |
|
|
|
WHEN ( DATEDIFF( now( ), tpr.contents ) >= 9 AND DATEDIFF( now( ), tpr.contents ) <= 19 ) THEN |
|
|
|
'14天数据搜集' |
|
|
|
WHEN ( DATEDIFF( now( ), tpr.contents ) >= 87 AND DATEDIFF( now( ), tpr.contents ) <= 93 ) THEN |
|
|
|
WHEN ( DATEDIFF( now( ), tpr.contents ) >= 85 AND DATEDIFF( now( ), tpr.contents ) <= 95 ) THEN |
|
|
|
'90天数据搜集' |
|
|
|
WHEN ( DATEDIFF( now( ), tpr.contents ) >= 177 AND DATEDIFF( now( ), tpr.contents ) <= 183 ) THEN |
|
|
|
WHEN ( DATEDIFF( now( ), tpr.contents ) >= 175 AND DATEDIFF( now( ), tpr.contents ) <= 185 ) THEN |
|
|
|
'180天随访' |
|
|
|
WHEN ( DATEDIFF( now( ), tpr.contents ) >= 362 AND DATEDIFF( now( ), tpr.contents ) <= 368 ) THEN |
|
|
|
WHEN ( DATEDIFF( now( ), tpr.contents ) >= 360 AND DATEDIFF( now( ), tpr.contents ) <= 370 ) THEN |
|
|
|
'360天随访' |
|
|
|
WHEN ( DATEDIFF( now( ), tpr.contents ) >= 0 AND DATEDIFF( now( ), tpr.contents ) <= 3 ) THEN |
|
|
|
WHEN ( DATEDIFF( now( ), tpr.contents ) >= 0 AND DATEDIFF( now( ), tpr.contents ) <= 5 ) THEN |
|
|
|
'第一次数据收集' |
|
|
|
END |
|
|
|
) as task from t_patient_record tpr |
|
|
|
@ -463,17 +500,18 @@ |
|
|
|
where tpr.rec_status=0 |
|
|
|
and tpr.test_questions_id=#{param.testQuestionsId} |
|
|
|
and ( |
|
|
|
( DATEDIFF( now( ), tpr.contents ) >= 11 AND DATEDIFF( now( ), tpr.contents ) <= 17 ) |
|
|
|
OR ( DATEDIFF( now( ), tpr.contents ) >= 87 AND DATEDIFF( now( ), tpr.contents ) <= 93 ) |
|
|
|
OR ( DATEDIFF( now( ), tpr.contents ) >= 177 AND DATEDIFF( now( ), tpr.contents ) <= 183 ) |
|
|
|
OR ( DATEDIFF( now( ), tpr.contents ) >= 362 AND DATEDIFF( now( ), tpr.contents ) <= 368 ) |
|
|
|
OR ( DATEDIFF( now( ), tpr.contents ) >= 0 AND DATEDIFF( now( ), tpr.contents ) <= 3 ) |
|
|
|
( DATEDIFF( now( ), tpr.contents ) >= 9 AND DATEDIFF( now( ), tpr.contents ) <= 19 ) |
|
|
|
OR ( DATEDIFF( now( ), tpr.contents ) >= 85 AND DATEDIFF( now( ), tpr.contents ) <= 95 ) |
|
|
|
OR ( DATEDIFF( now( ), tpr.contents ) >= 175 AND DATEDIFF( now( ), tpr.contents ) <= 185 ) |
|
|
|
OR ( DATEDIFF( now( ), tpr.contents ) >= 360 AND DATEDIFF( now( ), tpr.contents ) <= 370 ) |
|
|
|
OR ( DATEDIFF( now( ), tpr.contents ) >= 0 AND DATEDIFF( now( ), tpr.contents ) <= 5 ) |
|
|
|
) |
|
|
|
and tpr.user_id=#{userId} |
|
|
|
</select> |
|
|
|
<resultMap id="selPatientProgress1" type="com.ccsens.tcm.bean.vo.StatisticVo$PatientProgressVo"> |
|
|
|
<id property="id" column="id" /> |
|
|
|
<result property="hospitalization" column="hospitalization" /> |
|
|
|
<result property="code" column="code" /> |
|
|
|
<collection property="collectTime" ofType="java.lang.Integer"> |
|
|
|
<result column="collectTime"/> |
|
|
|
</collection> |
|
|
|
@ -482,6 +520,7 @@ |
|
|
|
SELECT |
|
|
|
tpi.id, |
|
|
|
tpi.hospitalization, |
|
|
|
tpi.code, |
|
|
|
tpr.collect_time collectTime |
|
|
|
FROM |
|
|
|
t_patient_record tpr |
|
|
|
@ -522,4 +561,21 @@ |
|
|
|
GROUP BY |
|
|
|
tbs.sample_type |
|
|
|
</select> |
|
|
|
<select id="queryByPatient" resultType="com.ccsens.tcm.bean.vo.BiologicalSamplesVo$selBiolog"> |
|
|
|
select th.name,tbs.sample_type as sampleType, tpi.hospitalization, tpi.code as patientCode, tbs.collect_time as collectTime, |
|
|
|
tbs.update_at as updateAt, |
|
|
|
tbs.user_id as userId, |
|
|
|
d.`name` as doctorName |
|
|
|
from t_biological_samples tbs, t_patient_information tpi, t_hospital th, t_doctor d |
|
|
|
where |
|
|
|
tpi.id=tbs.patient_information_id |
|
|
|
and th.id=tpi.hospital_id |
|
|
|
and d.user_id = tbs.user_id |
|
|
|
and tbs.patient_information_id = #{param.patientId} |
|
|
|
and tbs.rec_status=0 |
|
|
|
and tpi.rec_status=0 |
|
|
|
and th.rec_status=0 |
|
|
|
and d.rec_status = 0 |
|
|
|
order by tbs.update_at desc |
|
|
|
</select> |
|
|
|
</mapper> |