|  | @ -1,14 +1,23 @@
 | 
												
													
														
															|  | package com.yihu.jw.hospital.service.SystemMessage;
 |  | package com.yihu.jw.hospital.service.SystemMessage;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | import com.alibaba.fastjson.JSONObject;
 |  | import com.alibaba.fastjson.JSONObject;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.entity.base.patient.BasePatientDO;
 | 
												
													
														
															|  | import com.yihu.jw.entity.hospital.message.SystemMessageDO;
 |  | import com.yihu.jw.entity.hospital.message.SystemMessageDO;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
 | 
												
													
														
															|  | import com.yihu.jw.hospital.message.service.SystemMessageService;
 |  | import com.yihu.jw.hospital.message.service.SystemMessageService;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.hospital.prescription.service.PrescriptionService;
 | 
												
													
														
															|  | import com.yihu.jw.im.service.ImService;
 |  | import com.yihu.jw.im.service.ImService;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.patient.dao.BasePatientDao;
 | 
												
													
														
															|  | 
 |  | import com.yihu.jw.util.idcard.IdCardUtil;
 | 
												
													
														
															|  | import org.slf4j.Logger;
 |  | import org.slf4j.Logger;
 | 
												
													
														
															|  | import org.slf4j.LoggerFactory;
 |  | import org.slf4j.LoggerFactory;
 | 
												
													
														
															|  | import org.springframework.beans.factory.annotation.Autowired;
 |  | import org.springframework.beans.factory.annotation.Autowired;
 | 
												
													
														
															|  | 
 |  | import org.springframework.scheduling.annotation.Async;
 | 
												
													
														
															|  | import org.springframework.stereotype.Service;
 |  | import org.springframework.stereotype.Service;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | import java.util.List;
 | 
												
													
														
															|  | 
 |  | import java.util.Map;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | /**
 |  | /**
 | 
												
													
														
															|  |  * 互联网医院系统消息业务层
 |  |  * 互联网医院系统消息业务层
 | 
												
											
												
													
														
															|  | @ -24,9 +33,15 @@ public class HospitalSystemMessageService  {
 | 
												
													
														
															|  | 	@Autowired
 |  | 	@Autowired
 | 
												
													
														
															|  | 	private SystemMessageService systemMessageService;
 |  | 	private SystemMessageService systemMessageService;
 | 
												
													
														
															|  | 	
 |  | 	
 | 
												
													
														
															|  | 
 |  | 	@Autowired
 | 
												
													
														
															|  | 
 |  | 	private BasePatientDao basePatientDao;
 | 
												
													
														
															|  | 
 |  | 	
 | 
												
													
														
															|  | 	@Autowired
 |  | 	@Autowired
 | 
												
													
														
															|  | 	private ImService imService;
 |  | 	private ImService imService;
 | 
												
													
														
															|  | 	
 |  | 	
 | 
												
													
														
															|  | 
 |  | 	@Autowired
 | 
												
													
														
															|  | 
 |  | 	private PrescriptionService prescriptionService;
 | 
												
													
														
															|  | 
 |  | 	
 | 
												
													
														
															|  | 	/**
 |  | 	/**
 | 
												
													
														
															|  | 	 * 保存系统消息&发送IM外层刷新事件的消息
 |  | 	 * 保存系统消息&发送IM外层刷新事件的消息
 | 
												
													
														
															|  | 	 * @param systemMessageDO
 |  | 	 * @param systemMessageDO
 | 
												
											
												
													
														
															|  | @ -60,5 +75,34 @@ public class HospitalSystemMessageService  {
 | 
												
													
														
															|  | 		}
 |  | 		}
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 	}
 |  | 	}
 | 
												
													
														
															|  | 
 |  | 	
 | 
												
													
														
															|  | 
 |  | 	/**
 | 
												
													
														
															|  | 
 |  | 	 * 通知医生抢单消息
 | 
												
													
														
															|  | 
 |  | 	 * @param wlyyOutpatientDO
 | 
												
													
														
															|  | 
 |  | 	 */
 | 
												
													
														
															|  | 
 |  | 	@Async
 | 
												
													
														
															|  | 
 |  | 	public void sendImPichCheckMessage(WlyyOutpatientDO wlyyOutpatientDO) throws Exception {
 | 
												
													
														
															|  | 
 |  | 		BasePatientDO basePatientDO =basePatientDao.findById(wlyyOutpatientDO.getPatient());
 | 
												
													
														
															|  | 
 |  | 		String tagMsg = "";
 | 
												
													
														
															|  | 
 |  | 		JSONObject object = new JSONObject();
 | 
												
													
														
															|  | 
 |  | 		object.put("socket_sms_type",12);//抢单事件
 | 
												
													
														
															|  | 
 |  | 		if("1".equals(wlyyOutpatientDO.getOutpatientType())&&"1".equals(wlyyOutpatientDO.getType())){//图文复诊
 | 
												
													
														
															|  | 
 |  | 			object.put("relation_code","1:"+wlyyOutpatientDO.getId());
 | 
												
													
														
															|  | 
 |  | 			tagMsg = "图文复诊";
 | 
												
													
														
															|  | 
 |  | 		}else if ("1".equals(wlyyOutpatientDO.getOutpatientType())&&"2".equals(wlyyOutpatientDO.getType())){//视频复诊
 | 
												
													
														
															|  | 
 |  | 			object.put("relation_code","3:"+wlyyOutpatientDO.getId());
 | 
												
													
														
															|  | 
 |  | 			tagMsg = "视频复诊";
 | 
												
													
														
															|  | 
 |  | 		}else if ("2".equals(wlyyOutpatientDO.getOutpatientType())){//协同门诊
 | 
												
													
														
															|  | 
 |  | 			object.put("relation_code","3:"+wlyyOutpatientDO.getId());
 | 
												
													
														
															|  | 
 |  | 			tagMsg = "协同门诊";
 | 
												
													
														
															|  | 
 |  | 		}else{}
 | 
												
													
														
															|  | 
 |  | 		
 | 
												
													
														
															|  | 
 |  | 		object.put("msg",basePatientDO.getName()+"("+ IdCardUtil.getSexForIdcardReturnName(basePatientDO.getIdcard())+" "
 | 
												
													
														
															|  | 
 |  | 				+ IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard())+"岁)发起了随机邀请"+tagMsg+",问题:"+wlyyOutpatientDO.getDescription());
 | 
												
													
														
															|  | 
 |  | 		
 | 
												
													
														
															|  | 
 |  | //		List<Map<String,Object>> doctorlist = prescriptionService.findDoctorByHospitalAndDept();
 | 
												
													
														
															|  | 
 |  | 		
 | 
												
													
														
															|  | 
 |  | //		imService.sendWaiSocketMessage(wlyyOutpatientDO.getPatient(),wlyyOutpatientDO.getDoctor(),object.toString(),"1");
 | 
												
													
														
															|  | 
 |  | 	}
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | }
 |  | }
 |