[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnumed-devel] Statistics
From: |
Karsten Hilbert |
Subject: |
Re: [Gnumed-devel] Statistics |
Date: |
Fri, 8 Feb 2013 23:47:17 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
First of all: Jim, thanks so much for taking the time to
help with fielding questions.
> You will need to identify and select the keys for your
> desired encounter types. You can obtain this by logging in
> with psql
>
> psql -d gnumed_v17 -U gm-dbo
>
> and then
>
> select * from clin.encounter_type ORDER BY description ;
Or else you can simply type that query into the report
generator, too :-)
> The following query will result for me all patients whose
> encounter of type 'seen in clinic' that I have created or
> modified in the past 21 days. The number of records returned
> is shown You will need a somewhat different query
>
> SELECT
> to_char(c_e.modified_when,'yyyy.mm.dd hh:mm') modified,
> d_n.lastnames || ', ' || d_n.firstnames person_encountered,
> c_et.description encounter_type,
> to_char(c_e.started,'yyyy.mm.dd hh:mm') started,
> c_e.assessment_of_encounter aoe,
> c_e.pk AS pk_encounter,
> c_e.fk_patient pk_patient
> FROM
> clin.encounter c_e INNER JOIN dem.names d_n ON c_e.fk_patient =
> d_n.id_identity INNER JOIN clin.encounter_type c_et ON c_e.fk_type = c_et.pk
> WHERE
> c_e.modified_by = "current_user"()
> AND
> c_e.modified_when > now() - interval '21 days'
> AND
> c_e.fk_type = 1
This condition can be modified to
AND
c_e.fk_type = (select pk from clin.encounter_type where description =
'seen in clinic')
...
or even
AND
c_e.fk_type = (select pk from clin.encounter_type where description IN
('seen in clinic', 'seen elsewhere', 'not seen but called', ...))
...
> ORDER BY
> c_e.started DESC
> ;
Karsten
--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346
- [Gnumed-devel] Statistics, Vaibhav Banait, 2013/02/08
- Re: [Gnumed-devel] Statistics, Busser, Jim, 2013/02/08
- Re: [Gnumed-devel] Statistics,
Karsten Hilbert <=
- Re: [Gnumed-devel] Statistics, Karsten Hilbert, 2013/02/08
- Re: [Gnumed-devel] Statistics, Karsten Hilbert, 2013/02/08
- Re: [Gnumed-devel] Statistics, Karsten Hilbert, 2013/02/08