Descargar como pdf o txt
Descargar como pdf o txt
Está en la página 1de 28

BASE DE DATOS II

Esneyder Mora Salcedo - H1

David Dueñas Torres - J1

5) Suponga que un paciente ingresa tres veces al hospital el mismo mes,


responda a la pregunta y muestre con datos ¿cómo registraría cada
ingreso y salida del paciente en base de datos?

• Gracias a mi base de datos se realizaría por medio desde la tabla registro en


donde se almacenan los datos de numero de documento, la fecha de entrada que
es obligatoria y la de salida que es opcional y se da a entender si este campo está
vacío es que no ha salido del hospital. Por otra parte, con la relación de unos a
muchos, un paciente puede tener varios registros y un registro solo puede
pertenecer a un paciente.

6) Ahora es importante ampliar el modelo para incluir áreas del hospital, por
ejemplo, urgencias, zona de hospitalización, área de atención prenatal,
área infantil. De manera que según el cuarto donde se encuentra internado
el paciente se pueda determinar el área del hospital en el que se encuentra,
realice los cambios/actualizaciones necesarias en su modelo,
impleméntelas y documente un ejemplo.

Primero, observamos que en base al modelo de base de datos como se muestra en la


siguiente imagen:
Después, se muestra la tabla en donde cada cuarto pertenece a un
áreaespecífica como esta en la imagen:

7) El hospital requiere que un api web pueda consultar una parte de la


informaciónde los usuarios que se encuentran registrados en el hospital,
solamente debe poder verse el nombre, el tipo de sangre y la fecha de
ingreso y la cama únicamente de los pacientes que se encuentren internados
en el hospital “es decir los que ya fueron de alta no se deben incluir”, para
esto implemente una tabla dinámica que permita obtener esta información.

Link del drive con los archivos:

https://drive.google.com/drive/folders/15RxIQqYzGViBUNWXJ072iqyhm1pEAcEM?usp=sharing

Adicionalmente copio los códigos :


Consultas:

Script-16

select p.numero_de_identificacion, p.nombre, p.apellidos


,p.tipo_de_documento,p.fecha_de_nacimiento ,p.eps,p.estado, tds.nombre as
sangre from paciente p, tipo_de_sangre tds where p.id_tipodesangre =
tds.id_tipodesangre ;

select count(*) from paciente p2;

select nombre, eps from paciente p where eps='Medimas'

select count(*) from paciente p,tipo_de_sangre tds where


p.id_tipodesangre=tds.id_tipodesangre and tds.nombre= 'A +';
select count(*) from paciente p,tipo_de_sangre tds where
p.id_tipodesangre=tds.id_tipodesangre and tds.nombre='A -';
select count(*) from paciente p,tipo_de_sangre tds where
p.id_tipodesangre=tds.id_tipodesangre and tds.nombre='B +';
select count(*) from paciente p,tipo_de_sangre tds where
p.id_tipodesangre=tds.id_tipodesangre and tds.nombre='B -';
select count(*) from paciente p,tipo_de_sangre tds where
p.id_tipodesangre=tds.id_tipodesangre and tds.nombre='AB +';
select count(*) from paciente p,tipo_de_sangre tds where
p.id_tipodesangre=tds.id_tipodesangre and tds.nombre='AB -';
select count(*) from paciente p,tipo_de_sangre tds where
p.id_tipodesangre=tds.id_tipodesangre and tds.nombre='O +';
select count(*) from paciente p,tipo_de_sangre tds where
p.id_tipodesangre=tds.id_tipodesangre and tds.nombre='O -';

select p.nombre,r.fecha_de_ingreso from paciente p,registro r where


p.numero_de_identificacion=r.numero_de_identificacion and
r.fecha_de_ingreso = '2008/12/31 13:00:00';

select p.nombre , r.idcama from paciente p, registro r where


p.numero_de_identificacion= r.numero_de_identificacion
Base de datos:

dump-fckstort-202211291743

--
-- PostgreSQL database dump
--

-- Dumped from database version 13.8 (Ubuntu 13.8-1.pgdg20.04+1)


-- Dumped by pg_dump version 14.4

-- Started on 2022-11-29 17:43:47

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 xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

--
-- TOC entry 24 (class 2615 OID 2200)
-- Name: public; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA public;

ALTER SCHEMA public OWNER TO postgres;

--
-- TOC entry 4198 (class 0 OID 0)
-- Dependencies: 24
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
--

COMMENT ON SCHEMA public IS 'standard public schema';


--
-- TOC entry 980 (class 1255 OID 828947)
-- Name: crear_fecha_salida(); Type: FUNCTION; Schema: public; Owner:
fckstort
--

