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;
}
Aggregations