Browse Source

Merge branch 'dev' of lyr/patient-co-management into dev

lyr 8 years ago
parent
commit
75b71ae15a

+ 338 - 320
patient-co-wlyy/src/main/java/com/yihu/wlyy/entity/doctor/profile/Doctor.java

@ -14,313 +14,318 @@ import com.fasterxml.jackson.annotation.JsonFormat;
/**
 * 医生信息
 *
 * @author George
 */
@Entity
@Table(name = "wlyy_doctor")
public class Doctor extends IdEntity {
	private static final long serialVersionUID = -6585552029939285364L;
    
	private String code;        // 业务主键
	
	private String name;
	private Integer sex;        // 性别(1男,2女)
	private Date birthday;
	private String photo;
	private String mobile;
	private String password;
	private String salt;        // 密码标识
	private Integer status;     // 状态(1正常,0禁用)
	
	private String province;
	private String city;
	private String town;
	private String provinceName;
	private String cityName;
    private static final long serialVersionUID = -6585552029939285364L;
    private String code;        // 业务主键
    private String name;
    private Integer sex;        // 性别(1男,2女)
    private Date birthday;
    private String photo;
    private String mobile;
    private String password;
    private String salt;        // 密码标识
    private Integer status;     // 状态(1正常,0禁用)
    private String province;
    private String city;
    private String town;
    private String provinceName;
    private String cityName;
    private String townName;
	
	private String hospital;        // 医院代码
	private String hospitalName;
	private String dept;            // 科室代码
	private String deptName;
	private String job;             // 职称代码
	private String jobName;         // 职称名
	
	private String expertise;       // 医生专长
	private String introduce;       // 医生介绍
	
	private Integer level;          // 类型:1专科医生,2全科医生,3健康管理师
	private Integer iscertified;   // 资格是否认证通过,1是,0否
    private String hospital;        // 医院代码
    private String hospitalName;
    private String dept;            // 科室代码
    private String deptName;
    private String job;             // 职称代码
    private String jobName;         // 职称名
    private String expertise;       // 医生专长
    private String introduce;       // 医生介绍
    private Integer level;          // 类型:1专科医生,2全科医生,3健康管理师
    private Integer iscertified;   // 资格是否认证通过,1是,0否
    private String qrcode;          // 二维码
	
