From 1be6cfd72cba5455da8e6bd3047c6a619368b656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Wed, 11 Dec 2019 00:24:27 +0100 Subject: [PATCH 01/21] =?UTF-8?q?Creadas=20claves=20Auton=C3=BAmericas=20(?= =?UTF-8?q?Id)=20para=20Centraos=20de=20atenci=C3=B3n=20de=20primaria=20(C?= =?UTF-8?q?APS)=20y=20modificados=20campos=20relacionados.=20Datos=20de=20?= =?UTF-8?q?prueba=20para=20CAPs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 2.database/01.CreateTables.sql | 21 +++++++++++---------- 2.database/02. Datos_prueba.sql | 20 +++++++++++++++++++- 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/2.database/01.CreateTables.sql b/2.database/01.CreateTables.sql index 7cfac52..03f5400 100644 --- a/2.database/01.CreateTables.sql +++ b/2.database/01.CreateTables.sql @@ -32,13 +32,13 @@ ALTER TABLE myhealth.administrator CREATE TABLE myhealth.familydoctor ( - id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), - password VARCHAR(100) COLLATE pg_catalog."default" NOT NULL, - nif VARCHAR(50) COLLATE pg_catalog."default", - surname VARCHAR(100) COLLATE pg_catalog."default", - email VARCHAR(120) COLLATE pg_catalog."default", - name VARCHAR(100) COLLATE pg_catalog."default", - primaryhealthcarecenterid VARCHAR(50) COLLATE pg_catalog."default", + id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), + password character varying(100) COLLATE pg_catalog."default" NOT NULL, + nif character varying(50) COLLATE pg_catalog."default", + surname character varying(100) COLLATE pg_catalog."default", + email character varying(120) COLLATE pg_catalog."default", + name character varying(100) COLLATE pg_catalog."default", + primaryhealthcarecenterid integer, CONSTRAINT familydoctor_pkey PRIMARY KEY (id) ) TABLESPACE pg_default; @@ -124,9 +124,10 @@ ALTER TABLE myhealth.location CREATE TABLE myhealth.primaryhealthcarecenter ( - name VARCHAR(50) COLLATE pg_catalog."default" NOT NULL, - location INTEGER, - CONSTRAINT primaryhealthcarecenter_pkey PRIMARY KEY (name) + id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), + name character varying(150) COLLATE pg_catalog."default" NOT NULL, + location character varying(512) COLLATE pg_catalog."default", + CONSTRAINT primaryhealthcarecenter_pkey PRIMARY KEY (id) ) TABLESPACE pg_default; diff --git a/2.database/02. Datos_prueba.sql b/2.database/02. Datos_prueba.sql index 0183550..ccd897e 100644 --- a/2.database/02. Datos_prueba.sql +++ b/2.database/02. Datos_prueba.sql @@ -2,8 +2,26 @@ insert into myhealth.administrator (email, password) values ('admin@example.com', '21232F297A57A5A743894A0E4A801FC3'); insert into myhealth.administrator (email, password) values ('marcos@example.com', '21232F297A57A5A743894A0E4A801FC3'); --- Inserta Especialidades médicas +-- 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 '); +-- Inserta Especialidades médicas insert into MyHealth.MedicalSpecialty(name, description) values ('Alergologia','Especialidad médica de Alergologia'); insert into MyHealth.MedicalSpecialty(name, description) From 3e315f866a45ba0c0ee14c3b39a7fbc042fe38e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Wed, 11 Dec 2019 00:37:26 +0100 Subject: [PATCH 02/21] =?UTF-8?q?Cambiadas=20todas=20las=20listas=20depleg?= =?UTF-8?q?ables=20fijas,=20a=20listas=20con=20b=C3=BAsqueda=20AJAX=20inte?= =?UTF-8?q?grada=20(Estilo=20typeahead).=20Permite=20b=C3=BAsquedas=20en?= =?UTF-8?q?=20tiempo=20real.=20*=20Se=20muestra=20informaci=C3=B3n=20organ?= =?UTF-8?q?izada=20por=20columnas=20de=20datos.=20*=20Identificadores=20ba?= =?UTF-8?q?sados=20en=20Ids=20autogenerados.=20*=20Nuevos=20m=C3=A9todos?= =?UTF-8?q?=20en=20EJB=20com=C3=BAn=20para=20poder=20realizar=20b=C3=BAsqu?= =?UTF-8?q?edas=20de=20datos=20con=20filtro=20y=20paginadas=20(para=20los?= =?UTF-8?q?=20comboBox).=20*=20Varias=20correcciones=20de=20interfaz=20de?= =?UTF-8?q?=20usuario.=20*=20Nueva=20clase=20de=20utilidades.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../docroot/profile/ChangeFamilyDoctor.xhtml | 33 +- .../ChangePrimaryHealthCareCenter.xhtml | 11 +- .../docroot/profile/RegisterUser.xhtml | 319 +++++++++--------- .../docroot/profile/UpdateProfile.xhtml | 72 ++-- 1.sources/MyHealth/src/TO/FamilyDoctorTO.java | 16 +- .../MyHealth/src/TO/MedicalSpecialtyTO.java | 15 +- 1.sources/MyHealth/src/TO/PatientTO.java | 14 +- .../src/TO/PrimaryHealthCareCenterTO.java | 26 +- .../MyHealth/src/TO/SpecialistDoctorTO.java | 14 +- 1.sources/MyHealth/src/common/Constants.java | 5 + 1.sources/MyHealth/src/common/Utils.java | 11 + .../src/ejb/common/CommonFacadeBean.java | 107 ++++-- .../src/ejb/common/CommonFacadeLocal.java | 25 +- .../src/ejb/common/CommonFacadeRemote.java | 25 +- .../src/ejb/profile/ProfileFacadeBean.java | 10 +- .../MyHealth/src/jpa/FamilyDoctorJPA.java | 2 + .../MyHealth/src/jpa/MedicalSpecialtyJPA.java | 15 +- 1.sources/MyHealth/src/jpa/PatientJPA.java | 11 +- .../src/jpa/PrimaryHealthCareCenterJPA.java | 14 + .../MyHealth/src/jpa/SpecialistDoctorJPA.java | 6 +- 1.sources/MyHealth/src/jpa/VisitJPA.java | 34 +- .../profile/ChangeFamilyDoctorMBean.java | 20 +- .../ChangePrimaryHealthCareCenterMBean.java | 20 +- .../profile/RegisterUserMBean.java | 35 +- .../profile/UpdateProfileMBean.java | 82 +++-- 25 files changed, 607 insertions(+), 335 deletions(-) create mode 100644 1.sources/MyHealth/src/common/Constants.java create mode 100644 1.sources/MyHealth/src/common/Utils.java diff --git a/1.sources/MyHealth/docroot/profile/ChangeFamilyDoctor.xhtml b/1.sources/MyHealth/docroot/profile/ChangeFamilyDoctor.xhtml index 160536f..45e68bb 100644 --- a/1.sources/MyHealth/docroot/profile/ChangeFamilyDoctor.xhtml +++ b/1.sources/MyHealth/docroot/profile/ChangeFamilyDoctor.xhtml @@ -2,7 +2,7 @@ + xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui"> @@ -14,8 +14,8 @@
- Su perfil de usuario no permite que pueda cambiar su Médico de Familia asignado.
Si cree que no debería estar viendo esta página y que se trata de un - error, por favor, contacte con el soporte de la aplicación para obtener asistencia tecnica. + Su perfil de usuario no permite que pueda cambiar su Médico de Familia asignado.
Si cree que no debería estar viendo esta página y que se trata de un error, por + favor, contacte con el soporte de la aplicación para obtener asistencia tecnica.
@@ -35,25 +35,30 @@
- +
- +
- - - - - - - + + + + + + + + + + + +
- +
diff --git a/1.sources/MyHealth/docroot/profile/ChangePrimaryHealthCareCenter.xhtml b/1.sources/MyHealth/docroot/profile/ChangePrimaryHealthCareCenter.xhtml index 1841a57..861dce5 100644 --- a/1.sources/MyHealth/docroot/profile/ChangePrimaryHealthCareCenter.xhtml +++ b/1.sources/MyHealth/docroot/profile/ChangePrimaryHealthCareCenter.xhtml @@ -35,7 +35,7 @@
- +
@@ -43,13 +43,12 @@
- - - + + - +
diff --git a/1.sources/MyHealth/docroot/profile/RegisterUser.xhtml b/1.sources/MyHealth/docroot/profile/RegisterUser.xhtml index 668e6c0..a4fe8f3 100644 --- a/1.sources/MyHealth/docroot/profile/RegisterUser.xhtml +++ b/1.sources/MyHealth/docroot/profile/RegisterUser.xhtml @@ -2,48 +2,49 @@ + xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui"> - -
-
+ + +
+
- -
+ +
-
- Enhorabuena - - , se ha registrado correctamente, el sistema le ha asignado un - - , por favor recuerdelo ya que deberá utilizarlo para logearse en el sistema. +
+ Enhorabuena + + , se ha registrado correctamente, el sistema le ha asignado un + + , por favor recuerdelo ya que deberá utilizarlo para logearse en el sistema. +
+ +
+ + +
+ +
+ +
+ +
+
+ +
+
-
- - -
+ +
+
+ -
- -
- -
-
- -
-
-
- -
-
-
- - - - + + function handleRequest(xhr, status, args) { if(args.specs) { $('#panCentros').slideUp(); @@ -58,134 +59,142 @@ } } - - -
-
- -
-
- - - - -
-
-
-
-
- -
-
- -
-
- -
-
- -
- -
- -
-
- -
-
- -
- -
- -
-
- -
-
- -
- -
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
- -
+ + +
- -
-
- - - - #{phc.name} - #{phc.location} - +
- -
-
- -
-
- -
-
- - - - #{ms.name} - #{ms.description} - -
-
- -
-
- -
-
-
- -
-
- + + + + +
-
+ +
+ +
+
+ +
+
+ +
+
+ +
- - +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ + +
+ +
+
+ + + + + + + + + +
+
+ +
+
+ + +
+ +
+
+ + + + + + + + + +
+
+ +
+
+ +
+
+
+ + +
+
+ +
+
+
+
+
+ + diff --git a/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml b/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml index f91349c..c8a553d 100644 --- a/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml +++ b/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml @@ -2,7 +2,7 @@ + xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui"> @@ -27,8 +27,8 @@
- - + +
@@ -84,7 +84,7 @@
-
+
@@ -106,42 +106,72 @@
- +
- +
- - - - #{phc.name} - #{phc.location} - + + + + + + + + +
- +
- - - - #{ms.name} - #{ms.description} - + + + + + + + + +
+ +
+ +
+
+ + + + + + + + + + + + +
+
+ +
+
+
diff --git a/1.sources/MyHealth/src/TO/FamilyDoctorTO.java b/1.sources/MyHealth/src/TO/FamilyDoctorTO.java index 30e00cf..258c3b8 100644 --- a/1.sources/MyHealth/src/TO/FamilyDoctorTO.java +++ b/1.sources/MyHealth/src/TO/FamilyDoctorTO.java @@ -26,13 +26,13 @@ public class FamilyDoctorTO implements Serializable { } public FamilyDoctorTO(Integer id, String nif, String name, String surname, String password, String email, PrimaryHealthCareCenterTO phc) { - this.setId(id); - this.setNif(nif); - this.setName(name); - this.setSurname(surname); - this.setPassword(password); - this.setEmail(email); - this.setPrimaryHealthCareCenter(phc); + this.id = id; + this.nif = nif; + this.name = name; + this.surname = surname; + this.password = password; + this.email =email; + this.primaryHealthCareCenter = phc; } public String getEmail() { @@ -83,7 +83,7 @@ public class FamilyDoctorTO implements Serializable { this.id = id; } - public String getDisplayDescription() { + public String getDisplayName() { return String.format("[%d] %s %s", this.id, this.name, this.surname); } diff --git a/1.sources/MyHealth/src/TO/MedicalSpecialtyTO.java b/1.sources/MyHealth/src/TO/MedicalSpecialtyTO.java index 1780adf..40d43a4 100644 --- a/1.sources/MyHealth/src/TO/MedicalSpecialtyTO.java +++ b/1.sources/MyHealth/src/TO/MedicalSpecialtyTO.java @@ -13,7 +13,7 @@ import javax.xml.bind.annotation.XmlRootElement; public class MedicalSpecialtyTO implements Serializable { private static final long serialVersionUID = 1L; - + private Integer id; private String name; private String description; @@ -21,11 +21,20 @@ public class MedicalSpecialtyTO implements Serializable { super(); } - public MedicalSpecialtyTO(String name, String description) { + public MedicalSpecialtyTO(Integer id, String name, String description) { + this.id = id; this.name = name; this.description = description; } + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + public String getName() { return name; } @@ -42,7 +51,7 @@ public class MedicalSpecialtyTO implements Serializable { this.description = description; } - public String getDisplayDescription() { + public String getDisplayName() { return String.format("[%s] %s", this.name, this.description); } diff --git a/1.sources/MyHealth/src/TO/PatientTO.java b/1.sources/MyHealth/src/TO/PatientTO.java index 69c555b..c31bfda 100644 --- a/1.sources/MyHealth/src/TO/PatientTO.java +++ b/1.sources/MyHealth/src/TO/PatientTO.java @@ -31,13 +31,13 @@ public class PatientTO implements Serializable { } public PatientTO(Integer id, String nif, String name, String surname, String password, String email, FamilyDoctorTO familyDoc) { - this.setId(id); - this.setNif(nif); - this.setName(name); - this.setSurname(surname); - this.setPassword(password); - this.setEmail(email); - this.setFamilyDoctor(familyDoc); + this.id = id; + this.nif = nif; + this.name = name; + this.surname = surname; + this.password = password; + this.email =email; + this.familyDoctor = familyDoc; } public String getEmail() { diff --git a/1.sources/MyHealth/src/TO/PrimaryHealthCareCenterTO.java b/1.sources/MyHealth/src/TO/PrimaryHealthCareCenterTO.java index a4b88fa..5160600 100644 --- a/1.sources/MyHealth/src/TO/PrimaryHealthCareCenterTO.java +++ b/1.sources/MyHealth/src/TO/PrimaryHealthCareCenterTO.java @@ -13,20 +13,28 @@ import javax.xml.bind.annotation.XmlRootElement; public class PrimaryHealthCareCenterTO implements Serializable { private static final long serialVersionUID = 1L; - + private Integer id; private String name; private String location; - public PrimaryHealthCareCenterTO() { super(); } - public PrimaryHealthCareCenterTO(String name, String location) { + public PrimaryHealthCareCenterTO(Integer Id, String name, String location) { + this.id = Id; this.name = name; this.location = location; } + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + public String getName() { return name; } @@ -39,16 +47,16 @@ public class PrimaryHealthCareCenterTO implements Serializable { return location; } - public void setLocation(String description) { - this.location = description; + public void setLocation(String value) { + this.location = value; } - - public String getDisplayDescription() { + + public String getDisplayName() { return String.format("[%s] %s", this.name, this.location); } - + @Override public String toString() { - return String.format("%s[name=%s]", getClass().getSimpleName(), this.getName()); + return String.format("%s[name=%s]", getClass().getSimpleName(), this.getName()); } } diff --git a/1.sources/MyHealth/src/TO/SpecialistDoctorTO.java b/1.sources/MyHealth/src/TO/SpecialistDoctorTO.java index 5397814..bee77c4 100644 --- a/1.sources/MyHealth/src/TO/SpecialistDoctorTO.java +++ b/1.sources/MyHealth/src/TO/SpecialistDoctorTO.java @@ -26,13 +26,13 @@ public class SpecialistDoctorTO implements Serializable { } public SpecialistDoctorTO(Integer id, String nif, String name, String surname, String password, String email, MedicalSpecialtyTO medicalSpec) { - this.setId(id); - this.setNif(nif); - this.setName(name); - this.setSurname(surname); - this.setPassword(password); - this.setEmail(email); - this.setMedicalSpecialty(medicalSpec); + this.id = id; + this.nif = nif; + this.name = name; + this.surname = surname; + this.password = password; + this.email =email; + this.medicalSpecialty = medicalSpec; } public String getEmail() { diff --git a/1.sources/MyHealth/src/common/Constants.java b/1.sources/MyHealth/src/common/Constants.java new file mode 100644 index 0000000..a4ff4c0 --- /dev/null +++ b/1.sources/MyHealth/src/common/Constants.java @@ -0,0 +1,5 @@ +package common; + +public class Constants { + public static final int MAX_ITEMS_AUTOCOMPLETE_SEARCH = 200; +} diff --git a/1.sources/MyHealth/src/common/Utils.java b/1.sources/MyHealth/src/common/Utils.java new file mode 100644 index 0000000..7bb7db7 --- /dev/null +++ b/1.sources/MyHealth/src/common/Utils.java @@ -0,0 +1,11 @@ +package common; + +import java.text.Normalizer; + +public class Utils { + public static String stripAccents(String input){ + return input == null ? null : + Normalizer.normalize(input, Normalizer.Form.NFD) + .replaceAll("\\p{InCombiningDiacriticalMarks}+", ""); + } +} diff --git a/1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java b/1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java index 44fdb1e..67e1e22 100644 --- a/1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java +++ b/1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java @@ -2,17 +2,20 @@ package ejb.common; import java.util.ArrayList; import java.util.Collection; +import java.util.List; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; +import javax.persistence.TypedQuery; import TO.FamilyDoctorTO; import TO.MedicalSpecialtyTO; import TO.PatientTO; import TO.PrimaryHealthCareCenterTO; import TO.SpecialistDoctorTO; +import common.Utils; import jpa.FamilyDoctorJPA; import jpa.MedicalSpecialtyJPA; import jpa.PatientJPA; @@ -28,8 +31,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal { /** * Metodo que devuelve todas las especialidades medicas */ - public Collection listAllMedicalSpecialities() { - return this.listPagedMedicalSpecialities(0, 0); + public List listAllMedicalSpecialities() { + return this.listMedicalSpecialitiesPaged(0, 0); } /** @@ -39,54 +42,106 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal { * cada página * */ - public Collection listPagedMedicalSpecialities(int pageNumber, int pageSize) { - Query query = entman.createQuery("from MedicalSpecialtyJPA order by name"); + public List listMedicalSpecialitiesPaged(int pageNumber, int pageSize) { + return listMedicalSpecialitiesFiltered(null, pageNumber, pageSize); + } + + public List listMedicalSpecialitiesFiltered(String searchTerm, int pageNumber, int pageSize) { + String strQuery = "SELECT ms from MedicalSpecialtyJPA ms %s order by ms.name, ms.description"; + String strFilter = ""; + if (searchTerm == null) + searchTerm = ""; + else + searchTerm = Utils.stripAccents(searchTerm).toLowerCase(); + + if (searchTerm.length() > 0) { + strFilter = "WHERE lower(ms.name) LIKE :searchTerm OR lower(ms.description) LIKE :searchTerm"; + } + + TypedQuery query = entman.createQuery(String.format(strQuery, strFilter), MedicalSpecialtyJPA.class); + + if (searchTerm.length() > 0) + query.setParameter("searchTerm", "%" + searchTerm + "%"); if (pageSize > 0) { query.setFirstResult(pageNumber * pageSize); query.setMaxResults(pageSize); } - @SuppressWarnings("unchecked") - Collection allJPA = query.getResultList(); - Collection allSpecialities = new ArrayList(); + List allJPA = query.getResultList(); + List allSpecialities = new ArrayList(); - for (MedicalSpecialtyJPA ms : allJPA) { - allSpecialities.add(new MedicalSpecialtyTO(ms.getName(), ms.getDescription())); + for (MedicalSpecialtyJPA cap : allJPA) { + allSpecialities.add(new MedicalSpecialtyTO(cap.getId(), cap.getName(), cap.getDescription())); } return allSpecialities; } - public Collection listAllCAPs() { - return this.listPagedAllCAPs(0, 0); + public List listAllCAPs() { + return this.listCAPsPaged(0, 0); } - public Collection listPagedAllCAPs(int pageNumber, int pageSize) { - Query query = entman.createQuery("from PrimaryHealthCareCenterJPA order by name"); + public List listCAPsPaged(int pageNumber, int pageSize) { + return this.listCAPsFiltered(null, pageNumber, pageSize); + } + + public List listCAPsFiltered(String searchTerm, int pageNumber, int pageSize) { + String strQuery = "SELECT phc from PrimaryHealthCareCenterJPA phc %s order by phc.name, phc.location"; + String strFilter = ""; + if (searchTerm == null) + searchTerm = ""; + else + searchTerm = Utils.stripAccents(searchTerm).toLowerCase(); + + if (searchTerm.length() > 0) { + strFilter = "WHERE lower(phc.name) LIKE :searchTerm OR lower(phc.location) LIKE :searchTerm"; + } + + TypedQuery query = entman.createQuery(String.format(strQuery, strFilter), PrimaryHealthCareCenterJPA.class); + + if (searchTerm.length() > 0) + query.setParameter("searchTerm", "%" + searchTerm + "%"); if (pageSize > 0) { query.setFirstResult(pageNumber * pageSize); query.setMaxResults(pageSize); } - @SuppressWarnings("unchecked") - Collection allJPA = query.getResultList(); - Collection allCAPs = new ArrayList(); + List allJPA = query.getResultList(); + List allCAPs = new ArrayList(); for (PrimaryHealthCareCenterJPA cap : allJPA) { - allCAPs.add(new PrimaryHealthCareCenterTO(cap.getName(), cap.getLocation())); + allCAPs.add(new PrimaryHealthCareCenterTO(cap.getId(), cap.getName(), cap.getLocation())); } return allCAPs; } - public Collection listAllFamilyDoctors() { - return this.listAllFamilyDoctors(0, 0); + public List listAllFamilyDoctors() { + return this.listFamilyDoctorsPaged(0, 0); } - public Collection listAllFamilyDoctors(int pageNumber, int pageSize) { - Query query = entman.createQuery("from FamilyDoctorJPA order by name, surname"); + public List listFamilyDoctorsPaged(int pageNumber, int pageSize) { + return this.listFamilyDoctorsFiltered(null, pageNumber, pageSize); + } + + public List listFamilyDoctorsFiltered(String searchTerm, int pageNumber, int pageSize) { + String strQuery = "SELECT fd FROM FamilyDoctorJPA fd %s order by fd.name, fd.surname"; + String strFilter = ""; + if (searchTerm == null) + searchTerm = ""; + else + searchTerm = Utils.stripAccents(searchTerm).toLowerCase(); + + if (searchTerm.length() > 0) { + strFilter = "WHERE lower(fd.name) LIKE :searchTerm OR lower(fd.surname) LIKE :searchTerm"; + } + + TypedQuery query = entman.createQuery(String.format(strQuery, strFilter), FamilyDoctorJPA.class); + + if (searchTerm.length() > 0) + query.setParameter("searchTerm", "%" + searchTerm + "%"); if (pageSize > 0) { query.setFirstResult(pageNumber * pageSize); @@ -94,14 +149,14 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal { } @SuppressWarnings("unchecked") - Collection allFDsJPA = query.getResultList(); - Collection allFDTOs = new ArrayList(); + List allFDsJPA = query.getResultList(); + List allFDTOs = new ArrayList(); for (FamilyDoctorJPA item : allFDsJPA) { allFDTOs.add(new FamilyDoctorTO(item.getId(), item.getNif(), item.getName(), item.getSurname(), item.getPassword(), item.getEmail(), null)); } - return allFDTOs; + return allFDTOs; } public PatientTO retrievePatient(int patientId) throws Exception { @@ -129,7 +184,7 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal { PrimaryHealthCareCenterTO phc = null; if (fd.getPrimaryHealthCareCenter() != null) - phc = new PrimaryHealthCareCenterTO(fd.getPrimaryHealthCareCenter().getName(), fd.getPrimaryHealthCareCenter().getLocation()); + phc = new PrimaryHealthCareCenterTO(fd.getPrimaryHealthCareCenter().getId(), fd.getPrimaryHealthCareCenter().getName(), fd.getPrimaryHealthCareCenter().getLocation()); FamilyDoctorTO fdTO = new FamilyDoctorTO(fd.getId(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), phc); return fdTO; @@ -144,7 +199,7 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal { MedicalSpecialtyTO ms = null; if (sd.getMedicalSpecialty() != null) - ms = new MedicalSpecialtyTO(sd.getMedicalSpecialty().getName(), sd.getMedicalSpecialty().getDescription()); + ms = new MedicalSpecialtyTO(sd.getMedicalSpecialty().getId(), sd.getMedicalSpecialty().getName(), sd.getMedicalSpecialty().getDescription()); SpecialistDoctorTO sdTO = new SpecialistDoctorTO(sd.getId(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail(), ms); return sdTO; diff --git a/1.sources/MyHealth/src/ejb/common/CommonFacadeLocal.java b/1.sources/MyHealth/src/ejb/common/CommonFacadeLocal.java index 3ec40c9..cc71c0e 100644 --- a/1.sources/MyHealth/src/ejb/common/CommonFacadeLocal.java +++ b/1.sources/MyHealth/src/ejb/common/CommonFacadeLocal.java @@ -1,6 +1,7 @@ package ejb.common; import java.util.Collection; +import java.util.List; import javax.ejb.Local; @@ -18,18 +19,24 @@ import TO.SpecialistDoctorTO; @Local public interface CommonFacadeLocal { - public Collection listAllMedicalSpecialities(); + public List listAllMedicalSpecialities(); - public Collection listPagedMedicalSpecialities(int pageNumber, int pageSize); + public List listMedicalSpecialitiesPaged(int pageNumber, int pageSize); - public Collection listAllCAPs(); - - public Collection listPagedAllCAPs(int pageNumber, int pageSize); + public List listMedicalSpecialitiesFiltered(String searchTerm, int pageNumber, int pageSize); + + public List listAllCAPs(); + + public List listCAPsPaged(int pageNumber, int pageSize); + + public List listCAPsFiltered(String searchTerm, int pageNumber, int pageSize); + + public List listAllFamilyDoctors(); + + public List listFamilyDoctorsPaged(int pageNumber, int pageSize); + + public List listFamilyDoctorsFiltered(String searchTerm, int pageNumber, int pageSize); - public Collection listAllFamilyDoctors(); - - public Collection listAllFamilyDoctors(int pageNumber, int pageSize); - public PatientTO retrievePatient(int patientId) throws Exception; public FamilyDoctorTO retrieveFamilyDoctor(int ProfessionalNumberId) throws Exception; diff --git a/1.sources/MyHealth/src/ejb/common/CommonFacadeRemote.java b/1.sources/MyHealth/src/ejb/common/CommonFacadeRemote.java index 6a9732b..d62a870 100644 --- a/1.sources/MyHealth/src/ejb/common/CommonFacadeRemote.java +++ b/1.sources/MyHealth/src/ejb/common/CommonFacadeRemote.java @@ -1,6 +1,7 @@ package ejb.common; import java.util.Collection; +import java.util.List; import javax.ejb.Remote; @@ -18,18 +19,24 @@ import TO.SpecialistDoctorTO; @Remote public interface CommonFacadeRemote { - public Collection listAllMedicalSpecialities(); + public List listAllMedicalSpecialities(); - public Collection listPagedMedicalSpecialities(int pageNumber, int pageSize); + public List listMedicalSpecialitiesPaged(int pageNumber, int pageSize); - public Collection listAllCAPs(); - - public Collection listPagedAllCAPs(int pageNumber, int pageSize); + public List listMedicalSpecialitiesFiltered(String searchTerm, int pageNumber, int pageSize); + + public List listAllCAPs(); + + public List listCAPsPaged(int pageNumber, int pageSize); + + public List listCAPsFiltered(String searchTerm, int pageNumber, int pageSize); + + public List listAllFamilyDoctors(); + + public List listFamilyDoctorsPaged(int pageNumber, int pageSize); + + public List listFamilyDoctorsFiltered(String searchTerm, int pageNumber, int pageSize); - public Collection listAllFamilyDoctors(); - - public Collection listAllFamilyDoctors(int pageNumber, int pageSize); - public PatientTO retrievePatient(int patientId) throws Exception; public FamilyDoctorTO retrieveFamilyDoctor(int ProfessionalNumberId) throws Exception; diff --git a/1.sources/MyHealth/src/ejb/profile/ProfileFacadeBean.java b/1.sources/MyHealth/src/ejb/profile/ProfileFacadeBean.java index e6c34b7..8e28709 100644 --- a/1.sources/MyHealth/src/ejb/profile/ProfileFacadeBean.java +++ b/1.sources/MyHealth/src/ejb/profile/ProfileFacadeBean.java @@ -67,7 +67,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote { public SpecialistDoctorTO registerSpecialistDoctor(int id, String nif, String name, String surname, String password, String email, MedicalSpecialtyTO specialty) throws Exception { - MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, specialty.getName()); + MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, specialty.getId()); if (ms == null) { throw new Exception("No se encuentra la especialidad médica con identificador: " + specialty.getName()); } @@ -84,7 +84,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote { public FamilyDoctorTO registerFamilyDoctor(int id, String nif, String name, String surname, String password, String email, PrimaryHealthCareCenterTO cap) throws Exception { FamilyDoctorTO fdTO = null; - PrimaryHealthCareCenterJPA phcC = entman.find(PrimaryHealthCareCenterJPA.class, cap.getName()); + PrimaryHealthCareCenterJPA phcC = entman.find(PrimaryHealthCareCenterJPA.class, cap.getId()); if (phcC == null) { throw new Exception("No se encuentra el centro de atención primaria con identificador: " + cap.getName()); } @@ -127,7 +127,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote { throw new Exception("No se pueden actualizar los datos del médico de familia porque no se encuentra en la base de datos ningún registro con id: " + String.valueOf(id)); } - MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, specialty.getName()); + MedicalSpecialtyJPA ms = entman.find(MedicalSpecialtyJPA.class, specialty.getId()); if (ms == null) { throw new Exception("No se encuentra la especialidad médica con identificador: " + specialty.getName()); } @@ -155,7 +155,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote { throw new Exception("No se pueden actualizar los datos del médico de familia porque no se encuentra en la base de datos ningún registro con id: " + String.valueOf(id)); } - PrimaryHealthCareCenterJPA phcC = entman.find(PrimaryHealthCareCenterJPA.class, phcTO.getName()); + PrimaryHealthCareCenterJPA phcC = entman.find(PrimaryHealthCareCenterJPA.class, phcTO.getId()); if (phcC == null) { throw new Exception("No se encuentra el centro de atención primaria con identificador: " + phcTO.getName()); } @@ -185,7 +185,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote { throw new Exception("No se encuentra en la base de datos ningún médico de familia con id: " + String.valueOf(professionalId)); } - PrimaryHealthCareCenterJPA phcC = entman.find(PrimaryHealthCareCenterJPA.class, newCenter.getName()); + PrimaryHealthCareCenterJPA phcC = entman.find(PrimaryHealthCareCenterJPA.class, newCenter.getId()); if (phcC == null) { throw new Exception("No se encuentra el centro de atención primaria con identificador: " + newCenter.getName()); } diff --git a/1.sources/MyHealth/src/jpa/FamilyDoctorJPA.java b/1.sources/MyHealth/src/jpa/FamilyDoctorJPA.java index dd02336..3d36ead 100644 --- a/1.sources/MyHealth/src/jpa/FamilyDoctorJPA.java +++ b/1.sources/MyHealth/src/jpa/FamilyDoctorJPA.java @@ -4,6 +4,7 @@ import java.io.Serializable; import java.util.Collection; import javax.persistence.CascadeType; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; @@ -26,6 +27,7 @@ public class FamilyDoctorJPA implements Serializable { private static final long serialVersionUID = 1L; @Id + @Column(updatable = false) @GeneratedValue(strategy=GenerationType.IDENTITY) private Integer id; private String nif; diff --git a/1.sources/MyHealth/src/jpa/MedicalSpecialtyJPA.java b/1.sources/MyHealth/src/jpa/MedicalSpecialtyJPA.java index 92bd161..8b15906 100644 --- a/1.sources/MyHealth/src/jpa/MedicalSpecialtyJPA.java +++ b/1.sources/MyHealth/src/jpa/MedicalSpecialtyJPA.java @@ -2,7 +2,10 @@ package jpa; import java.io.Serializable; +import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @@ -18,6 +21,9 @@ public class MedicalSpecialtyJPA implements Serializable { private static final long serialVersionUID = 1L; @Id + @Column(updatable = false) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; private String name; private String description; @@ -33,7 +39,14 @@ public class MedicalSpecialtyJPA implements Serializable { this.description = description; } - @Id + public Integer getId() { + return id; + } + + public void setId(Integer value) { + this.id = value; + } + public String getName() { return name; } diff --git a/1.sources/MyHealth/src/jpa/PatientJPA.java b/1.sources/MyHealth/src/jpa/PatientJPA.java index be58fef..fd4b069 100644 --- a/1.sources/MyHealth/src/jpa/PatientJPA.java +++ b/1.sources/MyHealth/src/jpa/PatientJPA.java @@ -2,6 +2,7 @@ package jpa; import java.io.Serializable; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; @@ -22,7 +23,8 @@ public class PatientJPA implements Serializable { private static final long serialVersionUID = 1L; @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) + @Column(updatable = false) + @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; private String nif; private String name; @@ -30,7 +32,7 @@ public class PatientJPA implements Serializable { private String password; private String email; @ManyToOne - @JoinColumn (name="FamilyDoctorId") + @JoinColumn(name = "FamilyDoctorId") private FamilyDoctorJPA familyDoctor; /** @@ -96,11 +98,12 @@ public class PatientJPA implements Serializable { public void setEmail(String email) { this.email = email; } - + public FamilyDoctorJPA getFamilyDoctor() { return familyDoctor; } - public void setFamilyDoctor(FamilyDoctorJPA familyDoc) { + + public void setFamilyDoctor(FamilyDoctorJPA familyDoc) { this.familyDoctor = familyDoc; } } diff --git a/1.sources/MyHealth/src/jpa/PrimaryHealthCareCenterJPA.java b/1.sources/MyHealth/src/jpa/PrimaryHealthCareCenterJPA.java index ce81e61..cfbece7 100644 --- a/1.sources/MyHealth/src/jpa/PrimaryHealthCareCenterJPA.java +++ b/1.sources/MyHealth/src/jpa/PrimaryHealthCareCenterJPA.java @@ -2,7 +2,10 @@ package jpa; import java.io.Serializable; +import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @@ -18,6 +21,9 @@ public class PrimaryHealthCareCenterJPA implements Serializable { private static final long serialVersionUID = 1L; @Id + @Column(updatable = false) + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; private String name; private String location; @@ -33,6 +39,14 @@ public class PrimaryHealthCareCenterJPA implements Serializable { this.location = location; } + public Integer getId() { + return id; + } + + public void setId(Integer value) { + this.id = value; + } + public String getName() { return name; } diff --git a/1.sources/MyHealth/src/jpa/SpecialistDoctorJPA.java b/1.sources/MyHealth/src/jpa/SpecialistDoctorJPA.java index 7c7e1b5..6ffa8d4 100644 --- a/1.sources/MyHealth/src/jpa/SpecialistDoctorJPA.java +++ b/1.sources/MyHealth/src/jpa/SpecialistDoctorJPA.java @@ -2,6 +2,7 @@ package jpa; import java.io.Serializable; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; @@ -22,7 +23,8 @@ public class SpecialistDoctorJPA implements Serializable { private static final long serialVersionUID = 1L; @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) + @Column(updatable = false) + @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; private String nif; private String name; @@ -30,7 +32,7 @@ public class SpecialistDoctorJPA implements Serializable { private String password; private String email; @ManyToOne - @JoinColumn(name = "MedicalSpecialtyId") + @JoinColumn(name = "MedicalSpecialtyId") private MedicalSpecialtyJPA medicalSpecialty; /** diff --git a/1.sources/MyHealth/src/jpa/VisitJPA.java b/1.sources/MyHealth/src/jpa/VisitJPA.java index e6e6b36..bb5ef55 100644 --- a/1.sources/MyHealth/src/jpa/VisitJPA.java +++ b/1.sources/MyHealth/src/jpa/VisitJPA.java @@ -4,6 +4,7 @@ import java.io.Serializable; import java.sql.Time; import java.util.Date; +import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; @@ -12,7 +13,6 @@ import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; - /** * * @author Marcos García Núñez (mgarcianun@uoc.edu) @@ -25,17 +25,19 @@ public class VisitJPA implements Serializable { private static final long serialVersionUID = 1L; @Id + @Column(updatable = false) + @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; private Date date; private Time time; private String observations; private String result; - @ManyToOne - @JoinColumn (name="FamilyDoctorId") - private FamilyDoctorJPA familyDoctor; - @ManyToOne - @JoinColumn (name="PatientId") - private PatientJPA patient; + @ManyToOne + @JoinColumn(name = "FamilyDoctorId") + private FamilyDoctorJPA familyDoctor; + @ManyToOne + @JoinColumn(name = "PatientId") + private PatientJPA patient; /** * Class constructor methods @@ -46,14 +48,14 @@ public class VisitJPA implements Serializable { public VisitJPA(Integer id, Date date, Time time, String observations, String result) { this.id = id; - this.date=date; + this.date = date; this.time = time; this.observations = observations; this.result = result; } @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) + @GeneratedValue(strategy = GenerationType.IDENTITY) public Integer getId() { return id; } @@ -85,21 +87,23 @@ public class VisitJPA implements Serializable { public void setObservations(String observation) { this.observations = observations; } + /** * Methods get/set persistent relationships */ public FamilyDoctorJPA getFamilyDoctor() { return familyDoctor; } - public void setFamilyDoctor(FamilyDoctorJPA familyDoc) { + + public void setFamilyDoctor(FamilyDoctorJPA familyDoc) { this.familyDoctor = familyDoc; } - + public PatientJPA getPatient() { return patient; } - - public void setPatient (PatientJPA pat) { - this.patient=pat; + + public void setPatient(PatientJPA pat) { + this.patient = pat; } -} +} diff --git a/1.sources/MyHealth/src/managedbean/profile/ChangeFamilyDoctorMBean.java b/1.sources/MyHealth/src/managedbean/profile/ChangeFamilyDoctorMBean.java index 77996c8..2c1d72c 100644 --- a/1.sources/MyHealth/src/managedbean/profile/ChangeFamilyDoctorMBean.java +++ b/1.sources/MyHealth/src/managedbean/profile/ChangeFamilyDoctorMBean.java @@ -1,7 +1,7 @@ package managedbean.profile; import java.io.Serializable; -import java.util.Collection; +import java.util.List; import javax.annotation.PostConstruct; import javax.faces.application.FacesMessage; @@ -11,6 +11,7 @@ import javax.inject.Named; import TO.FamilyDoctorTO; import TO.LoggedUserTO; import TO.PatientTO; +import common.Constants; import common.UserType; import managedbean.common.ManagedBeanBase; import managedbean.common.SessionUtils; @@ -28,7 +29,8 @@ public class ChangeFamilyDoctorMBean extends ManagedBeanBase implements Serializ private int id; private FamilyDoctorTO currentFamilyDoctor; private FamilyDoctorTO newFamilyDoctor; - private Collection familyDoctorList; + private List familyDoctorList; + private String lastUIQuery; public ChangeFamilyDoctorMBean() { @@ -38,6 +40,7 @@ public class ChangeFamilyDoctorMBean extends ManagedBeanBase implements Serializ public void init() { // Recuperamos el usuario logeado actual LoggedUserTO usr = null; + this.lastUIQuery = ""; try { usr = SessionUtils.getloggedOnUser(); @@ -48,7 +51,7 @@ public class ChangeFamilyDoctorMBean extends ManagedBeanBase implements Serializ this.id = Integer.valueOf(usr.getId()); if (usr.getUserType() == UserType.PATIENT) { - this.familyDoctorList = this.getRemoteManagerCommon().listAllFamilyDoctors(); + this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH); PatientTO pat = this.getRemoteManagerCommon().retrievePatient(this.id); this.setCurrentFamilyDoctor(pat.getFamilyDoctor()); @@ -60,10 +63,19 @@ public class ChangeFamilyDoctorMBean extends ManagedBeanBase implements Serializ } - public Collection getFamilyDoctorList() { + public List getFamilyDoctorList() { return familyDoctorList; } + public List completeFamilyDoctor(String query) { + if (query != null && query.equals(this.lastUIQuery) == false) { + this.lastUIQuery = query; + // Recuperamos las 200 primeras coincidencias + this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH); + } + return this.familyDoctorList; + } + public int getId() { return id; } diff --git a/1.sources/MyHealth/src/managedbean/profile/ChangePrimaryHealthCareCenterMBean.java b/1.sources/MyHealth/src/managedbean/profile/ChangePrimaryHealthCareCenterMBean.java index 7d894a0..1b43f38 100644 --- a/1.sources/MyHealth/src/managedbean/profile/ChangePrimaryHealthCareCenterMBean.java +++ b/1.sources/MyHealth/src/managedbean/profile/ChangePrimaryHealthCareCenterMBean.java @@ -2,6 +2,7 @@ package managedbean.profile; import java.io.Serializable; import java.util.Collection; +import java.util.List; import javax.annotation.PostConstruct; import javax.faces.application.FacesMessage; @@ -11,6 +12,7 @@ import javax.inject.Named; import TO.FamilyDoctorTO; import TO.LoggedUserTO; import TO.PrimaryHealthCareCenterTO; +import common.Constants; import common.UserType; import managedbean.common.ManagedBeanBase; import managedbean.common.SessionUtils; @@ -28,7 +30,8 @@ public class ChangePrimaryHealthCareCenterMBean extends ManagedBeanBase implemen private int id; private PrimaryHealthCareCenterTO currentCenter; private PrimaryHealthCareCenterTO newCenter; - private Collection primaryHealthCareCentersList; + private List primaryHealthCareCentersList; + private String lastUIQuery; public ChangePrimaryHealthCareCenterMBean() { @@ -38,6 +41,8 @@ public class ChangePrimaryHealthCareCenterMBean extends ManagedBeanBase implemen public void init() { // Recuperamos el usuario logeado actual LoggedUserTO usr = null; + this.lastUIQuery = ""; + try { usr = SessionUtils.getloggedOnUser(); @@ -48,7 +53,7 @@ public class ChangePrimaryHealthCareCenterMBean extends ManagedBeanBase implemen this.id = Integer.valueOf(usr.getId()); if (usr.getUserType() == UserType.FAMILY_DOCTOR) { - this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listAllCAPs(); + this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH); FamilyDoctorTO fd = this.getRemoteManagerCommon().retrieveFamilyDoctor(this.id); this.setCurrentCenter(fd.getPrimaryHealthCareCenter()); @@ -60,9 +65,18 @@ public class ChangePrimaryHealthCareCenterMBean extends ManagedBeanBase implemen } - public Collection getPhcList() { + public List getPhcList() { return primaryHealthCareCentersList; } + + public List completePrimaryHealCareCenter(String query) { + if (query != null && query.equals(this.lastUIQuery) == false) { + this.lastUIQuery = query; + // Recuperamos las 200 primeras coincidencias + this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH); + } + return this.primaryHealthCareCentersList; + } public int getId() { return id; diff --git a/1.sources/MyHealth/src/managedbean/profile/RegisterUserMBean.java b/1.sources/MyHealth/src/managedbean/profile/RegisterUserMBean.java index 331f6eb..158ac99 100644 --- a/1.sources/MyHealth/src/managedbean/profile/RegisterUserMBean.java +++ b/1.sources/MyHealth/src/managedbean/profile/RegisterUserMBean.java @@ -19,6 +19,7 @@ import TO.MedicalSpecialtyTO; import TO.PatientTO; import TO.PrimaryHealthCareCenterTO; import TO.SpecialistDoctorTO; +import common.Constants; import common.UserType; import managedbean.common.ManagedBeanBase; import managedbean.common.ValidationUtils; @@ -44,14 +45,16 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable { private String password; private String email; private boolean registered; + private String lastUIQueryPH; + private String lastUIQueryMS; // private HashMap userTypes; private List userTypes; private String userType; private PrimaryHealthCareCenterTO primaryHealthCareCenter; private MedicalSpecialtyTO medicalSpecialty; - private Collection medicalSpecialitiesList; - private Collection primaryHealthCareCentersList; + private List medicalSpecialitiesList; + private List primaryHealthCareCentersList; public RegisterUserMBean() { @@ -64,11 +67,13 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable { this.userTypes.add(UserType.FAMILY_DOCTOR); this.userTypes.add(UserType.SPECIALIST_DOCTOR); this.registered = false; + this.lastUIQueryPH = ""; + this.lastUIQueryMS = ""; this.userType = UserType.PATIENT.name(); - this.medicalSpecialitiesList = this.getRemoteManagerCommon().listAllMedicalSpecialities(); - this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listAllCAPs(); + this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH); + this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH); } public List getUserTypes() { @@ -98,14 +103,32 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable { } } - public Collection getMedicalSpecialtiesList() { + public List getMedicalSpecialtiesList() { return medicalSpecialitiesList; } - public Collection getPhcList() { + public List getPhcList() { return primaryHealthCareCentersList; } + public List completePrimaryHealCareCenter(String query) { + if (query != null && query.equals(this.lastUIQueryPH) == false) { + this.lastUIQueryPH = query; + // Recuperamos las 200 primeras coincidencias + this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH); + } + return this.primaryHealthCareCentersList; + } + + public List completeMedicalSpecialty(String query) { + if (query != null && query.equals(this.lastUIQueryMS) == false) { + this.lastUIQueryMS = query; + // Recuperamos las 200 primeras coincidencias + this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH); + } + return this.medicalSpecialitiesList; + } + public boolean isPatient() { return (UserType.valueOf(this.userType) == UserType.PATIENT); } diff --git a/1.sources/MyHealth/src/managedbean/profile/UpdateProfileMBean.java b/1.sources/MyHealth/src/managedbean/profile/UpdateProfileMBean.java index 6bd252f..5cb372b 100644 --- a/1.sources/MyHealth/src/managedbean/profile/UpdateProfileMBean.java +++ b/1.sources/MyHealth/src/managedbean/profile/UpdateProfileMBean.java @@ -4,18 +4,11 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import java.util.Properties; import javax.annotation.PostConstruct; import javax.faces.application.FacesMessage; -import javax.faces.context.ExternalContext; -import javax.faces.context.FacesContext; import javax.faces.view.ViewScoped; import javax.inject.Named; -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.print.attribute.standard.Severity; import javax.resource.NotSupportedException; import org.primefaces.PrimeFaces; @@ -26,9 +19,9 @@ import TO.MedicalSpecialtyTO; import TO.PatientTO; import TO.PrimaryHealthCareCenterTO; import TO.SpecialistDoctorTO; +import common.Constants; import common.HashUtils; import common.UserType; -import ejb.systemAdmin.SystemAdminFacadeRemote; import managedbean.common.ManagedBeanBase; import managedbean.common.SessionUtils; import managedbean.common.ValidationUtils; @@ -54,13 +47,18 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable private String oldPassword; private String password; private String email; + private String lastUIQueryPH; + private String lastUIQueryMS; + private String lastUIQueryFD; private List userTypes; private String userType; private PrimaryHealthCareCenterTO primaryHealthCareCenter; private MedicalSpecialtyTO medicalSpecialty; - private Collection medicalSpecialitiesList; - private Collection primaryHealthCareCentersList; + private List medicalSpecialitiesList; + private List primaryHealthCareCentersList; + private FamilyDoctorTO familyDoctor; + private List familyDoctorList; public UpdateProfileMBean() { @@ -72,6 +70,8 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable this.userTypes.add(UserType.PATIENT); this.userTypes.add(UserType.FAMILY_DOCTOR); this.userTypes.add(UserType.SPECIALIST_DOCTOR); + this.lastUIQueryPH = ""; + this.lastUIQueryMS = ""; // Recuperamos el usuario logeado actual LoggedUserTO usr = null; @@ -87,6 +87,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable switch (usr.getUserType()) { case PATIENT: + this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH); PatientTO pat = this.getRemoteManagerCommon().retrievePatient(this.id); this.name = pat.getName(); @@ -96,7 +97,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable this.currentPassword = pat.getPassword(); break; case SPECIALIST_DOCTOR: - this.medicalSpecialitiesList = this.getRemoteManagerCommon().listAllMedicalSpecialities(); + this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH); SpecialistDoctorTO sd = this.getRemoteManagerCommon().retrieveSpecialistDoctor(this.id); this.name = sd.getName(); @@ -107,7 +108,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable this.medicalSpecialty = sd.getMedicalSpecialty(); break; case FAMILY_DOCTOR: - this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listAllCAPs(); + this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH); FamilyDoctorTO fd = this.getRemoteManagerCommon().retrieveFamilyDoctor(this.id); this.name = fd.getName(); @@ -156,28 +157,59 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable } } - public Collection getMedicalSpecialtiesList() { + public List getMedicalSpecialtiesList() { return medicalSpecialitiesList; } - public Collection getPhcList() { + public List getPhcList() { return primaryHealthCareCentersList; } - public boolean isPatient() { + public List completePrimaryHealCareCenter(String query) { + if (query != null && query.equals(this.lastUIQueryPH) == false) { + this.lastUIQueryPH = query; + // Recuperamos las 200 primeras coincidencias + this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH); + } + return this.primaryHealthCareCentersList; + } + + public List completeMedicalSpecialty(String query) { + if (query != null && query.equals(this.lastUIQueryMS) == false) { + this.lastUIQueryMS = query; + // Recuperamos las 200 primeras coincidencias + this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH); + } + return this.medicalSpecialitiesList; + } + + public List getFamilyDoctorList() { + return familyDoctorList; + } + + public List completeFamilyDoctor(String query) { + if (query != null && query.equals(this.lastUIQueryFD) == false) { + this.lastUIQueryFD = query; + // Recuperamos las 200 primeras coincidencias + this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsFiltered(query, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH); + } + return this.familyDoctorList; + } + + public boolean isUserTypePatient() { return (UserType.valueOf(this.userType) == UserType.PATIENT); } - public boolean isFamilyDoctor() { + public boolean isUserTypeFamilyDoctor() { return (UserType.valueOf(this.userType) == UserType.FAMILY_DOCTOR); } - public boolean isSpecialistDoctor() { + public boolean isUserTypeSpecialistDoctor() { return (UserType.valueOf(this.userType) == UserType.SPECIALIST_DOCTOR); } - public boolean isDoctor() { - return (isFamilyDoctor() || isSpecialistDoctor()); + public boolean isUserTypeDoctor() { + return (isUserTypeFamilyDoctor() || isUserTypeSpecialistDoctor()); } public String getEmail() { @@ -228,11 +260,11 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable int error = 0; boolean changePassword = (this.oldPassword != null && this.oldPassword.equals("") == false) || (this.password != null && this.password.equals("") == false); - if (this.isFamilyDoctor() && this.primaryHealthCareCenter == null) { + if (this.isUserTypeFamilyDoctor() && this.primaryHealthCareCenter == null) { this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Centro de atención primaria no seleccionado", "Por favor, especifique un centro de atención primaria."); error++; } - if (this.isSpecialistDoctor() && this.medicalSpecialty == null) { + if (this.isUserTypeSpecialistDoctor() && this.medicalSpecialty == null) { this.addFacesMessage(FacesMessage.SEVERITY_WARN, "Especialidad médica no seleccionada", "Por favor, especifique una especialidad médica."); error++; } @@ -320,4 +352,12 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable this.oldPassword = oldPassword; } + public FamilyDoctorTO getFamilyDoctor() { + return familyDoctor; + } + + public void setFamilyDoctor(FamilyDoctorTO familyDoctor) { + this.familyDoctor = familyDoctor; + } + } From be743e4aa7f0572aa712a5ca5f27f42d9a1b9806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Wed, 11 Dec 2019 00:53:48 +0100 Subject: [PATCH 03/21] =?UTF-8?q?Correcci=C3=B3n=20con=20tag=20faltanten?= =?UTF-8?q?=20de=20omnifaces.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../docroot/profile/ChangePrimaryHealthCareCenter.xhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1.sources/MyHealth/docroot/profile/ChangePrimaryHealthCareCenter.xhtml b/1.sources/MyHealth/docroot/profile/ChangePrimaryHealthCareCenter.xhtml index 861dce5..712df92 100644 --- a/1.sources/MyHealth/docroot/profile/ChangePrimaryHealthCareCenter.xhtml +++ b/1.sources/MyHealth/docroot/profile/ChangePrimaryHealthCareCenter.xhtml @@ -2,7 +2,7 @@ + xmlns:p="http://primefaces.org/ui" xmlns:o="http://omnifaces.org/ui"> From acdc1958288bed19d9e19c22eff41e14552a37f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Wed, 11 Dec 2019 21:46:22 +0100 Subject: [PATCH 04/21] =?UTF-8?q?A=C3=B1adidas=20dos=20secuencias=20para?= =?UTF-8?q?=20generar=20identificadores=20de=20Pacientes=20y=20M=C3=A9dico?= =?UTF-8?q?s.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Añadidos nuevos campo en las entidades de paciente, medico de familia y medico especialista para albergar los códigos. Las PKs de las tablas siguen siendo autonúmericos tal como hemos comentado. --- 2.database/01.CreateTables.sql | 49 +++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/2.database/01.CreateTables.sql b/2.database/01.CreateTables.sql index 03f5400..145ec54 100644 --- a/2.database/01.CreateTables.sql +++ b/2.database/01.CreateTables.sql @@ -9,8 +9,28 @@ DROP TABLE myhealth.Question; DROP TABLE myhealth.Response; DROP TABLE myhealth.SpecialistDoctor; DROP TABLE myhealth.Visit; + +DROP SEQUENCE myhealth.ProfesionalNumber; +DROP SEQUENCE myhealth.CodigoIdentificacionPaciente */ +CREATE SEQUENCE myhealth.ProfesionalNumber + INCREMENT 1 + START 1000 + MINVALUE 1000 + CACHE 1; + +ALTER SEQUENCE myhealth.ProfesionalNumber OWNER TO "USER"; + +CREATE SEQUENCE myhealth.CodigoIdentificacionPaciente + INCREMENT 1 + START 1000 + MINVALUE 1000 + CACHE 1; + +ALTER SEQUENCE myhealth.CodigoIdentificacionPaciente OWNER TO "USER"; + + -- Table: myhealth.administrator -- DROP TABLE myhealth.administrator; @@ -33,11 +53,12 @@ ALTER TABLE myhealth.administrator CREATE TABLE myhealth.familydoctor ( id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), - password character varying(100) COLLATE pg_catalog."default" NOT NULL, - nif character varying(50) COLLATE pg_catalog."default", - surname character varying(100) COLLATE pg_catalog."default", - email character varying(120) COLLATE pg_catalog."default", - name character varying(100) COLLATE pg_catalog."default", + professionalnumber VARCHAR(15) NOT NULL COLLATE pg_catalog."default", + password VARCHAR(100) NOT NULL COLLATE pg_catalog."default", + nif VARCHAR(50) NOT NULL COLLATE pg_catalog."default", + name VARCHAR(100) NOT NULL COLLATE pg_catalog."default", + surname VARCHAR(100) NOT NULL COLLATE pg_catalog."default", + email VARCHAR(120) COLLATE pg_catalog."default", primaryhealthcarecenterid integer, CONSTRAINT familydoctor_pkey PRIMARY KEY (id) ) @@ -90,11 +111,12 @@ ALTER TABLE myhealth.medicaltest CREATE TABLE myhealth.patient ( id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), - password VARCHAR(100) COLLATE pg_catalog."default", - nif VARCHAR(50) COLLATE pg_catalog."default", - surname VARCHAR(100) COLLATE pg_catalog."default", + personalIdentificationCode VARCHAR(15) NOT NULL COLLATE pg_catalog."default", + password VARCHAR(100) NOT NULL COLLATE pg_catalog."default", + nif VARCHAR(50) NOT NULL COLLATE pg_catalog."default", + name VARCHAR(100) NOT NULL COLLATE pg_catalog."default", + surname VARCHAR(100) NOT NULL COLLATE pg_catalog."default", email VARCHAR(120) COLLATE pg_catalog."default", - name VARCHAR(100) COLLATE pg_catalog."default", familydoctorid INTEGER, CONSTRAINT patient_pkey PRIMARY KEY (id) ) @@ -175,11 +197,12 @@ ALTER TABLE myhealth.response CREATE TABLE myhealth.specialistdoctor ( id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), - password VARCHAR(100) COLLATE pg_catalog."default", - nif VARCHAR(50) COLLATE pg_catalog."default", - surname VARCHAR(100) COLLATE pg_catalog."default", + professionalnumber VARCHAR(15) NOT NULL COLLATE pg_catalog."default", + password VARCHAR(100) NOT NULL COLLATE pg_catalog."default", + nif VARCHAR(50) NOT NULL COLLATE pg_catalog."default", + name VARCHAR(100) NOT NULL COLLATE pg_catalog."default", + surname VARCHAR(100) NOT NULL COLLATE pg_catalog."default", email VARCHAR(120) COLLATE pg_catalog."default", - name VARCHAR(100) COLLATE pg_catalog."default", medicalspecialtyid INTEGER, CONSTRAINT specialistdoctor_pkey PRIMARY KEY (id) ) From 28b11920361b54080196f11ebc546bb9dd0c1678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Wed, 11 Dec 2019 21:47:44 +0100 Subject: [PATCH 05/21] =?UTF-8?q?Multiples=20cambios=20para=20soportar=20l?= =?UTF-8?q?a=20utilizaci=C3=B3n=20de=20c=C3=B3digos=20de=20usuario=20?= =?UTF-8?q?=C3=BAnicos=20para=20(Pacientes,=20medicos=20de=20familia,=20me?= =?UTF-8?q?dicos=20especialista=20y=20administradores).=20Nuevos=20m=C3=A9?= =?UTF-8?q?todos=20en=20EJB=20com=C3=BAn=20para=20consultar=20Entidades=20?= =?UTF-8?q?por=20Id=20y=20por=20c=C3=B3digo=20(Para=20el=20login).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../docroot/profile/RegisterUser.xhtml | 2 +- .../docroot/profile/UpdateProfile.xhtml | 8 +- 1.sources/MyHealth/src/TO/FamilyDoctorTO.java | 11 +- 1.sources/MyHealth/src/TO/PatientTO.java | 10 +- .../MyHealth/src/TO/SpecialistDoctorTO.java | 11 +- 1.sources/MyHealth/src/common/Constants.java | 2 + .../src/ejb/common/CommonFacadeBean.java | 154 +++++++++++++----- .../src/ejb/common/CommonFacadeLocal.java | 16 +- .../src/ejb/common/CommonFacadeRemote.java | 16 +- .../src/ejb/profile/ProfileFacadeBean.java | 52 +++--- .../src/ejb/profile/ProfileFacadeRemote.java | 2 +- .../systemAdmin/SystemAdminFacadeBean.java | 110 ++++++++----- .../MyHealth/src/jpa/FamilyDoctorJPA.java | 13 +- 1.sources/MyHealth/src/jpa/PatientJPA.java | 13 +- .../MyHealth/src/jpa/SpecialistDoctorJPA.java | 13 +- .../profile/ChangeFamilyDoctorMBean.java | 2 +- .../ChangePrimaryHealthCareCenterMBean.java | 2 +- .../profile/RegisterUserMBean.java | 24 +-- .../profile/UpdateProfileMBean.java | 69 +++++--- 19 files changed, 366 insertions(+), 164 deletions(-) diff --git a/1.sources/MyHealth/docroot/profile/RegisterUser.xhtml b/1.sources/MyHealth/docroot/profile/RegisterUser.xhtml index a4fe8f3..9b60cd1 100644 --- a/1.sources/MyHealth/docroot/profile/RegisterUser.xhtml +++ b/1.sources/MyHealth/docroot/profile/RegisterUser.xhtml @@ -28,7 +28,7 @@
- +
diff --git a/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml b/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml index c8a553d..95700b0 100644 --- a/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml +++ b/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml @@ -27,14 +27,14 @@
- - + +
- +
- +
diff --git a/1.sources/MyHealth/src/TO/FamilyDoctorTO.java b/1.sources/MyHealth/src/TO/FamilyDoctorTO.java index 258c3b8..dd91620 100644 --- a/1.sources/MyHealth/src/TO/FamilyDoctorTO.java +++ b/1.sources/MyHealth/src/TO/FamilyDoctorTO.java @@ -14,6 +14,7 @@ public class FamilyDoctorTO implements Serializable { private static final long serialVersionUID = 1L; private Integer id; + private String professionalNumber; private String nif; private String name; private String surname; @@ -25,8 +26,9 @@ public class FamilyDoctorTO implements Serializable { super(); } - public FamilyDoctorTO(Integer id, String nif, String name, String surname, String password, String email, PrimaryHealthCareCenterTO phc) { + public FamilyDoctorTO(Integer id, String pic, String nif, String name, String surname, String password, String email, PrimaryHealthCareCenterTO phc) { this.id = id; + this.professionalNumber = pic; this.nif = nif; this.name = name; this.surname = surname; @@ -95,4 +97,11 @@ public class FamilyDoctorTO implements Serializable { this.primaryHealthCareCenter = primaryHealthCareCenter; } + public String getProfessionalNumber() { + return professionalNumber; + } + + public void setProfessionalNumber(String professionalNumber) { + this.professionalNumber = professionalNumber; + } } diff --git a/1.sources/MyHealth/src/TO/PatientTO.java b/1.sources/MyHealth/src/TO/PatientTO.java index c31bfda..e694dcb 100644 --- a/1.sources/MyHealth/src/TO/PatientTO.java +++ b/1.sources/MyHealth/src/TO/PatientTO.java @@ -16,6 +16,7 @@ public class PatientTO implements Serializable { private static final long serialVersionUID = 1L; private Integer id; + private String personalIdentificationCode; private String nif; private String name; private String surname; @@ -30,8 +31,9 @@ public class PatientTO implements Serializable { super(); } - public PatientTO(Integer id, String nif, String name, String surname, String password, String email, FamilyDoctorTO familyDoc) { + public PatientTO(Integer id, String pic, String nif, String name, String surname, String password, String email, FamilyDoctorTO familyDoc) { this.id = id; + this.personalIdentificationCode = pic; this.nif = nif; this.name = name; this.surname = surname; @@ -96,5 +98,11 @@ public class PatientTO implements Serializable { this.familyDoctor = familyDoctor; } + public String getPersonalIdentificationCode() { + return personalIdentificationCode; + } + public void setPersonalIdentificationCode(String personalIdentificationCode) { + this.personalIdentificationCode = personalIdentificationCode; + } } diff --git a/1.sources/MyHealth/src/TO/SpecialistDoctorTO.java b/1.sources/MyHealth/src/TO/SpecialistDoctorTO.java index bee77c4..596745e 100644 --- a/1.sources/MyHealth/src/TO/SpecialistDoctorTO.java +++ b/1.sources/MyHealth/src/TO/SpecialistDoctorTO.java @@ -14,6 +14,7 @@ public class SpecialistDoctorTO implements Serializable { private static final long serialVersionUID = 1L; private Integer id; + private String professionalNumber; private String nif; private String name; private String surname; @@ -25,8 +26,9 @@ public class SpecialistDoctorTO implements Serializable { super(); } - public SpecialistDoctorTO(Integer id, String nif, String name, String surname, String password, String email, MedicalSpecialtyTO medicalSpec) { + public SpecialistDoctorTO(Integer id, String pic, String nif, String name, String surname, String password, String email, MedicalSpecialtyTO medicalSpec) { this.id = id; + this.professionalNumber = pic; this.nif = nif; this.name = name; this.surname = surname; @@ -91,4 +93,11 @@ public class SpecialistDoctorTO implements Serializable { this.medicalSpecialty = medicalSpecialty; } + public String getProfessionalNumber() { + return professionalNumber; + } + + public void setProfessionalNumber(String professionalNumber) { + this.professionalNumber = professionalNumber; + } } diff --git a/1.sources/MyHealth/src/common/Constants.java b/1.sources/MyHealth/src/common/Constants.java index a4ff4c0..cf8500d 100644 --- a/1.sources/MyHealth/src/common/Constants.java +++ b/1.sources/MyHealth/src/common/Constants.java @@ -2,4 +2,6 @@ package common; public class Constants { public static final int MAX_ITEMS_AUTOCOMPLETE_SEARCH = 200; + public static final String PROFESSIONAL_NUMBER_PREFIX= "PRO#"; + public static final String PERSONAL_IDENTIFICATION_CODE_PREFIX= "PAT#"; } diff --git a/1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java b/1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java index 67e1e22..4524e03 100644 --- a/1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java +++ b/1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java @@ -1,7 +1,6 @@ package ejb.common; import java.util.ArrayList; -import java.util.Collection; import java.util.List; import javax.ejb.Stateless; @@ -10,6 +9,8 @@ import javax.persistence.PersistenceContext; import javax.persistence.Query; import javax.persistence.TypedQuery; +import org.jboss.security.auth.spi.Users.User; + import TO.FamilyDoctorTO; import TO.MedicalSpecialtyTO; import TO.PatientTO; @@ -71,8 +72,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal { List allJPA = query.getResultList(); List allSpecialities = new ArrayList(); - for (MedicalSpecialtyJPA cap : allJPA) { - allSpecialities.add(new MedicalSpecialtyTO(cap.getId(), cap.getName(), cap.getDescription())); + for (MedicalSpecialtyJPA item : allJPA) { + allSpecialities.add(this.getPOJOforMedicalSpecialtyJPA(item)); } return allSpecialities; @@ -111,8 +112,8 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal { List allJPA = query.getResultList(); List allCAPs = new ArrayList(); - for (PrimaryHealthCareCenterJPA cap : allJPA) { - allCAPs.add(new PrimaryHealthCareCenterTO(cap.getId(), cap.getName(), cap.getLocation())); + for (PrimaryHealthCareCenterJPA item : allJPA) { + allCAPs.add(this.getPOJOforPrimaryHealthCareCenterJPA(item)); } return allCAPs; @@ -148,60 +149,127 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal { query.setMaxResults(pageSize); } - @SuppressWarnings("unchecked") List allFDsJPA = query.getResultList(); List allFDTOs = new ArrayList(); for (FamilyDoctorJPA item : allFDsJPA) { - allFDTOs.add(new FamilyDoctorTO(item.getId(), item.getNif(), item.getName(), item.getSurname(), item.getPassword(), item.getEmail(), null)); + allFDTOs.add(this.getPOJOforFamilyDoctorJPA(item, 0)); } return allFDTOs; } - public PatientTO retrievePatient(int patientId) throws Exception { - PatientJPA pat = entman.find(PatientJPA.class, patientId); - - if (pat == null) { - throw new Exception("No se pueden actualizar los datos del paciente porque no se encuentra en la base de datos ningún registro con id: " + String.valueOf(patientId)); + private MedicalSpecialtyTO getPOJOforMedicalSpecialtyJPA(MedicalSpecialtyJPA ms) { + MedicalSpecialtyTO msTO = null; + + if (ms != null) { + msTO = new MedicalSpecialtyTO(ms.getId(), ms.getName(), ms.getDescription()); } - - FamilyDoctorTO fdTO = null; - if (pat.getFamilyDoctor() != null) { - FamilyDoctorJPA fd = pat.getFamilyDoctor(); - fdTO = new FamilyDoctorTO(fd.getId(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), null); - } - - PatientTO paTO = new PatientTO(pat.getId(), pat.getNif(), pat.getName(), pat.getSurname(), pat.getPassword(), pat.getEmail(), fdTO); - return paTO; + + return msTO; } - public FamilyDoctorTO retrieveFamilyDoctor(int ProfessionalNumberId) throws Exception { - FamilyDoctorJPA fd = entman.find(FamilyDoctorJPA.class, ProfessionalNumberId); - if (fd == null) { - throw new Exception("No se encuentra en la base de datos ningún médico de familia con id: " + String.valueOf(ProfessionalNumberId)); + private PrimaryHealthCareCenterTO getPOJOforPrimaryHealthCareCenterJPA(PrimaryHealthCareCenterJPA phc) { + PrimaryHealthCareCenterTO phcTO = null; + + if (phc != null) { + phcTO = new PrimaryHealthCareCenterTO(phc.getId(), phc.getName(), phc.getLocation()); } - - PrimaryHealthCareCenterTO phc = null; - if (fd.getPrimaryHealthCareCenter() != null) - phc = new PrimaryHealthCareCenterTO(fd.getPrimaryHealthCareCenter().getId(), fd.getPrimaryHealthCareCenter().getName(), fd.getPrimaryHealthCareCenter().getLocation()); - - FamilyDoctorTO fdTO = new FamilyDoctorTO(fd.getId(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), phc); - return fdTO; + + return phcTO; } - public SpecialistDoctorTO retrieveSpecialistDoctor(int professionalId) throws Exception { - SpecialistDoctorJPA sd = entman.find(SpecialistDoctorJPA.class, professionalId); - if (sd == null) { - throw new Exception( - "No se pueden actualizar los datos del médico de familia porque no se encuentra en la base de datos ningún registro con id: " + String.valueOf(professionalId)); + private 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)); } - - MedicalSpecialtyTO ms = null; - if (sd.getMedicalSpecialty() != null) - ms = new MedicalSpecialtyTO(sd.getMedicalSpecialty().getId(), sd.getMedicalSpecialty().getName(), sd.getMedicalSpecialty().getDescription()); - - SpecialistDoctorTO sdTO = new SpecialistDoctorTO(sd.getId(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail(), ms); + return sdTO; } + + private 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)); + } + + return fdTO; + } + + private 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)); + } + + 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) { + TypedQuery query = entman.createQuery("from PatientJPA pat where pat.personalIdentificationCode=:code", PatientJPA.class); + + query.setParameter("code", code); + + List results = query.getResultList(); + if (results.size() > 0) + return results.get(0); + else + return null; } + + public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId) { + return this.getPOJOforFamilyDoctorJPA(entman.find(FamilyDoctorJPA.class, ProfessionalNumberId), 1); + } + + public FamilyDoctorJPA 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); + else + return null; + } + + public SpecialistDoctorTO findSpecialistDoctorById(int ProfessionalNumberId) { + return this.getPOJOforSpecialistDoctorJPA(entman.find(SpecialistDoctorJPA.class, ProfessionalNumberId), 1); + } + + public SpecialistDoctorJPA 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); + else + return null; + } } diff --git a/1.sources/MyHealth/src/ejb/common/CommonFacadeLocal.java b/1.sources/MyHealth/src/ejb/common/CommonFacadeLocal.java index cc71c0e..5cc75bd 100644 --- a/1.sources/MyHealth/src/ejb/common/CommonFacadeLocal.java +++ b/1.sources/MyHealth/src/ejb/common/CommonFacadeLocal.java @@ -10,6 +10,9 @@ import TO.MedicalSpecialtyTO; import TO.PatientTO; import TO.PrimaryHealthCareCenterTO; import TO.SpecialistDoctorTO; +import jpa.FamilyDoctorJPA; +import jpa.PatientJPA; +import jpa.SpecialistDoctorJPA; /** * @@ -37,9 +40,16 @@ public interface CommonFacadeLocal { public List listFamilyDoctorsFiltered(String searchTerm, int pageNumber, int pageSize); - public PatientTO retrievePatient(int patientId) throws Exception; + public PatientTO findPatientById(int patientId); - public FamilyDoctorTO retrieveFamilyDoctor(int ProfessionalNumberId) throws Exception; + public PatientJPA findPatientByCode(String code); + + public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId); + + public FamilyDoctorJPA findFamilyDoctorByCode(String code); + + public SpecialistDoctorTO findSpecialistDoctorById(int ProfessionalNumberId); + + public SpecialistDoctorJPA findSpecialistDoctorByCode(String code); - public SpecialistDoctorTO retrieveSpecialistDoctor(int ProfessionalNumberId) throws Exception; } diff --git a/1.sources/MyHealth/src/ejb/common/CommonFacadeRemote.java b/1.sources/MyHealth/src/ejb/common/CommonFacadeRemote.java index d62a870..44f38cc 100644 --- a/1.sources/MyHealth/src/ejb/common/CommonFacadeRemote.java +++ b/1.sources/MyHealth/src/ejb/common/CommonFacadeRemote.java @@ -10,6 +10,9 @@ import TO.MedicalSpecialtyTO; import TO.PatientTO; import TO.PrimaryHealthCareCenterTO; import TO.SpecialistDoctorTO; +import jpa.FamilyDoctorJPA; +import jpa.PatientJPA; +import jpa.SpecialistDoctorJPA; /** * @@ -37,9 +40,16 @@ public interface CommonFacadeRemote { public List listFamilyDoctorsFiltered(String searchTerm, int pageNumber, int pageSize); - public PatientTO retrievePatient(int patientId) throws Exception; + public PatientTO findPatientById(int patientId); - public FamilyDoctorTO retrieveFamilyDoctor(int ProfessionalNumberId) throws Exception; + public PatientJPA findPatientByCode(String code); + + public FamilyDoctorTO findFamilyDoctorById(int ProfessionalNumberId); + + public FamilyDoctorJPA findFamilyDoctorByCode(String code); + + public SpecialistDoctorTO findSpecialistDoctorById(int ProfessionalNumberId); + + public SpecialistDoctorJPA findSpecialistDoctorByCode(String code); - public SpecialistDoctorTO retrieveSpecialistDoctor(int ProfessionalNumberId) throws Exception; } diff --git a/1.sources/MyHealth/src/ejb/profile/ProfileFacadeBean.java b/1.sources/MyHealth/src/ejb/profile/ProfileFacadeBean.java index 8e28709..80ca931 100644 --- a/1.sources/MyHealth/src/ejb/profile/ProfileFacadeBean.java +++ b/1.sources/MyHealth/src/ejb/profile/ProfileFacadeBean.java @@ -4,16 +4,16 @@ import javax.ejb.EJB; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; +import javax.persistence.Query; import TO.FamilyDoctorTO; import TO.MedicalSpecialtyTO; import TO.PatientTO; import TO.PrimaryHealthCareCenterTO; import TO.SpecialistDoctorTO; +import common.Constants; import common.HashUtils; -import ejb.common.CommonFacadeBean; import ejb.common.CommonFacadeLocal; -import ejb.common.CommonFacadeRemote; import jpa.FamilyDoctorJPA; import jpa.MedicalSpecialtyJPA; import jpa.PatientJPA; @@ -31,36 +31,46 @@ public class ProfileFacadeBean implements ProfileFacadeRemote { // Persistence Unit Context @PersistenceContext(unitName = "MyHealth") private EntityManager entman; - - @EJB - CommonFacadeLocal commonServices; - public PatientTO changeFamilyDoctor(int patientId, int ProfessionalNumberId) throws Exception { + @EJB + CommonFacadeLocal commonServices; + + private String getNextProfessionalNumber() { + Query q = entman.createNativeQuery("select nextval('myhealth.profesionalnumber')"); + return Constants.PROFESSIONAL_NUMBER_PREFIX.concat(String.valueOf(q.getSingleResult())); + } + + private String getNextPersonalIdentificationCode() { + Query q = entman.createNativeQuery("select nextval('myhealth.profesionalnumber')"); + return Constants.PERSONAL_IDENTIFICATION_CODE_PREFIX.concat(String.valueOf(q.getSingleResult())); + } + + public PatientTO changeFamilyDoctor(int patientId, int newDoctor) throws Exception { PatientJPA pat = entman.find(PatientJPA.class, patientId); if (pat == null) { throw new Exception("No se pueden actualizar los datos del paciente porque no se encuentra en la base de datos ningún registro con id: " + String.valueOf(patientId)); } - FamilyDoctorJPA fd = entman.find(FamilyDoctorJPA.class, ProfessionalNumberId); + FamilyDoctorJPA fd = entman.find(FamilyDoctorJPA.class, newDoctor); if (fd == null) { - throw new Exception("No se pueden actualizar los datos del médico de familia porque no se encuentra en la base de datos ningún registro con id: " - + String.valueOf(ProfessionalNumberId)); + throw new Exception( + "No se pueden actualizar los datos del médico de familia porque no se encuentra en la base de datos ningún registro con id: " + String.valueOf(newDoctor)); } PatientTO paTO = null; pat.setFamilyDoctor(fd); entman.persist(pat); - //CommonFacadeRemote common = new CommonFacadeBean(); - return commonServices.retrievePatient(pat.getId()); + // CommonFacadeRemote common = new CommonFacadeBean(); + return commonServices.findPatientById(pat.getId()); } public PatientTO registerPatient(int id, String nif, String name, String surname, String password, String email) { PatientTO paTO = null; - PatientJPA pat = new PatientJPA(nif, name, surname, HashUtils.hashMD5(password), email, null); + PatientJPA pat = new PatientJPA(this.getNextPersonalIdentificationCode(), nif, name, surname, HashUtils.hashMD5(password), email, null); entman.persist(pat); - paTO = new PatientTO(pat.getId(), pat.getNif(), pat.getName(), pat.getSurname(), pat.getPassword(), pat.getEmail(), null); + paTO = new PatientTO(pat.getId(), this.getNextPersonalIdentificationCode(), pat.getNif(), pat.getName(), pat.getSurname(), pat.getPassword(), pat.getEmail(), null); return paTO; } @@ -72,11 +82,11 @@ public class ProfileFacadeBean implements ProfileFacadeRemote { throw new Exception("No se encuentra la especialidad médica con identificador: " + specialty.getName()); } - SpecialistDoctorJPA sd = new SpecialistDoctorJPA(nif, name, surname, HashUtils.hashMD5(password), email, ms); + SpecialistDoctorJPA sd = new SpecialistDoctorJPA(this.getNextProfessionalNumber(), nif, name, surname, HashUtils.hashMD5(password), email, ms); entman.persist(sd); SpecialistDoctorTO sdTO = null; - sdTO = new SpecialistDoctorTO(sd.getId(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail(), specialty); + sdTO = new SpecialistDoctorTO(sd.getId(), this.getNextProfessionalNumber(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail(), specialty); return sdTO; } @@ -89,10 +99,10 @@ public class ProfileFacadeBean implements ProfileFacadeRemote { throw new Exception("No se encuentra el centro de atención primaria con identificador: " + cap.getName()); } - FamilyDoctorJPA fd = new FamilyDoctorJPA(nif, name, surname, HashUtils.hashMD5(password), email, phcC); + FamilyDoctorJPA fd = new FamilyDoctorJPA(this.getNextProfessionalNumber(), nif, name, surname, HashUtils.hashMD5(password), email, phcC); entman.persist(fd); - fdTO = new FamilyDoctorTO(fd.getId(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), cap); + fdTO = new FamilyDoctorTO(fd.getId(), this.getNextProfessionalNumber(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), cap); return fdTO; } @@ -115,7 +125,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote { entman.persist(pat); PatientTO patTO = null; - patTO = new PatientTO(pat.getId(), pat.getNif(), pat.getName(), pat.getSurname(), pat.getPassword(), pat.getEmail(), null); + patTO = new PatientTO(pat.getId(), pat.getPersonalIdentificationCode(), pat.getNif(), pat.getName(), pat.getSurname(), pat.getPassword(), pat.getEmail(), null); return patTO; } @@ -144,7 +154,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote { entman.persist(sd); SpecialistDoctorTO sdTO = null; - sdTO = new SpecialistDoctorTO(sd.getId(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail(), specialty); + sdTO = new SpecialistDoctorTO(sd.getId(), sd.getProfessionalNumber(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail(), specialty); return sdTO; } @@ -172,7 +182,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote { entman.persist(fd); FamilyDoctorTO fdTO = null; - fdTO = new FamilyDoctorTO(fd.getId(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), phcTO); + fdTO = new FamilyDoctorTO(fd.getId(), fd.getProfessionalNumber(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), phcTO); return fdTO; } @@ -192,7 +202,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote { fd.setPrimaryHealthCareCenter(phcC); entman.persist(fd); - fdTO = new FamilyDoctorTO(fd.getId(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), newCenter); + fdTO = new FamilyDoctorTO(fd.getId(), fd.getProfessionalNumber(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), newCenter); return fdTO; } diff --git a/1.sources/MyHealth/src/ejb/profile/ProfileFacadeRemote.java b/1.sources/MyHealth/src/ejb/profile/ProfileFacadeRemote.java index d75674c..5e1ed76 100644 --- a/1.sources/MyHealth/src/ejb/profile/ProfileFacadeRemote.java +++ b/1.sources/MyHealth/src/ejb/profile/ProfileFacadeRemote.java @@ -16,7 +16,7 @@ import TO.SpecialistDoctorTO; @Remote public interface ProfileFacadeRemote { - public PatientTO changeFamilyDoctor(int id, int ProfessionalNumberId) throws Exception; + public PatientTO changeFamilyDoctor(int id, int newDoctor) throws Exception; public PatientTO registerPatient(int id, String nif, String name, String surname, String password, String email); diff --git a/1.sources/MyHealth/src/ejb/systemAdmin/SystemAdminFacadeBean.java b/1.sources/MyHealth/src/ejb/systemAdmin/SystemAdminFacadeBean.java index ba4469c..ea2eccf 100644 --- a/1.sources/MyHealth/src/ejb/systemAdmin/SystemAdminFacadeBean.java +++ b/1.sources/MyHealth/src/ejb/systemAdmin/SystemAdminFacadeBean.java @@ -1,23 +1,18 @@ package ejb.systemAdmin; -import java.util.ArrayList; -import java.util.Collection; - +import javax.ejb.EJB; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; -import javax.persistence.Query; import TO.LoggedUserTO; -import TO.MedicalSpecialtyTO; -import TO.PrimaryHealthCareCenterTO; +import common.Constants; import common.HashUtils; import common.UserType; +import ejb.common.CommonFacadeLocal; import jpa.AdministratorJPA; import jpa.FamilyDoctorJPA; -import jpa.MedicalSpecialtyJPA; import jpa.PatientJPA; -import jpa.PrimaryHealthCareCenterJPA; import jpa.SpecialistDoctorJPA; /** @@ -32,49 +27,80 @@ public class SystemAdminFacadeBean implements SystemAdminFacadeRemote { @PersistenceContext(unitName = "MyHealth") private EntityManager entman; - public LoggedUserTO login(String id, String pwd) { + @EJB + CommonFacadeLocal commonServices; + + /** + * Si la autenticación no es correcgta devuelve null, sino devuelve un POJO con + * datos del usuario logeado. + * + * La autenticación se realiza en 2 pasos: + * + * Paso 1. Se intenta localizar un registro de usuario, por orden: + * + * a. Primero Paciente, si el identificador comienza por los caracteres + * correctos. + * + * b.Después médico de familia, si el identificador es de profesional + * + * c. Si no lo localizamos buscamos el identificador en la tabla de médicos + * especialistas (el identificador es de profesional) + * + * d. Si no hemos localizado aún al usuario, lo buscamos en la tabla de + * administradores, aún cuando el identificador comience por cualquier carácter + * (podría ser una dirección de email que comienza por caracteres del + * identificaodr de paciente o profesional) + * + * Paso 2. Si hemos localizado un registro de usuario, verificamos si el + * password recibido coincide con el de la base de datos, en tal caso la + * autenticación se compelta y es correcta. + */ + public LoggedUserTO login(String userCode, String pwd) { LoggedUserTO usr = null; - // First try to login as Admin - AdministratorJPA adm = entman.find(AdministratorJPA.class, id); - if (adm != null) { - usr = new LoggedUserTO(adm.getEmail(), adm.getEmail(), adm.getPassword(), UserType.ADMINISTRATOR); - } else { - try { - int iId = Integer.parseInt(id); - - // Try to login Patient, FamilyDoctor or SpecialistDoctor - // TODO: Si Patient, FamilyDoctor o Specialist Doctor tienen el mismo id, solo - // el paciente se puede logear. ¿Deberíamos cambiar esto permitiendo seleccionar - // el perfil a logearse? - PatientJPA pat = entman.find(PatientJPA.class, iId); - - if (pat != null) { - usr = new LoggedUserTO(String.valueOf(pat.getId()), pat.getName(), pat.getPassword(), UserType.PATIENT); - } else { - FamilyDoctorJPA fdoc = entman.find(FamilyDoctorJPA.class, iId); - - if (fdoc != null) { - usr = new LoggedUserTO(String.valueOf(fdoc.getId()), fdoc.getName(), fdoc.getPassword(), UserType.FAMILY_DOCTOR); - } else { - SpecialistDoctorJPA sdoc = entman.find(SpecialistDoctorJPA.class, iId); - - if (sdoc != null) { - usr = new LoggedUserTO(String.valueOf(sdoc.getId()), sdoc.getName(), sdoc.getPassword(), UserType.SPECIALIST_DOCTOR); - } - } - } - } catch (NumberFormatException nf) { - // id is not an intenger, so, login fails - usr = null; + 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); + 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); + 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); + + if (sd != null) { + usr = new LoggedUserTO(String.valueOf(sd.getId()), sd.getName(), sd.getPassword(), UserType.SPECIALIST_DOCTOR); + } + } } + // Si todavía no hemos conseguido autenticar al usuario, podría tratarse de una + // dirección de email de un administrador que empiece por + // PERSONAL_IDENTIFICATION_CODE_PREFIX o por PROFESSIONAL_NUMBER_PREFIX, por lo + // cual intentamos login contra la tabla de administradores + if (usr == null) { + // Intentamos recuperar un registro de administrador + AdministratorJPA adm = entman.find(AdministratorJPA.class, userCode); + + if (adm != null) { + usr = new LoggedUserTO(adm.getEmail(), adm.getEmail(), adm.getPassword(), UserType.ADMINISTRATOR); + } + } + + // Si el objeto usr, es que hemos localizado un registro de usuario, verificamos + // la contraseña. if (usr != null) { // Comprobamos el password if (usr.getPassword().equals(HashUtils.hashMD5(pwd)) == false) { - // Bad Password, devolvemos null! + // Bad Password, devolvemos null! La autenticación falla. usr = null; } } diff --git a/1.sources/MyHealth/src/jpa/FamilyDoctorJPA.java b/1.sources/MyHealth/src/jpa/FamilyDoctorJPA.java index 3d36ead..0c77993 100644 --- a/1.sources/MyHealth/src/jpa/FamilyDoctorJPA.java +++ b/1.sources/MyHealth/src/jpa/FamilyDoctorJPA.java @@ -30,6 +30,8 @@ public class FamilyDoctorJPA implements Serializable { @Column(updatable = false) @GeneratedValue(strategy=GenerationType.IDENTITY) private Integer id; + @Column(nullable = false, unique = true) + private String professionalNumber; private String nif; private String name; private String surname; @@ -49,7 +51,8 @@ public class FamilyDoctorJPA implements Serializable { super(); } - public FamilyDoctorJPA(String nif, String name, String surname, String password, String email, PrimaryHealthCareCenterJPA phc) { + public FamilyDoctorJPA(String pin, String nif, String name, String surname, String password, String email, PrimaryHealthCareCenterJPA phc) { + this.setProfessionalNumber(pin); this.nif = nif; this.name = name; this.surname = surname; @@ -124,4 +127,12 @@ public class FamilyDoctorJPA implements Serializable { public void setPrimaryHealthCareCenter(PrimaryHealthCareCenterJPA center) { this.primaryHealthCareCenter = center; } + + public String getProfessionalNumber() { + return professionalNumber; + } + + public void setProfessionalNumber(String professionalNumber) { + this.professionalNumber = professionalNumber; + } } \ No newline at end of file diff --git a/1.sources/MyHealth/src/jpa/PatientJPA.java b/1.sources/MyHealth/src/jpa/PatientJPA.java index fd4b069..764b444 100644 --- a/1.sources/MyHealth/src/jpa/PatientJPA.java +++ b/1.sources/MyHealth/src/jpa/PatientJPA.java @@ -26,6 +26,8 @@ public class PatientJPA implements Serializable { @Column(updatable = false) @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; + @Column(nullable = false, unique = true) + private String personalIdentificationCode; private String nif; private String name; private String surname; @@ -42,7 +44,8 @@ public class PatientJPA implements Serializable { super(); } - public PatientJPA(String nif, String name, String surname, String password, String email, FamilyDoctorJPA familyDoc) { + public PatientJPA(String pic, String nif, String name, String surname, String password, String email, FamilyDoctorJPA familyDoc) { + this.personalIdentificationCode = pic; this.nif = nif; this.name = name; this.surname = surname; @@ -106,4 +109,12 @@ public class PatientJPA implements Serializable { public void setFamilyDoctor(FamilyDoctorJPA familyDoc) { this.familyDoctor = familyDoc; } + + public String getPersonalIdentificationCode() { + return personalIdentificationCode; + } + + public void setPersonalIdentificationCode(String personalIdentificationCode) { + this.personalIdentificationCode = personalIdentificationCode; + } } diff --git a/1.sources/MyHealth/src/jpa/SpecialistDoctorJPA.java b/1.sources/MyHealth/src/jpa/SpecialistDoctorJPA.java index 6ffa8d4..c845966 100644 --- a/1.sources/MyHealth/src/jpa/SpecialistDoctorJPA.java +++ b/1.sources/MyHealth/src/jpa/SpecialistDoctorJPA.java @@ -26,6 +26,8 @@ public class SpecialistDoctorJPA implements Serializable { @Column(updatable = false) @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; + @Column(nullable = false, unique = true) + private String professionalNumber; private String nif; private String name; private String surname; @@ -42,7 +44,8 @@ public class SpecialistDoctorJPA implements Serializable { super(); } - public SpecialistDoctorJPA(String nif, String name, String surname, String password, String email, MedicalSpecialtyJPA ms) { + public SpecialistDoctorJPA(String pic, String nif, String name, String surname, String password, String email, MedicalSpecialtyJPA ms) { + this.setProfessionalNumber(pic); this.nif = nif; this.name = name; this.surname = surname; @@ -106,4 +109,12 @@ public class SpecialistDoctorJPA implements Serializable { public void setMedicalSpecialty(MedicalSpecialtyJPA specialty) { this.medicalSpecialty = specialty; } + + public String getProfessionalNumber() { + return professionalNumber; + } + + public void setProfessionalNumber(String professionalNumber) { + this.professionalNumber = professionalNumber; + } } diff --git a/1.sources/MyHealth/src/managedbean/profile/ChangeFamilyDoctorMBean.java b/1.sources/MyHealth/src/managedbean/profile/ChangeFamilyDoctorMBean.java index 2c1d72c..463af12 100644 --- a/1.sources/MyHealth/src/managedbean/profile/ChangeFamilyDoctorMBean.java +++ b/1.sources/MyHealth/src/managedbean/profile/ChangeFamilyDoctorMBean.java @@ -53,7 +53,7 @@ public class ChangeFamilyDoctorMBean extends ManagedBeanBase implements Serializ if (usr.getUserType() == UserType.PATIENT) { this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH); - PatientTO pat = this.getRemoteManagerCommon().retrievePatient(this.id); + PatientTO pat = this.getRemoteManagerCommon().findPatientById(this.id); this.setCurrentFamilyDoctor(pat.getFamilyDoctor()); } } diff --git a/1.sources/MyHealth/src/managedbean/profile/ChangePrimaryHealthCareCenterMBean.java b/1.sources/MyHealth/src/managedbean/profile/ChangePrimaryHealthCareCenterMBean.java index 1b43f38..f0c6107 100644 --- a/1.sources/MyHealth/src/managedbean/profile/ChangePrimaryHealthCareCenterMBean.java +++ b/1.sources/MyHealth/src/managedbean/profile/ChangePrimaryHealthCareCenterMBean.java @@ -55,7 +55,7 @@ public class ChangePrimaryHealthCareCenterMBean extends ManagedBeanBase implemen if (usr.getUserType() == UserType.FAMILY_DOCTOR) { this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH); - FamilyDoctorTO fd = this.getRemoteManagerCommon().retrieveFamilyDoctor(this.id); + FamilyDoctorTO fd = this.getRemoteManagerCommon().findFamilyDoctorById(this.id); this.setCurrentCenter(fd.getPrimaryHealthCareCenter()); } } diff --git a/1.sources/MyHealth/src/managedbean/profile/RegisterUserMBean.java b/1.sources/MyHealth/src/managedbean/profile/RegisterUserMBean.java index 158ac99..f2969b9 100644 --- a/1.sources/MyHealth/src/managedbean/profile/RegisterUserMBean.java +++ b/1.sources/MyHealth/src/managedbean/profile/RegisterUserMBean.java @@ -36,8 +36,8 @@ import managedbean.common.ValidationUtils; public class RegisterUserMBean extends ManagedBeanBase implements Serializable { private static final long serialVersionUID = 1L; - private int id; + private String cipCode; private String nif; private String name; private String surname; @@ -185,14 +185,6 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable { this.nif = nif; } - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - public void addNewUser() { int error = 0; @@ -214,17 +206,17 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable { switch (UserType.valueOf(this.userType)) { case PATIENT: PatientTO pat = this.getRemoteManagerProfile().registerPatient(id, nif, name, surname, password, email); - this.id = pat.getId(); + this.cipCode = pat.getPersonalIdentificationCode(); break; case FAMILY_DOCTOR: FamilyDoctorTO fd = this.getRemoteManagerProfile().registerFamilyDoctor(id, nif, name, surname, password, email, this.primaryHealthCareCenter); - this.id = fd.getId(); + this.cipCode = fd.getProfessionalNumber(); break; case SPECIALIST_DOCTOR: SpecialistDoctorTO sd = this.getRemoteManagerProfile().registerSpecialistDoctor(id, nif, name, surname, password, email, this.medicalSpecialty); - this.id = sd.getId(); + this.cipCode = sd.getProfessionalNumber(); break; case ADMINISTRATOR: @@ -268,4 +260,12 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable { return registered; } + public String getCipCode() { + return cipCode; + } + + public void setCipCode(String cipCode) { + this.cipCode = cipCode; + } + } diff --git a/1.sources/MyHealth/src/managedbean/profile/UpdateProfileMBean.java b/1.sources/MyHealth/src/managedbean/profile/UpdateProfileMBean.java index 5cb372b..81b492f 100644 --- a/1.sources/MyHealth/src/managedbean/profile/UpdateProfileMBean.java +++ b/1.sources/MyHealth/src/managedbean/profile/UpdateProfileMBean.java @@ -40,6 +40,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable private static final long serialVersionUID = 1L; private int id; + private String cipCode; private String nif; private String name; private String surname; @@ -88,35 +89,15 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable switch (usr.getUserType()) { case PATIENT: this.familyDoctorList = this.getRemoteManagerCommon().listFamilyDoctorsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH); - PatientTO pat = this.getRemoteManagerCommon().retrievePatient(this.id); - - this.name = pat.getName(); - this.surname = pat.getName(); - this.nif = pat.getNif(); - this.email = pat.getEmail(); - this.currentPassword = pat.getPassword(); + this.setPatientData(this.getRemoteManagerCommon().findPatientById(this.id)); break; case SPECIALIST_DOCTOR: this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH); - SpecialistDoctorTO sd = this.getRemoteManagerCommon().retrieveSpecialistDoctor(this.id); - - this.name = sd.getName(); - this.surname = sd.getName(); - this.nif = sd.getNif(); - this.email = sd.getEmail(); - this.currentPassword = sd.getPassword(); - this.medicalSpecialty = sd.getMedicalSpecialty(); + this.setSpecialistDoctorData(this.getRemoteManagerCommon().findSpecialistDoctorById(this.id)); break; case FAMILY_DOCTOR: this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH); - FamilyDoctorTO fd = this.getRemoteManagerCommon().retrieveFamilyDoctor(this.id); - - this.name = fd.getName(); - this.surname = fd.getName(); - this.nif = fd.getNif(); - this.email = fd.getEmail(); - this.currentPassword = fd.getPassword(); - this.primaryHealthCareCenter = fd.getPrimaryHealthCareCenter(); + this.setFamilyDoctorData(this.getRemoteManagerCommon().findFamilyDoctorById(this.id)); break; case ADMINISTRATOR: // TODO: Recuperar usuario administrador para editar su perfil ¿? @@ -127,7 +108,39 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable } catch (Exception e) { this.manageException(e); } + } + private void setPatientData(PatientTO pat) { + this.id = pat.getId(); + this.cipCode = pat.getPersonalIdentificationCode(); + this.name = pat.getName(); + this.surname = pat.getName(); + this.nif = pat.getNif(); + this.email = pat.getEmail(); + this.currentPassword = pat.getPassword(); + this.familyDoctor = pat.getFamilyDoctor(); + } + + private void setFamilyDoctorData(FamilyDoctorTO fd) { + this.id = fd.getId(); + this.cipCode = fd.getProfessionalNumber(); + this.name = fd.getName(); + this.surname = fd.getName(); + this.nif = fd.getNif(); + this.email = fd.getEmail(); + this.currentPassword = fd.getPassword(); + this.primaryHealthCareCenter = fd.getPrimaryHealthCareCenter(); + } + + private void setSpecialistDoctorData(SpecialistDoctorTO sd) { + this.id = sd.getId(); + this.cipCode = sd.getProfessionalNumber(); + this.name = sd.getName(); + this.surname = sd.getName(); + this.nif = sd.getNif(); + this.email = sd.getEmail(); + this.currentPassword = sd.getPassword(); + this.medicalSpecialty = sd.getMedicalSpecialty(); } public List getUserTypes() { @@ -290,17 +303,17 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable switch (UserType.valueOf(this.userType)) { case PATIENT: PatientTO pat = this.getRemoteManagerProfile().updatePatientData(id, nif, name, surname, password, email); - this.id = pat.getId(); + this.setPatientData(pat); break; case FAMILY_DOCTOR: FamilyDoctorTO fd = this.getRemoteManagerProfile().updateFamilyDoctorData(id, nif, name, surname, password, email, this.primaryHealthCareCenter); - this.id = fd.getId(); + this.setFamilyDoctorData(fd); break; case SPECIALIST_DOCTOR: SpecialistDoctorTO sd = this.getRemoteManagerProfile().updateSpecialistDoctorData(id, nif, name, surname, password, email, this.medicalSpecialty); - this.id = sd.getId(); + this.setSpecialistDoctorData(sd); break; case ADMINISTRATOR: @@ -360,4 +373,8 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable this.familyDoctor = familyDoctor; } + public String getCipCode() { + return cipCode; + } + } From a6238cc5804b1ef64cfa4169a8123bb4d3ff479a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Wed, 11 Dec 2019 21:59:04 +0100 Subject: [PATCH 06/21] =?UTF-8?q?A=C3=B1adido=20CHANGELOG.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 CHANGELOG diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..3f87794 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,11 @@ +Hoy he subido multiples cambios para que las entidades de Paciente, Medico de Familia y Medico Especialista tengan un código, diferente del identificador de base de datos que se pueda utlizar para realizar el login correctamente. + +Ahora mismo, con la última version: +* Hay 2 secuencias en base de datos (las he añadido al script de base de datos) que generan identificadores númericos únicos. +* Una secuencia genera los identificadores para Pacientes, y otra secuencia para profesionales (tal como requieren los requisitos). +* Los medicos de familia y los medicos especialistas comparten el identificador único (secuencia) y por lo tanto sus identificadores no se solapan. +* Los identificadores númericos se completan con 4 caracteres que se contatenas al inicio, y que hacen único al identificador (PAT#XXXX para Pacientes y PRO#0000 para profesionales) +* El login tiene en cuenta estos nuevos códigos, y por lo tanto el login se puede realizar correctametne. + +* También he añadido varios métodos al EJB común para recuperar entidades, tanto por Id como por codigo. +* También he añadido junciones para convertir entidades JPA e entidades POJO de forma más o menos automática, y con minimo soporte para mapeo de propiedades de objetos relacionados. \ No newline at end of file From f63ba35621167f7006aa422af1ce45dc92a32c20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Thu, 12 Dec 2019 00:18:35 +0100 Subject: [PATCH 07/21] =?UTF-8?q?A=C3=B1adidos=20custom=20Validators=20de?= =?UTF-8?q?=20JSF=20para=20validar=20NIF=20y=20email.=20Configurada=20vali?= =?UTF-8?q?daci=C3=B3n=20en=20cliente=20de=20email.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../docroot/profile/RegisterUser.xhtml | 11 +++-- .../docroot/profile/UpdateProfile.xhtml | 13 +++--- .../src/ejb/common/CommonFacadeBean.java | 10 ++--- .../src/ejb/common/CommonFacadeLocal.java | 12 ++++++ .../src/ejb/profile/ProfileFacadeBean.java | 34 ++++----------- .../validators/EmailValidator.java | 43 +++++++++++++++++++ .../managedbean/validators/NifValidator.java | 39 +++++++++++++++++ 7 files changed, 122 insertions(+), 40 deletions(-) create mode 100644 1.sources/MyHealth/src/managedbean/validators/EmailValidator.java create mode 100644 1.sources/MyHealth/src/managedbean/validators/NifValidator.java diff --git a/1.sources/MyHealth/docroot/profile/RegisterUser.xhtml b/1.sources/MyHealth/docroot/profile/RegisterUser.xhtml index 9b60cd1..c46d556 100644 --- a/1.sources/MyHealth/docroot/profile/RegisterUser.xhtml +++ b/1.sources/MyHealth/docroot/profile/RegisterUser.xhtml @@ -82,10 +82,10 @@
- +
- +
@@ -112,10 +112,13 @@
- + + +
- +
diff --git a/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml b/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml index 95700b0..fbc1b26 100644 --- a/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml +++ b/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml @@ -41,7 +41,7 @@
- +
@@ -71,10 +71,13 @@
- + + +
- +
@@ -153,8 +156,8 @@
- + diff --git a/1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java b/1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java index 4524e03..578e3c3 100644 --- a/1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java +++ b/1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java @@ -159,7 +159,7 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal { return allFDTOs; } - private MedicalSpecialtyTO getPOJOforMedicalSpecialtyJPA(MedicalSpecialtyJPA ms) { + public MedicalSpecialtyTO getPOJOforMedicalSpecialtyJPA(MedicalSpecialtyJPA ms) { MedicalSpecialtyTO msTO = null; if (ms != null) { @@ -169,7 +169,7 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal { return msTO; } - private PrimaryHealthCareCenterTO getPOJOforPrimaryHealthCareCenterJPA(PrimaryHealthCareCenterJPA phc) { + public PrimaryHealthCareCenterTO getPOJOforPrimaryHealthCareCenterJPA(PrimaryHealthCareCenterJPA phc) { PrimaryHealthCareCenterTO phcTO = null; if (phc != null) { @@ -179,7 +179,7 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal { return phcTO; } - private SpecialistDoctorTO getPOJOforSpecialistDoctorJPA(SpecialistDoctorJPA sd, int nestedProps) { + public SpecialistDoctorTO getPOJOforSpecialistDoctorJPA(SpecialistDoctorJPA sd, int nestedProps) { SpecialistDoctorTO sdTO = null; if (sd != null) { @@ -194,7 +194,7 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal { return sdTO; } - private FamilyDoctorTO getPOJOforFamilyDoctorJPA(FamilyDoctorJPA fd, int nestedProps) { + public FamilyDoctorTO getPOJOforFamilyDoctorJPA(FamilyDoctorJPA fd, int nestedProps) { FamilyDoctorTO fdTO = null; if (fd != null) { @@ -209,7 +209,7 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal { return fdTO; } - private PatientTO getPOJOforPatientJPA(PatientJPA pat, int nestedProps) { + public PatientTO getPOJOforPatientJPA(PatientJPA pat, int nestedProps) { PatientTO paTO = null; if (pat != null) { diff --git a/1.sources/MyHealth/src/ejb/common/CommonFacadeLocal.java b/1.sources/MyHealth/src/ejb/common/CommonFacadeLocal.java index 5cc75bd..bd6a081 100644 --- a/1.sources/MyHealth/src/ejb/common/CommonFacadeLocal.java +++ b/1.sources/MyHealth/src/ejb/common/CommonFacadeLocal.java @@ -11,7 +11,9 @@ import TO.PatientTO; import TO.PrimaryHealthCareCenterTO; import TO.SpecialistDoctorTO; import jpa.FamilyDoctorJPA; +import jpa.MedicalSpecialtyJPA; import jpa.PatientJPA; +import jpa.PrimaryHealthCareCenterJPA; import jpa.SpecialistDoctorJPA; /** @@ -52,4 +54,14 @@ public interface CommonFacadeLocal { public SpecialistDoctorJPA findSpecialistDoctorByCode(String code); + public MedicalSpecialtyTO getPOJOforMedicalSpecialtyJPA(MedicalSpecialtyJPA ms); + + public SpecialistDoctorTO getPOJOforSpecialistDoctorJPA(SpecialistDoctorJPA sd, int nestedProps); + + public PrimaryHealthCareCenterTO getPOJOforPrimaryHealthCareCenterJPA(PrimaryHealthCareCenterJPA phc); + + public FamilyDoctorTO getPOJOforFamilyDoctorJPA(FamilyDoctorJPA fd, int nestedProps); + + public PatientTO getPOJOforPatientJPA(PatientJPA pat, int nestedProps); + } diff --git a/1.sources/MyHealth/src/ejb/profile/ProfileFacadeBean.java b/1.sources/MyHealth/src/ejb/profile/ProfileFacadeBean.java index 80ca931..5260402 100644 --- a/1.sources/MyHealth/src/ejb/profile/ProfileFacadeBean.java +++ b/1.sources/MyHealth/src/ejb/profile/ProfileFacadeBean.java @@ -57,12 +57,10 @@ public class ProfileFacadeBean implements ProfileFacadeRemote { "No se pueden actualizar los datos del médico de familia porque no se encuentra en la base de datos ningún registro con id: " + String.valueOf(newDoctor)); } - PatientTO paTO = null; pat.setFamilyDoctor(fd); entman.persist(pat); - // CommonFacadeRemote common = new CommonFacadeBean(); - return commonServices.findPatientById(pat.getId()); + return this.commonServices.getPOJOforPatientJPA(pat, 1); } public PatientTO registerPatient(int id, String nif, String name, String surname, String password, String email) { @@ -70,9 +68,8 @@ public class ProfileFacadeBean implements ProfileFacadeRemote { PatientJPA pat = new PatientJPA(this.getNextPersonalIdentificationCode(), nif, name, surname, HashUtils.hashMD5(password), email, null); entman.persist(pat); - paTO = new PatientTO(pat.getId(), this.getNextPersonalIdentificationCode(), pat.getNif(), pat.getName(), pat.getSurname(), pat.getPassword(), pat.getEmail(), null); - return paTO; + return this.commonServices.getPOJOforPatientJPA(pat, 1); } public SpecialistDoctorTO registerSpecialistDoctor(int id, String nif, String name, String surname, String password, String email, MedicalSpecialtyTO specialty) @@ -85,10 +82,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote { SpecialistDoctorJPA sd = new SpecialistDoctorJPA(this.getNextProfessionalNumber(), nif, name, surname, HashUtils.hashMD5(password), email, ms); entman.persist(sd); - SpecialistDoctorTO sdTO = null; - sdTO = new SpecialistDoctorTO(sd.getId(), this.getNextProfessionalNumber(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail(), specialty); - - return sdTO; + return this.commonServices.getPOJOforSpecialistDoctorJPA(sd, 1); } public FamilyDoctorTO registerFamilyDoctor(int id, String nif, String name, String surname, String password, String email, PrimaryHealthCareCenterTO cap) throws Exception { @@ -102,9 +96,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote { FamilyDoctorJPA fd = new FamilyDoctorJPA(this.getNextProfessionalNumber(), nif, name, surname, HashUtils.hashMD5(password), email, phcC); entman.persist(fd); - fdTO = new FamilyDoctorTO(fd.getId(), this.getNextProfessionalNumber(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), cap); - - return fdTO; + return commonServices.getPOJOforFamilyDoctorJPA(fd, 1); } public PatientTO updatePatientData(int id, String nif, String name, String surname, String password, String email) throws Exception { @@ -124,10 +116,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote { entman.persist(pat); - PatientTO patTO = null; - patTO = new PatientTO(pat.getId(), pat.getPersonalIdentificationCode(), pat.getNif(), pat.getName(), pat.getSurname(), pat.getPassword(), pat.getEmail(), null); - - return patTO; + return this.commonServices.getPOJOforPatientJPA(pat, 1); } public SpecialistDoctorTO updateSpecialistDoctorData(int id, String nif, String name, String surname, String password, String email, MedicalSpecialtyTO specialty) @@ -153,10 +142,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote { entman.persist(sd); - SpecialistDoctorTO sdTO = null; - sdTO = new SpecialistDoctorTO(sd.getId(), sd.getProfessionalNumber(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail(), specialty); - - return sdTO; + return this.commonServices.getPOJOforSpecialistDoctorJPA(sd, 1); } public FamilyDoctorTO updateFamilyDoctorData(int id, String nif, String name, String surname, String password, String email, PrimaryHealthCareCenterTO phcTO) throws Exception { @@ -181,10 +167,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote { entman.persist(fd); - FamilyDoctorTO fdTO = null; - fdTO = new FamilyDoctorTO(fd.getId(), fd.getProfessionalNumber(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), phcTO); - - return fdTO; + return this.commonServices.getPOJOforFamilyDoctorJPA(fd, 1); } public FamilyDoctorTO changePrimaryHealthCareCenter(int professionalId, PrimaryHealthCareCenterTO newCenter) throws Exception { @@ -202,8 +185,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote { fd.setPrimaryHealthCareCenter(phcC); entman.persist(fd); - fdTO = new FamilyDoctorTO(fd.getId(), fd.getProfessionalNumber(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail(), newCenter); - return fdTO; + return this.commonServices.getPOJOforFamilyDoctorJPA(fd, 1); } } diff --git a/1.sources/MyHealth/src/managedbean/validators/EmailValidator.java b/1.sources/MyHealth/src/managedbean/validators/EmailValidator.java new file mode 100644 index 0000000..f6d2fcc --- /dev/null +++ b/1.sources/MyHealth/src/managedbean/validators/EmailValidator.java @@ -0,0 +1,43 @@ +package managedbean.validators; + +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.faces.application.FacesMessage; +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.validator.FacesValidator; +import javax.faces.validator.Validator; +import javax.faces.validator.ValidatorException; + +import org.primefaces.validate.ClientValidator; + +@FacesValidator("emailValidator") +public class EmailValidator implements Validator, ClientValidator { + + private final static String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; + private final static Pattern EMAIL_COMPILED_PATTERN = Pattern.compile(EMAIL_PATTERN); + + public void validate(FacesContext context, UIComponent comp, Object value) throws ValidatorException { + String strValue = ""; + + if (value != null) + strValue = String.valueOf(value); + + if (strValue.equals("")) + throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Correo electrónico no válido", "La dirección " + value + " no es una dirección válida")); + + Matcher matcher = EMAIL_COMPILED_PATTERN.matcher((String) value); + if (!matcher.matches()) + throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Correo electrónico no válido", "La dirección " + value + " no es una dirección válida")); + } + + public Map getMetadata() { + return null; + } + + public String getValidatorId() { + return "emailValidator"; + } +} diff --git a/1.sources/MyHealth/src/managedbean/validators/NifValidator.java b/1.sources/MyHealth/src/managedbean/validators/NifValidator.java new file mode 100644 index 0000000..c663919 --- /dev/null +++ b/1.sources/MyHealth/src/managedbean/validators/NifValidator.java @@ -0,0 +1,39 @@ +package managedbean.validators; + +import java.util.Map; + +import javax.faces.application.FacesMessage; +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.validator.FacesValidator; +import javax.faces.validator.Validator; +import javax.faces.validator.ValidatorException; + +import org.primefaces.validate.ClientValidator; + +import managedbean.common.ValidationUtils; + +@FacesValidator("nifValidator") +public class NifValidator implements Validator, ClientValidator { + + public void validate(FacesContext context, UIComponent comp, Object value) throws ValidatorException { + String strValue = ""; + + if (value != null) + strValue = String.valueOf(value); + + if (strValue.equals("")) + throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "El NIF no es válido", "El NIF " + value + " no es válido")); + + if (ValidationUtils.isValid(strValue) == false) + throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "El NIF no es válido", "El NIF " + value + " no es válido")); + } + + public Map getMetadata() { + return null; + } + + public String getValidatorId() { + return "nifValidator"; + } +} From 49d07c659965f37fc839020f4c120640eaa342cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Thu, 12 Dec 2019 16:14:45 +0100 Subject: [PATCH 08/21] Establecido maxlength para los campos de datos personales. --- .../MyHealth/docroot/profile/RegisterUser.xhtml | 12 ++++++------ .../MyHealth/docroot/profile/UpdateProfile.xhtml | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/1.sources/MyHealth/docroot/profile/RegisterUser.xhtml b/1.sources/MyHealth/docroot/profile/RegisterUser.xhtml index c46d556..3eb6835 100644 --- a/1.sources/MyHealth/docroot/profile/RegisterUser.xhtml +++ b/1.sources/MyHealth/docroot/profile/RegisterUser.xhtml @@ -82,7 +82,7 @@
- +
@@ -92,7 +92,7 @@
- +
@@ -102,7 +102,7 @@
- +
@@ -112,7 +112,7 @@
- @@ -124,7 +124,7 @@
-
@@ -135,7 +135,7 @@
- +
diff --git a/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml b/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml index fbc1b26..69da325 100644 --- a/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml +++ b/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml @@ -41,7 +41,7 @@
- +
@@ -51,7 +51,7 @@
- +
@@ -61,7 +61,7 @@
- +
@@ -71,7 +71,7 @@
- @@ -83,7 +83,7 @@
- +
@@ -92,7 +92,7 @@
-
@@ -103,7 +103,7 @@
- +
From c2852718ce3ae5c95524799784c1e220eed77001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Thu, 12 Dec 2019 22:08:36 +0100 Subject: [PATCH 09/21] Clases para reflejar los enumerados TestType y QuestionStatus. --- 1.sources/MyHealth/src/common/Constants.java | 9 +++-- 1.sources/MyHealth/src/common/HashUtils.java | 6 +++- .../MyHealth/src/common/QuestionStatus.java | 24 +++++++++++++ 1.sources/MyHealth/src/common/TestType.java | 24 +++++++++++++ 1.sources/MyHealth/src/common/UserType.java | 36 ++++++++++--------- 1.sources/MyHealth/src/common/Utils.java | 11 +++--- 6 files changed, 86 insertions(+), 24 deletions(-) create mode 100644 1.sources/MyHealth/src/common/QuestionStatus.java create mode 100644 1.sources/MyHealth/src/common/TestType.java diff --git a/1.sources/MyHealth/src/common/Constants.java b/1.sources/MyHealth/src/common/Constants.java index cf8500d..d56325e 100644 --- a/1.sources/MyHealth/src/common/Constants.java +++ b/1.sources/MyHealth/src/common/Constants.java @@ -1,7 +1,12 @@ package common; +/** + * + * @author Marcos García Núñez (mgarcianun@uoc.edu) + * + */ public class Constants { public static final int MAX_ITEMS_AUTOCOMPLETE_SEARCH = 200; - public static final String PROFESSIONAL_NUMBER_PREFIX= "PRO#"; - public static final String PERSONAL_IDENTIFICATION_CODE_PREFIX= "PAT#"; + public static final String PROFESSIONAL_NUMBER_PREFIX = "PRO#"; + public static final String PERSONAL_IDENTIFICATION_CODE_PREFIX = "PAT#"; } diff --git a/1.sources/MyHealth/src/common/HashUtils.java b/1.sources/MyHealth/src/common/HashUtils.java index 5b7bd53..dc9d3e4 100644 --- a/1.sources/MyHealth/src/common/HashUtils.java +++ b/1.sources/MyHealth/src/common/HashUtils.java @@ -1,10 +1,14 @@ package common; import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; import javax.xml.bind.DatatypeConverter; +/** + * + * @author Marcos García Núñez (mgarcianun@uoc.edu) + * + */ public class HashUtils { public static String hashMD5(String stringValue) { diff --git a/1.sources/MyHealth/src/common/QuestionStatus.java b/1.sources/MyHealth/src/common/QuestionStatus.java new file mode 100644 index 0000000..b32bbf6 --- /dev/null +++ b/1.sources/MyHealth/src/common/QuestionStatus.java @@ -0,0 +1,24 @@ +package common; + +/** + * + * @author Marcos García Núñez (mgarcianun@uoc.edu) + * + */ +public enum QuestionStatus { + ANSWERED("Respondida"), PENDING("Pendiente"); + + private String questionStatusName; + + private QuestionStatus(String typeName) { + this.questionStatusName = typeName; + } + + public String getQuestionStatusName() { + return questionStatusName; + } + + public String getName() { + return this.name(); + } +} diff --git a/1.sources/MyHealth/src/common/TestType.java b/1.sources/MyHealth/src/common/TestType.java new file mode 100644 index 0000000..d413bdd --- /dev/null +++ b/1.sources/MyHealth/src/common/TestType.java @@ -0,0 +1,24 @@ +package common; + +/** + * + * @author Marcos García Núñez (mgarcianun@uoc.edu) + * + */ +public enum TestType { + MAGNETIC_RESONANCE_IMAGING("Imagen por Resonancia Magnética"), CT_SCAN("Tomografía Áxial Computerizada"), BLOOD_TEST("Análisis de sangre"); + + private String testTypeName; + + private TestType(String typeName) { + this.testTypeName = typeName; + } + + public String getTestTypeName() { + return testTypeName; + } + + public String getName() { + return this.name(); + } +} diff --git a/1.sources/MyHealth/src/common/UserType.java b/1.sources/MyHealth/src/common/UserType.java index 3a49b5a..00d0de2 100644 --- a/1.sources/MyHealth/src/common/UserType.java +++ b/1.sources/MyHealth/src/common/UserType.java @@ -1,22 +1,24 @@ package common; +/** + * + * @author Marcos García Núñez (mgarcianun@uoc.edu) + * + */ public enum UserType { - PATIENT("Paciente"), - FAMILY_DOCTOR("Médico de familia"), - SPECIALIST_DOCTOR("Médico especialista"), - ADMINISTRATOR("Administrador"); - - private String userTypename; - - private UserType (String userTypename){ - this.userTypename = userTypename; - } + PATIENT("Paciente"), FAMILY_DOCTOR("Médico de familia"), SPECIALIST_DOCTOR("Médico especialista"), ADMINISTRATOR("Administrador"); - public String getUserTypename() { - return userTypename; - } - - public String getName() { - return this.name(); - } + private String userTypename; + + private UserType(String userTypename) { + this.userTypename = userTypename; } + + public String getUserTypename() { + return userTypename; + } + + public String getName() { + return this.name(); + } +} diff --git a/1.sources/MyHealth/src/common/Utils.java b/1.sources/MyHealth/src/common/Utils.java index 7bb7db7..642d910 100644 --- a/1.sources/MyHealth/src/common/Utils.java +++ b/1.sources/MyHealth/src/common/Utils.java @@ -2,10 +2,13 @@ package common; import java.text.Normalizer; +/** + * + * @author Marcos García Núñez (mgarcianun@uoc.edu) + * + */ public class Utils { - public static String stripAccents(String input){ - return input == null ? null : - Normalizer.normalize(input, Normalizer.Form.NFD) - .replaceAll("\\p{InCombiningDiacriticalMarks}+", ""); + public static String stripAccents(String input) { + return input == null ? null : Normalizer.normalize(input, Normalizer.Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}+", ""); } } From 551e79e7e83821684df6dd50746a5ca44f86729c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Fri, 13 Dec 2019 02:01:31 +0100 Subject: [PATCH 10/21] =?UTF-8?q?Conversi=C3=B3n=20nativa=20de=20JSF=202.3?= =?UTF-8?q?=20para=20enumerados=20en=20selecci=C3=B3n=20de=20tipo=20de=20u?= =?UTF-8?q?suario.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../docroot/profile/RegisterUser.xhtml | 125 +++++++++--------- .../docroot/profile/UpdateProfile.xhtml | 6 +- .../profile/RegisterUserMBean.java | 43 +++--- .../profile/UpdateProfileMBean.java | 42 ++---- 4 files changed, 97 insertions(+), 119 deletions(-) diff --git a/1.sources/MyHealth/docroot/profile/RegisterUser.xhtml b/1.sources/MyHealth/docroot/profile/RegisterUser.xhtml index 3eb6835..2fbd2c4 100644 --- a/1.sources/MyHealth/docroot/profile/RegisterUser.xhtml +++ b/1.sources/MyHealth/docroot/profile/RegisterUser.xhtml @@ -45,20 +45,22 @@ - function handleRequest(xhr, status, args) { - if(args.specs) { - $('#panCentros').slideUp(); - $('#panEspecialidades').slideDown(); - } - else if (args.caps) { - $('#panEspecialidades').slideUp(); - $('#panCentros').slideDown(); - } else { - $('#panCentros').slideUp(); - $('#panEspecialidades').slideUp(); - } - } - + function handleRequest(xhr, status, args) { + /* + if(args.specs) { + $('#panCentros').slideUp(); + $('#panEspecialidades').slideDown(); + } + else if (args.caps) { + $('#panEspecialidades').slideUp(); + $('#panCentros').slideDown(); + } else if (args.pats) { + $('#panCentros').slideUp(); + $('#panEspecialidades').slideUp(); + } + */ + } +
@@ -67,12 +69,11 @@
- - - + +
-
+

@@ -102,7 +103,7 @@
- +
@@ -112,8 +113,8 @@
- +
@@ -124,7 +125,7 @@
-
@@ -141,46 +142,48 @@
- -
- -
-
- - - - - - - - - -
-
- -
-
+ + +
+ +
+
+ + + + + + + + + +
+
+ +
+
- -
- -
-
- - - - - - - - - -
-
- -
+ +
+ +
+
+ + + + + + + + + +
+
+ +
+
diff --git a/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml b/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml index 69da325..cc543d1 100644 --- a/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml +++ b/1.sources/MyHealth/docroot/profile/UpdateProfile.xhtml @@ -109,7 +109,7 @@
- +
@@ -130,7 +130,7 @@
- +
@@ -151,7 +151,7 @@
- +
diff --git a/1.sources/MyHealth/src/managedbean/profile/RegisterUserMBean.java b/1.sources/MyHealth/src/managedbean/profile/RegisterUserMBean.java index f2969b9..d53a778 100644 --- a/1.sources/MyHealth/src/managedbean/profile/RegisterUserMBean.java +++ b/1.sources/MyHealth/src/managedbean/profile/RegisterUserMBean.java @@ -2,7 +2,6 @@ package managedbean.profile; import java.io.Serializable; import java.util.ArrayList; -import java.util.Collection; import java.util.List; import javax.annotation.PostConstruct; @@ -49,8 +48,8 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable { private String lastUIQueryMS; // private HashMap userTypes; - private List userTypes; - private String userType; + private List availableUserTypes; + private UserType userType; private PrimaryHealthCareCenterTO primaryHealthCareCenter; private MedicalSpecialtyTO medicalSpecialty; private List medicalSpecialitiesList; @@ -62,26 +61,26 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable { @PostConstruct public void init() { - this.userTypes = new ArrayList(); - this.userTypes.add(UserType.PATIENT); - this.userTypes.add(UserType.FAMILY_DOCTOR); - this.userTypes.add(UserType.SPECIALIST_DOCTOR); + this.availableUserTypes = new ArrayList(); + this.availableUserTypes.add(UserType.PATIENT); + this.availableUserTypes.add(UserType.FAMILY_DOCTOR); + this.availableUserTypes.add(UserType.SPECIALIST_DOCTOR); this.registered = false; this.lastUIQueryPH = ""; this.lastUIQueryMS = ""; - this.userType = UserType.PATIENT.name(); + this.userType = UserType.PATIENT; this.medicalSpecialitiesList = this.getRemoteManagerCommon().listMedicalSpecialitiesPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH); this.primaryHealthCareCentersList = this.getRemoteManagerCommon().listCAPsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH); } - public List getUserTypes() { - return userTypes; + public List getAvailableUserTypes() { + return availableUserTypes; } public void onUserTypeChange() { - switch (UserType.valueOf(this.userType)) { + switch (this.userType) { case SPECIALIST_DOCTOR: try { PrimeFaces.current().ajax().addCallbackParam("specs", true); @@ -130,15 +129,15 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable { } public boolean isPatient() { - return (UserType.valueOf(this.userType) == UserType.PATIENT); + return (this.userType == UserType.PATIENT); } public boolean isFamilyDoctor() { - return (UserType.valueOf(this.userType) == UserType.FAMILY_DOCTOR); + return (this.userType == UserType.FAMILY_DOCTOR); } public boolean isSpecialistDoctor() { - return (UserType.valueOf(this.userType) == UserType.SPECIALIST_DOCTOR); + return (this.userType == UserType.SPECIALIST_DOCTOR); } public boolean isDoctor() { @@ -203,7 +202,7 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable { if (error == 0) { try { - switch (UserType.valueOf(this.userType)) { + switch (this.userType) { case PATIENT: PatientTO pat = this.getRemoteManagerProfile().registerPatient(id, nif, name, surname, password, email); this.cipCode = pat.getPersonalIdentificationCode(); @@ -232,28 +231,28 @@ public class RegisterUserMBean extends ManagedBeanBase implements Serializable { } } - public String getUserType() { + public UserType getUserType() { return userType; } - public void setUserType(String userType) { - this.userType = userType; + public void setUserType(UserType value) { + this.userType = value; } public MedicalSpecialtyTO getMedicalSpecialty() { return medicalSpecialty; } - public void setMedicalSpecialty(MedicalSpecialtyTO medicalSpecialty) { - this.medicalSpecialty = medicalSpecialty; + public void setMedicalSpecialty(MedicalSpecialtyTO value) { + this.medicalSpecialty = value; } public PrimaryHealthCareCenterTO getPrimaryHealthCareCenter() { return primaryHealthCareCenter; } - public void setPrimaryHealthCareCenter(PrimaryHealthCareCenterTO primaryHealthCareCenter) { - this.primaryHealthCareCenter = primaryHealthCareCenter; + public void setPrimaryHealthCareCenter(PrimaryHealthCareCenterTO value) { + this.primaryHealthCareCenter = value; } public boolean isRegistered() { diff --git a/1.sources/MyHealth/src/managedbean/profile/UpdateProfileMBean.java b/1.sources/MyHealth/src/managedbean/profile/UpdateProfileMBean.java index 81b492f..9199d59 100644 --- a/1.sources/MyHealth/src/managedbean/profile/UpdateProfileMBean.java +++ b/1.sources/MyHealth/src/managedbean/profile/UpdateProfileMBean.java @@ -2,7 +2,6 @@ package managedbean.profile; import java.io.Serializable; import java.util.ArrayList; -import java.util.Collection; import java.util.List; import javax.annotation.PostConstruct; @@ -53,7 +52,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable private String lastUIQueryFD; private List userTypes; - private String userType; + private UserType userType; private PrimaryHealthCareCenterTO primaryHealthCareCenter; private MedicalSpecialtyTO medicalSpecialty; private List medicalSpecialitiesList; @@ -83,7 +82,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Sesión no válida", "Su sesión actual no es válida, por favor cierre su sesión y vuelva a logearse en el sistema."); else { - this.userType = usr.getUserType().getName(); + this.userType = usr.getUserType(); this.id = Integer.valueOf(usr.getId()); switch (usr.getUserType()) { @@ -147,29 +146,6 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable return userTypes; } - public void onUserTypeChange() { - switch (UserType.valueOf(this.userType)) { - case SPECIALIST_DOCTOR: - try { - PrimeFaces.current().ajax().addCallbackParam("specs", true); - } catch (Exception e) { - this.manageException(e); - } - break; - case FAMILY_DOCTOR: - try { - PrimeFaces.current().ajax().addCallbackParam("caps", true); - } catch (Exception e) { - this.manageException(e); - } - break; - case ADMINISTRATOR: - case PATIENT: - PrimeFaces.current().ajax().addCallbackParam("pats", true); - break; - } - } - public List getMedicalSpecialtiesList() { return medicalSpecialitiesList; } @@ -210,15 +186,15 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable } public boolean isUserTypePatient() { - return (UserType.valueOf(this.userType) == UserType.PATIENT); + return (this.userType == UserType.PATIENT); } public boolean isUserTypeFamilyDoctor() { - return (UserType.valueOf(this.userType) == UserType.FAMILY_DOCTOR); + return (this.userType == UserType.FAMILY_DOCTOR); } public boolean isUserTypeSpecialistDoctor() { - return (UserType.valueOf(this.userType) == UserType.SPECIALIST_DOCTOR); + return (this.userType == UserType.SPECIALIST_DOCTOR); } public boolean isUserTypeDoctor() { @@ -300,7 +276,7 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable if (error == 0) { try { - switch (UserType.valueOf(this.userType)) { + switch (this.userType) { case PATIENT: PatientTO pat = this.getRemoteManagerProfile().updatePatientData(id, nif, name, surname, password, email); this.setPatientData(pat); @@ -333,12 +309,12 @@ public class UpdateProfileMBean extends ManagedBeanBase implements Serializable } } - public String getUserType() { + public UserType getUserType() { return userType; } - public void setUserType(String userType) { - this.userType = userType; + public void setUserType(UserType value) { + this.userType = value; } public MedicalSpecialtyTO getMedicalSpecialty() { From 3a3379a06359c00e7ff424cad336d45e893f8f43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Fri, 13 Dec 2019 02:01:57 +0100 Subject: [PATCH 11/21] =?UTF-8?q?Normalizci=C3=B3n=20de=20terminos=20de=20?= =?UTF-8?q?b=C3=BAsqueda.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.sources/MyHealth/src/common/Utils.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/1.sources/MyHealth/src/common/Utils.java b/1.sources/MyHealth/src/common/Utils.java index 642d910..0926f7e 100644 --- a/1.sources/MyHealth/src/common/Utils.java +++ b/1.sources/MyHealth/src/common/Utils.java @@ -11,4 +11,9 @@ public class Utils { public static String stripAccents(String input) { return input == null ? null : Normalizer.normalize(input, Normalizer.Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}+", ""); } + + public static String normalizeTerm(String input) { + //return stripAccents(input).toLowerCase(); + return input.toLowerCase(); + } } From c785f70728dcf79a776ad009030bd324dc99c3f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Fri, 13 Dec 2019 02:02:16 +0100 Subject: [PATCH 12/21] Clase para paddin cero en columnas anidadas de CSS Grid. --- 1.sources/MyHealth/docroot/resources/css/estilos.css | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/1.sources/MyHealth/docroot/resources/css/estilos.css b/1.sources/MyHealth/docroot/resources/css/estilos.css index 59fb335..f88cc78 100644 --- a/1.sources/MyHealth/docroot/resources/css/estilos.css +++ b/1.sources/MyHealth/docroot/resources/css/estilos.css @@ -1,7 +1,12 @@ -BODY{ +BODY { font-family: Verdana, Arial, Helvetica, sans-serif; } .hide { - display: none; + display: none; +} + +.nopadding { + padding: 0 !important; + margin: 0 !important; } \ No newline at end of file From 1715f2356a632fdd2df038279ff77d3ca02a2cb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Fri, 13 Dec 2019 02:02:48 +0100 Subject: [PATCH 13/21] =?UTF-8?q?Busqueda=20de=20entidades=20por=20nombre?= =?UTF-8?q?=20a=20lowecase=20sin=20normalizaci=C3=B3n=20de=20acentos.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java b/1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java index 578e3c3..e150321 100644 --- a/1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java +++ b/1.sources/MyHealth/src/ejb/common/CommonFacadeBean.java @@ -53,7 +53,7 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal { if (searchTerm == null) searchTerm = ""; else - searchTerm = Utils.stripAccents(searchTerm).toLowerCase(); + searchTerm = Utils.normalizeTerm(searchTerm); if (searchTerm.length() > 0) { strFilter = "WHERE lower(ms.name) LIKE :searchTerm OR lower(ms.description) LIKE :searchTerm"; @@ -93,7 +93,7 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal { if (searchTerm == null) searchTerm = ""; else - searchTerm = Utils.stripAccents(searchTerm).toLowerCase(); + searchTerm = Utils.normalizeTerm(searchTerm); if (searchTerm.length() > 0) { strFilter = "WHERE lower(phc.name) LIKE :searchTerm OR lower(phc.location) LIKE :searchTerm"; @@ -133,7 +133,7 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal { if (searchTerm == null) searchTerm = ""; else - searchTerm = Utils.stripAccents(searchTerm).toLowerCase(); + searchTerm = Utils.normalizeTerm(searchTerm); if (searchTerm.length() > 0) { strFilter = "WHERE lower(fd.name) LIKE :searchTerm OR lower(fd.surname) LIKE :searchTerm"; From d21e86e5d132ff6ae15ecfb30088bf80d4b44cf6 Mon Sep 17 00:00:00 2001 From: Gabriel Paradiso Date: Fri, 13 Dec 2019 16:34:47 +0100 Subject: [PATCH 14/21] cambio character varying por VARCHAR para mantener el standard --- 2.database/01.CreateTables.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/2.database/01.CreateTables.sql b/2.database/01.CreateTables.sql index 145ec54..8e667e1 100644 --- a/2.database/01.CreateTables.sql +++ b/2.database/01.CreateTables.sql @@ -147,8 +147,8 @@ ALTER TABLE myhealth.location CREATE TABLE myhealth.primaryhealthcarecenter ( id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), - name character varying(150) COLLATE pg_catalog."default" NOT NULL, - location character varying(512) COLLATE pg_catalog."default", + name VARCHAR(150) COLLATE pg_catalog."default" NOT NULL, + location VARCHAR(512) COLLATE pg_catalog."default", CONSTRAINT primaryhealthcarecenter_pkey PRIMARY KEY (id) ) TABLESPACE pg_default; From 9d9acb11d957001ad6be3c71b983b03188c98043 Mon Sep 17 00:00:00 2001 From: Gabriel Paradiso Date: Fri, 13 Dec 2019 16:35:11 +0100 Subject: [PATCH 15/21] remover tabla locations ya que acordamos utilizar un unico string para la direccion --- 2.database/01.CreateTables.sql | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/2.database/01.CreateTables.sql b/2.database/01.CreateTables.sql index 8e667e1..41ad5bb 100644 --- a/2.database/01.CreateTables.sql +++ b/2.database/01.CreateTables.sql @@ -125,21 +125,6 @@ TABLESPACE pg_default; ALTER TABLE myhealth.patient OWNER to "USER"; --- Table: myhealth.location - --- DROP TABLE myhealth.location; - -CREATE TABLE myhealth.location -( - id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), - name VARCHAR(100) COLLATE pg_catalog."default" NOT NULL, - CONSTRAINT primarylocation_pkey PRIMARY KEY (id) -) -TABLESPACE pg_default; - -ALTER TABLE myhealth.location - OWNER to "USER"; - -- Table: myhealth.primaryhealthcarecenter -- DROP TABLE myhealth.primaryhealthcarecenter; From 6f7790d907491e85c7d476d01cad6e1d9057e52b Mon Sep 17 00:00:00 2001 From: Gabriel Paradiso Date: Fri, 13 Dec 2019 16:56:06 +0100 Subject: [PATCH 16/21] agregar indices unicos para family doctor y specialist --- 2.database/01.CreateTables.sql | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/2.database/01.CreateTables.sql b/2.database/01.CreateTables.sql index 41ad5bb..63863ef 100644 --- a/2.database/01.CreateTables.sql +++ b/2.database/01.CreateTables.sql @@ -64,6 +64,9 @@ CREATE TABLE myhealth.familydoctor ) TABLESPACE pg_default; +CREATE UNIQUE INDEX family_doctor_professionaln_index + ON myhealth.familydoctor (professionalnumber); + ALTER TABLE myhealth.familydoctor OWNER to "USER"; @@ -193,6 +196,9 @@ CREATE TABLE myhealth.specialistdoctor ) TABLESPACE pg_default; +CREATE UNIQUE INDEX specialistdoctor_professionaln_index + ON myhealth.specialistdoctor (professionalnumber); + ALTER TABLE myhealth.specialistdoctor OWNER to "USER"; From c33bbf0de6d86d127aa574f341580ea4102ac114 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Fri, 13 Dec 2019 18:26:55 +0100 Subject: [PATCH 17/21] =?UTF-8?q?Script=20co=20comprobaci=C3=B3n=20de=20ex?= =?UTF-8?q?istencia=20de=20objetos,=20para=20poder=20ejecutar=20despliegue?= =?UTF-8?q?=20autom=C3=A1tico=20en=20base=20de=20datos.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 2.database/01.CreateTables.sql | 118 ++++++++++++++++++++++----------- 1 file changed, 81 insertions(+), 37 deletions(-) diff --git a/2.database/01.CreateTables.sql b/2.database/01.CreateTables.sql index 145ec54..c28d5be 100644 --- a/2.database/01.CreateTables.sql +++ b/2.database/01.CreateTables.sql @@ -1,40 +1,88 @@ -/* -DROP TABLE myhealth.Administrator; -DROP TABLE myhealth.FamilyDoctor; -DROP TABLE myhealth.MedicalSpecialty; -DROP TABLE myhealth.MedicalTest; -DROP TABLE myhealth.Patient; -DROP TABLE myhealth.PrimaryHealthCareCenter; -DROP TABLE myhealth.Question; -DROP TABLE myhealth.Response; -DROP TABLE myhealth.SpecialistDoctor; -DROP TABLE myhealth.Visit; +DO +$$ +begin -DROP SEQUENCE myhealth.ProfesionalNumber; -DROP SEQUENCE myhealth.CodigoIdentificacionPaciente +IF NOT EXISTS(SELECT schema_name FROM information_schema.schemata WHERE schema_name = 'myhealth') THEN + CREATE SCHEMA myhealth; +END IF; + +IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname='usrmyhealth') THEN + create user usrmyhealth with encrypted password 'myhealth.123'; +END IF; + +IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname='USER') THEN + create user "USER" with encrypted password 'PASSWORD'; +END IF; + +GRANT ALL ON SCHEMA myhealth TO "USER"; +GRANT ALL ON SCHEMA myhealth TO usrmyhealth; + +if exists (SELECT 1 FROM pg_tables WHERE schemaname='myhealth' and tablename='administrator') THEN + drop table myhealth.administrator; +end if; +if exists (SELECT 1 FROM pg_tables WHERE schemaname='myhealth' and tablename='familydoctor') THEN + drop table myhealth.familydoctor; +end if; +if exists (SELECT 1 FROM pg_tables WHERE schemaname='myhealth' and tablename='medicalspecialty') THEN + drop table myhealth.medicalspecialty; +end if; +if exists (SELECT 1 FROM pg_tables WHERE schemaname='myhealth' and tablename='medicaltest') THEN + drop table myhealth.medicaltest; +end if; +if exists (SELECT 1 FROM pg_tables WHERE schemaname='myhealth' and tablename='patient') THEN + drop table myhealth.patient; +end if; +if exists (SELECT 1 FROM pg_tables WHERE schemaname='myhealth' and tablename='primaryhealthcarecenter') THEN + drop table myhealth.primaryhealthcarecenter; +end if; +if exists (SELECT 1 FROM pg_tables WHERE schemaname='myhealth' and tablename='question') THEN + drop table myhealth.question; +end if; +if exists (SELECT 1 FROM pg_tables WHERE schemaname='myhealth' and tablename='response') THEN + drop table myhealth.response; +end if; +if exists (SELECT 1 FROM pg_tables WHERE schemaname='myhealth' and tablename='specialistdoctor') THEN + drop table myhealth.specialistdoctor; +end if; +if exists (SELECT 1 FROM pg_tables WHERE schemaname='myhealth' and tablename='visit') THEN + drop table myhealth.visit; +end if; + +/* +drop table myhealth.administrator; +drop table myhealth.familydoctor; +drop table myhealth.medicalspecialty; +drop table myhealth.medicaltest; +drop table myhealth.patient; +drop table myhealth.primaryhealthcarecenter; +drop table myhealth.question; +drop table myhealth.response; +drop table myhealth.specialistdoctor; +drop table myhealth.visit; */ +if exists (SELECT 1 FROM pg_sequences WHERE schemaname='myhealth' and sequencename='profesionalnumber') THEN + drop sequence myhealth.profesionalnumber; +end if; + +if exists (SELECT 1 FROM pg_sequences WHERE schemaname='myhealth' and sequencename='codigoidentificacionpaciente') THEN + drop sequence myhealth.codigoidentificacionpaciente; +end if; + CREATE SEQUENCE myhealth.ProfesionalNumber INCREMENT 1 START 1000 MINVALUE 1000 CACHE 1; -ALTER SEQUENCE myhealth.ProfesionalNumber OWNER TO "USER"; - CREATE SEQUENCE myhealth.CodigoIdentificacionPaciente INCREMENT 1 START 1000 MINVALUE 1000 CACHE 1; -ALTER SEQUENCE myhealth.CodigoIdentificacionPaciente OWNER TO "USER"; - - -- Table: myhealth.administrator - -- DROP TABLE myhealth.administrator; - CREATE TABLE myhealth.administrator ( email VARCHAR(120) COLLATE pg_catalog."default" NOT NULL, @@ -64,6 +112,9 @@ CREATE TABLE myhealth.familydoctor ) TABLESPACE pg_default; +CREATE UNIQUE INDEX family_doctor_professionaln_index + ON myhealth.familydoctor (professionalnumber); + ALTER TABLE myhealth.familydoctor OWNER to "USER"; @@ -122,24 +173,12 @@ CREATE TABLE myhealth.patient ) TABLESPACE pg_default; +CREATE UNIQUE INDEX patient_pic_index + ON myhealth.patient (personalIdentificationCode); + ALTER TABLE myhealth.patient OWNER to "USER"; --- Table: myhealth.location - --- DROP TABLE myhealth.location; - -CREATE TABLE myhealth.location -( - id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), - name VARCHAR(100) COLLATE pg_catalog."default" NOT NULL, - CONSTRAINT primarylocation_pkey PRIMARY KEY (id) -) -TABLESPACE pg_default; - -ALTER TABLE myhealth.location - OWNER to "USER"; - -- Table: myhealth.primaryhealthcarecenter -- DROP TABLE myhealth.primaryhealthcarecenter; @@ -147,8 +186,8 @@ ALTER TABLE myhealth.location CREATE TABLE myhealth.primaryhealthcarecenter ( id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ), - name character varying(150) COLLATE pg_catalog."default" NOT NULL, - location character varying(512) COLLATE pg_catalog."default", + name VARCHAR(150) COLLATE pg_catalog."default" NOT NULL, + location VARCHAR(512) COLLATE pg_catalog."default", CONSTRAINT primaryhealthcarecenter_pkey PRIMARY KEY (id) ) TABLESPACE pg_default; @@ -208,6 +247,9 @@ CREATE TABLE myhealth.specialistdoctor ) TABLESPACE pg_default; +CREATE UNIQUE INDEX specialistdoctor_professionaln_index + ON myhealth.specialistdoctor (professionalnumber); + ALTER TABLE myhealth.specialistdoctor OWNER to "USER"; @@ -231,3 +273,5 @@ TABLESPACE pg_default; ALTER TABLE myhealth.visit OWNER to "USER"; +END; +$$ From f31803f4f4fed18b52d2d990890fbda281253107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Fri, 13 Dec 2019 19:18:24 +0100 Subject: [PATCH 18/21] =?UTF-8?q?Cambio=20Nombre=20par=C3=A1metro.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.sources/MyHealth/src/TO/LoggedUserTO.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/1.sources/MyHealth/src/TO/LoggedUserTO.java b/1.sources/MyHealth/src/TO/LoggedUserTO.java index 62a3907..0ea7a58 100644 --- a/1.sources/MyHealth/src/TO/LoggedUserTO.java +++ b/1.sources/MyHealth/src/TO/LoggedUserTO.java @@ -60,8 +60,8 @@ public class LoggedUserTO implements Serializable { return userType; } - public void setUserType(UserType userType) { - this.userType = userType; + public void setUserType(UserType value) { + this.userType = value; } } From 8140eb19aad145c80a9187c5ede0a36cbba8d4e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Fri, 13 Dec 2019 19:18:53 +0100 Subject: [PATCH 19/21] =?UTF-8?q?Corregido=20error=20que=20impedia=20el=20?= =?UTF-8?q?correcto=20funcionamiento=20de=20login.=20No=20se=20inclu=C3=AD?= =?UTF-8?q?an=20en=20el=20jar=20las=20clases=20comunes=20del=20paquete=20c?= =?UTF-8?q?ommon.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.sources/MyHealth/build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1.sources/MyHealth/build.xml b/1.sources/MyHealth/build.xml index 1def254..e8bbecb 100644 --- a/1.sources/MyHealth/build.xml +++ b/1.sources/MyHealth/build.xml @@ -48,7 +48,7 @@ - + From b64a8de9646b500ad9e79265804cdab55ad6f7d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Fri, 13 Dec 2019 20:08:20 +0100 Subject: [PATCH 20/21] =?UTF-8?q?Correcci=C3=B3n=20de=20error=20al=20gener?= =?UTF-8?q?ar=20war.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.sources/MyHealth/build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1.sources/MyHealth/build.xml b/1.sources/MyHealth/build.xml index e8bbecb..292e667 100644 --- a/1.sources/MyHealth/build.xml +++ b/1.sources/MyHealth/build.xml @@ -79,7 +79,7 @@ - + From 2b1ab687aede87ca4de3e71a428a63f5853b5280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Fri, 13 Dec 2019 20:21:17 +0100 Subject: [PATCH 21/21] =?UTF-8?q?Cambio=20en=20el=20script=20de=20ant:=20E?= =?UTF-8?q?liminaci=C3=B3n=20de=20clases=20que=20van=20en=20el=20JAR=20del?= =?UTF-8?q?=20ejb.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.sources/MyHealth/build.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/1.sources/MyHealth/build.xml b/1.sources/MyHealth/build.xml index 292e667..6548729 100644 --- a/1.sources/MyHealth/build.xml +++ b/1.sources/MyHealth/build.xml @@ -70,7 +70,8 @@ - + + @@ -79,7 +80,7 @@ - +