|  | @ -63,14 +63,13 @@ class Sessions extends RedisModel {
 | 
	
		
			
				|  |  |         } else {
 | 
	
		
			
				|  |  |             callBusinessType(sessionId);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         var businessType = SESSION_BUSINESS_TYPE.DOCTOR;
 | 
	
		
			
				|  |  |         function callBusinessType(sessionId) {
 | 
	
		
			
				|  |  |             var businessType = SESSION_BUSINESS_TYPE.DOCTOR;
 | 
	
		
			
				|  |  |             for (var j = 0; j < participantArray.length; j++)
 | 
	
		
			
				|  |  |                 callIsPatient(j, businessType, participantArray.length);
 | 
	
		
			
				|  |  |                 callIsPatient(j, participantArray.length);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         function callIsPatient(j, businessType, length) {
 | 
	
		
			
				|  |  |         function callIsPatient(j, length) {
 | 
	
		
			
				|  |  |             Users.isPatientId(participantArray[j], function (isPatient) {
 | 
	
		
			
				|  |  |                 if (isPatient) {
 | 
	
		
			
				|  |  |                     businessType = SESSION_BUSINESS_TYPE.PATIENT
 | 
	
	
		
			
				|  | @ -167,7 +166,7 @@ class Sessions extends RedisModel {
 | 
	
		
			
				|  |  |      * @param page
 | 
	
		
			
				|  |  |      * @param size
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     getUserSessions(userId, page, size) {
 | 
	
		
			
				|  |  |     getUserSessions(userId, page, size,businessType) {
 | 
	
		
			
				|  |  |         let userSessionKey = RedisModel.makeRedisKey(REDIS_KEYS.UserSessions, userId);
 | 
	
		
			
				|  |  |         let self = this;
 | 
	
		
			
				|  |  |         if (page > 0) {
 | 
	
	
		
			
				|  | @ -205,7 +204,9 @@ class Sessions extends RedisModel {
 | 
	
		
			
				|  |  |                             let session = res[0];
 | 
	
		
			
				|  |  |                             let role = res[1];
 | 
	
		
			
				|  |  |                             let lastFetchTime = res[2];
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                             if(businessType&&businessType!=session.business_type){
 | 
	
		
			
				|  |  |                                 logger.info("businessType:"+businessType+"<>"+session.business_type);
 | 
	
		
			
				|  |  |                             }else{
 | 
	
		
			
				|  |  |                             // 计算未读消息数
 | 
	
		
			
				|  |  |                             let messagesByTimestampKey = RedisModel.makeRedisKey(REDIS_KEYS.MessagesByTimestamp, sessionId);
 | 
	
		
			
				|  |  |                             redis.zcountAsync(messagesByTimestampKey, lastFetchTime, new Date().getTime())
 | 
	
	
		
			
				|  | @ -219,13 +220,15 @@ class Sessions extends RedisModel {
 | 
	
		
			
				|  |  |                                         sender_id: session.sender_id,
 | 
	
		
			
				|  |  |                                         sender_name: session.sender_name,
 | 
	
		
			
				|  |  |                                         unread_count: count,
 | 
	
		
			
				|  |  |                                         business_type:session.business_type,
 | 
	
		
			
				|  |  |                                         my_role: role
 | 
	
		
			
				|  |  |                                     });
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                                     if (sessionId === sessionIds[sessionIds.length - 1]) {
 | 
	
		
			
				|  |  |                                         ModelUtil.emitOK(self.eventEmitter, sessionList);
 | 
	
		
			
				|  |  |                                     }
 | 
	
		
			
				|  |  |                                 });
 | 
	
		
			
				|  |  |                                 })
 | 
	
		
			
				|  |  |                             };
 | 
	
		
			
				|  |  |                         })
 | 
	
		
			
				|  |  |                         .catch(function (err) {
 | 
	
		
			
				|  |  |                             ModelUtil.emitError(self.eventEmitter, "Get sessions failed: " + err);
 | 
	
	
		
			
				|  | @ -349,7 +352,7 @@ class Sessions extends RedisModel {
 | 
	
		
			
				|  |  |                         let startMsgScore = res[1];
 | 
	
		
			
				|  |  |                         let endMsgScore = res[0];
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                         if (startMsgScore == null || endMsgScore == null) {
 | 
	
		
			
				|  |  |                         if (startMsgScore == null || endMsgScore == null||startMsgScore==endMsgScore) {
 | 
	
		
			
				|  |  |                             handler(null, []);
 | 
	
		
			
				|  |  |                             return;
 | 
	
		
			
				|  |  |                         }
 | 
	
	
		
			
				|  | @ -514,7 +517,7 @@ class Sessions extends RedisModel {
 | 
	
		
			
				|  |  |                     });
 | 
	
		
			
				|  |  |                 }).then(function (res) {
 | 
	
		
			
				|  |  |                     // TODO: 消息推送
 | 
	
		
			
				|  |  |                     pusher.pushTo
 | 
	
		
			
				|  |  |                    //pusher.pushTo
 | 
	
		
			
				|  |  |                 }).catch(function (err) {
 | 
	
		
			
				|  |  |                     ModelUtil.emitError(self.eventEmitter, {message: "Error occurred while save message to session: " + err});
 | 
	
		
			
				|  |  |                 })
 |