CREATE FUNCTION public.crear_fecha_salida() RETURNS trigger


LANGUAGE plpgsql
AS $$
begin

INSERT INTO public.fecha_de_egreso (idfechadeegreso,


hora_de_egreso)
VALUES(new.idfechadeegreso,new.hora_de_egreso);
return new;
end
$$;

ALTER FUNCTION public.crear_fecha_salida() OWNER TO fckstort;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- TOC entry 227 (class 1259 OID 733492)
-- Name: alergia; Type: TABLE; Schema: public; Owner: fckstort
--

CREATE TABLE public.alergia (


idalergia integer NOT NULL,
nombre character varying(50)
);

ALTER TABLE public.alergia OWNER TO fckstort;

--
-- TOC entry 226 (class 1259 OID 733490)
-- Name: alergia_idalergia_seq; Type: SEQUENCE; Schema: public; Owner:
fckstort
--

CREATE SEQUENCE public.alergia_idalergia_seq


AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER TABLE public.alergia_idalergia_seq OWNER TO fckstort;

--
-- TOC entry 4199 (class 0 OID 0)
-- Dependencies: 226
-- Name: alergia_idalergia_seq; Type: SEQUENCE OWNED BY; Schema: public;
Owner: fckstort
--

ALTER SEQUENCE public.alergia_idalergia_seq OWNED BY


public.alergia.idalergia;

--
-- TOC entry 235 (class 1259 OID 759213)
-- Name: alergia_paciente; Type: TABLE; Schema: public; Owner: fckstort
--

CREATE TABLE public.alergia_paciente (


numero_de_identificacion integer NOT NULL,
idalergia integer NOT NULL
);

ALTER TABLE public.alergia_paciente OWNER TO fckstort;

--
-- TOC entry 234 (class 1259 OID 759211)
-- Name: alergia_paciente_idalergia_seq; Type: SEQUENCE; Schema: public;
Owner: fckstort
--

CREATE SEQUENCE public.alergia_paciente_idalergia_seq


AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER TABLE public.alergia_paciente_idalergia_seq OWNER TO fckstort;

--
-- TOC entry 4200 (class 0 OID 0)
-- Dependencies: 234
-- Name: alergia_paciente_idalergia_seq; Type: SEQUENCE OWNED BY; Schema:
public; Owner: fckstort
--

ALTER SEQUENCE public.alergia_paciente_idalergia_seq OWNED BY


public.alergia_paciente.idalergia;

--
-- TOC entry 233 (class 1259 OID 759209)
-- Name: alergia_paciente_numero_de_identificacion_seq; Type: SEQUENCE;
Schema: public; Owner: fckstort
--

CREATE SEQUENCE public.alergia_paciente_numero_de_identificacion_seq


AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER TABLE public.alergia_paciente_numero_de_identificacion_seq OWNER TO


fckstort;

--
-- TOC entry 4201 (class 0 OID 0)
-- Dependencies: 233
-- Name: alergia_paciente_numero_de_identificacion_seq; Type: SEQUENCE OWNED
BY; Schema: public; Owner: fckstort
--

ALTER SEQUENCE public.alergia_paciente_numero_de_identificacion_seq OWNED BY


public.alergia_paciente.numero_de_identificacion;

--
-- TOC entry 237 (class 1259 OID 831310)
-- Name: area_del_hospital; Type: TABLE; Schema: public; Owner: fckstort
--

CREATE TABLE public.area_del_hospital (


idareahospital integer NOT NULL,
nombre character varying(25)
);

ALTER TABLE public.area_del_hospital OWNER TO fckstort;

--
-- TOC entry 236 (class 1259 OID 831308)
-- Name: area_del_hospital_idareahospital_seq; Type: SEQUENCE; Schema:
public; Owner: fckstort
--

CREATE SEQUENCE public.area_del_hospital_idareahospital_seq


AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER TABLE public.area_del_hospital_idareahospital_seq OWNER TO fckstort;

--
-- TOC entry 4202 (class 0 OID 0)
-- Dependencies: 236
-- Name: area_del_hospital_idareahospital_seq; Type: SEQUENCE OWNED BY;
Schema: public; Owner: fckstort
--

ALTER SEQUENCE public.area_del_hospital_idareahospital_seq OWNED BY


public.area_del_hospital.idareahospital;

--
-- TOC entry 243 (class 1259 OID 831551)
-- Name: cama; Type: TABLE; Schema: public; Owner: fckstort
--

