--
-- PostgreSQL database dump
--

-- Dumped from database version 9.6.9
-- Dumped by pg_dump version 9.6.9

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: report_patient; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.report_patient (
    id integer NOT NULL,
    patient_full_name character varying(300) NOT NULL,
    patient_cc character varying(50) NOT NULL
);


ALTER TABLE public.report_patient OWNER TO postgres;

--
-- Name: TABLE report_patient; Type: COMMENT; Schema: public; Owner: postgres
--

COMMENT ON TABLE public.report_patient IS 'Tabla con la lista de paciente para la vista de reportes';


--
-- Name: COLUMN report_patient.id; Type: COMMENT; Schema: public; Owner: postgres
--

COMMENT ON COLUMN public.report_patient.id IS 'Identificador de la tabla';


--
-- Name: COLUMN report_patient.patient_full_name; Type: COMMENT; Schema: public; Owner: postgres
--

COMMENT ON COLUMN public.report_patient.patient_full_name IS 'Columna con el nombre del paciente';


--
-- Name: COLUMN report_patient.patient_cc; Type: COMMENT; Schema: public; Owner: postgres
--

COMMENT ON COLUMN public.report_patient.patient_cc IS 'Numero de identificacion del paciente';


--
-- Name: report_patient_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.report_patient_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.report_patient_id_seq OWNER TO postgres;

--
-- Name: report_patient_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.report_patient_id_seq OWNED BY public.report_patient.id;


--
-- Name: report_study; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.report_study (
    id integer NOT NULL,
    patient_id integer NOT NULL,
    study_rp_code character varying(50),
    study_description character varying(300),
    study_report character varying(100) NOT NULL,
    study_date date NOT NULL
);


ALTER TABLE public.report_study OWNER TO postgres;

--
-- Name: TABLE report_study; Type: COMMENT; Schema: public; Owner: postgres
--

COMMENT ON TABLE public.report_study IS 'Tabla con la informacion de los reportes';


--
-- Name: COLUMN report_study.id; Type: COMMENT; Schema: public; Owner: postgres
--

COMMENT ON COLUMN public.report_study.id IS 'Identificador del usuario';


--
-- Name: COLUMN report_study.patient_id; Type: COMMENT; Schema: public; Owner: postgres
--

COMMENT ON COLUMN public.report_study.patient_id IS 'Identificacion del paciente relacionado con la tabla report_patient';


--
-- Name: COLUMN report_study.study_rp_code; Type: COMMENT; Schema: public; Owner: postgres
--

COMMENT ON COLUMN public.report_study.study_rp_code IS 'Columna con el codigo del estudio';


--
-- Name: COLUMN report_study.study_description; Type: COMMENT; Schema: public; Owner: postgres
--

COMMENT ON COLUMN public.report_study.study_description IS 'Campo con la descripcion del estudio';


--
-- Name: COLUMN report_study.study_report; Type: COMMENT; Schema: public; Owner: postgres
--

COMMENT ON COLUMN public.report_study.study_report IS 'Nombre del reporte';


--
-- Name: COLUMN report_study.study_date; Type: COMMENT; Schema: public; Owner: postgres
--

COMMENT ON COLUMN public.report_study.study_date IS 'Fecha del reporte';


--
-- Name: report_study_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE public.report_study_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.report_study_id_seq OWNER TO postgres;

--
-- Name: report_study_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.report_study_id_seq OWNED BY public.report_study.id;


--
-- Name: report_patient id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.report_patient ALTER COLUMN id SET DEFAULT nextval('public.report_patient_id_seq'::regclass);


--
-- Name: report_study id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.report_study ALTER COLUMN id SET DEFAULT nextval('public.report_study_id_seq'::regclass);


--
-- Name: report_patient report_patient_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.report_patient
    ADD CONSTRAINT report_patient_pkey PRIMARY KEY (id);


--
-- Name: report_study report_study_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.report_study
    ADD CONSTRAINT report_study_pkey PRIMARY KEY (id);


--
-- Name: report_patient_search; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX report_patient_search ON public.report_patient USING gin (to_tsvector('simple'::regconfig, (((patient_full_name)::text || ' '::text) || (patient_cc)::text)));


--
-- Name: report_study report_patient_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.report_study
    ADD CONSTRAINT report_patient_id FOREIGN KEY (patient_id) REFERENCES public.report_patient(id);


--
-- PostgreSQL database dump complete
--

