|
@ -16,6 +16,7 @@ let doctorRepo = require('../repository/doctor.repo.js');
|
|
|
let gmRepo = require('../repository/group.msg.repo');
|
|
|
let pmRepo = require('../repository/private.msg.repo');
|
|
|
let smRepo = require('../repository/system.msg.repo');
|
|
|
let Doctor = require('../models/doctor');
|
|
|
var WLYY_ENPOINTS = require('../include/endpoints').WLYY_ENPOINTS;
|
|
|
|
|
|
//--------------------About all chats--------------------
|
|
@ -231,13 +232,34 @@ exports.getAppMsgAmount = function (userId, handler) {
|
|
|
new_msg_count =new_msg_count+ patient.new_msg_count;
|
|
|
|
|
|
}
|
|
|
//获取预约消息
|
|
|
smRepo.getAppoList(userId,function(err, res){
|
|
|
new_msg_count = new_msg_count+res.length;
|
|
|
//获取系统消息
|
|
|
smRepo.getSystemList(userId,function(err, res){
|
|
|
new_msg_count = new_msg_count+res.length;
|
|
|
return new_msg_count;
|
|
|
smRepo.getMessagesAmountByType(userId,"301,302,303,304,401,402,403,404,405",null,null,null,null,function(err, res){
|
|
|
if (err) {
|
|
|
modelUtil.emitDbError(self.eventEmitter, 'Get chat list with patient failed', err);
|
|
|
return;
|
|
|
}
|
|
|
new_msg_count+=res[0]["amount"];
|
|
|
smRepo.getMessagesAmountByType(userId,"101","ydf_consult","id","status","1",function(err,res){
|
|
|
if (err) {
|
|
|
modelUtil.emitDbError(self.eventEmitter, 'Get getLastMessageByType list with doctor failed', err);
|
|
|
return;
|
|
|
}
|
|
|
new_msg_count+=res[0]["amount"];
|
|
|
smRepo.getMessagesAmountByType(userId,"201","ydf_appointment","id","status","0",function(err,res){
|
|
|
if (err) {
|
|
|
modelUtil.emitDbError(self.eventEmitter, 'Get getLastMessageByType list with doctor failed', err);
|
|
|
return;
|
|
|
}
|
|
|
new_msg_count+=res[0]["amount"];
|
|
|
//反馈意见 type 5
|
|
|
smRepo.getMessagesAmountByType(userId,"501","ydf_feedback","id","status","0",function(err,res){
|
|
|
if (err) {
|
|
|
modelUtil.emitDbError(self.eventEmitter, 'Get getLastMessageByType list with doctor failed', err);
|
|
|
return;
|
|
|
}
|
|
|
new_msg_count+=res[0]["amount"];
|
|
|
handler(null,new_msg_count);
|
|
|
});
|
|
|
})
|
|
|
})
|
|
|
})
|
|
|
});
|