Search in sources :

Example 91 with Annotation

use of org.hl7.fhir.dstu2.model.Annotation in project org.hl7.fhir.core by hapifhir.

the class ListRenderer method render.

public boolean render(XhtmlNode x, ResourceWrapper list) throws FHIRFormatError, DefinitionException, IOException {
    if (list.has("title")) {
        x.h2().tx(list.get("title").primitiveValue());
    }
    XhtmlNode t = x.table("clstu");
    XhtmlNode tr = t.tr();
    XhtmlNode td = tr.td();
    if (list.has("date")) {
        td.tx("Date: " + list.get("date").dateTimeValue().toHumanDisplay());
    }
    if (list.has("mode")) {
        td.tx("Mode: " + list.get("mode").primitiveValue());
    }
    if (list.has("status")) {
        td.tx("Status: " + list.get("status").primitiveValue());
    }
    if (list.has("code")) {
        td.tx("Code: " + displayBase(list.get("code")));
    }
    tr = t.tr();
    td = tr.td();
    if (list.has("subject")) {
        td.tx("Subject: ");
        shortForRef(td, list.get("subject"));
    }
    if (list.has("encounter")) {
        td.tx("Encounter: ");
        shortForRef(td, list.get("encounter"));
    }
    if (list.has("source")) {
        td.tx("Source: ");
        shortForRef(td, list.get("encounter"));
    }
    if (list.has("orderedBy")) {
        td.tx("Order: " + displayBase(list.get("orderedBy")));
    }
    // for (Annotation a : list.getNote()) {
    // renderAnnotation(a, x);
    // }
    boolean flag = false;
    boolean deleted = false;
    boolean date = false;
    for (BaseWrapper e : list.children("entry")) {
        flag = flag || e.has("flag");
        deleted = deleted || e.has("deleted");
        date = date || e.has("date");
    }
    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 (BaseWrapper e : list.children("entry")) {
        tr = t.tr();
        shortForRef(tr.td(), e.get("item"));
        if (date) {
            tr.td().tx(e.has("date") ? e.get("date").dateTimeValue().toHumanDisplay() : "");
        }
        if (flag) {
            tr.td().tx(e.has("flag") ? displayBase(e.get("flag")) : "");
        }
        if (deleted) {
            tr.td().tx(e.has("deleted") ? e.get("deleted").primitiveValue() : "");
        }
    }
    return false;
}
Also used : BaseWrapper(org.hl7.fhir.r4b.renderers.utils.BaseWrappers.BaseWrapper) XhtmlNode(org.hl7.fhir.utilities.xhtml.XhtmlNode)

Example 92 with Annotation

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

the class ConditionMapper method buildNotes.

private List<Annotation> buildNotes(Optional<RCMRMT030101UK04ObservationStatement> observationStatement, RCMRMT030101UK04LinkSet linkSet) {
    List<Annotation> annotationList = new ArrayList<>();
    observationStatement.ifPresent(observationStatement1 -> observationStatement1.getPertinentInformation().stream().map(RCMRMT030101UK04PertinentInformation02::getPertinentAnnotation).filter(Objects::nonNull).map(RCMRMT030101UK04Annotation::getText).filter(StringUtils::isNotBlank).map(StringType::new).map(Annotation::new).forEach(annotationList::add));
    if (linkSet.hasCode() && linkSet.getCode().getOriginalText() != null) {
        StringType text = new StringType(linkSet.getCode().getOriginalText());
        annotationList.add(new Annotation(text));
    }
    return annotationList;
}
Also used : StringType(org.hl7.fhir.dstu3.model.StringType) StringUtils(org.apache.commons.lang3.StringUtils) ArrayList(java.util.ArrayList) Objects(java.util.Objects) Annotation(org.hl7.fhir.dstu3.model.Annotation) RCMRMT030101UK04Annotation(org.hl7.v3.RCMRMT030101UK04Annotation)

Example 93 with Annotation

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

the class ConditionMapper method getCondition.

