|
|
@@ -92,14 +92,10 @@
|
|
|
order by last_msg_time desc
|
|
|
</select>
|
|
|
|
|
|
- <select id="queryPageMsgBlurry" resultMap="imRoomResult">
|
|
|
--- todo
|
|
|
- </select>
|
|
|
-
|
|
|
|
|
|
<select id="maxSort" resultType="java.lang.Long">
|
|
|
- SELECT
|
|
|
- MAX( sort )
|
|
|
+ SELECT
|
|
|
+ MAX( sort )
|
|
|
FROM
|
|
|
im_msg
|
|
|
GROUP BY
|
|
|
@@ -107,4 +103,35 @@
|
|
|
HAVING
|
|
|
room_id = #{roomId};
|
|
|
</select>
|
|
|
+
|
|
|
+ <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
|
|
|
+ from
|
|
|
+ im_room 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
|
|
|
+ where r.doctor_id=#{doctorId}
|
|
|
+ order by doctor_top desc , case when (status =1) then 0 else 1 end desc ,create_time desc
|
|
|
+ </select>
|
|
|
</mapper>
|