Ejemplo n.º 1
0
        public IActionResult Get()
        {
            List <Appointment> appointments     = _appointmentService.InitializeAppointments("2406978890047", new DateTime(2020, 12, 5));
            List <AvailableAppointmentsDTO> dto = AppointmentMapper.AppointmentsToAvailableAppointmentsDTO(appointments);

            return(Ok(dto));
        }
Ejemplo n.º 2
0
        public void Map_appointment_persistance_to_appointment_entity_when_persistance_is_null()
        {
            AppointmentPersistence appointmentsPersistance = null;

            Assert.Throws <ArgumentNullException>(()
                                                  => AppointmentMapper.MapAppointmentsPersistenceToAppointmentsEntity(appointmentsPersistance));
        }
Ejemplo n.º 3
0
        public void Map_appointment_persistance_collection_to_appointment_entity_collection_when_collection_is_null()
        {
            List <AppointmentPersistence> listOfAppointmentsPersistance = null;

            Assert.Throws <ArgumentNullException>(()
                                                  => AppointmentMapper.MapAppointmentsPersistenceCollectionToAppointmentsEntityCollection(listOfAppointmentsPersistance));
        }
Ejemplo n.º 4
0
 public IEnumerable <Appointment> GetForPatient(Guid patientId)
 {
     using (MQuinceDbContext _context = new MQuinceDbContext(_dbContext))
     {
         return(AppointmentMapper.MapAppointmentsPersistenceCollectionToAppointmentsEntityCollection(_context.Appointments.Where(c => c.PatientPersistanceId == patientId && c.IsCanceled == false).ToList()));
     }
 }
Ejemplo n.º 5
0
 public IEnumerable <Appointment> GetAll()
 {
     using (MQuinceDbContext _context = new MQuinceDbContext(_dbContext))
     {
         return(AppointmentMapper.MapAppointmentsPersistenceCollectionToAppointmentsEntityCollection(_context.Appointments.ToList()));
     }
 }
Ejemplo n.º 6
0
 public Appointment GetById(Guid id)
 {
     using (MQuinceDbContext _context = new MQuinceDbContext(_dbContext))
     {
         return(AppointmentMapper.MapAppointmentsPersistenceToAppointmentsEntity(_context.Appointments.SingleOrDefault(c => c.Id.Equals(id))));
     }
 }
Ejemplo n.º 7
0
 public IEnumerable <Appointment> GetForDoctor(Guid doctorId)
 {
     using (MQuinceDbContext _context = new MQuinceDbContext(_dbContext))
     {
         return(AppointmentMapper.MapAppointmentsPersistenceCollectionToAppointmentsEntityCollection(_context.Appointments.Where(c => c.Id.Equals(doctorId) && c.IsCanceled == false)));
     }
 }
Ejemplo n.º 8
0
        public void Map_appointment_persistence_to_appointment_entity_when_appointment_persistance_is_null()
        {
            Appointment appointment = null;

            Assert.Throws <ArgumentNullException>(()
                                                  => AppointmentMapper.MapAppointmentEntityToAppointmentIdentifierDTO(appointment));
        }
Ejemplo n.º 9
0
        public IActionResult GetAvailable(SearchAppointmentsStandardDTO appointmentsDTO)
        {
            List <Appointment> appointments     = _appointmentService.GetAvailableBy(appointmentsDTO.DoctorId, appointmentsDTO.Date).ToList();
            List <AvailableAppointmentsDTO> dto = AppointmentMapper.AppointmentsToAvailableAppointmentsDTO(appointments);

            return(Ok(dto));
        }
Ejemplo n.º 10
0
        public IActionResult GetCancelableAppointments()
        {
            string                   id              = User.Identity.Name;
            List <Appointment>       appointments    = _appointmentService.GetCancelableAppointments(id);
            List <GetAppointmentDTO> appointmentsDTO = AppointmentMapper.ListAppointmentToListGetAppointmentDTO(appointments);

            return(Ok(appointmentsDTO));
        }
Ejemplo n.º 11
0
 public IEnumerable <Appointment> GetAppointmentForDoctorForDate(Guid doctorId, DateTime requestDate)
 {
     using (MQuinceDbContext _context = new MQuinceDbContext(_dbContext))
     {
         return(AppointmentMapper.MapAppointmentsPersistenceCollectionToAppointmentsEntityCollection(_context.Appointments.ToList())
                .Where(x => x.DoctorId.Equals(doctorId) && x.DateRange.StartDateTime.Date.Equals(requestDate.Date) && x.IsCanceled == false));
     }
 }
Ejemplo n.º 12
0
        private IdentifiableDTO <AppointmentDTO> InitializeAppointments(Appointment appointment, Guid patientId, Guid doctorId)
        {
            IdentifiableDTO <AppointmentDTO> appointmentDTO = AppointmentMapper.MapAppointmentEntityToAppointmentIdentifierDTO(appointment);

            appointmentDTO.EntityDTO.PatientId = patientId;
            appointmentDTO.EntityDTO.DoctorId  = doctorId;
            return(appointmentDTO);
        }
Ejemplo n.º 13
0
        public void Map_appointment_persistence_to_appointment_entity()
        {
            AppointmentPersistence appointmentsPersistance = this.GetAppointmentPersistanceFirst();

            Appointment appointments = AppointmentMapper.MapAppointmentsPersistenceToAppointmentsEntity(appointmentsPersistance);

            Assert.True(this.IsEqualAppointmentPersistanceAndAppointmentEntity(appointmentsPersistance, appointments));
        }
Ejemplo n.º 14
0
 public void Update(Appointment entity)
 {
     using (MQuinceDbContext _context = new MQuinceDbContext(_dbContext))
     {
         _context.Appointments.Update(AppointmentMapper.MapAppointmentEntityToAppointmentPersistence(entity));
         _context.SaveChanges();
     }
 }
Ejemplo n.º 15
0
        public void Map_appointment_entity_to_appointment_identifier_dto()
        {
            Appointment appointment = this.GetPatient();

            IdentifiableDTO <AppointmentDTO> appointmentDTO = AppointmentMapper.MapAppointmentEntityToAppointmentIdentifierDTO(appointment);

            Assert.True(IsEqualAppointmentPersistanceAndAppointmentEntity(appointmentDTO, appointment));
        }
Ejemplo n.º 16
0
        public void Map_appointment_persistance_collection_to_appointment_entity_collection()
        {
            List <AppointmentPersistence> appointmentsPersistance = this.GetListOfAppointmentPersistance();

            List <Appointment> listOfAppointments = AppointmentMapper.MapAppointmentsPersistenceCollectionToAppointmentsEntityCollection(appointmentsPersistance).ToList();

            Assert.True(this.IsEqualAppointmentPersistanceAndAppointmentEntity(appointmentsPersistance[0], listOfAppointments[0]));
            Assert.True(this.IsEqualAppointmentPersistanceAndAppointmentEntity(appointmentsPersistance[1], listOfAppointments[1]));
        }
        private AppointmentReasonsResult GetAppointmentReasons(string providerID)
        {
            var postData = AppointmentMapper.MapToAppointmentReasonsPOSTData(providerID);
            var restUrl  = "/patientappointmentreasons ";

            JToken action = api.GET(restUrl, postData);

            return(GetReasonsResults(action));
        }
        private CreateAppointmentResult Create(Appointment appointment, string departmentID)
        {
            var postData = AppointmentMapper.MapToPOSTData(appointment, departmentID);
            var restUrl  = "/appointments";

            JToken action = api.POST(restUrl, postData);

            return(GetCreateResults(action));
        }
Ejemplo n.º 19
0
        public IActionResult GetAvailable2(SearchAppointmentsDTO appoitmentsDTO)
        {
            PriorityParameters parameters =
                AppointmentMapper.SearchAppointmentsDTOToPriorityParameters(appoitmentsDTO);
            List <Appointment> appointments     = _appointmentService.GetAvailableByStrategy(parameters).ToList();
            List <AvailableAppointmentsDTO> dto = AppointmentMapper.AppointmentsToAvailableAppointmentsDTOWithDoctor(appointments);

            return(Ok(dto));
        }
        private AppointmentSlotsResult GetAppointmentSlots()
        {
            var postData = AppointmentMapper.MapToAppointmentSlotsPOSTData();
            var restUrl  = "/appointments/open";

            JToken action = api.POST(restUrl, postData);

            return(GetSearchResults(action));
        }
Ejemplo n.º 21
0
        public void TestInitialize()
        {
            MockDatabase = new Mock <IDatabase>();
            MockQuery    = new Mock <IQuery>();
            MockHydrater = new Mock <IHydrater <AppointmentVO> >();

            Target = new AppointmentMapper(MockDatabase.Object, MockHydrater.Object);

            MockDatabase.Setup(m => m.CreateQuery(It.IsAny <string>())).Returns(MockQuery.Object);
        }
Ejemplo n.º 22
0
        public List <TestPatientAppointment> InitiateTestPatients()
        {
            RA.TestAppointmentList testapptlist = new RA.TestAppointmentList();
            testapptlist.BackgroundListLoad();

            List <TestPatientAppointment> Testpatients = new List <TestPatientAppointment>();

            foreach (TestAppointment app in testapptlist)
            {
                TestPatientAppointment item = AppointmentMapper.FromRATestAppointment(app);
                Testpatients.Add(item);
            }
            return(Testpatients);
        }
Ejemplo n.º 23
0
 public IdentifiableDTO <AppointmentDTO> GetById(Guid id)
 {
     try
     {
         return(AppointmentMapper.MapAppointmentEntityToAppointmentIdentifierDTO(_appointmentRepository.GetById(id)));
     }
     catch (ArgumentNullException e)
     {
         throw new NotFoundEntityException();
     }
     catch (Exception e)
     {
         throw new InternalServerErrorException();
     }
 }
Ejemplo n.º 24
0
 public IEnumerable <IdentifiableDTO <AppointmentDTO> > GetForPatient(Guid patientId)
 {
     try
     {
         return(_appointmentRepository.GetForPatient(patientId).Select(c => AppointmentMapper.MapAppointmentEntityToAppointmentIdentifierDTO(c)));
     }
     catch (ArgumentNullException e)
     {
         throw new NotFoundEntityException();
     }
     catch (Exception e)
     {
         throw new InternalServerErrorException();
     }
 }
Ejemplo n.º 25
0
        public async Task <Appointment> GetAppointmentByIdAsync(int appointmentId)
        {
            try
            {
                Appointments dbAppointment = await _context.Appointments.FindAsync(appointmentId);

                if (dbAppointment == null)
                {
                    return(null);
                }

                return(AppointmentMapper.Map(dbAppointment));
            }
            catch (Exception e)
            {
                return(null);
            }
        }
        public IServiceResult Create(IServiceInput input)
        {
            var vm = input as CreateAppointmentVM;

            //var providers = providerService.Search(new ProviderSearchInput());

            //TODO: pass in provider ID


            var apptReasons = GetAppointmentReasons(vm.ProviderID);
            //var apptSlots = GetAppointmentSlots();

            // map patient
            Appointment appointment = CreateAppointmentVMMapper.MapToAppointment(vm);

            // call core method
            CreateAppointmentResult retval = Create(appointment, vm.DepartmentID);

            // return mapped result
            return(AppointmentMapper.MapToCreateAppointmentVM(appointment, retval));
        }
Ejemplo n.º 27
0
        public async Task <bool> AddAppointmentToCaseAsync(Case targetCase, Appointment appointment, bool save = true)
        {
            try
            {
                // First, add the appointment to appointments
                appointment.CaseId = targetCase.Id;
                _context.Appointments.Add(AppointmentMapper.Map(appointment));

                // Finally, add the appointment to the case model's appointments
                targetCase.Appointments.Add(appointment);

                if (save)
                {
                    await _context.SaveChangesAsync();
                }

                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Ejemplo n.º 28
0
        public IActionResult Schedule(ScheduleAppointmentDTO dto)
        {
            try
            {
                ValidateScheduleAppointment.Validate(dto);
            } catch (Exception)
            {
                return(BadRequest("Can not schedule appointmnet in the past"));
            }

            dto.PatientId = User.Identity.Name;

            Appointment appointment = AppointmentMapper.ScheduleAppointmentDTOToAppointment(dto);

            appointment.PatientId = dto.PatientId;
            Appointment scheduledAppointment = _appointmentService.ScheduleAppointment(appointment);

            if (scheduledAppointment == null)
            {
                return(BadRequest("Can not schedule appointment"));
            }

            return(Ok("Scheduled!"));
        }
Ejemplo n.º 29
0
 public IEnumerable <IdentifiableDTO <AppointmentDTO> > GetAppointmentForDoctorForDate(Guid doctorId, DateTime time)
 {
     try
     {
         return(_appointmentRepository.GetAppointmentForDoctorForDate(doctorId, time).Select(c => AppointmentMapper.MapAppointmentEntityToAppointmentIdentifierDTO(c)));
     }
     catch (ArgumentNullException e)
     {
         throw new NotFoundEntityException();
     }
     catch (Exception e)
     {
         throw new InternalServerErrorException();
     }
 }
Ejemplo n.º 30
0
        [HttpGet("getScheduledAppointmetsByPatient/{patientId}")]       // GET /api/appointment/getScheduledAppointmetsByPatient/{patientId}
        public IActionResult GetScheduledAppointmentsByPatient(int patientId)
        {
            List <AppointmentDto> result = new List <AppointmentDto>();

            App.Instance().AppointmentService.GetScheduledAppointmetsByPatient(patientId, DateTime.Now).ToList().ForEach(appointment => result.Add(AppointmentMapper.AppointmentToAppointmentDto(appointment)));
            if (result.Count == 0)
            {
                return(NotFound());
            }
            return(Ok(result));
        }