diff --git a/trunk/SIPRPSoft/ant/common/evo-app-load-properties.xml b/trunk/SIPRPSoft/ant/common/evo-app-load-properties.xml index 01ffb6e8..68ae9785 100644 --- a/trunk/SIPRPSoft/ant/common/evo-app-load-properties.xml +++ b/trunk/SIPRPSoft/ant/common/evo-app-load-properties.xml @@ -21,7 +21,6 @@ - @@ -79,6 +78,8 @@ + + diff --git a/trunk/SIPRPSoft/lib/cursos.jar b/trunk/SIPRPSoft/lib/cursos.jar index 1c1037f7..99ad469f 100644 Binary files a/trunk/SIPRPSoft/lib/cursos.jar and b/trunk/SIPRPSoft/lib/cursos.jar differ diff --git a/trunk/SIPRPSoft/lib/evolute.jar b/trunk/SIPRPSoft/lib/evolute.jar index 93e88255..c6cc0ab7 100644 Binary files a/trunk/SIPRPSoft/lib/evolute.jar and b/trunk/SIPRPSoft/lib/evolute.jar differ diff --git a/trunk/SIPRPSoft/lib/shst.jar b/trunk/SIPRPSoft/lib/shst.jar index 694537a4..65ff8e75 100644 Binary files a/trunk/SIPRPSoft/lib/shst.jar and b/trunk/SIPRPSoft/lib/shst.jar differ diff --git a/trunk/SIPRPSoft/src/alter3.sql b/trunk/SIPRPSoft/src/alter3.sql deleted file mode 100644 index 4bfea09d..00000000 --- a/trunk/SIPRPSoft/src/alter3.sql +++ /dev/null @@ -1,32 +0,0 @@ -UPDATE trabalhadores SET perfil=1 WHERE perfil IS NULL; -UPDATE marcacoes_trabalhador SET motivo = - ( SELECT tipo FROM exames WHERE exames.trabalhador_id = marcacoes_trabalhador.trabalhador_id AND - exames.data = marcacoes_trabalhador.data ) -WHERE motivo IS NULL AND realizada = 'y'; - -CREATE TABLE etiquetas -( - id serial NOT NULL, - descricao varchar(255) NOT NULL, - descricao_plain varchar, - altura float4, - largura float4, - margem_esquerda float4, - margem_cima float4, - colunas int4, - linhas int4, - continua char(1) NOT NULL DEFAULT 'n'::bpchar, - altura_folha float4, - largura_folha float4, - margem_vertical_folha float4, - margem_horizontal_folha float4, - CONSTRAINT etiquetas_pkey PRIMARY KEY (id) -) -WITHOUT OIDS; -ALTER TABLE etiquetas OWNER TO postgres; - -ALTER TABLE estabelecimentos ADD medico_id int4 REFERENCES medicos( id ); - -insert into etiquetas ( descricao, descricao_plain, altura, largura, margem_esquerda, margem_cima, colunas, linhas, continua, altura_folha, largura_folha, - margem_horizontal_folha, margem_vertical_folha ) - values( 'Etiquetas em folha A4', 'etiquetas em folha a4', 3.7125, 10.5, 0.0, 0.0, 2, 8, 'n', 29.7, 21.0, 0.7, 0.5 ); \ No newline at end of file diff --git a/trunk/SIPRPSoft/src/alter_20060516.sql b/trunk/SIPRPSoft/src/alter_20060516.sql deleted file mode 100644 index 3e76a52c..00000000 --- a/trunk/SIPRPSoft/src/alter_20060516.sql +++ /dev/null @@ -1,2 +0,0 @@ -alter table empresas add inicio_contrato date; -alter table empresas add duracao int; \ No newline at end of file diff --git a/trunk/SIPRPSoft/src/alter_20070124.sql b/trunk/SIPRPSoft/src/alter_20070124.sql deleted file mode 100644 index 0f7cfb06..00000000 --- a/trunk/SIPRPSoft/src/alter_20070124.sql +++ /dev/null @@ -1,154 +0,0 @@ --- Table: ecd_oficial - --- DROP TABLE ecd_oficial; - -CREATE TABLE ecd_oficial -( - id serial NOT NULL, - descricao varchar(255), - descricao_plain varchar(255), - ordem int4, - activo char(1), - CONSTRAINT ecd_oficial_pkey PRIMARY KEY (id) -) -WITHOUT OIDS; -ALTER TABLE ecd_oficial OWNER TO postgres; - - --- Table: prestadores - --- DROP TABLE prestadores; - -CREATE TABLE prestadores -( - id serial NOT NULL, - nome varchar(255), - nome_plain varchar(255), - morada varchar(2048), - codigo_postal varchar(16), - localidade varchar(255), - localidade_cp varchar(255), - contacto_id int4, - activo char(1), - faz_consultas char(1), - faz_ecds char(1), - CONSTRAINT prestadores_pkey PRIMARY KEY (id), - CONSTRAINT prestadores_contacto_id_fkey FOREIGN KEY (contacto_id) - REFERENCES contactos (id) MATCH SIMPLE - ON UPDATE NO ACTION ON DELETE NO ACTION -) -WITHOUT OIDS; -ALTER TABLE prestadores OWNER TO postgres; - - --- Table: prestadores_grupos_protocolo - --- DROP TABLE prestadores_grupos_protocolo; - -CREATE TABLE prestadores_grupos_protocolo -( - id serial NOT NULL, - prestador_id int4 NOT NULL, - grupo_protocolo_id int4 NOT NULL, - CONSTRAINT prestadores_grupos_protocolo_pkey PRIMARY KEY (id), - CONSTRAINT prestadores_grupos_protocolo_grupo_protocolo_id_fkey FOREIGN KEY (grupo_protocolo_id) - REFERENCES prt_grupos_protocolo (id) MATCH SIMPLE - ON UPDATE NO ACTION ON DELETE NO ACTION, - CONSTRAINT prestadores_grupos_protocolo_prestador_id_fkey FOREIGN KEY (prestador_id) - REFERENCES prestadores (id) MATCH SIMPLE - ON UPDATE NO ACTION ON DELETE NO ACTION -) -WITHOUT OIDS; -ALTER TABLE prestadores_grupos_protocolo OWNER TO postgres; - - - --- Table: marcacoes_trabalhador_estados - --- DROP TABLE marcacoes_trabalhador_estados; - -CREATE TABLE marcacoes_trabalhador_estados -( - id serial NOT NULL, - data date, - estado int4, - marcacao_id int4, - CONSTRAINT marcacoes_trabalhador_estados_pkey PRIMARY KEY (id), - CONSTRAINT marcacoes_trabalhador_estados_marcacao_id_fkey FOREIGN KEY (marcacao_id) - REFERENCES marcacoes_trabalhador (id) MATCH SIMPLE - ON UPDATE NO ACTION ON DELETE NO ACTION -) -WITHOUT OIDS; -ALTER TABLE marcacoes_trabalhador_estados OWNER TO postgres; - -alter table marcacoes_grupos_realizados add marcacoes_trabalhador_estado_id int4 references marcacoes_trabalhador_estados(id); - --- Table: lembretes_tipos - --- DROP TABLE lembretes_tipos; - -CREATE TABLE lembretes_tipos -( - id serial NOT NULL, - codigo varchar(16) NOT NULL, - descricao varchar(255) NOT NULL, - ordem int4 NOT NULL, - activo char(1) NOT NULL DEFAULT 'y'::bpchar, - CONSTRAINT lembretes_tipos_pkey PRIMARY KEY (id) -) -WITHOUT OIDS; -ALTER TABLE lembretes_tipos OWNER TO postgres; - -INSERT INTO lembretes_tipos (codigo, descricao, ordem, activo ) - VALUES( 'EXTERNO','Avisos Externos', 1, 'y' ); -INSERT INTO lembretes_tipos (codigo, descricao, ordem, activo ) - VALUES( 'REMARCACOES', 'Remarca\\u00e7\\u00f5es', 3 , 'y' ); -INSERT INTO lembretes_tipos (codigo, descricao, ordem, activo ) - VALUES( 'MARCACOES', 'Marca\\u00e7\\u00f5es Pendentes', 2, 'y' ); -INSERT INTO lembretes_tipos (codigo, descricao, ordem, activo ) - VALUES( 'OUTROS','Outros',4,'y' ); - --- Table: lembretes - --- DROP TABLE lembretes; - -CREATE TABLE lembretes -( - id serial NOT NULL, - tipo_id int4 NOT NULL, - data date NOT NULL, - descricao varchar(255) NOT NULL, - texto varchar(16384), - empresa_id int4, - estabelecimento_id int4, - trabalhador_id int4, - marcacao_estabelecimento_id int4, - marcacao_trabalhador_id int4, - enviar_email char(1) DEFAULT 'n'::bpchar, - periodicidade_dias int4, - periodicidade_meses int4, - ultimo_envio date, - CONSTRAINT lembretes_pkey PRIMARY KEY (id), - CONSTRAINT lembretes_empresa_id_fkey FOREIGN KEY (empresa_id) - REFERENCES empresas (id) MATCH SIMPLE - ON UPDATE NO ACTION ON DELETE NO ACTION, - CONSTRAINT lembretes_estabelecimento_id_fkey FOREIGN KEY (estabelecimento_id) - REFERENCES estabelecimentos (id) MATCH SIMPLE - ON UPDATE NO ACTION ON DELETE NO ACTION, - CONSTRAINT lembretes_marcacao_estabelecimento_id_fkey FOREIGN KEY (marcacao_estabelecimento_id) - REFERENCES marcacoes_estabelecimento (id) MATCH SIMPLE - ON UPDATE NO ACTION ON DELETE NO ACTION, - CONSTRAINT lembretes_marcacao_trabalhador_id_fkey FOREIGN KEY (marcacao_trabalhador_id) - REFERENCES marcacoes_trabalhador (id) MATCH SIMPLE - ON UPDATE NO ACTION ON DELETE NO ACTION, - CONSTRAINT lembretes_tipo_id_fkey FOREIGN KEY (tipo_id) - REFERENCES lembretes_tipos (id) MATCH SIMPLE - ON UPDATE NO ACTION ON DELETE NO ACTION, - CONSTRAINT lembretes_trabalhador_id_fkey FOREIGN KEY (trabalhador_id) - REFERENCES trabalhadores (id) MATCH SIMPLE - ON UPDATE NO ACTION ON DELETE NO ACTION -) -WITHOUT OIDS; -ALTER TABLE lembretes OWNER TO postgres; - - diff --git a/trunk/SIPRPSoft/src/alter_20070221.sql b/trunk/SIPRPSoft/src/alter_20070221.sql deleted file mode 100644 index 722c7dd1..00000000 --- a/trunk/SIPRPSoft/src/alter_20070221.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE prestadores ADD contribuinte VARCHAR(64); -ALTER TABLE marcacoes_trabalhador ADD prestador_id int4 REFERENCES prestadores( id ); -ALTER TABLE marcacoes_trabalhador_estados ADD prestador_id int4 REFERENCES prestadores( id ); \ No newline at end of file diff --git a/trunk/SIPRPSoft/src/build.xml b/trunk/SIPRPSoft/src/build.xml deleted file mode 100644 index d0a1900e..00000000 --- a/trunk/SIPRPSoft/src/build.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/SIPRPSoft/src/siprp/SHSTLogger.java b/trunk/SIPRPSoft/src/siprp/SHSTLogger.java deleted file mode 100644 index 256f1ead..00000000 --- a/trunk/SIPRPSoft/src/siprp/SHSTLogger.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * SIPRPLogger.java - * - * Created on 15 de Marco de 2005, 15:31 - */ - -package siprp; - -import shst.SHSTPropertiesConstants; - -import com.evolute.project.ProjectTools; -import com.evolute.utils.Singleton; -import com.evolute.utils.db.DBManager; -import com.evolute.utils.db.Executer; -import com.evolute.utils.db.SQLRetriever; -import com.evolute.utils.error.Logger; -import com.evolute.utils.sql.Assignment; -import com.evolute.utils.sql.Field; -import com.evolute.utils.sql.Insert; - -/** - * - * @author lflores - - * MySQL -CREATE TABLE errors -( - id INT NOT NULL AUTO_INCREMENT, - PRIMARY KEY( id ), - date TIMESTAMP NOT NULL DEFAULT 'now()', - type VARCHAR(20), - environment VARCHAR( 255 ), - description TEXT -); - * - *PostgreSQL -CREATE TABLE errors -( - id SERIAL, - PRIMARY KEY( id ), - date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - type VARCHAR(20), - environment VARCHAR( 255 ), - description VARCHAR( 256000 ) -) - - */ -public class SHSTLogger implements Logger -{ - private final String java = System.getProperty( "java.version" ) + "-" + System.getProperty( "java.vm.version" ); - private final String os = System.getProperty( "os.name" ) + " - " + System.getProperty( "os.version" ); - private final String user = ( String )Singleton.getInstance( Singleton.USERNAME ); - private final String ENV = "Java: " + java + " \nOS: " + os + " \nUser: " + user - + "\n Software: " + ( String )Singleton.getInstance( SHSTPropertiesConstants.SOFTWARE_NAME ) - + "\n Version: " + ProjectTools.getInstance().getVersion(); - private final Executer executer; - - /** Creates a new instance of SIPRPLogger */ - public SHSTLogger() - throws Exception - { - DBManager dbm = ( DBManager )Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ); - executer = dbm.getExclusiveExecuter( this ); - } - - @Override - public void log( String str ) - { - String mem = "(" + Runtime.getRuntime().freeMemory() + "/" + - Runtime.getRuntime().maxMemory() + ")"; - if( str.length() > 254000 ) - { - str = str.substring( 0, 254000 ) + " Message too big (" + str.length() + "), truncated."; - } - try - { - executer.executeQuery( new Insert( "errors", new Assignment[] { - new Assignment( new Field( "type" ), "LOG" ), - new Assignment( new Field( "environment" ), ENV + mem ), - new Assignment( new Field( "description" ), str ) - } ), null ); - } - catch( Exception ex ) - { - logException( ex ); - } - } - - @Override - public void logException( Throwable ex ) - { - StackTraceElement ste[] = ex.getStackTrace(); - StringBuffer sb = new StringBuffer(); - for( int i = 0; i < ste.length; ++i ) - { - sb.append( ste[ i ].toString() ); - } - String str = "Exception Message: " + ex.getMessage() + "\nStack Trace: " + sb.toString(); - String mem = "(" + Runtime.getRuntime().freeMemory() + "/" + - Runtime.getRuntime().maxMemory() + ")"; - if( str.length() > 254000 ) - { - str = str.substring( 0, 254000 ) + " Message too big (" + str.length() + "), truncated."; - } - try - { - executer.executeQuery( new Insert( "errors", new Assignment[] { - new Assignment( new Field( "type" ), "ERROR" ), - new Assignment( new Field( "environment" ), ENV + mem ), - new Assignment( new Field( "description" ), str ) - } ), new SQLRetriever() ); - } - catch( Exception ex1 ) - { - ex.printStackTrace(); - } - } - - @Override - public void close() { - - } - - @Override - public void log(String str, java.util.logging.Level level) { - - } - - @Override - public void logException(Throwable ex, java.util.logging.Level level) { - - } - -} diff --git a/trunk/SIPRPSoft/src/siprp/SIPRPTracker.java b/trunk/SIPRPSoft/src/siprp/SIPRPTracker.java index b7385814..bfcb6b5f 100644 --- a/trunk/SIPRPSoft/src/siprp/SIPRPTracker.java +++ b/trunk/SIPRPSoft/src/siprp/SIPRPTracker.java @@ -69,6 +69,8 @@ public class SIPRPTracker extends WindowTracker implements SHSTTrackerInterface private MultiMarcacoesWindow multiMarcacoesWindow; private MarcacoesHigieneInterface higieneWindow; + private LoginWindow loginWindow = null; + /** Creates a new instance of SIPRPTracker */ public SIPRPTracker( AvisosPanel avisosP ) { @@ -309,30 +311,25 @@ public class SIPRPTracker extends WindowTracker implements SHSTTrackerInterface setCreators( creators ); } - public shst.clientes.ClientesWindow getClientesWindow() throws Exception + @Override + public shst.clientes.ClientesWindow getClientesWindow() { - if( clientesWindow == null ) + try { - clientesWindow = new shst.clientes.ClientesWindow( avisos ); - clientesWindow.setTracker( SIPRPTracker.this ); + if( clientesWindow == null ) + { + clientesWindow = new shst.clientes.ClientesWindow( avisos ); + clientesWindow.setTracker( SIPRPTracker.this ); + } } - return clientesWindow; - } - - private shst.clientes.ClientesWindow clientesWindow2 = null; - - private LoginWindow loginWindow = null; - - public shst.clientes.ClientesWindow getClientesWindow2() throws Exception - { - if( clientesWindow2 == null ) + catch( Exception e ) { - clientesWindow2 = new shst.clientes.ClientesWindow( avisos ); - clientesWindow2.setTracker( SIPRPTracker.this ); + ErrorLogger.logException( e ); } - return clientesWindow2; + return clientesWindow; } + @Override public MedicinaWindowInterface getMedicinaWindow() throws Exception { if( medicinaWindow == null ) @@ -343,16 +340,25 @@ public class SIPRPTracker extends WindowTracker implements SHSTTrackerInterface return medicinaWindow; } - public MultiMarcacoesWindow getMultiMarcacoesWindow() throws Exception + @Override + public MultiMarcacoesWindow getMultiMarcacoesWindow() { - if( multiMarcacoesWindow == null ) + try { - multiMarcacoesWindow = new MultiMarcacoesWindow(); - multiMarcacoesWindow.setTracker( SIPRPTracker.this ); + if( multiMarcacoesWindow == null ) + { + multiMarcacoesWindow = new MultiMarcacoesWindow(); + multiMarcacoesWindow.setTracker( SIPRPTracker.this ); + } + } + catch( Exception e ) + { + ErrorLogger.logException( e ); } return multiMarcacoesWindow; } + @Override public MarcacoesHigieneInterface getHigieneWindow() throws Exception { if( higieneWindow == null ) @@ -363,6 +369,7 @@ public class SIPRPTracker extends WindowTracker implements SHSTTrackerInterface return higieneWindow; } + @Override public AvisosPanel getAvisosPanel() { return avisos; diff --git a/trunk/SIPRPSoft/src/siprp_create.sql b/trunk/SIPRPSoft/src/siprp_create.sql deleted file mode 100644 index 56b89f27..00000000 --- a/trunk/SIPRPSoft/src/siprp_create.sql +++ /dev/null @@ -1,569 +0,0 @@ --- --- PostgreSQL database dump --- - -SET client_encoding = 'LATIN1'; -SET check_function_bodies = false; -SET client_min_messages = warning; - - --- --- Name: actualizacao; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --- - -CREATE TABLE actualizacao ( - hora timestamp without time zone, - id serial NOT NULL -); - - -ALTER TABLE public.actualizacao OWNER TO postgres; - --- --- Name: avisos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --- - -CREATE TABLE avisos ( - id integer NOT NULL, - tipo integer DEFAULT 0 NOT NULL, - empresa_id integer, - estabelecimento_id integer, - trabalhador_id integer, - evento_id integer, - data_aviso date NOT NULL, - data_evento date, - descricao character varying(255) -); - - -ALTER TABLE public.avisos OWNER TO postgres; - --- --- Name: contactos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --- - -CREATE TABLE contactos ( - id integer NOT NULL, - nome character varying(255), - telefone character varying(255), - telemovel character varying(255), - fax character varying(255), - email character varying(255), - cargo character varying(255) -); - - -ALTER TABLE public.contactos OWNER TO postgres; - --- --- Name: empresas; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --- - -CREATE TABLE empresas ( - id integer NOT NULL, - designacao_social character varying(255) DEFAULT ''::character varying NOT NULL, - servico_saude_tipo integer, - servico_saude_designacao character varying(255) DEFAULT 'Sociedade Ibu00e9rica de Prevenu00e7u00e3o de Riscos Profissionais'::character varying, - servico_higiene_tipo integer, - servico_higiene_designacao character varying(255), - inactivo character(1) DEFAULT 'n'::bpchar NOT NULL, - morada character varying(255), - codigo_postal character varying(8), - localidade character varying(255), - distrito character varying(255), - concelho character varying(255), - numero_trabalhadores integer, - data_proposta date, - data_aceitacao date, - perfil_1 character varying(255), - perfil_2 character varying(255), - data_envio_contrato date, - data_recepcao_contrato date, - data_envio_idict date, - cae character varying(255), - contribuinte character varying(255), - seguranca_social character varying(255), - codigo_1 character varying(255), - codigo_2 character varying(255), - codigo_3 character varying(255), - servicos integer, - contacto_1 integer, - contacto_2 integer, - data_relatorio_anual date, - preco_higiene double precision, - preco_medicina double precision, - periodicidade character varying(255), - actividade character varying(255), - actualizacao timestamp without time zone, - designacao_social_plain character varying(255) -); - - -ALTER TABLE public.empresas OWNER TO postgres; - --- --- Name: errors; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --- - -CREATE TABLE errors ( - id integer NOT NULL, - date timestamp without time zone, - "type" character varying(20), - environment character varying(255), - description character varying(65535) -); - - -ALTER TABLE public.errors OWNER TO postgres; - --- --- Name: estabelecimentos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --- - -CREATE TABLE estabelecimentos ( - id integer NOT NULL, - nome character varying(255) DEFAULT ''::character varying NOT NULL, - localidade character varying(255), - inactivo character(1) DEFAULT 'n'::bpchar NOT NULL, - empresa_id integer DEFAULT 0 NOT NULL, - morada character varying(255), - codigo_postal character varying(255), - contacto character varying(255), - historico character varying(65535), - actualizacao timestamp without time zone, - nome_plain character varying(255) -); - - -ALTER TABLE public.estabelecimentos OWNER TO postgres; - --- --- Name: exames; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --- - -CREATE TABLE exames ( - id integer NOT NULL, - data date, - tipo integer DEFAULT 0 NOT NULL, - ocasional integer, - outro_tipo character varying(255), - resultado integer, - outra_funcao_1 character varying(255), - outra_funcao_2 character varying(255), - outra_funcao_3 character varying(255), - outra_funcao_4 character varying(255), - proximo_exame date, - outras_recomendacoes character varying(65535), - inactivo character(1) DEFAULT 'n'::bpchar NOT NULL, - trabalhador_id integer DEFAULT 0 NOT NULL, - medico_id integer DEFAULT 0 NOT NULL, - pdf bytea -); - - -ALTER TABLE public.exames OWNER TO postgres; - --- --- Name: exames_perfis; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --- - -CREATE TABLE exames_perfis ( - id integer NOT NULL, - perfil integer DEFAULT 0 NOT NULL, - tipo integer DEFAULT 0 NOT NULL, - multiplicador integer DEFAULT 0 NOT NULL -); - - -ALTER TABLE public.exames_perfis OWNER TO postgres; - --- --- Name: historico_estabelecimento; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --- - -CREATE TABLE historico_estabelecimento ( - id integer NOT NULL, - estabelecimento_id integer DEFAULT 0 NOT NULL, - data date, - texto character varying(65535) -); - - -ALTER TABLE public.historico_estabelecimento OWNER TO postgres; - --- --- Name: ids; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --- - -CREATE TABLE ids ( - id integer NOT NULL -); - - -ALTER TABLE public.ids OWNER TO postgres; - --- --- Name: marcacoes_empresa; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --- - -CREATE TABLE marcacoes_empresa ( - id integer NOT NULL, - data date NOT NULL, - texto character varying(65535), - empresa_id integer DEFAULT 0 NOT NULL, - realizada character(1) -); - - -ALTER TABLE public.marcacoes_empresa OWNER TO postgres; - --- --- Name: marcacoes_estabelecimento; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --- - -CREATE TABLE marcacoes_estabelecimento ( - id integer NOT NULL, - data date NOT NULL, - realizada character(1) DEFAULT 'n'::bpchar NOT NULL, - data_email date, - data_relatorio date, - estabelecimento_id integer DEFAULT 0 NOT NULL -); - - -ALTER TABLE public.marcacoes_estabelecimento OWNER TO postgres; - --- --- Name: marcacoes_trabalhador; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --- - -CREATE TABLE marcacoes_trabalhador ( - id integer NOT NULL, - data date, - realizada character(1) DEFAULT 'n'::bpchar NOT NULL, - data_email date, - data_relatorio date, - tipo integer, - trabalhador_id integer -); - - -ALTER TABLE public.marcacoes_trabalhador OWNER TO postgres; - --- --- Name: medicos; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --- - -CREATE TABLE medicos ( - id integer NOT NULL, - nome character varying(255) DEFAULT ''::character varying NOT NULL, - numero_cedula character varying(255) DEFAULT ''::character varying NOT NULL, - inactivo character(1) DEFAULT 'n'::bpchar NOT NULL -); - - -ALTER TABLE public.medicos OWNER TO postgres; - --- --- Name: tipos_exames_comp; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --- - -CREATE TABLE tipos_exames_comp ( - id integer NOT NULL, - ordem integer DEFAULT 0 NOT NULL, - descricao character varying(255) DEFAULT ''::character varying NOT NULL -); - - -ALTER TABLE public.tipos_exames_comp OWNER TO postgres; - --- --- Name: trabalhadores; Type: TABLE; Schema: public; Owner: postgres; Tablespace: --- - -CREATE TABLE trabalhadores ( - id integer NOT NULL, - nome character varying(255) DEFAULT ''::character varying NOT NULL, - sexo character(1), - data_nascimento date, - nacionalidade character varying(255), - numero_mecanografico character varying(255), - data_admissao date, - categoria character varying(255), - local_trabalho character varying(255), - funcao_proposta character varying(255), - data_admissao_funcao date, - observacoes character varying(65535), - inactivo character(1) DEFAULT 'n'::bpchar NOT NULL, - estabelecimento_id integer DEFAULT 0 NOT NULL, - data_demissao date, - observacoes_gestao character varying(65535), - perfil integer, - actualizacao timestamp without time zone, - nome_plain character varying(255) -); - - -ALTER TABLE public.trabalhadores OWNER TO postgres; - --- --- Name: actualizacao_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --- - -ALTER TABLE ONLY actualizacao - ADD CONSTRAINT actualizacao_pkey PRIMARY KEY (id); - - -ALTER INDEX public.actualizacao_pkey OWNER TO postgres; - --- --- Name: avisos_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --- - -ALTER TABLE ONLY avisos - ADD CONSTRAINT avisos_pkey PRIMARY KEY (id); - - -ALTER INDEX public.avisos_pkey OWNER TO postgres; - --- --- Name: contactos_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --- - -ALTER TABLE ONLY contactos - ADD CONSTRAINT contactos_pkey PRIMARY KEY (id); - - -ALTER INDEX public.contactos_pkey OWNER TO postgres; - --- --- Name: empresas_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --- - -ALTER TABLE ONLY empresas - ADD CONSTRAINT empresas_pkey PRIMARY KEY (id); - - -ALTER INDEX public.empresas_pkey OWNER TO postgres; - --- --- Name: errors_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --- - -ALTER TABLE ONLY errors - ADD CONSTRAINT errors_pkey PRIMARY KEY (id); - - -ALTER INDEX public.errors_pkey OWNER TO postgres; - --- --- Name: estabelecimentos_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --- - -ALTER TABLE ONLY estabelecimentos - ADD CONSTRAINT estabelecimentos_pkey PRIMARY KEY (id); - - -ALTER INDEX public.estabelecimentos_pkey OWNER TO postgres; - --- --- Name: exames_perfis_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --- - -ALTER TABLE ONLY exames_perfis - ADD CONSTRAINT exames_perfis_pkey PRIMARY KEY (id); - - -ALTER INDEX public.exames_perfis_pkey OWNER TO postgres; - --- --- Name: exames_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --- - -ALTER TABLE ONLY exames - ADD CONSTRAINT exames_pkey PRIMARY KEY (id); - - -ALTER INDEX public.exames_pkey OWNER TO postgres; - --- --- Name: historico_estabelecimento_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --- - -ALTER TABLE ONLY historico_estabelecimento - ADD CONSTRAINT historico_estabelecimento_pkey PRIMARY KEY (id); - - -ALTER INDEX public.historico_estabelecimento_pkey OWNER TO postgres; - --- --- Name: ids_pk; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --- - -ALTER TABLE ONLY ids - ADD CONSTRAINT ids_pk PRIMARY KEY (id); - - -ALTER INDEX public.ids_pk OWNER TO postgres; - --- --- Name: marcacoes_empresa_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --- - -ALTER TABLE ONLY marcacoes_empresa - ADD CONSTRAINT marcacoes_empresa_pkey PRIMARY KEY (id); - - -ALTER INDEX public.marcacoes_empresa_pkey OWNER TO postgres; - --- --- Name: marcacoes_estabelecimento_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --- - -ALTER TABLE ONLY marcacoes_estabelecimento - ADD CONSTRAINT marcacoes_estabelecimento_pkey PRIMARY KEY (id); - - -ALTER INDEX public.marcacoes_estabelecimento_pkey OWNER TO postgres; - --- --- Name: marcacoes_trabalhador_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --- - -ALTER TABLE ONLY marcacoes_trabalhador - ADD CONSTRAINT marcacoes_trabalhador_pkey PRIMARY KEY (id); - - -ALTER INDEX public.marcacoes_trabalhador_pkey OWNER TO postgres; - --- --- Name: medicos_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --- - -ALTER TABLE ONLY medicos - ADD CONSTRAINT medicos_pkey PRIMARY KEY (id); - - -ALTER INDEX public.medicos_pkey OWNER TO postgres; - --- --- Name: tipos_exames_comp_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --- - -ALTER TABLE ONLY tipos_exames_comp - ADD CONSTRAINT tipos_exames_comp_pkey PRIMARY KEY (id); - - -ALTER INDEX public.tipos_exames_comp_pkey OWNER TO postgres; - --- --- Name: trabalhadores_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: --- - -ALTER TABLE ONLY trabalhadores - ADD CONSTRAINT trabalhadores_pkey PRIMARY KEY (id); - - -ALTER INDEX public.trabalhadores_pkey OWNER TO postgres; - - --- --- Name: avisos_empresa_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY avisos - ADD CONSTRAINT avisos_empresa_id_fkey FOREIGN KEY (empresa_id) REFERENCES empresas(id); - - --- --- Name: avisos_estabelecimento_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY avisos - ADD CONSTRAINT avisos_estabelecimento_id_fkey FOREIGN KEY (estabelecimento_id) REFERENCES estabelecimentos(id); - - --- --- Name: empresas_contacto_1_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY empresas - ADD CONSTRAINT empresas_contacto_1_fkey FOREIGN KEY (contacto_1) REFERENCES contactos(id); - - --- --- Name: empresas_contacto_2_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY empresas - ADD CONSTRAINT empresas_contacto_2_fkey FOREIGN KEY (contacto_2) REFERENCES contactos(id); - - --- --- Name: estabelecimentos_empresa_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY estabelecimentos - ADD CONSTRAINT estabelecimentos_empresa_id_fkey FOREIGN KEY (empresa_id) REFERENCES empresas(id); - - --- --- Name: exames_medico_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY exames - ADD CONSTRAINT exames_medico_id_fkey FOREIGN KEY (medico_id) REFERENCES medicos(id); - - --- --- Name: exames_perfis_tipo_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY exames_perfis - ADD CONSTRAINT exames_perfis_tipo_fkey FOREIGN KEY (tipo) REFERENCES tipos_exames_comp(id); - - --- --- Name: historico_estabelecimento_estabelecimento_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY historico_estabelecimento - ADD CONSTRAINT historico_estabelecimento_estabelecimento_id_fkey FOREIGN KEY (estabelecimento_id) REFERENCES estabelecimentos(id); - - --- --- Name: marcacoes_empresa_empresa_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY marcacoes_empresa - ADD CONSTRAINT marcacoes_empresa_empresa_id_fkey FOREIGN KEY (empresa_id) REFERENCES empresas(id); - - --- --- Name: marcacoes_estabelecimento_estabelecimento_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY marcacoes_estabelecimento - ADD CONSTRAINT marcacoes_estabelecimento_estabelecimento_id_fkey FOREIGN KEY (estabelecimento_id) REFERENCES estabelecimentos(id); - - --- --- Name: trabalhadores_estabelecimento_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres --- - -ALTER TABLE ONLY trabalhadores - ADD CONSTRAINT trabalhadores_estabelecimento_id_fkey FOREIGN KEY (estabelecimento_id) REFERENCES estabelecimentos(id); - - - --- --- Name: public; Type: ACL; Schema: -; Owner: postgres --- - -REVOKE ALL ON SCHEMA public FROM PUBLIC; -REVOKE ALL ON SCHEMA public FROM postgres; -GRANT ALL ON SCHEMA public TO postgres; -GRANT ALL ON SCHEMA public TO PUBLIC; - - -