Skip to content

Instantly share code, notes, and snippets.

@felipecruz
Created June 3, 2011 21:31
Show Gist options
  • Save felipecruz/1007212 to your computer and use it in GitHub Desktop.
Save felipecruz/1007212 to your computer and use it in GitHub Desktop.
distolica = new ValueAnswer("Distolica");
sistolica = new ValueAnswer("Sistolica");
complex_rule = new ComplexRule( { distolica: distolica, sistolica: sistolica},
"context.Distolica > 14 && context.Sistolica > 8",
null,
function() { recomendations.push("Hipertensao! Marcar consulta"); });
complex_rule2 = new ComplexRule( { distolica: distolica, sistolica: sistolica},
"context.Distolica < 10 && context.Sistolica < 8",
null,
function() { recomendations.push("Pressao baixa! Marcar consulta"); });
question3 = new ComplexQuestion("Qual sua pressão?", [distolica, sistolica], [complex_rule, complex_rule2] );
action1 = new Action("Comer Fibras",function() { alert('Comer fibras'); recomendations.push("Comer Fibras"); });
answer1 = new Answer("Estou com diarreia", [action1], question3);
answer2 = new Answer("Nao Estou com diarreia", [], question3);
question1 = new Question("Voce tem diarreia?", [answer1, answer2]);
action2 = new Action("Tomar remedio",function() { alert('Tomar remedio'); recomendations.push("Tomar Remedio"); });
answer3 = new Answer("Estou com febre", [action2], question1);
answer4 = new Answer("Nao Estou com febre", [], question1);
question2 = new Question("Febre?", [answer3, answer4]);
var protocol = new Protocol("Geral", question2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment