コード例 #1
0
        public async Task <ServiceReturn <bool> > CancelAppointmentForUniquePatientAsync(AuthenticationType tipoAuth, string facilityId, string apptId, string userID, string cancelObs, string successMessage = "", string errorMessage = "")
        {
            var uiMessages = new Dictionary <string, string>();

            if (!string.IsNullOrEmpty(errorMessage))
            {
                uiMessages.Add(ServiceReturnHandling.GenericMessageKey, errorMessage);
            }
            else
            {
                uiMessages.Add(ServiceReturnHandling.GenericMessageKey, "Não foi possível cancelar a marcação.");
            }
            if (!string.IsNullOrEmpty(successMessage))
            {
                uiMessages.Add(ServiceReturnHandling.SuccessMessageKey, successMessage);
            }

            try
            {
                string baseUrl = await CommunicationManager.ServiceManager.GetServiceEndpoint("GP_BASE_URL");

                Generated.AppointmentClient sc = new Generated.AppointmentClient(baseUrl, await CommunicationManager.Instance.GetHttpClientWithToken(tipoAuth, new HttpClient()));
                //string userID = (User != null && !string.IsNullOrEmpty(User.UserId)) ? User.UserId : string.Empty;
                int operationTimeOut = 30;

                await sc.CancelAppointmentByUniquePatientIdAsync(facilityId, apptId, userID, operationTimeOut, GetGPAppVersion());

                return(ServiceReturnHandling.BuildSuccessCallReturn <bool>(true, uiMessages));
            }
            catch (Exception ex)
            {
                return(ServiceReturnHandling.HandleException <bool>(ex, uiMessages));
            }
        }
コード例 #2
0
        public async Task <ServiceReturn <List <Appointment> > > GetAllPatientAndDescendantsAppointmentsAsync(AuthenticationType tipoAuth, IEnumerable <string> facilityIds, IEnumerable <string> patientIds, DateTime minDate, DateTime maxDate, int skip, int take, string successMessage = "", string errorMessage = "")
        {
            var uiMessages = new Dictionary <string, string>();

            if (!string.IsNullOrEmpty(errorMessage))
            {
                uiMessages.Add(ServiceReturnHandling.GenericMessageKey, errorMessage);
            }
            else
            {
                uiMessages.Add(ServiceReturnHandling.GenericMessageKey, "Não é possível obter lista de marcações");
            }

            if (!string.IsNullOrEmpty(successMessage))
            {
                uiMessages.Add(ServiceReturnHandling.SuccessMessageKey, successMessage);
            }

            try
            {
                List <Appointment> appointments = null;
                string             userID       = (User != null && !string.IsNullOrEmpty(User.UserId)) ? User.UserId : string.Empty; // Patient uniqueid??? Validar caso seja anonimo access??

                string baseUrl = await CommunicationManager.ServiceManager.GetServiceEndpoint("GP_BASE_URL");

                Generated.AppointmentClient sc     = new Generated.AppointmentClient(baseUrl, await CommunicationManager.Instance.GetHttpClientWithToken(tipoAuth, new HttpClient()));
                Generated.AppointmentFilter filter = new Generated.AppointmentFilter();

                if (facilityIds.Count() > 0)
                {
                    filter.FacilityIds = new ObservableCollection <double>(facilityIds.Select(x => double.Parse(x)));
                }

                filter.DescendantPatientUniqueIds = new ObservableCollection <string>(patientIds);

                var result = await sc.AppointmentsByParentAsync(filter, userID, "true", minDate, maxDate, skip, take, GetGPAppVersion());

                if (result != null)
                {
                    appointments = new List <Appointment>();
                    foreach (var item in result)
                    {
                        appointments.Add(TranslateAppointmentGPToLocal(item));
                    }
                }

                return(ServiceReturnHandling.BuildSuccessCallReturn <List <Appointment> >(appointments, uiMessages));
            }
            catch (Exception ex)
            {
                return(ServiceReturnHandling.HandleException <List <Appointment> >(ex, uiMessages));
            }
        }
