use of org.hl7.fhir.r4.model.ListResource.ListEntryComponent in project gpconnect-demonstrator by nhsconnect.
the class PopulateMedicationBundle method createListEntry.
private ListResource createListEntry(List<MedicationStatementDetail> medicationStatements, String nhsNumber) {
ListResource medicationStatementsList = new ListResource();
// #179 dont populate List.id
// medicationStatementsList.setId(new IdType(1));
medicationStatementsList.setMeta(new Meta().addProfile(SystemURL.SD_GPC_LIST));
medicationStatementsList.setStatus(ListStatus.CURRENT);
// #179 dont populate List.id
// medicationStatementsList.setId(new IdDt(1));
medicationStatementsList.setMode(ListMode.SNAPSHOT);
medicationStatementsList.setTitle(SystemConstants.MEDICATION_LIST);
medicationStatementsList.setCode(new CodeableConcept().addCoding(new Coding(SystemURL.VS_SNOMED, "933361000000108", MEDICATION_LIST)));
medicationStatementsList.setSubject(new Reference(new IdType("Patient", 1L)).setIdentifier(new Identifier().setValue(nhsNumber).setSystem(SystemURL.ID_NHS_NUMBER)));
medicationStatementsList.setDate(new Date());
medicationStatementsList.setOrderedBy(new CodeableConcept().addCoding(new Coding(SystemURL.CS_LIST_ORDER, "event-date", "Sorted by Event Date")));
medicationStatementsList.addExtension(setClinicalSetting());
if (medicationStatements.isEmpty()) {
medicationStatementsList.setEmptyReason(new CodeableConcept().setText(SystemConstants.NO_CONTENT));
medicationStatementsList.setNote(Arrays.asList(new Annotation(new StringType(SystemConstants.INFORMATION_NOT_AVAILABLE))));
}
Set<String> warningCodes = new HashSet<>();
medicationStatements.forEach(statement -> {
Reference statementRef = new Reference(new IdType("MedicationStatement", statement.getId()));
ListEntryComponent listEntryComponent = new ListEntryComponent(statementRef);
medicationStatementsList.addEntry(listEntryComponent);
if (statement.getWarningCode() != null) {
warningCodes.add(statement.getWarningCode());
}
});
WarningCodeExtHelper.addWarningCodeExtensions(warningCodes, medicationStatementsList, patientRepository, medicationStatementRepository, structuredAllergySearch);
return medicationStatementsList;
}
use of org.hl7.fhir.r4.model.ListResource.ListEntryComponent in project cqf-ruler by DBCG.
the class CollectDataProvider method readEvaluatedResources.
private List<Resource> readEvaluatedResources(MeasureReport report) {
List<Resource> resources = new ArrayList<>();
if (report.getEvaluatedResources() == null) {
return resources;
}
Reference listReference = report.getEvaluatedResources();
// Removes the contained "#" prefix
String listId = listReference.getReference().substring(1);
Optional<Resource> list = report.getContained().stream().filter(x -> x.getId().equals(listId)).findFirst();
if (!list.isPresent()) {
return resources;
}
ListResource containedList = (ListResource) list.get();
for (ListEntryComponent entry : containedList.getEntry()) {
if (!entry.hasItem()) {
continue;
}
Reference reference = entry.getItem();
resources.add(this.read(reference.getReferenceElement()));
}
return resources;
}
use of org.hl7.fhir.r4.model.ListResource.ListEntryComponent in project org.hl7.fhir.core by hapifhir.
the class CCDAConverter method addItemToList.
protected ListEntryComponent addItemToList(ListResource list, DomainResource ai) throws Exception {
list.getContained().add(ai);
String n = nextRef();
ai.setId(n);
ListEntryComponent item = new ListResource.ListEntryComponent();
list.getEntry().add(item);
item.setItem(Factory.makeReference("#" + n));
return item;
}
use of org.hl7.fhir.r4.model.ListResource.ListEntryComponent in project nia-patient-switching-standard-adaptor by NHSDigital.
the class EncounterMapper method generateStructuredConsultation.
private void generateStructuredConsultation(List<RCMRMT030101UK04CompoundStatement> topicCompoundStatementList, RCMRMT030101UK04EhrComposition ehrComposition, ListResource consultation, List<ListResource> topics, List<ListResource> categories) {
topicCompoundStatementList.forEach(topicCompoundStatement -> {
var topic = consultationListMapper.mapToTopic(consultation, topicCompoundStatement);
consultation.addEntry(new ListEntryComponent(new Reference(topic)));
generateCategoryLists(topicCompoundStatement, topic, categories);
generateLinkSetTopicLists(ehrComposition, consultation, topics);
topics.add(topic);
});
}
use of org.hl7.fhir.r4.model.ListResource.ListEntryComponent in project nia-patient-switching-standard-adaptor by NHSDigital.
the class EncounterMapper method generateFlatConsultation.
private void generateFlatConsultation(ListResource consultation, List<ListResource> topics, RCMRMT030101UK04EhrComposition ehrComposition) {
var topic = consultationListMapper.mapToTopic(consultation, null);
List<Reference> entryReferences = new ArrayList<>();
resourceReferenceUtil.extractChildReferencesFromEhrComposition(ehrComposition, entryReferences);
entryReferences.forEach(reference -> addEntry(topic, reference));
consultation.addEntry(new ListEntryComponent(new Reference(topic)));
topics.add(topic);
}
Aggregations