[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnumed-devel] re: concrete example of test_types
From: |
Karsten Hilbert |
Subject: |
Re: [Gnumed-devel] re: concrete example of test_types |
Date: |
Wed, 29 Sep 2004 20:52:56 +0200 |
User-agent: |
Mutt/1.3.22.1i |
> how should sBP and dBP be stored, say 140/80 ?
Roughly like this:
insert into test_org
(fk_org, fk_adm_contact, fk_med_contact, internal_name, comment)
values (
7777777,
(select i_id from v_basic_person where firstnames='Leonard' and
lastnames='Spock' and dob='1931-3-26+2:00'::timestamp),
(select i_id from v_basic_person where firstnames='Leonard' and
lastnames='McCoy' and dob='1920-1-20+2:00'::timestamp),
'Syan"s Lab',
'a dummy lab for Syan to store blood pressure'
);
insert into test_type
(fk_test_org, code, name, comment, conversion_unit)
values (
currval('test_org_pk_seq'),
'sBP',
'systolic blood pressure',
'right arm, sitting, standard size cuff assumed',
'Pa'
);
insert into test_type_local (code, name)
values (
'RR',
'systolic blood pressure'
);
insert into lnk_ttype2local_type (fk_test_type, fk_test_type_local)
values (
currval('test_type_pk_seq'),
currval('test_type_local_pk_seq')
);
insert into test_type
(fk_test_org, code, name, comment, conversion_unit)
values (
currval('test_org_pk_seq'),
'dBP',
'diastolic blood pressure',
'right arm, sitting, standard size cuff assumed',
'Pa'
);
insert into test_type_local (code, name)
values (
'RR',
'diastolic blood pressure'
);
insert into lnk_ttype2local_type (fk_test_type, fk_test_type_local)
values (
currval('test_type_pk_seq'),
currval('test_type_local_pk_seq')
);
insert into test_result (
fk_encounter,
fk_episode,
fk_type,
val_num,
val_unit,
val_normal_min,
val_normal_max
) values (
currval('clin_encounter_id_seq'),
(select pk from clin_episode where name='blood pressure follow-up'),
(select pk from test_type where code='sBP' and ...),
'140',
'mmHG',
'105',
'130'
);
insert into test_result (
fk_encounter,
fk_episode,
fk_type,
val_num,
val_unit,
val_normal_min,
val_normal_max
) values (
currval('clin_encounter_id_seq'),
(select pk from clin_episode where name='blood pressure follow-up'),
(select pk from test_type where code='dBP' and ...),
'80',
'mmHG',
'65',
'85'
);
Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346