Exemple #1
0
        private static Hl7.Fhir.Model.Patient GetPatient2(string patientId)
        {
            var baseUrl       = $"http://hapi.fhir.org/baseDstu3";
            var getPatientUrl = $"http://hapi.fhir.org/baseDstu3/Patient/{patientId}";

            var client = new Hl7.Fhir.Rest.FhirClient(baseUrl);


            var version = client.VerifyFhirVersion;

            Console.WriteLine($"Version de FHIR:{version}");

            var ret = client.Read <Hl7.Fhir.Model.Patient>(getPatientUrl);

            return(ret);
        }
Exemple #2
0
		private void buttonTest_Click(object sender, EventArgs e) {
			Cursor = Cursors.WaitCursor;
			Hl7.Fhir.Model.ValueSet vs;
			List<object> z = new List<object>();
			if (textBoxResource.Text.Contains("$")) {
				// Need to handle the expension
				using (WebClient w = new WebClient()) {
					string url = string.Empty;
					if (!comboBoxServer.Text.EndsWith("/")) {
						url = comboBoxServer.Text + "/" + textBoxResource.Text;
					} else {
						url = comboBoxServer.Text + textBoxResource.Text;
					}

					string x = w.DownloadString(url);

					vs = (Hl7.Fhir.Model.ValueSet)Hl7.Fhir.Serialization.FhirParser.ParseResourceFromJson(x);
					textBoxResponse.Text = Hl7.Fhir.Serialization.FhirSerializer.SerializeResourceToJson(vs);
				}
			} else {
				var client = new Hl7.Fhir.Rest.FhirClient(comboBoxServer.Text);
				client.PreferredFormat = Hl7.Fhir.Rest.ResourceFormat.Json;
				vs = client.Read<Hl7.Fhir.Model.ValueSet>(textBoxResource.Text);

				textBoxResponse.Text = Hl7.Fhir.Serialization.FhirSerializer.SerializeResourceToJson(vs);
			}

			if (vs.Expansion != null) {
				for (int i = 0; i < vs.Expansion.Contains.Count; i++) {
					z.Add(vs.Expansion.Contains[i].Display);
				}
			} else {
				if (vs.CodeSystem != null) {
					for (int i = 0; i < vs.CodeSystem.Concept.Count; i++) {
						z.Add(vs.CodeSystem.Concept[i].Display);
					}
				}
				if (vs.Compose != null) {
					for (int i = 0; i < vs.Compose.Include.Count; i++) {
						for (int j = 0; j < vs.Compose.Include[i].Concept.Count; j++) {
							z.Add(vs.Compose.Include[i].Concept[j].Display);
						}
					}
				}
			}
			comboBoxValueSet.Items.Clear();
			comboBoxValueSet.Items.AddRange(z.ToArray());
			
			Cursor = Cursors.Default;
		}
Exemple #3
0
        private void buttonTest_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            Hl7.Fhir.Model.ValueSet vs;
            List <object>           z = new List <object>();

            if (textBoxResource.Text.Contains("$"))
            {
                // Need to handle the expension
                using (WebClient w = new WebClient()) {
                    string url = string.Empty;
                    if (!comboBoxServer.Text.EndsWith("/"))
                    {
                        url = comboBoxServer.Text + "/" + textBoxResource.Text;
                    }
                    else
                    {
                        url = comboBoxServer.Text + textBoxResource.Text;
                    }

                    string x = w.DownloadString(url);

                    vs = (Hl7.Fhir.Model.ValueSet)Hl7.Fhir.Serialization.FhirParser.ParseResourceFromJson(x);
                    textBoxResponse.Text = Hl7.Fhir.Serialization.FhirSerializer.SerializeResourceToJson(vs);
                }
            }
            else
            {
                var client = new Hl7.Fhir.Rest.FhirClient(comboBoxServer.Text);
                client.PreferredFormat = Hl7.Fhir.Rest.ResourceFormat.Json;
                vs = client.Read <Hl7.Fhir.Model.ValueSet>(textBoxResource.Text);

                textBoxResponse.Text = Hl7.Fhir.Serialization.FhirSerializer.SerializeResourceToJson(vs);
            }

            if (vs.Expansion != null)
            {
                for (int i = 0; i < vs.Expansion.Contains.Count; i++)
                {
                    z.Add(vs.Expansion.Contains[i].Display);
                }
            }
            else
            {
                if (vs.CodeSystem != null)
                {
                    for (int i = 0; i < vs.CodeSystem.Concept.Count; i++)
                    {
                        z.Add(vs.CodeSystem.Concept[i].Display);
                    }
                }
                if (vs.Compose != null)
                {
                    for (int i = 0; i < vs.Compose.Include.Count; i++)
                    {
                        for (int j = 0; j < vs.Compose.Include[i].Concept.Count; j++)
                        {
                            z.Add(vs.Compose.Include[i].Concept[j].Display);
                        }
                    }
                }
            }
            comboBoxValueSet.Items.Clear();
            comboBoxValueSet.Items.AddRange(z.ToArray());

            Cursor = Cursors.Default;
        }