--CREATE OR REPLACE FUNCTION fn_GetVisitCount("VisitID" uuid)
--RETURNS integer AS
--$BODY$	
--declare	_ret int;
--Begin	
--	select count(*) 
--	from akuz.T_DOCTOR_INSPECTION_RE i
--	into _ret
--	where i.DoctorInspection = "VisitID";
--	return _ret + 1;
--END $BODY$
--  LANGUAGE plpgsql volatile
--  COST 100;
--ALTER FUNCTION fn_getvisitcount(uuid)
--  OWNER TO postgres;