Commit fc291533558330f95e792ee6ff02b770000e0e8b
1 parent
f32ec6cc
Exists in
master
Adicionado campo SUS no cadastro de pessoa física;
Portabilis/ieducar#147
Showing
8 changed files
with
72 additions
and
6 deletions
Show diff stats
ieducar/intranet/atendidos_cad.php
@@ -108,6 +108,7 @@ class indice extends clsCadastro | @@ -108,6 +108,7 @@ class indice extends clsCadastro | ||
108 | var $retorno; | 108 | var $retorno; |
109 | var $zona_localizacao; | 109 | var $zona_localizacao; |
110 | var $cor_raca; | 110 | var $cor_raca; |
111 | + var $sus; | ||
111 | 112 | ||
112 | var $caminho_det; | 113 | var $caminho_det; |
113 | var $caminho_lst; | 114 | var $caminho_lst; |
@@ -134,7 +135,7 @@ class indice extends clsCadastro | @@ -134,7 +135,7 @@ class indice extends clsCadastro | ||
134 | $this->idtlog, $this->sigla_uf, $this->complemento, $this->numero, | 135 | $this->idtlog, $this->sigla_uf, $this->complemento, $this->numero, |
135 | $this->bloco, $this->apartamento, $this->andar, $this->zona_localizacao, $this->estado_civil, | 136 | $this->bloco, $this->apartamento, $this->andar, $this->zona_localizacao, $this->estado_civil, |
136 | $this->pai_id, $this->mae_id, $this->tipo_nacionalidade, $this->pais_origem, $this->naturalidade, | 137 | $this->pai_id, $this->mae_id, $this->tipo_nacionalidade, $this->pais_origem, $this->naturalidade, |
137 | - $this->letra | 138 | + $this->letra, $this->sus |
138 | ) = | 139 | ) = |
139 | 140 | ||
140 | $objPessoa->queryRapida( | 141 | $objPessoa->queryRapida( |
@@ -143,7 +144,7 @@ class indice extends clsCadastro | @@ -143,7 +144,7 @@ class indice extends clsCadastro | ||
143 | 'tipo', 'sexo', 'cidade', 'bairro', 'logradouro', 'cep', 'idlog', | 144 | 'tipo', 'sexo', 'cidade', 'bairro', 'logradouro', 'cep', 'idlog', |
144 | 'idbai', 'idtlog', 'sigla_uf', 'complemento', 'numero', 'bloco', 'apartamento', | 145 | 'idbai', 'idtlog', 'sigla_uf', 'complemento', 'numero', 'bloco', 'apartamento', |
145 | 'andar', 'zona_localizacao', 'ideciv', 'idpes_pai', 'idpes_mae', 'nacionalidade', | 146 | 'andar', 'zona_localizacao', 'ideciv', 'idpes_pai', 'idpes_mae', 'nacionalidade', |
146 | - 'idpais_estrangeiro', 'idmun_nascimento', 'letra' | 147 | + 'idpais_estrangeiro', 'idmun_nascimento', 'letra', 'sus' |
147 | ); | 148 | ); |
148 | 149 | ||
149 | $this->id_federal = is_numeric($this->id_federal) ? int2CPF($this->id_federal) : ''; | 150 | $this->id_federal = is_numeric($this->id_federal) ? int2CPF($this->id_federal) : ''; |
@@ -329,6 +330,18 @@ class indice extends clsCadastro | @@ -329,6 +330,18 @@ class indice extends clsCadastro | ||
329 | 330 | ||
330 | $this->inputsHelper()->uf($options, $helperOptions); | 331 | $this->inputsHelper()->uf($options, $helperOptions); |
331 | 332 | ||
333 | + // Carteira do SUS | ||
334 | + | ||
335 | + $options = array( | ||
336 | + 'required' => false, | ||
337 | + 'label' => 'Número da carteira do SUS', | ||
338 | + 'placeholder' => '', | ||
339 | + 'value' => $this->sus, | ||
340 | + 'max_length' => 20, | ||
341 | + 'size' => 20 | ||
342 | + ); | ||
343 | + | ||
344 | + $this->inputsHelper()->text('sus', $options); | ||
332 | 345 | ||
333 | // tipo de certidao civil | 346 | // tipo de certidao civil |
334 | 347 | ||
@@ -1051,6 +1064,7 @@ class indice extends clsCadastro | @@ -1051,6 +1064,7 @@ class indice extends clsCadastro | ||
1051 | $fisica->nacionalidade = $_REQUEST['tipo_nacionalidade']; | 1064 | $fisica->nacionalidade = $_REQUEST['tipo_nacionalidade']; |
1052 | $fisica->idpais_estrangeiro = $_REQUEST['pais_origem_id']; | 1065 | $fisica->idpais_estrangeiro = $_REQUEST['pais_origem_id']; |
1053 | $fisica->idmun_nascimento = $_REQUEST['naturalidade_id']; | 1066 | $fisica->idmun_nascimento = $_REQUEST['naturalidade_id']; |
1067 | + $fisica->sus = $this->sus; | ||
1054 | 1068 | ||
1055 | $sql = "select 1 from cadastro.fisica WHERE idpes = $1 limit 1"; | 1069 | $sql = "select 1 from cadastro.fisica WHERE idpes = $1 limit 1"; |
1056 | 1070 |
ieducar/intranet/educar_aluno_det.php
@@ -95,6 +95,7 @@ class indice extends clsDetalhe | @@ -95,6 +95,7 @@ class indice extends clsDetalhe | ||
95 | var $nm_pai; | 95 | var $nm_pai; |
96 | var $nm_mae; | 96 | var $nm_mae; |
97 | var $ref_cod_raca; | 97 | var $ref_cod_raca; |
98 | + var $sus; | ||
98 | 99 | ||
99 | function Gerar() | 100 | function Gerar() |
100 | { | 101 | { |
@@ -180,6 +181,8 @@ class indice extends clsDetalhe | @@ -180,6 +181,8 @@ class indice extends clsDetalhe | ||
180 | $this->idpes_pai = $det_fisica['idpes_pai']; | 181 | $this->idpes_pai = $det_fisica['idpes_pai']; |
181 | $this->idpes_mae = $det_fisica['idpes_mae']; | 182 | $this->idpes_mae = $det_fisica['idpes_mae']; |
182 | 183 | ||
184 | + $this->sus = $det_fisica['sus']; | ||
185 | + | ||
183 | $this->nm_pai = $registro['nm_pai']; | 186 | $this->nm_pai = $registro['nm_pai']; |
184 | $this->nm_mae = $registro['nm_mae']; | 187 | $this->nm_mae = $registro['nm_mae']; |
185 | 188 | ||
@@ -685,6 +688,7 @@ class indice extends clsDetalhe | @@ -685,6 +688,7 @@ class indice extends clsDetalhe | ||
685 | if (trim($reg['peso'])!='') $this->addDetalhe(array('Peso/kg', $reg['peso'])); | 688 | if (trim($reg['peso'])!='') $this->addDetalhe(array('Peso/kg', $reg['peso'])); |
686 | if (trim($reg['grupo_sanguineo'])!='') $this->addDetalhe(array('Grupo sanguíneo', $reg['grupo_sanguineo'])); | 689 | if (trim($reg['grupo_sanguineo'])!='') $this->addDetalhe(array('Grupo sanguíneo', $reg['grupo_sanguineo'])); |
687 | if (trim($reg['fator_rh'])!='') $this->addDetalhe(array('Fator RH', $reg['fator_rh'])); | 690 | if (trim($reg['fator_rh'])!='') $this->addDetalhe(array('Fator RH', $reg['fator_rh'])); |
691 | + if (trim($this->sus)!='') $this->addDetalhe(array('Número do cartão do SUS', $this->sus)); | ||
688 | $this->addDetalhe(array('Possui alergia a algum medicamento', ($reg['alergia_medicamento'] == 'S' ? 'Sim': 'Não') )); | 692 | $this->addDetalhe(array('Possui alergia a algum medicamento', ($reg['alergia_medicamento'] == 'S' ? 'Sim': 'Não') )); |
689 | if (trim($reg['desc_alergia_medicamento'])!='') $this->addDetalhe(array('Quais', $reg['desc_alergia_medicamento'])); | 693 | if (trim($reg['desc_alergia_medicamento'])!='') $this->addDetalhe(array('Quais', $reg['desc_alergia_medicamento'])); |
690 | $this->addDetalhe(array('Possui alergia a algum alimento', ($reg['alergia_alimento'] == 'S' ? 'Sim': 'Não') )); | 694 | $this->addDetalhe(array('Possui alergia a algum alimento', ($reg['alergia_alimento'] == 'S' ? 'Sim': 'Não') )); |
ieducar/intranet/include/pessoa/clsFisica.inc.php
@@ -69,6 +69,7 @@ class clsFisica | @@ -69,6 +69,7 @@ class clsFisica | ||
69 | var $ref_cod_sistema; | 69 | var $ref_cod_sistema; |
70 | var $cpf; | 70 | var $cpf; |
71 | var $ref_cod_religiao; | 71 | var $ref_cod_religiao; |
72 | + var $sus; | ||
72 | 73 | ||
73 | var $tabela; | 74 | var $tabela; |
74 | var $schema; | 75 | var $schema; |
@@ -327,6 +328,12 @@ class clsFisica | @@ -327,6 +328,12 @@ class clsFisica | ||
327 | $valores .= ", $this->cpf"; | 328 | $valores .= ", $this->cpf"; |
328 | } | 329 | } |
329 | 330 | ||
331 | + if(!empty($this->sus)) | ||
332 | + { | ||
333 | + $campos .= ", sus"; | ||
334 | + $valores .= ", '$this->sus'"; | ||
335 | + } | ||
336 | + | ||
330 | $db->Consulta( "INSERT INTO {$this->schema}.{$this->tabela} (idpes, origem_gravacao, idsis_cad, data_cad, operacao, idpes_cad $campos) VALUES ( '{$this->idpes}', 'M', 17, NOW(), 'I', '$this->idpes_cad' $valores )" ); | 337 | $db->Consulta( "INSERT INTO {$this->schema}.{$this->tabela} (idpes, origem_gravacao, idsis_cad, data_cad, operacao, idpes_cad $campos) VALUES ( '{$this->idpes}', 'M', 17, NOW(), 'I', '$this->idpes_cad' $valores )" ); |
331 | return true; | 338 | return true; |
332 | 339 | ||
@@ -477,6 +484,11 @@ class clsFisica | @@ -477,6 +484,11 @@ class clsFisica | ||
477 | $gruda = ", "; | 484 | $gruda = ", "; |
478 | } | 485 | } |
479 | 486 | ||
487 | + if($this->sus) { | ||
488 | + $set .= "$gruda sus = '{$this->sus}'"; | ||
489 | + $gruda = ", "; | ||
490 | + } | ||
491 | + | ||
480 | if(is_numeric($this->ref_cod_sistema) || $this->ref_cod_sistema == "NULL") { | 492 | if(is_numeric($this->ref_cod_sistema) || $this->ref_cod_sistema == "NULL") { |
481 | $set .= "$gruda ref_cod_sistema = {$this->ref_cod_sistema}"; | 493 | $set .= "$gruda ref_cod_sistema = {$this->ref_cod_sistema}"; |
482 | $gruda = ", "; | 494 | $gruda = ", "; |
@@ -790,7 +802,7 @@ class clsFisica | @@ -790,7 +802,7 @@ class clsFisica | ||
790 | if($this->idpes) | 802 | if($this->idpes) |
791 | { | 803 | { |
792 | $db = new clsBanco(); | 804 | $db = new clsBanco(); |
793 | - $db->Consulta("SELECT idpes, data_nasc, sexo, idpes_mae, idpes_pai, idpes_responsavel, idesco, ideciv, idpes_con, data_uniao, data_obito, nacionalidade, idpais_estrangeiro, data_chegada_brasil, idmun_nascimento, ultima_empresa, idocup, nome_mae, nome_pai, nome_conjuge, nome_responsavel, justificativa_provisorio, cpf , ref_cod_religiao FROM {$this->schema}.{$this->tabela} WHERE idpes = {$this->idpes}"); | 805 | + $db->Consulta("SELECT idpes, data_nasc, sexo, idpes_mae, idpes_pai, idpes_responsavel, idesco, ideciv, idpes_con, data_uniao, data_obito, nacionalidade, idpais_estrangeiro, data_chegada_brasil, idmun_nascimento, ultima_empresa, idocup, nome_mae, nome_pai, nome_conjuge, nome_responsavel, justificativa_provisorio, cpf , ref_cod_religiao, sus FROM {$this->schema}.{$this->tabela} WHERE idpes = {$this->idpes}"); |
794 | if( $db->ProximoRegistro() ) | 806 | if( $db->ProximoRegistro() ) |
795 | { | 807 | { |
796 | $tupla = $db->Tupla(); | 808 | $tupla = $db->Tupla(); |
ieducar/intranet/include/pessoa/clsPessoaFisica.inc.php
@@ -296,6 +296,7 @@ class clsPessoaFisica extends clsPessoaFj | @@ -296,6 +296,7 @@ class clsPessoaFisica extends clsPessoaFj | ||
296 | $this->justificativa_provisorio = $detalhe_fisica['justificativa_provisorio']; | 296 | $this->justificativa_provisorio = $detalhe_fisica['justificativa_provisorio']; |
297 | $this->cpf = $detalhe_fisica['cpf']; | 297 | $this->cpf = $detalhe_fisica['cpf']; |
298 | $this->ref_cod_religiao = $detalhe_fisica['ref_cod_religiao']; | 298 | $this->ref_cod_religiao = $detalhe_fisica['ref_cod_religiao']; |
299 | + $this->sus = $detalhe_fisica['sus']; | ||
299 | 300 | ||
300 | $tupla['idpes'] = $this->idpes; | 301 | $tupla['idpes'] = $this->idpes; |
301 | $tupla[] = & $tupla['idpes']; | 302 | $tupla[] = & $tupla['idpes']; |
ieducar/misc/database/deltas/portabilis/73_cria_campo_sus_fisica_documento.sql
0 → 100644
@@ -0,0 +1,16 @@ | @@ -0,0 +1,16 @@ | ||
1 | + -- // | ||
2 | + | ||
3 | + -- | ||
4 | + -- Adiciona campo sus para adicionarem o número da carteira do sus para pessoas | ||
5 | + -- | ||
6 | + -- @author Lucas Schmoeller da Silva <lucas@portabilis.com.br> | ||
7 | + -- @license @@license@@ | ||
8 | + -- @version $Id$ | ||
9 | + | ||
10 | + ALTER TABLE cadastro.fisica ADD COLUMN sus character varying(20); | ||
11 | + | ||
12 | + -- //@UNDO | ||
13 | + | ||
14 | + ALTER TABLE cadastro.fisica DROP COLUMN sus; | ||
15 | + | ||
16 | + -- // | ||
0 | \ No newline at end of file | 17 | \ No newline at end of file |
ieducar/modules/Api/Views/AlunoController.php
@@ -246,6 +246,13 @@ class AlunoController extends ApiCoreController | @@ -246,6 +246,13 @@ class AlunoController extends ApiCoreController | ||
246 | return $tipo; | 246 | return $tipo; |
247 | } | 247 | } |
248 | 248 | ||
249 | + protected function saveSus($pessoaId){ | ||
250 | + | ||
251 | + $sus = Portabilis_String_Utils::toLatin1($this->getRequest()->sus); | ||
252 | + | ||
253 | + $sql = 'update cadastro.fisica set sus = $1 where idpes = $2'; | ||
254 | + return $this->fetchPreparedQuery($sql, array($sus, $pessoaId)); | ||
255 | + } | ||
249 | 256 | ||
250 | protected function createOrUpdateTransporte($alunoId) { | 257 | protected function createOrUpdateTransporte($alunoId) { |
251 | $tiposTransporte = array( | 258 | $tiposTransporte = array( |
@@ -781,6 +788,8 @@ protected function createOrUpdateUniforme($id) { | @@ -781,6 +788,8 @@ protected function createOrUpdateUniforme($id) { | ||
781 | $aluno = Portabilis_Array_Utils::merge($objMoradia,$aluno); | 788 | $aluno = Portabilis_Array_Utils::merge($objMoradia,$aluno); |
782 | } | 789 | } |
783 | 790 | ||
791 | + $sql = "select sus from cadastro.fisica where idpes = $1"; | ||
792 | + $aluno['sus'] = Portabilis_String_Utils::toUtf8($this->fetchPreparedQuery($sql, $aluno['pessoa_id'], false, 'first-field')); | ||
784 | 793 | ||
785 | return $aluno; | 794 | return $aluno; |
786 | } | 795 | } |
@@ -855,9 +864,11 @@ protected function createOrUpdateUniforme($id) { | @@ -855,9 +864,11 @@ protected function createOrUpdateUniforme($id) { | ||
855 | protected function post() { | 864 | protected function post() { |
856 | if ($this->canPost()) { | 865 | if ($this->canPost()) { |
857 | $id = $this->createOrUpdateAluno(); | 866 | $id = $this->createOrUpdateAluno(); |
867 | + $pessoaId = $this->getRequest()->pessoa_id; | ||
858 | 868 | ||
859 | if (is_numeric($id)) { | 869 | if (is_numeric($id)) { |
860 | $this->updateResponsavel(); | 870 | $this->updateResponsavel(); |
871 | + $this->saveSus($pessoaId); | ||
861 | $this->createOrUpdateTransporte($id); | 872 | $this->createOrUpdateTransporte($id); |
862 | $this->createUpdateOrDestroyEducacensoAluno($id); | 873 | $this->createUpdateOrDestroyEducacensoAluno($id); |
863 | $this->updateDeficiencias(); | 874 | $this->updateDeficiencias(); |
@@ -876,9 +887,11 @@ protected function createOrUpdateUniforme($id) { | @@ -876,9 +887,11 @@ protected function createOrUpdateUniforme($id) { | ||
876 | 887 | ||
877 | protected function put() { | 888 | protected function put() { |
878 | $id = $this->getRequest()->id; | 889 | $id = $this->getRequest()->id; |
890 | + $pessoaId = $this->getRequest()->pessoa_id; | ||
879 | 891 | ||
880 | if ($this->canPut() && $this->createOrUpdateAluno($id)) { | 892 | if ($this->canPut() && $this->createOrUpdateAluno($id)) { |
881 | $this->updateResponsavel(); | 893 | $this->updateResponsavel(); |
894 | + $this->saveSus($pessoaId); | ||
882 | $this->createOrUpdateTransporte($id); | 895 | $this->createOrUpdateTransporte($id); |
883 | $this->createUpdateOrDestroyEducacensoAluno($id); | 896 | $this->createUpdateOrDestroyEducacensoAluno($id); |
884 | $this->updateDeficiencias(); | 897 | $this->updateDeficiencias(); |
ieducar/modules/Cadastro/Assets/Javascripts/Aluno.js
@@ -95,6 +95,8 @@ resourceOptions.handleGet = function(dataResponse) { | @@ -95,6 +95,8 @@ resourceOptions.handleGet = function(dataResponse) { | ||
95 | CAMPOS DA FICHA MÉDICA | 95 | CAMPOS DA FICHA MÉDICA |
96 | ************************************************/ | 96 | ************************************************/ |
97 | 97 | ||
98 | + $j('#sus').val(dataResponse.sus); | ||
99 | + | ||
98 | //campos checkbox | 100 | //campos checkbox |
99 | if (dataResponse.alergia_medicamento == 'S'){ | 101 | if (dataResponse.alergia_medicamento == 'S'){ |
100 | $j('#alergia_medicamento').attr('checked',true); | 102 | $j('#alergia_medicamento').attr('checked',true); |
@@ -584,7 +586,7 @@ function afterChangePessoa(targetWindow, pessoaId) { | @@ -584,7 +586,7 @@ function afterChangePessoa(targetWindow, pessoaId) { | ||
584 | $j('#tab2').toggleClass('alunoTab alunoTab-active') | 586 | $j('#tab2').toggleClass('alunoTab alunoTab-active') |
585 | $j('.tablecadastro >tbody > tr').each(function(index, row) { | 587 | $j('.tablecadastro >tbody > tr').each(function(index, row) { |
586 | if (row.id!='stop'){ | 588 | if (row.id!='stop'){ |
587 | - if (index>14 && index<61){ | 589 | + if (index>14 && index<62){ |
588 | row.show(); | 590 | row.show(); |
589 | }else if (index>0){ | 591 | }else if (index>0){ |
590 | row.hide(); | 592 | row.hide(); |
@@ -605,7 +607,7 @@ function afterChangePessoa(targetWindow, pessoaId) { | @@ -605,7 +607,7 @@ function afterChangePessoa(targetWindow, pessoaId) { | ||
605 | $j('#tab3').toggleClass('alunoTab alunoTab-active') | 607 | $j('#tab3').toggleClass('alunoTab alunoTab-active') |
606 | $j('.tablecadastro >tbody > tr').each(function(index, row) { | 608 | $j('.tablecadastro >tbody > tr').each(function(index, row) { |
607 | if (row.id!='stop'){ | 609 | if (row.id!='stop'){ |
608 | - if (index>60 && index<83){ | 610 | + if (index>60 && index<84){ |
609 | row.show(); | 611 | row.show(); |
610 | }else if (index>0){ | 612 | }else if (index>0){ |
611 | row.hide(); | 613 | row.hide(); |
@@ -623,7 +625,7 @@ function afterChangePessoa(targetWindow, pessoaId) { | @@ -623,7 +625,7 @@ function afterChangePessoa(targetWindow, pessoaId) { | ||
623 | $j('#tab4').toggleClass('alunoTab alunoTab-active') | 625 | $j('#tab4').toggleClass('alunoTab alunoTab-active') |
624 | $j('.tablecadastro >tbody > tr').each(function(index, row) { | 626 | $j('.tablecadastro >tbody > tr').each(function(index, row) { |
625 | 627 | ||
626 | - if (index<83 && index!=0){ | 628 | + if (index<84 && index!=0){ |
627 | row.hide(); | 629 | row.hide(); |
628 | }else{ | 630 | }else{ |
629 | row.show(); | 631 | row.show(); |
ieducar/modules/Cadastro/Views/AlunoController.php
@@ -449,6 +449,10 @@ class AlunoController extends Portabilis_Controller_Page_EditController | @@ -449,6 +449,10 @@ class AlunoController extends Portabilis_Controller_Page_EditController | ||
449 | $options = array('label' => $this->_getLabel('fator_rh'), 'size' => 5, 'max_length' => 1, 'required' => false, 'placeholder' => '' ); | 449 | $options = array('label' => $this->_getLabel('fator_rh'), 'size' => 5, 'max_length' => 1, 'required' => false, 'placeholder' => '' ); |
450 | $this->inputsHelper()->text('fator_rh',$options); | 450 | $this->inputsHelper()->text('fator_rh',$options); |
451 | 451 | ||
452 | + // sus | ||
453 | + $options = array('label' => $this->_getLabel('sus'), 'size' => 20, 'max_length' => 20, 'required' => false, 'placeholder' => '' ); | ||
454 | + $this->inputsHelper()->text('sus',$options); | ||
455 | + | ||
452 | // alergia_medicamento | 456 | // alergia_medicamento |
453 | $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('alergia_medicamento') ), 'required' => false, 'placeholder' => ''); | 457 | $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('alergia_medicamento') ), 'required' => false, 'placeholder' => ''); |
454 | $this->inputsHelper()->checkbox('alergia_medicamento',$options); | 458 | $this->inputsHelper()->checkbox('alergia_medicamento',$options); |