Search in sources :

Example 1 with SpecimenBatteryParameters

use of uk.nhs.adaptors.pss.translator.mapper.diagnosticreport.SpecimenBatteryMapper.SpecimenBatteryParameters in project nia-patient-switching-standard-adaptor by NHSDigital.

the class SpecimenCompoundsMapper method handleSpecimenChildComponents.

public List<Observation> handleSpecimenChildComponents(RCMRMT030101UK04EhrExtract ehrExtract, List<Observation> observations, List<Observation> observationComments, List<DiagnosticReport> diagnosticReports, Patient patient, List<Encounter> encounters, String practiseCode) {
    final List<Observation> batteryObservations = new ArrayList<>();
    diagnosticReports.forEach(diagnosticReport -> getCompoundStatementByDRId(ehrExtract, diagnosticReport.getId()).ifPresent(parentCompoundStatement -> getSpecimenCompoundStatements(parentCompoundStatement).forEach(specimenCompoundStatement -> {
        getObservationStatementsInCompound(specimenCompoundStatement).forEach(specimenObservationStatement -> getObservationById(observations, specimenObservationStatement.getId().getRoot()).ifPresent(observation -> handleObservationStatement(specimenCompoundStatement, observation, diagnosticReport)));
        getCompoundStatementsInSpecimenCompound(specimenCompoundStatement, CLUSTER_CLASSCODE).forEach(clusterCompoundStatement -> handleClusterCompoundStatement(specimenCompoundStatement, clusterCompoundStatement, observations, observationComments, diagnosticReport));
        getCompoundStatementsInSpecimenCompound(specimenCompoundStatement, BATTERY_CLASSCODE).forEach(batteryCompoundStatement -> {
            handleBatteryCompoundStatement(specimenCompoundStatement, batteryCompoundStatement, observations, observationComments, diagnosticReport);
            final SpecimenBatteryParameters batteryParameters = SpecimenBatteryParameters.builder().ehrExtract(ehrExtract).batteryCompoundStatement(batteryCompoundStatement).specimenCompoundStatement(specimenCompoundStatement).ehrComposition(getCurrentEhrComposition(ehrExtract, parentCompoundStatement)).diagnosticReport(diagnosticReport).patient(patient).encounters(encounters).observations(observations).observationComments(observationComments).practiseCode(practiseCode).build();
            batteryObservations.add(batteryMapper.mapBatteryObservation(batteryParameters));
        });
    })));
    return batteryObservations;
}
Also used : RCMRMT030101UK04Component3(org.hl7.v3.RCMRMT030101UK04Component3) RCMRMT030101UK04ObservationStatement(org.hl7.v3.RCMRMT030101UK04ObservationStatement) IdType(org.hl7.fhir.dstu3.model.IdType) RequiredArgsConstructor(lombok.RequiredArgsConstructor) TextUtil.getLastLine(uk.nhs.adaptors.pss.translator.util.TextUtil.getLastLine) Autowired(org.springframework.beans.factory.annotation.Autowired) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept) StringUtils(org.apache.commons.lang3.StringUtils) ObservationRelationshipType(org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType) RCMRMT030101UK04Component02(org.hl7.v3.RCMRMT030101UK04Component02) ArrayList(java.util.ArrayList) Specimen(org.hl7.fhir.dstu3.model.ResourceType.Specimen) DiagnosticReport(org.hl7.fhir.dstu3.model.DiagnosticReport) Service(org.springframework.stereotype.Service) RCMRMT030101UK04EhrExtract(org.hl7.v3.RCMRMT030101UK04EhrExtract) SpecimenBatteryParameters(uk.nhs.adaptors.pss.translator.mapper.diagnosticreport.SpecimenBatteryMapper.SpecimenBatteryParameters) RCMRMT030101UK04CompoundStatement(org.hl7.v3.RCMRMT030101UK04CompoundStatement) CompoundStatementResourceExtractors(uk.nhs.adaptors.pss.translator.util.CompoundStatementResourceExtractors) Reference(org.hl7.fhir.dstu3.model.Reference) RCMRMT030101UK04EhrComposition(org.hl7.v3.RCMRMT030101UK04EhrComposition) Observation(org.hl7.fhir.dstu3.model.Observation) Objects(java.util.Objects) Encounter(org.hl7.fhir.dstu3.model.Encounter) List(java.util.List) Patient(org.hl7.fhir.dstu3.model.Patient) Optional(java.util.Optional) TextUtil.addLine(uk.nhs.adaptors.pss.translator.util.TextUtil.addLine) RCMRMT030101UK04NarrativeStatement(org.hl7.v3.RCMRMT030101UK04NarrativeStatement) ObservationRelatedComponent(org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent) Observation(org.hl7.fhir.dstu3.model.Observation) ArrayList(java.util.ArrayList) SpecimenBatteryParameters(uk.nhs.adaptors.pss.translator.mapper.diagnosticreport.SpecimenBatteryMapper.SpecimenBatteryParameters)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 Objects (java.util.Objects)1 Optional (java.util.Optional)1 RequiredArgsConstructor (lombok.RequiredArgsConstructor)1 StringUtils (org.apache.commons.lang3.StringUtils)1 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)1 DiagnosticReport (org.hl7.fhir.dstu3.model.DiagnosticReport)1 Encounter (org.hl7.fhir.dstu3.model.Encounter)1 IdType (org.hl7.fhir.dstu3.model.IdType)1 Observation (org.hl7.fhir.dstu3.model.Observation)1 ObservationRelatedComponent (org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent)1 ObservationRelationshipType (org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType)1 Patient (org.hl7.fhir.dstu3.model.Patient)1 Reference (org.hl7.fhir.dstu3.model.Reference)1 Specimen (org.hl7.fhir.dstu3.model.ResourceType.Specimen)1 RCMRMT030101UK04Component02 (org.hl7.v3.RCMRMT030101UK04Component02)1 RCMRMT030101UK04Component3 (org.hl7.v3.RCMRMT030101UK04Component3)1 RCMRMT030101UK04CompoundStatement (org.hl7.v3.RCMRMT030101UK04CompoundStatement)1 RCMRMT030101UK04EhrComposition (org.hl7.v3.RCMRMT030101UK04EhrComposition)1