select * from rpt.hosp_medpersonal_workload_pg(cast($1 as bigint ),
cast($2 as varchar ),
cast($3 as bigint ),
cast($4 as bigint ),
cast($5 as bigint ),
cast($6 as bigint ),
cast($7 as varchar ),
cast($8 as timestamp ),
cast($9 as timestamp ),
cast($10 as time ))
order by case 
		when "Person_Fio" is not null and "LpuSection_Code" is null then 99991
		when "Person_Fio" is null and "LpuSection_Code" is not null then 99992
		when "Person_Fio" is null and "LpuSection_Code" is null then 99993
		else cast(row_numb as bigint)
	end	asc