CREATE TABLE public.cama (


idcama integer NOT NULL,
etiqueta character varying(20),
idcuarto integer NOT NULL
);

ALTER TABLE public.cama OWNER TO fckstort;

--
-- TOC entry 241 (class 1259 OID 831545)
-- Name: cama_idcama_seq; Type: SEQUENCE; Schema: public; Owner: fckstort
--

CREATE SEQUENCE public.cama_idcama_seq


AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER TABLE public.cama_idcama_seq OWNER TO fckstort;

--
-- TOC entry 4203 (class 0 OID 0)
-- Dependencies: 241
-- Name: cama_idcama_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner:
fckstort
--

ALTER SEQUENCE public.cama_idcama_seq OWNED BY public.cama.idcama;

--
-- TOC entry 242 (class 1259 OID 831547)
-- Name: cama_idcuarto_seq; Type: SEQUENCE; Schema: public; Owner: fckstort
--

CREATE SEQUENCE public.cama_idcuarto_seq


AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.cama_idcuarto_seq OWNER TO fckstort;

--
-- TOC entry 4204 (class 0 OID 0)
-- Dependencies: 242
-- Name: cama_idcuarto_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner:
fckstort
--

ALTER SEQUENCE public.cama_idcuarto_seq OWNED BY public.cama.idcuarto;

--
-- TOC entry 240 (class 1259 OID 831338)
-- Name: cuarto; Type: TABLE; Schema: public; Owner: fckstort
--

CREATE TABLE public.cuarto (


idcuarto integer NOT NULL,
idareahospital integer NOT NULL
);

ALTER TABLE public.cuarto OWNER TO fckstort;

--
-- TOC entry 239 (class 1259 OID 831336)
-- Name: cuarto_idareahospital_seq; Type: SEQUENCE; Schema: public; Owner:
fckstort
--

CREATE SEQUENCE public.cuarto_idareahospital_seq


AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER TABLE public.cuarto_idareahospital_seq OWNER TO fckstort;

--
-- TOC entry 4205 (class 0 OID 0)
-- Dependencies: 239
-- Name: cuarto_idareahospital_seq; Type: SEQUENCE OWNED BY; Schema: public;
Owner: fckstort
--

ALTER SEQUENCE public.cuarto_idareahospital_seq OWNED BY


public.cuarto.idareahospital;

--
-- TOC entry 238 (class 1259 OID 831334)
-- Name: cuarto_idcuarto_seq; Type: SEQUENCE; Schema: public; Owner:
fckstort
--

CREATE SEQUENCE public.cuarto_idcuarto_seq


AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER TABLE public.cuarto_idcuarto_seq OWNER TO fckstort;

--
-- TOC entry 4206 (class 0 OID 0)
-- Dependencies: 238
-- Name: cuarto_idcuarto_seq; Type: SEQUENCE OWNED BY; Schema: public;
Owner: fckstort
--

ALTER SEQUENCE public.cuarto_idcuarto_seq OWNED BY public.cuarto.idcuarto;

--
-- TOC entry 232 (class 1259 OID 759071)
-- Name: paciente; Type: TABLE; Schema: public; Owner: fckstort
--

CREATE TABLE public.paciente (


numero_de_identificacion integer NOT NULL,
nombre character varying(255) NOT NULL,
apellidos character varying(70) NOT NULL,
tipo_de_documento character varying(50) NOT NULL,
fecha_de_nacimiento date NOT NULL,
id_tipodesangre integer NOT NULL,
eps character varying(20) NOT NULL,
estado character varying(10)
);

ALTER TABLE public.paciente OWNER TO fckstort;

--
-- TOC entry 246 (class 1259 OID 1523014)
-- Name: registro; Type: TABLE; Schema: public; Owner: fckstort
--

CREATE TABLE public.registro (


numero_de_identificacion integer NOT NULL,
fecha_de_ingreso timestamp with time zone,
fecha_de_egreso timestamp with time zone,
idcama integer NOT NULL
);

ALTER TABLE public.registro OWNER TO fckstort;

--
-- TOC entry 229 (class 1259 OID 758956)
-- Name: tipo_de_sangre; Type: TABLE; Schema: public; Owner: fckstort
--

CREATE TABLE public.tipo_de_sangre (


id_tipodesangre integer NOT NULL,
nombre character varying(5)
);

ALTER TABLE public.tipo_de_sangre OWNER TO fckstort;

--
-- TOC entry 247 (class 1259 OID 1534474)
-- Name: datos_pacientes_actuales_view; Type: VIEW; Schema: public; Owner:
fckstort
--

CREATE VIEW public.datos_pacientes_actuales_view AS


