Esempio n. 1
0
 public Appointment(DateTime date, TypeOfAppointment type, Room room, Patient patient)
 {
     this.StartTime = date;
     this.Type      = type;
     this.Room      = room;
     this.Patient   = patient;
 }
        public Appointment ConvertCSVFormatToEntity(string entityCSVFormat)
        {
            string[]          tokens    = entityCSVFormat.Split(_delimiter.ToCharArray());
            long              patientId = long.Parse(tokens[2]);
            ExamOperationRoom room      = ExamOperationRoomRepository.Instance.GetRoomById(long.Parse(tokens[6]));
            TypeOfAppointment type      = (TypeOfAppointment)Enum.Parse(typeof(TypeOfAppointment), tokens[3], true);
            DateTime          startDate = DateTime.Parse(tokens[4]);
            DateTime          endDate   = DateTime.Parse(tokens[5]);

            var doctorRepository  = DoctorRepository.Instance;
            var patientRepository = PatientRepository.Instance;

            Doctor doctor = doctorRepository.GetDoctorById(long.Parse(tokens[1]));

            Patient patient = patientRepository.GetPatientById(patientId);


            return(new Appointment(long.Parse(tokens[0]),
                                   doctor,
                                   patient,
                                   room,
                                   type,
                                   startDate,
                                   endDate));
        }
        private void SelectedDate_SelectedDateChanged(object sender, SelectionChangedEventArgs e)
        {
            if (SelectedDate != null)
            {
                {
                    DateTime Date = (DateTime)SelectedDate.SelectedDate;

                    List <string> timeStringComboBox = new List <String>();

                    if (Date.CompareTo(DateTime.Today) < 0)
                    {
                        TimeBox.ItemsSource = new List <String>();
                        timeStringComboBox.Add("Odabrali ste datum pre današnjeg!");
                    }
                    else
                    {
                        TimeBox.ItemsSource = new List <String>();
                        TypeOfAppointment typeOfAppointment = (bool)Surgery.IsChecked ? TypeOfAppointment.surgery : TypeOfAppointment.examination;

                        foreach (Appointment appointment in availableAppointemntController.GetAvailableForDayAndDoctor(Date, MainWindow.doctor, typeOfAppointment, false).Values)
                        {
                            timeStringComboBox.Add(appointment.StartTime.ToString("HH:mm"));
                        }

                        TimeBox.ItemsSource = timeStringComboBox;
                    }
                }
            }
        }
        private void FindFreeAppointments(TypeOfAppointment type, Dictionary <int, Appointment> allScheduled,
                                          Dictionary <int, Appointment> availableAppointments, WorkDay workDay)
        {
            int      ifSurgeryMultiply = type == TypeOfAppointment.surgery ? (int)Math.Ceiling((double)surgeryPeriod / (double)appointmentTimePeriod) : 1;
            DateTime startTime         = new DateTime(workDay.Date.Year, workDay.Date.Month, workDay.Date.Day, workDay.Shift.StartHour, 0, 0);
            DateTime endTime           = new DateTime(workDay.Date.Year, workDay.Date.Month, workDay.Date.Day, workDay.Shift.EndHour, 0, 0);

            while (startTime.CompareTo(endTime) < 0)
            {
                Appointment appointment = new Appointment(startTime, startTime.AddMinutes(appointmentTimePeriod * ifSurgeryMultiply),
                                                          (Doctor)workDay.Employee, TypeOfAppointment.examination);
                if (!allScheduled.ContainsKey(appointment.GetHashCode()) && !(appointment.EndTime.Hour > workDay.Shift.EndHour))
                {
                    if (type == TypeOfAppointment.surgery)
                    {
                        FreeSurgeryAppointments(allScheduled, availableAppointments, appointment);
                    }
                    else
                    {
                        FreeExaminationAppointments(availableAppointments, appointment);
                    }
                }
                startTime = startTime.AddMinutes(appointmentTimePeriod);
            }
        }
 public EmergencyRequest(TypeOfAppointment typeOfAppointment, string sideNotes, Specialization specialization, MedicalRecord.MedicalRecord medicalRecord)
 {
     TypeOfAppointment = typeOfAppointment;
     SideNotes         = sideNotes;
     Specialization    = specialization;
     MedicalRecord     = medicalRecord;
     Scheduled         = false;
 }
Esempio n. 6
0
 public ExaminationSurgery(DateTime startTime, TypeOfAppointment type, Doctor doctor, MedicalRecord.MedicalRecord record)
 {
     StartTime     = startTime;
     Type          = type;
     Doctor        = doctor;
     MedicalRecord = record;
     Treatments    = new List <Treatment>();
     Diagnoses     = new List <Diagnosis>();
 }
 public Appointment(DateTime startTime, DateTime endTime, Doctor doctor, TypeOfAppointment type)
 {
     Finished          = false;
     StartTime         = startTime;
     EndTime           = endTime;
     TypeOfAppointment = type;
     Doctor            = doctor;
     Room = type == TypeOfAppointment.examination ? doctor.ExaminationRoom : doctor.OperationRoom;
 }
