From b37fe339068d80a6252361cbf66fc23b76b009b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garcia=20Nu=C3=B1ez?= Date: Tue, 24 Dec 2019 17:50:06 +0100 Subject: [PATCH] =?UTF-8?q?Esqueleto=20de=20la=20vista=20para=20a=C3=B1adi?= =?UTF-8?q?r=20una=20nueva=20visita.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MyHealth/docroot/visit/AddVisit.xhtml | 92 +++++++++++++ .../src/managedbean/visit/AddVisitMBean.java | 122 ++++++++++++++++++ 2 files changed, 214 insertions(+) create mode 100644 1.sources/MyHealth/docroot/visit/AddVisit.xhtml create mode 100644 1.sources/MyHealth/src/managedbean/visit/AddVisitMBean.java diff --git a/1.sources/MyHealth/docroot/visit/AddVisit.xhtml b/1.sources/MyHealth/docroot/visit/AddVisit.xhtml new file mode 100644 index 0000000..5adc38a --- /dev/null +++ b/1.sources/MyHealth/docroot/visit/AddVisit.xhtml @@ -0,0 +1,92 @@ + + + + + + + + + + +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+
+ +
+
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ +
+
+
+ +
+
+ +
+
+
+
+ + + + + diff --git a/1.sources/MyHealth/src/managedbean/visit/AddVisitMBean.java b/1.sources/MyHealth/src/managedbean/visit/AddVisitMBean.java new file mode 100644 index 0000000..2edc628 --- /dev/null +++ b/1.sources/MyHealth/src/managedbean/visit/AddVisitMBean.java @@ -0,0 +1,122 @@ +package managedbean.visit; + +import java.io.Serializable; +import java.sql.Time; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.enterprise.context.RequestScoped; +import javax.faces.application.FacesMessage; +import javax.faces.context.FacesContext; +import javax.inject.Named; + +import org.primefaces.model.LazyDataModel; +import org.primefaces.model.SortOrder; + +import TO.FamilyDoctorTO; +import TO.PatientTO; +import TO.VisitTO; +import managedbean.common.ManagedBeanBase; +import managedbean.common.SessionUtils; + +@Named("AddVisit") +@RequestScoped +public class AddVisitMBean extends ManagedBeanBase implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer id; + private Date date; + private Time time; + private String observations; + private String result; + private String patientDisplayName; + private String familyDoctorDisplayName; + private PatientTO patient; + private FamilyDoctorTO familyDoctor; + + public AddVisitMBean() { + } + + @PostConstruct + public void init() { + // El usuario actual es un medico de familia, recuperamos su Id de la sessión actual + Integer patientId = Integer.valueOf(SessionUtils.getUserId()); + + this.patient = this.getRemoteManagerCommon().findPatientById(patientId); + this.familyDoctor = this.patient.getFamilyDoctor(); + + this.date = new Date(); + } + + public void saveData() { + // TODO: Añadir la nueva visita a la BBDD + } + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } + + public Time getTime() { + return time; + } + + public void setTime(Time time) { + this.time = time; + } + + public String getObservations() { + return observations; + } + + public void setObservations(String observations) { + this.observations = observations; + } + + public String getResult() { + return result; + } + + public void setResult(String result) { + this.result = result; + } + + public String getPatientDisplayName() { + return patientDisplayName; + } + + public String getFamilyDoctorDisplayName() { + return familyDoctorDisplayName; + } + + public PatientTO getPatient() { + return patient; + } + + public void setPatient(PatientTO patient) { + this.patient = patient; + } + + public FamilyDoctorTO getFamilyDoctor() { + return familyDoctor; + } + + public void setFamilyDoctor(FamilyDoctorTO familyDoctor) { + this.familyDoctor = familyDoctor; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + +}