no message

git-svn-id: https://svn.coded.pt/svn/SIPRP@368 bb69d46d-e84e-40c8-a05a-06db0d633741
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Frederico Palma 19 years ago
parent e3e9756e6c
commit abcb77d958

@ -17,6 +17,7 @@ public interface MedicinaConstants
{
public static final int TIPO_ECDS = 0;
public static final int TIPO_CONSULTA = 1;
public static final int TIPO_FICHA_APTIDAO = 2;
public static final int MOTIVO_ADMISSAO = 1;
public static final Integer MOTIVO_ADMISSAO_INTEGER = new Integer( MOTIVO_ADMISSAO );

@ -11,6 +11,8 @@ package siprp.medicina.processo;
import com.evolute.utils.Singleton;
import com.evolute.utils.arrays.Virtual2DArray;
import com.evolute.utils.data.IDObject;
import com.evolute.utils.data.MappableObject;
import com.evolute.utils.db.DBManager;
import com.evolute.utils.db.Executer;
import com.evolute.utils.jdo.JDOProvider;
@ -18,7 +20,12 @@ import com.evolute.utils.sql.Expression;
import com.evolute.utils.sql.Field;
import com.evolute.utils.sql.Select;
import com.evolute.utils.sql.Select2;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.Vector;
import siprp.medicina.MedicinaConstants;
import siprp.medicina.processo.data.TrabalhadoresProcessoData;
/**
@ -26,6 +33,7 @@ import siprp.medicina.processo.data.TrabalhadoresProcessoData;
* @author fpalma
*/
public class ProcessoDataProvider
implements MedicinaConstants
{
public static final String PROCESSO_ABERTO_CODE = "a";
public static final String PROCESSO_FECHADO_CODE = "f";
@ -82,7 +90,7 @@ public class ProcessoDataProvider
new Expression[ 0 ],
new String[]{ "id", "data_inicio" },
new Field( "marcacoes_processo.trabalhador_id" ).isEqual( trabalhadorID ),
new String[]{ "data_inicio" },
new String[]{ "data_inicio DESC" },
null,
null,
null );
@ -112,4 +120,141 @@ public class ProcessoDataProvider
{
return ESTADO_PROCESSO_BY_CODE.get( codigo );
}
public Object[][] getElementosProcesso( Integer processoID )
throws Exception
{
Vector<Object[]> elementosVector = new Vector<Object[]>();
Select select =
new Select2( new String[]{ "trabalhadores_ecds" },
new Integer[]{},
new Expression[]{},
new String[]{ "id", "data", "estado", "" + TIPO_ECDS },
new Field( "processo_id" ).isEqual( processoID ),
new String[]{ "data", "id" },
null,
null,
null );
Virtual2DArray array = EXECUTER.executeQuery( select );
elementosVector.addAll( Arrays.asList( array.getObjects() ) );
select =
new Select2( new String[]{ "trabalhadores_consultas" },
new Integer[]{},
new Expression[]{},
new String[]{ "id", "data", "estado", "" + TIPO_CONSULTA },
new Field( "processo_id" ).isEqual( processoID ),
new String[]{ "data", "id" },
null,
null,
null );
array = EXECUTER.executeQuery( select );
elementosVector.addAll( Arrays.asList( array.getObjects() ) );
select =
new Select2( new String[]{ "trabalhadores_fichas_aptidao", "exames" },
new Integer[]{ Select2.JOIN_INNER },
new Expression[]{ new Field( "trabalhadores_fichas_aptidao.exame_id" ).isEqual( new Field( "exames.id" ) ) },
new String[]{ "exames.id", "exames.data", "resultado", "" + TIPO_FICHA_APTIDAO },
new Field( "trabalhadores_fichas_aptidao.processo_id" ).isEqual( processoID ).and(
new Field( "exames.inactivo" ).isDifferent( "y" ) ),
new String[]{ "exames.data", "exames.id" },
null,
null,
null );
array = EXECUTER.executeQuery( select );
elementosVector.addAll( Arrays.asList( array.getObjects() ) );
Object elementos[][] = elementosVector.toArray( new Object[ elementosVector.size() ][] );
Arrays.sort( elementos, new Comparator(){
public int compare( Object o1, Object o2 )
{
return ( (Date)( ( Object[] ) o1 )[ 1 ] ).compareTo( ( (Date)( ( Object[] ) o2 )[ 1 ] ) );
}
} );
return elementos;
}
public Object[][] getDatasConsulta( Integer consultaID )
throws Exception
{
Select select =
new Select2( new String[]{ "trabalhadores_consultas_datas" },
new Integer[]{},
new Expression[]{},
new String[]{ "id", "data", "estado" },
new Field( "consulta_id" ).isEqual( consultaID ),
new String[]{ "data DESC" },
null,
null,
null );
Virtual2DArray array = EXECUTER.executeQuery( select );
return array.getObjects();
}
public Object[][] getDatasECDs( Integer consultaID )
throws Exception
{
Select select =
new Select2( new String[]{ "trabalhadores_ecds_datas" },
new Integer[]{},
new Expression[]{},
new String[]{ "id", "data", "estado" },
new Field( "consulta_id" ).isEqual( consultaID ),
new String[]{ "data DESC" },
null,
null,
null );
Virtual2DArray array = EXECUTER.executeQuery( select );
return array.getObjects();
}
public IDObject getObservacoesConsultaData( Integer consultaDataID )
throws Exception
{
Select select =
new Select2( new String[]{ "consultas_datas_observacoes" },
new Integer[]{},
new Expression[]{},
new String[]{ "id", "observacao" },
new Field( "trabalhadores_consultas_datas_id" ).isEqual( consultaDataID ),
null,
null,
null,
null );
Virtual2DArray array = EXECUTER.executeQuery( select );
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
{
return null;
}
else
{
return new MappableObject( ( Integer ) array.get( 0, 0 ), ( String ) array.get( 0, 1 ) );
}
}
public IDObject getObservacoesECDsData( Integer ecdsDataID )
throws Exception
{
Select select =
new Select2( new String[]{ "consultas_datas_observacoes" },
new Integer[]{},
new Expression[]{},
new String[]{ "id", "observacao" },
new Field( "trabalhadores_ecds_datas_id" ).isEqual( ecdsDataID ),
null,
null,
null,
null );
Virtual2DArray array = EXECUTER.executeQuery( select );
if( array.columnLength() == 0 || array.get( 0, 0 ) == null )
{
return null;
}
else
{
return new MappableObject( ( Integer ) array.get( 0, 0 ), ( String ) array.get( 0, 1 ) );
}
}
}

