Skip to content
Snippets Groups Projects
Commit b90b9cc8 authored by jpko19's avatar jpko19
Browse files

Add TEA in pee_por_categoria

parent 96b12b32
No related branches found
No related tags found
4 merge requests!329Update enrollment - new filters,!328Dev,!327Issue753 change names,!309Merge new updates into master
......@@ -45,6 +45,8 @@ module.exports = function peeCategory(id) {
case 12:
return 'Transtorno Desintegrativo da Infância';
case 13:
return 'Superdotado';
return 'Altas habilidades / Superdotação';
case 14:
return 'Transtorno do Espectro Austista (TEA)';
}
};
......@@ -173,11 +173,15 @@ class ReqQueryFields {
}
let categorias = ['', 'blindness', 'low_vision', 'deafness', 'hearing_deficiency', 'deafblindness', 'physical_disability', 'intellectual_disability',
'multiple_disabilities', 'autism', 'asperger_syndrom', 'rett_syndrom', 'childhood_desintegrative_disorder', 'supergifted'];
'multiple_disabilities', 'autism', 'asperger_syndrom', 'rett_syndrom', 'childhood_desintegrative_disorder', 'supergifted', 'autism_spectrum_disorder'];
if(obj.pee_por_categoria !== undefined && queryField === 'filter')
for(var cat of obj.pee_por_categoria)
if(obj.pee_por_categoria !== undefined && queryField === 'filter'){
for(var cat of obj.pee_por_categoria){
cat = parseInt(cat);
obj[categorias[cat]] = true;
}
delete obj.pee_por_categoria;
}
// Se o array existe e não está vazio fazemos a interseção
......
......@@ -250,7 +250,7 @@ enrollmentApp.get('/pee', (req, res, next) => {
enrollmentApp.get('/pee_por_categoria', (req, res, next) => {
req.result = [];
for(let i = 1; i <= 13; ++i) {
for(let i = 1; i <= 14; ++i) {
req.result.push({
id: i,
name: id2str.peePorCategoria(i)
......@@ -717,6 +717,16 @@ rqf.addField({
type: 'boolean',
field: 'autismo'
}
}).addValue({
name: 'autism_spectrum_disorder',
table: 'matricula',
tableField: 'transtorno_espectro_autista',
resultField: 'autism_spectrum_disorder',
where: {
relation: '=',
type: 'boolean',
field: 'transtorno_espectro_autista'
}
}).addValue({
name: 'asperger_syndrom',
table: 'matricula',
......@@ -767,7 +777,7 @@ rqf.addField({
type: 'boolean',
field: 'possui_necessidade_especial'
}
}).addValueToField({
}).addValue({
name: 'pee_por_categoria',
table: 'matricula',
tableField: 'possui_necessidade_especial',
......@@ -777,7 +787,7 @@ rqf.addField({
type: 'boolean',
field: 'possui_necessidade_especial'
}
}, 'dims');
});
enrollmentApp.get('/', rqf.parse(), (req, res, next) => {
if('pee_por_categoria' in req.dims){
......@@ -792,10 +802,11 @@ enrollmentApp.get('/', rqf.parse(), (req, res, next) => {
.field('SUM(CASE WHEN deficiencia_intelectual = true THEN 1 ELSE 0 END)', 'Deficiência intelectual')
.field('SUM(CASE WHEN deficiencia_multiplas = true THEN 1 ELSE 0 END)', 'Deficiências múltiplas')
.field('SUM(CASE WHEN autismo = true THEN 1 ELSE 0 END)', 'Autismo')
.field('SUM(CASE WHEN transtorno_espectro_autista = true THEN 1 ELSE 0 END)', 'Transtorno do Espectro Autista (TEA)')
.field('SUM(CASE WHEN sindrome_asperger = true THEN 1 ELSE 0 END)', 'Síndrome de Asperger')
.field('SUM(CASE WHEN sindrome_rett = true THEN 1 ELSE 0 END)', 'Síndrome de Rett')
.field('SUM(CASE WHEN transtorno_desintegrativo_da_infancia = true THEN 1 ELSE 0 END)', 'Transtorno desintegrativo da infância')
.field('SUM(CASE WHEN superdotado = true THEN 1 ELSE 0 END)', 'Superdotado')
.field('SUM(CASE WHEN superdotado = true THEN 1 ELSE 0 END)', 'Altas habilidades / Superdotação')
.field('matricula.ano_censo', 'year')
.from('matricula')
.group('matricula.ano_censo')
......@@ -811,7 +822,10 @@ enrollmentApp.get('/', rqf.parse(), (req, res, next) => {
.where('((matricula.tipo<=3 OR matricula.tipo IS NULL) AND (matricula.tipo_atendimento_turma IS NULL OR matricula.tipo_atendimento_turma <= 2))');
}
next();
}, rqf.build(), query, id2str.transform(false), (req, res, next) => {
}, rqf.build(), (req, res, next) => {
console.log('sql:' + req.sql.toString());
next();
}, query, id2str.transform(false), (req, res, next) => {
if(req.pee_por_categoria === true){
let result = req.result;
let result_total = [];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment