Search in sources :

Example 51 with ListResource

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

the class CCDAConverter method processVitalSignsSection.

protected SectionComponent processVitalSignsSection(Element section) throws Exception {
    ListResource list = new ListResource();
    for (Element entry : cda.getChildren(section, "entry")) {
        Element organizer = cda.getlastChild(entry);
        if (cda.hasTemplateId(organizer, "2.16.840.1.113883.10.20.22.4.26")) {
            processVitalSignsOrganizer(list, organizer);
        } else
            throw new Exception("Unhandled Section template ids: " + cda.showTemplateIds(organizer));
    }
    // todo: text
    SectionComponent s = new Composition.SectionComponent();
    s.setCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code")));
    // todo: check subject
    s.addEntry(Factory.makeReference(addReference(list, "Vital Signs", makeUUIDReference())));
    return s;
}
Also used : Element(org.w3c.dom.Element) SectionComponent(org.hl7.fhir.dstu3.model.Composition.SectionComponent)

Example 52 with ListResource

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

the class CCDAConverter method processVitalSignsOrganizer.

protected void processVitalSignsOrganizer(ListResource list, Element organizer) throws Exception {
    cda.checkTemplateId(organizer, "2.16.840.1.113883.10.20.22.4.26");
    checkNoNegationOrNullFlavor(organizer, "Vital Signs Organizer");
    checkNoSubject(organizer, "Vital Signs Organizer");
    // moodCode is EVN.
    Observation obs = new Observation();
    addItemToList(list, obs);
    // SHALL contain at least one [1..*] id (CONF:7282).
    for (Element e : cda.getChildren(organizer, "id")) obs.getIdentifier().add(convert.makeIdentifierFromII(e));
    // SHALL contain exactly one [1..1] code (CONF:19176).
    // This code SHALL contain exactly one [1..1] @code="46680005" Vital signs (CodeSystem: SNOMED-CT 2.16.840.1.113883.6.96 STATIC) (CONF:19177).
    obs.setCode(convert.makeCodeableConceptFromCD(cda.getChild(organizer, "code")));
    // SHALL contain exactly one [1..1] effectiveTime (CONF:7288).
    obs.setEffective(convert.makeMatchingTypeFromIVL(cda.getChild(organizer, "effectiveTime")));
    // SHALL contain exactly one [1..1] Vital Sign Observation (templateId:2.16.840.1.113883.10.20.22.4.27) (CONF:15946).
    for (Element e : cda.getChildren(organizer, "component")) {
        ObservationRelatedComponent ro = new ObservationRelatedComponent();
        ro.setType(ObservationRelationshipType.HASMEMBER);
        ro.setTarget(Factory.makeReference("#" + processVitalSignsObservation(e, list)));
    }
}
Also used : Element(org.w3c.dom.Element) ObservationRelatedComponent(org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent)

Example 53 with ListResource

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

the class CCDAConverter method processAdverseReactionsSection.

protected SectionComponent processAdverseReactionsSection(Element section) throws Exception {
    ListResource list = new ListResource();
    for (Element entry : cda.getChildren(section, "entry")) {
        Element concern = cda.getChild(entry, "act");
        if (cda.hasTemplateId(concern, "2.16.840.1.113883.10.20.22.4.30")) {
            processAllergyProblemAct(list, concern);
        } else
            throw new Exception("Unhandled Section template ids: " + cda.showTemplateIds(concern));
    }
    // todo: text
    SectionComponent s = new Composition.SectionComponent();
    s.setCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code")));
    // todo: check subject
    s.addEntry(Factory.makeReference(addReference(list, "Allergies, Adverse Reactions, Alerts", makeUUIDReference())));
    return s;
}
Also used : Element(org.w3c.dom.Element) SectionComponent(org.hl7.fhir.dstu3.model.Composition.SectionComponent)

Example 54 with ListResource

use of org.hl7.fhir.dstu3.model.ListResource 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 55 with ListResource

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

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