Search in sources :

Example 86 with HumanName

use of org.hl7.fhir.r5.model.HumanName in project camel-spring-boot by apache.

the class AbstractFhirTestSupport method createPatient.

private void createPatient() {
    this.patient = new Patient().addName(new HumanName().addGiven("Vincent").setFamily("Freeman")).setActive(false);
    this.patient.setId(fhirClient.create().resource(patient).execute().getId());
}
Also used : HumanName(org.hl7.fhir.r4.model.HumanName) Patient(org.hl7.fhir.r4.model.Patient)

Example 87 with HumanName

use of org.hl7.fhir.r5.model.HumanName in project camel-spring-boot by apache.

the class FhirTransactionIT 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.r4.model.HumanName) Bundle(org.hl7.fhir.r4.model.Bundle) Patient(org.hl7.fhir.r4.model.Patient)

Example 88 with HumanName

use of org.hl7.fhir.r5.model.HumanName in project camel-spring-boot by apache.

the class FhirTransactionIT method testWithResources.

@Test
public void testWithResources() throws Exception {
    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);
    // using java.util.List message body for single parameter "resources"
    List<IBaseResource> result = requestBody("direct://WITH_RESOURCES", patients);
    assertNotNull(result, "withResources result");
    LOG.debug("withResources: " + result);
    assertEquals(2, result.size());
}
Also used : HumanName(org.hl7.fhir.r4.model.HumanName) ArrayList(java.util.ArrayList) Patient(org.hl7.fhir.r4.model.Patient) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) CamelSpringBootTest(org.apache.camel.test.spring.junit5.CamelSpringBootTest) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 89 with HumanName

use of org.hl7.fhir.r5.model.HumanName in project camel-spring-boot by apache.

the class FhirValidateIT method testResourceAsString.

@Test
public void testResourceAsString() throws Exception {
    Patient bobbyHebb = new Patient().addName(new HumanName().addGiven("Bobby").setFamily("Hebb"));
    bobbyHebb.getText().setStatus(Narrative.NarrativeStatus.GENERATED);
    bobbyHebb.getText().setDivAsString("<div>This is the narrative text</div>");
    // using org.hl7.fhir.instance.model.api.IBaseResource message body for single parameter "resource"
    MethodOutcome result = requestBody("direct://RESOURCE_AS_STRING", this.fhirContext.newXmlParser().encodeResourceToString(bobbyHebb));
    assertNotNull(result, "resource result");
    LOG.debug("resource: " + result);
    OperationOutcome operationOutcome = (OperationOutcome) result.getOperationOutcome();
    assertNotNull(operationOutcome);
    List<OperationOutcome.OperationOutcomeIssueComponent> issue = operationOutcome.getIssue();
    assertNotNull(issue);
    assertEquals(1, issue.size());
    assertTrue(issue.get(0).getDiagnostics().contains("No issues detected during validation"));
}
Also used : HumanName(org.hl7.fhir.r4.model.HumanName) OperationOutcome(org.hl7.fhir.r4.model.OperationOutcome) Patient(org.hl7.fhir.r4.model.Patient) MethodOutcome(ca.uhn.fhir.rest.api.MethodOutcome) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) CamelSpringBootTest(org.apache.camel.test.spring.junit5.CamelSpringBootTest)

Example 90 with HumanName

use of org.hl7.fhir.r5.model.HumanName in project camel-spring-boot by apache.

the class FhirCreateIT method testCreateResource.

@Test
public void testCreateResource() throws Exception {
    Patient patient = new Patient().addName(new HumanName().addGiven("Vincent").setFamily("Freeman"));
    MethodOutcome result = requestBody("direct://RESOURCE", patient);
    LOG.debug("resource: " + result);
    assertNotNull(result, "resource result");
    assertTrue(result.getCreated());
}
Also used : HumanName(org.hl7.fhir.r4.model.HumanName) Patient(org.hl7.fhir.r4.model.Patient) MethodOutcome(ca.uhn.fhir.rest.api.MethodOutcome) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) CamelSpringBootTest(org.apache.camel.test.spring.junit5.CamelSpringBootTest)

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