Browse Source

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

trick9191 8 years ago
parent
commit
7f71e9855c

+ 9 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java

@ -67,6 +67,12 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
    @Query("select a from SignFamily a,DoctorTeamMember w where a.teamCode = w.team and w.del = '1' and w.memberCode = ?1 and a.patient = ?2 and a.status > 0")
    List<SignFamily> findByDoctorAndPatient(String doctor, String patient);
    @Query(value = "select a from SignFamily a where a.doctor =?1 and a.patient = ?2 and a.status =0 and a.signYear =?3")
    List<SignFamily> findByDoctorAndPatientOverDue(String doctor,String patient,String signYear);
    @Query(value = "select a from SignFamily a where a.doctorHealth =?1 and a.patient = ?2 and a.status =0 and a.signYear =?3")
    List<SignFamily> findByDoctorHealthAndPatient(String doctorHealth,String patient,String signYear);
    @Query("select a from SignFamily a where a.doctor = ?1 and a.patient = ?2 and a.status = 1 and a.type = 2")
    SignFamily findByFamilyDoctorAndPatient(String doctor, String patient);
@ -271,6 +277,9 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
    @Query("select a from SignFamily a where a.patient = ?1 and a.type = 2 and a.status in (0,1,2)")
    SignFamily findFamilySignByPatient(String patientCode);
    @Query("select a from SignFamily a where a.patient = ?1 and a.type = 2 and a.status =-4 and a.signYear =?2")
    SignFamily findFamilySignByPatientOverDue(String patientCode,String signYear);
    @Query("select p.code, p.name, p.photo, p.birthday, p.sex, p.diseaseCondition, p.disease, p.recordAmount,a.type,a.applyDate,p.idcard from SignFamily a,Patient p where (a.doctor = ?1 or a.doctorHealth = ?1) and a.patient = p.code and a.status in (1,2,3)")
    List<Object> findDoctorSignPatients(String doctor);

+ 4 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyRenewDao.java

@ -27,10 +27,11 @@ public interface SignFamilyRenewDao extends PagingAndSortingRepository<SignFamil
    @Query(value = "select a from SignFamilyRenew a where a.patient = ?1 and a.status <> -1 and a.status <> -2")
    List<SignFamilyRenew> findAllActiveSignByPatient(String patient);
    @Query(value = "select a from SignFamilyRenew a where a.doctor =?1 and a.patient = ?2 ")
    List<SignFamilyRenew> findByDoctorAndPatient(String doctor,String patient);
    @Query(value = "select a from SignFamilyRenew a where a.doctor =?1 and a.patient = ?2 and a.signYear =?3")
    List<SignFamilyRenew> findByDoctorAndPatient(String doctor,String patient,String signYear);
    List<SignFamilyRenew> findByDoctorHealthAndPatient(String doctorHealth,String patient);
    @Query(value = "select a from SignFamilyRenew a where a.doctorHealth =?1 and a.patient = ?2 and a.signYear =?3")
    List<SignFamilyRenew> findByDoctorHealthAndPatient(String doctorHealth,String patient,String signYear);
    // 查询患者已生效的家庭续签约
    @Query("select a from SignFamilyRenew a where a.patient = ?1 and a.type = 2 and a.status = 0")

