Search in sources :

Example 1 with RCMRMT030101UK04EhrComposition

use of org.hl7.v3.RCMRMT030101UK04EhrComposition 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 2 with RCMRMT030101UK04EhrComposition

use of org.hl7.v3.RCMRMT030101UK04EhrComposition in project nia-patient-switching-standard-adaptor by NHSDigital.

the class ReferralRequestMapper method mapToReferralRequest.

public ReferralRequest mapToReferralRequest(RCMRMT030101UK04EhrComposition ehrComposition, RCMRMT030101UK04RequestStatement requestStatement, Patient patient, List<Encounter> encounters, String practiseCode) {
    var referralRequest = new ReferralRequest();
    var id = requestStatement.getId().get(0).getRoot();
    referralRequest.setId(id);
    referralRequest.setMeta(generateMeta(META_PROFILE));
    referralRequest.getIdentifier().add(buildIdentifier(id, practiseCode));
    referralRequest.setStatus(ReferralRequestStatus.UNKNOWN);
    referralRequest.setIntent(ReferralCategory.ORDER);
    referralRequest.getRequester().setAgent(ParticipantReferenceUtil.getParticipantReference(requestStatement.getParticipant(), ehrComposition));
    referralRequest.setAuthoredOnElement(getAuthoredOn(requestStatement.getAvailabilityTime()));
    referralRequest.setNote(getNotes(requestStatement));
    referralRequest.setSubject(new Reference(patient));
    setReferralRequestContext(referralRequest, ehrComposition, encounters);
    setReferralRequestRecipient(referralRequest, requestStatement.getResponsibleParty());
    setReferralRequestReasonCode(referralRequest, requestStatement.getCode());
    return referralRequest;
}
Also used : ReferralRequest(org.hl7.fhir.dstu3.model.ReferralRequest) Reference(org.hl7.fhir.dstu3.model.Reference)

Example 3 with RCMRMT030101UK04EhrComposition

use of org.hl7.v3.RCMRMT030101UK04EhrComposition in project nia-patient-switching-standard-adaptor by NHSDigital.

the class TemplateMapper method createQuestionnaireResponse.

private QuestionnaireResponse createQuestionnaireResponse(RCMRMT030101UK04CompoundStatement compoundStatement, String practiseCode, Patient patient, Optional<Reference> encounter, Observation parentObservation, RCMRMT030101UK04EhrComposition ehrComposition, RCMRMT030101UK04EhrExtract ehrExtract) {
    var questionnaireResponse = new QuestionnaireResponse();
    var id = compoundStatement.getId().get(0).getRoot();
    questionnaireResponse.addItem(createdLinkedId(compoundStatement)).setAuthoredElement(getAuthored(ehrComposition, ehrExtract)).setSubject(new Reference(patient)).setStatus(COMPLETED).setParent(List.of(new Reference(parentObservation))).setIdentifier(buildIdentifier(id, practiseCode)).setMeta(generateMeta(QUESTIONNAIRE_META_PROFILE)).setId(QUESTIONNAIRE_REFERENCE.formatted(id));
    encounter.ifPresent(questionnaireResponse::setContext);
    return questionnaireResponse;
}
Also used : ParticipantReferenceUtil.getParticipantReference(uk.nhs.adaptors.pss.translator.util.ParticipantReferenceUtil.getParticipantReference) Reference(org.hl7.fhir.dstu3.model.Reference) QuestionnaireResponse(org.hl7.fhir.dstu3.model.QuestionnaireResponse)

Example 4 with RCMRMT030101UK04EhrComposition

use of org.hl7.v3.RCMRMT030101UK04EhrComposition in project nia-patient-switching-standard-adaptor by NHSDigital.

the class DiagnosticReportMapper method createDiagnosticReport.

