|
@ -314,7 +314,7 @@ class Doctor extends BaseModel {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
let chats = {patients: {p2p:[],group:[]}, doctors: {p2p:[],group:[]},system:{system:[],appo:[]}};
|
|
|
let chats = {patients: {p2p:[],group:[]}, doctors: {p2p:[],group:[]},system:{sysInfo:[],appo:[]}};
|
|
|
for (let i = 0; i < patients.length; i++) {
|
|
|
let patient = patients[i];
|
|
|
chats.patients.p2p.push({
|
|
@ -379,7 +379,7 @@ class Doctor extends BaseModel {
|
|
|
modelUtil.emitDbError(self.eventEmitter, 'Get group list with doctor failed', err);
|
|
|
return;
|
|
|
}
|
|
|
chats.system.system = sys;
|
|
|
chats.system.sysInfo = sys;
|
|
|
modelUtil.emitData(self.eventEmitter, chats);
|
|
|
})
|
|
|
})
|
|
@ -505,7 +505,7 @@ class Doctor extends BaseModel {
|
|
|
*/
|
|
|
getChatListMsgAmount(userId) {
|
|
|
let self = this;
|
|
|
let chats = {doctor: {}, patient: {}};
|
|
|
let chats = {doctor: {}, patient: {},appo:{},sysInfo:{}};
|
|
|
// 先获取医生间的私聊
|
|
|
pmRepo.findAllP2PWithDoctor(userId, function (err, doctors) {
|
|
|
if (err) {
|
|
@ -548,14 +548,22 @@ class Doctor extends BaseModel {
|
|
|
|
|
|
}
|
|
|
chats.patient = patientAmount;
|
|
|
pmRepo.countAppo(userId,function(err, res){
|
|
|
smRepo.getAppoList(userId,function(err, res){
|
|
|
if (err) {
|
|
|
modelUtil.emitDbError(self.eventEmitter, 'Get chat list with patient failed', err);
|
|
|
return;
|
|
|
}else{
|
|
|
chats.appo = chats.patient+res[0].cou;
|
|
|
chats.appo = res[0].newMessageCount;
|
|
|
}
|
|
|
modelUtil.emitData(self.eventEmitter, chats);
|
|
|
smRepo.getSystemList(userId,function(err,res){
|
|
|
if (err) {
|
|
|
modelUtil.emitDbError(self.eventEmitter, 'Get chat list with patient failed', err);
|
|
|
return;
|
|
|
}else{
|
|
|
chats.sysInfo = res[0].newMessageCount;
|
|
|
}
|
|
|
modelUtil.emitData(self.eventEmitter, chats);
|
|
|
})
|
|
|
})
|
|
|
});
|
|
|
});
|