Quellcode durchsuchen

ydf项目处理

vor 8 Jahren
Ursprung
Commit
84ede3575b
2 geänderte Dateien mit 23 neuen und 10 gelöschten Zeilen
  1. 14 6
      src/doctor/models/doctor.js
  2. 9 4
      src/doctor/repository/stats.msg.repo.js

+ 14 - 6
src/doctor/models/doctor.js

@ -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);
                        })
                    })
                });
            });

+ 9 - 4
src/doctor/repository/stats.msg.repo.js

@ -15,7 +15,7 @@ var imRepo = require("./database/im.db.js");
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');
var WLYY_ENPOINTS = require('../include/endpoints').WLYY_ENPOINTS;
//--------------------About all chats--------------------
@ -231,9 +231,14 @@ exports.getAppMsgAmount = function (userId, handler) {
                        new_msg_count =new_msg_count+ patient.new_msg_count;
                    }
                    pmRepo.countAppo(userId,function(err, res){
                        new_msg_count  = new_msg_count+res[0].cou;
                        return new_msg_count;
                    //获取预约消息
                    smRepo.getAppoList(userId,function(err, res){
                        new_msg_count  = new_msg_count+res[0].newMessageCount;
                        //获取系统消息
                        smRepo.getSystemList(userId,function(err, res){
                            new_msg_count  = new_msg_count+res[0].newMessageCount;
                            return new_msg_count;
                        })
                    })
                });
            });