use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component5 in project integration-adaptor-111 by nhsconnect.
the class ObservationMapper method mapObservations.
public List<Observation> mapObservations(POCDMT000002UK01ClinicalDocument1 clinicalDocument, Encounter encounter) {
List<Observation> observations = new ArrayList<>();
POCDMT000002UK01Component2 component = clinicalDocument.getComponent();
if (component.isSetStructuredBody()) {
POCDMT000002UK01Component3[] components = component.getStructuredBody().getComponentArray();
for (POCDMT000002UK01Component3 component3 : components) {
POCDMT000002UK01Section section = component3.getSection();
for (POCDMT000002UK01Component5 component5 : section.getComponentArray()) {
ST title = component5.getSection().getTitle();
if (nodeUtil.getNodeValueString(title).matches(PATIENTS_CONDITION_REGEXP)) {
StrucDocContent[] contentArray = component5.getSection().getText().getContentArray();
List<String> sectionText = stream(contentArray).map(it -> nodeUtil.getNodeValueString(it)).collect(toList());
observations.add(createObservation(encounter, sectionText));
}
}
}
}
return observations;
}
use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component5 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.POCDMT000002UK01Component5 in project integration-adaptor-111 by nhsconnect.
the class CompositionMapper method addSectionChildren.
private void addSectionChildren(SectionComponent component, POCDMT000002UK01Section section) {
for (POCDMT000002UK01Component5 component5 : section.getComponentArray()) {
POCDMT000002UK01Section innerSection = component5.getSection();
SectionComponent innerCompositionSection = getSectionText(innerSection);
component.addSection(innerCompositionSection);
if (isNotEmpty(innerSection.getComponentArray())) {
addSectionChildren(innerCompositionSection, innerSection);
}
}
}
use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component5 in project integration-adaptor-111 by nhsconnect.
the class ObservationMapperTest method setUp.
@BeforeEach
public void setUp() {
POCDMT000002UK01Component2 component2 = mock(POCDMT000002UK01Component2.class);
when(component2.isSetStructuredBody()).thenReturn(true);
POCDMT000002UK01StructuredBody structuredBody = mock(POCDMT000002UK01StructuredBody.class);
POCDMT000002UK01Component3 component3 = mock(POCDMT000002UK01Component3.class);
POCDMT000002UK01Section section = mock(POCDMT000002UK01Section.class);
POCDMT000002UK01Component5 component5 = mock(POCDMT000002UK01Component5.class);
POCDMT000002UK01Section innerSection = mock(POCDMT000002UK01Section.class);
StrucDocText text = mock(StrucDocText.class);
StrucDocContent contentItem = mock(StrucDocContent.class);
StrucDocContent[] content = new StrucDocContent[] { contentItem };
when(text.getContentArray()).thenReturn(content);
when(innerSection.getText()).thenReturn(text);
ST title = mock(ST.class);
when(nodeUtil.getNodeValueString(title)).thenReturn("Patient's Reported Condition");
when(nodeUtil.getNodeValueString(contentItem)).thenReturn(OBSERVATION_VALUE);
when(resourceUtil.newRandomUuid()).thenReturn(new IdType(RANDOM_UUID));
when(resourceUtil.createReference(encounter)).thenReturn(new Reference(encounter));
when(innerSection.getTitle()).thenReturn(title);
when(component5.getSection()).thenReturn(innerSection);
POCDMT000002UK01Component5[] components5 = new POCDMT000002UK01Component5[] { component5 };
when(section.getComponentArray()).thenReturn(components5);
when(component3.getSection()).thenReturn(section);
POCDMT000002UK01Component3[] components3 = new POCDMT000002UK01Component3[] { component3 };
when(structuredBody.getComponentArray()).thenReturn(components3);
when(component2.getStructuredBody()).thenReturn(structuredBody);
when(clinicalDocument.getComponent()).thenReturn(component2);
when(encounter.getSubject()).thenReturn(subject);
}
use of uk.nhs.connect.iucds.cda.ucr.POCDMT000002UK01Component5 in project integration-adaptor-111 by nhsconnect.
the class AppointmentServiceTest method mockAppointmentSection.
private void mockAppointmentSection(POCDMT000002UK01Section section) {
POCDMT000002UK01Component5 component5 = mock(POCDMT000002UK01Component5.class);
POCDMT000002UK01Section section1 = mock(POCDMT000002UK01Section.class);
CE code = mock(CE.class);
when(section.getComponentArray()).thenReturn(new POCDMT000002UK01Component5[] { component5 });
when(component5.getSection()).thenReturn(section1);
when(section1.getCode()).thenReturn(code);
when(code.getCode()).thenReturn(APPOINTMENT_CODE);
when(code.getCodeSystem()).thenReturn(SNOMED);
}
Aggregations