@ -17,6 +17,7 @@ public final class TrabalhadoresConsultas implements JDOInnerObject
private Date data;
private Integer estado;
private Integer prestador_id;
private Integer processo_id;
public TrabalhadoresConsultas()
{
@ -44,6 +45,10 @@ public final class TrabalhadoresConsultas implements JDOInnerObject
{
return prestador_id;
}
else if( fieldName == TrabalhadoresConsultasData.PROCESSO_ID )
{
return processo_id;
}
else if( fieldName.equals( TrabalhadoresConsultasData.ID ) )
{
return id;
@ -64,6 +69,10 @@ public final class TrabalhadoresConsultas implements JDOInnerObject
{
return prestador_id;
}
else if( fieldName.equals( TrabalhadoresConsultasData.PROCESSO_ID ) )
{
return processo_id;
}
return null;
}
@ -89,6 +98,10 @@ public final class TrabalhadoresConsultas implements JDOInnerObject
{
prestador_id = ( Integer ) value;
}
else if( fieldName == TrabalhadoresConsultasData.PROCESSO_ID )
{
processo_id = ( Integer ) value;
}
else if( fieldName.equals( TrabalhadoresConsultasData.ID ) )
{
id = ( Integer ) value;
@ -109,6 +122,10 @@ public final class TrabalhadoresConsultas implements JDOInnerObject
{
prestador_id = ( Integer ) value;
}
else if( fieldName.equals( TrabalhadoresConsultasData.PROCESSO_ID ) )
{
processo_id = ( Integer ) value;
}
}
public Class getOuterClass()

@ -17,13 +17,14 @@ public final class TrabalhadoresConsultasData extends JDOObject
public static final String DATA = "data";
public static final String ESTADO = "estado";
public static final String PRESTADOR_ID = "prestador_id";
public static final String PROCESSO_ID = "processo_id";
public static final String FIELD_NAMES[] = new String[]{
TRABALHADOR_ID, DATA, ESTADO, PRESTADOR_ID, };
TRABALHADOR_ID, DATA, ESTADO, PRESTADOR_ID, PROCESSO_ID, };
protected static final String ALL_FIELD_NAMES[] = new String[]{
ID, TRABALHADOR_ID, DATA, ESTADO, PRESTADOR_ID, };
ID, TRABALHADOR_ID, DATA, ESTADO, PRESTADOR_ID, PROCESSO_ID, };
private HashMap dataHash;

