|
@ -6,6 +6,7 @@ import com.yihu.wlyy.service.BaseService;
|
|
import com.yihu.wlyy.task.PushMsgTask;
|
|
import com.yihu.wlyy.task.PushMsgTask;
|
|
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
|
|
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
|
|
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
|
|
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
@ -67,18 +68,22 @@ public class DoctorFeldsherTemplateService extends BaseService {
|
|
sendJson.put("toUser", patient);//带参数的模板跳转链接
|
|
sendJson.put("toUser", patient);//带参数的模板跳转链接
|
|
pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11, openId, name, sendJson);
|
|
pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11, openId, name, sendJson);
|
|
//发送代理人
|
|
//发送代理人
|
|
jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient, openId);
|
|
|
|
if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
|
for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
|
sendJson.remove("toUser");
|
|
|
|
sendJson.put("toUser", member.getCode());//带参数的模板跳转链接
|
|
|
|
sendJson.remove("url");
|
|
|
|
sendJson.put("url", url+ "&openid=" + member.getOpenid() +"&toUser=" + member.getCode() + "&toName=" +name);
|
|
|
|
//name患者姓名
|
|
|
|
sendJson.put("first", weiXinOpenIdUtils.getTitleMes(people, (int) j.get("relation"), name) + first);
|
|
|
|
pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11, member.getOpenid(), name, sendJson);
|
|
|
|
|
|
if (StringUtils.isEmpty(openId)){
|
|
|
|
jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient, openId);
|
|
|
|
if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
|
for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
|
JSONObject newJson = new JSONObject();
|
|
|
|
newJson.put("keyword1", "血糖测量");
|
|
|
|
newJson.put("keyword2", dateFormat.format(new Date()));
|
|
|
|
newJson.put("remark", remark);
|
|
|
|
newJson.put("toUser", member.getCode());//带参数的模板跳转链接
|
|
|
|
newJson.put("url", url+ "&openid=" + member.getOpenid() +"&toUser=" + member.getCode() + "&toName=" +name);
|
|
|
|
//name患者姓名
|
|
|
|
newJson.put("first", weiXinOpenIdUtils.getTitleMes(people, (int) j.get("relation"), name) + first);
|
|
|
|
pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11, member.getOpenid(), name, newJson);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
logger.info("sendJson: " + sendJson);
|
|
logger.info("sendJson: " + sendJson);
|
|
@ -94,19 +99,22 @@ public class DoctorFeldsherTemplateService extends BaseService {
|
|
sendJson.put("toUser", patient);//带参数的模板跳转链接
|
|
sendJson.put("toUser", patient);//带参数的模板跳转链接
|
|
pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11, openId, name, sendJson);
|
|
pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11, openId, name, sendJson);
|
|
//发送代理人
|
|
//发送代理人
|
|
jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient, openId);
|
|
|
|
if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
|
for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
|
JSONObject data = sendJson;
|
|
|
|
data.remove("toUser");
|
|
|
|
data.put("toUser", member.getCode());//带参数的模板跳转链接
|
|
|
|
data.remove("url");
|
|
|
|
data.put("url", url+ "&openid=" + member.getOpenid() +"&toUser=" + member.getCode() + "&toName=" +name);
|
|
|
|
//name患者姓名
|
|
|
|
data.put("first", weiXinOpenIdUtils.getTitleMes(people, (int) j.get("relation"), name) + first);
|
|
|
|
pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11, member.getOpenid(), name, data);
|
|
|
|
|
|
if (StringUtils.isEmpty(openId)){
|
|
|
|
jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient, openId);
|
|
|
|
if (jsonArray != null && jsonArray.length() > 0) {
|
|
|
|
for (int i = 0; i < jsonArray.length(); i++) {
|
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
|
JSONObject newJson = new JSONObject();
|
|
|
|
newJson.put("keyword1", "血压测量");
|
|
|
|
newJson.put("keyword2", dateFormat.format(new Date()));
|
|
|
|
newJson.put("remark", remark);
|
|
|
|
newJson.put("toUser", member.getCode());//带参数的模板跳转链接
|
|
|
|
newJson.put("url", url+ "&openid=" + member.getOpenid() +"&toUser=" + member.getCode() + "&toName=" +name);
|
|
|
|
//name患者姓名
|
|
|
|
newJson.put("first", weiXinOpenIdUtils.getTitleMes(people, (int) j.get("relation"), name) + first);
|
|
|
|
pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11, member.getOpenid(), name, newJson);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
logger.info("sendJson: " + sendJson);
|
|
logger.info("sendJson: " + sendJson);
|