Pārlūkot izejas kodu

签约判断添加

lyr 8 gadi atpakaļ
vecāks
revīzija
a1397a95f9

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

@ -1811,7 +1811,8 @@ public class FamilyContractService extends BaseService {
        SignFamily sanshiSign = signFamilyDao.findSanshiSignByPatient(patient);
        if (familySign != null) {
            if (doctor.equals(familySign.getDoctor()) || doctor.equals(familySign.getDoctorHealth())) {
            if (doctor.equals(StringUtils.isEmpty(familySign.getDoctor()) ? "" : familySign.getDoctor()) ||
                    doctor.equals(StringUtils.isEmpty(familySign.getDoctorHealth()) ? "" : familySign.getDoctorHealth())) {
                if (familySign.getStatus() == 0) {
                    result.put("status", "0");
                    result.put("msg", "已申请家庭签约");
@ -1823,7 +1824,8 @@ public class FamilyContractService extends BaseService {
            }
        }
        if (sanshiSign != null) {
            if (doctor.equals(sanshiSign.getDoctor()) || doctor.equals(sanshiSign.getDoctorHealth())) {
            if (doctor.equals(StringUtils.isEmpty(sanshiSign.getDoctor()) ? "" : sanshiSign.getDoctor()) ||
                    doctor.equals(StringUtils.isEmpty(sanshiSign.getDoctorHealth()) ? "" : sanshiSign.getDoctorHealth())) {
                result.put("status", "2");
                result.put("msg", "已有三师签约");
                return result;
@ -1843,46 +1845,46 @@ public class FamilyContractService extends BaseService {
     * @param doctor
     * @return
     */
    public JSONObject isPatientAndDoctorCanSign(String patient, String doctor){
    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","已申请签约,不可签约");
        if (familySign != null) {
            if (familySign.getStatus() == 0) {
                result.put("status", "0");
                result.put("msg", "已申请签约,不可签约");
            } else {
                result.put("status","-1");
                result.put("msg","因已签约家庭医生,不可签约");
                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","因签约对象不含签约三师中全科,不可签约");
        if (sanshiSign != null) {
            if (doc.getLevel() == 2) {
                if (!doctor.equals(StringUtils.isEmpty(sanshiSign.getDoctor()) ? "" : 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","因签约对象不与签约三师中全科在同一团队,不可签约");
                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);
                    result.put("status", "1");
                    result.put("msg", "可签约");
                    result.put("team", teams);
                }
                return result;
            }
        }
        result.put("status","1");
        result.put("msg","可签约");
        result.put("status", "1");
        result.put("msg", "可签约");
        return result;
    }