@ -16,6 +16,7 @@ public final class TrabalhadoresEcds implements JDOInnerObject
private Integer trabalhador_id;
private Integer estado;
private Date data;
private Integer processo_id;
public TrabalhadoresEcds()
{
@ -39,6 +40,10 @@ public final class TrabalhadoresEcds implements JDOInnerObject
{
return data;
}
else if( fieldName == TrabalhadoresEcdsData.PROCESSO_ID )
{
return processo_id;
}
else if( fieldName.equals( TrabalhadoresEcdsData.ID ) )
{
return id;
@ -55,6 +60,10 @@ public final class TrabalhadoresEcds implements JDOInnerObject
{
return data;
}
else if( fieldName.equals( TrabalhadoresEcdsData.PROCESSO_ID ) )
{
return processo_id;
}
return null;
}
@ -76,6 +85,10 @@ public final class TrabalhadoresEcds implements JDOInnerObject
{
data = ( Date ) value;
}
else if( fieldName == TrabalhadoresEcdsData.PROCESSO_ID )
{
processo_id = ( Integer ) value;
}
else if( fieldName.equals( TrabalhadoresEcdsData.ID ) )
{
id = ( Integer ) value;
@ -92,6 +105,10 @@ public final class TrabalhadoresEcds implements JDOInnerObject
{
data = ( Date ) value;
}
else if( fieldName.equals( TrabalhadoresEcdsData.PROCESSO_ID ) )
{
processo_id = ( Integer ) value;
}
}
public Class getOuterClass()

@ -16,13 +16,14 @@ public final class TrabalhadoresEcdsData extends JDOObject
public static final String TRABALHADOR_ID = "trabalhador_id";
public static final String ESTADO = "estado";
public static final String DATA = "data";
public static final String PROCESSO_ID = "processo_id";
public static final String FIELD_NAMES[] = new String[]{
TRABALHADOR_ID, ESTADO, DATA, };
TRABALHADOR_ID, ESTADO, DATA, PROCESSO_ID, };
protected static final String ALL_FIELD_NAMES[] = new String[]{
ID, TRABALHADOR_ID, ESTADO, DATA, };
ID, TRABALHADOR_ID, ESTADO, DATA, PROCESSO_ID, };
private HashMap dataHash;

@ -132,6 +132,10 @@
<extension vendor-name="jpox" key="column-name" value="data"/>
<extension vendor-name="evolute" key="java-type" value="Date"/>
</field>
<field name="processo_id" primary-key="false">
<extension vendor-name="jpox" key="column-name" value="processo_id"/>
<extension vendor-name="evolute" key="java-type" value="Integer"/>
</field>
</class>
<class name="TrabalhadoresEcd" identity-type="application" objectid-class="siprp.medicina.processo.data.TrabalhadoresEcdID">
<extension vendor-name="jpox" key="table-name" value="trabalhadores_ecd"/>
@ -269,6 +273,10 @@
<extension vendor-name="jpox" key="column-name" value="prestador_id"/>
<extension vendor-name="evolute" key="java-type" value="Integer"/>
</field>
<field name="processo_id" primary-key="false">
<extension vendor-name="jpox" key="column-name" value="processo_id"/>
<extension vendor-name="evolute" key="java-type" value="Integer"/>
</field>
</class>
</package>
</jdo>

Loading…
Cancel
Save