--"set dateformat dmy select * from rpt59.pan_StomDesease_ByDiag(" + params["paramLpu"].value + "," + params["paramLpuBuilding"].value + "," + params["paramLpuUnit"].value + "," +params["paramLpuSection"].value + "," + params["paramMedStaffFact"].value + "," +params["paramPayType"].value + ", dbo.GetDiagCodeByID("+params["paramBegDiag"].value+"),dbo.GetDiagCodeByID("+params["paramEndDiag"].value + "),'" + params["paramBegDate"].value + "','" + params["paramEndDate"].value+"')"

select *
from rpt.pan_stomdesease_bydiag_pg(
cast($1 as int8), 
cast($2 as int8), 
cast($3 as int8), 
cast($4 as int8), 
cast($5 as int8), 
cast($6 as int8), 
dbo.GetDiagCodeByID(cast($7 as int8)),
dbo.GetDiagCodeByID(cast($8 as int8)),
cast(to_timestamp($9,'dd.mm.yyyy') as timestamp), 
cast(to_timestamp($10,'dd.mm.yyyy') as timestamp))
