CAmbiado tipo de datos para manejar Horas a LocalTime.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package TO;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Time;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
@@ -20,7 +20,7 @@ public class VisitTO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Integer id;
|
||||
private Date date;
|
||||
private Time time;
|
||||
private LocalTime time;
|
||||
private String observations;
|
||||
private String result;
|
||||
private FamilyDoctorTO familyDoctor;
|
||||
@@ -30,7 +30,7 @@ public class VisitTO implements Serializable {
|
||||
super();
|
||||
}
|
||||
|
||||
public VisitTO(Integer Id, Date date, Time time, String observations, String result, FamilyDoctorTO fd, PatientTO pat) {
|
||||
public VisitTO(Integer Id, Date date, LocalTime time, String observations, String result, FamilyDoctorTO fd, PatientTO pat) {
|
||||
this.id = Id;
|
||||
this.date = date;
|
||||
this.time = time;
|
||||
@@ -56,11 +56,11 @@ public class VisitTO implements Serializable {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public Time getTime() {
|
||||
public LocalTime getTime() {
|
||||
return this.time;
|
||||
}
|
||||
|
||||
public void setTime(Time time) {
|
||||
public void setTime(LocalTime time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package jpa;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Time;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@@ -29,7 +30,7 @@ public class VisitJPA implements Serializable {
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Integer id;
|
||||
private Date date;
|
||||
private Time time;
|
||||
private LocalTime time;
|
||||
private String observations;
|
||||
private String result;
|
||||
|
||||
@@ -48,7 +49,7 @@ public class VisitJPA implements Serializable {
|
||||
super();
|
||||
}
|
||||
|
||||
public VisitJPA(Integer id, Date date, Time time, String observations, String result, PatientJPA patient, FamilyDoctorJPA familydoctor) {
|
||||
public VisitJPA(Integer id, Date date, LocalTime time, String observations, String result, PatientJPA patient, FamilyDoctorJPA familydoctor) {
|
||||
this.id = id;
|
||||
this.date = date;
|
||||
this.time = time;
|
||||
@@ -74,11 +75,11 @@ public class VisitJPA implements Serializable {
|
||||
this.date = value;
|
||||
}
|
||||
|
||||
public Time getTime() {
|
||||
public LocalTime getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(Time value) {
|
||||
public void setTime(LocalTime value) {
|
||||
this.time = value;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package managedbean.visit;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -21,37 +22,38 @@ import managedbean.common.SessionUtils;
|
||||
public class UpdateVisitMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
private Integer id;
|
||||
private Date date;
|
||||
private Date time;
|
||||
private LocalTime time;
|
||||
private String observations;
|
||||
private String result;
|
||||
private PatientTO patient;
|
||||
private FamilyDoctorTO familyDoctor;
|
||||
private boolean onlyResult;
|
||||
private String fromPage;
|
||||
|
||||
|
||||
public UpdateVisitMBean() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
FacesContext context = FacesContext.getCurrentInstance();
|
||||
Map<String, String> requestParams = context.getExternalContext().getRequestParameterMap();
|
||||
VisitTO vi = null;
|
||||
|
||||
|
||||
try {
|
||||
this.fromPage = requestParams.get("fromPage");
|
||||
|
||||
|
||||
// Parámetro con el "id" de la visita.
|
||||
int parId = Integer.valueOf(requestParams.get("id"));
|
||||
|
||||
|
||||
vi = this.getRemoteManagerVisit().getVisit(parId);
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
|
||||
|
||||
if (vi != null) {
|
||||
this.id = vi.getId();
|
||||
this.date = vi.getDate();
|
||||
@@ -61,12 +63,12 @@ public class UpdateVisitMBean extends ManagedBeanBase implements Serializable {
|
||||
this.patient = vi.getPatient();
|
||||
this.familyDoctor = vi.getFamilyDoctor();
|
||||
} else {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Identificador de visita no válido", "No se ha podido recuperar el identificador de visita especificado. Por favor, vuelva a intentarlo seleccionando de nuevo la visita.");
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Identificador de visita no válido",
|
||||
"No se ha podido recuperar el identificador de visita especificado. Por favor, vuelva a intentarlo seleccionando de nuevo la visita.");
|
||||
}
|
||||
|
||||
|
||||
// Si el usuario es un paciente listamos las visitas de ese paciente, si es admnistrador listamos todas.
|
||||
switch (SessionUtils.getUserType())
|
||||
{
|
||||
switch (SessionUtils.getUserType()) {
|
||||
case ADMINISTRATOR:
|
||||
case PATIENT:
|
||||
// Administrador y paciente pueden actualizar cualquier dato de la visita (excepto esl resultado)
|
||||
@@ -79,30 +81,29 @@ public class UpdateVisitMBean extends ManagedBeanBase implements Serializable {
|
||||
case SPECIALIST_DOCTOR:
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Acesso denegado", "Su perfil de usuario no está autorizado acceder a esta página.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void saveData() {
|
||||
// Si el usuario es un paciente listamos las visitas de ese paciente, si es admnistrador listamos todas.
|
||||
switch (SessionUtils.getUserType())
|
||||
{
|
||||
switch (SessionUtils.getUserType()) {
|
||||
case ADMINISTRATOR:
|
||||
case PATIENT:
|
||||
// Administrador y paciente pueden actualizar la fecha y hora de la visita (excepto esl resultado)
|
||||
// TODO: Implementar método en EJB
|
||||
//this.getRemoteManagerVisit().updateVisit(this.id, this.date, this.time);
|
||||
// this.getRemoteManagerVisit().updateVisit(this.id, this.date, this.time);
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Visita actualizada", "La fecha y hora de la visita se ha actualizado correctamente.");
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
// El médico de familia solo puede actualizar el resultado.
|
||||
//TODO: implementar método EJB para actualizar el resultado.
|
||||
//this.getRemoteManagerVisit().addResultToVisit(this.id, this.result);
|
||||
// TODO: implementar método EJB para actualizar el resultado.
|
||||
// this.getRemoteManagerVisit().addResultToVisit(this.id, this.result);
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Resultado actualizado", "El resultado de la visita se ha actualizado correctamente.");
|
||||
break;
|
||||
case SPECIALIST_DOCTOR:
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Acesso denegado", "Su perfil de usuario no está autorizado acceder a esta página.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
@@ -113,11 +114,11 @@ public class UpdateVisitMBean extends ManagedBeanBase implements Serializable {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public Date getTime() {
|
||||
public LocalTime getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(Date time) {
|
||||
public void setTime(LocalTime time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package managedbean.visit;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Time;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -22,19 +22,20 @@ import managedbean.common.ManagedBeanBase;
|
||||
public class VisitMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
private Integer id;
|
||||
private Date date;
|
||||
private Time time;
|
||||
private LocalTime time;
|
||||
private String observations;
|
||||
private String result;
|
||||
private PatientTO patient;
|
||||
private FamilyDoctorTO familyDoctor;
|
||||
private String fromPage;
|
||||
|
||||
|
||||
public VisitMBean() {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// Inicialización de variables y propiedades van aquí.
|
||||
@@ -43,18 +44,18 @@ public class VisitMBean extends ManagedBeanBase implements Serializable {
|
||||
Map<String, String> requestParams = context.getExternalContext().getRequestParameterMap();
|
||||
|
||||
VisitTO vi = null;
|
||||
|
||||
|
||||
try {
|
||||
this.fromPage = requestParams.get("fromPage");
|
||||
|
||||
|
||||
// Parámetro con el "id" de la visita.
|
||||
int parId = Integer.valueOf(requestParams.get("id"));
|
||||
|
||||
|
||||
vi = this.getRemoteManagerVisit().getVisit(parId);
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
|
||||
|
||||
if (vi != null) {
|
||||
this.id = vi.getId();
|
||||
this.date = vi.getDate();
|
||||
@@ -64,13 +65,14 @@ public class VisitMBean extends ManagedBeanBase implements Serializable {
|
||||
this.patient = vi.getPatient();
|
||||
this.familyDoctor = vi.getFamilyDoctor();
|
||||
} else {
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Identificador de visita no válido", "No se ha podido recuperar el identificador de visita especificado. Por favor, vuelva a intentarlo seleccionando de nuevo la visita.");
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Identificador de visita no válido",
|
||||
"No se ha podido recuperar el identificador de visita especificado. Por favor, vuelva a intentarlo seleccionando de nuevo la visita.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void editVisit(Integer visitId) throws IOException {
|
||||
FacesContext ctx = FacesContext.getCurrentInstance();
|
||||
ctx.getExternalContext().redirect(String.format("UpdateVisit.xhtml?id=%d&fromPage=%s", visitId, this.fromPage));
|
||||
ctx.getExternalContext().redirect(String.format("UpdateVisit.xhtml?id=%d&fromPage=%s", visitId, this.fromPage));
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
@@ -81,11 +83,11 @@ public class VisitMBean extends ManagedBeanBase implements Serializable {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public Time getTime() {
|
||||
public LocalTime getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(Time time) {
|
||||
public void setTime(LocalTime time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user