Comprobación de médico de familia asignado al crear una visita.
This commit is contained in:
@@ -14,20 +14,20 @@
|
|||||||
<div class="ui-g-2">
|
<div class="ui-g-2">
|
||||||
<p:outputLabel for="paciente" value="Paciente:" />
|
<p:outputLabel for="paciente" value="Paciente:" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-8">
|
<div class="ui-g-6">
|
||||||
<p:inputText id="paciente" value="#{AddVisit.patient.displayName}" readonly="true" />
|
<p:inputText id="paciente" value="#{AddVisit.patient.displayName}" readonly="true" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2">
|
<div class="ui-g-4">
|
||||||
<p:message for="paciente" display="text" />
|
<p:message for="paciente" display="text" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ui-g-2">
|
<div class="ui-g-2">
|
||||||
<p:outputLabel for="medico" value="Médico de familia:" />
|
<p:outputLabel for="medico" value="Médico de familia:" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-8">
|
<div class="ui-g-6">
|
||||||
<p:inputText id="medico" value="#{AddVisit.familyDoctor.displayName}" readonly="true" />
|
<p:inputText id="medico" value="#{AddVisit.familyDoctorDisplayName}" readonly="true" required="true" requiredMessage="Dese tener asignado un médico de familia. Por favor, cambie su médico de familia." />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2">
|
<div class="ui-g-4">
|
||||||
<p:message for="medico" display="text" />
|
<p:message for="medico" display="text" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ public class AddVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
private String patientDisplayName;
|
private String patientDisplayName;
|
||||||
private String familyDoctorDisplayName;
|
private String familyDoctorDisplayName;
|
||||||
private PatientTO patient;
|
private PatientTO patient;
|
||||||
private FamilyDoctorTO familyDoctor;
|
|
||||||
|
|
||||||
public AddVisitMBean() {
|
public AddVisitMBean() {
|
||||||
}
|
}
|
||||||
@@ -40,7 +39,11 @@ public class AddVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
Integer patientId = Integer.valueOf(SessionUtils.getUserId());
|
Integer patientId = Integer.valueOf(SessionUtils.getUserId());
|
||||||
|
|
||||||
this.patient = this.getRemoteManagerCommon().findPatientById(patientId);
|
this.patient = this.getRemoteManagerCommon().findPatientById(patientId);
|
||||||
this.familyDoctor = this.patient.getFamilyDoctor();
|
|
||||||
|
if (this.patient.getFamilyDoctor() != null)
|
||||||
|
this.familyDoctorDisplayName = this.patient.getFamilyDoctor().getDisplayName();
|
||||||
|
else
|
||||||
|
this.familyDoctorDisplayName = null;
|
||||||
|
|
||||||
this.date = LocalDate.now();
|
this.date = LocalDate.now();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -54,6 +57,10 @@ public class AddVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
int error = 0;
|
int error = 0;
|
||||||
LocalDate today = LocalDate.now();
|
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");
|
||||||
|
error++;
|
||||||
|
}
|
||||||
if (this.date.isBefore(today)) {
|
if (this.date.isBefore(today)) {
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Fecha incorrecta", "La cita fijada es anterior al momento actual");
|
this.addFacesMessage(FacesMessage.SEVERITY_ERROR, "Fecha incorrecta", "La cita fijada es anterior al momento actual");
|
||||||
error++;
|
error++;
|
||||||
@@ -112,6 +119,10 @@ public class AddVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
public String getFamilyDoctorDisplayName() {
|
public String getFamilyDoctorDisplayName() {
|
||||||
return familyDoctorDisplayName;
|
return familyDoctorDisplayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setFamilyDoctorDisplayName(String value) {
|
||||||
|
this.familyDoctorDisplayName = value;
|
||||||
|
}
|
||||||
|
|
||||||
public PatientTO getPatient() {
|
public PatientTO getPatient() {
|
||||||
return patient;
|
return patient;
|
||||||
@@ -121,14 +132,6 @@ public class AddVisitMBean extends ManagedBeanBase implements Serializable {
|
|||||||
this.patient = patient;
|
this.patient = patient;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FamilyDoctorTO getFamilyDoctor() {
|
|
||||||
return familyDoctor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFamilyDoctor(FamilyDoctorTO familyDoctor) {
|
|
||||||
this.familyDoctor = familyDoctor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getId() {
|
public Integer getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user