Search in sources :

Example 1 with RCMRMT030101UK04Patient

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;
}
Also used : Reference(org.hl7.fhir.dstu3.model.Reference) RCMRMT030101UK04Patient(org.hl7.v3.RCMRMT030101UK04Patient) Patient(org.hl7.fhir.dstu3.model.Patient)

Example 2 with RCMRMT030101UK04Patient

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();
}
Also used : RCMRMT030101UK04Patient(org.hl7.v3.RCMRMT030101UK04Patient) RCMRMT030101UK04Patient(org.hl7.v3.RCMRMT030101UK04Patient) Patient(org.hl7.fhir.dstu3.model.Patient) Test(org.junit.jupiter.api.Test)

Example 3 with RCMRMT030101UK04Patient

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);
}
Also used : RCMRMT030101UK04Patient(org.hl7.v3.RCMRMT030101UK04Patient) RCMRMT030101UK04Patient(org.hl7.v3.RCMRMT030101UK04Patient) Patient(org.hl7.fhir.dstu3.model.Patient) Test(org.junit.jupiter.api.Test)

Aggregations

Patient (org.hl7.fhir.dstu3.model.Patient)3 RCMRMT030101UK04Patient (org.hl7.v3.RCMRMT030101UK04Patient)3 Test (org.junit.jupiter.api.Test)2 Reference (org.hl7.fhir.dstu3.model.Reference)1