Añado los fuentes de java
This commit is contained in:
@@ -0,0 +1,123 @@
|
||||
/**
|
||||
* @(#) Constantes.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
/**
|
||||
* Interface que contiene las constantes de uso en la aplicación Tarisan.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
|
||||
public interface Constantes
|
||||
{
|
||||
//Módulo de Gestión de Médicos
|
||||
final static int OPC_MED_GESTOR = 0;
|
||||
final static int OPC_MED_CABECERA = 1;
|
||||
final static int OPC_MED_PASSWORD = 2;
|
||||
final static int OPC_MED_ACTOS = 3;
|
||||
final static int OPC_MED_LIQUIDACION = 4;
|
||||
final static int OPC_MED_PACIENTES = 5;
|
||||
final static int OPC_MED_IRPF = 6;
|
||||
final static int OPC_MED_MEDICAMENTOS = 7;
|
||||
final static int OPC_MED_PRESCRIPCIONES = 8;
|
||||
final static int OPC_MED_ANALISIS = 9;
|
||||
final static int OPC_MED_IGUALADOS = 10;
|
||||
final static int OPC_MED_ACTUALIZAR_CABECERA = 11;
|
||||
final static int OPC_MED_ACTUALIZAR_PASSWORD = 12;
|
||||
final static int OPC_MED_PREAVISO = 13;
|
||||
final static int OPC_MED_ACTUALIZAR_ACCESO = 14;
|
||||
final static int OPC_MED_REGISTRAR_LOG_ANALISIS = 15;
|
||||
final static int OPC_MED_DETALLE_PACIENTE = 20;
|
||||
final static int OPC_MED_IMPRIMIR_PETICIONES = 21;
|
||||
final static int OPC_MED_PETICION_CAPTURADA = 32;
|
||||
final static int OPC_MED_GENERAR_DETALLE_IRPF = 16;
|
||||
final static int OPC_MED_ENVIAR_EMAIL = 17;
|
||||
|
||||
//Módulo de Gestión de Pacientes
|
||||
final static int OPC_PAC_GESTOR = 0;
|
||||
final static int OPC_PAC_FACTURACION = 1;
|
||||
final static int OPC_PAC_AUTORIZACION = 2;
|
||||
final static int OPC_PAC_ANALITICA = 3;
|
||||
final static int OPC_PAC_DIAGNOSTICO = 4;
|
||||
final static int OPC_PAC_ESPECIALIDADES = 5;
|
||||
final static int OPC_PAC_RECETAS = 6;
|
||||
final static int OPC_PAC_HISTORIA = 7;
|
||||
final static int OPC_PAC_ANALISTA = 8;
|
||||
final static int OPC_PAC_PASO_TARJETA = 9;
|
||||
final static int OPC_PAC_ACTUALIZAR_HISTORIA_PACIENTE = 10;
|
||||
final static int OPC_PAC_PRESCRIPCION_ESPECIALIDADES = 11;
|
||||
final static int OPC_PAC_PRESCRIPCION_DIAGNOSTICO = 12;
|
||||
final static int OPC_PAC_PRESCRIPCION_FACTURACION = 13;
|
||||
final static int OPC_PAC_FACTURACION_REHABPOD = 21;
|
||||
final static int OPC_PAC_PRESCRIPCION_ANALITICA = 14;
|
||||
final static int OPC_PAC_PETICION_AUTORIZACION = 15;
|
||||
final static int OPC_PAC_FIRMA_BENEFICIARIO = 16;
|
||||
final static int OPC_PAC_ANALISTA_ACEPTAR_ANALISIS = 17;
|
||||
final static int OPC_PAC_REGISTRAR_LOG_ANALISIS = 18;
|
||||
final static int OPC_PAC_PRESCRIPCION_RECETAS = 19;
|
||||
final static int OPC_PAC_LEER_NUMERO_TARJETA_ATS = 22;
|
||||
final static int OPC_PAC_FACTURACION_CHIPCARD = 23;
|
||||
final static int OPC_PAC_VOLANTE_INGRESO = 24;
|
||||
final static int OPC_PAC_IMPRIMIR_VOLANTE_INGRESO = 25;
|
||||
final static int OPC_PAC_BORRAR_VOLANTE_INGRESO = 26;
|
||||
final static int OPC_PAC_PRESCRIPCION_ATS = 27;
|
||||
final static int OPC_PAC_FACTURACION_ODON = 28;
|
||||
final static int OPC_PAC_PRESCRIPCION_FACTURACION_ODON = 29;
|
||||
final static int OPC_PAC_PRESCRIPCION_FACTURACION_ESTOMATOLOGIA = 30;
|
||||
final static int OPC_PAC_FACTURACION_ESTOMATOLOGIA = 31;
|
||||
final static int OPC_PAC_DETALLE_PACIENTE = 32;
|
||||
final static int OPC_PAC_PRESCRIPCION_ANATOMIA_PATOLOGICA = 33;
|
||||
final static int OPC_PAC_VER_PDF = 34;
|
||||
final static int OPC_PAC_RADIOLOGO = 35;
|
||||
final static int OPC_PAC_ANALISTA_ACEPTAR_RADIODIAGNOSTICO = 36;
|
||||
|
||||
|
||||
|
||||
//Módulo de Administración
|
||||
final static int OPC_ADM_USUARIO_LISTA = 1;
|
||||
final static int OPC_ADM_USUARIO_DETALLE = 2;
|
||||
final static int OPC_ADM_PASSWORD = 3;
|
||||
final static int OPC_ADM_ACT_AUTORIZACION = 4;
|
||||
final static int OPC_ADM_GES_NIVELES_ESPE = 5;
|
||||
final static int OPC_ADM_GES_ACT_VISIBILI = 6;
|
||||
final static int OPC_ADM_GES_NIVELES_ACT = 7;
|
||||
final static int OPC_ADM_GES_ACT_NIVEL_ACTO = 8;
|
||||
final static int OPC_ADM_MOSTRAR_LOG = 9;
|
||||
|
||||
|
||||
|
||||
//Perfiles de la aplicación
|
||||
final static String PERFIL_ADMINISTRADOR = "00";
|
||||
final static String PERFIL_CABECERA = "01";
|
||||
final static String PERFIL_ANALISTA = "02";
|
||||
final static String PERFIL_ESPECIALISTA = "03";
|
||||
final static String PERFIL_REHABPOD = "04";
|
||||
final static String PERFIL_ATS = "05";
|
||||
final static String PERFIL_DENTISTA = "06";
|
||||
final static String PERFIL_ODONTOLOGIA = "07";
|
||||
final static String PERFIL_RADIOLOGO= "08";
|
||||
|
||||
|
||||
//Control de acceso de usuarios y autenticación
|
||||
final static Integer USUARIO_VALIDO = Integer.valueOf(0);
|
||||
final static Integer USUARIO_BLOQUEADO = Integer.valueOf(1);
|
||||
final static Integer USUARIO_CADUCADO = Integer.valueOf(2);
|
||||
final static Integer USUARIO_PREAVISO = Integer.valueOf(3);
|
||||
final static Integer USUARIO_INACTIVO = Integer.valueOf(4);
|
||||
final static Integer USUARIO_INEXISTENTE = Integer.valueOf(5);
|
||||
final static Integer USUARIO_ACCESO = Integer.valueOf(6);
|
||||
final static Integer USUARIO_INTENTOS = Integer.valueOf(7);
|
||||
final static Integer USUARIO_ERROR_CLAVE = Integer.valueOf(8);
|
||||
|
||||
//Control de la validez de tarjetas de pacientes
|
||||
final static Integer TARJETA_VALIDA = Integer.valueOf(0);
|
||||
final static Integer TARJETA_CADUCADA = Integer.valueOf(1);
|
||||
final static Integer TARJETA_BAJA = Integer.valueOf(2);
|
||||
final static Integer TARJETA_SUSPENSO = Integer.valueOf(3);
|
||||
final static Integer TARJETA_AUTORIZACION = Integer.valueOf(4);
|
||||
final static Integer TARJETA_FIRMA_AUTORIZACION = Integer.valueOf(5);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.tarisan.control;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.activation.DataHandler;
|
||||
// import javax.activation.DataSource;
|
||||
import javax.activation.FileDataSource;
|
||||
import jakarta.mail.BodyPart;
|
||||
import jakarta.mail.Message;
|
||||
import jakarta.mail.Multipart;
|
||||
import jakarta.mail.Session;
|
||||
import jakarta.mail.Transport;
|
||||
import jakarta.mail.internet.InternetAddress;
|
||||
import jakarta.mail.internet.MimeBodyPart;
|
||||
import jakarta.mail.internet.MimeMessage;
|
||||
import jakarta.mail.internet.MimeMultipart;
|
||||
|
||||
import com.tarisan.log.LogTarisan;
|
||||
import com.tarisan.log.NivelLog;
|
||||
// import com.sun.mail.util.MessageRemovedIOException;
|
||||
|
||||
public class JavaMail {
|
||||
|
||||
public static void main(String[] args) {
|
||||
/*JavaMail javaMail = new JavaMail();
|
||||
javaMail.mandarCorreo(mensaje,tarjeta); */
|
||||
}
|
||||
|
||||
public void mandarCorreo(String mensaje, String tarjeta, String email, String asunto, String nombreAdjuntos) {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "com.tarisan.servlets/JavaMail -- mandarCorreo("+mensaje+","+tarjeta+","+email+","+asunto+","+nombreAdjuntos);
|
||||
|
||||
// El correo de envío
|
||||
String correoEnvia = "sistemas@imqnavarra.com";
|
||||
String claveCorreo = "s1st3masacc17";
|
||||
|
||||
// La configuración para enviar correo
|
||||
Properties properties = new Properties();
|
||||
properties.put("mail.smtp.host", "smtp.imqnavarra.com");
|
||||
properties.put("mail.smtp.starttls.enable", "true");
|
||||
properties.put("mail.smtp.port", "587");
|
||||
properties.put("mail.smtp.auth", "true");
|
||||
properties.put("mail.user", correoEnvia);
|
||||
properties.put("mail.password", claveCorreo);
|
||||
properties.put("mail.debug", "true"); //para que nos muestre en detalle el proceso
|
||||
|
||||
// Obtener la sesion
|
||||
Session session = Session.getInstance(properties, null);
|
||||
|
||||
try {
|
||||
// Crear el cuerpo del mensaje
|
||||
MimeMessage mimeMessage = new MimeMessage(session);
|
||||
|
||||
// Agregar quien envía el correo
|
||||
//mimeMessage.setFrom(new InternetAddress(correoEnvia, "sistemas"));
|
||||
mimeMessage.setFrom(new InternetAddress(email));
|
||||
|
||||
// Los destinatarios
|
||||
InternetAddress[] internetAddresses = {
|
||||
new InternetAddress("soporte_tarisan@imqnavarra.com")};/*,
|
||||
new InternetAddress("david.andueza@imqnavarra.com"),
|
||||
new InternetAddress("sistemas@imqnavarra.com") };*/
|
||||
|
||||
// Agregar los destinatarios al mensaje
|
||||
mimeMessage.setRecipients(Message.RecipientType.TO,
|
||||
internetAddresses);
|
||||
|
||||
// Agregar el asunto al correo
|
||||
mimeMessage.setSubject(asunto);
|
||||
|
||||
// Creo la parte del mensaje
|
||||
String mensajeCompleto = "";
|
||||
if (tarjeta!=null && tarjeta.compareTo("")!=0){
|
||||
tarjeta = tarjeta.replace("()", "%");
|
||||
mensajeCompleto = mensaje+"\n\n\nTARJETA: "+tarjeta;
|
||||
}else{
|
||||
mensajeCompleto = mensaje;
|
||||
}
|
||||
|
||||
MimeBodyPart mimeBodyPart = new MimeBodyPart();
|
||||
mimeBodyPart.setText(mensajeCompleto);
|
||||
|
||||
// Crear el multipart para agregar la parte del mensaje anterior
|
||||
Multipart multipart = new MimeMultipart();
|
||||
multipart.addBodyPart(mimeBodyPart);
|
||||
|
||||
// Creo la parte del archivo adjunto
|
||||
BodyPart adjuntoBodyPart = new MimeBodyPart();
|
||||
|
||||
if( nombreAdjuntos!=null && nombreAdjuntos.length()>0 ){
|
||||
String[] partes = nombreAdjuntos.split("--");
|
||||
for (int x=0; x < partes.length ; x++) {
|
||||
String rutaAdjunto = partes[x];
|
||||
adjuntoBodyPart = new MimeBodyPart();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Ruta de adjunto "+x+": " + ParametrosConfiguracion.ruta_adjuntos+rutaAdjunto);
|
||||
File f = new File(ParametrosConfiguracion.ruta_adjuntos+rutaAdjunto);
|
||||
if( f.exists() ){
|
||||
adjuntoBodyPart.setDataHandler(new DataHandler(new FileDataSource(ParametrosConfiguracion.ruta_adjuntos+"/"+rutaAdjunto)));
|
||||
adjuntoBodyPart.setFileName( f.getName() );
|
||||
multipart.addBodyPart(adjuntoBodyPart);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Agregar el multipart al cuerpo del mensaje
|
||||
mimeMessage.setContent(multipart);
|
||||
|
||||
// Enviar el mensaje
|
||||
Transport transport = session.getTransport("smtp");
|
||||
transport.connect(correoEnvia, claveCorreo);
|
||||
transport.sendMessage(mimeMessage, mimeMessage.getAllRecipients());
|
||||
transport.close();
|
||||
|
||||
} catch (Exception ex) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al Enviar el Correo");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Correo Enviado");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
/**
|
||||
* @(#) Paginacion.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
import com.tarisan.log.*;
|
||||
import java.sql.*;
|
||||
|
||||
/**
|
||||
* Clase de apoyo utilizada para realizar la paginación de los datos.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 29/09/2003
|
||||
*/
|
||||
|
||||
public class Paginacion
|
||||
{
|
||||
|
||||
/**
|
||||
* Número de página que se le presenta al usuario.
|
||||
*/
|
||||
private int intNumPagina=0;
|
||||
|
||||
/**
|
||||
* Número de páginas totales de las que está compuesta la consulta realizada por el usuario.
|
||||
* <br>Este valor se calcula utulizando el número de filas por página.
|
||||
*/
|
||||
private int intNumPaginasTotales=0;
|
||||
|
||||
/**
|
||||
* Número de registros totales de los que está compuesta la consulta realizada por el usuario.
|
||||
*/
|
||||
private int intNumRegistrosTotales=0;
|
||||
|
||||
/**
|
||||
* Número de filas por página que se le van a mostrar al usuario.
|
||||
* <br>Este atributo se inicializa cuando se arranca el servidor de aplicaciones.
|
||||
* <br>El valor de este atributo se coge del fichero properties.
|
||||
*/
|
||||
private static int intFilasPorPagina;
|
||||
|
||||
|
||||
/**
|
||||
* Establece en un atributo de la clase el número de filas por página.
|
||||
* @param filasPorPagina Entero que indica el número de filas por pagina.
|
||||
*/
|
||||
public static void setFilasPorPagina(int filasPorPagina)
|
||||
{
|
||||
intFilasPorPagina = filasPorPagina;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtiene el número de filas por página utilizados en la paginación.
|
||||
* @return Valor numérico que indica el número de filas por página.
|
||||
*/
|
||||
public static int getFilasPorPagina()
|
||||
{
|
||||
return intFilasPorPagina;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtiene el número de página que se le presenta al usuario.
|
||||
* @return Valor numérico que indica el número de página actual.
|
||||
*/
|
||||
public int getNumeroPagina()
|
||||
{
|
||||
return intNumPagina;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Establece en un atributo de la clase el número de la página actual que se le presenta al usuario.
|
||||
* @param numeroPagina Entero que indica el número de pagina.
|
||||
*/
|
||||
public void setNumeroPagina(int numeroPagina)
|
||||
{
|
||||
intNumPagina=numeroPagina;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtiene el número de páginas totales.
|
||||
* @return Valor numérico que indica el número de páginas totales.
|
||||
*/
|
||||
public int getNumeroPaginasTotales()
|
||||
{
|
||||
return intNumPaginasTotales;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtiene el número de registros totales.
|
||||
* @return Valor numérico que indica el número de registros totales.
|
||||
*/
|
||||
public int getNumeroRegistrosTotales()
|
||||
{
|
||||
return intNumRegistrosTotales;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inicializa el objeto <code>Paginacion</code> para su uso.
|
||||
* @param rs Objeto <code>ResultSet</code> que contiene los datos de la consulta realizada por el usuario.
|
||||
*/
|
||||
public void inicializarPaginacion(ResultSet rs) throws ExcepcionTarisan
|
||||
{
|
||||
try
|
||||
{
|
||||
rs.last();
|
||||
intNumRegistrosTotales = rs.getRow();
|
||||
rs.beforeFirst();
|
||||
intNumPaginasTotales = intNumRegistrosTotales / intFilasPorPagina;
|
||||
|
||||
if (intNumRegistrosTotales % intFilasPorPagina != 0)
|
||||
intNumPaginasTotales++;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al inicializar la paginacion: " + e);
|
||||
throw new ExcepcionTarisan(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Realiza la paginación de los datos obtenidos. Consiste en posicionarse en el
|
||||
* registro correspondiente a la página que el usuario desea consultar sobre el objeto <code>ResultSet</code>.
|
||||
* @param rs Objeto <code>ResultSet</code> que contiene los datos de la consulta realizada por el usuario.
|
||||
* @param pagina Entero que nos indica la página que el usuario desea visualizar.
|
||||
*/
|
||||
public void realizarPaginacion(ResultSet rs, int pagina) throws ExcepcionTarisan
|
||||
{
|
||||
int posicion;
|
||||
|
||||
try
|
||||
{
|
||||
if (pagina!=0 && intNumRegistrosTotales!=0)
|
||||
{
|
||||
posicion = ((pagina - 1) * intFilasPorPagina);
|
||||
if (posicion == 0)
|
||||
rs.beforeFirst();
|
||||
else
|
||||
rs.absolute(posicion);
|
||||
|
||||
intNumPagina = pagina;
|
||||
}
|
||||
else
|
||||
intNumPagina = 0;
|
||||
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al realizar la paginacion: " + e);
|
||||
throw new ExcepcionTarisan(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Indica si la página cargada se trata de la última página.
|
||||
* @return Valor booleano que indica si es la última página.
|
||||
*/
|
||||
public boolean esUltimaPagina()
|
||||
{
|
||||
return (intNumPagina == intNumPaginasTotales);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indica si la página cargada se trata de la primera página.
|
||||
* @return Valor booleano que indica si es la primera página.
|
||||
*/
|
||||
public boolean esPrimeraPagina()
|
||||
{
|
||||
return (intNumPagina == 1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,793 @@
|
||||
/**
|
||||
* @(#) ParametrosConfiguracion.java
|
||||
*/
|
||||
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.log.*;
|
||||
//import com.tarisan.control.Constantes; Elimino el import que nunca se usa
|
||||
import com.tarisan.persistencia.DataStore;
|
||||
import com.tarisan.persistencia.PersistenciaParametros;
|
||||
import com.tarisan.util.Utilidades;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.PropertyResourceBundle;
|
||||
import java.util.Hashtable;
|
||||
|
||||
/**
|
||||
* Contiene atributos de clase con los parámetros de configuración de la aplicación.
|
||||
* <br>
|
||||
* Dichos parámetros se leen de un fichero de propiedades.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class ParametrosConfiguracion
|
||||
{
|
||||
/**
|
||||
* Nombre del fichero de propiedades de la aplicación Tarisan (con extensión .properties).
|
||||
*/
|
||||
private static final String NOMBRE_PROPIEDADES = "tarisan";
|
||||
|
||||
private static final String PROP_VISUAL_DECIMALES = "VISUAL.decimales";
|
||||
private static final String PROP_VISUAL_FORMATO_FECHAS = "VISUAL.formato_fechas";
|
||||
|
||||
private static final String PROP_IMP_CIUDAD = "IMP.ciudad";
|
||||
|
||||
private static final String PROP_PAC_PERIODO_ANALISIS = "PAC.periodo_analisis";
|
||||
private static final String PROP_PAC_PERIODO_RX = "PAC.periodo_rx";
|
||||
private static final String PROP_PAC_CODIGO_PRIMERA_VISITA = "PAC.codigo_primera_visita";
|
||||
private static final String PROP_PAC_CODIGO_PRIMERA_LIMPIEZA = "PAC.codigo_primera_limpieza";
|
||||
private static final String PROP_PAC_CODIGO_VISITA_SUCESIVA = "PAC.codigo_visita_sucesiva";
|
||||
private static final String PROP_PAC_CODIGO_IGUALAS = "PAC.codigo_igualas";
|
||||
private static final String PROP_PAC_ANALITICAS = "PAC.analisis";
|
||||
private static final String PROP_PAC_RADIODIAGNOSTICO = "PAC.radiodiag";
|
||||
private static final String PROP_PAC_PERIODO_PRIMERA_VISITA = "PAC.periodo_primera_visita";
|
||||
private static final String PROP_PAC_PERIODO_PRIMERA_VISITA_CHIPCARD = "PAC.periodo_primera_visita_chipcard";
|
||||
private static final String PROP_PAC_PERIODO_NATURAL = "PAC.periodo_natural";
|
||||
private static final String PROP_PAC_AUTORIZACION = "PAC.autorizacion";
|
||||
private static final String PROP_PAC_RUTA_PDF_RESULTADOS = "PAC.ruta_pdf_resultados";
|
||||
private static final String PROP_PAC_RUTA_PDF_RESULTADOS_ANALITICAS = "PAC.ruta_pdf_resultados_analiticas";
|
||||
private static final String PROP_PAC_RUTA_PDF_RESULTADOS_ANATOMIA_CSM = "PAC.ruta_pdf_resultados_anatomia_CSM";
|
||||
private static final String PROP_PAC_RUTA_PDF_RESULTADOS_ANATOMIA = "PAC.ruta_pdf_resultados_anatomia";
|
||||
private static final String PROP_PAC_RUTA_PDF = "PAC.ruta_pdf";
|
||||
private static final String PROP_PAC_RUTA_LOGOTIPOS = "PAC.ruta_logotipos";
|
||||
private static final String PROP_PAC_RUTA_ADJUNTOS = "PAC.ruta_adjuntos";
|
||||
private static final String PROP_PAC_RUTA_PDF_INFORMES_RX = "PAC.ruta_pdf_informes_rx";
|
||||
private static final String PROP_PAC_RUTA_PDF_PETICIONES_ANALITICAS = "PAC.ruta_pdf_peticiones_analiticas";
|
||||
private static final String PROP_PAC_RUTA_PDF_PETICIONES_ANALITICAS_CAPTURADAS = "PAC.ruta_pdf_peticiones_analiticas_capturadas";
|
||||
private static final String PROP_PAC_RUTA_PDF_PETICIONES_RX_CAPTURADOS = "PAC.ruta_pdf_peticiones_rx_capturados";
|
||||
private static final String PROP_PAC_RUTA_PDF_PETICIONES_DETALLE_PACIENTES = "PAC.ruta_pdf_peticiones_detalle_pacientes";
|
||||
private static final String PROP_PAC_RUTA_PDF_PETICIONES_FACTURAS = "PAC.ruta_pdf_peticiones_facturas";
|
||||
private static final String PROP_PAC_RUTA_PDF_PETICIONES_INGRESOS = "PAC.ruta_pdf_peticiones_ingresos";
|
||||
private static final String PROP_PAC_RUTA_PDF_PETICIONES_RECETAS = "PAC.ruta_pdf_peticiones_recetas";
|
||||
private static final String PROP_PAC_RUTA_PDF_PETICIONES_AP = "PAC.ruta_pdf_peticiones_ap";
|
||||
private static final String PROP_PAC_RUTA_PDF_PETICIONES_ATS = "PAC.ruta_pdf_peticiones_ats";
|
||||
private static final String PROP_PAC_RUTA_PDF_PETICIONES_AUTORIZACIONES = "PAC.ruta_pdf_peticiones_autorizaciones";
|
||||
private static final String PROP_PAC_RUTA_PDF_PETICIONES_ESPECIALIDADES = "PAC.ruta_pdf_peticiones_especialidades";
|
||||
private static final String PROP_PAC_RUTA_PDF_PETICIONES_RX = "PAC.ruta_pdf_peticiones_rx";
|
||||
private static final String PROP_PAC_RUTA_PDF_PETICIONES = "PAC.ruta_pdf_peticiones";
|
||||
private static final String PROP_PAC_RUTA_PDF_LIQUIDACIONES = "PAC.ruta_pdf_liquidaciones";
|
||||
private static final String PROP_PAC_RUTA_PDF_IRPF = "PAC.ruta_pdf_irpf";
|
||||
private static final String PROP_PAC_RUTA_PDF_FRANQUICIAS = "PAC.ruta_pdf_franquicias";
|
||||
private static final String PROP_PAC_RUTA_IMG = "PAC.ruta_img";
|
||||
private static final String PROP_PAC_CONTRATO_DENTAL = "PAC.contrato_dental";
|
||||
private static final String PROP_PAC_SALUD_CON_COBERTURA_DENTAL = "PAC.salud_con_cobertura_dental";
|
||||
|
||||
private static final String PROP_LOG_FICHERO = "LOG.nombre_fichero";
|
||||
private static final String PROP_LOG_PATH = "LOG.path_fichero";
|
||||
private static final String PROP_LOG_TAMANO = "LOG.tamano_fichero";
|
||||
private static final String PROP_LOG_NUMERO = "LOG.numero_ficheros";
|
||||
private static final String PROP_LOG_NIVEL = "LOG.nivel";
|
||||
|
||||
private static final String PROP_LOG_CONTROL_MEDICOS = "LOG.control_medicos";
|
||||
|
||||
private static final String PROP_DB_DATASTORE = "DB.data_store";
|
||||
private static final String PROP_DB_USUARIO = "DB.usuario";
|
||||
private static final String PROP_DB_PASSWORD = "DB.password";
|
||||
private static final String PROP_DB_MAQUINA = "DB.maquina";
|
||||
private static final String PROP_DB_MAQUINA2 = "DB.maquina2";
|
||||
private static final String PROP_DB_PUERTO = "DB.puerto";
|
||||
private static final String PROP_DB_INSTANCIA = "DB.instancia";
|
||||
private static final String PROP_DB_DATASOURCE = "DB.data_source";
|
||||
private static final String PROP_DB_TIPO_SERVIDOR = "DB.tipo_servidor";
|
||||
|
||||
private static final String PROP_PAG_FILAS_PAGINACION = "PAG.filas_paginacion";
|
||||
|
||||
private static final String PROP_CLAVE_DIAS_ACTIVIDAD = "CLAVE.dias_actividad";
|
||||
private static final String PROP_CLAVE_DIAS_CADUCIDAD = "CLAVE.dias_caducidad";
|
||||
private static final String PROP_CLAVE_DIAS_PREAVISO = "CLAVE.dias_preaviso";
|
||||
private static final String PROP_CLAVE_NUMERO_INTENTOS = "CLAVE.numero_intentos";
|
||||
|
||||
/*
|
||||
* RAYOS.usuario = fidoate
|
||||
* RAYOS.clave = fidoate
|
||||
* RAYOS.server = gimli.grupoimq.local
|
||||
*/
|
||||
private static final String PROP_RAYOS_USUARIO = "RAYOS.usuario";
|
||||
private static final String PROP_RAYOS_CLAVE = "RAYOS.clave";
|
||||
private static final String PROP_RAYOS_SERVER = "RAYOS.server";
|
||||
|
||||
//private static final String PROP_RUTA_PDFS = "PAC.ruta_pdf";
|
||||
|
||||
//Propiedades para las conexiones con chipcard
|
||||
|
||||
private static final String PROP_CHIPCARD_LOGIN = "CHIPCARD.login";
|
||||
private static final String PROP_CHIPCARD_PASS = "CHIPCARD.password";
|
||||
private static final String PROP_CHIPCARD_TERMINAL = "CHIPCARD.terminal";
|
||||
private static final String PROP_CHIPCARD_PROFESIONAL = "CHIPCARD.profesional";
|
||||
private static final String PROP_CHIPCARD_URL = "CHIPCARD.webservice";
|
||||
private static final String PROP_CHIPCARD_COMPANY = "CHIPCARD.comp_verify_card";
|
||||
private static final String PROP_CHIPCARD_BIN_PROPIOS = "CHIPCARD.bin_propios";
|
||||
private static final String PROP_CHIPCARD_BIN_DKV = "CHIPCARD.bin_dkv";
|
||||
private static final String PROP_CHIPCARD_BIN_ADESLAS = "CHIPCARD.bin_adeslas";
|
||||
private static final String PROP_CHIPCARD_BIN_SANITAS = "CHIPCARD.bin_sanitas";
|
||||
private static final String PROP_CHIPCARD_BIN_IMQBILBO = "CHIPCARD.bin_imqbilbo";
|
||||
private static final String PROP_CHIPCARD_BIN_HNA = "CHIPCARD.bin_hna";
|
||||
private static final String PROP_REDSA_BIN_ASISA = "REDSA.bin_asisa";
|
||||
private static final String PROP_CHIPCARD_LISTA = "CHIPCARD.list_verify_card";
|
||||
private static final String PROP_CHIPCARD_AUTO = "CHIPCARD.operativa_autorizada";
|
||||
private static final String PROP_CHIPCARD_DENY = "CHIPCARD.operativa_denegada";
|
||||
|
||||
//conexion al his para generar los pdfs de resultados de analiticas de izasa
|
||||
|
||||
private static final String PROP_DBHIS_USUARIO = "DBHIS.usuario";
|
||||
private static final String PROP_DBHIS_PASSWORD ="DBHIS.password";
|
||||
private static final String PROP_DBHIS_MAQUINA = "DBHIS.maquina";
|
||||
private static final String PROP_DBHIS_PUERTO = "DBHIS.puerto";
|
||||
private static final String PROP_DBHIS_INSTANCIA = "DBHIS.instancia";
|
||||
private static final String PROP_DBHIS_DATASOURCE = "DBHIS.data_source";
|
||||
private static final String PROP_DBHIS_TIPO_SERVIDOR ="DBHIS.tipo_servidor";
|
||||
|
||||
//actos de la especialidad ATS (50) que funcionan como curas, para que no reste las sesiones y solo permita durante un mes
|
||||
//(acto == 6000 || acto == 6001 || acto == 6002 || acto <= 6003)
|
||||
private static final String PROP_ACTOS_ATS_CURA = "ATS.actos_cura";
|
||||
|
||||
|
||||
//BEGIN MODIFICADO por ROUMEN ROUMENOV 15/06/2005
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static Hashtable tablaPerfiles = new Hashtable();
|
||||
//END
|
||||
|
||||
/**
|
||||
* DataStore utilizado en la conexión a base de datos.
|
||||
*/
|
||||
public static DataStore dataStore;
|
||||
|
||||
/**
|
||||
* Ciudad en la que se esta utilizando la aplicación. Este valor será utilizado a la hora de realizar las impresiones de los documentos.
|
||||
*/
|
||||
public static String ciudad;
|
||||
|
||||
/**
|
||||
* Usuario que inicia sesión en el servidor pacs para ver los resultados del diagnóstico por la imagen.
|
||||
*/
|
||||
public static String usuario_pacs;
|
||||
|
||||
/**
|
||||
* Clave del usuario que inicia sesión en el servidor pacs para ver los resultados del diagnóstico por la imagen.
|
||||
*/
|
||||
public static String clave_usuario_pacs;
|
||||
|
||||
/**
|
||||
* Servidor pacs para ver los resultados del diagnóstico por la imagen.
|
||||
*/
|
||||
public static String server_pacs;
|
||||
|
||||
/**
|
||||
* Valor que indica el periodo, en meses, de los analisis que se van a mostrar al usuario.
|
||||
*/
|
||||
public static int periodoAnalisis;
|
||||
|
||||
/**
|
||||
* Valor que indica el periodo, en meses, de los radio diagnósticos que se van a mostrar al usuario.
|
||||
*/
|
||||
public static int periodoRx;
|
||||
|
||||
|
||||
/**
|
||||
* Codigo del acto medico de PRIMERA VISITA.
|
||||
*/
|
||||
public static int codigoPrimeraVisita;
|
||||
|
||||
/**
|
||||
* Codigo del acto medico de PRIMERA LIMPIEZA DE BOCA.
|
||||
*/
|
||||
public static int codigoPrimeraLimpieza;
|
||||
|
||||
/**
|
||||
* Codigo del acto medico de VISITA SUCESIVA.
|
||||
*/
|
||||
public static int codigoVisitaSucesiva;
|
||||
|
||||
/**
|
||||
* Codigo del acto medico de IGUALAS.
|
||||
*/
|
||||
public static int codigoIgualas;
|
||||
|
||||
/**
|
||||
* Especialidad de analiticas.
|
||||
*/
|
||||
public static int analiticas;
|
||||
|
||||
/**
|
||||
* Especialidad de radiodiagnostico.
|
||||
*/
|
||||
public static int radiodiagnostico;
|
||||
|
||||
/**
|
||||
* Periodo mensual que indica los meses que deben transcurrir para que se considere primera visita.
|
||||
*/
|
||||
public static int periodoPrimeraVisita;
|
||||
|
||||
/**
|
||||
* Periodo mensual que indica los meses que deben transcurrir para que se considere primera visita para los de Chipcard.
|
||||
*/
|
||||
public static int periodoPrimeraVisitaChipcard;
|
||||
|
||||
/**
|
||||
* Valor que indica si se trata de un periodo natural (periodo de enero a diciembre) o no.
|
||||
*/
|
||||
public static String periodoNatural;
|
||||
|
||||
/**
|
||||
* Indicador de solicitud de autorización del paciente.
|
||||
*/
|
||||
public static String autorizacion;
|
||||
|
||||
/**
|
||||
* Ruta para generar los pdf de peticiones, recetas....
|
||||
*/
|
||||
public static String ruta_pdf;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los pdfs de los resultados de anatomia patológica para episodios de CSM
|
||||
*/
|
||||
public static String ruta_pdf_resultados_anatomia_CSM;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los pdfs de los resultados de anatomia patológica propios de TARISAN
|
||||
*/
|
||||
public static String ruta_pdf_resultados_anatomia;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los pdfs de los resultados de las analíticas
|
||||
*/
|
||||
public static String ruta_pdf_resultados_analiticas;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los pdfs de los resultados de analíticas
|
||||
*/
|
||||
public static String ruta_pdf_resultados;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los pdfs de los informes de rayos
|
||||
*/
|
||||
public static String ruta_pdf_informes_rx;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los pdfs de las peticiones de analítica
|
||||
*/
|
||||
public static String ruta_pdf_peticiones_analiticas;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los pdfs de las analíticas capturadas
|
||||
*/
|
||||
public static String ruta_pdf_peticiones_analiticas_capturadas;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los pdfs de los radiodiagnósticos capturados
|
||||
*/
|
||||
public static String ruta_pdf_peticiones_rx_capturados;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los pdfs del detalle de las peticiones de los pacientes vistos por un médico en un día
|
||||
*/
|
||||
public static String ruta_pdf_peticiones_detalle_pacientes;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los pdfs de las peticiones de facturas
|
||||
*/
|
||||
public static String ruta_pdf_peticiones_facturas;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los pdfs de las peticiones de ingresos
|
||||
*/
|
||||
public static String ruta_pdf_peticiones_ingresos;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los pdfs de las peticiones de recetas
|
||||
*/
|
||||
public static String ruta_pdf_peticiones_recetas;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los pdfs de las peticiones de anatomia patologica
|
||||
*/
|
||||
public static String ruta_pdf_peticiones_ap;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los pdfs de peticiones de ats
|
||||
*/
|
||||
public static String ruta_pdf_peticiones_ats;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los pdfs de las peticiones de autorizaciones
|
||||
*/
|
||||
public static String ruta_pdf_peticiones_autorizaciones;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los pdfs de las peticiones de especialidades
|
||||
*/
|
||||
public static String ruta_pdf_peticiones_especialidades;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los pdfs de las peticiones de rayos
|
||||
*/
|
||||
public static String ruta_pdf_peticiones_rx;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los pdfs de las peticiones "viejas" (a partir de Febrero de 2016)
|
||||
*/
|
||||
public static String ruta_pdf_peticiones;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los pdfs de las liquidaciones de los médicos, así como de sus detalles
|
||||
*/
|
||||
public static String ruta_pdf_liquidaciones;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los pdfs de los certificados de irpf de los médicos
|
||||
*/
|
||||
public static String ruta_pdf_irpf;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los pdfs de las franquicias dentales
|
||||
*/
|
||||
public static String ruta_pdf_franquicias;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos las imágenes
|
||||
*/
|
||||
public static String ruta_img;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los logotipos de los medicos
|
||||
*/
|
||||
public static String ruta_logotipos;
|
||||
|
||||
/**
|
||||
* Ruta donde guardamos los archivos adjuntos de las incidencias
|
||||
*/
|
||||
public static String ruta_adjuntos;
|
||||
|
||||
/**
|
||||
* Codigo de contrato para polizas dentales
|
||||
*/
|
||||
public static String contrato_dental;
|
||||
|
||||
/**
|
||||
* Codigo de contrato para tarjetas de salud concoberturas dentales
|
||||
*/
|
||||
public static int salud_con_cobertura_dental;
|
||||
|
||||
/**
|
||||
* Número de días que se permite la inactividad en el uso de la aplicación.
|
||||
*/
|
||||
public static int diasActividad;
|
||||
|
||||
/**
|
||||
* Número de días de duración de la clave (a su fin se alcanza la fecha de caducidad).
|
||||
*/
|
||||
public static int diasCaducidad;
|
||||
|
||||
/**
|
||||
* Número de días que se muestra el preaviso de caducidad de clave antes de llegar a su fin.
|
||||
*/
|
||||
public static int diasPreaviso;
|
||||
|
||||
/**
|
||||
* Número de intentos de accesos fallidos al login en la aplicación.
|
||||
*/
|
||||
public static int numeroIntentos;
|
||||
|
||||
|
||||
/**
|
||||
* Devuelve el nombre del fichero de propiedades utilizado en la aplicación.
|
||||
* @return Objeto <code>String</code> que contiene el nombre del fichero de propiedades.
|
||||
*/
|
||||
public static String getNombrePropiedades()
|
||||
{
|
||||
return NOMBRE_PROPIEDADES;
|
||||
}
|
||||
|
||||
/**
|
||||
* El bin de chipcard para los propios
|
||||
*/
|
||||
public static String bin_chipcard_propios;
|
||||
|
||||
/**
|
||||
* El bin de chipcard para los adeslas
|
||||
*/
|
||||
public static String bin_chipcard_adeslas;
|
||||
|
||||
/**
|
||||
* El bin de chipcard para los sanitas
|
||||
*/
|
||||
public static String bin_chipcard_sanitas;
|
||||
|
||||
/**
|
||||
* El bin de chipcard para los dkv
|
||||
*/
|
||||
public static String bin_chipcard_dkv;
|
||||
|
||||
/**
|
||||
* El bin de chipcard para los IMQ de Bilbao
|
||||
*/
|
||||
public static String bin_chipcard_imqbilbo;
|
||||
|
||||
/**
|
||||
* El bin de chipcard para los IMQ de Bilbao
|
||||
*/
|
||||
public static String bin_chipcard_hna;
|
||||
|
||||
/**
|
||||
* El bin de Redsa para identificar ASISA
|
||||
*/
|
||||
public static String bin_redsa_asisa;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static String chipcard_login;
|
||||
public static String chipcard_pass;
|
||||
public static String chipcard_terminal;
|
||||
public static String chipcard_profesional;
|
||||
public static String chipcard_url;
|
||||
public static String chipcard_company;
|
||||
public static String chipcard_lista;
|
||||
public static String chipcard_oper_auto;
|
||||
public static String chipcard_oper_deny;
|
||||
|
||||
|
||||
public static int log_control_medicos;
|
||||
|
||||
/**
|
||||
* la conexion al his para obtener los pdfs de izasa
|
||||
*/
|
||||
public static String dbhis_usuario;
|
||||
public static String dbhis_password;
|
||||
public static String dbhis_maquina;
|
||||
public static String dbhis_puerto;
|
||||
public static String dbhis_instancia;
|
||||
public static String dbhis_tipo_servidor;
|
||||
public static String dbhis_data_source;
|
||||
|
||||
/**
|
||||
* Los actos de ats curas
|
||||
*/
|
||||
public static String actos_ats_curas;
|
||||
|
||||
|
||||
/**
|
||||
* El destino de la bbdd desarrollo o real
|
||||
*/
|
||||
public static String db_destino;
|
||||
|
||||
/**
|
||||
* Carga en variables de la aplicación los valores indicados en el fichero de propiedades.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void cargarPropiedades()
|
||||
{
|
||||
String mensaje;
|
||||
try
|
||||
{
|
||||
PropertyResourceBundle propiedades = (PropertyResourceBundle)PropertyResourceBundle.getBundle(NOMBRE_PROPIEDADES);
|
||||
System.out.println("- Linea 487 - Fichero properties: " + propiedades);
|
||||
|
||||
LogTarisan.setNombreFichero(Utilidades.cargarPropiedadString(propiedades, PROP_LOG_FICHERO, LogTarisan.DEF_LOG_FICHERO));
|
||||
LogTarisan.setPathFichero(Utilidades.cargarPropiedadString(propiedades, PROP_LOG_PATH, LogTarisan.DEF_LOG_PATH));
|
||||
LogTarisan.setTamanoFichero(Utilidades.cargarPropiedadString(propiedades, PROP_LOG_TAMANO, LogTarisan.DEF_LOG_TAMANO));
|
||||
LogTarisan.setNumeroFicheros(Utilidades.cargarPropiedadInt(propiedades, PROP_LOG_NUMERO, LogTarisan.DEF_LOG_NUMERO));
|
||||
LogTarisan.setNivel(Utilidades.cargarPropiedadString(propiedades, PROP_LOG_NIVEL, LogTarisan.DEF_LOG_NIVEL));
|
||||
|
||||
|
||||
//Cargar la propiedad del log_sql de las lecturas de pistas de los médicos
|
||||
log_control_medicos = Utilidades.cargarPropiedadInt(propiedades, PROP_LOG_CONTROL_MEDICOS, 0);
|
||||
|
||||
dataStore = crearDataStore(Utilidades.cargarPropiedadString(propiedades, PROP_DB_DATASTORE, PersistenciaParametros.ORACLE));
|
||||
PersistenciaParametros.decimales = Utilidades.cargarPropiedadInt(propiedades, PROP_VISUAL_DECIMALES, 0);
|
||||
PersistenciaParametros.formatoFechas = Utilidades.cargarPropiedadString(propiedades, PROP_VISUAL_FORMATO_FECHAS, "");
|
||||
PersistenciaParametros.usuario = Utilidades.cargarPropiedadString(propiedades, PROP_DB_USUARIO, "");
|
||||
PersistenciaParametros.password = Utilidades.cargarPropiedadString(propiedades, PROP_DB_PASSWORD, "");
|
||||
PersistenciaParametros.maquina = Utilidades.cargarPropiedadString(propiedades, PROP_DB_MAQUINA, "");
|
||||
PersistenciaParametros.maquina2 = Utilidades.cargarPropiedadString(propiedades, PROP_DB_MAQUINA2, "");
|
||||
PersistenciaParametros.puerto = Utilidades.cargarPropiedadInt(propiedades, PROP_DB_PUERTO, 0);
|
||||
PersistenciaParametros.instancia = Utilidades.cargarPropiedadString(propiedades, PROP_DB_INSTANCIA, "");
|
||||
PersistenciaParametros.dataSource = Utilidades.cargarPropiedadString(propiedades, PROP_DB_DATASOURCE, "");
|
||||
PersistenciaParametros.tipoServidorOracle = Utilidades.cargarPropiedadString(propiedades, PROP_DB_TIPO_SERVIDOR, "10g");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Paginacion.setFilasPorPagina(Utilidades.cargarPropiedadInt(propiedades, PROP_PAG_FILAS_PAGINACION, 0));
|
||||
|
||||
ciudad = Utilidades.cargarPropiedadString(propiedades, PROP_IMP_CIUDAD, "Pamplona");
|
||||
|
||||
diasActividad = Utilidades.cargarPropiedadInt(propiedades, PROP_CLAVE_DIAS_ACTIVIDAD, 90);
|
||||
diasCaducidad = Utilidades.cargarPropiedadInt(propiedades, PROP_CLAVE_DIAS_CADUCIDAD, 180);
|
||||
diasPreaviso = Utilidades.cargarPropiedadInt(propiedades, PROP_CLAVE_DIAS_PREAVISO, 15);
|
||||
numeroIntentos = Utilidades.cargarPropiedadInt(propiedades, PROP_CLAVE_NUMERO_INTENTOS, 5);
|
||||
|
||||
periodoAnalisis = Utilidades.cargarPropiedadInt(propiedades, PROP_PAC_PERIODO_ANALISIS, 6);
|
||||
periodoRx = Utilidades.cargarPropiedadInt(propiedades, PROP_PAC_PERIODO_RX, 6);
|
||||
codigoVisitaSucesiva = Utilidades.cargarPropiedadInt(propiedades, PROP_PAC_CODIGO_VISITA_SUCESIVA, 2);
|
||||
codigoPrimeraVisita = Utilidades.cargarPropiedadInt(propiedades, PROP_PAC_CODIGO_PRIMERA_VISITA, 1);
|
||||
codigoPrimeraLimpieza = Utilidades.cargarPropiedadInt(propiedades, PROP_PAC_CODIGO_PRIMERA_LIMPIEZA, 1460);
|
||||
codigoIgualas = Utilidades.cargarPropiedadInt(propiedades, PROP_PAC_CODIGO_IGUALAS, 993999);
|
||||
analiticas = Utilidades.cargarPropiedadInt(propiedades, PROP_PAC_ANALITICAS, 17);
|
||||
radiodiagnostico = Utilidades.cargarPropiedadInt(propiedades, PROP_PAC_RADIODIAGNOSTICO, 20);
|
||||
periodoPrimeraVisita = Utilidades.cargarPropiedadInt(propiedades, PROP_PAC_PERIODO_PRIMERA_VISITA, 0);
|
||||
periodoPrimeraVisitaChipcard = Utilidades.cargarPropiedadInt(propiedades, PROP_PAC_PERIODO_PRIMERA_VISITA_CHIPCARD, 0);
|
||||
periodoNatural = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_PERIODO_NATURAL, "");
|
||||
autorizacion = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_AUTORIZACION, "N");
|
||||
ruta_logotipos = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_LOGOTIPOS, "/var/lib/tomcat/webapps/tarisan/logotipos");
|
||||
ruta_adjuntos = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_ADJUNTOS, "/var/lib/tomcat/webapps/tarisan/adjuntos");
|
||||
ruta_pdf = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF, "/var/lib/tomcat/webapps/tarisan/peticiones");
|
||||
/*ruta_pdf_resultados = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_RESULTADOS, "/root/apache-tomcat-6.0.20/webapps/tarisan/resultados");*/
|
||||
ruta_pdf_resultados = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_RESULTADOS, "/var/lib/tomcat/webapps/tarisan/resultados");
|
||||
ruta_pdf_resultados_analiticas = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_RESULTADOS_ANALITICAS, "/var/lib/tomcat/webapps/tarisan/resultados/analiticas");
|
||||
ruta_pdf_resultados_anatomia_CSM = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_RESULTADOS_ANATOMIA_CSM, "/var/lib/tomcat/webapps/tarisan/hador/DOCEXT");
|
||||
ruta_pdf_resultados_anatomia = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_RESULTADOS_ANATOMIA, "/var/lib/tomcat/webapps/tarisan/resultados/ap");
|
||||
ruta_pdf_informes_rx = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_INFORMES_RX, "/var/lib/tomcat/webapps/tarisan/resultados/rx");
|
||||
ruta_pdf_peticiones_analiticas = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_PETICIONES_ANALITICAS, "/var/lib/tomcat/webapps/tarisan/peticiones/analiticas");
|
||||
ruta_pdf_peticiones_analiticas_capturadas = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_PETICIONES_ANALITICAS_CAPTURADAS, "/var/lib/tomcat/webapps/tarisan/peticiones/analiticas_capturadas");
|
||||
ruta_pdf_peticiones_rx_capturados = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_PETICIONES_RX_CAPTURADOS, "/var/lib/tomcat/webapps/tarisan/peticiones/rx_capturados");
|
||||
ruta_pdf_peticiones_detalle_pacientes = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_PETICIONES_DETALLE_PACIENTES, "/var/lib/tomcat/webapps/tarisant/peticiones/detalle_pacientes");
|
||||
ruta_pdf_peticiones_facturas = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_PETICIONES_FACTURAS, "/var/lib/tomcat/webapps/tarisan/peticiones/facturas");
|
||||
ruta_pdf_peticiones_ingresos = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_PETICIONES_INGRESOS, "/var/lib/tomcat/webapps/tarisan/peticiones/ingresos");
|
||||
ruta_pdf_peticiones_recetas = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_PETICIONES_RECETAS, "/var/lib/tomcat/webapps/tarisan/peticiones/recetas");
|
||||
ruta_pdf_peticiones_ap = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_PETICIONES_AP, "/var/lib/tomcat/webapps/tarisan/peticiones/ap");
|
||||
ruta_pdf_peticiones_ats = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_PETICIONES_ATS, "/var/lib/tomcat/webapps/tarisan/peticiones/ats");
|
||||
ruta_pdf_peticiones_autorizaciones = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_PETICIONES_AUTORIZACIONES, "/var/lib/tomcat/webapps/tarisan/peticiones/autorizaciones");
|
||||
ruta_pdf_peticiones_especialidades = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_PETICIONES_ESPECIALIDADES, "/var/lib/tomcat/webapps/tarisan/peticiones/especialidades");
|
||||
ruta_pdf_peticiones_rx = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_PETICIONES_RX, "/var/lib/tomcat/webapps/tarisan/peticiones/rx");
|
||||
ruta_pdf_peticiones = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_PETICIONES, "/var/lib/tomcat/webapps/tarisan/peticiones");
|
||||
ruta_pdf_liquidaciones = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_LIQUIDACIONES, "/var/lib/tomcat/webapps/tarisan/liquidaciones");
|
||||
ruta_pdf_irpf = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_IRPF, "/var/lib/tomcat/webapps/tarisan/irpf");
|
||||
ruta_pdf_franquicias = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_PDF_FRANQUICIAS, "/var/lib/tomcat/webapps/tarisan/franquicias");
|
||||
ruta_img = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_RUTA_IMG, "/var/lib/tomcat/webapps/tarisan/img");
|
||||
contrato_dental = Utilidades.cargarPropiedadString(propiedades, PROP_PAC_CONTRATO_DENTAL, "723, 748");
|
||||
salud_con_cobertura_dental = Utilidades.cargarPropiedadInt(propiedades, PROP_PAC_SALUD_CON_COBERTURA_DENTAL, 723);
|
||||
|
||||
//MODIFICADO POR José Javier Ripa el 28/06/2011
|
||||
|
||||
//Cargar las propiedades de conexión al pacs para ver las imágenes.
|
||||
usuario_pacs = Utilidades.cargarPropiedadString(propiedades, PROP_RAYOS_USUARIO, "");
|
||||
clave_usuario_pacs = Utilidades.cargarPropiedadString(propiedades, PROP_RAYOS_CLAVE, "");
|
||||
server_pacs = Utilidades.cargarPropiedadString(propiedades, PROP_RAYOS_SERVER, "");
|
||||
|
||||
//Configuracion conexiones chipcardd
|
||||
chipcard_login=Utilidades.cargarPropiedadString(propiedades, PROP_CHIPCARD_LOGIN, "");
|
||||
chipcard_pass=Utilidades.cargarPropiedadString(propiedades, PROP_CHIPCARD_PASS, "");
|
||||
chipcard_terminal=Utilidades.cargarPropiedadString(propiedades, PROP_CHIPCARD_TERMINAL, "");
|
||||
chipcard_profesional=Utilidades.cargarPropiedadString(propiedades, PROP_CHIPCARD_PROFESIONAL, "");
|
||||
chipcard_url=Utilidades.cargarPropiedadString(propiedades, PROP_CHIPCARD_URL, "");
|
||||
chipcard_company=Utilidades.cargarPropiedadString(propiedades, PROP_CHIPCARD_COMPANY, "");
|
||||
chipcard_lista=Utilidades.cargarPropiedadString(propiedades, PROP_CHIPCARD_LISTA, "");
|
||||
chipcard_oper_auto = Utilidades.cargarPropiedadString(propiedades, PROP_CHIPCARD_AUTO, "");
|
||||
chipcard_oper_deny = Utilidades.cargarPropiedadString(propiedades, PROP_CHIPCARD_DENY, "");
|
||||
|
||||
|
||||
//BIN'es VÁLIDOS CHIPCARD
|
||||
bin_chipcard_propios = Utilidades.cargarPropiedadString(propiedades, PROP_CHIPCARD_BIN_PROPIOS, "");
|
||||
bin_chipcard_dkv = Utilidades.cargarPropiedadString(propiedades, PROP_CHIPCARD_BIN_DKV, "");
|
||||
bin_chipcard_adeslas = Utilidades.cargarPropiedadString(propiedades, PROP_CHIPCARD_BIN_ADESLAS, "");
|
||||
bin_chipcard_sanitas = Utilidades.cargarPropiedadString(propiedades, PROP_CHIPCARD_BIN_SANITAS, "");
|
||||
bin_chipcard_imqbilbo = Utilidades.cargarPropiedadString(propiedades, PROP_CHIPCARD_BIN_IMQBILBO, "");
|
||||
bin_chipcard_hna = Utilidades.cargarPropiedadString(propiedades, PROP_CHIPCARD_BIN_HNA, "");
|
||||
|
||||
bin_redsa_asisa = Utilidades.cargarPropiedadString(propiedades, PROP_REDSA_BIN_ASISA, "B8461");
|
||||
|
||||
dbhis_usuario = Utilidades.cargarPropiedadString(propiedades, PROP_DBHIS_USUARIO, "");
|
||||
dbhis_password= Utilidades.cargarPropiedadString(propiedades, PROP_DBHIS_PASSWORD, "");
|
||||
dbhis_maquina = Utilidades.cargarPropiedadString(propiedades, PROP_DBHIS_MAQUINA, "");
|
||||
dbhis_puerto = Utilidades.cargarPropiedadString(propiedades, PROP_DBHIS_PUERTO, "");
|
||||
dbhis_instancia = Utilidades.cargarPropiedadString(propiedades, PROP_DBHIS_INSTANCIA, "");
|
||||
dbhis_tipo_servidor = Utilidades.cargarPropiedadString(propiedades, PROP_DBHIS_TIPO_SERVIDOR, "");
|
||||
dbhis_data_source = Utilidades.cargarPropiedadString(propiedades, PROP_DBHIS_DATASOURCE, "");
|
||||
|
||||
actos_ats_curas = Utilidades.cargarPropiedadString(propiedades, PROP_ACTOS_ATS_CURA, "6000, 6001, 6002, 6003");
|
||||
|
||||
db_destino = Utilidades.cargarPropiedadString(propiedades, PROP_DB_INSTANCIA, "REAL");
|
||||
|
||||
|
||||
//BEGIN MODIFICADO por ROUMEN ROUMENOV 15/06/2005
|
||||
|
||||
//Cargar Perfiles CSM
|
||||
int key = 0;
|
||||
String valor = "";
|
||||
|
||||
//PERFIL ADMINISTRADOR
|
||||
key = Utilidades.cargarPropiedadInt(propiedades,"PERFIL.ADMINISTRADOR",0);
|
||||
valor = Constantes.PERFIL_ADMINISTRADOR;
|
||||
|
||||
tablaPerfiles.put(Integer.valueOf(key),new String(valor));
|
||||
|
||||
//PERFIL ANALISTA
|
||||
key = Utilidades.cargarPropiedadInt(propiedades,"PERFIL.ANALISTA1",0);
|
||||
valor = Constantes.PERFIL_ANALISTA;
|
||||
|
||||
tablaPerfiles.put(Integer.valueOf(key),new String(valor));
|
||||
|
||||
//PERFIL ANALISTA
|
||||
/*key = Utilidades.cargarPropiedadInt(propiedades,"PERFIL.ANALISTA2",99);
|
||||
valor = Constantes.PERFIL_ANALISTA;
|
||||
|
||||
tablaPerfiles.put(Integer.valueOf(key),new String(valor)); */
|
||||
|
||||
//PERFIL CABECERA
|
||||
key = Utilidades.cargarPropiedadInt(propiedades,"PERFIL.CABECERA",0);
|
||||
valor = Constantes.PERFIL_CABECERA;
|
||||
tablaPerfiles.put(Integer.valueOf(key),new String(valor));
|
||||
|
||||
//PERFIL PODOLOGÍA
|
||||
key = Utilidades.cargarPropiedadInt(propiedades,"PERFIL.PODOLOGIA",0);
|
||||
valor = Constantes.PERFIL_REHABPOD;
|
||||
tablaPerfiles.put(Integer.valueOf(key),new String(valor));
|
||||
|
||||
//PERFIL REHABILITACION
|
||||
key = Utilidades.cargarPropiedadInt(propiedades,"PERFIL.REHABILITACION",0);
|
||||
valor = Constantes.PERFIL_REHABPOD;
|
||||
tablaPerfiles.put(Integer.valueOf(key),new String(valor));
|
||||
|
||||
//PERFIL ATS
|
||||
key = Utilidades.cargarPropiedadInt(propiedades,"PERFIL.ATS",0);
|
||||
valor = Constantes.PERFIL_ATS;
|
||||
tablaPerfiles.put(Integer.valueOf(key),new String(valor));
|
||||
|
||||
//PERFIL ESTOMATOLOGÍA
|
||||
key = Utilidades.cargarPropiedadInt(propiedades,"PERFIL.DENTISTA",0);
|
||||
valor = Constantes.PERFIL_DENTISTA;
|
||||
tablaPerfiles.put(Integer.valueOf(key),new String(valor));
|
||||
|
||||
//PERFIL ODONTOLOGÍA
|
||||
key = Utilidades.cargarPropiedadInt(propiedades,"PERFIL.ODONTOLOGIA",0);
|
||||
valor = Constantes.PERFIL_ODONTOLOGIA;
|
||||
tablaPerfiles.put(Integer.valueOf(key),new String(valor));
|
||||
|
||||
//PERFIL radiologo
|
||||
key = Utilidades.cargarPropiedadInt(propiedades,"PERFIL.RADIOLOGO",0);
|
||||
valor = Constantes.PERFIL_RADIOLOGO;
|
||||
tablaPerfiles.put(Integer.valueOf(key),new String(valor));
|
||||
|
||||
//PERFIL Psicoterapia (Padre Menni)
|
||||
key = Utilidades.cargarPropiedadInt(propiedades,"PERFIL.PSICOTERAPIA",64);
|
||||
System.out.println("- Linea 667 - Psicoterapia key: " + key);
|
||||
valor = Constantes.PERFIL_REHABPOD;
|
||||
tablaPerfiles.put(Integer.valueOf(key),new String(valor));
|
||||
|
||||
//PERFIL Cirugía Plástica (Dr. Colas)
|
||||
key = Utilidades.cargarPropiedadInt(propiedades,"PERFIL.CIRUGIA_PLASTICA",14);
|
||||
System.out.println("- Linea 673 - Colas key: " + key);
|
||||
valor = Constantes.PERFIL_REHABPOD;
|
||||
tablaPerfiles.put(Integer.valueOf(key),new String(valor));
|
||||
|
||||
|
||||
|
||||
|
||||
//END
|
||||
mensaje = " (OK)";
|
||||
}
|
||||
catch(MissingResourceException ex)
|
||||
{
|
||||
mensaje = " (KO, MissingResourceException: " + ex + ")";
|
||||
}
|
||||
|
||||
LogTarisan.inicializarLog();
|
||||
escribirConfiguracionLog(mensaje);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Crea el data store que se utilizará en la aplicación según se ha indicado en el fichero de propiedades.<br>
|
||||
* Si no existe la clase, por defecto se usará el data store correspondiente a Oracle.
|
||||
* @param nombre Nombre de la clase (incluido su paquete) del data store indicado en el fichero de propiedades.
|
||||
* @return El objeto <code>DataStore</code> correspondiente al parámetro del fichero de propiedades.
|
||||
*/
|
||||
private static DataStore crearDataStore(String nombre)
|
||||
{
|
||||
DataStore dataStore = null;
|
||||
@SuppressWarnings("rawtypes")
|
||||
Class clase = null;
|
||||
|
||||
try
|
||||
{
|
||||
clase = Class.forName(nombre);
|
||||
dataStore = (DataStore)clase.newInstance();
|
||||
}
|
||||
catch(ClassNotFoundException ex)
|
||||
{
|
||||
System.out.println(ex);
|
||||
dataStore = crearDataStore(PersistenciaParametros.ORACLE);
|
||||
}
|
||||
catch(IllegalAccessException ex)
|
||||
{
|
||||
System.out.println(ex);
|
||||
dataStore = crearDataStore(PersistenciaParametros.ORACLE);
|
||||
}
|
||||
catch(InstantiationException ex)
|
||||
{
|
||||
System.out.println(ex);
|
||||
dataStore = crearDataStore(PersistenciaParametros.ORACLE);
|
||||
}
|
||||
|
||||
return dataStore;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escribe en el fichero de log el valor de los atributos de clase leídos desde
|
||||
* el fichero de propiedades de la aplicación.
|
||||
* @param mensaje Cadena que indica si el fichero de propiedades se cargó o no correctamente.
|
||||
*/
|
||||
private static void escribirConfiguracionLog(String mensaje)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.INIT, "Parámetros de configuración cargados" + mensaje);
|
||||
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_LOG_FICHERO + " = " + LogTarisan.getNombreFichero());
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_LOG_PATH + " = " + LogTarisan.getPathFichero());
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_LOG_TAMANO + " = " + LogTarisan.getTamanoFichero());
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_LOG_NUMERO + " = " + LogTarisan.getNumeroFicheros());
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_LOG_NIVEL + " = " + LogTarisan.getNivel());
|
||||
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_VISUAL_DECIMALES + " = " + PersistenciaParametros.decimales);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_VISUAL_FORMATO_FECHAS + " = " + PersistenciaParametros.formatoFechas);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_DB_DATASTORE + " = " + dataStore);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_DB_USUARIO + " = " + PersistenciaParametros.usuario);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_DB_PASSWORD + " = " + PersistenciaParametros.password);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_DB_MAQUINA + " = " + PersistenciaParametros.maquina);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_DB_MAQUINA2 + " = " + PersistenciaParametros.maquina2);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_DB_PUERTO + " = " + PersistenciaParametros.puerto);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_DB_INSTANCIA + " = " + PersistenciaParametros.instancia);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_DB_DATASOURCE + " = " + PersistenciaParametros.dataSource);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_DB_TIPO_SERVIDOR + " = " + PersistenciaParametros.tipoServidorOracle);
|
||||
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_PAG_FILAS_PAGINACION + " = " + Paginacion.getFilasPorPagina());
|
||||
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_IMP_CIUDAD + " = " + ciudad);
|
||||
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_CLAVE_DIAS_ACTIVIDAD + " = " + diasActividad);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_CLAVE_DIAS_CADUCIDAD + " = " + diasCaducidad);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_CLAVE_DIAS_PREAVISO + " = " + diasPreaviso);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_CLAVE_NUMERO_INTENTOS + " = " + numeroIntentos);
|
||||
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_PAC_PERIODO_ANALISIS + " = " + periodoAnalisis);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_PAC_PERIODO_RX + " = " + periodoRx);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_PAC_CODIGO_VISITA_SUCESIVA + " = " + codigoVisitaSucesiva);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_PAC_CODIGO_PRIMERA_VISITA + " = " + codigoPrimeraVisita);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_PAC_CODIGO_PRIMERA_LIMPIEZA + " = " + codigoPrimeraLimpieza);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_PAC_CODIGO_IGUALAS + " = " + codigoIgualas);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_PAC_ANALITICAS + " = " + analiticas);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_PAC_RADIODIAGNOSTICO + " = " + radiodiagnostico);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_PAC_PERIODO_PRIMERA_VISITA + " = " + periodoPrimeraVisita);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_PAC_PERIODO_PRIMERA_VISITA_CHIPCARD + " = " + periodoPrimeraVisitaChipcard);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_PAC_PERIODO_NATURAL + " = " + periodoNatural);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_PAC_AUTORIZACION + " = " + autorizacion);
|
||||
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_RAYOS_USUARIO + " = " + usuario_pacs);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_RAYOS_CLAVE + " = " + clave_usuario_pacs);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_RAYOS_SERVER + " = " + server_pacs);
|
||||
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_CHIPCARD_BIN_PROPIOS + " = " + bin_chipcard_propios);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_CHIPCARD_BIN_DKV + " = " + bin_chipcard_dkv);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_CHIPCARD_BIN_ADESLAS + " = " + bin_chipcard_adeslas);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_CHIPCARD_BIN_SANITAS + " = " + bin_chipcard_sanitas);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_CHIPCARD_BIN_IMQBILBO + " = " + bin_chipcard_imqbilbo);
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_CHIPCARD_BIN_HNA + " = " + bin_chipcard_hna);
|
||||
|
||||
LogTarisan.logger.log(NivelLog.INIT, PROP_REDSA_BIN_ASISA + " =" + bin_redsa_asisa);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
import com.tarisan.log.*;
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
public class PersistenciaControlMedicos
|
||||
{
|
||||
public boolean insertar(int medico, String tarjeta)
|
||||
{
|
||||
boolean resul=false;
|
||||
StringBuffer sqlInsert = new StringBuffer();
|
||||
Object[] aValores = new Object[3];
|
||||
|
||||
try {
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, medico + " - El medico "+medico+" pasa la tarjeta: "+tarjeta+" vamos a meterlo en la tabla oracle");
|
||||
sqlInsert.append("Insert into control_medicos (id, medico, fecha, tarjeta) values (?, ?, sysdate, ?)");
|
||||
aValores[0]=siguiente_id();
|
||||
aValores[1]=Integer.valueOf(medico);
|
||||
aValores[2]=new String(tarjeta);
|
||||
|
||||
resul = ParametrosConfiguracion.dataStore.insertar(sqlInsert.toString(), aValores, conexion);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error al insertar el registro de control de medicos");
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
public int siguiente_id()
|
||||
{
|
||||
int resul = 0;
|
||||
try {
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
String sql = "select max(id) maximo from control_medicos";
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sql);
|
||||
while(rs.next())
|
||||
{
|
||||
resul = rs.getInt(1);
|
||||
}
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al obtener el max id de la tabla control_medicos");
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error SQL al obtener el max id de la tabla control_medicos");
|
||||
}
|
||||
if(resul == 0)
|
||||
resul = 1;
|
||||
else
|
||||
resul += 1;
|
||||
return resul;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
import com.tarisan.log.*;
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
public class PersistenciaControlMedicosTroquelado
|
||||
{
|
||||
public boolean insertar(int medico, String troquelado)
|
||||
{
|
||||
boolean resul=false;
|
||||
StringBuffer sqlInsert = new StringBuffer();
|
||||
Object[] aValores = new Object[3];
|
||||
|
||||
try {
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, medico + " - El medico "+medico+" mete el troquelado: "+troquelado+" vamos a meterlo en la tabla oracle");
|
||||
sqlInsert.append("Insert into control_medicos_troquelado (id, medico, fecha, troquelado) values (?, ?, sysdate, ?)");
|
||||
aValores[0]=siguiente_id();
|
||||
aValores[1]=Integer.valueOf(medico);
|
||||
aValores[2]=new String(troquelado);
|
||||
|
||||
resul = ParametrosConfiguracion.dataStore.insertar(sqlInsert.toString(), aValores, conexion);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error al insertar el registro de control de medicos troquelado");
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
public int siguiente_id()
|
||||
{
|
||||
int resul = 0;
|
||||
try {
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
String sql = "select max(id) maximo from control_medicos_troquelado";
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sql);
|
||||
while(rs.next())
|
||||
{
|
||||
resul = rs.getInt(1);
|
||||
}
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al obtener el max id de la tabla control_medicos_troquelado");
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error SQL al obtener el max id de la tabla control_medicos_troquelado");
|
||||
}
|
||||
if(resul == 0)
|
||||
resul = 1;
|
||||
else
|
||||
resul += 1;
|
||||
return resul;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.tarisan.control;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.tarisan.data.Tanoticias;
|
||||
import com.tarisan.data.Tavolin;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
import com.tarisan.log.LogTarisan;
|
||||
import com.tarisan.log.NivelLog;
|
||||
import com.tarisan.util.Utilidades;
|
||||
|
||||
import com.tarisan.data.Hce_doc_ext_ap;
|
||||
|
||||
public class PersistenciaHce_doc_ext_ap {
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber qué página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>.
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
public Vector seleccionar(Number epis_pk) throws ExcepcionTarisan
|
||||
{
|
||||
Vector vResultado = new Vector();
|
||||
Hce_doc_ext_ap hce_doc_ext_ap = null;
|
||||
String consulta = "";
|
||||
String nombrePdf = "";
|
||||
|
||||
consulta = "select * from hce_doc_ext_ap where epis_pk = "+ epis_pk;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, consulta);
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
String[] partes = rs.getString("NOMBRE_DOC").split("\\.");
|
||||
nombrePdf = partes[0];
|
||||
hce_doc_ext_ap = new Hce_doc_ext_ap();
|
||||
hce_doc_ext_ap.setNombre_doc(nombrePdf);
|
||||
vResultado.addElement(hce_doc_ext_ap);
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla hce_doc_ext_ap (" + consulta + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de hce_doc_ext_ap: " + sqle + " (" + consulta + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de hce_doc_ext_ap: " + sqle + " (" + consulta + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de hce_doc_ext_ap: " + sqle + " (" + consulta + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de hce_doc_ext_ap: " + sqle + " (" + consulta + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,726 @@
|
||||
/**
|
||||
* @(#) PersistenciaPaciente.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.Paciente;
|
||||
import com.tarisan.data.Tarjeta;
|
||||
import com.tarisan.excepcion.*;
|
||||
import com.tarisan.log.*;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Calendar;
|
||||
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>Paciente</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaPaciente implements Constantes
|
||||
{
|
||||
|
||||
/**
|
||||
* Selecciona el primer registro de la tabla ttbenefi encontrado para la tarjeta de paciente pasada por el médico.
|
||||
* @param tarjeta El objeto <code>Tarjeta</code> para el que se realiza la búsqueda.
|
||||
* @return El <code>Paciente</code> encontrado en la tabla de beneficiarios,
|
||||
* o null si se produce alguna excepción.
|
||||
* @throws
|
||||
*/
|
||||
public Object seleccionar(Tarjeta tarjeta, int medico) throws ExcepcionTarisan
|
||||
{
|
||||
Object retorno = null;
|
||||
Paciente paciente = null;
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
sqlSelect.append("SELECT ttbenefi.TARJETA");
|
||||
sqlSelect.append(", ttbenefi.CLIENTE");
|
||||
sqlSelect.append(", ttbenefi.FECHA_BAJA");
|
||||
sqlSelect.append(", ttbenefi.LPD_AUT");
|
||||
sqlSelect.append(", ttbenefi.ENTIDAD");
|
||||
sqlSelect.append(", ttclient.SEXO");
|
||||
sqlSelect.append(", ttclient.FECHA_NACIMIENTO");
|
||||
sqlSelect.append(" FROM ttbenefi, ttclient");
|
||||
sqlSelect.append(" WHERE TARJETA = ? AND");
|
||||
sqlSelect.append(" ttbenefi.cliente = ttclient.cliente");
|
||||
sqlSelect.append(" and (ttbenefi.fecha_baja is null or ttbenefi.fecha_baja > sysdate) ");
|
||||
//sqlSelect.append(" AND POLIZA = ?");
|
||||
//sqlSelect.append(" AND ORDEN = ?");
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
Object aCondiciones[] = new Object[1];
|
||||
aCondiciones[0] = Integer.valueOf(tarjeta.getTarjeta());
|
||||
//aCondiciones[1] = Double.valueOf(tarjeta.getPoliza());
|
||||
//aCondiciones[2] = Integer.valueOf(tarjeta.getBeneficiario());
|
||||
@SuppressWarnings("unused")
|
||||
int numTarjeta = 0;
|
||||
int codCliente = 0;
|
||||
Date fecBaja = null;
|
||||
String autorizado = "";
|
||||
String sexo = "";
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
while(rs.next())
|
||||
{
|
||||
paciente = new Paciente();
|
||||
tarjeta.setEntidadIMQ(rs.getInt("ENTIDAD"));
|
||||
paciente.setTarjeta(tarjeta);
|
||||
numTarjeta = rs.getInt("TARJETA");
|
||||
codCliente = rs.getInt("CLIENTE");
|
||||
fecBaja = rs.getDate("FECHA_BAJA");
|
||||
autorizado = rs.getString("LPD_AUT");
|
||||
sexo = rs.getString("SEXO");
|
||||
paciente.setSexo(sexo);
|
||||
paciente.setEdad(com.tarisan.util.Utilidades.calcularEdad(rs.getDate("FECHA_NACIMIENTO"), Calendar.getInstance().getTime()));
|
||||
}
|
||||
rs.close();
|
||||
|
||||
Calendar calendario = Calendar.getInstance();
|
||||
/*if((numTarjeta != tarjeta.getTarjeta()) && (tarjeta.getTarjeta() > 0))
|
||||
{
|
||||
//La tarjeta del beneficiario (que no es Visa) está caducada (se ha emitido una posterior)
|
||||
retorno = TARJETA_CADUCADA;
|
||||
}
|
||||
else
|
||||
*/
|
||||
if((fecBaja != null) && (calendario.getTime().after((java.util.Date)fecBaja)))
|
||||
{
|
||||
//esa tarjeta está de baja, vamos a buscar por col-pol-orden a ver si tiene una activa
|
||||
sqlSelect.append("SELECT TARJETA");
|
||||
sqlSelect.append(", CLIENTE");
|
||||
sqlSelect.append(", FECHA_BAJA");
|
||||
sqlSelect.append(", LPD_AUT");
|
||||
sqlSelect.append(" FROM ttbenefi");
|
||||
sqlSelect.append(" WHERE COLECTIVO = ?");
|
||||
sqlSelect.append(" AND POLIZA = ?");
|
||||
sqlSelect.append(" AND ORDEN = ?");
|
||||
sqlSelect.append(" AND ENTIDAD = ?");
|
||||
sqlSelect.append(" AND (fecha_baja is null or fecha_baja > sysdate) ");
|
||||
Object bCondiciones[] = new Object[4];
|
||||
bCondiciones[0] = Long.valueOf(tarjeta.getColectivo());
|
||||
bCondiciones[1] = Double.valueOf(tarjeta.getPoliza());
|
||||
bCondiciones[2] = Integer.valueOf(tarjeta.getBeneficiario());
|
||||
bCondiciones[3] = Integer.valueOf(tarjeta.getEntidadIMQ());
|
||||
int numTarjeta2 = 0;
|
||||
rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
while(rs.next())
|
||||
{
|
||||
numTarjeta2 = rs.getInt("TARJETA");
|
||||
}
|
||||
rs.close();
|
||||
if(numTarjeta2 != 0)
|
||||
{
|
||||
//La tarjeta pasada está de baja, pero hay otra de alta: tarjeta caducada.
|
||||
retorno = TARJETA_CADUCADA;
|
||||
}
|
||||
else
|
||||
{
|
||||
//El beneficiario está dado de baja
|
||||
retorno = TARJETA_BAJA;
|
||||
}
|
||||
}
|
||||
else if (this.clienteConMorosidad(tarjeta.getColectivo(), tarjeta.getPoliza(), medico))
|
||||
{
|
||||
//La tarjeta del paciente está suspendida (es moroso)
|
||||
retorno = TARJETA_SUSPENSO;
|
||||
}
|
||||
else if ((ParametrosConfiguracion.autorizacion.trim().toUpperCase().compareTo("S") == 0))
|
||||
{
|
||||
//El sistema comprobará la autorización para mostrar los resultados de las analíticas
|
||||
paciente.setNombre(this.obtenerNombreAsegurado(codCliente,medico));
|
||||
if(autorizado == null)
|
||||
{
|
||||
paciente.setAutorizado("N");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(autorizado.compareTo("S")==0)
|
||||
paciente.setAutorizado(autorizado);
|
||||
else
|
||||
paciente.setAutorizado("N");
|
||||
}
|
||||
retorno = paciente;
|
||||
}
|
||||
else
|
||||
{
|
||||
//La tarjeta del beneficiario es correcta y no comprobaremos si el paciente ha firmado la autorización
|
||||
paciente.setNombre(this.obtenerNombreAsegurado(codCliente,medico));
|
||||
paciente.setAutorizado("S");
|
||||
retorno = paciente;
|
||||
}
|
||||
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, medico + " - Seleccionado el paciente " + paciente + " de la tabla ttbenefi (" + sqlSelect + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de paciente: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan();
|
||||
}
|
||||
|
||||
return retorno;
|
||||
}
|
||||
|
||||
public Object seleccionarColPolOrd(Tarjeta tarjeta, int medico) throws ExcepcionTarisan
|
||||
{
|
||||
Object retorno = null;
|
||||
/*Paciente paciente = null;*/
|
||||
Paciente paciente = new Paciente();
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
boolean encontrado = false;
|
||||
try
|
||||
{
|
||||
sqlSelect.append("SELECT ttbenefi.TARJETA");
|
||||
sqlSelect.append(", ttbenefi.CLIENTE");
|
||||
sqlSelect.append(", ttbenefi.FECHA_BAJA");
|
||||
sqlSelect.append(", ttbenefi.LPD_AUT");
|
||||
sqlSelect.append(", ttbenefi.ENTIDAD");
|
||||
sqlSelect.append(", ttclient.SEXO");
|
||||
sqlSelect.append(", ttclient.FECHA_NACIMIENTO");
|
||||
sqlSelect.append(" FROM ttbenefi, ttclient");
|
||||
sqlSelect.append(" WHERE COLECTIVO = ? AND");
|
||||
sqlSelect.append(" POLIZA = ? AND");
|
||||
sqlSelect.append(" ORDEN = ? AND");
|
||||
sqlSelect.append(" ttbenefi.cliente = ttclient.cliente");
|
||||
sqlSelect.append(" and (ttbenefi.fecha_baja is null or ttbenefi.fecha_baja > sysdate) ");
|
||||
//sqlSelect.append(" AND POLIZA = ?");
|
||||
//sqlSelect.append(" AND ORDEN = ?");
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
Object aCondiciones[] = new Object[3];
|
||||
aCondiciones[0] = Long.valueOf(tarjeta.getColectivo());
|
||||
aCondiciones[1] = Double.valueOf(tarjeta.getPoliza());
|
||||
aCondiciones[2] = Integer.valueOf(tarjeta.getBeneficiario());
|
||||
//aCondiciones[1] = Double.valueOf(tarjeta.getPoliza());
|
||||
//aCondiciones[2] = Integer.valueOf(tarjeta.getBeneficiario());
|
||||
@SuppressWarnings("unused")
|
||||
int numTarjeta = 0;
|
||||
int codCliente = 0;
|
||||
Date fecBaja = null;
|
||||
String autorizado = "";
|
||||
String sexo = "";
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
while(rs.next())
|
||||
{
|
||||
paciente = new Paciente();
|
||||
tarjeta.setEntidadIMQ(rs.getInt("ENTIDAD"));
|
||||
paciente.setTarjeta(tarjeta);
|
||||
numTarjeta = rs.getInt("TARJETA");
|
||||
codCliente = rs.getInt("CLIENTE");
|
||||
fecBaja = rs.getDate("FECHA_BAJA");
|
||||
autorizado = rs.getString("LPD_AUT");
|
||||
sexo = rs.getString("SEXO");
|
||||
paciente.setSexo(sexo);
|
||||
if(rs.getDate("FECHA_NACIMIENTO") == null){
|
||||
paciente.setEdad(99);
|
||||
}else {
|
||||
paciente.setEdad(com.tarisan.util.Utilidades.calcularEdad(rs.getDate("FECHA_NACIMIENTO"), Calendar.getInstance().getTime()));
|
||||
}
|
||||
|
||||
encontrado = true;
|
||||
}
|
||||
rs.close();
|
||||
|
||||
Calendar calendario = Calendar.getInstance();
|
||||
/*if((numTarjeta != tarjeta.getTarjeta()) && (tarjeta.getTarjeta() > 0))
|
||||
{
|
||||
//La tarjeta del beneficiario (que no es Visa) está caducada (se ha emitido una posterior)
|
||||
retorno = TARJETA_CADUCADA;
|
||||
}
|
||||
else
|
||||
*/
|
||||
if(((fecBaja != null) && (calendario.getTime().after((java.util.Date)fecBaja)) ) || (fecBaja == null && encontrado == false))
|
||||
{
|
||||
//esa tarjeta está de baja, vamos a buscar por col-pol-orden a ver si tiene una activa
|
||||
StringBuffer sqlSelect2 = new StringBuffer();
|
||||
sqlSelect2.append("SELECT TARJETA");
|
||||
sqlSelect2.append(", CLIENTE");
|
||||
sqlSelect2.append(", FECHA_BAJA");
|
||||
sqlSelect2.append(", LPD_AUT");
|
||||
sqlSelect2.append(" FROM ttbenefi");
|
||||
sqlSelect2.append(" WHERE COLECTIVO = ?");
|
||||
sqlSelect2.append(" AND POLIZA = ?");
|
||||
sqlSelect2.append(" AND ORDEN = ?");
|
||||
sqlSelect2.append(" AND ENTIDAD = ?");
|
||||
sqlSelect2.append(" AND (fecha_baja is null or fecha_baja > sysdate) ");
|
||||
Object bCondiciones[] = new Object[4];
|
||||
bCondiciones[0] = Long.valueOf(tarjeta.getColectivo());
|
||||
bCondiciones[1] = Double.valueOf(tarjeta.getPoliza());
|
||||
bCondiciones[2] = Integer.valueOf(tarjeta.getBeneficiario());
|
||||
bCondiciones[3] = Integer.valueOf(tarjeta.getEntidadIMQ());
|
||||
int numTarjeta2 = 0;
|
||||
ResultSet rs2 = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect2.toString(), bCondiciones);
|
||||
while(rs2.next())
|
||||
{
|
||||
numTarjeta2 = rs.getInt("TARJETA");
|
||||
}
|
||||
rs2.close();
|
||||
if(numTarjeta2 != 0)
|
||||
{
|
||||
//La tarjeta pasada está de baja, pero hay otra de alta: tarjeta caducada.
|
||||
retorno = TARJETA_CADUCADA;
|
||||
}
|
||||
else
|
||||
{
|
||||
//El beneficiario está dado de baja
|
||||
retorno = TARJETA_BAJA;
|
||||
}
|
||||
}
|
||||
else if (this.clienteConMorosidad(tarjeta.getColectivo(), tarjeta.getPoliza(), medico))
|
||||
{
|
||||
//La tarjeta del paciente está suspendida (es moroso)
|
||||
retorno = TARJETA_SUSPENSO;
|
||||
}
|
||||
else if ((ParametrosConfiguracion.autorizacion.trim().toUpperCase().compareTo("S") == 0))
|
||||
{
|
||||
//El sistema comprobará la autorización para mostrar los resultados de las analíticas
|
||||
paciente.setNombre(this.obtenerNombreAsegurado(codCliente,medico));
|
||||
if(autorizado == null)
|
||||
{
|
||||
paciente.setAutorizado("N");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(autorizado.compareTo("S")==0)
|
||||
paciente.setAutorizado(autorizado);
|
||||
else
|
||||
paciente.setAutorizado("N");
|
||||
}
|
||||
retorno = paciente;
|
||||
}
|
||||
else
|
||||
{
|
||||
//La tarjeta del beneficiario es correcta y no comprobaremos si el paciente ha firmado la autorización
|
||||
paciente.setNombre(this.obtenerNombreAsegurado(codCliente,medico));
|
||||
paciente.setAutorizado("S");
|
||||
retorno = paciente;
|
||||
}
|
||||
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, medico + " - Seleccionado el paciente " + paciente.getNombre() + " de la tabla ttbenefi (" + sqlSelect.toString() + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de paciente: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan();
|
||||
}
|
||||
|
||||
return retorno;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Comprueba en la tabla TARECOFI si el cliente buscado tiene morosidad o no.
|
||||
* @param colectivo El número de colectivo.
|
||||
* @param póliza El número de póliza.
|
||||
* @return El valor booleano según sea o no moroso el cliente.
|
||||
* @throws ExcepcionTarisan
|
||||
*/
|
||||
private boolean clienteConMorosidad(long colectivo, double poliza, int medico) throws ExcepcionTarisan
|
||||
{
|
||||
boolean retorno;
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
|
||||
try
|
||||
{
|
||||
sqlSelect.append("SELECT PENDIENTE");
|
||||
sqlSelect.append(" FROM TARECOFI, TTCOLECT");
|
||||
sqlSelect.append(" WHERE COLEC = ?");
|
||||
sqlSelect.append(" AND POLIZA = ?");
|
||||
sqlSelect.append(" AND TARECOFI.ENTIDAD = TTCOLECT.ENTIDAD");
|
||||
sqlSelect.append(" AND TARECOFI.COLEC = TTCOLECT.COLECTIVO");
|
||||
sqlSelect.append(" AND COPAGO <> 3");
|
||||
|
||||
/* Se excluyen los colectivos que tienen copago transferido (TTCOLECT.COPAGO = 3) */
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
Object aCondiciones[] = new Object[2];
|
||||
aCondiciones[0] = Long.valueOf(colectivo);
|
||||
aCondiciones[1] = Double.valueOf(poliza);
|
||||
|
||||
double importe = -1.0;
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
while(rs.next())
|
||||
{
|
||||
importe = rs.getDouble("PENDIENTE");
|
||||
}
|
||||
rs.close();
|
||||
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
|
||||
if (importe >= 0.0)
|
||||
{
|
||||
retorno = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
retorno = false;
|
||||
}
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, medico + " - Seleccionado la morosidad del cliente: " + importe + " de la tabla TARECOFI (" + sqlSelect + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
retorno = false;
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de morosidad del cliente: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan();
|
||||
}
|
||||
|
||||
return retorno;
|
||||
}
|
||||
|
||||
|
||||
public String obtenerNombreAsegurado(Tarjeta tarj, int medico)
|
||||
{
|
||||
String resul ="";
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
try
|
||||
{
|
||||
//SELECT * FROM TTBENEFI WHERE COLECTIVO=3 AND POLIZA=9.5957400185E11 AND ENTIDAD=5 AND ORDEN = 1
|
||||
sqlSelect.append("SELECT CLIENTE FROM TTBENEFI WHERE COLECTIVO=? AND POLIZA=? AND ENTIDAD=? AND ORDEN = ?");
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
Object aCondiciones[] = new Object[4];
|
||||
aCondiciones[0] = Long.valueOf(tarj.getColectivo());
|
||||
aCondiciones[1] = Long.valueOf(tarj.getPoliza());
|
||||
aCondiciones[2] = Integer.valueOf(tarj.getEntidadIMQ());
|
||||
aCondiciones[3] = Integer.valueOf(tarj.getBeneficiario());
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
while(rs.next())
|
||||
{
|
||||
resul = obtenerNombreAsegurado(rs.getInt("CLIENTE"), medico);
|
||||
}
|
||||
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, medico + " - Seleccionado el cliente: " + resul + " de la tabla TTBENEFI (" + sqlSelect + ")");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - PersistenciaPaciente - obtenerNombreAsegurado(Tarjeta) - Excepcion "+e.toString());
|
||||
} catch (ExcepcionTarisan e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recupera el nombre y apellidos del cliente correspondiente a la tarjeta de paciente.
|
||||
* @param codCliente Código del cliente correspondiente a la tarjeta del paciente.
|
||||
* @return El nombre y apellidos del cliente.
|
||||
* @throws
|
||||
*/
|
||||
private String obtenerNombreAsegurado(int codCliente, int medico) throws ExcepcionTarisan
|
||||
{
|
||||
/*StringBuffer nombre = new StringBuffer();*/
|
||||
String nombre = "";
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
|
||||
try
|
||||
{
|
||||
sqlSelect.append("SELECT NOMBRE");
|
||||
sqlSelect.append(", APELLIDOS");
|
||||
sqlSelect.append(" FROM ttclient");
|
||||
sqlSelect.append(" WHERE CLIENTE = ?");
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
Object aCondiciones[] = new Object[1];
|
||||
aCondiciones[0] = Integer.valueOf(codCliente);
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
while(rs.next())
|
||||
{
|
||||
if(rs.getString("APELLIDOS").contains(rs.getString("NOMBRE").trim()))
|
||||
{
|
||||
/*nombre.append(rs.getString("APELLIDOS"));*/
|
||||
nombre = rs.getString("APELLIDOS");
|
||||
}
|
||||
else
|
||||
{
|
||||
/*nombre.append(rs.getString("NOMBRE"));
|
||||
nombre.append(" ");
|
||||
nombre.append(rs.getString("APELLIDOS"));*/
|
||||
nombre = rs.getString("NOMBRE") + " " + rs.getString("APELLIDOS");
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, medico + " - Seleccionado el cliente: " + nombre/*.toString()*/ + " de la tabla ttclient (" + sqlSelect + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección del cliente: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan();
|
||||
}
|
||||
|
||||
/*return nombre.toString();*/
|
||||
return nombre;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Marca el flag de autorización con el valor 'S' a la firma de la autorización por parte del beneficiario.
|
||||
* @param tarjeta El objeto <code>Tarjeta</code> del paciente beneficiario.
|
||||
* @return El resultado de la actualización en base de datos.
|
||||
* @throws
|
||||
*
|
||||
* Se cambia TABENEFI a vista materializada, no se puede hacer update en ella. Se requiere que el médico
|
||||
* lleve el papel de la autorización firmada al IMQ.
|
||||
*/
|
||||
public boolean firmarAutorizacion(Tarjeta tarjeta, int medico) throws ExcepcionTarisan
|
||||
{
|
||||
boolean resultado = true;
|
||||
/*
|
||||
Connection conexion = null;
|
||||
|
||||
StringBuffer sqlUpdate = new StringBuffer();
|
||||
sqlUpdate.append("UPDATE ttbenefi");
|
||||
sqlUpdate.append(" SET LPD_AUT = ?");
|
||||
sqlUpdate.append(" WHERE COLECTIVO = ?");
|
||||
sqlUpdate.append(" AND POLIZA = ?");
|
||||
sqlUpdate.append(" AND ORDEN = ?");
|
||||
sqlUpdate.append(" AND ENTIDAD = ?");
|
||||
|
||||
try
|
||||
{
|
||||
Object[] aValores = new Object[1];
|
||||
aValores[0] = "S";
|
||||
|
||||
Object[] aCondiciones = new Object[4];
|
||||
aCondiciones[0] = Integer.valueOf(tarjeta.getColectivo());
|
||||
aCondiciones[1] = Double.valueOf(tarjeta.getPoliza());
|
||||
aCondiciones[2] = Integer.valueOf(tarjeta.getBeneficiario());
|
||||
aCondiciones[3] = Integer.valueOf(tarjeta.getEntidadIMQ());
|
||||
|
||||
resultado = ParametrosConfiguracion.dataStore.actualizar(sqlUpdate.toString(), aValores, aCondiciones);
|
||||
}
|
||||
catch(ExcepcionTarisan ex)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la actualización de la firma del beneficiario " + tarjeta + ": " + ex + " (" + sqlUpdate + ")");
|
||||
throw ex;
|
||||
}*/
|
||||
|
||||
LogTarisan.logger.log(NivelLog.INFO, medico + " - Ya no se actualiza ttbenefi por que es vista materializada ");
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public boolean clienteCompatible(int medico)
|
||||
{
|
||||
boolean esCompatible = false;
|
||||
|
||||
return esCompatible;
|
||||
}
|
||||
|
||||
public Calendar obtenerFechaNacimiento(Tarjeta tarjeta, int medico)
|
||||
{
|
||||
Calendar fecnac = Calendar.getInstance();
|
||||
fecnac.set(Calendar.DAY_OF_MONTH, 1);
|
||||
fecnac.set(Calendar.MONTH, 1);
|
||||
fecnac.set(Calendar.YEAR, 1900);
|
||||
Connection conexion;
|
||||
try {
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
sqlSelect.append("Select fecha_nacimiento ");
|
||||
sqlSelect.append("from ttbenefi, ttclient ");
|
||||
sqlSelect.append("where ttclient.cliente = ttbenefi.cliente ");
|
||||
sqlSelect.append(" and (ttbenefi.fecha_baja is null or ttbenefi.fecha_baja > sysdate) ");
|
||||
|
||||
Object[] aCondiciones = new Object[1];
|
||||
if(tarjeta.getTarjeta()==0)
|
||||
{
|
||||
sqlSelect.append("and trim(ttbenefi.tarjeta_chipcard) = trim(?)");
|
||||
aCondiciones[0]=new String(tarjeta.getTarjetaDesplazado());
|
||||
}
|
||||
else
|
||||
{
|
||||
sqlSelect.append("and ttbenefi.tarjeta = ?");
|
||||
aCondiciones[0]=Integer.valueOf(tarjeta.getTarjeta());
|
||||
}
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
|
||||
try {
|
||||
while(rs.next())
|
||||
{
|
||||
if(rs.getDate("fecha_nacimiento") != null)
|
||||
fecnac.setTime(rs.getDate("fecha_nacimiento"));
|
||||
}
|
||||
rs.close();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, medico + " - Seleccionada la fecha de nacimiento: " + fecnac + " del cliente: " + tarjeta.getTarjetaDesplazado() + "/" + tarjeta.getTarjeta() + "de la tabla ttbenefi (" + sqlSelect + ")");
|
||||
} catch (SQLException e) {
|
||||
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
}
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
} catch (ExcepcionTarisan e1) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error al obtener la fecha de nacimiento de la tarjeta: "+tarjeta);
|
||||
}
|
||||
|
||||
return fecnac;
|
||||
}
|
||||
|
||||
public String obtenerNIF(Tarjeta tarjeta, int medico) throws ExcepcionTarisan
|
||||
{
|
||||
String nif = "";
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
sqlSelect.append("Select nif ");
|
||||
sqlSelect.append("from ttbenefi, ttclient ");
|
||||
sqlSelect.append("where ttclient.cliente = ttbenefi.cliente ");
|
||||
sqlSelect.append(" and (ttbenefi.fecha_baja is null or ttbenefi.fecha_baja > sysdate) ");
|
||||
Object[] aCondiciones = new Object[1];
|
||||
if(tarjeta.getTarjeta()==0)
|
||||
{
|
||||
sqlSelect.append("and trim(ttbenefi.tarjeta_chipcard) = trim(?)");
|
||||
aCondiciones[0]=new String(tarjeta.getTarjetaDesplazado());
|
||||
}
|
||||
else
|
||||
{
|
||||
sqlSelect.append("and ttbenefi.tarjeta = ?");
|
||||
aCondiciones[0]=Integer.valueOf(tarjeta.getTarjeta());
|
||||
}
|
||||
|
||||
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
|
||||
try {
|
||||
while(rs.next())
|
||||
{
|
||||
nif = rs.getString("nif");
|
||||
}
|
||||
rs.close();
|
||||
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, medico + " - Seleccionado el nif: " + nif + "del cliente: " + tarjeta.getTarjeta() + " de la tabla ttclient (" + sqlSelect + ")");
|
||||
|
||||
} catch (SQLException e) {
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - ERROR. "+e.toString());
|
||||
}
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
return nif;
|
||||
}
|
||||
|
||||
public String obtenerDomicilio(Tarjeta tarjeta, int medico) throws ExcepcionTarisan
|
||||
{
|
||||
String direccion = "";
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
sqlSelect.append("select ttclient.CP, ttclient.DIRECCION, ttclient.POBLACION");
|
||||
sqlSelect.append(" from ttclient, ttbenefi");
|
||||
sqlSelect.append(" where ttbenefi.CLIENTE = ttclient.CLIENTE ");
|
||||
|
||||
Object[] aCondiciones = new Object[1];
|
||||
if(tarjeta.getTarjeta()==0)
|
||||
{
|
||||
sqlSelect.append("and trim(ttbenefi.tarjeta_chipcard) = trim(?)");
|
||||
aCondiciones[0]=new String(tarjeta.getTarjetaDesplazado());
|
||||
}
|
||||
else
|
||||
{
|
||||
sqlSelect.append("and ttbenefi.tarjeta = ?");
|
||||
aCondiciones[0]=Integer.valueOf(tarjeta.getTarjeta());
|
||||
}
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
|
||||
try{
|
||||
while(rs.next())
|
||||
{
|
||||
direccion = rs.getString("DIRECCION").trim() + ", CP: " + rs.getString("CP").trim() + ". " + rs.getString("POBLACION").trim();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, medico + " - Obtenida dirección: "+direccion);
|
||||
}
|
||||
rs.close();
|
||||
}
|
||||
catch (SQLException e) {
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - ERROR. "+e.toString());
|
||||
}
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
|
||||
|
||||
return direccion;
|
||||
}
|
||||
|
||||
public boolean tieneDental(String chipCard, int medico) throws ExcepcionTarisan
|
||||
{
|
||||
boolean dental = false;
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
sqlSelect.append("Select ttbenefi.COLECTIVO ");
|
||||
sqlSelect.append("from ttbenefi, TTCOLECT ");
|
||||
sqlSelect.append("where ttbenefi.cliente in (select cliente from ttbenefi where tarjeta_chipcard = '" + chipCard + "') ");
|
||||
sqlSelect.append(" AND TTCOLECT.COLECTIVO = TTBENEFI.COLECTIVO ");
|
||||
sqlSelect.append(" AND TTCOLECT.CONTRATO = 723 ");
|
||||
sqlSelect.append(" and (TTBENEFI.FECHA_BAJA > sysdate OR TTBENEFI.FECHA_BAJA IS NULL)");
|
||||
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString());
|
||||
|
||||
try {
|
||||
if(rs.next())
|
||||
{
|
||||
dental = true;
|
||||
}
|
||||
rs.close();
|
||||
} catch (SQLException e) {
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - ERROR. "+e.toString());
|
||||
}
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
|
||||
return dental;
|
||||
}
|
||||
|
||||
public boolean tieneSalud(int entidad, long colectivo, int medico) throws ExcepcionTarisan
|
||||
{
|
||||
boolean salud = false;
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
sqlSelect.append("Select ttcolect.CONTRATO ");
|
||||
sqlSelect.append("from ttbenefi, TTCOLECT ");
|
||||
sqlSelect.append(" WHERE TTCOLECT.ENTIDAD = ? ");
|
||||
sqlSelect.append(" AND TTCOLECT.COLECTIVO = ? ");
|
||||
sqlSelect.append(" AND TTCOLECT.COLECTIVO = TTBENEFI.COLECTIVO ");
|
||||
sqlSelect.append(" AND TTCOLECT.ENTIDAD = TTBENEFI.ENTIDAD ");
|
||||
sqlSelect.append(" AND TTCOLECT.CONTRATO <> 723 ");
|
||||
sqlSelect.append(" and (TTBENEFI.FECHA_BAJA > sysdate OR TTBENEFI.FECHA_BAJA IS NULL)");
|
||||
|
||||
Object aCondiciones[] = new Object[2];
|
||||
aCondiciones[0] = Integer.valueOf(entidad);
|
||||
aCondiciones[1] = Long.valueOf(colectivo);
|
||||
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
|
||||
try {
|
||||
if(rs.next())
|
||||
{
|
||||
salud = true;
|
||||
}
|
||||
rs.close();
|
||||
} catch (SQLException e) {
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - ERROR. "+e.toString());
|
||||
}
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
|
||||
return salud;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,323 @@
|
||||
/**
|
||||
* @(#)
|
||||
*/
|
||||
package com.tarisan.control;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.Date;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Calendar;
|
||||
|
||||
import com.tarisan.data.RespuestaChipcard;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
import com.tarisan.log.LogTarisan;
|
||||
import com.tarisan.log.NivelLog;
|
||||
import com.tarisan.util.Utilidades;
|
||||
|
||||
public class PersistenciaRespuestaChipcard
|
||||
{
|
||||
public RespuestaChipcard parsearRespuesta(String response)
|
||||
{
|
||||
RespuestaChipcard resul = new RespuestaChipcard();
|
||||
if(response != null)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Llega 14: "+response);
|
||||
String campo = "";
|
||||
if(response.contains("<Error errcode"))
|
||||
{
|
||||
resul.set_error(true);
|
||||
campo = response.substring(response.indexOf("<Error errcode"));
|
||||
campo = response.substring(response.indexOf(">")+1, response.indexOf("</Error>"));
|
||||
resul.set_mensaje(campo);
|
||||
}
|
||||
else
|
||||
{
|
||||
resul.set_error(false);
|
||||
campo = response.substring(response.indexOf("<Tarjeta><num>"), response.indexOf("</num><ver>"));
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Llega 18");
|
||||
resul.set_tarjeta(campo);
|
||||
campo = "";
|
||||
campo = response.substring(response.indexOf("<Aut><response>"), response.indexOf("</response><desc>"));
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Llega 22");
|
||||
resul.set_respuesta(campo);
|
||||
campo = "";
|
||||
campo = response.substring(response.indexOf("</response><desc>"), response.indexOf("</desc><AutID>"));
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Llega 26");
|
||||
resul.set_mensaje(campo);
|
||||
campo = "";
|
||||
resul.set_talon_chipcard(Integer.parseInt(response.substring(response.indexOf("<numref>")+8, response.indexOf("</numref>"))));
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Llega 30");
|
||||
campo = "";
|
||||
resul.set_terminal(Integer.parseInt(response.substring(response.indexOf("<term>")+6, response.indexOf("</term>"))));
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Llega 33");
|
||||
campo = "";
|
||||
resul.set_especialidad(Integer.parseInt(response.substring(response.indexOf("<Espec>")+7, response.indexOf("</Espec>"))));
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Llega 53");
|
||||
campo = "";
|
||||
resul.set_acto(Integer.parseInt(response.substring(response.indexOf("<acto>")+6, response.indexOf("</acto>"))));
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Llega 56");
|
||||
campo = "";
|
||||
// <timestamp>2013-11-27-09.14.45.100121</timestamp>
|
||||
String tiempo = response.substring(response.indexOf("<timestamp>")+11, response.indexOf("</timestamp>"));
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Llega 61. tiempo: "+tiempo);
|
||||
Calendar cal = Calendar.getInstance();
|
||||
int anio = 0;
|
||||
int mes = 0;
|
||||
int dia = 0;
|
||||
int hora=0;
|
||||
int min=0;
|
||||
int sec=0;
|
||||
//cal.set(year, month, date, hourOfDay, minute, second);
|
||||
anio = Integer.valueOf(tiempo.substring(0, 4));
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "año "+anio);
|
||||
mes = Integer.valueOf(tiempo.substring(5,7));
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Mes "+mes);
|
||||
dia = Integer.valueOf(tiempo.substring(8,10));
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Dia "+dia);
|
||||
hora = Integer.valueOf(tiempo.substring(11, 13));
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "hora "+hora);
|
||||
min = Integer.valueOf(tiempo.substring(14, 16));
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "min "+min);
|
||||
sec = Integer.valueOf(tiempo.substring(17, 19));
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "sec "+sec);
|
||||
cal.clear();
|
||||
cal.set(Calendar.DAY_OF_MONTH, dia);
|
||||
cal.set(Calendar.MONTH, mes);
|
||||
cal.set(Calendar.YEAR, anio);
|
||||
cal.set(Calendar.HOUR_OF_DAY, hora);
|
||||
cal.set(Calendar.MINUTE, min);
|
||||
cal.set(Calendar.SECOND, sec);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Llega 83");
|
||||
resul.set_fecha_hora(new Date(cal.getTimeInMillis()));
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Llega 85");
|
||||
resul.set_xml(response);
|
||||
}
|
||||
}
|
||||
return resul;
|
||||
}
|
||||
|
||||
public Integer obtenerSecuencia()
|
||||
{
|
||||
Integer sec = 0;
|
||||
|
||||
String consulta = "select PETICION_CHIPCARD.NEXTVAL from dual";
|
||||
Connection conexion = null;
|
||||
try {
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, consulta);
|
||||
if(rs.next())
|
||||
sec = rs.getInt("NEXTVAL");
|
||||
}
|
||||
catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Excepcion TARISAN en obtenerSecuencia");
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Excepcion SQL en obtenerSecuencia");
|
||||
}
|
||||
|
||||
try {
|
||||
conexion.close();
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al cerrar la conexion con oracle");
|
||||
}
|
||||
|
||||
return sec;
|
||||
}
|
||||
|
||||
public boolean insertar_peticiones(int medico, int especialidad, int acto, String tarjeta, Calendar cal, Integer secuencia)
|
||||
{
|
||||
boolean resul = false;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object[] aValores = new Object[6];
|
||||
strSql.append("INSERT INTO CHIPCARD_PETICIONES (MEDICO, ESPECIALIDAD, ACTO, TARJETA_CHIPCARD, FECHA_HORA, SECUENCIA) VALUES (?, ?, ?, '?', TO_DATE('?', 'dd/mm/yyyy hh24:mi:ss'), ?)");
|
||||
aValores[0] = Integer.valueOf(medico);
|
||||
aValores[1] = Integer.valueOf(especialidad);
|
||||
aValores[2] = Integer.valueOf(acto);
|
||||
aValores[3] = new String(tarjeta);
|
||||
aValores[5] = Integer.valueOf(secuencia);
|
||||
String segundos = "";
|
||||
if(cal.get(Calendar.SECOND)<10)
|
||||
segundos = "0"+cal.get(Calendar.SECOND);
|
||||
else
|
||||
segundos = Integer.toString(cal.get(Calendar.SECOND));
|
||||
|
||||
aValores[4] = new String(cal.get(Calendar.DAY_OF_MONTH)+"/"+(cal.get(Calendar.MONTH)+1)+"/"+cal.get(Calendar.YEAR)+" "+cal.get(Calendar.HOUR_OF_DAY)+":"+cal.get(Calendar.MINUTE)+":"+segundos);
|
||||
|
||||
Connection conexion = null;
|
||||
try
|
||||
{
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, Utilidades.obtenerSentenciaSQL(strSql, aValores, null));
|
||||
resul = ParametrosConfiguracion.dataStore.insertar(Utilidades.obtenerSentenciaSQL(strSql, aValores, null), conexion);
|
||||
}catch (ExcepcionTarisan e1) {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Excepcion tarisan al generar la sentencia sql. "+strSql.toString()+aValores);
|
||||
}
|
||||
|
||||
try {
|
||||
conexion.close();
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al cerrar la conexion con oracle");
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recibe el objeto respuesta chipcard y lo inserta en la tabla Chipcard_movimientos.
|
||||
* @param res
|
||||
* @return
|
||||
*/
|
||||
public boolean insertar_movimientos(RespuestaChipcard res, Integer secuencia)
|
||||
{
|
||||
boolean resul = false;
|
||||
//INSERTAR EN CHIPCARD_MOVIMIENTOS PARA TENER EN BBDD LOS MOVIMIENTOS DE CHIPCARD
|
||||
/*
|
||||
* TARJETA VARCHAR2(24 BYTE),
|
||||
RESPUESTA VARCHAR2(255 BYTE),
|
||||
MENSAJE VARCHAR2(255 BYTE),
|
||||
AUTORIZACION NUMBER(10) NOT NULL,
|
||||
TERMINAL VARCHAR2(10 BYTE)
|
||||
*/
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object[] aValores = new Object[10];
|
||||
strSql.append("INSERT INTO CHIPCARD_MOVIMIENTOS (TARJETA, RESPUESTA, MENSAJE, AUTORIZACION, TERMINAL, ESPECIALIDAD, ACTO, FECHA_HORA, XMLCOMPLETO, SECUENCIA) VALUES ('?', '?', '?', ?, '?', ?, ?, to_date('?', 'dd/mm/yyyy hh24:mi:ss'), '?', ?)");
|
||||
aValores[0] = new String(res.get_tarjeta().substring(14));
|
||||
aValores[1] = new String(res.get_respuesta().substring(15));
|
||||
aValores[2] = new String(res.get_mensaje().substring(17));
|
||||
aValores[3] = Integer.valueOf(res.get_talon_chipcard());
|
||||
aValores[4] = Integer.valueOf(res.get_terminal());
|
||||
aValores[5] = Integer.valueOf(res.get_especialidad());
|
||||
aValores[6] = Integer.valueOf(res.get_acto());
|
||||
aValores[9] = Integer.valueOf(secuencia);
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(res.get_fecha_hora());
|
||||
String segundos = "";
|
||||
if(cal.get(Calendar.SECOND)<10)
|
||||
segundos = "0"+cal.get(Calendar.SECOND);
|
||||
else
|
||||
segundos = Integer.toString(cal.get(Calendar.SECOND));
|
||||
aValores[7] = new String(cal.get(Calendar.DAY_OF_MONTH)+"/"+(cal.get(Calendar.MONTH)+1)+"/"+cal.get(Calendar.YEAR)+" "+cal.get(Calendar.HOUR_OF_DAY)+":"+cal.get(Calendar.MINUTE)+":"+segundos);
|
||||
aValores[8] = new String(res.get_xml());
|
||||
try {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, Utilidades.obtenerSentenciaSQL(strSql, aValores, null));
|
||||
} catch (ExcepcionTarisan e1) {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Excepcion tarisan al generar la sentencia sql. "+strSql.toString()+aValores);
|
||||
}
|
||||
|
||||
|
||||
Connection conexion = null;
|
||||
try {
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
//resul = ParametrosConfiguracion.dataStore.insertar(strSql.toString(), aValores, conexion);
|
||||
resul = ParametrosConfiguracion.dataStore.insertar(Utilidades.obtenerSentenciaSQL(strSql, aValores, null), conexion);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Excepcion en chipcard_movimientos la respuesta: "+res.get_talon_chipcard()+", el error: "+e.toString());
|
||||
}
|
||||
|
||||
try {
|
||||
conexion.close();
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al cerrar la conexion con oracle");
|
||||
}
|
||||
return resul;
|
||||
}
|
||||
|
||||
public boolean talon_duplicado(Integer autoriz, int medico)
|
||||
{
|
||||
boolean resultado = false;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object[] aCondiciones = new Object[2];
|
||||
strSql.append("select count(talon_chipcard) cuantos from tamovext where talon_chipcard = ? and medico <> ?");
|
||||
aCondiciones[0]=autoriz;
|
||||
aCondiciones[0]=medico;
|
||||
Connection conexion = null;
|
||||
try{
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
if(rs.next())
|
||||
{
|
||||
int cuanto = rs.getInt("CUANTOS");
|
||||
if(cuanto > 0)
|
||||
resultado = true;
|
||||
}
|
||||
}
|
||||
catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Excepcion en talon_duplicado");
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Excepcion en talon_duplicado");
|
||||
}
|
||||
|
||||
try {
|
||||
conexion.close();
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al cerrar la conexion con oracle");
|
||||
}
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hemos detectado que si hay dos peticiones exáctamente al mismo tiempo las respuestas se alternan y da un error a pesar de que la respuesta haya sido autorizada.
|
||||
* para asegurarnos buscamos la secuencia de la petición en la tabla de respuestas y "recomprobamos" el resultado
|
||||
* @param secuencia
|
||||
* @return
|
||||
*/
|
||||
public boolean obtener_resultado_secuencia(Integer secuencia)
|
||||
{
|
||||
boolean resul = false;
|
||||
String sql = "SELECT RESPUESTA FROM CHIPCARD_MOVIMIENTOS WHERE SECUENCIA = "+secuencia;
|
||||
Connection conexion = null;
|
||||
try
|
||||
{
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sql);
|
||||
if(rs.next())
|
||||
{
|
||||
String respuesta = rs.getString("RESPUESTA");
|
||||
if(respuesta.contains(ParametrosConfiguracion.chipcard_oper_auto))
|
||||
resul = true;
|
||||
}
|
||||
}catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Excepcion tarisan al obtener resultado por secuencia");
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Excepcion sql al obtener resultado por secuencia");
|
||||
}
|
||||
|
||||
try {
|
||||
conexion.close();
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al cerrar la conexion con oracle");
|
||||
}
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Se encuentra la secuencia "+secuencia+"? "+resul);
|
||||
return resul;
|
||||
}
|
||||
|
||||
public String obtener_respuesta_secuencia(Integer secuencia)
|
||||
{
|
||||
String resul = "";
|
||||
String sql = "SELECT XMLCOMPLETO FROM CHIPCARD_MOVIMIENTOS WHERE SECUENCIA = "+secuencia;
|
||||
Connection conexion = null;
|
||||
try
|
||||
{
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sql);
|
||||
if(rs.next())
|
||||
{
|
||||
resul = rs.getString("XMLCOMPLETO");
|
||||
}
|
||||
}catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Excepcion tarisan al obtener resultado por secuencia");
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Excepcion sql al obtener resultado por secuencia");
|
||||
}
|
||||
|
||||
try {
|
||||
conexion.close();
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al cerrar la conexion con oracle");
|
||||
}
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Se encuentra la secuencia "+secuencia+"? "+resul);
|
||||
|
||||
return resul;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* @(#) PersistenciaPaciente.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.excepcion.*;
|
||||
import com.tarisan.log.*;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Calendar;
|
||||
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>Paciente</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaTTColect implements Constantes
|
||||
{
|
||||
|
||||
/**
|
||||
* Selecciona el primer registro de la tabla ttbenefi encontrado para la tarjeta de paciente pasada por el médico.
|
||||
* @param tarjeta El objeto <code>Tarjeta</code> para el que se realiza la búsqueda.
|
||||
* @return El <code>Paciente</code> encontrado en la tabla de beneficiarios,
|
||||
* o null si se produce alguna excepción.
|
||||
* @throws
|
||||
*/
|
||||
public int obtenerContrato(int entidad, long colectivo) throws ExcepcionTarisan
|
||||
{
|
||||
int contrato=0;
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
|
||||
try
|
||||
{
|
||||
sqlSelect.append("SELECT CONTRATO");
|
||||
sqlSelect.append(" FROM TTCOLECT");
|
||||
sqlSelect.append(" WHERE ENTIDAD = ?");
|
||||
sqlSelect.append(" AND COLECTIVO = ?");
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
Object aCondiciones[] = new Object[2];
|
||||
aCondiciones[0] = Integer.valueOf(entidad);
|
||||
aCondiciones[1] = Long.valueOf(colectivo);
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
while(rs.next())
|
||||
{
|
||||
contrato = rs.getInt("CONTRATO");
|
||||
}
|
||||
rs.close();
|
||||
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado el contrato: " + contrato + " de la tabla TTCOLECT (" + sqlSelect + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de morosidad del cliente: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan();
|
||||
}
|
||||
|
||||
return contrato;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
package com.tarisan.control;
|
||||
|
||||
|
||||
import com.tarisan.data.TTFranquiciasDentales;
|
||||
import com.tarisan.data.Tamedico;
|
||||
import com.tarisan.excepcion.*;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.util.Utilidades;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Vector;
|
||||
|
||||
public class PersistenciaTTFranquiciasDentales {
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtiene una franquicia dental.
|
||||
* @param especialidad Numero de especialidad.
|
||||
* @param entidad Número de entidad.
|
||||
* @param colectivo Número de colectivo.
|
||||
* @param anio.
|
||||
* @return Objeto <code>TTFranquiciasDentales</code>.
|
||||
* @throws
|
||||
*/
|
||||
public Vector obtenerFranquicia(int especialidad, int entidad, long colectivo, int anio, String busquedaActo, int pagina) throws ExcepcionTarisan
|
||||
{
|
||||
int elementosPaginacion=1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
TTFranquiciasDentales ttFranquiciasDentales = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT ttfranquicias_dentales.precio, ttfranquicias_dentales.acto, ttactmed.descripcion");
|
||||
strSql.append(" FROM ttfranquicias_dentales, ttactmed");
|
||||
strSql.append(" WHERE ttactmed.especialidad = TTFRANQUICIAS_DENTALES.ESPECIALIDAD");
|
||||
strSql.append(" AND ttactmed.ACTO = TTFRANQUICIAS_DENTALES.ACTO");
|
||||
strSql.append(" AND ttfranquicias_dentales.especialidad=?");
|
||||
strSql.append(" AND ttfranquicias_dentales.entidad=?");
|
||||
strSql.append(" AND ttfranquicias_dentales.colectivo=?");
|
||||
strSql.append(" AND ttfranquicias_dentales.anio=?");
|
||||
|
||||
//comprobamos si se trata de una busqueda de actos medicos
|
||||
if (!busquedaActo.equalsIgnoreCase("")) //la sql tiene tres parametros
|
||||
{
|
||||
if (busquedaActo.endsWith("*"))
|
||||
busquedaActo=busquedaActo.replace('*', '%');
|
||||
else
|
||||
busquedaActo="%" + busquedaActo + "%";
|
||||
|
||||
strSql.append(" AND ttactmed.descripcion LIKE ?");
|
||||
|
||||
//el array de objetos sera de tres elementos
|
||||
aCondiciones = new Object[5];
|
||||
aCondiciones[4] = busquedaActo;
|
||||
}
|
||||
else //la sql solo tiene dos parametros
|
||||
aCondiciones = new Object[4];
|
||||
|
||||
aCondiciones[0] = Integer.valueOf(especialidad);
|
||||
aCondiciones[1] = Integer.valueOf(entidad);
|
||||
aCondiciones[2] = Long.valueOf(colectivo);
|
||||
aCondiciones[3] = Integer.valueOf(anio);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones));
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
ttFranquiciasDentales = new TTFranquiciasDentales();
|
||||
ttFranquiciasDentales.setEspecialidad(especialidad);
|
||||
ttFranquiciasDentales.setActo(rs.getInt("ACTO"));
|
||||
ttFranquiciasDentales.setEntidad(entidad);
|
||||
ttFranquiciasDentales.setColectivo(colectivo);
|
||||
ttFranquiciasDentales.setAnio(anio);
|
||||
ttFranquiciasDentales.setPrecio(rs.getInt("PRECIO"));
|
||||
ttFranquiciasDentales.setDescripcion(rs.getString("DESCRIPCION"));
|
||||
vResultado.addElement(ttFranquiciasDentales);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Franquicia dental obtenida de la tabla ttfranquicias_dentales es: (" + strSql.toString() + ")");
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de ttfranquicias_dentales: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de ttfranquicias_dentales: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de ttfranquicias_dentales: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de ttfranquicias_dentales: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public int obtenerNumeroFranquicia(int especialidad, int entidad, long colectivo, int anio)
|
||||
{
|
||||
|
||||
int resultado = 0;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT distinct(ttfranquicias_dentales.tipo_franquicia)");
|
||||
strSql.append(" FROM ttfranquicias_dentales");
|
||||
strSql.append(" WHERE ttfranquicias_dentales.especialidad=?");
|
||||
strSql.append(" AND ttfranquicias_dentales.entidad=?");
|
||||
strSql.append(" AND ttfranquicias_dentales.colectivo=?");
|
||||
strSql.append(" AND ttfranquicias_dentales.anio=?");
|
||||
|
||||
aCondiciones = new Object[4];
|
||||
|
||||
aCondiciones[0] = Integer.valueOf(especialidad);
|
||||
aCondiciones[1] = Integer.valueOf(entidad);
|
||||
aCondiciones[2] = Long.valueOf(colectivo);
|
||||
aCondiciones[3] = Integer.valueOf(anio);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones));
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
if(rs.next())
|
||||
{
|
||||
resultado = rs.getInt("TIPO_FRANQUICIA");
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Franquicia dental obtenida de la tabla ttfranquicias_dentales es: (" + strSql.toString() + ")");
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de ttfranquicias_dentales: " + sqle + " (" + strSql.toString() + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de ttfranquicias_dentales: " + sqle + " (" + strSql.toString() + ")");
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de ttfranquicias_dentales: " + sqle + " (" + strSql.toString() + ")");
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de ttfranquicias_dentales: " + sqle + " (" + strSql.toString() + ")");
|
||||
|
||||
}
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public int obtenerNumeroFranquiciaPorContrato(int contrato)
|
||||
{
|
||||
|
||||
int resultado = 0;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT distinct(ttfranquicias_dentales.tipo_franquicia)");
|
||||
strSql.append(" FROM ttfranquicias_dentales");
|
||||
strSql.append(" WHERE ttfranquicias_dentales.contrato=?");
|
||||
|
||||
aCondiciones = new Object[1];
|
||||
|
||||
aCondiciones[0] = Integer.valueOf(contrato);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones));
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
if(rs.next())
|
||||
{
|
||||
resultado = rs.getInt("TIPO_FRANQUICIA");
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Franquicia dental obtenida de la tabla ttfranquicias_dentales es: (" + strSql.toString() + ")");
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de ttfranquicias_dentales: " + sqle + " (" + strSql.toString() + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de ttfranquicias_dentales: " + sqle + " (" + strSql.toString() + ")");
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de ttfranquicias_dentales: " + sqle + " (" + strSql.toString() + ")");
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de ttfranquicias_dentales: " + sqle + " (" + strSql.toString() + ")");
|
||||
|
||||
}
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,430 @@
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.Paciente;
|
||||
import com.tarisan.data.TTMovaut;
|
||||
import com.tarisan.data.Tarjeta;
|
||||
import com.tarisan.data.Taconaut;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
import com.tarisan.log.LogTarisan;
|
||||
import com.tarisan.log.NivelLog;
|
||||
import com.tarisan.util.Utilidades;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la Tabla TTMovaut para gestionar las autorizaciones de un beneficiario
|
||||
* @author csm_jjripaper
|
||||
*
|
||||
*/
|
||||
public class PersistenciaTTMovaut implements Constantes
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
/**
|
||||
* Obtener el número de autorización a partir de la entidad, colectivo, poliza y orden de un beneficiario
|
||||
* @param entidad La entidad
|
||||
* @param col El colectivo
|
||||
* @param pol La póliza
|
||||
* @param ord El orden
|
||||
* @return El número de autorización, 0 si no tiene ninguna activa.
|
||||
*/
|
||||
public long ObtenerAutorizacion(int entidad, int col, int pol, int ord, int medico)
|
||||
{
|
||||
long autorizacion = 0;
|
||||
Paciente pac = new Paciente();
|
||||
Tarjeta tarjeta = new Tarjeta();
|
||||
tarjeta.setColectivo(col);
|
||||
tarjeta.setPoliza(pol);
|
||||
tarjeta.setBeneficiario(ord);
|
||||
pac.setTarjeta(tarjeta);
|
||||
autorizacion = ObtenerAutorizacion(pac, medico);
|
||||
return autorizacion;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtener el número de autorización a partir de un objeto paciente
|
||||
* @param pac El paciente
|
||||
* @param medico El médico solicitante de la autorizacion
|
||||
* @return El número de autorización, 0 si no tiene ninguna autorización
|
||||
*/
|
||||
public long ObtenerAutorizacion(Paciente pac, int medico)
|
||||
{
|
||||
long autorizacion = 0;
|
||||
int acto = 0;
|
||||
int cantidad = 0;
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
PersistenciaTamedico persistenciaTamedico = new PersistenciaTamedico();
|
||||
|
||||
try
|
||||
{
|
||||
sqlSelect.append("SELECT autorizacion from ttmovaut ");
|
||||
sqlSelect.append("WHERE MEDICO = ? ");
|
||||
sqlSelect.append("AND (especialidad1 = ? or ");
|
||||
sqlSelect.append("especialidad2 = ? or ");
|
||||
sqlSelect.append("especialidad3 = ? or ");
|
||||
sqlSelect.append("especialidad4 = ?) ");
|
||||
sqlSelect.append("AND colectivo = ? ");
|
||||
sqlSelect.append("AND poliza = ? ");
|
||||
sqlSelect.append("AND orden = ? ");
|
||||
sqlSelect.append("AND fecha_autorizacion <= sysdate");
|
||||
sqlSelect.append(" order by FECHA_AUTORIZACION asc");
|
||||
|
||||
|
||||
Object aCondiciones[] = new Object[8];
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
aCondiciones[1] = Integer.valueOf(persistenciaTamedico.obtenerEspecialidad(medico));
|
||||
aCondiciones[2] = Integer.valueOf(persistenciaTamedico.obtenerEspecialidad(medico));
|
||||
aCondiciones[3] = Integer.valueOf(persistenciaTamedico.obtenerEspecialidad(medico));
|
||||
aCondiciones[4] = Integer.valueOf(persistenciaTamedico.obtenerEspecialidad(medico));
|
||||
aCondiciones[5] = Long.valueOf(pac.getTarjeta().getColectivo());
|
||||
aCondiciones[6] = Double.valueOf(pac.getTarjeta().getPoliza());
|
||||
aCondiciones[7] = Integer.valueOf(pac.getTarjeta().getBeneficiario());
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Sentencia:" +Utilidades.obtenerSentenciaSQL(sqlSelect, null, aCondiciones));
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
while(rs.next())
|
||||
{
|
||||
autorizacion = rs.getLong("autorizacion");
|
||||
}
|
||||
rs.close();
|
||||
|
||||
}
|
||||
catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de la autorizacion del paciente: " + e.toString() + " (" + sqlSelect + ")");
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de la autorizacion del paciente: " + e.toString() + " (" + sqlSelect + ")");
|
||||
}
|
||||
|
||||
return autorizacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clase para saber que actos están incluidos en una autorización y que el médico solo pueda seleccionar entre esos actos.
|
||||
* @param autorizacion El número de la autorización
|
||||
* @return Un vector con los códigos de los actos autorizados
|
||||
*/
|
||||
public Vector ObtenerActosAutorizados(long autorizacion, int especialidad){
|
||||
Vector vSeleccion = new Vector();
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
try
|
||||
{
|
||||
sqlSelect.append("SELECT acto1, especialidad2, acto2, especialidad3, acto3, especialidad4, acto4 from ttmovaut ");
|
||||
sqlSelect.append("WHERE autorizacion = ? ");
|
||||
|
||||
Object aCondiciones[] = new Object[1];
|
||||
aCondiciones[0] = Long.valueOf(autorizacion);
|
||||
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
while(rs.next())
|
||||
{
|
||||
vSeleccion.addElement(rs.getInt("acto1"));
|
||||
if(rs.getInt("especialidad2") == especialidad)
|
||||
vSeleccion.addElement(rs.getInt("acto2"));
|
||||
|
||||
if(rs.getInt("especialidad3") == especialidad)
|
||||
vSeleccion.addElement(rs.getInt("acto3"));
|
||||
|
||||
if(rs.getInt("especialidad4") == especialidad)
|
||||
vSeleccion.addElement(rs.getInt("acto4"));
|
||||
}
|
||||
rs.close();
|
||||
|
||||
}
|
||||
catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de la autorizacion del paciente: " + e.toString() + " (" + sqlSelect + ")");
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de la autorizacion del paciente: " + e.toString() + " (" + sqlSelect + ")");
|
||||
}
|
||||
|
||||
return vSeleccion;
|
||||
}
|
||||
|
||||
public Vector ObtenerAutorizacionesPoliza(long autorizacion)
|
||||
{
|
||||
Vector resultado = new Vector();
|
||||
TTMovaut ttmov = ObtenerAutorizacionTTmovaut(autorizacion);
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
try
|
||||
{
|
||||
sqlSelect.append("select autorizacion from ttmovaut ");
|
||||
sqlSelect.append("where entidad = ? ");
|
||||
sqlSelect.append("and colectivo = ? ");
|
||||
sqlSelect.append("and poliza = ? ");
|
||||
sqlSelect.append("and orden = ? ");
|
||||
Object aCondiciones[] = new Object[4];
|
||||
aCondiciones[0] = Integer.valueOf(ttmov.get_entidad());
|
||||
aCondiciones[1] = Long.valueOf(ttmov.get_colectivo());
|
||||
aCondiciones[2] = Long.valueOf(ttmov.get_poliza());
|
||||
aCondiciones[3] = Integer.valueOf(ttmov.get_orden());
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
while(rs.next())
|
||||
{
|
||||
resultado.add(rs.getLong("AUTORIZACION"));
|
||||
}
|
||||
}
|
||||
catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de las autorizaciones del paciente: " + e.toString() + " (" + sqlSelect + ")");
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de las autorizaciones del paciente: " + e.toString() + " (" + sqlSelect + ")");
|
||||
}
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public Vector ObtenerAutorizacionADM(long autorizacion)
|
||||
{
|
||||
Vector resultado = new Vector();
|
||||
Taconaut tacon = new Taconaut();
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
try
|
||||
{
|
||||
sqlSelect.append("select * from ttmovaut ");
|
||||
sqlSelect.append("where autorizacion = ?");
|
||||
Object aCondiciones[] = new Object[1];
|
||||
aCondiciones[0] = Long.valueOf(autorizacion);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
while(rs.next())
|
||||
{
|
||||
for(int i=1;i<5;i++)
|
||||
{
|
||||
if(rs.getInt("cantidad"+i) >0)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "ObtenerAutorizacionADM - Llega 165 - Iteracion: "+i);
|
||||
tacon = new Taconaut();
|
||||
tacon.setActo(rs.getInt("acto"+i));
|
||||
tacon.setAutorizacion(String.valueOf(autorizacion));
|
||||
tacon.setCantidad(rs.getInt("cantidad"+i));
|
||||
tacon.setEspecialidad(rs.getInt("especialidad"+i));
|
||||
tacon.setFromGesigu(true);
|
||||
tacon.setInforme("");
|
||||
tacon.setMedico(rs.getInt("medico"));
|
||||
resultado.add(tacon);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de la autorizacion del paciente: " + e.toString() + " (" + sqlSelect + ")");
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de la autorizacion del paciente: " + e.toString() + " (" + sqlSelect + ")");
|
||||
}
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public TTMovaut ObtenerAutorizacionTTmovaut(long autorizacion){
|
||||
TTMovaut ttmov = new TTMovaut();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Inicia ObtenerAutorizacionTTMovaut");
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
try
|
||||
{
|
||||
sqlSelect.append("Select * from ttmovaut ");
|
||||
sqlSelect.append("where autorizacion = ?");
|
||||
|
||||
Object aCondiciones[] = new Object[1];
|
||||
aCondiciones[0] = Long.valueOf(autorizacion);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
|
||||
if(rs.next())
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Se encuentra la autorizacion: "+autorizacion);
|
||||
ttmov.set_autorizacion(autorizacion);
|
||||
ttmov.set_medico(rs.getInt("MEDICO"));
|
||||
ttmov.set_especialidad1(rs.getInt("ESPECIALIDAD1"));
|
||||
ttmov.set_acto1(rs.getInt("ACTO1"));
|
||||
ttmov.set_entidad(rs.getInt("ENTIDAD"));
|
||||
ttmov.set_colectivo(rs.getLong("COLECTIVO"));
|
||||
ttmov.set_poliza(rs.getLong("POLIZA"));
|
||||
ttmov.set_orden(rs.getInt("ORDEN"));
|
||||
ttmov.set_fecha_autorizacion(rs.getDate("FECHA_AUTORIZACION"));
|
||||
ttmov.set_prescriptor(rs.getInt("PRESCRIPTOR"));
|
||||
ttmov.set_provincia(rs.getString("PROVINCIA"));
|
||||
ttmov.set_cantidad1(rs.getInt("CANTIDAD1"));
|
||||
ttmov.set_descripcion1(rs.getString("DESCRIPCION1"));
|
||||
ttmov.set_fecha_validez(rs.getDate("FECHA_VALIDEZ"));
|
||||
ttmov.set_nombre_completo(rs.getString("NOMBRE_COMPLETO"));
|
||||
ttmov.set_especialidad2(rs.getInt("ESPECIALIDAD2"));
|
||||
ttmov.set_acto2(rs.getInt("ACTO2"));
|
||||
ttmov.set_cantidad2(rs.getInt("CANTIDAD2"));
|
||||
ttmov.set_descripcion2(rs.getString("DESCRIPCION2"));
|
||||
ttmov.set_especialidad3(rs.getInt("ESPECIALIDAD3"));
|
||||
ttmov.set_acto3(rs.getInt("ACTO3"));
|
||||
ttmov.set_cantidad3(rs.getInt("CANTIDAD3"));
|
||||
ttmov.set_descripcion3(rs.getString("DESCRIPCION3"));
|
||||
ttmov.set_especialidad4(rs.getInt("ESPECIALIDAD4"));
|
||||
ttmov.set_acto4(rs.getInt("ACTO4"));
|
||||
ttmov.set_cantidad4(rs.getInt("CANTIDAD4"));
|
||||
ttmov.set_descripcion4(rs.getString("DESCRIPCION4"));
|
||||
ttmov.set_texto(rs.getString("TEXTO"));
|
||||
ttmov.set_usuario(rs.getString("USUARIO"));
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Se ha cargado bien la autorizacion: "+autorizacion);
|
||||
}
|
||||
}
|
||||
catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de la autorizacion del paciente: " + e.toString() + " (" + sqlSelect + ")");
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de la autorizacion del paciente: " + e.toString() + " (" + sqlSelect + ")");
|
||||
}
|
||||
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Fin ObtenerAutorizacionTTMovaut");
|
||||
return ttmov;
|
||||
}
|
||||
|
||||
public int ObtenerCantidadActoAutorizado(long autorizacion, int acto)
|
||||
{
|
||||
int cuantos = 0;
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
|
||||
try
|
||||
{
|
||||
sqlSelect.append("SELECT cantidad1, cantidad2, cantidad3, cantidad4, acto1, acto2, acto3, acto4 from ttmovaut ");
|
||||
sqlSelect.append("WHERE autorizacion = ? ");
|
||||
sqlSelect.append("and (acto1 = ? or acto2 = ? or acto3 = ? or acto4 = ?)");
|
||||
|
||||
Object aCondiciones[] = new Object[5];
|
||||
aCondiciones[0] = Long.valueOf(autorizacion);
|
||||
aCondiciones[1] = Integer.valueOf(acto);
|
||||
aCondiciones[2] = Integer.valueOf(acto);
|
||||
aCondiciones[3] = Integer.valueOf(acto);
|
||||
aCondiciones[4] = Integer.valueOf(acto);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
if(rs.getInt("acto1") == acto)
|
||||
cuantos = rs.getInt("cantidad1");
|
||||
if(rs.getInt("acto2") == acto)
|
||||
cuantos = rs.getInt("cantidad2");
|
||||
if(rs.getInt("acto3") == acto)
|
||||
cuantos = rs.getInt("cantidad3");
|
||||
if(rs.getInt("acto4") == acto)
|
||||
cuantos = rs.getInt("cantidad4");
|
||||
}
|
||||
rs.close();
|
||||
|
||||
}
|
||||
catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en ObtenerCantidadActoAutorizado: " + e.toString() + " (" + sqlSelect + ")");
|
||||
}
|
||||
catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en ObtenerCantidadActoAutorizado: " + e.toString() + " (" + sqlSelect + ")");
|
||||
}
|
||||
|
||||
return cuantos;
|
||||
}
|
||||
|
||||
/*public Vector BuscarAutorizacionPorMedicoYPoliza(int medico, int colectivo, long poliza, int orden)
|
||||
{
|
||||
Vector resultado = new Vector();
|
||||
String sqlSelect = new String();
|
||||
String tarjeta="";
|
||||
String tarjeta_chipcard="";
|
||||
try
|
||||
{
|
||||
sqlSelect = "select * from ttmovaut where medico = "+ medico + " and colectivo = "+ colectivo + " and poliza = "+ poliza + " and orden = "+ orden;
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString());
|
||||
while(rs.next())
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "BuscarAutorizacionPorMedicoYPoliza - Llega 165 - Iteracion: ");
|
||||
Taconaut tacon = new Taconaut();
|
||||
tacon.setActo(rs.getInt("acto1"));
|
||||
tacon.setAutorizacion(rs.getString("autorizacion"));
|
||||
tacon.setCantidad(rs.getInt("cantidad1"));
|
||||
tacon.setEspecialidad(rs.getInt("especialidad1"));
|
||||
tacon.setFromGesigu(true);
|
||||
tacon.setInforme("");
|
||||
tacon.setMedico(rs.getInt("medico"));
|
||||
resultado.add(tacon);
|
||||
|
||||
}
|
||||
rs.close();
|
||||
|
||||
}
|
||||
catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de la autorizacion del paciente: " + e.toString() + " (" + sqlSelect + ")");
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de la autorizacion del paciente: " + e.toString() + " (" + sqlSelect + ")");
|
||||
}
|
||||
return resultado;
|
||||
} */
|
||||
|
||||
public Vector BuscarAutorizacionPorMedicoYPoliza(int medico, int colectivo, long poliza, int orden, int pagina)
|
||||
{
|
||||
int elementosPaginacion=1;
|
||||
Vector resultado = new Vector();
|
||||
String sqlSelect = new String();
|
||||
String tarjeta="";
|
||||
String tarjeta_chipcard="";
|
||||
try
|
||||
{
|
||||
sqlSelect = "select * from ttmovaut where medico = "+ medico + " and colectivo = "+ colectivo + " and poliza = "+ poliza + " and orden = "+ orden;
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString());
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "BuscarAutorizacionPorMedicoYPoliza - Llega 165 - Iteracion: ");
|
||||
Taconaut tacon = new Taconaut();
|
||||
tacon.setActo(rs.getInt("acto1"));
|
||||
tacon.setAutorizacion(rs.getString("autorizacion"));
|
||||
tacon.setCantidad(rs.getInt("cantidad1"));
|
||||
tacon.setEspecialidad(rs.getInt("especialidad1"));
|
||||
tacon.setFromGesigu(true);
|
||||
tacon.setInforme("");
|
||||
tacon.setMedico(rs.getInt("medico"));
|
||||
resultado.add(tacon);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
|
||||
}
|
||||
catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de la autorizacion del paciente: " + e.toString() + " (" + sqlSelect + ")");
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de la autorizacion del paciente: " + e.toString() + " (" + sqlSelect + ")");
|
||||
}
|
||||
return resultado;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,263 @@
|
||||
package com.tarisan.control;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Calendar;
|
||||
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
import com.tarisan.log.LogTarisan;
|
||||
import com.tarisan.log.NivelLog;
|
||||
import com.tarisan.util.Utilidades;
|
||||
import com.tarisan.data.*;
|
||||
|
||||
public class PersistenciaTaDespla implements Constantes
|
||||
{
|
||||
public Tadespla Seleccionar_Tadespla(String tarjeta)
|
||||
{
|
||||
Tadespla tades = new Tadespla ();
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
tades.set_tarjeta("");
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "PersistenciaTaDespla - Seleccionar_Tadespla - Inicio");
|
||||
try {
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
sqlSelect.append("Select * from tadesplaz ");
|
||||
sqlSelect.append("where TARJETA_CHIPCARD = ?");
|
||||
|
||||
Object aCondiciones[] = new Object[1];
|
||||
aCondiciones[0] = new String(tarjeta);
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
while(rs.next())
|
||||
{
|
||||
tades.set_tarjeta((tarjeta == null)?"":tarjeta);
|
||||
tades.setContrato(rs.getInt("CONTRATO_CHIPCARD"));
|
||||
tades.setEntidad_chipcard(rs.getInt("ENTIDAD_CHIPCARD"));
|
||||
tades.setFecha_Alta(rs.getDate("FECHA_ALTA"));
|
||||
tades.setFecha_Registro(rs.getDate("FECHA_REGISTRO"));
|
||||
tades.setNombre(rs.getString("NOMBRE_COMPLETO"));
|
||||
tades.setResultado(rs.getInt("TRATADO"));
|
||||
}
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "PersistenciaTaDespla - Seleccionar_Tadespla - Error: " + e.toString() + " (" + sqlSelect.toString() + ")");
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "PersistenciaTaDespla - Seleccionar_Tadespla - Error: " + e.toString() + " (" + sqlSelect.toString() + ")");
|
||||
}
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "PersistenciaTaDespla - Seleccionar_Tadespla - Fin");
|
||||
return tades;
|
||||
}
|
||||
|
||||
public Date UltimaVisita_Tadespla(int tarjeta, int medico, int espe) throws ExcepcionTarisan
|
||||
{
|
||||
Date resultado = new Date(Calendar.getInstance().getTimeInMillis());
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "\nPersistenciaTaDespla - UltimaVisita_Tadespla - Inicio");
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
sqlSelect.append("Select max(fecha_imp) as fecha_imp from tadespla ");
|
||||
sqlSelect.append("where tarjeta = ? ");
|
||||
sqlSelect.append("and medico = ? ");
|
||||
sqlSelect.append("and especialidad = ? ");
|
||||
|
||||
Object aCondiciones[] = new Object[3];
|
||||
aCondiciones[0] = Integer.valueOf(tarjeta);
|
||||
aCondiciones[1] = Integer.valueOf(medico);
|
||||
aCondiciones[2] = Integer.valueOf(espe);
|
||||
|
||||
try
|
||||
{
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
while(rs.next())
|
||||
{
|
||||
resultado = rs.getDate("fecha_imp");
|
||||
}
|
||||
rs.close();
|
||||
}
|
||||
catch (ExcepcionTarisan e) {
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
resultado.setTime(1);
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "PersistenciaTaDespla - UltimaVisita_Tadespla - Error: " + e.toString() + " (" + sqlSelect + ")");
|
||||
} catch (SQLException e) {
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
resultado.setTime(1);
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "PersistenciaTaDespla - UltimaVisita_Tadespla - Error: " + e.toString() + " (" + sqlSelect + ")");
|
||||
}
|
||||
if(resultado == null)
|
||||
{
|
||||
resultado = new Date(Calendar.getInstance().getTimeInMillis());
|
||||
resultado.setTime(1);
|
||||
}
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "\nPersistenciaTaDespla - UltimaVisita_Tadespla - Final");
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public boolean esPrimeraVisitaTarisan(int tarjeta, int medico, int espe)
|
||||
{
|
||||
boolean resultado = false;
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Inicio - esprimeravisitatarisan: tarjeta:"+tarjeta+" medico:"+medico+" espe:"+espe);
|
||||
|
||||
Calendar ultimavisita = Calendar.getInstance();
|
||||
Calendar fechaAct = Calendar.getInstance();
|
||||
try {
|
||||
ultimavisita.setTime(UltimaVisita_Tadespla(tarjeta, medico, espe));
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "esprimeravisitatarisan - Tenemos la fecha de la ultima visita: ");
|
||||
|
||||
if(ultimavisita == null)
|
||||
{
|
||||
resultado = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(fechaAct.get(Calendar.YEAR) != ultimavisita.get(Calendar.YEAR))
|
||||
resultado = true;
|
||||
else
|
||||
resultado = false;
|
||||
}
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al calcular la PrimeravisitaTarisan"+e);
|
||||
}
|
||||
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
/**
|
||||
* Funcion que inserta una línea en la tabla tadespla, recibe un objeto Tadespla
|
||||
* @param tades
|
||||
* @return Devuelve cierto o falso según si la inserción se ha realizado correctamente o no...
|
||||
* @throws ExcepcionTarisan
|
||||
*/
|
||||
public boolean Insertar_Tadespla(Tadespla tades, int medico) throws ExcepcionTarisan
|
||||
{
|
||||
boolean exito = false;
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "\n\nPersistencaTaDespla - Insertar_Tadespla - Inicio");
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Valores: "+tades.getContrato()+" - "+tades.getEntidad_chipcard()+" - "+tades.getNombre()+" - "+tades.getTarjeta()+" - "+tades.getTroquelado());
|
||||
Connection conexion = null;
|
||||
/*Tadespla verify = Seleccionar_Tadespla(tades.getTarjeta());
|
||||
if(verify.getTarjeta().length()>0)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.INFO, "Se ha vuelto a intentar insertar el desplazado : "+verify.getNombre());
|
||||
|
||||
java.sql.Date dtFecha = new java.sql.Date(Calendar.getInstance().getTime().getTime());
|
||||
|
||||
sqlSelect.append("UPDATE TADESPLAZ SET TRATADO = 0, FECHA_REGISTRO = ? ");
|
||||
sqlSelect.append("WHERE TADESPLAZ.TARJETA_CHIPCARD = ?");
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ParametrosConfiguracion.dataStore.iniciarTransaccion(conexion);
|
||||
Object aCondiciones[] = new Object[1];
|
||||
aCondiciones[0] = new String(tades.getTarjeta());
|
||||
Object aValores[] = new Object[1];
|
||||
aValores[0] = (String)Utilidades.formatear_fecha(dtFecha);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Update embosado: "+Utilidades.obtenerSentenciaSQL(sqlSelect, aValores, aCondiciones));
|
||||
exito = ParametrosConfiguracion.dataStore.actualizar(sqlSelect.toString(), aValores, aCondiciones);
|
||||
if (exito)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Actualizar tratado tadespla - Exito al ponerlo a cero");
|
||||
ParametrosConfiguracion.dataStore.confirmarTransaccion(conexion);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Actualizar tratado tadespla - Fallo al ponerlo a cero");
|
||||
ParametrosConfiguracion.dataStore.deshacerTransaccion(conexion);
|
||||
}
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
}
|
||||
else
|
||||
{*/
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
sqlSelect.append("insert into TADESPLAZ (TARJETA_CHIPCARD, NOMBRE_COMPLETO, FECHA_ALTA, ENTIDAD_CHIPCARD, CONTRATO_CHIPCARD, FECHA_REGISTRO, TRATADO, TROQUELADO) ");
|
||||
sqlSelect.append("values (?, ");
|
||||
sqlSelect.append("?, ");
|
||||
sqlSelect.append("?, ");
|
||||
sqlSelect.append("?, ");
|
||||
sqlSelect.append("?, ");
|
||||
sqlSelect.append("?, ");
|
||||
sqlSelect.append("?, ");
|
||||
sqlSelect.append("?) ");
|
||||
|
||||
Object aValores[] = new Object[8];
|
||||
aValores[0] = new String(tades.getTarjeta());
|
||||
aValores[1] = new String(tades.getNombre());
|
||||
aValores[2] = new Date(tades.getFecha_Alta().getTime());
|
||||
aValores[3] = Integer.valueOf(tades.getEntidad_chipcard());
|
||||
aValores[4] = Integer.valueOf(tades.getContrato());
|
||||
aValores[5] = new Date(tades.getFecha_Registro().getTime());
|
||||
aValores[6] = Integer.valueOf(tades.getTratado());
|
||||
aValores[7] = new String(tades.getTroquelado());
|
||||
//LogTarisan.logger.log(NivelLog.DEBUG, "Insertar tadespla: " + Utilidades.obtenerSentenciaSQL(sqlSelect, null, aCondiciones));
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Insertar tadespla - Se ha obtenido la conexion");
|
||||
ParametrosConfiguracion.dataStore.iniciarTransaccion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Insertar tadespla - se inicia la transaccion");
|
||||
|
||||
PersistenciaTareglog pertareg = new PersistenciaTareglog();
|
||||
Calendar fecha = Calendar.getInstance();
|
||||
Timestamp fechaAcceso = new Timestamp(fecha.getTimeInMillis());
|
||||
|
||||
int intUltimoValorCorrelativo = pertareg.obtenerUltimoValorCorrelativo(medico, fechaAcceso);
|
||||
pertareg.insertarLog(medico, fechaAcceso, fecha, intUltimoValorCorrelativo, "TADESPLAZ",Utilidades.obtenerSentenciaSQL(sqlSelect, aValores, null), "insert en tadesplaz", conexion);
|
||||
/*pertareg.insertarLog(956, fechaAcceso, fecha, intUltimoValorCorrelativo, "taconaut", "insert into taconaut (autorizacion, especialidad, acto, cantidad, medico, informe, from_gesigu, tarjeta) values ", "autorizacion para ats insertada con exito");*/
|
||||
exito = ParametrosConfiguracion.dataStore.insertar(sqlSelect.toString(), aValores, conexion);
|
||||
|
||||
if (exito)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Insertar tadespla - Exito al insertar");
|
||||
ParametrosConfiguracion.dataStore.confirmarTransaccion(conexion);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Insertar tadespla - Fallo al insertar");
|
||||
ParametrosConfiguracion.dataStore.deshacerTransaccion(conexion);
|
||||
}
|
||||
}
|
||||
catch (ExcepcionTarisan e) {
|
||||
try {
|
||||
ParametrosConfiguracion.dataStore.deshacerTransaccion(conexion);
|
||||
} catch (ExcepcionTarisan e1) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al deshacerlatransaccion");
|
||||
}
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion del desplazado: " + e.toString() + " (" + sqlSelect + ")");
|
||||
}
|
||||
// }
|
||||
return exito;
|
||||
}
|
||||
|
||||
public boolean troquelado_repe(String troquelado)
|
||||
{
|
||||
boolean resul=false;
|
||||
/*
|
||||
* troquelado like '%0015%3915%4315%0465%' encuentra:
|
||||
* 0015 3915 4315 0465
|
||||
* 0015391543150465
|
||||
*/
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Vamos a comprobar que no repitan troquelados");
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
Connection conexion = null;
|
||||
try
|
||||
{
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
sqlSelect.append("Select troquelado from tadesplaz where ");
|
||||
sqlSelect.append("troquelado like '%'||?||'%'");
|
||||
Object aCondiciones[] = new Object[1];
|
||||
aCondiciones[0] = new String(troquelado.replace(' ', '%'));
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
while(rs.next())
|
||||
{
|
||||
resul=true;
|
||||
}
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la verificacion de la duplicidad del troquelado: " + e.toString() + " (" + sqlSelect + ")");
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la verificacion de la duplicidad del troquelado: " + e.toString());
|
||||
}
|
||||
return resul;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,732 @@
|
||||
package com.tarisan.control;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Calendar;
|
||||
|
||||
import com.tarisan.data.Tarjeta;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
import com.tarisan.log.LogTarisan;
|
||||
import com.tarisan.log.NivelLog;
|
||||
import com.tarisan.util.Utilidades;
|
||||
|
||||
public class PersistenciaTabenefi implements Constantes
|
||||
{
|
||||
/**
|
||||
* Funcion que cargará colectivo, poliza, orden y fecha baja en el objeto tarjeta a partir del número de tarjeta
|
||||
* @param tarjeta
|
||||
* @return
|
||||
*/
|
||||
public Tarjeta generarObjetoTarjeta(int tarjeta)
|
||||
{
|
||||
Tarjeta resultado = new Tarjeta();
|
||||
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
sqlSelect.append("SELECT COLECTIVO");
|
||||
sqlSelect.append(", POLIZA");
|
||||
sqlSelect.append(", FECHA_BAJA");
|
||||
sqlSelect.append(", ORDEN");
|
||||
sqlSelect.append(", ENTIDAD");
|
||||
sqlSelect.append(", TARJETA_CHIPCARD");
|
||||
sqlSelect.append(" FROM ttbenefi");
|
||||
sqlSelect.append(" WHERE TARJETA = ?");
|
||||
sqlSelect.append(" and ttbenefi.fecha_baja is null and fecha_alta <= sysdate");
|
||||
|
||||
|
||||
Connection conexion;
|
||||
try {
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
Object aCondiciones[] = new Object[1];
|
||||
aCondiciones[0] = Integer.valueOf(tarjeta);
|
||||
resultado.setTarjeta(tarjeta);
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
resultado.setColectivo(rs.getLong("COLECTIVO"));
|
||||
resultado.setPoliza(rs.getInt("POLIZA"));
|
||||
resultado.setBeneficiario(rs.getInt("ORDEN"));
|
||||
resultado.setEntidadIMQ(rs.getInt("ENTIDAD"));
|
||||
resultado.setTarjetaDesplazado(rs.getString("TARJETA_CHIPCARD"));
|
||||
resultado.setValida(true);
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
PersistenciaTaiguala pertaiguala = new PersistenciaTaiguala();
|
||||
int contrato = pertaiguala.obtenerContrato(resultado.getColectivo(), resultado.getPoliza(), resultado.getEntidadIMQ());
|
||||
if(contrato > 0)
|
||||
{
|
||||
resultado.setContrato(contrato);
|
||||
resultado.setValida(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
resultado.setValida(false);
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "No se encuentra el contrato de la tarjeta: "+tarjeta);
|
||||
}
|
||||
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al generar el objeto tarjeta a partir del número de tarjeta:"+tarjeta);
|
||||
e.printStackTrace();
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error SQL: "+e.toString()+" al generar el objeto tarjeta a partir del número de tarjeta:"+tarjeta);
|
||||
}
|
||||
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public boolean tiene_embosado(String tarjetachipcard)
|
||||
{
|
||||
boolean resul = false;
|
||||
/**
|
||||
* 16/02/2016 QUITAMOS EXCEPción PARA OBLIGAR A METER EL TROQUELADO A LOS DE SANITAS TAMBión. (MARTA)
|
||||
*
|
||||
*/
|
||||
/*if(tarjetachipcard.startsWith(ParametrosConfiguracion.bin_chipcard_sanitas))
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Es de sanitas no hay que buscar");
|
||||
resul = true;
|
||||
}
|
||||
else
|
||||
{*/
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Comprobamos si la tarjeta "+tarjetachipcard+" tiene el Identificador introducido");
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
sqlSelect.append("SELECT TROQUELADO, TRATADO FROM TADESPLAZ");
|
||||
sqlSelect.append(" WHERE TRIM(TARJETA_CHIPCARD) = TRIM(?)");
|
||||
Connection conexion;
|
||||
try
|
||||
{
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = null;
|
||||
Object aCondiciones[] = new Object[1];
|
||||
aCondiciones[0] = new String(tarjetachipcard);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "SQL: "+Utilidades.obtenerSentenciaSQL(sqlSelect, null, aCondiciones));
|
||||
rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
while(rs.next())
|
||||
{
|
||||
if(rs.getObject("TROQUELADO") == null && rs.getInt("TRATADO")==0)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "PersistenciaTabenefi - NO tiene_embosado hay que pedirlo");
|
||||
resul = false;
|
||||
}
|
||||
// if(rs.getString("TROQUELADO").trim().length()>0)
|
||||
else
|
||||
{
|
||||
//LogTarisan.logger.log(NivelLog.DEBUG, "PersistenciaTabenefi - tiene_embosado - "+ rs.getString("TROQUELADO").trim().length() + " - " + tarjetachipcard);
|
||||
resul = true;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Excepcion Tarisan - "+e.toString());
|
||||
}/* catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Excepcion SQL - "+e.toString());
|
||||
}*/
|
||||
//return true;
|
||||
catch (ExcepcionTarisan e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
/*}*/
|
||||
return resul;
|
||||
}
|
||||
|
||||
/*public boolean añade_embosado(String tarjetachipcard, String embosado)
|
||||
{
|
||||
boolean resul = false;
|
||||
boolean resultado = false;
|
||||
LogTarisan.logger.log(NivelLog.INFO, "Vamos a insertar el identificador de la tarjeta");
|
||||
StringBuffer sqlInsert = new StringBuffer();
|
||||
sqlInsert.append("UPDATE TADESPLAZ SET TROQUELADO = ? ");
|
||||
sqlInsert.append("WHERE TADESPLAZ.TARJETA_CHIPCARD = ?");
|
||||
Connection conexion = null;
|
||||
try
|
||||
{
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ParametrosConfiguracion.dataStore.iniciarTransaccion(conexion);
|
||||
Object aCondiciones[] = new Object[1];
|
||||
aCondiciones[0] = new String(tarjetachipcard);
|
||||
Object aValores[] = new Object[1];
|
||||
aValores[0] = new String(embosado);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Update embosado: "+Utilidades.obtenerSentenciaSQL(sqlInsert, aValores, aCondiciones));
|
||||
resul = ParametrosConfiguracion.dataStore.actualizar(sqlInsert.toString(), aValores, aCondiciones);
|
||||
ParametrosConfiguracion.dataStore.confirmarTransaccion(conexion);
|
||||
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
sqlSelect.append("SELECT * FROM TADESPLAZ");
|
||||
sqlSelect.append(" WHERE TRIM(TARJETA_CHIPCARD) = TRIM('"+ tarjetachipcard +"')");
|
||||
sqlSelect.append(" AND TRIM(TROQUELADO) = TRIM('"+ embosado +"')");
|
||||
ResultSet rs = null;
|
||||
rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString());
|
||||
while(rs.next())
|
||||
{
|
||||
resultado=true;
|
||||
}
|
||||
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
try {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al actualizar el embosado en tadesplaz."+e.toString());
|
||||
ParametrosConfiguracion.dataStore.deshacerTransaccion(conexion);
|
||||
} catch (ExcepcionTarisan e1) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al actualizar el embosado en tadesplaz."+e1.toString());
|
||||
}
|
||||
} catch (ExcepcionTarisan e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Resultado al actualizar embosado." + resul);
|
||||
return resultado;
|
||||
}*/
|
||||
public boolean anade_embosado(String tarjetachipcard, String embosado)
|
||||
{
|
||||
boolean resul = false;
|
||||
boolean resultado = false;
|
||||
LogTarisan.logger.log(NivelLog.INFO, "Vamos a insertar el identificador de la tarjeta");
|
||||
StringBuffer sqlInsert = new StringBuffer();
|
||||
Connection conexion = null;
|
||||
try
|
||||
{
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
sqlSelect.append("SELECT * FROM TADESPLAZ");
|
||||
sqlSelect.append(" WHERE TRIM(TARJETA_CHIPCARD) = TRIM('"+ tarjetachipcard +"')");
|
||||
sqlSelect.append(" AND TRIM(TROQUELADO) = TRIM('"+ embosado +"')");
|
||||
ResultSet rs = null;
|
||||
rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString());
|
||||
if (rs!=null){
|
||||
while(rs.next())
|
||||
{
|
||||
resultado=true;
|
||||
}
|
||||
}
|
||||
|
||||
//ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
|
||||
if (resultado) {
|
||||
sqlInsert.append("UPDATE TADESPLAZ SET TROQUELADO = ? ");
|
||||
sqlInsert.append("WHERE TADESPLAZ.TARJETA_CHIPCARD = ?");
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ParametrosConfiguracion.dataStore.iniciarTransaccion(conexion);
|
||||
Object aCondiciones[] = new Object[1];
|
||||
aCondiciones[0] = new String(tarjetachipcard);
|
||||
Object aValores[] = new Object[1];
|
||||
aValores[0] = new String(embosado);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Update embosado: "+Utilidades.obtenerSentenciaSQL(sqlInsert, aValores, aCondiciones));
|
||||
resul = ParametrosConfiguracion.dataStore.actualizar(sqlInsert.toString(), aValores, aCondiciones);
|
||||
ParametrosConfiguracion.dataStore.confirmarTransaccion(conexion);
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
resultado = resul;
|
||||
}
|
||||
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
try {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al actualizar el embosado en tadesplaz."+e.toString());
|
||||
ParametrosConfiguracion.dataStore.deshacerTransaccion(conexion);
|
||||
} catch (ExcepcionTarisan e1) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al actualizar el embosado en tadesplaz."+e1.toString());
|
||||
}
|
||||
} catch (ExcepcionTarisan e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Resultado al actualizar embosado." + resul);
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public Calendar getFechaBaja(String tarjetachipcard)
|
||||
{
|
||||
Calendar resul = Calendar.getInstance();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "\nEntra en fechabaja para comprobar si la poliza está de baja.");
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
sqlSelect.append("SELECT FECHA_BAJA FROM TTBENEFI");
|
||||
sqlSelect.append(" WHERE TRIM(TARJETA_CHIPCARD) = TRIM(?)");
|
||||
Connection conexion;
|
||||
try
|
||||
{
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = null;
|
||||
Object aCondiciones[] = new Object[1];
|
||||
aCondiciones[0] = new String(tarjetachipcard);
|
||||
rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
while(rs.next())
|
||||
{
|
||||
resul.setTime(rs.getDate("FECHA_BAJA"));
|
||||
}
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Excepcion Tarisan - "+e.toString());
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Excepcion SQL - "+e.toString());
|
||||
}
|
||||
return resul;
|
||||
}
|
||||
|
||||
public boolean existeTarjetaChipcard(String tarjetachipcard, int entidad)
|
||||
{
|
||||
boolean resultado = false;
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "\nEntra en existeTarjetaChipcard con valores: tarjetachipcard = "+tarjetachipcard+", entidad = "+entidad+"\n");
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
sqlSelect.append("SELECT COLECTIVO");
|
||||
sqlSelect.append(", POLIZA");
|
||||
sqlSelect.append(", FECHA_BAJA");
|
||||
sqlSelect.append(", ORDEN");
|
||||
sqlSelect.append(", ENTIDAD");
|
||||
sqlSelect.append(" FROM TTBENEFI");
|
||||
sqlSelect.append(" WHERE TRIM(TARJETA_CHIPCARD) = TRIM(?)");
|
||||
//sqlSelect.append(" and (ttbenefi.fecha_baja is null or ttbenefi.fecha_baja > sysdate)");
|
||||
if(entidad > 0)
|
||||
sqlSelect.append(" AND ENTIDAD = ?");
|
||||
|
||||
|
||||
|
||||
Connection conexion;
|
||||
try {
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = null;
|
||||
if(entidad > 0)
|
||||
{
|
||||
Object aCondiciones[] = new Object[2];
|
||||
aCondiciones[0] = new String(tarjetachipcard);
|
||||
aCondiciones[1] = Integer.valueOf(entidad);
|
||||
|
||||
rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
}
|
||||
else
|
||||
{
|
||||
Object aCondiciones[] = new Object[1];
|
||||
aCondiciones[0] = new String(tarjetachipcard);
|
||||
|
||||
rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
}
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Datos conseguidos COL="+rs.getLong("COLECTIVO")+", POL="+rs.getLong("POLIZA")+", ORD="+rs.getInt("ORDEN"));
|
||||
resultado = true;
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Excepcion Tarisan - "+e.toString());
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Excepcion SQL - "+e.toString());
|
||||
}
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Datos conseguidos?: "+resultado);
|
||||
return resultado;
|
||||
|
||||
}
|
||||
|
||||
public Tarjeta generarObjetoTarjetaChipcard(String tarjetachipcard, int entidad)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "\nEntra en generarobjetotarjetachipcard con valores: tarjetachipcard = "+tarjetachipcard+", entidad = "+entidad+"\n");
|
||||
Tarjeta resultado = new Tarjeta();
|
||||
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
sqlSelect.append("SELECT COLECTIVO");
|
||||
sqlSelect.append(", POLIZA");
|
||||
sqlSelect.append(", FECHA_BAJA");
|
||||
sqlSelect.append(", ORDEN");
|
||||
sqlSelect.append(", ENTIDAD");
|
||||
sqlSelect.append(" FROM TTBENEFI");
|
||||
sqlSelect.append(" WHERE TRIM(TARJETA_CHIPCARD) = TRIM(?)");
|
||||
//sqlSelect.append(" and (ttbenefi.fecha_baja is null or ttbenefi.fecha_baja > sysdate)");
|
||||
if(entidad > 0)
|
||||
sqlSelect.append(" AND ENTIDAD = ?");
|
||||
|
||||
|
||||
|
||||
Connection conexion;
|
||||
try {
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = null;
|
||||
if(entidad > 0)
|
||||
{
|
||||
Object aCondiciones[] = new Object[2];
|
||||
aCondiciones[0] = new String(tarjetachipcard);
|
||||
aCondiciones[1] = Integer.valueOf(entidad);
|
||||
resultado.setTarjetaDesplazado(tarjetachipcard);
|
||||
rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
}
|
||||
else
|
||||
{
|
||||
Object aCondiciones[] = new Object[1];
|
||||
aCondiciones[0] = new String(tarjetachipcard);
|
||||
resultado.setTarjetaDesplazado(tarjetachipcard);
|
||||
rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
}
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Datos conseguidos COL="+rs.getLong("COLECTIVO")+", POL="+rs.getLong("POLIZA")+", ORD="+rs.getInt("ORDEN"));
|
||||
resultado.setColectivo(rs.getLong("COLECTIVO"));
|
||||
resultado.setPoliza(rs.getLong("POLIZA"));
|
||||
resultado.setBeneficiario(rs.getInt("ORDEN"));
|
||||
resultado.setEntidadIMQ(rs.getInt("ENTIDAD"));
|
||||
PersistenciaTaiguala pertaiguala = new PersistenciaTaiguala();
|
||||
resultado.setContrato(pertaiguala.obtenerContrato(resultado.getColectivo(), resultado.getPoliza(), resultado.getEntidadIMQ()));
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "PersistenciaTabenefi - generarObjetoTarjetaChipcard - LLega 241");
|
||||
Calendar hoy = Calendar.getInstance();
|
||||
Calendar baja = Calendar.getInstance();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "PersistenciaTabenefi - generarObjetoTarjetaChipcard - LLega 244");
|
||||
if(rs.getDate("FECHA_BAJA") == null)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "PersistenciaTabenefi - generarObjetoTarjetaChipcard - LLega 247");
|
||||
baja = null;
|
||||
}
|
||||
else
|
||||
baja.setTime(rs.getDate("FECHA_BAJA"));
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "PersistenciaTabenefi - generarObjetoTarjetaChipcard - LLega 252");
|
||||
if(baja == null || baja.compareTo(hoy) > 0)
|
||||
{
|
||||
resultado.setValida(true);
|
||||
resultado.setEstadeBaja(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
resultado.setValida(false);
|
||||
resultado.setEstadeBaja(true);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "El asegurado esta de baja!!!");
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Excepcion Tarisan - "+e.toString());
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Excepcion SQL - "+e.toString());
|
||||
}
|
||||
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Datos conseguidos: "+resultado.getColectivo()+"="+resultado.getPoliza()+"="+resultado.getEntidadIMQ());
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public int obtenerNumCli(int tarjeta) throws ExcepcionTarisan
|
||||
{
|
||||
int cliente=0;
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
|
||||
try
|
||||
{
|
||||
sqlSelect.append("SELECT CLIENTE");
|
||||
sqlSelect.append(" FROM TTBENEFI");
|
||||
sqlSelect.append(" WHERE TARJETA = ?");
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
Object aCondiciones[] = new Object[1];
|
||||
aCondiciones[0] = Integer.valueOf(tarjeta);
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
if(rs.next())
|
||||
{
|
||||
cliente = rs.getInt("CLIENTE");
|
||||
}
|
||||
rs.close();
|
||||
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado el numero de cliente: " + cliente + " de la tabla TTBENEFI (" + sqlSelect + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección del numero del cliente: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan();
|
||||
}
|
||||
|
||||
return cliente;
|
||||
}
|
||||
|
||||
public int obtenerEntidad(int cliente, long tarjeta) throws ExcepcionTarisan
|
||||
{
|
||||
int entidad=0;
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
|
||||
try
|
||||
{
|
||||
sqlSelect.append("SELECT ENTIDAD");
|
||||
sqlSelect.append(" FROM TTBENEFI");
|
||||
sqlSelect.append(" WHERE CLIENTE = ?");
|
||||
sqlSelect.append(" AND TARJETA <> ?");
|
||||
sqlSelect.append(" and (TTBENEFI.FECHA_BAJA > sysdate OR TTBENEFI.FECHA_BAJA IS NULL)");
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
Object aCondiciones[] = new Object[2];
|
||||
aCondiciones[0] = Integer.valueOf(cliente);
|
||||
aCondiciones[1] = Long.valueOf(tarjeta);
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
if(rs.next())
|
||||
{
|
||||
entidad=(rs.getInt("ENTIDAD"));
|
||||
|
||||
}
|
||||
else{
|
||||
//Devuelvo -1 para saber que no ha encontrado ninguna entidad y diferenciarlo de la entidad=0
|
||||
entidad=-1;
|
||||
}
|
||||
rs.close();
|
||||
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado entidad y colectivo del cliente: " + cliente + " de la tabla TTBENEFI (" + sqlSelect + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección del entidad y colectivo del cliente: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan();
|
||||
}
|
||||
|
||||
return entidad;
|
||||
}
|
||||
|
||||
public long obtenerColectivo(int cliente, long tarjeta) throws ExcepcionTarisan
|
||||
{
|
||||
long colectivo=0;
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
|
||||
try
|
||||
{
|
||||
sqlSelect.append("SELECT COLECTIVO");
|
||||
sqlSelect.append(" FROM TTBENEFI");
|
||||
sqlSelect.append(" WHERE CLIENTE = ?");
|
||||
sqlSelect.append(" AND TARJETA <> ?");
|
||||
sqlSelect.append(" and (TTBENEFI.FECHA_BAJA > sysdate OR TTBENEFI.FECHA_BAJA IS NULL)");
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
Object aCondiciones[] = new Object[2];
|
||||
aCondiciones[0] = Integer.valueOf(cliente);
|
||||
aCondiciones[1] = Long.valueOf(tarjeta);
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
if(rs.next())
|
||||
{
|
||||
colectivo=(rs.getLong("COLECTIVO"));
|
||||
|
||||
}
|
||||
else{
|
||||
//Devuelvo -1 para saber que no ha encontrado ningun colectivo y diferenciarlo del colectivo=0
|
||||
colectivo=-1;
|
||||
}
|
||||
rs.close();
|
||||
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado entidad y colectivo del cliente: " + cliente + " de la tabla TTBENEFI (" + sqlSelect + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección del entidad y colectivo del cliente: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan();
|
||||
}
|
||||
|
||||
return colectivo;
|
||||
}
|
||||
|
||||
public String obtenerIdentificador(String tarjetachipcard) throws ExcepcionTarisan
|
||||
{
|
||||
String identificador="";
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Obtenemos el identificador de la tarjeta "+tarjetachipcard+" introducida");
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
sqlSelect.append("SELECT TROQUELADO, TRATADO FROM TADESPLAZ");
|
||||
sqlSelect.append(" WHERE TRIM(TARJETA_CHIPCARD) = TRIM(?)");
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
Object aCondiciones[] = new Object[1];
|
||||
aCondiciones[0] = new String(tarjetachipcard);
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
if(rs.next())
|
||||
{
|
||||
identificador=(rs.getString("TROQUELADO"));
|
||||
|
||||
}
|
||||
rs.close();
|
||||
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado el identificador de la tabla TADESPLAZ (" + sqlSelect + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección del identificador de la tabla TADESPLAZ: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan();
|
||||
}
|
||||
|
||||
return identificador;
|
||||
}
|
||||
|
||||
public String obtenerIdentificador(long col, Double pol, int ord) throws ExcepcionTarisan
|
||||
{
|
||||
String identificador="";
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Obtenemos el identificador del colectivo "+col+", poliza "+pol+"y orden "+ord+" introducidos");
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
sqlSelect.append("SELECT TRIM(IDENTIFICADOR) IDENTIFICADOR FROM TTBENEFI");
|
||||
sqlSelect.append(" WHERE COLECTIVO = ?");
|
||||
sqlSelect.append(" AND POLIZA = ?");
|
||||
sqlSelect.append(" AND ORDEN = ?");
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
Object aCondiciones[] = new Object[3];
|
||||
aCondiciones[0] = Long.valueOf(col);
|
||||
aCondiciones[1] = Double.valueOf(pol);
|
||||
aCondiciones[2] = Integer.valueOf(ord);
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
if(rs.next())
|
||||
{
|
||||
if (rs.getString("IDENTIFICADOR")!=null)
|
||||
identificador=(rs.getString("IDENTIFICADOR"));
|
||||
|
||||
}
|
||||
rs.close();
|
||||
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado el identificador de la tabla TTBENEFI (" + sqlSelect + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección del identificador de la tabla TTBENEFI: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan();
|
||||
}
|
||||
|
||||
return identificador;
|
||||
}
|
||||
|
||||
public String obtenerTarjetaChipcard(int col, long pol, int ord) throws ExcepcionTarisan
|
||||
{
|
||||
String tarjeta="";
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Obtenemos la tarjeta_chipcard del "+col + " - " + pol + " - " + ord +" introducidos");
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
sqlSelect.append("SELECT TARJETA_CHIPCARD FROM TTBENEFI");
|
||||
sqlSelect.append(" WHERE COLECTIVO = ?");
|
||||
sqlSelect.append(" AND POLIZA = ?");
|
||||
sqlSelect.append(" AND ORDEN = ?");
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
Object aCondiciones[] = new Object[3];
|
||||
aCondiciones[0] = Integer.valueOf(col);
|
||||
aCondiciones[1] = Long.valueOf(pol);
|
||||
aCondiciones[2] = Integer.valueOf(ord);
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
if(rs.next())
|
||||
{
|
||||
tarjeta=(rs.getString("TARJETA_CHIPCARD"));
|
||||
|
||||
}
|
||||
rs.close();
|
||||
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionada la tarjeta_chipcard de la tabla TTBENEFI (" + sqlSelect + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de la tarjeta_chipcard de la tabla TTBENEFI: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan();
|
||||
}
|
||||
|
||||
return tarjeta;
|
||||
}
|
||||
|
||||
public String obtenerTarjeta(int col, long pol, int ord) throws ExcepcionTarisan
|
||||
{
|
||||
String tarjeta="";
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Obtenemos la tarjeta del "+col + " - " + pol + " - " + ord +" introducidos");
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
sqlSelect.append("SELECT TARJETA FROM TTBENEFI");
|
||||
sqlSelect.append(" WHERE COLECTIVO = ?");
|
||||
sqlSelect.append(" AND POLIZA = ?");
|
||||
sqlSelect.append(" AND ORDEN = ?");
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
Object aCondiciones[] = new Object[3];
|
||||
aCondiciones[0] = Integer.valueOf(col);
|
||||
aCondiciones[1] = Long.valueOf(pol);
|
||||
aCondiciones[2] = Integer.valueOf(ord);
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
if(rs.next())
|
||||
{
|
||||
tarjeta=(rs.getString("TARJETA"));
|
||||
|
||||
}
|
||||
rs.close();
|
||||
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionada la tarjeta de la tabla TTBENEFI (" + sqlSelect + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de la tarjeta de la tabla TTBENEFI: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan();
|
||||
}
|
||||
|
||||
return tarjeta;
|
||||
}
|
||||
|
||||
public Long obtenerTarjeta(long col, Double pol, int ord) throws ExcepcionTarisan
|
||||
{
|
||||
long tarjeta=0;
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Obtenemos la tarjeta del "+col + " - " + pol + " - " + ord +" introducidos");
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
sqlSelect.append("SELECT TARJETA FROM TTBENEFI");
|
||||
sqlSelect.append(" WHERE COLECTIVO = ?");
|
||||
sqlSelect.append(" AND POLIZA = ?");
|
||||
sqlSelect.append(" AND ORDEN = ?");
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
Object aCondiciones[] = new Object[3];
|
||||
aCondiciones[0] = Long.valueOf(col);
|
||||
aCondiciones[1] = Double.valueOf(pol);
|
||||
aCondiciones[2] = Integer.valueOf(ord);
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
if(rs.next())
|
||||
{
|
||||
tarjeta=(rs.getLong("TARJETA"));
|
||||
|
||||
}
|
||||
rs.close();
|
||||
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionada la tarjeta de la tabla TTBENEFI (" + sqlSelect + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de la tarjeta de la tabla TTBENEFI: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan();
|
||||
}
|
||||
|
||||
return tarjeta;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
/**
|
||||
* @(#) PersistenciaTacentro.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.Tacentro;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>Tacentro</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaTacentro
|
||||
{
|
||||
|
||||
/**
|
||||
* Obtiene los centros existentes de la tabla TACENTRO
|
||||
* @return El Vector con la totalidad de los centros.
|
||||
* @throws
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public Vector obtenerCentros() throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
Tacentro tacentro = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT CODIGO, DESCRIPCION");
|
||||
strSql.append(" FROM tacentro");
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString());
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
tacentro = new Tacentro();
|
||||
tacentro.setCodigo(rs.getString("CODIGO"));
|
||||
tacentro.setDescripcion(rs.getString("DESCRIPCION"));
|
||||
vResultado.addElement(tacentro);
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TACENTRO (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TACENTRO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TACENTRO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TACENTRO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TACENTRO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtiene el centro asociado al código del centro indicado.
|
||||
* @param codigo Código del centro.
|
||||
* @return El objeto <code>Tacentro</code> asociado al codigo del centro indicado.
|
||||
* @throws
|
||||
*/
|
||||
public Tacentro obtenerCentro(String codigo) throws ExcepcionTarisan
|
||||
{
|
||||
Tacentro tacentro = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object[] aCondiciones=null;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT CODIGO, DESCRIPCION");
|
||||
strSql.append(" FROM TACENTRO");
|
||||
strSql.append(" WHERE CODIGO=?");
|
||||
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0] = codigo;
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
if(rs.next())
|
||||
{
|
||||
tacentro = new Tacentro();
|
||||
tacentro.setCodigo(rs.getString("CODIGO"));
|
||||
tacentro.setDescripcion(rs.getString("DESCRIPCION"));
|
||||
}
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado " + rs.getRow() + " registros de la tabla TACENTRO (" + strSql.toString() + ")");
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TACENTRO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TACENTRO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TACENTRO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TACENTRO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
|
||||
return tacentro;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,199 @@
|
||||
/**
|
||||
* @(#) PersistenciaTadremed.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.Taconaut;
|
||||
import com.tarisan.data.Tadremed;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.util.DES;
|
||||
import com.tarisan.util.Utilidades;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>Tadremed</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaTadremed
|
||||
{
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>.
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selecciona los registros de la tabla TADREMED en función de la sentencia SELECT indicada.
|
||||
* @param sqlSelect La sentencia SELECT de selección.
|
||||
* @param pagina Número de página a mostrar.
|
||||
* @param aCondiciones Array que contiene los parámetros utilizados en la sentencia SELECT.
|
||||
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code>Tadremed</code>).
|
||||
* @throws
|
||||
*/
|
||||
public Vector seleccionar(String sqlSelect/*, int pagina*/, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
/*int elementosPaginacion=1;*/
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
Tadremed tadremed = null;
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect, aCondiciones);
|
||||
|
||||
/*objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina); */
|
||||
|
||||
while(rs.next() /*&& (elementosPaginacion <= Paginacion.getFilasPorPagina())*/)
|
||||
{
|
||||
tadremed = new Tadremed();
|
||||
tadremed.setFecha(rs.getDate("FECHA"));
|
||||
tadremed.setIrpf(rs.getDouble("IRPF"));
|
||||
tadremed.setImporte(rs.getDouble("IMPORTE"));
|
||||
vResultado.addElement(tadremed);
|
||||
/*if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;*/
|
||||
}
|
||||
/*}*/
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TADREMED (" + sqlSelect + ")");
|
||||
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TADREMED: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TADREMED: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TADREMED: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TADREMED: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public Vector listado_detalle_irpf(String anio, int medico/*, int intPagina*/)
|
||||
{
|
||||
Vector resul = new Vector();
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
|
||||
Object [] aCondiciones = new Object[1];
|
||||
String consulta = "";
|
||||
|
||||
strSql.append("SELECT FECHA, IRPF, IMPORTE");
|
||||
strSql.append(" FROM TADREMED");
|
||||
strSql.append(" WHERE MEDICO=?");
|
||||
if (!anio.equalsIgnoreCase("")) //la sql tiene dos parametros
|
||||
{
|
||||
if (ParametrosConfiguracion.dataStore.getClass().getName().toUpperCase().indexOf("ORACLE") >= 0)
|
||||
{
|
||||
strSql.append(" AND EXTRACT(YEAR FROM FECHA) = ?");
|
||||
}
|
||||
else
|
||||
{
|
||||
strSql.append(" AND {fn YEAR(FECHA)} = ?");
|
||||
}
|
||||
|
||||
//el array de objetos sera de dos elementos
|
||||
aCondiciones = new Object[2];
|
||||
aCondiciones[1] = Integer.valueOf(anio);
|
||||
}
|
||||
else //la sql tiene un parametro
|
||||
//el array de objetos sera de un elemento
|
||||
aCondiciones = new Object[1];
|
||||
|
||||
strSql.append(" ORDER BY FECHA");
|
||||
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
|
||||
try {
|
||||
resul = this.seleccionar(strSql.toString()/*, intPagina*/, aCondiciones);
|
||||
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de Tamedico_Taprescr (listado_prescripciones): " + e + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
public Vector<Tadremed> ObtenerTotalesIrpf(int medico, String anio)
|
||||
{
|
||||
Vector<Tadremed> vResul = new Vector<Tadremed>();
|
||||
Tadremed tadremed = null;
|
||||
/*StringBuffer sqlSelect = new StringBuffer();*/
|
||||
String consulta = "";
|
||||
String fechaInicio = "01/01/"+anio;
|
||||
String fechaFin = "31/12/"+anio;
|
||||
try
|
||||
{
|
||||
/*sqlSelect.append("Select SUM(IMPORTE) AS IMPORTE, SUM(IRPF) AS IRPF from TADREMED ");
|
||||
sqlSelect.append("where medico = ?");
|
||||
sqlSelect.append("AND FECHA BETWEEN " + fechaInicio + " AND " + fechaFin);*/
|
||||
|
||||
consulta = "Select SUM(IMPORTE) AS IMPORTE, SUM(IRPF) AS IRPF ";
|
||||
consulta += "from TADREMED ";
|
||||
consulta += "where medico = ? ";
|
||||
consulta += "AND FECHA BETWEEN TO_DATE('" + fechaInicio + "','DD/MM/YYYY') AND TO_DATE('" + fechaFin + "','DD/MM/YYYY')";
|
||||
|
||||
Object aCondiciones[] = new Object[1];
|
||||
aCondiciones[0]=Integer.valueOf(medico);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, consulta, aCondiciones);
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
tadremed = new Tadremed();
|
||||
tadremed.setIrpfTotal(rs.getDouble("IRPF"));
|
||||
tadremed.setImporteTotal(rs.getDouble("IMPORTE"));
|
||||
vResul.addElement(tadremed);
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan e)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "ExcepcionTarisan: "+e.toString());
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Excepcion SQL: "+e.toString());
|
||||
}
|
||||
|
||||
return vResul;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
/**
|
||||
* @(#) PersistenciaTaespeci.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.Taespeci;
|
||||
import com.tarisan.data.TtactmedGPC;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.util.Utilidades;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>Taespeci</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaTaespeci
|
||||
{
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>.
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selecciona los registros de la tabla TAESPECI en función de la sentencia SELECT indicada.
|
||||
* @param sqlSelect La sentencia SELECT de selección.
|
||||
* @param pagina Número de página a mostrar.
|
||||
* @param aCondiciones Array que contiene los parámetros utilizados en la sentencia SELECT.
|
||||
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code>Taespeci</code>).
|
||||
* @throws
|
||||
*/
|
||||
public Vector seleccionar(String sqlSelect, int pagina, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
int elementosPaginacion=1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
Taespeci taespeci = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
if (aCondiciones==null || aCondiciones.length==0)
|
||||
rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect);
|
||||
else
|
||||
rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect, aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
taespeci = new Taespeci();
|
||||
taespeci.setDescripcion(rs.getString("DESCRIPCION"));
|
||||
taespeci.setEspecialidad(rs.getInt("ESPECIALIDAD"));
|
||||
vResultado.addElement(taespeci);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TAESPECI (" + sqlSelect + ")");
|
||||
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAESPECI: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAESPECI: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAESPECI: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAESPECI: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public Vector listado_especialidades(String nombre, int intPagina)
|
||||
{
|
||||
Vector resul = new Vector();
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
|
||||
Object [] aCondiciones = new Object[1];
|
||||
String consulta = "";
|
||||
|
||||
strSql.append("SELECT ESPECIALIDAD, DESCRIPCION");
|
||||
strSql.append(" FROM TAESPECI");
|
||||
strSql.append(" WHERE ESPECIALIDAD <> ?");
|
||||
|
||||
|
||||
//comprobamos si se trata de una busqueda de especialidades
|
||||
if (!nombre.equalsIgnoreCase(""))
|
||||
{
|
||||
if (nombre.endsWith("*"))
|
||||
nombre=nombre.replace('*', '%');
|
||||
else
|
||||
nombre="%" + nombre + "%";
|
||||
|
||||
strSql.append(" AND DESCRIPCION LIKE ?");
|
||||
|
||||
aCondiciones = new Object[2];
|
||||
aCondiciones[1] = new String(nombre);
|
||||
}
|
||||
else
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0] = Integer.valueOf(0);
|
||||
|
||||
strSql.append(" ORDER BY DESCRIPCION");
|
||||
|
||||
|
||||
try {
|
||||
resul = this.seleccionar(strSql.toString(), intPagina, aCondiciones);
|
||||
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de Tapresca-taclient (listado_diagnostico_gpc_por_cliente): " + e + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
public String obtenerDescripcionEspecialidad(int especialidad) throws SQLException
|
||||
{
|
||||
String resul = "";
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
ResultSet rs = null;
|
||||
Object [] aCondiciones = new Object[1];
|
||||
|
||||
strSql.append("SELECT DESCRIPCION");
|
||||
strSql.append(" FROM TAESPECI");
|
||||
strSql.append(" WHERE ESPECIALIDAD = ?");
|
||||
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0] = especialidad;
|
||||
|
||||
try {
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
if(rs.next())
|
||||
{
|
||||
resul = rs.getString("DESCRIPCION");
|
||||
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionada la especialidad " + resul + " de la tabla TAESPECI (" + strSql.toString() + ")");
|
||||
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de Taespeci (obtenerDescripcionEspecialidad): " + e + " (" + strSql.toString() + ")");
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
public int paginaDeLaEspecialidad(int Especialidad) throws SQLException
|
||||
{
|
||||
int pagina = 0;
|
||||
Vector resul = new Vector();
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Taespeci taespeci = null;
|
||||
int pos = 0;
|
||||
|
||||
Object [] aCondiciones = new Object[0];
|
||||
String consulta = "";
|
||||
|
||||
strSql.append("SELECT ESPECIALIDAD, DESCRIPCION");
|
||||
strSql.append(" FROM TAESPECI");
|
||||
strSql.append(" ORDER BY DESCRIPCION");
|
||||
|
||||
try {
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
pos = pos + 1;
|
||||
taespeci = new Taespeci();
|
||||
taespeci.setDescripcion(rs.getString("DESCRIPCION"));
|
||||
taespeci.setEspecialidad(rs.getInt("ESPECIALIDAD"));
|
||||
|
||||
if (taespeci.getEspecialidad()==Especialidad){
|
||||
pagina = (pos/10) + 1;
|
||||
if (pos % 10 == 0){
|
||||
pagina = pagina - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + resul.size() + " registros de la tabla tapresca_tarisan (" + strSql.toString() + ")");
|
||||
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de Tapresca-taclient (listado_diagnostico_gpc_por_cliente): " + e + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
|
||||
|
||||
return pagina;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,382 @@
|
||||
/**
|
||||
* @(#) PersistenciaTagruana.java
|
||||
*/
|
||||
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.Tagruana;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>Tagruana</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaTagruana
|
||||
{
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>.
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtiene los grupos de análisis de la especialidad analítica.
|
||||
* @return El Vector con los grupos de análisis de la especialidad de analíticas.
|
||||
*/
|
||||
public Vector obtenerGrupos(int pagina, int medico) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
Tagruana tagruana = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
int elementosPaginacion=1;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT DISTINCT GRUPO,DESCRIPCION");
|
||||
strSql.append(" FROM tagruana");
|
||||
strSql.append(" WHERE especialidad=?");
|
||||
strSql.append(" and medico=?");
|
||||
|
||||
aCondiciones = new Object[2];
|
||||
aCondiciones[0]=Integer.valueOf(ParametrosConfiguracion.analiticas);
|
||||
aCondiciones[1]=Integer.valueOf(medico);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
tagruana = new Tagruana();
|
||||
tagruana.setGrupo(rs.getInt("GRUPO"));
|
||||
tagruana.setDescripcion(rs.getString("DESCRIPCION"));
|
||||
vResultado.addElement(tagruana);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TAGRUANA (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAGRUANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAGRUANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAGRUANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAGRUANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public Vector obtenerGruposAnalisis(int medico) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
Tagruana tagruana = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT DISTINCT GRUPO,DESCRIPCION");
|
||||
strSql.append(" FROM tagruana");
|
||||
strSql.append(" WHERE especialidad=?");
|
||||
strSql.append(" and medico=?");
|
||||
|
||||
aCondiciones = new Object[2];
|
||||
aCondiciones[0]=Integer.valueOf(ParametrosConfiguracion.analiticas);
|
||||
aCondiciones[1]=Integer.valueOf(medico);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
tagruana = new Tagruana();
|
||||
tagruana.setGrupo(rs.getInt("GRUPO"));
|
||||
tagruana.setDescripcion(rs.getString("DESCRIPCION"));
|
||||
vResultado.addElement(tagruana);
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TAGRUANA (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAGRUANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAGRUANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAGRUANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAGRUANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public Vector listar_actos_buscador_excluidos(String nosacar, String buscador)
|
||||
{
|
||||
Vector vResultado = new Vector();
|
||||
Tagruana tag = new Tagruana();
|
||||
String sql = "select distinct(a.acto) ACTO, a.descripcion_gpc DESCRIP_ACTO from ttactmed_gpc a where a.acto not in ("+nosacar+") and upper(a.descripcion_gpc) like upper('"+buscador+"') and especialidad="+ParametrosConfiguracion.analiticas+" order by a.descripcion_gpc";
|
||||
Connection conexion;
|
||||
try {
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sql);
|
||||
while(rs.next())
|
||||
{
|
||||
tag = new Tagruana();
|
||||
tag.setActo(rs.getInt("ACTO"));
|
||||
tag.setDescripcionActo(rs.getString("DESCRIP_ACTO"));
|
||||
vResultado.addElement(tag);
|
||||
}
|
||||
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al obtener los actos teniendo en cuenta los excluidos y usando el buscador. Excepcion Tarisan.");
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al obtener los actos teniendo en cuenta los excluidos y usando el buscador. SQL Exception");
|
||||
}
|
||||
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
|
||||
public int getMaxGrupo()
|
||||
{
|
||||
int result = 0;
|
||||
String sql = null;
|
||||
Connection conexion;
|
||||
try {
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
sql = "SELECT MAX(GRUPO) AS GRUPO FROM TAGRUANA";
|
||||
ResultSet resul = ParametrosConfiguracion.dataStore.seleccionar(conexion, sql);
|
||||
int max = 0;
|
||||
while(resul.next())
|
||||
{
|
||||
max = resul.getInt("GRUPO");
|
||||
}
|
||||
result = max + 1;
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al obtener el siguiente numero de grupo. ExcecionTarisan");
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al obtener el siguiente numero de grupo. SQLExcepcion");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtiene los actos médicos que forman parte de un determinado grupo de análisis de la especialidad analítica.
|
||||
* @param grupo Código del grupo de análisis.
|
||||
* @return El Vector con los actos médicos pertenecientes al grupo de análisis indicado.
|
||||
* @throws
|
||||
*/
|
||||
public Vector obtenerActosMedicos(int grupo, int medico) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
Tagruana tagruana = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT TAGRUANA.Acto, ttactmed_gpc.Descripcion_gpc AS Descripcion_acto, TAGRUANA.Descripcion AS Descripcion_perfil" );
|
||||
strSql.append(" FROM tagruana, ttactmed_gpc");
|
||||
strSql.append(" WHERE tagruana.especialidad=ttactmed_gpc.especialidad");
|
||||
strSql.append(" AND tagruana.acto=ttactmed_gpc.acto");
|
||||
strSql.append(" AND tagruana.especialidad=?");
|
||||
strSql.append(" AND tagruana.grupo=?");
|
||||
strSql.append(" AND tagruana.medico=?");
|
||||
|
||||
aCondiciones = new Object[3];
|
||||
aCondiciones[0]=Integer.valueOf(ParametrosConfiguracion.analiticas);
|
||||
aCondiciones[1]=Integer.valueOf(grupo);
|
||||
aCondiciones[2]=Integer.valueOf(medico);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
tagruana = new Tagruana();
|
||||
tagruana.setActo(rs.getInt("ACTO"));
|
||||
tagruana.setDescripcionActo(rs.getString("DESCRIPCION_ACTO"));
|
||||
tagruana.setDescripcion(rs.getString("DESCRIPCION_PERFIL"));
|
||||
vResultado.addElement(tagruana);
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TAGRUANA (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAGRUANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAGRUANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAGRUANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAGRUANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void borrar_actos(int grupo, int espe, int medico)
|
||||
{
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
Connection conexion = null;
|
||||
|
||||
strSql.append("delete tagruana");
|
||||
strSql.append(" where grupo = ?");
|
||||
strSql.append(" and especialidad = ?");
|
||||
strSql.append(" and medico = ?");
|
||||
|
||||
aCondiciones = new Object[3];
|
||||
aCondiciones[0]=Integer.valueOf(grupo);
|
||||
aCondiciones[1]=Integer.valueOf(espe);
|
||||
aCondiciones[2]=Integer.valueOf(medico);
|
||||
|
||||
try
|
||||
{
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ParametrosConfiguracion.dataStore.iniciarTransaccion(conexion);
|
||||
ParametrosConfiguracion.dataStore.borrar(strSql.toString(), aCondiciones, conexion);
|
||||
ParametrosConfiguracion.dataStore.confirmarTransaccion(conexion);
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Eliminados todos los registros de la tabla TAGRUANA (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la eliminacion de TAGRUANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la eliminacion de TAGRUANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public int insertar_actos(int grupo, int espe, int medico, String valores, String descrip)
|
||||
{
|
||||
int resultado = 0;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
int i = 0, j = 0;
|
||||
Connection conexion = null;
|
||||
|
||||
try
|
||||
{
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ParametrosConfiguracion.dataStore.iniciarTransaccion(conexion);
|
||||
|
||||
while(valores.substring(i).indexOf(",") != -1)
|
||||
{
|
||||
strSql.append("insert into tagruana (grupo, especialidad, acto, medico, descripcion)");
|
||||
strSql.append(" values(?, ?, ?, ?, ?)");
|
||||
|
||||
aCondiciones = new Object[5];
|
||||
aCondiciones[0]=Integer.valueOf(grupo);
|
||||
aCondiciones[1]=Integer.valueOf(espe);
|
||||
aCondiciones[2]=new String(valores.substring(i, i+valores.substring(i).indexOf(",")));
|
||||
aCondiciones[3]=Integer.valueOf(medico);
|
||||
aCondiciones[4]=new String(descrip);
|
||||
|
||||
|
||||
i=i+valores.substring(i).indexOf(",") + 1;
|
||||
j+=1;
|
||||
|
||||
ParametrosConfiguracion.dataStore.insertar(strSql.toString(), aCondiciones, conexion);
|
||||
strSql = new StringBuffer();
|
||||
|
||||
}
|
||||
resultado = j;
|
||||
ParametrosConfiguracion.dataStore.confirmarTransaccion(conexion);
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Insertados "+ j +" registros en la tabla TAGRUANA (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la inserción de TAGRUANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
try
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Excepcion. Vamos a hacer rollback");
|
||||
ParametrosConfiguracion.dataStore.deshacerTransaccion(conexion);
|
||||
}
|
||||
catch(ExcepcionTarisan ex1)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Excepcion al intentar hacer rollback de la transaccion. ");
|
||||
}
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la inserción de TAGRUANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
}
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Created on 24-nov-2005
|
||||
*
|
||||
* TODO To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
package com.tarisan.control;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import com.tarisan.data.Taiguala;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
import com.tarisan.log.LogTarisan;
|
||||
import com.tarisan.log.NivelLog;
|
||||
|
||||
|
||||
/**
|
||||
* @author Roumen
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class PersistenciaTaiguala {
|
||||
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public int obtenerContrato(long colectivo, double poliza, int entidad) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
int contrato = 0;
|
||||
Taiguala taiguala;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object[] aCondiciones=null;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT CONTRATO");
|
||||
strSql.append(" FROM TTIGUALA");
|
||||
strSql.append(" WHERE COLECTIVO=?");
|
||||
strSql.append(" AND POLIZA=?");
|
||||
strSql.append(" AND ENTIDAD=?");
|
||||
|
||||
aCondiciones = new Object[3];
|
||||
aCondiciones[0] = Long.valueOf(colectivo);
|
||||
aCondiciones[1] = Double.valueOf(poliza);
|
||||
aCondiciones[2] = Integer.valueOf(entidad);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
if(rs.next())
|
||||
{
|
||||
contrato = rs.getInt("CONTRATO");
|
||||
}
|
||||
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado " + rs.getRow() + " registros de la tabla TAIGUALA (" + strSql.toString() + ")");
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAIGUALA: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAIGUALA: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAIGUALA: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TACENTRO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
|
||||
|
||||
return contrato;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,346 @@
|
||||
package com.tarisan.control;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.tarisan.data.Taliquimedi;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
import com.tarisan.log.LogTarisan;
|
||||
import com.tarisan.log.NivelLog;
|
||||
import com.tarisan.util.Utilidades;
|
||||
|
||||
public class PersistenciaTaliquimedi {
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selecciona los registros de la tabla ttactmed en función de la sentencia SELECT indicada.
|
||||
* @param sqlSelect La sentencia SELECT de selección.
|
||||
* @param pagina Número de página a mostrar.
|
||||
* @param aCondiciones Array que contiene los parametros utilizados en la sentencia SELECT.
|
||||
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code>ttactmed</code>).
|
||||
* @throws
|
||||
*/
|
||||
public Vector seleccionar(String sqlSelect, int pagina, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
int elementosPaginacion=1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
Taliquimedi taliquimedi = null;
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect, aCondiciones);
|
||||
|
||||
/*objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina); */
|
||||
|
||||
while(rs.next()) /* && (elementosPaginacion <= Paginacion.getFilasPorPagina()))*/
|
||||
{
|
||||
taliquimedi = new Taliquimedi();
|
||||
taliquimedi.setMedico(rs.getInt("MEDICO"));
|
||||
taliquimedi.setMedico_origen(rs.getInt("MEDICO_ORIGEN"));
|
||||
taliquimedi.setMes(rs.getString("MES"));
|
||||
taliquimedi.setAnio(rs.getString("año"));
|
||||
taliquimedi.setFecha_factura(rs.getDate("FECHA_FACTURA"));
|
||||
taliquimedi.setFactura(rs.getInt("FACTURA"));
|
||||
taliquimedi.setEspecialidad(rs.getInt("ESPECIALIDAD"));
|
||||
taliquimedi.setDesc_esp(rs.getString("DESC_ESP"));
|
||||
taliquimedi.setActo(rs.getInt("ACTO"));
|
||||
taliquimedi.setDescripcion(rs.getString("DESCRIPCION"));
|
||||
taliquimedi.setPrecio(rs.getDouble("PRECIO"));
|
||||
taliquimedi.setCantidad(rs.getInt("CANTIDAD"));
|
||||
taliquimedi.setImporte(rs.getDouble("IMPORTE"));
|
||||
vResultado.addElement(taliquimedi);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
//}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TALIQUIMEDI (" + sqlSelect + ")");
|
||||
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TALIQUIMEDI: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TALIQUIMEDI: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TALIQUIMEDI: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TALIQUIMEDI: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public Vector seleccionar_res_todas_liqui(String sqlSelect, Object[] aCondiciones, String retencion) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect, aCondiciones);
|
||||
|
||||
if (retencion=="S"){
|
||||
while(rs.next())
|
||||
{
|
||||
vResultado.addElement(rs.getString("FECHA"));
|
||||
vResultado.addElement(rs.getInt("IMPORTE"));
|
||||
vResultado.addElement(rs.getInt("TOTAL"));
|
||||
vResultado.addElement(rs.getInt("IRPF"));
|
||||
}
|
||||
}else{
|
||||
while(rs.next())
|
||||
{
|
||||
vResultado.addElement(rs.getString("FECHA"));
|
||||
vResultado.addElement(rs.getInt("IMPORTE"));
|
||||
vResultado.addElement(rs.getInt("TOTAL"));
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TALIQUIMEDI (" + sqlSelect + ")");
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TALIQUIMEDI: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TALIQUIMEDI: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TALIQUIMEDI: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TALIQUIMEDI: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
|
||||
public Vector listado_fechas_liquidaciones(int medico) throws SQLException
|
||||
{
|
||||
Vector vresul = new Vector();
|
||||
String sql="";
|
||||
|
||||
sql = "select mes||'/'||año as fecha from taliquimedi where medico = "+medico+" group by año, mes order by año desc, mes desc";
|
||||
|
||||
try {
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet resultado = ParametrosConfiguracion.dataStore.seleccionar(conexion, sql);
|
||||
|
||||
while (resultado.next())
|
||||
{
|
||||
vresul.addElement(resultado.getString("FECHA"));
|
||||
};
|
||||
conexion.close();
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de las fechas de liquidación: " + e + " (" + sql + ")");
|
||||
}
|
||||
|
||||
return vresul;
|
||||
}
|
||||
|
||||
public boolean tiene_retencion(int medico) throws SQLException
|
||||
{
|
||||
boolean retencion = false;
|
||||
String sql="";
|
||||
|
||||
sql = "Select cla, medico_origen from ttmedico, taliquimedi where ttmedico.medico = " + medico + " and ttmedico.medico = taliquimedi.medico";
|
||||
|
||||
try {
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet resultado = ParametrosConfiguracion.dataStore.seleccionar(conexion, sql);
|
||||
if(resultado.next())
|
||||
{
|
||||
if(resultado.getString("cla").indexOf("M") == 0)
|
||||
{
|
||||
retencion = true;
|
||||
LogTarisan.logger.log(NivelLog.INFO, "\nSi tiene retencion 219\n");
|
||||
}
|
||||
};
|
||||
conexion.close();
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de la existencia de retención de IRP: " + e + " (" + sql + ")");
|
||||
}
|
||||
|
||||
return retencion;
|
||||
}
|
||||
|
||||
public boolean tiene_retencion_por_taliquimedico(int medico) throws SQLException
|
||||
{
|
||||
boolean retencion = false;
|
||||
String sql="";
|
||||
|
||||
sql = "Select cla, medico_origen from ttmedico, taliquimedi where taliquimedi.medico = " + medico + " and ttmedico.medico = taliquimedi.medico_origen";
|
||||
|
||||
try {
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet resultado = ParametrosConfiguracion.dataStore.seleccionar(conexion, sql);
|
||||
if(resultado.next())
|
||||
{
|
||||
if(resultado.getString("cla").indexOf("M") == 0)
|
||||
{
|
||||
retencion = true;
|
||||
LogTarisan.logger.log(NivelLog.INFO, "\nSi tiene retencion 219\n");
|
||||
}
|
||||
};
|
||||
conexion.close();
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de la existencia de retención de IRP: " + e + " (" + sql + ")");
|
||||
}
|
||||
|
||||
return retencion;
|
||||
}
|
||||
|
||||
public Vector listado_resumen_todas_liquidaciones_con_retencion(int medico)
|
||||
{
|
||||
Vector resul = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
String retencion = "S";
|
||||
|
||||
Object [] aCondiciones = new Object[1];
|
||||
String consulta = "";
|
||||
|
||||
strSql.append("Select concat(concat(mes, '/'),año) as FECHA, sum(importe) as IMPORTE, (sum(importe)*0.15) as IRPF, (sum(importe)-(sum(importe)*0.15)) as TOTAL");
|
||||
strSql.append(" from taliquimedi where medico = ?");
|
||||
strSql.append(" group by mes, año");
|
||||
strSql.append(" order by mes, año");
|
||||
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
|
||||
try {
|
||||
resul = this.seleccionar_res_todas_liqui(strSql.toString(), aCondiciones, retencion);
|
||||
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TALIQUIMEDI (listado_resumen_todas_liquidaciones_con_retencion): " + e + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
public Vector listado_resumen_todas_liquidaciones_sin_retencion(int medico)
|
||||
{
|
||||
Vector resul = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
String retencion = "N";
|
||||
|
||||
Object [] aCondiciones = new Object[1];
|
||||
String consulta = "";
|
||||
|
||||
strSql.append("Select concat(concat(mes, '/'),año) as FECHA, sum(importe) as IMPORTE, sum(importe) as TOTAL");
|
||||
strSql.append(" from taliquimedi where medico = ?");
|
||||
strSql.append(" group by mes, año");
|
||||
strSql.append(" order by mes, año");
|
||||
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
|
||||
try {
|
||||
resul = this.seleccionar_res_todas_liqui(strSql.toString(), aCondiciones, retencion);
|
||||
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TALIQUIMEDI (listado_resumen_todas_liquidaciones_sin_retencion): " + e + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
public int obtener_medico_origen(int med) throws SQLException
|
||||
{
|
||||
int medico = 0;
|
||||
String sql="";
|
||||
|
||||
sql = "select medico_origen from taliquimedi where medico = " + med;
|
||||
|
||||
try {
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet resultado = ParametrosConfiguracion.dataStore.seleccionar(conexion, sql);
|
||||
if(resultado.next())
|
||||
{
|
||||
medico = resultado.getInt("medico_origen");
|
||||
};
|
||||
conexion.close();
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la select de la obtención del médico de origen: " + e + " (" + sql + ")");
|
||||
}
|
||||
|
||||
return medico;
|
||||
}
|
||||
|
||||
public Vector listado_detalle_liquidaciones_medicos(int medico, String mes, int pagina)
|
||||
{
|
||||
Vector resul = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
String retencion = "N";
|
||||
|
||||
Object [] aCondiciones = new Object[2];
|
||||
String consulta = "";
|
||||
|
||||
strSql.append("Select *");
|
||||
strSql.append(" from taliquimedi where medico = ?");
|
||||
strSql.append(" and concat(concat(mes,'/'),año) = ?");
|
||||
strSql.append(" order by concat(concat(mes,'/'),año), acto");
|
||||
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
aCondiciones[1] = new String(mes);
|
||||
|
||||
try {
|
||||
resul = this.seleccionar(strSql.toString(), pagina, aCondiciones);
|
||||
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TALIQUIMEDI (listado_detalle_liquidaciones_medicos): " + e + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,440 @@
|
||||
package com.tarisan.control;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.sql.Connection;
|
||||
import java.sql.Date;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.itextpdf.text.BaseColor;
|
||||
import com.itextpdf.text.Document;
|
||||
import com.itextpdf.text.DocumentException;
|
||||
import com.itextpdf.text.Element;
|
||||
import com.itextpdf.text.Font;
|
||||
import com.itextpdf.text.FontFactory;
|
||||
import com.itextpdf.text.PageSize;
|
||||
import com.itextpdf.text.Paragraph;
|
||||
import com.itextpdf.text.Phrase;
|
||||
import com.itextpdf.text.pdf.PdfPCell;
|
||||
import com.itextpdf.text.pdf.PdfPTable;
|
||||
import com.itextpdf.text.pdf.PdfWriter;
|
||||
import com.tarisan.data.TaliquimediDet;
|
||||
import com.tarisan.data.Tavolin;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.util.*;
|
||||
|
||||
public class PersistenciaTaliquimedidet implements Constantes
|
||||
{
|
||||
|
||||
/**
|
||||
* Devuelve los resultados correspondientes para ese medico, especialidad, mes y anio, siguiendo la paginacion
|
||||
* @param med
|
||||
* @param espe
|
||||
* @param mes
|
||||
* @param anio
|
||||
* @param pag
|
||||
* @return
|
||||
*/
|
||||
public Vector buscarDetalles(int med, int mes, int anio, int pag)
|
||||
{
|
||||
|
||||
|
||||
|
||||
Vector resultado = new Vector();;
|
||||
TaliquimediDet talimedet = new TaliquimediDet();
|
||||
Object[] aCondiciones = new Object[3];
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
String m = (mes<10)?"0"+mes:""+mes;
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
sqlSelect.append("Select MEDICO, FACTURA, APELLIDOS, ENTIDAD, COLECTIVO, poliza, orden, fecha_gasto, FECHA_FACTURA, especialidad, descripcion, importe from taliquimedidet");
|
||||
sqlSelect.append(" where medico = ?");
|
||||
sqlSelect.append(" and fecha_factura = ?");
|
||||
sqlSelect.append(" order by fecha_gasto desc");
|
||||
aCondiciones[0] = Integer.valueOf(med);
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set(anio, mes-1, Utilidades.ultimo_dia_mes(mes,anio));
|
||||
aCondiciones[1] = new Date(cal.getTimeInMillis());
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString().toUpperCase(), aCondiciones);
|
||||
|
||||
Paginacion pg = new Paginacion();
|
||||
pg.inicializarPaginacion(rs);
|
||||
pg.realizarPaginacion(rs, pag);
|
||||
for(int i=0;i<pg.getFilasPorPagina();i++)
|
||||
{
|
||||
rs.next();
|
||||
//LogTarisan.logger.log(NivelLog.DEBUG, "llega 51");
|
||||
talimedet = new TaliquimediDet();
|
||||
talimedet.setMedico(rs.getInt("MEDICO"));
|
||||
//LogTarisan.logger.log(NivelLog.DEBUG, "llega 54");
|
||||
talimedet.setFactura(rs.getInt("FACTURA"));
|
||||
talimedet.setApellidos(rs.getString("APELLIDOS"));
|
||||
talimedet.setEntidad(rs.getInt("ENTIDAD"));
|
||||
talimedet.setColectivo(rs.getInt("COLECTIVO"));
|
||||
talimedet.setPoliza(rs.getDouble("POLIZA"));
|
||||
talimedet.setOrden(rs.getInt("ORDEN"));
|
||||
talimedet.setFecha_gasto(rs.getDate("FECHA_GASTO"));
|
||||
talimedet.setEspecialidad(rs.getInt("ESPECIALIDAD"));
|
||||
talimedet.setDescripcion(rs.getString("DESCRIPCION"));
|
||||
talimedet.setImporte(rs.getDouble("IMPORTE"));
|
||||
talimedet.setFecha_factura(rs.getDate("FECHA_FACTURA"));
|
||||
|
||||
resultado.add(talimedet);
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + resultado.size() +" detalles del medico " + med);
|
||||
|
||||
} catch (ExcepcionTarisan e){
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al obtener los detalles del medico: "+med);
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al obtener los detalles del medico: "+med);
|
||||
}
|
||||
|
||||
return resultado;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Devuelve todos los resultados correspondientes para ese medico, especialidad, mes y anio
|
||||
* @param med
|
||||
* @param espe
|
||||
* @param mes
|
||||
* @param anio
|
||||
* @return
|
||||
*/
|
||||
public Vector buscarDetalles(int med, int mes, int anio)
|
||||
{
|
||||
Vector resultado = new Vector();;
|
||||
TaliquimediDet talimedet = new TaliquimediDet();
|
||||
Object[] aCondiciones = new Object[2];
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
String m = (mes<10)?"0"+mes:""+mes;
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
sqlSelect.append("Select MEDICO, FACTURA, APELLIDOS, ENTIDAD, COLECTIVO, poliza, orden, fecha_gasto, FECHA_FACTURA, especialidad, descripcion, importe from taliquimedidet");
|
||||
sqlSelect.append(" where medico = ?");
|
||||
sqlSelect.append(" and fecha_factura = ?");
|
||||
sqlSelect.append(" order by fecha_gasto desc");
|
||||
aCondiciones[0] = Integer.valueOf(med);
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.set(anio, mes-1, Utilidades.ultimo_dia_mes(mes,anio));
|
||||
aCondiciones[1] = new Date(cal.getTimeInMillis());
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString().toUpperCase(), aCondiciones);
|
||||
while(rs.next())
|
||||
{
|
||||
talimedet = new TaliquimediDet();
|
||||
talimedet.setMedico(rs.getInt("MEDICO"));
|
||||
talimedet.setFactura(rs.getInt("FACTURA"));
|
||||
talimedet.setApellidos(rs.getString("APELLIDOS"));
|
||||
talimedet.setEntidad(rs.getInt("ENTIDAD"));
|
||||
talimedet.setColectivo(rs.getInt("COLECTIVO"));
|
||||
talimedet.setPoliza(rs.getDouble("POLIZA"));
|
||||
talimedet.setOrden(rs.getInt("ORDEN"));
|
||||
talimedet.setFecha_gasto(rs.getDate("FECHA_GASTO"));
|
||||
talimedet.setEspecialidad(rs.getInt("ESPECIALIDAD"));
|
||||
talimedet.setDescripcion(rs.getString("DESCRIPCION"));
|
||||
talimedet.setImporte(rs.getDouble("IMPORTE"));
|
||||
talimedet.setFecha_factura(rs.getDate("FECHA_FACTURA"));
|
||||
|
||||
resultado.add(talimedet);
|
||||
}
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + resultado.size() +" detalles del medico " + med);
|
||||
} catch (ExcepcionTarisan e){
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al obtener los detalles del medico: "+med);
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al obtener los detalles del medico: "+med);
|
||||
}
|
||||
return resultado;
|
||||
}
|
||||
|
||||
/**
|
||||
* Genera el pdf de los detalles de la liquidación que está consultando el médico
|
||||
* @param med
|
||||
* @param espe
|
||||
* @param mes
|
||||
* @param anio
|
||||
* @return
|
||||
*/
|
||||
public boolean generarPdfDetalle(int med, int mes, int anio)
|
||||
{
|
||||
boolean resul = false;
|
||||
Double importe = 0.0;
|
||||
DecimalFormat df = new DecimalFormat("#.##");
|
||||
String m = (String) ((mes<10)?"0"+mes:""+mes);
|
||||
int ultimo_dia = Utilidades.ultimo_dia_mes(mes, anio);
|
||||
String fecha_factura = ultimo_dia+"/"+m+"/"+anio;
|
||||
//String file_detalle="/root/apache-tomcat-6.0.20/webapps/tarisan/liquidaciones/detalle_"+med+"_"+m+"_"+anio+".pdf";
|
||||
String file_detalle=ParametrosConfiguracion.ruta_pdf_liquidaciones + "detalle_"+med+"_"+m+"_"+anio+".pdf";
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Vamos a generar el pdf del detalle de la liquidacion "+file_detalle);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Vamos a generar el pdf del detalle de la liquidacion para el medico "+med+", del mes "+mes+" del año "+anio+"\n\n\n\n");
|
||||
Font fuente= new Font(Font.getFamily("ARIAL"), 7, Font.BOLD);
|
||||
|
||||
String encabezado = null;
|
||||
String detalles_fra = null;
|
||||
String pie = null;
|
||||
Document documento = new Document(PageSize.A4);
|
||||
//float[] colsWidth = {1f, 1f, 2f, 1f, 3f, 2f, 1f, 1f};
|
||||
float[] colsWidth = {2f, 5f, 3f, 1f, 1f};
|
||||
|
||||
PdfPTable tabla=new PdfPTable(colsWidth);
|
||||
tabla.setWidthPercentage(100);
|
||||
// entidad, colectivo, poliza, orden, asegurado, descripcion, fecha_gasto
|
||||
Vector detalles = this.buscarDetalles(med, mes, anio);
|
||||
|
||||
if(detalles.size()>0)
|
||||
{
|
||||
TaliquimediDet talimedet = new TaliquimediDet();
|
||||
talimedet = (TaliquimediDet)detalles.get(0);
|
||||
|
||||
|
||||
detalles_fra="Detalle de los honorarios del: "+m+"/"+anio+"\n"+ "Fecha Factura: "+talimedet.getFecha_factura()+"\n Factura Numero: "+talimedet.getMedico()+"/"+talimedet.getFactura()+"\n"+"\n"+"\n"+"\n";
|
||||
|
||||
Phrase para=new Phrase(detalles_fra,FontFactory.getFont("arial",10,Font.NORMAL,BaseColor.BLACK));
|
||||
|
||||
try {
|
||||
|
||||
PdfWriter.getInstance(documento, new FileOutputStream(file_detalle));
|
||||
documento.open();
|
||||
documento.add(para);
|
||||
|
||||
//Añadimos los encabezados de la tabla
|
||||
PdfPCell celda1 =new PdfPCell (new Paragraph("Póliza",FontFactory.getFont("arial",7,Font.BOLD,BaseColor.RED)));
|
||||
//PdfPCell celda2 =new PdfPCell (new Paragraph("Col.",FontFactory.getFont("arial",7,Font.BOLD,BaseColor.RED)));
|
||||
//PdfPCell celda3 =new PdfPCell (new Paragraph("Póliza",FontFactory.getFont("arial",7,Font.BOLD,BaseColor.RED)));
|
||||
//PdfPCell celda4 =new PdfPCell (new Paragraph("Orden",FontFactory.getFont("arial",7,Font.BOLD,BaseColor.RED)));
|
||||
PdfPCell celda5 =new PdfPCell (new Paragraph("Asegurado",FontFactory.getFont("arial",7,Font.BOLD,BaseColor.RED)));
|
||||
PdfPCell celda6 =new PdfPCell (new Paragraph("Descripción",FontFactory.getFont("arial",7,Font.BOLD,BaseColor.RED)));
|
||||
PdfPCell celda7 =new PdfPCell (new Paragraph("Fecha gasto",FontFactory.getFont("arial",7,Font.BOLD,BaseColor.RED)));
|
||||
PdfPCell celda8 =new PdfPCell (new Paragraph("Importe",FontFactory.getFont("arial",7,Font.BOLD,BaseColor.RED)));
|
||||
//LogTarisan.logger.log(NivelLog.DEBUG, "\n\n\n\nLlega 218\n\n\n\n");
|
||||
|
||||
celda1.setBorder(1);
|
||||
celda1.setBorderWidthTop(1);
|
||||
celda1.setBorderWidthBottom(1);
|
||||
celda1.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
celda1.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
/*celda2.setBorder(1);
|
||||
celda2.setBorderWidthTop(1);
|
||||
celda2.setBorderWidthBottom(1);
|
||||
celda2.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
celda2.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
celda3.setBorder(1);
|
||||
celda3.setBorderWidthTop(1);
|
||||
celda3.setBorderWidthBottom(1);
|
||||
celda3.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
celda3.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
celda4.setBorder(1);
|
||||
celda4.setBorderWidthTop(1);
|
||||
celda4.setBorderWidthBottom(1);
|
||||
celda4.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
celda4.setVerticalAlignment(Element.ALIGN_MIDDLE);*/
|
||||
celda5.setBorder(1);
|
||||
celda5.setBorderWidthTop(1);
|
||||
celda5.setBorderWidthBottom(1);
|
||||
celda5.setHorizontalAlignment(Element.ALIGN_LEFT);
|
||||
celda5.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
celda6.setBorder(1);
|
||||
celda6.setBorderWidthTop(1);
|
||||
celda6.setBorderWidthBottom(1);
|
||||
celda6.setHorizontalAlignment(Element.ALIGN_LEFT);
|
||||
celda6.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
celda7.setBorder(1);
|
||||
celda7.setBorderWidthTop(1);
|
||||
celda7.setBorderWidthBottom(1);
|
||||
celda7.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
celda7.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
celda8.setBorder(1);
|
||||
celda8.setBorderWidthTop(1);
|
||||
celda8.setBorderWidthBottom(1);
|
||||
celda8.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
celda8.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
tabla.addCell(celda1);/*
|
||||
tabla.addCell(celda2);
|
||||
tabla.addCell(celda3);
|
||||
tabla.addCell(celda4);*/
|
||||
tabla.addCell(celda5);
|
||||
tabla.addCell(celda6);
|
||||
tabla.addCell(celda7);
|
||||
tabla.addCell(celda8);
|
||||
|
||||
//ahora recorremos el vector con todos los detalles de la liquidacion y vamos añadiendo los campos
|
||||
for(int j=0;j<detalles.size();j++)
|
||||
{
|
||||
//LogTarisan.logger.log(NivelLog.DEBUG, "Llega 272: detalle "+j+" de"+detalles.size());
|
||||
talimedet = (TaliquimediDet)detalles.get(j);
|
||||
Double aux = talimedet.getPoliza();
|
||||
Long aux2 = aux.longValue();
|
||||
String poliza = talimedet.getEntidad()+"-"+talimedet.getColectivo()+"-"+aux2.toString()+"-"+talimedet.getOrden();
|
||||
PdfPCell celda01 =new PdfPCell (new Paragraph(poliza,FontFactory.getFont("arial",7,Font.NORMAL,BaseColor.BLACK)));
|
||||
//PdfPCell celda02 =new PdfPCell (new Paragraph(talimedet.getColectivo()+"",FontFactory.getFont("arial",7,Font.NORMAL,BaseColor.BLACK)));
|
||||
//PdfPCell celda03 =new PdfPCell (new Paragraph(aux2.toString(),FontFactory.getFont("arial",7,Font.NORMAL,BaseColor.BLACK)));
|
||||
//PdfPCell celda04 =new PdfPCell (new Paragraph(talimedet.getOrden()+"",FontFactory.getFont("arial",7,Font.NORMAL,BaseColor.BLACK)));
|
||||
PdfPCell celda05 =new PdfPCell (new Paragraph(talimedet.getApellidos()+"",FontFactory.getFont("arial",7,Font.NORMAL,BaseColor.BLACK)));
|
||||
PdfPCell celda06 =new PdfPCell (new Paragraph(talimedet.getDescripcion()+"",FontFactory.getFont("arial",7,Font.NORMAL,BaseColor.BLACK)));
|
||||
PdfPCell celda07 =new PdfPCell (new Paragraph(Utilidades.formatear_fecha(talimedet.getFecha_gasto())+"",FontFactory.getFont("arial",7,Font.NORMAL,BaseColor.BLACK)));
|
||||
PdfPCell celda08 =new PdfPCell (new Paragraph(df.format(talimedet.getImporte())+"",FontFactory.getFont("arial",7,Font.NORMAL,BaseColor.BLACK)));
|
||||
|
||||
celda01.setBorder(0);
|
||||
celda01.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
celda01.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
|
||||
if((j % 2) == 0)
|
||||
celda01.setBackgroundColor(BaseColor.LIGHT_GRAY);
|
||||
/*
|
||||
celda02.setBorder(0);
|
||||
celda02.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
celda02.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
if((j % 2) == 0)
|
||||
celda02.setBackgroundColor(BaseColor.LIGHT_GRAY);
|
||||
|
||||
celda03.setBorder(0);
|
||||
celda03.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
celda03.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
if((j % 2) == 0)
|
||||
celda03.setBackgroundColor(BaseColor.LIGHT_GRAY);
|
||||
|
||||
celda04.setBorder(0);
|
||||
celda04.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
celda04.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
if((j % 2) == 0)
|
||||
celda04.setBackgroundColor(BaseColor.LIGHT_GRAY);
|
||||
*/
|
||||
celda05.setBorder(0);
|
||||
celda05.setHorizontalAlignment(Element.ALIGN_LEFT);
|
||||
celda05.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
if((j % 2) == 0)
|
||||
celda05.setBackgroundColor(BaseColor.LIGHT_GRAY);
|
||||
|
||||
celda06.setBorder(0);
|
||||
celda06.setHorizontalAlignment(Element.ALIGN_LEFT);
|
||||
celda06.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
if((j % 2) == 0)
|
||||
celda06.setBackgroundColor(BaseColor.LIGHT_GRAY);
|
||||
|
||||
celda07.setBorder(0);
|
||||
celda07.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
celda07.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
if((j % 2) == 0)
|
||||
celda07.setBackgroundColor(BaseColor.LIGHT_GRAY);
|
||||
|
||||
celda08.setBorder(0);
|
||||
celda08.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
celda08.setVerticalAlignment(Element.ALIGN_MIDDLE);
|
||||
if((j % 2) == 0)
|
||||
celda08.setBackgroundColor(BaseColor.LIGHT_GRAY);
|
||||
|
||||
tabla.addCell(celda01);/*
|
||||
tabla.addCell(celda02);
|
||||
tabla.addCell(celda03);
|
||||
tabla.addCell(celda04);*/
|
||||
tabla.addCell(celda05);
|
||||
tabla.addCell(celda06);
|
||||
tabla.addCell(celda07);
|
||||
tabla.addCell(celda08);
|
||||
importe = importe + talimedet.getImporte();
|
||||
}
|
||||
documento.add(tabla);
|
||||
|
||||
|
||||
PdfPTable resumen=new PdfPTable(2);
|
||||
resumen.setWidthPercentage(40);
|
||||
PdfPCell celda_pie1 =new PdfPCell (new Paragraph("Importe total:",FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK)));
|
||||
celda_pie1.setBorder(0);
|
||||
PdfPCell celda_pie2 =new PdfPCell (new Paragraph(df.format(importe),FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK)));
|
||||
celda_pie2.setBorder(0);
|
||||
celda_pie2.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
resumen.addCell(celda_pie1);
|
||||
resumen.addCell(celda_pie2);
|
||||
Double irpf = 0.0;
|
||||
Double total = 0.0;
|
||||
irpf = importe*0.15;
|
||||
total = importe - irpf;
|
||||
if(tieneRetencion(med))
|
||||
{
|
||||
celda_pie1 =new PdfPCell (new Paragraph("I.R.P.F. ",FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK)));
|
||||
celda_pie2 =new PdfPCell (new Paragraph(df.format(irpf),FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK)));
|
||||
celda_pie1.setBorder(0);
|
||||
celda_pie2.setBorder(0);
|
||||
celda_pie2.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
//resumen.addCell(celda_pie1);
|
||||
//resumen.addCell(celda_pie2);
|
||||
}
|
||||
celda_pie1 =new PdfPCell (new Paragraph("Total Liquidacion:",FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK)));
|
||||
celda_pie2 =new PdfPCell (new Paragraph(df.format(total),FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK)));
|
||||
celda_pie1.setBorder(0);
|
||||
celda_pie2.setBorder(0);
|
||||
celda_pie1.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
celda_pie2.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
//resumen.addCell(celda_pie1);
|
||||
//resumen.addCell(celda_pie2);
|
||||
|
||||
|
||||
Paragraph fin=new Paragraph(pie,FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK));
|
||||
|
||||
|
||||
//documento.add(tabla);
|
||||
documento.add(new Paragraph("\n\n\n",FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK)));
|
||||
documento.add(resumen);
|
||||
documento.add(new Paragraph("\n\n\n",FontFactory.getFont("arial",8,Font.NORMAL,BaseColor.BLACK)));
|
||||
documento.add(fin);
|
||||
|
||||
|
||||
|
||||
documento.close();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Suma total del detalle: "+Utilidades.formatearDouble(importe, 2));
|
||||
} catch (FileNotFoundException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "No encuentro el fichero: "+file_detalle);
|
||||
} catch (DocumentException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Excepcion DocumentException: "+e.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
/**
|
||||
* Devuelve si el médico pasado por parámetro tiene retención o no.
|
||||
* @param med
|
||||
* @return
|
||||
*/
|
||||
public boolean tieneRetencion(int med)
|
||||
{
|
||||
boolean retencion = false;
|
||||
String sql = "Select cla from ttmedico where ttmedico.medico = " + med;
|
||||
Connection conexion;
|
||||
try {
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet resul = ParametrosConfiguracion.dataStore.seleccionar(conexion, sql);
|
||||
|
||||
|
||||
if(resul.next())
|
||||
{
|
||||
if(resul.getString("cla").contains("M"))
|
||||
{
|
||||
retencion = true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Excepcion tarisan al obtener la retencion del medico : "+med+", "+e.toString());
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Excepcion sql al obtener la retencion del medico : "+med+", "+e.toString());
|
||||
}
|
||||
|
||||
return retencion;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
/**
|
||||
* @(#) PersistenciaTamedica.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.Tamedica;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.util.Utilidades;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>Tamedica</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaTamedica
|
||||
{
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber qué página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>.
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selecciona los registros de la tabla TAMEDICA en función de la sentencia SELECT indicada.
|
||||
* @param sqlSelect La sentencia SELECT de selección.
|
||||
* @param pagina Número de página a mostrar.
|
||||
* @param aCondiciones Array que contiene los parámetros utilizados en la sentencia SELECT.
|
||||
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code>Tamedica</code>).
|
||||
* @throws
|
||||
*/
|
||||
public Vector seleccionar(String sqlSelect, int pagina, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
int elementosPaginacion=1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
Tamedica tamedica = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
if (aCondiciones==null || aCondiciones.length==0)
|
||||
rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect);
|
||||
else
|
||||
rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect, aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
tamedica = new Tamedica();
|
||||
tamedica.setDescripcion(rs.getString("DESCRIPCION"));
|
||||
tamedica.setCodigo(rs.getInt("CODIGO"));
|
||||
vResultado.addElement(tamedica);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TAMEDICA (" + sqlSelect + ")");
|
||||
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICA: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICA: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICA: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICA: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public Vector listado_medicamentos(String nombre, int intPagina)
|
||||
{
|
||||
Vector resul = new Vector();
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
|
||||
Object [] aCondiciones = new Object[1];
|
||||
String consulta = "";
|
||||
|
||||
strSql.append("SELECT CODIGO, DESCRIPCION");
|
||||
strSql.append(" FROM TAMEDICA");
|
||||
|
||||
//comprobamos si se trata de una busqueda de medicamentos
|
||||
if (!nombre.equalsIgnoreCase(""))
|
||||
{
|
||||
if (nombre.endsWith("*"))
|
||||
nombre=nombre.replace('*', '%');
|
||||
else
|
||||
nombre="%" + nombre +"%";
|
||||
|
||||
strSql.append(" WHERE DESCRIPCION LIKE ?");
|
||||
aCondiciones[0] = new String(nombre);
|
||||
}else{
|
||||
aCondiciones = new Object[0];
|
||||
|
||||
}
|
||||
|
||||
strSql.append(" ORDER BY DESCRIPCION");
|
||||
|
||||
|
||||
try {
|
||||
resul = this.seleccionar(strSql.toString(), intPagina, aCondiciones);
|
||||
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de Tamedica (listado_medicamentos): " + e + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,717 @@
|
||||
/**
|
||||
* @(#) PersistenciaTamedico.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.Tamedico;
|
||||
import com.tarisan.excepcion.*;
|
||||
import com.tarisan.log.*;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>Tamedico</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaTamedico
|
||||
{
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>.
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selecciona los registros de la tabla TAMEDICO en función de la sentencia SELECT indicada.
|
||||
* @param sqlSelect La sentencia SELECT de selección.
|
||||
* @param pagina Número de página a mostrar.
|
||||
* @param aCondiciones Array que contiene los parámetros utilizados en la sentencia SELECT.
|
||||
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code>tamedico</code>).
|
||||
* @throws
|
||||
*/
|
||||
public Vector seleccionar(String sqlSelect, int pagina, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
int elementosPaginacion=1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
Tamedico tamedico = null;
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect, aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
tamedico = new Tamedico();
|
||||
tamedico.setApellidos(rs.getString("APELLIDOS"));
|
||||
tamedico.setColegiadoCab(rs.getString("COLEGIADO_CAB"));
|
||||
tamedico.setCpCab(rs.getInt("CP_CAB"));
|
||||
tamedico.setDireccionCab(rs.getString("DIRECCION_CAB"));
|
||||
tamedico.setEspecialidad(rs.getInt("ESPECIALIDAD"));
|
||||
tamedico.setEspecialidadCab(rs.getString("ESPECIALIDAD_CAB"));
|
||||
tamedico.setMedico(rs.getInt("MEDICO"));
|
||||
tamedico.setNombre(rs.getString("NOMBRE"));
|
||||
tamedico.setNombreCab(rs.getString("NOMBRE_CAB"));
|
||||
tamedico.setParam1(rs.getInt("PARAM1"));
|
||||
tamedico.setParam2(rs.getInt("PARAM2"));
|
||||
tamedico.setPassword(rs.getString("PASSWORD"));
|
||||
tamedico.setPoblacionCab(rs.getString("POBLACION_CAB"));
|
||||
tamedico.setTarifa(rs.getInt("TARIFA"));
|
||||
tamedico.setTelefonoCab(rs.getString("TELEFONO_CAB"));
|
||||
tamedico.setNum_deter(rs.getInt("NUM_DETER"));
|
||||
tamedico.setEmailCab(rs.getString("EMAIL_CAB"));
|
||||
vResultado.addElement(tamedico);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TAMEDICO (" + sqlSelect + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtiene el médico que ha realizado la prescripción del análisis al paciente.
|
||||
* @param autorizacion Autorización de la prescripción.
|
||||
* @param colectivo Número de colectivo.
|
||||
* @param póliza Número de póliza.
|
||||
* @param beneficiario Número de beneficiario.
|
||||
* @return El objeto <code>Tamedico</code> que ha realizado la prescripción del análisis al paciente.
|
||||
* @throws
|
||||
*/
|
||||
public Tamedico obtenerMedicoPrescripcionAnalisis(long autorizacion, long colectivo, double poliza, int beneficiario) throws ExcepcionTarisan
|
||||
{
|
||||
Tamedico tamedico = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT tapresca_tarisan.PRESCRIPTOR, TAMEDICO.ESPECIALIDAD");
|
||||
strSql.append(" FROM tapresca_tarisan, TAMEDICO");
|
||||
strSql.append(" WHERE tapresca_tarisan.PRESCRIPTOR=TAMEDICO.MEDICO");
|
||||
strSql.append(" AND tapresca_tarisan.AUTORIZACION=?");
|
||||
strSql.append(" AND tapresca_tarisan.COLEC=?");
|
||||
strSql.append(" AND tapresca_tarisan.POLIZA=?");
|
||||
strSql.append(" AND tapresca_tarisan.ORDEN=?");
|
||||
|
||||
aCondiciones = new Object[4];
|
||||
aCondiciones[0] = Long.valueOf(autorizacion);
|
||||
aCondiciones[1] = Long.valueOf(colectivo);
|
||||
aCondiciones[2] = Double.valueOf(poliza);
|
||||
aCondiciones[3] = Integer.valueOf(beneficiario);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
if (rs.next())
|
||||
{
|
||||
tamedico = new Tamedico();
|
||||
tamedico.setEspecialidad(rs.getInt("ESPECIALIDAD"));
|
||||
tamedico.setMedico(rs.getInt("PRESCRIPTOR"));
|
||||
}
|
||||
else
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la obtención del codigo del prescriptor de la tabla tapresca_tarisan (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan("Error en la obtención del prescriptor del analisis.");
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "El codigo del prescriptor obtenido de la tabla tapresca_tarisan es: " + tamedico.getMedico() + " (" + strSql.toString() + ")");
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return tamedico;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtiene el password del médico que está conectado a la aplicación de la tabla TAMEDICO.
|
||||
* @param medico Código del médico conectado.
|
||||
* @param especialidad Código de la especialidad del médico conectado.
|
||||
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code>tamedico</code>).
|
||||
* @throws
|
||||
*/
|
||||
public Vector obtenerPassword(int medico, int especialidad) throws ExcepcionTarisan
|
||||
{
|
||||
Vector vResultado = new Vector();
|
||||
Tamedico tamedico = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT password");
|
||||
strSql.append(" FROM tamedico");
|
||||
strSql.append(" WHERE medico=?");
|
||||
strSql.append(" AND especialidad=?");
|
||||
|
||||
aCondiciones = new Object[2];
|
||||
aCondiciones[0]=Integer.valueOf(medico);
|
||||
aCondiciones[1]=Integer.valueOf(especialidad);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
//nos posicionamos en el registro
|
||||
rs.next();
|
||||
//obtenemos el password
|
||||
tamedico = new Tamedico();
|
||||
tamedico.setPassword(rs.getString("PASSWORD"));
|
||||
vResultado.addElement(tamedico);
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TAMEDICO (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtiene el valor del campo Param1 del médico indicado de la tabla TAMEDICO.
|
||||
* @param medico Código del médico conectado.
|
||||
* @return El valor del campo Param1 del médico en cuestión.
|
||||
* @throws
|
||||
*/
|
||||
public int obtenerValorParam1(int medico) throws ExcepcionTarisan
|
||||
{
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
int intParam1 = 0;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT param1");
|
||||
strSql.append(" FROM tamedico");
|
||||
strSql.append(" WHERE medico=?");
|
||||
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0]=Integer.valueOf(medico);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
//nos posicionamos en el registro
|
||||
if (rs.next())
|
||||
//obtenemos el campo PARAM1
|
||||
intParam1 = rs.getInt("PARAM1");
|
||||
else
|
||||
{
|
||||
//lanzamos error al no encontrar el registro del medico indicado
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la obtención del campo PARAM1 de la tabla TAMEDICO: (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan("Error en la obtención de los datos del médico.");
|
||||
}
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado el valor " + intParam1 + " del campo PARAM1 de la tabla TAMEDICO (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
|
||||
return intParam1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public int obtenerEspecialidad(int medico) throws ExcepcionTarisan
|
||||
{
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
int intEspe = 0;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT especialidad");
|
||||
strSql.append(" FROM tamedico");
|
||||
strSql.append(" WHERE medico=?");
|
||||
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0]=Integer.valueOf(medico);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
//nos posicionamos en el registro
|
||||
if (rs.next())
|
||||
//obtenemos el campo PARAM1
|
||||
intEspe = rs.getInt("ESPECIALIDAD");
|
||||
else
|
||||
{
|
||||
//lanzamos error al no encontrar el registro del medico indicado
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la obtención del campo ESPECIALIDAD de la tabla TAMEDICO: (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan("Error en la obtención de los datos del médico.");
|
||||
}
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado el valor " + intEspe + " del campo ESPECIALIDAD de la tabla TAMEDICO (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
|
||||
return intEspe;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Modifica la tabla TAMEDICO en función de la sentencia UPDATE indicada.
|
||||
* @param sqlSelect La sentencia UPDATE.
|
||||
* @param aValores Array que contiene los valores de los parámetros utilizados en la sentencia.
|
||||
* @param aCondiciones Array que contiene los parámetros de la condición utilizados en la sentencia.
|
||||
* @throws
|
||||
*/
|
||||
public void modificarMedico(String sqlSelect, Object[] aValores, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
try
|
||||
{
|
||||
ParametrosConfiguracion.dataStore.actualizar(sqlSelect, aValores, aCondiciones);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifica la tabla TAMEDICO en función de la sentencia UPDATE indicada.
|
||||
* @param sqlSelect La sentencia UPDATE.
|
||||
* @param aValores Array que contiene los valores de los parámetros utilizados en la sentencia.
|
||||
* @param aCondiciones Array que contiene los parámetros de la condición utilizados en la sentencia.
|
||||
* @param conexion La conexión por la que se ejecuta la sentencia. Utilizado para el uso transacciones.
|
||||
* @throws
|
||||
*/
|
||||
public void modificarMedico(String sqlSelect, Object[] aValores, Object[] aCondiciones, Connection conexion) throws ExcepcionTarisan
|
||||
{
|
||||
try
|
||||
{
|
||||
ParametrosConfiguracion.dataStore.actualizar(sqlSelect, aValores, aCondiciones, conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selecciona el registro de la tabla TAMEDICO correspondiente al usuario seleccionado en función de la sentencia SELECT indicada.
|
||||
* @param medico El código de usuario seleccionado.
|
||||
* @return El objeto <code>Tamedico</code> seleccionado, o null si no encuentra nada.
|
||||
* @throws
|
||||
*/
|
||||
public Tamedico seleccionar(int medico) throws ExcepcionTarisan
|
||||
{
|
||||
Tamedico tamedico = null;
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
|
||||
try
|
||||
{
|
||||
sqlSelect.append("SELECT MEDICO");
|
||||
sqlSelect.append(", NOMBRE");
|
||||
sqlSelect.append(", APELLIDOS");
|
||||
sqlSelect.append(", ESPECIALIDAD");
|
||||
sqlSelect.append(", BLOQUEO_CLAVE");
|
||||
sqlSelect.append(", FECHA_ULT_ACCESO");
|
||||
sqlSelect.append(", FECHA_MODIF_CLAVE");
|
||||
sqlSelect.append(", NUM_DETER");
|
||||
sqlSelect.append(", DIRECCION_CAB");
|
||||
sqlSelect.append(", CP_CAB");
|
||||
sqlSelect.append(", POBLACION_CAB");
|
||||
sqlSelect.append(", EMAIL_CAB");
|
||||
sqlSelect.append(" FROM TAMEDICO");
|
||||
sqlSelect.append(" WHERE MEDICO = ?");
|
||||
|
||||
Object aCondiciones[] = new Object[1];
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
tamedico = new Tamedico();
|
||||
tamedico.setMedico(rs.getInt("MEDICO"));
|
||||
tamedico.setNombre(rs.getString("NOMBRE"));
|
||||
tamedico.setApellidos(rs.getString("APELLIDOS"));
|
||||
tamedico.setEspecialidad(rs.getInt("ESPECIALIDAD"));
|
||||
tamedico.setBloqueoClave(rs.getString("BLOQUEO_CLAVE"));
|
||||
tamedico.setFechaUltimoAcceso(rs.getDate("FECHA_ULT_ACCESO"));
|
||||
tamedico.setFechaModifClave(rs.getDate("FECHA_MODIF_CLAVE"));
|
||||
tamedico.setDireccionCab(rs.getString("DIRECCION_CAB"));
|
||||
tamedico.setCpCab(rs.getInt("CP_CAB"));
|
||||
tamedico.setPoblacionCab(rs.getString("POBLACION_CAB"));
|
||||
tamedico.setNum_deter(rs.getInt("NUM_DETER"));
|
||||
tamedico.setEmailCab(rs.getString("EMAIL_CAB"));
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, medico + " - Seleccionado el usuario " + medico + " de la tabla TAMEDICO (" + sqlSelect + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de TAMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de TAMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de TAMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de TAMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return tamedico;
|
||||
}
|
||||
|
||||
public boolean actualizar_noticia(int noticia, int medico)
|
||||
{
|
||||
boolean resultado = false;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Connection conexion = null;
|
||||
|
||||
strSql.append("update tamedico");
|
||||
strSql.append(" set param2 = "+ noticia);
|
||||
strSql.append(" where medico = "+medico);
|
||||
|
||||
try
|
||||
{
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
resultado = ParametrosConfiguracion.dataStore.actualizar(strSql.toString(), conexion);
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, medico + " - Actualizado el registro de la tabla TAMEDICO (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la actualizacion de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la actualizacion de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
}
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public int obtener_intNoticia(int medico)
|
||||
{
|
||||
int resultado = 0;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Connection conexion = null;
|
||||
Tamedico tamedico = null;
|
||||
Object aCondiciones[] = new Object[1];
|
||||
|
||||
strSql.append("Select PARAM2");
|
||||
strSql.append(" from tamedico");
|
||||
strSql.append(" where medico = ?");
|
||||
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
|
||||
try {
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet resul = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
if(resul.next())
|
||||
{
|
||||
tamedico = new Tamedico();
|
||||
tamedico.setParam2(resul.getInt("PARAM2"));
|
||||
}
|
||||
resultado = tamedico.getParam2();
|
||||
resul.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error al obtener la siguiente noticia. ExcecionTarisan");
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error al obtener la siguiente noticia. SQLExcepcion");
|
||||
}
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public String obtenerPosicionLogotipo(int medico) throws ExcepcionTarisan
|
||||
{
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
String logo = "";
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT logo_cab");
|
||||
strSql.append(" FROM tamedico");
|
||||
strSql.append(" WHERE medico=?");
|
||||
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0]=Integer.valueOf(medico);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
//nos posicionamos en el registro
|
||||
if (rs.next())
|
||||
logo = rs.getString("LOGO_CAB");
|
||||
/*else
|
||||
{
|
||||
//lanzamos error al no encontrar el registro del medico indicado
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la obtención del campo ESPECIALIDAD de la tabla TAMEDICO: (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan("Error en la obtención de los datos del médico.");
|
||||
}*/
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, medico + " - Seleccionado el valor " + logo + " del campo LOGO_CAB de la tabla TAMEDICO (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
|
||||
return logo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtiene el valor del campo NUM_DETER del médico indicado de la tabla TAMEDICO.
|
||||
* @param medico Código del médico conectado.
|
||||
* @return El valor del campo NUM_DETER del médico en cuestión.
|
||||
* @throws
|
||||
*/
|
||||
public int obtenerNumeroDeterminaciones(int medico) throws ExcepcionTarisan
|
||||
{
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
int num_deter = 0;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT num_deter");
|
||||
strSql.append(" FROM tamedico");
|
||||
strSql.append(" WHERE medico=?");
|
||||
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0]=Integer.valueOf(medico);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
//nos posicionamos en el registro
|
||||
if (rs.next())
|
||||
//obtenemos el campo PARAM1
|
||||
num_deter = rs.getInt("NUM_DETER");
|
||||
else
|
||||
{
|
||||
//lanzamos error al no encontrar el registro del medico indicado
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la obtención del campo NUM_DETER de la tabla TAMEDICO: (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan("Error en la obtención de los datos del médico.");
|
||||
}
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, medico + " - Seleccionado el valor " + num_deter + " del campo NUM_DETER de la tabla TAMEDICO (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
|
||||
return num_deter;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
/**
|
||||
* @(#) PersistenciaTamensaje.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.Tamensaje;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.util.Utilidades;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>TAMENSAJE</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaTamensaje
|
||||
{
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>.
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selecciona los registros de la tabla TAMENSAJE en función de la sentencia SELECT indicada.
|
||||
* @param sqlSelect La sentencia SELECT de selección.
|
||||
* @param pagina Número de página a mostrar.
|
||||
* @param aCondiciones Array que contiene los parámetros utilizados en la sentencia SELECT.
|
||||
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code>Taespeci</code>).
|
||||
* @throws
|
||||
*/
|
||||
public Tamensaje obtenerMensaje(int codigo) throws ExcepcionTarisan
|
||||
{
|
||||
Tamensaje tamensaje = null;
|
||||
ResultSet rs = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
|
||||
Object [] aCondiciones = new Object[1];
|
||||
|
||||
strSql.append("SELECT *");
|
||||
strSql.append(" FROM TAMENSAJE");
|
||||
strSql.append(" WHERE CODIGO = ?");
|
||||
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0] = Integer.valueOf(codigo);
|
||||
|
||||
strSql.append(" ORDER BY CODIGO");
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
|
||||
if(rs.next())
|
||||
{
|
||||
tamensaje = new Tamensaje();
|
||||
tamensaje.setMensaje(rs.getString("MENSAJE"));
|
||||
tamensaje.setCodigo(rs.getInt("CODIGO"));
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado un registro de la tabla TAMENSAJE (" + strSql.toString() + ")");
|
||||
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMENSAJE: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMENSAJE: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMENSAJE: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMENSAJE: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return tamensaje;
|
||||
}
|
||||
|
||||
public Vector obtenerMensajes(String codigos) throws ExcepcionTarisan
|
||||
{
|
||||
Vector vTamensajes = new Vector();
|
||||
ResultSet rs = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
|
||||
Object [] aCondiciones = new Object[1];
|
||||
|
||||
strSql.append("SELECT *");
|
||||
strSql.append(" FROM TAMENSAJE");
|
||||
strSql.append(" WHERE CODIGO in (?)");
|
||||
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0] = codigos;
|
||||
|
||||
strSql.append(" ORDER BY CODIGO");
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
|
||||
if(rs.next())
|
||||
{
|
||||
Tamensaje tamensaje = new Tamensaje();
|
||||
tamensaje.setMensaje(rs.getString("MENSAJE"));
|
||||
tamensaje.setCodigo(rs.getInt("CODIGO"));
|
||||
vTamensajes.add(tamensaje);
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado un registro de la tabla TAMENSAJE (" + strSql.toString() + ")");
|
||||
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMENSAJE: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMENSAJE: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMENSAJE: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMENSAJE: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vTamensajes;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,907 @@
|
||||
/**
|
||||
* @(#) PersistenciaTamovext.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.*;
|
||||
import com.tarisan.excepcion.*;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.util.Utilidades;
|
||||
|
||||
import java.sql.*;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.sql.Date;
|
||||
import java.util.Calendar;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>Tamovext</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaTamovext
|
||||
{
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtiene el último valor del campo NUMSEQ del médico indicado perteneciente a la tabla TAMOVEXT.
|
||||
* @param medico Código del médico conectado.
|
||||
* @return El último valor del campo NUMSEQ del médico en cuestión.
|
||||
* @throws
|
||||
*
|
||||
* OBSOLETO
|
||||
* 25/10/2017
|
||||
* csm_jjripaper
|
||||
* Cambiamos en oracle el campo numseq al tipo autoincrement de oracle (trigger berfore insert llamando a una secuencia).
|
||||
*/
|
||||
public int obtenerUltimoValorNumSeq2(int medico) throws ExcepcionTarisan
|
||||
{
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
int intUltimoValorNumseq = 1;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
/*
|
||||
strSql.append("SELECT MAX(numseq) as max_numseq");
|
||||
strSql.append(" FROM tamovext");
|
||||
strSql.append(" WHERE medico=?");*/
|
||||
/*
|
||||
* Cambiamos a una secuencia por que estamos viendo que hay veces que no incrementa bien el contador
|
||||
* // select NUMSEQ_SEQ.nextval from dual;
|
||||
*/
|
||||
/*strSql.append("select NUMSEQ_SEQ.nextval as MAXNUMSEQ");
|
||||
strSql.append(" FROM dual");*/
|
||||
|
||||
String sql = "select NUMSEQ_SEQ.nextval as MAXNUMSEQ FROM dual";
|
||||
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0]=Integer.valueOf(medico);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sql/*, aCondiciones*/);
|
||||
|
||||
//nos posicionamos en el registro
|
||||
if (rs.next())
|
||||
//obtenemos el campo PARAM1
|
||||
intUltimoValorNumseq = rs.getInt("MAXNUMSEQ");
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado el valor " + intUltimoValorNumseq + " del campo NUMSEQ de la tabla TAMOVEXT (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
|
||||
return intUltimoValorNumseq;
|
||||
}
|
||||
|
||||
/**
|
||||
* Añade a la tabla TAMOVEXT un nuevo registro según la sentencia INSERT indicada.
|
||||
* @param sqlSelect La sentencia INSERT.
|
||||
* @param aValores Array que contiene los valores de los parámetros utilizados en la sentencia.
|
||||
* @throws
|
||||
*/
|
||||
public void insertarMovimiento(String sqlSelect, Object[] aValores) throws ExcepcionTarisan
|
||||
{
|
||||
try
|
||||
{
|
||||
ParametrosConfiguracion.dataStore.insertar(sqlSelect, aValores);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAMOVEXT: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAMOVEXT: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAMOVEXT: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Añade a la tabla TAMOVEXT un nuevo registro según la sentencia INSERT indicada.
|
||||
* @param sqlSelect La sentencia INSERT.
|
||||
* @param aValores Array que contiene los valores de los parámetros utilizados en la sentencia.
|
||||
* @param conexion La conexión por la que se ejecuta la sentencia. Utilizado para el uso transacciones.
|
||||
* @throws
|
||||
*/
|
||||
public void insertarMovimiento(String sqlSelect, Object[] aValores, Connection conexion) throws ExcepcionTarisan
|
||||
{
|
||||
try
|
||||
{
|
||||
ParametrosConfiguracion.dataStore.insertar(sqlSelect, aValores, conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAMOVEXT: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAMOVEXT: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAMOVEXT: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Busca un movimiento en tamovex, devuelve cierto si lo encuentra
|
||||
* @param aCondiciones
|
||||
* @param conexion
|
||||
* @return
|
||||
*/
|
||||
public boolean buscarDuplicadoTamovext(Object[] aCondiciones, Connection conexion)
|
||||
{
|
||||
boolean resultado = false;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
strSql.append("Select * from TAMOVEXT");
|
||||
strSql.append("where MEDICO = ?");
|
||||
strSql.append("and ESPECIALIDAD = ?");
|
||||
strSql.append("and ACTO = ?");
|
||||
strSql.append("and COLECTIVO = ?");
|
||||
strSql.append("and POLIZA = ?");
|
||||
strSql.append("and ORDEN = ?");
|
||||
strSql.append("and FECHA = ?");
|
||||
|
||||
try
|
||||
{
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
if(rs.next())
|
||||
resultado = true;
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAMOVEXT: " + sqle + " (" + strSql + ")");
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAMOVEXT: " + sqle + " (" + strSql + ")");
|
||||
}
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public boolean insertarTamovext(Object[] aValores, Connection conexion)
|
||||
{
|
||||
boolean resultado = false;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
strSql.append("INSERT INTO TAMOVEXT");
|
||||
strSql.append(" (MEDICO, ESPECIALIDAD, ACTO, COLECTIVO, POLIZA, ORDEN, FECHA, PRECIO, PRESCRIPTOR, ENTIDAD, TARJETA_CHIPCARD, AUTORIZACION, ESPECIALIDAD_CHIPCARD, ACTO_CHIPCARD)");
|
||||
strSql.append(" VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
|
||||
try
|
||||
{
|
||||
ParametrosConfiguracion.dataStore.insertar(strSql.toString(), aValores, conexion);
|
||||
resultado = true;
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAMOVEXT: " + sqle + " (" + strSql + ")");
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAMOVEXT: " + sqle + " (" + strSql + ")");
|
||||
}
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public boolean insertarTamovextDesplazado(Object[] aValores, Connection conexion)
|
||||
{
|
||||
boolean resultado = false;
|
||||
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
strSql.append("INSERT INTO TAMOVEXT");
|
||||
strSql.append(" (MEDICO, ESPECIALIDAD, ACTO, COLECTIVO, POLIZA, ORDEN, FECHA, PRECIO, PRESCRIPTOR, TARJETA_CHIPCARD, ESPECIALIDAD_CHIPCARD, ACTO_CHIPCARD, TALON_CHIPCARD, ENTIDAD, AUTORIZACION)");
|
||||
strSql.append(" VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
|
||||
try
|
||||
{
|
||||
resultado = ParametrosConfiguracion.dataStore.insertar(strSql.toString(), aValores, conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAMOVEXT: " + sqle + " (" + strSql + ")");
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAMOVEXT: " + sqle + " (" + strSql + ")");
|
||||
}
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public boolean tieneRevisionHoy(int medico, String tarjeta, boolean chipcard)
|
||||
{
|
||||
boolean resul = false;
|
||||
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
java.sql.Date intUltimoValorNumseq = null;
|
||||
java.sql.Date dtFecha = null;
|
||||
Object[] aCondiciones;
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT fecha");
|
||||
strSql.append(" FROM tamovext");
|
||||
strSql.append(" WHERE medico="+medico);
|
||||
strSql.append(" and tarjeta_chipcard='"+tarjeta+"'");
|
||||
strSql.append(" and acto in (1,2)");
|
||||
|
||||
|
||||
|
||||
Calendar calFechaActual = Calendar.getInstance();
|
||||
int mes = calFechaActual.get(Calendar.MONTH)+1;
|
||||
String strhoy = calFechaActual.get(Calendar.DAY_OF_MONTH)+"/"+mes+"/"+calFechaActual.get(Calendar.YEAR);
|
||||
|
||||
strSql.append(" and fecha = to_date('"+strhoy+"', 'dd/mm/yyyy')");
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Consulta: "+strSql.toString());
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString());
|
||||
//nos posicionamos en el registro
|
||||
if (rs.next())
|
||||
//obtenemos el campo PARAM1
|
||||
resul = true;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT (TIENE REVISION DESPLAZADO): " + sqle + " (" + strSql.toString() + ")");
|
||||
} catch (ExcepcionTarisan e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
public boolean tieneRevisionHoyColPolOrd(int medico, long colectivo, double poliza, int beneficiario, boolean chipcard)
|
||||
{
|
||||
boolean resul = false;
|
||||
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
java.sql.Date intUltimoValorNumseq = null;
|
||||
java.sql.Date dtFecha = null;
|
||||
Object[] aCondiciones;
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT fecha");
|
||||
strSql.append(" FROM tamovext");
|
||||
strSql.append(" WHERE medico="+medico);
|
||||
strSql.append(" and colectivo="+colectivo);
|
||||
strSql.append(" and poliza="+poliza);
|
||||
strSql.append(" and orden="+beneficiario);
|
||||
strSql.append(" and acto in (1,2)");
|
||||
|
||||
|
||||
|
||||
Calendar calFechaActual = Calendar.getInstance();
|
||||
int mes = calFechaActual.get(Calendar.MONTH)+1;
|
||||
String strhoy = calFechaActual.get(Calendar.DAY_OF_MONTH)+"/"+mes+"/"+calFechaActual.get(Calendar.YEAR);
|
||||
|
||||
strSql.append(" and fecha = to_date('"+strhoy+"', 'dd/mm/yyyy')");
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Consulta: "+strSql.toString());
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString());
|
||||
//nos posicionamos en el registro
|
||||
if (rs.next())
|
||||
//obtenemos el campo PARAM1
|
||||
resul = true;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT (TIENE REVISION DESPLAZADO): " + sqle + " (" + strSql.toString() + ")");
|
||||
} catch (ExcepcionTarisan e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
/**
|
||||
* Comprueba si un asegurado determinado ya ha tenido consulta de "chipcard" para un médico determinado.
|
||||
*
|
||||
* @param medico el médico para el que buscamos
|
||||
* @param tarjeta la tarjeta chipcard que buscamos
|
||||
* @return cierto si hay acto "consulta" en tamovext
|
||||
*/
|
||||
public boolean tieneConsultaChipcard(int medico, String tarjeta)
|
||||
{
|
||||
|
||||
boolean resul = false;
|
||||
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object[] aCondiciones;
|
||||
try
|
||||
{
|
||||
strSql.append("Select count(*) COUNT from tamovext");
|
||||
strSql.append(" where medico = ?");
|
||||
strSql.append(" and tarjeta_chipcard=?");
|
||||
strSql.append(" and acto_chipcard=1");
|
||||
|
||||
aCondiciones = new Object[2];
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
aCondiciones[1] = new String(tarjeta);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
if(rs.next())
|
||||
{
|
||||
if(rs.getInt("COUNT")>0)
|
||||
resul = true;
|
||||
}
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "La tarjeta "+tarjeta+" tiene consulta en tamovext para el medico "+medico+": "+resul);
|
||||
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT (PRIMERA VISITA DESPLAZADO): " + sqle + " (" + strSql.toString() + ")");
|
||||
} catch (ExcepcionTarisan e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
public boolean esPrimeraVisitaDesplazado(int medico, String tarjeta, boolean chipcard)
|
||||
{
|
||||
boolean resul = false;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
java.sql.Date intUltimoValorNumseq = null;
|
||||
java.sql.Date dtFecha = null;
|
||||
Object[] aCondiciones;
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT fecha");
|
||||
strSql.append(" FROM tamovext");
|
||||
strSql.append(" WHERE medico=?");
|
||||
strSql.append(" and tarjeta_chipcard=?");
|
||||
strSql.append(" and acto in (1)");
|
||||
|
||||
aCondiciones = new Object[2];
|
||||
aCondiciones[0]=Integer.valueOf(medico);
|
||||
aCondiciones[1]=new String(tarjeta);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
//nos posicionamos en el registro
|
||||
if (rs.next())
|
||||
//obtenemos el campo PARAM1
|
||||
dtFecha = rs.getDate("fecha");
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
|
||||
//YA TENEMOS LA FECHA DE LA ÚLTIMA VISITA (O NULL SI NO HA VENIDO NUNCA)
|
||||
if (dtFecha!=null) //existe registro. Se comprueba si es la primera visita
|
||||
{
|
||||
Calendar calFechaPrimeraVisita = Calendar.getInstance();
|
||||
calFechaPrimeraVisita.setTime(dtFecha);
|
||||
Calendar calFechaActual = Calendar.getInstance();
|
||||
if (ParametrosConfiguracion.periodoNatural.equalsIgnoreCase("si")) //se trata de un periodo natural
|
||||
{
|
||||
if (calFechaActual.get(Calendar.YEAR)>calFechaPrimeraVisita.get(Calendar.YEAR)) { //años diferentes
|
||||
resul = true;
|
||||
} else {
|
||||
if (calFechaActual.get(Calendar.YEAR)==calFechaPrimeraVisita.get(Calendar.YEAR )) //mismo año
|
||||
{
|
||||
//le sumamos a la fecha obtenida el periodo de meses para conocer si es primera visita
|
||||
if(chipcard)
|
||||
calFechaPrimeraVisita.add(Calendar.MONTH, ParametrosConfiguracion.periodoPrimeraVisitaChipcard);
|
||||
else
|
||||
calFechaPrimeraVisita.add(Calendar.MONTH, ParametrosConfiguracion.periodoPrimeraVisita);
|
||||
|
||||
if ( calFechaPrimeraVisita.getTime().compareTo( calFechaActual.getTime() ) < 0 ) { //la fecha de la primera visita mas el periodo es inferior a la fecha actual
|
||||
resul = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else //se trata de un periodo no natural
|
||||
{
|
||||
//le sumamos a la fecha obtenida el periodo de meses para conocer si es primera visita
|
||||
calFechaPrimeraVisita.add(Calendar.MONTH, ParametrosConfiguracion.periodoPrimeraVisita);
|
||||
|
||||
if ( calFechaPrimeraVisita.getTime().compareTo( calFechaActual.getTime() ) < 0 ) //la fecha de la primera visita mas el periodo es inferior a la fecha actual
|
||||
resul = true;
|
||||
}
|
||||
} else { //No existe registro. Es primera visita
|
||||
resul = true;
|
||||
}
|
||||
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Es primera visita DESPLAZADO: " + resul +" (" + strSql.toString() + ")");
|
||||
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT (PRIMERA VISITA DESPLAZADO): " + sqle + " (" + strSql.toString() + ")");
|
||||
} catch (ExcepcionTarisan e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
public Vector ObtenerMovimientosMismaPolizaYMedico(int medico, int espe, int acto, int entidad, long col, long pol, int ord)
|
||||
{
|
||||
Vector resul = new Vector();;
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
Object[] aCondiciones = new Object[7];
|
||||
try
|
||||
{
|
||||
sqlSelect.append("Select * from tamovext_espia ");
|
||||
sqlSelect.append("where medico = ? ");
|
||||
sqlSelect.append("and especialidad = ? ");
|
||||
sqlSelect.append("and acto = ? ");
|
||||
sqlSelect.append("and entidad = ? ");
|
||||
sqlSelect.append("and colectivo = ? ");
|
||||
sqlSelect.append("and poliza = ? ");
|
||||
sqlSelect.append("and orden = ? ");
|
||||
sqlSelect.append("order by fecha desc ");
|
||||
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
aCondiciones[1] = Integer.valueOf(espe);
|
||||
aCondiciones[2] = Integer.valueOf(acto);
|
||||
aCondiciones[3] = Integer.valueOf(entidad);
|
||||
aCondiciones[4] = Long.valueOf(col);
|
||||
aCondiciones[5] = Long.valueOf(pol);
|
||||
aCondiciones[6] = Integer.valueOf(ord);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
while (rs.next())
|
||||
{
|
||||
Tamovext ta = new Tamovext();
|
||||
ta.setMedico(rs.getInt("MEDICO"));
|
||||
ta.setEspecialidad(rs.getInt("ESPECIALIDAD"));
|
||||
ta.setActo(rs.getInt("ACTO"));
|
||||
ta.setNumseq(rs.getInt("NUMSEQ"));
|
||||
ta.setEntidad(rs.getInt("ENTIDAD"));
|
||||
ta.setColec(rs.getInt("COLECTIVO"));
|
||||
ta.setPoliza(rs.getDouble("POLIZA"));
|
||||
ta.setOrden(rs.getInt("ORDEN"));
|
||||
ta.setFecha(rs.getDate("FECHA"));
|
||||
ta.setPrecio(rs.getDouble("PRECIO"));
|
||||
ta.setPrescriptor(rs.getInt("PRESCRIPTOR"));
|
||||
ta.setAutorizacion(rs.getLong("AUTORIZACION"));
|
||||
/*
|
||||
* TODO faltan los de chipcard
|
||||
*/
|
||||
resul.add(ta);
|
||||
}
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT obteniendo movimientos previos de la misma poliza y medico");
|
||||
} catch (ExcepcionTarisan e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
public Vector ObtenerMovimientosAutorizacion(long autorizacion)
|
||||
{
|
||||
Vector resul = new Vector();;
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
Object[] aCondiciones = new Object[1];
|
||||
try
|
||||
{
|
||||
sqlSelect.append("Select * from tamovext_espia ");
|
||||
sqlSelect.append("where autorizacion = ? ");
|
||||
sqlSelect.append("order by fecha desc ");
|
||||
|
||||
aCondiciones[0] = Long.valueOf(autorizacion);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
while (rs.next())
|
||||
{
|
||||
Tamovext ta = new Tamovext();
|
||||
ta.setMedico(rs.getInt("MEDICO"));
|
||||
ta.setEspecialidad(rs.getInt("ESPECIALIDAD"));
|
||||
ta.setActo(rs.getInt("ACTO"));
|
||||
ta.setNumseq(rs.getInt("NUMSEQ"));
|
||||
ta.setEntidad(rs.getInt("ENTIDAD"));
|
||||
ta.setColec(rs.getInt("COLECTIVO"));
|
||||
ta.setPoliza(rs.getDouble("POLIZA"));
|
||||
ta.setOrden(rs.getInt("ORDEN"));
|
||||
ta.setFecha(rs.getDate("FECHA"));
|
||||
ta.setPrecio(rs.getDouble("PRECIO"));
|
||||
ta.setPrescriptor(rs.getInt("PRESCRIPTOR"));
|
||||
ta.setAutorizacion(rs.getLong("AUTORIZACION"));
|
||||
/*
|
||||
* TODO faltan los de chipcard
|
||||
*/
|
||||
resul.add(ta);
|
||||
}
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT obteniendo movimientos previos de la misma poliza y medico");
|
||||
} catch (ExcepcionTarisan e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Vector AnaliticasCapturadasTotal(int medico)
|
||||
{
|
||||
return this.AnaliticasCapturadas(medico, null, null);
|
||||
}
|
||||
|
||||
public Vector AnaliticasCapturadasDesde(int medico, java.sql.Date fecini)
|
||||
{
|
||||
return this.AnaliticasCapturadas(medico, fecini, null);
|
||||
}
|
||||
|
||||
public Vector AnaliticasCapturadasHasta(int medico, java.sql.Date fecfin)
|
||||
{
|
||||
return this.AnaliticasCapturadas(medico, null, fecfin);
|
||||
}
|
||||
|
||||
public Vector<Object[]> AnaliticasCapturadas(int medico, java.sql.Date fecini, java.sql.Date fecfin)
|
||||
{
|
||||
Vector<Object[]> resul = new Vector<Object[]>();
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
Object[] aCondiciones = null;
|
||||
int i = 1;
|
||||
try
|
||||
{
|
||||
/*
|
||||
* select tamovext_espia.autorizacion , TTCLIENT.APELLIDOS, ttactmed.DESCRIPCION
|
||||
from tamovext_espia, ttactmed, TTBENEFI, TTCLIENT
|
||||
where TAMOVEXT_ESPIA.MEDICO = 363
|
||||
and TAMOVEXT_ESPIA.ACTO = ttactmed.ACTO
|
||||
and TAMOVEXT_ESPIA.ESPECIALIDAD = ttactmed.ESPECIALIDAD
|
||||
and TAMOVEXT_ESPIA.entidad = TTBENEFI.ENTIDAD
|
||||
and TAMOVEXT_ESPIA.COLECTIVO = TTBENEFI.COLECTIVO
|
||||
and TAMOVEXT_ESPIA.POLIZA = TTBENEFI.POLIZA
|
||||
and TAMOVEXT_ESPIA.ORDEN = TTBENEFI.ORDEN
|
||||
and TTBENEFI.CLIENTE = TTCLIENT.CLIENTE
|
||||
order by TAMOVEXT_ESPIA.FECHA desc
|
||||
|
||||
*/
|
||||
sqlSelect.append("select distinct(TTCLIENT.APELLIDOS), tamovext_espia.autorizacion, TAMOVEXT_ESPIA.FECHA ");
|
||||
sqlSelect.append("from tamovext_espia, TTBENEFI, TTCLIENT ");
|
||||
sqlSelect.append("where TAMOVEXT_ESPIA.MEDICO = ? ");
|
||||
sqlSelect.append("and TAMOVEXT_ESPIA.entidad = TTBENEFI.ENTIDAD ");
|
||||
sqlSelect.append("and TAMOVEXT_ESPIA.COLECTIVO = TTBENEFI.COLECTIVO ");
|
||||
sqlSelect.append("and TAMOVEXT_ESPIA.POLIZA = TTBENEFI.POLIZA ");
|
||||
sqlSelect.append("and TAMOVEXT_ESPIA.ORDEN = TTBENEFI.ORDEN ");
|
||||
sqlSelect.append("and TTBENEFI.CLIENTE = TTCLIENT.CLIENTE ");
|
||||
//si hay fecha inicio
|
||||
if(fecini != null)
|
||||
{
|
||||
sqlSelect.append("and tamovext_espia.fecha >= ? ");
|
||||
i+=1;
|
||||
}
|
||||
if(fecfin != null)
|
||||
{
|
||||
sqlSelect.append("and tamovext_espia.fecha <= ? ");
|
||||
i+=1;
|
||||
}
|
||||
sqlSelect.append("order by TAMOVEXT_ESPIA.FECHA desc ");
|
||||
|
||||
aCondiciones = new Object[i];
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
if(fecini != null)
|
||||
{
|
||||
aCondiciones[1] = fecini;
|
||||
if(fecfin != null)
|
||||
{
|
||||
aCondiciones[2] = fecfin;
|
||||
}
|
||||
}
|
||||
else if(fecfin != null)
|
||||
aCondiciones[1] = fecfin;
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
while (rs.next())
|
||||
{
|
||||
Object[] aResultados = new Object[3];
|
||||
aResultados[0] = new String(rs.getString(1));
|
||||
aResultados[1] = Long.valueOf(rs.getLong(2));
|
||||
aResultados[2] = rs.getDate(3);
|
||||
resul.addElement(aResultados);
|
||||
}
|
||||
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT obteniendo AnaliticasCapturadas");
|
||||
} catch (ExcepcionTarisan e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
public Vector<Object[]> MovimientosCapturadosPorMedico(int pagina, int medico, int especialidad)
|
||||
{
|
||||
Vector<Object[]> resul = new Vector<Object[]>();
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
Object[] aCondiciones = null;
|
||||
int elementosPaginacion=1;
|
||||
|
||||
try
|
||||
{
|
||||
sqlSelect.append("select distinct(TTCLIENT.APELLIDOS), tamovext.autorizacion, TAMOVEXT.FECHA, SUM(TAMOVEXT.PRECIO) ");
|
||||
sqlSelect.append("from tamovext, TTBENEFI, TTCLIENT ");
|
||||
sqlSelect.append("where TAMOVEXT.MEDICO = ? ");
|
||||
sqlSelect.append("and TAMOVEXT.entidad = TTBENEFI.ENTIDAD ");
|
||||
sqlSelect.append("and TAMOVEXT.COLECTIVO = TTBENEFI.COLECTIVO ");
|
||||
sqlSelect.append("and TAMOVEXT.POLIZA = TTBENEFI.POLIZA ");
|
||||
sqlSelect.append("and TAMOVEXT.ORDEN = TTBENEFI.ORDEN ");
|
||||
sqlSelect.append("and TTBENEFI.CLIENTE = TTCLIENT.CLIENTE ");
|
||||
sqlSelect.append("and TAMOVEXT.ESPECIALIDAD = ? ");
|
||||
sqlSelect.append("GROUP BY TTCLIENT.APELLIDOS, tamovext.autorizacion, TAMOVEXT.FECHA");
|
||||
|
||||
aCondiciones = new Object[2];
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
aCondiciones[1] = Integer.valueOf(especialidad);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
Object[] aResultados = new Object[4];
|
||||
aResultados[0] = new String(rs.getString(1));
|
||||
aResultados[1] = Long.valueOf(rs.getLong(2));
|
||||
aResultados[2] = rs.getDate(3);
|
||||
aResultados[3] = Double.valueOf(rs.getDouble(4));
|
||||
resul.addElement(aResultados);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + resul.size() + " movimientos (análisis o radiodiagnósticos) de la tabla TAMOVEXT (" + sqlSelect + ")");
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT obteniendo MovimientosCapturadosPorMedico");
|
||||
} catch (ExcepcionTarisan e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
public Vector<Object[]> MovimientosCapturadosDetallePorAutorizacion(int pagina, int medico, long autorizacion, int especialidad)
|
||||
{
|
||||
Vector<Object[]> resul = new Vector<Object[]>();
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
Object[] aCondiciones = null;
|
||||
int elementosPaginacion=1;
|
||||
|
||||
try
|
||||
{
|
||||
sqlSelect.append("select distinct(TTCLIENT.APELLIDOS), tamovext.autorizacion, TAMOVEXT.FECHA, TTACTMED.acto, TTACTMED.DESCRIPCION, TAMOVEXT.PRECIO ");
|
||||
sqlSelect.append("from tamovext, TTACTMED, TTBENEFI, TTCLIENT ");
|
||||
sqlSelect.append("where TAMOVEXT.MEDICO = ? ");
|
||||
sqlSelect.append("AND TTACTMED.acto = TAMOVEXT.acto ");
|
||||
sqlSelect.append("AND TTACTMED.especialidad = ? ");
|
||||
sqlSelect.append("and TAMOVEXT.autorizacion = ? ");
|
||||
sqlSelect.append("and TAMOVEXT.entidad = TTBENEFI.ENTIDAD ");
|
||||
sqlSelect.append("and TAMOVEXT.COLECTIVO = TTBENEFI.COLECTIVO ");
|
||||
sqlSelect.append("and TAMOVEXT.POLIZA = TTBENEFI.POLIZA ");
|
||||
sqlSelect.append("and TAMOVEXT.ORDEN = TTBENEFI.ORDEN ");
|
||||
sqlSelect.append("and TTBENEFI.CLIENTE = TTCLIENT.CLIENTE ");
|
||||
|
||||
aCondiciones = new Object[3];
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
aCondiciones[1] = Integer.valueOf(especialidad);
|
||||
aCondiciones[2] = Long.valueOf(autorizacion);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
Object[] aResultados = new Object[6];
|
||||
aResultados[0] = new String(rs.getString(1));
|
||||
aResultados[1] = Long.valueOf(rs.getLong(2));
|
||||
aResultados[2] = new String(Utilidades.formatear_fecha(rs.getDate(3)));
|
||||
aResultados[3] = Integer.valueOf(rs.getInt(4));
|
||||
aResultados[4] = new String(rs.getString(5));
|
||||
aResultados[5] = Double.valueOf(rs.getDouble(6));
|
||||
resul.addElement(aResultados);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + resul.size() + " analisis de la tabla TAMOVEXT (" + sqlSelect + ")");
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT obteniendo AnaliticasCapturadasPorMedico");
|
||||
} catch (ExcepcionTarisan e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
public Vector MovimientosImputados(int pagina, int medico, String fecha, String apellido1, String apellido2, String nombre)
|
||||
{
|
||||
Vector<Object[]> vResultado = new Vector<Object[]>();
|
||||
int elementosPaginacion=1;
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
|
||||
try
|
||||
{
|
||||
if (fecha=="")
|
||||
fecha="%";
|
||||
if (apellido1=="")
|
||||
apellido1="%";
|
||||
if (apellido2=="")
|
||||
apellido2="%";
|
||||
if (nombre=="")
|
||||
nombre="%";
|
||||
|
||||
sqlSelect.append("SELECT TAMOVEXT.MEDICO, TAMOVEXT.FECHA, TAMOVEXT.ACTO, TAMOVEXT.ENTIDAD, TTCLIENT.APELLIDO1, TTCLIENT.APELLIDO2, TTCLIENT.NOMBRE, TAMOVEXT.ESPECIALIDAD, TAMOVEXT.NUMSEQ, TAMOVEXT.COLECTIVO, TAMOVEXT.POLIZA, TAMOVEXT.ORDEN ");
|
||||
sqlSelect.append("FROM tamovext, ttbenefi, ttclient ");
|
||||
sqlSelect.append("WHERE TAMOVEXT.MEDICO = "+ medico + " ");
|
||||
if (fecha=="%")
|
||||
sqlSelect.append("AND tamovext.fecha LIKE '%"+ fecha +"%' ");
|
||||
else
|
||||
sqlSelect.append("AND tamovext.fecha = '"+ fecha +"' ");
|
||||
sqlSelect.append("AND TTCLIENT.APELLIDO1 LIKE '%"+ apellido1 +"%' ");
|
||||
sqlSelect.append("AND TTCLIENT.APELLIDO2 LIKE '%"+ apellido2 +"%' ");
|
||||
sqlSelect.append("AND TTCLIENT.NOMBRE LIKE '%"+ nombre +"%' ");
|
||||
sqlSelect.append("AND TTBENEFI.COLECTIVO = TAMOVEXT.COLECTIVO ");
|
||||
sqlSelect.append("AND TTBENEFI.POLIZA = TAMOVEXT.POLIZA ");
|
||||
sqlSelect.append("AND TTBENEFI.ORDEN = TAMOVEXT.ORDEN ");
|
||||
sqlSelect.append("AND TTCLIENT.CLIENTE = TTBENEFI.CLIENTE ");
|
||||
sqlSelect.append("ORDER BY TAMOVEXT.FECHA DESC");
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString());
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
Object[] aResultados = new Object[12];
|
||||
aResultados[0] = Integer.valueOf(rs.getInt(1));
|
||||
aResultados[1] = new String(Utilidades.formatear_fecha(rs.getDate(2)));
|
||||
aResultados[2] = Integer.valueOf(rs.getInt(3));
|
||||
aResultados[3] = Integer.valueOf(rs.getInt(4));
|
||||
aResultados[4] = new String(rs.getString(5));
|
||||
aResultados[5] = new String(rs.getString(6));
|
||||
aResultados[6] = new String(rs.getString(7));
|
||||
aResultados[7] = Integer.valueOf(rs.getInt(8));
|
||||
aResultados[8] = Integer.valueOf(rs.getInt(9));
|
||||
aResultados[9] = Integer.valueOf(rs.getInt(10));
|
||||
aResultados[10] = Integer.valueOf(rs.getInt(11));
|
||||
aResultados[11] = Integer.valueOf(rs.getInt(12));
|
||||
vResultado.addElement(aResultados);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " actos imputados de la tabla TAMOVEXT (" + sqlSelect + ")");
|
||||
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan et) {
|
||||
et.printStackTrace();
|
||||
} catch (SQLException sqle) {
|
||||
sqle.printStackTrace();
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public boolean EliminarMovimientoImputado(int medico, int especialidad, int acto, int numseeq, int colectivo, int poliza, int orden, String fecha) throws ParseException
|
||||
{
|
||||
boolean resultado = false;
|
||||
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
strSql.append("DELETE FROM TAMOVEXT");
|
||||
strSql.append(" WHERE MEDICO = "+ medico +" AND ESPECIALIDAD = "+ especialidad +" AND ACTO = "+ acto +" AND NUMSEQ = "+ numseeq +" AND COLECTIVO = "+ colectivo +" AND POLIZA = "+ poliza +" AND ORDEN = "+ orden +" AND FECHA = '"+ fecha + "'");
|
||||
//strSql.append(" WHERE MEDICO = "+ medico +" AND ESPECIALIDAD = "+ especialidad +" AND ACTO = "+ acto +" AND NUMSEQ = "+ numseeq +" AND COLECTIVO = "+ colectivo +" AND POLIZA = "+ poliza +" AND ORDEN = "+ orden);
|
||||
|
||||
try
|
||||
{
|
||||
resultado = ParametrosConfiguracion.dataStore.borrar(strSql.toString());
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la eliminacion de TAMOVEXT: " + sqle + " (" + strSql + ")");
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la eliminacion de TAMOVEXT: " + sqle + " (" + strSql + ")");
|
||||
}
|
||||
|
||||
return resultado;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.*;
|
||||
import com.tarisan.excepcion.*;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.util.Utilidades;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Calendar;
|
||||
import java.util.Vector;
|
||||
|
||||
public class PersistenciaTamovextDental {
|
||||
|
||||
public int obtenerUltimoValorNumSeq(int medico) throws ExcepcionTarisan
|
||||
{
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
int intUltimoValorNumseq = 1;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT MAX(numseq) as max_numseq");
|
||||
strSql.append(" FROM tamovext_dental");
|
||||
strSql.append(" WHERE medico=?");
|
||||
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0]=Integer.valueOf(medico);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
//nos posicionamos en el registro
|
||||
if (rs.next())
|
||||
//obtenemos el campo PARAM1
|
||||
intUltimoValorNumseq = rs.getInt("MAX_NUMSEQ");
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado el valor " + intUltimoValorNumseq + " del campo NUMSEQ de la tabla TAMOVEXT_DENTAL (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT_DENTAL: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT_DENTAL: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT_DENTAL: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT_DENTAL: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return intUltimoValorNumseq;
|
||||
}
|
||||
|
||||
public boolean insertarTamovextDental(Object[] aValores, Connection conexion)
|
||||
{
|
||||
boolean resultado = false;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
strSql.append("INSERT INTO TAMOVEXT_DENTAL");
|
||||
strSql.append(" (MEDICO, ESPECIALIDAD, ACTO, NUMSEQ, COLECTIVO, POLIZA, ORDEN, FECHA, PRECIO, PRESCRIPTOR, ENTIDAD, TARJETA_CHIPCARD, AUTORIZACION, ESPECIALIDAD_CHIPCARD, ACTO_CHIPCARD)");
|
||||
strSql.append(" VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
|
||||
try
|
||||
{
|
||||
ParametrosConfiguracion.dataStore.insertar(strSql.toString(), aValores, conexion);
|
||||
resultado = true;
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAMOVEXT_DENTAL: " + sqle + " (" + strSql + ")");
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAMOVEXT_DENTAL: " + sqle + " (" + strSql + ")");
|
||||
}
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
/**
|
||||
* @(#) PersistenciaTamovmpo.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.Tamovmpo;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.util.Utilidades;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>Tamovmpo</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaTamovmpo
|
||||
{
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>.
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selecciona los registros de la tabla TAMOVMPO en función de la sentencia SELECT indicada.
|
||||
* @param sqlSelect La sentencia SELECT de selección.
|
||||
* @param pagina Número de página a mostrar.
|
||||
* @param aCondiciones Array que contiene los parámetros utilizados en la sentencia SELECT.
|
||||
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code>Tamovmpo</code>).
|
||||
* @throws
|
||||
*/
|
||||
public Vector seleccionar(String sqlSelect, int pagina, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
int elementosPaginacion=1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
Tamovmpo tamovmpo = null;
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect, aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
tamovmpo = new Tamovmpo();
|
||||
tamovmpo.setFecha(rs.getDate("FECHA"));
|
||||
tamovmpo.setTexto(rs.getString("TEXTO"));
|
||||
vResultado.addElement(tamovmpo);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TAMOVMPO (" + sqlSelect + ")");
|
||||
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVMPO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVMPO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVMPO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVMPO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtiene el último valor del campo 'numero' de la tabla TAMOVMPO para el médico y paciente indicado.
|
||||
* @param medico Código del médico.
|
||||
* @param colectivo Número de colectivo.
|
||||
* @param póliza Número de póliza.
|
||||
* @param beneficiario Número de beneficiario de la póliza.
|
||||
* @param fecha Fecha en la que se desea actualizar el historial del paciente.
|
||||
* @return El último valor del campo 'numero' para el médico y paciente indicado.
|
||||
* @throws
|
||||
*/
|
||||
public int obtenerUltimoNumero(int medico, long colectivo, double poliza, int beneficiario, java.sql.Date fecha) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object[] aCondiciones = new Object[5];
|
||||
int intUltimoNumero=0;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT MAX(NUMERO) AS ULTIMO_NUMERO");
|
||||
strSql.append(" FROM TAMOVMPO");
|
||||
strSql.append(" WHERE MEDICO=?");
|
||||
strSql.append(" AND COLEC=?");
|
||||
strSql.append(" AND POLIZA=?");
|
||||
strSql.append(" AND ORDEN=?");
|
||||
strSql.append(" AND FECHA=?");
|
||||
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
aCondiciones[1] = Long.valueOf(colectivo);
|
||||
aCondiciones[2] = new Double (poliza);
|
||||
aCondiciones[3] = Integer.valueOf(beneficiario);
|
||||
aCondiciones[4] = fecha;
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
if (rs.next())
|
||||
intUltimoNumero=rs.getInt("ULTIMO_NUMERO");
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "El valor del campo 'numero' obtenido de la tabla TAMOVMPO es:" + intUltimoNumero );
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVMPO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVMPO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVMPO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVMPO: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return intUltimoNumero;
|
||||
}
|
||||
|
||||
/**
|
||||
* Añade a la tabla TAMOVMPO un nuevo registro según la sentencia INSERT indicada.
|
||||
* @param sqlSelect La sentencia INSERT.
|
||||
* @param aValores Array que contiene los valores de los parámetros utilizados en la sentencia.
|
||||
* @throws
|
||||
*/
|
||||
public void insertarMovimiento(String sqlSelect, Object[] aValores) throws ExcepcionTarisan
|
||||
{
|
||||
try
|
||||
{
|
||||
ParametrosConfiguracion.dataStore.insertar(sqlSelect, aValores);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAMOVMPO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAMOVMPO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAMOVMPO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Añade a la tabla TAMOVMPO un nuevo registro según la sentencia INSERT indicada.
|
||||
* @param sqlSelect La sentencia INSERT.
|
||||
* @param aValores Array que contiene los valores de los parámetros utilizados en la sentencia.
|
||||
* @param conexion La conexión por la que se ejecuta la sentencia. Utilizado para el uso transacciones.
|
||||
* @throws
|
||||
*/
|
||||
public void insertarMovimiento(String sqlSelect, Object[] aValores, Connection conexion) throws ExcepcionTarisan
|
||||
{
|
||||
try
|
||||
{
|
||||
ParametrosConfiguracion.dataStore.insertar(sqlSelect, aValores, conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAMOVMPO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAMOVMPO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAMOVMPO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Vector listado_historia_paciente(int medico, long colectivo, double poliza, int orden, int intPagina)
|
||||
{
|
||||
Vector resul = new Vector();
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
|
||||
Object [] aCondiciones = new Object[4];
|
||||
String consulta = "";
|
||||
|
||||
strSql.append("SELECT fecha, texto");
|
||||
strSql.append(" FROM tamovmpo");
|
||||
strSql.append(" WHERE medico=?");
|
||||
strSql.append(" and colec=?");
|
||||
strSql.append(" and poliza=?");
|
||||
strSql.append(" and orden=?");
|
||||
strSql.append(" ORDER BY fecha DESC");
|
||||
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
aCondiciones[1] = Long.valueOf(colectivo);
|
||||
aCondiciones[2] = Double.valueOf(poliza);
|
||||
aCondiciones[3] = Integer.valueOf(orden);
|
||||
|
||||
|
||||
try {
|
||||
resul = this.seleccionar(strSql.toString(), intPagina, aCondiciones);
|
||||
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de Tapresca-taclient (listado_diagnostico_gpc_por_cliente): " + e + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,475 @@
|
||||
/**
|
||||
* @(#) PersistenciaTanivelEspecialidadTanivelActo.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.TanivelActo;
|
||||
import com.tarisan.data.TanivelEspecialidad;
|
||||
import com.tarisan.excepcion.*;
|
||||
import com.tarisan.log.*;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>TanivelEspecialidad</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaTanivelEspecialidadTanivelActo
|
||||
{
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber qué página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
/**
|
||||
* Selecciona los registros de la tabla TANIVEL_ESPECIALIDAD en función de la sentencia SELECT indicada.
|
||||
* @param sqlSelect La sentencia SELECT de selección.
|
||||
* @param pagina Número de página a mostrar.
|
||||
* @param aCondiciones Array que contiene los parámetros utilizados en la sentencia SELECT.
|
||||
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code>tanivelEspecialidad</code>).
|
||||
* @throws
|
||||
*/
|
||||
public Vector obtenerEspecialidades()
|
||||
{
|
||||
Vector vResultado = new Vector();
|
||||
TanivelEspecialidad tanivelEspe = null;
|
||||
String sqlSelect = "SELECT DISTINCT (ESPECIALIDAD) FROM TANIVEL_ESPECIALIDAD";
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect);
|
||||
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
|
||||
tanivelEspe = new TanivelEspecialidad();
|
||||
tanivelEspe.setEspecialidad(rs.getInt("ESPECIALIDAD"));
|
||||
vResultado.addElement(tanivelEspe);
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TANIVEL_ESPECIALIDAD (" + sqlSelect + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANIVEL_ESPECIALIDAD: " + sqle + " (" + sqlSelect + ")");
|
||||
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANIVEL_ESPECIALIDAD: " + sqle + " (" + sqlSelect + ")");
|
||||
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANIVEL_ESPECIALIDAD: " + sqle + " (" + sqlSelect + ")");
|
||||
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANIVEL_ESPECIALIDAD: " + sqle + " (" + sqlSelect + ")");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public String ObtenerDescripcion(int especialidad) {
|
||||
String resultado = "";
|
||||
String sqlSelect = "SELECT DESCRIPCION FROM TAESPECI WHERE ESPECIALIDAD=" + especialidad;
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect);
|
||||
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
resultado = rs.getString("DESCRIPCION");
|
||||
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Descripcion de especialidad("+ especialidad +"): " + resultado + " (" + sqlSelect + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAESPECI: " + sqle + " (" + sqlSelect + ")");
|
||||
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAESPECI: " + sqle + " (" + sqlSelect + ")");
|
||||
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAESPECI: " + sqle + " (" + sqlSelect + ")");
|
||||
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAESPECI: " + sqle + " (" + sqlSelect + ")");
|
||||
|
||||
|
||||
}
|
||||
|
||||
return resultado;
|
||||
|
||||
}
|
||||
|
||||
public Vector ObtenerNiveles(int especialidad) {
|
||||
return ObtenerNiveles(especialidad, 0);
|
||||
|
||||
}
|
||||
|
||||
public Vector ObtenerNiveles(int especialidad, int especialidadSolicitada) {
|
||||
Vector vResultado = new Vector();
|
||||
TanivelEspecialidad tanivelEspe = null;
|
||||
String sqlSelect = "SELECT * FROM TANIVEL_ESPECIALIDAD WHERE ESPECIALIDAD=" + especialidad;
|
||||
|
||||
if (especialidadSolicitada!=0){
|
||||
sqlSelect = "SELECT * FROM TANIVEL_ESPECIALIDAD WHERE ESPECIALIDAD=" + especialidad + "AND ESPECIALIDAD_SOLICITADA=" + especialidadSolicitada;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect);
|
||||
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
tanivelEspe = new TanivelEspecialidad();
|
||||
tanivelEspe.setEspecialidad(rs.getInt("ESPECIALIDAD"));
|
||||
tanivelEspe.setNivel(rs.getInt("NIVEL"));
|
||||
tanivelEspe.setVisibilidad(rs.getInt("VISIBILIDAD"));
|
||||
vResultado.addElement(tanivelEspe);
|
||||
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TANIVEL_ESPECIALIDAD (" + sqlSelect + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANIVEL_ESPECIALIDAD: " + sqle + " (" + sqlSelect + ")");
|
||||
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANIVEL_ESPECIALIDAD: " + sqle + " (" + sqlSelect + ")");
|
||||
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANIVEL_ESPECIALIDAD: " + sqle + " (" + sqlSelect + ")");
|
||||
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANIVEL_ESPECIALIDAD: " + sqle + " (" + sqlSelect + ")");
|
||||
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
|
||||
}
|
||||
|
||||
public boolean ActualizarVisibilidad(Vector vTanivEspe) {
|
||||
return ActualizarVisibilidad(vTanivEspe, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public boolean ActualizarVisibilidad(Vector vTanivEspe, int especialidadSolicitada) {
|
||||
boolean resultado = false;
|
||||
TanivelEspecialidad TanivEsp = null;
|
||||
Connection conexion = null;
|
||||
|
||||
try {
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
ParametrosConfiguracion.dataStore.iniciarTransaccion(conexion);
|
||||
for(int i = 0; i < vTanivEspe.size(); i++){
|
||||
if ((i!=0) && (resultado==false)){
|
||||
return resultado;
|
||||
}
|
||||
TanivEsp = (TanivelEspecialidad)vTanivEspe.elementAt(i);
|
||||
String sqlSelect = "UPDATE TANIVEL_ESPECIALIDAD SET VISIBILIDAD="+ TanivEsp.getVisibilidad() +""
|
||||
+ " WHERE ESPECIALIDAD="+ TanivEsp.getEspecialidad() + " and NIVEL="+ TanivEsp.getNivel();
|
||||
|
||||
if (especialidadSolicitada!=0){
|
||||
sqlSelect = "UPDATE TANIVEL_ESPECIALIDAD SET VISIBILIDAD="+ TanivEsp.getVisibilidad() +""
|
||||
+ " WHERE ESPECIALIDAD="+ TanivEsp.getEspecialidad() + " and NIVEL="+ TanivEsp.getNivel() + " and ESPECIALIDAD_SOLICITADA="+ especialidadSolicitada;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
if (ParametrosConfiguracion.dataStore.actualizar(sqlSelect, conexion)){
|
||||
resultado = true;
|
||||
}
|
||||
|
||||
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Visibilidad actualizada de la tabla TANIVEL_ESPECIALIDAD (" + sqlSelect + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en el update de TANIVEL_ESPECIALIDAD: " + sqle + " (" + sqlSelect + ")");
|
||||
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en el update de TANIVEL_ESPECIALIDAD: " + sqle + " (" + sqlSelect + ")");
|
||||
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en el update de TANIVEL_ESPECIALIDAD: " + sqle + " (" + sqlSelect + ")");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
if (resultado == false) {
|
||||
ParametrosConfiguracion.dataStore.deshacerTransaccion(conexion);
|
||||
}else{
|
||||
ParametrosConfiguracion.dataStore.confirmarTransaccion(conexion);
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
}
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en el update de TANIVEL_ESPECIALIDAD "+e.toString());
|
||||
}
|
||||
return resultado;
|
||||
|
||||
}
|
||||
|
||||
public String ObtenerDescripcionActo(int acto, int esp){
|
||||
String resultado = "";
|
||||
String sqlSelect = "SELECT DESCRIPCION FROM TTACTMED WHERE ACTO=" + acto + "AND ESPECIALIDAD=" + esp;
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect);
|
||||
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
resultado = rs.getString("DESCRIPCION");
|
||||
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Descripcion de especialidad("+ acto +"): " + resultado + " (" + sqlSelect + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAESPECI: " + sqle + " (" + sqlSelect + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAESPECI: " + sqle + " (" + sqlSelect + ")");
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAESPECI: " + sqle + " (" + sqlSelect + ")");
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAESPECI: " + sqle + " (" + sqlSelect + ")");
|
||||
}
|
||||
|
||||
return resultado;
|
||||
|
||||
}
|
||||
|
||||
public Vector ObtenerActos(int especialidad, int pagina) {
|
||||
return ObtenerActos(especialidad, pagina, "");
|
||||
|
||||
}
|
||||
|
||||
public Vector ObtenerActos(int especialidad, int pagina, String acto) {
|
||||
int elementosPaginacion = 1;
|
||||
Vector vResultado = new Vector();
|
||||
TanivelActo tanivelAct = null;
|
||||
String sqlSelect = "SELECT * FROM TANIVEL_ACTO WHERE ESPECIALIDAD=" + especialidad;
|
||||
|
||||
if (acto!=""){
|
||||
sqlSelect = "SELECT * FROM TANIVEL_ACTO, ttactmed WHERE TANIVEL_ACTO.ESPECIALIDAD=" + especialidad +" AND ttactmed.ACTO=TANIVEL_ACTO.ACTO AND ttactmed.DESCRIPCION LIKE '%"+ acto + "%' AND TANIVEL_ACTO.ESPECIALIDAD=ttactmed.ESPECIALIDAD";
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
tanivelAct = new TanivelActo();
|
||||
tanivelAct.setEspecialidad(rs.getInt("ESPECIALIDAD"));
|
||||
tanivelAct.setActo(rs.getInt("ACTO"));
|
||||
tanivelAct.setNivel(rs.getInt("NIVEL"));
|
||||
vResultado.addElement(tanivelAct);
|
||||
if (pagina != 0)
|
||||
{
|
||||
elementosPaginacion++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TANIVEL_ACTO (" + sqlSelect + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANIVEL_ACTO: " + sqle + " (" + sqlSelect + ")");
|
||||
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANIVEL_ACTO: " + sqle + " (" + sqlSelect + ")");
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANIVEL_ACTO: " + sqle + " (" + sqlSelect + ")");
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANIVEL_ACTO: " + sqle + " (" + sqlSelect + ")");
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
|
||||
}
|
||||
|
||||
public boolean ActualizarNivelActo(Vector vTanivelAct) {
|
||||
boolean resultado = false;
|
||||
TanivelActo TanivAct = null;
|
||||
Connection conexion = null;
|
||||
|
||||
try {
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
ParametrosConfiguracion.dataStore.iniciarTransaccion(conexion);
|
||||
for(int i = 0; i < vTanivelAct.size(); i++){
|
||||
if ((i!=0) && (resultado==false)){
|
||||
return resultado;
|
||||
}
|
||||
TanivAct = (TanivelActo)vTanivelAct.elementAt(i);
|
||||
String sqlSelect = "UPDATE TANIVEL_ACTO SET NIVEL="+ TanivAct.getNivel() +""
|
||||
+ " WHERE ESPECIALIDAD="+ TanivAct.getEspecialidad() + " and ACTO="+ TanivAct.getActo();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
if (ParametrosConfiguracion.dataStore.actualizar(sqlSelect, conexion)){
|
||||
resultado = true;
|
||||
}
|
||||
|
||||
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Visibilidad actualizada de la tabla TANIVEL_ACTO (" + sqlSelect + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en el update de TANIVEL_ACTO: " + sqle + " (" + sqlSelect + ")");
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en el update de TANIVEL_ACTO: " + sqle + " (" + sqlSelect + ")");
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en el update de TANIVEL_ACTO: " + sqle + " (" + sqlSelect + ")");
|
||||
}
|
||||
}
|
||||
if (resultado == false) {
|
||||
ParametrosConfiguracion.dataStore.deshacerTransaccion(conexion);
|
||||
}else{
|
||||
ParametrosConfiguracion.dataStore.confirmarTransaccion(conexion);
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
}
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en el update de TANIVEL_ACTO: "+e.toString());
|
||||
}
|
||||
return resultado;
|
||||
|
||||
}
|
||||
|
||||
public Vector obtenerEspecialidadesSolicitadas(int espe)
|
||||
{
|
||||
Vector vResultado = new Vector();
|
||||
TanivelEspecialidad tanivelEspe = null;
|
||||
String sqlSelect = "SELECT DISTINCT (ESPECIALIDAD_SOLICITADA) AS ESPECI FROM TANIVEL_ESPECIALIDAD WHERE ESPECIALIDAD="+ espe;
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect);
|
||||
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
|
||||
tanivelEspe = new TanivelEspecialidad();
|
||||
tanivelEspe.setEspecialidad(rs.getInt("ESPECI"));
|
||||
vResultado.addElement(tanivelEspe);
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TANIVEL_ESPECIALIDAD (" + sqlSelect + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANIVEL_ESPECIALIDAD: " + sqle + " (" + sqlSelect + ")");
|
||||
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANIVEL_ESPECIALIDAD: " + sqle + " (" + sqlSelect + ")");
|
||||
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANIVEL_ESPECIALIDAD: " + sqle + " (" + sqlSelect + ")");
|
||||
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANIVEL_ESPECIALIDAD: " + sqle + " (" + sqlSelect + ")");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
package com.tarisan.control;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.tarisan.data.Tanoticias;
|
||||
import com.tarisan.data.Tavolin;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
import com.tarisan.log.LogTarisan;
|
||||
import com.tarisan.log.NivelLog;
|
||||
import com.tarisan.util.Utilidades;
|
||||
|
||||
public class PersistenciaTanoticias {
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>.
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
public Vector seleccionar(String sqlSelect, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
Vector vResultado = new Vector();
|
||||
Tanoticias tanoticias = null;
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect, aCondiciones);
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
tanoticias = new Tanoticias();
|
||||
tanoticias.setId_noticia(rs.getInt("ID_NOTICIA"));
|
||||
tanoticias.setNoticia(rs.getString("NOTICIA"));
|
||||
tanoticias.setFecha(rs.getDate("FECHA"));
|
||||
tanoticias.setCabecera(rs.getInt("CABECERA"));
|
||||
vResultado.addElement(tanoticias);
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TANOTICIAS (" + sqlSelect + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANOTICIAS: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANOTICIAS: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANOTICIAS: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANOTICIAS: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public int obtener_ultima_noticia(int medico)
|
||||
{
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
int resultado = 0;
|
||||
|
||||
strSql.append("select max(id_noticia) as ultima from tanoticias");
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString());
|
||||
|
||||
if (rs.next())
|
||||
resultado = rs.getInt("ULTIMA");
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, medico + " - Seleccionado el valor " + resultado + " del campo id_noticia de la tabla TANOTICIAS (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de TANOTICIAS: " + sqle + " (" + strSql.toString() + ")");
|
||||
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de TANOTICIAS: " + sqle + " (" + strSql.toString() + ")");
|
||||
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de TANOTICIAS: " + sqle + " (" + strSql.toString() + ")");
|
||||
|
||||
}
|
||||
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public Vector obtener_noticia(int id_noticia)
|
||||
{
|
||||
Vector resul = new Vector();
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
|
||||
Object [] aCondiciones = new Object[1];
|
||||
String consulta = "";
|
||||
|
||||
strSql.append("select id_noticia, noticia, fecha, cabecera");
|
||||
strSql.append(" from tanoticias");
|
||||
strSql.append(" where id_noticia = ?");
|
||||
|
||||
aCondiciones[0] = Integer.valueOf(id_noticia);
|
||||
|
||||
try {
|
||||
resul = this.seleccionar(strSql.toString(), aCondiciones);
|
||||
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de Tanoticias (obtener_noticia): " + e + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
public Vector obtener_noticias(int medico, int espe, int pagina)
|
||||
{
|
||||
int elementosPaginacion=1;
|
||||
Vector vResultado = new Vector();
|
||||
Tanoticias tanoticias = null;
|
||||
String consulta = "";
|
||||
consulta="SELECT TN.ID_NOTICIA, TN.NOTICIA, TN.FECHA, TN.CABECERA FROM TANOTICIAS TN, TANOTICIA_ESPECIALIDAD TNE WHERE TN.ID_NOTICIA = TNE.NOTICIA AND TNE.ESPECIALIDAD = 0 UNION SELECT TN.ID_NOTICIA, TN.NOTICIA, TN.FECHA, TN.CABECERA FROM TANOTICIAS TN, TANOTICIA_ESPECIALIDAD TNE WHERE TN.ID_NOTICIA = TNE.NOTICIA AND TNE.MEDICO = "+ medico + " UNION SELECT TN.ID_NOTICIA, TN.NOTICIA, TN.FECHA, TN.CABECERA FROM TANOTICIAS TN, TANOTICIA_ESPECIALIDAD TNE WHERE TN.ID_NOTICIA = TNE.NOTICIA AND TNE.ESPECIALIDAD = "+ espe +" AND TNE.MEDICO IS NULL ORDER BY FECHA DESC";
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, consulta);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
tanoticias = new Tanoticias();
|
||||
tanoticias.setId_noticia(rs.getInt("ID_NOTICIA"));
|
||||
tanoticias.setNoticia(rs.getString("NOTICIA"));
|
||||
tanoticias.setFecha(rs.getDate("FECHA"));
|
||||
tanoticias.setCabecera(rs.getInt("CABECERA"));
|
||||
vResultado.addElement(tanoticias);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TANOTICIAS (" + consulta + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANOTICIAS: " + sqle + " (" + consulta + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANOTICIAS: " + sqle + " (" + consulta + ")");
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANOTICIAS: " + sqle + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
|
||||
public boolean insertarNoticiaLeida(int noticia, int medico)
|
||||
{
|
||||
boolean resultado=false;
|
||||
String consulta = "";
|
||||
|
||||
try {
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "\n Vamos ainsertar la noticia: "+noticia+", del medico: "+medico+" en la tabla TANOTICIAS_LEIDAS");
|
||||
consulta = "INSERT INTO TANOTICIAS_LEIDAS (NOTICIA,MEDICO,FECHA) VALUES (" + noticia + "," + medico + ",SYSDATE)";
|
||||
|
||||
resultado = ParametrosConfiguracion.dataStore.insertar(consulta, conexion);
|
||||
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al insertar la noticia");
|
||||
}
|
||||
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public Vector obtener_noticias_cabecera()
|
||||
{
|
||||
Vector resul = new Vector();
|
||||
|
||||
Object [] aCondiciones = new Object[0];
|
||||
String consulta = "";
|
||||
|
||||
consulta = "select id_noticia, noticia, fecha, cabecera from tanoticias where cabecera = 1";
|
||||
|
||||
try {
|
||||
resul = this.seleccionar(consulta, aCondiciones);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de Tanoticias (obtener_noticias_cabecera): " + e + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
public Vector obtener_noticias_no_leidas(int medico, int espe, int pagina)
|
||||
{
|
||||
int elementosPaginacion=1;
|
||||
Vector vResultado = new Vector();
|
||||
Tanoticias tanoticias = null;
|
||||
String consulta = "";
|
||||
consulta="SELECT TN.ID_NOTICIA, TN.NOTICIA, TN.FECHA, TN.CABECERA FROM TANOTICIAS TN, TANOTICIA_ESPECIALIDAD TNE WHERE TN.ID_NOTICIA = TNE.NOTICIA AND TNE.ESPECIALIDAD = 0 UNION SELECT TN.ID_NOTICIA, TN.NOTICIA, TN.FECHA, TN.CABECERA FROM TANOTICIAS TN, TANOTICIA_ESPECIALIDAD TNE WHERE TN.ID_NOTICIA = TNE.NOTICIA AND TNE.MEDICO = "+ medico + " UNION SELECT TN.ID_NOTICIA, TN.NOTICIA, TN.FECHA, TN.CABECERA FROM TANOTICIAS TN, TANOTICIA_ESPECIALIDAD TNE WHERE TN.ID_NOTICIA = TNE.NOTICIA AND TNE.ESPECIALIDAD = "+ espe +" AND TNE.MEDICO IS NULL MINUS SELECT TN.ID_NOTICIA, TN.NOTICIA, TN.FECHA, TN.CABECERA FROM TANOTICIAS TN, TANOTICIAS_LEIDAS TNL WHERE TN.ID_NOTICIA = TNL.NOTICIA AND TNL.MEDICO = "+ medico + " ORDER BY FECHA DESC";
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, consulta);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
tanoticias = new Tanoticias();
|
||||
tanoticias.setId_noticia(rs.getInt("ID_NOTICIA"));
|
||||
tanoticias.setNoticia(rs.getString("NOTICIA"));
|
||||
tanoticias.setFecha(rs.getDate("FECHA"));
|
||||
tanoticias.setCabecera(rs.getInt("CABECERA"));
|
||||
vResultado.addElement(tanoticias);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TANOTICIAS (" + consulta + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANOTICIAS: " + sqle + " (" + consulta + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANOTICIAS: " + sqle + " (" + consulta + ")");
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TANOTICIAS: " + sqle + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,732 @@
|
||||
/**
|
||||
* @(#) PersistenciaTapecap.java
|
||||
*/
|
||||
package com.tarisan.control;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.tarisan.data.Taclient;
|
||||
import com.tarisan.data.Tapecap;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
import com.tarisan.log.LogTarisan;
|
||||
import com.tarisan.log.NivelLog;
|
||||
import com.tarisan.util.Utilidades;
|
||||
|
||||
public class PersistenciaTapecap {
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>.
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtiene las peticiones analíticas capturadas por el medico indicado.
|
||||
* @param medico Medico de las peticiones aceptadas.
|
||||
* @return El vector <code>vResultado</code> con las peticiones analíticas capturadas.
|
||||
* @throws
|
||||
*/
|
||||
public Vector obtenerPeticionesCapturadas(int medico, String fecha, int pagina) throws ExcepcionTarisan
|
||||
{
|
||||
Vector vResultado = new Vector();
|
||||
Tapecap tapecap = null;
|
||||
//StringBuffer strSql = new StringBuffer();
|
||||
Object[] aCondiciones=null;
|
||||
int elementosPaginacion=1;
|
||||
//Calendar hoy = Calendar.getInstance();
|
||||
java.sql.Date hoy = new java.sql.Date(Calendar.getInstance().getTime().getTime());
|
||||
String consulta ="";
|
||||
|
||||
try
|
||||
{
|
||||
/*strSql.append("SELECT *");
|
||||
strSql.append(" FROM TAPECAP");
|
||||
strSql.append(" WHERE MEDICO=?");
|
||||
strSql.append(" AND FECHA=?");
|
||||
strSql.append(" ORDER BY TO_NUMBER(CODIGO) ASC");
|
||||
String sql = strSql.toString();*/
|
||||
|
||||
consulta = "SELECT * FROM TAPECAP WHERE MEDICO= ? AND FECHA= ? ORDER BY TO_NUMBER(CODIGO) ASC";
|
||||
|
||||
aCondiciones = new Object[2];
|
||||
aCondiciones[0] = medico;
|
||||
if (fecha.compareTo("")==0){
|
||||
aCondiciones[1] = (String)Utilidades.formatear_fecha(hoy);
|
||||
//sql = sql + " AND FECHA="+ (String)Utilidades.formatear_fecha(hoy) + " ORDER BY CODIGO ASC";
|
||||
}else{
|
||||
aCondiciones[1] = fecha;
|
||||
//sql = sql + " AND FECHA="+ fecha + " ORDER BY CODIGO ASC";;
|
||||
}
|
||||
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
//ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sql, aCondiciones);
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, consulta, aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
tapecap = new Tapecap();
|
||||
tapecap.setApellidos(rs.getString("APELLIDOS"));
|
||||
tapecap.setCodigo(rs.getString("CODIGO"));
|
||||
tapecap.setCompania(rs.getString("COMPaniA"));
|
||||
tapecap.setDireccion(rs.getString("DIRECCION"));
|
||||
tapecap.setFecha(rs.getDate("FECHA"));
|
||||
tapecap.setFecha_nac(rs.getDate("FECHA_NAC"));
|
||||
tapecap.setMedico(rs.getInt("MEDICO"));
|
||||
tapecap.setNif(rs.getString("NIF"));
|
||||
tapecap.setNombre(rs.getString("NOMBRE"));
|
||||
tapecap.setIdentificador(rs.getString("IDENTIFICADOR"));
|
||||
tapecap.setTelefono(rs.getString("TELEFONO"));
|
||||
tapecap.setAutorizacion(rs.getLong("AUTORIZACION"));
|
||||
tapecap.setPrescriptor(rs.getString("PRESCRIPTOR"));
|
||||
tapecap.setEspecialidad(rs.getString("ESPECIALIDAD"));
|
||||
tapecap.setPoliza(rs.getDouble("POLIZA"));
|
||||
tapecap.setOrden(rs.getInt("ORDEN"));
|
||||
tapecap.setColectivo(rs.getLong("COLECTIVO"));
|
||||
vResultado.addElement(tapecap);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado " + rs.getRow() + " registros de la tabla TAPECAP (" + consulta + ")");
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + consulta + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + consulta + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + consulta + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + consulta + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserta un nuevo registro en la tabla TAPECAP en función de la sentencia INSERT indicada.
|
||||
* @param sqlSelect La sentencia INSERT.
|
||||
* @param aValores Array que contiene los valores de los parámetros utilizados en la sentencia.
|
||||
* @param conexion La conexión por la que se ejecuta la sentencia. Utilizado para el uso transacciones.
|
||||
* @throws
|
||||
*/
|
||||
public void insertarPeticionCapturada(String sqlSelect, Object[] aValores, Connection conexion) throws ExcepcionTarisan
|
||||
{
|
||||
try
|
||||
{
|
||||
ParametrosConfiguracion.dataStore.insertar(sqlSelect, aValores, conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAPECAP: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAPECAP: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAPECAP: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public int obtenerUltimaTapecapPk() throws ExcepcionTarisan
|
||||
{
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
int pk = 0;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT MAX(TAPECAP_PK)");
|
||||
strSql.append(" FROM TAPECAP");
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString());
|
||||
|
||||
//nos posicionamos en el registro
|
||||
if (rs.next())
|
||||
//obtenemos el campo pk
|
||||
pk = rs.getInt("TAPECAP_PK");
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
pk = pk == 0 ? 1 : pk;
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado el valor " + pk + " del campo TAPECAP_PK de la tabla TAPECAP (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
|
||||
return pk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtiene el ultimo codigo de analítica capturada por medico y dia.
|
||||
* @param medico Medico de las peticiones aceptadas.
|
||||
* @return El int <code>codigo</code> de la ultima analítica capturada.
|
||||
* @throws
|
||||
*/
|
||||
public int obtenerUltimoCodigo(int medico) throws ExcepcionTarisan
|
||||
{
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
int codigo = 0;
|
||||
Object[] aCondiciones=null;
|
||||
java.sql.Date dtFecha = new java.sql.Date(Calendar.getInstance().getTime().getTime());
|
||||
String consulta = "";
|
||||
String fec="";
|
||||
|
||||
try
|
||||
{
|
||||
/*strSql.append("SELECT MAX(CODIGO) CODIGO");
|
||||
strSql.append(" FROM TAPECAP");
|
||||
strSql.append(" WHERE MEDICO = ?");
|
||||
strSql.append(" AND FECHA = ?");
|
||||
|
||||
aCondiciones = new Object[2];
|
||||
aCondiciones[0] = medico;
|
||||
|
||||
aCondiciones[1] = (String)Utilidades.formatear_fecha(dtFecha);*/
|
||||
|
||||
fec = (String)Utilidades.formatear_fecha(dtFecha);
|
||||
|
||||
consulta = "SELECT MAX(TO_NUMBER(CODIGO))+1 CODIGO FROM TAPECAP WHERE MEDICO = " + medico + " AND FECHA = TO_DATE('" + fec +"','dd/mm/yyyy')";
|
||||
|
||||
/*consulta = "SELECT CODIGO FROM TAPECAP WHERE MEDICO = " + medico + " AND FECHA = TO_DATE('" + fec +"','dd/mm/yyyy') ORDER BY CODIGO DESC";*/
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
//ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, consulta);
|
||||
|
||||
//nos posicionamos en el registro
|
||||
if (rs.next())
|
||||
codigo = rs.getInt("CODIGO");
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
codigo = codigo == 0 ? 1 : codigo;
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado el valor " + codigo + " del campo CODIGO de la tabla TAPECAP (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
|
||||
return codigo;
|
||||
}
|
||||
|
||||
public Vector obtenerDetallePaciente(long colec, double poliza, int orden) throws ExcepcionTarisan
|
||||
{
|
||||
Vector vResultado = new Vector();
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object[] aCondiciones=null;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT TTCLIENT.APELLIDO1,TTCLIENT.APELLIDO2,TTCLIENT.NOMBRE,TTCLIENT.NIF,TTCLIENT.DIRECCION,TTCLIENT.FECHA_NACIMIENTO,TTCLIENT.TELEFONO");
|
||||
strSql.append(" FROM TTCLIENT");
|
||||
strSql.append(" WHERE TTCLIENT.CLIENTE = (SELECT TTBENEFI.CLIENTE FROM TTBENEFI WHERE TTBENEFI.COLECTIVO = ? AND TTBENEFI.POLIZA = ? AND TTBENEFI.ORDEN = ?)");
|
||||
|
||||
aCondiciones = new Object[3];
|
||||
aCondiciones[0] = colec;
|
||||
aCondiciones[1] = poliza;
|
||||
aCondiciones[2] = orden;
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
String ape1 = "";
|
||||
if (rs.getString("APELLIDO1")!=null){
|
||||
ape1 = rs.getString("APELLIDO1").trim();
|
||||
}
|
||||
String ape2 = "";
|
||||
if (rs.getString("APELLIDO2")!=null){
|
||||
ape2 = rs.getString("APELLIDO2").trim();
|
||||
}
|
||||
String nom = "";
|
||||
if (rs.getString("NOMBRE")!=null){
|
||||
nom = rs.getString("NOMBRE").trim();
|
||||
}
|
||||
String nif = "";
|
||||
if (rs.getString("NIF")!=null){
|
||||
nif = rs.getString("NIF").trim();
|
||||
}
|
||||
String dir = "";
|
||||
if (rs.getString("DIRECCION")!=null){
|
||||
dir = rs.getString("DIRECCION").trim();
|
||||
}
|
||||
String fec_na = "";
|
||||
if (rs.getDate("FECHA_NACIMIENTO")!=null){
|
||||
fec_na = (String)Utilidades.formatear_fecha(rs.getDate("FECHA_NACIMIENTO")).substring(0, 10);
|
||||
}
|
||||
String tel = "";
|
||||
if (rs.getString("TELEFONO")!=null){
|
||||
tel = rs.getString("TELEFONO");
|
||||
}
|
||||
|
||||
vResultado.addElement(ape1+" "+ape2);
|
||||
vResultado.addElement(nom);
|
||||
vResultado.addElement(nif);
|
||||
vResultado.addElement(dir);
|
||||
vResultado.addElement(fec_na);
|
||||
vResultado.addElement(tel);
|
||||
}
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado " + rs.getRow() + " registros de la tabla TTCLIENT (" + strSql.toString() + ")");
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTCLIENT: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTCLIENT: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTCLIENT: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTCLIENT: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public Vector imprimirPeticionesCapturadas(int medico, String fecha, int pagina) throws ExcepcionTarisan
|
||||
{
|
||||
Vector vResultado = new Vector();
|
||||
Tapecap tapecap = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object[] aCondiciones=null;
|
||||
//Calendar hoy = Calendar.getInstance();
|
||||
java.sql.Date hoy = new java.sql.Date(Calendar.getInstance().getTime().getTime());
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT *");
|
||||
strSql.append(" FROM TAPECAP");
|
||||
strSql.append(" WHERE MEDICO=?");
|
||||
strSql.append(" AND FECHA=?");
|
||||
strSql.append(" ORDER BY TO_NUMBER(CODIGO) ASC");
|
||||
|
||||
aCondiciones = new Object[2];
|
||||
aCondiciones[0] = medico;
|
||||
if (fecha.compareTo("")==0){
|
||||
aCondiciones[1] = (String)Utilidades.formatear_fecha(hoy);
|
||||
}else{
|
||||
aCondiciones[1] = fecha;
|
||||
}
|
||||
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
tapecap = new Tapecap();
|
||||
tapecap.setApellidos(rs.getString("APELLIDOS"));
|
||||
tapecap.setCodigo(rs.getString("CODIGO"));
|
||||
tapecap.setCompania(rs.getString("COMPaniA"));
|
||||
tapecap.setDireccion(rs.getString("DIRECCION"));
|
||||
tapecap.setFecha(rs.getDate("FECHA"));
|
||||
tapecap.setFecha_nac(rs.getDate("FECHA_NAC"));
|
||||
tapecap.setMedico(rs.getInt("MEDICO"));
|
||||
tapecap.setNif(rs.getString("NIF"));
|
||||
tapecap.setNombre(rs.getString("NOMBRE"));
|
||||
tapecap.setIdentificador(rs.getString("IDENTIFICADOR"));
|
||||
tapecap.setTelefono(rs.getString("TELEFONO"));
|
||||
tapecap.setAutorizacion(rs.getLong("AUTORIZACION"));
|
||||
tapecap.setPrescriptor(rs.getString("PRESCRIPTOR"));
|
||||
tapecap.setEspecialidad(rs.getString("ESPECIALIDAD"));
|
||||
tapecap.setPoliza(rs.getDouble("POLIZA"));
|
||||
tapecap.setOrden(rs.getInt("ORDEN"));
|
||||
tapecap.setColectivo(rs.getLong("COLECTIVO"));
|
||||
vResultado.addElement(tapecap);
|
||||
}
|
||||
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado " + rs.getRow() + " registros de la tabla TAPECAP (" + strSql.toString() + ")");
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public Vector buscarPaciente(String troquelado, int pagina) throws ExcepcionTarisan
|
||||
{
|
||||
Vector vResultado = new Vector();
|
||||
Tapecap tapecap = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object[] aCondiciones=null;
|
||||
int elementosPaginacion=1;
|
||||
java.sql.Date hoy = new java.sql.Date(Calendar.getInstance().getTime().getTime());
|
||||
|
||||
try
|
||||
{
|
||||
/*strSql.append("SELECT NOMBRE, TRIM (apellido1) || ' ' || TRIM (apellido2) AS APELLIDOS,");
|
||||
strSql.append(" TRIM (direccion) || ', ' || TRIM (poblacion) || ', ' || cp AS DIRECCION,");
|
||||
strSql.append(" fecha_nacimiento as FECHA_NAC, TELEFONO, NIF, IDENTIFICADOR,");
|
||||
strSql.append(" CASE entidad");
|
||||
strSql.append(" WHEN 1 THEN 'IMQ'");
|
||||
strSql.append(" WHEN 3 THEN 'ADESLAS DESPLAZADO'");
|
||||
strSql.append(" WHEN 4 THEN 'ASISA DESPLAZADO'");
|
||||
strSql.append(" WHEN 5 THEN 'SANITAS DESPLAZADO'");
|
||||
strSql.append(" WHEN 7 THEN 'IMQ-BILBO DESPLAZADO'");
|
||||
strSql.append(" WHEN 32 THEN 'DKV DESPLAZADO'");
|
||||
strSql.append(" WHEN 60 THEN 'HNA DESPLAZADO'");
|
||||
strSql.append(" END as COMPANIA");
|
||||
strSql.append(" FROM ttclient, ttbenefi");
|
||||
strSql.append(" WHERE TTBENEFI.IDENTIFICADOR LIKE '%"+ troquelado +"%'");
|
||||
strSql.append(" AND ttbenefi.cliente = ttclient.cliente");*/
|
||||
|
||||
strSql.append("SELECT DISTINCT(IDENTIFICADOR), NOMBRE, APELLIDOS, DIRECCION, FECHA_NAC,");
|
||||
strSql.append(" TELEFONO, NIF, COMPANIA FROM");
|
||||
strSql.append(" (SELECT NOMBRE, TRIM (apellido1) || ' ' || TRIM (apellido2) AS APELLIDOS,");
|
||||
strSql.append(" TRIM (direccion) || ', ' || TRIM (poblacion) || ', ' || cp AS DIRECCION,");
|
||||
strSql.append(" fecha_nacimiento as FECHA_NAC, TELEFONO, NIF, IDENTIFICADOR,");
|
||||
strSql.append(" CASE entidad");
|
||||
strSql.append(" WHEN 1 THEN 'IMQ'");
|
||||
strSql.append(" WHEN 3 THEN 'ADESLAS DESPLAZADO'");
|
||||
strSql.append(" WHEN 4 THEN 'ASISA DESPLAZADO'");
|
||||
strSql.append(" WHEN 5 THEN 'SANITAS DESPLAZADO'");
|
||||
strSql.append(" WHEN 7 THEN 'IMQ-BILBO DESPLAZADO'");
|
||||
strSql.append(" WHEN 32 THEN 'DKV DESPLAZADO'");
|
||||
strSql.append(" WHEN 60 THEN 'HNA DESPLAZADO'");
|
||||
strSql.append(" END as COMPANIA");
|
||||
strSql.append(" FROM ttclient, ttbenefi");
|
||||
strSql.append(" WHERE TTBENEFI.IDENTIFICADOR LIKE '%"+ troquelado +"%'");
|
||||
strSql.append(" AND ttbenefi.cliente = ttclient.cliente");
|
||||
strSql.append(" UNION");
|
||||
strSql.append(" SELECT NOMBRE, APELLIDOS, DIRECCION, FECHA_NAC,");
|
||||
strSql.append(" TELEFONO, NIF, IDENTIFICADOR, COMPaniA AS COMPANIA");
|
||||
strSql.append(" FROM TAPECAP");
|
||||
strSql.append(" WHERE IDENTIFICADOR LIKE '%"+ troquelado +"%')");
|
||||
strSql.append(" ORDER BY APELLIDOS ASC");
|
||||
|
||||
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0] = troquelado;
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString()/*, aCondiciones*/);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
|
||||
String ape = "";
|
||||
if (rs.getString("APELLIDOS")!=null){
|
||||
ape = rs.getString("APELLIDOS");
|
||||
ape = ape.trim();
|
||||
}
|
||||
String compa = "";
|
||||
if (rs.getString("COMPANIA")!=null){
|
||||
compa = rs.getString("COMPANIA");
|
||||
compa = compa.trim();
|
||||
}
|
||||
String dir = "";
|
||||
if (rs.getString("DIRECCION")!=null){
|
||||
dir = rs.getString("DIRECCION");
|
||||
dir = dir.trim();
|
||||
}
|
||||
String nif = "";
|
||||
if (rs.getString("NIF")!=null){
|
||||
nif = rs.getString("NIF");
|
||||
nif = nif.trim();
|
||||
}
|
||||
String nom = "";
|
||||
if (rs.getString("NOMBRE")!=null){
|
||||
nom = rs.getString("NOMBRE");
|
||||
nom = nom.trim();
|
||||
}
|
||||
String iden = "";
|
||||
if (rs.getString("IDENTIFICADOR")!=null){
|
||||
iden = rs.getString("IDENTIFICADOR");
|
||||
iden = iden.trim();
|
||||
}
|
||||
String tel = "";
|
||||
if (rs.getString("TELEFONO")!=null){
|
||||
tel = rs.getString("TELEFONO");
|
||||
tel = tel.trim();
|
||||
}
|
||||
|
||||
|
||||
|
||||
tapecap = new Tapecap();
|
||||
tapecap.setApellidos(ape);
|
||||
/*tapecap.setCodigo(rs.getInt("CODIGO"));*/
|
||||
tapecap.setCompania(compa);
|
||||
tapecap.setDireccion(dir);
|
||||
/*tapecap.setFecha(rs.getDate("FECHA"));*/
|
||||
tapecap.setFecha_nac(rs.getDate("FECHA_NAC"));
|
||||
/*tapecap.setMedico(rs.getInt("MEDICO"));*/
|
||||
tapecap.setNif(nif);
|
||||
tapecap.setNombre(nom);
|
||||
tapecap.setIdentificador(iden);
|
||||
tapecap.setTelefono(tel);
|
||||
/*tapecap.setAutorizacion(rs.getLong("AUTORIZACION"));
|
||||
tapecap.setPrescriptor(rs.getString("PRESCRIPTOR"));
|
||||
tapecap.setEspecialidad(rs.getString("ESPECIALIDAD"));
|
||||
tapecap.setPoliza(rs.getDouble("POLIZA"));
|
||||
tapecap.setOrden(rs.getInt("ORDEN"));
|
||||
tapecap.setColectivo(rs.getLong("COLECTIVO"));*/
|
||||
vResultado.addElement(tapecap);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado " + rs.getRow() + " registros de la tabla TAPECAP (" + strSql.toString() + ")");
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtiene el ultimo codigo de analítica capturada por medico y dia si es de un paciente con más de una autorización.
|
||||
* @param medico Medico de las peticiones aceptadas.
|
||||
* @return El int <code>codigo</code> de la ultima analítica capturada.
|
||||
* @throws
|
||||
*/
|
||||
public String obtenerUltimoCodigoMismoPaciente(int medico, String identificador) throws ExcepcionTarisan
|
||||
{
|
||||
String codigo = "";
|
||||
java.sql.Date dtFecha = new java.sql.Date(Calendar.getInstance().getTime().getTime());
|
||||
String consulta = "";
|
||||
String fec="";
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
fec = (String)Utilidades.formatear_fecha(dtFecha);
|
||||
|
||||
/*consulta = "SELECT MAX(CODIGO) CODIGO FROM TAPECAP WHERE MEDICO = " + medico + " AND FECHA = TO_DATE('" + fec +"','dd/mm/yyyy') AND IDENTIFICADOR = "+ identificador ;*/
|
||||
|
||||
consulta = "SELECT CODIGO FROM TAPECAP WHERE MEDICO = " + medico + " AND FECHA = TO_DATE('" + fec +"','dd/mm/yyyy') AND IDENTIFICADOR = "+ identificador + " ORDER BY CODIGO DESC";
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, consulta);
|
||||
|
||||
//nos posicionamos en el registro
|
||||
if (rs.next())
|
||||
codigo = rs.getString("CODIGO");
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
//codigo = codigo == 0 ? 1 : codigo;
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado el valor " + codigo + " del campo CODIGO de la tabla TAPECAP (" + consulta + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + consulta + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + consulta + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + consulta + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + consulta + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
|
||||
return codigo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Comprueba si existe el paciente con otra analítica capturada por el mismo medico el mismo dia.
|
||||
* @param medico Medico de las peticiones aceptadas.
|
||||
* @return El int <code>codigo</code> de la ultima analítica capturada.
|
||||
* @throws
|
||||
*/
|
||||
public boolean existePaciente(int medico, String embosado) throws ExcepcionTarisan
|
||||
{
|
||||
boolean existe = false;;
|
||||
java.sql.Date dtFecha = new java.sql.Date(Calendar.getInstance().getTime().getTime());
|
||||
String consulta = "";
|
||||
String fec="";
|
||||
if (embosado.compareTo("")==0 ){
|
||||
embosado="0";
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
fec = (String)Utilidades.formatear_fecha(dtFecha);
|
||||
|
||||
consulta = "SELECT CODIGO FROM TAPECAP WHERE MEDICO = " + medico + " AND FECHA = TO_DATE('" + fec +"','dd/mm/yyyy') AND IDENTIFICADOR = "+ embosado ;
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, consulta);
|
||||
|
||||
//nos posicionamos en el registro
|
||||
if (rs.next())
|
||||
existe = true;
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Resultado " + existe + " de comprobar si existe el paciente en TAPECAP (" + consulta + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + consulta + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + consulta + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + consulta + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPECAP: " + sqle + " (" + consulta + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
|
||||
return existe;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,358 @@
|
||||
/**
|
||||
* @(#) PersistenciaTapolfac.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.Tapolfac;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.util.Utilidades;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>Tapolfac</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaTapolfac
|
||||
{
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>.
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selecciona los registros de la tabla TAPOLFAC en función de la sentencia SELECT indicada.
|
||||
* @param sqlSelect La sentencia SELECT de selección.
|
||||
* @param pagina Número de página a mostrar.
|
||||
* @param aCondiciones Array que contiene los parámetros utilizados en la sentencia SELECT.
|
||||
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code>Tapolfac</code>).
|
||||
* @throws
|
||||
*/
|
||||
public Vector seleccionar(String sqlSelect, int pagina, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
int elementosPaginacion=1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
Tapolfac tapolfac = null;
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect, aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
tapolfac = new Tapolfac();
|
||||
tapolfac.setTitular(rs.getString("TITULAR"));
|
||||
tapolfac.setColec(rs.getInt("COLEC"));
|
||||
tapolfac.setPoliza(rs.getDouble("POLIZA"));
|
||||
tapolfac.setBeneficiarios(rs.getInt("BENEFICIARIOS"));
|
||||
vResultado.addElement(tapolfac);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TAPOLFAC (" + sqlSelect + ")");
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPOLFAC: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPOLFAC: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPOLFAC: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPOLFAC: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
|
||||
public int obtenerNumerPolizasMedicos(int medico)
|
||||
{
|
||||
int resul = 0;
|
||||
String strSql = "";
|
||||
try
|
||||
{
|
||||
strSql = "Select count(*) from tapolfac where medico = " + medico +" group by colec, poliza";
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql);
|
||||
if(rs.next())
|
||||
{
|
||||
rs.last();
|
||||
resul = rs.getRow();
|
||||
}
|
||||
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección obtenerNumerPolizasMedicos: " + sqle + " (" + strSql + ")");
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección obtenerNumerPolizasMedicos: " + e + " (" + strSql + ")");
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtiene el número total de beneficiarios del total de pólizas de la tabla TAPOLFAC dependiendo del médico que este conectado.
|
||||
* @param medico El código del médico conectado a la aplicación.
|
||||
* @return El número total de beneficiarios del total de pólizas pertenecientes al médico conectado.
|
||||
* @throws
|
||||
*/
|
||||
public int obtenerNumTotalBeneficiarios(int medico) throws ExcepcionTarisan
|
||||
{
|
||||
String strSql="";
|
||||
int intTotalBeneficiarios=0;
|
||||
|
||||
try
|
||||
{
|
||||
strSql = "select count(*) as totalBeneficiarios from tapolfac where medico=" + medico;
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql);
|
||||
|
||||
if (rs.next())
|
||||
intTotalBeneficiarios = rs.getInt("totalBeneficiarios");
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Total beneficiarios " + intTotalBeneficiarios + " de la tabla TAPOLFAC (" + strSql + ")");
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección obtenerNumTotalBeneficiarios: " + sqle + " (" + strSql + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección obtenerNumTotalBeneficiarios: " + sqle + " (" + strSql + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección obtenerNumTotalBeneficiarios: " + sqle + " (" + strSql + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección obtenerNumTotalBeneficiarios: " + sqle + " (" + strSql + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return intTotalBeneficiarios;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Indica si la póliza es una de las igualas de un determinado médico.
|
||||
* @param medico El código del médico.
|
||||
* @param colectivo El código del colectivo.
|
||||
* @param poliza El código de la póliza.
|
||||
* @return Valor entero que indica si la póliza es una de las igualas del médico (1), es iguala de otro médico (2) o no es
|
||||
* iguala (0)
|
||||
* @throws
|
||||
*
|
||||
*/
|
||||
public Integer esPolizaIgualaMedico(int medico, long colectivo, double poliza) throws ExcepcionTarisan
|
||||
{
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
Integer blnEsPolizaIgualaMedico = 0;
|
||||
Integer blnEsMutualista = 0;
|
||||
/*
|
||||
* Manda el Dr. Indave una incidencia:
|
||||
* https://incidencias.imqnavarra.com/soporte/scp/tickets.php?id=52142
|
||||
* para que los mutualistas puedan ir al médico de cabecera que quieran
|
||||
* pero solo los mutualistas, no los directos.
|
||||
*/
|
||||
|
||||
strSql.append("Select count(*) from TTCOLECT where ");
|
||||
strSql.append("COLECTIVO=? and ");
|
||||
strSql.append("contrato in (711, 712,713)");
|
||||
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0]=Long.valueOf(colectivo);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
try{
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Vamos a comprobar si es mutualista");
|
||||
if(rs.next())
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Es mutualista ");
|
||||
blnEsMutualista = 1;
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
aCondiciones=null;
|
||||
}
|
||||
else{
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "No es mutualista, seguimos comprobando");
|
||||
aCondiciones=null;
|
||||
}
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPOLFAC: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
strSql = new StringBuffer();
|
||||
strSql.append("SELECT *");
|
||||
strSql.append(" FROM tapolfac");
|
||||
//strSql.append(" WHERE medico=?");
|
||||
//strSql.append(" AND colec=?");
|
||||
strSql.append(" where colec=?");
|
||||
strSql.append(" AND poliza=?");
|
||||
//strSql.append(" and medico != 0");
|
||||
|
||||
/*
|
||||
* El médico 0 es el sns, si ponemos la excepcion consideramos que los que tienen SNS pueden ir a los medicos de cabecera del cuadro.
|
||||
* Si la quitamos, los que van a SNS no pueden ir a los médicos del cuadro.
|
||||
*
|
||||
*/
|
||||
|
||||
aCondiciones = new Object[2];
|
||||
/*aCondiciones[0]=Integer.valueOf(medico);
|
||||
aCondiciones[1]=Integer.valueOf(colectivo);
|
||||
aCondiciones[2]=Double.valueOf(poliza);*/
|
||||
aCondiciones[0]=Long.valueOf(colectivo);
|
||||
aCondiciones[1]=Double.valueOf(poliza);
|
||||
|
||||
/*
|
||||
* No necesitamos volver a definir las variables, ya que las hemos definido arriba para comprobar si es mutualista.
|
||||
*/
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
//nos posicionamos en el registro
|
||||
if (rs.next()){
|
||||
int sql_medico = rs.getInt("medico");
|
||||
if(sql_medico == medico){
|
||||
//la poliza se trata de una iguala del medico
|
||||
blnEsPolizaIgualaMedico = 1;
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "La poliza es una de las igualas del medico " + blnEsPolizaIgualaMedico + " (" + strSql.toString() + ")");
|
||||
}
|
||||
else{
|
||||
//la poliza es iguala de otro médico
|
||||
if(blnEsMutualista == 1){
|
||||
//Los mutualistas pueden ir a cualquier médico de cabecera.
|
||||
blnEsPolizaIgualaMedico = 0;
|
||||
}
|
||||
else{
|
||||
blnEsPolizaIgualaMedico = 2;
|
||||
}
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "La poliza es una de las igualas pero de otro medico " + blnEsPolizaIgualaMedico + " (" + strSql.toString() + ")");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPOLFAC: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPOLFAC: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPOLFAC: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPOLFAC: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
|
||||
return blnEsPolizaIgualaMedico;
|
||||
}
|
||||
|
||||
public Vector listado_igualados(String igualado, int medico, int intPagina)
|
||||
{
|
||||
Vector resul = new Vector();
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
|
||||
Object [] aCondiciones = new Object[1];
|
||||
String consulta = "";
|
||||
|
||||
if(igualado.length()==0)
|
||||
{
|
||||
strSql.append("SELECT TITULAR, COLEC, POLIZA, BENEFICIARIOS");
|
||||
strSql.append(" FROM TAPOLFAC");
|
||||
strSql.append(" WHERE MEDICO=?");
|
||||
strSql.append(" ORDER BY TITULAR");
|
||||
}
|
||||
else
|
||||
{
|
||||
strSql.append("SELECT TITULAR, COLEC, POLIZA, BENEFICIARIOS");
|
||||
strSql.append(" FROM TAPOLFAC");
|
||||
strSql.append(" WHERE MEDICO=?");
|
||||
strSql.append(" AND TITULAR LIKE '%"+igualado+"%'");
|
||||
strSql.append(" ORDER BY TITULAR");
|
||||
|
||||
}
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
|
||||
try {
|
||||
resul = this.seleccionar(strSql.toString(), intPagina, aCondiciones);
|
||||
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de Tapolfac (listado_igualados): " + e + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,531 @@
|
||||
/**
|
||||
* @(#) Persistenciatapresca_tarisan.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.Paciente;
|
||||
import com.tarisan.data.Taconaut;
|
||||
import com.tarisan.data.Tapresca;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.util.DES;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>tapresca_tarisan</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaTapresca
|
||||
{
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>.
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtiene los actos médicos pertenecientes a la prescripción realizada al paciente.
|
||||
* @param autorizacion Autorización de la prescripción.
|
||||
* @param colectivo Número de colectivo.
|
||||
* @param poliza Número de póliza.
|
||||
* @param beneficiario Número de beneficiario.
|
||||
* @param pagina Número de página a mostrar.
|
||||
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code>tapresca_tarisan</code>).
|
||||
* @throws
|
||||
*/
|
||||
public Vector obtenerActosPrescripcionAnalisis(long autorizacion, long colectivo, double poliza, int beneficiario, int pagina) throws ExcepcionTarisan
|
||||
{
|
||||
int elementosPaginacion=1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
Tapresca tapresca_tarisan = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT tapresca_tarisan.ACTO");
|
||||
strSql.append(" FROM tapresca_tarisan");
|
||||
strSql.append(" WHERE tapresca_tarisan.AUTORIZACION=?");
|
||||
strSql.append(" AND tapresca_tarisan.COLEC=?");
|
||||
strSql.append(" AND tapresca_tarisan.POLIZA=?");
|
||||
strSql.append(" AND tapresca_tarisan.ORDEN=?");
|
||||
|
||||
aCondiciones = new Object[4];
|
||||
aCondiciones[0] = Long.valueOf(autorizacion);
|
||||
aCondiciones[1] = Long.valueOf(colectivo);
|
||||
aCondiciones[2] = Double.valueOf(poliza);
|
||||
aCondiciones[3] = Integer.valueOf(beneficiario);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
tapresca_tarisan = new Tapresca();
|
||||
tapresca_tarisan.setActo(rs.getInt("ACTO"));
|
||||
vResultado.addElement(tapresca_tarisan);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla tapresca_tarisan (" + strSql.toString() + ")");
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inserta un nuevo registro en la tabla tapresca_tarisan en función de la sentencia INSERT indicada.
|
||||
* @param sqlSelect La sentencia INSERT.
|
||||
* @param aValores Array que contiene los valores de los parámetros utilizados en la sentencia.
|
||||
* @throws
|
||||
*/
|
||||
public boolean insertarPrescripcion(String sqlSelect, Object[] aValores) throws ExcepcionTarisan
|
||||
{
|
||||
boolean resultado = false;
|
||||
try
|
||||
{
|
||||
resultado = ParametrosConfiguracion.dataStore.insertar(sqlSelect, aValores);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de tapresca_tarisan: " + sqle + " (" + sqlSelect + ")");
|
||||
return resultado;
|
||||
//throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de tapresca_tarisan: " + sqle + " (" + sqlSelect + ")");
|
||||
return resultado;
|
||||
//throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de tapresca_tarisan: " + sqle + " (" + sqlSelect + ")");
|
||||
return resultado;
|
||||
//throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
return resultado;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserta un nuevo registro en la tabla tapresca_tarisan en función de la sentencia INSERT indicada.
|
||||
* @param sqlSelect La sentencia INSERT.
|
||||
* @param aValores Array que contiene los valores de los parámetros utilizados en la sentencia.
|
||||
* @param conexion La conexión por la que se ejecuta la sentencia. Utilizado para el uso transacciones.
|
||||
* @throws
|
||||
*/
|
||||
public boolean insertarPrescripcion(String sqlSelect, Object[] aValores, Connection conexion) throws ExcepcionTarisan
|
||||
{
|
||||
boolean resultado = false;
|
||||
try
|
||||
{
|
||||
resultado = ParametrosConfiguracion.dataStore.insertar(sqlSelect, aValores, conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de tapresca_tarisan: " + sqle + " (" + sqlSelect + ")");
|
||||
return resultado;
|
||||
//throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de tapresca_tarisan: " + sqle + " (" + sqlSelect + ")");
|
||||
return resultado;
|
||||
//throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de tapresca_tarisan: " + sqle + " (" + sqlSelect + ")");
|
||||
return resultado;
|
||||
//throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public boolean modificarPrescripcion(String sqlSelect, Object[] aValores, Object[] aCondiciones, Connection conexion) throws ExcepcionTarisan
|
||||
{
|
||||
boolean resultado = false;
|
||||
try
|
||||
{
|
||||
resultado = ParametrosConfiguracion.dataStore.actualizar(sqlSelect, aValores, aCondiciones, conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de tapresca_tarisan: " + sqle + " (" + sqlSelect + ")");
|
||||
return resultado;
|
||||
//throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de tapresca_tarisan: " + sqle + " (" + sqlSelect + ")");
|
||||
return resultado;
|
||||
//throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de tapresca_tarisan: " + sqle + " (" + sqlSelect + ")");
|
||||
return resultado;
|
||||
//throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public boolean eliminarPrescripcion(String sqlSelect, Object[] aCondiciones, Connection conexion) throws ExcepcionTarisan
|
||||
{
|
||||
boolean resultado = false;
|
||||
try
|
||||
{
|
||||
resultado = ParametrosConfiguracion.dataStore.borrar(sqlSelect, aCondiciones, conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la eliminación de tapresca_tarisan: " + sqle + " (" + sqlSelect + ")");
|
||||
return resultado;
|
||||
//throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la eliminación de tapresca_tarisan: " + sqle + " (" + sqlSelect + ")");
|
||||
return resultado;
|
||||
//throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la eliminación de tapresca_tarisan: " + sqle + " (" + sqlSelect + ")");
|
||||
return resultado;
|
||||
//throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public Vector obtenerPeticiones(int medico, int colectivo, long poliza, int orden, int pagina) throws ExcepcionTarisan
|
||||
{
|
||||
int elementosPaginacion=1;
|
||||
Vector autorizaciones = new Vector();
|
||||
String sqlSelect = new String();
|
||||
PersistenciaTabenefi per = new PersistenciaTabenefi();
|
||||
String tarjeta = "";
|
||||
String tarjetaChipcard = "";
|
||||
|
||||
tarjeta = per.obtenerTarjeta(colectivo, poliza, orden);
|
||||
tarjetaChipcard = per.obtenerTarjetaChipcard(colectivo, poliza, orden);
|
||||
|
||||
try
|
||||
{
|
||||
//sqlSelect = "select distinct(autorizacion) from tapresca_tarisan where prescriptor = "+ strMedico + " and colec = "+ colectivo + " and poliza = "+ poliza + " and orden = "+ orden;
|
||||
if ((tarjeta.compareTo("")!=0)&&(tarjeta.compareTo("0")!=0)){
|
||||
if (medico==0){
|
||||
sqlSelect = "select distinct(autorizacion) from tapresca_tarisan where tarjeta = "+ tarjeta;
|
||||
}else{
|
||||
sqlSelect = "select distinct(autorizacion) from tapresca_tarisan where prescriptor = "+ medico + " and tarjeta = "+ tarjeta;
|
||||
}
|
||||
}else{
|
||||
if (medico==0){
|
||||
sqlSelect = "select distinct(autorizacion) from tapresca_tarisan where tarjeta = "+ tarjetaChipcard;
|
||||
}else{
|
||||
sqlSelect = "select distinct(autorizacion) from tapresca_tarisan where prescriptor = "+ medico + " and tarjeta = "+ tarjetaChipcard;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString());
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
int autorizacion = rs.getInt("AUTORIZACION");
|
||||
autorizaciones.addElement(autorizacion);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
}
|
||||
catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de la peticion del paciente: " + e.toString() + " (" + sqlSelect + ")");
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de la peticion del paciente: " + e.toString() + " (" + sqlSelect + ")");
|
||||
}
|
||||
return autorizaciones;
|
||||
}
|
||||
|
||||
public boolean existePeticion(long autorizacion)
|
||||
{
|
||||
boolean resultado= false;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT *");
|
||||
strSql.append(" FROM tapresca_tarisan");
|
||||
strSql.append(" WHERE tapresca_tarisan.AUTORIZACION=?");
|
||||
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0] = Long.valueOf(autorizacion);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
if(rs.next())
|
||||
{
|
||||
resultado = true;
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionada la petición analítica " + autorizacion + " de la tabla tapresca_tarisan (" + strSql.toString() + ")");
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
}
|
||||
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public Vector listado_peticiones_por_paciente(int medico, Paciente pac, int intPagina, int tipo_peticion) throws SQLException
|
||||
{
|
||||
int elementosPaginacion=1;
|
||||
Vector resul = new Vector();
|
||||
Tapresca tapresca = null;
|
||||
String consulta = "";
|
||||
String tarDespla = "";
|
||||
String tarjeta = "";
|
||||
String strMedico = ""+medico;
|
||||
|
||||
if(pac.getDesplazado() == null)
|
||||
pac.setDesplazado(pac.getTarjeta().getEntidadChipcard());
|
||||
|
||||
tarjeta=(Integer.valueOf( pac.getTarjeta().getTarjeta())).toString();
|
||||
tarDespla=new String( pac.getTarjeta().getTarjetaDesplazado());
|
||||
|
||||
if (tarjeta != null & tarjeta.compareTo("")!=0){
|
||||
if (tarDespla != null & tarDespla.compareTo("")!=0){
|
||||
|
||||
consulta = "SELECT DISTINCT(AUTORIZACION), ESPECIALIDAD, FECHA, TEXTO FROM TAPRESCA_TARISAN WHERE (TARJETA = '" + tarjeta +"' OR TARJETA = '" + tarDespla +"') AND PRESCRIPTOR = '" + medico +"' AND TIPO_PETICION = '" + tipo_peticion +"' ORDER BY AUTORIZACION DESC";
|
||||
}else{
|
||||
consulta = "SELECT AUTORIZACION, ESPECIALIDAD, FECHA, TEXTO FROM TAPRESCA_TARISAN WHERE TARJETA = '" + tarjeta +"' AND PRESCRIPTOR = '" + medico +"' AND TIPO_PETICION = '" + tipo_peticion +"' ORDER BY AUTORIZACION DESC";
|
||||
}
|
||||
}else{
|
||||
consulta = "SELECT AUTORIZACION, ESPECIALIDAD, FECHA, TEXTO FROM TAPRESCA_TARISAN WHERE TARJETA = '" + tarDespla +"' AND PRESCRIPTOR = '" + medico +"' AND TIPO_PETICION = '" + tipo_peticion +"' ORDER BY AUTORIZACION DESC";
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, consulta);
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, intPagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
DES encrypter = new DES(strMedico);
|
||||
String auto = rs.getString("AUTORIZACION");
|
||||
/*auto = (auto.length()<8)?"0"+auto:auto;*/
|
||||
String autoEncriptada = encrypter.encrypt(auto);
|
||||
|
||||
tapresca = new Tapresca();
|
||||
tapresca.setTexto(rs.getString("TEXTO"));
|
||||
tapresca.setFecha(rs.getDate("FECHA"));
|
||||
tapresca.setAutorizacion(rs.getLong("AUTORIZACION"));
|
||||
tapresca.setAutorizacionEncriptada(autoEncriptada);
|
||||
tapresca.setEspecialidad(rs.getInt("ESPECIALIDAD"));
|
||||
resul.addElement(tapresca);
|
||||
if (intPagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + resul.size() + " registros de tapresca_tarisan (" + consulta + ")");
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de Tapresca_tarisan (listado_peticiones_por_paciente): " + e + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
public Vector obtenerEspecialidadOtrasPeticiones(long autorizacion) throws ExcepcionTarisan
|
||||
{
|
||||
int elementosPaginacion=1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
Tapresca tapresca_tarisan = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT tapresca_tarisan.ESPECIALIDAD,tapresca_tarisan.TEXTO");
|
||||
strSql.append(" FROM tapresca_tarisan");
|
||||
strSql.append(" WHERE tapresca_tarisan.AUTORIZACION=?");
|
||||
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0] = Long.valueOf(autorizacion);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
tapresca_tarisan = new Tapresca();
|
||||
tapresca_tarisan.setEspecialidad(rs.getInt("ESPECIALIDAD"));
|
||||
tapresca_tarisan.setTexto(rs.getString("TEXTO"));
|
||||
vResultado.addElement(tapresca_tarisan);
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla tapresca_tarisan (" + strSql.toString() + ")");
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public Vector obtenerDatosAutorizacion(long autorizacion) throws ExcepcionTarisan
|
||||
{
|
||||
int elementosPaginacion=1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
Tapresca tapresca_tarisan = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT tapresca_tarisan.ACTO,tapresca_tarisan.ESPECIALIDAD,tapresca_tarisan.TEXTO");
|
||||
strSql.append(" FROM tapresca_tarisan");
|
||||
strSql.append(" WHERE tapresca_tarisan.AUTORIZACION=?");
|
||||
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0] = Long.valueOf(autorizacion);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
tapresca_tarisan = new Tapresca();
|
||||
tapresca_tarisan.setActo(rs.getInt("ACTO"));
|
||||
tapresca_tarisan.setEspecialidad(rs.getInt("ESPECIALIDAD"));
|
||||
tapresca_tarisan.setTexto(rs.getString("TEXTO"));
|
||||
vResultado.addElement(tapresca_tarisan);
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla tapresca_tarisan (" + strSql.toString() + ")");
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,588 @@
|
||||
/**
|
||||
* @(#) PersistenciaTaprimer.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.data.Usuario;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
import java.sql.*;
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>Taprimer</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaTaprimer
|
||||
{
|
||||
|
||||
/**
|
||||
* Obtiene si se trata de la primera visita del paciente.
|
||||
* @param medico Código del médico.
|
||||
* @param colectivo Número de colectivo.
|
||||
* @param poliza Número de póliza.
|
||||
* @param beneficiario Número de beneficiario.
|
||||
* @return Valor booleano que nos indica si se trata de la primera visita del paciente.
|
||||
* @throws
|
||||
*/
|
||||
public boolean esPrimeraVisita(int medico, long colectivo, double poliza, int beneficiario) throws ExcepcionTarisan
|
||||
{
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object[] aCondiciones;
|
||||
boolean esPrimeraVisita = false;
|
||||
|
||||
try
|
||||
{
|
||||
java.sql.Date dtFecha = this.obtenerFechaPrimeraVisita(medico, colectivo, poliza, beneficiario);
|
||||
|
||||
if (dtFecha!=null) //existe registro. Se comprueba si es la primera visita
|
||||
{
|
||||
Calendar calFechaPrimeraVisita = Calendar.getInstance();
|
||||
calFechaPrimeraVisita.setTime(dtFecha);
|
||||
Calendar calFechaActual = Calendar.getInstance();
|
||||
|
||||
if (ParametrosConfiguracion.periodoNatural.equalsIgnoreCase("si")) //se trata de un periodo natural
|
||||
{
|
||||
if (calFechaActual.get(Calendar.YEAR)>calFechaPrimeraVisita.get(Calendar.YEAR)) { //años diferentes
|
||||
esPrimeraVisita = true;
|
||||
} else {
|
||||
if (calFechaActual.get(Calendar.YEAR)==calFechaPrimeraVisita.get(Calendar.YEAR )) //mismo año
|
||||
{
|
||||
//le sumamos a la fecha obtenida el periodo de meses para conocer si es primera visita
|
||||
calFechaPrimeraVisita.add(Calendar.MONTH, ParametrosConfiguracion.periodoPrimeraVisita);
|
||||
|
||||
if ( calFechaPrimeraVisita.getTime().compareTo( calFechaActual.getTime() ) < 0 ) { //la fecha de la primera visita mas el periodo es inferior a la fecha actual
|
||||
esPrimeraVisita = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else //se trata de un periodo no natural
|
||||
{
|
||||
//le sumamos a la fecha obtenida el periodo de meses para conocer si es primera visita
|
||||
calFechaPrimeraVisita.add(Calendar.MONTH, ParametrosConfiguracion.periodoPrimeraVisita);
|
||||
|
||||
if ( calFechaPrimeraVisita.getTime().compareTo( calFechaActual.getTime() ) < 0 ) //la fecha de la primera visita mas el periodo es inferior a la fecha actual
|
||||
esPrimeraVisita = true;
|
||||
}
|
||||
} else { //No existe registro. Es primera visita
|
||||
esPrimeraVisita = true;
|
||||
}
|
||||
|
||||
//LogTarisan.logger.log(NivelLog.DEBUG, "Es primera visita: " + esPrimeraVisita +" (" + strSql.toString() + ")");
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Es primera visita: " + esPrimeraVisita);
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPRIMER: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPRIMER: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPRIMER: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return esPrimeraVisita;
|
||||
|
||||
}
|
||||
|
||||
public boolean sePuedeAutoprescribible(int medico, int entidad, long colectivo, double poliza, int orden, int acto){
|
||||
return sePuedeAutoprescribible(medico, entidad, colectivo, poliza, orden, acto, 0);
|
||||
}
|
||||
|
||||
public boolean sePuedeAutoprescribible(int medico, int entidad, long colectivo, double poliza, int orden, int acto, int contrato)
|
||||
{
|
||||
boolean resultado = false;
|
||||
LogTarisan.logger.log(NivelLog.INFO, "Empezamos a comprobar si se puede imputar un acto autoprescribible");
|
||||
//selecionamos entidad, colectivo, poliza, orden con la tarjeta
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
java.sql.Date dtFechaUltimoTamovext = null;
|
||||
Object[] aCondiciones;
|
||||
Connection conexion = null;
|
||||
Usuario usu = new Usuario();
|
||||
PersistenciaUsuario perUsu= new PersistenciaUsuario();
|
||||
|
||||
|
||||
try {
|
||||
|
||||
usu = perUsu.seleccionar(medico);
|
||||
int especialidad = usu.getEspecialidad();
|
||||
if((especialidad == Integer.parseInt(Constantes.PERFIL_DENTISTA)) || (especialidad == 19))
|
||||
resultado = true;
|
||||
|
||||
if(!resultado)
|
||||
{
|
||||
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
strSql = new StringBuffer();
|
||||
strSql.append("select FECHA");
|
||||
if(contrato==723){
|
||||
strSql.append(" from tamovext_dental");
|
||||
}else{
|
||||
strSql.append(" from tamovext");
|
||||
}
|
||||
strSql.append(" where entidad = ?");
|
||||
strSql.append(" and colectivo = ?");
|
||||
strSql.append(" and poliza = ?");
|
||||
strSql.append(" and orden = ?");
|
||||
strSql.append(" and medico = ?");
|
||||
strSql.append(" and acto = ?");
|
||||
strSql.append(" ORDER BY FECHA DESC");
|
||||
aCondiciones = null;
|
||||
aCondiciones = new Object[6];
|
||||
aCondiciones[0] = Integer.valueOf(entidad);
|
||||
aCondiciones[1] = Long.valueOf(colectivo);
|
||||
aCondiciones[2] = Double.valueOf(poliza);
|
||||
aCondiciones[3] = Integer.valueOf(orden);
|
||||
aCondiciones[4] = Integer.valueOf(medico);
|
||||
aCondiciones[5] = Integer.valueOf(acto);
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
if(rs.next())
|
||||
{
|
||||
dtFechaUltimoTamovext = rs.getDate("FECHA");
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "PersistenciaTaprimer - sePuedeAutoprescribible - Llega a 132 fecha: "+dtFechaUltimoTamovext);
|
||||
}
|
||||
rs.close();
|
||||
//si la fecha del movimiento es distinto de null es que hay movimientos comparamos el año, mes, día con la fecha actual y si corresponde ponemos resultado a cierto
|
||||
if(dtFechaUltimoTamovext != null)
|
||||
{
|
||||
Calendar calFechaUltTamovext = Calendar.getInstance();
|
||||
Calendar hoy = Calendar.getInstance();
|
||||
calFechaUltTamovext.setTime(dtFechaUltimoTamovext);
|
||||
if(hoy.get(Calendar.YEAR)>calFechaUltTamovext.get(Calendar.YEAR))
|
||||
{
|
||||
resultado = true;
|
||||
}
|
||||
else if(hoy.get(Calendar.MONTH)>calFechaUltTamovext.get(Calendar.MONTH))
|
||||
{
|
||||
resultado = true;
|
||||
}
|
||||
else if(hoy.get(Calendar.DAY_OF_MONTH)>calFechaUltTamovext.get(Calendar.DAY_OF_MONTH))
|
||||
{
|
||||
resultado = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
resultado = true;
|
||||
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
}
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de sePuedeAutoprescribible: " + sqle + " (" + strSql.toString() + ")");
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error SQL en la selección de sePuedeAutoprescribible: " + e + " (" + strSql.toString() + ")");
|
||||
}
|
||||
LogTarisan.logger.log(NivelLog.INFO, "Terminamos de comprobar si se puede el acto: "+acto+" para ent, col, pol, ord: "+entidad+", "+colectivo+", "+poliza+", "+orden+" con resultado: "+resultado);
|
||||
return resultado;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Devuelve la fecha más reciente de la primera visita realizada para el médico y paciente indicado.
|
||||
* En caso de que no exista ningún registro para el médico y paciente indicado, la función devolverá el valor null.
|
||||
* @param medico Código del médico.
|
||||
* @param colectivo Número de colectivo.
|
||||
* @param poliza Número de póliza.
|
||||
* @param beneficiario Número de beneficiario.
|
||||
* @return La Fecha más reciente perteneciente a la primera visita. En caso de no encontrar ningún registro, devolverá el valor null.
|
||||
* @throws
|
||||
* @param orden: si es cierto ordena descendentemente, sino ascendentemente (obtener primera visita o la última)
|
||||
*/
|
||||
public java.sql.Date obtenerFechaPrimeraVisita(int medico, long colectivo, double poliza, int beneficiario) throws ExcepcionTarisan
|
||||
{
|
||||
return this.obtenerFechaPrimeraVisita(medico,colectivo,poliza,beneficiario, true);
|
||||
}
|
||||
|
||||
public java.sql.Date obtenerFechaPrimeraVisita(int medico, long colectivo, double poliza, int beneficiario, boolean orden) throws ExcepcionTarisan
|
||||
{
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object[] aCondiciones;
|
||||
boolean esPrimeraVisita = false;
|
||||
java.sql.Date dtFechaPrimeraVisita = null;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT FECHA");
|
||||
strSql.append(" FROM TAPRIMER");
|
||||
strSql.append(" WHERE MEDICO = ?");
|
||||
strSql.append(" AND COLEC=?");
|
||||
strSql.append(" AND POLIZA=?");
|
||||
strSql.append(" AND ORDEN=?");
|
||||
//strSql.append(" AND ACTO=1");
|
||||
//strSql.append(" AND ACTO=1");
|
||||
strSql.append(" AND ACTO<>1460");
|
||||
if(orden)
|
||||
strSql.append(" ORDER BY FECHA DESC");
|
||||
else
|
||||
strSql.append(" ORDER BY FECHA ASC");
|
||||
|
||||
aCondiciones = new Object[4];
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
aCondiciones[1] = Long.valueOf(colectivo);
|
||||
aCondiciones[2] = Double.valueOf(poliza);
|
||||
aCondiciones[3] = Integer.valueOf(beneficiario);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
if (rs.next()) //existe registro.
|
||||
dtFechaPrimeraVisita = rs.getDate("FECHA");
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "La fecha de la primera visita obtenida ha sido: " + dtFechaPrimeraVisita +" (" + strSql.toString() + ")");
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPRIMER: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPRIMER: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPRIMER: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPRIMER: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return dtFechaPrimeraVisita;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Modifica la tabla TAPRIMER en función de la sentencia UPDATE indicada.
|
||||
* @param sqlSelect La sentencia UPDATE.
|
||||
* @param aValores Array que contiene los valores de los parámetros utilizados en la sentencia.
|
||||
* @param aCondiciones Array que contiene los parámetros de la condición utilizados en la sentencia.
|
||||
* @throws
|
||||
*/
|
||||
public void modificarPrimeraVisita(String sqlSelect, Object[] aValores, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
try
|
||||
{
|
||||
ParametrosConfiguracion.dataStore.actualizar(sqlSelect, aValores, aCondiciones);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAPRIMER: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAPRIMER: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAPRIMER: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifica la tabla TAPRIMER en función de la sentencia UPDATE indicada.
|
||||
* @param sqlSelect La sentencia UPDATE.
|
||||
* @param aValores Array que contiene los valores de los parámetros utilizados en la sentencia.
|
||||
* @param aCondiciones Array que contiene los parámetros de la condición utilizados en la sentencia.
|
||||
* @param conexion La conexión por la que se ejecuta la sentencia. Utilizado para el uso transacciones.
|
||||
* @throws
|
||||
*/
|
||||
public void modificarPrimeraVisita(String sqlSelect, Object[] aValores, Object[] aCondiciones, Connection conexion) throws ExcepcionTarisan
|
||||
{
|
||||
try
|
||||
{
|
||||
ParametrosConfiguracion.dataStore.actualizar(sqlSelect, aValores, aCondiciones, conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAPRIMER: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAPRIMER: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAPRIMER: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifica la tabla TAPRIMER en función de la sentencia INSERT indicada.
|
||||
* @param sqlSelect La sentencia INSERT.
|
||||
* @param aValores Array que contiene los valores de los parámetros utilizados en la sentencia.
|
||||
* @throws
|
||||
*/
|
||||
public void insertarPrimeraVisita(String sqlSelect, Object[] aValores) throws ExcepcionTarisan
|
||||
{
|
||||
try
|
||||
{
|
||||
ParametrosConfiguracion.dataStore.insertar(sqlSelect, aValores);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAPRIMER: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAPRIMER: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAPRIMER: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifica la tabla TAPRIMER en función de la sentencia INSERT indicada.
|
||||
* @param sqlSelect La sentencia INSERT.
|
||||
* @param aValores Array que contiene los valores de los parámetros utilizados en la sentencia.
|
||||
* @param conexion La conexión por la que se ejecuta la sentencia. Utilizado para el uso transacciones.
|
||||
* @throws
|
||||
*/
|
||||
public void insertarPrimeraVisita(String sqlSelect, Object[] aValores, Connection conexion) throws ExcepcionTarisan
|
||||
{
|
||||
try
|
||||
{
|
||||
ParametrosConfiguracion.dataStore.insertar(sqlSelect, aValores, conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAPRIMER: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAPRIMER: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAPRIMER: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public java.sql.Date obtenerFechaPrimeraLimpieza(int medico, long colectivo, double poliza, int beneficiario) throws ExcepcionTarisan
|
||||
{
|
||||
return this.obtenerFechaPrimeraLimpieza(medico,colectivo,poliza,beneficiario, true);
|
||||
}
|
||||
|
||||
public java.sql.Date obtenerFechaPrimeraLimpieza(int medico, long colectivo, double poliza, int beneficiario, boolean orden) throws ExcepcionTarisan
|
||||
{
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object[] aCondiciones;
|
||||
boolean esPrimeraLimpieza = false;
|
||||
java.sql.Date dtFechaPrimeraLimpieza = null;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT FECHA");
|
||||
strSql.append(" FROM TAPRIMER");
|
||||
strSql.append(" WHERE MEDICO = ?");
|
||||
strSql.append(" AND COLEC=?");
|
||||
strSql.append(" AND POLIZA=?");
|
||||
strSql.append(" AND ORDEN=?");
|
||||
strSql.append(" AND ACTO=?");
|
||||
if(orden)
|
||||
strSql.append(" ORDER BY FECHA DESC");
|
||||
else
|
||||
strSql.append(" ORDER BY FECHA ASC");
|
||||
|
||||
aCondiciones = new Object[5];
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
aCondiciones[1] = Long.valueOf(colectivo);
|
||||
aCondiciones[2] = Double.valueOf(poliza);
|
||||
aCondiciones[3] = Integer.valueOf(beneficiario);
|
||||
aCondiciones[4] = Integer.valueOf(ParametrosConfiguracion.codigoPrimeraLimpieza);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
if (rs.next()) //existe registro.
|
||||
dtFechaPrimeraLimpieza = rs.getDate("FECHA");
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "La fecha de la primera limpieza de boca obtenida ha sido: " + dtFechaPrimeraLimpieza +" (" + strSql.toString() + ")");
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPRIMER: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPRIMER: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPRIMER: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPRIMER: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return dtFechaPrimeraLimpieza;
|
||||
|
||||
}
|
||||
|
||||
public boolean esPrimeraLimpieza(int medico, long colectivo, double poliza, int beneficiario) throws ExcepcionTarisan
|
||||
{
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object[] aCondiciones;
|
||||
boolean esPrimeraLimpieza = false;
|
||||
|
||||
try
|
||||
{
|
||||
java.sql.Date dtFecha = this.obtenerFechaPrimeraLimpieza(medico, colectivo, poliza, beneficiario);
|
||||
|
||||
if (dtFecha!=null) //existe registro. Se comprueba si es la primera limpieza de boca
|
||||
{
|
||||
Calendar calFechaPrimeraLimpieza = Calendar.getInstance();
|
||||
calFechaPrimeraLimpieza.setTime(dtFecha);
|
||||
Calendar calFechaActual = Calendar.getInstance();
|
||||
|
||||
if (ParametrosConfiguracion.periodoNatural.equalsIgnoreCase("si")) //se trata de un periodo natural
|
||||
{
|
||||
if (calFechaActual.get(Calendar.YEAR)>calFechaPrimeraLimpieza.get(Calendar.YEAR)) { //años diferentes
|
||||
esPrimeraLimpieza = true;
|
||||
} else {
|
||||
if (calFechaActual.get(Calendar.YEAR)==calFechaPrimeraLimpieza.get(Calendar.YEAR )) //mismo año
|
||||
{
|
||||
//le sumamos a la fecha obtenida el periodo de meses para conocer si es primera visita
|
||||
calFechaPrimeraLimpieza.add(Calendar.MONTH, ParametrosConfiguracion.periodoPrimeraVisita);
|
||||
|
||||
if ( calFechaPrimeraLimpieza.getTime().compareTo( calFechaActual.getTime() ) < 0 ) { //la fecha de la primera limpieza de boca mas el periodo es inferior a la fecha actual
|
||||
esPrimeraLimpieza = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else //se trata de un periodo no natural
|
||||
{
|
||||
//le sumamos a la fecha obtenida el periodo de meses para conocer si es primera limpieza de boca
|
||||
calFechaPrimeraLimpieza.add(Calendar.MONTH, ParametrosConfiguracion.periodoPrimeraVisita);
|
||||
|
||||
if ( calFechaPrimeraLimpieza.getTime().compareTo( calFechaActual.getTime() ) < 0 ) //la fecha de la primera limpieza de boca mas el periodo es inferior a la fecha actual
|
||||
esPrimeraLimpieza = true;
|
||||
}
|
||||
} else { //No existe registro. Es primera limpieza de boca
|
||||
esPrimeraLimpieza = true;
|
||||
}
|
||||
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Es primera limpieza: " + esPrimeraLimpieza);
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPRIMER: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPRIMER: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPRIMER: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return esPrimeraLimpieza;
|
||||
|
||||
}
|
||||
|
||||
public void modificarPrimeraLimpieza(String sqlSelect, Object[] aValores, Object[] aCondiciones, Connection conexion) throws ExcepcionTarisan
|
||||
{
|
||||
try
|
||||
{
|
||||
ParametrosConfiguracion.dataStore.actualizar(sqlSelect, aValores, aCondiciones, conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAPRIMER: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAPRIMER: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAPRIMER: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void insertarPrimeraLimpieza(String sqlSelect, Object[] aValores, Connection conexion) throws ExcepcionTarisan
|
||||
{
|
||||
try
|
||||
{
|
||||
ParametrosConfiguracion.dataStore.insertar(sqlSelect, aValores, conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAPRIMER: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAPRIMER: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAPRIMER: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
/**
|
||||
* @(#) PersistenciaTareglog.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.excepcion.*;
|
||||
import com.tarisan.log.*;
|
||||
import java.sql.*;
|
||||
import java.time.Instant;
|
||||
import java.util.Calendar;
|
||||
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>Tareglog</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaTareglog
|
||||
{
|
||||
|
||||
/**
|
||||
* Obtiene el valor más alto del campo 'correlativo' de la tabla TAREGLOG para el médico conectado a la aplicación.
|
||||
* @param medico Código del médico conectado.
|
||||
* @param fecha Objeto <code>Timestamp</code> que contiene la fecha y hora del último acceso por parte del usuario a la aplicación.
|
||||
* @return El valor más alto del campo 'correlativo' de la tabla TAREGLOG para el médico conectado.
|
||||
* @throws
|
||||
*/
|
||||
public int obtenerUltimoValorCorrelativo(int medico, Timestamp fecha) throws ExcepcionTarisan
|
||||
{
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
int intCorrelativo = 0;
|
||||
if (fecha == null) {
|
||||
fecha = Timestamp.from(Instant.now());
|
||||
}
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT MAX(correlativo) as correlativo");
|
||||
strSql.append(" FROM tareglog");
|
||||
strSql.append(" WHERE medico=?");
|
||||
strSql.append(" AND fecha=?");
|
||||
|
||||
aCondiciones = new Object[2];
|
||||
aCondiciones[0]=Integer.valueOf(medico);
|
||||
aCondiciones[1] = fecha;
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
//nos posicionamos en el registro
|
||||
if (rs.next())
|
||||
//obtenemos el campo correlativo
|
||||
intCorrelativo = rs.getInt("CORRELATIVO");
|
||||
else
|
||||
intCorrelativo = 1;
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
intCorrelativo = intCorrelativo == 0 ? 1 : intCorrelativo;
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado el valor " + intCorrelativo + " del campo CORRELATIVO de la tabla TAREGLOG (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAREGLOG: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAREGLOG: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAREGLOG: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAREGLOG: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
|
||||
return intCorrelativo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inserta un nuevo registro en la tabla TAREGLOG en función de la sentencia INSERT indicada.
|
||||
* <br>Dentro de esta tabla se grabalos movimientos realizados por los usuarios mientras navegaban por la aplicación.
|
||||
* <br>Entendemos por movimiento la inserción o modificación de algún registro de ciertas tablas pertenecientes a la aplicación.
|
||||
* @param medico Código del médico conectado a la aplicación
|
||||
* @param fechaAcceso Objeto <code>Timestamp</code> que contiene la fecha y hora en la que el usuario ha entrado en la aplicación
|
||||
* @param fechaPeticion Objeto <code>Calendar</code> que contiene la fecha en la que el usuario ha realizado algún tipo de movimiento en la aplicación.
|
||||
* @param correlativo Se trata de un campo correlativo utilizado para que las claves primarias no coincidan. El valor de este campo será el máximo valor correlativo existente en la base de datos para el médico conectado, incrementado en una unidad.
|
||||
* @param tabla Nombre de la tabla a la que le afecta el movimiento (inserción/modificación) realizado por el usuario.
|
||||
* @param sentencia La sentencia sql que ejecuta la acción que pide el usuario.
|
||||
* @param observaciones Parametro que se utiliza para indicar las observaciones que se consideren oportunas.
|
||||
* @throws
|
||||
*/
|
||||
public void insertarLog(int medico, Timestamp fechaAcceso, Calendar fechaPeticion, int correlativo, String tabla, String sentencia, String observaciones) throws ExcepcionTarisan
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Entramos en IntertarLog con valores, medico:"+medico+" fechaacceso: "+fechaAcceso+" fechapeticion: "+fechaPeticion+" intcorrelativo: "+correlativo);
|
||||
StringBuffer strSql = null;
|
||||
if (fechaAcceso == null) {
|
||||
fechaAcceso = Timestamp.from(Instant.now());
|
||||
}
|
||||
try
|
||||
{
|
||||
strSql = new StringBuffer();
|
||||
strSql.append("INSERT INTO TAREGLOG");
|
||||
strSql.append(" (MEDICO, FECHA, FECHA_PETICION, CORRELATIVO, TABLA, SENTENCIA, OBSERVACIONES)");
|
||||
strSql.append(" VALUES(?, ?, ?, ?, ?, ?, ?)");
|
||||
|
||||
Object[] aValores = new Object[7];
|
||||
aValores[0] = Integer.valueOf(medico);
|
||||
aValores[1] = fechaAcceso;
|
||||
aValores[2] = new Timestamp(fechaPeticion.getTimeInMillis());
|
||||
aValores[3] = Integer.valueOf(correlativo);
|
||||
aValores[4] = tabla;
|
||||
aValores[5] = sentencia;
|
||||
aValores[6] = observaciones;
|
||||
|
||||
ParametrosConfiguracion.dataStore.insertar(strSql.toString(), aValores);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAREGLOG: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAREGLOG: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAREGLOG: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inserta un nuevo registro en la tabla TAREGLOG en función de la sentencia INSERT indicada a través de la conexión proporcionada.
|
||||
* <br>Dentro de esta tabla se grabalos movimientos realizados por los usuarios mientras navegaban por la aplicación.
|
||||
* <br>Entendemos por movimiento la inserción o modificación de algún registro de ciertas tablas pertenecientes a la aplicación.
|
||||
* @param medico Código del médico conectado a la aplicación.
|
||||
* @param fechaAcceso Objeto <code>Timestamp</code> que contiene la fecha y hora en la que el usuario ha entrado en la aplicación.
|
||||
* @param fechaPeticion Objeto <code>Calendar</code> que contiene la fecha en la que el usuario ha realizado algún tipo de movimiento en la aplicación.
|
||||
* @param correlativo Se trata de un campo correlativo utilizado para que las claves primarias no coincidan. El valor de este campo será el máximo valor correlativo existente en la base de datos para el médico conectado, incrementado en una unidad.
|
||||
* @param tabla Nombre de la tabla a la que le afecta el movimiento (inserción/modificación) realizado por el usuario.
|
||||
* @param sentencia La sentencia sql que ejecuta la acción que pide el usuario.
|
||||
* @param observaciones Parametro que se utiliza para indicar las observaciones que se consideren oportunas.
|
||||
* @param conexion Conexión utilizada para insertar el nuevo registro en la tabla TAREGLOG.
|
||||
* @throws
|
||||
*/
|
||||
public void insertarLog(int medico, Timestamp fechaAcceso, Calendar fechaPeticion, int correlativo, String tabla, String sentencia, String observaciones, Connection conexion) throws ExcepcionTarisan
|
||||
{
|
||||
StringBuffer strSql = null;
|
||||
if (fechaAcceso == null) {
|
||||
fechaAcceso = Timestamp.from(Instant.now());
|
||||
}
|
||||
try
|
||||
{
|
||||
strSql = new StringBuffer();
|
||||
strSql.append("INSERT INTO TAREGLOG");
|
||||
strSql.append(" (MEDICO, FECHA, FECHA_PETICION, CORRELATIVO, TABLA, SENTENCIA, OBSERVACIONES)");
|
||||
strSql.append(" VALUES(?, ?, ?, ?, ?, ?, ?)");
|
||||
|
||||
Object[] aValores = new Object[7];
|
||||
aValores[0] = Integer.valueOf(medico);
|
||||
aValores[1] = fechaAcceso;
|
||||
aValores[2] = new Timestamp(fechaPeticion.getTimeInMillis());
|
||||
aValores[3] = Integer.valueOf(correlativo);
|
||||
aValores[4] = tabla;
|
||||
aValores[5] = sentencia;
|
||||
aValores[6] = observaciones;
|
||||
|
||||
ParametrosConfiguracion.dataStore.insertar(strSql.toString(), aValores, conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la insercion de TAREGLOG: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAREGLOG: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TAREGLOG: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
/**
|
||||
* @(#) PersistenciaTaregmed.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.Taregmed;
|
||||
import com.tarisan.excepcion.*;
|
||||
import com.tarisan.log.*;
|
||||
import java.sql.*;
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>Taregmed</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaTaregmed
|
||||
{
|
||||
|
||||
/**
|
||||
* Selecciona el primer registro de la tabla TAREGMED encontrado para el médico conectado a la aplicación Tarisan.
|
||||
* @param medico El código del médico conectado a la aplicación.
|
||||
* @param fecha La fecha en la que se realiza los intentos de conexión a la aplicación.
|
||||
* @return El objeto <code>Taregmed</code> encontrado en la tabla de registros de accesos de médicos o null si se produce alguna excepción o no encuentra nada.
|
||||
* @throws
|
||||
*/
|
||||
public Taregmed seleccionar(int medico, Timestamp fecha) throws ExcepcionTarisan
|
||||
{
|
||||
Taregmed taregmed = null;
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
|
||||
try
|
||||
{
|
||||
sqlSelect.append("SELECT RESULTADO");
|
||||
sqlSelect.append(" FROM TAREGMED");
|
||||
sqlSelect.append(" WHERE MEDICO = ?");
|
||||
sqlSelect.append(" AND FECHA = ?");
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
Object aCondiciones[] = new Object[2];
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
aCondiciones[1] = fecha;
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
taregmed = new Taregmed();
|
||||
taregmed.setMedico(medico);
|
||||
taregmed.setFecha(fecha);
|
||||
taregmed.setResultado(rs.getString("RESULTADO"));
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado el " + taregmed + " de la tabla TAREGMED (" + sqlSelect + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
taregmed = null;
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de taregmed: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan();
|
||||
}
|
||||
|
||||
return taregmed;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inserta el registro correspondiente al médico conectado marcándolo como bloqueado.
|
||||
* @param medico El código del médico conectado a la aplicación.
|
||||
* @param fecha La fecha en la que se ha intentado conectar a la aplicación.
|
||||
* @param resultado Parámetro que indica si la conexión a la aplicación ha sido correcta o incorrecta.
|
||||
* @return El resultado de la actualización en base de datos.
|
||||
* @throws
|
||||
*/
|
||||
public boolean insertar(int medico, Calendar calendario, String resultado) throws ExcepcionTarisan
|
||||
{
|
||||
boolean res = true;
|
||||
StringBuffer sqlInsert = null;
|
||||
try
|
||||
{
|
||||
sqlInsert = new StringBuffer();
|
||||
sqlInsert.append("INSERT INTO TAREGMED");
|
||||
sqlInsert.append(" (MEDICO, FECHA, RESULTADO)");
|
||||
sqlInsert.append(" VALUES(?, ?, ?)");
|
||||
|
||||
Object[] aValores = new Object[3];
|
||||
aValores[0] = Integer.valueOf(medico);
|
||||
aValores[1] = new Timestamp(calendario.getTimeInMillis());
|
||||
aValores[2] = resultado;
|
||||
|
||||
res = ParametrosConfiguracion.dataStore.insertar(sqlInsert.toString(), aValores);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la inserción de TAREGMED: " + sqle + " (" + sqlInsert + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la inserción de TAREGMED: " + sqle + " (" + sqlInsert + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la inserción de TAREGMED: " + sqle + " (" + sqlInsert + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Insertar un registro, para mantener una tabla con los usuarios conectados en un momento determinado (concurrencia)
|
||||
* @param medico
|
||||
* @param calendario
|
||||
* @return
|
||||
*/
|
||||
public boolean conectar(int medico, Calendar calendario)
|
||||
{
|
||||
boolean res = true;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
/**
|
||||
* @(#) PersistenciaTaresana.java
|
||||
*/
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
import java.sql.*;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>Taresana</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaTaresana
|
||||
{
|
||||
|
||||
/**
|
||||
* Devuelve true en caso de que ya exista el análisis indicado en la tabla TARESANA, o false en caaso contrario.
|
||||
* @param prescriptor Código del médico prescriptor.
|
||||
* @param especialidad Código de la especialidad del análisis realizado.
|
||||
* @param colectivo Código del colectivo.
|
||||
* @param poliza Número de la póliza.
|
||||
* @param beneficiario Número de beneficiario.
|
||||
* @param fecha Fecha del análisis.
|
||||
* @return Valor booleano que indica si ya existe el análisis indicado en la tabla TARESANA.
|
||||
* @throws
|
||||
*/
|
||||
public boolean existeAnalisis(int prescriptor, int especialidad, long colectivo, double poliza, int beneficiario, java.sql.Date fecha) throws ExcepcionTarisan
|
||||
{
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
boolean blnExisteAnalisis = false;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT *");
|
||||
strSql.append(" FROM taresana");
|
||||
strSql.append(" WHERE prescriptor=?");
|
||||
strSql.append(" AND especialidad=?");
|
||||
strSql.append(" AND colec=?");
|
||||
strSql.append(" AND poliza=?");
|
||||
strSql.append(" AND orden=?");
|
||||
strSql.append(" AND fecha=?");
|
||||
|
||||
aCondiciones = new Object[6];
|
||||
aCondiciones[0]=Integer.valueOf(prescriptor);
|
||||
aCondiciones[1]=Integer.valueOf(especialidad);
|
||||
aCondiciones[2]=Long.valueOf(colectivo);
|
||||
aCondiciones[3]=Double.valueOf(poliza);
|
||||
aCondiciones[4]=Integer.valueOf(beneficiario);
|
||||
aCondiciones[5]=fecha;
|
||||
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
//nos posicionamos en el registro
|
||||
if (rs.next())
|
||||
//Existe un analisis
|
||||
blnExisteAnalisis = true;
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "La comprobacion de si existe ya un analisis en la tabla TARESANA es: " + blnExisteAnalisis + " (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TARESANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TARESANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TARESANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TARESANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
|
||||
return blnExisteAnalisis;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inserta un nuevo registro en la tabla TARESANA en función de la sentencia INSERT indicada.
|
||||
* @param sqlSelect la sentencia INSERT.
|
||||
* @param aValores Array que contiene los valores de los parámetros utilizados en la sentencia.
|
||||
* @throws
|
||||
*/
|
||||
public void insertarAnalisis(String sqlSelect, Object[] aValores) throws ExcepcionTarisan
|
||||
{
|
||||
try
|
||||
{
|
||||
ParametrosConfiguracion.dataStore.insertar(sqlSelect, aValores);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TARESANA: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TARESANA: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TARESANA: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserta un nuevo registro en la tabla TARESANA en función de la sentencia INSERT indicada.
|
||||
* @param sqlSelect La sentencia INSERT.
|
||||
* @param aValores Array que contiene los valores de los parámetros utilizados en la sentencia.
|
||||
* @param conexion La conexión por la que se ejecuta la sentencia. Utilizado para el uso transacciones.
|
||||
* @throws
|
||||
*/
|
||||
public void insertarAnalisis(String sqlSelect, Object[] aValores, Connection conexion) throws ExcepcionTarisan
|
||||
{
|
||||
try
|
||||
{
|
||||
ParametrosConfiguracion.dataStore.insertar(sqlSelect, aValores, conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TARESANA: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TARESANA: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la modificacion de TARESANA: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public boolean analisisEnClinica(int peticionTarisan)
|
||||
{
|
||||
/*
|
||||
* Buscamos en la tabla de HIS nhgp_petin_cab si existe la correlación de petición tarisan con petición gpc
|
||||
*
|
||||
*/
|
||||
boolean resul = false;
|
||||
String sql = "Select count(NHGP_PETICION_CAB.NHGP_PETC_ID) as cuantos from novahis.nhgp_petin_cab, novahis.nhgp_peticion_cab where nhgp_refext = '" + peticionTarisan + "' and NHGP_PETIN_CAB.NHGP_ID_PROCESO = NHGP_PETICION_CAB.NHGP_PETC_EPI";
|
||||
|
||||
Connection conexion;
|
||||
try {
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sql);
|
||||
int contador = 0;
|
||||
while(rs.next())
|
||||
{
|
||||
contador += rs.getInt(1);
|
||||
}
|
||||
if(contador > 0)
|
||||
resul = true;
|
||||
} catch (ExcepcionTarisan e) {
|
||||
e.printStackTrace();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resul;
|
||||
}
|
||||
|
||||
public int analisisGpc(int peticionTarisan)
|
||||
{
|
||||
int resul = 0;
|
||||
String sql = "Select REPLACE(NHGP_PETICION_CAB.NHGP_PETC_ID,'-','') from novahis.nhgp_petin_cab, novahis.nhgp_peticion_cab where nhgp_refext = '" + peticionTarisan + "' and NHGP_PETIN_CAB.NHGP_ID_PROCESO = NHGP_PETICION_CAB.NHGP_PETC_EPI";
|
||||
|
||||
Connection conexion;
|
||||
try {
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sql);
|
||||
while(rs.next())
|
||||
{
|
||||
resul = rs.getInt(1);
|
||||
}
|
||||
|
||||
} catch (ExcepcionTarisan e) {
|
||||
e.printStackTrace();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return resul;
|
||||
}
|
||||
|
||||
public boolean peticionCapturada(long autorizacion)
|
||||
{
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
boolean resultado = false;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT *");
|
||||
strSql.append(" FROM taresana");
|
||||
strSql.append(" WHERE autorizacion=?");
|
||||
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0]=Long.valueOf(autorizacion);
|
||||
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
//nos posicionamos en el registro
|
||||
if (rs.next())
|
||||
//Existe un analisis
|
||||
resultado = true;
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "La comprobacion de si un análisis ya está capturado en la tabla TARESANA es: " + resultado + " (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TARESANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
//return false;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TARESANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
//return false;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TARESANA: " + sqle + " (" + strSql.toString() + ")");
|
||||
//return false;
|
||||
}
|
||||
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
package com.tarisan.control;
|
||||
|
||||
|
||||
import com.tarisan.excepcion.*;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.util.Utilidades;
|
||||
import com.tarisan.data.Tavolin;
|
||||
import java.sql.*;
|
||||
import java.util.Calendar;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author csm_jjripaper
|
||||
*
|
||||
*/
|
||||
public class PersistenciaTavolin implements Constantes
|
||||
{
|
||||
public boolean insertar(Tavolin tavol)
|
||||
{
|
||||
boolean resultado=false;
|
||||
StringBuffer sqlInsert = new StringBuffer();
|
||||
Object[] aValores = new Object[13];
|
||||
|
||||
try {
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "\n Datos Volante Ingreso: Nom_paciente: "+tavol.get_nombre()+", domicilio:"+tavol.get_domicilio()+", fec_nac: "+tavol.get_fecnac());
|
||||
sqlInsert.append("Insert into tavolin (tarjeta, nombre, domicilio, fec_nac, nif, prescriptor, poliza, acto_medico, motivo_ingreso, juicio_diagnostico, fecha, pk, motivo_peticion)");
|
||||
sqlInsert.append(" values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
aValores[0]=Long.valueOf(tavol.get_tarjeta());
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "tarjeta : "+aValores[0]);
|
||||
aValores[1]=new String(tavol.get_nombre());
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "nombre: "+aValores[1]);
|
||||
aValores[2]=new String(tavol.get_domicilio());
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "domicilio: "+aValores[2]);
|
||||
aValores[3]=tavol.get_fecnac();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "fecnac: "+aValores[3]);
|
||||
aValores[4]=new String(tavol.get_nif());
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "nif: "+aValores[4]);
|
||||
aValores[5]=Integer.valueOf(tavol.get_medico());
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "medico: "+aValores[5]);
|
||||
aValores[6]=new String(tavol.get_poliza());
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "poliza: "+aValores[6]);
|
||||
aValores[7]=Integer.valueOf(tavol.get_acto());
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "acto: "+aValores[7]);
|
||||
aValores[8]=Integer.valueOf(tavol.get_motivo());
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "motivo: "+aValores[8]);
|
||||
aValores[9]=new String(tavol.get_juicio());
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "juicio: "+aValores[9]);
|
||||
aValores[10]=tavol.get_fecha();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "fecha: "+aValores[10]);
|
||||
aValores[11]=this.next_pk();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "pk: "+aValores[11]);
|
||||
aValores[12]=new String(tavol.get_motivo_peticion());
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "motivo peti: "+aValores[12]);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Insert: "+Utilidades.obtenerSentenciaSQL(sqlInsert, aValores, null));
|
||||
|
||||
resultado = ParametrosConfiguracion.dataStore.insertar(sqlInsert.toString(), aValores, conexion);
|
||||
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al insertar el Volante de Ingreso");
|
||||
}
|
||||
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public Vector volantes_por_prescriptor(int medico, int pagina)
|
||||
{
|
||||
return this.volantes_por_prescriptor(medico, pagina, 0);
|
||||
}
|
||||
|
||||
public Vector volantes_por_prescriptor(int medico, int pagina, int erroneos)
|
||||
{
|
||||
Vector resultado = new Vector();
|
||||
Tavolin tavol = new Tavolin();
|
||||
Object[] aCondiciones = new Object[1];
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
sqlSelect.append("Select * from tavolin ");
|
||||
sqlSelect.append("where prescriptor = ? ");
|
||||
sqlSelect.append("and erroneo = "+erroneos);
|
||||
sqlSelect.append(" order by pk desc");
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
while(rs.next())
|
||||
{
|
||||
tavol = new Tavolin();
|
||||
tavol.set_acto(rs.getInt("ACTO_MEDICO"));
|
||||
tavol.set_domicilio(rs.getString("DOMICILIO"));
|
||||
tavol.set_fecha(rs.getDate("FECHA"));
|
||||
tavol.set_fecnac(rs.getDate("FEC_NAC"));
|
||||
tavol.set_juicio(rs.getString("JUICIO_DIAGNOSTICO"));
|
||||
tavol.set_medico(rs.getInt("PRESCRIPTOR"));
|
||||
tavol.set_motivo(rs.getInt("MOTIVO_INGRESO"));
|
||||
tavol.set_nif(rs.getString("NIF"));
|
||||
tavol.set_nombre(rs.getString("NOMBRE"));
|
||||
tavol.set_poliza(rs.getString("POLIZA"));
|
||||
tavol.set_tarjeta(rs.getLong("TARJETA"));
|
||||
tavol.set_erroneo(rs.getInt("ERRONEO"));
|
||||
tavol.set_pk(rs.getInt("PK"));
|
||||
tavol.set_motivo_peticion(rs.getString("MOTIVO_PETICION"));
|
||||
resultado.add(tavol);
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + resultado.size() +" volantes del medico " + medico);
|
||||
} catch (ExcepcionTarisan e){
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al obtener los volantes del medico: "+medico);
|
||||
} catch (SQLException e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al obtener los volantes del medico: "+medico);
|
||||
}
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public boolean marcar_volante_erroneo(int pk_volante)
|
||||
{
|
||||
boolean resultado = false;
|
||||
String sqlSelect = new String();
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Vamos a marcar el volante: "+pk_volante+" como erroneo");
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
sqlSelect = "update tavolin set erroneo = 1 where pk = "+pk_volante;
|
||||
resultado = ParametrosConfiguracion.dataStore.actualizar(sqlSelect, conexion);
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
} catch (ExcepcionTarisan e){
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error al marcar el volante: "+pk_volante+" como erroneo.");
|
||||
}
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Volante "+pk_volante+" marcado como erroneo:"+resultado);
|
||||
return resultado;
|
||||
}
|
||||
|
||||
private int next_pk()
|
||||
{
|
||||
int resul = 0;
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
sqlSelect.append("Select max(pk) NEXT from tavolin");
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString());
|
||||
while(rs.next())
|
||||
{
|
||||
resul = rs.getInt("NEXT");
|
||||
}
|
||||
rs.close();
|
||||
|
||||
}
|
||||
catch (ExcepcionTarisan e){
|
||||
resul = 0;
|
||||
} catch (SQLException e) {
|
||||
resul = 0;
|
||||
}
|
||||
return resul+1;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,210 @@
|
||||
/**
|
||||
* @(#) PersistenciattactmedGPC.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.TtactmedGPC;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.util.Utilidades;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>ttactmed</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaTtactmedGPC
|
||||
{
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber qué página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selecciona los registros de la tabla ttactmed en función de la sentencia SELECT indicada.
|
||||
* @param sqlSelect La sentencia SELECT de selección.
|
||||
* @param pagina Número de página a mostrar.
|
||||
* @param aCondiciones Array que contiene los parametros utilizados en la sentencia SELECT.
|
||||
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code>ttactmed</code>).
|
||||
* @throws
|
||||
*/
|
||||
public Vector seleccionar(String sqlSelect, int pagina, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
int elementosPaginacion=1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
TtactmedGPC ttactmed = null;
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect, aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
ttactmed = new TtactmedGPC();
|
||||
ttactmed.setDescripcion_gpc(rs.getString("DESCRIPCION"));
|
||||
ttactmed.setActo(rs.getInt("ACTO"));
|
||||
ttactmed.setOmc(rs.getInt("PRECIO"));
|
||||
vResultado.addElement(ttactmed);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TTACTMED_GPC (" + sqlSelect + ")");
|
||||
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTACTMED_GPC: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTACTMED_GPC: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTACTMED_GPC: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTACTMED_GPC: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public Vector listadoDeterminacionesAnaliticas(String strCampoNombre, int pagina) throws SQLException
|
||||
{
|
||||
Vector vResultado = new Vector();
|
||||
TtactmedGPC ttactmedGPC = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
int intPagina=1;
|
||||
Object aCondiciones[]=null;
|
||||
String consulta="";
|
||||
int elementosPaginacion=1;
|
||||
|
||||
strSql.append("SELECT *");
|
||||
strSql.append(" FROM TTACTMED_GPC");
|
||||
|
||||
//comprobamos si se trata de una busqueda de determinaciones analiticas
|
||||
if (!strCampoNombre.equalsIgnoreCase("")) //la sql tiene tres parametros
|
||||
{
|
||||
if (strCampoNombre.endsWith("*"))
|
||||
strCampoNombre=strCampoNombre.replace('*', '%');
|
||||
else
|
||||
strCampoNombre ="%" + strCampoNombre + "%";
|
||||
|
||||
//el array de objetos sera de tres elementos
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0] = strCampoNombre;
|
||||
|
||||
strSql.append(" WHERE TTACTMED_GPC.DESCRIPCION_GPC LIKE ?");
|
||||
}
|
||||
else //la sql solo tiene dos parametros
|
||||
aCondiciones = new Object[0];
|
||||
|
||||
strSql.append(" ORDER BY TTACTMED_GPC.DESCRIPCION_GPC");
|
||||
|
||||
try {
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
ttactmedGPC = new TtactmedGPC();
|
||||
ttactmedGPC.setDescripcion_gpc(rs.getString("DESCRIPCION_GPC"));
|
||||
ttactmedGPC.setActo(rs.getInt("ACTO"));
|
||||
ttactmedGPC.setOmc(rs.getInt("OMC"));
|
||||
vResultado.addElement(ttactmedGPC);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TTACTMED_GPC (" + strSql.toString() + ")");
|
||||
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de las determinaciones analiticas: " + e + " (" + strSql.toString() + ")");
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public Vector actosPorPeticion(long autorizacion) throws SQLException
|
||||
{
|
||||
Vector vResultado = new Vector();
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
TtactmedGPC ttactmed = null;
|
||||
|
||||
//strSql.append("select tapresca_tarisan.acto,descripcion_gpc ");
|
||||
strSql.append("select *");
|
||||
strSql.append(" from tapresca_tarisan, ttactmed_gpc ");
|
||||
strSql.append(" where tapresca_tarisan.acto=ttactmed_gpc.acto");
|
||||
strSql.append(" and autorizacion=?");
|
||||
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0] = autorizacion;
|
||||
|
||||
try {
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
ttactmed = new TtactmedGPC();
|
||||
ttactmed.setDescripcion_gpc(rs.getString("DESCRIPCION_GPC"));
|
||||
ttactmed.setActo(rs.getInt("ACTO"));
|
||||
ttactmed.setJustificacionInforme(rs.getString("TEXTO"));
|
||||
ttactmed.setJustificacionPrescripcion(rs.getString("JUSTIFICACION"));
|
||||
ttactmed.setJustifi_deter(rs.getString("JUSTIFY_DETER"));
|
||||
vResultado.addElement(ttactmed);
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TTACTMED_GPC (" + strSql.toString() + ")");
|
||||
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de las determinaciones analiticas: " + e + " (" + strSql.toString() + ")");
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,690 @@
|
||||
/**
|
||||
* @(#) PersistenciaUsuario.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.Tamedico;
|
||||
import com.tarisan.data.Usuario;
|
||||
import com.tarisan.excepcion.*;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.util.Utilidades;
|
||||
import java.sql.*;
|
||||
import java.util.Calendar;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>Usuario</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaUsuario implements Constantes
|
||||
{
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selecciona el primer registro de la tabla TAMEDICO encontrado para el usuario conectado a la aplicación Tarisan.
|
||||
* <br>Retorna uno de los siguientes objetos:<ul>
|
||||
* <li><code>null</code>: si se produce algún error incontrolado</li>
|
||||
* <li><code>Usuario</code>: el usuario correcto encontrado en la base de datos</li>
|
||||
* <li><code>Integer</code>: el código de error correspondiente al proceso de autenticación</li>
|
||||
* </ul>
|
||||
* @param codigo El código de usuario introducido en la página de conexión.
|
||||
* @param clave La clave de usuario introducida en la página de conexión.
|
||||
* @return El objeto resultante del proceso de validación.
|
||||
* @throws
|
||||
*/
|
||||
public Object seleccionar(int codigo, String clave) throws ExcepcionTarisan
|
||||
{
|
||||
Object retorno = null;
|
||||
Usuario usuario = null;
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
Connection conexion = null;
|
||||
|
||||
try
|
||||
{
|
||||
sqlSelect.append("SELECT MEDICO");
|
||||
sqlSelect.append(", NOMBRE");
|
||||
sqlSelect.append(", APELLIDOS");
|
||||
sqlSelect.append(", ESPECIALIDAD");
|
||||
sqlSelect.append(", TARIFA");
|
||||
sqlSelect.append(", NOMBRE_CAB");
|
||||
sqlSelect.append(", DIRECCION_CAB");
|
||||
sqlSelect.append(", POBLACION_CAB");
|
||||
sqlSelect.append(", TELEFONO_CAB");
|
||||
sqlSelect.append(", EMAIL_CAB");
|
||||
sqlSelect.append(", COLEGIADO_CAB");
|
||||
sqlSelect.append(", ESPECIALIDAD_CAB");
|
||||
sqlSelect.append(", BLOQUEO_CLAVE");
|
||||
sqlSelect.append(", FECHA_ULT_ACCESO");
|
||||
sqlSelect.append(", FECHA_MODIF_CLAVE");
|
||||
sqlSelect.append(", PASSWORD");
|
||||
sqlSelect.append(" FROM TAMEDICO");
|
||||
sqlSelect.append(" WHERE MEDICO = ?");
|
||||
|
||||
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
|
||||
Object aCondiciones[] = new Object[1];
|
||||
aCondiciones[0] = Integer.valueOf(codigo);
|
||||
|
||||
String bloqueo = "";
|
||||
Timestamp fecModifClave = null;
|
||||
String password = "";
|
||||
Calendar calHoy = null;
|
||||
Calendar calInactividad = null;
|
||||
Calendar calCaducidad = null;
|
||||
Calendar calPreaviso = null;
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
|
||||
String nombre = "";
|
||||
if (rs.getString("NOMBRE") != null){
|
||||
nombre = rs.getString("NOMBRE") + " ";
|
||||
}
|
||||
|
||||
String ape = "";
|
||||
if (rs.getString("APELLIDOS") != null){
|
||||
ape = rs.getString("APELLIDOS");
|
||||
}
|
||||
|
||||
String nombreCab = "";
|
||||
if (rs.getString("NOMBRE_CAB") != null){
|
||||
nombreCab = rs.getString("NOMBRE_CAB");
|
||||
}
|
||||
|
||||
usuario = new Usuario();
|
||||
usuario.setMedico(rs.getInt("MEDICO"));
|
||||
usuario.setNombre(nombre + ape);
|
||||
usuario.setEspecialidad(rs.getInt("ESPECIALIDAD"));
|
||||
usuario.setTarifa(rs.getInt("TARIFA"));
|
||||
usuario.setNombreCab(nombreCab);
|
||||
usuario.setDireccionCab(rs.getString("DIRECCION_CAB"));
|
||||
usuario.setPoblacionCab(rs.getString("POBLACION_CAB"));
|
||||
usuario.setTelefonoCab(rs.getString("TELEFONO_CAB"));
|
||||
usuario.setEmailCab(rs.getString("EMAIL_CAB"));
|
||||
usuario.setColegiadoCab(rs.getString("COLEGIADO_CAB"));
|
||||
usuario.setEspecialidadCab(rs.getString("ESPECIALIDAD_CAB"));
|
||||
usuario.setFechaUltAcceso(rs.getTimestamp("FECHA_ULT_ACCESO"));
|
||||
|
||||
bloqueo = rs.getString("BLOQUEO_CLAVE");
|
||||
fecModifClave = rs.getTimestamp("FECHA_MODIF_CLAVE");
|
||||
password = rs.getString("PASSWORD");
|
||||
}
|
||||
rs.close();
|
||||
|
||||
//Primero: se calculan las fechas para su tratamiento posterior
|
||||
calHoy = Calendar.getInstance();
|
||||
|
||||
if (usuario != null)
|
||||
{
|
||||
|
||||
if(usuario.getFechaUltAcceso() != null)
|
||||
{
|
||||
|
||||
//Cálculo de la fecha de fin de actividad de la clave
|
||||
calInactividad = Calendar.getInstance();
|
||||
calInactividad.setTime((java.util.Date)usuario.getFechaUltAcceso());
|
||||
calInactividad.add(Calendar.DATE, ParametrosConfiguracion.diasActividad);
|
||||
}
|
||||
|
||||
if(fecModifClave != null)
|
||||
{
|
||||
|
||||
//Cálculo de la fecha de caducidad de la clave
|
||||
calCaducidad = Calendar.getInstance();
|
||||
calCaducidad.setTime((java.util.Date)fecModifClave);
|
||||
calCaducidad.add(Calendar.DATE, ParametrosConfiguracion.diasCaducidad);
|
||||
|
||||
//Cálculo de la fecha de preaviso de caducidad de la clave
|
||||
calPreaviso = Calendar.getInstance();
|
||||
calPreaviso.setTime((java.util.Date)fecModifClave);
|
||||
calPreaviso.add(Calendar.DATE, ParametrosConfiguracion.diasCaducidad - ParametrosConfiguracion.diasPreaviso);
|
||||
}
|
||||
}
|
||||
|
||||
//Segundo: se evalúa la selección del usuario realizada en la base de datos
|
||||
if (usuario == null)
|
||||
{
|
||||
|
||||
//El usuario no se ha encontrado en la base de datos
|
||||
retorno = USUARIO_INEXISTENTE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if(usuario.getFechaUltAcceso() == null)
|
||||
{
|
||||
|
||||
//El usuario realiza el primer acceso a la aplicación
|
||||
if(password.compareTo(clave) != 0)
|
||||
{
|
||||
|
||||
//El usuario no existe (la clave sin encriptar en la base de datos no es la misma que la escrita en el formulario de login)
|
||||
retorno = USUARIO_ERROR_CLAVE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//El usuario existe y se le redigirá a la introducción de la nueva clave, para su encriptación
|
||||
retorno = usuario;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if(password.compareTo(Utilidades.encripta(clave, String.valueOf(codigo))) != 0)
|
||||
{
|
||||
|
||||
//El usuario no existe (la clave encriptada en la base de datos no es la misma que la escrita en el formulario de login)
|
||||
retorno = USUARIO_ERROR_CLAVE;
|
||||
}
|
||||
else if((bloqueo != null) && (bloqueo.trim().toUpperCase().compareTo("S") == 0))
|
||||
{
|
||||
|
||||
//El usuario está bloqueado
|
||||
retorno = USUARIO_BLOQUEADO;
|
||||
}
|
||||
else if((calCaducidad != null) && calCaducidad.before(calHoy))
|
||||
{
|
||||
|
||||
//El usuario se bloquea por haber excedido la fecha de caducidad
|
||||
this.bloquearUsuario(codigo, calHoy);
|
||||
retorno = USUARIO_CADUCADO;
|
||||
}
|
||||
else if((calPreaviso != null) && calPreaviso.before(calHoy) && calHoy.before(calCaducidad))
|
||||
{
|
||||
|
||||
//Se muestra mensaje al usuario de cambio de clave por proximidad de la fecha de caducidad
|
||||
usuario.setFechaCaducidad(new Date(calCaducidad.getTimeInMillis()));
|
||||
retorno = usuario;
|
||||
}
|
||||
else if((calInactividad != null) && calInactividad.before(calHoy))
|
||||
{
|
||||
|
||||
//El usuario está bloqueado por período de inactividad
|
||||
this.bloquearUsuario(codigo, calHoy);
|
||||
retorno = USUARIO_INACTIVO;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//El usuario introducido es correcto
|
||||
retorno = usuario;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado el usuario " + usuario + " de la tabla TAMEDICO (" + sqlSelect + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
usuario = null;
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de usuario: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
usuario = null;
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de usuario: " + e + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan();
|
||||
}
|
||||
|
||||
return retorno;
|
||||
}
|
||||
|
||||
|
||||
public Usuario seleccionar(int medico) throws ExcepcionTarisan
|
||||
{
|
||||
return this.seleccionar(medico, 0);
|
||||
}
|
||||
/**
|
||||
* Selecciona el primer registro de la tabla TAMEDICO encontrado para el usuario conectado a la aplicación Tarisan.
|
||||
* @param medico El código de usuario introducido en la página de conexión.
|
||||
* @param especialidad El código de especialidad del usuario conectado.
|
||||
* @return El <code>Usuario</code> encontrado en la tabla de médicos,
|
||||
* un objeto vacío <code>Usuario</code> si no se cumplen las condiciones de búsqueda o null si se produce alguna excepción.
|
||||
* @throws
|
||||
*/
|
||||
public Usuario seleccionar(int medico, int especialidad) throws ExcepcionTarisan
|
||||
{
|
||||
Usuario usuario = null;
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
|
||||
try
|
||||
{
|
||||
sqlSelect.append("SELECT MEDICO");
|
||||
sqlSelect.append(", NOMBRE");
|
||||
sqlSelect.append(", APELLIDOS");
|
||||
sqlSelect.append(", ESPECIALIDAD");
|
||||
sqlSelect.append(", TARIFA");
|
||||
sqlSelect.append(", NOMBRE_CAB");
|
||||
sqlSelect.append(", DIRECCION_CAB");
|
||||
sqlSelect.append(", POBLACION_CAB");
|
||||
sqlSelect.append(", TELEFONO_CAB");
|
||||
sqlSelect.append(", EMAIL_CAB");
|
||||
sqlSelect.append(", COLEGIADO_CAB");
|
||||
sqlSelect.append(", ESPECIALIDAD_CAB");
|
||||
sqlSelect.append(" FROM TAMEDICO");
|
||||
sqlSelect.append(" WHERE MEDICO = ?");
|
||||
if(especialidad >0)
|
||||
sqlSelect.append(" AND ESPECIALIDAD = ?");
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
Object aCondiciones[] = null;
|
||||
if(especialidad > 0)
|
||||
{
|
||||
aCondiciones = new Object[2];
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
aCondiciones[1] = Integer.valueOf(especialidad);
|
||||
}
|
||||
else
|
||||
{
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
}
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
usuario = new Usuario();
|
||||
usuario.setMedico(rs.getInt("MEDICO"));
|
||||
usuario.setNombre(rs.getString("NOMBRE") + " " + rs.getString("APELLIDOS"));
|
||||
usuario.setEspecialidad(rs.getInt("ESPECIALIDAD"));
|
||||
usuario.setTarifa(rs.getInt("TARIFA"));
|
||||
usuario.setNombreCab(rs.getString("NOMBRE_CAB"));
|
||||
usuario.setDireccionCab(rs.getString("DIRECCION_CAB"));
|
||||
usuario.setPoblacionCab(rs.getString("POBLACION_CAB"));
|
||||
usuario.setTelefonoCab(rs.getString("TELEFONO_CAB"));
|
||||
usuario.setEmailCab(rs.getString("EMAIL_CAB"));
|
||||
usuario.setColegiadoCab(rs.getString("COLEGIADO_CAB"));
|
||||
usuario.setEspecialidadCab(rs.getString("ESPECIALIDAD_CAB"));
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado el usuario " + usuario + " de la tabla TAMEDICO (" + sqlSelect + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
usuario = null;
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de usuario: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan();
|
||||
}
|
||||
|
||||
return usuario;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Modifica el registro correspondiente al usuario conectado marcándolo como bloqueado.
|
||||
* <br>Escribe 'S' en el campo BLOQUEO_CLAVE de la tabla TAMEDICO.
|
||||
* @param codigo El código de usuario que se intenta conectar.
|
||||
* @param fechaAcceso Fecha en la que el usuario ha realizado el acceso a la aplicación. Utilizado para introducir un nuevo registro en la tabla de seguimiento TAREGLOG.
|
||||
* @return El resultado de la actualización en base de datos.
|
||||
* @throws
|
||||
*/
|
||||
public boolean bloquearUsuario(int codigo, Calendar fechaAcceso) throws ExcepcionTarisan
|
||||
{
|
||||
boolean resultado = true;
|
||||
|
||||
StringBuffer sqlUpdate = new StringBuffer();
|
||||
sqlUpdate.append("UPDATE TAMEDICO");
|
||||
sqlUpdate.append(" SET BLOQUEO_CLAVE = ?");
|
||||
sqlUpdate.append(" WHERE MEDICO = ?");
|
||||
|
||||
try
|
||||
{
|
||||
Object[] aValores = new Object[1];
|
||||
aValores[0] = "S";
|
||||
|
||||
Object[] aCondiciones = new Object[1];
|
||||
aCondiciones[0] = Integer.valueOf(codigo);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ParametrosConfiguracion.dataStore.iniciarTransaccion(conexion);
|
||||
|
||||
try
|
||||
{
|
||||
//dejamos al usuario bloqueado
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Llega 332: "+sqlUpdate.toString());
|
||||
resultado = ParametrosConfiguracion.dataStore.actualizar(sqlUpdate.toString(), aValores, aCondiciones, conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Llega 334, ha actualizado ");
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
//insertamos un registro en la tabla tareglog para indicar los movimientos realizados por el usuario
|
||||
Timestamp tsFechaAcceso = new Timestamp(fechaAcceso.getTimeInMillis());
|
||||
PersistenciaTareglog perTareglog = new PersistenciaTareglog();
|
||||
//obtenemos el ultimo valor del campo correlativo de la tabla tareglog.
|
||||
//Este campo es un numero correlativo utilizado para diferenciar las claves.
|
||||
int intUltimoValorCorrelativo = perTareglog.obtenerUltimoValorCorrelativo(codigo, tsFechaAcceso);
|
||||
perTareglog.insertarLog(codigo, tsFechaAcceso, Calendar.getInstance(), intUltimoValorCorrelativo + 1, "TAMEDICO", Utilidades.obtenerSentenciaSQL(sqlUpdate, aValores, aCondiciones), "", conexion);
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
//las actualizaciones han ido bien. Confirmamos la transaccion
|
||||
ParametrosConfiguracion.dataStore.confirmarTransaccion(conexion);
|
||||
}
|
||||
catch (ExcepcionTarisan ex)
|
||||
{
|
||||
ParametrosConfiguracion.dataStore.deshacerTransaccion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "ExcepcionTarisan: " + ex.getMensaje());
|
||||
throw (ExcepcionTarisan)ex;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ParametrosConfiguracion.dataStore.deshacerTransaccion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Exception: " + ex.getMessage());
|
||||
throw new ExcepcionTarisan(ex.getMessage());
|
||||
}
|
||||
finally
|
||||
{
|
||||
//liberamos la conexion
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
}
|
||||
}
|
||||
catch(ExcepcionTarisan ex)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en el bloqueo de usuario: " + ex + " (" + sqlUpdate + ")");
|
||||
throw ex;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Actualiza la fecha de último acceso a la aplicación una vez conectado con éxito.
|
||||
* <br>Escribe la fecha y hora actual en el campo FECHA_ULT_ACCESO de la tabla TAMEDICO.
|
||||
* @param codigo El código de usuario a modificar.
|
||||
* @param calHoy La fecha actual a poner como fecha de último acceso.
|
||||
* @return El resultado de la actualización en base de datos.
|
||||
* @throws
|
||||
*/
|
||||
public boolean actualizarFechaAcceso(int codigo, Calendar calHoy) throws ExcepcionTarisan
|
||||
{
|
||||
boolean resultado = true;
|
||||
Connection conexion = null;
|
||||
|
||||
StringBuffer sqlUpdate = new StringBuffer();
|
||||
sqlUpdate.append("UPDATE TAMEDICO");
|
||||
sqlUpdate.append(" SET FECHA_ULT_ACCESO = ?");
|
||||
sqlUpdate.append(" WHERE MEDICO = ?");
|
||||
|
||||
try
|
||||
{
|
||||
Object[] aValores = new Object[1];
|
||||
aValores[0] = new Timestamp(calHoy.getTimeInMillis());
|
||||
|
||||
Object[] aCondiciones = new Object[1];
|
||||
aCondiciones[0] = Integer.valueOf(codigo);
|
||||
|
||||
resultado = ParametrosConfiguracion.dataStore.actualizar(sqlUpdate.toString(), aValores, aCondiciones);
|
||||
}
|
||||
catch(ExcepcionTarisan ex)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la actualización de la fecha de acceso de usuario: " + ex + " (" + sqlUpdate + ")");
|
||||
throw ex;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public Vector listado_usuarios(int pagina, String strCampoApellido)
|
||||
{
|
||||
int elementosPaginacion = 1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
Tamedico tamedico = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
strSql.append("SELECT APELLIDOS, NOMBRE, MEDICO");
|
||||
strSql.append(" FROM TAMEDICO");
|
||||
Object aCondiciones[] = null;
|
||||
|
||||
//comprobamos si se trata de una busqueda por apellido
|
||||
if (!strCampoApellido.equalsIgnoreCase("")) //la sql tiene una condición de búsqueda
|
||||
{
|
||||
if (strCampoApellido.endsWith("*"))
|
||||
{
|
||||
strCampoApellido=strCampoApellido.replace('*', '%');
|
||||
}
|
||||
else
|
||||
{
|
||||
strCampoApellido="%" + strCampoApellido + "%";
|
||||
}
|
||||
|
||||
aCondiciones = new Object[1];
|
||||
aCondiciones[0] = strCampoApellido;
|
||||
strSql.append(" WHERE APELLIDOS LIKE ?");
|
||||
}
|
||||
else
|
||||
{
|
||||
aCondiciones = new Object[0];
|
||||
}
|
||||
strSql.append(" ORDER BY APELLIDOS, NOMBRE");
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
tamedico = new Tamedico();
|
||||
tamedico.setApellidos(rs.getString("APELLIDOS"));
|
||||
tamedico.setMedico(rs.getInt("MEDICO"));
|
||||
tamedico.setNombre(rs.getString("NOMBRE"));
|
||||
vResultado.addElement(tamedico);
|
||||
if (pagina != 0)
|
||||
{
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TAMEDICO (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + strSql.toString() + ")");
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selecciona los registros de la tabla TAMEDICO en función de la sentencia SELECT indicada.
|
||||
* Retorna la lista con todos los usuarios de la aplicación.
|
||||
* @param sqlSelect La sentencia SELECT de selección.
|
||||
* @param pagina El número de página a mostrar.
|
||||
* @param aCondiciones El array que contiene las condiciones utilizadas en la sentencia SELECT.
|
||||
* @return El Vector con la lista de objetos <code>Tamedico</code> obtenidos.
|
||||
* @throws
|
||||
*/
|
||||
public Vector seleccionar(String sqlSelect, int pagina, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
int elementosPaginacion = 1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
Tamedico tamedico = null;
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect, aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
tamedico = new Tamedico();
|
||||
tamedico.setApellidos(rs.getString("APELLIDOS"));
|
||||
tamedico.setMedico(rs.getInt("MEDICO"));
|
||||
tamedico.setNombre(rs.getString("NOMBRE"));
|
||||
vResultado.addElement(tamedico);
|
||||
if (pagina != 0)
|
||||
{
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TAMEDICO (" + sqlSelect + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public Object seleccionarSimulado(int codigo) throws ExcepcionTarisan
|
||||
{
|
||||
Object retorno = null;
|
||||
Usuario usuario = null;
|
||||
StringBuffer sqlSelect = new StringBuffer();
|
||||
Connection conexion = null;
|
||||
|
||||
try
|
||||
{
|
||||
sqlSelect.append("SELECT MEDICO");
|
||||
sqlSelect.append(", NOMBRE");
|
||||
sqlSelect.append(", APELLIDOS");
|
||||
sqlSelect.append(", ESPECIALIDAD");
|
||||
sqlSelect.append(", TARIFA");
|
||||
sqlSelect.append(", NOMBRE_CAB");
|
||||
sqlSelect.append(", DIRECCION_CAB");
|
||||
sqlSelect.append(", POBLACION_CAB");
|
||||
sqlSelect.append(", TELEFONO_CAB");
|
||||
sqlSelect.append(", EMAIL_CAB");
|
||||
sqlSelect.append(", COLEGIADO_CAB");
|
||||
sqlSelect.append(", ESPECIALIDAD_CAB");
|
||||
sqlSelect.append(", BLOQUEO_CLAVE");
|
||||
sqlSelect.append(", FECHA_ULT_ACCESO");
|
||||
sqlSelect.append(", FECHA_MODIF_CLAVE");
|
||||
sqlSelect.append(", PASSWORD");
|
||||
sqlSelect.append(" FROM TAMEDICO");
|
||||
sqlSelect.append(" WHERE MEDICO = ?");
|
||||
|
||||
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
|
||||
|
||||
Object aCondiciones[] = new Object[1];
|
||||
aCondiciones[0] = Integer.valueOf(codigo);
|
||||
|
||||
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect.toString(), aCondiciones);
|
||||
|
||||
while(rs.next())
|
||||
{
|
||||
|
||||
String nombre = "";
|
||||
if (rs.getString("NOMBRE") != null){
|
||||
nombre = rs.getString("NOMBRE") + " ";
|
||||
}
|
||||
|
||||
String ape = "";
|
||||
if (rs.getString("APELLIDOS") != null){
|
||||
ape = rs.getString("APELLIDOS");
|
||||
}
|
||||
|
||||
String nombreCab = "";
|
||||
if (rs.getString("NOMBRE_CAB") != null){
|
||||
nombreCab = rs.getString("NOMBRE_CAB");
|
||||
}
|
||||
|
||||
usuario = new Usuario();
|
||||
usuario.setMedico(rs.getInt("MEDICO"));
|
||||
usuario.setNombre(nombre + ape);
|
||||
usuario.setEspecialidad(rs.getInt("ESPECIALIDAD"));
|
||||
usuario.setTarifa(rs.getInt("TARIFA"));
|
||||
usuario.setNombreCab(nombreCab);
|
||||
usuario.setDireccionCab(rs.getString("DIRECCION_CAB"));
|
||||
usuario.setPoblacionCab(rs.getString("POBLACION_CAB"));
|
||||
usuario.setTelefonoCab(rs.getString("TELEFONO_CAB"));
|
||||
usuario.setEmailCab(rs.getString("EMAIL_CAB"));
|
||||
usuario.setColegiadoCab(rs.getString("COLEGIADO_CAB"));
|
||||
usuario.setEspecialidadCab(rs.getString("ESPECIALIDAD_CAB"));
|
||||
usuario.setFechaUltAcceso(rs.getTimestamp("FECHA_ULT_ACCESO"));
|
||||
}
|
||||
rs.close();
|
||||
|
||||
|
||||
retorno = usuario;
|
||||
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionado el usuario " + usuario + " de la tabla TAMEDICO (" + sqlSelect + ")");
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
usuario = null;
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de usuario: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
usuario = null;
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de usuario: " + e + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan();
|
||||
}
|
||||
|
||||
return retorno;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,229 @@
|
||||
package com.tarisan.control;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.tarisan.data.Tamedico;
|
||||
import com.tarisan.data.VTtbancosTamedico;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
import com.tarisan.log.LogTarisan;
|
||||
import com.tarisan.log.NivelLog;
|
||||
import com.tarisan.util.Utilidades;
|
||||
|
||||
public class PersistenciaVTTbancosTamedico {
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>.
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selecciona los registros de la JOIN entre tablas TTMEDICO y TTBANCOS en función de la sentencia SELECT indicada.
|
||||
* @param sqlSelect La sentencia SELECT de selección.
|
||||
* @param pagina Número de página a mostrar.
|
||||
* @param aCondiciones Array que contiene los parámetros utilizados en la sentencia SELECT.
|
||||
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code></code>).
|
||||
* @throws
|
||||
*/
|
||||
public Vector seleccionar(String sqlSelect, int pagina, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
int elementosPaginacion=1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
VTtbancosTamedico vTtbancosTamedico = null;
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect, aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
vTtbancosTamedico = new VTtbancosTamedico();
|
||||
vTtbancosTamedico.setNif(rs.getString("NIF"));
|
||||
vTtbancosTamedico.setNombre(rs.getString("NOMBRE"));
|
||||
vTtbancosTamedico.setApellidos(rs.getString("APELLIDOS"));
|
||||
vTtbancosTamedico.setDireccion(rs.getString("DIRECCION"));
|
||||
vTtbancosTamedico.setCp(rs.getString("CP"));
|
||||
vTtbancosTamedico.setPoblacion(rs.getString("POBLACION"));
|
||||
vTtbancosTamedico.setDescripcion(rs.getString("DESCRIPCION"));
|
||||
vTtbancosTamedico.setIban_sucursal(rs.getInt("IBAN_SUCURSAL"));
|
||||
vTtbancosTamedico.setIban_cuenta(rs.getString("IBAN_CUENTA"));
|
||||
vTtbancosTamedico.setMes(rs.getString("MES"));
|
||||
vTtbancosTamedico.setFecha_factura(rs.getDate("FECHA_FACTURA"));
|
||||
vTtbancosTamedico.setFactura(rs.getInt("FACTURA"));
|
||||
vTtbancosTamedico.setCla(rs.getString("CLA"));
|
||||
vResultado.addElement(vTtbancosTamedico);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de las tablas TTBANCOS, TTMEDICO y TALIQUIMEDI (" + sqlSelect + ")");
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTBANCOS, TTMEDICO y TALIQUIMEDI: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTBANCOS, TTMEDICO y TALIQUIMEDI: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTBANCOS, TTMEDICO y TALIQUIMEDI: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTBANCOS, TTMEDICO y TALIQUIMEDI: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public Vector seleccionar_reducido(String sqlSelect, int pagina, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
int elementosPaginacion=1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
VTtbancosTamedico vTtbancosTamedico = null;
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect, aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
vTtbancosTamedico = new VTtbancosTamedico();
|
||||
vTtbancosTamedico.setNif(rs.getString("NIF"));
|
||||
vTtbancosTamedico.setNombre(rs.getString("NOMBRE"));
|
||||
vTtbancosTamedico.setApellidos(rs.getString("APELLIDOS"));
|
||||
vTtbancosTamedico.setDireccion(rs.getString("DIRECCION"));
|
||||
vTtbancosTamedico.setCp(rs.getString("CP"));
|
||||
vTtbancosTamedico.setPoblacion(rs.getString("POBLACION"));
|
||||
vTtbancosTamedico.setDescripcion(rs.getString("DESCRIPCION"));
|
||||
vTtbancosTamedico.setIban_sucursal(rs.getInt("IBAN_SUCURSAL"));
|
||||
vTtbancosTamedico.setIban_cuenta(rs.getString("IBAN_CUENTA"));
|
||||
vResultado.addElement(vTtbancosTamedico);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de las tablas TTBANCOS y TTMEDICO (" + sqlSelect + ")");
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTBANCOS y TTMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTBANCOS y TTMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTBANCOS y TTMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTBANCOS y TTMEDICO: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
|
||||
public Vector obtenerMedico_por_medico_origen(int medico, int intPagina)
|
||||
{
|
||||
Vector resul = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
|
||||
Object [] aCondiciones = new Object[1];
|
||||
String consulta = "";
|
||||
|
||||
strSql.append("select distinct(ttmedico.nombre), ttmedico.apellidos, ttmedico.direccion, ttmedico.cp, ttmedico.poblacion, nif, ttbancos.descripcion, iban_sucursal, iban_cuenta");
|
||||
strSql.append(" from ttmedico, TTBANCOS");
|
||||
strSql.append(" where ttmedico.medico = ?");
|
||||
strSql.append(" and ttmedico.iban_banco = ttbancos.iban_banco");
|
||||
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
|
||||
try {
|
||||
resul = this.seleccionar_reducido(strSql.toString(),intPagina, aCondiciones);
|
||||
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTBANCOS_TTMEDICO (obtenerMedico): " + e + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
public Vector obtenerMedico_por_medico_y_mes(int medico, String mes, int intPagina)
|
||||
{
|
||||
Vector resul = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
|
||||
Object [] aCondiciones = new Object[2];
|
||||
String consulta = "";
|
||||
|
||||
strSql.append("select distinct(ttmedico.nombre), ttmedico.apellidos, ttmedico.direccion, ttmedico.cp, ttmedico.poblacion, concat(mes, concat('/',año)) mes, fecha_factura, factura, nif, ttbancos.descripcion, iban_sucursal, iban_cuenta, (select ttmedico.cla from ttmedico where ttmedico.medico = taliquimedi.medico_origen) cla");
|
||||
strSql.append(" from ttmedico, taliquimedi,TTBANCOS");
|
||||
strSql.append(" where ttmedico.medico = ?");
|
||||
strSql.append(" AND ttmedico.MEDICO = TALIQUIMEDI.MEDICO");
|
||||
strSql.append(" and concat(mes, concat('/',año)) = ?");
|
||||
strSql.append(" and ttmedico.iban_banco = ttbancos.iban_banco");
|
||||
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
aCondiciones[1] = new String(mes);
|
||||
|
||||
try {
|
||||
resul = this.seleccionar(strSql.toString(),intPagina, aCondiciones);
|
||||
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TTBANCOS_TTMEDICO_TALIQUIMEDI (obtenerMedico): " + e + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.tarisan.control;
|
||||
|
||||
public class PersistenciaVTagruanaTtactmed {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,479 @@
|
||||
/**
|
||||
* @(#) PersistenciaVTamovextTaclient.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.VTamovextTaclient;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.util.Utilidades;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
|
||||
import java.sql.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>VTamovextTaclient</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaVTamovextTaclient
|
||||
{
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>.
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
public Vector detalle_pacientes(Integer medico, Integer especialidad, java.sql.Date dtFecha)
|
||||
{
|
||||
Vector resultado = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
String consulta = "";
|
||||
Object[] aCondiciones=null;
|
||||
/*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 tamovext.entidad=ttbenefi.entidad");
|
||||
strSql.append(" and ttbenefi.cliente=ttclient.cliente");
|
||||
strSql.append(" and ttbenefi.fecha_baja is null");
|
||||
strSql.append(" and tamovext.fecha=?");
|
||||
strSql.append(" ORDER BY tamovext.fecha"); */
|
||||
|
||||
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 tamovext.entidad=ttbenefi.entidad");
|
||||
strSql.append(" and ttbenefi.cliente=ttclient.cliente");
|
||||
strSql.append(" and ttbenefi.fecha_baja is null");
|
||||
strSql.append(" and tamovext.fecha=?");
|
||||
strSql.append(" ORDER BY tamovext.fecha");
|
||||
|
||||
aCondiciones = new Object[3];
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
aCondiciones[1] = Integer.valueOf(especialidad);
|
||||
aCondiciones[2] = dtFecha;
|
||||
|
||||
try {
|
||||
resultado = this.seleccionar(strSql.toString(), 0, aCondiciones);
|
||||
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT-TACLIENT: " + e.toString() + " (" + consulta + ")");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public Vector detalle_paciente(int pagina, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
int elementosPaginacion = 1;
|
||||
Vector vResultado = new Vector();
|
||||
VTamovextTaclient VtamovextTaclient = null;
|
||||
String consulta = "";
|
||||
|
||||
SimpleDateFormat sdfFormateadorFechaSelect = new SimpleDateFormat("MM/yyyy");
|
||||
java.sql.Date dtFecha = new java.sql.Date(Calendar.getInstance().getTime().getTime());
|
||||
sdfFormateadorFechaSelect.format(dtFecha);
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
strSql.append("SELECT tamovext.autorizacion, tamovext.fecha, tamovext.acto, tamovext.colectivo, tamovext.poliza, tamovext.orden, tamovext.numseq, tamovext.medico, tamovext.especialidad, tamovext.precio as precioActoMedico, ttactmed.descripcion as descripcionActoMedico, ttclient.nombre, ttclient.apellidos FROM tamovext, ttactmed, ttbenefi, ttclient WHERE tamovext.acto=ttactmed.acto and tamovext.especialidad=ttactmed.especialidad and tamovext.medico=? and tamovext.especialidad=? and tamovext.colectivo=ttbenefi.colectivo");
|
||||
strSql.append(" and tamovext.poliza=ttbenefi.poliza and tamovext.orden=ttbenefi.orden and tamovext.entidad=ttbenefi.entidad and ttbenefi.cliente=ttclient.cliente and (ttbenefi.fecha_baja is null OR ttbenefi.fecha_baja > sysdate) and tamovext.fecha >= to_date('01/");
|
||||
strSql.append(sdfFormateadorFechaSelect.format(dtFecha));
|
||||
strSql.append("','dd/mm/yyyy') union");
|
||||
strSql.append(" select tamovext.autorizacion, tamovext.fecha, tamovext.acto, tamovext.colectivo, tamovext.poliza, tamovext.orden, tamovext.numseq, tamovext.medico, tamovext.especialidad, tamovext.precio as precioActoMedico, ttactmed.descripcion descripcionActoMedico, TADESPLAZ.NOMBRE_COMPLETO nombre, ' ' as apellidos from tamovext, ttactmed, tadesplaz");
|
||||
//strSql.append(" where TAMOVEXT.TALON_CHIPCARD is not null and trim(TAMOVEXT.TARJETA_CHIPCARD) = trim(TADESPLAZ.TARJETA_CHIPCARD) and TADESPLAZ.TRATADO = 0");
|
||||
strSql.append(" where trim(TAMOVEXT.TARJETA_CHIPCARD) = trim(TADESPLAZ.TARJETA_CHIPCARD) and TADESPLAZ.TRATADO = 0");
|
||||
strSql.append(" and tamovext.acto=ttactmed.acto and tamovext.especialidad=ttactmed.especialidad and tamovext.medico=? and tamovext.especialidad=? and tamovext.fecha >= to_date('01/");
|
||||
strSql.append(sdfFormateadorFechaSelect.format(dtFecha));
|
||||
strSql.append("','dd/mm/yyyy') ");
|
||||
strSql.append(" order by fecha desc");
|
||||
|
||||
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if(objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
VtamovextTaclient = new VTamovextTaclient();
|
||||
VtamovextTaclient.setFecha(rs.getDate("FECHA"));
|
||||
VtamovextTaclient.setNombre(rs.getString("NOMBRE"));
|
||||
VtamovextTaclient.setApellidos(rs.getString("APELLIDOS"));
|
||||
VtamovextTaclient.setDescripcionActoMedico(rs.getString("DESCRIPCIONACTOMEDICO"));
|
||||
VtamovextTaclient.setPrecioActoMedico(rs.getDouble("PRECIOACTOMEDICO"));
|
||||
VtamovextTaclient.setActo(rs.getInt("ACTO"));
|
||||
VtamovextTaclient.setColec(rs.getInt("COLECTIVO"));
|
||||
VtamovextTaclient.setPoliza(rs.getDouble("POLIZA"));
|
||||
VtamovextTaclient.setOrden(rs.getInt("ORDEN"));
|
||||
VtamovextTaclient.setNumseq(rs.getInt("NUMSEQ"));
|
||||
VtamovextTaclient.setMedico(rs.getInt("MEDICO"));
|
||||
VtamovextTaclient.setEspecialidad(rs.getInt("ESPECIALIDAD"));
|
||||
VtamovextTaclient.setAutorizacion(rs.getLong("AUTORIZACION"));
|
||||
vResultado.addElement(VtamovextTaclient);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados "+vResultado.size() + " detalle paciente.");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT: " + sqle + " (" + consulta + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT: " + sqle + " (" + consulta + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT: " + sqle + " (" + consulta + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT: " + sqle + " (" + consulta + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public Vector detalle_paciente_tamovext_espia(int pagina, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
int elementosPaginacion = 1;
|
||||
Vector vResultado = new Vector();
|
||||
VTamovextTaclient VtamovextTaclient = null;
|
||||
String consulta = "";
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
|
||||
/*strSql.append("SELECT tamovext_espia.autorizacion, tamovext_espia.fecha, tamovext_espia.acto, tamovext_espia.colectivo, tamovext_espia.poliza, tamovext_espia.orden, tamovext_espia.numseq, tamovext_espia.medico, tamovext_espia.especialidad, tamovext_espia.precio AS precioActoMedico, ttactmed.descripcion AS descripcionActoMedico, ttclient.nombre,ttclient.apellidos");
|
||||
strSql.append(" FROM tamovext_espia, ttactmed, ttbenefi, ttclient");
|
||||
strSql.append(" WHERE tamovext_espia.acto = ttactmed.acto AND tamovext_espia.especialidad = ttactmed.especialidad AND tamovext_espia.medico = ? AND tamovext_espia.especialidad = ? AND tamovext_espia.borrado = 0 AND tamovext_espia.colectivo = ttbenefi.colectivo AND tamovext_espia.poliza = ttbenefi.poliza AND tamovext_espia.orden = ttbenefi.orden");
|
||||
strSql.append(" AND tamovext_espia.entidad = ttbenefi.entidad AND ttbenefi.cliente = ttclient.cliente AND (ttbenefi.fecha_baja IS NULL OR ttbenefi.fecha_baja > SYSDATE) AND tamovext_espia.fecha >= TO_DATE ('01/?', 'dd/mm/yyyy') AND tamovext_espia.fecha <= TRUNC(LAST_DAY(TO_DATE ('01/?', 'dd/mm/yyyy')))");
|
||||
strSql.append(" UNION");
|
||||
strSql.append(" SELECT tamovext_espia.autorizacion, tamovext_espia.fecha, tamovext_espia.acto, tamovext_espia.colectivo, tamovext_espia.poliza, tamovext_espia.orden, tamovext_espia.numseq, tamovext_espia.medico, tamovext_espia.especialidad, tamovext_espia.precio AS precioActoMedico, ttactmed.descripcion descripcionActoMedico, TADESPLAZ.NOMBRE_COMPLETO nombre, ' ' AS apellidos");
|
||||
strSql.append(" FROM tamovext_espia, ttactmed, tadesplaz");
|
||||
strSql.append(" WHERE TRIM (tamovext_espia.TARJETA_CHIPCARD) = TRIM (TADESPLAZ.TARJETA_CHIPCARD) AND TADESPLAZ.TRATADO = 0 AND tamovext_espia.acto = ttactmed.acto AND tamovext_espia.especialidad = ttactmed.especialidad AND tamovext_espia.medico = ?");
|
||||
strSql.append(" AND tamovext_espia.especialidad = ? AND tamovext_espia.borrado = 0 AND tamovext_espia.fecha >= TO_DATE ('01/?', 'dd/mm/yyyy') AND tamovext_espia.fecha <= TRUNC(LAST_DAY(TO_DATE ('01/?', 'dd/mm/yyyy')))");
|
||||
strSql.append(" ORDER BY fecha DESC");*/
|
||||
|
||||
strSql.append("SELECT tamovext_espia.autorizacion, tamovext_espia.fecha, tamovext_espia.acto, tamovext_espia.colectivo, tamovext_espia.poliza, tamovext_espia.orden, tamovext_espia.numseq, tamovext_espia.medico, tamovext_espia.especialidad, tamovext_espia.precio AS precioActoMedico, ttactmed.descripcion AS descripcionActoMedico, ttclient.nombre,ttclient.apellidos");
|
||||
strSql.append(" FROM tamovext_espia, ttactmed, ttbenefi, ttclient");
|
||||
strSql.append(" WHERE tamovext_espia.acto = ttactmed.acto AND tamovext_espia.especialidad = ttactmed.especialidad AND tamovext_espia.medico = ? AND tamovext_espia.especialidad = ? AND tamovext_espia.borrado = 0 AND tamovext_espia.colectivo = ttbenefi.colectivo AND tamovext_espia.poliza = ttbenefi.poliza AND tamovext_espia.orden = ttbenefi.orden");
|
||||
strSql.append(" AND tamovext_espia.entidad = ttbenefi.entidad AND ttbenefi.cliente = ttclient.cliente AND tamovext_espia.fecha >= TO_DATE ('01/?', 'dd/mm/yyyy') AND tamovext_espia.fecha <= TRUNC(LAST_DAY(TO_DATE ('01/?', 'dd/mm/yyyy')))");
|
||||
strSql.append(" UNION");
|
||||
strSql.append(" SELECT tamovext_espia.autorizacion, tamovext_espia.fecha, tamovext_espia.acto, tamovext_espia.colectivo, tamovext_espia.poliza, tamovext_espia.orden, tamovext_espia.numseq, tamovext_espia.medico, tamovext_espia.especialidad, tamovext_espia.precio AS precioActoMedico, ttactmed.descripcion descripcionActoMedico, TADESPLAZ.NOMBRE_COMPLETO nombre, ' ' AS apellidos");
|
||||
strSql.append(" FROM tamovext_espia, ttactmed, tadesplaz");
|
||||
strSql.append(" WHERE TRIM (tamovext_espia.TARJETA_CHIPCARD) = TRIM (TADESPLAZ.TARJETA_CHIPCARD) AND TADESPLAZ.TRATADO = 0 AND tamovext_espia.acto = ttactmed.acto AND tamovext_espia.especialidad = ttactmed.especialidad AND tamovext_espia.medico = ?");
|
||||
strSql.append(" AND tamovext_espia.especialidad = ? AND tamovext_espia.borrado = 0 AND tamovext_espia.fecha >= TO_DATE ('01/?', 'dd/mm/yyyy') AND tamovext_espia.fecha <= TRUNC(LAST_DAY(TO_DATE ('01/?', 'dd/mm/yyyy')))");
|
||||
strSql.append(" ORDER BY fecha DESC");
|
||||
|
||||
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
//ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, consulta);
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if(objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
VtamovextTaclient = new VTamovextTaclient();
|
||||
VtamovextTaclient.setFecha(rs.getDate("FECHA"));
|
||||
VtamovextTaclient.setNombre(rs.getString("NOMBRE"));
|
||||
VtamovextTaclient.setApellidos(rs.getString("APELLIDOS"));
|
||||
VtamovextTaclient.setDescripcionActoMedico(rs.getString("DESCRIPCIONACTOMEDICO"));
|
||||
VtamovextTaclient.setPrecioActoMedico(rs.getDouble("PRECIOACTOMEDICO"));
|
||||
VtamovextTaclient.setActo(rs.getInt("ACTO"));
|
||||
VtamovextTaclient.setColec(rs.getInt("COLECTIVO"));
|
||||
VtamovextTaclient.setPoliza(rs.getDouble("POLIZA"));
|
||||
VtamovextTaclient.setOrden(rs.getInt("ORDEN"));
|
||||
VtamovextTaclient.setNumseq(rs.getInt("NUMSEQ"));
|
||||
VtamovextTaclient.setMedico(rs.getInt("MEDICO"));
|
||||
VtamovextTaclient.setEspecialidad(rs.getInt("ESPECIALIDAD"));
|
||||
VtamovextTaclient.setAutorizacion(rs.getLong("AUTORIZACION"));
|
||||
vResultado.addElement(VtamovextTaclient);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados "+vResultado.size() + " detalle paciente.");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT_ESPIA: " + sqle + " (" + consulta + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT_ESPIA: " + sqle + " (" + consulta + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT_ESPIA: " + sqle + " (" + consulta + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT_ESPIA: " + sqle + " (" + consulta + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selecciona los registros de la JOIN entre las tablas TAMOVEXT y ttclient en función de la sentencia SELECT indicada.
|
||||
* @param sqlSelect La sentencia SELECT de selección.
|
||||
* @param pagina Número de página a mostrar.
|
||||
* @param aCondiciones Array que contiene los parámetros utilizados en la sentencia SELECT.
|
||||
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code>VTamovextTaclient</code>).
|
||||
* @throws
|
||||
*/
|
||||
public Vector seleccionar(String sqlSelect, int pagina, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
int elementosPaginacion=1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
VTamovextTaclient VtamovextTaclient = null;
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect, aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
VtamovextTaclient = new VTamovextTaclient();
|
||||
VtamovextTaclient.setFecha(rs.getDate("FECHA"));
|
||||
VtamovextTaclient.setNombre(rs.getString("NOMBRE"));
|
||||
VtamovextTaclient.setApellidos(rs.getString("APELLIDOS"));
|
||||
VtamovextTaclient.setDescripcionActoMedico(rs.getString("DESCRIPCIONACTOMEDICO"));
|
||||
VtamovextTaclient.setPrecioActoMedico(rs.getDouble("PRECIOACTOMEDICO"));
|
||||
vResultado.addElement(VtamovextTaclient);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TAMOVEXT (" + sqlSelect + ")");
|
||||
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public Vector detalle_paciente_diario(int pagina, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
int elementosPaginacion = 1;
|
||||
Vector vResultado = new Vector();
|
||||
VTamovextTaclient VtamovextTaclient = null;
|
||||
String consulta = "";
|
||||
String hoy = "";
|
||||
|
||||
SimpleDateFormat sdfFormateadorFechaSelect = new SimpleDateFormat("dd/MM/yyyy");
|
||||
java.sql.Date dtFecha = new java.sql.Date(Calendar.getInstance().getTime().getTime());
|
||||
hoy = sdfFormateadorFechaSelect.format(dtFecha);
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
strSql.append("SELECT tamovext.fecha, tamovext.precio as precioActoMedico, ttactmed.descripcion as descripcionActoMedico, ttclient.nombre, ttclient.apellidos FROM tamovext, ttactmed, ttbenefi, ttclient WHERE tamovext.acto=ttactmed.acto and tamovext.especialidad=ttactmed.especialidad and tamovext.medico=? and tamovext.especialidad=? and tamovext.colectivo=ttbenefi.colectivo");
|
||||
strSql.append(" and tamovext.poliza=ttbenefi.poliza and tamovext.orden=ttbenefi.orden and tamovext.entidad=ttbenefi.entidad and ttbenefi.cliente=ttclient.cliente and (ttbenefi.fecha_baja is null OR ttbenefi.fecha_baja > sysdate) and tamovext.fecha = '" + hoy + "'");
|
||||
strSql.append(" union");
|
||||
strSql.append(" select tamovext.fecha, tamovext.precio as precioActoMedico, ttactmed.descripcion descripcionActoMedico, TADESPLAZ.NOMBRE_COMPLETO nombre, ' ' as apellidos from tamovext, ttactmed, tadesplaz");
|
||||
//strSql.append(" where TAMOVEXT.TALON_CHIPCARD is not null and trim(TAMOVEXT.TARJETA_CHIPCARD) = trim(TADESPLAZ.TARJETA_CHIPCARD) and TADESPLAZ.TRATADO = 0");
|
||||
strSql.append(" where trim(TAMOVEXT.TARJETA_CHIPCARD) = trim(TADESPLAZ.TARJETA_CHIPCARD) and TADESPLAZ.TRATADO = 0");
|
||||
strSql.append(" and tamovext.acto=ttactmed.acto and tamovext.especialidad=ttactmed.especialidad and tamovext.medico=? and tamovext.especialidad=? and tamovext.fecha = '" + hoy + "'");
|
||||
strSql.append(" order by fecha desc");
|
||||
|
||||
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if(objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
VtamovextTaclient = new VTamovextTaclient();
|
||||
VtamovextTaclient.setFecha(rs.getDate("FECHA"));
|
||||
VtamovextTaclient.setNombre(rs.getString("NOMBRE"));
|
||||
VtamovextTaclient.setApellidos(rs.getString("APELLIDOS"));
|
||||
VtamovextTaclient.setDescripcionActoMedico(rs.getString("DESCRIPCIONACTOMEDICO"));
|
||||
VtamovextTaclient.setPrecioActoMedico(rs.getDouble("PRECIOACTOMEDICO"));
|
||||
vResultado.addElement(VtamovextTaclient);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados "+vResultado.size() + " detalle paciente.");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT: " + sqle + " (" + consulta + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT: " + sqle + " (" + consulta + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT: " + sqle + " (" + consulta + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT: " + sqle + " (" + consulta + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public boolean borrar_acto(int medico, String fecha, int acto, int col, double pol, int ord, int espe, int numseq, long auto)
|
||||
{
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
Connection conexion = null;
|
||||
String consulta = "";
|
||||
String consulta2 = "";
|
||||
|
||||
strSql.append("delete from tamovext");
|
||||
strSql.append(" where medico = ?");
|
||||
strSql.append(" and fecha = ?");
|
||||
strSql.append(" and acto = ?");
|
||||
strSql.append(" and colectivo = ?");
|
||||
strSql.append(" and poliza = ?");
|
||||
strSql.append(" and orden = ?");
|
||||
strSql.append(" and especialidad = ?");
|
||||
strSql.append(" and numseq = ?");
|
||||
|
||||
aCondiciones = new Object[8];
|
||||
aCondiciones[0]=Integer.valueOf(medico);
|
||||
aCondiciones[1]=new String(fecha);
|
||||
aCondiciones[2]=Integer.valueOf(acto);
|
||||
aCondiciones[3]=Integer.valueOf(col);
|
||||
aCondiciones[4]=Double.valueOf(pol);
|
||||
aCondiciones[5]=Integer.valueOf(ord);
|
||||
aCondiciones[6]=Integer.valueOf(espe);
|
||||
aCondiciones[7]=Integer.valueOf(numseq);
|
||||
|
||||
consulta="update tamovext_espia";
|
||||
consulta+=" set borrado = 1";
|
||||
consulta+=" where medico = "+medico;
|
||||
consulta+=" and fecha = '"+fecha+"'";
|
||||
consulta+=" and acto = "+acto;
|
||||
consulta+=" and colectivo = "+col;
|
||||
consulta+=" and poliza = "+pol;
|
||||
consulta+=" and orden = "+ord;
|
||||
consulta+=" and especialidad = "+espe;
|
||||
consulta+=" and numseq = "+numseq;
|
||||
|
||||
consulta2="update taconaut";
|
||||
consulta2+=" set cantidad = cantidad + 1";
|
||||
consulta2+=" where autorizacion = "+auto;
|
||||
|
||||
try
|
||||
{
|
||||
conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ParametrosConfiguracion.dataStore.iniciarTransaccion(conexion);
|
||||
ParametrosConfiguracion.dataStore.borrar(strSql.toString(), aCondiciones, conexion);
|
||||
ParametrosConfiguracion.dataStore.actualizar(consulta, conexion);
|
||||
if ((acto == 1964 && espe==37) || (acto == 6004 && espe==50) || (acto == 6005 && espe==50) || (acto == 6006 && espe==50) || (acto == 6007 && espe==50) || (acto == 6008 && espe==50) || (acto == 6010 && espe==50)){
|
||||
ParametrosConfiguracion.dataStore.actualizar(consulta2, conexion);
|
||||
}
|
||||
ParametrosConfiguracion.dataStore.confirmarTransaccion(conexion);
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Registro eliminado de la tabla TAMOVEXT (" + strSql.toString() + ")");
|
||||
return true;
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la eliminacion de TAMOVEXT: " + sqle + " (" + strSql.toString() + ")");
|
||||
return false;
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la eliminacion de TAMOVEXT: " + sqle + " (" + strSql.toString() + ")");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
/**
|
||||
* @(#) PersistenciaVTamovextttactmed.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.VTamovextTtactmed;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.util.Utilidades;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>VTamovextttactmed</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaVTamovextTtactmed
|
||||
{
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>.
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selecciona los registros de la JOIN entre las tablas TAMOVEXT y ttactmed en función de la sentencia SELECT indicada.
|
||||
* @param sqlSelect La sentencia SELECT de selección.
|
||||
* @param pagina Número de página a mostrar.
|
||||
* @param aCondiciones Array que contiene los parámetros utilizados en la sentencia SELECT.
|
||||
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code>VTamovextttactmed</code>).
|
||||
* @throws
|
||||
*/
|
||||
public Vector seleccionar(String sqlSelect, int pagina, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
int elementosPaginacion=1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
VTamovextTtactmed Vtamovextttactmed = null;
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect, aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
Vtamovextttactmed = new VTamovextTtactmed();
|
||||
Vtamovextttactmed.setActo(rs.getInt("ACTO"));
|
||||
Vtamovextttactmed.setDescripcionActoMedico(rs.getString("DESCRIPCIONACTOMEDICO"));
|
||||
Vtamovextttactmed.setCantidad(rs.getInt("CANTIDAD"));
|
||||
Vtamovextttactmed.setPrecioActoMedico(rs.getDouble("PRECIOACTOMEDICO"));
|
||||
Vtamovextttactmed.setImporteActoMedico(Vtamovextttactmed.getCantidad() * Vtamovextttactmed.getPrecioActoMedico());
|
||||
vResultado.addElement(Vtamovextttactmed);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TAMOVEXT (" + sqlSelect + ")");
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAMOVEXT: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public Vector listado_liquidaciones_por_medico(int medico, int especialidad, String fecha, int intPagina)
|
||||
{
|
||||
Vector resul = new Vector();
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
|
||||
Object [] aCondiciones = new Object[2];
|
||||
String consulta = "";
|
||||
|
||||
strSql.append("SELECT TAMOVEXT.Acto, Count(TAMOVEXT.Acto) as cantidad, TAMOVEXT.Precio as precioActoMedico, TTACTMED.descripcion as descripcionActoMedico");
|
||||
strSql.append(" FROM TAMOVEXT, TTACTMED");
|
||||
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.fecha >= to_date('01/");
|
||||
strSql.append(fecha);
|
||||
strSql.append("','dd/mm/yyyy')");
|
||||
strSql.append(" GROUP BY TAMOVEXT.Acto, TAMOVEXT.Precio, TTACTMED.descripcion");
|
||||
strSql.append(" ORDER BY TAMOVEXT.Acto ASC");
|
||||
|
||||
aCondiciones[0] = Integer.valueOf( medico);
|
||||
aCondiciones[1] = Integer.valueOf( especialidad );
|
||||
|
||||
|
||||
try {
|
||||
resul = this.seleccionar(strSql.toString(), intPagina, aCondiciones);
|
||||
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de Tamovext-ttactmed (listado_liquidaciones_por_medico): " + e + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,271 @@
|
||||
/*
|
||||
* Created on 14-dic-2005
|
||||
*
|
||||
* TODO To change the template for this generated file go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
package com.tarisan.control;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.Date;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Vector;
|
||||
|
||||
import com.tarisan.data.Paciente;
|
||||
import com.tarisan.data.Ttrayos;
|
||||
import com.tarisan.data.VTaresanaTaclient;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
import com.tarisan.log.LogTarisan;
|
||||
import com.tarisan.log.NivelLog;
|
||||
import com.tarisan.util.DES;
|
||||
import com.tarisan.util.Utilidades;
|
||||
|
||||
/**
|
||||
* @author Roumen
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class PersistenciaVTaprescaTaclient {
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>.
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selecciona los registros de la JOIN entre las tablas TARESANA y ttclient en función de la sentencia SELECT indicada.
|
||||
* @param sqlSelect La sentencia SELECT de selección.
|
||||
* @param pagina Número de página a mostrar.
|
||||
* @param aCondiciones Array que contiene los parámetros utilizados en la sentencia SELECT.
|
||||
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code>VTaresanaTaclient</code>).
|
||||
* @throws
|
||||
*/
|
||||
public Vector seleccionar(String sqlSelect, int pagina, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
int elementosPaginacion=1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
VTaresanaTaclient VtaresanaTaclient = null;
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect, aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
VtaresanaTaclient = new VTaresanaTaclient();
|
||||
VtaresanaTaclient.setFecha(rs.getDate("FECHA"));
|
||||
VtaresanaTaclient.setAutorizacion(rs.getInt("AUTORIZACION"));
|
||||
VtaresanaTaclient.setNombre(rs.getString("NOMBRE"));
|
||||
VtaresanaTaclient.setApellidos(rs.getString("APELLIDOS"));
|
||||
vResultado.addElement(VtaresanaTaclient);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla tapresca_tarisan (" + sqlSelect + ")");
|
||||
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de tapresca_tarisan: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
public Vector listado_analisis_por_prescriptor(int medico, int intPagina)
|
||||
{
|
||||
Vector resul = new Vector();
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
|
||||
Object [] aCondiciones = new Object[1];
|
||||
String consulta = "";
|
||||
|
||||
strSql.append("SELECT tapresca_tarisan.fecha, ttclient.nombre, ttclient.apellidos, tapresca_tarisan.autorizacion");
|
||||
strSql.append(" FROM tapresca_tarisan, ttbenefi, ttclient");
|
||||
strSql.append(" WHERE tapresca_tarisan.prescriptor=?");
|
||||
strSql.append(" and tapresca_tarisan.colec=ttbenefi.colectivo");
|
||||
strSql.append(" and tapresca_tarisan.especialidad=4");
|
||||
strSql.append(" and tapresca_tarisan.poliza=ttbenefi.poliza");
|
||||
strSql.append(" and tapresca_tarisan.orden=ttbenefi.orden");
|
||||
strSql.append(" and ttbenefi.cliente=ttclient.cliente");
|
||||
strSql.append(" and ttbenefi.fecha_baja is null");
|
||||
strSql.append(" GROUP BY tapresca_tarisan.fecha, ttclient.nombre, ttclient.apellidos, tapresca_tarisan.autorizacion");
|
||||
strSql.append(" ORDER BY tapresca_tarisan.fecha DESC, tapresca_tarisan.autorizacion DESC");
|
||||
|
||||
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
|
||||
|
||||
try {
|
||||
resul = this.seleccionar(strSql.toString(), intPagina, aCondiciones);
|
||||
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de Tapresca-taclient (listado_analisis_por_prescriptor): " + e + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
public Vector listado_diagnostico_gpc_por_cliente(String numafil, int intPagina)
|
||||
{
|
||||
Vector resul = new Vector();
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
|
||||
Object [] aCondiciones = new Object[1];
|
||||
String consulta = "";
|
||||
|
||||
strSql.append("select NOMBRE, APELLIDOS,FECHA, AUTORIZACION, PRESCRIPTOR FROM (");
|
||||
strSql.append("SELECT deCode(novahis.EPISODIOS.TIPO_EPISODIO_PK,1,'URG',2,'CEX','HOSP') as NOMBRE,novahis.r_mexp.desc_exp as APELLIDOS, novahis.EPISODIOS.EPIS_APERTURA_FECH AS FECHA, ");
|
||||
strSql.append("novahis.r_xexplo.cod_explo AS AUTORIZACION, NOVAHIS.fpersona.CODIGO_PERSONAL PRESCRIPTOR ");
|
||||
strSql.append("FROM novahis.clientes, novahis.r_xexplo, novahis.r_xrecep, novahis.servicios, novahis.fpersona, novahis.actividad, novahis.episodios, novahis.r_mexp, novahis.Co_cli_planes, novahis.cliente_pagadores ");
|
||||
strSql.append("WHERE novahis.co_cli_planes.num_afil = ?");
|
||||
strSql.append(" and novahis.co_cli_planes.CLIPAG_PK = novahis.cliente_pagadores.CLIPAG_PK");
|
||||
strSql.append(" and novahis.cliente_pagadores.CODIGO_CLIENTE = novahis.r_xrecep.codigo_cliente");
|
||||
strSql.append(" AND novahis.servicios.codigo_servicio = novahis.r_xrecep.codigo_servicio");
|
||||
strSql.append(" AND novahis.r_xrecep.cod_recepcion = novahis.r_xexplo.cod_recepcion ");
|
||||
strSql.append(" AND novahis.r_xrecep.codigo_cliente = novahis.clientes.codigo_cliente");
|
||||
strSql.append(" AND novahis.r_xrecep.rechazo IS NULL");
|
||||
strSql.append(" AND novahis.r_xrecep.codigo_personal = novahis.fpersona.codigo_personal");
|
||||
strSql.append(" AND novahis.r_xrecep.ref_nhactividad = novahis.ACTIVIDAD.ACTIVIDAD_PK");
|
||||
strSql.append(" AND novahis.ACTIVIDAD.EPIS_PK = novahis.episodios.epis_pk");
|
||||
strSql.append(" AND novahis.EPISODIOS.CODIGO_CLIENTE = novahis.CLIENTES.CODIGO_CLIENTE");
|
||||
strSql.append(" AND novahis.R_XEXPLO.COD_RECEPCION = novahis.r_xrecep.cod_recepcion");
|
||||
strSql.append(" AND novahis.r_xexplo.cod_exp_id = novahis.r_mexp.cod_exp_id)");
|
||||
|
||||
|
||||
aCondiciones[0] = new String(numafil);
|
||||
|
||||
|
||||
try {
|
||||
resul = this.seleccionar(strSql.toString(), intPagina, aCondiciones);
|
||||
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de Tapresca-taclient (listado_diagnostico_gpc_por_cliente): " + e + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
public Vector listado_rx_por_paciente(String colec, String pol, String ord, Date fecha, int medico, int intPagina) throws SQLException
|
||||
{
|
||||
int elementosPaginacion=1;
|
||||
Vector resul = new Vector();
|
||||
Ttrayos ttrayos = null;
|
||||
String fecha_texto = fecha.toString();
|
||||
String strMedico = ""+medico;
|
||||
|
||||
int longitud = colec.length();
|
||||
for(int i = 0; i < 5 - longitud ; i++)
|
||||
{
|
||||
colec = "0" + colec;
|
||||
}
|
||||
longitud = pol.length();
|
||||
for(int i = 0; i < (12 - longitud); i++)
|
||||
{
|
||||
pol = "0" + pol;
|
||||
}
|
||||
longitud = ord.length();
|
||||
for(int i = 0; i < (2 - longitud); i++)
|
||||
{
|
||||
ord = "0" + ord;
|
||||
}
|
||||
String numafil = new String();
|
||||
numafil = colec + "-" + pol + "-" + ord;
|
||||
|
||||
String consulta = "SELECT DISTINCT actividad.epis_pk, r_xrecep.fecha_cita_previa AS fecha, hc.nhc, prest_item.prest_item_Desc AS Prestacion, TRIM (procedencia.nombre_corto) AS prescriptor, -1 as PETICION FROM NOVAHIS.r_xrecep, NOVAHIS.clientes, NOVAHIS.hc, NOVAHIS.fpersona procedencia, NOVAHIS.r_msalas, NOVAHIS.r_xexplo, NOVAHIS.prest_item, NOVAHIS.r_mexp, NOVAHIS.actividad, NOVAHIS.actividad_det, NOVAHIS.co_cli_planes, NOVAHIS.cliente_pagadores, (SELECT hce_registro_form.fecha_reg AS fechacierre, hce_exp_form.exp_form_pk, hce_exp_form.epis_pk FROM NOVAHIS.hce_exp_form, NOVAHIS.hce_formulario, NOVAHIS.hce_registro_form WHERE hce_exp_form.formulario_pk = hce_formulario.formulario_pk AND (hce_formulario.ffamilia_pk = 14 AND (hce_formulario.hce_tipogest_pk IS NULL OR hce_tipogest_pk <> 2)) AND hce_exp_form.exp_form_pk = HCE_REGISTRO_FORM.EXP_FORM_PK AND hce_registro_form.tipo_oper_pk = 10) CierreForm WHERE r_xrecep.fecha_cita_previa >= TO_DATE ('" + fecha_texto +"', 'yyyy-mm-dd') AND r_xrecep.codigo_cliente = clientes.codigo_cliente AND clientes.codigo_cliente = hc.codigo_cliente AND hc.activa_sn = 1 AND r_xrecep.codigo_personal = procedencia.codigo_personal(+) AND r_xrecep.cod_recepcion = r_xexplo.cod_recepcion AND R_XEXPLO.cod_sala_id = R_MSALAS.COD_SALA_ID AND r_xexplo.cod_exp_id = r_mexp.cod_exp_id AND r_mexp.prest_item_pk = prest_item.prest_item_pk AND r_xexplo.cod_exp_id NOT IN (424, 425) AND R_XRECEP.REF_NHACTIVIDAD = actividad_det.actividad_pk AND actividad_det.actividad_pk = actividad.actividad_pk AND actividad.epis_pk = CierreForm.epis_pk(+) AND clientes.codigo_cliente = cliente_pagadores.codigo_cliente AND actividad_det.cod_pagador_pk = cliente_pagadores.cod_pagador_pk AND cliente_pagadores.cod_pagador_pk = 120 AND cliente_pagadores.clipag_activo_sn = 1 AND cliente_pagadores.clipag_pk = co_cli_planes.clipag_pk AND co_cli_planes.num_afil = '"+ numafil +"' UNION SELECT -1 AS EPIS_PK, FECHA, 'TAPRESCA_TARISAN' AS NHC, TTACTMED_GPC.DESCRIPCION_GPC AS PRESTACION, TRIM(TTMEDICO.NOMBRE) || ' ' || TRIM(TTMEDICO.APELLIDOS) AS PRESCRIPTOR, TAPRESCA_TARISAN.AUTORIZACION AS PETICION FROM TAPRESCA_TARISAN, TTACTMED_GPC, TTMEDICO WHERE COLEC = '" + colec + "' AND POLIZA = '" + pol + "' AND ORDEN = '" + ord + "' AND TIPO_PETICION = 3 AND TAPRESCA_TARISAN.ACTO = TTACTMED_GPC.ACTO AND TAPRESCA_TARISAN.ESPECIALIDAD = TTACTMED_GPC.ESPECIALIDAD AND TAPRESCA_TARISAN.PRESCRIPTOR = TTMEDICO.MEDICO AND POLIZA <> '000000000000' ORDER BY FECHA DESC";
|
||||
|
||||
/*String consulta = "SELECT DISTINCT actividad.epis_pk, r_xrecep.fecha_cita_previa AS fecha, hc.nhc, prest_item.prest_item_Desc AS Prestacion, TRIM (procedencia.nombre_corto) AS prescriptor FROM NOVAHIS.r_xrecep, NOVAHIS.clientes, NOVAHIS.hc, NOVAHIS.fpersona procedencia, NOVAHIS.r_msalas, NOVAHIS.r_xexplo, NOVAHIS.prest_item, NOVAHIS.r_mexp, NOVAHIS.actividad, NOVAHIS.actividad_det, NOVAHIS.co_cli_planes, NOVAHIS.cliente_pagadores, (SELECT hce_registro_form.fecha_reg AS fechacierre, hce_exp_form.exp_form_pk, hce_exp_form.epis_pk FROM NOVAHIS.hce_exp_form, NOVAHIS.hce_formulario, NOVAHIS.hce_registro_form WHERE hce_exp_form.formulario_pk = hce_formulario.formulario_pk AND (hce_formulario.ffamilia_pk = 14 AND (hce_formulario.hce_tipogest_pk IS NULL OR hce_tipogest_pk <> 2)) AND hce_exp_form.exp_form_pk = HCE_REGISTRO_FORM.EXP_FORM_PK AND hce_registro_form.tipo_oper_pk = 10) CierreForm WHERE r_xrecep.fecha_cita_previa >= TO_DATE ('2015-01-01', 'yyyy-mm-dd') AND r_xrecep.codigo_cliente = clientes.codigo_cliente AND clientes.codigo_cliente = hc.codigo_cliente AND hc.activa_sn = 1 AND r_xrecep.codigo_personal = procedencia.codigo_personal(+) AND r_xrecep.cod_recepcion = r_xexplo.cod_recepcion AND R_XEXPLO.cod_sala_id = R_MSALAS.COD_SALA_ID AND r_xexplo.cod_exp_id = r_mexp.cod_exp_id AND r_mexp.prest_item_pk = prest_item.prest_item_pk AND r_xexplo.cod_exp_id NOT IN (424, 425) AND R_XRECEP.REF_NHACTIVIDAD = actividad_det.actividad_pk AND actividad_det.actividad_pk = actividad.actividad_pk AND actividad.epis_pk = CierreForm.epis_pk(+) AND clientes.codigo_cliente = cliente_pagadores.codigo_cliente AND actividad_det.cod_pagador_pk = cliente_pagadores.cod_pagador_pk AND cliente_pagadores.cod_pagador_pk = 120 AND cliente_pagadores.clipag_activo_sn = 1 AND cliente_pagadores.clipag_pk = co_cli_planes.clipag_pk AND co_cli_planes.num_afil = '"+ numafil +"' UNION SELECT -1 AS EPIS_PK, FECHA, 'TAPRESCA_TARISAN' AS NHC, TTACTMED_GPC.DESCRIPCION_GPC AS PRESTACION, TRIM(TTMEDICO.NOMBRE) || ' ' || TRIM(TTMEDICO.APELLIDOS) AS PRESCRIPTOR FROM TAPRESCA_TARISAN, TTACTMED_GPC, TTMEDICO WHERE COLEC = '" + colec + "' AND POLIZA = '" + pol + "' AND ORDEN = '" + ord + "' AND TIPO_PETICION = 3 AND TAPRESCA_TARISAN.ACTO = TTACTMED_GPC.ACTO AND TAPRESCA_TARISAN.ESPECIALIDAD = TTACTMED_GPC.ESPECIALIDAD AND TAPRESCA_TARISAN.PRESCRIPTOR = TTMEDICO.MEDICO ORDER BY FECHA DESC";*/
|
||||
|
||||
|
||||
try {
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, consulta);
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, intPagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
DES encrypter = new DES(strMedico);
|
||||
/*auto = (auto.length()<8)?"0"+auto:auto;*/
|
||||
String petEncriptada = "0";
|
||||
if (rs.getString("PETICION").compareTo("0")!=0){
|
||||
petEncriptada = encrypter.encrypt(rs.getString("PETICION"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
ttrayos = new Ttrayos();
|
||||
ttrayos.setEpisodio(rs.getInt("EPIS_PK"));
|
||||
ttrayos.setNhc(rs.getString("NHC"));
|
||||
ttrayos.setPrueba(rs.getString("PRESTACION"));
|
||||
ttrayos.setFecha(rs.getDate("FECHA"));
|
||||
ttrayos.setPrescriptor(rs.getString("PRESCRIPTOR"));
|
||||
ttrayos.setPeticion(rs.getString("PETICION"));
|
||||
ttrayos.setPeticionEncriptada(petEncriptada);
|
||||
resul.addElement(ttrayos);
|
||||
if (intPagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + resul.size() + " registros de Tablas del HIS (" + consulta + ")");
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de Tablas del HIS (listado_rx_por_paciente): " + e + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,124 @@
|
||||
/**
|
||||
* @(#) PersistenciaVtapresca_tarisanttactmed.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.VTapresca_Ttactmed;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
import java.sql.*;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>Vtapresca_tarisanttactmed</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaVTaprescaTtactmed
|
||||
{
|
||||
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>.
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtiene los actos médicos pertenecientes a la prescripción realizada al paciente.
|
||||
* @param autorizacion Autorización de la prescripción.
|
||||
* @param colectivo Número de colectivo.
|
||||
* @param poliza Número de póliza.
|
||||
* @param beneficiario Número de beneficiario.
|
||||
* @param especialidad Código de la especialidad.
|
||||
* @param pagina Número de página a mostrar.
|
||||
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code>Vtapresca_tarisanttactmed</code>).
|
||||
* @throws
|
||||
*/
|
||||
public Vector obtenerPrescripcionAnalisis(long autorizacion, long colectivo, double poliza, int beneficiario, int especialidad, int pagina, int medico) throws ExcepcionTarisan
|
||||
{
|
||||
int elementosPaginacion=1;
|
||||
Vector vResultado = new Vector();
|
||||
VTapresca_Ttactmed Vtapresca_tarisanttactmed = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT tapresca_tarisan.ACTO, ttactmed.DESCRIPCION, tapresca_tarisan.TEXTO, tapresca_tarisan.PRESCRIPTOR");
|
||||
strSql.append(" FROM tapresca_tarisan, ttactmed");
|
||||
strSql.append(" WHERE tapresca_tarisan.ESPECIALIDAD=ttactmed.ESPECIALIDAD");
|
||||
strSql.append(" AND tapresca_tarisan.ACTO=ttactmed.ACTO");
|
||||
strSql.append(" AND tapresca_tarisan.AUTORIZACION=?");
|
||||
strSql.append(" AND tapresca_tarisan.COLEC=?");
|
||||
strSql.append(" AND tapresca_tarisan.POLIZA=?");
|
||||
strSql.append(" AND tapresca_tarisan.ORDEN=?");
|
||||
strSql.append(" AND tapresca_tarisan.ESPECIALIDAD=?");
|
||||
|
||||
aCondiciones = new Object[5];
|
||||
aCondiciones[0] = Long.valueOf(autorizacion);
|
||||
aCondiciones[1] = Long.valueOf(colectivo);
|
||||
aCondiciones[2] = Double.valueOf(poliza);
|
||||
aCondiciones[3] = Integer.valueOf(beneficiario);
|
||||
aCondiciones[4] = Integer.valueOf(especialidad);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
Vtapresca_tarisanttactmed = new VTapresca_Ttactmed();
|
||||
Vtapresca_tarisanttactmed.setActo(rs.getInt("ACTO"));
|
||||
Vtapresca_tarisanttactmed.setDescripcionActoMedico(rs.getString("DESCRIPCION"));
|
||||
Vtapresca_tarisanttactmed.setInforme(rs.getString("TEXTO"));
|
||||
Vtapresca_tarisanttactmed.setPrescriptor(rs.getInt("PRESCRIPTOR"));
|
||||
vResultado.addElement(Vtapresca_tarisanttactmed);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, medico + " - Seleccionados " + vResultado.size() + " registros de la tabla tapresca_tarisan (" + strSql.toString() + ")");
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, medico + " - Error en la selección de tapresca_tarisan: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
/**
|
||||
* @(#) PersistenciaVTaprescrTamedico.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.VTaprescrTamedico;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.util.Utilidades;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>VTaprescrTamedico</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaVTaprescrTamedico
|
||||
{
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>.
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selecciona los registros de las tablas TAMEDICO y TAPRESCR en función de la sentencia SELECT indicada.
|
||||
* @param sqlSelect La sentencia SELECT de selección.
|
||||
* @param pagina Número de página a mostrar.
|
||||
* @param aCondiciones Array que contiene los parámetros utilizados en la sentencia SELECT.
|
||||
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code>VTaprescrTamedico</code>).
|
||||
* @throws
|
||||
*/
|
||||
public Vector seleccionar(String sqlSelect, int pagina, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
int elementosPaginacion=1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
VTaprescrTamedico vTaprescrTamedico = null;
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect, aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
vTaprescrTamedico = new VTaprescrTamedico();
|
||||
vTaprescrTamedico.setNombre(rs.getString("NOMBRE"));
|
||||
vTaprescrTamedico.setApellidos(rs.getString("APELLIDOS"));
|
||||
vTaprescrTamedico.setImporte(rs.getDouble("IMPORTE"));
|
||||
vResultado.addElement(vTaprescrTamedico);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TAPRESCR (" + sqlSelect + ")");
|
||||
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPRESCR: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPRESCR: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPRESCR: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TAPRESCR: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtiene el importe total de las prescripciones de un determinado médico.
|
||||
* @param medico Código del médico prescriptor.
|
||||
* @param anio año que sirve de filtro para obtener las prescripciones para un determinado año. En caso de que no se quiera realizar ningún filtro, el valor de este campo será 0.
|
||||
* @return El importe total asociado a las prescripciones del médico indicado.
|
||||
* @throws
|
||||
*/
|
||||
public double obtenerImporteTotal(int medico, int anio) throws ExcepcionTarisan
|
||||
{
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
Object aCondiciones[]=null;
|
||||
double dblImporteTotal = 0;
|
||||
|
||||
try
|
||||
{
|
||||
strSql.append("SELECT SUM(IMPORTE) AS IMPORTE_TOTAL");
|
||||
strSql.append(" FROM TAPRESCR");
|
||||
strSql.append(" WHERE PRESCRIPTOR=?");
|
||||
|
||||
if (anio!=0) //se hace el filtro de las prescripciones por un determinado año.
|
||||
{
|
||||
strSql.append(" AND ANO=?");
|
||||
|
||||
aCondiciones = new Object[2];
|
||||
aCondiciones[1] = Integer.valueOf(anio);
|
||||
}
|
||||
else //se sacan todas las prescripciones. No se tiene en cuenta el año.
|
||||
aCondiciones = new Object[1];
|
||||
|
||||
aCondiciones[0]=Integer.valueOf(medico);
|
||||
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, strSql.toString(), aCondiciones);
|
||||
|
||||
//nos posicionamos en el registro
|
||||
if (rs.next())
|
||||
//obtenemos el campo PARAM1
|
||||
dblImporteTotal = rs.getDouble("IMPORTE_TOTAL");
|
||||
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "El importe total de las prescripciones de la tabla TAPRESCR es: " + dblImporteTotal + " (" + strSql.toString() + ")");
|
||||
}
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la obtención del importe total de las prescripciones de la tabla TAPRESCR: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la obtención del importe total de las prescripciones de la tabla TAPRESCR: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la obtención del importe total de las prescripciones de la tabla TAPRESCR: " + sqle + " (" + strSql.toString() + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la obtención del importe total de las prescripciones de la tabla TAPRESCR: " + sqle + " (" + strSql.toString() + ")"); throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
|
||||
return dblImporteTotal;
|
||||
}
|
||||
|
||||
public Vector listado_prescripciones(String anio, int medico, int intPagina)
|
||||
{
|
||||
Vector resul = new Vector();
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
|
||||
Object [] aCondiciones = new Object[1];
|
||||
String consulta = "";
|
||||
|
||||
strSql.append("SELECT TAMEDICO.NOMBRE, TAMEDICO.APELLIDOS, TAPRESCR.IMPORTE");
|
||||
strSql.append(" FROM TAMEDICO, TAPRESCR");
|
||||
strSql.append(" WHERE TAMEDICO.MEDICO=TAPRESCR.MEDICO");
|
||||
strSql.append(" AND TAPRESCR.PRESCRIPTOR=?");
|
||||
if (!anio.equalsIgnoreCase("")) //se realiza una busqueda por año
|
||||
{
|
||||
strSql.append(" AND TAPRESCR.ANO=?");
|
||||
//la consulta sql tendra dos parametros
|
||||
aCondiciones = new Object[2];
|
||||
aCondiciones[1] = Integer.valueOf(anio);
|
||||
}
|
||||
else //no se realiza busqueda por año
|
||||
//la consulta sql tendra un solo parametro
|
||||
aCondiciones = new Object[1];
|
||||
|
||||
strSql.append(" ORDER BY TAMEDICO.NOMBRE, TAMEDICO.APELLIDOS");
|
||||
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
|
||||
try {
|
||||
resul = this.seleccionar(strSql.toString(), intPagina, aCondiciones);
|
||||
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de Tamedico_Taprescr (listado_prescripciones): " + e + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
/**
|
||||
* @(#) PersistenciaVTaresanaTaclient.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.VTaresanaTaclient;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.util.Utilidades;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>VTaresanaTaclient</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaVTaresanaTaclient
|
||||
{
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber que página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>.
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selecciona los registros de la JOIN entre las tablas TARESANA y ttclient en función de la sentencia SELECT indicada.
|
||||
* @param sqlSelect La sentencia SELECT de selección.
|
||||
* @param pagina Número de página a mostrar.
|
||||
* @param aCondiciones Array que contiene los parámetros utilizados en la sentencia SELECT.
|
||||
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code>VTaresanaTaclient</code>).
|
||||
* @throws
|
||||
*/
|
||||
public Vector seleccionar(String sqlSelect, int pagina, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
int elementosPaginacion=1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
VTaresanaTaclient VtaresanaTaclient = null;
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect, aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
VtaresanaTaclient = new VTaresanaTaclient();
|
||||
VtaresanaTaclient.setFecha(rs.getDate("FECHA"));
|
||||
VtaresanaTaclient.setAutorizacion(rs.getInt("AUTORIZACION"));
|
||||
VtaresanaTaclient.setNombre(rs.getString("NOMBRE"));
|
||||
VtaresanaTaclient.setApellidos(rs.getString("APELLIDOS"));
|
||||
vResultado.addElement(VtaresanaTaclient);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TARESANA (" + sqlSelect + ")");
|
||||
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TARESANA: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TARESANA: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TARESANA: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TARESANA: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
|
||||
public Vector listado_analisis_por_medico(int medico, int intPagina)
|
||||
{
|
||||
Vector resul = null;
|
||||
StringBuffer strSql = new StringBuffer();
|
||||
|
||||
Object [] aCondiciones = new Object[1];
|
||||
String consulta = "";
|
||||
|
||||
strSql.append("SELECT taresana.fecha, ttclient.nombre, ttclient.apellidos, taresana.autorizacion");
|
||||
strSql.append(" FROM taresana, ttbenefi, ttclient");
|
||||
strSql.append(" WHERE taresana.prescriptor=?");
|
||||
strSql.append(" and taresana.colec=tabenefi.colectivo");
|
||||
strSql.append(" and taresana.poliza=tabenefi.poliza");
|
||||
strSql.append(" and taresana.orden=tabenefi.orden");
|
||||
strSql.append(" and ttbenefi.cliente=ttclient.cliente");
|
||||
strSql.append(" ORDER BY taresana.fecha DESC");
|
||||
|
||||
|
||||
aCondiciones[0] = Integer.valueOf(medico);
|
||||
|
||||
|
||||
try {
|
||||
resul = this.seleccionar(strSql.toString(), intPagina, aCondiciones);
|
||||
consulta = Utilidades.obtenerSentenciaSQL(strSql, null, aCondiciones);
|
||||
} catch (ExcepcionTarisan e) {
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TARESANA-taclient (listado_analisis_por_medico): " + e + " (" + consulta + ")");
|
||||
}
|
||||
|
||||
|
||||
|
||||
return resul;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
/**
|
||||
* @(#) PersistenciaVTaresanaTamedico.java
|
||||
*/
|
||||
|
||||
package com.tarisan.control;
|
||||
|
||||
import com.tarisan.data.VTaresanaTamedico;
|
||||
import com.tarisan.log.*;
|
||||
import com.tarisan.excepcion.ExcepcionTarisan;
|
||||
import java.sql.*;
|
||||
import java.util.Vector;
|
||||
|
||||
/**
|
||||
* Controla los accesos a la persistencia para la entidad <code>VTaresanaTamedico</code>.
|
||||
* @author <a href="mailto:sistemas@imqnavarra.com">Dpto. Informática</a>.
|
||||
* @version 1.0, 24/09/2003
|
||||
*/
|
||||
public class PersistenciaVTaresanaTamedico
|
||||
{
|
||||
/**
|
||||
* El objeto <code>Paginacion</code> que controla el número de filas a mostrar por cada página.
|
||||
*/
|
||||
private Paginacion objPaginacion = new Paginacion();
|
||||
|
||||
/**
|
||||
* Obtiene el valor del objeto <code>Paginacion</code> para saber qué página se está visualizando.
|
||||
* @return El objeto <code>Paginacion</code>.
|
||||
*/
|
||||
public Paginacion getPaginacion()
|
||||
{
|
||||
return objPaginacion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Selecciona los registros de la JOIN entre tablas TAMEDICO y TARESANA en función de la sentencia SELECT indicada.
|
||||
* @param sqlSelect La sentencia SELECT de selección.
|
||||
* @param pagina Número de página a mostrar.
|
||||
* @param aCondiciones Array que contiene los parámetros utilizados en la sentencia SELECT.
|
||||
* @return El Vector con los registros seleccionados (todos pertenencientes a la clase <code>VTaprescrTamedico</code>).
|
||||
* @throws
|
||||
*/
|
||||
public Vector seleccionar(String sqlSelect, int pagina, Object[] aCondiciones) throws ExcepcionTarisan
|
||||
{
|
||||
|
||||
int elementosPaginacion=1;
|
||||
|
||||
Vector vResultado = new Vector();
|
||||
VTaresanaTamedico vTaresanaTamedico = null;
|
||||
|
||||
try
|
||||
{
|
||||
Connection conexion = ParametrosConfiguracion.dataStore.obtenerConexion();
|
||||
ResultSet rs = ParametrosConfiguracion.dataStore.seleccionar(conexion, sqlSelect, aCondiciones);
|
||||
|
||||
objPaginacion.inicializarPaginacion(rs);
|
||||
if (objPaginacion.getNumeroRegistrosTotales()!=0)
|
||||
{
|
||||
objPaginacion.realizarPaginacion(rs, pagina);
|
||||
|
||||
while(rs.next() && (elementosPaginacion <= Paginacion.getFilasPorPagina()))
|
||||
{
|
||||
vTaresanaTamedico = new VTaresanaTamedico();
|
||||
vTaresanaTamedico.setNombre(rs.getString("NOMBRE"));
|
||||
vTaresanaTamedico.setApellidos(rs.getString("APELLIDOS"));
|
||||
vTaresanaTamedico.setFecha(rs.getDate("FECHA"));
|
||||
vTaresanaTamedico.setAutorizacion(rs.getInt("AUTORIZACION"));
|
||||
vResultado.addElement(vTaresanaTamedico);
|
||||
if (pagina!=0) //Se quiere realizar la paginacion
|
||||
elementosPaginacion++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
ParametrosConfiguracion.dataStore.liberarConexion(conexion);
|
||||
LogTarisan.logger.log(NivelLog.DEBUG, "Seleccionados " + vResultado.size() + " registros de la tabla TARESANA (" + sqlSelect + ")");
|
||||
|
||||
|
||||
}
|
||||
|
||||
catch (ExcepcionTarisan sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TARESANA: " + sqle + " (" + sqlSelect + ")");
|
||||
throw (ExcepcionTarisan)sqle;
|
||||
}
|
||||
catch(SQLException sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TARESANA: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Exception sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TARESANA: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
}
|
||||
catch(Throwable sqle)
|
||||
{
|
||||
LogTarisan.logger.log(NivelLog.ERROR, "Error en la selección de TARESANA: " + sqle + " (" + sqlSelect + ")");
|
||||
throw new ExcepcionTarisan(sqle.getMessage());
|
||||
|
||||
}
|
||||
|
||||
return vResultado;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user