forked from Coded/SIPRP
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
2.3 KiB
75 lines
2.3 KiB
package shst.medicina.fichasclinicas.provider;
|
|
|
|
import java.util.List;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
|
import pt.evolute.data.ProviderSpringBean;
|
|
import shst.medicina.fichasclinicas.data.shst.FilFileData;
|
|
import shst.medicina.fichasclinicas.data.shst.FilFileTrabalhadorData;
|
|
|
|
import com.evolute.utils.arrays.Virtual2DArray;
|
|
import com.evolute.utils.sql.Expression;
|
|
import com.evolute.utils.sql.Field;
|
|
import com.evolute.utils.sql.Select2;
|
|
|
|
|
|
public class DocumentosDataProvider
|
|
{
|
|
@Autowired(required = true)
|
|
@Qualifier("siprpProvider")
|
|
ProviderSpringBean siprpProvidersBean;
|
|
|
|
|
|
|
|
public Long getDocumentosCount(Integer trabalhadorID) throws Exception
|
|
{
|
|
Select2 sel = new Select2(
|
|
new String[]{FilFileTrabalhadorData.TABLENAME,FilFileData.TABLENAME},
|
|
new Integer[]{Select2.JOIN_INNER},
|
|
new Expression[]{
|
|
new Field(FilFileTrabalhadorData.FILE_ID_FULL).isEqual(new Field(FilFileData.ID_FULL))
|
|
.and(new Field(FilFileData.DELETED_STAMP).isEqual(null))
|
|
.and(new Field(FilFileTrabalhadorData.TRABALHADOR_ID_FULL).isEqual(trabalhadorID))
|
|
.and(new Field(FilFileTrabalhadorData.ONLINE_FULL).isEqual(true))},
|
|
new String[]{"COUNT(DISTINCT("+FilFileData.ID_FULL+"))"},
|
|
/*expression*/null,
|
|
/*order*/null,
|
|
/*group*/null,
|
|
/*having*/null,
|
|
null);
|
|
Virtual2DArray queryResult = siprpProvidersBean.getDBMANAGER().getSharedExecuter(this).executeQuery(sel);
|
|
Long rst = null;
|
|
if(queryResult.rowCount()==1)
|
|
{
|
|
rst = queryResult.get(0,0);
|
|
}
|
|
return rst;
|
|
}
|
|
|
|
|
|
|
|
public List<FilFileTrabalhadorData> getDocumentosList(Integer trabalhadorID) throws Exception
|
|
{
|
|
Select2 excludDeleted = new Select2(FilFileData.TABLENAME,new Field(FilFileData.DELETED_STAMP).isEqual(null), FilFileData.ID);
|
|
|
|
return siprpProvidersBean.getENTITY_PROVIDER().listLoad(FilFileTrabalhadorData.class,new Field(FilFileTrabalhadorData.TRABALHADOR_ID).isEqual(trabalhadorID).and(new Field(FilFileTrabalhadorData.ONLINE).isEqual(true)).and(new Field(FilFileTrabalhadorData.FILE_ID).in(excludDeleted)),null,null);
|
|
}
|
|
|
|
|
|
|
|
public FilFileData getDocumento(Integer documentoID) throws Exception
|
|
{
|
|
return siprpProvidersBean.getENTITY_PROVIDER().load(FilFileData.class, new Object[]{documentoID,null},new String[]{FilFileData.ID,FilFileData.DELETED_STAMP});
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|