	private Date czrq;              // 更新时间
	private Integer del;            // 状态(1正常,0删除)
	private String idcard;          //身份证号
	private Integer isFamous;       //是否是名医 1是  0或者空不是
	private String isPasswordPrompt;// 是否提示密码信息 1是 0或者空是否
	private String isHelp;//是否求助  1已经求助 0未求助
	public Doctor() {}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public Doctor(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Integer getSex() {
		return sex;
	}
	public void setSex(Integer sex) {
		this.sex = sex;
	}
	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	public String getPhoto() {
		return photo;
	}
	public void setPhoto(String photo) {
		this.photo = photo;
	}
	public String getMobile() {
		return mobile;
	}
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getSalt() {
		return salt;
	}
	public void setSalt(String salt) {
		this.salt = salt;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	public String getProvince() {
		return province;
	}
	public void setProvince(String province) {
		this.province = province;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public String getTown() {
		return town;
	}
	public void setTown(String town) {
		this.town = town;
	}
	
	@Column(name = "province_name")
	public String getProvinceName() {
		return provinceName;
	}
	public void setProvinceName(String provinceName) {
		this.provinceName = provinceName;
	}
	@Column(name = "city_name")
	public String getCityName() {
		return cityName;
	}
	public void setCityName(String cityName) {
		this.cityName = cityName;
	}
	@Column(name = "town_name")
	public String getTownName() {
		return townName;
	}
	public void setTownName(String townName) {
		this.townName = townName;
	}
	public String getHospitalName() {
		return hospitalName;
	}
	public void setHospitalName(String hospitalName) {
		this.hospitalName = hospitalName;
	}
	@Column(name = "dept_name")
	public String getDeptName() {
		return deptName;
	}
	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}
	@Column(name = "job_name")
	public String getJobName() {
		return jobName;
	}
	public void setJobName(String jobName) {
		this.jobName = jobName;
	}
	public String getHospital() {
		return hospital;
	}
	public void setHospital(String hospital) {
		this.hospital = hospital;
	}
	public String getDept() {
		return dept;
	}
	public void setDept(String dept) {
		this.dept = dept;
	}
	public String getJob() {
		return job;
	}
	public void setJob(String job) {
		this.job = job;
	}
	public String getExpertise() {
		return expertise;
	}
	public void setExpertise(String expertise) {
		this.expertise = expertise;
	}
	public String getIntroduce() {
		return introduce;
	}
	public void setIntroduce(String introduce) {
		this.introduce = introduce;
	}
	public Integer getLevel() {
		return level;
	}
	public void setLevel(Integer level) {
		this.level = level;
	}
    private Date czrq;              // 更新时间
    private Integer del;            // 状态(1正常,0删除)
    private String idcard;          //身份证号
    private Integer isFamous;       //是否是名医 1是  0或者空不是
    private String isPasswordPrompt;// 是否提示密码信息 1是 0或者空是否
    private String isHelp;//是否求助  1已经求助 0未求助
    public Doctor() {
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public Doctor(Long id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Integer getSex() {
        return sex;
    }
    public void setSex(Integer sex) {
        this.sex = sex;
    }
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
    public Date getBirthday() {
        return birthday;
    }
    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getSalt() {
        return salt;
    }
    public void setSalt(String salt) {
        this.salt = salt;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getProvince() {
        return province;
    }
    public void setProvince(String province) {
        this.province = province;
    }
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
    public String getTown() {
        return town;
    }
    public void setTown(String town) {
        this.town = town;
    }
    @Column(name = "province_name")
    public String getProvinceName() {
        return provinceName;
    }
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }
    @Column(name = "city_name")
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    @Column(name = "town_name")
    public String getTownName() {
        return townName;
    }
    public void setTownName(String townName) {
        this.townName = townName;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    @Column(name = "dept_name")
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    @Column(name = "job_name")
    public String getJobName() {
        return jobName;
    }
    public void setJobName(String jobName) {
        this.jobName = jobName;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    public String getJob() {
        return job;
    }
    public void setJob(String job) {
        this.job = job;
    }
    public String getExpertise() {
        return expertise;
    }
    public void setExpertise(String expertise) {
        this.expertise = expertise;
    }
    public String getIntroduce() {
        return introduce;
    }
    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }
    public Integer getLevel() {
        return level;
    }
    public void setLevel(Integer level) {
        this.level = level;
    }
    @Column(name = "iscertified")
    public Integer getIscertified() {
		return iscertified;
	}
	public void setIscertified(Integer isCertified) {
		this.iscertified = isCertified;
	}
	public String getQrcode() {
		return qrcode;
	}
	public void setQrcode(String qrcode) {
		this.qrcode = qrcode;
	}
	// 设定JSON序列化时的日期格式
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getCzrq() {
		return czrq;
	}
	public void setCzrq(Date czrq) {
		this.czrq = czrq;
	}
	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
	@Column(name = "del")
	public Integer getDel() {
		return del;
	}
	public void setDel(Integer del) {
		this.del = del;
	}
	public String getIdcard() {
		return idcard;
	}
	public void setIdcard(String idcard) {
		this.idcard = idcard;
	}
	@Column(name = "is_famous")
	public Integer getIsFamous() {
		return isFamous;
	}
	public void setIsFamous(Integer isFamous) {
		this.isFamous = isFamous;
	}
        return iscertified;
    }
    public void setIscertified(Integer isCertified) {
        this.iscertified = isCertified;
    }
    public String getQrcode() {
        return qrcode;
    }
    public void setQrcode(String qrcode) {
        this.qrcode = qrcode;
    }
    // 设定JSON序列化时的日期格式
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
    @Column(name = "del")
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    @Column(name = "is_famous")
    public Integer getIsFamous() {
        return isFamous;
    }
    public void setIsFamous(Integer isFamous) {
        this.isFamous = isFamous;
    }
    /**
     * 是否为专科医生。
@ -328,8 +333,12 @@ public class Doctor extends IdEntity {
     * @return
     */
    @Transient
	public boolean isProfessionalDoctor(){
	    return level == 1;
    public boolean isProfessionalDoctor() {
        if (level != null && level == 1) {
            return true;
        } else {
            return false;
        }
    }
    /**
@ -338,8 +347,12 @@ public class Doctor extends IdEntity {
     * @return
     */
    @Transient
	public boolean isGeneralDoctor(){
	    return level == 2;
    public boolean isGeneralDoctor() {
        if (level != null && level == 2) {
            return true;
        } else {
            return false;
        }
    }
    /**
@ -348,24 +361,29 @@ public class Doctor extends IdEntity {
     * @return
     */
    @Transient
    public boolean isHealthDoctor(){
        return level == 3;
    }
	@Transient
	public String getIsHelp() {
		return isHelp;
	}
	public void setIsHelp(String isHelp) {
		this.isHelp = isHelp;
	}
	@Column(name = "is_password_prompt")
	public String getIsPasswordPrompt() {
		return isPasswordPrompt;
	}
	public void setIsPasswordPrompt(String isPasswordPrompt) {
		this.isPasswordPrompt = isPasswordPrompt;
	}
    public boolean isHealthDoctor() {
        if (level != null && level == 3) {
            return true;
        } else {
            return false;
        }
    }
    @Transient
    public String getIsHelp() {
        return isHelp;
    }
    public void setIsHelp(String isHelp) {
        this.isHelp = isHelp;
    }
    @Column(name = "is_password_prompt")
    public String getIsPasswordPrompt() {
        return isPasswordPrompt;
    }
    public void setIsPasswordPrompt(String isPasswordPrompt) {
        this.isPasswordPrompt = isPasswordPrompt;
    }
}

+ 145 - 26
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/ExpensesRemindService.java

@ -14,16 +14,19 @@ import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.SendP2PUtil;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import org.apache.commons.collections.FastHashMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@ -34,7 +37,7 @@ import java.util.concurrent.TimeUnit;
 * Created by lyr on 2016/10/24.
 */
@Service
public class ExpensesRemindService extends BaseService {
public class PatientRemindService extends BaseService {
    @Autowired
    SignFamilyDao signFamilyDao;
@ -86,31 +89,37 @@ public class ExpensesRemindService extends BaseService {
     */
    public void RemindAll(Doctor doc, Hospital hos) {
        try {
            String sql = "select distinct a.patient from " +
                    " (select patient,expenses_status,LENGTH(trim(ifnull(expenses_status,''))) len " +
            boolean flag = true;
            int page = 0;
            int start = 0;
            String sql = "select p.* " +
                    "     from " +
                    "        wlyy_sign_family " +
                    "     where "
                    + (doc.getLevel() == 2 ? "doctor" : "doctor_health") + " = ? " +
                    "        and status > 0 " +
                    "        and type = 2 " +
                    "        order by begin desc ) a" +
                    " where a.expenses_status = '0' or a.len < 1";
                    "        wlyy_sign_family f join wlyy_patient p on f.patient = p.code " +
                    "     where " +
                    "        (f.doctor = ? or f.doctor_health = ?) " +
                    "        and f.status > 0 " +
                    "        and f.type = 2 " +
                    "        and (f.expenses_status = '0' or LENGTH(trim(ifnull(f.expenses_status,''))) < 1) " +
                    "     limit ?,3000";
            List<Map<String, Object>> result = jdbcTemplate.queryForList(sql, new Object[]{doc.getCode()});
            while (flag) {
                List<Patient> result = jdbcTemplate.query(sql,new Object[]{doc.getCode(), doc.getCode(), start}, new BeanPropertyRowMapper<Patient>());
            if (result != null && result.size() > 0) {
                for (Map<String, Object> map : result) {
                    Patient p = patientDao.findByCode(String.valueOf(map.get("patient")));
                    if (p != null) {
                        String epTime = redisTemplate.opsForValue().get("expenses:remind:" + p.getCode());
                        if(StringUtils.isNotEmpty(epTime) &&
                                new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime)) {
                            continue;
                if (result != null && result.size() > 0) {
                    for (Patient p : result) {
                        if (p != null) {
                            String epTime = redisTemplate.opsForValue().get("expenses:remind:" + p.getCode());
                            if (StringUtils.isNotEmpty(epTime) &&
                                    new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime)) {
                                continue;
                            }
                            remindPatientExpenses(p, doc, hos, true);
                        }
                        remindPatientExpenses(p, doc, hos, true);
                    }
                    page = page + 1;
                    start = page * 3000;
                } else {
                    flag = false;
                }
            }
        } catch (Exception e) {
@ -147,8 +156,8 @@ public class ExpensesRemindService extends BaseService {
        } catch (Exception e) {
            e.printStackTrace();
            JSONObject reObj = new JSONObject();
            reObj.put("status",-1);
            reObj.put("msg",e.getMessage());
            reObj.put("status", -1);
            reObj.put("msg", e.getMessage());
            return reObj;
        }
    }
@ -199,7 +208,7 @@ public class ExpensesRemindService extends BaseService {
                wFlag = true;
            }
            //发送IM
            SendP2PUtil.sendP2Pmsg(doc.getCode(),p.getCode(),"1",doc.getName() + "医生提醒您:为完成家庭医生签约," +
            SendP2PUtil.sendP2Pmsg(doc.getCode(), p.getCode(), "1", doc.getName() + "医生提醒您:为完成家庭医生签约," +
                    "尽早为您提供家庭医生服务,请尽快到" + hos.getName() + "(地址:" + hos.getAddress() + ")缴费");
            if (ignore) {
                redisTemplate.opsForValue().set("expenses:remind:" + p.getCode(), df.format(new Date()));
@ -237,9 +246,119 @@ public class ExpensesRemindService extends BaseService {
        } catch (Exception e) {
            e.printStackTrace();
            JSONObject reObj = new JSONObject();
            reObj.put("status",-1);
            reObj.put("msg",e.getMessage());
            reObj.put("status", -1);
            reObj.put("msg", e.getMessage());
            return reObj;
        }
    }
    /**
     * 提醒患者关注微信
     *
     * @param patient 患者
     * @param doctor  医生
     * @return
     */
    public JSONObject remindPatientFocusWechat(String patient, String doctor) {
        try {
            Doctor doc = doctorDao.findByCode(doctor);
            if (doc == null) {
                throw new Exception("doctor info can not find");
            }
            Patient p = patientDao.findByCode(patient);
            if (p == null) {
                throw new Exception("patient info can not find");
            }
            Map<String, Object> map = new HashMap<>();
            map.put("code", p.getCode());
            map.put("name", p.getName());
            map.put("mobile", p.getMobile());
            return remindWechatFocus(map, doc);
        } catch (Exception e) {
            e.printStackTrace();
            JSONObject reObj = new JSONObject();
            reObj.put("status", -1);
            reObj.put("msg", e.getMessage());
            return reObj;
        }
    }
    /**
     * 提醒所有患者关注微信
     *
     * @param doctor
     */
    @Async
    public void remindPatientWechatFocusAll(String doctor) throws Exception {
        int page = 0;
        int start = 0;
        boolean flag = true;
        Doctor doc = doctorDao.findByCode(doctor);
        if (doc == null) {
            throw new Exception("doctor info can not find");
        }
        String sql = "select p.code,p.name,p.mobile" +
                "     from " +
                "        wlyy_sign_family f join wlyy_patient p on f.patient = p.code" +
                "     where " +
                "        (f.doctor = ? or f.doctor_health = ?) " +
                "        and f.status > 0 " +
                "        and f.expenses_status = '1' " +
                "        and LENGTH(trim(ifnull(p.openid,''))) < 1 limit ?,3000";
        while (flag) {
            List<Map<String, Object>> result = jdbcTemplate.queryForList(sql, new Object[]{doctor, doctor, start});
            if (result != null && result.size() > 0) {
                for (Map<String, Object> map : result) {
                    remindWechatFocus(map, doc);
                }
                page = page + 1;
                start = page * 3000;
            } else {
                flag = false;
            }
        }
    }
    /**
     * 微信关注提醒
     *
     * @param p
     * @param doctor
     * @return
     */
    public JSONObject remindWechatFocus(Map<String, Object> p, Doctor doctor) {
        JSONObject result = new JSONObject();
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        if (p.get("mobile") == null || StringUtils.isEmpty(p.get("mobile").toString())) {
            result.put("status", -1);
            result.put("msg", "对不起,居民未绑定手机号,无法短信提醒");
            redisTemplate.opsForValue().set("wechat:focus:remind:" + p.get("code").toString(), df.format(new Date()));
            redisTemplate.expire("wechat:focus:remind:" + p.get("code").toString(), 1, TimeUnit.DAYS);
            return result;
        }
        String msg = "尊敬的" + p.get("name").toString() + "," + doctor.getName() + "医生提醒您:" +
                "为更好地为您提供健康服务,请您关注并登录\"厦门i健康\"微信公众号,与医生进行互动。";
        JSONObject smsResult = smsService.sendMsg(p.get("mobile").toString(), msg);
        if (smsResult != null && smsResult.getInt("result") == 0) {
            result.put("status", 1);
            result.put("msg", "提醒成功");
        } else {
            result.put("status", -1);
            result.put("msg", "对不起,短信提醒失败,失败原因:" + smsResult.getString("description"));
        }
        return result;
    }
}

+ 67 - 7
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java

@ -6,16 +6,18 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.app.message.MessageService;
import com.yihu.wlyy.service.app.sign.ExpensesRemindService;
import com.yihu.wlyy.service.app.sign.PatientRemindService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.util.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -60,7 +62,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
    @Autowired
    MessageService messageService;
    @Autowired
    ExpensesRemindService expensesRemindService;
    PatientRemindService patientRemindService;
    @Autowired
    AdminTeamService teamService;
@ -814,7 +816,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                return error(-1, "参数不能同时为空");
            }
            JSONObject result = familyContractService.updateSignInfo(patient, healthDoctor, doctor, expensesType,getUID());
            JSONObject result = familyContractService.updateSignInfo(patient, healthDoctor, doctor, expensesType, getUID());
            if (result.getInt("status") != 1) {
                return error(-1, result.getString("msg"));
@ -870,7 +872,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
    /**
     * 获取没有健康管理师的签约数据数目
     *
     * @param doctor 医生code
     * @param teamCode 团队code
     * @return
     */
    @RequestMapping(value = "/findNoHealthSignFamilyNum")
@ -906,17 +908,33 @@ public class DoctorFamilyContractController extends WeixinBaseController {
            if (StringUtils.isEmpty(patient) && StringUtils.isEmpty(isAll)) {
                return error(-1, "参数不能都为空");
            }
            String status = redisTemplate.opsForValue().get("expenses:remind:doctor:" + getUID());
            status = StringUtils.isEmpty(status) ? "0" : status;
            if (!status.equals("1")) {
                redisTemplate.opsForValue().set("expenses:remind:doctor:" + getUID(), "1");
                redisTemplate.expire("expenses:remind:doctor:" + getUID(), 20, TimeUnit.MINUTES);
            } else {
                return error(-2, "正在提醒中,请勿重复操作");
            }
            if (StringUtils.isNotEmpty(patient)) {
                JSONObject result = expensesRemindService.remindPatientExpenses(patient, getUID());
                JSONObject result = patientRemindService.remindPatientExpenses(patient, getUID());
                redisTemplate.opsForValue().set("expenses:remind:doctor:" + getUID(), "0");
                redisTemplate.expire("expenses:remind:doctor:" + getUID(), 10, TimeUnit.MINUTES);
                return write(result.getInt("status"), result.getString("msg"));
            } else if (StringUtils.isNotEmpty(isAll) && isAll.equals("1")) {
                expensesRemindService.remindPatientExpensesAll(getUID());
                patientRemindService.remindPatientExpensesAll(getUID());
                redisTemplate.opsForValue().set("expenses:remind:doctor:" + getUID(), "0");
                redisTemplate.expire("expenses:remind:doctor:" + getUID(), 10, TimeUnit.MINUTES);
                return error(200, "提醒操作成功");
            } else {
                redisTemplate.opsForValue().set("expenses:remind:doctor:" + getUID(), "0");
                redisTemplate.expire("expenses:remind:doctor:" + getUID(), 10, TimeUnit.MINUTES);
                return write(-1, "参数错误");
            }
        } catch (Exception e) {
            redisTemplate.opsForValue().set("expenses:remind:doctor:" + getUID(), "0");
            redisTemplate.expire("expenses:remind:doctor:" + getUID(), 10, TimeUnit.MINUTES);
            e.printStackTrace();
            return error(-1, "提醒失败");
        }
@ -1038,4 +1056,46 @@ public class DoctorFamilyContractController extends WeixinBaseController {
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value = "/wechat_focus_remind", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    @ApiOperation(value = "微信关注提醒")
    public String wechatFocusRemind(@RequestParam(defaultValue = "") @ApiParam(value = "居民") String patient,
                                    @RequestParam(defaultValue = "") @ApiParam(value = "是否全部(1:全部  0:非全部)") String isAll) {
        try {
            int result = 1;
            String msg = "提醒成功";
            String status = redisTemplate.opsForValue().get("wechat:focus:remind:doctor:" + getUID());
            status = StringUtils.isEmpty(status) ? "0" : status;
            if (!status.equals("1")) {
                redisTemplate.opsForValue().set("wechat:focus:remind:doctor:" + getUID(), "1");
                redisTemplate.expire("wechat:focus:remind:doctor:" + getUID(), 20, TimeUnit.MINUTES);
            } else {
                result = -1;
                msg = "正在提醒中,请勿重复操作";
            }
            if (isAll.equals("1")) {
                patientRemindService.remindPatientWechatFocusAll(getUID());
            } else {
                if (StringUtils.isEmpty(patient)) {
                    result = -1;
                    msg = "请选择需提醒的居民";
                }
                JSONObject json = patientRemindService.remindPatientFocusWechat(patient, getUID());
                result = json.getInt("status");
                msg = json.getString("msg");
            }
            redisTemplate.opsForValue().set("wechat:focus:remind:doctor:" + getUID(), "0");
            redisTemplate.expire("wechat:focus:remind:doctor:" + getUID(), 10, TimeUnit.MINUTES);
            return write(result, msg);
        } catch (Exception e) {
            redisTemplate.opsForValue().set("wechat:focus:remind:doctor:" + getUID(), "0");
            redisTemplate.expire("wechat:focus:remind:doctor:" + getUID(), 10, TimeUnit.MINUTES);
            e.printStackTrace();
            return error(-1, "微信关注提醒失败");
        }
    }
}