Mejoras en la gestión de excepciones.
This commit is contained in:
@@ -35,21 +35,16 @@ public class AddVisitMBean extends ManagedBeanBase implements Serializable {
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
// El usuario actual es un medico de familia, recuperamos su Id de la sessión actual
|
||||
try {
|
||||
Integer patientId = Integer.valueOf(SessionUtils.getUserId());
|
||||
Integer patientId = Integer.valueOf(SessionUtils.getUserId());
|
||||
|
||||
this.patient = this.getRemoteManagerCommon().findPatientById(patientId);
|
||||
|
||||
if (this.patient.getFamilyDoctor() != null)
|
||||
this.familyDoctorDisplayName = this.patient.getFamilyDoctor().getDisplayName();
|
||||
else
|
||||
this.familyDoctorDisplayName = null;
|
||||
this.patient = this.getRemoteManagerCommon().findPatientById(patientId);
|
||||
|
||||
this.date = LocalDate.now();
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
if (this.patient.getFamilyDoctor() != null)
|
||||
this.familyDoctorDisplayName = this.patient.getFamilyDoctor().getDisplayName();
|
||||
else
|
||||
this.familyDoctorDisplayName = null;
|
||||
|
||||
this.date = LocalDate.now();
|
||||
}
|
||||
|
||||
public void saveData() {
|
||||
@@ -58,7 +53,8 @@ public class AddVisitMBean extends ManagedBeanBase implements Serializable {
|
||||
LocalDate today = LocalDate.now();
|
||||
|
||||
if (this.patient.getFamilyDoctor() == null) {
|
||||
this.addFacesMessage("visitForm:medico", FacesMessage.SEVERITY_ERROR, "Médico de familia no asignado", "Es necesario que tenga un médico de familia asignado, por favor, cambie el médico de familia que tiene asignado");
|
||||
this.addFacesMessage("visitForm:medico", FacesMessage.SEVERITY_ERROR, "Médico de familia no asignado",
|
||||
"Es necesario que tenga un médico de familia asignado, por favor, cambie el médico de familia que tiene asignado");
|
||||
error++;
|
||||
}
|
||||
if (this.date.isBefore(today)) {
|
||||
@@ -119,7 +115,7 @@ public class AddVisitMBean extends ManagedBeanBase implements Serializable {
|
||||
public String getFamilyDoctorDisplayName() {
|
||||
return familyDoctorDisplayName;
|
||||
}
|
||||
|
||||
|
||||
public void setFamilyDoctorDisplayName(String value) {
|
||||
this.familyDoctorDisplayName = value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user