Search in sources :

Example 56 with HumanName

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

the class UnknownPractitionerHandler method createUnknownPractitioner.

private Practitioner createUnknownPractitioner() {
    Practitioner unknown = new Practitioner();
    unknown.setId(idGeneratorService.generateUuid());
    return unknown.addName(new HumanName().setText(UNKNOWN_USER));
}
Also used : Practitioner(org.hl7.fhir.dstu3.model.Practitioner) HumanName(org.hl7.fhir.dstu3.model.HumanName)

Example 57 with HumanName

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

the class FhirLoadPageTest method populateServer.

@BeforeEach
public void populateServer() {
    List<IBaseResource> input = new ArrayList<>();
    Patient p1 = new Patient();
    p1.addName().setFamily("PATIENT1");
    input.add(p1);
    Patient p2 = new Patient();
    p2.addName().setFamily("PATIENT2");
    input.add(p2);
    input.add(new Patient().addName(new HumanName().setFamily("PATIENT3")));
    List<IBaseResource> response = fhirClient.transaction().withResources(input).encodedJson().execute();
    assertEquals(3, response.size());
}
Also used : HumanName(org.hl7.fhir.dstu3.model.HumanName) ArrayList(java.util.ArrayList) Patient(org.hl7.fhir.dstu3.model.Patient) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 58 with HumanName

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

the class FhirTransactionTest 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.dstu3.model.HumanName) ArrayList(java.util.ArrayList) Patient(org.hl7.fhir.dstu3.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 59 with HumanName

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

the class FhirValidateTest method testResource.

@Test
public void testResource() throws Exception {
    Patient bobbyHebb = new Patient().addName(new HumanName().addGiven("Bobby").setFamily("Hebb"));
    // using org.hl7.fhir.instance.model.api.IBaseResource message body for single parameter "resource"
    MethodOutcome result = requestBody("direct://RESOURCE", bobbyHebb);
    assertNotNull(result, "resource result");
    LOG.debug("resource: " + result);
    assertNotNull(result.getOperationOutcome());
    assertTrue(((OperationOutcome) result.getOperationOutcome()).getText().getDivAsString().contains("No issues detected during validation"));
}
Also used : HumanName(org.hl7.fhir.dstu3.model.HumanName) Patient(org.hl7.fhir.dstu3.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 60 with HumanName

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

the class FhirValidateTest method testResourceAsString.

@Test
public void testResourceAsString() throws Exception {
    Patient bobbyHebb = new Patient().addName(new HumanName().addGiven("Bobby").setFamily("Hebb"));
    // 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);
    assertNotNull(result.getOperationOutcome());
    assertTrue(((OperationOutcome) result.getOperationOutcome()).getText().getDivAsString().contains("No issues detected during validation"));
}
Also used : HumanName(org.hl7.fhir.dstu3.model.HumanName) Patient(org.hl7.fhir.dstu3.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