|
@ -10,6 +10,7 @@ const DB_TABLES = require('../../include/commons').DB_TABLES;
|
|
|
const PARTICIPANT_ROLES = require('../../include/commons').PARTICIPANT_ROLES;
|
|
|
const SESSION_STATUS = require('../../include/commons').SESSION_STATUS;
|
|
|
const SESSION_BUSINESS_TYPE = require('../../include/commons').SESSION_BUSINESS_TYPE;
|
|
|
const SESSION_TYPES = require('../../include/commons').SESSION_TYPES;
|
|
|
class SessionRepo {
|
|
|
constructor() {
|
|
|
}
|
|
@ -166,7 +167,7 @@ class SessionRepo {
|
|
|
* @param type
|
|
|
* @param handler
|
|
|
*/
|
|
|
static findListByType(userId, type,page,pagesize, status,name,handler) {
|
|
|
static findListByType(userId, type,page,pagesize, status,name,searchType,handler) {
|
|
|
log.info("type="+type);
|
|
|
if (page > 0) {
|
|
|
if (page == 1) {
|
|
@ -181,10 +182,21 @@ class SessionRepo {
|
|
|
* userId 为传值时:管理员调度大屏获取im消息
|
|
|
*/
|
|
|
if (userId != null && userId != "") {
|
|
|
sql = "select session_id from " + DB_TABLES.Participants + " w where w.participant_id in(?) group by w.session_id";
|
|
|
sql = "select session_id from " + DB_TABLES.Participants + " w where w.participant_id in(?)";
|
|
|
if (searchType!= null&&type==SESSION_TYPES.P2P){
|
|
|
if (1==searchType){
|
|
|
sql += "and EXISTS( select p.id from participants ww INNER JOIN doctors p on p.id = ww.participant_id " +
|
|
|
" where ww.session_id = w.session_id and p.id<>'"+userId+"' )"
|
|
|
}if (2==searchType){
|
|
|
sql += " and EXISTS( select p.id from participants ww INNER JOIN patients p on p.id = ww.participant_id " +
|
|
|
" where ww.session_id = w.session_id and p.id<>'"+userId+"' ) ";
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
sql = "select session_id from " + DB_TABLES.Participants + " w group by w.session_id"
|
|
|
sql = "select session_id from " + DB_TABLES.Participants + " w "
|
|
|
}
|
|
|
|
|
|
sql +=" group by w.session_id ";
|
|
|
let sessionSQL = "select id, name, type, create_date, last_sender_id, last_sender_name, last_content_type, last_content, last_message_time from "
|
|
|
+ DB_TABLES.Sessions + " s where s.id in(" + sql + ") and s.type in("+type+") ";
|
|
|
|