Commit fc291533558330f95e792ee6ff02b770000e0e8b

Authored by Caroline Salib
1 parent f32ec6cc
Exists in master

Adicionado campo SUS no cadastro de pessoa física;

Portabilis/ieducar#147
ieducar/intranet/atendidos_cad.php
... ... @@ -108,6 +108,7 @@ class indice extends clsCadastro
108 108 var $retorno;
109 109 var $zona_localizacao;
110 110 var $cor_raca;
  111 + var $sus;
111 112  
112 113 var $caminho_det;
113 114 var $caminho_lst;
... ... @@ -134,7 +135,7 @@ class indice extends clsCadastro
134 135 $this->idtlog, $this->sigla_uf, $this->complemento, $this->numero,
135 136 $this->bloco, $this->apartamento, $this->andar, $this->zona_localizacao, $this->estado_civil,
136 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 141 $objPessoa->queryRapida(
... ... @@ -143,7 +144,7 @@ class indice extends clsCadastro
143 144 'tipo', 'sexo', 'cidade', 'bairro', 'logradouro', 'cep', 'idlog',
144 145 'idbai', 'idtlog', 'sigla_uf', 'complemento', 'numero', 'bloco', 'apartamento',
145 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 150 $this->id_federal = is_numeric($this->id_federal) ? int2CPF($this->id_federal) : '';
... ... @@ -329,6 +330,18 @@ class indice extends clsCadastro
329 330  
330 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 346 // tipo de certidao civil
334 347  
... ... @@ -1051,6 +1064,7 @@ class indice extends clsCadastro
1051 1064 $fisica->nacionalidade = $_REQUEST['tipo_nacionalidade'];
1052 1065 $fisica->idpais_estrangeiro = $_REQUEST['pais_origem_id'];
1053 1066 $fisica->idmun_nascimento = $_REQUEST['naturalidade_id'];
  1067 + $fisica->sus = $this->sus;
1054 1068  
1055 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 95 var $nm_pai;
96 96 var $nm_mae;
97 97 var $ref_cod_raca;
  98 + var $sus;
98 99  
99 100 function Gerar()
100 101 {
... ... @@ -180,6 +181,8 @@ class indice extends clsDetalhe
180 181 $this->idpes_pai = $det_fisica['idpes_pai'];
181 182 $this->idpes_mae = $det_fisica['idpes_mae'];
182 183  
  184 + $this->sus = $det_fisica['sus'];
  185 +
183 186 $this->nm_pai = $registro['nm_pai'];
184 187 $this->nm_mae = $registro['nm_mae'];
185 188  
... ... @@ -685,6 +688,7 @@ class indice extends clsDetalhe
685 688 if (trim($reg['peso'])!='') $this->addDetalhe(array('Peso/kg', $reg['peso']));
686 689 if (trim($reg['grupo_sanguineo'])!='') $this->addDetalhe(array('Grupo sanguíneo', $reg['grupo_sanguineo']));
687 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 692 $this->addDetalhe(array('Possui alergia a algum medicamento', ($reg['alergia_medicamento'] == 'S' ? 'Sim': 'Não') ));
689 693 if (trim($reg['desc_alergia_medicamento'])!='') $this->addDetalhe(array('Quais', $reg['desc_alergia_medicamento']));
690 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 69 var $ref_cod_sistema;
70 70 var $cpf;
71 71 var $ref_cod_religiao;
  72 + var $sus;
72 73  
73 74 var $tabela;
74 75 var $schema;
... ... @@ -327,6 +328,12 @@ class clsFisica
327 328 $valores .= ", $this->cpf";
328 329 }
329 330  
  331 + if(!empty($this->sus))
  332 + {
  333 + $campos .= ", sus";
  334 + $valores .= ", '$this->sus'";
  335 + }
  336 +
330 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 338 return true;
332 339  
... ... @@ -477,6 +484,11 @@ class clsFisica
477 484 $gruda = ", ";
478 485 }
479 486  
  487 + if($this->sus) {
  488 + $set .= "$gruda sus = '{$this->sus}'";
  489 + $gruda = ", ";
  490 + }
  491 +
