| 
															
																@ -195,7 +195,7 @@ public class ConsultTeamService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        consultTeam.setConsult(consult.getId()); // 设置咨询标识 
															 | 
															
															 | 
															
																        consultTeam.setConsult(consult.getId()); // 设置咨询标识 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //(im创建咨询) 紧急救助咨询的sessionid为居民code+咨询类型 
															 | 
															
															 | 
															
																        //(im创建咨询) 紧急救助咨询的sessionid为居民code+咨询类型 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String sessionId = patient + "_" + consult.getId() + "_" + consultTeam.getType(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        String sessionId = patient + "_" + consultTeam.getType(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //4、 紧急救助咨询-参与者 
															 | 
															
															 | 
															
																        //4、 紧急救助咨询-参与者 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        JSONObject participants = new JSONObject(); 
															 | 
															
															 | 
															
																        JSONObject participants = new JSONObject(); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -313,8 +313,8 @@ public class ConsultTeamService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        consult.setRelationCode(doorServiceOrderDO.getId());//关联业务code 
															 | 
															
															 | 
															
																        consult.setRelationCode(doorServiceOrderDO.getId());//关联业务code 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        consultTeam.setConsult(consult.getId()); // 设置咨询标识 
															 | 
															
															 | 
															
																        consultTeam.setConsult(consult.getId()); // 设置咨询标识 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //(im创建咨询) 上门服务咨询的sessionid为居民code+咨询code+工单编号+咨询类型 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String sessionId = patient + "_" + consult.getId() + "_" + doorServiceOrderDO.getNumber() +  "_" + consultTeam.getType(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        //(im创建咨询) 上门服务咨询的sessionid为居民code+咨询类型 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        String sessionId = patient + "_" + consultTeam.getType(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //4、 上门服务咨询-参与者 
															 | 
															
															 | 
															
																        //4、 上门服务咨询-参与者 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        JSONObject participants = new JSONObject(); 
															 | 
															
															 | 
															
																        JSONObject participants = new JSONObject(); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -411,8 +411,8 @@ public class ConsultTeamService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        consult.setRelationCode(orderId);//关联业务code 
															 | 
															
															 | 
															
																        consult.setRelationCode(orderId);//关联业务code 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        consultTeam.setConsult(consult.getId()); // 设置咨询标识 
															 | 
															
															 | 
															
																        consultTeam.setConsult(consult.getId()); // 设置咨询标识 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //(im创建咨询) 安防警报咨询的sessionid为居民code+咨询id+咨询类型 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        String sessionId = patient + "_" + consult.getId() + "_" + consultTeam.getType(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        //(im创建咨询) 安防警报咨询的sessionid为居民code+咨询类型 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																        String sessionId = patient + "_" + consultTeam.getType(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //4、安防警报咨询-参与者  提供服务的助老员 老人本人 家属 
															 | 
															
															 | 
															
																        //4、安防警报咨询-参与者  提供服务的助老员 老人本人 家属 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        JSONObject participants = new JSONObject(); 
															 | 
															
															 | 
															
																        JSONObject participants = new JSONObject(); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -567,109 +567,6 @@ public class ConsultTeamService { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																            throw new RuntimeException(String.valueOf(obj.get("message"))); 
															 | 
															
															 | 
															
																            throw new RuntimeException(String.valueOf(obj.get("message"))); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        } 
															 | 
															
															 | 
															
																        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        //结束咨询才发送推送给IM文字消息 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//        if (endType == 1) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//            BasePatientDO p = patientDao.findOne(endOperator); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//            endName = p.getName(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//            if (consultTeam.getType() == 2 || consultTeam.getType() == 8) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                String openId = p.getOpenid(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																// 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey", "zxpj"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                String first = templateConfig.getFirst(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                first = first.replace("key1", (endName == null ? "" : endName)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                String keyword1 = templateConfig.getKeyword1(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																// 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                org.json.JSONObject json = new org.json.JSONObject(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                json.put("keyword1", keyword1); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                json.put("keyword2", sdf.format(new Date())); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                json.put("toUser", p.getCode()); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                json.put("represented", p.getCode());//被代理人 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                json.put("remark", ""); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                json.put("consult", consult); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                if (consultTeam.getType() == 8) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    first = first.replace("key2", "续方"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                } else { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    first = first.replace("key2", ""); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                json.put("first", first); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                if (StringUtils.isNotBlank(p.getOpenid())) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 17, openId, p.getName(), json); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                } else { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    //发送代理人 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    org.json.JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode(), p.getOpenid()); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    if (jsonArray != null && jsonArray.length() > 0) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        for (int i = 0; i < jsonArray.length(); i++) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            org.json.JSONObject j = jsonArray.getJSONObject(i); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            Patient member = (Patient) j.get("member"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            org.json.JSONObject data = json; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            data.remove("toUser"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            data.put("toUser", member.getCode()); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            data.remove("first"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()) + first); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 17, member.getOpenid(), p.getName(), data); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//            } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//        } else { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//            if (consultTeam.getType() == 2 || consultTeam.getType() == 8) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                Patient p = patientDao.findByCode(consultTeam.getPatient()); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                String name = p.getName(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                String openId = p.getOpenid(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																// 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey", "zxpj"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																// 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                if (endOperator.equals("admin")) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    templateConfig = templateConfigDao.findByScene("template_doctor_survey", "zxcspj"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                String first = templateConfig.getFirst(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                first = first.replace("key1", (name == null ? "" : name)); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                String keyword1 = templateConfig.getKeyword1(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																// 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                org.json.JSONObject json = new org.json.JSONObject(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                json.put("keyword1", keyword1); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                json.put("keyword2", sdf.format(new Date())); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                json.put("toUser", p.getCode()); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                json.put("represented", p.getCode());//被代理人 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                json.put("remark", ""); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                json.put("consult", consult); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																// 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                if (consultTeam.getType() == 8) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    first += "续方"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    first = first.replace("key2", "续方"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                } else { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    first = first.replace("key2", ""); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                /*if (endOperator.equals("admin")) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    first += "咨询超时未回复,系统自动关闭,请及时对咨询医生进行评价。"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                }else { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    first += "咨询已结束,请及时对咨询医生进行评价。"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                }*/ 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                json.put("first", first); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                if (StringUtils.isNotBlank(p.getOpenid())) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 17, openId, p.getName(), json); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                } else { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    //发送代理人 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    org.json.JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode(), p.getOpenid()); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    if (jsonArray != null && jsonArray.length() > 0) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        for (int i = 0; i < jsonArray.length(); i++) { 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            org.json.JSONObject j = jsonArray.getJSONObject(i); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            Patient member = (Patient) j.get("member"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            org.json.JSONObject data = json; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            data.remove("toUser"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            data.put("toUser", member.getCode()); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            data.remove("first"); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()) + first); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                            pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 17, member.getOpenid(), p.getName(), data); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                        } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                    } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//                } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																// 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//            } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																//        } 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        consultTeam.setEndMsgId(obj.getString("id")); 
															 | 
															
															 | 
															
																        consultTeam.setEndMsgId(obj.getString("id")); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        cons.setEndTime(new Date()); 
															 | 
															
															 | 
															
																        cons.setEndTime(new Date()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        consultTeam.setEndTime(new Date()); 
															 | 
															
															 | 
															
																        consultTeam.setEndTime(new Date()); 
															 |