| 
					
				 | 
			
			
				@ -628,8 +628,9 @@ public class ImService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						JSONObject users = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						users.put(doctor,0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						// 设置医生名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						// 设置患者信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						ct.setPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						// 查询患者信息 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -655,9 +656,20 @@ public class ImService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//		consult.setGuidance(ct.getGuidance()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						// 设置咨询标识 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						ct.setConsult(consult.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						// 设置医生CODE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						ct.setDoctor(doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						// 设置医生名称 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						ct.setDoctorName(baseDoctorDO.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						JSONObject jsonObject = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						jsonObject.put("title", tempPatient.getName() + "申请专家咨询"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						jsonObject.put("content",ct.getSymptoms()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						jsonObject.put("age",DateUtil.getAgeForIdcard(tempPatient.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						jsonObject.put("sex",tempPatient.getSex()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						jsonObject.put("name",tempPatient.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						//推送给IM去创建议题,取得成员消息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						JSONObject messages = imUtil.getCreateTopicMessage(patient, tempPatient.getName(), consult.getTitle(), consult.getSymptoms(), consult.getImages(), doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						JSONObject messages = imUtil.getCreateTopicMessage(patient, tempPatient.getName(), consult.getTitle(), jsonObject.toJSONString(), consult.getImages(), doctor); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						users.put(patient, 0);//+ " "+(tempPatient.getSex()==1?"(男 ":"(女 ") + IdCardUtil.getAgeForIdcard(tempPatient.getIdcard())+")" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						JSONObject obj = imUtil.createTopics(patient + "_" + doctor + "_" + ct.getType(), consult.getId(), tempPatient.getName(), users, messages, imUtil.SESSION_TYPE_MUC); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						if (obj == null) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -817,8 +829,16 @@ public class ImService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							//1、获取his就诊记录详情(保存续方表、药品续方信息表、续方疾病类型表) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(outpatientCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							if(!"0".equals(wlyyOutpatientDO.getStatus())){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								throw new RuntimeException("该就诊记录已被取消,无法接单!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							JSONObject jsonObject = new JSONObject(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							jsonObject.put("title", p.getName() + "申请复诊"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							jsonObject.put("content",wlyyOutpatientDO.getDescription()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							jsonObject.put("age",DateUtil.getAgeForIdcard(p.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							jsonObject.put("sex",p.getSex()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							jsonObject.put("name",p.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							String content = jsonObject.toString(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -834,6 +854,7 @@ public class ImService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							ct.setDoctorName(doctor.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							// 设置患者信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							ct.setPatient(patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							ct.setSymptoms(wlyyOutpatientDO.getDescription()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//			if (1 == type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//				ct.setSymptoms("高血压"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//			} else if (2 == type) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -868,7 +889,7 @@ public class ImService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							ct.setConsult(consult.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							//推送给IM去创建议题,取得成员消息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							JSONObject messages = imUtil.getCreateTopicMessage(doctorCode, doctor.getName(), consult.getTitle(), content, consult.getImages(), patient); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							JSONObject messages = imUtil.getCreateTopicMessage(patient, p.getName(), consult.getTitle(), content, consult.getImages(), doctorCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							//5、(im创建咨询) 续方咨询的sessionid为居民code+就诊code+咨询类型(图文,视频,图文+视频) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							String sessionId = patient + "_" + outpatientCode + "_" + ct.getType(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -905,6 +926,10 @@ public class ImService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							JSONObject result = imUtil.getSingleSessionInfo(sessionId,doctorCode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							wlyyOutpatientDO.setStatus("1");//修改就诊记录为就诊中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							wlyyOutpatientDO.setConDate(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							outpatientDao.save(wlyyOutpatientDO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -996,6 +1021,11 @@ public class ImService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						consultTeam.setStatus(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						consultDao.save(cons); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						consultTeamDao.save(consultTeam); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findOne(cons.getRelationCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						if(wlyyOutpatientDO != null && wlyyOutpatientDO.getId() != null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							wlyyOutpatientDO.setStatus("2"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						return 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 
			 |