Ejemplo n.º 1
0
 public IActionResult GetAppointmentsByFilterCriteria(AppointmentFilterDTO appointmentFilterDTO)
 {
     if (appointmentFilterDTO.AppointmentFilterCriteria == AppointmentFilterCriteria.ByTimeIntervalPriority)
     {
         return(Ok(_appointmentFilterService.GetAvailableByPriorityTimeInterval(new PriorityParameters {
             ChosenStartDate = appointmentFilterDTO.StartInterval, ChosenEndDate = appointmentFilterDTO.EndInterval
         })));
     }
     else if (appointmentFilterDTO.AppointmentFilterCriteria == AppointmentFilterCriteria.BySpecialistNoPriority && appointmentFilterDTO.HospitalEquipmentId != -1)
     {
         return(Ok(_appointmentFilterService.GetAvailableByDoctorTimeIntervalAndEquipment(new PriorityParameters {
             DoctorId = appointmentFilterDTO.DoctorId, ChosenStartDate = appointmentFilterDTO.StartInterval, ChosenEndDate = appointmentFilterDTO.EndInterval
         }, appointmentFilterDTO.HospitalEquipmentId, "nopriority")));
     }
     else if (appointmentFilterDTO.AppointmentFilterCriteria == AppointmentFilterCriteria.BySpecialistDoctorPriority && appointmentFilterDTO.HospitalEquipmentId != -1)
     {
         return(Ok(_appointmentFilterService.GetAvailableByDoctorTimeIntervalAndEquipment(new PriorityParameters {
             DoctorId = appointmentFilterDTO.DoctorId, ChosenStartDate = appointmentFilterDTO.StartInterval, ChosenEndDate = appointmentFilterDTO.EndInterval
         }, appointmentFilterDTO.HospitalEquipmentId, "doctor")));
     }
     else if (appointmentFilterDTO.AppointmentFilterCriteria == AppointmentFilterCriteria.BySpecialistTimePriority && appointmentFilterDTO.HospitalEquipmentId != -1)
     {
         return(Ok(_appointmentFilterService.GetAvailableByDoctorTimeIntervalAndEquipment(new PriorityParameters {
             DoctorId = appointmentFilterDTO.DoctorId, ChosenStartDate = appointmentFilterDTO.StartInterval, ChosenEndDate = appointmentFilterDTO.EndInterval
         }, appointmentFilterDTO.HospitalEquipmentId, "timeinterval")));
     }
     else if (appointmentFilterDTO.AppointmentFilterCriteria == AppointmentFilterCriteria.AddRoomToAppointment)
     {
         return(Ok(_appointmentFilterService.AddRoomToAppointment(appointmentFilterDTO.Appointments)));
     }
     else if (appointmentFilterDTO.AppointmentFilterCriteria == AppointmentFilterCriteria.EmergencyAppointment)
     {
         return(Ok(_appointmentFilterService.FindEmergencyAppointment(new PriorityParameters()
         {
             DoctorId = appointmentFilterDTO.DoctorId, ChosenStartDate = appointmentFilterDTO.StartInterval, ChosenEndDate = appointmentFilterDTO.EndInterval, SpecializationId = appointmentFilterDTO.SpecializationId
         }, appointmentFilterDTO.HospitalEquipmentId)));
     }
     else if (appointmentFilterDTO.AppointmentFilterCriteria == AppointmentFilterCriteria.ReschedulingAppointment)
     {
         return(Ok(_appointmentFilterService.FindAppointmentsForRescheduling(new PriorityParameters()
         {
             DoctorId = appointmentFilterDTO.DoctorId, ChosenStartDate = appointmentFilterDTO.StartInterval, ChosenEndDate = appointmentFilterDTO.EndInterval
         }, appointmentFilterDTO.HospitalEquipmentId)));
     }
     else
     {
         return(Ok());
     }
 }
        private void ButtonScheduleExamination(object sender, RoutedEventArgs e)
        {
            Appointment appointment = (Appointment)dataGridAppointment.SelectedItem;

            if (appointment == null)
            {
                MessageBox.Show("You didn't select appointment!");
                return;
            }
            Patient patient = (Patient)comboBoxPatient.SelectedItem;

            if (patient == null)
            {
                MessageBox.Show("You didn't select patient!");
                return;
            }
            //MedicalRecord medicalRecord = SearchDataBaseForMedicalRecord(patient.Id);
            //appointment.MedicalRecord.Id = medicalRecord.Id;
            appointment.PatientId = patient.Id;
            appointment.Doctor    = (Doctor)comboBoxDoctor.SelectedItem;
            appointment.Room      = null;
            if (listViewPostPoneTime.ItemsSource == null)
            {
                AppointmentFilterDTO appointmentFilterDTO = new AppointmentFilterDTO()
                {
                    appointmentSearchOrSchedule = AppointmentSearchOrSchedule.ScheduleAppointment, appointment = appointment
                };
                SaveAndUpdateDataBase(appointmentFilterDTO);
                MessageBox.Show("Appointment is scheduled!");
            }
            else
            {
                Appointment          appointmentForRescheduling = CreateNewAppointment(appointment, (double)listViewPostPoneTime.SelectedItem);
                AppointmentFilterDTO appointmentFilterDTO       = new AppointmentFilterDTO()
                {
                    appointmentSearchOrSchedule = AppointmentSearchOrSchedule.ScheduleAppointment, appointment = appointmentForRescheduling
                };
                SaveAndUpdateDataBase(appointmentFilterDTO);
                appointment.Urgent = true;
                appointmentFilterDTO.appointment = appointment;
                appointmentFilterDTO.appointmentSearchOrSchedule = AppointmentSearchOrSchedule.UpdateAppointment;
                SaveAndUpdateDataBase(appointmentFilterDTO);
                MessageBox.Show("Appointment is moved and emergency appointment is scheduled!");
            }
            listViewPostPoneTime.ItemsSource = null;
            dataGridAppointment.ItemsSource  = null;
        }
Ejemplo n.º 3
0
        private async void HttpRequestToAppointmentController(AppointmentFilterDTO appointmentFilterDTO)
        {
            string     jsonSearchAppointmentsDTO = JsonConvert.SerializeObject(appointmentFilterDTO);
            HttpClient client  = new HttpClient();
            var        content = new StringContent(jsonSearchAppointmentsDTO, Encoding.UTF8, "application/json");
            // HttpResponseMessage response = await client.PostAsync("http://localhost:53109/api/appointment", content);
            HttpResponseMessage response = await client.PostAsync("http://localhost:8083/api/appointment/apointmentsBySearchOrSchedule", content);

            response.EnsureSuccessStatusCode();
            string responseBody = await response.Content.ReadAsStringAsync();

            appointments = JsonConvert.DeserializeObject <List <Appointment> >(responseBody);
            HttpRequestToAppointmentFilterController(new AppointmentFilterDTO {
                appointmentFilterCriteria = AppointmentFilterCriteria.AddRoomToAppointment, appointments = appointments
            });
            dataGridAppointment.ItemsSource = appointments;
        }
Ejemplo n.º 4
0
        private async void HttpRequestToAppointmentFilterController(AppointmentFilterDTO appointmentFilterDTO)
        {
            string     jsonSearchAppointmentsDTO = JsonConvert.SerializeObject(appointmentFilterDTO);
            HttpClient client  = new HttpClient();
            var        content = new StringContent(jsonSearchAppointmentsDTO, Encoding.UTF8, "application/json");
            //HttpResponseMessage response = await client.PostAsync("http://localhost:53109/api/appointmentfilter/", content);
            HttpResponseMessage response = await client.PostAsync("http://localhost:8083/api/appointmentFilter", content);

            response.EnsureSuccessStatusCode();
            string responseBody = await response.Content.ReadAsStringAsync();

            appointments = JsonConvert.DeserializeObject <List <Appointment> >(responseBody);
            if ((bool)radioButtonInterval.IsChecked)
            {
                appointments = FilterSpecialization(appointments);
            }
            dataGridAppointment.ItemsSource = appointments;
        }
        private void ButtonCancelExamination(object sender, RoutedEventArgs e)
        {
            Appointment appointment = (Appointment)dataGridAppointments.SelectedItem;

            if (appointment == null)
            {
                MessageBox.Show("You didn't select any examination appointment!");
                return;
            }
            appointment.CanceledByPatient = true;
            AppointmentFilterDTO appointmentFilterDTO = new AppointmentFilterDTO()
            {
                appointment = appointment, appointmentSearchOrSchedule = AppointmentSearchOrSchedule.UpdateAppointment
            };

            SaveAndUpdateDataBase(appointmentFilterDTO);
            appointments.Remove(appointment);
        }
