use of org.hl7.fhir.dstu2.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());
}
use of org.hl7.fhir.dstu2.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;
}
use of org.hl7.fhir.dstu2.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());
}
use of org.hl7.fhir.dstu2.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"));
}
use of org.hl7.fhir.dstu2.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());
}
Aggregations