コード例 #3
0
        public async Task <ServiceReturn <ScheduledAppointment> > RescheduleAppointmentAsync(AuthenticationType tipoAuth, string userId, string facilityId, FreeTimeSlot freeTimeSlotLocal, Appointment oldApp, string cod_motivo, DateTime efrExpDate, string efrCard, string successMessage = "", string errorMessage = "")
        {
            #region uimessage
            var uiMessages = new Dictionary <string, string>();
            if (!string.IsNullOrEmpty(errorMessage))
            {
                uiMessages.Add(ServiceReturnHandling.GenericMessageKey, errorMessage);
            }
            else
            {
                uiMessages.Add(ServiceReturnHandling.GenericMessageKey, "Não foi possível efetuar a marcação.");
            }
            if (!string.IsNullOrEmpty(successMessage))
            {
                uiMessages.Add(ServiceReturnHandling.SuccessMessageKey, successMessage);
            }
            #endregion

            ScheduledAppointment scheduledAppoint;

            try
            {
                string baseUrl = await CommunicationManager.ServiceManager.GetServiceEndpoint("GP_BASE_URL");

                Generated.AppointmentClient sc = new Generated.AppointmentClient(baseUrl, await CommunicationManager.Instance.GetHttpClientWithToken(tipoAuth, new HttpClient()));
                var obsFinal = !string.IsNullOrEmpty(freeTimeSlotLocal.Observations) ? freeTimeSlotLocal.Observations : string.Empty;

                var resApp = TranslateFreeTimeSlotLocalToGP(freeTimeSlotLocal);

                var res = await sc.RescheduleAppointmentAsync(resApp, facilityId, oldApp.Id.ToString(), userId, obsFinal, cod_motivo, efrCard, efrExpDate, GetGPAppVersion());

                if (res != null)
                {
                    scheduledAppoint = TranslateScheduledAppointmentGPToLocal(res.First());
                }
                else
                {
                    throw new Exception();
                }

                return(ServiceReturnHandling.BuildSuccessCallReturn <ScheduledAppointment>(scheduledAppoint, uiMessages));
            }
            catch (Exception ex)
            {
                return(ServiceReturnHandling.HandleException <ScheduledAppointment>(ex, uiMessages));
            }
        }
コード例 #4
0
        public async Task <ServiceReturn <ScheduledAppointment> > ScheduleAppointmentForUniquePatientAsync(AuthenticationType tipoAuth, string userId, string facilityId, FreeTimeSlot freeTimeSlotLocal, DateTime efrExpDate, string efrCard, string successMessage = "", string errorMessage = "")
        {
            #region uimessage
            var uiMessages = new Dictionary <string, string>();
            if (!string.IsNullOrEmpty(errorMessage))
            {
                uiMessages.Add(ServiceReturnHandling.GenericMessageKey, errorMessage);
            }
            else
            {
                uiMessages.Add(ServiceReturnHandling.GenericMessageKey, "Não foi possível efetuar a marcação.");
            }
            if (!string.IsNullOrEmpty(successMessage))
            {
                uiMessages.Add(ServiceReturnHandling.SuccessMessageKey, successMessage);
            }
            #endregion

            ScheduledAppointment scheduledAppoint;

            try
            {
                string baseUrl = await CommunicationManager.ServiceManager.GetServiceEndpoint("GP_BASE_URL");

                Generated.AppointmentClient sc = new Generated.AppointmentClient(baseUrl, await CommunicationManager.Instance.GetHttpClientWithToken(tipoAuth, new HttpClient()));
                string group = Configuration.Instance.Configurations["GROUP"];
                Generated.FreeTimeSlot2 freeSlotGP = TranslateFreeTimeSlotLocalToGP(freeTimeSlotLocal);
                int operationTimeOut = 30;
                var res = await sc.ScheduleAppointmentForUniquePatientAsync(freeSlotGP, facilityId, userId, efrCard, efrExpDate, operationTimeOut, GetGPAppVersion());

                if (res != null)
                {
                    scheduledAppoint = TranslateScheduledAppointmentGPToLocal(res.First());
                }
                else
                {
                    throw new Exception();
                }

                return(ServiceReturnHandling.BuildSuccessCallReturn <ScheduledAppointment>(scheduledAppoint, uiMessages));
            }
            catch (Exception ex)
            {
                return(ServiceReturnHandling.HandleException <ScheduledAppointment>(ex, uiMessages));
            }
        }
