Files
tarisan_gitea/jsp/pac/prescripcion_ats.jsp
2025-06-09 13:55:08 +02:00

1057 lines
38 KiB
Plaintext

<%@ page import="com.tarisan.control.*" %>
<%@ page import="com.tarisan.data.*" %>
<%@ page import="com.tarisan.excepcion.*" %>
<%@ page import="com.tarisan.log.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.Vector" %>
<%
//LogTarisan.logger.log(NivelLog.INFO, "Inicio página de prescripcion ats (pac/prescripcion_ats.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ón invalidada");
response.sendRedirect(request.getContextPath() + "/html/login.html");
}
else
{
LogTarisan.logger.log(NivelLog.INFO, ((Usuario)sesion.getAttribute("USUARIO")).getMedico() + " - Inicio página de prescripcion ats (pac/prescripcion_ats.jsp)");
try
{
// Definicion de variables
boolean boolActosValidosCargados=false;
String strMensajeSinElementos="No ha seleccionado ningún acto médico.";
String strJustificacionPrescripcion="";
String strParametroMenu="";
String strCampoNombre="";
String strListaElementos="";
String strListaCodigoElementos="";
String strUnidades="";
String strInforme="";
String strAutorizacion="";
String strTextBox = "";
int intPagina = 0;
int i=0;
StringBuffer strSql = new StringBuffer();
Object aCondiciones[]=null;
int intImpresion = 0;
PersistenciaTagruana perTagruana = new PersistenciaTagruana();
Tagruana tagruana=null;
int intMedico = ((Usuario)sesion.getAttribute("USUARIO")).getMedico();
//Obtención del perfil del usuario conectado
StringBuffer perfil = new StringBuffer();
perfil.append("|");
perfil.append(sesion.getAttribute("PERFIL"));
perfil.append("|");
String mensaje = "";
mensaje = (String)sesion.getAttribute("ERROR");
sesion.setAttribute("ERROR", "");
if(mensaje!=""){
strMensajeSinElementos = "<p style='color:blue;'>"+ mensaje + "</p>";
}
//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 descripcion para las busquedas
if (request.getParameter("nombre")!=null)
strCampoNombre = (String)request.getParameter("nombre");
//parametro pagina para realizar la paginacion
if (request.getParameter("pagina")!=null)
intPagina=Integer.parseInt(request.getParameter("pagina"));
//parametro listaPrescripciones para mostrar las prescripciones seleccionadas
if (request.getParameter("listaElementos")!=null)
strListaElementos=(String)request.getParameter("listaElementos");
//parametro listaPrescripciones para mostrar las prescripciones seleccionadas
if (request.getParameter("listaCodigoElementos")!=null)
strListaCodigoElementos=(String)request.getParameter("listaCodigoElementos");
//parametro listaUnidades
if (request.getParameter("unidadesElementosPrescripcion")!=null)
strUnidades=(String)request.getParameter("unidadesElementosPrescripcion");
//parametro informe para mostrar el informe introducido por el medico
if (request.getParameter("informe")!=null)
strInforme=(String)request.getParameter("informe");
//parametro impresion que nos indica que se ha de realizar una impresion
if (request.getParameter("imp")!=null) {
intImpresion=Integer.parseInt(request.getParameter("imp"));
}
//atributo autorizacion utilizado para realizar la impresion
if (request.getAttribute("autorizacion")!=null) {
//strAutorizacion=(String)request.getAttribute("autorizacion");
if(request.getAttribute("autorizacion").getClass() == Long.class)
{
strAutorizacion = String.valueOf(request.getAttribute("autorizacion"));
}
else
{
strAutorizacion = (String)request.getAttribute("autorizacion");
}
}
//parametro justificacion que contiene la justificacion del medico para hacer una nueva prescripcion.
//en caso de no ser necesaria una justificacion, este campo estará vacio
if (request.getParameter("justificacionPrescripcion")!=null)
{
strJustificacionPrescripcion=(String)request.getParameter("justificacionPrescripcion");
//quitamos las comillas simples para pasarlas a un input oculto del formulario
//en javascript.
//Si no le quitamos las comillas simples, fallaria. Antes de pasar el valor al input, restauramos las comillas simples.
strJustificacionPrescripcion = strJustificacionPrescripcion.replace('\'', '~');
}
//parametro nombreTextBox para saber a que caja de texto hay que ponerle el focus y hacerle parpadear cambiando su color
if (request.getParameter("nombreTextBox")!=null)
{
strTextBox=(String)request.getParameter("nombreTextBox");
}
Tamensaje tamensaje = new Tamensaje();
PersistenciaTamensaje pertamensaje = new PersistenciaTamensaje();
boolean mostrarNoticia = true;
PersistenciaTanoticias perTaNo = new PersistenciaTanoticias();
Vector vSeleccionNot = perTaNo.obtener_noticias_cabecera();
Vector vNoticias = new Vector();
String strNoticia = "";
String noticias ="";
String separador = " ---//--- ";
if(vSeleccionNot.size()==0){
mostrarNoticia = false;
}else{
mostrarNoticia = true;
Tanoticias tanoticia = null;
for(int n = 0; n < vSeleccionNot.size(); n++)
{
tanoticia = (Tanoticias)vSeleccionNot.elementAt(n);
if (n!=0){
strNoticia = strNoticia + separador + tanoticia.getNoticia();
}else{
strNoticia = tanoticia.getNoticia();
}
strNoticia = strNoticia.replaceAll("<br/>", " ");
}
}
String path = request.getContextPath();
if (request.getContextPath().indexOf("tarisan")==-1){
path = path + "/tarisan";
}
%>
<html>
<head>
<title>ATS</title>
<link rel="shortcut icon" href="<%=path%>/img/logo.ico" />
<link rel="STYLESHEET" type="text/css" href="<%=path%>/css/estilos.css">
<link rel="STYLESHEET" type="text/css" href="<%=path %>/css/jquery.modal.css">
<script language="JavaScript" src="<%=path%>/js/funciones.js"></script>
<script language="JavaScript" src="<%=path%>/js/inicio_tarisan.js"></script>
<script language="JavaScript" src="<%=path%>/js/menu_pac.js"></script>
<script language="JavaScript" src="<%=path%>/js/bloques_tarisan.js"></script>
<script language="JavaScript" src="<%=path%>/js/jquery-1.11.3.js"></script>
<script language="JavaScript" src="<%=path%>/js/jquery.modal.min.js"></script>
<script language="JavaScript">pNG="<%= perfil.toString() %>"</script>
<script language="JavaScript" type="text/javascript">
<!--
//********************************************************************************************************************
//********************************************************************************************************************
//FUNCIONES UTILIZADAS PARA EL TRATAMIENTO DE LA SELECCION DE LOS CHECKBOXES DE LA GESTION DE PACIENTES
//********************************************************************************************************************
//********************************************************************************************************************
var mensajeSinElementos = "<%=strMensajeSinElementos%>";
var vElementos = new Array();
var vCodigoElementos = new Array();
var vUnidades = new Array();
var intNumeroCheckBoxes = 0;
var stringActosValidos = "";
function comprobarImpresion(impresion)
{
if (impresion==1) {//se efectua la impresion
//VentanaImpresion('<%=request.getContextPath()%>','<%=request.getContextPath()%>/jsp/imp/impAnalitica.jsp?autorizacion=<%=strAutorizacion%>');
//var ventanaAnalisis2 = window.open('<%=request.getContextPath()%>/peticiones/<%=strAutorizacion%>.pdf',"<%=strAutorizacion%>","dependent=1,height=490,width=720,left=150,top=100,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no,toolbar=no,directories=no");
document.frmImprimirPeticion.nombrePDF.value = "<%=strAutorizacion%>.pdf";
document.frmImprimirPeticion.submit();
}
}
function anular()
{
strParametroGrupoSeleccionado="";
vElementos = new Array();
escribirListaElementos();
vCodigoElementos = new Array();
vUnidades = new Array();
//limpiamos la seleccion de las checkboxes
for (var i=0;i<intNumeroCheckBoxes;i++)
eval("document.frmAnalitica.checkbox" + i + ".checked=false");
document.frmPrescripcion.listaElementosPrescripcion.value="";
document.frmPrescripcion.listaCodigoElementosPrescripcion.value="";
document.frmPrescripcion.unidadesElementosPrescripcion.value="";
document.frmPrescripcion.informePrescripcion.value="";
document.frmAnalitica.listaElementos.value="";
document.frmAnalitica.listaCodigoElementos.value="";
document.frmAnalitica.informe.value="";
document.frmAnalitica.grupo.value=""
document.frmAnalitica.seleccionGrupo.value=""
}
function imprimir()
{
prepararImpresionListaElementos(document.frmPrescripcion.listaElementosPrescripcion, document.frmPrescripcion.listaCodigoElementosPrescripcion, document.frmPrescripcion.unidadesElementosPrescripcion);
prepararEnvioFormInformePrescripcion();
if (document.frmPrescripcion.listaElementosPrescripcion.value==""){
//alert("Debe seleccionar algún elemento para realizar la prescripción.");
modal({type:'error',title:'¡Atención!',text:'Debe seleccionar algún elemento para realizar la prescripción.',});
}
else
{
//comprobamos que tenga menos de mil caracteres
if (document.frmPrescripcion.informePrescripcion.value.length > 1000)
document.frmPrescripcion.informePrescripcion.value=document.frmPrescripcion.informePrescripcion.value.substring(0,1000);
if(document.frmPrescripcion.informePrescripcion.value.length < 20){
//alert("Recuerde que en el informe debe indicar los detalles y posologia del inyectable, las pautas de la cura, del sondaje...")
modal({type:'error',title:'¡Atención!',text:'Recuerde que en el informe debe indicar los detalles y posologia del inyectable, las pautas de la cura, del sondaje...',});
}
else
{
//enviamos el formulario
document.frmPrescripcion.submit();
}
}
}
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (obj, fromIndex) {
if (fromIndex == null) {
fromIndex = 0;
} else if (fromIndex < 0) {
fromIndex = Math.max(0, this.length + fromIndex);
}
for (var i = fromIndex, j = this.length; i < j; i++) {
if (this[i] == obj && obj != 0)
return i;
}
return -1;
};
}
function prepararImpresionListaElementos(campoElementos, campoCodigoElementos, campoUnidades)
{
var textoElementos="";
var textoCodigoElementos="";
var textoUnidades="";
if(vCodigoElementos.length>0)
{
for (var i=0; i<vCodigoElementos.length; i++)
{
textoCodigoElementos+= "¬" + vCodigoElementos[i];
textoElementos+= "¬" + vElementos[i];
textoUnidades+= "¬" + vUnidades[i];
}
textoCodigoElementos+= "¬";
textoElementos+="¬";
textoUnidades+="¬";
campoElementos.value=textoElementos;
campoCodigoElementos.value=textoCodigoElementos;
campoUnidades.value=textoUnidades;
}
else
{
//alert("Debe seleccionar algún elemento para realizar la prescripción.");
modal({type:'error',title:'¡Atención!',text:'Debe seleccionar algún elemento para realizar la prescripción.',});
}
}
function DetectFirefox()
{
var resul = false;
var val = navigator.appName;
if(val.indexOf("Netscape") > -1)
{
resul = true;
}
return resul;
}
function buscar_array_firefox(obj, elemento)
{
var matriz = new Array();
matriz = obj;
for(var i=0; i<matriz.length; i++)
{
if(matriz[i] == elemento)
return i;
}
return -1;
}
function prepararEnvioFormListaElementos(campoElementos, campoCodigoElementos, campoUnidades)
{
var textoElementos="";
var textoCodigoElementos="";
var textoUnidades="";
//stringActosValidos += "¬";
var posiciones_eliminar="";
var temp3 = new Array();
var temp2 = new Array();
var temp4 = new Array();
var j=0;
if (vCodigoElementos.length>0) //array con elementos
{
//preparamos la lista de codigos
//Convertimos el string en array y buscamos el elemento actual dentro del array:
for (var i=0; i<vCodigoElementos.length; i++)
{
textoCodigoElementos+= "¬" + vCodigoElementos[i];
textoElementos+= "¬" + vElementos[i];
textoUnidades+= "¬" + vUnidades[i];
temp3[j] = vCodigoElementos[i];
temp2[j] = vElementos[i];
temp4[j] = vUnidades[i];
j=j+1;
}
textoCodigoElementos+= "¬";
textoElementos+="¬";
textoUnidades+="¬";
}
campoElementos.value=textoElementos;
campoUnidades.value=textoUnidades;
campoCodigoElementos.value=textoCodigoElementos;
vCodigoElementos = temp3;
vElementos = temp2;
vUnidades = temp4;
}
function prepararEnvioFormInformePrescripcion()
{
document.frmPrescripcion.informePrescripcion.value = document.frmAnalitica.informe.value;
}
function inicializarListaElementos()
{
//preparamos la lista de codigos
//cogemos los valores de la lista de codigos
var lstCodigoElementos = '<%=strListaCodigoElementos%>';
var lstUnidades = '<%=strUnidades%>';
//inicializamos el array de elementos con sus valores
var i=0;
if (lstCodigoElementos!="") //la lista no esta vacia
{
//quitamos el primer caracter separador
lstCodigoElementos=lstCodigoElementos.substring(lstCodigoElementos.indexOf("¬") + 1);
while (lstCodigoElementos.indexOf("¬")!=-1)
{
var string = lstCodigoElementos.substring(0, lstCodigoElementos.indexOf("¬"));
if(string.length > 0)
vCodigoElementos[i] = string;
lstCodigoElementos=lstCodigoElementos.substring(lstCodigoElementos.indexOf("¬") + 1);
i++;
}
}
i=0;
if(lstUnidades!="")
{
lstUnidades=lstUnidades.substring(lstUnidades.indexOf("¬")+1)
while(lstUnidades.indexOf("¬")!=-1)
{
var string = lstUnidades.substring(0, lstUnidades.indexOf("¬"));
if(string.length > 0)
vUnidades[i] = string;
lstUnidades=lstUnidades.substring(lstUnidades.indexOf("¬") + 1);
i++;
}
}
//preparamos la lista de descripciones
//Quitamos las comillas simples para que al asignar el valor de la lista de elementos
//no kaske, ya que en esa asignacion se utiliza comillas simples
<%
String strListaElementosAux=strListaElementos.replace('\'', '~');
%>
//cogemos los valores de la lista sin comillas simples
var lstElementos = '<%=strListaElementosAux%>';
//restauramos las comillas simples para ponerlos con su valor original en el array de elementos
while(lstElementos.indexOf("~")!=-1)
lstElementos = lstElementos.replace("~", "'");
//inicializamos el array de elementos con sus valores originales
var i=0;
if (lstElementos!="") //la lista no esta vacia
{
//quitamos el primer caracter separador
lstElementos=lstElementos.substring(lstElementos.indexOf("¬") + 1);
while (lstElementos.indexOf("¬")!=-1)
{
var string = lstElementos.substring(0, lstElementos.indexOf("¬"));
if(string.length > 0)
vElementos[i] = string;
//lstElementos.substring(0, lstElementos.indexOf("¬"));
lstElementos=lstElementos.substring(lstElementos.indexOf("¬") + 1);
i++;
}
}
prepararEnvioFormListaElementos(document.frmAnalitica.listaElementos, document.frmAnalitica.listaCodigoElementos, document.frmAnalitica.unidadesElementosPrescripcion);
escribirListaElementos();
}
function aniadirElemento(elemento, codigoElemento, unidades)
{
var elementoConComillaSimple=elemento;
var nocargar=false;
//En caso de que el elemento tenga el caracter (~), se sustituye por una comilla simple (')
//para mostrarlo correctamente. En el array se almacenan los valores reales, con comillas simples.
//El elemento viene con ese caracter especial que sustituye a la comilla simple, porque si no, a la hora de
//asignar el valor original a la propiedad value del checkbox, si el valor original contiene ', kaska. Pensara que es
//final de string. Para evitar eso, antes de asignar a la propiedad value remplazamos la comilla por ese valor especial.
while(elementoConComillaSimple.indexOf("~")!=-1)
{
elementoConComillaSimple = elementoConComillaSimple.replace("~", "'");
}
//añadimos descripcion elemento
vElementos[vElementos.length]=elementoConComillaSimple;
//añadimos codigo elemento
vCodigoElementos[vCodigoElementos.length]=codigoElemento;
//añadimos las unidades del elemento
vUnidades[vUnidades.length]=unidades;
}
function eliminarElemento(elemento, codigoElemento)
{
var elementoConComillaSimple=elemento;
var vNuevosElementos=new Array();
var vNuevosCodigoElementos=new Array();
var vNuevasUnidades = new Array();
var j=0;
//eliminamos descripcion elemento
//En caso de que el elemento tenga tenga el caracter (~), se sustituye por una comilla simple (')
//ya que en el array se almacenan los valores reales, con comillas simples.
while(elementoConComillaSimple.indexOf("~")!=-1)
elementoConComillaSimple = elementoConComillaSimple.replace("~", "'");
for (var i=0; i<vElementos.length; i++)
{
if(vElementos[i]!=elementoConComillaSimple)
{
vNuevosElementos[j]=vElementos[i];
vNuevasUnidades[j]=vUnidades[i];
j++;
}
}
vElementos = vNuevosElementos;
//eliminamos codigo elemento
j=0;
for (var i=0; i<vCodigoElementos.length; i++)
{
if(vCodigoElementos[i]!=codigoElemento)
{
vNuevosCodigoElementos[j]=vCodigoElementos[i];
j++;
}
}
vCodigoElementos = vNuevosCodigoElementos;
//eliminamos las unidades del elemento
vUnidades = vNuevasUnidades;
}
function escribirListaElementos()
{
// USAR EL STRING EN LUGAR DEL ARRAY O MODIFICAR EL ARRAY
var texto="<table border='0' cellpadding='0' cellspacing='0'>";
if (vElementos.length==0) //no hay ningun elemento
texto+= "<tr><td class='txt'>" + mensajeSinElementos + "</td></tr>";
else //hay algun elemento
{
for (var i=0; i<vElementos.length; i++)
{
texto+= "<tr><td class="+'"txtNegrita"'+" valign='top'><input type=\"checkbox\" onclick=\"javascript:tratarCheckBox(this, " + vCodigoElementos[i] + ", "+vUnidades[i] +")\" checked=\"checked\" value='"+vElementos[i]+"'></td><td class='txt'>" + vElementos[i] + " - " + vUnidades[i] + "</td></tr>";
}
}
texto = texto + "</table>";
//alert(texto);
//escribimos la lista de elementos dependiendo del navegador
if (document.all)
{
document.all['elementos'].innerHTML = texto;
}
else if (document.getElementById)
{
document.getElementById('elementos').innerHTML = texto;
}
else if (document.layers)
{
texto = "<layer top='0' left='0'>"+texto+"</layer>";
document.layers['elementos'].document.open();
document.layers['elementos'].document.write(texto);
document.layers['elementos'].document.close();
}
}
function tratarCheckBox(checkbox, codigoElemento, valorUnidades)
{
var unidades = 0;
if (vElementos.length>=25) //hay seleccionados 25 elementos. No puede seleccionar mas elementos.
{
if (checkbox.checked==true) //se selecciona una prescripcion
{
checkbox.checked=false;
//alert("No puede imputar más actos médicos");
modal({type:'error',title:'¡Atención!',text:'No puede imputar más actos médicos.',});
}
else //se quita la seleccion de una prescripcion
{
eliminarElemento(checkbox.value, codigoElemento, unidades);
prepararEnvioFormListaElementos(document.frmAnalitica.listaElementos, document.frmAnalitica.listaCodigoElementos, document.frmAnalitica.unidadesElementosPrescripcion);
escribirListaElementos();
}
}
else //tiene seleccionados menos que 25 elementos. Le dejamos que seleccione sin ningun problema.
{
//alert("tiene menos de 25 elementos");
if (checkbox.checked==true) //se selecciona una prescripcion
{
unidades = document.getElementById(valorUnidades).value;
var nombreCaja = valorUnidades; //Guardo el nombre de la caja de texto para ponerle el focus después de sacar el alert
if (isNaN(unidades)) {
alert("Solo puede introducir números en el campo unidades");
//modal({type:'error',title:'¡Atención!',text:'Solo puede introducir números en el campo unidades.',});
checkbox.checked=false;
document.frmAnalitica.nombreTextBox.value=nombreCaja;
document.getElementById(valorUnidades).value="";
}
else if(unidades == 0 || unidades == null)
{
alert("Debe indicar las unidades prescritas");
//modal({type:'error',title:'¡Atención!',text:'Debe indicar las unidades prescritas.',});
checkbox.checked=false;
document.frmAnalitica.nombreTextBox.value=nombreCaja;
}else if(unidades>50)
{
alert("No puede introducir más de 50 unidades");
//modal({type:'error',title:'¡Atención!',text:'No puede introducir más de 50 unidades.',});
checkbox.checked=false;
document.frmAnalitica.nombreTextBox.value=nombreCaja;
document.getElementById(valorUnidades).value="";
}
else
{
// alert("Vamos a añadir un elemento");
aniadirElemento(checkbox.value, codigoElemento, unidades);
document.frmAnalitica.nombreTextBox.value=null;
}
}
else
{
// alert("Vamos a quitar un elemento");
// alert("valores, checkbox: "+checkbox.value+"codigoelemento: "+codigoElemento);
eliminarElemento(checkbox.value, codigoElemento, unidades);
}
prepararEnvioFormListaElementos(document.frmAnalitica.listaElementos, document.frmAnalitica.listaCodigoElementos, document.frmAnalitica.unidadesElementosPrescripcion);
escribirListaElementos();
//buscar();
document.frmAnalitica.submit();
}
}
//********************************************************************************************************************
//********************************************************************************************************************
//FUNCIONES UTILIZADAS PARA EL TRATAMIENTO DE LA SELECCION DE LOS CHECKBOXES DE LA GESTION DE PACIENTES
//********************************************************************************************************************
//********************************************************************************************************************
//el parametro justificacion proveniente de la jsp justificaccionDiagnostico, puede que tenga comillas simples.
//este valor hay que pasarlo como input oculto dentro del formulario.
//para evitar que kaske esta asignacion, hacemos tratamiento de las comillas.
//antes, en el codigo java, hemos sustituido las comillas simples por el caracter '~'.
//ahora sustituimos el valor '~' por las comillas simples.
function prepararCampoJustificacion()
{
var justificacionConComillas = document.frmPrescripcion.justificacionPrescripcion.value;
while (justificacionConComillas.indexOf("~")!=-1)
justificacionConComillas=justificacionConComillas.replace("~", "'");
document.frmAnalitica.justificacionPrescripcion.value = justificacionConComillas;
document.frmPrescripcion.justificacionPrescripcion.value = justificacionConComillas;
}
function informarParametroCampoBusqueda()
{
//Quitamos las comillas simples para que al asignar el valor del campo de busqueda
//no kaske, ya que en esa asignacion se utiliza comillas simples
<%
String strCampoNombreAux=strCampoNombre.replace('\'', '~');
%>
//cogemos el valor del campo de busqueda sin comillas simples
var lstCampoBusqueda = '<%=strCampoNombreAux%>';
//restauramos las comillas simples para ponerlos con su valor original en campo de busqueda
while(lstCampoBusqueda.indexOf("~")!=-1)
lstCampoBusqueda = lstCampoBusqueda.replace("~", "'");
document.frmAnalitica.nombre.value=lstCampoBusqueda;
}
function comprobarTamanio()
{
return (document.frmAnalitica.informe.value.length < 1000)
}
function pasarAMayusculas(campo)
{
campo.value=campo.value.toUpperCase();
}
function buscar()
{
prepararEnvioFormListaElementos(document.frmAnalitica.listaElementos, document.frmAnalitica.listaCodigoElementos, document.frmAnalitica.unidadesElementosPrescripcion);
document.frmAnalitica.pagina.value=1;
pasarAMayusculas(document.frmAnalitica.nombre);
document.frmAnalitica.submit();
}
function paginacion(pagina)
{
prepararEnvioFormListaElementos(document.frmAnalitica.listaElementos, document.frmAnalitica.listaCodigoElementos, document.frmAnalitica.unidadesElementosPrescripcion);
document.frmAnalitica.pagina.value=pagina;
pasarAMayusculas(document.frmAnalitica.nombre);
document.frmAnalitica.submit();
}
//-->
</script>
</head>
<body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" alink="#43881A" bgcolor="#FFFFFF" onLoad="javascript:comprobarImpresion(<%=intImpresion%>);javascript:inicializarListaElementos();informarParametroCampoBusqueda()">
<div class="marco">
<!-- Datos del usuario conectado //-->
<table cellpadding="0" cellspacing="0" border="0" align="center" style="width:95%">
<tr>
<td class="tdLogoCabecera"><img src="<%=request.getContextPath()%>/img/logo.png" class="logoCabecera"></td>
<td>
<table width="100%">
<tr><td class="tituloTablaMedico" align="center"><%= sesion.getAttribute("USUARIO") %></td></tr>
<tr>
<td>
<div id="contenedorNoticia">
<br>
<div class="tituloNoticia">
<p class="marquee"><%=strNoticia %></p>
</div>
</div>
</td>
</tr>
</table>
</td>
</tr>
<!-- Cabecera de Navegación superior //-->
<table cellpadding="0" cellspacing="0" border="0" align="center" style="width:95%">
<tr>
<td><script language="JavaScript">bloques();</script></td>
</tr>
</table>
<br>
<!-- Datos del paciente introducido mediante la lectura de la tarjeta //-->
<table cellpadding="0" cellspacing="0" border="0" align="center" style="width:95%">
<tr>
<td class="tituloTabla" align="center"><%= sesion.getAttribute("PACIENTE") %></td>
</tr>
</table>
<br>
<!-- Cuerpo de la página //-->
<table cellpadding="0" cellspacing="0" border="0" align="center" style="width:95%">
<tr valign="top">
<!--<td width="180">//-->
<td width="5%">
<!-- Menú de navegación del módulo (zona izquierda) //-->
<table cellpadding="0" cellspacing="0" border="0">
<tr valign="top">
<td colspan="2"><img src="<%=request.getContextPath()%>/img/sp.gif" width="180" height="12" border="0"></td>
</tr>
<tr valign="top">
<td><script language="JavaScript">escribirMenuGst();</script></td>
</tr>
</table>
</td>
<td width="565">
<!-- Tabla con el contenido de la página (zona central-derecha) //-->
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td width="1px" bgcolor="#CCCCCC"></td>
<td class="txt" valign="top">
<table border="0" align="center" width="100%" cellpadding="0">
<%
Tarjeta tarjeta = ((Paciente)sesion.getAttribute("PACIENTE")).getTarjeta();
if(!((Paciente)sesion.getAttribute("PACIENTE")).get_noesiguala_inactivar() && tarjeta.getEntidadChipcard().compareTo(ParametrosConfiguracion.bin_chipcard_propios)==0)
{
%>
<tr><td>&nbsp;</td></tr>
<tr><td>&nbsp;</td></tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td align="center" class="txtNegrita"><% tamensaje = pertamensaje.obtenerMensaje(11); %><%=tamensaje.getMensaje() %></td>
</tr>
<%
}
else
{
%>
<!-- Presentacion de los resultados -->
<tr>
<td colspan="2" align="right">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="button" name="aceptar" value="OK/Imprimir" onclick="javascript:imprimir()" class="menu"></td>
<td><img src="<%=request.getContextPath()%>/img/sp.gif" width="5" height="1" border="0"></td>
<td><input type="button" name="anular" value="Anular" onclick="javascript:anular()" class="menu"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<form name="frmPrescripcion" action="<%=request.getContextPath()%>/servlet/GestorPacientes?x=<%=strParametroMenu%>&imp=1" method="post">
<input type="hidden" name="listaElementosPrescripcion" value="">
<input type="hidden" name="listaCodigoElementosPrescripcion" value="">
<input type="hidden" name="unidadesElementosPrescripcion" value="">
<input type="hidden" name="informePrescripcion" value="">
<input type="hidden" name="OPCION" value="<%=Constantes.OPC_PAC_PRESCRIPCION_ATS%>">
<% //ponemos la especialidad 50 fuego por que es la de los ats %>
<input type="hidden" name="especialidad" value="50">
<input type="hidden" name="justificacionPrescripcion" value='<%=strJustificacionPrescripcion%>'>
</form>
<form name="frmAnalitica" action="<%=request.getContextPath()%>/jsp/pac/prescripcion_ats.jsp?x=<%=strParametroMenu%>" method="post" onSubmit="javascript:pasarAMayusculas(this.nombre)">
<input type="hidden" name="nombreTextBox" value="<%=strTextBox%>">
<table border="0" align="left" width="60%">
<tr>
<td align="left" class="txtNegrita"><%=pertamensaje.obtenerMensaje(45).getMensaje() %></td>
</tr>
<tr>
<td align="left">
<div id="elementos" style="position:relative;top:0px;left:0px;" class="txt"></div>
</td>
</tr>
</table>
<table border="0" align="right">
<tr>
<td>
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td align="left" class="txtNegrita"><%=pertamensaje.obtenerMensaje(46).getMensaje() %>:</td>
</tr>
<tr>
<tr>
<td>
</td>
</tr>
<td align="left">
<textarea name="informe" rows="4" cols="40" class="txt" onkeypress="javascript:return comprobarTamanio()"><%=strInforme%></textarea>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2"><img src="<%=request.getContextPath()%>/img/sp.gif" width="1" height="2" border="0"></td>
</tr>
<tr>
<td colspan="2">
<table border="0" align="center">
<tr>
<td><span class="txtnegrita"><%=pertamensaje.obtenerMensaje(43).getMensaje() %> </span></td>
<td><input type="text" size="50" name="nombre" class="txt"></td>
<td>&nbsp;</td>
<td><a href="javascript:buscar()" class="enlace" name="buscar"><%=pertamensaje.obtenerMensaje(24).getMensaje() %></a></td>
</tr>
</table>
</td>
<input type="hidden" name="pagina" value="1">
<input type="hidden" name="listaElementos" value="">
<input type="hidden" name="listaCodigoElementos" value="">
<input type="hidden" name="unidadesElementosPrescripcion" value="">
<input type="hidden" name="justificacionPrescripcion">
<input type="hidden" name="seleccionGrupo">
</tr>
<%
Paciente pac = (Paciente)sesion.getAttribute("PACIENTE");
long intColectivonew = ((Paciente)sesion.getAttribute("PACIENTE")).getTarjeta().getColectivo();
double dblPolizanew = ((Paciente)sesion.getAttribute("PACIENTE")).getTarjeta().getPoliza();
int intContratonew = ((Paciente)sesion.getAttribute("PACIENTE")).getTarjeta().getContrato();
// en los desplazados que están casados llega aquí sin asignar bien este valor
if(pac.getDesplazado() == null)
pac.setDesplazado(((Paciente)sesion.getAttribute("PACIENTE")).getTarjeta().getEntidadChipcard());
PersistenciaTtactmed per = new PersistenciaTtactmed();
Vector vSeleccion = null;
// LogTarisan.logger.log(NivelLog.ERROR, "Peta por que al pasar la tarjeta de un desplazado \"casado\" no le asigna bien pac.getDesplazado: ");
if(pac.getDesplazado().compareTo(ParametrosConfiguracion.bin_chipcard_propios) == 0)
{
vSeleccion= per.obtenerActosPorEspecialidad(intPagina, 50,intContratonew,intColectivonew,dblPolizanew, strCampoNombre, 0);
}
else
{
LogTarisan.logger.log(NivelLog.DEBUG, ((Usuario)sesion.getAttribute("USUARIO")).getMedico() + " - Obtener todos los actos, es desplazado");
vSeleccion= per.obtenerActosPorEspecialidad(intPagina, 50, strCampoNombre, 0);
}
if (vSeleccion.size()==0) //No se han encontrado datos
{
%>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2" align="center"><span class="txt"><% tamensaje = pertamensaje.obtenerMensaje(10); %><%=tamensaje.getMensaje() %></span></td>
</tr>
<%
}
else
{
if (intPagina != 0){ //se tiene en cuenta la paginacion
%>
<tr>
<td colspan="2" align="right"><span class="txt">Página <%=per.getPaginacion().getNumeroPagina()%> de <%=per.getPaginacion().getNumeroPaginasTotales()%></span></td>
</tr>
<%
}
%>
<!-- Para saber cuantas checkbox tenemos en la pagina y poder hacer la anulacion de las selecciones -->
<script language="javascript" type="text/javascript">
<!--
intNumeroCheckBoxes = <%=vSeleccion.size()%>
//-->
</script>
<tr>
<td width="1%"></td>
<td class="cabeceraTabla" align="center" bgcolor="#FFAAAA"><%=pertamensaje.obtenerMensaje(41).getMensaje() %></td><td class="cabeceraTabla" align="center" bgcolor="#FFAAAA">Unidades</td>
</tr>
<%
Ttactmed ttactmed = null;
String estilo = "";
String strDescripcionSinComilla="";
for(i = 0; i < vSeleccion.size(); i++)
{
if (i % 2 == 0)
{
estilo = "filaA";
}
else
{
estilo = "filaB";
}
ttactmed = (Ttactmed)vSeleccion.elementAt(i);
//hacemos el tratamiento por si viene comilla simple en la descripcion
strDescripcionSinComilla = ttactmed.getDescripcion().replace('\'', '~');
%>
<tr class="trResultados">
<%
if (strListaElementos.indexOf("¬" + ttactmed.getDescripcion() + "¬")!=-1)
{
%>
<td><input type="checkbox" name="checkbox<%=i%>" value='<%=strDescripcionSinComilla%>' checked="checked" onclick="javascript:tratarCheckBox(this, <%=ttactmed.getActo()%>, 'unidades<%=ttactmed.getActo()%>')"></td>
<%
}
else
{
%>
<td><input type="checkbox" name="checkbox<%=i%>" value='<%=strDescripcionSinComilla%>' onclick="javascript:tratarCheckBox(this, <%=ttactmed.getActo()%>, 'unidades<%=ttactmed.getActo()%>')"></td>
<%
}
%>
<td class="<%=estilo%>" align="left"><%=ttactmed.getDescripcion()%></td>
<%
if (ttactmed.getActo()==6000 || ttactmed.getActo()==6001 || ttactmed.getActo()==6002 || ttactmed.getActo()==6003){%>
<td class="<%=estilo %>" align="left"><input type="text" name="unidades" id="unidades<%=ttactmed.getActo()%>" size="5" value="1" disabled="true"/></td>
<%
}else{
%>
<td class="<%=estilo %>" align="left"><input type="text" name="unidades" id="unidades<%=ttactmed.getActo()%>" size="5" value=""/></td>
<% }
%>
</tr>
<%
}
//if (request.getParameter("nombreTextBox")!=null)//Controlar si hay que poner el focus en algun textbox
if (strTextBox!="")//Controlar si hay que poner el focus en algun textbox
{
%>
<script language="javascript" type="text/javascript">
document.frmAnalitica.<%=strTextBox%>.focus();
setTimeout(function(){ document.frmAnalitica.<%=strTextBox%>.style.backgroundColor = "#FFAAAA"; }, 500);
setTimeout(function(){ document.frmAnalitica.<%=strTextBox%>.style.backgroundColor = "white"; }, 1000);
setTimeout(function(){ document.frmAnalitica.<%=strTextBox%>.style.backgroundColor = "#FFAAAA"; }, 1500);
setTimeout(function(){ document.frmAnalitica.<%=strTextBox%>.style.backgroundColor = "white"; }, 2000);
setTimeout(function(){ document.frmAnalitica.<%=strTextBox%>.style.backgroundColor = "#FFAAAA"; }, 2500);
setTimeout(function(){ document.frmAnalitica.<%=strTextBox%>.style.backgroundColor = "white"; }, 3000);
document.frmAnalitica.nombreTextBox.value="";
</script>
<%
strTextBox="";
}
%>
</form>
<% if (intPagina!=0){ //se tiene en cuenta la paginacion %>
<tr><td colspan="2"></td></tr>
<tr>
<td colspan="2">
<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">ú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">último</a></td>
<%}%>
</tr>
</table>
</td>
</tr>
<%
} //fin if(pagina!=0)
%>
<%
} //fin else (vSeleccion.size()!=0)
}
%>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<form name="frmImprimirPeticion" action="<%=request.getContextPath()%>/servlet/GestorPacientes" target="blank" method="post" style="width:50%;margin-bottom: 0px">
<input type="hidden" name="tipo" value="7"/>
<input type="hidden" name="nombrePDF" value="" />
<input type="hidden" name="OPCION" value="<%=Constantes.OPC_PAC_VER_PDF%>">
</form>
</body>
</html>
<script>
var jsMostrarNoticia = <%=mostrarNoticia %>;
if (!jsMostrarNoticia){
document.getElementById('contenedorNoticia').style.display="none";
}else{
<% strNoticia = strNoticia.replaceAll("\"", "'"); %>
var not = "<%=strNoticia %>";
tamanioNoticia(not);
marquee($('.tituloNoticia'), $('.marquee'),not);
}
</script>
<%
}
catch(ExcepcionTarisan ex)
{
LogTarisan.logger.log(NivelLog.ERROR, ((Usuario)sesion.getAttribute("USUARIO")).getMedico() + " - ExcepcionTarisan: " + ex.getMensaje());
sesion.setAttribute("ERROR", "Error en la presentación de la página al usuario.");
response.sendRedirect(request.getContextPath() + "/jsp/error.jsp");
}
catch(Exception ex)
{
LogTarisan.logger.log(NivelLog.ERROR, ((Usuario)sesion.getAttribute("USUARIO")).getMedico() + " - Exception: " + ex);
sesion.setAttribute("ERROR", "Error en la presentación de la página al usuario.");
response.sendRedirect(request.getContextPath() + "/jsp/error.jsp");
}
LogTarisan.logger.log(NivelLog.INFO, ((Usuario)sesion.getAttribute("USUARIO")).getMedico() + " - Final página de prescripcion ats (pac/prescripcion_ats.jsp)");
}
%>