use of org.hl7.v3.RCMRMT030101UK04EhrExtract in project nia-patient-switching-standard-adaptor by NHSDigital.
the class SpecimenMapperTest method testSpecimenIsMappedWithNoOptionalFields.
@Test
public void testSpecimenIsMappedWithNoOptionalFields() {
RCMRMT030101UK04EhrExtract ehrExtract = unmarshallEhrExtract("specimen_no_optional_fields.xml");
List<Specimen> specimenList = specimenMapper.mapSpecimen(ehrExtract, List.of(DIAGNOSTIC_REPORT_WITH_SPECIMEN), PATIENT, PRACTICE_CODE);
Specimen specimen = specimenList.get(0);
assertThat(specimen.getCollection().getCollected()).isNull();
assertThat(specimen.hasAccessionIdentifier()).isFalse();
assertThat(specimen.getType().getText()).isNullOrEmpty();
checkFixedValues(specimen);
}
use of org.hl7.v3.RCMRMT030101UK04EhrExtract 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;
}
use of org.hl7.v3.RCMRMT030101UK04EhrExtract 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;
}
use of org.hl7.v3.RCMRMT030101UK04EhrExtract 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;
}
use of org.hl7.v3.RCMRMT030101UK04EhrExtract in project nia-patient-switching-standard-adaptor by NHSDigital.
the class MedicationRequestOrderMapper method mapToOrderMedicationRequest.
public MedicationRequest mapToOrderMedicationRequest(RCMRMT030101UK04EhrExtract ehrExtract, RCMRMT030101UK04MedicationStatement medicationStatement, RCMRMT030101UK04Prescribe supplyPrescribe, String practiseCode) {
var ehrSupplyPrescribeIdExtract = extractEhrSupplyPrescribeId(supplyPrescribe);
var inFulfillmentOfId = extractInFulfillmentOfId(supplyPrescribe);
if (ehrSupplyPrescribeIdExtract.isPresent()) {
var ehrSupplyPrescribeId = ehrSupplyPrescribeIdExtract.get();
MedicationRequest medicationRequest = createMedicationRequestSkeleton(ehrSupplyPrescribeId);
medicationRequest.addIdentifier(buildIdentifier(ehrSupplyPrescribeId, practiseCode));
medicationRequest.setStatus(COMPLETED);
medicationRequest.setIntent(ORDER);
medicationRequest.addDosageInstruction(buildDosage(medicationStatement.getPertinentInformation()));
medicationRequest.setDispenseRequest(buildDispenseRequestForPrescribe(supplyPrescribe));
buildNotesForPrescribe(supplyPrescribe).forEach(medicationRequest::addNote);
medicationMapper.extractMedicationReference(medicationStatement).ifPresent(medicationRequest::setMedication);
inFulfillmentOfId.ifPresent(inFulfillmentId -> {
var supplyAuthorise = extractSupplyAuthorise(ehrExtract, inFulfillmentId);
buildPrescriptionTypeExtension(supplyAuthorise).ifPresent(medicationRequest::addExtension);
medicationRequest.addBasedOn(buildMedicationRequestReference(inFulfillmentId));
});
return medicationRequest;
}
return null;
}
Aggregations