|
@ -61,13 +61,14 @@ exports.findAllGroupsWithPatient = function (userId, handler) {
|
|
|
" SELECT g.code code, g.name name, g.type type FROM wlyy.wlyy_talk_group g, wlyy.wlyy_talk_group_member m " +
|
|
|
" WHERE g.code = m.group_code and m.member_code = ?) g, wlyy.wlyy_patient p , " +
|
|
|
" ( SELECT new_msg_count, from_gid FROM msg_statistic WHERE uid =? GROUP BY from_gid ORDER BY `timestamp` DESC ) msgcount " +
|
|
|
" WHERE (ms.uid = ? and ms.from_uid = p.code) " +
|
|
|
" WHERE ((ms.uid = ? and ms.from_uid = p.code)) " +
|
|
|
" and ms.from_gid = g.code and ms.msg_type = 2 AND ms.last_content_type in (1,2,3,5,6) AND msgcount.from_gid=ms.from_gid " +
|
|
|
" UNION " +
|
|
|
" SELECT m.group_code code, m.group_name name, ms.last_content_type, ms.last_content, ms.timestamp, ms.new_msg_count, '2' group_type " +
|
|
|
" FROM wlyy.wlyy_talk_group g, wlyy.wlyy_talk_group_member m, wlyy.wlyy_doctor d, msg_statistic ms, " +
|
|
|
" ( SELECT new_msg_count, from_gid FROM msg_statistic WHERE uid =? GROUP BY from_gid ORDER BY `timestamp` DESC ) msgcount " +
|
|
|
" WHERE d.code = ? AND d.code = m.member_code AND msgcount.from_gid=ms.from_gid AND m.group_code = g.code AND g.type=1 AND g.code = ms.from_gid group by m.group_code, m.group_name" +
|
|
|
" WHERE d.code = ? AND d.code = m.member_code AND msgcount.from_gid=ms.from_gid " +
|
|
|
" AND m.group_code = g.code AND g.type=1 AND g.code = ms.from_gid group by m.group_code, m.group_name" +
|
|
|
") X ORDER BY timestamp DESC";
|
|
|
|
|
|
imRepo.execQuery({
|