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