use of org.hl7.fhir.dstu2016may.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;
}
use of org.hl7.fhir.dstu2016may.model.Composition.SectionComponent in project eCRNow by drajer-health.
the class FhirGeneratorUtilsTest method getSectionComponentTest.
@Test
public void getSectionComponentTest() {
SectionComponent sc = FhirGeneratorUtils.getSectionComponent("TestValue", "123456", "Covid-19");
assertNotNull(sc);
assertNotNull(sc.getCode());
assertEquals("Covid-19", sc.getCode().getText());
}
use of org.hl7.fhir.dstu2016may.model.Composition.SectionComponent in project eCRNow by drajer-health.
the class FhirGeneratorUtils method getSectionComponent.
public static SectionComponent getSectionComponent(String system, String code, String display) {
CodeableConcept cc = getCodeableConcept(system, code, display);
SectionComponent sc = null;
if (cc != null) {
sc = new SectionComponent();
sc.setCode(cc);
}
return sc;
}
use of org.hl7.fhir.dstu2016may.model.Composition.SectionComponent in project eCRNow by drajer-health.
the class EicrCompositionGenerator method convertR4FhirBundletoCdaEicr.
public static Composition convertR4FhirBundletoCdaEicr(R4FhirData data) {
Composition comp = new Composition();
// Add version number extension.
comp.addExtension(FhirGeneratorConstants.COMP_CLIN_DOC_VERSION_NUM_URL, new StringType(String.valueOf(FhirGeneratorConstants.VERSION_NUM)));
// Add Type
comp.setType(FhirGeneratorUtils.getCodeableConcept(FhirGeneratorConstants.LOINC_CS_URL, FhirGeneratorConstants.COMP_TYPE_CODE, FhirGeneratorConstants.COMP_TYPE_CODE_DISPLAY));
// Setup Patient.
comp.getSubject().setResource(data.getPatient());
// Setup Encounter
if (data.getEncounter() != null)
comp.getEncounter().setResource(data.getEncounter());
// Add Authors.
List<Reference> auths = new ArrayList<>();
// Add organization
if (data.getOrganization() != null)
auths.add(FhirGeneratorUtils.getReference(data.getOrganization()));
if (data.getPractitioner() != null)
auths.add(FhirGeneratorUtils.getReference(data.getPractitioner()));
comp.setAuthor(auths);
// Add Reason for Visit Section;
SectionComponent rvs = FhirGeneratorUtils.getSectionComponent(FhirGeneratorConstants.LOINC_CS_URL, FhirGeneratorConstants.REASON_FOR_VISIT_CODE, FhirGeneratorConstants.REASON_FOR_VISIT_CODE_DISPLAY);
// Set the Section Code Display to be the narrative text.
rvs.getCode().setTextElement(new StringType(FhirGeneratorUtils.getReasonForVisitNarrativeText(data.getEncounter())));
comp.getSection().add(rvs);
return comp;
}
Aggregations