Search in sources :

Example 1 with PatientReferenceTranslator

use of org.openmrs.module.fhir2.api.translators.PatientReferenceTranslator in project openmrs-module-fhir2 by openmrs.

the class DiagnosticReportTranslatorImplTest method setup.

@Before
public void setup() {
    translator = new DiagnosticReportTranslatorImpl();
    translator.setObservationReferenceTranslator(observationReferenceTranslator);
    translator.setConceptTranslator(conceptTranslator);
    translator.setEncounterReferenceTranslator(encounterReferenceTranslator);
    translator.setPatientReferenceTranslator(patientReferenceTranslator);
    // OpenMRS setup
    fhirDiagnosticReport = new FhirDiagnosticReport();
    Obs childObs = new Obs();
    childObs.setUuid(CHILD_UUID);
    fhirDiagnosticReport.setUuid(PARENT_UUID);
    fhirDiagnosticReport.getResults().add(childObs);
    // FHIR setup
    Reference obsReference = new Reference().setType("Observation").setReference("Observation/" + CHILD_UUID);
    diagnosticReport = new DiagnosticReport();
    diagnosticReport.setId(PARENT_UUID);
    diagnosticReport.addResult(obsReference);
    // Mocks for DiagnosticReport.result
    when(observationReferenceTranslator.toFhirResource(childObs)).thenReturn(obsReference);
    when(observationReferenceTranslator.toOpenmrsType(obsReference)).thenReturn(childObs);
}
Also used : Obs(org.openmrs.Obs) FhirDiagnosticReport(org.openmrs.module.fhir2.model.FhirDiagnosticReport) Reference(org.hl7.fhir.r4.model.Reference) DiagnosticReport(org.hl7.fhir.r4.model.DiagnosticReport) FhirDiagnosticReport(org.openmrs.module.fhir2.model.FhirDiagnosticReport) Before(org.junit.Before)

Aggregations

DiagnosticReport (org.hl7.fhir.r4.model.DiagnosticReport)1 Reference (org.hl7.fhir.r4.model.Reference)1 Before (org.junit.Before)1 Obs (org.openmrs.Obs)1 FhirDiagnosticReport (org.openmrs.module.fhir2.model.FhirDiagnosticReport)1