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