|
@ -412,7 +412,7 @@ class Sessions extends RedisModel {
|
|
|
* @param size
|
|
|
* @param businessType
|
|
|
*/
|
|
|
getUserSessions(userId, page, size, businessType) {
|
|
|
getUserSessions(userId,name,search_type, page, size, businessType) {
|
|
|
let userSessionKey = RedisModel.makeRedisKey(REDIS_KEYS.UserSessions, userId);
|
|
|
let self = this;
|
|
|
if (page > 0) {
|
|
@ -658,6 +658,7 @@ class Sessions extends RedisModel {
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
participantsTimeJson["id"] = participantsTimeArray[j];
|
|
|
participantsTimeJson[participantsTimeArray[j]] = participantsTimeArray[j+1];
|
|
|
participantsTime.push(participantsTimeJson);
|
|
@ -713,29 +714,101 @@ class Sessions extends RedisModel {
|
|
|
let topicId = topic.id;
|
|
|
});
|
|
|
});
|
|
|
|
|
|
sessionList.push({
|
|
|
id: sessionId,
|
|
|
name: sessionName,
|
|
|
create_date: parseInt(session.create_date),
|
|
|
last_content_type: session.last_content_type||"",
|
|
|
last_content: session.last_content||"",
|
|
|
sender_id: session.last_sender_id||"",
|
|
|
last_message_time: session.last_message_time||"",
|
|
|
type: session.type,
|
|
|
sender_name: session.last_sender_name||"",
|
|
|
unread_count: count,
|
|
|
// business_type: session.business_type,
|
|
|
business_type: businessType,
|
|
|
my_role: role,
|
|
|
sender_sex: sex,
|
|
|
sender_birthday: bir,
|
|
|
participantsTimeArray:participantsTime,
|
|
|
status:session.status,
|
|
|
is_invite:isInvite,
|
|
|
backTopid:backTopid
|
|
|
});
|
|
|
|
|
|
var SearchExist=false;
|
|
|
if (search_type==1&&name){//医生
|
|
|
if (session.type!=2){
|
|
|
SearchExist = false;
|
|
|
}
|
|
|
else {
|
|
|
for (var tmpIndex in participantsTime){
|
|
|
var patientName = participantsTime[tmpIndex].name
|
|
|
var is_patient = participantsTime[tmpIndex].is_patient
|
|
|
if (is_patient=0&&(patientName+"").indexOf(name)!=-1){
|
|
|
SearchExist = true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if((sessionName+"").indexOf(name)!=-1){SearchExist = true;}
|
|
|
}
|
|
|
if (search_type==2&&name){//患者
|
|
|
if (session.type!=2){
|
|
|
SearchExist = false;
|
|
|
}
|
|
|
else{
|
|
|
for (var tmpIndex in participantsTime){
|
|
|
var patientName = participantsTime[tmpIndex].name
|
|
|
var is_patient = participantsTime[tmpIndex].is_patient
|
|
|
if (is_patient=1&&(patientName+"").indexOf(name)!=-1){
|
|
|
SearchExist = true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if((sessionName+"").indexOf(name)!=-1){SearchExist = true;}
|
|
|
}
|
|
|
if (search_type==3&&name){
|
|
|
if((sessionName+"").indexOf(name)!=-1){
|
|
|
sessionList.push({
|
|
|
id: sessionId,
|
|
|
name: sessionName,
|
|
|
create_date: new Date(session.last_message_time).getTime(),
|
|
|
last_content_type: session.last_content_type,
|
|
|
last_content: session.last_content,
|
|
|
sender_id: session.last_sender_id,
|
|
|
type: session.type,
|
|
|
sender_name: session.last_sender_name,
|
|
|
unread_count: count,
|
|
|
business_type: session.business_type,
|
|
|
my_role: role,
|
|
|
sender_sex: sex,
|
|
|
sender_birthday: bir,
|
|
|
participantsTimeArray:participantsTime,
|
|
|
status:session.status,
|
|
|
is_invite:isInvite
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
else if(name&&(search_type==1||search_type==2)){
|
|
|
if (SearchExist){
|
|
|
sessionList.push({
|
|
|
id: sessionId,
|
|
|
name: sessionName,
|
|
|
create_date: new Date(session.last_message_time).getTime(),
|
|
|
last_content_type: session.last_content_type,
|
|
|
last_content: session.last_content,
|
|
|
sender_id: session.last_sender_id,
|
|
|
type: session.type,
|
|
|
sender_name: session.last_sender_name,
|
|
|
unread_count: count,
|
|
|
business_type: session.business_type,
|
|
|
my_role: role,
|
|
|
sender_sex: sex,
|
|
|
sender_birthday: bir,
|
|
|
participantsTimeArray:participantsTime,
|
|
|
status:session.status,
|
|
|
is_invite:isInvite
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
else{
|
|
|
sessionList.push({
|
|
|
id: sessionId,
|
|
|
name: sessionName,
|
|
|
create_date: new Date(session.last_message_time).getTime(),
|
|
|
last_content_type: session.last_content_type,
|
|
|
last_content: session.last_content,
|
|
|
sender_id: session.last_sender_id,
|
|
|
type: session.type,
|
|
|
sender_name: session.last_sender_name,
|
|
|
unread_count: count,
|
|
|
business_type: session.business_type,
|
|
|
my_role: role,
|
|
|
sender_sex: sex,
|
|
|
sender_birthday: bir,
|
|
|
participantsTimeArray:participantsTime,
|
|
|
status:session.status,
|
|
|
is_invite:isInvite
|
|
|
});
|
|
|
}
|
|
|
index = (parseInt(index) + 1);
|
|
|
if (index == sessionIds.length) {
|
|
|
ModelUtil.emitOK(self.eventEmitter, sessionList);
|
|
@ -1032,7 +1105,7 @@ class Sessions extends RedisModel {
|
|
|
* @param size
|
|
|
* @param businessType
|
|
|
*/
|
|
|
getUserStatusSessions(userId,status,businessType,page, size) {
|
|
|
getUserStatusSessions(userId,status,businessType,name,search_type,page, size) {
|
|
|
let userSessionKey = RedisModel.makeRedisKey(REDIS_KEYS.UserSessions, userId);
|
|
|
log.info(userId);
|
|
|
let self = this;
|
|
@ -1144,26 +1217,102 @@ class Sessions extends RedisModel {
|
|
|
if (res.length != 0 && res[0].sex) {
|
|
|
sex = res[0].sex;
|
|
|
}
|
|
|
var SearchExist=false;
|
|
|
if (search_type==1&&name){//医生
|
|
|
if (session.type!=2){
|
|
|
SearchExist = false;
|
|
|
}
|
|
|
else{
|
|
|
for (var tmpIndex in participantsTime){
|
|
|
var patientName = participantsTime[tmpIndex].name
|
|
|
var is_patient = participantsTime[tmpIndex].is_patient
|
|
|
if (is_patient=0&&(patientName+"").indexOf(name)!=-1){
|
|
|
SearchExist = true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if((sessionName+"").indexOf(name)!=-1){SearchExist = true;}
|
|
|
}
|
|
|
if (search_type==2&&name){//患者
|
|
|
if (session.type!=2){
|
|
|
SearchExist = false;
|
|
|
}
|
|
|
else{
|
|
|
for (var tmpIndex in participantsTime){
|
|
|
var patientName = participantsTime[tmpIndex].name
|
|
|
var is_patient = participantsTime[tmpIndex].is_patient
|
|
|
if (is_patient=1&&(patientName+"").indexOf(name)!=-1){
|
|
|
SearchExist = true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if((sessionName+"").indexOf(name)!=-1){SearchExist = true;}
|
|
|
|
|
|
sessionList.push({
|
|
|
id: sessionId,
|
|
|
name: sessionName,
|
|
|
create_date: new Date(mysqlSession.last_message_time).getTime(),
|
|
|
last_content_type: session.last_content_type,
|
|
|
last_content: session.last_content,
|
|
|
sender_id: session.last_sender_id,
|
|
|
type: session.type,
|
|
|
sender_name: session.last_sender_name,
|
|
|
unread_count: count,
|
|
|
business_type: session.business_type,
|
|
|
my_role: role,
|
|
|
sender_sex: sex,
|
|
|
sender_birthday: bir,
|
|
|
participantsTimeArray:participantsTime,
|
|
|
status:session.status,
|
|
|
is_invite:isInvite
|
|
|
});
|
|
|
|
|
|
}
|
|
|
if (search_type==3&&name){
|
|
|
if((sessionName+"").indexOf(name)!=-1){
|
|
|
sessionList.push({
|
|
|
id: sessionId,
|
|
|
name: sessionName,
|
|
|
create_date: new Date(mysqlSession.last_message_time).getTime(),
|
|
|
last_content_type: session.last_content_type,
|
|
|
last_content: session.last_content,
|
|
|
sender_id: session.last_sender_id,
|
|
|
type: session.type,
|
|
|
sender_name: session.last_sender_name,
|
|
|
unread_count: count,
|
|
|
business_type: session.business_type,
|
|
|
my_role: role,
|
|
|
sender_sex: sex,
|
|
|
sender_birthday: bir,
|
|
|
participantsTimeArray:participantsTime,
|
|
|
status:session.status,
|
|
|
is_invite:isInvite
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
else if(name&&(search_type==1||search_type==2)){
|
|
|
if (SearchExist){
|
|
|
sessionList.push({
|
|
|
id: sessionId,
|
|
|
name: sessionName,
|
|
|
create_date: new Date(mysqlSession.last_message_time).getTime(),
|
|
|
last_content_type: session.last_content_type,
|
|
|
last_content: session.last_content,
|
|
|
sender_id: session.last_sender_id,
|
|
|
type: session.type,
|
|
|
sender_name: session.last_sender_name,
|
|
|
unread_count: count,
|
|
|
business_type: session.business_type,
|
|
|
my_role: role,
|
|
|
sender_sex: sex,
|
|
|
sender_birthday: bir,
|
|
|
participantsTimeArray:participantsTime,
|
|
|
status:session.status,
|
|
|
is_invite:isInvite
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
else{
|
|
|
sessionList.push({
|
|
|
id: sessionId,
|
|
|
name: sessionName,
|
|
|
create_date: new Date(mysqlSession.last_message_time).getTime(),
|
|
|
last_content_type: session.last_content_type,
|
|
|
last_content: session.last_content,
|
|
|
sender_id: session.last_sender_id,
|
|
|
type: session.type,
|
|
|
sender_name: session.last_sender_name,
|
|
|
unread_count: count,
|
|
|
business_type: session.business_type,
|
|
|
my_role: role,
|
|
|
sender_sex: sex,
|
|
|
sender_birthday: bir,
|
|
|
participantsTimeArray:participantsTime,
|
|
|
status:session.status,
|
|
|
is_invite:isInvite
|
|
|
});
|
|
|
}
|
|
|
index = (parseInt(index) + 1);
|
|
|
if (index == sessionIds.length) {
|
|
|
ModelUtil.emitOK(self.eventEmitter, sessionList);
|