|  | @ -108,7 +108,7 @@ class WechatClient extends RedisModel {
 | 
	
		
			
				|  |  |                     count++;
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 if(pc_doctorClient){
 | 
	
		
			
				|  |  |                     log.error("doctor sessionid "+pc_doctorClient.sessionId);
 | 
	
		
			
				|  |  |                     log.error("pc_doctor sessionid "+pc_doctorClient.sessionId);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |                     if(patientClient){
 | 
	
		
			
				|  |  |                         log.error("patient sessionid "+patientClient.sessionId);
 | 
	
	
		
			
				|  | @ -332,8 +332,9 @@ class WechatClient extends RedisModel {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //发送pc端
 | 
	
		
			
				|  |  |         if(pc_doctorClient&&message.session_id==pc_doctorClient.sessionId){
 | 
	
		
			
				|  |  |         //发送pc端 - PC端消息不做sessionid的判断,前端自己判断消息归属于哪个会话,自行渲染--20191012-huangwenjie
 | 
	
		
			
				|  |  |         // if(pc_doctorClient&&message.session_id==pc_doctorClient.sessionId){
 | 
	
		
			
				|  |  |         if(pc_doctorClient){
 | 
	
		
			
				|  |  |             WechatClient.updateParticipantLastFetchTime(pc_doctorClient.sessionId, doctorId, ObjectUtil.timestampToLong(message.timestamp));
 | 
	
		
			
				|  |  |             pc_doctorClient.socket.emit('message', {
 | 
	
		
			
				|  |  |                 id: message.id,
 | 
	
	
		
			
				|  | @ -442,6 +443,111 @@ class WechatClient extends RedisModel {
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     //推送居民、居民PC、医生、医生PC外层推送
 | 
	
		
			
				|  |  |     static sendSystemSocketMessage(targetUserId, message) {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //居民外层消息推送
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         let patientClient = clientCache.findByIdAndType("patient_system_"+targetUserId,SOCKET_TYPES.PATIENT_SYSTEM);
 | 
	
		
			
				|  |  |         let pc_patientClient = clientCache.findByIdAndType("pcpatient_system_"+targetUserId,SOCKET_TYPES.PC_PATIENT_SYSTEM);
 | 
	
		
			
				|  |  |         if(!patientClient&&!pc_patientClient){
 | 
	
		
			
				|  |  |             log.warn("target  patient systemt is not online!");
 | 
	
		
			
				|  |  |             return;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         var patientcount = 0;
 | 
	
		
			
				|  |  |         if(patientClient&&message.session_id==patientClient.sessionId){
 | 
	
		
			
				|  |  |             WechatClient.updateParticipantLastFetchTime(patientClient.sessionId, targetUserId, ObjectUtil.timestampToLong(message.timestamp));
 | 
	
		
			
				|  |  |             patientClient.socket.emit('message', {
 | 
	
		
			
				|  |  |                 id: message.id,
 | 
	
		
			
				|  |  |                 session_id: message.session_id,
 | 
	
		
			
				|  |  |                 sender_id: message.sender_id,
 | 
	
		
			
				|  |  |                 sender_name: message.sender_name,
 | 
	
		
			
				|  |  |                 content_type: message.content_type,
 | 
	
		
			
				|  |  |                 content: message.content,
 | 
	
		
			
				|  |  |                 timestamp: ObjectUtil.timestampToLong(message.timestamp),
 | 
	
		
			
				|  |  |                 type: message.content_type,          // legacy support
 | 
	
		
			
				|  |  |                 name: message.sender_name,
 | 
	
		
			
				|  |  |             });
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             patientcount++;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //发送pc端
 | 
	
		
			
				|  |  |         if(pc_patientClient&&message.session_id==pc_patientClient.sessionId){
 | 
	
		
			
				|  |  |             WechatClient.updateParticipantLastFetchTime(pc_patientClient.sessionId, targetUserId, ObjectUtil.timestampToLong(message.timestamp));
 | 
	
		
			
				|  |  |             pc_patientClient.socket.emit('message', {
 | 
	
		
			
				|  |  |                 id: message.id,
 | 
	
		
			
				|  |  |                 session_id: message.session_id,
 | 
	
		
			
				|  |  |                 sender_id: message.sender_id,
 | 
	
		
			
				|  |  |                 sender_name: message.sender_name,
 | 
	
		
			
				|  |  |                 content_type: message.content_type,
 | 
	
		
			
				|  |  |                 content: message.content,
 | 
	
		
			
				|  |  |                 timestamp: ObjectUtil.timestampToLong(message.timestamp),
 | 
	
		
			
				|  |  |                 type: message.content_type,          // legacy support
 | 
	
		
			
				|  |  |                 name: message.sender_name,
 | 
	
		
			
				|  |  |             });
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             count++;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(patientcount==2){
 | 
	
		
			
				|  |  |             log.warn("patient system is not in the same session or is not online");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //医生外层消息推送
 | 
	
		
			
				|  |  |         let doctorClient = clientCache.findByIdAndType("doctor_system_"+targetUserId,SOCKET_TYPES.DOCTOR_SYSTEM);
 | 
	
		
			
				|  |  |         let pc_doctorClient = clientCache.findByIdAndType("pc_system_"+targetUserId,SOCKET_TYPES.PC_DOCTOR_SYSTEM);
 | 
	
		
			
				|  |  |         if(!doctorClient&&!pc_doctorClient){
 | 
	
		
			
				|  |  |             log.warn("target doctor system is not online!");
 | 
	
		
			
				|  |  |             return;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         var doctorcount = 0;
 | 
	
		
			
				|  |  |         if(doctorClient&&message.session_id==doctorClient.sessionId){
 | 
	
		
			
				|  |  |             WechatClient.updateParticipantLastFetchTime(doctorClient.sessionId, targetUserId, ObjectUtil.timestampToLong(message.timestamp));
 | 
	
		
			
				|  |  |             doctorClient.socket.emit('message', {
 | 
	
		
			
				|  |  |                 id: message.id,
 | 
	
		
			
				|  |  |                 session_id: message.session_id,
 | 
	
		
			
				|  |  |                 sender_id: message.sender_id,
 | 
	
		
			
				|  |  |                 sender_name: message.sender_name,
 | 
	
		
			
				|  |  |                 content_type: message.content_type,
 | 
	
		
			
				|  |  |                 content: message.content,
 | 
	
		
			
				|  |  |                 timestamp: ObjectUtil.timestampToLong(message.timestamp),
 | 
	
		
			
				|  |  |                 type: message.content_type,          // legacy support
 | 
	
		
			
				|  |  |                 name: message.sender_name,
 | 
	
		
			
				|  |  |             });
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             doctorcount++;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //发送pc端 - PC端消息不做sessionid的判断,前端自己判断消息归属于哪个会话,自行渲染--20191012-huangwenjie
 | 
	
		
			
				|  |  |         // if(pc_doctorClient&&message.session_id==pc_doctorClient.sessionId){
 | 
	
		
			
				|  |  |         if(pc_doctorClient){
 | 
	
		
			
				|  |  |             WechatClient.updateParticipantLastFetchTime(pc_doctorClient.sessionId, targetUserId, ObjectUtil.timestampToLong(message.timestamp));
 | 
	
		
			
				|  |  |             pc_doctorClient.socket.emit('message', {
 | 
	
		
			
				|  |  |                 id: message.id,
 | 
	
		
			
				|  |  |                 session_id: message.session_id,
 | 
	
		
			
				|  |  |                 sender_id: message.sender_id,
 | 
	
		
			
				|  |  |                 sender_name: message.sender_name,
 | 
	
		
			
				|  |  |                 content_type: message.content_type,
 | 
	
		
			
				|  |  |                 content: message.content,
 | 
	
		
			
				|  |  |                 timestamp: ObjectUtil.timestampToLong(message.timestamp),
 | 
	
		
			
				|  |  |                 type: message.content_type,          // legacy support
 | 
	
		
			
				|  |  |                 name: message.sender_name,
 | 
	
		
			
				|  |  |             });
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             doctorcount++;
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         if(doctorcount==2){
 | 
	
		
			
				|  |  |             log.warn("doctor system is not in the same session or is not online");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * 发送微信模板消息给居民
 |