Search in sources :

Example 1 with ConditionVerificationStatus

use of org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus in project openmrs-module-fhir2 by openmrs.

the class ConditionVerificationStatusTranslatorImpl_2_2 method toOpenmrsType.

@Override
public ConditionVerificationStatus toOpenmrsType(@Nonnull CodeableConcept codeableConcept) {
    if (codeableConcept == null || codeableConcept.getCoding().isEmpty()) {
        return null;
    }
    Optional<Coding> verificationStatus = codeableConcept.getCoding().stream().filter(c -> c.getSystem().equals(FhirConstants.CONDITION_VERIFICATION_STATUS_SYSTEM_URI)).findFirst();
    Coding verificationStatusCode = verificationStatus.orElse(null);
    if (verificationStatusCode == null) {
        return null;
    }
    switch(verificationStatusCode.getCode()) {
        case "confirmed":
            return ConditionVerificationStatus.CONFIRMED;
        case "provisional":
            return ConditionVerificationStatus.PROVISIONAL;
        default:
            return null;
    }
}
Also used : Component(org.springframework.stereotype.Component) OpenmrsProfile(org.openmrs.annotation.OpenmrsProfile) ConditionVerificationStatusTranslator(org.openmrs.module.fhir2.api.translators.ConditionVerificationStatusTranslator) Coding(org.hl7.fhir.r4.model.Coding) Optional(java.util.Optional) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept) ConditionVerificationStatus(org.openmrs.ConditionVerificationStatus) FhirConstants(org.openmrs.module.fhir2.FhirConstants) Nonnull(javax.annotation.Nonnull) Coding(org.hl7.fhir.r4.model.Coding)

Aggregations

Optional (java.util.Optional)1 Nonnull (javax.annotation.Nonnull)1 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)1 Coding (org.hl7.fhir.r4.model.Coding)1 ConditionVerificationStatus (org.openmrs.ConditionVerificationStatus)1 OpenmrsProfile (org.openmrs.annotation.OpenmrsProfile)1 FhirConstants (org.openmrs.module.fhir2.FhirConstants)1 ConditionVerificationStatusTranslator (org.openmrs.module.fhir2.api.translators.ConditionVerificationStatusTranslator)1 Component (org.springframework.stereotype.Component)1