private Condition getCondition(RCMRMT030101UK04EhrExtract ehrExtract, Patient patient, List<Encounter> encounters, RCMRMT030101UK04EhrComposition composition, RCMRMT030101UK04LinkSet linkSet, String practiseCode) {
    String id = linkSet.getId().getRoot();
    Condition condition = (Condition) new Condition().addIdentifier(buildIdentifier(id, practiseCode)).addCategory(generateCategory()).setId(id).setMeta(generateMeta(META_PROFILE));
    buildClinicalStatus(linkSet.getCode()).ifPresentOrElse(condition::setClinicalStatus, () -> {
        condition.setClinicalStatus(ACTIVE);
        condition.addNote(new Annotation(new StringType(DEFAULT_CLINICAL_STATUS)));
    });
    condition.setSubject(new Reference(patient));
    condition.addExtension(buildProblemSignificance(linkSet.getCode()));
    generateAnnotationToMinor(linkSet.getCode()).ifPresent(condition::addNote);
    buildContext(composition, encounters).ifPresent(condition::setContext);
    buildOnsetDateTimeType(linkSet).ifPresent(condition::setOnset);
    buildAbatementDateTimeType(linkSet.getEffectiveTime()).ifPresent(condition::setAbatement);
    buildAssertedDateTimeType(composition).ifPresentOrElse(condition::setAssertedDateElement, () -> condition.setAssertedDateElement(parseToDateTimeType(ehrExtract.getAvailabilityTime().getValue())));
    composition.getParticipant2().stream().findFirst().ifPresent(participant2 -> condition.setAsserter(new Reference(new IdType(ResourceType.Practitioner.name(), participant2.getAgentRef().getId().getRoot()))));
    return condition;
}
Also used : Condition(org.hl7.fhir.dstu3.model.Condition) StringType(org.hl7.fhir.dstu3.model.StringType) Reference(org.hl7.fhir.dstu3.model.Reference) Annotation(org.hl7.fhir.dstu3.model.Annotation) RCMRMT030101UK04Annotation(org.hl7.v3.RCMRMT030101UK04Annotation) IdType(org.hl7.fhir.dstu3.model.IdType)

Example 94 with Annotation

use of org.hl7.fhir.dstu2.model.Annotation in project CRD by HL7-DaVinci.

the class CardBuilder method priorAuthCard.

public static Card priorAuthCard(CqlResultsForCard cqlResults, IBaseResource request, FhirComponentsT fhirComponents, String priorAuthId, String patientId, String payerId, String providerId, String applicationFhirPath, FhirResourceRepository fhirResourceRepository) {
    logger.info("Build Prior Auth Card");
    Card card = transform(CardTypes.PRIOR_AUTH, cqlResults, false);
    // create the ClaimResponse
    ClaimResponse claimResponse = Utilities.createClaimResponse(priorAuthId, patientId, payerId, providerId, applicationFhirPath);
    // build the FhirResource and save to the database
    FhirResource fhirResource = new FhirResource();
    fhirResource.setFhirVersion(fhirComponents.getFhirVersion().toString()).setResourceType(claimResponse.fhirType()).setData(fhirComponents.getJsonParser().encodeResourceToString(claimResponse));
    fhirResource.setId(claimResponse.getId());
    fhirResource.setName(claimResponse.getId());
    FhirResource newFhirResource = fhirResourceRepository.save(fhirResource);
    logger.info("stored: " + newFhirResource.getFhirVersion() + "/" + newFhirResource.getResourceType() + "/" + newFhirResource.getId());
    // create the reference to the ClaimResponse
    Reference claimResponseReference = new Reference();
    claimResponseReference.setReference("ClaimResponse/" + claimResponse.getId());
    // add SupportingInfo to the Request
    IBaseResource outputRequest = FhirRequestProcessor.addSupportingInfoToRequest(request, claimResponseReference);
    // add suggestion with ClaimResponse
    Suggestion suggestionWithClaimResponse = createSuggestionWithResource(outputRequest, claimResponse, fhirComponents, "Store the prior authorization in the EHR", true);
    card.addSuggestionsItem(suggestionWithClaimResponse);
    // add suggestion with annotation
    Suggestion suggestionWithAnnotation = createSuggestionWithNote(card, outputRequest, fhirComponents, "Store prior authorization as an annotation to the order", "Add authorization to record", false, CoverageGuidance.PRIOR_AUTH);
    card.addSuggestionsItem(suggestionWithAnnotation);
    card.setSelectionBehavior(Card.SelectionBehaviorEnum.AT_MOST_ONE);
    return card;
}
Also used : FhirResource(org.hl7.davinci.endpoint.database.FhirResource) IBaseResource(org.hl7.fhir.instance.model.api.IBaseResource)

Aggregations

NotImplementedException (org.apache.commons.lang3.NotImplementedException)14 Trace (com.newrelic.api.agent.Trace)13 Operation (gov.cms.bfd.server.war.Operation)13 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)12 Annotation (org.hl7.fhir.r4.model.Annotation)12 NoResultException (javax.persistence.NoResultException)11 ResourceNotFoundException (ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException)9 Annotation (org.hl7.fhir.dstu3.model.Annotation)9 Search (ca.uhn.fhir.rest.annotation.Search)8 OffsetLinkBuilder (gov.cms.bfd.server.war.commons.OffsetLinkBuilder)8 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)8 Read (ca.uhn.fhir.rest.annotation.Read)7 Beneficiary (gov.cms.bfd.model.rif.Beneficiary)7 Patient (org.hl7.fhir.dstu3.model.Patient)7 ArrayList (java.util.ArrayList)6 List (java.util.List)6 Collectors (java.util.stream.Collectors)6 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)6 Resource (org.hl7.fhir.r4.model.Resource)6 Test (org.junit.jupiter.api.Test)6