480 492 if(is_numeric($this->ref_cod_sistema) || $this->ref_cod_sistema == "NULL") {
481 493 $set .= "$gruda ref_cod_sistema = {$this->ref_cod_sistema}";
482 494 $gruda = ", ";
... ... @@ -790,7 +802,7 @@ class clsFisica
790 802 if($this->idpes)
791 803 {
792 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 806 if( $db->ProximoRegistro() )
795 807 {
796 808 $tupla = $db->Tupla();
... ...
ieducar/intranet/include/pessoa/clsPessoaFisica.inc.php
... ... @@ -296,6 +296,7 @@ class clsPessoaFisica extends clsPessoaFj
296 296 $this->justificativa_provisorio = $detalhe_fisica['justificativa_provisorio'];
297 297 $this->cpf = $detalhe_fisica['cpf'];
298 298 $this->ref_cod_religiao = $detalhe_fisica['ref_cod_religiao'];
  299 + $this->sus = $detalhe_fisica['sus'];
299 300  
300 301 $tupla['idpes'] = $this->idpes;
301 302 $tupla[] = & $tupla['idpes'];
... ...
ieducar/misc/database/deltas/portabilis/73_cria_campo_sus_fisica_documento.sql 0 → 100644
... ... @@ -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 17 \ No newline at end of file
... ...
ieducar/modules/Api/Views/AlunoController.php
... ... @@ -246,6 +246,13 @@ class AlunoController extends ApiCoreController
246 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 257 protected function createOrUpdateTransporte($alunoId) {
251 258 $tiposTransporte = array(
... ... @@ -781,6 +788,8 @@ protected function createOrUpdateUniforme($id) {
781 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 794 return $aluno;
786 795 }
... ... @@ -855,9 +864,11 @@ protected function createOrUpdateUniforme($id) {
855 864 protected function post() {
856 865 if ($this->canPost()) {
857 866 $id = $this->createOrUpdateAluno();
  867 + $pessoaId = $this->getRequest()->pessoa_id;
858 868  
859 869 if (is_numeric($id)) {
860 870 $this->updateResponsavel();
  871 + $this->saveSus($pessoaId);
861 872 $this->createOrUpdateTransporte($id);
862 873 $this->createUpdateOrDestroyEducacensoAluno($id);
863 874 $this->updateDeficiencias();
... ... @@ -876,9 +887,11 @@ protected function createOrUpdateUniforme($id) {
876 887  
877 888 protected function put() {
878 889 $id = $this->getRequest()->id;
  890 + $pessoaId = $this->getRequest()->pessoa_id;
879 891  
880 892 if ($this->canPut() && $this->createOrUpdateAluno($id)) {
881 893 $this->updateResponsavel();
  894 + $this->saveSus($pessoaId);
882 895 $this->createOrUpdateTransporte($id);
883 896 $this->createUpdateOrDestroyEducacensoAluno($id);
884 897 $this->updateDeficiencias();
... ...
ieducar/modules/Cadastro/Assets/Javascripts/Aluno.js
... ... @@ -95,6 +95,8 @@ resourceOptions.handleGet = function(dataResponse) {
95 95 CAMPOS DA FICHA MÉDICA
96 96 ************************************************/
97 97  
  98 + $j('#sus').val(dataResponse.sus);
  99 +
98 100 //campos checkbox
99 101 if (dataResponse.alergia_medicamento == 'S'){
100 102 $j('#alergia_medicamento').attr('checked',true);
... ... @@ -584,7 +586,7 @@ function afterChangePessoa(targetWindow, pessoaId) {
584 586 $j('#tab2').toggleClass('alunoTab alunoTab-active')
585 587 $j('.tablecadastro >tbody > tr').each(function(index, row) {
586 588 if (row.id!='stop'){
587   - if (index>14 && index<61){
  589 + if (index>14 && index<62){
588 590 row.show();
589 591 }else if (index>0){
590 592 row.hide();
... ... @@ -605,7 +607,7 @@ function afterChangePessoa(targetWindow, pessoaId) {
605 607 $j('#tab3').toggleClass('alunoTab alunoTab-active')
606 608 $j('.tablecadastro >tbody > tr').each(function(index, row) {
607 609 if (row.id!='stop'){
608   - if (index>60 && index<83){
  610 + if (index>60 && index<84){
609 611 row.show();
610 612 }else if (index>0){
611 613 row.hide();
... ... @@ -623,7 +625,7 @@ function afterChangePessoa(targetWindow, pessoaId) {
623 625 $j('#tab4').toggleClass('alunoTab alunoTab-active')
624 626 $j('.tablecadastro >tbody > tr').each(function(index, row) {
625 627  
626   - if (index<83 && index!=0){
  628 + if (index<84 && index!=0){
627 629 row.hide();
628 630 }else{
629 631 row.show();
... ...
ieducar/modules/Cadastro/Views/AlunoController.php
... ... @@ -449,6 +449,10 @@ class AlunoController extends Portabilis_Controller_Page_EditController
449 449 $options = array('label' => $this->_getLabel('fator_rh'), 'size' => 5, 'max_length' => 1, 'required' => false, 'placeholder' => '' );
450 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 456 // alergia_medicamento
453 457 $options = array('label' => Portabilis_String_Utils::toLatin1($this->_getLabel('alergia_medicamento') ), 'required' => false, 'placeholder' => '');
454 458 $this->inputsHelper()->checkbox('alergia_medicamento',$options);
... ...