• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# FhirClient类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中FhirClient的典型用法代码示例。如果您正苦于以下问题:C# FhirClient类的具体用法?C# FhirClient怎么用?C# FhirClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FhirClient类属于命名空间,在下文中一共展示了FhirClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetMedicationDataForPatientAsync

        public static async Task<List<Medication>> GetMedicationDataForPatientAsync(string patientId, FhirClient client)
        {
            var mySearch = new SearchParams();
            mySearch.Parameters.Add(new Tuple<string, string>("patient", patientId));

            try
            {
                //Query the fhir server with search parameters, we will retrieve a bundle
                var searchResultResponse = await Task.Run(() => client.Search<Hl7.Fhir.Model.MedicationOrder>(mySearch));
                //There is an array of "entries" that can return. Get a list of all the entries.
                return
                    searchResultResponse
                        .Entry
                            .AsParallel() //as parallel since we are making network requests
                            .Select(entry =>
                            {
                                var medOrders = client.Read<MedicationOrder>("MedicationOrder/" + entry.Resource.Id);
                                var safeCast = (medOrders?.Medication as ResourceReference)?.Reference;
                                if (string.IsNullOrWhiteSpace(safeCast)) return null;
                                return client.Read<Medication>(safeCast);
                            })
                            .Where(a => a != null)
                            .ToList(); //tolist to force the queries to occur now
            }
            catch (AggregateException e)
            {
                throw e.Flatten();
            }
            catch (FhirOperationException)
            {
                // if we have issues we likely got a 404 and thus have no medication orders...
                return new List<Medication>();
            }
        }
开发者ID:EhrgoHealth,项目名称:CS6440,代码行数:34,代码来源:EhrBase.cs


示例2: InvokeExpandExistingValueSet

 public void InvokeExpandExistingValueSet()
 {
     var client = new FhirClient(testEndpoint);
     var vs = client.ExpandValueSet(ResourceIdentity.Build("ValueSet","administrative-gender"));
     
     Assert.IsTrue(vs.Expansion.Contains.Any());
 }
开发者ID:012345789,项目名称:fhir-net-api,代码行数:7,代码来源:OperationsTests.cs


示例3: Read

        public void Read()
        {
            FhirClient client = new FhirClient(testEndpoint);

            var loc = client.Read<Location>("Location/1");
            Assert.IsNotNull(loc);
            Assert.AreEqual("Den Burg", loc.Resource.Address.City);

            string version = new ResourceIdentity(loc.SelfLink).VersionId;
            Assert.IsNotNull(version);
            string id = new ResourceIdentity(loc.Id).Id;
            Assert.AreEqual("1", id);

            try
            {
                var random = client.Read(new Uri("Location/45qq54", UriKind.Relative));
                Assert.Fail();
            }
            catch (FhirOperationException)
            {
                Assert.IsTrue(client.LastResponseDetails.Result == HttpStatusCode.NotFound);
            }

            var loc2 = client.Read<Location>(ResourceIdentity.Build("Location","1", version));
            Assert.IsNotNull(loc2);
            Assert.AreEqual(FhirSerializer.SerializeBundleEntryToJson(loc),
                            FhirSerializer.SerializeBundleEntryToJson(loc2));

            var loc3 = client.Read<Location>(loc.SelfLink);
            Assert.IsNotNull(loc3);
            Assert.AreEqual(FhirSerializer.SerializeBundleEntryToJson(loc),
                            FhirSerializer.SerializeBundleEntryToJson(loc3));        
        }
开发者ID:peterswallow,项目名称:fhir-net-api,代码行数:33,代码来源:FhirClientTests.cs


示例4: GetMedicationDetails

        public async static Task<Tuple<List<Medication>, Hl7.Fhir.Model.Patient>> GetMedicationDetails(string id, ApplicationUserManager userManager)
        {
            Tuple<List<Medication>, Hl7.Fhir.Model.Patient> tup;
            using (var dbcontext = new ApplicationDbContext())
            {
                // Should be FhirID
                var user = await userManager.FindByIdAsync(id);
                if (user == null)
                {
                    return null;
                }

                var client = new FhirClient(Constants.HapiFhirServerBase);
                if (string.IsNullOrWhiteSpace(user.FhirPatientId))
                {
                    var result = client.Create(new Hl7.Fhir.Model.Patient() { });
                    user.FhirPatientId = result.Id;
                    await userManager.UpdateAsync(user);
                }
                var patient = client.Read<Hl7.Fhir.Model.Patient>(Constants.PatientBaseUrl + user.FhirPatientId);
                tup= new Tuple<List<Medication>, Patient>(await EhrBase.GetMedicationDataForPatientAsync(user.FhirPatientId, client), patient);
                return tup;
            }

        }
开发者ID:EhrgoHealth,项目名称:CS6440,代码行数:25,代码来源:EhrBase.cs


