| 
					
				 | 
			
			
				@ -454,6 +454,85 @@ public class ImService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 * 居民咨询发消息(追问接口) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 * @param consult 咨询标识-咨询CODE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 * @param content 消息内容 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 * @param type 消息类型 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 * @param times 次数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 * @param patientcode 发送的居民CODE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 * @param wechat_appid 微信公众号appid 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					public List<String> append(String consult, String content, Integer type, Integer times,String patientcode,String wechat_appid,String agent) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						List<ConsultTeamLogDo> logs = new ArrayList<ConsultTeamLogDo>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						ConsultTeamDo consultModel = consultTeamDao.findByConsult(consult); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						if (consultModel == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							throw new Exception("咨询记录不存在!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							if (wxId.equalsIgnoreCase("xm_ykyy_wx")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								prescriptionService.wxTempalteJPush("consult_remind_doctor",null,consultModel,content,"","",""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						}catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						if (consultModel.getEndMsgId() != null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							throw new Exception("咨询已结束!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						String[] arr = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						if (type == 3) {//语音文件处理 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							ConsultTeamLogDo log = new ConsultTeamLogDo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							log.setConsult(consult); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							log.setContent(content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							log.setDel("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							log.setChatType(type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							log.setType(type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							logs.add(log); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} else if (type == 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//			// 图片消息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							String[] images = content.split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							for (String image : images) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								ConsultTeamLogDo log = new ConsultTeamLogDo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								log.setConsult(consult); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								log.setContent(image); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								log.setDel("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								log.setChatType(type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								log.setType(type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								logs.add(log); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							ConsultTeamLogDo log = new ConsultTeamLogDo(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							log.setConsult(consult); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							log.setContent(content); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							log.setDel("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							log.setChatType(type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							log.setType(type); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							logs.add(log); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							arr = new String[]{content}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				//            Patient patient = patientDao.findByCode(getUID()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						BasePatientDO patient = basePatientDao.findById(patientcode); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						int i = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						List<String> failed = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						for (ConsultTeamLogDo log : logs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							String response = imUtil.sendTopicIM(patientcode, patient.getName(), consult, String.valueOf(log.getType()), log.getContent(),agent,patient.getName(),Integer.parseInt(IdCardUtil.getSexForIdcard_new(patient.getIdcard())), IdCardUtil.getAgeForIdcard(patient.getIdcard())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							if (org.apache.commons.lang3.StringUtils.isNotEmpty(response)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								JSONObject resObj = JSON.parseObject(response); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								if (resObj.getInteger("status")  == -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
									throw new Exception("追问失败!" + resObj.getString("message")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
								failed.add(String.valueOf(resObj.get("data"))); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
							} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
						return failed; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 * 居民咨询发消息(追问接口) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
					 * @param consult 咨询标识-咨询CODE 
			 |