Sha256: fe6974570648b23fbb70a91ac81b347fcea8332c7c879b7504771e4aa4602d42
Contents?: true
Size: 655 Bytes
Versions: 21
Compression:
Stored size: 655 Bytes
Contents
/* Returns a table of date => result for a patient, obx code (eg HGB) and start date */ CREATE OR REPLACE FUNCTION renalware.pathology_chart_data(patient_id integer, code text, start_date date) RETURNS TABLE(observed_on date, result float) LANGUAGE sql AS $function$ SELECT observed_at::date, convert_to_float(result) from pathology_observations po inner join pathology_observation_requests por on por.id = po.request_id inner join pathology_observation_descriptions pod on pod.id = po.description_id where pod.code = $2 and observed_at >= start_date and por.patient_id = $1 order by po.observed_at asc, po.created_at desc; $function$ ;
Version data entries
21 entries across 21 versions & 1 rubygems