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; + } + +}