SELECT p.nombre,
tds.nombre AS tipo_de_sangre,
r.fecha_de_ingreso,
r.idcama
FROM public.paciente p,
public.registro r,
public.cama c,
public.tipo_de_sangre tds
WHERE ((p.numero_de_identificacion = r.numero_de_identificacion) AND
(p.id_tipodesangre = tds.id_tipodesangre) AND (c.idcama = r.idcama) AND
(r.fecha_de_egreso = NULL::timestamp with time zone));

ALTER TABLE public.datos_pacientes_actuales_view OWNER TO fckstort;

--
-- TOC entry 231 (class 1259 OID 759069)
-- Name: paciente_id_tipodesangre_seq; Type: SEQUENCE; Schema: public;
Owner: fckstort
--

CREATE SEQUENCE public.paciente_id_tipodesangre_seq


AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER TABLE public.paciente_id_tipodesangre_seq OWNER TO fckstort;

--
-- TOC entry 4207 (class 0 OID 0)
-- Dependencies: 231
-- Name: paciente_id_tipodesangre_seq; Type: SEQUENCE OWNED BY; Schema:
public; Owner: fckstort
--

ALTER SEQUENCE public.paciente_id_tipodesangre_seq OWNED BY


public.paciente.id_tipodesangre;

--
-- TOC entry 230 (class 1259 OID 759067)
-- Name: paciente_numero_de_identificacion_seq; Type: SEQUENCE; Schema:
public; Owner: fckstort
--
CREATE SEQUENCE public.paciente_numero_de_identificacion_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER TABLE public.paciente_numero_de_identificacion_seq OWNER TO fckstort;

--
-- TOC entry 4208 (class 0 OID 0)
-- Dependencies: 230
-- Name: paciente_numero_de_identificacion_seq; Type: SEQUENCE OWNED BY;
Schema: public; Owner: fckstort
--

ALTER SEQUENCE public.paciente_numero_de_identificacion_seq OWNED BY


public.paciente.numero_de_identificacion;

--
-- TOC entry 245 (class 1259 OID 1523012)
-- Name: registro_idcama_seq; Type: SEQUENCE; Schema: public; Owner:
fckstort
--

CREATE SEQUENCE public.registro_idcama_seq


AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER TABLE public.registro_idcama_seq OWNER TO fckstort;

--
-- TOC entry 4209 (class 0 OID 0)
-- Dependencies: 245
-- Name: registro_idcama_seq; Type: SEQUENCE OWNED BY; Schema: public;
Owner: fckstort
--
ALTER SEQUENCE public.registro_idcama_seq OWNED BY public.registro.idcama;

--
-- TOC entry 244 (class 1259 OID 1523010)
-- Name: registro_numero_de_identificacion_seq; Type: SEQUENCE; Schema:
public; Owner: fckstort
--

CREATE SEQUENCE public.registro_numero_de_identificacion_seq


AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER TABLE public.registro_numero_de_identificacion_seq OWNER TO fckstort;

--
-- TOC entry 4210 (class 0 OID 0)
-- Dependencies: 244
-- Name: registro_numero_de_identificacion_seq; Type: SEQUENCE OWNED BY;
Schema: public; Owner: fckstort
--

ALTER SEQUENCE public.registro_numero_de_identificacion_seq OWNED BY


public.registro.numero_de_identificacion;

--
-- TOC entry 228 (class 1259 OID 758954)
-- Name: tipo_de_sangre_id_tipodesangre_seq; Type: SEQUENCE; Schema: public;
Owner: fckstort
--

CREATE SEQUENCE public.tipo_de_sangre_id_tipodesangre_seq


AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.tipo_de_sangre_id_tipodesangre_seq OWNER TO fckstort;

--
-- TOC entry 4211 (class 0 OID 0)
-- Dependencies: 228
-- Name: tipo_de_sangre_id_tipodesangre_seq; Type: SEQUENCE OWNED BY;
Schema: public; Owner: fckstort
--

ALTER SEQUENCE public.tipo_de_sangre_id_tipodesangre_seq OWNED BY


public.tipo_de_sangre.id_tipodesangre;

--
-- TOC entry 4006 (class 2604 OID 733495)
-- Name: alergia idalergia; Type: DEFAULT; Schema: public; Owner: fckstort
--

ALTER TABLE ONLY public.alergia ALTER COLUMN idalergia SET DEFAULT


nextval('public.alergia_idalergia_seq'::regclass);

--
-- TOC entry 4010 (class 2604 OID 759216)
-- Name: alergia_paciente numero_de_identificacion; Type: DEFAULT; Schema:
public; Owner: fckstort
--

