Esqueleto de la vista para añadir una nueva visita.
This commit is contained in:
92
1.sources/MyHealth/docroot/visit/AddVisit.xhtml
Normal file
92
1.sources/MyHealth/docroot/visit/AddVisit.xhtml
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
|
||||||
|
<ui:composition template="../header.xhtml">
|
||||||
|
<ui:define name="content">
|
||||||
|
<h:form id="visitForm">
|
||||||
|
<p:messages id="mesgs" showDetail="true" closable="true" autoupdate="true" />
|
||||||
|
<p:panel id="panelVisit" header="Detalles de la visita">
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
|
||||||
|
<div class="ui-g-2">
|
||||||
|
<p:outputLabel for="paciente" value="Paciente:" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-8">
|
||||||
|
<p:inputText id="paciente" value="#{AddVisit.patient.displayName}" readonly="true" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2">
|
||||||
|
<p:message for="paciente" display="text" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-g-2">
|
||||||
|
<p:outputLabel for="medico" value="Médico de familia:" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-8">
|
||||||
|
<p:inputText id="medico" value="#{AddVisit.familyDoctor.displayName}" readonly="true" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2">
|
||||||
|
<p:message for="medico" display="text" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-g-2">
|
||||||
|
<p:outputLabel for="fecha" value="Fecha:" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2">
|
||||||
|
<div class="ui-inputgroup">
|
||||||
|
<p:calendar id="fecha" value="#{AddVisit.date}" pattern="dd/MM/yyyy" showButtonPanel="true" autocomplete="true" required="true"
|
||||||
|
requiredMessage="Especifique la fecha de la visita." />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-8">
|
||||||
|
<p:message for="fecha" display="text" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-g-2">
|
||||||
|
<p:outputLabel for="hora" value="Hora:" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2">
|
||||||
|
<p:calendar id="hora" value="#{AddVisit.time}" pattern="HH:mm" showButtonPanel="true" autocomplete="true" required="true" requiredMessage="Especifique la hora de la visita." />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-8">
|
||||||
|
<p:message for="hora" display="text" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-g-2">
|
||||||
|
<p:outputLabel for="observaciones" value="Observaciones:" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-8">
|
||||||
|
<p:inputTextarea id="observaciones" value="#{AddVisit.observations}" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2">
|
||||||
|
<p:message for="observaciones" display="text" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-g-2">
|
||||||
|
<p:outputLabel for="resultado" value="Resultado:" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-8">
|
||||||
|
<p:inputTextarea id="resultado" value="#{AddVisit.result}" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2">
|
||||||
|
<p:message for="resultado" display="text" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-g-12 ui-g-nopad">
|
||||||
|
<div class="ui-g-4 ui-md-4" />
|
||||||
|
<div class="ui-g-2 ui-md-2 ">
|
||||||
|
<p:commandButton validateClient="true" value="Guardar" update="visitForm" action="#{AddVisit.saveData}" icon="pi pi-check" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:button value="Volver" outcome="/home" icon="pi pi-home" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</p:panel>
|
||||||
|
</h:form>
|
||||||
|
</ui:define>
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
||||||
122
1.sources/MyHealth/src/managedbean/visit/AddVisitMBean.java
Normal file
122
1.sources/MyHealth/src/managedbean/visit/AddVisitMBean.java
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user