Search in sources :

Example 91 with Meta

use of org.hl7.fhir.r5.model.Meta in project dpc-app by CMSgov.

the class FHIRBuilderTests method testTagAdditionExistingMeta.

@Test
void testTagAdditionExistingMeta() {
    final Meta meta = new Meta();
    meta.addTag().setSystem("http://not.real").setCode("nothing");
    final UUID uuid = UUID.randomUUID();
    final Patient patient = new Patient();
    patient.setMeta(meta);
    patient.setGender(Enumerations.AdministrativeGender.FEMALE);
    FHIRBuilders.addOrganizationTag(patient, uuid);
    assertAll(() -> assertNotNull(patient.getMeta(), "Should have meta"), () -> assertEquals(2, patient.getMeta().getTag().size(), "Should have a single tag"));
}
Also used : Meta(org.hl7.fhir.dstu3.model.Meta) Patient(org.hl7.fhir.dstu3.model.Patient) UUID(java.util.UUID) Test(org.junit.jupiter.api.Test)

Example 92 with Meta

use of org.hl7.fhir.r5.model.Meta in project hapi-fhir-jpaserver-starter by hapifhir.

the class ExampleServerR4IT method testBatchPutWithIdenticalTags.

@Test
public void testBatchPutWithIdenticalTags() {
    String batchPuts = "{\n" + "\t\"resourceType\": \"Bundle\",\n" + "\t\"id\": \"patients\",\n" + "\t\"type\": \"batch\",\n" + "\t\"entry\": [\n" + "\t\t{\n" + "\t\t\t\"request\": {\n" + "\t\t\t\t\"method\": \"PUT\",\n" + "\t\t\t\t\"url\": \"Patient/pat-1\"\n" + "\t\t\t},\n" + "\t\t\t\"resource\": {\n" + "\t\t\t\t\"resourceType\": \"Patient\",\n" + "\t\t\t\t\"id\": \"pat-1\",\n" + "\t\t\t\t\"meta\": {\n" + "\t\t\t\t\t\"tag\": [\n" + "\t\t\t\t\t\t{\n" + "\t\t\t\t\t\t\t\"system\": \"http://mysystem.org\",\n" + "\t\t\t\t\t\t\t\"code\": \"value2\"\n" + "\t\t\t\t\t\t}\n" + "\t\t\t\t\t]\n" + "\t\t\t\t}\n" + "\t\t\t},\n" + "\t\t\t\"fullUrl\": \"/Patient/pat-1\"\n" + "\t\t},\n" + "\t\t{\n" + "\t\t\t\"request\": {\n" + "\t\t\t\t\"method\": \"PUT\",\n" + "\t\t\t\t\"url\": \"Patient/pat-2\"\n" + "\t\t\t},\n" + "\t\t\t\"resource\": {\n" + "\t\t\t\t\"resourceType\": \"Patient\",\n" + "\t\t\t\t\"id\": \"pat-2\",\n" + "\t\t\t\t\"meta\": {\n" + "\t\t\t\t\t\"tag\": [\n" + "\t\t\t\t\t\t{\n" + "\t\t\t\t\t\t\t\"system\": \"http://mysystem.org\",\n" + "\t\t\t\t\t\t\t\"code\": \"value2\"\n" + "\t\t\t\t\t\t}\n" + "\t\t\t\t\t]\n" + "\t\t\t\t}\n" + "\t\t\t},\n" + "\t\t\t\"fullUrl\": \"/Patient/pat-2\"\n" + "\t\t}\n" + "\t]\n" + "}";
    Bundle bundle = FhirContext.forR4().newJsonParser().parseResource(Bundle.class, batchPuts);
    ourClient.transaction().withBundle(bundle).execute();
}
Also used : Bundle(org.hl7.fhir.r4.model.Bundle) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 93 with Meta

use of org.hl7.fhir.r5.model.Meta in project camel-quarkus by apache.

the class FhirR4Resource method metaAdd.

// ///////////////////
// Meta
// ///////////////////
@Path("/meta")
@POST
@Produces(MediaType.TEXT_PLAIN)
public int metaAdd(@QueryParam("id") String id) {
    IdType iIdType = new IdType(id);
    Meta inMeta = new Meta();
    inMeta.addTag().setSystem("urn:system1").setCode("urn:code1");
    Map<String, Object> headers = new HashMap<>();
    headers.put("CamelFhir.meta", inMeta);
    headers.put("CamelFhir.id", iIdType);
    IBaseMetaType result = producerTemplate.requestBodyAndHeaders("direct:metaAdd-r4", null, headers, IBaseMetaType.class);
    return result.getTag().size();
}
Also used : Meta(org.hl7.fhir.r4.model.Meta) HashMap(java.util.HashMap) IBaseMetaType(org.hl7.fhir.instance.model.api.IBaseMetaType) JsonObject(javax.json.JsonObject) IdType(org.hl7.fhir.r4.model.IdType) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces)

Example 94 with Meta

use of org.hl7.fhir.r5.model.Meta in project camel-quarkus by apache.

the class FhirR4Resource method metaDelete.

@Path("/meta")
@DELETE
@Produces(MediaType.TEXT_PLAIN)
public int metaDelete(@QueryParam("id") String id) {
    IdType iIdType = new IdType(id);
    Meta inMeta = new Meta();
    inMeta.addTag().setSystem("urn:system1").setCode("urn:code1");
    Map<String, Object> headers = new HashMap<>();
    headers.put("CamelFhir.meta", inMeta);
    headers.put("CamelFhir.id", iIdType);
    IBaseMetaType result = producerTemplate.requestBodyAndHeaders("direct:metaDelete-r4", null, headers, IBaseMetaType.class);
    return result.getTag().size();
}
Also used : Meta(org.hl7.fhir.r4.model.Meta) HashMap(java.util.HashMap) IBaseMetaType(org.hl7.fhir.instance.model.api.IBaseMetaType) JsonObject(javax.json.JsonObject) IdType(org.hl7.fhir.r4.model.IdType) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE) Produces(javax.ws.rs.Produces)

Example 95 with Meta

use of org.hl7.fhir.r5.model.Meta in project camel-quarkus by apache.

the class FhirDstu3Resource method metaAdd.

// ///////////////////
// Meta
// ///////////////////
@Path("/meta")
@POST
@Produces(MediaType.TEXT_PLAIN)
public int metaAdd(@QueryParam("id") String id) {
    IdType iIdType = new IdType(id);
    Meta inMeta = new Meta();
    inMeta.addTag().setSystem("urn:system1").setCode("urn:code1");
    Map<String, Object> headers = new HashMap<>();
    headers.put("CamelFhir.meta", inMeta);
    headers.put("CamelFhir.id", iIdType);
    IBaseMetaType result = producerTemplate.requestBodyAndHeaders("direct:metaAdd-dstu3", null, headers, IBaseMetaType.class);
    return result.getTag().size();
}
Also used : Meta(org.hl7.fhir.dstu3.model.Meta) HashMap(java.util.HashMap) IBaseMetaType(org.hl7.fhir.instance.model.api.IBaseMetaType) JsonObject(javax.json.JsonObject) IdType(org.hl7.fhir.dstu3.model.IdType) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces)

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