ALTER TABLE ONLY public.alergia_paciente ALTER COLUMN


numero_de_identificacion SET DEFAULT
nextval('public.alergia_paciente_numero_de_identificacion_seq'::regclass);

--
-- TOC entry 4011 (class 2604 OID 759217)
-- Name: alergia_paciente idalergia; Type: DEFAULT; Schema: public; Owner:
fckstort
--

ALTER TABLE ONLY public.alergia_paciente ALTER COLUMN idalergia SET DEFAULT


nextval('public.alergia_paciente_idalergia_seq'::regclass);

--
-- TOC entry 4012 (class 2604 OID 831313)
-- Name: area_del_hospital idareahospital; Type: DEFAULT; Schema: public;
Owner: fckstort
--

ALTER TABLE ONLY public.area_del_hospital ALTER COLUMN idareahospital SET


DEFAULT nextval('public.area_del_hospital_idareahospital_seq'::regclass);

--
-- TOC entry 4015 (class 2604 OID 831554)
-- Name: cama idcama; Type: DEFAULT; Schema: public; Owner: fckstort
--

ALTER TABLE ONLY public.cama ALTER COLUMN idcama SET DEFAULT


nextval('public.cama_idcama_seq'::regclass);

--
-- TOC entry 4016 (class 2604 OID 831555)
-- Name: cama idcuarto; Type: DEFAULT; Schema: public; Owner: fckstort
--

ALTER TABLE ONLY public.cama ALTER COLUMN idcuarto SET DEFAULT


nextval('public.cama_idcuarto_seq'::regclass);

--
-- TOC entry 4013 (class 2604 OID 831341)
-- Name: cuarto idcuarto; Type: DEFAULT; Schema: public; Owner: fckstort
--

ALTER TABLE ONLY public.cuarto ALTER COLUMN idcuarto SET DEFAULT


nextval('public.cuarto_idcuarto_seq'::regclass);

--
-- TOC entry 4014 (class 2604 OID 831342)
-- Name: cuarto idareahospital; Type: DEFAULT; Schema: public; Owner:
fckstort
--

ALTER TABLE ONLY public.cuarto ALTER COLUMN idareahospital SET DEFAULT


nextval('public.cuarto_idareahospital_seq'::regclass);

--
-- TOC entry 4008 (class 2604 OID 759074)
-- Name: paciente numero_de_identificacion; Type: DEFAULT; Schema: public;
Owner: fckstort
--

ALTER TABLE ONLY public.paciente ALTER COLUMN numero_de_identificacion SET


DEFAULT nextval('public.paciente_numero_de_identificacion_seq'::regclass);

--
-- TOC entry 4009 (class 2604 OID 759075)
-- Name: paciente id_tipodesangre; Type: DEFAULT; Schema: public; Owner:
fckstort
--

ALTER TABLE ONLY public.paciente ALTER COLUMN id_tipodesangre SET DEFAULT


nextval('public.paciente_id_tipodesangre_seq'::regclass);

--
-- TOC entry 4017 (class 2604 OID 1523017)
-- Name: registro numero_de_identificacion; Type: DEFAULT; Schema: public;
Owner: fckstort
--

ALTER TABLE ONLY public.registro ALTER COLUMN numero_de_identificacion SET


DEFAULT nextval('public.registro_numero_de_identificacion_seq'::regclass);

--
-- TOC entry 4018 (class 2604 OID 1523018)
-- Name: registro idcama; Type: DEFAULT; Schema: public; Owner: fckstort
--

ALTER TABLE ONLY public.registro ALTER COLUMN idcama SET DEFAULT


nextval('public.registro_idcama_seq'::regclass);

--
-- TOC entry 4007 (class 2604 OID 758959)
-- Name: tipo_de_sangre id_tipodesangre; Type: DEFAULT; Schema: public;
Owner: fckstort
--

ALTER TABLE ONLY public.tipo_de_sangre ALTER COLUMN id_tipodesangre SET


DEFAULT nextval('public.tipo_de_sangre_id_tipodesangre_seq'::regclass);
--
-- TOC entry 4173 (class 0 OID 733492)
-- Dependencies: 227
-- Data for Name: alergia; Type: TABLE DATA; Schema: public; Owner: fckstort
--

COPY public.alergia (idalergia, nombre) FROM stdin;


21 Dermatitis atópica
22 Poliposis nasal
23 Rinitis alérgica
24 Urticaria crónica
\.

--
-- TOC entry 4181 (class 0 OID 759213)
-- Dependencies: 235
-- Data for Name: alergia_paciente; Type: TABLE DATA; Schema: public; Owner:
fckstort
--

