Cambiado tipo de datos de Date a LocalDate para pruebas médicas.
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
package TO;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@@ -22,7 +19,7 @@ public class MedicalTestTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private int id;
|
||||
private Date date;
|
||||
private LocalDate date;
|
||||
private LocalTime time;
|
||||
private String observations;
|
||||
private String highresimage;
|
||||
@@ -33,13 +30,13 @@ public class MedicalTestTO implements Serializable {
|
||||
|
||||
public MedicalTestTO() {
|
||||
super();
|
||||
this.date = new Date();
|
||||
this.date = LocalDate.now();
|
||||
this.time = LocalTime.now();
|
||||
this.patient = new PatientTO();
|
||||
this.specialistDoctor = new SpecialistDoctorTO();
|
||||
}
|
||||
|
||||
public MedicalTestTO(int id, Date date, LocalTime time, String observations, String highresimage, MedicalTestType type,
|
||||
public MedicalTestTO(int id, LocalDate date, LocalTime time, String observations, String highresimage, MedicalTestType type,
|
||||
PatientTO patiend, SpecialistDoctorTO specialistDoctor) {
|
||||
this.setId(id);
|
||||
this.setDate(date);
|
||||
@@ -59,11 +56,11 @@ public class MedicalTestTO implements Serializable {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
public LocalDate getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
public void setDate(LocalDate date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
@@ -119,11 +116,4 @@ public class MedicalTestTO implements Serializable {
|
||||
public String toString() {
|
||||
return Integer.toString(this.getId());
|
||||
}
|
||||
|
||||
public String getOnlyDate() {
|
||||
DateFormat df = DateFormat.getDateInstance(DateFormat.DATE_FIELD, new Locale("es", "ES"));
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
||||
return sdf.format(this.getDate());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package TO;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
|
||||
@@ -619,19 +619,19 @@ public class CommonFacadeBean implements CommonFacadeRemote, CommonFacadeLocal {
|
||||
return qsTO;
|
||||
}
|
||||
|
||||
public MedicalTestTO getPOJOforMedicalTestJPA(MedicalTestJPA vi, int nestedProps) {
|
||||
public MedicalTestTO getPOJOforMedicalTestJPA(MedicalTestJPA mt, int nestedProps) {
|
||||
MedicalTestTO qsTO = null;
|
||||
|
||||
if (vi != null) {
|
||||
if (mt != null) {
|
||||
SpecialistDoctorJPA fd = null;
|
||||
PatientJPA pat = null;
|
||||
if (nestedProps > 0) {
|
||||
fd = vi.getSpecialistDoctor();
|
||||
pat = vi.getPatient();
|
||||
fd = mt.getSpecialistDoctor();
|
||||
pat = mt.getPatient();
|
||||
}
|
||||
|
||||
nestedProps--;
|
||||
qsTO = new MedicalTestTO(vi.getId(), vi.getDate(), vi.getTime(), vi.getObservations(), vi.getHighresimage(), vi.getType(),
|
||||
qsTO = new MedicalTestTO(mt.getId(), mt.getDate(), mt.getTime(), mt.getObservations(), mt.getHighresimage(), mt.getType(),
|
||||
this.getPOJOforPatientJPA(pat, nestedProps), this.getPOJOforSpecialistDoctorJPA(fd, nestedProps));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package ejb.medicalTest;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.EJB;
|
||||
@@ -158,7 +158,7 @@ public class MedicalTestFacadeBean implements MedicalTestFacadeRemote {
|
||||
* @param testType Pudiera llegar a ser: Análisis de sangre, resonancias magnéticas y TAC
|
||||
* @param observations
|
||||
*/
|
||||
public MedicalTestTO addMedicalTest(int patientID, int doctorSpecialistID, Date date, LocalTime time, MedicalTestType testType, String observations) throws Exception {
|
||||
public MedicalTestTO addMedicalTest(int patientID, int doctorSpecialistID, LocalDate date, LocalTime time, MedicalTestType testType, String observations) throws Exception {
|
||||
SpecialistDoctorJPA specDoctor = entman.find(SpecialistDoctorJPA.class, doctorSpecialistID);
|
||||
PatientJPA pat = entman.find(PatientJPA.class, patientID);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package ejb.medicalTest;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Remote;
|
||||
@@ -88,7 +88,7 @@ public interface MedicalTestFacadeRemote {
|
||||
* @param testType Pudiera llegar a ser: Análisis de sangre, resonancias magnéticas y TAC
|
||||
* @param observations
|
||||
*/
|
||||
public MedicalTestTO addMedicalTest(int patientID, int doctorSpecialistID, Date date, LocalTime time, MedicalTestType testType, String observations) throws Exception;
|
||||
public MedicalTestTO addMedicalTest(int patientID, int doctorSpecialistID, LocalDate date, LocalTime time, MedicalTestType testType, String observations) throws Exception;
|
||||
|
||||
/**
|
||||
* Recuperar una prueba médica por ID
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package jpa;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -36,7 +36,7 @@ public class MedicalTestJPA implements Serializable {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private int id;
|
||||
private Date date;
|
||||
private LocalDate date;
|
||||
private LocalTime time;
|
||||
private String observations;
|
||||
private String highresimage;
|
||||
@@ -57,7 +57,7 @@ public class MedicalTestJPA implements Serializable {
|
||||
super();
|
||||
}
|
||||
|
||||
public MedicalTestJPA(Date date, LocalTime time, String observations, String highresimage, MedicalTestType type, PatientJPA patient, SpecialistDoctorJPA specialistDoctor) {
|
||||
public MedicalTestJPA(LocalDate date, LocalTime time, String observations, String highresimage, MedicalTestType type, PatientJPA patient, SpecialistDoctorJPA specialistDoctor) {
|
||||
this.date = date;
|
||||
this.time = time;
|
||||
this.observations = observations;
|
||||
@@ -75,11 +75,11 @@ public class MedicalTestJPA implements Serializable {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
public LocalDate getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
public void setDate(LocalDate date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,6 @@ package managedbean.visit;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.faces.application.FacesMessage;
|
||||
@@ -54,7 +52,6 @@ public class AddVisitMBean extends ManagedBeanBase implements Serializable {
|
||||
public void saveData() {
|
||||
// Comprobamos que la fecha fijada para la visita no sea anterior a la actual
|
||||
int error = 0;
|
||||
LocalTime midnight = LocalTime.MIDNIGHT;
|
||||
LocalDate today = LocalDate.now();
|
||||
|
||||
if (this.date.isBefore(today)) {
|
||||
|
||||
@@ -3,7 +3,6 @@ package managedbean.visit;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package managedbean.visit;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
@@ -37,7 +36,6 @@ public class UpdateVisitMBean extends ManagedBeanBase implements Serializable {
|
||||
public UpdateVisitMBean() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
@@ -95,7 +93,6 @@ public class UpdateVisitMBean extends ManagedBeanBase implements Serializable {
|
||||
// Administrador y paciente pueden actualizar la fecha y hora de la visita (excepto el resultado)
|
||||
// Comprobamos que la fecha fijada para la visita no sea anterior a la actual
|
||||
int error = 0;
|
||||
LocalTime midnight = LocalTime.MIDNIGHT;
|
||||
LocalDate today = LocalDate.now();
|
||||
|
||||
if (this.date.isBefore(today)) {
|
||||
|
||||
@@ -3,7 +3,6 @@ package managedbean.visit;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@ public class VisitMBean extends ManagedBeanBase implements Serializable {
|
||||
public VisitMBean() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// Inicialización de variables y propiedades van aquí.
|
||||
|
||||
Reference in New Issue
Block a user