Prechádzať zdrojové kódy

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

lyr 8 rokov pred
rodič
commit
b53d1cdffb

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

@ -976,7 +976,7 @@ public class FamilyContractService extends BaseService {
            SignFamily sssignFamily = signFamilyDao.findSSByIdcard(p.getIdcard());
            if (sssignFamily != null) {
                if(StringUtils.isNotEmpty(doctor)) {
                if (StringUtils.isNotEmpty(doctor)) {
                    if (!doctor.equals(sssignFamily.getDoctor())) {
                        result.put("status", -2);
                        result.put("msg", "居民已签约三师,故全科医生只可为" + sssignFamily.getDoctorName() + "医生,请重新选择全科医生");
@ -1793,7 +1793,97 @@ public class FamilyContractService extends BaseService {
    public List<SignFamily> findAllSignByPatient(String patient) {
        return signFamilyDao.findAllSignByPatient(patient);
    }
    public List<SignFamily> findNoHealthSignFamilyNum(String doctor) {
        return signFamilyDao.findNoHealthSignFamilyNum(doctor);
    }
    /**
     * 判断居民与医生是否存在签约关系
     *
     * @param patient
     * @param doctor
     * @return
     */
    public JSONObject isPatientAndDoctorExistSign(String patient, String doctor) {
        JSONObject result = new JSONObject();
        SignFamily familySign = signFamilyDao.findFamilySignByPatient(patient);
        SignFamily sanshiSign = signFamilyDao.findSanshiSignByPatient(patient);
        if (familySign != null) {
            if (doctor.equals(familySign.getDoctor()) || doctor.equals(familySign.getDoctorHealth())) {
                if (familySign.getStatus() == 0) {
                    result.put("status", "0");
                    result.put("msg", "已申请家庭签约");
                } else {
                    result.put("status", "1");
                    result.put("msg", "已有家庭签约");
                }
                return result;
            }
        }
        if (sanshiSign != null) {
            if (doctor.equals(sanshiSign.getDoctor()) || doctor.equals(sanshiSign.getDoctorHealth())) {
                result.put("status", "2");
                result.put("msg", "已有三师签约");
                return result;
            }
        }
        result.put("status", "-1");
        result.put("msg", "无签约关系");
        return result;
    }
    /**
     * 判断医生与居民是否可签约
     *
     * @param patient
     * @param doctor
     * @return
     */
    public JSONObject isPatientAndDoctorCanSign(String patient, String doctor){
        JSONObject result = new JSONObject();
        Doctor doc = doctorDao.findByCode(doctor);
        SignFamily familySign = signFamilyDao.findFamilySignByPatient(patient);
        SignFamily sanshiSign = signFamilyDao.findSanshiSignByPatient(patient);
        if(familySign != null){
            if(familySign.getStatus() == 0){
                result.put("status","0");
                result.put("msg","已申请签约,不可签约");
            } else {
                result.put("status","-1");
                result.put("msg","因已签约家庭医生,不可签约");
            }
            return result;
        }
        if(sanshiSign != null){
            if(doc.getLevel() == 2){
                if(!doctor.equals(sanshiSign.getDoctor())){
                    result.put("status","-2");
                    result.put("msg","因签约对象不含签约三师中全科,不可签约");
                    return result;
                }
            } else {
                List<AdminTeam> teams = adminTeamService.findDoctorsTeams(doctor, sanshiSign.getDoctor());
                if(teams == null || teams.size() < 1){
                    result.put("status","-3");
                    result.put("msg","因签约对象不与签约三师中全科在同一团队,不可签约");
                } else {
                    result.put("status","1");
                    result.put("msg","可签约");
                    result.put("team",teams);
                }
                return result;
            }
        }
        result.put("status","1");
        result.put("msg","可签约");
        return result;
    }
}

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

@ -913,4 +913,54 @@ public class DoctorFamilyContractController extends WeixinBaseController {
            return error(-1, "查询失败");
        }
    }
    /**
     * 查询居民是否与某个医生存在签约关系
     *
     * @param doctor
     * @return
     */
    @RequestMapping(value = "/doctor_patient_sign_exist",method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public String isPatientAndDoctorExistSign(@RequestParam(required = true) String doctor,
                                              @RequestParam(required = true) String patient){
        try{
            if(StringUtils.isEmpty(doctor)){
                return error(-1,"医生不能为空");
            }
            if(StringUtils.isEmpty(patient)){
                return error(-1,"居民不能为空");
            }
            JSONObject result = familyContractService.isPatientAndDoctorExistSign(patient,doctor);
            return write(200,"查询成功","data",result);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
    /**
     * 查询居民与某个医生是否可签约
     *
     * @param doctor
     * @return
     */
    @RequestMapping(value = "/doctor_patient_can_sign",method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public String isPatientAndDoctorCanSign(@RequestParam(required = true) String doctor,
                                            @RequestParam(required = true) String patient){
        try{
            if(StringUtils.isEmpty(doctor)){
                return error(-1,"医生不能为空");
            }
            if(StringUtils.isEmpty(patient)){
                return error(-1,"居民不能为空");
            }
            JSONObject result = familyContractService.isPatientAndDoctorCanSign(patient,doctor);
            return write(200,"查询成功","data",result);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
}

+ 41 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/FamilyContractController.java

@ -577,4 +577,45 @@ public class FamilyContractController extends BaseController {
        }
    }
    /**
     * 查询居民是否与某个医生存在签约关系
     *
     * @param doctor
     * @return
     */
    @RequestMapping(value = "/doctor_sign_exist",method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public String isPatientAndDoctorExistSign(@RequestParam(required = true) String doctor){
        try{
            if(StringUtils.isEmpty(doctor)){
                return error(-1,"医生不能为空");
            }
            JSONObject result = familyContractService.isPatientAndDoctorExistSign(getUID(),doctor);
            return write(200,"查询成功","data",result);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
    /**
     * 查询居民与某个医生是否可签约
     *
     * @param doctor
     * @return
     */
    @RequestMapping(value = "/doctor_can_sign",method = {RequestMethod.GET,RequestMethod.POST})
    @ResponseBody
    public String isPatientAndDoctorCanSign(@RequestParam(required = true) String doctor){
        try{
            if(StringUtils.isEmpty(doctor)){
                return error(-1,"医生不能为空");
            }
            JSONObject result = familyContractService.isPatientAndDoctorCanSign(getUID(),doctor);
            return write(200,"查询成功","data",result);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
}