--------------------------------------------
-- Populate Regiao
--------------------------------------------

insert into regiao values(1, 'Norte', 2000000);
insert into regiao values(2, 'Centro', 3000000);
insert into regiao values(3, 'Lisboa', 1500000);
insert into regiao values(4, 'Alentejo', 2500000);
insert into regiao values(5, 'Algarve', 1000000);

--------------------------------------------
-- Populate Concelho
--------------------------------------------

insert into concelho values(1, 'Lisboa', 3, 547733);
insert into concelho values(2, 'Sintra', 3, 377835);
insert into concelho values(3, 'Vila Nova de Gaia', 1, 302295);
insert into concelho values(4, 'Porto', 1, 237591);
insert into concelho values(5, 'Cascais', 3, 206479);
insert into concelho values(6, 'Loures', 3, 205054);
insert into concelho values(7, 'Braga', 1, 181494);
insert into concelho values(8, 'Matosinhos', 1, 175478);
insert into concelho values(9, 'Amadora', 3, 175136);
insert into concelho values(10, 'Almada', 3, 174030);
insert into concelho values(11, 'Oeiras', 3, 172120);
insert into concelho values(12, 'Gondomar', 1, 168027);
insert into concelho values(13, 'Seixal', 3, 158269);
insert into concelho values(14, 'Guimaraes', 1, 158124);
insert into concelho values(15, 'Odivelas', 3, 144549);
insert into concelho values(16, 'Coimbra', 2, 143396);
insert into concelho values(17, 'Arouca', 1, 22359);
insert into concelho values(18, 'Viana do Castelo', 1, 88725);
insert into concelho values(19, 'Torres Vedras', 3, 79465);
insert into concelho values(20, 'Barreiro', 3, 78764);
insert into concelho values(21, 'Faro', 5, 64560);
insert into concelho values(22, 'Santarem', 2, 62200);
insert into concelho values(23, 'Figueira da Foz', 1, 62125);
insert into concelho values(25, 'Felgueiras', 1, 58065);
insert into concelho values(27, 'Evora', 4, 56596);
insert into concelho values(28, 'Pacos de Ferreira', 1, 56340);

--------------------------------------------
-- Populate Instituicao
--------------------------------------------

insert into instituicao values('Clinica de Sao Joao', 'clinica', 1, 13);
insert into instituicao values('Hospital Sao Marcos', 'hospital', 1, 14);
insert into instituicao values('Hospital Santa Maria', 'hospital', 3, 1);
insert into instituicao values('Farmacia Gustavo', 'farmacia', 1, 14);
insert into instituicao values('Clinica Medica de Santo Antonio', 'clinica', 1, 8);
insert into instituicao values('Farmacia da Juventude', 'farmacia', 3, 15);
insert into instituicao values('Hospital da Luz', 'hospital', 3, 1);
insert into instituicao values('Clinica do Castelo', 'clinica', 1, 14);
insert into instituicao values('Farmacia Sousa', 'farmacia', 1, 15);
insert into instituicao values('Hospital de Gondomar', 'hospital', 1, 12);
insert into instituicao values('Farmacia Maria', 'farmacia', 1, 3);
insert into instituicao values('Hospital do Norte', 'hospital', 1, 3);
insert into instituicao values('Laboratorio Ferreira', 'laboratorio', 1, 17);
insert into instituicao values('Laboratorio Santa Madalena', 'laboratorio', 3, 11);
insert into instituicao values('Clinica Santa Eduarda', 'clinica', 5, 21);
insert into instituicao values('Farmacia da Luz', 'farmacia', 1, 14);
insert into instituicao values('Farmacia Bruxellas', 'farmacia', 1, 17);
insert into instituicao values('Farmacia Varzea', 'farmacia', 1, 14);
insert into instituicao values('Clinica Marco Paulo', 'clinica', 1, 8);
insert into instituicao values('CUF Descobertas', 'hospital', 3, 1);
insert into instituicao values('Centro de Saude do Lumiar', 'clinica', 3, 1);
insert into instituicao values('Laboratorio Municipal de Evora', 'laboratorio', 4, 27);
insert into instituicao values('Hospital Sao Jose', 'hospital', 1, 4);
insert into instituicao values('Hospital de Faro', 'hospital', 5, 21);
insert into instituicao values('Laboratorio Alberto Santos', 'laboratorio', 2, 16);
insert into instituicao values('Farmacia Central', 'farmacia',  5, 21);


--------------------------------------------
-- Populate Medicos
--------------------------------------------

insert into medico values(112, 'Joao Santos','Pediatria');
insert into medico values(140, 'Fernando Ferreira','Cardiologia');
insert into medico values(138, 'Luis Saltes','Respiratoria');
insert into medico values(187, 'Pedro Guimaraes', 'Neurologia');
insert into medico values(105, 'Jose Pedro', 'Respiratoria');
insert into medico values(155, 'Madalena Tinoco' , 'Neurologia');
insert into medico values(114, 'Francisco Figueira', 'Dermatologia');
insert into medico values(101, 'Maria Marcos', 'Pediatria');
insert into medico values(145, 'Constança Cortes' , 'Pediatria');
insert into medico values(185, 'Antonio Felgueiras', 'Oftalmologia');
insert into medico values(170, 'Francisca Janota' , 'Oncologia');
insert into medico values(173, 'Antonio Luis' , 'Oncologia');
insert into medico values(124, 'Eduardo Vara' , 'Pedontria');
insert into medico values(137, 'Pedro Polaco' , 'Dermatologia');
insert into medico values(175, 'Marta Valongo', 'Cardiologia');

--------------------------------------------
-- Populate consultas
--------------------------------------------

insert into consulta values ( 101 ,	245 , '2020-06-13' , 'CUF Descobertas' );--LISBOA 3
insert into consulta values ( 140 ,	273 , '2020-03-25' , 'Hospital Santa Maria' );--LISBOA 3
insert into consulta values ( 105 ,	224 , '2020-11-19' , 'Hospital Sao Jose' );-- PORTO 1 
insert into consulta values ( 187 ,	237 , '2019-01-30' , 'Centro de Saude do Lumiar' ); -- LISBOA 3  *
insert into consulta values ( 101 ,	285 , '2020-08-27' , 'Hospital de Faro' ); -- FARO 5
insert into consulta values ( 185 ,	205 , '2017-11-11' , 'Clinica Marco Paulo' );-- MATOSINHOS 1
insert into consulta values ( 170 , 270 , '2019-04-06' , 'Laboratorio Municipal de Evora' );-- EVORA 4 **
insert into consulta values ( 137 ,	243 , '2020-11-11' , 'Farmacia Varzea' );-- AROUCA 1 
insert into consulta values ( 101 ,	228 , '2020-01-04' , 'Hospital de Faro' );-- FARO 5
insert into consulta values ( 145 ,	240 , '2019-05-22' , 'Farmacia Central' );-- FARO 5 **
insert into consulta values ( 185 ,	236 , '2009-04-11' , 'Hospital Santa Maria' );--LISBOA 3
insert into consulta values ( 124 ,	245 , '2019-07-21' , 'CUF Descobertas' );--LISBOA 3
insert into consulta values ( 187 ,	200 , '2019-02-14' , 'Laboratorio Alberto Santos' );--Coimbra 2 **
insert into consulta values ( 112 ,	283 , '2019-03-26' , 'Clinica Marco Paulo' );-- MATOSINHOS 1 **
insert into consulta values ( 173 ,	212 , '2020-11-24' , 'Hospital Santa Maria' );--LISBOA 3
insert into consulta values ( 140 ,	209 , '2020-01-14' , 'Laboratorio Ferreira' );--LISBOA 3

--------------------------------------------
-- Populate prescricao
--------------------------------------------

insert into prescricao values ( 101 ,	245 , '2020-06-13' , 'Aspirina' , 30 );
insert into prescricao values ( 140 ,	273 , '2020-03-25' , 'Paracetamol' , 1000 );
insert into prescricao values ( 105 ,	224 , '2020-11-19' , 'Levocitirizina' , 50 );
insert into prescricao values ( 187 ,	237 , '2019-01-30' , 'ibuprofeno' , 400 );
insert into prescricao values ( 101 ,	285 , '2020-08-27' , 'Aspirina' , 10 );
insert into prescricao values ( 185 ,	205 , '2017-11-11' , 'Ebastina' , 60 );
insert into prescricao values ( 170 ,   270 , '2019-04-06' , 'ibuprofeno' , 50 );
insert into prescricao values ( 137 ,	243 , '2020-11-11' , 'Locoid' , 5 );
insert into prescricao values ( 101 ,	228 , '2020-01-04' , 'Aspirina' , 500 );
insert into prescricao values ( 145 ,	240 , '2019-05-22' , 'Diclofenac' , 20 );
insert into prescricao values ( 185 ,	236 , '2009-04-11' , 'Paracetamol' , 500 );
insert into prescricao values ( 124 ,	245 , '2019-07-21' , 'ibuprofeno' , 600 );
insert into prescricao values ( 187 ,	200 , '2019-02-14' , 'Xyzal' , 70 );
insert into prescricao values ( 112 ,	283 , '2019-03-26' , 'Ebastina' , 100 );
insert into prescricao values ( 173 ,	212 , '2020-11-24' , 'Aspirina' , 30 );
insert into prescricao values ( 140 ,	209 , '2020-01-14' , 'Aspirina' , 40 );

--------------------------------------------
-- Populate prescricao
--------------------------------------------

insert into analise values ( 341 , 'Pediatria' , 145 ,	240 , '2019-05-22' , '2020-06-20' , 'Ver. Fluidos Pulmonares' , 2 , 'Clinica Marco Paulo' );
insert into analise values ( 373 , 'Oncologia'	, 173 ,	212 , '2020-11-24', '2020-11-28' , 'TAC scan' , 1 , 'Hospital Santa Maria' );
insert into analise values ( 308 , 'Pedontria'	, 124 ,	245 , '2019-07-21'  , '2019-07-26' , 'Raio-X' , 6 , 'CUF Descobertas' );
insert into analise values ( 331 , 'Dermatologia', 137 ,	243 , '2020-11-11' , '2020-11-17' , 'Teste Alergicos' , 24 , 'Centro de Saude do Lumiar' );
insert into analise values ( 307 , 'Oftalnologia', 185 ,	205 , '2017-11-11'  , '2017-11-28' , 'Analises Sanguineas' , 13 , 'Laboratorio Municipal de Evora' );
insert into analise values ( 338 , 'Respiratoria', 105 ,	224 , '2020-11-19' , '2020-11-30' , 'Ecocardiograma' , 1, 'Hospital Sao Jose' );
insert into analise values ( 397 , 'Oncologia' ,  170 , 270 , '2019-04-06'  , '2019-04-16' , 'Ressonacia Magenetica' , 1 , 'Hospital Sao Jose' );
insert into analise values ( 302 , 'Pediatria'	, 112 ,	283 , '2019-03-26' , '2019-04-06' , 'Raio-X' , 5 , 'Hospital de Faro' );


-------------------------------------------
-- Populate Venda Farmacia
-------------------------------------------

insert into venda_farmacia values(1010, CURRENT_DATE, 'Aspirina' , 30 , 4, 'Farmacia Gustavo');
insert into venda_farmacia values(1011, CURRENT_DATE, 'Paracetamol' , 1000, 3, 'Farmacia Sousa');
--insert into venda_farmacia values(1012, '2020-11-20', 'Levocitirizina' , 50 , 3, 'Farmacia da Luz');
insert into venda_farmacia values(1013, '2019-01-31', 'ibuprofeno' , 400, 7, 'Farmacia da Luz');
insert into venda_farmacia values(1014, CURRENT_DATE, 'Aspirina' , 10, 3, 'Farmacia Bruxellas');
insert into venda_farmacia values(1015, '2017-11-13', 'Ebastina' , 60, 6, 'Farmacia da Luz');
insert into venda_farmacia values(1016, CURRENT_DATE, 'ibuprofeno' , 50 , 3, 'Farmacia Sousa');
--insert into venda_farmacia values(1017, '2021-02-11', 'Locoid' , 5 , 3, 'Farmacia da Luz');
insert into venda_farmacia values(1018, '2020-01-06', 'Aspirina' , 500 , 8, 'Farmacia Varzea');
insert into venda_farmacia values(1019, CURRENT_DATE, 'Diclofenac' , 600, 3, 'Farmacia da Juventude');
insert into venda_farmacia values(1020, '2009-04-19', 'Paracetamol', 500, 3, 'Farmacia da Luz');
insert into venda_farmacia values(1021 ,'2019-07-24' ,'ibuprofeno' , 600, 7, 'Farmacia Bruxellas');
insert into venda_farmacia values(1022, CURRENT_DATE, 'Xyzal' , 70, 3, 'Farmacia da Luz');
insert into venda_farmacia values(1023, CURRENT_DATE, 'Ebastina' , 100, 3, 'Farmacia da Luz');
insert into venda_farmacia values(1024, '2020-11-28', 'Aspirina' , 30, 3, 'Farmacia Bruxellas');
insert into venda_farmacia values(1025, CURRENT_DATE, 'Aspirina' , 40, 4, 'Farmacia Bruxellas');

-------------------------------------------
-- Populate Prescricao de Venda
-------------------------------------------

insert into prescricao_venda values(101 , 245 , '2020-06-13' , 'Aspirina', 1010);
insert into prescricao_venda values(140 , 273 , '2020-03-25' , 'Paracetamol', 1011);
--insert into prescricao_venda values(105 , 224 , '2020-11-19' , 'Levocitirizina', 1012);
insert into prescricao_venda values(187 , 237 , '2019-01-30' , 'ibuprofeno', 1013);
insert into prescricao_venda values(101 , 285 , '2020-08-27' , 'Aspirina', 1014);
insert into prescricao_venda values(185 , 205 , '2017-11-11' , 'Ebastina' , 1015);
insert into prescricao_venda values(170 , 270 , '2019-04-06' , 'ibuprofeno' , 1016);
--insert into prescricao_venda values(137 , 243 , '2020-11-11' , 'Locoid', 1017);
insert into prescricao_venda values(101 , 228 , '2020-01-04' , 'Aspirina', 1018);
insert into prescricao_venda values(145 , 240 , '2019-05-22' , 'Diclofenac' , 1019);
insert into prescricao_venda values(185 , 236 , '2009-04-11' , 'Paracetamol'  , 1020);
insert into prescricao_venda values(124 , 245 , '2019-07-21' , 'ibuprofeno' , 1021);
insert into prescricao_venda values(187 , 200 , '2019-02-14' , 'Xyzal' , 1022);
insert into prescricao_venda values(112 , 283 , '2019-03-26' , 'Ebastina' , 1023);
insert into prescricao_venda values(173 , 212 , '2020-11-24' , 'Aspirina' , 1024);
insert into prescricao_venda values(140 , 209 , '2020-01-14' , 'Aspirina' , 1025);