示例5: AssertContentLocationPresentAndValid

        public static void AssertContentLocationPresentAndValid(FhirClient client)
        {
            if (String.IsNullOrEmpty(client.LastResponseDetails.ContentLocation))
                TestResult.Fail("Mandatory Content-Location header missing");

            AssertContentLocationValidIfPresent(client);
        }
开发者ID:nagyistoce,项目名称:furore-sprinkler,代码行数:7,代码来源:HttpTests.cs


示例6: btnSearchPatient_Click

        // When btnSearchPatient is clicked, search patient
        private void btnSearchPatient_Click(object sender, EventArgs e)
        {
            // Edit status text
            searchStatus.Text = "Searching...";
            
            // Set FHIR endpoint and create client
            var endpoint = new Uri("http://fhirtest.uhn.ca/baseDstu2");
            var client = new FhirClient(endpoint);

            // Search endpoint with a family name, input from searchFamName
            var query = new string[] { "family=" + searchFamName.Text };
            Bundle result = client.Search<Patient>(query);

            // Edit status text
            searchStatus.Text = "Got " + result.Entry.Count() + " records!";
            
            // Clear results labels
            label1.Text = "";
            label2.Text = "";

            // For every patient in the result, add name and ID to a label
            foreach (var entry in result.Entry)
            {
                Patient p = (Patient)entry.Resource;
                label1.Text = label1.Text + p.Id + "\r\n";
                label2.Text = label2.Text + p.BirthDate + "\r\n";
            }
        }
开发者ID:nagyistoce,项目名称:JawboneToFHIRMapper,代码行数:29,代码来源:Form1.cs


示例7: Register

        public async Task<ActionResult> Register(RegisterViewModel model)
        {
            if(ModelState.IsValid)
            {
                var client = new FhirClient(Constants.HapiFhirServerBase);
                var fhirResult = client.Create(new Hl7.Fhir.Model.Patient() { });
                var user = new ApplicationUser { UserName = model.Email, Email = model.Email, FhirPatientId = fhirResult.Id };
                var result = await UserManager.CreateAsync(user, model.Password);
                if(result.Succeeded)
                {
                    await UserManager.AddToRolesAsync(user.Id, Enum.GetName(typeof(AccountLevel), model.Account_Level));
                    await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);

                    // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                    return RedirectToAction("Index", "Home");
                }
                AddErrors(result);
            }
            // If we got this far, something failed, redisplay form
            return View(viewName: "Register");
        }
开发者ID:EhrgoHealth,项目名称:CS6440,代码行数:26,代码来源:RegisterController.cs


示例8: TimelineManager

        public TimelineManager(string apiBaseUrl)
        {
            var client = new FhirClient(new Uri(apiBaseUrl));

            _patientManager = new PatientManager(client);
            _timelineBuilder = new TimelineBuilder(client);
        }
开发者ID:nagyistoce,项目名称:PatientTimelineFhir,代码行数:7,代码来源:TimelineManager.cs


示例9: AllergyIntolerance

        public AllergyIntolerance(string fhirServer)
        {
            if (String.IsNullOrEmpty(fhirServer))
                throw new Exception("Invalid URL passed to AllergyIntolerance Constructor");

            fhirClient = new FhirClient(fhirServer);
           
        }
开发者ID:EhrgoHealth,项目名称:CS6440,代码行数:8,代码来源:AllergyIntolerance.cs


示例10: InvokeLookupCode

        public void InvokeLookupCode()
        {
            var client = new FhirClient(testEndpoint);
            var expansion = client.ConceptLookup(new Code("male"), new FhirUri("http://hl7.org/fhir/administrative-gender"));

            //Assert.AreEqual("male", expansion.GetSingleValue<FhirString>("name").Value);  // Returns empty currently on Grahame's server
            Assert.AreEqual("Male", expansion.GetSingleValue<FhirString>("display").Value);
        }
开发者ID:012345789,项目名称:fhir-net-api,代码行数:8,代码来源:OperationsTests.cs


示例11: AssertResourceResponseConformsTo

        public static void AssertResourceResponseConformsTo(FhirClient client, ContentType.ResourceFormat format)
        {
            AssertValidResourceContentTypePresent(client);

            var type = client.LastResponseDetails.ContentType;
            if(ContentType.GetResourceFormatFromContentType(type) != format)
               TestResult.Fail(String.Format("{0} is not acceptable when expecting {1}", type, format.ToString()));
        }
开发者ID:nagyistoce,项目名称:furore-sprinkler,代码行数:8,代码来源:HttpTests.cs


示例12: ReadWithFormat

        public void ReadWithFormat()
        {
            FhirClient client = new FhirClient(testEndpoint);

            client.UseFormatParam = true;
            client.PreferredFormat = ResourceFormat.Json;

            var loc = client.Read<Patient>("Patient/1");
            Assert.IsNotNull(loc);
        }
