From 514198043df4051ff06991625377c3dabf7c93c8 Mon Sep 17 00:00:00 2001 From: "watcha.h" Date: Sat, 22 Nov 2014 00:31:10 +0700 Subject: [PATCH] report hd case --- .../actions/clinic_hd_case_dialy.xml | 8 ++ .../layouts/clinic_hd_case_dialy.xml | 3 + netforce_clinic/layouts/clinic_menu.xml | 6 +- netforce_clinic/models/__init__.py | 3 +- netforce_clinic/models/dialyzer_line.py | 20 ----- netforce_clinic/models/hd_case.py | 3 +- netforce_clinic/models/hd_case_dialy.py | 77 ++++++++++++++++++ netforce_clinic/models/hd_case_dialyzer.py | 7 +- netforce_clinic/reports/hd_case_dialy.xlsx | Bin 0 -> 5043 bytes netforce_clinic/templates/hd_case_dialy.hbs | 45 ++++++++++ netforce_clinic/templates/visit_dialy.hbs | 4 +- netforce_clinic/todo.txt | 3 + 12 files changed, 149 insertions(+), 30 deletions(-) create mode 100644 netforce_clinic/actions/clinic_hd_case_dialy.xml create mode 100644 netforce_clinic/layouts/clinic_hd_case_dialy.xml delete mode 100644 netforce_clinic/models/dialyzer_line.py create mode 100644 netforce_clinic/models/hd_case_dialy.py create mode 100644 netforce_clinic/reports/hd_case_dialy.xlsx create mode 100644 netforce_clinic/templates/hd_case_dialy.hbs diff --git a/netforce_clinic/actions/clinic_hd_case_dialy.xml b/netforce_clinic/actions/clinic_hd_case_dialy.xml new file mode 100644 index 0000000..5a13d45 --- /dev/null +++ b/netforce_clinic/actions/clinic_hd_case_dialy.xml @@ -0,0 +1,8 @@ + + HD Case Dialy + report + clinic.hd.case.dialy + hd_case_dialy + hd_case_dialy + clinic_menu + diff --git a/netforce_clinic/layouts/clinic_hd_case_dialy.xml b/netforce_clinic/layouts/clinic_hd_case_dialy.xml new file mode 100644 index 0000000..bac7081 --- /dev/null +++ b/netforce_clinic/layouts/clinic_hd_case_dialy.xml @@ -0,0 +1,3 @@ +
+ + diff --git a/netforce_clinic/layouts/clinic_menu.xml b/netforce_clinic/layouts/clinic_menu.xml index f79e8ba..6c1ddbf 100644 --- a/netforce_clinic/layouts/clinic_menu.xml +++ b/netforce_clinic/layouts/clinic_menu.xml @@ -36,8 +36,10 @@ - - + + + + diff --git a/netforce_clinic/models/__init__.py b/netforce_clinic/models/__init__.py index 406b09e..5cf384f 100644 --- a/netforce_clinic/models/__init__.py +++ b/netforce_clinic/models/__init__.py @@ -23,8 +23,9 @@ from . import hd_case_personal from . import hd_case_gmline from . import hd_case_discont from . import hd_case_payment +from . import hd_case_dialy +from . import hd_case_dialyzer from . import dialyzer -from . import dialyzer_line from . import import_payment from . import cycle from . import cycle_item diff --git a/netforce_clinic/models/dialyzer_line.py b/netforce_clinic/models/dialyzer_line.py deleted file mode 100644 index 63c4c5a..0000000 --- a/netforce_clinic/models/dialyzer_line.py +++ /dev/null @@ -1,20 +0,0 @@ -from netforce.model import Model, fields - -class DialyzerLine(Model): - _name="clinic.dialyzer.line" - _fields={ - "hd_case_id": fields.Many2One("clinic.hd.case","HdCase",on_delete="cascade"), - "visit_id": fields.Many2One("clinic.visit","Visit",on_delete="cascade"), - "dialyzer_id": fields.Many2One("clinic.dialyzer","Dialzer",search=True), - "description": fields.Char("Description",search=True), - "use_time":fields.Integer("Use time"), - "max_use_time":fields.Integer("Max use time"), - "member_type": fields.Selection([("unsub","Unsub cellul"),("sub","Sub cellul"),("synthetic","Synthetic")],"Member Type"), - "dialyzer_type": fields.Selection([("low","low flux"),("high","high flux"),("dbl","dbl hifulx")],"Member Type"), - "bid_flow_rate": fields.Integer("Bid Flow Rate (ml/min)"), - "ultrafittration": fields.Float("Ultrafittration Kg."), - "state":fields.Selection([("draft","New"),("active","Active"),("drop","Drop")],"Status"), - } - -DialyzerLine.register() - diff --git a/netforce_clinic/models/hd_case.py b/netforce_clinic/models/hd_case.py index 4430310..9c2d4d6 100644 --- a/netforce_clinic/models/hd_case.py +++ b/netforce_clinic/models/hd_case.py @@ -49,7 +49,7 @@ class HDCase(Model): "check_goverment_pay" : fields.Boolean("The Government Pay"), "check_personal_pay" : fields.Boolean("Pay yourself"), "state": fields.Selection([("draft","Draft"),("in_progress","In Progress"),("completed","Completed"),("waiting_payment","Waiting Payment"),("discountinued","Discountinued"),("in_completed","In completed")],"Status",required=True), - "dialyzers": fields.One2Many("clinic.dialyzer.line","hd_case_id","Dialyzers"), + "dialyzers": fields.One2Many("clinic.hd.case.dialyzer","hd_case_id","Dialyzers"), "lines": fields.One2Many("clinic.hd.case.line","hd_case_id","Lines"), "personals": fields.One2Many("clinic.hd.case.personal","hd_case_id","Personals"), "comments": fields.One2Many("message","related_id","Comments"), "company_id": fields.Many2One("company","Company"), @@ -694,7 +694,6 @@ class HDCase(Model): doctor+= 1 else: nurse+=1 - print('doctor ', doctor_id) res[obj.id]={ 'total_doctor': doctor, 'total_nurse': nurse, diff --git a/netforce_clinic/models/hd_case_dialy.py b/netforce_clinic/models/hd_case_dialy.py new file mode 100644 index 0000000..238b017 --- /dev/null +++ b/netforce_clinic/models/hd_case_dialy.py @@ -0,0 +1,77 @@ +import time +import urllib.parse as urllib + +from datetime import datetime +from calendar import monthrange +from netforce.model import Model, fields, get_model +from netforce.access import get_active_company + +from . import utils + +class HDCaseDialy(Model): + _name="clinic.hd.case.dialy" + _string="HD Case Dialy" + _transient=True + + _fields={ + "date": fields.Date("Date", required=True), + } + + _defaults={ + 'date': lambda *a: time.strftime("%Y-%m-%d"), + } + + def get_report_data(self,ids,context={}): + company_id=get_active_company() + company=get_model("company").browse(company_id) + + date=datetime.now().strftime("%Y-%m-%d") + if ids: + obj=self.browse(ids)[0] + date=obj.date + month=int(date[5:7]) + day=date[8:10] + year=date[0:4] + month_str=utils.MONTHS['th_TH'][month] + dom=[] + dom.append(['time_start','>=','%s 00:00:00'%date]) + dom.append(['time_stop','<=','%s 23:59:59'%date]) + lines=[] + no=1 + for obj in get_model("clinic.hd.case").search_browse(dom): + patient_type=utils.PATIENT_TYPE[obj.patient_id.type] + dlz_number="" + dlz_id=None + for line in obj.dialyzers: + dlz=line.dialyzer_id + dlz_id=dlz.id + dlz_number=dlz.number + line={ + 'cycle_name': obj.cycle_id.name, + 'no': no, + 'hd_case_number': obj.number, + 'patient_name': obj.patient_id.name, + 'patient_type': patient_type, + 'doctor_name': obj.doctor_id.name, + 'doctor_id': obj.doctor_id.id, + 'fee_amount': obj.fee_amount, + 'hd_case_id': obj.id, + 'dlz_number': dlz_number, + 'dlz_id': dlz_id, + 'success_color': obj.state=='completed' and '#99ff99' or '', + 'note': obj.note or "", + } + lines.append(line) + no+=1 + # XXX + year=int(year)+543 + date_str='%s %s %s'%(day,month_str,year) + data={ + 'lines': lines, + 'date': date_str, + 'company_name': company.name, + 'company_parent_name': company.parent_id.name, + } + return data + +HDCaseDialy.register() diff --git a/netforce_clinic/models/hd_case_dialyzer.py b/netforce_clinic/models/hd_case_dialyzer.py index f3f407a..2ca5186 100644 --- a/netforce_clinic/models/hd_case_dialyzer.py +++ b/netforce_clinic/models/hd_case_dialyzer.py @@ -1,9 +1,10 @@ from netforce.model import Model, fields -class HdcaseDialyzer(Model): +class HDCaseDialyzerLine(Model): _name="clinic.hd.case.dialyzer" _fields={ - "hd_case_id": fields.Many2One("clinic.hd.case","HdCase",required=True,on_delete="cascade"), + "hd_case_id": fields.Many2One("clinic.hd.case","HdCase",on_delete="cascade"), + "visit_id": fields.Many2One("clinic.visit","Visit",on_delete="cascade"), "dialyzer_id": fields.Many2One("clinic.dialyzer","Dialzer",search=True), "description": fields.Char("Description",search=True), "use_time":fields.Integer("Use time"), @@ -15,5 +16,5 @@ class HdcaseDialyzer(Model): "state":fields.Selection([("draft","New"),("active","Active"),("drop","Drop")],"Status"), } -HdcaseDialyzer.register() +HDCaseDialyzerLine.register() diff --git a/netforce_clinic/reports/hd_case_dialy.xlsx b/netforce_clinic/reports/hd_case_dialy.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..47b0b02c1a7a456edbcc9c91fe2d02d8a457f06e GIT binary patch literal 5043 zcmaJ_2Ut^EvjqVu(n*jGp$Lj}P^w6kPN<>xAT>bfhN5&3=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m&6~tlg+2tq0Iaw$5Uh1~k?T9pR~R$jV?Re(Q-Dae*BqKr)v zGZBb4Ti=W8pzYaT-5JVz8%K!c?0ryyWxc9!+F9f+pp-C%;PVTsi}06R>e< z8aHiQ90UA&;e|u(7cll7aOfE_?#ZupdWES~4uez{gY9JWs7=({@O+7AX;nD=K9Ro7szP`yJ|_ONyz!G~{+|1NS7nR20$6Kac-JSj z7tp&fM7i-f!oK8xPFyK}A2?>1wf2OtpiH_dYpaKA&;jsN$-aECGa%q2N-veptfWNC zyR9%Sou~Ma5tI)+El1`=H|!7f6t4z|D!iU)q@yyIsICVAZwale!)=Fz&XDD2pLorT zL-qKN$kO4EHCOV0`9NVl)`o$eP;bjKY&+Amb$`~fe*ukZDu(*;L1Qpt?gZgjFICX? zM1?!;l&#MXwsJSMpcwZLXdYug_vXT+-Ye6&rYWW*lz%!BV4wT|Gi%aPg~ogq?51y6 ztFUmp0Pb&1xTZJ204w3PR4T97!e`09F6Vb`haMuzH&X!|e7$|7;j+p33^}j}DqA90 z7-1S*CR^xSFQDCFEaWjQF>+{O4@09O$O@axRBCidk!RMe-SR;RR0nH;b^fjdhu)LP4A007i!jBk$U^G^}$1!f@RK#VL@ z+MB|h`6Ux6wIDg!q zDYakLP4b`r@sDo%-T6F?o+*M~mPYpX@c+>Vzq_6%nlqmLWr4Uzzq9V|-sh9)jEsI+ r3gtQPf2iqq_wzgBEaQIJ7aRuvCI7&hL>JFqBE? +

ตารางการรักษาผู้ป่วย

+

+ {{parent_company_name}} {{company_name}}
+

+

+ ประจำวันที่ {{date}} +

+ + + + + + + + + + + + + + + + + + {{#each lines }} + + + + + + + + + + + + + + + {{/each}} + + + +
รอบNoชื่อ-นามสกุลแพทย์สิทธิ์จำนวนเงินRC.NoHDZN/Uพยาบาลหมายเหตุ
{{cycle_name}}{{no}}{{patient_name}}{{doctor_name}}{{patient_type}}{{fee_amount}}-{{hd_case_number}}{{dlz_number}}--{{note}}
diff --git a/netforce_clinic/templates/visit_dialy.hbs b/netforce_clinic/templates/visit_dialy.hbs index c7230b3..ccc0463 100644 --- a/netforce_clinic/templates/visit_dialy.hbs +++ b/netforce_clinic/templates/visit_dialy.hbs @@ -1,5 +1,5 @@
-

ตารางการรักษาผู้ป่วย

+

ตารางการนัดผู้ป่วย

{{parent_company_name}} {{company_name}}

@@ -12,7 +12,7 @@ รอบ Ref. ผู้ป่วย - นพ. + แพทย์ HD Case หมายเหตุ diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt index 4ef68ef..5293baf 100644 --- a/netforce_clinic/todo.txt +++ b/netforce_clinic/todo.txt @@ -1,4 +1,7 @@ ======= + - report salary + - +======== customize ui calendar - - show search