package rules
import org.hl7.fhir.dstu3.model.QuestionnaireResponse
// Further imports omitted for brevity
global com.systematic.ehealth.automatedprocessing.AutomatedProcessingDTO ruleResult
rule "SelfTreatmentServiceRequestActivationRule"
dialect "java"
when
$questionnaireResponses : Collection()
$listQrs : ArrayList() from collect (QuestionnaireResponse() from $questionnaireResponses)
then
QuestionnaireResponse qr = (QuestionnaireResponse)$listQrs.get(0);
boolean activate = false;
// QuestionnaireResponse examined (omitted), activate set to true when needed
ruleResult.setActivateSelfTreatment(activate);
end |