COPY public.alergia_paciente (numero_de_identificacion, idalergia) FROM


stdin;
367359 21
687107 22
704358 23
765908 24
\.

--
-- TOC entry 4183 (class 0 OID 831310)
-- Dependencies: 237
-- Data for Name: area_del_hospital; Type: TABLE DATA; Schema: public;
Owner: fckstort
--

COPY public.area_del_hospital (idareahospital, nombre) FROM stdin;


100 Urgencias
101 Zona de hospitalizacion
102 atención prenatal
103 Area infantil
\.
--
-- TOC entry 4189 (class 0 OID 831551)
-- Dependencies: 243
-- Data for Name: cama; Type: TABLE DATA; Schema: public; Owner: fckstort
--

COPY public.cama (idcama, etiqueta, idcuarto) FROM stdin;


456552 A 1
5221 A 2
1256 B 3
4589 A 4
4580 B 4
1000 A 5
1001 B 5
1002 A 6
1003 B 7
1004 B 8
1005 B 9
1006 B 10
1007 A 11
1008 A 12
\.

--
-- TOC entry 4186 (class 0 OID 831338)
-- Dependencies: 240
-- Data for Name: cuarto; Type: TABLE DATA; Schema: public; Owner: fckstort
--

COPY public.cuarto (idcuarto, idareahospital) FROM stdin;


1 100
2 101
3 102
4 103
5 100
6 100
7 100
8 100
9 100
10 100
11 100
12 100
\.
--
-- TOC entry 4178 (class 0 OID 759071)
-- Dependencies: 232
-- Data for Name: paciente; Type: TABLE DATA; Schema: public; Owner:
fckstort
--

COPY public.paciente (numero_de_identificacion, nombre, apellidos,


tipo_de_documento, fecha_de_nacimiento, id_tipodesangre, eps, estado) FROM
stdin;
687107 Danny Eastabrook visa 2022-02-04 1 Salud total casado(a)
367359 Cally Micklewicz tarjeta de identidad 2021-12-21 2 Medimas
casado(a)
704358 Adolf Rois tarjeta de identidad 2022-09-24 3 Medimas
casado(a)
765908 Vin Kopta cedula 2021-11-06 4 Medimas soltero(a)
887128 Salome Skrzynski cedula 2022-07-18 5 Salud total soltero(a)
450914 Oralee Dineen visa 2022-10-29 6 Medimas soltero(a)
477029 Romeo de Quincey cedula 2022-06-20 7 Salud total casado(a)
481050 Asa MacCaughey visa 2022-03-13 8 Medimas casado(a)
192282 Katharine Padefield visa 2022-01-26 1 Medimas soltero(a)
906005 Niels Gillard visa 2022-01-14 2 Medimas soltero(a)
797570 Trip Danjoie tarjeta de identidad 2022-01-22 3 Salud total
casado(a)
837003 Tabbatha Boutton visa 2022-05-04 4 Salud total soltero(a)
777086 Fabiano Sylvaine cedula 2021-11-13 5 Medimas soltero(a)
931005 Corrinne Goburn tarjeta de identidad 2022-01-01 6 Salud
total soltero(a)
\.

--
-- TOC entry 4192 (class 0 OID 1523014)
-- Dependencies: 246
-- Data for Name: registro; Type: TABLE DATA; Schema: public; Owner:
fckstort
--

COPY public.registro (numero_de_identificacion, fecha_de_ingreso,


fecha_de_egreso, idcama) FROM stdin;
687107 2008-12-31 18:00:00+00 2009-02-25 18:00:00+00 456552
367359 2008-12-31 18:00:00+00 2021-10-01 18:00:00+00 5221
765908 2021-09-30 18:00:00+00 2022-11-01 18:00:00+00 4589
481050 2022-10-31 18:00:00+00 \N 1000
837003 2022-10-31 18:00:00+00 \N 1001
\.

--
-- TOC entry 4175 (class 0 OID 758956)
-- Dependencies: 229
-- Data for Name: tipo_de_sangre; Type: TABLE DATA; Schema: public; Owner:
fckstort
--

COPY public.tipo_de_sangre (id_tipodesangre, nombre) FROM stdin;


1 A +
2 A -
3 B +
4 B -
5 AB +
6 AB -
7 O +
8 O -
\.

--
-- TOC entry 4212 (class 0 OID 0)
-- Dependencies: 226
-- Name: alergia_idalergia_seq; Type: SEQUENCE SET; Schema: public; Owner:
fckstort
--

