Search in sources :

Example 21 with ListResource

use of org.hl7.fhir.r4.model.ListResource in project org.hl7.fhir.core by hapifhir.

the class ListRenderer method render.

public boolean render(XhtmlNode x, ListResource list) throws FHIRFormatError, DefinitionException, IOException {
    if (list.hasTitle()) {
        x.h2().tx(list.getTitle());
    }
    XhtmlNode t = x.table("clstu");
    XhtmlNode tr = t.tr();
    if (list.hasDate()) {
        tr.td().tx("Date: " + list.getDate().toLocaleString());
    }
    if (list.hasMode()) {
        tr.td().tx("Mode: " + list.getMode().getDisplay());
    }
    if (list.hasStatus()) {
        tr.td().tx("Status: " + list.getStatus().getDisplay());
    }
    if (list.hasCode()) {
        tr.td().tx("Code: " + display(list.getCode()));
    }
    tr = t.tr();
    if (list.hasSubject()) {
        shortForRef(tr.td().txN("Subject: "), list.getSubject());
    }
    if (list.hasEncounter()) {
        shortForRef(tr.td().txN("Encounter: "), list.getEncounter());
    }
    if (list.hasSource()) {
        shortForRef(tr.td().txN("Source: "), list.getEncounter());
    }
    if (list.hasOrderedBy()) {
        tr.td().tx("Order: " + display(list.getOrderedBy()));
    }
    for (Annotation a : list.getNote()) {
        renderAnnotation(x, a);
    }
    boolean flag = false;
    boolean deleted = false;
    boolean date = false;
    for (ListResourceEntryComponent e : list.getEntry()) {
        flag = flag || e.hasFlag();
        deleted = deleted || e.hasDeleted();
        date = date || e.hasDate();
    }
    t = x.table("grid");
    tr = t.tr().style("backgound-color: #eeeeee");
    tr.td().b().tx("Items");
    if (date) {
        tr.td().tx("Date");
    }
    if (flag) {
        tr.td().tx("Flag");
    }
    if (deleted) {
        tr.td().tx("Deleted");
    }
    for (ListResourceEntryComponent e : list.getEntry()) {
        tr = t.tr();
        shortForRef(tr.td(), e.getItem());
        if (date) {
            tr.td().tx(e.hasDate() ? e.getDate().toLocaleString() : "");
        }
        if (flag) {
            tr.td().tx(e.hasFlag() ? display(e.getFlag()) : "");
        }
        if (deleted) {
            tr.td().tx(e.hasDeleted() ? Boolean.toString(e.getDeleted()) : "");
        }
    }
    return false;
}
Also used : ListResourceEntryComponent(org.hl7.fhir.r4b.model.ListResource.ListResourceEntryComponent) Annotation(org.hl7.fhir.r4b.model.Annotation) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Example 22 with ListResource

use of org.hl7.fhir.r4.model.ListResource in project org.hl7.fhir.core by hapifhir.

the class ListRenderer method render.

public boolean render(XhtmlNode x, ListResource list) throws FHIRFormatError, DefinitionException, IOException {
    if (list.hasTitle()) {
        x.h2().tx(list.getTitle());
    }
    XhtmlNode t = x.table("clstu");
    XhtmlNode tr = t.tr();
    if (list.hasDate()) {
        tr.td().tx("Date: " + list.getDate().toLocaleString());
    }
    if (list.hasMode()) {
        tr.td().tx("Mode: " + list.getMode().getDisplay());
    }
    if (list.hasStatus()) {
        tr.td().tx("Status: " + list.getStatus().getDisplay());
    }
    if (list.hasCode()) {
        tr.td().tx("Code: " + display(list.getCode()));
    }
    tr = t.tr();
    if (list.hasSubject()) {
        shortForRef(tr.td().txN("Subject: "), list.getSubject());
    }
    if (list.hasEncounter()) {
        shortForRef(tr.td().txN("Encounter: "), list.getEncounter());
    }
    if (list.hasSource()) {
        shortForRef(tr.td().txN("Source: "), list.getEncounter());
    }
    if (list.hasOrderedBy()) {
        tr.td().tx("Order: " + display(list.getOrderedBy()));
    }
    for (Annotation a : list.getNote()) {
        renderAnnotation(x, a);
    }
    boolean flag = false;
    boolean deleted = false;
    boolean date = false;
    for (ListResourceEntryComponent e : list.getEntry()) {
        flag = flag || e.hasFlag();
        deleted = deleted || e.hasDeleted();
        date = date || e.hasDate();
    }
    t = x.table("grid");
    tr = t.tr().style("backgound-color: #eeeeee");
    tr.td().b().tx("Items");
    if (date) {
        tr.td().tx("Date");
    }
    if (flag) {
        tr.td().tx("Flag");
    }
    if (deleted) {
        tr.td().tx("Deleted");
    }
    for (ListResourceEntryComponent e : list.getEntry()) {
        tr = t.tr();
        shortForRef(tr.td(), e.getItem());
        if (date) {
            tr.td().tx(e.hasDate() ? e.getDate().toLocaleString() : "");
        }
        if (flag) {
            tr.td().tx(e.hasFlag() ? display(e.getFlag()) : "");
        }
        if (deleted) {
            tr.td().tx(e.hasDeleted() ? Boolean.toString(e.getDeleted()) : "");
        }
    }
    return false;
}
Also used : ListResourceEntryComponent(org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent) Annotation(org.hl7.fhir.r5.model.Annotation) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Example 23 with ListResource

use of org.hl7.fhir.r4.model.ListResource in project nia-patient-switching-standard-adaptor by NHSDigital.

the class ConsultationListMapper method mapToConsultation.

public ListResource mapToConsultation(RCMRMT030101UK04EhrExtract ehrExtract, Encounter encounter) {
    ListResource consultation = new ListResource();
    consultation.setStatus(ListStatus.CURRENT).setMode(ListMode.SNAPSHOT).setTitle(getConsultationTitle(encounter.getType())).setCode(CodeableConceptUtils.createCodeableConcept(CONSULTATION_CODE_CODE, LIST_CODE_SYSTEM, CONSULTATION_CODE_DISPLAY, null)).setSubject(encounter.getSubject()).setDateElement(getConsultationDate(encounter.getPeriod(), ehrExtract)).setOrderedBy(CodeableConceptUtils.createCodeableConcept(LIST_ORDERED_BY_CODE, LIST_ORDERED_BY_SYSTEM, LIST_ORDERED_BY_DISPLAY, null)).setEncounter(new Reference(encounter)).setMeta(generateMeta(LIST_META_PROFILE)).setId(getConsultationId(encounter.getId()));
    return consultation;
}
Also used : Reference(org.hl7.fhir.dstu3.model.Reference) ListResource(org.hl7.fhir.dstu3.model.ListResource)

Example 24 with ListResource

use of org.hl7.fhir.r4.model.ListResource in project nia-patient-switching-standard-adaptor by NHSDigital.

the class ConsultationListMapper method mapToTopic.

public ListResource mapToTopic(ListResource consultation, RCMRMT030101UK04CompoundStatement compoundStatement) {
    ListResource topic = new ListResource();
    topic.setStatus(ListStatus.CURRENT).setMode(ListMode.SNAPSHOT).setTitle(getTitle(compoundStatement)).setCode(CodeableConceptUtils.createCodeableConcept(TOPIC_CODE_CODE, LIST_CODE_SYSTEM, TOPIC_CODE_DISPLAY, null)).setEncounter(consultation.getEncounter()).setSubject(consultation.getSubject()).setDateElement(getDate(compoundStatement, consultation)).setOrderedBy(CodeableConceptUtils.createCodeableConcept(LIST_ORDERED_BY_CODE, LIST_ORDERED_BY_SYSTEM, LIST_ORDERED_BY_DISPLAY, null)).setMeta(generateMeta(LIST_META_PROFILE)).setId(getTopicId(compoundStatement));
    return topic;
}
Also used : ListResource(org.hl7.fhir.dstu3.model.ListResource)

Example 25 with ListResource

use of org.hl7.fhir.r4.model.ListResource in project nia-patient-switching-standard-adaptor by NHSDigital.

the class ConsultationListMapper method mapToCategory.

public ListResource mapToCategory(ListResource topic, RCMRMT030101UK04CompoundStatement compoundStatement) {
    ListResource category = new ListResource();
    category.setStatus(ListStatus.CURRENT).setMode(ListMode.SNAPSHOT).setTitle(getTitle(compoundStatement)).setCode(CodeableConceptUtils.createCodeableConcept(CATEGORY_CODE_CODE, LIST_CODE_SYSTEM, CATEGORY_CODE_DISPLAY, null)).setEncounter(topic.getEncounter()).setSubject(topic.getSubject()).setDateElement(getDate(compoundStatement, topic)).setOrderedBy(CodeableConceptUtils.createCodeableConcept(LIST_ORDERED_BY_CODE, LIST_ORDERED_BY_SYSTEM, LIST_ORDERED_BY_DISPLAY, null)).setMeta(generateMeta(LIST_META_PROFILE)).setId(compoundStatement.getId().get(0).getRoot());
    return category;
}
Also used : ListResource(org.hl7.fhir.dstu3.model.ListResource)

Aggregations

ListResource (org.hl7.fhir.r5.model.ListResource)12 Element (org.w3c.dom.Element)12 ListResourceEntryComponent (org.hl7.fhir.r5.model.ListResource.ListResourceEntryComponent)11 ListResource (org.hl7.fhir.dstu3.model.ListResource)10 Reference (org.hl7.fhir.dstu3.model.Reference)10 ListEntryComponent (org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent)9 ArrayList (java.util.ArrayList)8 ListResource (org.hl7.fhir.r4.model.ListResource)8 Reference (org.hl7.fhir.r4.model.Reference)6 HashMap (java.util.HashMap)5 XSSFSheet (org.apache.poi.xssf.usermodel.XSSFSheet)5 SectionComponent (org.hl7.fhir.dstu3.model.Composition.SectionComponent)4 Patient (org.hl7.fhir.r4.model.Patient)4 Date (java.util.Date)3 HashSet (java.util.HashSet)3 List (java.util.List)3 File (java.io.File)2 FileOutputStream (java.io.FileOutputStream)2 IOException (java.io.IOException)2 XSSFRow (org.apache.poi.xssf.usermodel.XSSFRow)2