Vital signs in EMAP
Question
How do I find vital signs in EMAP star?
Answer
The following script should return any vital signs recorded in the last 5 minutes!
SELECT
-- observation details
ob.visit_observation_id
,ob.hospital_visit_id
,ob.observation_datetime
--,ob.visit_observation_type_id
--,ot.id_in_application
-- label nicely
CASE
,WHEN ot.id_in_application = '10' THEN 'SpO2'
WHEN ot.id_in_application = '5' THEN 'BP'
WHEN ot.id_in_application = '3040109304' THEN 'Oxygen'
WHEN ot.id_in_application = '6' THEN 'Temp'
WHEN ot.id_in_application = '8' THEN 'Pulse'
WHEN ot.id_in_application = '9' THEN 'Resp'
WHEN ot.id_in_application = '6466' THEN 'AVPU'
END AS vital
,ob.value_as_real
,ob.value_as_text
,ob.unit
FROM
star.visit_observation ob-- observation look-up
LEFT JOIN
star.visit_observation_type oton ob.visit_observation_type_id = ot.visit_observation_type_id
WHERE
> NOW() - '5 MINS'::INTERVAL
ob.observation_datetime AND
in
ot.id_in_application
('10' --'SpO2'
'5' --'BP'
,'3040109304' --'Room Air or Oxygen'
,'6' --'Temp'
,'8' --'Pulse'
,'9' --'Resp'
,'6466' -- Level of consciousness
,
)ORDER BY ob.observation_datetime DESC
;