Search in sources :

Example 16 with ProcedureRequest

use of org.hl7.fhir.dstu3.model.ProcedureRequest in project integration-adaptor-111 by nhsconnect.

the class ProcedureRequestMapper method mapProcedureRequest.

public ProcedureRequest mapProcedureRequest(POCDMT000002UK01ClinicalDocument1 clinicalDocument, Reference patient, ReferralRequest referralRequest) {
    ProcedureRequest procedureRequest = new ProcedureRequest();
    if (clinicalDocument.isSetComponentOf()) {
        if (clinicalDocument.getComponentOf().getEncompassingEncounter() != null) {
            if (clinicalDocument.getComponentOf().getEncompassingEncounter().isSetDischargeDispositionCode()) {
                Coding coding = new Coding();
                CE dischargeCode = clinicalDocument.getComponentOf().getEncompassingEncounter().getDischargeDispositionCode();
                if (dischargeCode.isSetDisplayName()) {
                    coding.setDisplay(dischargeCode.getDisplayName());
                }
                if (dischargeCode.isSetCode()) {
                    coding.setCode(dischargeCode.getCode());
                }
                if (dischargeCode.isSetCodeSystem()) {
                    coding.setSystem(dischargeCode.getCodeSystem());
                }
                if (StringUtils.isNotBlank(coding.getCode()) || StringUtils.isNotBlank(coding.getDisplay()) || StringUtils.isNotBlank(coding.getSystem())) {
                    procedureRequest.setIdElement(resourceUtil.newRandomUuid());
                    procedureRequest.setStatus(ProcedureRequest.ProcedureRequestStatus.ACTIVE).setIntent(ProcedureRequest.ProcedureRequestIntent.PLAN).setPriority(ProcedureRequest.ProcedureRequestPriority.ROUTINE).setCode(new CodeableConcept().addCoding(coding)).setSubject(patient).setDoNotPerform(false).setOccurrence(periodMapper.mapPeriod(clinicalDocument.getEffectiveTime())).setReasonReference(referralRequest.getReasonReference());
                }
            }
        }
    }
    return procedureRequest;
}
Also used : CE(uk.nhs.connect.iucds.cda.ucr.CE) Coding(org.hl7.fhir.dstu3.model.Coding) ProcedureRequest(org.hl7.fhir.dstu3.model.ProcedureRequest) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 17 with ProcedureRequest

use of org.hl7.fhir.dstu3.model.ProcedureRequest in project org.hl7.fhir.core by hapifhir.

the class TurtleTests method test_procedurerequest_example.

@Test
public void test_procedurerequest_example() throws FileNotFoundException, IOException, Exception {
    System.out.println("procedurerequest-example.ttl");
    new Turtle().parse(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\procedurerequest-example.ttl"));
}
Also used : Turtle(org.hl7.fhir.dstu3.utils.formats.Turtle) Test(org.junit.jupiter.api.Test)

Example 18 with ProcedureRequest

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

the class UnknownPractitionerHandlerTest method updateUnknownPractitionersRefsAddUnknownOnce.

@Test
public void updateUnknownPractitionersRefsAddUnknownOnce() {
    when(idGeneratorService.generateUuid()).thenReturn(UNKNOWN_PRACTITIONER_ID);
    Bundle bundle = bundle(new Observation(), new ProcedureRequest(), ENCOUNTER_WITHOUT_RECORDER);
    unknownPractitionerHandler.updateUnknownPractitionersRefs(bundle);
    verifyUnknownPractitionerAdded(bundle);
}
Also used : Bundle(org.hl7.fhir.dstu3.model.Bundle) Observation(org.hl7.fhir.dstu3.model.Observation) ProcedureRequest(org.hl7.fhir.dstu3.model.ProcedureRequest) Test(org.junit.jupiter.api.Test)

Example 19 with ProcedureRequest

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

the class ProcedureRequestMapper method mapToProcedureRequest.

public ProcedureRequest mapToProcedureRequest(RCMRMT030101UK04EhrExtract ehrExtract, RCMRMT030101UK04EhrComposition ehrComposition, RCMRMT030101UK04PlanStatement planStatement, Patient patient, List<Encounter> encounters, String practiseCode) {
    var id = planStatement.getId().getRoot();
    var procedureRequest = new ProcedureRequest();
    procedureRequest.setStatus(ProcedureRequestStatus.ACTIVE).setIntent(ProcedureRequestIntent.PLAN).setAuthoredOnElement(getAuthoredOn(planStatement.getAvailabilityTime(), ehrExtract, ehrComposition)).setOccurrence(getOccurrenceDate(planStatement.getEffectiveTime())).setSubject(new Reference(patient)).setMeta(generateMeta(META_PROFILE)).setId(id);
    procedureRequest.getIdentifier().add(buildIdentifier(id, practiseCode));
    procedureRequest.getNote().add(getNote(planStatement.getText()));
    procedureRequest.getReasonCode().add(codeableConceptMapper.mapToCodeableConcept(planStatement.getCode()));
    procedureRequest.getRequester().setAgent(ParticipantReferenceUtil.getParticipantReference(planStatement.getParticipant(), ehrComposition));
    setProcedureRequestContext(procedureRequest, ehrComposition, encounters);
    return procedureRequest;
}
Also used : Reference(org.hl7.fhir.dstu3.model.Reference) ProcedureRequest(org.hl7.fhir.dstu3.model.ProcedureRequest)

Example 20 with ProcedureRequest

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

the class ProcedureRequestMapperTest method mapProcedureRequestWithParticipant2.

@Test
public void mapProcedureRequestWithParticipant2() {
    var ehrExtract = unmarshallCodeElement("participant2_example.xml");
    var planStatement = getPlanStatement(ehrExtract);
    setUpCodeableConceptMock();
    ProcedureRequest procedureRequest = procedureRequestMapper.mapToProcedureRequest(ehrExtract, getEhrComposition(ehrExtract), planStatement, SUBJECT, ENCOUNTERS, PRACTISE_CODE);
    assertFixedValues(planStatement, procedureRequest);
    assertThat(procedureRequest.getReasonCodeFirstRep().getCodingFirstRep().getDisplay()).isEqualTo(planStatement.getCode().getDisplayName());
    assertThat(procedureRequest.getRequester().getAgent().getReference()).isEqualTo("Practitioner/2D70F602-6BB1-47E0-B2EC-39912A59787D");
    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