|  | @ -481,21 +481,23 @@ public class ImService {
 | 
	
		
			
				|  |  |      * @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 {
 | 
	
		
			
				|  |  |     public List<String> append(String consult, String content, Integer type, Integer times, String patientcode, String wechat_appid, String agent,String sessionType) 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, "", "", "");
 | 
	
		
			
				|  |  |         if ("1".equals(sessionType)) {
 | 
	
		
			
				|  |  |             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("咨询已结束!");
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         } catch (Exception e) {
 | 
	
		
			
				|  |  |             e.printStackTrace();
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         if (consultModel.getEndMsgId() != null) {
 | 
	
		
			
				|  |  |             throw new Exception("咨询已结束!");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String[] arr = null;
 | 
	
	
		
			
				|  | @ -537,14 +539,26 @@ public class ImService {
 | 
	
		
			
				|  |  |         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"));
 | 
	
		
			
				|  |  |             String response = "";
 | 
	
		
			
				|  |  |             if ("1".equals(sessionType)){
 | 
	
		
			
				|  |  |                 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")));
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             else {
 | 
	
		
			
				|  |  |                 response = imUtil.sendImMsgAgent(patientcode, patient.getName(), consult, String.valueOf(log.getType()), log.getContent(), "2", null,agent);
 | 
	
		
			
				|  |  |                 if (org.apache.commons.lang3.StringUtils.isNotEmpty(response)) {
 | 
	
		
			
				|  |  |                     JSONObject resObj = JSON.parseObject(response);
 | 
	
		
			
				|  |  |                     if (resObj.getInteger("count") == -1) {
 | 
	
		
			
				|  |  |                         throw new Exception("追问失败!" + resObj.getString("messages"));
 | 
	
		
			
				|  |  |                     }
 | 
	
		
			
				|  |  |                     failed.add(resObj.getJSONArray("messages").get(0).toString());
 | 
	
		
			
				|  |  |                 }
 | 
	
		
			
				|  |  |                 failed.add(String.valueOf(resObj.get("data")));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return failed;
 |