Corregido error al refrescar lista tras añadir una nueva prueba.
This commit is contained in:
@@ -136,7 +136,7 @@
|
|||||||
|
|
||||||
<div class="ui-g-3">Fecha:</div>
|
<div class="ui-g-3">Fecha:</div>
|
||||||
<div class="ui-g-9">
|
<div class="ui-g-9">
|
||||||
<p:datePicker id="fecha" value="#{mt.selected.date}" pattern="dd/MM/yyyy" showIcon="true" showButtonBar="true" autocomplete="true" required="true"
|
<p:datePicker id="fecha" value="#{mt.testDate}" pattern="dd/MM/yyyy" showIcon="true" showButtonBar="true" autocomplete="true" required="true"
|
||||||
requiredMessage="Especifique la fecha de la prueba médica">
|
requiredMessage="Especifique la fecha de la prueba médica">
|
||||||
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" timeStyle="short" />
|
<f:convertDateTime type="localDate" pattern="dd/MM/yyyy" timeStyle="short" />
|
||||||
</p:datePicker>
|
</p:datePicker>
|
||||||
@@ -144,7 +144,7 @@
|
|||||||
|
|
||||||
<div class="ui-g-3">Hora:</div>
|
<div class="ui-g-3">Hora:</div>
|
||||||
<div class="ui-g-9">
|
<div class="ui-g-9">
|
||||||
<p:datePicker id="hora" value="#{mt.selected.time}" timeOnly="true" pattern="HH:mm" showIcon="true" showButtonBar="true" autocomplete="true" required="true"
|
<p:datePicker id="hora" value="#{mt.testTime}" timeOnly="true" pattern="HH:mm" showIcon="true" showButtonBar="true" autocomplete="true" required="true"
|
||||||
requiredMessage="Especifique la hora de la prueba médica">
|
requiredMessage="Especifique la hora de la prueba médica">
|
||||||
<f:convertDateTime type="localTime" pattern="HH:mm" />
|
<f:convertDateTime type="localTime" pattern="HH:mm" />
|
||||||
</p:datePicker>
|
</p:datePicker>
|
||||||
@@ -152,12 +152,12 @@
|
|||||||
|
|
||||||
<div class="ui-g-3">Observaciones:</div>
|
<div class="ui-g-3">Observaciones:</div>
|
||||||
<div class="ui-g-9">
|
<div class="ui-g-9">
|
||||||
<p:textEditor value="#{mt.selected.observations}" required="true" requiredMessage="Debe indicar las observaciones de la prueba" />
|
<p:textEditor value="#{mt.testObservations}" required="true" requiredMessage="Debe indicar las observaciones de la prueba" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ui-g-3">Tipo de prueba:</div>
|
<div class="ui-g-3">Tipo de prueba:</div>
|
||||||
<div class="ui-g-9">
|
<div class="ui-g-9">
|
||||||
<p:selectOneMenu id="selUsertype" value="#{mt.selected.type}" required="true" unselectable="false" requiredMessage="Debe especificar un tipo de prueba médica">
|
<p:selectOneMenu id="selUsertype" value="#{mt.testType}" required="true" unselectable="false" requiredMessage="Debe especificar un tipo de prueba médica">
|
||||||
<f:selectItems value="#{mt.medicalTestTypes}" var="item" itemLabel="#{item.testTypeName}" />
|
<f:selectItems value="#{mt.medicalTestTypes}" var="item" itemLabel="#{item.testTypeName}" />
|
||||||
</p:selectOneMenu>
|
</p:selectOneMenu>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package managedbean.medicalTest;
|
package managedbean.medicalTest;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -41,6 +43,10 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
|||||||
private String lastUIQuery;
|
private String lastUIQuery;
|
||||||
private String lastUIQueryPatFilter;
|
private String lastUIQueryPatFilter;
|
||||||
private List<MedicalTestType> medicalTestTypes;
|
private List<MedicalTestType> medicalTestTypes;
|
||||||
|
private LocalDate testDate;
|
||||||
|
private LocalTime testTime;
|
||||||
|
private String testObservations;
|
||||||
|
private MedicalTestType testType;
|
||||||
|
|
||||||
public MedicalTestMBean() {
|
public MedicalTestMBean() {
|
||||||
}
|
}
|
||||||
@@ -64,7 +70,7 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
|||||||
case PATIENT:
|
case PATIENT:
|
||||||
this.patientList = null;
|
this.patientList = null;
|
||||||
this.patientWithTestList = null;
|
this.patientWithTestList = null;
|
||||||
break;
|
break;
|
||||||
case SPECIALIST_DOCTOR:
|
case SPECIALIST_DOCTOR:
|
||||||
this.patientList = this.getRemoteManagerCommon().listPatientsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
this.patientList = this.getRemoteManagerCommon().listPatientsPaged(0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
this.patientWithTestList = this.getRemoteManagerMedicalTest().loadPatientsForSpecialistDoctor(userID, null, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
this.patientWithTestList = this.getRemoteManagerMedicalTest().loadPatientsForSpecialistDoctor(userID, null, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
@@ -73,7 +79,7 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
|||||||
this.patientList = null;
|
this.patientList = null;
|
||||||
this.patientWithTestList = this.getRemoteManagerMedicalTest().loadPatientsForFamilyDoctor(userID, null, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
this.patientWithTestList = this.getRemoteManagerMedicalTest().loadPatientsForFamilyDoctor(userID, null, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loadMedicalTests();
|
this.loadMedicalTests();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,7 +131,7 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
|||||||
Integer patId = null;
|
Integer patId = null;
|
||||||
if (this.patientFilterSelected != null)
|
if (this.patientFilterSelected != null)
|
||||||
patId = this.patientFilterSelected.getId();
|
patId = this.patientFilterSelected.getId();
|
||||||
|
|
||||||
switch (userType) {
|
switch (userType) {
|
||||||
case PATIENT:
|
case PATIENT:
|
||||||
// Cargar las pruebas para el paciente en sesión
|
// Cargar las pruebas para el paciente en sesión
|
||||||
@@ -181,7 +187,7 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
|||||||
public List<PatientTO> getPatientList() {
|
public List<PatientTO> getPatientList() {
|
||||||
return patientList;
|
return patientList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PatientTO> getPatientWithTestList() {
|
public List<PatientTO> getPatientWithTestList() {
|
||||||
return patientWithTestList;
|
return patientWithTestList;
|
||||||
}
|
}
|
||||||
@@ -203,16 +209,17 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clearFilteredPatient() {
|
public void clearFilteredPatient() {
|
||||||
|
this.addNewMode = false;
|
||||||
this.selected = null;
|
this.selected = null;
|
||||||
this.patientFilterSelected = null;
|
this.patientFilterSelected = null;
|
||||||
this.loadMedicalTests();
|
this.loadMedicalTests();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onChangePatient(AjaxBehaviorEvent event) {
|
public void onChangePatient(AjaxBehaviorEvent event) {
|
||||||
this.selected = null;
|
this.selected = null;
|
||||||
this.loadMedicalTests();
|
this.loadMedicalTests();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSelectPatient(SelectEvent event) {
|
public void onSelectPatient(SelectEvent event) {
|
||||||
this.selected = null;
|
this.selected = null;
|
||||||
this.loadMedicalTests();
|
this.loadMedicalTests();
|
||||||
@@ -226,10 +233,10 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
|||||||
public void addMT() {
|
public void addMT() {
|
||||||
// Si hay un paciente filtrado en la busqueda de pruebas, lo seleccionamos para la prueba a añadir.
|
// Si hay un paciente filtrado en la busqueda de pruebas, lo seleccionamos para la prueba a añadir.
|
||||||
this.patSelected = this.patientFilterSelected;
|
this.patSelected = this.patientFilterSelected;
|
||||||
this.selected = new MedicalTestTO();
|
this.testDate = LocalDate.now();
|
||||||
this.selected.setId(-1);
|
this.testTime = LocalTime.now();
|
||||||
this.selected.setObservations("");
|
this.testObservations = "";
|
||||||
this.selected.setType(MedicalTestType.BLOOD_TEST);
|
this.testType = MedicalTestType.BLOOD_TEST;
|
||||||
this.addNewMode = true;
|
this.addNewMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,14 +263,14 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
|||||||
public void save() {
|
public void save() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
MedicalTestTO mt = this.getRemoteManagerMedicalTest().addMedicalTest(this.patSelected.getId(), this.userID, this.selected.getDate(), this.selected.getTime(),
|
MedicalTestTO mt = this.getRemoteManagerMedicalTest().addMedicalTest(this.patSelected.getId(), this.userID, this.testDate, this.testTime, this.testType,
|
||||||
this.selected.getType(), this.selected.getObservations());
|
this.testObservations);
|
||||||
|
|
||||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Éxito", String.format("La prueba médica se ha guardado correctamente, el identificador asignado es: %d", mt.getId()));
|
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Éxito", String.format("La prueba médica se ha guardado correctamente, el identificador asignado es: %d", mt.getId()));
|
||||||
|
|
||||||
// Volvemos al modo añadir (limpiamos el formulario).
|
// Volvemos al modo añadir (limpiamos el formulario).
|
||||||
this.addMT();
|
this.addMT();
|
||||||
|
|
||||||
this.loadMedicalTests();
|
this.loadMedicalTests();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
this.manageException(ex);
|
this.manageException(ex);
|
||||||
@@ -278,4 +285,36 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
|||||||
this.patientFilterSelected = patientFilterSelected;
|
this.patientFilterSelected = patientFilterSelected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LocalDate getTestDate() {
|
||||||
|
return testDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTestDate(LocalDate testDate) {
|
||||||
|
this.testDate = testDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalTime getTestTime() {
|
||||||
|
return testTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTestTime(LocalTime testTime) {
|
||||||
|
this.testTime = testTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTestObservations() {
|
||||||
|
return testObservations;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTestObservations(String testObservations) {
|
||||||
|
this.testObservations = testObservations;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MedicalTestType getTestType() {
|
||||||
|
return testType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTestType(MedicalTestType testType) {
|
||||||
|
this.testType = testType;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user