Search in sources :

Example 36 with ProcedureRequest

use of org.hl7.fhir.dstu3.model.ProcedureRequest in project nia-patient-switching-standard-adaptor by NHSDigital.

the class ProcedureRequestMapperTest method mapProcedureRequestWithValidData.

@Test
public void mapProcedureRequestWithValidData() {
    var ehrExtract = unmarshallCodeElement("full_valid_data_example.xml");
    var planStatement = getPlanStatement(ehrExtract);
    setUpCodeableConceptMock();
    ProcedureRequest procedureRequest = procedureRequestMapper.mapToProcedureRequest(ehrExtract, getEhrComposition(ehrExtract), planStatement, SUBJECT, ENCOUNTERS, PRACTISE_CODE);
    assertFixedValues(planStatement, procedureRequest);
    assertThat(procedureRequest.getNoteFirstRep().getText()).isEqualTo(planStatement.getText());
    assertThat(procedureRequest.getOccurrenceDateTimeType().getValue()).isEqualTo(DateFormatUtil.parseToDateTimeType(planStatement.getEffectiveTime().getCenter().getValue()).getValue());
    assertThat(procedureRequest.getAuthoredOn()).isEqualTo(DateFormatUtil.parseToDateTimeType(planStatement.getAvailabilityTime().getValue()).getValue());
    assertThat(procedureRequest.getReasonCodeFirstRep().getCodingFirstRep().getDisplay()).isEqualTo(planStatement.getCode().getDisplayName());
    assertThat(procedureRequest.getRequester().getAgent().getReference()).isEqualTo("Practitioner/8D1610C2-5E48-4ED5-882B-5A4A172AFA35");
    assertThat(procedureRequest.getContext().getResource().getIdElement().getValue()).isEqualTo(ENCOUNTER_ID);
}
Also used : ProcedureRequest(org.hl7.fhir.dstu3.model.ProcedureRequest) Test(org.junit.jupiter.api.Test)

Example 37 with ProcedureRequest

use of org.hl7.fhir.dstu3.model.ProcedureRequest in project nia-patient-switching-standard-adaptor by NHSDigital.

the class ProcedureRequestMapperTest method mapProcedureRequestWithEhrExtractAvailabilityTime.

@Test
public void mapProcedureRequestWithEhrExtractAvailabilityTime() {
    var ehrExtract = unmarshallCodeElement("ehr_extract_availability_time_example.xml");
    var planStatement = getPlanStatement(ehrExtract);
    setUpCodeableConceptMock();
    ProcedureRequest procedureRequest = procedureRequestMapper.mapToProcedureRequest(ehrExtract, getEhrComposition(ehrExtract), planStatement, SUBJECT, ENCOUNTERS, PRACTISE_CODE);
    assertFixedValues(planStatement, procedureRequest);
    assertThat(procedureRequest.getAuthoredOn()).isEqualTo(DateFormatUtil.parseToDateTimeType(ehrExtract.getAvailabilityTime().getValue()).getValue());
    assertThat(procedureRequest.getReasonCodeFirstRep().getCodingFirstRep().getDisplay()).isEqualTo(planStatement.getCode().getDisplayName());
    assertThat(procedureRequest.getContext().getResource().getIdElement().getValue()).isEqualTo(ENCOUNTER_ID);
}
Also used : ProcedureRequest(org.hl7.fhir.dstu3.model.ProcedureRequest) Test(org.junit.jupiter.api.Test)

Aggregations

ProcedureRequest (org.hl7.fhir.dstu3.model.ProcedureRequest)23 Test (org.junit.jupiter.api.Test)12 Test (org.junit.Test)10 ServiceRequest (org.hl7.fhir.r4.model.ServiceRequest)6 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)6 IdType (org.hl7.fhir.dstu3.model.IdType)5 Reference (org.hl7.fhir.dstu3.model.Reference)5 Bundle (org.hl7.fhir.dstu3.model.Bundle)4 MethodOutcome (ca.uhn.fhir.rest.api.MethodOutcome)3 Identifier (org.hl7.fhir.dstu3.model.Identifier)2 Resource (org.hl7.fhir.dstu3.model.Resource)2 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)2 Test (org.testng.annotations.Test)2 SystemRequestDetails (ca.uhn.fhir.jpa.partition.SystemRequestDetails)1 IParser (ca.uhn.fhir.parser.IParser)1 Create (ca.uhn.fhir.rest.annotation.Create)1 InternalErrorException (ca.uhn.fhir.rest.server.exceptions.InternalErrorException)1 IProcedureRequest (ch.elexis.core.findings.IProcedureRequest)1 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 URI (java.net.URI)1