Browse Source

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

chenweida 8 years ago
parent
commit
7c3827b6c7

+ 100 - 84
src/main/java/com/yihu/wlyy/service/app/scheduling/DoctorWorkTimeService.java

@ -29,7 +29,7 @@ import java.util.*;
@Transactional
public class DoctorWorkTimeService extends BaseService {
    static Object obj  = new Object();
    static Object obj = new Object();
    @Autowired
    private DoctorWorkTimeDao doctorWorkTimeDao;
    @Autowired
@ -48,7 +48,7 @@ public class DoctorWorkTimeService extends BaseService {
    public JSONObject findDoctorWorkTime(String doctor) throws Exception {
        JSONObject result = new JSONObject();
        Doctor doc = doctorDao.findByCode(doctor);
        if(doc == null){
        if (doc == null) {
            throw new Exception("doctor not exist");
        }
        WlyyDoctorWorkTime workTime = doctorWorkTimeDao.findDoctorWorkTime(doctor);
@ -242,71 +242,79 @@ public class DoctorWorkTimeService extends BaseService {
                json.put("status", "0");
                json.put("msg", "医生不接受咨询");
            } else {
                if (result.get("workWeek") != null) {
                    // 当前工作日已设置工作时间
                    int flag = 0;
                    WlyyDoctorWorkTime workTime = (WlyyDoctorWorkTime) result.get("workTime");
                    WlyyDoctorWorkWeek workWeek = (WlyyDoctorWorkWeek) result.get("workWeek");
                    int hour = calendar.get(Calendar.HOUR_OF_DAY);
                    int minute = calendar.get(Calendar.MINUTE);
                    String current = (hour < 10 ? ("0" + hour) : hour) + ":" + (hour < 10 ? ("0" + minute) : minute);
                    // 早上
                    if (workWeek.getMorning().equals("1")) {
                        String currentStart = workTime.getMorningBegin();
                        String currentEnd = workTime.getMorningEnd();
                        if (currentStart.length() == 4) {
                            currentStart = "0" + currentStart;
                        }
                        if (currentEnd.length() == 4) {
                            currentEnd = "0" + currentEnd;
                        }
                        if (current.compareTo(currentStart) >= 0 &&
                                current.compareTo(currentEnd) < 0) {
                            flag = 1;
                        }
                    }
                    // 下午
                    if (workWeek.getAfternoon().equals("1")) {
                        String currentStart = workTime.getAfternoonBegin();
                        String currentEnd = workTime.getAfternoonEnd();
                        if (currentStart.length() == 4) {
                            currentStart = "0" + currentStart;
                        }
                        if (currentEnd.length() == 4) {
                            currentEnd = "0" + currentEnd;
                        }
                        if (current.compareTo(currentStart) >= 0 &&
                                current.compareTo(currentEnd) < 0) {
                            flag = 1;
                        }
                    }
                    // 晚上
                    if (workWeek.getNight().equals("1")) {
                        String currentStart = workTime.getNightBegin();
                        String currentEnd = workTime.getNightEnd();
                        if (currentStart.length() == 4) {
                            currentStart = "0" + currentStart;
                if (StringUtils.isEmpty(doctorWorkTime.getMorningBegin()) && StringUtils.isEmpty(doctorWorkTime.getMorningEnd())
                        && StringUtils.isEmpty(doctorWorkTime.getAfternoonBegin()) && StringUtils.isEmpty(doctorWorkTime.getAfternoonEnd())
                        && StringUtils.isEmpty(doctorWorkTime.getNightBegin()) && StringUtils.isEmpty(doctorWorkTime.getNightEnd())) {
                    // 医生未设置工作时间,默认7*24小时工作
                    json.put("status", "1");
                    json.put("msg", "医生当前接受咨询");
                } else {
                    if (result.get("workWeek") != null) {
                        // 当前工作日已设置工作时间
                        int flag = 0;
                        WlyyDoctorWorkTime workTime = (WlyyDoctorWorkTime) result.get("workTime");
                        WlyyDoctorWorkWeek workWeek = (WlyyDoctorWorkWeek) result.get("workWeek");
                        int hour = calendar.get(Calendar.HOUR_OF_DAY);
                        int minute = calendar.get(Calendar.MINUTE);
                        String current = (hour < 10 ? ("0" + hour) : hour) + ":" + (hour < 10 ? ("0" + minute) : minute);
                        // 早上
                        if (workWeek.getMorning().equals("1")) {
                            String currentStart = workTime.getMorningBegin();
                            String currentEnd = workTime.getMorningEnd();
                            if (currentStart.length() == 4) {
                                currentStart = "0" + currentStart;
                            }
                            if (currentEnd.length() == 4) {
                                currentEnd = "0" + currentEnd;
                            }
                            if (current.compareTo(currentStart) >= 0 &&
                                    current.compareTo(currentEnd) < 0) {
                                flag = 1;
                            }
                        }
                        if (currentEnd.length() == 4) {
                            currentEnd = "0" + currentEnd;
                        // 下午
                        if (workWeek.getAfternoon().equals("1")) {
                            String currentStart = workTime.getAfternoonBegin();
                            String currentEnd = workTime.getAfternoonEnd();
                            if (currentStart.length() == 4) {
                                currentStart = "0" + currentStart;
                            }
                            if (currentEnd.length() == 4) {
                                currentEnd = "0" + currentEnd;
                            }
                            if (current.compareTo(currentStart) >= 0 &&
                                    current.compareTo(currentEnd) < 0) {
                                flag = 1;
                            }
                        }
                        if (current.compareTo(currentStart) >= 0 &&
                                current.compareTo(currentEnd) < 0) {
                            flag = 1;
                        // 晚上
                        if (workWeek.getNight().equals("1")) {
                            String currentStart = workTime.getNightBegin();
                            String currentEnd = workTime.getNightEnd();
                            if (currentStart.length() == 4) {
                                currentStart = "0" + currentStart;
                            }
                            if (currentEnd.length() == 4) {
                                currentEnd = "0" + currentEnd;
                            }
                            if (current.compareTo(currentStart) >= 0 &&
                                    current.compareTo(currentEnd) < 0) {
                                flag = 1;
                            }
                        }
                    }
                    if (flag == 1) {
                        json.put("status", "1");
                        json.put("msg", "医生当前接受咨询");
                        if (flag == 1) {
                            json.put("status", "1");
                            json.put("msg", "医生当前接受咨询");
                        } else {
                            json.put("status", "2");
                            json.put("msg", "医生当前不在工作时间");
                        }
                    } else {
                        json.put("status", "2");
                        json.put("msg", "医生当前不在工作时间");
                    }
                } else {
                    json.put("status", "2");
                    json.put("msg", "医生当前不在工作时间");
                }
            }
        }
@ -344,33 +352,41 @@ public class DoctorWorkTimeService extends BaseService {
                json.put("status", "0");
                json.put("times", 0);
            } else {
                if (result.get("workWeek") != null) {
                    WlyyDoctorWorkWeek workWeek = (WlyyDoctorWorkWeek)result.get("workWeek");
                    boolean flag = false;
                    if(StringUtils.isNotEmpty(workWeek.getMorning()) && workWeek.getMorning().equals("1")){
                        json.put("status", "1");
                        json.put("times", doctorWorkTime.getFamousConsultTimes());
                        flag = true;
                    }
                    if(StringUtils.isNotEmpty(workWeek.getAfternoon()) && workWeek.getAfternoon().equals("1")){
                        json.put("status", "1");
                        json.put("times", doctorWorkTime.getFamousConsultTimes());
                        flag = true;
                    }
                    if(StringUtils.isNotEmpty(workWeek.getNight()) && workWeek.getNight().equals("1")){
                        json.put("status", "1");
                        json.put("times", doctorWorkTime.getFamousConsultTimes());
                        flag = true;
                    }
                if (StringUtils.isEmpty(doctorWorkTime.getMorningBegin()) && StringUtils.isEmpty(doctorWorkTime.getMorningEnd())
                        && StringUtils.isEmpty(doctorWorkTime.getAfternoonBegin()) && StringUtils.isEmpty(doctorWorkTime.getAfternoonEnd())
                        && StringUtils.isEmpty(doctorWorkTime.getNightBegin()) && StringUtils.isEmpty(doctorWorkTime.getNightEnd())) {
                    // 医生未设置工作时间,默认7*24小时工作
                    json.put("status", "1");
                    json.put("times", doctorWorkTime.getFamousConsultTimes());
                } else {
                    if (result.get("workWeek") != null) {
                        WlyyDoctorWorkWeek workWeek = (WlyyDoctorWorkWeek) result.get("workWeek");
                        boolean flag = false;
                        if (StringUtils.isNotEmpty(workWeek.getMorning()) && workWeek.getMorning().equals("1")) {
                            json.put("status", "1");
                            json.put("times", doctorWorkTime.getFamousConsultTimes());
                            flag = true;
                        }
                        if (StringUtils.isNotEmpty(workWeek.getAfternoon()) && workWeek.getAfternoon().equals("1")) {
                            json.put("status", "1");
                            json.put("times", doctorWorkTime.getFamousConsultTimes());
                            flag = true;
                        }
                        if (StringUtils.isNotEmpty(workWeek.getNight()) && workWeek.getNight().equals("1")) {
                            json.put("status", "1");
                            json.put("times", doctorWorkTime.getFamousConsultTimes());
                            flag = true;
                        }
                    if(!flag){
                        if (!flag) {
                            json.put("status", "0");
                            json.put("times", 0);
                        }
                    } else {
                        json.put("status", "0");
                        json.put("times", 0);
                    }
                } else {
                    json.put("status", "0");
                    json.put("times", doctorWorkTime.getFamousConsultTimes());
                }
            }
        }
@ -493,8 +509,8 @@ public class DoctorWorkTimeService extends BaseService {
                JSONObject json = isDoctorWorkingToday(doc.getCode());
                if (json.getString("status").equals("1")) {
                    DoctorFamousConsultTimesRemain timesRemain = timesRemainDao.findByDoctorAndConsultDate(doc.getCode(),date);
                    if(timesRemain == null) {
                    DoctorFamousConsultTimesRemain timesRemain = timesRemainDao.findByDoctorAndConsultDate(doc.getCode(), date);
                    if (timesRemain == null) {
                        timesRemain = new DoctorFamousConsultTimesRemain();
                    }
                    timesRemain.setDoctor(doc.getCode());

+ 5 - 0
src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -1381,6 +1381,11 @@ public class FamilyContractService extends BaseService {
        return signFamilyDao.findSanshiSignByPatient(code);
    }
    public SignFamily findByFamilySignPatient(String code) {
        return signFamilyDao.findByPatientFamilySignInfo(code);
    }
    public SignFamily findByJiatingPatient(String code) {
        return signFamilyDao.findByjiatingPatientYes(code);

+ 1 - 1
src/main/java/com/yihu/wlyy/web/doctor/scheduling/DoctorWorkTimeController.java

@ -155,7 +155,7 @@ public class DoctorWorkTimeController extends BaseController {
            if (doc == null) {
                return error(-1,"医生不存在");
            }
            if (doc.getIsFamous() != 1) {
            if (doc.getIsFamous() == null || doc.getIsFamous() != 1) {
                return error(-1,"医生不是名医,无法设置名医咨询次数");
            }

+ 1 - 1
src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java

@ -567,7 +567,7 @@ public class PatientController extends WeixinBaseController {
                return write(200, "获取签约状态成功!", "data", ss.getStatus());
            }
            //判断是否有家庭签约
            SignFamily sf = familyContractService.findByJiatingPatient(getUID());
            SignFamily sf = familyContractService.findByFamilySignPatient(getUID());
            if (sf != null) {
                return write(200, "获取签约状态成功!", "data", sf.getStatus());
            }