use of uk.nhs.connect.iucds.cda.ucr.TS in project integration-adaptor-111 by nhsconnect.
the class ReferralRequestMapperTest method setup.
@BeforeEach
public void setup() {
healthcareServiceList = new ArrayList<>();
healthcareServiceList.add(healthcareService);
encounter = new Encounter();
String encounterId = "Encounter/1";
encounter.setServiceProvider(serviceProviderRef).setSubject(patientRef).setId(encounterId);
TS ts = TS.Factory.newInstance();
ts.setValue(AUTHOR_TIME);
POCDMT000002UK01Author[] authorArray = new POCDMT000002UK01Author[1];
authorArray[0] = author;
TS effectiveTime = TS.Factory.newInstance();
effectiveTime.setValue("20220304");
when(procedureRequestMapper.mapProcedureRequest(any(), any(), any())).thenReturn(procedureRequest);
when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
when(resourceUtil.createReference(encounter)).thenReturn(new Reference(encounter));
when(resourceUtil.createReference(procedureRequest)).thenReturn(new Reference(procedureRequest));
when(resourceUtil.createReference(practitioner)).thenReturn(new Reference(practitioner));
when(author.getTime()).thenReturn(ts);
when(author.getTypeCode()).thenReturn("AUT");
when(clinicalDocument.getAuthorArray()).thenReturn(authorArray);
when(clinicalDocument.getParticipantArray()).thenReturn(new POCDMT000002UK01Participant1[] { participantREFT, participantCALLBCK });
when(clinicalDocument.getEffectiveTime()).thenReturn(effectiveTime);
when(participantREFT.getTypeCode()).thenReturn(PARTICIPANT_TYPE_CODE_REFT);
when(participantCALLBCK.getTypeCode()).thenReturn(PARTICIPANT_TYPE_CODE_CALLBCK);
when(participantREFT.getAssociatedEntity()).thenReturn(associatedEntity);
when(practitionerMapper.mapPractitioner(associatedEntity)).thenReturn(practitioner);
when(periodMapper.mapPeriod(effectiveTime)).thenReturn(occurrence);
}
use of uk.nhs.connect.iucds.cda.ucr.TS in project integration-adaptor-111 by nhsconnect.
the class ProcedureRequestMapperTest method setUp.
@BeforeEach
public void setUp() {
TS effectiveTime = TS.Factory.newInstance();
effectiveTime.setValue("20220304");
reasonReferenceList.add(reasonReference);
when(clinicalDocument1.isSetComponentOf()).thenReturn(true);
when(clinicalDocument1.getComponentOf()).thenReturn(component1);
when(clinicalDocument1.getEffectiveTime()).thenReturn(effectiveTime);
when(component1.getEncompassingEncounter()).thenReturn(encompassingEncounter);
when(encompassingEncounter.isSetDischargeDispositionCode()).thenReturn(true);
when(encompassingEncounter.getDischargeDispositionCode()).thenReturn(ce);
when(ce.isSetDisplayName()).thenReturn(true);
when(ce.getDisplayName()).thenReturn(DISPLAY_NAME);
when(ce.isSetCode()).thenReturn(true);
when(ce.getCode()).thenReturn(CODE);
when(ce.isSetCodeSystem()).thenReturn(true);
when(ce.getCodeSystem()).thenReturn(CODESYSTEM);
when(referralRequest.getReasonReference()).thenReturn(reasonReferenceList);
when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
when(periodMapper.mapPeriod(effectiveTime)).thenReturn(occurrence);
}
use of uk.nhs.connect.iucds.cda.ucr.TS in project integration-adaptor-111 by nhsconnect.
the class PatientMapperTest method mockBirthTime.
private void mockBirthTime(POCDMT000002UK01Patient itkPatient) {
when(itkPatient.isSetBirthTime()).thenReturn(true);
TS itkBirthTime = mock(TS.class);
when(itkPatient.getBirthTime()).thenReturn(itkBirthTime);
when(periodMapper.mapPeriod(isA(TS.class))).thenReturn(period);
when(period.getStart()).thenReturn(date);
}
use of uk.nhs.connect.iucds.cda.ucr.TS in project integration-adaptor-111 by nhsconnect.
the class DataEntererMapperTest method shouldMapDataEntererToParticipantComponent.
@Test
public void shouldMapDataEntererToParticipantComponent() {
POCDMT000002UK01DataEnterer dataEnterer = mock(POCDMT000002UK01DataEnterer.class);
POCDMT000002UK01AssignedEntity assignedEntity = mock(POCDMT000002UK01AssignedEntity.class);
TS time = mock(TS.class);
when(dataEnterer.getAssignedEntity()).thenReturn(assignedEntity);
when(dataEnterer.isSetTime()).thenReturn(true);
when(dataEnterer.getTime()).thenReturn(time);
when(dataEnterer.getTypeCode()).thenReturn("CON");
when(practitionerMapper.mapPractitioner(isA(POCDMT000002UK01AssignedEntity.class))).thenReturn(practitioner);
when(periodMapper.mapPeriod(isA(TS.class))).thenReturn(period);
when(resourceUtil.createReference(practitioner)).thenReturn(new Reference(practitioner));
Encounter.EncounterParticipantComponent participantComponent = dataEntererMapper.mapDataEntererIntoParticipantComponent(dataEnterer);
assertThat(participantComponent.getIndividualTarget()).isEqualTo(practitioner);
assertThat(participantComponent.getPeriod()).isEqualTo(period);
assertThat(participantComponent.getType().get(0).getText()).isEqualTo("CON");
}
Aggregations