package com.yihu.wlyy.util;


import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

public class SendPatientUtil {
	public static String sendToPatient(String from,String fromName,String to,String contentType,String content,String title,String type){
		JSONObject participants = new JSONObject();
		participants.put(from,2);
		participants.put(to,0);
		if(!"4".equals(contentType)){
			contentType = "0";
		}
		JSONObject sessionJson  = ImUtill.createSession(participants,"1",title,to+"_consult_"+type);
		if(sessionJson.getInt("status")==-1){
			throw  new RuntimeException(sessionJson.getString("message"));
		}
		JSONObject session = sessionJson.getJSONObject("data");
		return ImUtill.sendImMsg(from,fromName,session.getString("id"),contentType,content,"1");
	}
}
