Search in sources :

Example 1 with RCMRMT030101UK04ObservationStatement

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

the class ConditionMapper method buildNotes.

private List<Annotation> buildNotes(Optional<RCMRMT030101UK04ObservationStatement> observationStatement, RCMRMT030101UK04LinkSet linkSet) {
    List<Annotation> annotationList = new ArrayList<>();
    observationStatement.ifPresent(observationStatement1 -> observationStatement1.getPertinentInformation().stream().map(RCMRMT030101UK04PertinentInformation02::getPertinentAnnotation).filter(Objects::nonNull).map(RCMRMT030101UK04Annotation::getText).filter(StringUtils::isNotBlank).map(StringType::new).map(Annotation::new).forEach(annotationList::add));
    if (linkSet.hasCode() && linkSet.getCode().getOriginalText() != null) {
        StringType text = new StringType(linkSet.getCode().getOriginalText());
        annotationList.add(new Annotation(text));
    }
    return annotationList;
}
Also used : StringType(org.hl7.fhir.dstu3.model.StringType) StringUtils(org.apache.commons.lang3.StringUtils) ArrayList(java.util.ArrayList) Objects(java.util.Objects) Annotation(org.hl7.fhir.dstu3.model.Annotation) RCMRMT030101UK04Annotation(org.hl7.v3.RCMRMT030101UK04Annotation)

Example 2 with RCMRMT030101UK04ObservationStatement

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

the class ImmunizationMapper method mapImmunization.

private Immunization mapImmunization(RCMRMT030101UK04EhrComposition ehrComposition, RCMRMT030101UK04ObservationStatement observationStatement, Patient patientResource, List<Encounter> encounterList, String practiseCode) {
    Immunization immunization = new Immunization();
    var id = observationStatement.getId().getRoot();
    var practitioner = ParticipantReferenceUtil.getParticipantReference(observationStatement.getParticipant(), ehrComposition);
    var encounter = getEncounterReference(encounterList, ehrComposition.getId());
    immunization.setMeta(generateMeta(META_PROFILE));
    immunization.addIdentifier(buildIdentifier(id, practiseCode));
    immunization.addExtension(createVaccineProcedureExtension(observationStatement));
    immunization.addExtension(createRecordedTimeExtension(ehrComposition));
    immunization.setEncounter(encounter).addPractitioner(new ImmunizationPractitionerComponent(practitioner)).setStatus(ImmunizationStatus.COMPLETED).setNotGiven(false).setPrimarySource(false).setPatient(new Reference(patientResource)).setId(id);
    buildNote(observationStatement).forEach(immunization::addNote);
    setDateFields(immunization, observationStatement);
    return immunization;
}
Also used : Immunization(org.hl7.fhir.dstu3.model.Immunization) Reference(org.hl7.fhir.dstu3.model.Reference) ImmunizationPractitionerComponent(org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent)

Aggregations

ArrayList (java.util.ArrayList)1 Objects (java.util.Objects)1 StringUtils (org.apache.commons.lang3.StringUtils)1 Annotation (org.hl7.fhir.dstu3.model.Annotation)1 Immunization (org.hl7.fhir.dstu3.model.Immunization)1 ImmunizationPractitionerComponent (org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent)1 Reference (org.hl7.fhir.dstu3.model.Reference)1 StringType (org.hl7.fhir.dstu3.model.StringType)1 RCMRMT030101UK04Annotation (org.hl7.v3.RCMRMT030101UK04Annotation)1