|
@ -1058,38 +1058,69 @@ public class SignWebService extends BaseService {
|
|
|
|
|
|
if (signFamilies != null && signFamilies.size() > 0) {
|
|
if (signFamilies != null && signFamilies.size() > 0) {
|
|
for (Map<String, Object> signFamily : signFamilies) {
|
|
for (Map<String, Object> signFamily : signFamilies) {
|
|
|
|
boolean flag = true;
|
|
String openid = (String) signFamily.get("openid");
|
|
String openid = (String) signFamily.get("openid");
|
|
String name = (String) signFamily.get("name");
|
|
String name = (String) signFamily.get("name");
|
|
String doctorName = (String) signFamily.get("doctorName");
|
|
String doctorName = (String) signFamily.get("doctorName");
|
|
JSONObject json = new JSONObject();
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
|
|
|
String patient = (String) signFamily.get("code");
|
|
|
|
json.put("toUser", patient);
|
|
|
|
json.put("represented",patient);//被代理人
|
|
json.put("keyword1", "续签家庭医生");
|
|
json.put("keyword1", "续签家庭医生");
|
|
json.put("keyword2", DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
|
|
json.put("keyword2", DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
|
|
json.put("remark", "提醒医生 :" + doctorName + "\n"
|
|
json.put("remark", "提醒医生 :" + doctorName + "\n"
|
|
+ "我们将继续为您提供优质的健康服务。");
|
|
+ "我们将继续为您提供优质的健康服务。");
|
|
if (StringUtils.isNotBlank(openid)) {
|
|
if (StringUtils.isNotBlank(openid)) {
|
|
|
|
flag = false;
|
|
json.put("first", name + ",您好!\n" +
|
|
json.put("first", name + ",您好!\n" +
|
|
"您的家庭医生签约将于6月30日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。");
|
|
"您的家庭医生签约将于6月30日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。");
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 16, openid, name, json);
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 16, openid, name, json);
|
|
} else {
|
|
|
|
//如果自己没有绑定,则发给家人
|
|
|
|
String code = (String) signFamily.get("code");
|
|
|
|
JSONObject j = weiXinOpenIdUtils.getFamilyOpenId(code);
|
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
|
Patient p = patientService.findByCode(code);
|
|
|
|
if (StringUtils.isNotBlank(member.getOpenid())) {
|
|
|
|
|
|
}
|
|
|
|
//发送代理人
|
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient,openid);
|
|
|
|
if(jsonArray!=null&&jsonArray.length()>0){
|
|
|
|
Patient p = patientService.findByCode(patient);
|
|
|
|
for (int i = 0;i<jsonArray.length();i++){
|
|
|
|
flag = false;
|
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
|
JSONObject data = json;
|
|
|
|
data.remove("toUser");
|
|
|
|
data.put("toUser",member.getCode());
|
|
json.put("first", weiXinOpenIdUtils.getTitleMes(p, (int) j.get("relation"), p.getName()) + "\n" +
|
|
json.put("first", weiXinOpenIdUtils.getTitleMes(p, (int) j.get("relation"), p.getName()) + "\n" +
|
|
name + ",您好!\n" +
|
|
name + ",您好!\n" +
|
|
"您的家庭医生签约将于6月30日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。");
|
|
"您的家庭医生签约将于6月30日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。");
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 16, member.getOpenid(), p.getName(), json);
|
|
|
|
} else {
|
|
|
|
//发送短信
|
|
|
|
String mobile = (String) signFamily.get("mobile");
|
|
|
|
if (StringUtils.isNotBlank(mobile)) {
|
|
|
|
SMSService.sendMsg(mobile, name + "您好!您的家庭医生将于6月30日到期,为了继续给您提供健康服务,请关注“厦门i健康”公众号,回复“续签”,进行家庭医生线上续签。");
|
|
|
|
}
|
|
|
|
|
|
PushMsgTask.getInstance().putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 8, member.getOpenid(), p.getName(), data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(flag){
|
|
|
|
//发送短信
|
|
|
|
String mobile = (String) signFamily.get("mobile");
|
|
|
|
if (StringUtils.isNotBlank(mobile)) {
|
|
|
|
SMSService.sendMsg(mobile, name + "您好!您的家庭医生将于6月30日到期,为了继续给您提供健康服务,请关注“厦门i健康”公众号,回复“续签”,进行家庭医生线上续签。");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// else {
|
|
|
|
// //如果自己没有绑定,则发给家人
|
|
|
|
// String code = (String) signFamily.get("code");
|
|
|
|
// JSONObject j = weiXinOpenIdUtils.getFamilyOpenId(code);
|
|
|
|
// Patient member = (Patient) j.get("member");
|
|
|
|
// Patient p = patientService.findByCode(code);
|
|
|
|
// if (StringUtils.isNotBlank(member.getOpenid())) {
|
|
|
|
// json.put("first", weiXinOpenIdUtils.getTitleMes(p, (int) j.get("relation"), p.getName()) + "\n" +
|
|
|
|
// name + ",您好!\n" +
|
|
|
|
// "您的家庭医生签约将于6月30日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。");
|
|
|
|
// PushMsgTask.getInstance().putWxMsg(access_token, 16, member.getOpenid(), p.getName(), json);
|
|
|
|
// } else {
|
|
|
|
// //发送短信
|
|
|
|
// String mobile = (String) signFamily.get("mobile");
|
|
|
|
// if (StringUtils.isNotBlank(mobile)) {
|
|
|
|
// SMSService.sendMsg(mobile, name + "您好!您的家庭医生将于6月30日到期,为了继续给您提供健康服务,请关注“厦门i健康”公众号,回复“续签”,进行家庭医生线上续签。");
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
}
|
|
}
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
@ -1141,7 +1172,10 @@ public class SignWebService extends BaseService {
|
|
String name = (String) signFamily.get("name");
|
|
String name = (String) signFamily.get("name");
|
|
String doctorName = (String) signFamily.get("doctorName");
|
|
String doctorName = (String) signFamily.get("doctorName");
|
|
JSONObject json = new JSONObject();
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
|
|
|
Boolean flag = true;
|
|
|
|
String patient = (String) signFamily.get("code");
|
|
|
|
json.put("toUser", patient);
|
|
|
|
json.put("represented",patient);//被代理人
|
|
json.put("keyword1", "续签家庭医生");
|
|
json.put("keyword1", "续签家庭医生");
|
|
json.put("keyword2", DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
|
|
json.put("keyword2", DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
|
|
json.put("remark", "提醒医生 :" + doctorName + "\n"
|
|
json.put("remark", "提醒医生 :" + doctorName + "\n"
|
|
@ -1150,25 +1184,51 @@ public class SignWebService extends BaseService {
|
|
json.put("first", name + ",您好!\n" +
|
|
json.put("first", name + ",您好!\n" +
|
|
"您的家庭医生签约将于6月30日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。");
|
|
"您的家庭医生签约将于6月30日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。");
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 16, openid, name, json);
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 16, openid, name, json);
|
|
} else {
|
|
|
|
//如果自己没有绑定,则发给家人
|
|
|
|
String code = (String) signFamily.get("code");
|
|
|
|
JSONObject j = weiXinOpenIdUtils.getFamilyOpenId(code);
|
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
|
Patient p = patientService.findByCode(code);
|
|
|
|
if (StringUtils.isNotBlank(member.getOpenid())) {
|
|
|
|
|
|
}
|
|
|
|
//发送代理人
|
|
|
|
JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient,openid);
|
|
|
|
if(jsonArray!=null&&jsonArray.length()>0){
|
|
|
|
Patient p = patientService.findByCode(patient);
|
|
|
|
for (int i = 0;i<jsonArray.length();i++){
|
|
|
|
flag = false;
|
|
|
|
JSONObject j = jsonArray.getJSONObject(i);
|
|
|
|
Patient member = (Patient) j.get("member");
|
|
|
|
JSONObject data = json;
|
|
|
|
data.remove("toUser");
|
|
|
|
data.put("toUser",member.getCode());
|
|
json.put("first", weiXinOpenIdUtils.getTitleMes(p, (int) j.get("relation"), p.getName()) + "\n" +
|
|
json.put("first", weiXinOpenIdUtils.getTitleMes(p, (int) j.get("relation"), p.getName()) + "\n" +
|
|
name + ",您好!\n" +
|
|
name + ",您好!\n" +
|
|
"您的家庭医生签约将于6月30日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。");
|
|
"您的家庭医生签约将于6月30日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。");
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 16, member.getOpenid(), p.getName(), json);
|
|
|
|
} else {
|
|
|
|
//发送短信
|
|
|
|
String mobile = (String) signFamily.get("mobile");
|
|
|
|
if (StringUtils.isNotBlank(mobile)) {
|
|
|
|
SMSService.sendMsg(mobile, name + "您好!您的家庭医生将于6月30日到期,为了继续给您提供健康服务,请关注“厦门i健康”公众号,回复“续签”,进行家庭医生线上续签。");
|
|
|
|
}
|
|
|
|
|
|
PushMsgTask.getInstance().putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 16, member.getOpenid(), p.getName(), data);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if(flag){
|
|
|
|
//发送短信
|
|
|
|
String mobile = (String) signFamily.get("mobile");
|
|
|
|
if (StringUtils.isNotBlank(mobile)) {
|
|
|
|
SMSService.sendMsg(mobile, name + "您好!您的家庭医生将于6月30日到期,为了继续给您提供健康服务,请关注“厦门i健康”公众号,回复“续签”,进行家庭医生线上续签。");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// else {
|
|
|
|
// //如果自己没有绑定,则发给家人
|
|
|
|
// String code = (String) signFamily.get("code");
|
|
|
|
// JSONObject j = weiXinOpenIdUtils.getFamilyOpenId(code);
|
|
|
|
// Patient member = (Patient) j.get("member");
|
|
|
|
// Patient p = patientService.findByCode(code);
|
|
|
|
// if (StringUtils.isNotBlank(member.getOpenid())) {
|
|
|
|
// json.put("first", weiXinOpenIdUtils.getTitleMes(p, (int) j.get("relation"), p.getName()) + "\n" +
|
|
|
|
// name + ",您好!\n" +
|
|
|
|
// "您的家庭医生签约将于6月30日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。");
|
|
|
|
// PushMsgTask.getInstance().putWxMsg(access_token, 16, member.getOpenid(), p.getName(), json);
|
|
|
|
// } else {
|
|
|
|
// //发送短信
|
|
|
|
// String mobile = (String) signFamily.get("mobile");
|
|
|
|
// if (StringUtils.isNotBlank(mobile)) {
|
|
|
|
// SMSService.sendMsg(mobile, name + "您好!您的家庭医生将于6月30日到期,为了继续给您提供健康服务,请关注“厦门i健康”公众号,回复“续签”,进行家庭医生线上续签。");
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
}
|
|
}
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|