Files
tarisan_gitea/jsp/Basura/med/Copia de detallePacientes.jsp
T
2025-06-09 13:55:08 +02:00

329 lines
11 KiB
Plaintext

<%@ page import="com.tarisan.control.*" %>
<%@ page import="com.tarisan.data.*" %>
<%@ page import="com.tarisan.excepcion.*" %>
<%@ page import="com.tarisan.log.*" %>
<%@ page import="com.tarisan.util.Utilidades" %>
<%@ page import="com.tarisan.persistencia.PersistenciaParametros" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.Vector" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%
LogTarisan.logger.log(NivelLog.INFO, "Inicio p&aacute;gina de pacientes (med/detallePacientes.jsp)");
response.setHeader("Expires", "0");
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
HttpSession sesion = request.getSession(true);
if(sesion.isNew() || (sesion.getAttribute("USUARIO") == null))
{
LogTarisan.logger.log(NivelLog.INFO, "Sesi&oacute;n invalidada");
response.sendRedirect("../../html/login.html");
}
else
{
try
{
// Definicion de variables
String strParametroMenu="";
String strFecha = "";
StringBuffer strSql = new StringBuffer();
int intPagina = 0;
SimpleDateFormat sdfFormateadorFecha=new SimpleDateFormat(PersistenciaParametros.formatoFechas);
Object aCondiciones[]=null;
//Obtenci&oacute;n del perfil del usuario conectado
StringBuffer perfil = new StringBuffer();
perfil.append("|");
perfil.append(sesion.getAttribute("PERFIL"));
perfil.append("|");
//Obtenemos los valores de los parametros que se pasan a la pagina
//En caso de que no se le pasen parametros, quedaram inicializados
//a sus valores por defecto
//parametro x para marcar la opcion del menu en la que se encuentra el usuario
if (request.getParameter("x")!=null)
strParametroMenu=(String)request.getParameter("x");
//parametro fecha que indica el a&ntilde;o para el que desea realizar la impresion
if (request.getParameter("fecha")!=null)
strFecha=(String)request.getParameter("fecha");
//parametro pagina para realizar la paginacion
if (request.getParameter("pagina")!=null)
intPagina=Integer.parseInt(request.getParameter("pagina"));
%>
<html>
<head>
<title>Pacientes</title>
<link rel="STYLESHEET" type="text/css" href="../../css/estilos.css">
<script language="JavaScript" src="../../js/imprimir.js"></script>
<script language="JavaScript" src="../../js/funciones.js"></script>
<script language="JavaScript" src="../../js/inicio_tarisan.js"></script>
<script language="JavaScript" src="../../js/menu_med.js"></script>
<script language="JavaScript" src="../../js/bloques_tarisan.js"></script>
<script language="JavaScript">pNG="<%= perfil.toString() %>"</script>
<script language="JavaScript" type="text/javascript">
<!--
function paginacion(pagina)
{
document.frmDetallePacientes.pagina.value=pagina;
document.frmDetallePacientes.submit();
}
function comprobarImpresion()
{
if (document.frmDetallePacientes.fecha.value!="")
{
return valorFecha(document.frmDetallePacientes.fecha);
}
else
{
alert("Introduzca la fecha.");
document.frmDetallePacientes.fecha.focus();
return false;
}
}
function realizarImpresion()
{
if (comprobarImpresion()==true)
{
VentanaImpresion('<%=request.getContextPath()%>','<%=request.getContextPath()%>/jsp/imp/impDetallePacientes.jsp?fecha='+document.frmDetallePacientes.fecha.value);
return true;
}
else
return false;
}
function imprimir()
{
if (comprobarImpresion()==true) {
//VentanaImpresion('<%=request.getContextPath()%>','<%=request.getContextPath()%>/jsp/imp/impDetallePacientes.jsp?fecha='+document.frmDetallePacientes.fecha.value);
alert("Victor");
//var ventana =
}
}
//-->
</script>
</head>
<body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" alink="#43881A" bgcolor="#FFFFFF">
<!-- Logotipo de IMQ de Navarra //-->
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr valign="bottom">
<td align="center"><img src="../../img/imq_grande.gif" border="0"></td>
</tr>
</table>
<br>
<!-- Datos del usuario conectado //-->
<table cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td class="tituloTabla" align="center"><%= sesion.getAttribute("USUARIO") %></td>
</tr>
<tr>
<td bgcolor="#C02331"><img src="img/sp.gif" width="746" height="1" border="0"></td>
</tr>
</table>
<br>
<!-- Cabecera de Navegaci&oacute;n superior //-->
<table cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td><script language="JavaScript">bloques();</script></td>
</tr>
</table>
<br>
<!-- Cuerpo de la p&aacute;gina //-->
<table cellpadding="0" cellspacing="0" border="0" align="center">
<tr valign="top">
<td width="180">
<!-- Men&uacute; de navegaci&oacute;n del m&oacute;dulo (zona izquierda) //-->
<table cellpadding="0" cellspacing="0" border="0">
<tr valign="top">
<td colspan="2"><img src="../../img/sp.gif" width="180" height="12" border="0"></td>
</tr>
<tr valign="top">
<td><script language="JavaScript">escribirMenuGst();</script></td>
<td><img src="../../img/sp.gif" width="14" height="261" border="0"></td>
</tr>
</table>
</td>
<td bgcolor="#CCCCCC"><img src="../../img/sp.gif" width="1" height="12" border="0"></td>
<td width="565">
<!-- Tabla con el contenido de la p&aacute;gina (zona central-derecha) //-->
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td><img src="../../img/sp.gif" width="4" height="261" border="0"></td>
<td class="txt" valign="top">
<img src="../../img/sp.gif" width="1" height="11" border="0"><br>
<table border="0" align="center" width="100%">
<!-- Presentacion de los resultados -->
<tr>
<td colspan="4">&nbsp;</td>
</tr>
<form name="frmDetallePacientes" action="detallePacientes.jsp?x=<%=strParametroMenu%>" method="post" onsubmit="javascript:return realizarImpresion()">
<td colspan="4">
<table border="0" align="center">
<tr>
<td><span class="txtnegrita">Fecha (dd-mm-aaaa): </span></td>
<td><input type="text" size="12" name="fecha" class="txt" value="<%=strFecha%>" maxlength="10"></td>
<td>&nbsp;</td>
<td><a href="javascript:imprimir()" class="enlace">Imprimir</a></td>
</tr>
</table>
</td>
<input type="hidden" name="pagina" value="1">
</form>
<tr><td colspan="4">&nbsp;</td></tr>
<%
//Creaci&oacute;n de la tabla presentaci&oacute;n de resultados
strSql.append("SELECT tamovext.fecha, tamovext.precio as precioActoMedico, ttactmed.descripcion as descripcionActoMedico, ttclient.nombre, ttclient.apellidos");
strSql.append(" FROM tamovext, ttactmed, ttbenefi, ttclient");
strSql.append(" WHERE tamovext.acto=ttactmed.acto");
strSql.append(" and tamovext.especialidad=ttactmed.especialidad");
strSql.append(" and tamovext.medico=?");
strSql.append(" and tamovext.especialidad=?");
strSql.append(" and tamovext.colectivo=ttbenefi.colectivo");
strSql.append(" and tamovext.poliza=ttbenefi.poliza");
strSql.append(" and tamovext.orden=ttbenefi.orden");
strSql.append(" and ttbenefi.cliente=ttclient.cliente");
strSql.append(" and ttbenefi.fecha_baja is null");
strSql.append(" ORDER BY tamovext.fecha");
aCondiciones = new Object[2];
aCondiciones[0] = Integer.valueOf( ((Usuario)sesion.getAttribute("USUARIO")).getMedico() );
aCondiciones[1] = Integer.valueOf( ((Usuario)sesion.getAttribute("USUARIO")).getEspecialidad() );
PersistenciaVTamovextTaclient per = new PersistenciaVTamovextTaclient();
Vector vSeleccion = per.seleccionar(strSql.toString(), intPagina, aCondiciones);
if (vSeleccion.size()==0) //No se han encontrado datos
{
%>
<tr>
<td colspan="4">&nbsp;</td>
</tr>
<tr>
<td colspan="4" align="center"><span class="txt">No se ha encontrado ning&uacute;n dato.</span></td>
</tr>
<%
}
else
{
if (intPagina != 0){ //se tiene en cuenta la paginacion
%>
<tr>
<td colspan="4" align="right"><span class="txt">P&aacute;gina <%=per.getPaginacion().getNumeroPagina()%> de <%=per.getPaginacion().getNumeroPaginasTotales()%></span></td>
</tr>
<%
}
%>
<tr>
<td class="cabeceraTabla" align="center" bgcolor="#FFAAAA">Fecha</td>
<td class="cabeceraTabla" align="center" bgcolor="#FFAAAA">Nombre</td>
<td class="cabeceraTabla" align="center" bgcolor="#FFAAAA">Descripci&oacute;n</td>
<td class="cabeceraTabla" align="center" bgcolor="#FFAAAA">Precio</td>
</tr>
<%
VTamovextTaclient vTamovextTaclient = null;
String estilo = "";
for(int i = 0; i < vSeleccion.size(); i++)
{
if (i % 2 == 0)
{
estilo = "filaA";
}
else
{
estilo = "filaB";
}
vTamovextTaclient = (VTamovextTaclient)vSeleccion.elementAt(i);
%>
<tr>
<td class="<%=estilo%>" align="center"><%=sdfFormateadorFecha.format(vTamovextTaclient.getFecha())%></td>
<td class="<%=estilo%>" align="left"><%=vTamovextTaclient.getNombre() + " " + vTamovextTaclient.getApellidos()%></td>
<td class="<%=estilo%>" align="left"><%=vTamovextTaclient.getDescripcionActoMedico()%></td>
<td class="<%=estilo%>" align="right"><%=Utilidades.formatearDouble(vTamovextTaclient.getPrecioActoMedico(),PersistenciaParametros.decimales)%></td>
</tr>
<%
}
if (intPagina!=0){ //se tiene en cuenta la paginacion %>
<tr><td colspan="4"></td></tr>
<tr>
<td colspan="4">
<table border="0" align="center">
<tr>
<%if (per.getPaginacion().esPrimeraPagina()){%>
<td width="70" align="right"><span class="pagDesactivo">primero</span></td>
<td></td>
<td width="70" align="left"><span class="pagDesactivo">anterior</span></td>
<%}else{%>
<td width="70" align="right"><a href="javascript:paginacion(1)" class="enlace">primero</a></td>
<td></td>
<td width="70" align="left"><a href="javascript:paginacion(<%=per.getPaginacion().getNumeroPagina() - 1%>)" class="enlace">anterior</a></td>
<%}%>
<%if (per.getPaginacion().esUltimaPagina()){%>
<td width="70" align="right"><span class="pagDesactivo">siguiente</span></td>
<td></td>
<td width="70" align="left"><span class="pagDesactivo">&uacute;ltimo</span></td>
<%}else{%>
<td width="70" align="right"><a href="javascript:paginacion(<%=per.getPaginacion().getNumeroPagina() + 1%>)" class="enlace">siguiente</a></td>
<td></td>
<td width="70" align="left"><a href="javascript:paginacion(<%=per.getPaginacion().getNumeroPaginasTotales()%>)" class="enlace">&uacute;ltimo</a></td>
<%}%>
</tr>
</table>
</td>
</tr>
<%
} //fin if(pagina!=0)
} //fin else (vSeleccion.size()!=0)
%>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<%
}
catch(ExcepcionTarisan ex)
{
LogTarisan.logger.log(NivelLog.ERROR, "ExcepcionTarisan: " + ex.getMensaje());
sesion.setAttribute("ERROR", "ExcepcionTarisan: " + ex.getMensaje());
response.sendRedirect("../error.jsp");
}
catch(Exception ex)
{
LogTarisan.logger.log(NivelLog.ERROR, "Exception: " + ex);
sesion.setAttribute("ERROR", "ExcepcionTarisan: " + ex);
response.sendRedirect("../error.jsp");
}
}
LogTarisan.logger.log(NivelLog.INFO, "Final p&aacute;gina de pacientes (med/detallePacientes.jsp)");
%>