CAmbiado tipo de datos para manejar Horas a LocalTime.
This commit is contained in:
@@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
<p:column headerText="Hora" width="60">
|
<p:column headerText="Hora" width="60">
|
||||||
<h:outputText value="#{v.time}">
|
<h:outputText value="#{v.time}">
|
||||||
<f:convertDateTime type="time" pattern="HH:mm" />
|
<f:convertDateTime type="localTime" pattern="HH:mm" />
|
||||||
</h:outputText>
|
</h:outputText>
|
||||||
</p:column>
|
</p:column>
|
||||||
|
|
||||||
|
|||||||
@@ -50,10 +50,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2">
|
<div class="ui-g-2">
|
||||||
<p:datePicker id="hora" value="#{UpdateVisit.time}" timeOnly="true" pattern="HH:mm" showIcon="true" showButtonBar="true" autocomplete="true" required="true"
|
<p:datePicker id="hora" value="#{UpdateVisit.time}" timeOnly="true" pattern="HH:mm" showIcon="true" showButtonBar="true" autocomplete="true" required="true"
|
||||||
requiredMessage="Especifique la hora de la visita." readonly="#{UpdateVisit.onlyResult}" />
|
requiredMessage="Especifique la hora de la visita." readonly="#{UpdateVisit.onlyResult}">
|
||||||
<p:calendar id="time" value="#{UpdateVisit.time}" pattern="HH:mm" timeOnly="true" autocomplete="true" />
|
<f:convertDateTime type="localTime" pattern="HH:mm" />
|
||||||
<p:datePicker id="hora2" value="#{UpdateVisit.time}" timeOnly="true" pattern="HH:mm" />
|
</p:datePicker>
|
||||||
<p:datePicker id="hora3" timeOnly="true" pattern="HH:mm" timeZone="Europe/Madrid" />
|
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-8">
|
<div class="ui-g-8">
|
||||||
<p:message for="hora" display="text" />
|
<p:message for="hora" display="text" />
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
<p:column headerText="Hora" width="60">
|
<p:column headerText="Hora" width="60">
|
||||||
<h:outputText value="#{v.time}">
|
<h:outputText value="#{v.time}">
|
||||||
<f:convertDateTime type="time" pattern="HH:mm" />
|
<f:convertDateTime type="localTime" pattern="HH:mm" />
|
||||||
</h:outputText>
|
</h:outputText>
|
||||||
</p:column>
|
</p:column>
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2">
|
<div class="ui-g-2">
|
||||||
<div class="ui-inputgroup">
|
<div class="ui-inputgroup">
|
||||||
<p:datePicker id="fecha" value="#{VisitView.date}" pattern="dd/MM/yyyy" showIcon="true" readonlyInput="true" showOn="none" readonly="true" showButtonBar="true" autocomplete="true" required="true"
|
<p:datePicker id="fecha" value="#{VisitView.date}" pattern="dd/MM/yyyy" showIcon="true" readonlyInput="true" showOn="none" readonly="true" showButtonBar="true"
|
||||||
requiredMessage="Especifique la fecha de la visita." />
|
autocomplete="true" required="true" requiredMessage="Especifique la fecha de la visita." />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-8">
|
<div class="ui-g-8">
|
||||||
@@ -49,8 +49,10 @@
|
|||||||
<p:outputLabel for="hora" value="Hora:" />
|
<p:outputLabel for="hora" value="Hora:" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2">
|
<div class="ui-g-2">
|
||||||
<p:datePicker id="hora" value="#{VisitView.time}" timeOnly="true" timeZone="Europe/Madrid" pattern="HH:mm" readonly="true" autocomplete="true" required="true"
|
<p:datePicker id="hora" value="#{VisitView.time}" timeOnly="true" pattern="HH:mm" showIcon="true" showButtonBar="true" autocomplete="true" required="true"
|
||||||
requiredMessage="Especifique la hora de la visita." />
|
requiredMessage="Especifique la hora de la visita.">
|
||||||
|
<f:convertDateTime type="localTime" pattern="HH:mm" />
|
||||||
|
</p:datePicker>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-8">
|
<div class="ui-g-8">
|
||||||
<p:message for="hora" display="text" />
|
<p:message for="hora" display="text" />
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package TO;
|
package TO;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.sql.Time;
|
import java.time.LocalTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
@@ -20,7 +20,7 @@ public class VisitTO implements Serializable {
|
|||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private Date date;
|
private Date date;
|
||||||
private Time time;
|
private LocalTime time;
|
||||||
private String observations;
|
private String observations;
|
||||||
private String result;
|
private String result;
|
||||||
private FamilyDoctorTO familyDoctor;
|
private FamilyDoctorTO familyDoctor;
|
||||||
@@ -30,7 +30,7 @@ public class VisitTO implements Serializable {
|
|||||||
super();
|
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.id = Id;
|
||||||
this.date = date;
|
this.date = date;
|
||||||
this.time = time;
|
this.time = time;
|
||||||
@@ -56,11 +56,11 @@ public class VisitTO implements Serializable {
|
|||||||
this.date = date;
|
this.date = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Time getTime() {
|
public LocalTime getTime() {
|
||||||
return this.time;
|
return this.time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTime(Time time) {
|
public void setTime(LocalTime time) {
|
||||||
this.time = time;
|
this.time = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package jpa;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.sql.Time;
|
import java.sql.Time;
|
||||||
|
import java.time.LocalTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
@@ -29,7 +30,7 @@ public class VisitJPA implements Serializable {
|
|||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private Date date;
|
private Date date;
|
||||||
private Time time;
|
private LocalTime time;
|
||||||
private String observations;
|
private String observations;
|
||||||
private String result;
|
private String result;
|
||||||
|
|
||||||
@@ -48,7 +49,7 @@ public class VisitJPA implements Serializable {
|
|||||||
super();
|
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.id = id;
|
||||||
this.date = date;
|
this.date = date;
|
||||||
this.time = time;
|
this.time = time;
|
||||||
@@ -74,11 +75,11 @@ public class VisitJPA implements Serializable {
|
|||||||
this.date = value;
|
this.date = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Time getTime() {
|
public LocalTime getTime() {
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTime(Time value) {
|
public void setTime(LocalTime value) {
|
||||||
this.time = value;
|
this.time = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package managedbean.visit;
|
package managedbean.visit;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ public class UpdateVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
|
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private Date date;
|
private Date date;
|
||||||
private Date time;
|
private LocalTime time;
|
||||||
private String observations;
|
private String observations;
|
||||||
private String result;
|
private String result;
|
||||||
private PatientTO patient;
|
private PatientTO patient;
|
||||||
@@ -35,6 +36,7 @@ public class UpdateVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
public UpdateVisitMBean() {
|
public UpdateVisitMBean() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
FacesContext context = FacesContext.getCurrentInstance();
|
FacesContext context = FacesContext.getCurrentInstance();
|
||||||
@@ -61,12 +63,12 @@ public class UpdateVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
this.patient = vi.getPatient();
|
this.patient = vi.getPatient();
|
||||||
this.familyDoctor = vi.getFamilyDoctor();
|
this.familyDoctor = vi.getFamilyDoctor();
|
||||||
} else {
|
} 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.
|
// 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 ADMINISTRATOR:
|
||||||
case PATIENT:
|
case PATIENT:
|
||||||
// Administrador y paciente pueden actualizar cualquier dato de la visita (excepto esl resultado)
|
// Administrador y paciente pueden actualizar cualquier dato de la visita (excepto esl resultado)
|
||||||
@@ -84,8 +86,7 @@ public class UpdateVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
|
|
||||||
public void saveData() {
|
public void saveData() {
|
||||||
// Si el usuario es un paciente listamos las visitas de ese paciente, si es admnistrador listamos todas.
|
// 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 ADMINISTRATOR:
|
||||||
case PATIENT:
|
case PATIENT:
|
||||||
// Administrador y paciente pueden actualizar la fecha y hora de la visita (excepto esl resultado)
|
// Administrador y paciente pueden actualizar la fecha y hora de la visita (excepto esl resultado)
|
||||||
@@ -113,11 +114,11 @@ public class UpdateVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
this.date = date;
|
this.date = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Date getTime() {
|
public LocalTime getTime() {
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTime(Date time) {
|
public void setTime(LocalTime time) {
|
||||||
this.time = time;
|
this.time = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package managedbean.visit;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.sql.Time;
|
import java.time.LocalTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ public class VisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
|
|
||||||
private Integer id;
|
private Integer id;
|
||||||
private Date date;
|
private Date date;
|
||||||
private Time time;
|
private LocalTime time;
|
||||||
private String observations;
|
private String observations;
|
||||||
private String result;
|
private String result;
|
||||||
private PatientTO patient;
|
private PatientTO patient;
|
||||||
@@ -35,6 +35,7 @@ public class VisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
public VisitMBean() {
|
public VisitMBean() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
// Inicialización de variables y propiedades van aquí.
|
// Inicialización de variables y propiedades van aquí.
|
||||||
@@ -64,7 +65,8 @@ public class VisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
this.patient = vi.getPatient();
|
this.patient = vi.getPatient();
|
||||||
this.familyDoctor = vi.getFamilyDoctor();
|
this.familyDoctor = vi.getFamilyDoctor();
|
||||||
} else {
|
} 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.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,11 +83,11 @@ public class VisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
this.date = date;
|
this.date = date;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Time getTime() {
|
public LocalTime getTime() {
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTime(Time time) {
|
public void setTime(LocalTime time) {
|
||||||
this.time = time;
|
this.time = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user