Search in sources :

Example 96 with HumanName

use of org.hl7.fhir.r4b.model.HumanName in project camel-quarkus by apache.

the class FhirR4Resource method transactionWithResources.

@Path("/transaction/withResources")
@GET
@Produces(MediaType.TEXT_PLAIN)
@SuppressWarnings("unchecked")
public int transactionWithResources(@QueryParam("summaryEnum") boolean summaryEnum) {
    Patient oscar = new Patient().addName(new HumanName().addGiven("Oscar").setFamily("Peterson"));
    Patient bobbyHebb = new Patient().addName(new HumanName().addGiven("Bobby").setFamily("Hebb"));
    List<IBaseResource> patients = new ArrayList<>(2);
    patients.add(oscar);
    patients.add(bobbyHebb);
    Map<String, Object> headers = new HashMap<>();
    if (summaryEnum) {
        headers.put(ExtraParameters.SUMMARY_ENUM.getHeaderName(), SummaryEnum.DATA);
    }
    List<IBaseResource> result = producerTemplate.requestBodyAndHeaders("direct:transactionWithResources-r4", patients, headers, List.class);
    return result.size();
}
Also used : HumanName(org.hl7.fhir.r4.model.HumanName) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Patient(org.hl7.fhir.r4.model.Patient) JsonObject(javax.json.JsonObject) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 97 with HumanName

use of org.hl7.fhir.r4b.model.HumanName in project camel-quarkus by apache.

the class FhirR5Resource method createTransactionBundle.

private Bundle createTransactionBundle() {
    Bundle input = new Bundle();
    input.setType(Bundle.BundleType.TRANSACTION);
    input.addEntry().setResource(new Patient().addName(new HumanName().addGiven("Art").setFamily("Tatum"))).getRequest().setMethod(Bundle.HTTPVerb.POST);
    return input;
}
Also used : HumanName(org.hl7.fhir.r5.model.HumanName) IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) Bundle(org.hl7.fhir.r5.model.Bundle) Patient(org.hl7.fhir.r5.model.Patient)

Example 98 with HumanName

use of org.hl7.fhir.r4b.model.HumanName in project camel-quarkus by apache.

the class FhirDstu3Resource method createTransactionBundle.

private Bundle createTransactionBundle() {
    Bundle input = new Bundle();
    input.setType(Bundle.BundleType.TRANSACTION);
    input.addEntry().setResource(new Patient().addName(new HumanName().addGiven("Art").setFamily("Tatum"))).getRequest().setMethod(Bundle.HTTPVerb.POST);
    return input;
}
Also used : HumanName(org.hl7.fhir.dstu3.model.HumanName) Bundle(org.hl7.fhir.dstu3.model.Bundle) IBaseBundle(org.hl7.fhir.instance.model.api.IBaseBundle) Patient(org.hl7.fhir.dstu3.model.Patient)

Example 99 with HumanName

use of org.hl7.fhir.r4b.model.HumanName in project camel-quarkus by apache.

the class FhirDstu2_1Resource method validateResourceAsString.

@Path("/validate/resourceAsString")
@GET
@Produces(MediaType.TEXT_PLAIN)
public String validateResourceAsString() {
    Patient patient = new Patient().addName(new HumanName().addGiven(PATIENT_FIRST_NAME).addFamily(PATIENT_LAST_NAME));
    patient.getText().setStatus(Narrative.NarrativeStatus.GENERATED);
    patient.getText().setDivAsString("<div>This is the narrative text</div>");
    String body = this.fhirContextInstance.get().newXmlParser().encodeResourceToString(patient);
    MethodOutcome result = producerTemplate.requestBody("direct:validateResourceAsString-dstu2-1", body, MethodOutcome.class);
    OperationOutcome operationOutcome = (OperationOutcome) result.getOperationOutcome();
    return operationOutcome.getIssue().get(0).getDiagnostics();
}
Also used : HumanName(org.hl7.fhir.dstu2016may.model.HumanName) IBaseOperationOutcome(org.hl7.fhir.instance.model.api.IBaseOperationOutcome) OperationOutcome(org.hl7.fhir.dstu2016may.model.OperationOutcome) Patient(org.hl7.fhir.dstu2016may.model.Patient) MethodOutcome(ca.uhn.fhir.rest.api.MethodOutcome) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 100 with HumanName

use of org.hl7.fhir.r4b.model.HumanName in project camel-quarkus by apache.

the class FhirDstu3Resource method transactionWithResources.

@Path("/transaction/withResources")
@GET
@Produces(MediaType.TEXT_PLAIN)
@SuppressWarnings("unchecked")
public int transactionWithResources(@QueryParam("summaryEnum") boolean summaryEnum) {
    Patient oscar = new Patient().addName(new HumanName().addGiven("Oscar").setFamily("Peterson"));
    Patient bobbyHebb = new Patient().addName(new HumanName().addGiven("Bobby").setFamily("Hebb"));
    List<IBaseResource> patients = new ArrayList<>(2);
    patients.add(oscar);
    patients.add(bobbyHebb);
    Map<String, Object> headers = new HashMap<>();
    if (summaryEnum) {
        headers.put(ExtraParameters.SUMMARY_ENUM.getHeaderName(), SummaryEnum.DATA);
    }
    List<IBaseResource> result = producerTemplate.requestBodyAndHeaders("direct:transactionWithResources-dstu3", patients, headers, List.class);
    return result.size();
}
Also used : HumanName(org.hl7.fhir.dstu3.model.HumanName) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Patient(org.hl7.fhir.dstu3.model.Patient) JsonObject(javax.json.JsonObject) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

HumanName (org.hl7.fhir.r4.model.HumanName)84 HumanName (org.hl7.fhir.dstu3.model.HumanName)37 Patient (org.hl7.fhir.r4.model.Patient)37 Test (org.junit.jupiter.api.Test)29 ArrayList (java.util.ArrayList)27 Patient (org.hl7.fhir.dstu3.model.Patient)27 Test (org.junit.Test)26 MethodOutcome (ca.uhn.fhir.rest.api.MethodOutcome)23 Address (org.hl7.fhir.r4.model.Address)20 Identifier (org.hl7.fhir.r4.model.Identifier)20 PersonName (org.openmrs.PersonName)17 CamelSpringBootTest (org.apache.camel.test.spring.junit5.CamelSpringBootTest)16 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)16 GET (javax.ws.rs.GET)15 Path (javax.ws.rs.Path)15 Produces (javax.ws.rs.Produces)15 ContactPoint (org.hl7.fhir.r4.model.ContactPoint)15 NotImplementedException (org.apache.commons.lang3.NotImplementedException)14 StringType (org.hl7.fhir.r4.model.StringType)14 Date (java.util.Date)13