use of org.hl7.fhir.r4b.model.Composition.SectionComponent in project gpconnect-demonstrator by nhsconnect.
the class FhirSectionBuilder method buildFhirSection.
public static SectionComponent buildFhirSection(Page page) {
Coding coding = new Coding().setSystem(SystemURL.VS_GPC_RECORD_SECTION).setCode(page.getCode()).setDisplay(page.getName());
CodeableConcept codableConcept = new CodeableConcept().addCoding(coding);
codableConcept.setText(page.getName());
Narrative narrative = new Narrative();
narrative.setStatus(NarrativeStatus.GENERATED);
narrative.setDivAsString(createHtmlContent(page));
SectionComponent sectionComponent = new SectionComponent();
sectionComponent.setCode(codableConcept);
sectionComponent.setTitle(page.getName()).setCode(codableConcept).setText(narrative);
return sectionComponent;
}
use of org.hl7.fhir.r4b.model.Composition.SectionComponent 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 org.hl7.fhir.r4b.model.Composition.SectionComponent in project integration-adaptor-111 by nhsconnect.
the class CompositionMapper method addPathwaysToSection.
private void addPathwaysToSection(Composition composition, List<QuestionnaireResponse> questionnaireResponseList) {
String questionnaireResponseTitle = "QuestionnaireResponse";
for (QuestionnaireResponse questionnaireResponse : questionnaireResponseList) {
SectionComponent sectionComponent = new SectionComponent();
sectionComponent.addEntry(resourceUtil.createReference(questionnaireResponse));
sectionComponent.setTitle(questionnaireResponseTitle);
composition.addSection(sectionComponent);
}
}
use of org.hl7.fhir.r4b.model.Composition.SectionComponent in project integration-adaptor-111 by nhsconnect.
the class CompositionMapperTest method shouldMapComposition.
@Test
@SuppressWarnings("MagicNumber")
public void shouldMapComposition() {
Composition composition = compositionMapper.mapComposition(clinicalDocument, encounter, carePlans, questionnaireResponseList, referralRequest, practitionerRoles);
Coding code = composition.getType().getCodingFirstRep();
String questionnaireResponseTitle = "QuestionnaireResponse";
assertThat(composition.getTitle()).isEqualTo("111 Report");
assertThat(code.getCode()).isEqualTo("371531000");
assertThat(code.getSystem()).isEqualTo("http://snomed.info/sct");
assertThat(code.getDisplay()).isEqualTo("Report of clinical encounter (record artifact)");
assertThat(composition.getStatus()).isEqualTo(FINAL);
assertThat(composition.getConfidentiality()).isEqualTo(Composition.DocumentConfidentiality.V);
assertThat(composition.getRelatesTo().get(0).getCode()).isEqualTo(REPLACES);
Composition.SectionComponent sectionComponent = composition.getSection().get(0);
assertThat(sectionComponent.getSection().size()).isEqualTo(1);
assertThat(sectionComponent.getSection().get(0).getTitle()).isEqualTo(NESTED_SECTION_TITLE);
assertThat(sectionComponent.getSection().get(0).getText().getStatus()).isEqualTo(GENERATED);
assertThat(sectionComponent.getSection().get(0).getText().getDivAsString()).isEqualTo(COMPOSITION_SECTION_DIV);
assertThat(composition.getSection().get(1).getTitle()).isEqualTo("CarePlan");
assertThat(composition.getSection().get(2).getTitle()).isEqualTo("ReferralRequest");
assertThat(composition.getSection().get(3).getEntry().get(0).getResource()).isEqualTo(questionnaireResponse);
assertThat(composition.getSection().get(3).getTitle()).isEqualTo(questionnaireResponseTitle);
assertThat(composition.getIdElement().getValue()).isEqualTo(RANDOM_UUID);
assertThat(composition.getDateElement().getValue()).isEqualTo(DateUtil.parse(effectiveTime.getValue()).getValue());
}
use of org.hl7.fhir.r4b.model.Composition.SectionComponent in project org.hl7.fhir.core by hapifhir.
the class BundleRenderer method renderDocument.
private boolean renderDocument(XhtmlNode x, Bundle b) throws UnsupportedEncodingException, FHIRException, IOException, EOperationOutcome {
// from the spec:
//
// When the document is presented for human consumption, applications SHOULD present the collated narrative portions in order:
// * The subject resource Narrative
// * The Composition resource Narrative
// * The section.text Narratives
Composition comp = (Composition) b.getEntry().get(0).getResource();
Resource subject = resolveReference(b, comp.getSubject());
if (subject != null) {
XhtmlNode nx = (subject instanceof DomainResource) ? ((DomainResource) subject).getText().getDiv() : null;
if (nx != null) {
x.addChildren(nx);
} else {
RendererFactory.factory(subject, context).render(x, subject);
}
}
x.hr();
if (comp.getText().hasDiv()) {
x.addChildren(comp.getText().getDiv());
x.hr();
}
for (SectionComponent section : comp.getSection()) {
addSection(x, section, 2, false);
}
return false;
}
Aggregations