|  | @ -893,15 +893,42 @@ public class ConsultTeamService extends ConsultService {
 | 
												
													
														
															|  |      * @param consult 三师咨询标识
 |  |      * @param consult 三师咨询标识
 | 
												
													
														
															|  |      * @return
 |  |      * @return
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public int finish(String consult) {
 |  | 
 | 
												
													
														
															|  | 
 |  |     public int finish(String consult, String endOperator, int endType) throws Exception {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         ConsultTeam consultTeam = consultTeamDao.findByConsult(consult);
 |  |         ConsultTeam consultTeam = consultTeamDao.findByConsult(consult);
 | 
												
													
														
															|  | 
 |  |         String name = "";
 | 
												
													
														
															|  | 
 |  |         String returnJson = "";
 | 
												
													
														
															|  |         //推送给IM文字消息
 |  |         //推送给IM文字消息
 | 
												
													
														
															|  |         String returnJson = sendIM(consultTeam.getPatient(), consultTeam.getDoctor(), "7", "本次咨询结束");
 |  | 
 | 
												
													
														
															|  |         ;
 |  | 
 | 
												
													
														
															|  |         JSONObject jo = new JSONObject(returnJson);
 |  | 
 | 
												
													
														
															|  |         //设置消息ID
 |  | 
 | 
												
													
														
															|  |         consultTeam.setEndMsgId(jo.getInt("startId"));
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (endType == 1) {
 | 
												
													
														
															|  | 
 |  |             Patient p = patientDao.findByCode(endOperator);
 | 
												
													
														
															|  | 
 |  |             name = p.getName();
 | 
												
													
														
															|  | 
 |  |             returnJson = sendIM(consultTeam.getPatient(), consultTeam.getDoctor(), "7", name + "结束了本次咨询");
 | 
												
													
														
															|  | 
 |  |         } else {
 | 
												
													
														
															|  | 
 |  |             Doctor d = doctorDao.findByCode(endOperator);
 | 
												
													
														
															|  | 
 |  |             name = d.getName();
 | 
												
													
														
															|  | 
 |  |             returnJson = sendIM(consultTeam.getDoctor(), consultTeam.getPatient(), "7", name + "结束了本次咨询");
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (StringUtils.isEmpty(returnJson)) {
 | 
												
													
														
															|  | 
 |  |             throw new Exception("send consult finished IM message failed");
 | 
												
													
														
															|  | 
 |  |         } else {
 | 
												
													
														
															|  | 
 |  |             JSONObject jo = new JSONObject(returnJson);
 | 
												
													
														
															|  | 
 |  |             //设置消息ID
 | 
												
													
														
															|  | 
 |  |             consultTeam.setEndMsgId(jo.getInt("startId"));
 | 
												
													
														
															|  | 
 |  |             consultTeam.setEndOperator(endOperator);
 | 
												
													
														
															|  | 
 |  |             consultTeam.setEndType(endType);
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         JSONObject group = talkGroupService.findConsultTalkGroup(consultTeam.getConsult());
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |         if (group != null) {
 | 
												
													
														
															|  | 
 |  |             String json = sendGroupIM(endOperator, group.getString("code"), "7", name + "结束了本次咨询");
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |             if (StringUtils.isEmpty(json)) {
 | 
												
													
														
															|  | 
 |  |                 throw new Exception("send consult finished IM message failed");
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         return consultTeamDao.updateStatusByConsult(consult);
 |  |         return consultTeamDao.updateStatusByConsult(consult);
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | 
 |  | 
 |