Search in sources :

Example 6 with ListEntryComponent

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;
}
Also used : IIdType(org.hl7.fhir.instance.model.api.IIdType) ListEntryComponent(org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent)

Example 7 with ListEntryComponent

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;
}
Also used : MeasureReportType(org.hl7.fhir.dstu3.model.MeasureReport.MeasureReportType) IdParam(ca.uhn.fhir.rest.annotation.IdParam) OperationParam(ca.uhn.fhir.rest.annotation.OperationParam) DaoRegistryOperationProvider(org.opencds.cqf.ruler.provider.DaoRegistryOperationProvider) Reference(org.hl7.fhir.dstu3.model.Reference) Parameters.newPart(org.opencds.cqf.ruler.utility.dstu3.Parameters.newPart) Resource(org.hl7.fhir.dstu3.model.Resource) IdType(org.hl7.fhir.dstu3.model.IdType) Description(ca.uhn.fhir.model.api.annotation.Description) Parameters.newParameters(org.opencds.cqf.ruler.utility.dstu3.Parameters.newParameters) Autowired(org.springframework.beans.factory.annotation.Autowired) ListResource(org.hl7.fhir.dstu3.model.ListResource) Operation(ca.uhn.fhir.rest.annotation.Operation) Measure(org.hl7.fhir.dstu3.model.Measure) ArrayList(java.util.ArrayList) List(java.util.List) RequestDetails(ca.uhn.fhir.rest.api.server.RequestDetails) Parameters(org.hl7.fhir.dstu3.model.Parameters) Optional(java.util.Optional) MeasureReport(org.hl7.fhir.dstu3.model.MeasureReport) ListEntryComponent(org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent) Reference(org.hl7.fhir.dstu3.model.Reference) Resource(org.hl7.fhir.dstu3.model.Resource) ListResource(org.hl7.fhir.dstu3.model.ListResource) ArrayList(java.util.ArrayList) ListEntryComponent(org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent) ListResource(org.hl7.fhir.dstu3.model.ListResource)

Example 8 with ListEntryComponent

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;
}
Also used : ListEntryComponent(org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent)

Example 9 with ListEntryComponent

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);
    });
}
Also used : Reference(org.hl7.fhir.dstu3.model.Reference) ListEntryComponent(org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent)

Example 10 with ListEntryComponent

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);
}
Also used : Reference(org.hl7.fhir.dstu3.model.Reference) ArrayList(java.util.ArrayList) ListEntryComponent(org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent)

Aggregations

ListEntryComponent (org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent)9 Reference (org.hl7.fhir.dstu3.model.Reference)5 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)2 ListResource (org.hl7.fhir.r4.model.ListResource)2 ListEntryComponent (org.hl7.fhir.r4.model.ListResource.ListEntryComponent)2 Reference (org.hl7.fhir.r4.model.Reference)2 Resource (org.hl7.fhir.r4.model.Resource)2 Description (ca.uhn.fhir.model.api.annotation.Description)1 IdParam (ca.uhn.fhir.rest.annotation.IdParam)1 Operation (ca.uhn.fhir.rest.annotation.Operation)1 OperationParam (ca.uhn.fhir.rest.annotation.OperationParam)1 RequestDetails (ca.uhn.fhir.rest.api.server.RequestDetails)1 InvalidRequestException (ca.uhn.fhir.rest.server.exceptions.InvalidRequestException)1 MeasureReportBuilder (com.ibm.cohort.engine.r4.builder.MeasureReportBuilder)1 ByteArrayDataSource (com.sun.istack.ByteArrayDataSource)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1