Ejemplo n.º 6
0
        private void SearchDatabaseForAppointment(Doctor doctor, EquipmentType hospitalEquipment, DateTime startTime, DateTime endTime)
        {
            AppointmentFilterDTO appointmentFilterDTO;

            if ((bool)radioButtonDoctor.IsChecked)
            {
                if (hospitalEquipment == null)
                {
                    appointmentFilterDTO = new AppointmentFilterDTO()
                    {
                        appointmentSearchOrSchedule = AppointmentSearchOrSchedule.ByDoctorPriority, DoctorId = doctor.Id, HospitalEquipmentId = -1, StartInterval = startTime, EndInterval = endTime
                    };
                    HttpRequestToAppointmentController(appointmentFilterDTO);
                }
                else
                {
                    appointmentFilterDTO = new AppointmentFilterDTO()
                    {
                        appointmentFilterCriteria = AppointmentFilterCriteria.BySpecialistDoctorPriority, DoctorId = doctor.Id, HospitalEquipmentId = hospitalEquipment.Id, StartInterval = startTime, EndInterval = endTime
                    };
                    HttpRequestToAppointmentFilterController(appointmentFilterDTO);
                }
            }
            else if ((bool)radioButtonInterval.IsChecked)
            {
                if (hospitalEquipment == null)
                {
                    appointmentFilterDTO = new AppointmentFilterDTO()
                    {
                        appointmentFilterCriteria = AppointmentFilterCriteria.ByTimeIntervalPriority, DoctorId = doctor.Id, HospitalEquipmentId = -1, StartInterval = startTime, EndInterval = endTime
                    };
                    HttpRequestToAppointmentFilterController(appointmentFilterDTO);
                }
                else
                {
                    appointmentFilterDTO = new AppointmentFilterDTO()
                    {
                        appointmentFilterCriteria = AppointmentFilterCriteria.BySpecialistTimePriority, DoctorId = doctor.Id, HospitalEquipmentId = hospitalEquipment.Id, StartInterval = startTime, EndInterval = endTime
                    };
                    HttpRequestToAppointmentFilterController(appointmentFilterDTO);
                }
            }
            else
            {
                if (hospitalEquipment == null)
                {
                    appointmentFilterDTO = new AppointmentFilterDTO()
                    {
                        appointmentSearchOrSchedule = AppointmentSearchOrSchedule.ByDoctorAndTimeInterval, DoctorId = doctor.Id, HospitalEquipmentId = -1, StartInterval = startTime, EndInterval = endTime
                    };
                    HttpRequestToAppointmentController(appointmentFilterDTO);
                }
                else
                {
                    appointmentFilterDTO = new AppointmentFilterDTO()
                    {
                        appointmentFilterCriteria = AppointmentFilterCriteria.BySpecialistNoPriority, DoctorId = doctor.Id, HospitalEquipmentId = hospitalEquipment.Id, StartInterval = startTime, EndInterval = endTime
                    };
                    HttpRequestToAppointmentFilterController(appointmentFilterDTO);
                }
            }
        }
Ejemplo n.º 7
0
 public Task <List <Appointment> > GetAllAsync(Guid timesheetId, AppointmentFilterDTO filterDto)
 {
     return(this.appointmentRepository.GetAllAsync(timesheetId, filterDto));
 }