|
|
@@ -36,7 +36,7 @@
|
|
|
r.patient_name_ps as patient_name_ps,
|
|
|
r.patient_name as patient_name,
|
|
|
r.patient_sex as patient_sex,
|
|
|
- r.manage_type as manage_type,
|
|
|
+ c.manage_type as manage_type,
|
|
|
r.`status` as status,
|
|
|
r.last_msg_time as last_msg_time,
|
|
|
r.sponsor_type as sponsor_type,
|
|
|
@@ -63,9 +63,6 @@
|
|
|
<if test="query.patientInfo != null">
|
|
|
and (patient_code like concat('%',#{query.patientInfo},'%') or patient_name like concat('%',#{query.patientInfo},'%') )
|
|
|
</if>
|
|
|
- <if test="query.manageType != null">
|
|
|
- and manage_type=#{query.manageType}
|
|
|
- </if>
|
|
|
<if test="query.patientId != null">
|
|
|
and patient_id=#{query.patientId}
|
|
|
</if>
|
|
|
@@ -80,6 +77,8 @@
|
|
|
</if>
|
|
|
</where>
|
|
|
) as r
|
|
|
+ join bus_patient as p on r.patient_id=p.id
|
|
|
+ join bus_clinic as c on p.clinic_id=c.id
|
|
|
left join (select * from im_msg) as rm
|
|
|
on rm.id=r.last_msg_id
|
|
|
<if test="query.assistId != null">
|
|
|
@@ -93,6 +92,9 @@
|
|
|
and (r.success_time > #{query.successTime}
|
|
|
or r.create_time > #{query.successTime})
|
|
|
</if>
|
|
|
+ <if test="query.manageType != null">
|
|
|
+ and c.manage_type=#{query.manageType}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
order by last_msg_time desc
|
|
|
</select>
|
|
|
@@ -115,26 +117,26 @@
|
|
|
|
|
|
<select id="queryDoctorRecentList" resultMap="imRoomResult">
|
|
|
select
|
|
|
- r.id as id,
|
|
|
- r.patient_code as patient_code,
|
|
|
- r.patient_age as patient_age,
|
|
|
- r.patient_name_ps as patient_name_ps,
|
|
|
- r.patient_name as patient_name,
|
|
|
- r.patient_sex as patient_sex,
|
|
|
- r.manage_type as manage_type,
|
|
|
- r.`status` as status,
|
|
|
- r.last_msg_time as last_msg_time,
|
|
|
- r.sponsor_type as sponsor_type,
|
|
|
- r.total_count as total_count,
|
|
|
- r.create_time as create_time,
|
|
|
- r.update_time as update_time,
|
|
|
- r.doctor_avatar as doctor_avatar,
|
|
|
- r.assist_avatar as assist_avatar,
|
|
|
- r.assist_id as assist_id,
|
|
|
- r.patient_id as patient_id,
|
|
|
- rm.payload as payload,
|
|
|
- rm.msg_type as msg_type,
|
|
|
- rm.operation_type as operation_type
|
|
|
+ r.id as id,
|
|
|
+ r.patient_code as patient_code,
|
|
|
+ r.patient_age as patient_age,
|
|
|
+ r.patient_name_ps as patient_name_ps,
|
|
|
+ r.patient_name as patient_name,
|
|
|
+ r.patient_sex as patient_sex,
|
|
|
+ r.manage_type as manage_type,
|
|
|
+ r.`status` as status,
|
|
|
+ r.last_msg_time as last_msg_time,
|
|
|
+ r.sponsor_type as sponsor_type,
|
|
|
+ r.total_count as total_count,
|
|
|
+ r.create_time as create_time,
|
|
|
+ r.update_time as update_time,
|
|
|
+ r.doctor_avatar as doctor_avatar,
|
|
|
+ r.assist_avatar as assist_avatar,
|
|
|
+ r.assist_id as assist_id,
|
|
|
+ r.patient_id as patient_id,
|
|
|
+ rm.payload as payload,
|
|
|
+ rm.msg_type as msg_type,
|
|
|
+ rm.operation_type as operation_type
|
|
|
from
|
|
|
(select * from im_room
|
|
|
<where>
|
|
|
@@ -152,9 +154,9 @@
|
|
|
</if>
|
|
|
</where>
|
|
|
) as r
|
|
|
- join (select MAX(id) as id,doctor_id,patient_id,assist_id from im_room group by doctor_id,patient_id,assist_id) as ir2 on r.id=ir2.id
|
|
|
- left join (select * from im_msg) as rm
|
|
|
- on rm.id=r.last_msg_id
|
|
|
+ join (select MAX(id) as id,doctor_id,patient_id,assist_id from im_room group by doctor_id,patient_id,assist_id) as ir2 on r.id=ir2.id
|
|
|
+ left join (select * from im_msg) as rm
|
|
|
+ on rm.id=r.last_msg_id
|
|
|
<where>
|
|
|
<if test="query.successTime != null">
|
|
|
and (r.success_time > #{query.successTime}
|