Search in sources :

Example 51 with Meta

use of org.hl7.fhir.r4.model.Meta in project nia-patient-switching-standard-adaptor by NHSDigital.

the class BundleGenerator method generateBundle.

public Bundle generateBundle() {
    Bundle bundle = new Bundle();
    Meta meta = new Meta();
    meta.setProfile(List.of(new UriType("https://fhir.nhs.uk/STU3/StructureDefinition/GPConnect-StructuredRecord-Bundle-1")));
    bundle.setId(idGeneratorService.generateUuid());
    bundle.setMeta(meta);
    bundle.setType(Bundle.BundleType.COLLECTION);
    return bundle;
}
Also used : Meta(org.hl7.fhir.dstu3.model.Meta) Bundle(org.hl7.fhir.dstu3.model.Bundle) UriType(org.hl7.fhir.dstu3.model.UriType)

Example 52 with Meta

use of org.hl7.fhir.r4.model.Meta in project nia-patient-switching-standard-adaptor by NHSDigital.

the class ResourceUtil method generateMeta.

public static Meta generateMeta(String urlProfile) {
    Meta meta = new Meta();
    UriType profile = new UriType(String.format(META_PROFILE_TEMPLATE, urlProfile));
    meta.setProfile(List.of(profile));
    return meta;
}
Also used : Meta(org.hl7.fhir.dstu3.model.Meta) UriType(org.hl7.fhir.dstu3.model.UriType)

Example 53 with Meta

use of org.hl7.fhir.r4.model.Meta in project camel-spring-boot by apache.

the class FhirMetaTest method testDelete.

@Test
public void testDelete() throws Exception {
    // assert no meta
    Meta meta = fhirClient.meta().get(Meta.class).fromResource(this.patient.getIdElement()).execute();
    assertEquals(0, meta.getTag().size());
    Meta inMeta = new Meta();
    inMeta.addTag().setSystem("urn:system1").setCode("urn:code1");
    // add meta
    meta = fhirClient.meta().add().onResource(this.patient.getIdElement()).meta(inMeta).execute();
    assertEquals(1, meta.getTag().size());
    // delete meta
    final Map<String, Object> headers = new HashMap<>();
    // parameter type is org.hl7.fhir.instance.model.api.IBaseMetaType
    headers.put("CamelFhir.meta", meta);
    // parameter type is org.hl7.fhir.instance.model.api.IIdType
    headers.put("CamelFhir.id", this.patient.getIdElement());
    IBaseMetaType result = requestBodyAndHeaders("direct://DELETE", null, headers);
    LOG.debug("delete: " + result);
    assertNotNull(result, "delete result");
    assertEquals(0, result.getTag().size());
}
Also used : Meta(org.hl7.fhir.dstu3.model.Meta) HashMap(java.util.HashMap) IBaseMetaType(org.hl7.fhir.instance.model.api.IBaseMetaType) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) CamelSpringBootTest(org.apache.camel.test.spring.junit5.CamelSpringBootTest)

Example 54 with Meta

use of org.hl7.fhir.r4.model.Meta in project camel-spring-boot by apache.

the class FhirMetaTest method testAdd.

@Test
public void testAdd() throws Exception {
    // assert no meta
    Meta meta = fhirClient.meta().get(Meta.class).fromResource(this.patient.getIdElement()).execute();
    assertEquals(0, meta.getTag().size());
    Meta inMeta = new Meta();
    inMeta.addTag().setSystem("urn:system1").setCode("urn:code1");
    final Map<String, Object> headers = new HashMap<>();
    // parameter type is org.hl7.fhir.instance.model.api.IBaseMetaType
    headers.put("CamelFhir.meta", inMeta);
    // parameter type is org.hl7.fhir.instance.model.api.IIdType
    headers.put("CamelFhir.id", this.patient.getIdElement());
    IBaseMetaType result = requestBodyAndHeaders("direct://ADD", null, headers);
    LOG.debug("add: " + result);
    assertNotNull(result, "add result");
    assertEquals(1, result.getTag().size());
}
Also used : Meta(org.hl7.fhir.dstu3.model.Meta) HashMap(java.util.HashMap) IBaseMetaType(org.hl7.fhir.instance.model.api.IBaseMetaType) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) CamelSpringBootTest(org.apache.camel.test.spring.junit5.CamelSpringBootTest)

Example 55 with Meta

use of org.hl7.fhir.r4.model.Meta in project syndesis by syndesisio.

the class FhirTransactionTest method transactionTest.

@Test
@SuppressWarnings("JdkObsolete")
public void transactionTest() {
    Bundle bundle = new Bundle();
    bundle.addEntry(new Bundle.BundleEntryComponent().setResource(new Account().setId("1").setMeta(new Meta().setLastUpdated(new Date()))));
    bundle.addEntry(new Bundle.BundleEntryComponent().setResource(new Patient().setId("2").setMeta(new Meta().setLastUpdated(new Date()))));
    stubFhirRequest(post(urlEqualTo("/?_format=xml")).withRequestBody(containing("<type value=\"transaction\"/><total value=\"2\"/><link><relation value=\"fhir-base\"/></link>" + "<link><relation value=\"self\"/></link>" + "<entry><resource><Account xmlns=\"http://hl7.org/fhir\"><name value=\"Joe\"/></Account></resource>" + "<request><method value=\"POST\"/></request></entry><entry><resource>" + "<Patient xmlns=\"http://hl7.org/fhir\"><name><family value=\"Jackson\"/></name></Patient></resource>" + "<request><method value=\"POST\"/></request></entry>")).willReturn(okXml(toXml(bundle))));
    template.requestBody("direct:start", "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>" + "<tns:Transaction xmlns:tns=\"http://hl7.org/fhir\">" + "<tns:Account><tns:name value=\"Joe\"/></tns:Account>" + "<tns:Patient><name><tns:family value=\"Jackson\"/></name></tns:Patient></tns:Transaction>");
}
Also used : Account(org.hl7.fhir.dstu3.model.Account) Meta(org.hl7.fhir.dstu3.model.Meta) Bundle(org.hl7.fhir.dstu3.model.Bundle) Patient(org.hl7.fhir.dstu3.model.Patient) Date(java.util.Date) Test(org.junit.Test)

Aggregations

Meta (org.hl7.fhir.r4.model.Meta)40 HashMap (java.util.HashMap)36 Date (java.util.Date)35 Meta (org.hl7.fhir.dstu3.model.Meta)31 IBaseMetaType (org.hl7.fhir.instance.model.api.IBaseMetaType)28 Reference (org.hl7.fhir.r4.model.Reference)26 JsonObject (javax.json.JsonObject)24 Path (javax.ws.rs.Path)24 Produces (javax.ws.rs.Produces)24 Code (org.mitre.synthea.world.concepts.HealthRecord.Code)20 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)18 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)17 DocumentReference (org.hl7.fhir.r4.model.DocumentReference)17 ArrayList (java.util.ArrayList)16 Coding (org.hl7.fhir.r4.model.Coding)16 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)15 Test (org.junit.jupiter.api.Test)15 Test (org.junit.Test)14 NotImplementedException (org.apache.commons.lang3.NotImplementedException)13 GET (javax.ws.rs.GET)12