gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] Statistics


From: Busser, Jim
Subject: Re: [Gnumed-devel] Statistics
Date: Fri, 8 Feb 2013 16:00:02 +0000

On 2013-02-08, at 6:28 AM, Vaibhav Banait <address@hidden> wrote:

> How do I know how many patients I have seen in a day, month, or last year and 
> trend when compared to previous year?
> :) 
> Also, patients who are not coming as per the advised follow up?
> Can I have an english translated pack for providing receipt for consultation? 

The three questions above all need different answers. Here is a partial answer 
(one method) for the first one.

Statistics can be achieved from a complex query pasted, and saved, into the 
Report generator plug-in. Each part (day, month, or year) can be answered from 
a simpler query, which you could build a more complex query which returns only 
the totals.

You will need to decide what you mean by patients "seen". More specifically, 
which kinds of encounters with the patient (not encounters with the GNUmed 
"record") you wish included.

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 ;

which for me yields

         pk |       description        
        ----+--------------------------
         13 | administrative encounter
         24 | clerical encounter
         26 | discharge from care
         14 | imported corr/docs
         23 | imported results
         19 | manage case
         25 | nursing encounter
         12 | other encounter
          2 | phone w/ patient
         15 | phone w/ provider
         18 | phone w/ proxy
         11 | review chart
         22 | review corr/docs
         21 | review requests
         20 | review results
          1 | seen in clinic
         10 | seen in emergency room
          7 | seen in hospital
          5 | seen outside (facility)
          4 | seen outside (home)
          9 | seen proxy alternate
          8 | video conference
        (22 rows)

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
ORDER BY
        c_e.started DESC
;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]