From d4c1e18ab198268670ee759e5b0abf1cace1f0e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Sat, 14 Dec 2019 19:17:00 +0100 Subject: [PATCH 01/17] Datos de prueba de paciente, medico especialista y medico de familia. --- 2.database/02. Datos_prueba.sql | 133 +++++++++++++++++++------------- 1 file changed, 79 insertions(+), 54 deletions(-) diff --git a/2.database/02. Datos_prueba.sql b/2.database/02. Datos_prueba.sql index ccd897e..540d4b4 100644 --- a/2.database/02. Datos_prueba.sql +++ b/2.database/02. Datos_prueba.sql @@ -1,61 +1,86 @@ --Inserta usuarios administradores (contraseña Hash MD5 'admin' para todos) -insert into myhealth.administrator (email, password) values ('admin@example.com', '21232F297A57A5A743894A0E4A801FC3'); -insert into myhealth.administrator (email, password) values ('marcos@example.com', '21232F297A57A5A743894A0E4A801FC3'); +insert into myhealth.administrator (email, password) values +('admin@example.com', '21232F297A57A5A743894A0E4A801FC3') +,('marcos@example.com', '21232F297A57A5A743894A0E4A801FC3'); -- Insertar Algunos centros médicos INSERT INTO myhealth.primaryhealthcarecenter(name, location) VALUES -('CENTRO SAUDE A DOBLADA',' CALLE RUA FAISAN S/N '), -('CENTRO SAUDE BEMBRIVE',' CARRETERA BEMBRIVE 259 '), -('CENTRO SAUDE BOLIVIA',' CALLE PIZARRO 22 '), -('CENTRO SAUDE CASCO VELLO',' PLAZA CONSTITUCION 7 '), -('CENTRO SAUDE COIA',' CALLE PONTEAREAS S/N '), -('CENTRO SAUDE COLMEIRO',' CALLE PINTOR COLMEIRO 11 '), -('CENTRO SAUDE CORUXO',' CALLE RUA JOSE RIVAS CARRASQUEIRA S/N '), -('CENTRO SAUDE LAVADORES',' TRAVESIA BARREIRO 1 36 '), -('CENTRO SAUDE LOPEZ MORA',' CALLE LOPEZ MORA 54 '), -('CENTRO SAUDE MATAMA',' CAMINO CAMIÑO BABIO-AS CARNEIRAS S/N '), -('CENTRO SAUDE NICOLAS PEÑA',' CAMINO CAMIÑO REGUEIRO S/N '), -('CENTRO SAUDE ROSALIA DE CASTRO-BEIRAMAR',' CALLE ROSALIA DE CASTRO 21 '), -('CENTRO SAUDE RUA CUBA',' CALLE CUBA 10 '), -('CENTRO SAUDE SAN PAIO DE NAVIA',' CALLE POZA CABALO S/N '), -('CENTRO SAUDE SARDOMA',' CALLE RUA CANTEIRA DE BALIN 76 '), -('CENTRO SAUDE TEIS',' CALLE ANGELA IGLESIAS REBOLLAR S/N '); +('CENTRO SAUDE A DOBLADA',' CALLE RUA FAISAN S/N') +,('CENTRO SAUDE BEMBRIVE',' CARRETERA BEMBRIVE 259') +,('CENTRO SAUDE BOLIVIA',' CALLE PIZARRO 22') +,('CENTRO SAUDE CASCO VELLO',' PLAZA CONSTITUCION 7') +,('CENTRO SAUDE COIA',' CALLE PONTEAREAS S/N') +,('CENTRO SAUDE COLMEIRO',' CALLE PINTOR COLMEIRO 11') +,('CENTRO SAUDE CORUXO',' CALLE RUA JOSE RIVAS CARRASQUEIRA S/N') +,('CENTRO SAUDE LAVADORES',' TRAVESIA BARREIRO 1 36') +,('CENTRO SAUDE LOPEZ MORA',' CALLE LOPEZ MORA 54') +,('CENTRO SAUDE MATAMA',' CAMINO CAMIÑO BABIO-AS CARNEIRAS S/N') +,('CENTRO SAUDE NICOLAS PEÑA',' CAMINO CAMIÑO REGUEIRO S/N') +,('CENTRO SAUDE ROSALIA DE CASTRO-BEIRAMAR',' CALLE ROSALIA DE CASTRO 21') +,('CENTRO SAUDE RUA CUBA',' CALLE CUBA 10') +,('CENTRO SAUDE SAN PAIO DE NAVIA',' CALLE POZA CABALO S/N') +,('CENTRO SAUDE SARDOMA',' CALLE RUA CANTEIRA DE BALIN 76') +,('CENTRO SAUDE TEIS',' CALLE ANGELA IGLESIAS REBOLLAR S/N'); -- Inserta Especialidades médicas -insert into MyHealth.MedicalSpecialty(name, description) -values ('Alergologia','Especialidad médica de Alergologia'); -insert into MyHealth.MedicalSpecialty(name, description) -values ('Cirugía cardiaca','Especialidad médica de Cirugía cardiaca'); -insert into MyHealth.MedicalSpecialty(name, description) -values ('Cirugía general','Especialidad médica de Cirugía general'); -insert into MyHealth.MedicalSpecialty(name, description) -values ('Cirugía plastica','Especialidad médica de Cirugía plastica'); -insert into MyHealth.MedicalSpecialty(name, description) -values ('Cirugía de mama','Especialidad médica de Cirugía de mama'); -insert into MyHealth.MedicalSpecialty(name, description) -values ('Cirugía maxilofacial','Especialidad médica de Cirugía maxilofacial'); -insert into MyHealth.MedicalSpecialty(name, description) -values ('Cirugía vascular','Especialidad médica de Cirugía vascular'); -insert into MyHealth.MedicalSpecialty(name, description) -values ('Dermatología','Especialidad médica de Dermatología'); -insert into MyHealth.MedicalSpecialty(name, description) -values ('Endocrinología y nutrición','Especialidad médica de Endocrinología y nutrición'); -insert into MyHealth.MedicalSpecialty(name, description) -values ('Gastroenterología- digestivo','Especialidad médica de Gastroenterología- digestivo'); -insert into MyHealth.MedicalSpecialty(name, description) -values ('Neurocirugía','Especialidad médica de Neurocirugía'); -insert into MyHealth.MedicalSpecialty(name, description) -values ('Oftalmología','Especialidad médica de Oftalmología'); -insert into MyHealth.MedicalSpecialty(name, description) -values ('Otorrinolaringologia','Especialidad médica de Otorrinolaringologia'); -insert into MyHealth.MedicalSpecialty(name, description) -values ('Oncología','Especialidad médica de Oncología'); -insert into MyHealth.MedicalSpecialty(name, description) -values ('Pediatría','Especialidad médica de Pediatría'); +insert into MyHealth.MedicalSpecialty(name, description) values +('Alergologia','Especialidad médica de Alergologia') +,('Cirugía cardiaca','Especialidad médica de Cirugía cardiaca') +,('Cirugía general','Especialidad médica de Cirugía general') +,('Cirugía plastica','Especialidad médica de Cirugía plastica') +,('Cirugía de mama','Especialidad médica de Cirugía de mama') +,('Cirugía maxilofacial','Especialidad médica de Cirugía maxilofacial') +,('Cirugía vascular','Especialidad médica de Cirugía vascular') +,('Dermatología','Especialidad médica de Dermatología') +,('Endocrinología y nutrición','Especialidad médica de Endocrinología y nutrición') +,('Gastroenterología- digestivo','Especialidad médica de Gastroenterología- digestivo') +,('Neurocirugía','Especialidad médica de Neurocirugía') +,('Oftalmología','Especialidad médica de Oftalmología') +,('Otorrinolaringologia','Especialidad médica de Otorrinolaringologia') +,('Oncología','Especialidad médica de Oncología') +,('Pediatría','Especialidad médica de Pediatría'); + + +-- Insertar médicos de familia +INSERT INTO myhealth.familydoctor(professionalnumber, password, nif, surname, email, name, primaryhealthcarecenterid) VALUES +('PRO#100','912EC803B2CE49E4A541068D495AB570','95874388S',' Moran Ortiz', ' @example.ecom',' ', 1) +,('PRO#101','912EC803B2CE49E4A541068D495AB570','59546140Z',' Zambrano Rivas', 'Belen@example.ecom',' Belen', 2) +,('PRO#102','912EC803B2CE49E4A541068D495AB570','16354100L',' Cuevas Luque', 'Fernando@example.ecom',' Fernando', 3) +,('PRO#103','912EC803B2CE49E4A541068D495AB570','32662259M',' Becerra Muñiz', 'Luis@example.ecom',' Luis', 4) +,('PRO#104','912EC803B2CE49E4A541068D495AB570','70600712G',' Aznar Silva', 'Ana@example.ecom',' Ana', 5) +,('PRO#105','912EC803B2CE49E4A541068D495AB570','08003806J',' Galvez Sancho', 'Alfonso@example.ecom',' Alfonso', 6) +,('PRO#106','912EC803B2CE49E4A541068D495AB570','19567288S',' Criado Marti', 'Jordi@example.ecom',' Jordi', 7) +,('PRO#107','912EC803B2CE49E4A541068D495AB570','95413653Q',' Estevez Mena', 'Barbara@example.ecom',' Barbara', 8) +,('PRO#108','912EC803B2CE49E4A541068D495AB570','90914444K',' Godoy Alcaide', 'Amalia@example.ecom',' Amalia', 9) +,('PRO#109','912EC803B2CE49E4A541068D495AB570','05709869G',' Lucas Wang', 'Carmelo@example.ecom',' Carmelo', 10); + + +-- Insertar médicos especialistas +INSERT INTO myhealth.specialistdoctor(professionalnumber, password, nif, surname, email, name, medicalspecialtyid) VALUES +('PRO#110','912EC803B2CE49E4A541068D495AB570','87719252N',' Vazquez Cruz', 'Luciano@example.ecom',' Luciano', 1) +,('PRO#111','912EC803B2CE49E4A541068D495AB570','79412306E',' Alcaide Mesa', 'Gregorio@example.ecom',' Gregorio', 2) +,('PRO#112','912EC803B2CE49E4A541068D495AB570','45727688P',' Herranz Soria', 'Candida@example.ecom',' Candida', 3) +,('PRO#113','912EC803B2CE49E4A541068D495AB570','65061962E',' Galvez Vives', 'Nora@example.ecom',' Nora', 4) +,('PRO#114','912EC803B2CE49E4A541068D495AB570','07359870P',' Rojas Alonso', 'Anton@example.ecom',' Anton', 5) +,('PRO#115','912EC803B2CE49E4A541068D495AB570','14117403A',' Lorente Carmona', 'Sheila@example.ecom',' Sheila', 6) +,('PRO#116','912EC803B2CE49E4A541068D495AB570','79864477J',' Gonzalo Bonet', 'Nicolas@example.ecom',' Nicolas', 7) +,('PRO#117','912EC803B2CE49E4A541068D495AB570','22761129F',' Bonet Ariza', 'Aroa@example.ecom',' Aroa', 8) +,('PRO#118','912EC803B2CE49E4A541068D495AB570','99693813Z',' Soria Singh', 'Cristian@example.ecom',' Cristian', 9) +,('PRO#119','912EC803B2CE49E4A541068D495AB570','04431824T',' Requena Calderon', 'Ferran@example.ecom',' Ferran', 10) +,('PRO#120','912EC803B2CE49E4A541068D495AB570','27476123R',' Angulo Zamora', 'Ana@example.ecom',' Ana', 11); + +--Insertar Pacientes +INSERT INTO myhealth.patient(personalidentificationcode, password, nif, surname, email, name, familydoctorid) VALUES +('PAT#100','912EC803B2CE49E4A541068D495AB570','97758900E',' Singh Vila', 'Soledad@example.ecom',' Soledad', 1) +,('PAT#101','912EC803B2CE49E4A541068D495AB570','Z9518183Y',' Jimenez Merino', 'Ainhoa@example.ecom',' Ainhoa', 2) +,('PAT#102','912EC803B2CE49E4A541068D495AB570','97758900E',' Jesus Chen Barba', 'Abel@example.ecom',' Abel', 3) +,('PAT#103','912EC803B2CE49E4A541068D495AB570','95014341F',' Lorenzo Tapia Navas', 'Francisco@example.ecom',' Francisco', 4) +,('PAT#104','912EC803B2CE49E4A541068D495AB570','17873499S',' Gimenez Gutierrez', 'Teodora@example.ecom',' Teodora', 5) +,('PAT#105','912EC803B2CE49E4A541068D495AB570','07320674G',' Escobar Marquez', 'Jorge@example.ecom',' Jorge', 6) +,('PAT#106','912EC803B2CE49E4A541068D495AB570','63888801E',' Marin Reina', 'Marti@example.ecom',' Marti', 7) +,('PAT#107','912EC803B2CE49E4A541068D495AB570','36676167E',' Bosch Zapata', 'Abril@example.ecom',' Abril', 8) +,('PAT#108','912EC803B2CE49E4A541068D495AB570','73569670F',' Bosch Zapata', 'Esperanza@example.ecom',' Esperanza', 9) +,('PAT#109','912EC803B2CE49E4A541068D495AB570','53986482P',' Carretero Ayala', 'Eduardo@example.ecom',' Eduardo', 10); + + -INSERT INTO myhealth.primaryhealthcarecenter(name, location) - VALUES ('Centro A', 'Descripción centro A'); -INSERT INTO myhealth.primaryhealthcarecenter(name, location) - VALUES ('Centro Medico Azul', 'Descripción centro medico azul'); -INSERT INTO myhealth.primaryhealthcarecenter(name, location) - VALUES ('Centro Medico 23', 'Descripción centro medico 23'); From 92af30a5f35b40cc7b1f18ef859b53a490e97336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Sat, 14 Dec 2019 19:55:07 +0100 Subject: [PATCH 02/17] =?UTF-8?q?Correcci=C3=B3n=20de=20espacios=20en=20lo?= =?UTF-8?q?s=20datos=20de=20los=20juegos=20de=20pruebas.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 2.database/02. Datos_prueba.sql | 64 ++++++++++++++++----------------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/2.database/02. Datos_prueba.sql b/2.database/02. Datos_prueba.sql index 540d4b4..e024e0b 100644 --- a/2.database/02. Datos_prueba.sql +++ b/2.database/02. Datos_prueba.sql @@ -40,47 +40,45 @@ insert into MyHealth.MedicalSpecialty(name, description) values ,('Oncología','Especialidad médica de Oncología') ,('Pediatría','Especialidad médica de Pediatría'); - -- Insertar médicos de familia INSERT INTO myhealth.familydoctor(professionalnumber, password, nif, surname, email, name, primaryhealthcarecenterid) VALUES -('PRO#100','912EC803B2CE49E4A541068D495AB570','95874388S',' Moran Ortiz', ' @example.ecom',' ', 1) -,('PRO#101','912EC803B2CE49E4A541068D495AB570','59546140Z',' Zambrano Rivas', 'Belen@example.ecom',' Belen', 2) -,('PRO#102','912EC803B2CE49E4A541068D495AB570','16354100L',' Cuevas Luque', 'Fernando@example.ecom',' Fernando', 3) -,('PRO#103','912EC803B2CE49E4A541068D495AB570','32662259M',' Becerra Muñiz', 'Luis@example.ecom',' Luis', 4) -,('PRO#104','912EC803B2CE49E4A541068D495AB570','70600712G',' Aznar Silva', 'Ana@example.ecom',' Ana', 5) -,('PRO#105','912EC803B2CE49E4A541068D495AB570','08003806J',' Galvez Sancho', 'Alfonso@example.ecom',' Alfonso', 6) -,('PRO#106','912EC803B2CE49E4A541068D495AB570','19567288S',' Criado Marti', 'Jordi@example.ecom',' Jordi', 7) -,('PRO#107','912EC803B2CE49E4A541068D495AB570','95413653Q',' Estevez Mena', 'Barbara@example.ecom',' Barbara', 8) -,('PRO#108','912EC803B2CE49E4A541068D495AB570','90914444K',' Godoy Alcaide', 'Amalia@example.ecom',' Amalia', 9) -,('PRO#109','912EC803B2CE49E4A541068D495AB570','05709869G',' Lucas Wang', 'Carmelo@example.ecom',' Carmelo', 10); - +('PRO#100','912EC803B2CE49E4A541068D495AB570','95874388S','Moran Ortiz', 'Xian@example.ecom','Xian', 1) +,('PRO#101','912EC803B2CE49E4A541068D495AB570','59546140Z','Zambrano Rivas', 'Belen@example.ecom','Belen', 2) +,('PRO#102','912EC803B2CE49E4A541068D495AB570','16354100L','Cuevas Luque', 'Fernando@example.ecom','Fernando', 3) +,('PRO#103','912EC803B2CE49E4A541068D495AB570','32662259M','Becerra Muñiz', 'Luis@example.ecom','Luis', 4) +,('PRO#104','912EC803B2CE49E4A541068D495AB570','70600712G','Aznar Silva', 'Ana@example.ecom','Ana', 5) +,('PRO#105','912EC803B2CE49E4A541068D495AB570','08003806J','Galvez Sancho', 'Alfonso@example.ecom','Alfonso', 6) +,('PRO#106','912EC803B2CE49E4A541068D495AB570','19567288S','Criado Marti', 'Jordi@example.ecom','Jordi', 7) +,('PRO#107','912EC803B2CE49E4A541068D495AB570','95413653Q','Estevez Mena', 'Barbara@example.ecom','Barbara', 8) +,('PRO#108','912EC803B2CE49E4A541068D495AB570','90914444K','Godoy Alcaide', 'Amalia@example.ecom','Amalia', 9) +,('PRO#109','912EC803B2CE49E4A541068D495AB570','05709869G','Lucas Wang', 'Carmelo@example.ecom','Carmelo', 10); -- Insertar médicos especialistas INSERT INTO myhealth.specialistdoctor(professionalnumber, password, nif, surname, email, name, medicalspecialtyid) VALUES -('PRO#110','912EC803B2CE49E4A541068D495AB570','87719252N',' Vazquez Cruz', 'Luciano@example.ecom',' Luciano', 1) -,('PRO#111','912EC803B2CE49E4A541068D495AB570','79412306E',' Alcaide Mesa', 'Gregorio@example.ecom',' Gregorio', 2) -,('PRO#112','912EC803B2CE49E4A541068D495AB570','45727688P',' Herranz Soria', 'Candida@example.ecom',' Candida', 3) -,('PRO#113','912EC803B2CE49E4A541068D495AB570','65061962E',' Galvez Vives', 'Nora@example.ecom',' Nora', 4) -,('PRO#114','912EC803B2CE49E4A541068D495AB570','07359870P',' Rojas Alonso', 'Anton@example.ecom',' Anton', 5) -,('PRO#115','912EC803B2CE49E4A541068D495AB570','14117403A',' Lorente Carmona', 'Sheila@example.ecom',' Sheila', 6) -,('PRO#116','912EC803B2CE49E4A541068D495AB570','79864477J',' Gonzalo Bonet', 'Nicolas@example.ecom',' Nicolas', 7) -,('PRO#117','912EC803B2CE49E4A541068D495AB570','22761129F',' Bonet Ariza', 'Aroa@example.ecom',' Aroa', 8) -,('PRO#118','912EC803B2CE49E4A541068D495AB570','99693813Z',' Soria Singh', 'Cristian@example.ecom',' Cristian', 9) -,('PRO#119','912EC803B2CE49E4A541068D495AB570','04431824T',' Requena Calderon', 'Ferran@example.ecom',' Ferran', 10) -,('PRO#120','912EC803B2CE49E4A541068D495AB570','27476123R',' Angulo Zamora', 'Ana@example.ecom',' Ana', 11); +('PRO#110','912EC803B2CE49E4A541068D495AB570','87719252N','Vazquez Cruz', 'Luciano@example.ecom','Luciano', 1) +,('PRO#111','912EC803B2CE49E4A541068D495AB570','79412306E','Alcaide Mesa', 'Gregorio@example.ecom','Gregorio', 2) +,('PRO#112','912EC803B2CE49E4A541068D495AB570','45727688P','Herranz Soria', 'Candida@example.ecom','Candida', 3) +,('PRO#113','912EC803B2CE49E4A541068D495AB570','65061962E','Galvez Vives', 'Nora@example.ecom','Nora', 4) +,('PRO#114','912EC803B2CE49E4A541068D495AB570','07359870P','Rojas Alonso', 'Anton@example.ecom','Anton', 5) +,('PRO#115','912EC803B2CE49E4A541068D495AB570','14117403A','Lorente Carmona', 'Sheila@example.ecom','Sheila', 6) +,('PRO#116','912EC803B2CE49E4A541068D495AB570','79864477J','Gonzalo Bonet', 'Nicolas@example.ecom','Nicolas', 7) +,('PRO#117','912EC803B2CE49E4A541068D495AB570','22761129F','Bonet Ariza', 'Aroa@example.ecom','Aroa', 8) +,('PRO#118','912EC803B2CE49E4A541068D495AB570','99693813Z','Soria Singh', 'Cristian@example.ecom','Cristian', 9) +,('PRO#119','912EC803B2CE49E4A541068D495AB570','04431824T','Requena Calderon', 'Ferran@example.ecom','Ferran', 10) +,('PRO#120','912EC803B2CE49E4A541068D495AB570','27476123R','Angulo Zamora', 'Ana@example.ecom','Ana', 11); --Insertar Pacientes INSERT INTO myhealth.patient(personalidentificationcode, password, nif, surname, email, name, familydoctorid) VALUES -('PAT#100','912EC803B2CE49E4A541068D495AB570','97758900E',' Singh Vila', 'Soledad@example.ecom',' Soledad', 1) -,('PAT#101','912EC803B2CE49E4A541068D495AB570','Z9518183Y',' Jimenez Merino', 'Ainhoa@example.ecom',' Ainhoa', 2) -,('PAT#102','912EC803B2CE49E4A541068D495AB570','97758900E',' Jesus Chen Barba', 'Abel@example.ecom',' Abel', 3) -,('PAT#103','912EC803B2CE49E4A541068D495AB570','95014341F',' Lorenzo Tapia Navas', 'Francisco@example.ecom',' Francisco', 4) -,('PAT#104','912EC803B2CE49E4A541068D495AB570','17873499S',' Gimenez Gutierrez', 'Teodora@example.ecom',' Teodora', 5) -,('PAT#105','912EC803B2CE49E4A541068D495AB570','07320674G',' Escobar Marquez', 'Jorge@example.ecom',' Jorge', 6) -,('PAT#106','912EC803B2CE49E4A541068D495AB570','63888801E',' Marin Reina', 'Marti@example.ecom',' Marti', 7) -,('PAT#107','912EC803B2CE49E4A541068D495AB570','36676167E',' Bosch Zapata', 'Abril@example.ecom',' Abril', 8) -,('PAT#108','912EC803B2CE49E4A541068D495AB570','73569670F',' Bosch Zapata', 'Esperanza@example.ecom',' Esperanza', 9) -,('PAT#109','912EC803B2CE49E4A541068D495AB570','53986482P',' Carretero Ayala', 'Eduardo@example.ecom',' Eduardo', 10); +('PAT#100','912EC803B2CE49E4A541068D495AB570','97758900E','Singh Vila', 'Soledad@example.ecom','Soledad', 1) +,('PAT#101','912EC803B2CE49E4A541068D495AB570','Z9518183Y','Jimenez Merino', 'Ainhoa@example.ecom','Ainhoa', 2) +,('PAT#102','912EC803B2CE49E4A541068D495AB570','97758900E','Jesus Chen Barba', 'Abel@example.ecom','Abel', 3) +,('PAT#103','912EC803B2CE49E4A541068D495AB570','95014341F','Lorenzo Tapia Navas', 'Francisco@example.ecom','Francisco', 4) +,('PAT#104','912EC803B2CE49E4A541068D495AB570','17873499S','Gimenez Gutierrez', 'Teodora@example.ecom','Teodora', 5) +,('PAT#105','912EC803B2CE49E4A541068D495AB570','07320674G','Escobar Marquez', 'Jorge@example.ecom','Jorge', 6) +,('PAT#106','912EC803B2CE49E4A541068D495AB570','63888801E','Marin Reina', 'Marti@example.ecom','Marti', 7) +,('PAT#107','912EC803B2CE49E4A541068D495AB570','36676167E','Bosch Zapata', 'Abril@example.ecom','Abril', 8) +,('PAT#108','912EC803B2CE49E4A541068D495AB570','73569670F','Bosch Zapata', 'Esperanza@example.ecom','Esperanza', 9) +,('PAT#109','912EC803B2CE49E4A541068D495AB570','53986482P','Carretero Ayala', 'Eduardo@example.ecom','Eduardo', 10); From 4c2c991e7c9622644c06a86b1dba46759c53dd73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Sat, 14 Dec 2019 19:55:56 +0100 Subject: [PATCH 03/17] Mostrar identificador de profesional en la lista desplegable. --- 1.sources/MyHealth/docroot/profile/ChangeFamilyDoctor.xhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1.sources/MyHealth/docroot/profile/ChangeFamilyDoctor.xhtml b/1.sources/MyHealth/docroot/profile/ChangeFamilyDoctor.xhtml index 45e68bb..497a814 100644 --- a/1.sources/MyHealth/docroot/profile/ChangeFamilyDoctor.xhtml +++ b/1.sources/MyHealth/docroot/profile/ChangeFamilyDoctor.xhtml @@ -47,7 +47,7 @@ itemLabel="#{fd.displayName}" itemValue="#{fd}" forceSelection="true" requiredMessage="Por favor, selecciona un médico de familia"> - + From 5098e51496f3d7dedaf89d9b6ad8de6ac761dd3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Sat, 14 Dec 2019 19:56:22 +0100 Subject: [PATCH 04/17] Mostrar identificador de profesional en displayname. --- 1.sources/MyHealth/src/TO/FamilyDoctorTO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1.sources/MyHealth/src/TO/FamilyDoctorTO.java b/1.sources/MyHealth/src/TO/FamilyDoctorTO.java index dd91620..6a7e0f0 100644 --- a/1.sources/MyHealth/src/TO/FamilyDoctorTO.java +++ b/1.sources/MyHealth/src/TO/FamilyDoctorTO.java @@ -86,7 +86,7 @@ public class FamilyDoctorTO implements Serializable { } public String getDisplayName() { - return String.format("[%d] %s %s", this.id, this.name, this.surname); + return String.format("[%s] %s %s", this.professionalNumber, this.name, this.surname); } public PrimaryHealthCareCenterTO getPrimaryHealthCareCenter() { From 16d7cea82993aed247484fd7ebaf0599cd8037c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Sat, 14 Dec 2019 19:56:52 +0100 Subject: [PATCH 05/17] =?UTF-8?q?Quitadas=20p=C3=A1ginas=20no=20utilizadas?= =?UTF-8?q?=20del=20men=C3=BA=20para=20el=20registro=20individual.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.sources/MyHealth/src/managedbean/common/MenuMBean.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/1.sources/MyHealth/src/managedbean/common/MenuMBean.java b/1.sources/MyHealth/src/managedbean/common/MenuMBean.java index 801de63..5a92700 100644 --- a/1.sources/MyHealth/src/managedbean/common/MenuMBean.java +++ b/1.sources/MyHealth/src/managedbean/common/MenuMBean.java @@ -113,10 +113,10 @@ public class MenuMBean implements Serializable { // Perfil subMenu = new DefaultSubMenu("Gestionar perfil", "fa fa-gears"); if (SessionUtils.isLogedIn() == false) { - subMenu.addElement(createMenuItem("Registro de usuario", "fa fa-user-plus", "/profile/RegisterUser", null)); - subMenu.addElement(createMenuItem("Registro de paciente", "fa fa-user-plus", "/profile/AddPatient", null)); - subMenu.addElement(createMenuItem("Registro de médico", "fa fa-user-md", "/profile/AddFamilyDoctor", null)); - subMenu.addElement(createMenuItem("Registro de especialista", "fa fa-user-md", "/profile/AddSpecialistDoctor", null)); +// subMenu.addElement(createMenuItem("Registro de usuario", "fa fa-user-plus", "/profile/RegisterUser", null)); +// subMenu.addElement(createMenuItem("Registro de paciente", "fa fa-user-plus", "/profile/AddPatient", null)); +// subMenu.addElement(createMenuItem("Registro de médico", "fa fa-user-md", "/profile/AddFamilyDoctor", null)); +// subMenu.addElement(createMenuItem("Registro de especialista", "fa fa-user-md", "/profile/AddSpecialistDoctor", null)); model.addElement(subMenu); } else { From 516a5d0701ea5a56fc0159338f725b52ea4c0e9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Sat, 14 Dec 2019 19:57:25 +0100 Subject: [PATCH 06/17] Mostrar codigo personal en display name. --- 1.sources/MyHealth/src/TO/PatientTO.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/1.sources/MyHealth/src/TO/PatientTO.java b/1.sources/MyHealth/src/TO/PatientTO.java index e694dcb..7cd78ca 100644 --- a/1.sources/MyHealth/src/TO/PatientTO.java +++ b/1.sources/MyHealth/src/TO/PatientTO.java @@ -90,6 +90,10 @@ public class PatientTO implements Serializable { this.id = id; } + public String getDisplayName() { + return String.format("[%s] %s %s", this.personalIdentificationCode, this.name, this.surname); + } + public FamilyDoctorTO getFamilyDoctor() { return familyDoctor; } From 5276ff017ef7428ce4545596d38101d20ee27e40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Sat, 14 Dec 2019 19:57:49 +0100 Subject: [PATCH 07/17] Campos de solo lectura en lugar de deshabilitados. --- 1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml b/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml index cc543d1..152a682 100644 --- a/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml +++ b/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml @@ -31,7 +31,7 @@
- +
@@ -156,11 +156,11 @@
- - + From 598e4cce71995d6c014b6f873a114bd2c0d304f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Sat, 14 Dec 2019 19:58:12 +0100 Subject: [PATCH 08/17] Cambiado displayName. --- 1.sources/MyHealth/src/TO/SpecialistDoctorTO.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/1.sources/MyHealth/src/TO/SpecialistDoctorTO.java b/1.sources/MyHealth/src/TO/SpecialistDoctorTO.java index 596745e..d55dcaf 100644 --- a/1.sources/MyHealth/src/TO/SpecialistDoctorTO.java +++ b/1.sources/MyHealth/src/TO/SpecialistDoctorTO.java @@ -85,6 +85,10 @@ public class SpecialistDoctorTO implements Serializable { this.id = id; } + public String getDisplayName() { + return String.format("[%s] %s %s", this.professionalNumber, this.name, this.surname); + } + public MedicalSpecialtyTO getMedicalSpecialty() { return medicalSpecialty; } From f776128be09015f7bbb69990602b4467e2cddd28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Sat, 14 Dec 2019 19:59:09 +0100 Subject: [PATCH 09/17] Eliminadas paginas y managed beans innecesarios. --- .../docroot/profile/AddFamilyDoctor.xhtml | 39 ------ .../MyHealth/docroot/profile/AddPatient.xhtml | 38 ------ .../docroot/profile/AddSpecialistDoctor.xhtml | 37 ------ .../docroot/profile/ShowFamilyDoctor.xhtml | 38 ------ .../docroot/profile/ShowPaciente.xhtml | 38 ------ .../profile/ShowSpecialistDoctor.xhtml | 38 ------ .../docroot/profile/UpdateFamilyDoctor.xhtml | 39 ------ .../docroot/profile/UpdatePatient.xhtml | 39 ------ .../profile/UpdateSpecialistDoctor.xhtml | 38 ------ .../profile/AddFamilyDoctorMBean.java | 29 ----- .../managedbean/profile/AddPatientMBean.java | 112 ------------------ .../profile/AddSpecialistDoctorMBean.java | 34 ------ .../profile/ShowFamilyDoctorMBean.java | 50 -------- .../managedbean/profile/ShowPatientMBean.java | 49 -------- .../profile/ShowSpecialistDoctorMBean.java | 50 -------- .../profile/UpdateFamilyDoctorMBean.java | 49 -------- .../profile/UpdatePatientMBean.java | 49 -------- .../profile/UpdateSpecialistDoctorMBean.java | 49 -------- 18 files changed, 815 deletions(-) delete mode 100644 1.sources/MyHealth/docroot/profile/AddFamilyDoctor.xhtml delete mode 100644 1.sources/MyHealth/docroot/profile/AddPatient.xhtml delete mode 100644 1.sources/MyHealth/docroot/profile/AddSpecialistDoctor.xhtml delete mode 100644 1.sources/MyHealth/docroot/profile/ShowFamilyDoctor.xhtml delete mode 100644 1.sources/MyHealth/docroot/profile/ShowPaciente.xhtml delete mode 100644 1.sources/MyHealth/docroot/profile/ShowSpecialistDoctor.xhtml delete mode 100644 1.sources/MyHealth/docroot/profile/UpdateFamilyDoctor.xhtml delete mode 100644 1.sources/MyHealth/docroot/profile/UpdatePatient.xhtml delete mode 100644 1.sources/MyHealth/docroot/profile/UpdateSpecialistDoctor.xhtml delete mode 100644 1.sources/MyHealth/src/managedbean/profile/AddFamilyDoctorMBean.java delete mode 100644 1.sources/MyHealth/src/managedbean/profile/AddPatientMBean.java delete mode 100644 1.sources/MyHealth/src/managedbean/profile/AddSpecialistDoctorMBean.java delete mode 100644 1.sources/MyHealth/src/managedbean/profile/ShowFamilyDoctorMBean.java delete mode 100644 1.sources/MyHealth/src/managedbean/profile/ShowPatientMBean.java delete mode 100644 1.sources/MyHealth/src/managedbean/profile/ShowSpecialistDoctorMBean.java delete mode 100644 1.sources/MyHealth/src/managedbean/profile/UpdateFamilyDoctorMBean.java delete mode 100644 1.sources/MyHealth/src/managedbean/profile/UpdatePatientMBean.java delete mode 100644 1.sources/MyHealth/src/managedbean/profile/UpdateSpecialistDoctorMBean.java diff --git a/1.sources/MyHealth/docroot/profile/AddFamilyDoctor.xhtml b/1.sources/MyHealth/docroot/profile/AddFamilyDoctor.xhtml deleted file mode 100644 index 10a6c27..0000000 --- a/1.sources/MyHealth/docroot/profile/AddFamilyDoctor.xhtml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - -
-
- -
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
-
-
-
-
- diff --git a/1.sources/MyHealth/docroot/profile/AddPatient.xhtml b/1.sources/MyHealth/docroot/profile/AddPatient.xhtml deleted file mode 100644 index 6959621..0000000 --- a/1.sources/MyHealth/docroot/profile/AddPatient.xhtml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - -
-
- -
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
-
-
-
-
- diff --git a/1.sources/MyHealth/docroot/profile/AddSpecialistDoctor.xhtml b/1.sources/MyHealth/docroot/profile/AddSpecialistDoctor.xhtml deleted file mode 100644 index 575abb2..0000000 --- a/1.sources/MyHealth/docroot/profile/AddSpecialistDoctor.xhtml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - -
-
- -
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
-
-
-
- diff --git a/1.sources/MyHealth/docroot/profile/ShowFamilyDoctor.xhtml b/1.sources/MyHealth/docroot/profile/ShowFamilyDoctor.xhtml deleted file mode 100644 index 5f4928b..0000000 --- a/1.sources/MyHealth/docroot/profile/ShowFamilyDoctor.xhtml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - -
-
- -
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
-
-
-
-
- diff --git a/1.sources/MyHealth/docroot/profile/ShowPaciente.xhtml b/1.sources/MyHealth/docroot/profile/ShowPaciente.xhtml deleted file mode 100644 index 01c461c..0000000 --- a/1.sources/MyHealth/docroot/profile/ShowPaciente.xhtml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - -
-
- -
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
-
-
-
-
- diff --git a/1.sources/MyHealth/docroot/profile/ShowSpecialistDoctor.xhtml b/1.sources/MyHealth/docroot/profile/ShowSpecialistDoctor.xhtml deleted file mode 100644 index 2beebdf..0000000 --- a/1.sources/MyHealth/docroot/profile/ShowSpecialistDoctor.xhtml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - -
-
- -
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
-
-
-
-
- diff --git a/1.sources/MyHealth/docroot/profile/UpdateFamilyDoctor.xhtml b/1.sources/MyHealth/docroot/profile/UpdateFamilyDoctor.xhtml deleted file mode 100644 index 711a727..0000000 --- a/1.sources/MyHealth/docroot/profile/UpdateFamilyDoctor.xhtml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - -
-
- -
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
-
-
-
-
- diff --git a/1.sources/MyHealth/docroot/profile/UpdatePatient.xhtml b/1.sources/MyHealth/docroot/profile/UpdatePatient.xhtml deleted file mode 100644 index b014f7b..0000000 --- a/1.sources/MyHealth/docroot/profile/UpdatePatient.xhtml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - -
-
- -
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
-
-
-
-
- diff --git a/1.sources/MyHealth/docroot/profile/UpdateSpecialistDoctor.xhtml b/1.sources/MyHealth/docroot/profile/UpdateSpecialistDoctor.xhtml deleted file mode 100644 index e24bb46..0000000 --- a/1.sources/MyHealth/docroot/profile/UpdateSpecialistDoctor.xhtml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - -
-
- -
-
- -
-
- -
-
-
-
- -
-
- -
-
-
-
-
-
-
-
- diff --git a/1.sources/MyHealth/src/managedbean/profile/AddFamilyDoctorMBean.java b/1.sources/MyHealth/src/managedbean/profile/AddFamilyDoctorMBean.java deleted file mode 100644 index 3d859b2..0000000 --- a/1.sources/MyHealth/src/managedbean/profile/AddFamilyDoctorMBean.java +++ /dev/null @@ -1,29 +0,0 @@ -package managedbean.profile; - -import java.io.Serializable; - -import javax.enterprise.context.RequestScoped; -import javax.inject.Named; - -import managedbean.common.ManagedBeanBase; - -/*** - * - * @author Marcos García Núñez (mgarcianun@uoc.edu) - * - */ -@Named("AddFamilyDoctorMBean") -@RequestScoped -public class AddFamilyDoctorMBean extends ManagedBeanBase implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * Constructor. Inicializa la conexión con el EJB Remoto - * - * @throws Exception - */ - public AddFamilyDoctorMBean() { - } - -} diff --git a/1.sources/MyHealth/src/managedbean/profile/AddPatientMBean.java b/1.sources/MyHealth/src/managedbean/profile/AddPatientMBean.java deleted file mode 100644 index 6310e3b..0000000 --- a/1.sources/MyHealth/src/managedbean/profile/AddPatientMBean.java +++ /dev/null @@ -1,112 +0,0 @@ -package managedbean.profile; - -import java.io.Serializable; - -import javax.enterprise.context.RequestScoped; -import javax.faces.application.FacesMessage; -import javax.faces.context.FacesContext; -import javax.inject.Named; - -import managedbean.common.ManagedBeanBase; - -/** - * ManagedBEan que gestiona la edición y actualización de una especialidad - * médica. - * - * @author mark - * - */ -@Named("addPatientMBean") -@RequestScoped -public class AddPatientMBean extends ManagedBeanBase implements Serializable { - - private static final long serialVersionUID = 1L; - - private String id; - private String nif; - private String name; - private String surname; - private String password; - private String passwordRepeat; - private String email; - private String primaryHealthCareCenter; - private String medicalSpecialty; - - /** - * Constructor. Inicializa la conexión con el EJB Remoto - * - * @throws Exception - */ - public AddPatientMBean() { - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getSurname() { - return surname; - } - - public void setSurname(String surname) { - this.surname = surname; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getNif() { - return nif; - } - - public void setNif(String nif) { - this.nif = nif; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public void save() { - FacesMessage msg; - - try { - - - msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Alta realizada", "El usuario " + name + " " + surname + " se ha registrado correctamente."); - } catch (Exception e) { - msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error", "Se ha producido un error inesperado: " + e.getLocalizedMessage()); - } - - FacesContext.getCurrentInstance().addMessage(null, msg); - } - - public String getPasswordRepeat() { - return passwordRepeat; - } - - public void setPasswordRepeat(String passwordRepeat) { - this.passwordRepeat = passwordRepeat; - } -} diff --git a/1.sources/MyHealth/src/managedbean/profile/AddSpecialistDoctorMBean.java b/1.sources/MyHealth/src/managedbean/profile/AddSpecialistDoctorMBean.java deleted file mode 100644 index 9086bc3..0000000 --- a/1.sources/MyHealth/src/managedbean/profile/AddSpecialistDoctorMBean.java +++ /dev/null @@ -1,34 +0,0 @@ -package managedbean.profile; - -import java.io.Serializable; - -import javax.ejb.EJB; -import javax.enterprise.context.RequestScoped; -import javax.inject.Named; - -import ejb.profile.ProfileFacadeRemote; -import managedbean.common.ManagedBeanBase; - -/*** - * - * @author Marcos García Núñez (mgarcianun@uoc.edu) - * - */ -@Named( "AddSpecialistDoctorMBean") -@RequestScoped -public class AddSpecialistDoctorMBean extends ManagedBeanBase implements Serializable { - - private static final long serialVersionUID = 1L; - - @EJB - private ProfileFacadeRemote remoteManager; - - /** - * Constructor. Inicializa la conexión con el EJB Remoto - * - * @throws Exception - */ - public AddSpecialistDoctorMBean() { - } - -} diff --git a/1.sources/MyHealth/src/managedbean/profile/ShowFamilyDoctorMBean.java b/1.sources/MyHealth/src/managedbean/profile/ShowFamilyDoctorMBean.java deleted file mode 100644 index 2c80a9c..0000000 --- a/1.sources/MyHealth/src/managedbean/profile/ShowFamilyDoctorMBean.java +++ /dev/null @@ -1,50 +0,0 @@ -package managedbean.profile; - -import java.io.Serializable; -import java.util.Properties; - -import javax.ejb.EJB; -import javax.enterprise.context.RequestScoped; -import javax.inject.Named; -import javax.naming.Context; -import javax.naming.InitialContext; - -import ejb.profile.ProfileFacadeRemote; -import managedbean.common.ManagedBeanBase; - -/*** - * - * @author Marcos García Núñez (mgarcianun@uoc.edu) - * - */ -@Named( "ShowFamilyDoctorMBean") -@RequestScoped -public class ShowFamilyDoctorMBean extends ManagedBeanBase implements Serializable { - - private static final long serialVersionUID = 1L; - - @EJB - private ProfileFacadeRemote remoteManager; - - /** - * Constructor. Inicializa la conexión con el EJB Remoto - * - * @throws Exception - */ - public ShowFamilyDoctorMBean() throws Exception { - initializeAdminFacadeRemote(); - } - - /** - * Inicializa la conexión con el EJB Remoto - * - * @throws Exception - */ - private void initializeAdminFacadeRemote() throws Exception { - Properties props = System.getProperties(); - Context ctx = new InitialContext(props); - remoteManager = (ProfileFacadeRemote) ctx - .lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote"); - } - -} diff --git a/1.sources/MyHealth/src/managedbean/profile/ShowPatientMBean.java b/1.sources/MyHealth/src/managedbean/profile/ShowPatientMBean.java deleted file mode 100644 index 059c7bc..0000000 --- a/1.sources/MyHealth/src/managedbean/profile/ShowPatientMBean.java +++ /dev/null @@ -1,49 +0,0 @@ -package managedbean.profile; - -import java.io.Serializable; -import java.util.Properties; - -import javax.ejb.EJB; -import javax.enterprise.context.RequestScoped; -import javax.inject.Named; -import javax.naming.Context; -import javax.naming.InitialContext; - -import ejb.profile.ProfileFacadeRemote; -import managedbean.common.ManagedBeanBase; - -/*** - * - * @author Marcos García Núñez (mgarcianun@uoc.edu) - * - */ -@Named("ShowPatientMBean") -@RequestScoped -public class ShowPatientMBean extends ManagedBeanBase implements Serializable { - - private static final long serialVersionUID = 1L; - - @EJB - private ProfileFacadeRemote remoteManager; - - /** - * Constructor. Inicializa la conexión con el EJB Remoto - * - * @throws Exception - */ - public ShowPatientMBean() throws Exception { - initializeAdminFacadeRemote(); - } - - /** - * Inicializa la conexión con el EJB Remoto - * - * @throws Exception - */ - private void initializeAdminFacadeRemote() throws Exception { - Properties props = System.getProperties(); - Context ctx = new InitialContext(props); - remoteManager = (ProfileFacadeRemote) ctx.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote"); - } - -} diff --git a/1.sources/MyHealth/src/managedbean/profile/ShowSpecialistDoctorMBean.java b/1.sources/MyHealth/src/managedbean/profile/ShowSpecialistDoctorMBean.java deleted file mode 100644 index 15bddbd..0000000 --- a/1.sources/MyHealth/src/managedbean/profile/ShowSpecialistDoctorMBean.java +++ /dev/null @@ -1,50 +0,0 @@ -package managedbean.profile; - -import java.io.Serializable; -import java.util.Properties; - -import javax.ejb.EJB; -import javax.enterprise.context.RequestScoped; -import javax.inject.Named; -import javax.naming.Context; -import javax.naming.InitialContext; - -import ejb.profile.ProfileFacadeRemote; -import managedbean.common.ManagedBeanBase; - -/*** - * - * @author Marcos García Núñez (mgarcianun@uoc.edu) - * - */ -@Named( "ShowSpecialistDoctorMBean") -@RequestScoped -public class ShowSpecialistDoctorMBean extends ManagedBeanBase implements Serializable { - - private static final long serialVersionUID = 1L; - - @EJB - private ProfileFacadeRemote remoteManager; - - /** - * Constructor. Inicializa la conexión con el EJB Remoto - * - * @throws Exception - */ - public ShowSpecialistDoctorMBean() throws Exception { - initializeAdminFacadeRemote(); - } - - /** - * Inicializa la conexión con el EJB Remoto - * - * @throws Exception - */ - private void initializeAdminFacadeRemote() throws Exception { - Properties props = System.getProperties(); - Context ctx = new InitialContext(props); - remoteManager = (ProfileFacadeRemote) ctx - .lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote"); - } - -} diff --git a/1.sources/MyHealth/src/managedbean/profile/UpdateFamilyDoctorMBean.java b/1.sources/MyHealth/src/managedbean/profile/UpdateFamilyDoctorMBean.java deleted file mode 100644 index 67e6f61..0000000 --- a/1.sources/MyHealth/src/managedbean/profile/UpdateFamilyDoctorMBean.java +++ /dev/null @@ -1,49 +0,0 @@ -package managedbean.profile; - -import java.io.Serializable; -import java.util.Properties; - -import javax.ejb.EJB; -import javax.enterprise.context.RequestScoped; -import javax.inject.Named; -import javax.naming.Context; -import javax.naming.InitialContext; - -import ejb.profile.ProfileFacadeRemote; -import managedbean.common.ManagedBeanBase; - -/*** - * - * @author Marcos García Núñez (mgarcianun@uoc.edu) - * - */ -@Named("UpdateFamilyDoctorMBean") -@RequestScoped -public class UpdateFamilyDoctorMBean extends ManagedBeanBase implements Serializable { - - private static final long serialVersionUID = 1L; - - @EJB - private ProfileFacadeRemote remoteManager; - - /** - * Constructor. Inicializa la conexión con el EJB Remoto - * - * @throws Exception - */ - public UpdateFamilyDoctorMBean() throws Exception { - initializeAdminFacadeRemote(); - } - - /** - * Inicializa la conexión con el EJB Remoto - * - * @throws Exception - */ - private void initializeAdminFacadeRemote() throws Exception { - Properties props = System.getProperties(); - Context ctx = new InitialContext(props); - remoteManager = (ProfileFacadeRemote) ctx.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote"); - } - -} diff --git a/1.sources/MyHealth/src/managedbean/profile/UpdatePatientMBean.java b/1.sources/MyHealth/src/managedbean/profile/UpdatePatientMBean.java deleted file mode 100644 index 6173ebc..0000000 --- a/1.sources/MyHealth/src/managedbean/profile/UpdatePatientMBean.java +++ /dev/null @@ -1,49 +0,0 @@ -package managedbean.profile; - -import java.io.Serializable; -import java.util.Properties; - -import javax.ejb.EJB; -import javax.enterprise.context.RequestScoped; -import javax.inject.Named; -import javax.naming.Context; -import javax.naming.InitialContext; - -import ejb.profile.ProfileFacadeRemote; -import managedbean.common.ManagedBeanBase; - -/*** - * - * @author Marcos García Núñez (mgarcianun@uoc.edu) - * - */ -@Named("UpdatePatientMBean") -@RequestScoped -public class UpdatePatientMBean extends ManagedBeanBase implements Serializable { - - private static final long serialVersionUID = 1L; - - @EJB - private ProfileFacadeRemote remoteManager; - - /** - * Constructor. Inicializa la conexión con el EJB Remoto - * - * @throws Exception - */ - public UpdatePatientMBean() throws Exception { - initializeAdminFacadeRemote(); - } - - /** - * Inicializa la conexión con el EJB Remoto - * - * @throws Exception - */ - private void initializeAdminFacadeRemote() throws Exception { - Properties props = System.getProperties(); - Context ctx = new InitialContext(props); - remoteManager = (ProfileFacadeRemote) ctx.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote"); - } - -} diff --git a/1.sources/MyHealth/src/managedbean/profile/UpdateSpecialistDoctorMBean.java b/1.sources/MyHealth/src/managedbean/profile/UpdateSpecialistDoctorMBean.java deleted file mode 100644 index 9327221..0000000 --- a/1.sources/MyHealth/src/managedbean/profile/UpdateSpecialistDoctorMBean.java +++ /dev/null @@ -1,49 +0,0 @@ -package managedbean.profile; - -import java.io.Serializable; -import java.util.Properties; - -import javax.ejb.EJB; -import javax.enterprise.context.RequestScoped; -import javax.inject.Named; -import javax.naming.Context; -import javax.naming.InitialContext; - -import ejb.profile.ProfileFacadeRemote; -import managedbean.common.ManagedBeanBase; - -/*** - * - * @author Marcos García Núñez (mgarcianun@uoc.edu) - * - */ -@Named("UpdateSpecialistDoctorMBean") -@RequestScoped -public class UpdateSpecialistDoctorMBean extends ManagedBeanBase implements Serializable { - - private static final long serialVersionUID = 1L; - - @EJB - private ProfileFacadeRemote remoteManager; - - /** - * Constructor. Inicializa la conexión con el EJB Remoto - * - * @throws Exception - */ - public UpdateSpecialistDoctorMBean() throws Exception { - initializeAdminFacadeRemote(); - } - - /** - * Inicializa la conexión con el EJB Remoto - * - * @throws Exception - */ - private void initializeAdminFacadeRemote() throws Exception { - Properties props = System.getProperties(); - Context ctx = new InitialContext(props); - remoteManager = (ProfileFacadeRemote) ctx.lookup("java:app/myHealth.jar/ProfileFacadeBean!ejb.component.ProfileFacadeRemote"); - } - -} From d39a82718ef301453462e8b906ad02ad52d2e39d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Sun, 15 Dec 2019 12:27:31 +0100 Subject: [PATCH 10/17] Formato de Datos de prueba (Camel Case) --- 2.database/02. Datos_prueba.sql | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/2.database/02. Datos_prueba.sql b/2.database/02. Datos_prueba.sql index e024e0b..0e3aaf4 100644 --- a/2.database/02. Datos_prueba.sql +++ b/2.database/02. Datos_prueba.sql @@ -5,22 +5,22 @@ insert into myhealth.administrator (email, password) values -- Insertar Algunos centros médicos INSERT INTO myhealth.primaryhealthcarecenter(name, location) VALUES -('CENTRO SAUDE A DOBLADA',' CALLE RUA FAISAN S/N') -,('CENTRO SAUDE BEMBRIVE',' CARRETERA BEMBRIVE 259') -,('CENTRO SAUDE BOLIVIA',' CALLE PIZARRO 22') -,('CENTRO SAUDE CASCO VELLO',' PLAZA CONSTITUCION 7') -,('CENTRO SAUDE COIA',' CALLE PONTEAREAS S/N') -,('CENTRO SAUDE COLMEIRO',' CALLE PINTOR COLMEIRO 11') -,('CENTRO SAUDE CORUXO',' CALLE RUA JOSE RIVAS CARRASQUEIRA S/N') -,('CENTRO SAUDE LAVADORES',' TRAVESIA BARREIRO 1 36') -,('CENTRO SAUDE LOPEZ MORA',' CALLE LOPEZ MORA 54') -,('CENTRO SAUDE MATAMA',' CAMINO CAMIÑO BABIO-AS CARNEIRAS S/N') -,('CENTRO SAUDE NICOLAS PEÑA',' CAMINO CAMIÑO REGUEIRO S/N') -,('CENTRO SAUDE ROSALIA DE CASTRO-BEIRAMAR',' CALLE ROSALIA DE CASTRO 21') -,('CENTRO SAUDE RUA CUBA',' CALLE CUBA 10') -,('CENTRO SAUDE SAN PAIO DE NAVIA',' CALLE POZA CABALO S/N') -,('CENTRO SAUDE SARDOMA',' CALLE RUA CANTEIRA DE BALIN 76') -,('CENTRO SAUDE TEIS',' CALLE ANGELA IGLESIAS REBOLLAR S/N'); +('Centro Saude A Doblada',' Calle Rua Faisan S/N') +,('Centro Saude Bembrive',' Carretera Bembrive 259') +,('Centro Saude Bolivia',' Calle Pizarro 22') +,('Centro Saude Casco Vello',' Plaza Constitucion 7') +,('Centro Saude Coia',' Calle Ponteareas S/N') +,('Centro Saude Colmeiro',' Calle Pintor Colmeiro 11') +,('Centro Saude Coruxo',' Calle Rua Jose Rivas Carrasqueira S/N') +,('Centro Saude Lavadores',' Travesia Barreiro 1 36') +,('Centro Saude Lopez Mora',' Calle Lopez Mora 54') +,('Centro Saude Matama',' Camino Camiño Babio-As Carneiras S/N') +,('Centro Saude Nicolas Peña',' Camino Camiño Regueiro S/N') +,('Centro Saude Rosalia De Castro-Beiramar',' Calle Rosalia De Castro 21') +,('Centro Saude Rua Cuba',' Calle Cuba 10') +,('Centro Saude San Paio De Navia',' Calle Poza Cabalo S/N') +,('Centro Saude Sardoma',' Calle Rua Canteira De Balin 76') +,('Centro Saude Teis',' Calle Angela Iglesias Rebollar S/N'); -- Inserta Especialidades médicas insert into MyHealth.MedicalSpecialty(name, description) values From 697a4d3c17f9426ea0994831caf52703dee888a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Sun, 15 Dec 2019 12:27:57 +0100 Subject: [PATCH 11/17] Corregido error (referncia a primerfaces) --- 1.sources/MyHealth/docroot/error.xhtml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/1.sources/MyHealth/docroot/error.xhtml b/1.sources/MyHealth/docroot/error.xhtml index c7e1cc7..374adb2 100644 --- a/1.sources/MyHealth/docroot/error.xhtml +++ b/1.sources/MyHealth/docroot/error.xhtml @@ -1,7 +1,8 @@ - + @@ -14,10 +15,8 @@
La acción que estaba realizando a causado un error inesperado en el sistema. A continuación podrá ver un descripción detallada del error para que pueda comunicarlo al equipo de soporte.
-
- Descripción del error -
- +
Descripción del error
+
From 4dc6828257986025952f7f3d6040fc091f878306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Sun, 15 Dec 2019 12:28:12 +0100 Subject: [PATCH 12/17] =?UTF-8?q?Restaurada=20opci=C3=B3n=20de=20registro?= =?UTF-8?q?=20de=20usuarios=20en=20el=20men=C3=BA.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.sources/MyHealth/src/managedbean/common/MenuMBean.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1.sources/MyHealth/src/managedbean/common/MenuMBean.java b/1.sources/MyHealth/src/managedbean/common/MenuMBean.java index 5a92700..35c1b7e 100644 --- a/1.sources/MyHealth/src/managedbean/common/MenuMBean.java +++ b/1.sources/MyHealth/src/managedbean/common/MenuMBean.java @@ -113,7 +113,7 @@ public class MenuMBean implements Serializable { // Perfil subMenu = new DefaultSubMenu("Gestionar perfil", "fa fa-gears"); if (SessionUtils.isLogedIn() == false) { -// subMenu.addElement(createMenuItem("Registro de usuario", "fa fa-user-plus", "/profile/RegisterUser", null)); + subMenu.addElement(createMenuItem("Registro de usuario", "fa fa-user-plus", "/profile/RegisterUser", null)); // subMenu.addElement(createMenuItem("Registro de paciente", "fa fa-user-plus", "/profile/AddPatient", null)); // subMenu.addElement(createMenuItem("Registro de médico", "fa fa-user-md", "/profile/AddFamilyDoctor", null)); // subMenu.addElement(createMenuItem("Registro de especialista", "fa fa-user-md", "/profile/AddSpecialistDoctor", null)); From b5a41958a2640a640a51b571f6b56915d19a8330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Sun, 15 Dec 2019 12:28:56 +0100 Subject: [PATCH 13/17] Implementada seguridad por URL para cada tipo de usuario. --- .../common/AuthorizationFilter.java | 105 +++++++++++++++++- .../src/managedbean/common/SessionUtils.java | 7 +- 2 files changed, 106 insertions(+), 6 deletions(-) diff --git a/1.sources/MyHealth/src/managedbean/common/AuthorizationFilter.java b/1.sources/MyHealth/src/managedbean/common/AuthorizationFilter.java index 84c85f8..95c971b 100644 --- a/1.sources/MyHealth/src/managedbean/common/AuthorizationFilter.java +++ b/1.sources/MyHealth/src/managedbean/common/AuthorizationFilter.java @@ -2,6 +2,9 @@ package managedbean.common; import java.io.IOException; +import java.util.ArrayList; +import java.util.Dictionary; +import java.util.List; import javax.servlet.Filter; import javax.servlet.FilterChain; @@ -14,6 +17,11 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import org.primefaces.model.menu.DefaultSeparator; +import org.primefaces.model.menu.DefaultSubMenu; + +import common.UserType; + @WebFilter(filterName = "AuthFilter", urlPatterns = { "*.xhtml" }) public class AuthorizationFilter implements Filter { @@ -34,11 +42,100 @@ public class AuthorizationFilter implements Filter { HttpSession ses = req.getSession(false); String reqURI = req.getRequestURI(); - if (reqURI.indexOf("/login.xhtml") >= 0 || reqURI.indexOf("/RegisterUser.xhtml") >= 0 || reqURI.indexOf("/home.xhtml") >= 0 || reqURI.indexOf("/public/") >= 0 - || reqURI.contains("javax.faces.resource") || SessionUtils.isLogedIn(ses) == true) + + // Para recursos publicos permitimos el acceso + if (reqURI.indexOf("/login.xhtml") >= 0 || reqURI.indexOf("/profile/RegisterUser.xhtml") >= 0 || reqURI.indexOf("/home.xhtml") >= 0 + || reqURI.indexOf("/error.xhtml") >= 0 || reqURI.indexOf("/public/") >= 0 || reqURI.contains("javax.faces.resource")) { chain.doFilter(request, response); - else - resp.sendRedirect(req.getContextPath() + "/login.xhtml"); + return; + } + + // Si el usuario está logeado comprobamos si está autorizado a ver la página + // solicitada. + if (SessionUtils.isLogedIn(ses) == true) { + UserType tipoUsuario = SessionUtils.getUserType(ses); + boolean authorized = false; + + switch (tipoUsuario) { + case ADMINISTRATOR: + if (reqURI.indexOf("/systemAdmin/ManageSpecialties") > 0) + authorized = true; + if (reqURI.indexOf("/systemAdmin/ManageHealthCareCenters") > 0) + authorized = true; + if (reqURI.indexOf("/systemAdmin/ListDoctorsByCenter") > 0) + authorized = true; + if (reqURI.indexOf("/visit/VisitView") > 0) + authorized = true; + if (reqURI.indexOf("/visit/UpdateVisit") > 0) + authorized = true; + break; + case PATIENT: + if (reqURI.indexOf("/visit/VisitView") > 0) + authorized = true; + if (reqURI.indexOf("/visit/AddVisit") > 0) + authorized = true; + if (reqURI.indexOf("/visit/UpdateVisit") > 0) + authorized = true; + if (reqURI.indexOf("/visit/CancelVisit") > 0) + authorized = true; + if (reqURI.indexOf("/medicaltest/AddQuestion") > 0) + authorized = true; + if (reqURI.indexOf("/medicaltest/ViewMedicalTest") > 0) + authorized = true; + if (reqURI.indexOf("/medicaltest/MedicalTests") > 0) + authorized = true; + if (reqURI.indexOf("/medicaltest/SearchSpecialistBySpecialty") > 0) + authorized = true; + if (reqURI.indexOf("/profile/UpdateProfile") > 0) + authorized = true; + if (reqURI.indexOf("/profile/ChangeFamilyDoctor") > 0) + authorized = true; + break; + case FAMILY_DOCTOR: + if (reqURI.indexOf("/visit/VisitView") > 0) + authorized = true; + if (reqURI.indexOf("/visit/VisitAddResult") > 0) + authorized = true; + if (reqURI.indexOf("/visit/VisitViewSchedules") > 0) + authorized = true; + if (reqURI.indexOf("/medicaltest/MedicalTests") > 0) + authorized = true; + if (reqURI.indexOf("/medicaltest/AnswerQuestion") > 0) + authorized = true; + if (reqURI.indexOf("/medicaltest/PendingQuestions") > 0) + authorized = true; + if (reqURI.indexOf("/medicaltest/ViewMedicalTest") > 0) + authorized = true; + if (reqURI.indexOf("/profile/UpdateProfile") > 0) + authorized = true; + if (reqURI.indexOf("/profile/ChangePrimaryHealthCareCenter") > 0) + authorized = true; + break; + case SPECIALIST_DOCTOR: + if (reqURI.indexOf("/medicaltest/MedicalTests") > 0) + authorized = true; + if (reqURI.indexOf("/medicaltest/AddMedicalTest") > 0) + authorized = true; + if (reqURI.indexOf("/medicaltest/ViewMedicalTest") > 0) + authorized = true; + if (reqURI.indexOf("/medicaltest/AddImageToMedicalTest") > 0) + authorized = true; + if (reqURI.indexOf("/profile/UpdateProfile") > 0) + authorized = true; + break; + } + + if (authorized == true) { + chain.doFilter(request, response); + return; + } else { + resp.sendRedirect(req.getContextPath() + "/error.xhtml"); + return; + } + + } + + resp.sendRedirect(req.getContextPath() + "/login.xhtml"); } catch (Exception e) { System.out.println(e.getMessage()); } diff --git a/1.sources/MyHealth/src/managedbean/common/SessionUtils.java b/1.sources/MyHealth/src/managedbean/common/SessionUtils.java index 80f5eb3..2b3bb97 100644 --- a/1.sources/MyHealth/src/managedbean/common/SessionUtils.java +++ b/1.sources/MyHealth/src/managedbean/common/SessionUtils.java @@ -70,9 +70,12 @@ public class SessionUtils { else return ""; } - + public static UserType getUserType() { - HttpSession session = getSession(); + return getUserType(getSession()); + } + + public static UserType getUserType(HttpSession session) { if (session != null && session.getAttribute(SessionUtils.SESSION_VAR_USERTYPE) != null) return UserType.class.cast(session.getAttribute(SessionUtils.SESSION_VAR_USERTYPE)); else From 1bfd7317e6d7285cad65aac0a9925a1238d99781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Sun, 15 Dec 2019 14:10:09 +0100 Subject: [PATCH 14/17] =?UTF-8?q?Implementaci=C3=B3n=20de=20mensajes=20de?= =?UTF-8?q?=20error=20que=20se=20muestran=20en=20la=20pagina=20de=20error.?= =?UTF-8?q?=20El=20mensaje=20de=20error=20se=20env=C3=ADa=20a=20trav=C3=A9?= =?UTF-8?q?s=20de=20la=20sesi=C3=B3n.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.sources/MyHealth/docroot/error.xhtml | 19 +++++++---- .../common/AuthorizationFilter.java | 4 ++- .../managedbean/common/ManagedBeanBase.java | 10 +++++- .../src/managedbean/common/SessionUtils.java | 32 ++++++++++++++++--- .../src/managedbean/common/homeMBean.java | 9 +++++- 5 files changed, 60 insertions(+), 14 deletions(-) diff --git a/1.sources/MyHealth/docroot/error.xhtml b/1.sources/MyHealth/docroot/error.xhtml index 374adb2..e961f1d 100644 --- a/1.sources/MyHealth/docroot/error.xhtml +++ b/1.sources/MyHealth/docroot/error.xhtml @@ -10,22 +10,29 @@
- + + + + +
La acción que estaba realizando a causado un error inesperado en el sistema. A continuación podrá ver un descripción detallada del error para que pueda comunicarlo al equipo de soporte.
-
Descripción del error
+
+ + +
- +
-
-
+
+
-
+
diff --git a/1.sources/MyHealth/src/managedbean/common/AuthorizationFilter.java b/1.sources/MyHealth/src/managedbean/common/AuthorizationFilter.java index 95c971b..945a532 100644 --- a/1.sources/MyHealth/src/managedbean/common/AuthorizationFilter.java +++ b/1.sources/MyHealth/src/managedbean/common/AuthorizationFilter.java @@ -6,6 +6,7 @@ import java.util.ArrayList; import java.util.Dictionary; import java.util.List; +import javax.faces.application.FacesMessage; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; @@ -129,7 +130,8 @@ public class AuthorizationFilter implements Filter { chain.doFilter(request, response); return; } else { - resp.sendRedirect(req.getContextPath() + "/error.xhtml"); + SessionUtils.addMessage(ses, FacesMessage.SEVERITY_ERROR, "No está autorizado a acceder a la página solicitada. Por favor, utilice el menú principal de la aplicación.", String.format("Se ha producido una expción de autorización, su usuario no está autorizado a acceder a la página: (%s).", reqURI)); + resp.sendRedirect(req.getContextPath() + "/error.xhtml?type=auth"); return; } diff --git a/1.sources/MyHealth/src/managedbean/common/ManagedBeanBase.java b/1.sources/MyHealth/src/managedbean/common/ManagedBeanBase.java index c9d4fb7..1e742e3 100644 --- a/1.sources/MyHealth/src/managedbean/common/ManagedBeanBase.java +++ b/1.sources/MyHealth/src/managedbean/common/ManagedBeanBase.java @@ -105,7 +105,15 @@ public class ManagedBeanBase { } protected void addFacesMessage(FacesContext context, FacesMessage.Severity severity, String summary, String detail) { - context.addMessage(null, new FacesMessage(severity, summary, detail)); + this.addFacesMessage(context, new FacesMessage(severity, summary, detail)); + } + + protected void addFacesMessage(FacesMessage facesMsg) { + this.addFacesMessage(FacesContext.getCurrentInstance(), facesMsg); + } + + protected void addFacesMessage(FacesContext context, FacesMessage facesMsg) { + context.addMessage(null, facesMsg); } protected void manageException(Exception ex) { diff --git a/1.sources/MyHealth/src/managedbean/common/SessionUtils.java b/1.sources/MyHealth/src/managedbean/common/SessionUtils.java index 2b3bb97..0aa178f 100644 --- a/1.sources/MyHealth/src/managedbean/common/SessionUtils.java +++ b/1.sources/MyHealth/src/managedbean/common/SessionUtils.java @@ -1,6 +1,7 @@ package managedbean.common; +import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext; import javax.servlet.ServletRequest; import javax.servlet.http.HttpServletRequest; @@ -14,6 +15,7 @@ public class SessionUtils { public static final String SESSION_VAR_USERID = "userId"; public static final String SESSION_VAR_USERTYPE = "userType"; public static final String SESSION_VAR_USER = "loggedOnUser"; + public static final String SESSION_VAR_MESSAGE = "facesMessage"; public static HttpSession getSession() { FacesContext ctx = FacesContext.getCurrentInstance(); @@ -47,7 +49,7 @@ public class SessionUtils { public static boolean isLogedIn() { return isLogedIn(getSession()); } - + public static boolean isLogedIn(HttpSession session) { if (session != null && session.getAttribute(SessionUtils.SESSION_VAR_USERID) != null) return true; @@ -73,15 +75,15 @@ public class SessionUtils { public static UserType getUserType() { return getUserType(getSession()); - } - + } + public static UserType getUserType(HttpSession session) { if (session != null && session.getAttribute(SessionUtils.SESSION_VAR_USERTYPE) != null) return UserType.class.cast(session.getAttribute(SessionUtils.SESSION_VAR_USERTYPE)); else return null; - } - + } + public static LoggedUserTO getloggedOnUser() { HttpSession session = getSession(); if (session != null && session.getAttribute(SessionUtils.SESSION_VAR_USER) != null) @@ -89,4 +91,24 @@ public class SessionUtils { else return null; } + + public static FacesMessage getMessage() { + HttpSession session = getSession(); + if (session != null && session.getAttribute(SessionUtils.SESSION_VAR_MESSAGE) != null) { + FacesMessage msg = FacesMessage.class.cast(session.getAttribute(SessionUtils.SESSION_VAR_MESSAGE)); + session.removeAttribute(SessionUtils.SESSION_VAR_MESSAGE); + return msg; + } else + return null; + } + + public static void addMessage(FacesMessage.Severity severity, String summary, String detail) { + addMessage(getSession(), severity, summary, detail); + } + + public static void addMessage(HttpSession session, FacesMessage.Severity severity, String summary, String detail) { + if (session != null) + session.setAttribute(SessionUtils.SESSION_VAR_MESSAGE, new FacesMessage(severity, summary, detail)); + } + } diff --git a/1.sources/MyHealth/src/managedbean/common/homeMBean.java b/1.sources/MyHealth/src/managedbean/common/homeMBean.java index 4d1dcdc..9e3edcc 100644 --- a/1.sources/MyHealth/src/managedbean/common/homeMBean.java +++ b/1.sources/MyHealth/src/managedbean/common/homeMBean.java @@ -5,6 +5,7 @@ import java.util.List; import javax.annotation.PostConstruct; import javax.enterprise.context.RequestScoped; +import javax.faces.application.FacesMessage; import javax.inject.Named; import common.UserType; @@ -16,7 +17,7 @@ import common.UserType; */ @Named("home") @RequestScoped -public class homeMBean implements Serializable { +public class homeMBean extends ManagedBeanBase implements Serializable { private static final long serialVersionUID = 1L; private boolean isLogedIn; @@ -31,6 +32,12 @@ public class homeMBean implements Serializable { userName = SessionUtils.getUserName(); userId = SessionUtils.getUserId(); userType = SessionUtils.getUserType(); + + FacesMessage message = SessionUtils.getMessage(); + + if (message != null) { + this.addFacesMessage(message); + } } public List getThemes() { From 7193ffd2504964dd59bdb7eacf537d8490354335 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Sun, 15 Dec 2019 19:31:41 +0100 Subject: [PATCH 15/17] =?UTF-8?q?Metodos=20para=20busqueda=20de=20paciente?= =?UTF-8?q?s,=20m=C3=A9dicos=20de=20familia=20y=20medicos=20especialistas?= =?UTF-8?q?=20por=20NIF.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/ejb/common/CommonFacadeBean.java | 109 ++++++++++++------ .../src/ejb/common/CommonFacadeLocal.java | 12 +- .../src/ejb/common/CommonFacadeRemote.java | 12 +- 3 files changed, 92 insertions(+), 41 deletions(-) diff --git a/1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java b/1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java index e150321..47b55db 100644 --- a/1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java +++ b/1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java @@ -161,114 +161,153 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal { public MedicalSpecialtyTO getPOJOforMedicalSpecialtyJPA(MedicalSpecialtyJPA ms) { MedicalSpecialtyTO msTO = null; - + if (ms != null) { msTO = new MedicalSpecialtyTO(ms.getId(), ms.getName(), ms.getDescription()); } - + return msTO; } public PrimaryHealthCareCenterTO getPOJOforPrimaryHealthCareCenterJPA(PrimaryHealthCareCenterJPA phc) { PrimaryHealthCareCenterTO phcTO = null; - + if (phc != null) { phcTO = new PrimaryHealthCareCenterTO(phc.getId(), phc.getName(), phc.getLocation()); } - + return phcTO; } public SpecialistDoctorTO getPOJOforSpecialistDoctorJPA(SpecialistDoctorJPA sd, int nestedProps) { SpecialistDoctorTO sdTO = null; - + if (sd != null) { MedicalSpecialtyJPA ms = null; if (nestedProps > 0) ms = sd.getMedicalSpecialty(); - - nestedProps--; - sdTO = new SpecialistDoctorTO(sd.getId(), sd.getProfessionalNumber(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail(), this.getPOJOforMedicalSpecialtyJPA(ms)); + + nestedProps--; + sdTO = new SpecialistDoctorTO(sd.getId(), sd.getProfessionalNumber(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail(), + this.getPOJOforMedicalSpecialtyJPA(ms)); } - + return sdTO; } - + public FamilyDoctorTO getPOJOforFamilyDoctorJPA(FamilyDoctorJPA fd, int nestedProps) { FamilyDoctorTO fdTO = null; - + if (fd != null) { PrimaryHealthCareCenterJPA phc = null; if (nestedProps > 0) phc = fd.getPrimaryHealthCareCenter(); - + nestedProps--; - fdTO = new FamilyDoctorTO(fd.getId(), fd.getProfessionalNumber(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), this.getPOJOforPrimaryHealthCareCenterJPA(phc)); + fdTO = new FamilyDoctorTO(fd.getId(), fd.getProfessionalNumber(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), + this.getPOJOforPrimaryHealthCareCenterJPA(phc)); } - + return fdTO; } - + public PatientTO getPOJOforPatientJPA(PatientJPA pat, int nestedProps) { PatientTO paTO = null; - + if (pat != null) { FamilyDoctorJPA fd = null; if (nestedProps > 0) fd = pat.getFamilyDoctor(); - + nestedProps--; - paTO = new PatientTO(pat.getId(), pat.getPersonalIdentificationCode(), pat.getNif(), pat.getName(), pat.getSurname(), pat.getPassword(), pat.getEmail(), this.getPOJOforFamilyDoctorJPA(fd, nestedProps)); + paTO = new PatientTO(pat.getId(), pat.getPersonalIdentificationCode(), pat.getNif(), pat.getName(), pat.getSurname(), pat.getPassword(), pat.getEmail(), + this.getPOJOforFamilyDoctorJPA(fd, nestedProps)); } - + return paTO; } - + public PatientTO findPatientById(int patientId) { // Recuperamos propiedades anidadas 1 nivel! return this.getPOJOforPatientJPA(entman.find(PatientJPA.class, patientId), 1); } - - public PatientJPA findPatientByCode(String code) { + public PatientTO findPatientByCode(String code) { TypedQuery query = entman.createQuery("from PatientJPA pat where pat.personalIdentificationCode=:code", PatientJPA.class); - + query.setMaxResults(1); query.setParameter("code", code); - + List results = query.getResultList(); if (results.size() > 0) - return results.get(0); + return this.getPOJOforPatientJPA(results.get(0), 1); else - return null; } + return null; + } + + public PatientTO findPatientByNif(String searchValue) { + TypedQuery query = entman.createQuery("from PatientJPA pat where pat.nif=:nif", PatientJPA.class); + query.setMaxResults(1); + query.setParameter("nif", searchValue); + + List results = query.getResultList(); + if (results.size() > 0) + return this.getPOJOforPatientJPA(results.get(0), 1); + else + return null; + } public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId) { return this.getPOJOforFamilyDoctorJPA(entman.find(FamilyDoctorJPA.class, ProfessionalNumberId), 1); } - public FamilyDoctorJPA findFamilyDoctorByCode(String code) { + public FamilyDoctorTO findFamilyDoctorByCode(String code) { TypedQuery query = entman.createQuery("from FamilyDoctorJPA d where d.professionalNumber=:code", FamilyDoctorJPA.class); - + query.setParameter("code", code); - + List results = query.getResultList(); if (results.size() > 0) - return results.get(0); + return this.getPOJOforFamilyDoctorJPA(results.get(0), 1); else return null; } - + + public FamilyDoctorTO findFamilyDoctorByNif(String searchValue) { + TypedQuery query = entman.createQuery("from FamilyDoctorJPA d where d.nif=:nif", FamilyDoctorJPA.class); + query.setMaxResults(1); + query.setParameter("nif", searchValue); + + List results = query.getResultList(); + if (results.size() > 0) + return this.getPOJOforFamilyDoctorJPA(results.get(0), 1); + else + return null; + } + public SpecialistDoctorTO findSpecialistDoctorById(int ProfessionalNumberId) { return this.getPOJOforSpecialistDoctorJPA(entman.find(SpecialistDoctorJPA.class, ProfessionalNumberId), 1); } - public SpecialistDoctorJPA findSpecialistDoctorByCode(String code) { + public SpecialistDoctorTO findSpecialistDoctorByCode(String code) { TypedQuery query = entman.createQuery("from SpecialistDoctorJPA d where d.professionalNumber=:code", SpecialistDoctorJPA.class); - + query.setParameter("code", code); - + List results = query.getResultList(); if (results.size() > 0) - return results.get(0); + return this.getPOJOforSpecialistDoctorJPA(results.get(0), 1); + else + return null; + } + + public SpecialistDoctorTO findSpecialistDoctorByNif(String searchValue) { + TypedQuery query = entman.createQuery("from SpecialistDoctorJPA d where d.nif=:nif", SpecialistDoctorJPA.class); + query.setMaxResults(1); + query.setParameter("nif", searchValue); + + List results = query.getResultList(); + if (results.size() > 0) + return this.getPOJOforSpecialistDoctorJPA(results.get(0), 1); else return null; } diff --git a/1.sources/MyHealth/src/ejb/common/CommonFacadeLocal.java b/1.sources/MyHealth/src/ejb/common/CommonFacadeLocal.java index bd6a081..72772f2 100644 --- a/1.sources/MyHealth/src/ejb/common/CommonFacadeLocal.java +++ b/1.sources/MyHealth/src/ejb/common/CommonFacadeLocal.java @@ -44,15 +44,21 @@ public interface CommonFacadeLocal { public PatientTO findPatientById(int patientId); - public PatientJPA findPatientByCode(String code); + public PatientTO findPatientByCode(String code); + + public PatientTO findPatientByNif(String searchValue); public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId); - public FamilyDoctorJPA findFamilyDoctorByCode(String code); + public FamilyDoctorTO findFamilyDoctorByCode(String code); + + public FamilyDoctorTO findFamilyDoctorByNif(String searchValue); public SpecialistDoctorTO findSpecialistDoctorById(int ProfessionalNumberId); - public SpecialistDoctorJPA findSpecialistDoctorByCode(String code); + public SpecialistDoctorTO findSpecialistDoctorByCode(String code); + + public SpecialistDoctorTO findSpecialistDoctorByNif(String searchValue); public MedicalSpecialtyTO getPOJOforMedicalSpecialtyJPA(MedicalSpecialtyJPA ms); diff --git a/1.sources/MyHealth/src/ejb/common/CommonFacadeRemote.java b/1.sources/MyHealth/src/ejb/common/CommonFacadeRemote.java index 44f38cc..e386ac8 100644 --- a/1.sources/MyHealth/src/ejb/common/CommonFacadeRemote.java +++ b/1.sources/MyHealth/src/ejb/common/CommonFacadeRemote.java @@ -42,14 +42,20 @@ public interface CommonFacadeRemote { public PatientTO findPatientById(int patientId); - public PatientJPA findPatientByCode(String code); + public PatientTO findPatientByCode(String code); + + public PatientTO findPatientByNif(String searchValue); public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId); - public FamilyDoctorJPA findFamilyDoctorByCode(String code); + public FamilyDoctorTO findFamilyDoctorByCode(String code); + + public FamilyDoctorTO findFamilyDoctorByNif(String searchValue); public SpecialistDoctorTO findSpecialistDoctorById(int ProfessionalNumberId); - public SpecialistDoctorJPA findSpecialistDoctorByCode(String code); + public SpecialistDoctorTO findSpecialistDoctorByCode(String code); + + public SpecialistDoctorTO findSpecialistDoctorByNif(String searchValue); } From 5a3ed35c168c78a3b3aca63d6f5679ad619ea1fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Sun, 15 Dec 2019 19:32:30 +0100 Subject: [PATCH 16/17] =?UTF-8?q?Implementada=20comprobaci=C3=B3n=20de=20N?= =?UTF-8?q?IFs=20duplicados=20para=20pacientes=20y=20todos=20los=20m=C3=A9?= =?UTF-8?q?dicos.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.sources/MyHealth/docroot/header.xhtml | 2 +- .../docroot/profile/RegisterUser.xhtml | 18 ++++--- .../docroot/profile/UpdateProfile.xhtml | 14 ++--- .../systemAdmin/SystemAdminFacadeBean.java | 14 ++--- .../managedbean/common/ManagedBeanBase.java | 20 ++++--- .../managedbean/common/ValidationUtils.java | 53 +++++++++++++++++++ .../src/managedbean/common/homeMBean.java | 2 +- .../profile/RegisterUserMBean.java | 9 ++++ .../profile/UpdateProfileMBean.java | 9 ++++ 9 files changed, 110 insertions(+), 31 deletions(-) diff --git a/1.sources/MyHealth/docroot/header.xhtml b/1.sources/MyHealth/docroot/header.xhtml index 45a0088..2e76837 100644 --- a/1.sources/MyHealth/docroot/header.xhtml +++ b/1.sources/MyHealth/docroot/header.xhtml @@ -33,7 +33,7 @@

- +
diff --git a/1.sources/MyHealth/src/ejb/systemAdmin/SystemAdminFacadeBean.java b/1.sources/MyHealth/src/ejb/systemAdmin/SystemAdminFacadeBean.java index ea2eccf..37785f3 100644 --- a/1.sources/MyHealth/src/ejb/systemAdmin/SystemAdminFacadeBean.java +++ b/1.sources/MyHealth/src/ejb/systemAdmin/SystemAdminFacadeBean.java @@ -5,15 +5,15 @@ import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; +import TO.FamilyDoctorTO; import TO.LoggedUserTO; +import TO.PatientTO; +import TO.SpecialistDoctorTO; import common.Constants; import common.HashUtils; import common.UserType; import ejb.common.CommonFacadeLocal; import jpa.AdministratorJPA; -import jpa.FamilyDoctorJPA; -import jpa.PatientJPA; -import jpa.SpecialistDoctorJPA; /** * @@ -29,7 +29,7 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote { @EJB CommonFacadeLocal commonServices; - + /** * Si la autenticación no es correcgta devuelve null, sino devuelve un POJO con * datos del usuario logeado. @@ -61,20 +61,20 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote { if (userCode.startsWith(Constants.PERSONAL_IDENTIFICATION_CODE_PREFIX)) { // Si el identificador de usuario es de tipo paciente, intentamos realizar el // login. - PatientJPA pat = this.commonServices.findPatientByCode(userCode); + PatientTO pat = this.commonServices.findPatientByCode(userCode); if (pat != null) { usr = new LoggedUserTO(String.valueOf(pat.getId()), pat.getName(), pat.getPassword(), UserType.PATIENT); } } else if (userCode.startsWith(Constants.PROFESSIONAL_NUMBER_PREFIX)) { // Si el identificador de usuario es de tipo profesional, intentamos realizar el // login, primero como médico de familia, después como especialista - FamilyDoctorJPA fd = this.commonServices.findFamilyDoctorByCode(userCode); + FamilyDoctorTO fd = this.commonServices.findFamilyDoctorByCode(userCode); if (fd != null) { usr = new LoggedUserTO(String.valueOf(fd.getId()), fd.getName(), fd.getPassword(), UserType.FAMILY_DOCTOR); } else { // No era un código de médico de familia, intenamos logearlo como especialista - SpecialistDoctorJPA sd = this.commonServices.findSpecialistDoctorByCode(userCode); + SpecialistDoctorTO sd = this.commonServices.findSpecialistDoctorByCode(userCode); if (sd != null) { usr = new LoggedUserTO(String.valueOf(sd.getId()), sd.getName(), sd.getPassword(), UserType.SPECIALIST_DOCTOR); diff --git a/1.sources/MyHealth/src/managedbean/common/ManagedBeanBase.java b/1.sources/MyHealth/src/managedbean/common/ManagedBeanBase.java index 1e742e3..74ac0dd 100644 --- a/1.sources/MyHealth/src/managedbean/common/ManagedBeanBase.java +++ b/1.sources/MyHealth/src/managedbean/common/ManagedBeanBase.java @@ -95,25 +95,29 @@ public class ManagedBeanBase { protected void addFacesMessageKeep(FacesMessage.Severity severity, String summary, String detail) { FacesContext context = FacesContext.getCurrentInstance(); - this.addFacesMessage(FacesContext.getCurrentInstance(), severity, summary, detail); + this.addFacesMessage(FacesContext.getCurrentInstance(), null, severity, summary, detail); context.getExternalContext().getFlash().setKeepMessages(true); } protected void addFacesMessage(FacesMessage.Severity severity, String summary, String detail) { - this.addFacesMessage(FacesContext.getCurrentInstance(), severity, summary, detail); + this.addFacesMessage(FacesContext.getCurrentInstance(), null, severity, summary, detail); + } + + protected void addFacesMessage(String clientId, FacesMessage.Severity severity, String summary, String detail) { + this.addFacesMessage(FacesContext.getCurrentInstance(), clientId, severity, summary, detail); } - protected void addFacesMessage(FacesContext context, FacesMessage.Severity severity, String summary, String detail) { - this.addFacesMessage(context, new FacesMessage(severity, summary, detail)); + protected void addFacesMessage(FacesContext context, String clientId, FacesMessage.Severity severity, String summary, String detail) { + this.addFacesMessage(context, clientId, new FacesMessage(severity, summary, detail)); } - protected void addFacesMessage(FacesMessage facesMsg) { - this.addFacesMessage(FacesContext.getCurrentInstance(), facesMsg); + protected void addFacesMessage(FacesMessage facesMsg, String clientId) { + this.addFacesMessage(FacesContext.getCurrentInstance(), clientId, facesMsg); } - protected void addFacesMessage(FacesContext context, FacesMessage facesMsg) { - context.addMessage(null, facesMsg); + protected void addFacesMessage(FacesContext context, String clientId, FacesMessage facesMsg) { + context.addMessage(clientId, facesMsg); } protected void manageException(Exception ex) { diff --git a/1.sources/MyHealth/src/managedbean/common/ValidationUtils.java b/1.sources/MyHealth/src/managedbean/common/ValidationUtils.java index f011bc3..d147b8e 100644 --- a/1.sources/MyHealth/src/managedbean/common/ValidationUtils.java +++ b/1.sources/MyHealth/src/managedbean/common/ValidationUtils.java @@ -1,5 +1,11 @@ package managedbean.common; +import TO.FamilyDoctorTO; +import TO.PatientTO; +import TO.SpecialistDoctorTO; +import common.UserType; +import ejb.common.CommonFacadeRemote; + /*** * * @author Marcos García Núñez (mgarcianun@uoc.edu) @@ -47,4 +53,51 @@ public class ValidationUtils { return false; } + /** + * Comprueba si un NIF existe para un tipo de usuario. * No se permite que el + * mismo NIF esté registrado como médico de familia y como especialista. * Se + * permite que el mismo NIF esté registrado como paciente y como médico (de + * familia o especialista) + * + * @param remoteSvc Servicio Remoto para recuperar datos. + * @param userType Tipo de usuario a comprobar + * @param nif NIF a comprobar. + * @param id Parámetro opcional, id del usuario actual (si encuentra el + * mismo nif y el usuario coincide no se devuelve la + * coincidencia) + * @return true si el NIF ya estaba registrado para un usuario diferente. + */ + public static boolean checkIfNifAlreadyRegistered(CommonFacadeRemote remoteSvc, UserType userType, String nif, Integer id) { + boolean nifExists = false; + + switch (userType) { + case ADMINISTRATOR: + break; + case FAMILY_DOCTOR: + case SPECIALIST_DOCTOR: + FamilyDoctorTO fd = remoteSvc.findFamilyDoctorByNif(nif); + + if (fd == null) { + // Si el nif no está en uso para un médico de familia, reivsamos si está en uso + // para los especialistas + SpecialistDoctorTO sd = remoteSvc.findSpecialistDoctorByNif(nif); + + if (sd != null && (id == null || fd.getId() != id)) + nifExists = true; + } else if (id == null || fd.getId() != id) + // Si se trata de un usuario diferente, entonces está repetido + nifExists = true; + + break; + case PATIENT: + PatientTO pat = remoteSvc.findPatientByNif(nif); + + // Si se trata de un usuario diferente, entonces está repetido + if (pat != null && (id == null || pat.getId() != id)) + nifExists = true; + break; + } + + return nifExists; + } } diff --git a/1.sources/MyHealth/src/managedbean/common/homeMBean.java b/1.sources/MyHealth/src/managedbean/common/homeMBean.java index 9e3edcc..89a2b55 100644 --- a/1.sources/MyHealth/src/managedbean/common/homeMBean.java +++ b/1.sources/MyHealth/src/managedbean/common/homeMBean.java @@ -36,7 +36,7 @@ public class homeMBean extends ManagedBeanBase implements Serializable { FacesMessage message = SessionUtils.getMessage(); if (message != null) { - this.addFacesMessage(message); + this.addFacesMessage(message, null); } } diff --git a/1.sources/MyHealth/src/managedbean/profile/RegisterUserMBean.java b/1.sources/MyHealth/src/managedbean/profile/RegisterUserMBean.java index d53a778..60896c1 100644 --- a/1.sources/MyHealth/src/managedbean/profile/RegisterUserMBean.java +++ b/1.sources/MyHealth/src/managedbean/profile/RegisterUserMBean.java @@ -127,6 +127,11 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable { } return this.medicalSpecialitiesList; } + + public void hadleNIFValueChange() { + if (ValidationUtils.checkIfNifAlreadyRegistered(this.getRemoteManagerCommon(), this.userType, this.nif, null) == true) + this.addFacesMessage("frmRegisterUser:nif", FacesMessage.SEVERITY_WARN, "NIF duplicado", "El nif indicado pertenece a otro usuario previamente registrado"); + } public boolean isPatient() { return (this.userType == UserType.PATIENT); @@ -199,6 +204,10 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable { this.addFacesMessage(FacesMessage.SEVERITY_WARN, "El NIF indicado no es válido", "Por favor, especifique un NIF válido."); error++; } + if (ValidationUtils.checkIfNifAlreadyRegistered(this.getRemoteManagerCommon(), this.userType, this.nif, null) == true) { + this.addFacesMessage("frmRegisterUser:nif", FacesMessage.SEVERITY_WARN, "NIF duplicado", "El nif indicado pertenece a otro usuario previamente registrado"); + error++; + } if (error == 0) { try { diff --git a/1.sources/MyHealth/src/managedbean/profile/UpdateProfileMBean.java b/1.sources/MyHealth/src/managedbean/profile/UpdateProfileMBean.java index 9199d59..3434842 100644 --- a/1.sources/MyHealth/src/managedbean/profile/UpdateProfileMBean.java +++ b/1.sources/MyHealth/src/managedbean/profile/UpdateProfileMBean.java @@ -172,6 +172,11 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable return this.medicalSpecialitiesList; } + public void hadleNIFValueChange() { + if (ValidationUtils.checkIfNifAlreadyRegistered(this.getRemoteManagerCommon(), this.userType, this.nif, this.id) == true) + this.addFacesMessage("frmUpdateProfile:nif", FacesMessage.SEVERITY_WARN, "NIF duplicado", "El nif indicado pertenece a otro usuario previamente registrado"); + } + public List getFamilyDoctorList() { return familyDoctorList; } @@ -261,6 +266,10 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable this.addFacesMessage(FacesMessage.SEVERITY_WARN, "El NIF indicado no es válido", "Por favor, especifique un NIF válido."); error++; } + if (ValidationUtils.checkIfNifAlreadyRegistered(this.getRemoteManagerCommon(), this.userType, this.nif, this.id) == true) { + this.addFacesMessage("frmUpdateProfile:nif", FacesMessage.SEVERITY_WARN, "NIF duplicado", "El nif indicado pertenece a otro usuario previamente registrado"); + error++; + } if (changePassword == true) { // el usuario queire cambiar el password Comprobamos que el password // especificado coincide con el guardado From f55ebe3bb9bec3575f7b05e543449756e499f6a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Sun, 15 Dec 2019 19:52:23 +0100 Subject: [PATCH 17/17] =?UTF-8?q?Corregido=20error:=20Se=20utilizaba=20la?= =?UTF-8?q?=20secuencia=20equivocada=20para=20genear=20los=20c=C3=B3digo?= =?UTF-8?q?=20CIP=20de=20pacientes.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.sources/MyHealth/src/ejb/profile/ProfileFacadeBean.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1.sources/MyHealth/src/ejb/profile/ProfileFacadeBean.java b/1.sources/MyHealth/src/ejb/profile/ProfileFacadeBean.java index 5260402..3b59839 100644 --- a/1.sources/MyHealth/src/ejb/profile/ProfileFacadeBean.java +++ b/1.sources/MyHealth/src/ejb/profile/ProfileFacadeBean.java @@ -41,7 +41,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote { } private String getNextPersonalIdentificationCode() { - Query q = entman.createNativeQuery("select nextval('myhealth.profesionalnumber')"); + Query q = entman.createNativeQuery("select nextval('myhealth.codigoidentificacionpaciente')"); return Constants.PERSONAL_IDENTIFICATION_CODE_PREFIX.concat(String.valueOf(q.getSingleResult())); }