开发者ID:alexandru360,项目名称:fhir-net-api,代码行数:10,代码来源:FhirClientTests.cs


示例13: InvokeExpandParameterValueSet

        public void InvokeExpandParameterValueSet()
        {
            var client = new FhirClient(testEndpoint);

            var vs = client.Read<ValueSet>("ValueSet/administrative-gender");

            var vsX = client.ExpandValueSet(vs);

            Assert.IsTrue(vs.Expansion.Contains.Any());
        }
开发者ID:012345789,项目名称:fhir-net-api,代码行数:10,代码来源:OperationsTests.cs


示例14: InvokeLookupCoding

        public void InvokeLookupCoding()
        {
            var client = new FhirClient(testEndpoint);
            var coding = new Coding("http://hl7.org/fhir/administrative-gender", "male");

            var expansion = client.ConceptLookup(coding);

            Assert.AreEqual("AdministrativeGender", expansion.GetSingleValue<FhirString>("name").Value);
            Assert.AreEqual("Male", expansion.GetSingleValue<FhirString>("display").Value);               
        }
开发者ID:alexandru360,项目名称:fhir-net-api,代码行数:10,代码来源:OperationsTests.cs


示例15: btnStart_Click

        private void btnStart_Click(object sender, EventArgs e)
        {
            // Choose your preferred FHIR server or add your own
            // More at http://wiki.hl7.org/index.php?title=Publicly_Available_FHIR_Servers_for_testing

            //var client = new FhirClient("http://fhir2.healthintersections.com.au/open");
            var client = new FhirClient("http://spark.furore.com/fhir");
            //var client = new FhirClient("http://fhirtest.uhn.ca/baseDstu2");
            //var client = new FhirClient("https://fhir-open-api-dstu2.smarthealthit.org/");
        }
开发者ID:furore-fhir,项目名称:fhirstarters,代码行数:10,代码来源:Form1.cs


示例16: AssertSuccess

 public static void AssertSuccess(FhirClient client, Action action)
 {
     try
     {
         action();
     }
     catch (FhirOperationException foe)
     {
         TestResult.Fail(foe, String.Format("Call failed (http result {0})", client.LastResponseDetails.Result));
     }
 }
开发者ID:nagyistoce,项目名称:furore-sprinkler,代码行数:11,代码来源:HttpTests.cs


示例17: FetchConformance

        public void FetchConformance()
        {
            FhirClient client = new FhirClient(testEndpoint);

            var entry = client.Conformance();

            Assert.IsNotNull(entry);
            // Assert.AreEqual("Spark.Service", c.Software.Name); // This is only for ewout's server
            Assert.AreEqual(Conformance.RestfulConformanceMode.Server, entry.Rest[0].Mode.Value);
            Assert.AreEqual(HttpStatusCode.OK.ToString(), client.LastResult.Status);
        }
开发者ID:alexandru360,项目名称:fhir-net-api,代码行数:11,代码来源:FhirClientTests.cs


示例18: ReadWithFormat

        public void ReadWithFormat()
        {
            FhirClient client = new FhirClient(testEndpoint);

            client.UseFormatParam = true;
            client.PreferredFormat = ResourceFormat.Json;

            var loc = client.Read("Patient/1");

            Assert.AreEqual(ResourceFormat.Json, ContentType.GetResourceFormatFromContentType(client.LastResponseDetails.ContentType));
        }
开发者ID:wdebeau1,项目名称:fhir-net-api,代码行数:11,代码来源:FhirClientTests.cs


示例19: ClientForPPT

        public void ClientForPPT()
        {
            var client = new FhirClient(new Uri("http://hl7connect.healthintersections.com.au/svc/fhir/patient/"));

            // Note patient is a ResourceEntry<Patient>, not a Patient
            var patEntry = client.Read<Patient>("1");
            var pat = patEntry.Resource;

            pat.Name.Add(HumanName.ForFamily("Kramer").WithGiven("Ewout"));

            client.Update<Patient>(patEntry);
        }
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:12,代码来源:FhirClientTests.cs


示例20: FetchConformance

        public void FetchConformance()
        {
            FhirClient client = new FhirClient(testEndpoint);

            Conformance c = client.Conformance().Resource;

            Assert.IsNotNull(c);
            Assert.AreEqual("HL7Connect", c.Software.Name);
            Assert.AreEqual(Conformance.RestfulConformanceMode.Server, c.Rest[0].Mode.Value);
            Assert.AreEqual(ContentType.XML_CONTENT_HEADER, client.LastResponseDetails.ContentType.ToLower());
            Assert.AreEqual(HttpStatusCode.OK, client.LastResponseDetails.Result);
        }
开发者ID:nagyistoce,项目名称:kevinpeterson-fhir,代码行数:12,代码来源:FhirClientTests.cs



注:本文中的FhirClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Field类代码示例发布时间:2022-05-24
下一篇:
C# FetchSummaryContext类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap