|
@ -214,17 +214,14 @@ class SessionRepo {
|
|
|
if(sessionType){
|
|
|
sessionSQL = "select s.* from " + DB_TABLES.Sessions + " s, " + DB_TABLES.Participants + " p " +
|
|
|
" where s.type='"+sessionType+"' and ((s.id in(" + sql + ") and s.business_type = ? and s.status = 1) or (s.id in(" + sql1 + ") and s.business_type = ? and s.status = 0)) " +
|
|
|
" and s.id = p.session_id and p.participant_id = ? ORDER BY s.last_message_time desc limit "+page+","+pagesize;
|
|
|
" and s.id = p.session_id and p.participant_id = ? "+patientNameSql+" ORDER BY s.last_message_time desc limit "+page+","+pagesize;
|
|
|
}else {
|
|
|
sessionSQL = "select s.* from " + DB_TABLES.Sessions + " s, " + DB_TABLES.Participants + " p " +
|
|
|
" where ((s.id in(" + sql + ") and s.business_type = ? and s.status = 1) or (s.id in(" + sql1 + ") and s.business_type = ? and s.status = 0)) " +
|
|
|
" and s.id = p.session_id and p.participant_id = ? ORDER BY s.last_message_time desc limit "+page+","+pagesize;
|
|
|
" and s.id = p.session_id and p.participant_id = ? "+patientNameSql+" ORDER BY s.last_message_time desc limit "+page+","+pagesize;
|
|
|
}
|
|
|
|
|
|
sessionSQL = "select s.* from " + DB_TABLES.Sessions + " s, " + DB_TABLES.Participants + " p " +
|
|
|
" where ((s.id in(" + sql + ") and s.business_type = ? and s.status = 1) or (s.id in(" + sql1 + ") and s.business_type = ? and s.status = 0)) " +
|
|
|
// " and s.id = p.session_id and p.participant_id = ? ORDER BY (p.last_fetch_time - s.last_message_time+1)>0,s.create_date desc limit "+page+","+pagesize;
|
|
|
" and s.id = p.session_id and p.participant_id = ? "+patientNameSql+" ORDER BY s.last_message_time desc limit "+page+","+pagesize;
|
|
|
console.log("sql -------------"+sessionSQL);
|
|
|
log.info("1."+sessionSQL);
|
|
|
ImDb.execQuery({
|
|
|
"sql": sessionSQL,
|