コード例 #5
0
        public async Task <ServiceReturn <List <Preparation> > > GetPreparationsAfterScheduleAsync(AuthenticationType tipoAuth, string facilityId, string IdAppointment, string successMessage = "", string errorMessage = "")
        {
            var uiMessages = new Dictionary <string, string>();

            if (!string.IsNullOrEmpty(errorMessage))
            {
                uiMessages.Add(ServiceReturnHandling.GenericMessageKey, errorMessage);
            }
            else
            {
                uiMessages.Add(ServiceReturnHandling.GenericMessageKey, "Não é possível obter lista de preparações");
            }

            if (!string.IsNullOrEmpty(successMessage))
            {
                uiMessages.Add(ServiceReturnHandling.SuccessMessageKey, successMessage);
            }

            List <Preparation> preps = null;

            try
            {
                string baseUrl = await CommunicationManager.ServiceManager.GetServiceEndpoint("GP_BASE_URL");

                Generated.AppointmentClient sc = new Generated.AppointmentClient(baseUrl, await CommunicationManager.Instance.GetHttpClientWithToken(tipoAuth, new HttpClient()));
                var prepIni = await sc.GetPreparationsAfterScheduleAsync(facilityId, IdAppointment, GetGPAppVersion());

                if (prepIni != null)
                {
                    preps = new List <Preparation>();
                    foreach (var item in prepIni)
                    {
                        Preparation prep = TranslatePreparationGPToLocal(item);
                        prep.FacilityId = facilityId; // facility nao vem mapeada.. adicionada manualmente pois é necessária no GetLoadPreparationObjectAsync (obter doc da preparação)
                        preps.Add(prep);
                    }
                }

                return(ServiceReturnHandling.BuildSuccessCallReturn <List <Preparation> >(preps, uiMessages));
            }
            catch (Exception ex)
            {
                return(ServiceReturnHandling.HandleException <List <Preparation> >(ex, uiMessages));
            }
        }
コード例 #6
0
        public async Task <ServiceReturn <Preparation> > GetLoadPreparationObjectAsync(AuthenticationType tipoAuth, Preparation prep, string facilityId, string IdAppointment, string successMessage = "", string errorMessage = "")
        {
            var uiMessages = new Dictionary <string, string>();

            if (!string.IsNullOrEmpty(errorMessage))
            {
                uiMessages.Add(ServiceReturnHandling.GenericMessageKey, errorMessage);
            }
            else
            {
                uiMessages.Add(ServiceReturnHandling.GenericMessageKey, "Não é possível obter lista de preparações");
            }

            if (!string.IsNullOrEmpty(successMessage))
            {
                uiMessages.Add(ServiceReturnHandling.SuccessMessageKey, successMessage);
            }

            try
            {
                string baseUrl = await CommunicationManager.ServiceManager.GetServiceEndpoint("GP_BASE_URL");

                Generated.AppointmentClient sc     = new Generated.AppointmentClient(baseUrl, await CommunicationManager.Instance.GetHttpClientWithToken(tipoAuth, new HttpClient()));
                Generated.Preparation       prepGP = TranslatePreparationLocalToGP(prep);
                ObservableCollection <Generated.Preparation> tmp = new ObservableCollection <Generated.Preparation>(new List <Generated.Preparation>()
                {
                    prepGP
                });
                var prepFinal = await sc.LoadLocalPreparationsDocumentsAsync(tmp, facilityId, User.UserId, string.Empty, GetGPAppVersion());

                if (prepFinal != null)
                {
                    prep = TranslatePreparationGPToLocal(prepFinal.First());
                }

                return(ServiceReturnHandling.BuildSuccessCallReturn <Preparation>(prep, uiMessages));
            }
            catch (Exception ex)
            {
                return(ServiceReturnHandling.HandleException <Preparation>(ex, uiMessages));
            }
        }
コード例 #7
0
        public async Task <ServiceReturn <bool> > CheckInFromDeviceAsync(AuthenticationType tipoAuth, string _facilityId, string _appointmentId, string successMessage = "", string errorMessage = "")
        {
            #region uimessage
            var uiMessages = new Dictionary <string, string>();
            if (!string.IsNullOrEmpty(errorMessage))
            {
                uiMessages.Add(ServiceReturnHandling.GenericMessageKey, errorMessage);
            }
            else
            {
                uiMessages.Add(ServiceReturnHandling.GenericMessageKey, "Não foi possível efectuar checkin do dispositivo.");
            }
            if (!string.IsNullOrEmpty(successMessage))
            {
                uiMessages.Add(ServiceReturnHandling.SuccessMessageKey, successMessage);
            }
            #endregion

            bool CheckedIn = false;

            try
            {
                string baseUrl = await CommunicationManager.ServiceManager.GetServiceEndpoint("GP_BASE_URL");

                Generated.AppointmentClient sc = new Generated.AppointmentClient(baseUrl, await CommunicationManager.Instance.GetHttpClientWithToken(tipoAuth, new HttpClient()));
                //TODO nao existe o metodo CheckInFromDevice no AppointmentClient
                //var result = sc.(userID, facilityIds, minDate.ToString(), maxDate.ToString(), skip, take, GetGPAppVersion());

                //CheckedIn = result;

                return(ServiceReturnHandling.BuildSuccessCallReturn <bool>(CheckedIn, uiMessages));
            }
            catch (Exception ex)
            {
                return(ServiceReturnHandling.HandleException <bool>(ex, uiMessages));
            }
        }