+ 249 - 12
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -32,9 +32,11 @@ import com.yihu.wlyy.task.SignUploadTask;
import com.yihu.wlyy.util.*;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.CachedIntrospectionResults;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
@ -154,8 +156,8 @@ public class FamilyContractService extends BaseService {
     * @param patient
     * @return
     */
    public SignFamilyRenew findSigningRenewByPatient(String patient) {
        return signFamilyRenewDao.findSigningByPatient(patient);
    public SignFamily findSigningRenewByPatient(String patient) {
        return signFamilyDao.findSigningByPatient(patient);
    }
    /**
     * 查询医院列表
@ -2921,11 +2923,11 @@ public class FamilyContractService extends BaseService {
            return -1;
        }
        List<SignFamilyRenew> sc = signFamilyRenewDao.findByIdcard(p.getIdcard());
        //判断身份证号是否已签约
        if (sc != null&&sc.size()>0) {
            return -2;
        }
//        List<SignFamilyRenew> sc = signFamilyRenewDao.findByIdcard(p.getIdcard());
//        //判断身份证号是否已签约
//        if (sc != null&&sc.size()>0) {
//            return -2;
//        }
        Doctor d = doctorDao.findByCode(doctor);
        Doctor hd = doctorDao.findByCode(healthDoctor);
@ -2934,8 +2936,14 @@ public class FamilyContractService extends BaseService {
            return -3;
        }
        SignFamilyRenew sf = new SignFamilyRenew();
        Calendar cal = Calendar.getInstance();
        int year =cal.get(Calendar.YEAR);
        int month = cal.get(Calendar.MONTH)+1;
        String sql = "";
        //判断是否有生效记录SQL
        String sql = "SELECT t.doctor,t.team_code teamCode,t.admin_team_code adminTeamCode FROM wlyy_sign_family t WHERE t.patient ='" + patient + "' AND t.status>=0 AND t.expenses_status='1'";
        sql ="SELECT t.doctor,t.team_code teamCode,t.admin_team_code adminTeamCode FROM wlyy_sign_family t WHERE t.patient ='" + patient + "' AND t.status>=0 AND t.expenses_status='1' AND t.sign_year ='"+(year-1)+"'";
        List<Map<String,Object>> signs = jdbcTemplate.queryForList(sql);
        if(signs==null||signs.size()==0){
            return -4;
@ -2945,7 +2953,8 @@ public class FamilyContractService extends BaseService {
        if(doctor.equals((String)sign.get("doctor"))){
            //如果一致保存团队信息
            sf.setTeamCode((String)sign.get("teamCode"));
            sf.setAdminTeamId((Long)sign.get("adminTeamId"));
            Integer c=(Integer)sign.get("adminTeamCode");
            sf.setAdminTeamId(c.longValue());
        }else {
            //如果不一致 查看医生团队
            String tcSql = "SELECT t.id FROM wlyy_admin_team t WHERE t.leader_code ='"+doctor+"'";
@ -3037,8 +3046,7 @@ public class FamilyContractService extends BaseService {
        sf.setSignSource("2");//签约来源【1 社区签约 2 移动签约】
        //******************扣费接口**********************/
        sf.setExpensesStatus("0");   //扣费状态 【0未扣费 1已扣费 2已退费】
        Calendar cal = Calendar.getInstance();
        int year =cal.get(Calendar.YEAR);
        sf.setSignYear(year+"");
        sf.setIsValid(0);
        sf.setBegin(new Date());
@ -3063,7 +3071,176 @@ public class FamilyContractService extends BaseService {
            message.setSignStatus("8");//续签
            message.setSex(p.getSex());
            message.setOver("1");//未处理
            message.setData(temp.getCode());
            message.setData(sf.getCode());
            messageDao.save(message);
            // 发送消息给医生
            JSONObject jsonObject = doctorWorkTimeService.isDoctorWorking(doctor);
            if (jsonObject.getString("status").equals("1")) {
                //如果在工作时间内就推送
                PushMsgTask.getInstance().put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.D_SW_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.家庭签约.name(), p.getName()+"申请与您续签家庭医生", patient);
            }
        }
        return 1;
    }
    /**
     * 续签申请(7月之后)
     *
     * @param doctor  签约医生
     * @param patient 居民code
     * @return
     */
    @Transactional
    public int signRenewOverdue(String doctor,String healthDoctor, String patient) throws Exception {
        Patient p = patientDao.findByCode(patient);
        if (p == null) {
            return -1;
        }
        Doctor d = doctorDao.findByCode(doctor);
        Doctor hd = doctorDao.findByCode(healthDoctor);
        if (d == null) {
            return -3;
        }
        SignFamily sf = new SignFamily();
        Calendar cal = Calendar.getInstance();
        int year =cal.get(Calendar.YEAR);
        int month = cal.get(Calendar.MONTH)+1;
        String sql  ="SELECT t.doctor,t.team_code teamCode,t.admin_team_code adminTeamCode FROM wlyy_sign_family t WHERE t.patient ='" + patient + "' AND t.status=-4 AND t.expenses_status='1' AND t.sign_year ='"+(year-1)+"'";
        List<Map<String,Object>> signs = jdbcTemplate.queryForList(sql);
        if(signs==null||signs.size()==0){
            return -4;
        }
        Map<String,Object> sign = signs.get(0);
        //判断续签医生是否一致
        if(doctor.equals((String)sign.get("doctor"))){
            //如果一致保存团队信息
            sf.setTeamCode((String)sign.get("teamCode"));
            Integer c=(Integer)sign.get("adminTeamCode");
            sf.setAdminTeamId(c.longValue());
        }else {
            //如果不一致 查看医生团队
            String tcSql = "SELECT t.id FROM wlyy_admin_team t WHERE t.leader_code ='"+doctor+"'";
            List<Map<String ,Object>> ids = jdbcTemplate.queryForList(tcSql);
            if(ids!=null&&ids.size()>0){
                Integer id =  (Integer)ids.get(0).get("id");
                Long lid = id.longValue();
                sf.setAdminTeamId(lid);
            }else{
                //未找到团队信息
                return -5;
            }
            //新建咨询团队组
            DoctorTeam team = new DoctorTeam();
            String code = getCode();
            team.setCode(code);
            team.setCzrq(new Date());
            team.setDel("1");
            team.setSignType("2");
            //判断是否有健康管理师
            if(hd!=null&&StringUtils.isNotBlank(hd.getName())){
                team.setName(d.getName()+","+hd.getName()+","+p.getName());
                //新建健康管理师
                DoctorTeamMember hdmb = new DoctorTeamMember();
                hdmb.setName(hd.getName());
                hdmb.setMemberCode(healthDoctor);
                hdmb.setCode(getCode());
                hdmb.setDel("1");
                hdmb.setCzrq(new Date());
                hdmb.setTeam(code);
                hdmb.setType(hd.getLevel());
                hdmb.setSignType("2");
                doctorTeamDoctor.save(hdmb);
            }else{
                team.setName(d.getName()+","+p.getName());
            }
            //新建医生成员
            DoctorTeamMember dmb = new DoctorTeamMember();
            dmb.setName(d.getName());
            dmb.setMemberCode(doctor);
            dmb.setCode(getCode());
            dmb.setDel("1");
            dmb.setCzrq(new Date());
            dmb.setTeam(code);
            dmb.setType(d.getLevel());
            dmb.setSignType("2");
            //新建病人
            DoctorTeamMember pmb = new DoctorTeamMember();
            pmb.setName(p.getName());
            pmb.setMemberCode(patient);
            pmb.setCode(getCode());
            pmb.setDel("1");
            pmb.setCzrq(new Date());
            pmb.setTeam(code);
            pmb.setType(5);
            pmb.setSignType("2");
            doctorTeamDoctor.save(dmb);
            doctorTeamDoctor.save(pmb);
            doctorTeamDao.save(team);
            //关联新团队
            sf.setTeamCode(code);
        }
        sf.setCode(getCode());
        sf.setCzrq(new Date());
        sf.setPatientApplyDate(new Date());
        if(d!=null){
            sf.setDoctor(doctor);
            sf.setDoctorName(d.getName());
        }
        if(hd!=null){
            sf.setDoctorHealth(healthDoctor);
            sf.setDoctorHealthName(hd.getName());
        }
        sf.setMobile(p.getMobile());
        sf.setName(p.getName());
        sf.setIdcard(p.getIdcard());
        sf.setOpenid(p.getOpenid());
        sf.setPatient(patient);
        sf.setHospital(d.getHospital());
        sf.setHospitalName(d.getHospitalName());
        sf.setSsc(p.getSsc());
        sf.setStatus(0);//0为初始状态
        sf.setType(2);// 设置为家庭签约
        sf.setSignType("1");//用户申请
        sf.setSignSource("2");//签约来源【1 社区签约 2 移动签约】
        //******************扣费接口**********************/
        sf.setExpensesStatus("0");   //扣费状态 【0未扣费 1已扣费 2已退费】
        sf.setSignYear(year+"");
        sf.setBegin(new Date());
        sf.setEnd(DateUtil.stringToDate(year+1+"-07-01 00:00:00","yyyy-MM-dd HH:mmm:ss"));
        SignFamily temp = signFamilyDao.save(sf);
        if (temp != null) {
            // 添加签约消息
            Message message = new Message();
            message.setCzrq(new Date());
            message.setCreateTime(new Date());
            message.setContent("您有一条新的家庭医生续签申请!");
            message.setRead(1);//设置未读
            message.setReceiver(doctor);//设置接受医生的code
            message.setSender(patient);//设置发送的用户
            message.setSenderName(p.getName());
            message.setCode(getCode());
            message.setSenderPhoto(p.getPhoto());
            message.setTitle("家庭续签申请");
            message.setType(1);//家庭签约信息
            message.setReadonly(1);//是否只读消息
            message.setSignStatus("8");//续签
            message.setSex(p.getSex());
            message.setOver("1");//未处理
            message.setData(sf.getCode());
            messageDao.save(message);
            // 发送消息给医生
            JSONObject jsonObject = doctorWorkTimeService.isDoctorWorking(doctor);
@ -3095,4 +3272,64 @@ public class FamilyContractService extends BaseService {
        }
        return "";
    }
    public JSONArray getSignDoctorMessageOverDue(String patientCode) {
        JSONArray jsonArray = new JSONArray();
        //找出患者的三师签约信息
        Patient patient = patientDao.findByCode(patientCode);
        Calendar cal = Calendar.getInstance();
        int year = cal.get(Calendar.YEAR);
        //得到家庭签约
        SignFamily jtSignFamily = signFamilyDao.findFamilySignByPatientOverDue(patientCode,(year-1)+"");
        if (jtSignFamily != null) {
            //家庭签约只找全科医生
            Doctor doctor = doctorDao.findByCode(jtSignFamily.getDoctor());
            Doctor doctorHealth = doctorDao.findByCode(jtSignFamily.getDoctorHealth());
            if (doctor != null) {
                JSONObject jo = new JSONObject();
                jo.put("code", doctor.getCode());
                jo.put("sex", doctor.getSex());
                jo.put("name", doctor.getName());
                jo.put("photo", doctor.getPhoto());
                jo.put("hosptialName", doctor.getHospitalName());
                jo.put("level", doctor.getLevel());
                jo.put("signType", "2");//三师签约
                jo.put("signStatus", jtSignFamily.getStatus());
                jo.put("jobName", doctor.getJobName());
                jo.put("disease", patient.getDisease());//0健康,1高血压,2糖尿病,3高血压+糖尿病
                if (jtSignFamily.getStatus() == 0) {
                    jo.put("sqDate", DateUtil.dateToStrShort(jtSignFamily.getPatientApplyDate()));//申请时间
                } else {
                    jo.put("qyDate", DateUtil.dateToStrShort(jtSignFamily.getBegin()));//签约时间
                    jo.put("endDate", DateUtil.dateToStrShort(jtSignFamily.getEnd()));//结束时间
                }
                jsonArray.put(jo);
            }
            if (doctorHealth != null) {
                JSONObject jo = new JSONObject();
                jo.put("code", doctorHealth.getCode());
                jo.put("sex", doctorHealth.getSex());
                jo.put("name", doctorHealth.getName());
                jo.put("photo", doctorHealth.getPhoto());
                jo.put("hosptialName", doctorHealth.getHospitalName());
                jo.put("level", doctorHealth.getLevel());
                jo.put("signType", "2");//三师签约
                jo.put("signStatus", jtSignFamily.getStatus());
                jo.put("jobName", doctorHealth.getJobName());
                jo.put("disease", patient.getDisease());//0健康,1高血压,2糖尿病,3高血压+糖尿病
                if (jtSignFamily.getStatus() == 0) {
                    jo.put("sqDate", DateUtil.dateToStrShort(jtSignFamily.getPatientApplyDate()));//申请时间
                } else {
                    jo.put("qyDate", DateUtil.dateToStrShort(jtSignFamily.getBegin()));//签约时间
                    jo.put("endDate", DateUtil.dateToStrShort(jtSignFamily.getEnd()));//结束时间
                }
                jsonArray.put(jo);
            }
        }
        return jsonArray;
    }
}

+ 91 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -898,11 +898,12 @@ public class SignWebService extends BaseService {
     * @return
     * @throws Exception
     */
    public int agreeRenew(String access_token,String dotorCode,String patientCode,String state,Long mesId) throws Exception{
        List<SignFamilyRenew> renews =  signFamilyRenewDao.findByDoctorAndPatient(dotorCode,patientCode);
    public int agreeRenew(String access_token,String dotorCode,String patientCode,String state,Long mesId,String signYear) throws Exception{
        List<SignFamilyRenew> renews =  signFamilyRenewDao.findByDoctorAndPatient(dotorCode,patientCode,signYear);
        if(renews==null||renews.size()==0){
            renews =  signFamilyRenewDao.findByDoctorHealthAndPatient(dotorCode,patientCode);
            renews =  signFamilyRenewDao.findByDoctorHealthAndPatient(dotorCode,patientCode,signYear);
        }
        if(renews!=null&&renews.size()>0){
@ -976,6 +977,93 @@ public class SignWebService extends BaseService {
        return 1;
    }
    /**
     * 同意或拒绝签约签约(七月份的流程)
     * @param access_token
     * @param dotorCode
     * @param state 1成功 0拒绝
     * @return
     * @throws Exception
     */
    public int agreeRenewOverDue (String access_token,String dotorCode,String patientCode,String state,Long mesId,String signYear) throws Exception{
        List<SignFamily> renews =  signFamilyDao.findByDoctorAndPatientOverDue(dotorCode,patientCode,signYear);
        if(renews==null||renews.size()==0){
            renews =  signFamilyDao.findByDoctorHealthAndPatient(dotorCode,patientCode,signYear);
        }
        if(renews!=null&&renews.size()>0){
            for(SignFamily renew : renews){
                if(StringUtils.isNotBlank(state)){
                    if ("0".equals(state)){
                        renew.setStatus(-2);
                    }else if("1".equals(state)){
                        renew.setStatus(1);
                    }
                }
                renew.setApplyDate(new Date());
                signFamilyDao.save(renew);
                if(mesId!=null&&mesId>0){
                    Message mes = messageDao.findOne(mesId);
                    mes.setRead(0);//设置已读
                    mes.setOver("0");//设置消息操作结束
                    mes.setCzrq(new Date());
                    messageDao.save(mes);
                }
                //发送微信模板消息
                JSONObject data = new JSONObject();
                data.put("doctorName",renew.getDoctorName());
                data.put("date",DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
                data.put("content","家庭医生续签");
                data.put("doctor",dotorCode);
                data.put("toUser",patientCode);
                data.put("toName",renew.getName());
                Patient patient = patientService.findByCode(renew.getPatient());
                if(patient!=null && StringUtils.isNotBlank(patient.getOpenid())){
                    if ("0".equals(state)){
                        data.put("first",renew.getName()+",您好!\n"+
                                "您的家庭医生续签申请已被拒绝");
                        data.put("remark","您可在到期后选择其他医生进行签约。");
                        PushMsgTask.getInstance().putWxMsg(access_token, 2, patient.getOpenid(), patient.getName(), data);
                    }else if("1".equals(state)){
                        data.put("first",renew.getName()+",您好!\n"+
                                "您的家庭医生续签申请已通过");
                        data.put("remark","待自动扣费成功后,家庭医生将续签成功。");
                        PushMsgTask.getInstance().putWxMsg(access_token, 1, patient.getOpenid(), patient.getName(), data);
                    }
                }else{
                    //如果自己没有绑定,则发给家人
                    JSONObject j = weiXinOpenIdUtils.getFamilyOpenId(patient.getCode());
                    Patient member = (Patient)j.get("member");
                    if(StringUtils.isNotBlank(member.getOpenid())){
                        if ("0".equals(state)){
                            data.put("first",weiXinOpenIdUtils.getTitleMes(patient,(int)j.get("relation"),member.getName())+"\n"+
                                    patient.getName()+",您好!\n" +
                                    "您的家庭医生续签申请已被拒绝");
                            data.put("remark","您可在到期后选择其他医生进行签约。");
                            PushMsgTask.getInstance().putWxMsg(access_token, 2, member.getOpenid(), member.getName(), data);
                        }else if("1".equals(state)){
                            data.put("first",weiXinOpenIdUtils.getTitleMes(patient,(int)j.get("relation"),member.getName())+"\n"+
                                    patient.getName()+",您好!\n" +
                                    "您的家庭医生续签申请已通过");
                            data.put("remark","待自动扣费成功后,家庭医生将续签成功。");
                            PushMsgTask.getInstance().putWxMsg(access_token, 1, member.getOpenid(), member.getName(), data);
                        }
                    }
                }
            }
        }else{
            return 0;
        }
        return 1;
    }
    /**
     * 获取年度列表
     * @return

+ 5 - 4
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java

@ -385,7 +385,7 @@ public class PatientService extends TokenService {
        //用于判断续签表是否有记录QL,有记录则不允许续签
        String sqlRenew = "SELECT t.id,t.sign_year signYear FROM wlyy_sign_family_renew t WHERE t.patient ='" + patient + "' AND t.status>=0 ";
        //判读是否有当前年度的记录SQL
        String signSql = "SELECT t.id,t.sign_year signYear FROM wlyy_sign_family t WHERE t.patient ='" + patient + "' AND t.status>=0 AND t.expenses_status='1' AND t.sign_year ='" + year + "'";
        String signSql = "SELECT t.id,t.sign_year signYear FROM wlyy_sign_family t WHERE t.patient ='" + patient + "' AND t.status>=0  AND t.sign_year ='" + year + "'";
        //判读是否有旧的已到期记录SQL
        String oldSignSql = "SELECT t.id,t.sign_year signYear FROM wlyy_sign_family t WHERE t.patient ='" + patient + "' AND t.status=-4 AND  t.expenses_status='1' AND t.sign_year ='" + (year - 1) + "'";
        //判断时间是否在6月30之前
@ -419,14 +419,14 @@ public class PatientService extends TokenService {
            }
        } else {
            //如果在签约七月份之后判断是否已经生效,判断是否有旧数据
            List<SignFamily> signFamilys1 = jdbcTemplate.queryForList(signSql, SignFamily.class);
            List<Map<String,Object>> signFamilys1 = jdbcTemplate.queryForList(signSql);
            if (signFamilys1 != null && signFamilys1.size() > 0) {
                rs.put("mes", "当前年度已经签约");
                rs.put("code", "-2");
                return rs;
            }
            List<SignFamily> signFamilys2 = jdbcTemplate.queryForList(oldSignSql, SignFamily.class);
            if (signFamilys1 != null && signFamilys1.size() > 0) {
            List<Map<String,Object>> signFamilys2 = jdbcTemplate.queryForList(oldSignSql);
            if (signFamilys2 != null && signFamilys2.size() > 0) {
                rs.put("mes", "可以续签(已到期)");
                rs.put("code", "2");
                return rs;
@ -474,4 +474,5 @@ public class PatientService extends TokenService {
        return "";
    }
}

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

@ -839,12 +839,12 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                // 设置患者联系电话
                json.put("phone", temp.getPhone());
                // 设置患者居住省份
                json.put("provinceName", temp.getProvinceName());
                json.put("cityName", temp.getCityName());
                json.put("townName", temp.getTownName());
                json.put("streetName", temp.getStreetName());
                json.put("provinceName", temp.getProvinceName()==null?"":temp.getProvinceName());
                json.put("cityName", temp.getCityName()==null?"":temp.getCityName());
                json.put("townName", temp.getTownName()==null?"":temp.getTownName());
                json.put("streetName", temp.getStreetName()==null?"":temp.getStreetName());
                // 设置患者地址
                json.put("address", temp.getAddress());
                json.put("address", temp.getAddress()==null?"":temp.getAddress());
                //设置患者医保号
                json.put("ssc", temp.getSsc());
@ -926,7 +926,7 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                    json.put("diseases", "");
                }
                SignFamilyRenew jtSign = familyContractService.findSigningRenewByPatient(patient);
                SignFamily jtSign = familyContractService.findSigningRenewByPatient(patient);
                // 家庭签约
                if (jtSign != null) {

+ 10 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java

@ -447,8 +447,17 @@ public class DoctorSignController extends WeixinBaseController {
                             @RequestParam(required = true)String patient,
                             @RequestParam(required = false) Long mesId ){
        try{
            int rs =signWebService.agreeRenew(getAccessToken(),getUID(),patient,state,mesId);
            Calendar cal = Calendar.getInstance();
            int year = cal.get(Calendar.YEAR);
            int month = cal.get(Calendar.MONTH)+1;
            int rs = 0;
            if(month<7){
                rs =signWebService.agreeRenew(getAccessToken(),getUID(),patient,state,mesId,year+"");
//            int rs =signWebService.agreeRenew(getAccessToken(),"test00000000005",patient,state);
            }else{
                rs =signWebService.agreeRenewOverDue(getAccessToken(),getUID(),patient,state,mesId,year+"");
            }
            if(rs == 0){
                return error(-1, "操作失败");
            }else{

+ 24 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/FamilyContractController.java

@ -22,6 +22,7 @@ import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.CacheControl;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@ -30,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.net.URLDecoder;
import java.util.Calendar;
import java.util.List;
/**
@ -73,6 +75,20 @@ public class FamilyContractController extends BaseController {
        }
    }
    @RequestMapping(value = "getSignMessageOverdue")
    @ResponseBody
    public String getSignDoctorMessageOverDue(String patientCode) {
        try {
            JSONArray array = familyContractService.getSignDoctorMessageOverDue(patientCode);
            return write(200, "获取列表成功!", "list", array);
        } catch (Exception e) {
            error(e);
            return error(-1, "获取列表失败!");
        }
    }
    /**
     * 社区医院列表查询接口
@ -479,8 +495,15 @@ public class FamilyContractController extends BaseController {
            if (StringUtils.isEmpty(doctor)) {
                return error(-1, "签约医生不能为空");
            }
            Calendar cal = Calendar.getInstance();
            int month = cal.get(Calendar.MONTH)+1;
            int result = -1;
            if(month<7){
                result = familyContractService.signRenew(doctor,healthDoctor,patient);
            }else{
                result = familyContractService.signRenewOverdue(doctor,healthDoctor,patient);
            }
            int result = familyContractService.signRenew(doctor,healthDoctor,patient);
            if (result == -1) {
                return error(-1, "用户信息查询失败");