private DiagnosticReport createDiagnosticReport(RCMRMT030101UK04CompoundStatement compoundStatement, Patient patient, RCMRMT030101UK04EhrComposition composition, List<Encounter> encounters, String practiceCode) {
    final DiagnosticReport diagnosticReport = new DiagnosticReport();
    final String id = compoundStatement.getId().get(0).getRoot();
    diagnosticReport.setMeta(generateMeta(META_PROFILE_URL_SUFFIX));
    diagnosticReport.setId(id);
    diagnosticReport.addIdentifier(buildIdentifier(id, practiceCode));
    diagnosticReport.setCode(createCode());
    diagnosticReport.setStatus(DiagnosticReportStatus.UNKNOWN);
    diagnosticReport.setSubject(new Reference(patient));
    diagnosticReport.setSpecimen(getSpecimenReferences(compoundStatement));
    createIdentifierExtension(compoundStatement.getId()).ifPresent(diagnosticReport::addIdentifier);
    buildContext(composition, encounters).ifPresent(diagnosticReport::setContext);
    setResultReferences(compoundStatement, diagnosticReport);
    return diagnosticReport;
}
Also used : Reference(org.hl7.fhir.dstu3.model.Reference) DiagnosticReport(org.hl7.fhir.dstu3.model.DiagnosticReport)

Example 5 with RCMRMT030101UK04EhrComposition

use of org.hl7.v3.RCMRMT030101UK04EhrComposition in project nia-patient-switching-standard-adaptor by NHSDigital.

the class BloodPressureMapper method mapObservation.

private Observation mapObservation(RCMRMT030101UK04EhrExtract ehrExtract, RCMRMT030101UK04EhrComposition ehrComposition, RCMRMT030101UK04CompoundStatement compoundStatement, Patient patient, List<Encounter> encounters, String practiseCode) {
    var observationStatements = getObservationStatementsFromCompoundStatement(compoundStatement);
    var id = compoundStatement.getId().get(0);
    Observation observation = new Observation().addIdentifier(buildIdentifier(id.getRoot(), practiseCode)).setStatus(ObservationStatus.FINAL).setCode(getCode(compoundStatement.getCode())).setComponent(getComponent(observationStatements)).setComment(getComment(observationStatements, getNarrativeStatementsFromCompoundStatement(compoundStatement))).setSubject(new Reference(patient)).setIssuedElement(getIssued(ehrExtract, ehrComposition)).addPerformer(getParticipantReference(compoundStatement.getParticipant(), ehrComposition));
    observation.setId(id.getRoot());
    observation.getMeta().getProfile().add(new UriType(META_PROFILE));
    addEffective(observation, getEffective(compoundStatement.getEffectiveTime(), compoundStatement.getAvailabilityTime()));
    addContextToObservation(observation, encounters, ehrComposition);
    return observation;
}
Also used : ParticipantReferenceUtil.getParticipantReference(uk.nhs.adaptors.pss.translator.util.ParticipantReferenceUtil.getParticipantReference) Reference(org.hl7.fhir.dstu3.model.Reference) Observation(org.hl7.fhir.dstu3.model.Observation) ResourceUtil.addContextToObservation(uk.nhs.adaptors.pss.translator.util.ResourceUtil.addContextToObservation) UriType(org.hl7.fhir.dstu3.model.UriType)

Aggregations

Reference (org.hl7.fhir.dstu3.model.Reference)17 ArrayList (java.util.ArrayList)5 RCMRMT030101UK04EhrComposition (org.hl7.v3.RCMRMT030101UK04EhrComposition)4 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 ListEntryComponent (org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent)3 Test (org.junit.jupiter.api.Test)3 ParticipantReferenceUtil.getParticipantReference (uk.nhs.adaptors.pss.translator.util.ParticipantReferenceUtil.getParticipantReference)3 Observation (org.hl7.fhir.dstu3.model.Observation)2 StringType (org.hl7.fhir.dstu3.model.StringType)2 ResourceUtil.addContextToObservation (uk.nhs.adaptors.pss.translator.util.ResourceUtil.addContextToObservation)2 Annotation (org.hl7.fhir.dstu3.model.Annotation)1 Condition (org.hl7.fhir.dstu3.model.Condition)1 DiagnosticReport (org.hl7.fhir.dstu3.model.DiagnosticReport)1 DocumentReference (org.hl7.fhir.dstu3.model.DocumentReference)1 EncounterLocationComponent (org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent)1 Extension (org.hl7.fhir.dstu3.model.Extension)1 IdType (org.hl7.fhir.dstu3.model.IdType)1 Immunization (org.hl7.fhir.dstu3.model.Immunization)1 ImmunizationPractitionerComponent (org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent)1 Period (org.hl7.fhir.dstu3.model.Period)1