SELECT pg_catalog.setval('public.alergia_idalergia_seq', 1, false);

--
-- TOC entry 4213 (class 0 OID 0)
-- Dependencies: 234
-- Name: alergia_paciente_idalergia_seq; Type: SEQUENCE SET; Schema: public;
Owner: fckstort
--

SELECT pg_catalog.setval('public.alergia_paciente_idalergia_seq', 1, false);

--
-- TOC entry 4214 (class 0 OID 0)
-- Dependencies: 233
-- Name: alergia_paciente_numero_de_identificacion_seq; Type: SEQUENCE SET;
Schema: public; Owner: fckstort
--

SELECT
pg_catalog.setval('public.alergia_paciente_numero_de_identificacion_seq', 1,
false);

--
-- TOC entry 4215 (class 0 OID 0)
-- Dependencies: 236
-- Name: area_del_hospital_idareahospital_seq; Type: SEQUENCE SET; Schema:
public; Owner: fckstort
--

SELECT pg_catalog.setval('public.area_del_hospital_idareahospital_seq', 1,
false);

--
-- TOC entry 4216 (class 0 OID 0)
-- Dependencies: 241
-- Name: cama_idcama_seq; Type: SEQUENCE SET; Schema: public; Owner:
fckstort
--

SELECT pg_catalog.setval('public.cama_idcama_seq', 1, false);

--
-- TOC entry 4217 (class 0 OID 0)
-- Dependencies: 242
-- Name: cama_idcuarto_seq; Type: SEQUENCE SET; Schema: public; Owner:
fckstort
--

SELECT pg_catalog.setval('public.cama_idcuarto_seq', 1, false);

--
-- TOC entry 4218 (class 0 OID 0)
-- Dependencies: 239
-- Name: cuarto_idareahospital_seq; Type: SEQUENCE SET; Schema: public;
Owner: fckstort
--
SELECT pg_catalog.setval('public.cuarto_idareahospital_seq', 1, false);

--
-- TOC entry 4219 (class 0 OID 0)
-- Dependencies: 238
-- Name: cuarto_idcuarto_seq; Type: SEQUENCE SET; Schema: public; Owner:
fckstort
--

SELECT pg_catalog.setval('public.cuarto_idcuarto_seq', 1, false);

--
-- TOC entry 4220 (class 0 OID 0)
-- Dependencies: 231
-- Name: paciente_id_tipodesangre_seq; Type: SEQUENCE SET; Schema: public;
Owner: fckstort
--

SELECT pg_catalog.setval('public.paciente_id_tipodesangre_seq', 1, false);

--
-- TOC entry 4221 (class 0 OID 0)
-- Dependencies: 230
-- Name: paciente_numero_de_identificacion_seq; Type: SEQUENCE SET; Schema:
public; Owner: fckstort
--

SELECT pg_catalog.setval('public.paciente_numero_de_identificacion_seq', 1,
false);

--
-- TOC entry 4222 (class 0 OID 0)
-- Dependencies: 245
-- Name: registro_idcama_seq; Type: SEQUENCE SET; Schema: public; Owner:
fckstort
--

SELECT pg_catalog.setval('public.registro_idcama_seq', 1, false);

--
-- TOC entry 4223 (class 0 OID 0)
-- Dependencies: 244
-- Name: registro_numero_de_identificacion_seq; Type: SEQUENCE SET; Schema:
public; Owner: fckstort
--

SELECT pg_catalog.setval('public.registro_numero_de_identificacion_seq', 1,
false);

--
-- TOC entry 4224 (class 0 OID 0)
-- Dependencies: 228
-- Name: tipo_de_sangre_id_tipodesangre_seq; Type: SEQUENCE SET; Schema:
public; Owner: fckstort
--

SELECT pg_catalog.setval('public.tipo_de_sangre_id_tipodesangre_seq', 1,
false);

--
-- TOC entry 4020 (class 2606 OID 733497)
-- Name: alergia alergia_pkey; Type: CONSTRAINT; Schema: public; Owner:
fckstort
--

ALTER TABLE ONLY public.alergia


ADD CONSTRAINT alergia_pkey PRIMARY KEY (idalergia);

--
-- TOC entry 4028 (class 2606 OID 831315)
-- Name: area_del_hospital area_del_hospital_pkey; Type: CONSTRAINT; Schema:
public; Owner: fckstort
--

ALTER TABLE ONLY public.area_del_hospital


ADD CONSTRAINT area_del_hospital_pkey PRIMARY KEY (idareahospital);

