From f16f14e4d878198bc3012ad33049ed88c49da8ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladimir=20T=C3=A1mara=20Pati=C3=B1o?= Date: Mon, 20 May 2024 07:49:46 -0500 Subject: [PATCH] ordena --- Gemfile.lock | 2 +- .../personas/_filtro_centropoblado.html.erb | 14 +- .../personas/_filtro_departamento.html.erb | 12 +- .../msip/personas/_filtro_municipio.html.erb | 12 +- app/views/msip/personas/_filtro_pais.html.erb | 14 +- db/structure.sql | 678 ++++++++---------- 6 files changed, 324 insertions(+), 408 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index cac7038..29fd218 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -74,7 +74,7 @@ GIT GIT remote: https://gitlab.com/pasosdeJesus/msip.git - revision: f05236cc39947d3b5b47c621700d4e3b21787f9a + revision: 54f056503d1fe1ca997101585cfa0a6d080ad9af branch: v2.2 specs: msip (2.2.0.beta6) diff --git a/app/views/msip/personas/_filtro_centropoblado.html.erb b/app/views/msip/personas/_filtro_centropoblado.html.erb index c87d1fd..0251031 100644 --- a/app/views/msip/personas/_filtro_centropoblado.html.erb +++ b/app/views/msip/personas/_filtro_centropoblado.html.erb @@ -10,18 +10,18 @@ collection: Msip::Centropoblado.habilitados.where( municipio_id: municipio_id ), - label: false, - label_method: :nombre, - valud_method: :id, - selected: Msip::ModeloHelper.poromision(params, :buscentropoblado), + include_blank: true, input_html: { - 'data-enviarautomatico' => '', class: 'tom-select', data: { - "action": "change->msip--geodep#cambiar_centropoblado", + action: "change->msip--geodep#cambiar_centropoblado", + enviarautomatico: "", "msip--geodep-target": "centropoblado" }, value: centropoblado_id }, - include_blank: true + label: false, + label_method: :nombre, + selected: Msip::ModeloHelper.poromision(params, :buscentropoblado), + valud_method: :id %> diff --git a/app/views/msip/personas/_filtro_departamento.html.erb b/app/views/msip/personas/_filtro_departamento.html.erb index c07268c..d11ae5e 100644 --- a/app/views/msip/personas/_filtro_departamento.html.erb +++ b/app/views/msip/personas/_filtro_departamento.html.erb @@ -4,18 +4,18 @@ params[:filtro][:busdepartamento].to_i : 0 %> <%= f.input :busdepartamento, collection: Msip::Departamento.habilitados.where(pais_id: pais_id), - label: false, - label_method: :nombre, - valud_method: :id, - selected: Msip::ModeloHelper.poromision(params, :busdepartamento), + include_blank: true, input_html: { - 'data-enviarautomatico' => '', class: 'tom-select', data: { "action": "change->msip--geodep#cambiar_departamento", + enviarautomatico: '', "msip--geodep-target": "departamento" }, value: departamento_id }, - include_blank: true + label: false, + label_method: :nombre, + selected: Msip::ModeloHelper.poromision(params, :busdepartamento), + valud_method: :id %> diff --git a/app/views/msip/personas/_filtro_municipio.html.erb b/app/views/msip/personas/_filtro_municipio.html.erb index 47f05af..f168aa0 100644 --- a/app/views/msip/personas/_filtro_municipio.html.erb +++ b/app/views/msip/personas/_filtro_municipio.html.erb @@ -8,18 +8,18 @@ collection: Msip::Municipio.habilitados.where( departamento_id: departamento_id ), - label: false, - label_method: :nombre, - valud_method: :id, - selected: Msip::ModeloHelper.poromision(params, :busmunicipio), + include_blank: true, input_html: { - 'data-enviarautomatico' => '', class: 'tom-select', data: { "action": "change->msip--geodep#cambiar_municipio", + enviarautomatico: '', "msip--geodep-target": "municipio" }, value: municipio_id }, - include_blank: true + label: false, + label_method: :nombre, + selected: Msip::ModeloHelper.poromision(params, :busmunicipio), + valud_method: :id %> diff --git a/app/views/msip/personas/_filtro_pais.html.erb b/app/views/msip/personas/_filtro_pais.html.erb index 0295fea..0db4b35 100644 --- a/app/views/msip/personas/_filtro_pais.html.erb +++ b/app/views/msip/personas/_filtro_pais.html.erb @@ -2,17 +2,17 @@ params[:filtro][:buspais].to_i : 0 %> <%= f.input :buspais, collection: Msip::Pais.habilitados, - label: false, - label_method: :nombre, - valud_method: :id, - selected: Msip::ModeloHelper.poromision(params, :buspais), + include_blank: true, input_html: { - 'data-enviarautomatico' => '', class: 'tom-select', data: { - "action": "change->msip--geodep#cambiar_pais" + "action": "change->msip--geodep#cambiar_pais", + enviarautomatico: '' }, value: pais_id }, - include_blank: true + label: false, + label_method: :nombre, + selected: Msip::ModeloHelper.poromision(params, :buspais), + valud_method: :id %> diff --git a/db/structure.sql b/db/structure.sql index e56f2c1..31018ce 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -1591,345 +1591,6 @@ CREATE SEQUENCE public.cargoestado_id_seq ALTER SEQUENCE public.cargoestado_id_seq OWNED BY public.cargoestado.id; --- --- Name: msip_persona_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.msip_persona_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: msip_persona; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.msip_persona ( - id integer DEFAULT nextval('public.msip_persona_id_seq'::regclass) NOT NULL, - nombres character varying(100) NOT NULL COLLATE public.es_co_utf_8, - apellidos character varying(100) NOT NULL COLLATE public.es_co_utf_8, - anionac integer, - mesnac integer, - dianac integer, - sexo character(1) DEFAULT 'S'::bpchar NOT NULL, - numerodocumento character varying(100) NOT NULL, - created_at timestamp without time zone, - updated_at timestamp without time zone, - pais_id integer, - nacionalde integer, - tdocumento_id integer NOT NULL, - departamento_id integer, - municipio_id integer, - centropoblado_id integer, - ultimo_departamento_trabajo_id integer, - ultima_regionpago_id integer, - ultimo_correo_trabajo character varying(128), - ultimo_celular_trabajo character varying(128), - ultima_entidad_id integer, - ultimo_cargoestado_id integer, - fecha_desafiliacion_aportante date, - etnia_id integer DEFAULT 1 NOT NULL, - tipoaliado_id integer, - detallealiado character varying(1000), - CONSTRAINT persona_check CHECK (((dianac IS NULL) OR (((dianac >= 1) AND (((mesnac = 1) OR (mesnac = 3) OR (mesnac = 5) OR (mesnac = 7) OR (mesnac = 8) OR (mesnac = 10) OR (mesnac = 12)) AND (dianac <= 31))) OR (((mesnac = 4) OR (mesnac = 6) OR (mesnac = 9) OR (mesnac = 11)) AND (dianac <= 30)) OR ((mesnac = 2) AND (dianac <= 29))))), - CONSTRAINT persona_mesnac_check CHECK (((mesnac IS NULL) OR ((mesnac >= 1) AND (mesnac <= 12)))), - CONSTRAINT persona_sexo_check CHECK (((sexo = 'S'::bpchar) OR (sexo = 'F'::bpchar) OR (sexo = 'M'::bpchar))) -); - - --- --- Name: sivel2_gen_caso_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.sivel2_gen_caso_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: sivel2_gen_caso; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.sivel2_gen_caso ( - id integer DEFAULT nextval('public.sivel2_gen_caso_id_seq'::regclass) NOT NULL, - titulo character varying(50), - fecha date NOT NULL, - hora character varying(10), - duracion character varying(10), - memo text NOT NULL, - grconfiabilidad character varying(5), - gresclarecimiento character varying(5), - grimpunidad character varying(8), - grinformacion character varying(8), - bienes text, - intervalo_id integer DEFAULT 5, - created_at timestamp without time zone, - updated_at timestamp without time zone, - ubicacion_id integer, - ayudafasol character varying(1024), - codigofasol character varying(32), - marbetefasol character varying(256), - observacionfasol character varying(1024) -); - - --- --- Name: sivel2_gen_victima_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.sivel2_gen_victima_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: sivel2_gen_victima; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.sivel2_gen_victima ( - hijos integer, - profesion_id integer DEFAULT 22 NOT NULL, - rangoedad_id integer DEFAULT 6 NOT NULL, - filiacion_id integer DEFAULT 10 NOT NULL, - sectorsocial_id integer DEFAULT 15 NOT NULL, - organizacion_id integer DEFAULT 16 NOT NULL, - vinculoestado_id integer DEFAULT 38 NOT NULL, - caso_id integer NOT NULL, - organizacionarmada integer DEFAULT 35 NOT NULL, - anotaciones character varying(1000), - persona_id integer NOT NULL, - iglesia_id integer DEFAULT 1, - orientacionsexual character(1) DEFAULT 'S'::bpchar NOT NULL, - created_at timestamp without time zone, - updated_at timestamp without time zone, - id integer DEFAULT nextval('public.sivel2_gen_victima_id_seq'::regclass) NOT NULL, - cargoestado_id integer DEFAULT 1, - entidad_id integer, - detallevinculoestado character varying(512), - CONSTRAINT victima_hijos_check CHECK (((hijos IS NULL) OR ((hijos >= 0) AND (hijos <= 100)))), - CONSTRAINT victima_orientacionsexual_check CHECK (((orientacionsexual = 'B'::bpchar) OR (orientacionsexual = 'G'::bpchar) OR (orientacionsexual = 'H'::bpchar) OR (orientacionsexual = 'I'::bpchar) OR (orientacionsexual = 'L'::bpchar) OR (orientacionsexual = 'O'::bpchar) OR (orientacionsexual = 'S'::bpchar) OR (orientacionsexual = 'T'::bpchar))) -); - - --- --- Name: cben1; Type: VIEW; Schema: public; Owner: - --- - -CREATE VIEW public.cben1 AS - SELECT caso.id AS caso_id, - subv.victima_id, - subv.persona_id, - 1 AS npersona, - 'total'::text AS total - FROM public.sivel2_gen_caso caso, - public.sivel2_gen_victima victima, - ( SELECT sivel2_gen_victima.persona_id, - max(sivel2_gen_victima.id) AS victima_id - FROM public.sivel2_gen_victima - GROUP BY sivel2_gen_victima.persona_id) subv, - public.msip_persona persona - WHERE ((subv.victima_id = victima.id) AND (caso.id = victima.caso_id) AND ((persona.anionac IS NULL) OR (persona.anionac = ANY (ARRAY[1922, 1931, 1933, 1935, 1937, 1938, 1939, 1940, 1941, 1942, 1943, 1944, 1945, 1946, 1947, 1948, 1949, 1950, 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, 1959, 1960, 1961, 1962, 1963, 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, 1993, 2000]))) AND (persona.etnia_id = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110])) AND (victima.filiacion_id = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 101])) AND ((((EXTRACT(year FROM caso.fecha))::text || '-'::text) || lpad((EXTRACT(month FROM caso.fecha))::text, 2, '0'::text)) = ANY (ARRAY['1983-04'::text, '1983-09'::text, '1985-04'::text, '1985-06'::text, '1985-07'::text, '1985-08'::text, '1985-11'::text, '1986-10'::text, '1987-08'::text, '1987-10'::text, '1987-11'::text, '1987-12'::text, '1988-02'::text, '1988-05'::text, '1988-09'::text, '1988-11'::text, '1989-01'::text, '1989-03'::text, '1989-04'::text, '1989-05'::text, '1989-06'::text, '1989-07'::text, '1989-08'::text, '1989-10'::text, '1989-11'::text, '1990-01'::text, '1990-04'::text, '1990-05'::text, '1990-06'::text, '1990-07'::text, '1990-08'::text, '1990-10'::text, '1991-01'::text, '1991-04'::text, '1991-09'::text, '1991-10'::text, '1991-11'::text, '1991-12'::text, '1992-01'::text, '1992-02'::text, '1992-03'::text, '1992-04'::text, '1992-05'::text, '1992-06'::text, '1992-07'::text, '1992-09'::text, '1992-10'::text, '1992-11'::text, '1992-12'::text, '1993-01'::text, '1993-02'::text, '1993-03'::text, '1993-04'::text, '1993-07'::text, '1993-09'::text, '1993-11'::text, '1993-12'::text, '1994-01'::text, '1994-03'::text, '1994-04'::text, '1994-05'::text, '1994-06'::text, '1994-07'::text, '1994-09'::text, '1994-10'::text, '1994-11'::text, '1995-01'::text, '1995-05'::text, '1995-06'::text, '1995-07'::text, '1995-08'::text, '1995-09'::text, '1995-10'::text, '1995-11'::text, '1995-12'::text, '1996-02'::text, '1996-03'::text, '1996-04'::text, '1996-05'::text, '1996-06'::text, '1996-07'::text, '1996-08'::text, '1996-09'::text, '1996-10'::text, '1996-12'::text, '1997-01'::text, '1997-02'::text, '1997-03'::text, '1997-04'::text, '1997-05'::text, '1997-06'::text, '1997-07'::text, '1997-08'::text, '1997-09'::text, '1997-10'::text, '1997-11'::text, '1997-12'::text, '1998-01'::text, '1998-02'::text, '1998-03'::text, '1998-04'::text, '1998-05'::text, '1998-06'::text, '1998-07'::text, '1998-08'::text, '1998-09'::text, '1998-10'::text, '1998-11'::text, '1998-12'::text, '1999-01'::text, '1999-02'::text, '1999-03'::text, '1999-04'::text, '1999-05'::text, '1999-06'::text, '1999-07'::text, '1999-08'::text, '1999-09'::text, '1999-10'::text, '1999-11'::text, '1999-12'::text, '2000-01'::text, '2000-02'::text, '2000-03'::text, '2000-04'::text, '2000-05'::text, '2000-06'::text, '2000-07'::text, '2000-08'::text, '2000-09'::text, '2000-11'::text, '2000-12'::text, '2001-01'::text, '2001-02'::text, '2001-03'::text, '2001-04'::text, '2001-05'::text, '2001-06'::text, '2001-07'::text, '2001-08'::text, '2001-09'::text, '2001-10'::text, '2001-11'::text, '2002-01'::text, '2002-02'::text, '2002-03'::text, '2002-04'::text, '2002-05'::text, '2002-06'::text, '2002-07'::text, '2002-08'::text, '2002-09'::text, '2002-10'::text, '2002-11'::text, '2002-12'::text, '2003-01'::text, '2003-02'::text, '2003-03'::text, '2003-04'::text, '2003-05'::text, '2003-06'::text, '2003-07'::text, '2003-08'::text, '2003-09'::text, '2003-10'::text, '2003-11'::text, '2003-12'::text, '2004-01'::text, '2004-02'::text, '2004-03'::text, '2004-04'::text, '2004-05'::text, '2004-06'::text, '2004-07'::text, '2004-09'::text, '2004-10'::text, '2004-11'::text, '2004-12'::text, '2005-01'::text, '2005-02'::text, '2005-03'::text, '2005-04'::text, '2005-05'::text, '2005-06'::text, '2005-07'::text, '2005-08'::text, '2005-09'::text, '2005-10'::text, '2005-11'::text, '2005-12'::text, '2006-01'::text, '2006-02'::text, '2006-03'::text, '2006-04'::text, '2006-05'::text, '2006-06'::text, '2006-07'::text, '2006-08'::text, '2006-09'::text, '2006-10'::text, '2006-11'::text, '2006-12'::text, '2007-01'::text, '2007-02'::text, '2007-03'::text, '2007-04'::text, '2007-05'::text, '2007-06'::text, '2007-07'::text, '2007-08'::text, '2007-09'::text, '2007-10'::text, '2007-11'::text, '2007-12'::text, '2008-01'::text, '2008-02'::text, '2008-03'::text, '2008-04'::text, '2008-05'::text, '2008-07'::text, '2008-08'::text, '2008-09'::text, '2008-10'::text, '2008-11'::text, '2009-01'::text, '2009-02'::text, '2009-03'::text, '2009-04'::text, '2009-05'::text, '2009-06'::text, '2009-07'::text, '2009-08'::text, '2009-10'::text, '2009-11'::text, '2009-12'::text, '2010-01'::text, '2010-02'::text, '2010-03'::text, '2010-04'::text, '2010-06'::text, '2010-07'::text, '2010-08'::text, '2010-09'::text, '2010-10'::text, '2010-11'::text, '2010-12'::text, '2011-01'::text, '2011-02'::text, '2011-03'::text, '2011-04'::text, '2011-05'::text, '2011-06'::text, '2011-07'::text, '2011-08'::text, '2011-09'::text, '2011-10'::text, '2011-11'::text, '2011-12'::text, '2012-01'::text, '2012-02'::text, '2012-03'::text, '2012-04'::text, '2012-05'::text, '2012-06'::text, '2012-07'::text, '2012-08'::text, '2012-09'::text, '2012-11'::text, '2012-12'::text, '2013-01'::text, '2013-02'::text, '2013-04'::text, '2013-05'::text, '2013-06'::text, '2013-07'::text, '2013-08'::text, '2013-09'::text, '2013-10'::text, '2013-11'::text, '2013-12'::text, '2014-01'::text, '2014-02'::text, '2014-03'::text, '2014-04'::text, '2014-05'::text, '2014-06'::text, '2014-07'::text, '2014-08'::text, '2014-12'::text, '2015-01'::text, '2015-02'::text, '2015-04'::text, '2015-05'::text, '2015-06'::text, '2015-07'::text, '2015-09'::text, '2015-10'::text, '2015-11'::text, '2016-05'::text, '2016-09'::text, '2016-11'::text, '2017-01'::text, '2017-03'::text, '2017-08'::text, '2017-11'::text, '2018-04'::text, '2018-05'::text, '2018-06'::text, '2018-07'::text, '2018-09'::text, '2018-10'::text, '2018-11'::text, '2019-03'::text, '2019-05'::text, '2019-11'::text, '2019-12'::text, '2020-02'::text, '2020-05'::text, '2020-10'::text, '2021-01'::text, '2021-03'::text, '2021-09'::text, '2022-03'::text, '2022-05'::text, '2022-06'::text, '2022-07'::text, '2022-12'::text, '2023-05'::text])) AND (victima.organizacion_id = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 101])) AND (victima.profesion_id = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 101, 102])) AND (victima.rangoedad_id = ANY (ARRAY[1, 2, 3, 4, 5, 6])) AND (victima.sectorsocial_id = ANY (ARRAY[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16])) AND (persona.sexo = ANY (ARRAY['F'::bpchar, 'M'::bpchar, 'S'::bpchar])) AND (persona.id = victima.persona_id)); - - --- --- Name: msip_centropoblado_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.msip_centropoblado_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: msip_centropoblado; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.msip_centropoblado ( - cplocal_cod integer, - tcentropoblado_id character varying(10) DEFAULT 'CP'::character varying NOT NULL, - nombre character varying(500) COLLATE public.es_co_utf_8, - fechacreacion date DEFAULT '2001-01-01'::date NOT NULL, - fechadeshabilitacion date, - latitud double precision, - longitud double precision, - created_at timestamp without time zone, - updated_at timestamp without time zone, - municipio_id integer, - id integer DEFAULT nextval('public.msip_centropoblado_id_seq'::regclass) NOT NULL, - observaciones character varying(5000) COLLATE public.es_co_utf_8, - ultvigenciaini date, - ultvigenciafin date, - svgruta character varying, - svgcdx integer, - svgcdy integer, - svgcdancho integer, - svgcdalto integer, - svgrotx double precision, - svgroty double precision, - CONSTRAINT msip_centropoblado_check CHECK (((fechadeshabilitacion IS NULL) OR (fechadeshabilitacion >= fechacreacion))) -); - - --- --- Name: msip_departamento_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.msip_departamento_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: msip_departamento; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.msip_departamento ( - deplocal_cod integer, - nombre character varying(500) COLLATE public.es_co_utf_8, - fechacreacion date DEFAULT CURRENT_DATE NOT NULL, - fechadeshabilitacion date, - latitud double precision, - longitud double precision, - created_at timestamp without time zone, - updated_at timestamp without time zone, - pais_id integer NOT NULL, - id integer DEFAULT nextval('public.msip_departamento_id_seq'::regclass) NOT NULL, - observaciones character varying(5000) COLLATE public.es_co_utf_8, - codiso character varying(6), - catiso character varying(64), - codreg integer, - ultvigenciaini date, - ultvigenciafin date, - svgruta character varying, - svgcdx integer, - svgcdy integer, - svgcdancho integer, - svgcdalto integer, - svgrotx double precision, - svgroty double precision, - CONSTRAINT departamento_check CHECK (((fechadeshabilitacion IS NULL) OR (fechadeshabilitacion >= fechacreacion))) -); - - --- --- Name: msip_municipio_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.msip_municipio_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: msip_municipio; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.msip_municipio ( - munlocal_cod integer, - nombre character varying(500) COLLATE public.es_co_utf_8, - fechacreacion date DEFAULT CURRENT_DATE NOT NULL, - fechadeshabilitacion date, - latitud double precision, - longitud double precision, - created_at timestamp without time zone, - updated_at timestamp without time zone, - departamento_id integer, - id integer DEFAULT nextval('public.msip_municipio_id_seq'::regclass) NOT NULL, - observaciones character varying(5000) COLLATE public.es_co_utf_8, - codreg integer, - ultvigenciaini date, - ultvigenciafin date, - tipomun character varying(32), - svgruta character varying, - svgcdx integer, - svgcdy integer, - svgcdancho integer, - svgcdalto integer, - svgrotx double precision, - svgroty double precision, - CONSTRAINT municipio_check CHECK (((fechadeshabilitacion IS NULL) OR (fechadeshabilitacion >= fechacreacion))) -); - - --- --- Name: msip_ubicacion_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.msip_ubicacion_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: msip_ubicacion; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.msip_ubicacion ( - id integer DEFAULT nextval('public.msip_ubicacion_id_seq'::regclass) NOT NULL, - tsitio_id integer DEFAULT 1 NOT NULL, - caso_id integer NOT NULL, - latitud double precision, - longitud double precision, - sitio character varying(500) COLLATE public.es_co_utf_8, - lugar character varying(500) COLLATE public.es_co_utf_8, - created_at timestamp without time zone, - updated_at timestamp without time zone, - pais_id integer, - departamento_id integer, - municipio_id integer, - centropoblado_id integer -); - - --- --- Name: cben2; Type: VIEW; Schema: public; Owner: - --- - -CREATE VIEW public.cben2 AS - SELECT cben1.caso_id, - cben1.victima_id, - cben1.persona_id, - cben1.npersona, - cben1.total, - ubicacion.departamento_id, - departamento.deplocal_cod AS departamento_divipola, - departamento.nombre AS departamento_nombre, - ubicacion.municipio_id, - ((departamento.deplocal_cod * 1000) + municipio.munlocal_cod) AS municipio_divipola, - municipio.nombre AS municipio_nombre, - ubicacion.centropoblado_id, - centropoblado.cplocal_cod AS centropoblado_divipola, - centropoblado.nombre AS centropoblado_nombre - FROM (((((public.cben1 - JOIN public.sivel2_gen_caso caso ON ((cben1.caso_id = caso.id))) - LEFT JOIN public.msip_ubicacion ubicacion ON ((caso.ubicacion_id = ubicacion.id))) - LEFT JOIN public.msip_departamento departamento ON ((ubicacion.departamento_id = departamento.id))) - LEFT JOIN public.msip_municipio municipio ON ((ubicacion.municipio_id = municipio.id))) - LEFT JOIN public.msip_centropoblado centropoblado ON ((ubicacion.centropoblado_id = centropoblado.id))) - GROUP BY cben1.caso_id, cben1.victima_id, cben1.persona_id, cben1.npersona, cben1.total, ubicacion.departamento_id, departamento.deplocal_cod, departamento.nombre, ubicacion.municipio_id, ((departamento.deplocal_cod * 1000) + municipio.munlocal_cod), municipio.nombre, ubicacion.centropoblado_id, centropoblado.cplocal_cod, centropoblado.nombre; - - -- -- Name: msip_grupoper_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- @@ -1978,6 +1639,55 @@ CREATE TABLE public.msip_orgsocial ( ); +-- +-- Name: msip_persona_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.msip_persona_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: msip_persona; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.msip_persona ( + id integer DEFAULT nextval('public.msip_persona_id_seq'::regclass) NOT NULL, + nombres character varying(100) NOT NULL COLLATE public.es_co_utf_8, + apellidos character varying(100) NOT NULL COLLATE public.es_co_utf_8, + anionac integer, + mesnac integer, + dianac integer, + sexo character(1) DEFAULT 'S'::bpchar NOT NULL, + numerodocumento character varying(100) NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + pais_id integer, + nacionalde integer, + tdocumento_id integer NOT NULL, + departamento_id integer, + municipio_id integer, + centropoblado_id integer, + ultimo_departamento_trabajo_id integer, + ultima_regionpago_id integer, + ultimo_correo_trabajo character varying(128), + ultimo_celular_trabajo character varying(128), + ultima_entidad_id integer, + ultimo_cargoestado_id integer, + fecha_desafiliacion_aportante date, + etnia_id integer DEFAULT 1 NOT NULL, + tipoaliado_id integer, + detallealiado character varying(1000), + CONSTRAINT persona_check CHECK (((dianac IS NULL) OR (((dianac >= 1) AND (((mesnac = 1) OR (mesnac = 3) OR (mesnac = 5) OR (mesnac = 7) OR (mesnac = 8) OR (mesnac = 10) OR (mesnac = 12)) AND (dianac <= 31))) OR (((mesnac = 4) OR (mesnac = 6) OR (mesnac = 9) OR (mesnac = 11)) AND (dianac <= 30)) OR ((mesnac = 2) AND (dianac <= 29))))), + CONSTRAINT persona_mesnac_check CHECK (((mesnac IS NULL) OR ((mesnac >= 1) AND (mesnac <= 12)))), + CONSTRAINT persona_sexo_check CHECK (((sexo = 'S'::bpchar) OR (sexo = 'F'::bpchar) OR (sexo = 'M'::bpchar))) +); + + -- -- Name: msip_tdocumento; Type: TABLE; Schema: public; Owner: - -- @@ -3767,6 +3477,83 @@ CREATE SEQUENCE public.cor1440_gen_valorcampotind_id_seq ALTER SEQUENCE public.cor1440_gen_valorcampotind_id_seq OWNED BY public.cor1440_gen_valorcampotind.id; +-- +-- Name: msip_departamento_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.msip_departamento_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: msip_departamento; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.msip_departamento ( + deplocal_cod integer, + nombre character varying(500) COLLATE public.es_co_utf_8, + fechacreacion date DEFAULT CURRENT_DATE NOT NULL, + fechadeshabilitacion date, + latitud double precision, + longitud double precision, + created_at timestamp without time zone, + updated_at timestamp without time zone, + pais_id integer NOT NULL, + id integer DEFAULT nextval('public.msip_departamento_id_seq'::regclass) NOT NULL, + observaciones character varying(5000) COLLATE public.es_co_utf_8, + codiso character varying(6), + catiso character varying(64), + codreg integer, + ultvigenciaini date, + ultvigenciafin date, + svgruta character varying, + svgcdx integer, + svgcdy integer, + svgcdancho integer, + svgcdalto integer, + svgrotx double precision, + svgroty double precision, + CONSTRAINT departamento_check CHECK (((fechadeshabilitacion IS NULL) OR (fechadeshabilitacion >= fechacreacion))) +); + + +-- +-- Name: msip_ubicacion_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.msip_ubicacion_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: msip_ubicacion; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.msip_ubicacion ( + id integer DEFAULT nextval('public.msip_ubicacion_id_seq'::regclass) NOT NULL, + tsitio_id integer DEFAULT 1 NOT NULL, + caso_id integer NOT NULL, + latitud double precision, + longitud double precision, + sitio character varying(500) COLLATE public.es_co_utf_8, + lugar character varying(500) COLLATE public.es_co_utf_8, + created_at timestamp without time zone, + updated_at timestamp without time zone, + pais_id integer, + departamento_id integer, + municipio_id integer, + centropoblado_id integer +); + + -- -- Name: sivel2_gen_acto_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- @@ -3795,6 +3582,45 @@ CREATE TABLE public.sivel2_gen_acto ( ); +-- +-- Name: sivel2_gen_caso_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.sivel2_gen_caso_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: sivel2_gen_caso; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.sivel2_gen_caso ( + id integer DEFAULT nextval('public.sivel2_gen_caso_id_seq'::regclass) NOT NULL, + titulo character varying(50), + fecha date NOT NULL, + hora character varying(10), + duracion character varying(10), + memo text NOT NULL, + grconfiabilidad character varying(5), + gresclarecimiento character varying(5), + grimpunidad character varying(8), + grinformacion character varying(8), + bienes text, + intervalo_id integer DEFAULT 5, + created_at timestamp without time zone, + updated_at timestamp without time zone, + ubicacion_id integer, + ayudafasol character varying(1024), + codigofasol character varying(32), + marbetefasol character varying(256), + observacionfasol character varying(1024) +); + + -- -- Name: sivel2_gen_categoria; Type: TABLE; Schema: public; Owner: - -- @@ -3846,6 +3672,47 @@ CREATE TABLE public.sivel2_gen_supracategoria ( ); +-- +-- Name: sivel2_gen_victima_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.sivel2_gen_victima_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: sivel2_gen_victima; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.sivel2_gen_victima ( + hijos integer, + profesion_id integer DEFAULT 22 NOT NULL, + rangoedad_id integer DEFAULT 6 NOT NULL, + filiacion_id integer DEFAULT 10 NOT NULL, + sectorsocial_id integer DEFAULT 15 NOT NULL, + organizacion_id integer DEFAULT 16 NOT NULL, + vinculoestado_id integer DEFAULT 38 NOT NULL, + caso_id integer NOT NULL, + organizacionarmada integer DEFAULT 35 NOT NULL, + anotaciones character varying(1000), + persona_id integer NOT NULL, + iglesia_id integer DEFAULT 1, + orientacionsexual character(1) DEFAULT 'S'::bpchar NOT NULL, + created_at timestamp without time zone, + updated_at timestamp without time zone, + id integer DEFAULT nextval('public.sivel2_gen_victima_id_seq'::regclass) NOT NULL, + cargoestado_id integer DEFAULT 1, + entidad_id integer, + detallevinculoestado character varying(512), + CONSTRAINT victima_hijos_check CHECK (((hijos IS NULL) OR ((hijos >= 0) AND (hijos <= 100)))), + CONSTRAINT victima_orientacionsexual_check CHECK (((orientacionsexual = 'B'::bpchar) OR (orientacionsexual = 'G'::bpchar) OR (orientacionsexual = 'H'::bpchar) OR (orientacionsexual = 'I'::bpchar) OR (orientacionsexual = 'L'::bpchar) OR (orientacionsexual = 'O'::bpchar) OR (orientacionsexual = 'S'::bpchar) OR (orientacionsexual = 'T'::bpchar))) +); + + -- -- Name: cvt1; Type: VIEW; Schema: public; Owner: - -- @@ -3856,18 +3723,18 @@ CREATE VIEW public.cvt1 AS acto.categoria_id, supracategoria.tviolencia_id, categoria.nombre AS categoria, - ubicacion.departamento_id, - departamento.deplocal_cod AS departamento_divipola, - departamento.nombre AS departamento_nombre + ((supracategoria.tviolencia_id)::text || (categoria.id)::text) AS nomcategoria, + departamento.nombre AS departamento_nombre, + departamento.deplocal_cod AS departamento_divipola FROM (((((((public.sivel2_gen_acto acto JOIN public.sivel2_gen_caso caso ON ((acto.caso_id = caso.id))) JOIN public.sivel2_gen_categoria categoria ON ((acto.categoria_id = categoria.id))) JOIN public.sivel2_gen_supracategoria supracategoria ON ((categoria.supracategoria_id = supracategoria.id))) JOIN public.sivel2_gen_victima victima ON (((victima.persona_id = acto.persona_id) AND (victima.caso_id = caso.id)))) JOIN public.msip_persona persona ON ((persona.id = acto.persona_id))) - LEFT JOIN public.msip_ubicacion ubicacion ON ((caso.ubicacion_id = ubicacion.id))) - LEFT JOIN public.msip_departamento departamento ON ((ubicacion.departamento_id = departamento.id))) - WHERE (categoria.id = ANY (ARRAY[197, 297, 527, 397, 427, 777, 196, 526, 426, 776, 296, 1025, 1023, 1070, 25, 15, 55, 35, 73, 45, 65, 92, 40, 50, 67, 801, 90, 57, 37, 16, 46, 26, 80, 85, 66, 64, 703, 38, 706, 59, 28, 49, 18, 501, 401, 135, 125, 115, 904, 331, 231, 402, 502, 17, 705, 62, 403, 104, 503, 906, 713, 1021, 101, 302, 21, 11, 76, 34, 102, 903, 902, 27, 1060, 1050, 24, 14, 301, 30, 20, 10, 292, 192, 392, 422, 522, 772, 63, 93, 1024, 395, 425, 295, 525, 195, 775, 714, 78, 774, 194, 424, 524, 394, 294, 89, 1040, 1030, 905, 86, 701, 68, 141, 241, 1080, 341, 715, 704, 702, 13, 23, 53, 43, 33, 1010, 88, 98, 84, 709, 711, 707, 708, 710, 1003, 1005, 1000, 1001, 1002, 87, 97, 717, 917, 716, 916, 91, 95, 718, 193, 773, 393, 293, 423, 523, 48, 58, 75, 69, 41, 1004, 74, 72, 22, 36, 56, 47, 12, 1020, 391, 521, 771, 421, 291, 191, 520, 39, 29, 77, 420, 19, 712])); + JOIN public.msip_ubicacion ubicacion ON ((ubicacion.id = caso.ubicacion_id))) + LEFT JOIN public.msip_departamento departamento ON ((departamento.id = ubicacion.departamento_id))) + WHERE ((caso.fecha >= '1983-04-19'::date) AND (caso.fecha <= '2023-05-05'::date) AND (categoria.id = ANY (ARRAY[45, 801, 10, 701])) AND (departamento.id = ANY (ARRAY[4, 7, 11, 13, 15, 17, 20, 24, 27, 29, 32, 33, 34, 35, 37, 38, 39, 41, 42, 43, 45, 46, 47, 48, 50, 51, 52, 53, 55, 56, 57, 58, 59])) AND (persona.sexo = ANY (ARRAY['F'::bpchar, 'M'::bpchar, 'S'::bpchar]))); -- @@ -4526,6 +4393,48 @@ CREATE SEQUENCE public.msip_bitacora_id_seq ALTER SEQUENCE public.msip_bitacora_id_seq OWNED BY public.msip_bitacora.id; +-- +-- Name: msip_centropoblado_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.msip_centropoblado_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: msip_centropoblado; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.msip_centropoblado ( + cplocal_cod integer, + tcentropoblado_id character varying(10) DEFAULT 'CP'::character varying NOT NULL, + nombre character varying(500) COLLATE public.es_co_utf_8, + fechacreacion date DEFAULT '2001-01-01'::date NOT NULL, + fechadeshabilitacion date, + latitud double precision, + longitud double precision, + created_at timestamp without time zone, + updated_at timestamp without time zone, + municipio_id integer, + id integer DEFAULT nextval('public.msip_centropoblado_id_seq'::regclass) NOT NULL, + observaciones character varying(5000) COLLATE public.es_co_utf_8, + ultvigenciaini date, + ultvigenciafin date, + svgruta character varying, + svgcdx integer, + svgcdy integer, + svgcdancho integer, + svgcdalto integer, + svgrotx double precision, + svgroty double precision, + CONSTRAINT msip_centropoblado_check CHECK (((fechadeshabilitacion IS NULL) OR (fechadeshabilitacion >= fechacreacion))) +); + + -- -- Name: msip_centropoblado_histvigencia; Type: TABLE; Schema: public; Owner: - -- @@ -4848,6 +4757,49 @@ CREATE SEQUENCE public.msip_homonimo_id_seq ALTER SEQUENCE public.msip_homonimo_id_seq OWNED BY public.msip_homonimo.id; +-- +-- Name: msip_municipio_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.msip_municipio_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: msip_municipio; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.msip_municipio ( + munlocal_cod integer, + nombre character varying(500) COLLATE public.es_co_utf_8, + fechacreacion date DEFAULT CURRENT_DATE NOT NULL, + fechadeshabilitacion date, + latitud double precision, + longitud double precision, + created_at timestamp without time zone, + updated_at timestamp without time zone, + departamento_id integer, + id integer DEFAULT nextval('public.msip_municipio_id_seq'::regclass) NOT NULL, + observaciones character varying(5000) COLLATE public.es_co_utf_8, + codreg integer, + ultvigenciaini date, + ultvigenciafin date, + tipomun character varying(32), + svgruta character varying, + svgcdx integer, + svgcdy integer, + svgcdancho integer, + svgcdalto integer, + svgrotx double precision, + svgroty double precision, + CONSTRAINT municipio_check CHECK (((fechadeshabilitacion IS NULL) OR (fechadeshabilitacion >= fechacreacion))) +); + + -- -- Name: msip_mundep_sinorden; Type: VIEW; Schema: public; Owner: - -- @@ -6138,42 +6090,6 @@ CREATE MATERIALIZED VIEW public.sivel2_gen_conscaso AS WITH NO DATA; --- --- Name: sivel2_gen_consexpcaso; Type: MATERIALIZED VIEW; Schema: public; Owner: - --- - -CREATE MATERIALIZED VIEW public.sivel2_gen_consexpcaso AS - SELECT conscaso.caso_id, - conscaso.fecha, - conscaso.memo, - conscaso.ubicaciones, - conscaso.victimas, - conscaso.presponsables, - conscaso.tipificacion, - conscaso.ultimo_refresco, - conscaso.q, - caso.titulo, - caso.hora, - caso.duracion, - caso.grconfiabilidad, - caso.gresclarecimiento, - caso.grimpunidad, - caso.grinformacion, - caso.bienes, - caso.intervalo_id, - caso.created_at, - caso.updated_at - FROM (public.sivel2_gen_conscaso conscaso - JOIN public.sivel2_gen_caso caso ON ((caso.id = conscaso.caso_id))) - WHERE (conscaso.caso_id IN ( SELECT sivel2_gen_conscaso.caso_id - FROM public.sivel2_gen_conscaso - WHERE ((sivel2_gen_conscaso.caso_id IN ( SELECT sivel2_gen_caso.id - FROM public.sivel2_gen_caso)) AND (sivel2_gen_conscaso.fecha >= '2013-01-01'::date) AND (sivel2_gen_conscaso.fecha <= '2013-12-31'::date)) - ORDER BY sivel2_gen_conscaso.fecha, sivel2_gen_conscaso.caso_id)) - ORDER BY conscaso.fecha, conscaso.caso_id - WITH NO DATA; - - -- -- Name: sivel2_gen_contexto_id_seq; Type: SEQUENCE; Schema: public; Owner: - --