Browse Source

Merge branch 'feature-refactor' of http://192.168.1.220:10080/Amoy/im.doctor into feature-refactor

yeshijie 4 years ago
parent
commit
034b3bc7f7

+ 1 - 0
src/server/include/commons.js

@ -101,6 +101,7 @@ const CONTENT_TYPES = {
    ChangeDoorCardInfo: 2102,//上门服务-修改工单卡片信息
    ChangeDoorDoctor: 2103,//上门服务-变更工单医生信息
    ChangeDoorPackageItems:2104, //上门服务-变更工单服务项信息
    InformedConsent:2105,//知情通知书
    typeToDescription: function (type, defaultDescription) {
        if (CONTENT_TYPES.Image == type) {
            return '[图片]';

+ 1 - 0
src/server/models/client/app.client.js

@ -174,6 +174,7 @@ class AppClient extends RedisModel {
                var session_type = isNaN(Number(sessionType))?sessionType:Number(sessionType);
                if( session_type==SESSION_TYPES.MUC||
                    session_type==SESSION_TYPES.P2P||
                    session_type==SESSION_TYPES.SCREENING_REFERRAL||
                    session_type==SESSION_TYPES.GROUP||
                    session_type==SESSION_TYPES.DISCUSSION||
                    session_type==SESSION_TYPES.SPECIALISTGROUP||

+ 14 - 14
src/server/models/sessions/sessions.js

@ -104,7 +104,7 @@ class Sessions extends RedisModel {
        for (let i in participantArray) {
            participantIdArray.push(participantArray[i].split(":")[0]);
        }
        if (type == SESSION_TYPES.P2P || type == SESSION_TYPES.SYSTEM) {
        if (type == SESSION_TYPES.P2P || type == SESSION_TYPES.SCREENING_REFERRAL || type == SESSION_TYPES.SYSTEM) {
            if (sessionId) {
                callBusinessType(sessionId);
                return;
@ -187,7 +187,7 @@ class Sessions extends RedisModel {
        }
        //流程1-判断是否存在sessionId不存在则创建对应的sessionId;
        if (!sessionId) {
            if (type == SESSION_TYPES.P2P || type == SESSION_TYPES.SYSTEM) {
            if (type == SESSION_TYPES.P2P || type == SESSION_TYPES.SCREENING_REFERRAL || type == SESSION_TYPES.SYSTEM) {
                ParticipantRepo.findSessionIdByParticipantIds(participantIdArray[0], participantIdArray[1], function (err, res) {
                    sessionId = res;
                    callBusinessType();
@ -359,7 +359,7 @@ class Sessions extends RedisModel {
        let self = this;
        let sessionKey = RedisModel.makeRedisKey(REDIS_KEYS.Session, sessionId);
        redis.hgetallAsync(sessionKey).then(function(session){
            if(session.type==SESSION_TYPES.P2P){
            if(session.type==SESSION_TYPES.P2P||session.type == SESSION_TYPES.SCREENING_REFERRAL){
                ParticipantRepo.findNameById(userId, function (err, res) {
                    session.name = res[0].name;
                    if(handler){
@ -603,7 +603,7 @@ class Sessions extends RedisModel {
                                }
                                let sessionName = "";
                                let otherUserId = "";
                                if (session.type == SESSION_TYPES.P2P) {
                                if (session.type == SESSION_TYPES.P2P||session.type == SESSION_TYPES.SCREENING_REFERRAL) {
                                    for (let j in users) {
                                        if (users[j] != userId) {
                                            otherUserId = users[j];
@ -620,7 +620,7 @@ class Sessions extends RedisModel {
                                    .then(function (count) {
                                        if (!otherUserId) otherUserId = userId;
                                        ParticipantRepo.findNameById(otherUserId, function (err, res) {
                                            if ((res && res.length == 0) || session.type != SESSION_TYPES.P2P) {
                                            if ((res && res.length == 0) || (session.type != SESSION_TYPES.P2P&&session.type != SESSION_TYPES.SCREENING_REFERRAL)) {
                                                sessionName = session.name;
                                            } else {
                                                sessionName = res[0].name;
@ -747,7 +747,7 @@ class Sessions extends RedisModel {
                                }
                                let sessionName = "";
                                let otherUserId = "";
                                if (session.type == SESSION_TYPES.P2P) {
                                if (session.type == SESSION_TYPES.P2P || session.type == SESSION_TYPES.SCREENING_REFERRAL) {
                                    for (let j in users) {
                                        if (users[j] != userId) {
                                            otherUserId = users[j];
@ -763,7 +763,7 @@ class Sessions extends RedisModel {
                                    .then(function (count) {
                                        if (!otherUserId) otherUserId = userId;
                                        ParticipantRepo.findNameById(otherUserId, function (err, res) {
                                            if ((res && res.length == 0) || session.type != SESSION_TYPES.P2P) {
                                            if ((res && res.length == 0) || session.type != SESSION_TYPES.P2P || session.type != SESSION_TYPES.SCREENING_REFERRAL) {
                                                sessionName = session.name;
                                            } else {
                                                sessionName = res[0].name;
@ -888,7 +888,7 @@ class Sessions extends RedisModel {
                                }
                                let sessionName = "";
                                let otherUserId = "";
                                if (session.type == SESSION_TYPES.P2P) {
                                if (session.type == SESSION_TYPES.P2P || session.type == SESSION_TYPES.SCREENING_REFERRAL) {
                                    for (let j in users) {
                                        if (users[j] != userId) {
                                            otherUserId = users[j];
@ -905,7 +905,7 @@ class Sessions extends RedisModel {
                                    .then(function (count) {
                                        if (!otherUserId) otherUserId = userId;
                                        ParticipantRepo.findNameById(otherUserId, function (err, res) {
                                            if ((res && res.length == 0) || session.type != SESSION_TYPES.P2P) {
                                            if ((res && res.length == 0) || session.type != SESSION_TYPES.P2P || session.type != SESSION_TYPES.SCREENING_REFERRAL) {
                                                sessionName = session.name;
                                            } else {
                                                sessionName = res[0].name;
@ -1185,7 +1185,7 @@ class Sessions extends RedisModel {
                                        handler(null, messages);
                                    }).then(function () {
                                        Sessions.updateParticipantLastFetchTime(sessionId, userId, new Date().getTime());
                                        if(session.type == SESSION_TYPES.P2P){
                                        if(session.type == SESSION_TYPES.P2P || session.type == SESSION_TYPES.SCREENING_REFERRAL){
                                            for(var j in users){
                                                if(users[j]==userId)continue;
                                                 WechatClient.sendAllRead(users[j],sessionId);
@ -1217,7 +1217,7 @@ class Sessions extends RedisModel {
                                        handler(null, messages);
                                    }).then(function () {
                                        Sessions.updateParticipantLastFetchTime(sessionId, userId, new Date().getTime());
                                        if(session.type == SESSION_TYPES.P2P){
                                        if(session.type == SESSION_TYPES.P2P || session.type == SESSION_TYPES.SCREENING_REFERRAL){
                                            for(var j in users){
                                                if(users[j]==userId)continue;
                                                //通知对方自己已经读取数据
@ -1841,7 +1841,7 @@ class Sessions extends RedisModel {
                    });
                }
            } else {
                if(sessionType==SESSION_TYPES.P2P){
                if(sessionType==SESSION_TYPES.P2P || sessionType == SESSION_TYPES.SCREENING_REFERRAL){
                     WechatClient.sendReadDoctorByDoctorId(targetUserId, message);
                }
                //告知医生新消息
@ -1912,7 +1912,7 @@ class Sessions extends RedisModel {
                WechatClient.sendMessage(message.targetUserId, message.targetUserName, message);
            }
        } else {
            if(message.sessionType==SESSION_TYPES.P2P){
            if(message.sessionType==SESSION_TYPES.P2P || message.sessionType == SESSION_TYPES.SCREENING_REFERRAL){
                WechatClient.sendReadDoctorByDoctorId(message.targetUserId, message);
            }
            //告知医生新消息
@ -1939,7 +1939,7 @@ class Sessions extends RedisModel {
     */
    static pushIntoNotification(targetUserId, targetUserName, message,sessionType) {
        if(sessionType==SESSION_TYPES.P2P){
        if(sessionType==SESSION_TYPES.P2P || sessionType == SESSION_TYPES.SCREENING_REFERRAL){
            WechatClient.sendReadDoctorByDoctorId(targetUserId, message);
        }
        //告知医生新消息