Search in sources :

Example 1 with POCDMT000002UK01Encounter

use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Encounter in project integration-adaptor-111 by nhsconnect.

the class AppointmentMapperTest method mockEntry.

private POCDMT000002UK01Entry mockEntry() {
    POCDMT000002UK01Entry entry = mock(POCDMT000002UK01Entry.class);
    POCDMT000002UK01Encounter encounter = mock(POCDMT000002UK01Encounter.class);
    POCDMT000002UK01Participant2 participant = mock(POCDMT000002UK01Participant2.class);
    POCDMT000002UK01ParticipantRole participantRole = mock(POCDMT000002UK01ParticipantRole.class);
    when(entry.getEncounter()).thenReturn(encounter);
    when(encounter.getParticipantArray()).thenReturn(new POCDMT000002UK01Participant2[] { participant });
    when(participant.getParticipantRole()).thenReturn(participantRole);
    when(entry.isSetEncounter()).thenReturn(true);
    when(encounter.isSetCode()).thenReturn(true);
    CDNPfITCDAUrl cdnPfITCDAUrl = mock(CDNPfITCDAUrl.class);
    when(encounter.getCode()).thenReturn(cdnPfITCDAUrl);
    when(cdnPfITCDAUrl.getDisplayName()).thenReturn(REASON);
    return entry;
}
Also used : POCDMT000002UK01Entry(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Entry) POCDMT000002UK01Participant2(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Participant2) CDNPfITCDAUrl(uk.nhs.connect.iucds.cda.ucr.CDNPfITCDAUrl) POCDMT000002UK01Encounter(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Encounter) POCDMT000002UK01ParticipantRole(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ParticipantRole)

Example 2 with POCDMT000002UK01Encounter

use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Encounter in project integration-adaptor-111 by nhsconnect.

the class ConditionMapper method mapCondition.

public Condition mapCondition(POCDMT000002UK01ClinicalDocument1 clinicalDocument, Encounter encounter, List<QuestionnaireResponse> questionnaireResponseList) {
    Condition condition = new Condition();
    condition.setIdElement(resourceUtil.newRandomUuid());
    condition.setClinicalStatus(Condition.ConditionClinicalStatus.ACTIVE).setVerificationStatus(Condition.ConditionVerificationStatus.UNKNOWN).setSubject(encounter.getSubject()).setContext(resourceUtil.createReference(encounter));
    if (questionnaireResponseList != null) {
        condition.setEvidence(evidenceOf(questionnaireResponseList));
    }
    addConditionReason(clinicalDocument, condition);
    if (clinicalDocument.getComponent().isSetStructuredBody()) {
        for (POCDMT000002UK01Component3 component3 : clinicalDocument.getComponent().getStructuredBody().getComponentArray()) {
            POCDMT000002UK01Section section = component3.getSection();
            for (POCDMT000002UK01Entry entry : section.getEntryArray()) {
                if (entry.isSetEncounter()) {
                    POCDMT000002UK01Encounter itkEncounter = entry.getEncounter();
                    if (itkEncounter.isSetEffectiveTime()) {
                        condition.setAssertedDateElement(DateUtil.parse(itkEncounter.getEffectiveTime().getValue()));
                    }
                    if (itkEncounter.isSetText()) {
                        condition.addCategory(new CodeableConcept().setText(nodeUtil.getAllText(itkEncounter.getText().getDomNode())));
                    }
                }
            }
            for (POCDMT000002UK01Component5 component : section.getComponentArray()) {
                if (component.getSection() != null) {
                    if (component.getSection().isSetLanguageCode()) {
                        if (component.getSection().getLanguageCode().isSetCode()) {
                            condition.setLanguage(component.getSection().getLanguageCode().getCode());
                        }
                    }
                }
            }
        }
    }
    return condition;
}
Also used : Condition(org.hl7.fhir.dstu3.model.Condition) POCDMT000002UK01Component3(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3) POCDMT000002UK01Section(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section) POCDMT000002UK01Entry(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Entry) POCDMT000002UK01Component5(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component5) POCDMT000002UK01Encounter(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Encounter) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 3 with POCDMT000002UK01Encounter

use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Encounter in project integration-adaptor-111 by nhsconnect.

the class AppointmentMapper method mapAppointment.

public Optional<Appointment> mapAppointment(POCDMT000002UK01Entry entry, POCDMT000002UK01Section matchingSection, Reference patient) {
    POCDMT000002UK01Encounter itkEncounter = entry.getEncounter();
    Appointment appointment = new Appointment().setStatus(BOOKED);
    appointment.setIdElement(resourceUtil.newRandomUuid());
    if (matchingSection != null) {
        appointment.setDescription(nodeUtil.getNodeValueString(matchingSection.getTitle())).setComment(nodeUtil.getNodeValueString(matchingSection.getText().getContentArray(0)));
    }
    appointment.addParticipant(new AppointmentParticipantComponent().setActor(patient).setActorTarget((Patient) patient.getResource()).setRequired(REQUIRED).setStatus(ACCEPTED));
    getAppointmentParticipantComponents(itkEncounter).forEach(appointment::addParticipant);
    appointment.addReason(getReason(entry));
    return Optional.of(appointment);
}
Also used : Appointment(org.hl7.fhir.dstu3.model.Appointment) AppointmentParticipantComponent(org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent) Patient(org.hl7.fhir.dstu3.model.Patient) POCDMT000002UK01Encounter(uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Encounter)

Aggregations

POCDMT000002UK01Encounter (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Encounter)3 POCDMT000002UK01Entry (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Entry)2 Appointment (org.hl7.fhir.dstu3.model.Appointment)1 AppointmentParticipantComponent (org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent)1 CodeableConcept (org.hl7.fhir.dstu3.model.CodeableConcept)1 Condition (org.hl7.fhir.dstu3.model.Condition)1 Patient (org.hl7.fhir.dstu3.model.Patient)1 CDNPfITCDAUrl (uk.nhs.connect.iucds.cda.ucr.CDNPfITCDAUrl)1 POCDMT000002UK01Component3 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component3)1 POCDMT000002UK01Component5 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component5)1 POCDMT000002UK01Participant2 (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Participant2)1 POCDMT000002UK01ParticipantRole (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01ParticipantRole)1 POCDMT000002UK01Section (uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Section)1