Search in sources :

Example 1 with ConsentScope

use of org.hl7.fhir.r4.model.codesystems.ConsentScope in project Gravity-SDOH-Exchange-RI by FHIR.

the class TaskBundleFactory method createConsent.

protected Consent createConsent() {
    Consent consent = new Consent();
    consent.getMeta().addProfile(SDOHProfiles.CONSENT);
    consent.setId(IdType.newRandomUuid());
    consent.setStatus(Consent.ConsentState.ACTIVE);
    consent.setDateTimeElement(DateTimeType.now());
    ConsentScope consentScope = ConsentScope.PATIENTPRIVACY;
    consent.getScope().addCoding(new Coding(consentScope.getSystem(), consentScope.toCode(), consentScope.getDisplay()));
    V3ActCode actCode = V3ActCode.IDSCL;
    consent.addCategory(new CodeableConcept().addCoding(new Coding(actCode.getSystem(), actCode.toCode(), actCode.getDisplay())));
    consent.setPatient(getPatientReference());
    ConsentPolicy consentPolicy = ConsentPolicy.HIPAAAUTH;
    consent.getPolicyRule().addCoding(new Coding(consentPolicy.getSystem(), consentPolicy.toCode(), consentPolicy.getDisplay()));
    V3RoleClass roleClass = V3RoleClass.PAT;
    consent.getProvision().addActor().setReference(getPatientReference()).getRole().addCoding(new Coding(roleClass.getSystem(), roleClass.toCode(), roleClass.getDisplay()));
    ConsentAction consentAction = ConsentAction.DISCLOSE;
    consent.getProvision().addAction().getCoding().add(new Coding(consentAction.getSystem(), consentAction.toCode(), consentAction.getDisplay()));
    return consent;
}
Also used : ConsentScope(org.hl7.fhir.r4.model.codesystems.ConsentScope) V3ActCode(org.hl7.fhir.r4.model.codesystems.V3ActCode) Consent(org.hl7.fhir.r4.model.Consent) Coding(org.hl7.fhir.r4.model.Coding) V3RoleClass(org.hl7.fhir.r4.model.codesystems.V3RoleClass) ConsentPolicy(org.hl7.fhir.r4.model.codesystems.ConsentPolicy) ConsentAction(org.hl7.fhir.r4.model.codesystems.ConsentAction) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 2 with ConsentScope

use of org.hl7.fhir.r4.model.codesystems.ConsentScope in project Gravity-SDOH-Exchange-RI by FHIR.

the class CreateConsentFactory method createConsent.

public Consent createConsent() {
    Consent consent = new Consent();
    consent.getSourceAttachment().setTitle(name);
    try {
        consent.getSourceAttachment().setData(attachment.getBytes());
    } catch (IOException e) {
        throw new ConsentCreateException("Consent attachment cannot be read.");
    }
    consent.getSourceAttachment().setContentType(MediaType.APPLICATION_PDF_VALUE);
    consent.setId(IdType.newRandomUuid());
    consent.setStatus(Consent.ConsentState.ACTIVE);
    consent.setDateTimeElement(DateTimeType.now());
    consent.getMeta().addProfile(SDOHProfiles.CONSENT);
    ConsentScope consentScope = ConsentScope.PATIENTPRIVACY;
    consent.getScope().addCoding(new Coding(consentScope.getSystem(), consentScope.toCode(), consentScope.getDisplay()));
    V3ActCode actCode = V3ActCode.IDSCL;
    consent.addCategory(new CodeableConcept().addCoding(new Coding(actCode.getSystem(), actCode.toCode(), actCode.getDisplay())));
    consent.setPatient(patient);
    ConsentPolicy consentPolicy = ConsentPolicy.HIPAAAUTH;
    consent.getPolicyRule().addCoding(new Coding(consentPolicy.getSystem(), consentPolicy.toCode(), consentPolicy.getDisplay()));
    V3RoleClass roleClass = V3RoleClass.PAT;
    consent.getProvision().addActor().setReference(patient).getRole().addCoding(new Coding(roleClass.getSystem(), roleClass.toCode(), roleClass.getDisplay()));
    ConsentAction consentAction = ConsentAction.DISCLOSE;
    consent.getProvision().addAction().getCoding().add(new Coding(consentAction.getSystem(), consentAction.toCode(), consentAction.getDisplay()));
    consent.getOrganization().add(organization);
    return consent;
}
Also used : ConsentScope(org.hl7.fhir.r4.model.codesystems.ConsentScope) ConsentCreateException(org.hl7.gravity.refimpl.sdohexchange.exception.ConsentCreateException) V3ActCode(org.hl7.fhir.r4.model.codesystems.V3ActCode) Consent(org.hl7.fhir.r4.model.Consent) Coding(org.hl7.fhir.r4.model.Coding) V3RoleClass(org.hl7.fhir.r4.model.codesystems.V3RoleClass) ConsentPolicy(org.hl7.fhir.r4.model.codesystems.ConsentPolicy) IOException(java.io.IOException) ConsentAction(org.hl7.fhir.r4.model.codesystems.ConsentAction) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Aggregations

CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)2 Coding (org.hl7.fhir.r4.model.Coding)2 Consent (org.hl7.fhir.r4.model.Consent)2 ConsentAction (org.hl7.fhir.r4.model.codesystems.ConsentAction)2 ConsentPolicy (org.hl7.fhir.r4.model.codesystems.ConsentPolicy)2 ConsentScope (org.hl7.fhir.r4.model.codesystems.ConsentScope)2 V3ActCode (org.hl7.fhir.r4.model.codesystems.V3ActCode)2 V3RoleClass (org.hl7.fhir.r4.model.codesystems.V3RoleClass)2 IOException (java.io.IOException)1 ConsentCreateException (org.hl7.gravity.refimpl.sdohexchange.exception.ConsentCreateException)1