85 lines
3.8 KiB
XML
85 lines
3.8 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<!DOCTYPE mapper
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.xinelu.mobile.mapper.homepage.HomePageMapper">
|
|
|
|
<select id="selectManageRouteNode" resultType="com.xinelu.mobile.vo.myfollowup.MyFollowUpVO">
|
|
select
|
|
pi.id patientId,
|
|
pi.patient_name,
|
|
spmr.id manageRouteId,
|
|
spmr.route_name manageRouteName,
|
|
spmrn.id manageRouteNodeId,
|
|
spmrn.route_node_name manageRouteNodeName,
|
|
spmrn.task_type,
|
|
spmrn.route_node_name,
|
|
IFNULL( spmrn.route_node_day,0) routeNodeDay,
|
|
pi.discharge_time,
|
|
pter.id patientTaskExecuteRecordId,
|
|
IF(pter.id is NULL,0,1) sign,
|
|
CASE
|
|
WHEN spmrn.task_type = 'PHONE_OUTBOUND' THEN spmrn.phone_id
|
|
WHEN spmrn.task_type = 'QUESTIONNAIRE_SCALE' THEN spmrn.question_info_id
|
|
WHEN spmrn.task_type = 'ARTIFICIAL_FOLLOW_UP' THEN spmrn.follow_template_id
|
|
END AS templateId
|
|
FROM patient_info pi
|
|
LEFT JOIN sign_patient_manage_route spmr ON spmr.patient_id = pi.id
|
|
LEFT JOIN sign_patient_manage_route_node spmrn ON spmrn.manage_route_id = spmr.id
|
|
LEFT JOIN patient_task_execute_record pter ON pter.manage_route_node_id = spmrn.id
|
|
<where>
|
|
spmrn.task_type in('PHONE_OUTBOUND','QUESTIONNAIRE_SCALE','ARTIFICIAL_FOLLOW_UP')
|
|
<if test="residentId != null ">
|
|
and pi.resident_id = #{residentId}
|
|
</if>
|
|
<if test="routeNodeName != null and routeNodeName != ''">
|
|
and spmrn.route_node_name = #{routeNodeName}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectTaskExecuteRecordByResidentId"
|
|
resultType="com.xinelu.manage.domain.patienttaskexecuterecord.PatientTaskExecuteRecord">
|
|
select
|
|
CASE
|
|
WHEN spmrn.task_type = 'PHONE_OUTBOUND' THEN spmrn.phone_template_name
|
|
WHEN spmrn.task_type = 'QUESTIONNAIRE_SCALE' THEN spmrn.questionnaire_name
|
|
WHEN spmrn.task_type = 'PROPAGANDA_ARTICLE' THEN spmrn.propaganda_title
|
|
WHEN spmrn.task_type = 'TEXT_REMIND' THEN '文字提醒'
|
|
WHEN spmrn.task_type = 'ARTIFICIAL_FOLLOW_UP' THEN spmrn.follow_template_name
|
|
END AS manageRouteNodeName,
|
|
pter.execute_time
|
|
from resident_info ri
|
|
LEFT JOIN patient_info pi ON ri.id = pi.resident_id
|
|
LEFT JOIN patient_task_execute_record pter ON pter.patient_id = pi.id
|
|
LEFT JOIN sign_patient_manage_route_node spmrn ON spmrn.id = pter.manage_route_node_id
|
|
<where>
|
|
ri.del_flag = 0 AND pi.del_flag = 0
|
|
<if test="residentId != null ">
|
|
and pi.resident_id = #{residentId}
|
|
</if>
|
|
<if test="nodeExecuteStatus != null and nodeExecuteStatus != ''">
|
|
and spmrn.node_execute_status = #{nodeExecuteStatus}
|
|
</if>
|
|
</where>
|
|
ORDER BY pter.execute_time desc
|
|
</select>
|
|
|
|
<select id="satisfactionQuestionnaireByResidentId"
|
|
resultType="com.xinelu.mobile.vo.satisfactionquestionnaire.SatisfactionQuestionnaire">
|
|
SELECT qi.id templateId,
|
|
qi.questionnaire_name,
|
|
qi.create_time,
|
|
(SELECT id
|
|
FROM patient_question_submit_result
|
|
WHERE resident_id = #{residentId}
|
|
AND question_info_id = qi.id) patientQuestionSubmitResultId,
|
|
(SELECT create_time
|
|
FROM patient_question_submit_result
|
|
WHERE id = patientQuestionSubmitResultId) executeTime
|
|
FROM question_info qi
|
|
WHERE qi.question_type = #{questionType}
|
|
AND qi.questionnaire_status = #{questionnaireStatus}
|
|
ORDER BY qi.create_time DESC
|
|
</select>
|
|
</mapper> |