コード例 #1
0
        public override async Task <FhirHealthCheckStatus> CheckHealth(CancellationToken token = default)
        {
            try
            {
                while (!token.IsCancellationRequested)
                {
                    SearchParams          search = new SearchParams().SetCount(1);
                    Hl7.Fhir.Model.Bundle result = await _fhirService.SearchForResourceAsync(Hl7.Fhir.Model.ResourceType.StructureDefinition, query : null, search.Count, token).ConfigureAwait(false);

                    return(await Task.FromResult(new FhirHealthCheckStatus(string.Empty, 200)));
                }

                token.ThrowIfCancellationRequested();
                return(await Task.FromResult(new FhirHealthCheckStatus(token.ToString(), 500)));
            }
            catch (FhirException ex)
            {
                return(await Task.FromResult(new FhirHealthCheckStatus(ex.Message, (int)ex.StatusCode)));
            }
            catch (IdentityModel.Clients.ActiveDirectory.AdalServiceException ex)
            {
                return(await Task.FromResult(new FhirHealthCheckStatus(ex.Message, ex.StatusCode)));
            }
#pragma warning disable CA1031
            catch (Exception ex)
#pragma warning restore CA1031
            {
                return(await Task.FromResult(new FhirHealthCheckStatus(ex.Message, 500)));
            }
        }
コード例 #2
0
        protected virtual async Task <Model.Observation> GetObservationFromServerAsync(Model.Identifier identifier)
        {
            var result = await _fhirService.SearchForResourceAsync(Model.ResourceType.Observation, identifier.ToSearchQueryParameter()).ConfigureAwait(false);

            return(await result.ReadOneFromBundleWithContinuationAsync <Model.Observation>(_fhirService));
        }