当前位置: 首页>>代码示例>>C#>>正文


C# FhirClient.Update方法代码示例

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


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

示例1: 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

示例2: CreateEditDelete

        public void CreateEditDelete()
        {
            var furore = new Organization
            {
                Name = "Furore",
                Identifier = new List<Identifier> { new Identifier("http://hl7.org/test/1", "3141") },
                Telecom = new List<Contact> { new Contact { System = Contact.ContactSystem.Phone, Value = "+31-20-3467171" } }
            };

            FhirClient client = new FhirClient(testEndpoint);
            var tags = new List<Tag> { new Tag("http://nu.nl/testname", Tag.FHIRTAGNS, "TestCreateEditDelete") };

            var fe = client.Create(furore,tags);

            Assert.IsNotNull(furore);
            Assert.IsNotNull(fe);
            Assert.IsNotNull(fe.Id);
            Assert.IsNotNull(fe.SelfLink);
            Assert.AreNotEqual(fe.Id,fe.SelfLink);
            Assert.IsNotNull(fe.Tags);
            Assert.AreEqual(1, fe.Tags.Count());
            Assert.AreEqual(fe.Tags.First(), tags[0]);
            createdTestOrganization = fe.Id;

            fe.Resource.Identifier.Add(new Identifier("http://hl7.org/test/2", "3141592"));

            var fe2 = client.Update(fe);

            Assert.IsNotNull(fe2);
            Assert.AreEqual(fe.Id, fe2.Id);
            Assert.AreNotEqual(fe.SelfLink, fe2.SelfLink);
            Assert.IsNotNull(fe2.Tags);
            Assert.AreEqual(1, fe2.Tags.Count());
            Assert.AreEqual(fe2.Tags.First(), tags[0]);

            client.Delete(fe2.Id);

            try
            {
                fe = client.Read<Organization>(ResourceLocation.GetIdFromResourceId(fe.Id));
                Assert.Fail();
            }
            catch
            {
                Assert.IsTrue(client.LastResponseDetails.Result == HttpStatusCode.Gone);
            }

            Assert.IsNull(fe);
        }
开发者ID:vista-novo,项目名称:fhir,代码行数:49,代码来源:FhirClientTests.cs

示例3: TestSearchByPersonaCode

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

            var pats =
              client.Search<Patient>(
                new[] { string.Format("identifier={0}|{1}", "http://hl7.org/fhir/sid/us-ssn", "444222222") });
            var pat = (Patient)pats.Entry.First().Resource;
            client.Update<Patient>(pat);
        }
开发者ID:alexandru360,项目名称:fhir-net-api,代码行数:10,代码来源:FhirClientTests.cs

示例4: CreateEditDelete

        public void CreateEditDelete()
        {
            var pat = (Patient)FhirParser.ParseResourceFromXml(File.ReadAllText(@"TestData\TestPatient.xml"));
            var key = new Random().Next();
            pat.Id = "NetApiCRUDTestPatient" + key;

            FhirClient client = new FhirClient(testEndpoint);

            var fe = client.Create(pat);
            Assert.IsNotNull(fe);
            Assert.IsNotNull(fe.Id);
            Assert.IsNotNull(fe.Meta.VersionId);
            createdTestPatientUrl = fe.ResourceIdentity();

            fe.Identifier.Add(new Identifier("http://hl7.org/test/2", "3141592"));
            var fe2 = client.Update(fe);

            Assert.IsNotNull(fe2);
            Assert.AreEqual(fe.Id, fe2.Id);
            Assert.AreNotEqual(fe.ResourceIdentity(), fe2.ResourceIdentity());
            Assert.AreEqual(2, fe2.Identifier.Count);

            fe.Identifier.Add(new Identifier("http://hl7.org/test/3", "3141592"));
            var fe3 = client.Update(fe);
            Assert.IsNotNull(fe3);
            Assert.AreEqual(3, fe3.Identifier.Count);

            client.Delete(fe3);

            try
            {
                // Get most recent version
                fe = client.Read<Patient>(fe.ResourceIdentity().WithoutVersion());
                Assert.Fail();
            }
            catch
            {
                Assert.IsTrue(client.LastResult.Status == HttpStatusCode.Gone.ToString());
            }
        }
开发者ID:alexandru360,项目名称:fhir-net-api,代码行数:40,代码来源:FhirClientTests.cs

