示例#1
0
        public Booking BookVisitDP(Visit visit, DoctorMapping mapping)
        {
            var foreignAddress       = mapping.ForeignAddress;
            var defaultDoctorService = mapping.ForeignDoctorService;
            var visitDoctorService   = visit.DoctorSchedule.ForeignDoctorService;
            var patient = visit.VisitPatient;

            var bookRequest = new BookSlotRequest()
            {
                DoctorServiceId = (visit.DoctorSchedule.ForeignDoctorService ?? defaultDoctorService).Id,
                IsReturning     = false,
                Patient         = new Patient()
                {
                    Name      = patient.Name,
                    Surname   = patient.Surname,
                    BirthDate = patient.Birthdate,
                    Email     = patient.Email,
                    Gender    = patient.StrGender,
                    Nin       = patient.NIN,
                    Phone     = patient.Phone
                }
            };

            var booking = _client.BookSlot(foreignAddress.ForeignFacilityId, foreignAddress.ForeignDoctorId, foreignAddress.Id, visit.StartAt, bookRequest);

            if (booking.Message == null)
            {
                return(booking);
            }
            else
            {
                throw new DpBookingException(booking.Message);
            }
        }
    public async Task <IActionResult> BookSlot(string dayId, [FromBody] BookSlotRequest bookSlot)
    {
        var command  = bookSlot.ToCommand(dayId);
        var metadata = GetCommandMetadata();

        await _dispatcher.Dispatch(command, metadata);

        return(Ok());
    }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="facilityId"></param>
        /// <param name="doctorId"></param>
        /// <param name="addressId"></param>
        /// <param name="start"></param>
        /// <param name="bookSlotRequest"></param>
        /// <returns></returns>
        public Booking BookSlot(string facilityId, string doctorId, string addressId, DateTime start, BookSlotRequest bookSlotRequest)
        {
            var request = new RestRequest($"{Prefix}/facilities/{facilityId}/doctors/{doctorId}/addresses/{addressId}/slots/{EncodeUniversalString(start)}/book", Method.POST);

            request.AddJsonBody(bookSlotRequest);


            var response = _client.Execute <Booking>(request);

            return(response.Data);
        }