trevor-shepard / my_health

App Academy Fullstack Project
1 stars 0 forks source link

alt text

Web application for patients to manage healthcare appointments and to interact with thier providers

MyHealth

Table of contents

Full Stack Application

User Authentication

Appointment Display


### Appointment Scheduling
* Users choose which provider they would like to schedule an appointment with
* Users choose which dates they would like to schedule appointments on
* Users choose which available time slots on selected days they would
* Users able to cancel appointments
* Custom validations to see if both user and provider is available for requested timeslot
```javascript
def available_timeslot_provider
    self.provider.appointments.each do |appointment|
        if (self.start > appointment.start && self.start < appointment.end)
            errors.add(:start, "appointment time is unavailable, #{self.provider.fname} #{self.provider.lname} has a conflicting appointment")
        end
        if (self.end > appointment.start && self.end < appointment.end)
            errors.add(:end, "appointment time is unavailable, #{self.provider.fname} #{self.provider.lname} has a conflicting appointment")
        end
    end
end

def available_timeslot_user
    self.user.appointments.each do |appointment|
        if (self.start > appointment.start && self.start < appointment.end)
            errors.add(:start, 'another already scheduled appointment conflicts with the start of this appointment')
        end
        if (self.end > appointment.start && self.end < appointment.end)
            errors.add(:end, 'another already scheduled appointment conflicts with the end of this appointment')
        end
    end
end

Prescription Refill Request