report summary
parent
bc433b8b8b
commit
c196d8878e
|
@ -24,118 +24,101 @@ class ReportHDCaseSummary(Model):
|
|||
company_name=item.name
|
||||
|
||||
date=datetime.now().strftime("%Y-%m-%d")
|
||||
dom=[]
|
||||
if ids:
|
||||
obj=self.browse(ids)[0]
|
||||
date=obj.date
|
||||
crr_month=int(date[5:7])
|
||||
prev_month=crr_month-1
|
||||
next_month=crr_month+1
|
||||
if crr_month==1:
|
||||
prev_month=12
|
||||
if crr_month==12:
|
||||
next_month=1
|
||||
|
||||
month=int(date[5:7])
|
||||
year=int(date[0:4])
|
||||
weekday, total_day=monthrange(year, month)
|
||||
#date_from="%s-%s-01"%(year,month)
|
||||
#date_to="%s-%s-%s"%(year,month,total_day)
|
||||
#month_str=datetime.strptime(date,'%Y-%m-%d').strftime("%B")
|
||||
month_str=utils.MONTHS['th_TH'][int(datetime.strptime(date,'%Y-%m-%d').strftime('%m'))]
|
||||
next_month = str(month + 1)
|
||||
if next_month == 13:
|
||||
next_month = 12
|
||||
next_month_str=utils.MONTHS['th_TH'][int(datetime.strptime(next_month,'%m').strftime("%m"))]
|
||||
|
||||
previous_month = month-1
|
||||
if previous_month == 0:
|
||||
previous_month = 12
|
||||
#tip previous_month=str(month-1 == 0 and 12 or month)
|
||||
previous_month_str=utils.MONTHS['th_TH'][int(datetime.strptime('%s'%previous_month,'%m').strftime("%m"))]
|
||||
month_str=utils.MONTHS['th_TH'][crr_month]
|
||||
next_month_str=utils.MONTHS['th_TH'][next_month]
|
||||
prev_month_str=utils.MONTHS['th_TH'][prev_month]
|
||||
|
||||
time_start='2014-%s-01'%(month) # 2014-10-20
|
||||
time_stop='2014-%s-%s'%(month,total_day)
|
||||
|
||||
|
||||
|
||||
dom=[]
|
||||
dom.append(['type','=','sc'])
|
||||
patients_sc=len(get_model("clinic.patient").search(dom))
|
||||
dom.append(['type','=','nhso'])
|
||||
patients_nhso=len(get_model("clinic.patient").search(dom))
|
||||
dom.append(['type','=','nhso'])
|
||||
patients_nhso=len(get_model("clinic.patient").search(dom))
|
||||
dom.append(['type','=','pn'])
|
||||
patients_pn=len(get_model("clinic.patient").search(dom))
|
||||
#New Patients
|
||||
#dom.append(['type','=','All'])
|
||||
#patients=len(get_model("clinic.patient").search_browse(['type','=','All']))
|
||||
|
||||
dom=[]
|
||||
dom.append(['state','=','completed'])
|
||||
dom.append(['time_start','>=',time_start])
|
||||
dom.append(['time_stop','<=',time_stop])
|
||||
cur_total_case=len(get_model("clinic.hd.case").search(dom))
|
||||
patients=len(get_model("clinic.patient").search_browse(['type','=','All']))
|
||||
weekday, prev_total_day=monthrange(year, prev_month)
|
||||
prev_time_start='2014-%s-01 00:00:00'%(str(prev_month).zfill(2))
|
||||
prev_time_stop='2014-%s-%s 23:59:59'%(str(prev_month).zfill(2),prev_total_day)
|
||||
dom.append(['time_start','>=', prev_time_start])
|
||||
dom.append(['time_stop','<=',prev_time_stop])
|
||||
prev_total=len(get_model("clinic.hd.case").search(dom))
|
||||
|
||||
dom=[]
|
||||
weekday, crr_total_day=monthrange(year, crr_month)
|
||||
crr_time_start='2014-%s-01 00:00:00'%(str(crr_month).zfill(2))
|
||||
crr_time_stop='2014-%s-%s 23:59:59'%(str(crr_month).zfill(2),crr_total_day)
|
||||
dom.append(['time_start','>=', crr_time_start])
|
||||
dom.append(['time_stop','<=',crr_time_stop])
|
||||
crr_total=len(get_model("clinic.hd.case").search(dom))
|
||||
|
||||
dom=[]
|
||||
weekday, next_total_day=monthrange(year, next_month)
|
||||
next_time_start='2014-%s-01 00:00:00'%(str(next_month).zfill(2))
|
||||
next_time_stop='2014-%s-%s 23:59:59'%(str(next_month).zfill(2),next_total_day)
|
||||
dom.append(['time_start','>=', next_time_start])
|
||||
dom.append(['time_stop','<=',next_time_stop])
|
||||
next_total=len(get_model("clinic.hd.case").search(dom))
|
||||
|
||||
weekday, prev_total_day=monthrange(year, previous_month)
|
||||
time_start_pre='2014-%s-01'%(previous_month) # 2014-10-20
|
||||
time_stop_pre='2014-%s-%s'%(previous_month,prev_total_day)
|
||||
|
||||
dom=[]
|
||||
dom.append(['state','=','completed'])
|
||||
dom.append(['time_start','>=',time_start_pre])
|
||||
dom.append(['time_stop','<=',time_stop_pre])
|
||||
prev_total_case=len(get_model("clinic.hd.case").search(dom))
|
||||
items={
|
||||
'topic1': {
|
||||
'month': month_str,
|
||||
'amount': cur_total_case,
|
||||
'date_from': time_start,
|
||||
'date_to': time_stop,
|
||||
'amount': crr_total,
|
||||
'date_from': crr_time_start[0:10],
|
||||
'date_to': crr_time_stop[0:10],
|
||||
},
|
||||
'topic2':
|
||||
{
|
||||
'month': previous_month_str,
|
||||
'amount': prev_total_case,
|
||||
'date_from': time_start_pre,
|
||||
'date_to': time_stop_pre,
|
||||
'month': prev_month_str,
|
||||
'amount': prev_total,
|
||||
'date_from': prev_time_start[0:10],
|
||||
'date_to': prev_time_stop[0:10],
|
||||
},
|
||||
'topic3':
|
||||
{
|
||||
'month': month_str,
|
||||
'amount': patients,
|
||||
'date_from': time_start,
|
||||
'date_to': time_stop,
|
||||
'amount': next_total,
|
||||
'date_from': next_time_start[0:10],
|
||||
'date_to': next_time_stop[0:10],
|
||||
},
|
||||
'topic4':
|
||||
{
|
||||
'month': month_str,
|
||||
'amount': 'N/A',
|
||||
'date_from': time_start,
|
||||
'date_to': time_stop,
|
||||
'date_from': '',
|
||||
'date_to': '',
|
||||
},
|
||||
'topic5':
|
||||
{
|
||||
'month': next_month_str,
|
||||
'amount': 'N/A',
|
||||
'date_from': time_start,
|
||||
'date_to': time_stop,
|
||||
'date_from': '',
|
||||
'date_to': '',
|
||||
},
|
||||
'topic6':
|
||||
{
|
||||
'month': '',
|
||||
'amount': patients_sc,
|
||||
'date_from': time_start,
|
||||
'date_to': time_stop,
|
||||
'amount': '',
|
||||
'date_from': '',
|
||||
'date_to': '',
|
||||
},
|
||||
'topic7':
|
||||
{
|
||||
'month':'',
|
||||
'amount': patients_nhso,
|
||||
'date_from': time_start,
|
||||
'date_to': time_stop,
|
||||
'amount': '',
|
||||
'date_from': '',
|
||||
'date_to': '',
|
||||
},
|
||||
'topic8':
|
||||
{
|
||||
'month': '',
|
||||
'amount': patients_pn,
|
||||
'date_from': time_start,
|
||||
'date_to': time_stop,
|
||||
'amount': '',
|
||||
'date_from': '',
|
||||
'date_to': '',
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<td>{{topic}}</td>
|
||||
<td>{{month}}</td>
|
||||
<td>เท่ากับ</td>
|
||||
<td><a style="text-decoration: underline" href="ui#name=clinic_report_hd_detail&defaults.date_from={{date_from}}&defaults.date_to={{date_to}}" >{{amount}}</a></td>
|
||||
<td><a style="text-decoration: underline" href="ui#name=clinic_report_hd_case_detail&defaults.date_from={{date_from}}&defaults.date_to={{date_to}}" >{{amount}}</a></td>
|
||||
<td>{{unit}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
|
@ -31,7 +31,7 @@
|
|||
</table>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td>
|
||||
<td style="width:50%">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th><h4>รายชื่อผู้ป่วยรับใหม่</h4></th>
|
||||
|
@ -51,6 +51,28 @@
|
|||
</tfoot>
|
||||
</table>
|
||||
</td>
|
||||
<td>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th><h4>รวมจำนวนยาที่ใช้ประจำเดือน</h4></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><b>ปกส.</b></td>
|
||||
<td><b>uc</b></td>
|
||||
<td><b>ซื้อ</b></td>
|
||||
<td><b>รวม</b></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
</tfoot>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<table class="table">
|
||||
<thead>
|
||||
|
@ -73,27 +95,3 @@
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<th><h4>รวมจำนวนยาที่ใช้ประจำเดือน</h4></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><b>ปกส.</b></td>
|
||||
<td><b>uc</b></td>
|
||||
<td><b>ซื้อ</b></td>
|
||||
<td><b>รวม</b></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
</tfoot>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
Loading…
Reference in New Issue