use of org.hl7.v3.RCMRMT030101UK04Patient in project nia-patient-switching-standard-adaptor by NHSDigital.
the class PatientMapper method mapToPatient.
public Patient mapToPatient(RCMRMT030101UK04Patient patient, Organization organization) {
String nhsNumber = patient.getId().getExtension();
Patient mappedPatient = createPatient(nhsNumber);
if (organization != null) {
mappedPatient.setManagingOrganization(new Reference(organization));
}
return mappedPatient;
}
use of org.hl7.v3.RCMRMT030101UK04Patient in project nia-patient-switching-standard-adaptor by NHSDigital.
the class PatientMapperTest method testIdMetaAndNhsNumberIsAddedToPatient.
@Test
public void testIdMetaAndNhsNumberIsAddedToPatient() {
RCMRMT030101UK04Patient patientXml = unmarshallCodeElement(PATIENT_EXAMPLE_XML);
Patient patient = patientMapper.mapToPatient(patientXml, null);
assertThat(patient.getId()).isEqualTo(TEST_PATIENT_ID);
assertThat(patient.hasMeta()).isTrue();
assertThat(patient.getMeta().getVersionId()).isEqualTo(EXPECTED_META_VERSION_ID);
assertThat(patient.getMeta().getProfile().stream().findFirst().get().getValue()).isEqualTo(EXPECTED_META_PROFILE_URL);
assertThat(patient.hasIdentifier()).isTrue();
assertThat(patient.getIdentifierFirstRep().getSystem()).isEqualTo(EXPECTED_NHS_NUMBER_SYSTEM_URL);
assertThat(patient.getIdentifierFirstRep().getValue()).isEqualTo(EXPECTED_NHS_NUMBER);
assertThat(patient.hasManagingOrganization()).isFalse();
}
use of org.hl7.v3.RCMRMT030101UK04Patient in project nia-patient-switching-standard-adaptor by NHSDigital.
the class PatientMapperTest method testOrganizationReferenceIsAddedToPatient.
@Test
public void testOrganizationReferenceIsAddedToPatient() {
RCMRMT030101UK04Patient patientXml = unmarshallCodeElement(PATIENT_EXAMPLE_XML);
Patient patient = patientMapper.mapToPatient(patientXml, ORGANIZATION);
assertThat(patient.hasIdentifier()).isTrue();
assertThat(patient.hasManagingOrganization()).isTrue();
assertThat(patient.getManagingOrganization().getResource()).isEqualTo(ORGANIZATION);
}
Aggregations