示例5: CreateEditDelete

        public void CreateEditDelete()
        {
            FhirClient client = new FhirClient(testEndpoint);
            var pat = client.Read<Patient>("Patient/example");
            pat.Id = null;
            pat.Identifier.Clear();
            pat.Identifier.Add(new Identifier("http://hl7.org/test/2", "99999"));

            var fe = client.Create(pat);
            Assert.IsNotNull(fe);
            Assert.IsNotNull(fe.Id);
            Assert.IsNotNull(fe.Meta.VersionId);
            createdTestPatientUrl = fe.ResourceIdentity();

            fe.Identifier.Add(new Identifier("http://hl7.org/test/2", "3141592"));
            var fe2 = client.Update(fe);

            Assert.IsNotNull(fe2);
            Assert.AreEqual(fe.Id, fe2.Id);
            Assert.AreNotEqual(fe.ResourceIdentity(), fe2.ResourceIdentity());
            Assert.AreEqual(2, fe2.Identifier.Count);

            fe.Identifier.Add(new Identifier("http://hl7.org/test/3", "3141592"));
            var fe3 = client.Update(fe);
            Assert.IsNotNull(fe3);
            Assert.AreEqual(3, fe3.Identifier.Count);

            client.Delete(fe3);

            try
            {
                // Get most recent version
                fe = client.Read<Patient>(fe.ResourceIdentity().WithoutVersion());
                Assert.Fail();
            }
            catch
            {
                Assert.IsTrue(client.LastResult.Status == "410");
            }
        }
开发者ID:molsches,项目名称:fhir-net-api,代码行数:40,代码来源:FhirClientTests.cs

示例6: CreateEditDelete

        public void CreateEditDelete()
        {
            var furore = new Organization
            {
                Name = "Furore",
                Identifier = new List<Identifier> { new Identifier("http://hl7.org/test/1", "3141") },
                Telecom = new List<Contact> { new Contact { System = Contact.ContactSystem.Phone, Value = "+31-20-3467171" } }
            };

            FhirClient client = new FhirClient(testEndpoint);
            var tags = new List<Tag> { new Tag("http://nu.nl/testname", Tag.FHIRTAGSCHEME_GENERAL, "TestCreateEditDelete") };

            var fe = client.Create<Organization>(furore, tags:tags, refresh: true);

            Assert.IsNotNull(furore);
            Assert.IsNotNull(fe);
            Assert.IsNotNull(fe.Id);
            Assert.IsNotNull(fe.SelfLink);
            Assert.AreNotEqual(fe.Id, fe.SelfLink);
			Assert.IsNotNull(fe.Tags);
			Assert.AreEqual(1, fe.Tags.Count(), "Tag count on new organization record don't match");
			Assert.AreEqual(fe.Tags.First(), tags[0]);
			createdTestOrganizationUrl = fe.Id;

            fe.Resource.Identifier.Add(new Identifier("http://hl7.org/test/2", "3141592"));
            var fe2 = client.Update(fe, refresh: true);
            
            Assert.IsNotNull(fe2);
            Assert.AreEqual(fe.Id, fe2.Id);
            Assert.AreNotEqual(fe.SelfLink, fe2.SelfLink);
            Assert.AreEqual(2, fe2.Resource.Identifier.Count);

            Assert.IsNotNull(fe2.Tags);
			Assert.AreEqual(1, fe2.Tags.Count(), "Tag count on updated organization record don't match");
            Assert.AreEqual(fe2.Tags.First(), tags[0]);

            fe.Resource.Identifier.Add(new Identifier("http://hl7.org/test/3", "3141592"));
            var fe3 = client.Update(fe2.Id, fe.Resource, refresh: true);
            Assert.IsNotNull(fe3);
            Assert.AreEqual(3, fe3.Resource.Identifier.Count);

            client.Delete(fe3);

            try
            {
                // Get most recent version
                fe = client.Read<Organization>(new ResourceIdentity(fe.Id));
                Assert.Fail();
            }
            catch
            {
                Assert.IsTrue(client.LastResponseDetails.Result == HttpStatusCode.Gone);
            }
        }
开发者ID:wdebeau1,项目名称:fhir-net-api,代码行数:54,代码来源:FhirClientTests.cs


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