Browse Source

续签流程bug修改

trick9191 8 năm trước cách đây
mục cha
commit
fdc0ae68d4

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

@ -76,6 +76,12 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
    @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(value = "select a from SignFamily a where a.doctor =?1 and a.patient = ?2 and a.signYear =?3 and a.status = 1 and a.expensesStatus ='1'")
    List<SignFamily> findByDoctorAndPatientIsValid(String doctor,String patient,String signYear);
    @Query(value = "select a from SignFamily a where a.doctorHealth =?1 and a.patient = ?2 and a.signYear =?3 and a.status = 1 and a.expensesStatus ='1'")
    List<SignFamily> findByDoctorHealthAndPatientIsValid(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);

+ 6 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyRenewDao.java

@ -30,6 +30,12 @@ public interface SignFamilyRenewDao extends PagingAndSortingRepository<SignFamil
    @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);
    @Query(value = "select a from SignFamilyRenew a where a.doctor =?1 and a.patient = ?2 and a.signYear =?3 and a.status = 1 and a.expensesStatus ='1'")
    List<SignFamilyRenew> findByDoctorAndPatientIsValid(String doctor,String patient,String signYear);
    @Query(value = "select a from SignFamilyRenew a where a.doctorHealth =?1 and a.patient = ?2 and a.signYear =?3 and a.status = 1 and a.expensesStatus ='1'")
    List<SignFamilyRenew> findByDoctorHealthAndPatientIsValid(String doctorHealth,String patient,String signYear);
    @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);

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

@ -1102,34 +1102,36 @@ public class FamilyContractService extends BaseService {
        }
        String doctorTeamCode = null;//服务团队的CODE;
        if (type == 1) {
            //2017-5-27 屏蔽三师签约判断
            //判断是否有三师签约 并且判断全科医生一致
            SignFamily sssignFamily = signFamilyDao.findSSByIdcard(p.getIdcard());
            if (sssignFamily != null) {
                if (StringUtils.isNotEmpty(doctor)) {
                    if (!doctor.equals(sssignFamily.getDoctor())) {
                        result.put("status", -2);
                        result.put("msg", "居民已签约三师,故全科医生只可为" + sssignFamily.getDoctorName() + "医生,请重新选择全科医生");
                        return result;
                    }
                    List<AdminTeam> teams = adminTeamService.findDoctorsTeams(sf.getDoctorHealth(), sssignFamily.getDoctor());
                    if (teams == null || teams.size() < 1) {
                        result.put("status", -4);
                        result.put("msg", "居民已签约三师,三师签约的全科医生" + sssignFamily.getDoctorName() + "与该签约申请的健管师" + sf.getDoctorHealthName() + "不在同一个团队,该签约申请已失效");
                        messageService.readHealth(msgid);
                        updateSignStatus(p.getIdcard());
                        return result;
                    }
                }
                if (StringUtils.isNotEmpty(healthDoctor) && !sf.getDoctor().equals(sssignFamily.getDoctor())) {
                    result.put("status", -3);
                    result.put("msg", "对不起,居民已签约三师,故只可与" + sssignFamily.getDoctorName() + "医生签约,该签约申请已失效");
                    messageService.readHealth(msgid);
                    updateSignStatus(p.getIdcard());
                    return result;
                }
            }
//            SignFamily sssignFamily = signFamilyDao.findSSByIdcard(p.getIdcard());
//
//            if (sssignFamily != null) {
//                if (StringUtils.isNotEmpty(doctor)) {
//                    if (!doctor.equals(sssignFamily.getDoctor())) {
//                        result.put("status", -2);
//                        result.put("msg", "居民已签约三师,故全科医生只可为" + sssignFamily.getDoctorName() + "医生,请重新选择全科医生");
//                        return result;
//                    }
//                    List<AdminTeam> teams = adminTeamService.findDoctorsTeams(sf.getDoctorHealth(), sssignFamily.getDoctor());
//
//                    if (teams == null || teams.size() < 1) {
//                        result.put("status", -4);
//                        result.put("msg", "居民已签约三师,三师签约的全科医生" + sssignFamily.getDoctorName() + "与该签约申请的健管师" + sf.getDoctorHealthName() + "不在同一个团队,该签约申请已失效");
//                        messageService.readHealth(msgid);
//                        updateSignStatus(p.getIdcard());
//                        return result;
//                    }
//                }
//                if (StringUtils.isNotEmpty(healthDoctor) && !sf.getDoctor().equals(sssignFamily.getDoctor())) {
//                    result.put("status", -3);
//                    result.put("msg", "对不起,居民已签约三师,故只可与" + sssignFamily.getDoctorName() + "医生签约,该签约申请已失效");
//                    messageService.readHealth(msgid);
//                    updateSignStatus(p.getIdcard());
//                    return result;
//                }
//            }
            //List<SystemDict> systemDicts = systemDictDao.findByDictName("SIGN_YEAR");
            Calendar cal = Calendar.getInstance();
@ -1175,7 +1177,7 @@ public class FamilyContractService extends BaseService {
            sf.setBegin(begin.getTime());
            sf.setEnd(end.getTime());
            //签约类型:1三师签约,2家庭签约
            // 改为签约生效
            sf.setStatus(1);
            sf.setSignType("1");//患者发起签约
@ -1209,7 +1211,7 @@ public class FamilyContractService extends BaseService {
            //建立团队
            DoctorTeam doctorTeam = new DoctorTeam();
            doctorTeamCode = getCode();
            doctorTeam.setName("三师签约团队患者:" + p.getName());
            doctorTeam.setName("签约团队患者:" + p.getName());
            doctorTeam.setCode(doctorTeamCode);
            doctorTeam.setCzrq(new Date());
            doctorTeam.setSignType("2");

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

@ -1231,4 +1231,26 @@ public class SignWebService extends BaseService {
        String dateKey = DateUtil.dateToStr(new Date(),"yyyyMMdd");
        redisTemplate.opsForValue().set("renew:"+dateKey+":"+patient,"1");
    }
    //判断用户当前年度是否有已经付费的签约记录
    public int checkNowYearSign(String doctor,String patient){
        List<SignFamilyRenew> renews1 = signFamilyRenewDao.findByDoctorAndPatientIsValid(doctor,patient,DateUtil.getNowYear()+"");
        if(renews1!=null&&renews1.size()>0){
            return 0;
        }
        List<SignFamilyRenew> renews2 = signFamilyRenewDao.findByDoctorHealthAndPatientIsValid(doctor,patient,DateUtil.getNowYear()+"");
        if(renews2!=null&&renews2.size()>0){
            return 0;
        }
        List<SignFamily> sign1 = signFamilyDao.findByDoctorAndPatientIsValid(doctor,patient,DateUtil.getNowYear()+"");
        if(sign1!=null&&sign1.size()>0){
            return 0;
        }
        List<SignFamily> sign2 = signFamilyDao.findByDoctorHealthAndPatientIsValid(doctor,patient,DateUtil.getNowYear()+"");
        if(sign2!=null&&sign2.size()>0){
            return 0;
        }
        return 1;
    }
}

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

@ -447,6 +447,12 @@ public class DoctorSignController extends WeixinBaseController {
                             @RequestParam(required = true)String patient,
                             @RequestParam(required = false) Long mesId ){
        try{
            int isNowYearSign = signWebService.checkNowYearSign(getUID(),patient);
            if(isNowYearSign==0){
                return  write(200, "已经存在下个年度的签约关系", "data", -1);
            }
            Calendar cal = Calendar.getInstance();
            int year = cal.get(Calendar.YEAR);
            int month = cal.get(Calendar.MONTH)+1;