Corregido error al refrescar lista tras añadir una nueva prueba.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package managedbean.medicalTest;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
@@ -41,6 +43,10 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
||||
private String lastUIQuery;
|
||||
private String lastUIQueryPatFilter;
|
||||
private List<MedicalTestType> medicalTestTypes;
|
||||
private LocalDate testDate;
|
||||
private LocalTime testTime;
|
||||
private String testObservations;
|
||||
private MedicalTestType testType;
|
||||
|
||||
public MedicalTestMBean() {
|
||||
}
|
||||
@@ -64,7 +70,7 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
||||
case PATIENT:
|
||||
this.patientList = null;
|
||||
this.patientWithTestList = null;
|
||||
break;
|
||||
break;
|
||||
case SPECIALIST_DOCTOR:
|
||||
this.patientList = this.getRemoteManagerCommon().listPatientsPaged(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.patientWithTestList = this.getRemoteManagerMedicalTest().loadPatientsForFamilyDoctor(userID, null, 0, Constants.MAX_ITEMS_AUTOCOMPLETE_SEARCH);
|
||||
}
|
||||
|
||||
|
||||
this.loadMedicalTests();
|
||||
}
|
||||
|
||||
@@ -125,7 +131,7 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
||||
Integer patId = null;
|
||||
if (this.patientFilterSelected != null)
|
||||
patId = this.patientFilterSelected.getId();
|
||||
|
||||
|
||||
switch (userType) {
|
||||
case PATIENT:
|
||||
// Cargar las pruebas para el paciente en sesión
|
||||
@@ -181,7 +187,7 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
||||
public List<PatientTO> getPatientList() {
|
||||
return patientList;
|
||||
}
|
||||
|
||||
|
||||
public List<PatientTO> getPatientWithTestList() {
|
||||
return patientWithTestList;
|
||||
}
|
||||
@@ -203,16 +209,17 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
||||
}
|
||||
|
||||
public void clearFilteredPatient() {
|
||||
this.addNewMode = false;
|
||||
this.selected = null;
|
||||
this.patientFilterSelected = null;
|
||||
this.loadMedicalTests();
|
||||
}
|
||||
|
||||
|
||||
public void onChangePatient(AjaxBehaviorEvent event) {
|
||||
this.selected = null;
|
||||
this.loadMedicalTests();
|
||||
}
|
||||
|
||||
|
||||
public void onSelectPatient(SelectEvent event) {
|
||||
this.selected = null;
|
||||
this.loadMedicalTests();
|
||||
@@ -226,10 +233,10 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
||||
public void addMT() {
|
||||
// Si hay un paciente filtrado en la busqueda de pruebas, lo seleccionamos para la prueba a añadir.
|
||||
this.patSelected = this.patientFilterSelected;
|
||||
this.selected = new MedicalTestTO();
|
||||
this.selected.setId(-1);
|
||||
this.selected.setObservations("");
|
||||
this.selected.setType(MedicalTestType.BLOOD_TEST);
|
||||
this.testDate = LocalDate.now();
|
||||
this.testTime = LocalTime.now();
|
||||
this.testObservations = "";
|
||||
this.testType = MedicalTestType.BLOOD_TEST;
|
||||
this.addNewMode = true;
|
||||
}
|
||||
|
||||
@@ -256,14 +263,14 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
||||
public void save() {
|
||||
try {
|
||||
|
||||
MedicalTestTO mt = this.getRemoteManagerMedicalTest().addMedicalTest(this.patSelected.getId(), this.userID, this.selected.getDate(), this.selected.getTime(),
|
||||
this.selected.getType(), this.selected.getObservations());
|
||||
MedicalTestTO mt = this.getRemoteManagerMedicalTest().addMedicalTest(this.patSelected.getId(), this.userID, this.testDate, this.testTime, this.testType,
|
||||
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()));
|
||||
|
||||
|
||||
// Volvemos al modo añadir (limpiamos el formulario).
|
||||
this.addMT();
|
||||
|
||||
|
||||
this.loadMedicalTests();
|
||||
} catch (Exception ex) {
|
||||
this.manageException(ex);
|
||||
@@ -278,4 +285,36 @@ public class MedicalTestMBean extends ManagedBeanBase implements Serializable {
|
||||
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