Search in sources :

Example 1 with ListEntryComponent

use of org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent in project gpconnect-demonstrator by nhsconnect.

the class StructuredAllergyIntoleranceBuilder method listResourceBuilder.

private void listResourceBuilder(ListResource buildingListResource, AllergyIntolerance allergyIntolerance, boolean isResolved) {
    ListEntryComponent comp = new ListEntryComponent();
    if (isResolved) {
        buildingListResource.addContained(allergyIntolerance);
        Reference allergyReference = new Reference("#" + allergyIntolerance.getId());
        comp.setItem(allergyReference);
    } else {
        Reference allergyReference = new Reference("AllergyIntolerance/" + allergyIntolerance.getId());
        comp.setItem(allergyReference);
    }
    buildingListResource.addEntry(comp);
}
Also used : ListEntryComponent(org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent)

Example 2 with ListEntryComponent

use of org.hl7.fhir.dstu3.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)

Aggregations

ListEntryComponent (org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent)2 IIdType (org.hl7.fhir.instance.model.api.IIdType)1