health-dev
[Top][All Lists]
Advanced

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

[Health-dev] What is wrong with my function field?


From: Bounmy Sihaphom
Subject: [Health-dev] What is wrong with my function field?
Date: Mon, 27 Oct 2014 16:40:00 +0700

Hi all!
I am trying to write a simple reports to count the number of patients based on visit_type,Model:appointmentreport. We want to show total of patients for today, Total Patients with visit_type=='New health condition', Total Patients with visit_type=='Followup'

class AppointmentReportbm(ModelSQL, ModelView):
...
 cmr_newpatients = fields.Function(fields.Integer('cmr_newpatients'),'get_cmr_newpatients')


@classmethod
    def table_query(cls):
        pool = Pool()
        appointment = pool.get('gnuhealth.appointment').__table__()
        party = pool.get('party.party').__table__()
        patient = pool.get('gnuhealth.patient').__table__()
...

   def get_cmr_newpatients(self, name):
        x=0
        for appointment in appointment:
        if self.visit_type == 'new':
            x+=1
        return x
Can someone help please. Thanks.

Best Regards;

Bounmy Sihaphom

reply via email to

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