Esempio n. 8
0
 public Report(DateTime startTime, TypeOfAppointment type, string doctorId, int recordId)
 {
     StartTime       = startTime;
     Type            = type;
     DoctorId        = doctorId;
     MedicalRecordId = recordId;
     Treatments      = new List <Treatment.Treatment>();
     Diagnoses       = new List <Diagnosis>();
 }
Esempio n. 9
0
 public Appointment(int id, Period period, TypeOfAppointment typeOfAppointment, string shortDescription, bool urgent, Room room, Doctor doctor)
 {
     Id                = id;
     Period            = period;
     TypeOfAppointment = typeOfAppointment;
     ShortDescription  = shortDescription;
     Urgent            = urgent;
     Room              = room;
     Doctor            = doctor;
 }
Esempio n. 10
0
 public Appointment(int id, Period period, TypeOfAppointment type, string shortDescription,
                    bool urgent, bool deleted, Doctor doctor, int roomId)
 {
     Id                = id;
     Period            = period;
     TypeOfAppointment = type;
     ShortDescription  = shortDescription;
     Urgent            = urgent;
     Deleted           = deleted;
     Finished          = false;
     RoomId            = roomId;
     Doctor            = doctor;
     DoctorId          = doctor.Id;
 }
 public Appointment(DateTime startTime, DateTime endTime, TypeOfAppointment type, string shortDescription,
                    bool urgent, bool deleted, Room room, MedicalRecord.MedicalRecord medicalRecord, Doctor doctor)
 {
     Finished          = false;
     StartTime         = startTime;
     EndTime           = endTime;
     TypeOfAppointment = type;
     ShortDescription  = shortDescription;
     Urgent            = urgent;
     Deleted           = deleted;
     Room          = room;
     MedicalRecord = medicalRecord;
     Doctor        = doctor;
 }
        public Dictionary <int, Appointment> GetAvailableForDay(DateTime date, TypeOfAppointment type, bool ifUrgent)
        {
            Dictionary <int, Appointment> availableAppointments = new Dictionary <int, Appointment>();

            if (date.Date.CompareTo(DateTime.Today.Date.AddHours(allowedPeriodOfTime)) <= 0 && !ifUrgent)
            {
                return(availableAppointments);
            }
            var allScheduledForDay      = appointmentRepository.GetAppointmentsByDate(date.Date);
            var allWorkingDoctorsForDay = workDayService.GetWorkingDoctorsForDay(date.Date);

            foreach (WorkDay workDay in allWorkingDoctorsForDay)
            {
                FindFreeAppointments(type, allScheduledForDay, availableAppointments, workDay);
            }
            CheckIfRoomsAreAvailable(availableAppointments, date);
            return(availableAppointments);
        }
Esempio n. 13
0
 private void appointmentComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (((string)appointmentComboBox.SelectedItem).Equals("Operacija"))
     {
         roomLabel.Visibility             = Visibility.Visible;
         operationRoomsListBox.Visibility = Visibility.Visible;
         operationRoomsListBox.IsEnabled  = true;
         typeOfAppointment = TypeOfAppointment.Operacija;
     }
     else
     {
         roomLabel.Visibility             = Visibility.Hidden;
         operationRoomsListBox.Visibility = Visibility.Hidden;
         operationRoomsListBox.IsEnabled  = false;
         _selectedRoomForAppointment      = _loggedDoctor.room;
         typeOfAppointment = TypeOfAppointment.Pregled;
     }
 }
Esempio n. 14
0
 public int GetNumberOfAppointmentsForDoctor(Doctor doctor, TypeOfAppointment type) => appointmentService.GetNumberOfAppointmentsForDoctor(doctor, type);
Esempio n. 15
0
 public Dictionary <int, Appointment> GetAvailableForDay(DateTime date, TypeOfAppointment type, bool ifUrgent) => availableAppointmentService.GetAvailableForDay(date, type, ifUrgent);
        public Dictionary <int, Appointment> GetAvailableForDayAndDoctor(DateTime date, Doctor doctor, TypeOfAppointment type, bool ifUrgent)
        {
            var allAvailableByDate = GetAvailableForDay(date, type, ifUrgent);
            Dictionary <int, Appointment> availableAppointments = new Dictionary <int, Appointment>();

            foreach (Appointment appointment in allAvailableByDate.Values)
            {
                if (appointment.Doctor.Username.Equals(doctor.Username))
                {
                    availableAppointments.Add(appointment.GetHashCode(), appointment);
                }
            }
            return(availableAppointments);
        }
Esempio n. 17
0
 public Dictionary <int, Appointment> GetAvailableForDayAndDoctor(DateTime date, Doctor doctor, TypeOfAppointment type, bool ifUrgent) => availableAppointmentService.GetAvailableForDayAndDoctor(date, doctor, type, ifUrgent);
        public int GetNumberOfAppointmentsForDoctor(Doctor doctor, TypeOfAppointment type)
        {
            var allExams = appointmentRepository.GetAll().ToList().Where(entity => entity.Doctor.Username.Equals(doctor.Username));

            return(allExams.Where(entity => entity.Finished == true && entity.TypeOfAppointment == type).ToList().Count);
        }
Esempio n. 19
0
 public Appointment(DateTime startTime, Doctor doctor, TypeOfAppointment type)
 {
     StartTime   = startTime;
     this.Doctor = doctor;
     this.Type   = type;
 }