use of org.hl7.fhir.dstu2.model.HumanName in project camel-spring-boot by apache.
the class FhirXmlDataFormatTest method getPatient.
private Patient getPatient() {
Patient patient = new Patient();
patient.addName(new HumanName().addGiven("Sherlock").setFamily("Holmes")).addAddress(new Address().addLine("221b Baker St, Marylebone, London NW1 6XE, UK"));
return patient;
}
use of org.hl7.fhir.dstu2.model.HumanName in project gpconnect-demonstrator by nhsconnect.
the class PatientResourceProvider method registerPatientResourceConverterToPatientDetail.
private PatientDetails registerPatientResourceConverterToPatientDetail(Patient patientResource) {
PatientDetails patientDetails = new PatientDetails();
HumanName name = patientResource.getNameFirstRep();
String givenNames = name.getGiven().stream().map(n -> n.getValue()).collect(Collectors.joining(","));
patientDetails.setForename(givenNames);
patientDetails.setSurname(name.getFamily());
patientDetails.setDateOfBirth(patientResource.getBirthDate());
if (patientResource.getGender() != null) {
patientDetails.setGender(patientResource.getGender().toString());
}
patientDetails.setNhsNumber(patientResource.getIdentifierFirstRep().getValue());
DateTimeType deceased = (DateTimeType) patientResource.getDeceased();
if (deceased != null) {
try {
patientDetails.setDeceased((deceased.getValue()));
} catch (ClassCastException cce) {
throwUnprocessableEntity422_InvalidResourceException("The multiple deceased property is expected to be a datetime");
}
}
// activate patient as temporary
patientDetails.setRegistrationStartDateTime(new Date());
// patientDetails.setRegistrationEndDateTime(getRegistrationEndDate(patientResource));
patientDetails.setRegistrationStatus(ACTIVE_REGISTRATION_STATUS);
patientDetails.setRegistrationType(TEMPORARY_RESIDENT_REGISTRATION_TYPE);
updateAddressAndTelecom(patientResource, patientDetails);
// set some standard values for defaults, ensure managing org is always returned
// added at 1.2.2 7 is A20047 the default GP Practice
patientDetails.setManagingOrganization("7");
return patientDetails;
}
use of org.hl7.fhir.dstu2.model.HumanName in project gpconnect-demonstrator by nhsconnect.
the class PatientResourceProvider method IsActiveName.
private Boolean IsActiveName(HumanName name) {
Period period = name.getPeriod();
if (null == period) {
return true;
}
Date start = period.getStart();
Date end = period.getEnd();
if ((null == end || end.after(new Date())) && (null == start || start.equals(new Date()) || start.before(new Date()))) {
return true;
}
return false;
}
use of org.hl7.fhir.dstu2.model.HumanName in project wildfly-camel by wildfly-extras.
the class FhirJsonIntegrationTest method createPatient.
private Patient createPatient() {
Patient patient = new Patient();
patient.addName(new HumanName().addGiven("Sherlock").setFamily("Holmes")).addAddress(new Address().addLine("221b Baker St, Marylebone, London NW1 6XE, UK"));
return patient;
}
use of org.hl7.fhir.dstu2.model.HumanName in project camel-quarkus by apache.
the class FhirR4Resource method validateResource.
// ///////////////////
// Validate
// ///////////////////
@Path("/validate/resource")
@GET
@Produces(MediaType.TEXT_PLAIN)
public String validateResource() {
Patient patient = new Patient().addName(new HumanName().addGiven(PATIENT_FIRST_NAME).setFamily(PATIENT_LAST_NAME));
patient.getText().setStatus(NarrativeStatus.GENERATED);
patient.getText().setDivAsString("<div>This is the narrative text</div>");
MethodOutcome result = producerTemplate.requestBody("direct:validateResource-r4", patient, MethodOutcome.class);
OperationOutcome operationOutcome = (OperationOutcome) result.getOperationOutcome();
return operationOutcome.getIssue().get(0).getDiagnostics();
}
Aggregations