17 lines
503 B
Python
17 lines
503 B
Python
|
from netforce.model import Model
|
||
|
from netforce.database import get_connection
|
||
|
|
||
|
class Report(Model):
|
||
|
_name="clinic.report"
|
||
|
_store=False
|
||
|
|
||
|
def cycle_recent_widget(self,context={}):
|
||
|
db=get_connection()
|
||
|
res=db.query("select count(cycle_id) as count, c.name from clinic_hd_case as hd inner join clinic_cycle as c on c.id=hd.cycle_id group by c.name;")
|
||
|
data=[]
|
||
|
for r in res:
|
||
|
data.append((r.name,r.count))
|
||
|
return {"value":data}
|
||
|
|
||
|
Report.register()
|