コード例 #1
0
        public bool CreateNewUrgentAppointment(Patient patient, int duration, DoctorType doctorType, RoomType roomType, AppointmentType appointmentType, DateTime appointmentStart, DateTime appointmentEnd)
        {
            List <Room>   availableRooms   = _roomService.GetAvailableRoomList(appointmentStart, appointmentEnd);
            List <Doctor> availableDoctors = _doctorService.GetAvailableDoctorList(appointmentStart, appointmentEnd);

            List <Room>   filteredRooms   = _roomService.GetFilteredRooms(availableRooms, appointmentType);
            List <Doctor> filteredDoctors = _doctorService.GetFilteredDoctors(availableDoctors, doctorType);


            if (filteredRooms.Count > 0 && filteredDoctors.Count > 0)
            {
                foreach (Appointment appointmentItem in _appointmentService.GetAll())
                {
                    if (appointmentItem.AppointmentStatus == AppointmentStatus.scheduled && appointmentItem.Patient.Equals(patient) && (appointmentItem.AppointmentDate >= appointmentStart && appointmentItem.AppointmentDate <= appointmentEnd))
                    {
                        _appointmentService.Remove(appointmentItem);
                    }
                }


                Room           room   = filteredRooms[0];
                global::Doctor doctor = filteredDoctors[0];
                int            id     = _appointmentService.GetAll().Count + 1;

                Appointment appointment = new Appointment(id, appointmentStart, duration, appointmentType, AppointmentStatus.scheduled, patient, doctor, room);
                _appointmentService.Add(appointment);
                return(true);
            }
            return(false);
        }
コード例 #2
0
 public AppointmentFilter(Doctor doctor, DoctorType doctorType, TimeInterval timeInterval, AppointmentType appointmentType)
 {
     _doctor       = doctor;
     _doctorType   = doctorType;
     _timeInterval = timeInterval;
     _type         = appointmentType;
 }
コード例 #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            DoctorType doctorType = db.DoctorTypes.Find(id);

            db.DoctorTypes.Remove(doctorType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #4
0
 public DoctorTypeViewModel(DoctorType entity)
 {
     if (entity != null)
     {
         Id   = entity.Id;
         Name = entity.Name;
     }
 }
コード例 #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            DoctorType doctorType = db.DoctorTypes.Find(id);

            doctorType.doctor_type_isDeleted = true;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #6
0
ファイル: DoctorInfo.cs プロジェクト: gldnpz17/MedAssist
 public DoctorInfo(string doctorName, Guid doctorID, int doctorAge, byte[] doctorPicture, string doctorHospital, DoctorType doctorType)
 {
     DoctorName      = doctorName;
     DoctorID        = doctorID;
     DoctorAge       = doctorAge;
     DoctorPicture   = doctorPicture;
     DoctorHospital  = doctorHospital;
     this.doctorType = doctorType;
 }
コード例 #7
0
        public List <DoctorDto> GetByType(DoctorType type)
        {
            List <DoctorDto> myDoctors = new List <DoctorDto>();
            List <Doctor>    doctors   = _dbContext.Doctors.Where(doctor => doctor.Type == type).ToList();

            doctors.ForEach(doctor => myDoctors.Add(DoctorAdapter.DoctorToDoctorDto(doctor)));

            return(myDoctors);
        }
コード例 #8
0
        public IActionResult GetByType(DoctorType type)
        {
            if (_doctorService.GetByType(type) == null)
            {
                return(NotFound());
            }

            return(Ok(_doctorService.GetByType(type)));
        }
コード例 #9
0
 public SpecialistBookingLicence(DoctorType doctorAllowed, int numberOfAppointments, bool Active, Patient patient, TimeInterval timeInterval, List <Doctor> handsOutLicence)
 {
     _doctorAllowed        = doctorAllowed;
     _numberOfAppointments = numberOfAppointments;
     _active          = Active;
     _patient         = patient;
     _timeInterval    = timeInterval;
     _handsOutLicence = handsOutLicence;
 }
コード例 #10
0
        private void Confirm_Click(object sender, RoutedEventArgs e)
        {
            if (PatientsList.SelectedItem == null)
            {
                MessageBox.Show("Morate izabrati pacijenta", "Nevalidan unos", MessageBoxButton.OK);
                return;
            }

            if (AppointmentTypeCombo.SelectedItem == null)
            {
                MessageBox.Show("Morate izabrati tip termina", "Nevalidan unos", MessageBoxButton.OK);
                return;
            }
            if (DoctorTypeCombo.SelectedItem == null)
            {
                MessageBox.Show("Morate izabrati tip lekara", "Nevalidan unos", MessageBoxButton.OK);
                return;
            }
            if (!UInt64.TryParse(DurationInMinutes.Text, out var res))
            {
                MessageBox.Show("Trajanje mora biti pozitivna celobrojna vrednost", "Nevalidan unos", MessageBoxButton.OK);
                return;
            }

            DoctorType doctorType       = Doctor.DoctorTypeFromString(DoctorTypeCombo.SelectedItem.ToString());
            int        duration         = int.Parse(DurationInMinutes.Text);
            string     jmbg             = PatientsList.SelectedItem.ToString().Split('-')[1].Trim();
            Patient    patient          = _patientController.GetOneByJMBG(jmbg);
            DateTime   appointmentStart = _appointmentTimesController.GetNextEarliestAppointmentTime(DateTime.Today.AddHours(DateTime.Now.TimeOfDay.Hours).AddMinutes(DateTime.Now.TimeOfDay.Minutes));

            DateTime        appointmentEnd = appointmentStart.AddMinutes(duration);
            AppointmentType appointmentType;
            RoomType        roomType;

            if (AppointmentTypeCombo.Text.Equals("Operacija"))
            {
                appointmentType = AppointmentType.operation;
                roomType        = RoomType.operatingRoom;
            }
            else
            {
                appointmentType = AppointmentType.generalPractitionerCheckup;
                roomType        = RoomType.examinationRoom;
            }
            bool retVal = _urgentAppointmentController.CreateNewUrgentAppointment(patient, duration, doctorType, roomType, appointmentType, appointmentStart, appointmentEnd);

            if (retVal)
            {
                Close();
            }
            else
            {
                PostponeAppointmentWIndow postponeWindow = new PostponeAppointmentWIndow(this, patient, duration, doctorType, roomType, appointmentType, appointmentStart);
                postponeWindow.ShowDialog();
            }
        }
コード例 #11
0
 public ActionResult Edit([Bind(Include = "DoctorTypeID,Label")] DoctorType doctorType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(doctorType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(doctorType));
 }
コード例 #12
0
 public ActionResult Edit([Bind(Include = "doctor_type_id,doctor_type_name,doctor_type_isDeleted")] DoctorType doctorType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(doctorType).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(doctorType));
 }
コード例 #13
0
        public ActionResult Create([Bind(Include = "doctor_type_id,doctor_type_name,doctor_type_isDeleted")] DoctorType doctorType)
        {
            if (ModelState.IsValid)
            {
                db.DoctorTypes.Add(doctorType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(doctorType));
        }
コード例 #14
0
        public ActionResult Create([Bind(Include = "DoctorTypeID,Label")] DoctorType doctorType)
        {
            if (ModelState.IsValid)
            {
                db.DoctorTypes.Add(doctorType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(doctorType));
        }
コード例 #15
0
        public List <Doctor> GetDoctorsByType(DoctorType type)
        {
            List <Doctor> doctors = new List <Doctor>();

            foreach (Doctor doctor in _doctorRepository.GetAll())
            {
                if (doctor.doctorType.Equals(type))
                {
                    doctors.Add(doctor);
                }
            }
            return(doctors);
        }
コード例 #16
0
        public List <Doctor> GetFilteredDoctors(List <Doctor> doctors, DoctorType doctorType)
        {
            List <Doctor> filteredDoctors = new List <Doctor>();

            foreach (Doctor doctor in doctors)
            {
                if (doctor.doctorType == doctorType)
                {
                    filteredDoctors.Add(doctor);
                }
            }
            return(filteredDoctors);
        }
コード例 #17
0
        internal Doctor(
            string name,
            string userId,
            DoctorType doctorType)
        {
            Guard.AgainstEmptyString <InvalidUserException>(userId, nameof(userId));
            Guard.AgainstEmptyString <InvalidNameException>(name, nameof(name));

            this.UserId       = userId;
            this.Name         = name;
            this.DoctorType   = doctorType;
            this.appointments = new HashSet <Appointment>();
        }
コード例 #18
0
        // GET: DoctorTypes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DoctorType doctorType = db.DoctorTypes.Find(id);

            if (doctorType == null)
            {
                return(HttpNotFound());
            }
            return(View(doctorType));
        }
 public PostponeAppointmentWIndow(NewUrgentAppointment parent, Patient patient, int duration, DoctorType doctorType, RoomType roomType, AppointmentType appointmentType, DateTime earliestAppointmentTime)
 {
     _parent                    = parent;
     _patient                   = patient;
     _appointmentDuration       = duration;
     _doctorType                = doctorType;
     _roomType                  = roomType;
     _appointmentType           = appointmentType;
     _earliestAppointmentTime   = earliestAppointmentTime;
     _appointmentsForPostponing = new List <Appointment>();
     InitializeComponent();
     _appointmentsInTheUpcomingWeek = GetAppointmentsForUpcomingWeek();
     InitializeAppointments(_appointmentsInTheUpcomingWeek);
 }
コード例 #20
0
        /// <summary>
        /// Ged doctor type by id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static DoctorType GetDoctorType(int id)
        {
            HealtheeEntities db = new HealtheeEntities();

            if (DEBUG)
            {
                db.Database.Log = Console.WriteLine;
            }

            var query = from dt in db.DoctorTypes
                        where dt.DoctorTypeID == id
                        select dt;
            DoctorType dType = query.Single();

            return(dType);
        }
コード例 #21
0
        internal Doctor(
            string name,
            string userId,
            DoctorType doctorType,
            PhoneNumber phoneNumber,
            Address address)
        {
            Guard.AgainstEmptyString <InvalidNameException>(name, nameof(name));
            Guard.AgainstEmptyString <InvalidUserException>(userId, nameof(userId));

            this.Name         = name;
            this.UserId       = userId;
            this.DoctorType   = doctorType;
            this.PhoneNumber  = phoneNumber;
            this.Address      = address;
            this.appointments = new HashSet <Appointment>();
        }
コード例 #22
0
 public Doctor(string userName,
               string password,
               string name,
               string surname,
               string middleName,
               Sex sex,
               DateTime dateOfBirth,
               string uidn,
               Address address,
               string homePhone,
               string cellPhone,
               string email1,
               string email2,
               TimeTable timeTable,
               Hospital hospital,
               Room office,
               DoctorType doctorType)
     : base(timeTable, hospital, userName, password, name, surname, middleName, sex, dateOfBirth, uidn, address, homePhone, cellPhone, email1, email2)
 {
     _office      = office;
     _docTypeEnum = doctorType;
 }
コード例 #23
0
 private ISpecification <Doctor> GetSpecificationByType(DoctorType type)
 {
     return(new ExpressionSpecification <Doctor>(o => o.DoctorType == type));
 }
コード例 #24
0
        public static void RequestDoctor(UserToken userToken, GeoCoordinate location, string locationDetail, DoctorType doctorType, DateTime appointmentDate, DateTime requestDate)
        {
            if (userToken.ID.Equals(AuthenticationManager.SavedUsers.Find(item => item.userInfo.Username.Equals(userToken.userInfo.Username))))
            {
                try
                {
                    using (var db = new DatabaseMedAssistEntities())
                    {
                        string day   = appointmentDate.DayOfWeek.ToString();
                        var    query = from dbDoctor in db.DatabaseDoctors
                                       where dbDoctor.DoctorType == doctorType.ToString() &&
                                       (day == "Monday" ? dbDoctor.AppointmentMonday :
                                        day == "Tuesday" ? dbDoctor.AppointmentTuesday :
                                        day == "Wednesday" ? dbDoctor.AppointmentWednesday :
                                        day == "Thursday" ? dbDoctor.AppointmentThursday :
                                        day == "Friday" ? dbDoctor.AppointmentFriday :
                                        day == "Saturday" ? dbDoctor.AppointmentSaturday : dbDoctor.AppointmentSunday) == false
                                       select dbDoctor;
                        int count = query.Count();
                        if (count == 0)
                        {
                            //ui doctor not available
                        }
                        else
                        {
                            var        selectedDoctor = query.OrderBy(item => GetDistance(Convert.ToDouble(item.HospitalLatitude), Convert.ToDouble(item.HospitalLongitude), location)).ThenByDescending(freeday => Convert.ToInt16(freeday.AppointmentMonday) + Convert.ToInt16(freeday.AppointmentTuesday) + Convert.ToInt16(freeday.AppointmentWednesday) + Convert.ToInt16(freeday.AppointmentThursday) + Convert.ToInt16(freeday.AppointmentFriday) + Convert.ToInt16(freeday.AppointmentSaturday) + Convert.ToInt16(freeday.AppointmentSunday)).First();
                            DoctorInfo doctorInfo     = new DoctorInfo(selectedDoctor.DoctorName, selectedDoctor.DoctorID.GetValueOrDefault(), Convert.ToInt32(selectedDoctor.DoctorAge), selectedDoctor.DoctorPicture, selectedDoctor.DoctorHospital,
                                                                       selectedDoctor.DoctorType == "Psikolog" ? DoctorType.Psikolog : DoctorType.DokterUmum);
                            var             healthcare      = db.DatabaseUsers.SingleOrDefault(k => k.Nama == selectedDoctor.DoctorHospital);
                            DatabaseRequest databaseRequest = new DatabaseRequest
                            {
                                IsLocked          = false,
                                SenderID          = userToken.userInfo.UserID,
                                ReceiverID        = healthcare.UserID,
                                LocationLatitude  = Convert.ToSingle(location.Latitude),
                                LocationLongitude = Convert.ToSingle(location.Longitude),
                                LocationDetail    = locationDetail,
                                Request           = "Dokter",
                                RequestDetail     = selectedDoctor.DoctorID.ToString() + "," + appointmentDate.ToShortDateString() + "," + requestDate.ToShortDateString()
                            };
                            switch (day)
                            {
                            case "Monday":
                                selectedDoctor.AppointmentMonday = true;
                                break;

                            case "Tuesday":
                                selectedDoctor.AppointmentTuesday = true;
                                break;

                            case "Wednesday":
                                selectedDoctor.AppointmentWednesday = true;
                                break;

                            case "Thursday":
                                selectedDoctor.AppointmentThursday = true;
                                break;

                            case "Friday":
                                selectedDoctor.AppointmentFriday = true;
                                break;

                            case "Saturday":
                                selectedDoctor.AppointmentSaturday = true;
                                break;

                            case "Sunday":
                                selectedDoctor.AppointmentSunday = true;
                                break;
                            }
                            db.DatabaseRequests.Add(databaseRequest);
                            db.SaveChanges();
                        }
                    }
                }
                catch (Exception ex)
                {
                    //ui error happened
                }
            }
            else
            {
                //textbox login expired to UI
            }
        }
コード例 #25
0
 public IEnumerable <Doctor> GetDoctorByType(DoctorType doctorType)
 => _doctorRepository.GetDoctorByType(doctorType);
コード例 #26
0
ファイル: DataSeeder.cs プロジェクト: poxmel2019/ProjectTask
        public async Task SeedAsync()
        {
            if (!UnitOfWork.Select <DoctorType>().Any())
            {
                var dto = new DoctorType()
                {
                    Name         = "Лор",
                    LastEditedAt = DateTime.Now,
                    CreateDate   = DateTime.Now,
                };

                UnitOfWork.Insert <DoctorType>(dto);
                dto = new DoctorType()
                {
                    Name         = "Окулист",
                    LastEditedAt = DateTime.Now,
                    CreateDate   = DateTime.Now,
                };

                UnitOfWork.Insert <DoctorType>(dto);
            }
            if (!UnitOfWork.Select <Doctor>().Any())
            {
                var doctor = new Doctor()
                {
                    Address      = "Нурсултан",
                    IIN          = "123123456456",
                    FirstName    = "Айболит",
                    LastName     = "Доктор1",
                    SurName      = "Попов",
                    LastEditedAt = DateTime.Now,
                    CreateDate   = DateTime.Now,
                };

                UnitOfWork.Insert <Doctor>(doctor);

                doctor = new Doctor()
                {
                    Address      = "Нурсултан",
                    IIN          = "123123456456",
                    FirstName    = "Айболат",
                    LastName     = "Доктор2",
                    SurName      = "Смирнов",
                    LastEditedAt = DateTime.Now,
                    CreateDate   = DateTime.Now,
                };

                UnitOfWork.Insert <Doctor>(doctor);
            }


            if (!UnitOfWork.Select <Pacient>().Any())
            {
                var dto = new Pacient()
                {
                    Address      = "Нурсултан",
                    IIN          = "123123456456",
                    FirstName    = "Дастан",
                    LastName     = "Пациент",
                    SurName      = "Пациент1",
                    LastEditedAt = DateTime.Now,
                    CreateDate   = DateTime.Now,
                };

                UnitOfWork.Insert <Pacient>(dto);
                dto = new Pacient()
                {
                    Address      = "Нурсултан",
                    IIN          = "123123456456",
                    FirstName    = "Айдана",
                    LastName     = "Пациентова",
                    SurName      = "Пациент2",
                    LastEditedAt = DateTime.Now,
                    CreateDate   = DateTime.Now,
                };

                UnitOfWork.Insert <Pacient>(dto);
            }

            await UnitOfWork.CommitAsync().ConfigureAwait(false);
        }
コード例 #27
0
 public DoctorFilter(string name, string surname, DoctorType type)
 {
     _name    = name;
     _surname = surname;
     _type    = type;
 }
コード例 #28
0
 private ISpecification <Appointment> GetSpecificationByDoctorType(DoctorType type)
 {
     return(new ExpressionSpecification <Appointment>(o => o.DoctorInAppointment == null ? false : o.DoctorInAppointment.DoctorType == type));
 }
コード例 #29
0
 public IEnumerable <Doctor> GetDoctorByType(DoctorType doctorType)
 => _doctorService.GetDoctorByType(doctorType);
 public bool CreateNewUrgentAppointment(Patient patient, int duration, DoctorType doctorType, RoomType roomType, AppointmentType appointmentType, DateTime appointmentStart, DateTime appointmentEnd)
 {
     return(_urgentAppointmentService.CreateNewUrgentAppointment(patient, duration, doctorType, roomType, appointmentType, appointmentStart, appointmentEnd));
 }