create function f_bmi_bsa(tz numeric, sg numeric) returns numeric[]
language plpgsql
as
$$
/*
综述:BMI,BSA
参数:体重;身高
输出:BMI,BSA
*/
declare
BMI numeric; BSA numeric;result numeric[];
begin
if TZ = null or SG = null then
result = null;
else
BMI = round(tz/power(sg/100.0,2),1)::numeric;
BSA = round(0.0061*sg+0.0128*tz-0.1529,1)::numeric;
end if;
result = array[BMI, BSA];
return result;
end;
$$;