Search in sources :

Example 6 with RCMRMT030101UK04CompoundStatement

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

use of org.hl7.v3.RCMRMT030101UK04CompoundStatement 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 8 with RCMRMT030101UK04CompoundStatement

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

the class SpecimenMapper method createSpecimen.

private Specimen createSpecimen(RCMRMT030101UK04CompoundStatement specimenCompoundStatement, Patient patient, String practiceCode) {
    Specimen specimen = new Specimen();
    final String id = specimenCompoundStatement.getId().get(0).getRoot();
    specimen.setId(id);
    specimen.setMeta(generateMeta(SPECIMEN_META_PROFILE_SUFFIX));
    specimen.addIdentifier(buildIdentifier(id, practiceCode));
    specimen.setSubject(new Reference(patient));
    specimen.setNote(getNote(specimenCompoundStatement));
    getAccessionIdentifier(specimenCompoundStatement).ifPresent(specimen::setAccessionIdentifier);
    getType(specimenCompoundStatement).ifPresent(specimen::setType);
    getCollectedDateTime(specimenCompoundStatement).ifPresent(specimen::setCollection);
    return specimen;
}
Also used : Specimen(org.hl7.fhir.dstu3.model.Specimen) Reference(org.hl7.fhir.dstu3.model.Reference)

Example 9 with RCMRMT030101UK04CompoundStatement

use of org.hl7.v3.RCMRMT030101UK04CompoundStatement 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)

Example 10 with RCMRMT030101UK04CompoundStatement

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

the class ConsultationListMapper method mapToTopic.

public ListResource mapToTopic(ListResource consultation, RCMRMT030101UK04CompoundStatement compoundStatement) {
    ListResource topic = new ListResource();
    topic.setStatus(ListStatus.CURRENT).setMode(ListMode.SNAPSHOT).setTitle(getTitle(compoundStatement)).setCode(CodeableConceptUtils.createCodeableConcept(TOPIC_CODE_CODE, LIST_CODE_SYSTEM, TOPIC_CODE_DISPLAY, null)).setEncounter(consultation.getEncounter()).setSubject(consultation.getSubject()).setDateElement(getDate(compoundStatement, consultation)).setOrderedBy(CodeableConceptUtils.createCodeableConcept(LIST_ORDERED_BY_CODE, LIST_ORDERED_BY_SYSTEM, LIST_ORDERED_BY_DISPLAY, null)).setMeta(generateMeta(LIST_META_PROFILE)).setId(getTopicId(compoundStatement));
    return topic;
}
Also used : ListResource(org.hl7.fhir.dstu3.model.ListResource)

Aggregations

RCMRMT030101UK04CompoundStatement (org.hl7.v3.RCMRMT030101UK04CompoundStatement)14 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)13 Reference (org.hl7.fhir.dstu3.model.Reference)10 Test (org.junit.jupiter.api.Test)7 MethodSource (org.junit.jupiter.params.provider.MethodSource)6 ArrayList (java.util.ArrayList)4 ListResource (org.hl7.fhir.dstu3.model.ListResource)2 ListEntryComponent (org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent)2 ParticipantReferenceUtil.getParticipantReference (uk.nhs.adaptors.pss.translator.util.ParticipantReferenceUtil.getParticipantReference)2 DiagnosticReport (org.hl7.fhir.dstu3.model.DiagnosticReport)1 IdType (org.hl7.fhir.dstu3.model.IdType)1 Observation (org.hl7.fhir.dstu3.model.Observation)1 QuestionnaireResponse (org.hl7.fhir.dstu3.model.QuestionnaireResponse)1 Specimen (org.hl7.fhir.dstu3.model.Specimen)1 UriType (org.hl7.fhir.dstu3.model.UriType)1 CD (org.hl7.v3.CD)1 II (org.hl7.v3.II)1 TS (org.hl7.v3.TS)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 ResourceUtil.addContextToObservation (uk.nhs.adaptors.pss.translator.util.ResourceUtil.addContextToObservation)1