use of org.hl7.fhir.r4.model.Composition in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeCompositionCompositionRelatesToComponent.
protected void composeCompositionCompositionRelatesToComponent(Complex parent, String parentType, String name, Composition.CompositionRelatesToComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "relatesTo", name, element, index);
if (element.hasCodeElement())
composeEnum(t, "Composition", "code", element.getCodeElement(), -1);
if (element.hasTarget())
composeType(t, "Composition", "target", element.getTarget(), -1);
}
use of org.hl7.fhir.r4.model.Composition 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;
}
use of org.hl7.fhir.r4.model.Composition in project nia-patient-switching-standard-adaptor by NHSDigital.
the class DiagnosticReportMapper method mapResources.
@Override
public List<DiagnosticReport> mapResources(RCMRMT030101UK04EhrExtract ehrExtract, Patient patient, List<Encounter> encounters, String practiseCode) {
return mapEhrExtractToFhirResource(ehrExtract, (extract, composition, component) -> extractAllCompoundStatements(component).filter(Objects::nonNull).filter(ResourceFilterUtil::isDiagnosticReport).map(compoundStatement -> {
DiagnosticReport diagnosticReport = createDiagnosticReport(compoundStatement, patient, composition, encounters, practiseCode);
getIssued(ehrExtract, compoundStatement, composition).ifPresent(diagnosticReport::setIssuedElement);
return diagnosticReport;
})).toList();
}
use of org.hl7.fhir.r4.model.Composition in project nia-patient-switching-standard-adaptor by NHSDigital.
the class ConditionMapper method getCondition.
private Condition getCondition(RCMRMT030101UK04EhrExtract ehrExtract, Patient patient, List<Encounter> encounters, RCMRMT030101UK04EhrComposition composition, RCMRMT030101UK04LinkSet linkSet, String practiseCode) {
String id = linkSet.getId().getRoot();
Condition condition = (Condition) new Condition().addIdentifier(buildIdentifier(id, practiseCode)).addCategory(generateCategory()).setId(id).setMeta(generateMeta(META_PROFILE));
buildClinicalStatus(linkSet.getCode()).ifPresentOrElse(condition::setClinicalStatus, () -> {
condition.setClinicalStatus(ACTIVE);
condition.addNote(new Annotation(new StringType(DEFAULT_CLINICAL_STATUS)));
});
condition.setSubject(new Reference(patient));
condition.addExtension(buildProblemSignificance(linkSet.getCode()));
generateAnnotationToMinor(linkSet.getCode()).ifPresent(condition::addNote);
buildContext(composition, encounters).ifPresent(condition::setContext);
buildOnsetDateTimeType(linkSet).ifPresent(condition::setOnset);
buildAbatementDateTimeType(linkSet.getEffectiveTime()).ifPresent(condition::setAbatement);
buildAssertedDateTimeType(composition).ifPresentOrElse(condition::setAssertedDateElement, () -> condition.setAssertedDateElement(parseToDateTimeType(ehrExtract.getAvailabilityTime().getValue())));
composition.getParticipant2().stream().findFirst().ifPresent(participant2 -> condition.setAsserter(new Reference(new IdType(ResourceType.Practitioner.name(), participant2.getAgentRef().getId().getRoot()))));
return condition;
}
Aggregations