Añado los fuentes de java
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user