|
@ -8,6 +8,7 @@ import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeamMember;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
import com.yihu.wlyy.entity.patient.SignFamilyRenew;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorTeamMemberDao;
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyRenewDao;
|
|
@ -64,6 +65,8 @@ public class SignWebService extends BaseService {
|
|
|
private WeiXinOpenIdUtils weiXinOpenIdUtils;
|
|
|
@Autowired
|
|
|
private SignFamilyRenewDao signFamilyRenewDao;
|
|
|
@Autowired
|
|
|
private DoctorDao doctorDao;
|
|
|
/**
|
|
|
* 根据医生代码及签约状态编码 获取该医生签约患者的信息列表
|
|
|
*
|
|
@ -1031,4 +1034,63 @@ public class SignWebService extends BaseService {
|
|
|
rs.put("guidanceResult",guidanceResult);
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 提醒用户续签约
|
|
|
* @param access_token
|
|
|
* @param patientCode
|
|
|
* @param doctor
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public int remainPatientRenew(String access_token,String patientCode,String doctor)throws Exception{
|
|
|
|
|
|
Doctor d = doctorDao.findByCode(doctor);
|
|
|
if(doctor==null){
|
|
|
return -1;
|
|
|
}
|
|
|
//发送微信模板消息
|
|
|
Patient p = patientService.findByCode(patientCode);
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.put("keyword1", "续签家庭医生");
|
|
|
json.put("keyword2", DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
|
|
|
json.put("remark","提醒医生 :"+d.getName()+"\n"
|
|
|
+"我们将继续为您提供优质的健康服务。");
|
|
|
String openid = p.getOpenid();
|
|
|
String name = p.getName();
|
|
|
|
|
|
if(StringUtils.isNotBlank(openid)){
|
|
|
json.put("first",name+",您好!\n" +
|
|
|
"您的家庭医生签约将于7月31日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。");
|
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 16, openid, name, json);
|
|
|
patientSetReminFlag(patientCode);
|
|
|
return 1;
|
|
|
}else{
|
|
|
//如果自己没有绑定,则发给家人
|
|
|
JSONObject j = weiXinOpenIdUtils.getFamilyOpenId(patientCode);
|
|
|
Patient member = (Patient)j.get("member");
|
|
|
if(StringUtils.isNotBlank(member.getOpenid())){
|
|
|
json.put("first",weiXinOpenIdUtils.getTitleMes(p,(int)j.get("relation"),member.getName())+"\n"+
|
|
|
name+",您好!\n" +
|
|
|
"您的家庭医生签约将于7月31日到期,为了能继续给您提供健康服务,诚邀您续签家庭医生。");
|
|
|
PushMsgTask.getInstance().putWxMsg(access_token, 16, member.getOpenid(), member.getName(), json);
|
|
|
patientSetReminFlag(patientCode);
|
|
|
return 1;
|
|
|
}else{
|
|
|
//发送短信
|
|
|
String mobile = p.getMobile();
|
|
|
if(StringUtils.isNotBlank(mobile)){
|
|
|
SMSService.sendMsg(mobile,name+"您好!您的家庭医生将于7月31日到期,为了继续给您提供健康服务,请关注“厦门i健康”公众号,回复“续签”,进行家庭医生线上续签。");
|
|
|
patientSetReminFlag(patientCode);
|
|
|
return 2;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
public void patientSetReminFlag(String patient){
|
|
|
String dateKey = DateUtil.dateToStr(new Date(),"yyyyMMdd");
|
|
|
redisTemplate.opsForValue().set("renew:"+dateKey+":"+patient,"1");
|
|
|
}
|
|
|
}
|