--
-- TOC entry 4032 (class 2606 OID 831558)
-- Name: cama cama_pkey; Type: CONSTRAINT; Schema: public; Owner: fckstort
--
ALTER TABLE ONLY public.cama
ADD CONSTRAINT cama_pkey PRIMARY KEY (idcama);

--
-- TOC entry 4030 (class 2606 OID 831344)
-- Name: cuarto cuarto_pkey; Type: CONSTRAINT; Schema: public; Owner:
fckstort
--

ALTER TABLE ONLY public.cuarto


ADD CONSTRAINT cuarto_pkey PRIMARY KEY (idcuarto);

--
-- TOC entry 4026 (class 2606 OID 759219)
-- Name: alergia_paciente numero_de_identificacion_idalergia_pk; Type:
CONSTRAINT; Schema: public; Owner: fckstort
--

ALTER TABLE ONLY public.alergia_paciente


ADD CONSTRAINT numero_de_identificacion_idalergia_pk PRIMARY KEY
(numero_de_identificacion, idalergia);

--
-- TOC entry 4024 (class 2606 OID 759077)
-- Name: paciente paciente_pkey; Type: CONSTRAINT; Schema: public; Owner:
fckstort
--

ALTER TABLE ONLY public.paciente


ADD CONSTRAINT paciente_pkey PRIMARY KEY (numero_de_identificacion);

--
-- TOC entry 4022 (class 2606 OID 758961)
-- Name: tipo_de_sangre tipo_de_sangre_pkey; Type: CONSTRAINT; Schema:
public; Owner: fckstort
--

ALTER TABLE ONLY public.tipo_de_sangre


ADD CONSTRAINT tipo_de_sangre_pkey PRIMARY KEY (id_tipodesangre);

--
-- TOC entry 4037 (class 2606 OID 831559)
-- Name: cama cama_idcuarto_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: fckstort
--

ALTER TABLE ONLY public.cama


ADD CONSTRAINT cama_idcuarto_fkey FOREIGN KEY (idcuarto) REFERENCES
public.cuarto(idcuarto);

--
-- TOC entry 4035 (class 2606 OID 759225)
-- Name: alergia_paciente idalergia_alergia_paciente_fkey; Type: FK
CONSTRAINT; Schema: public; Owner: fckstort
--

ALTER TABLE ONLY public.alergia_paciente


ADD CONSTRAINT idalergia_alergia_paciente_fkey FOREIGN KEY (idalergia)
REFERENCES public.alergia(idalergia);

--
-- TOC entry 4036 (class 2606 OID 831345)
-- Name: cuarto idareadelhospital_fkey; Type: FK CONSTRAINT; Schema: public;
Owner: fckstort
--

ALTER TABLE ONLY public.cuarto


ADD CONSTRAINT idareadelhospital_fkey FOREIGN KEY (idareahospital)
REFERENCES public.area_del_hospital(idareahospital);

--
-- TOC entry 4038 (class 2606 OID 1523019)
-- Name: registro idcama_fk; Type: FK CONSTRAINT; Schema: public; Owner:
fckstort
--

ALTER TABLE ONLY public.registro


ADD CONSTRAINT idcama_fk FOREIGN KEY (idcama) REFERENCES
public.cama(idcama);

--
-- TOC entry 4034 (class 2606 OID 759220)
-- Name: alergia_paciente numero_de_identificacion_alergia_paciente_fkey;
Type: FK CONSTRAINT; Schema: public; Owner: fckstort
--

ALTER TABLE ONLY public.alergia_paciente


ADD CONSTRAINT numero_de_identificacion_alergia_paciente_fkey FOREIGN
KEY (numero_de_identificacion) REFERENCES
public.paciente(numero_de_identificacion);

--
-- TOC entry 4039 (class 2606 OID 1523024)
-- Name: registro numero_de_identificacion_fk; Type: FK CONSTRAINT; Schema:
public; Owner: fckstort
--

ALTER TABLE ONLY public.registro


ADD CONSTRAINT numero_de_identificacion_fk FOREIGN KEY
(numero_de_identificacion) REFERENCES
public.paciente(numero_de_identificacion);

--
-- TOC entry 4033 (class 2606 OID 759078)
-- Name: paciente tipo_de_sangre_paciente_fkey; Type: FK CONSTRAINT; Schema:
public; Owner: fckstort
--

ALTER TABLE ONLY public.paciente


ADD CONSTRAINT tipo_de_sangre_paciente_fkey FOREIGN KEY
(id_tipodesangre) REFERENCES public.tipo_de_sangre(id_tipodesangre);

-- Completed on 2022-11-29 17:44:28

--
-- PostgreSQL database dump complete
--

También podría gustarte