Exemplo n.º 1
0
        private async void LoadDataFromServer()
        {
            RequestRunning = true;

            IFHIRLabDataService dataService = ServiceLocator.Current.GetInstance <IFHIRLabDataService>();

            Bundle reports = await dataService.DiagnosticReportHistoryByIdAsync(async (e) =>
            {
                var dialog = new MessageDialog("Requested resource is not available on the server.", "Error");
                var result = await dialog.ShowAsync();
                if (NavigationService.CanGoBack)
                {
                    NavigationService.GoBack();
                }
            }, DiagnosticReportId);

            var resourceList = new List <DiagnosticReportServerRequestModel>();

            foreach (var item in reports.Entry)
            {
                resourceList.Add(new DiagnosticReportServerRequestModel(item));
            }

            DiagnosticReportVersions = resourceList;

            RequestRunning = false;
        }
        private async void LoadDataFromServer()
        {
            RequestRunning = true;

            IFHIRLabDataService dataService = ServiceLocator.Current.GetInstance <IFHIRLabDataService>();

            Bundle reports = await dataService.DiagnosticReportsForPatientAsync(async (e) =>
            {
                var dialog = new MessageDialog("Requested resource is not available on the server.", "Error");
                var result = await dialog.ShowAsync();
                if (NavigationService.CanGoBack)
                {
                    NavigationService.GoBack();
                }
            }, Services.SettingsServices.SettingsService.Instance.FhirPatientId, Hl7.Fhir.Rest.SummaryType.True);

            if (reports == null)
            {
                RequestRunning = false;
                return;
            }

            var resourceList = new List <DiagnosticReportModel>();

            foreach (var item in reports.Entry)
            {
                resourceList.Add(new DiagnosticReportModel((DiagnosticReport)item.Resource));
            }

            DiagnosticReports = new List <DiagnosticReportModel>(resourceList.OrderBy((x) => x.EffectiveDate));
            RequestRunning    = false;
        }
Exemplo n.º 3
0
        private async void LoadDataFromServer()
        {
            RequestRunning = true;

            IFHIRLabDataService dataService = ServiceLocator.Current.GetInstance <IFHIRLabDataService>();

            //CurrentDiagnosticReport = await dataService.DiagnosticReportByIdAsync(async (e) =>
            //{
            //    var dialog = new MessageDialog("Requested resource is not available on the server.", "Error");
            //    var result = await dialog.ShowAsync();
            //    if (NavigationService.CanGoBack)
            //    {
            //        NavigationService.GoBack();
            //    }
            //}, DiagnosticReportId);

            //List<Observation> observations = new List<Observation>();
            //foreach (var reference in CurrentDiagnosticReport.Result)
            //{
            //    if (reference.IsContainedReference)
            //    {
            //        var observation = CurrentDiagnosticReport.Contained.Where((x) => (x.Id == reference.Reference.TrimStart('#'))).FirstOrDefault();
            //        if (observation != null)
            //        {
            //            observations.Add((Observation)observation);
            //        }
            //    }
            //}
            //DRResult = observations;

            // Update all bindings
            RaisePropertyChanged("");

            RequestRunning = false;
        }
        private async void LoadDataFromServer()
        {
            RequestRunning = true;

            IFHIRLabDataService dataService = ServiceLocator.Current.GetInstance <IFHIRLabDataService>();
            Action <Exception>  errorAction = async(e) =>
            {
                var dialog = new MessageDialog("Requested resource is not available on the server.", "Error");
                var result = await dialog.ShowAsync();

                if (NavigationService.CanGoBack)
                {
                    NavigationService.GoBack();
                }
            };

            CurrentDiagnosticReport = await dataService.DiagnosticReportByIdAsync(errorAction, DiagnosticReportId);

            List <ObservationModel> observations = new List <ObservationModel>();

            foreach (var reference in CurrentDiagnosticReport.Result)
            {
                if (reference.IsContainedReference)
                {
                    var observation = CurrentDiagnosticReport.Contained.Where((x) => (x.Id == reference.Reference.TrimStart('#'))).FirstOrDefault();
                    if (observation != null)
                    {
                        observations.Add(new ObservationModel((Observation)observation));
                    }
                }
                else if (reference.Reference != null)
                {
                    // Hacky hack to know where to go next...
                    if (reference.Reference.Contains("Observation/"))
                    {
                        var observationUri = ExtractIdFromUri(reference.Reference, "Observation/");
                        var observation    = await dataService.ObservationByIdAsync(errorAction, observationUri);

                        if (observation == null)
                        {
                            break;
                        }
                        observations.Add(new ObservationModel(observation));
                    }
                }
            }
            DRResult = observations;

            // Update all bindings
            RaisePropertyChanged("");

            RequestRunning = false;
        }
        private async void LoadPatientsFromServer(string searchTerms = null)
        {
            PatientRequestRunning = true;

            IFHIRLabDataService dataService = ServiceLocator.Current.GetInstance <IFHIRLabDataService>();
            Action <Exception>  errorAction = async(e) =>
            {
                var dialog = new MessageDialog("Requested resource is not available on the server.", "Error");
                var result = await dialog.ShowAsync();

                if (NavigationService?.CanGoBack == true)
                {
                    NavigationService.GoBack();
                }
            };

            Bundle patients;

            if (searchTerms == null)
            {
                patients = await dataService.PatientsAsync(errorAction);
            }
            else
            {
                string[] searchParams = searchTerms.Split(' ');
                patients = await dataService.SearchPatientAsync(errorAction, searchParams);
            }

            var resourceList = new List <PatientModel>();

            if (patients == null)
            {
                PatientList           = null;
                PatientRequestRunning = false;
                return;
            }
            foreach (var item in patients.Entry)
            {
                if (item.Resource.TypeName == "Patient")
                {
                    resourceList.Add(new PatientModel((Patient)item.Resource));
                }
            }

            PatientList           = resourceList;
            PatientRequestRunning = false;
        }
        private async void LoadDataFromServer()
        {
            RequestRunning = true;

            IFHIRLabDataService dataService = ServiceLocator.Current.GetInstance <IFHIRLabDataService>();

            CurrentPatient = await dataService.PatientByIdAsync(async (e) =>
            {
                var dialog = new MessageDialog("Requested resource is not available on the server.", "Error");
                var result = await dialog.ShowAsync();
                if (NavigationService.CanGoBack)
                {
                    NavigationService.GoBack();
                }
            }, Services.SettingsServices.SettingsService.Instance.FhirPatientId);

            // Update all bindings
            RaisePropertyChanged("");

            RequestRunning = false;
        }