diff --git a/netforce_clinic/actions/clinic_patient_move.xml b/netforce_clinic/actions/clinic_patient_move.xml new file mode 100644 index 0000000..6f1d35a --- /dev/null +++ b/netforce_clinic/actions/clinic_patient_move.xml @@ -0,0 +1,11 @@ + + Patient Moves + multi_view + clinic.patient.move + [ + ["All",[[]]], + ["In",[["type","=","in"]]], + ["Out",[["type","=","out"]]]] + + clinic_menu + diff --git a/netforce_clinic/actions/clinic_print_wizard_labor_cost.xml b/netforce_clinic/actions/clinic_print_wizard_labor_cost.xml new file mode 100644 index 0000000..20ba3f9 --- /dev/null +++ b/netforce_clinic/actions/clinic_print_wizard_labor_cost.xml @@ -0,0 +1,6 @@ + + Report Wizard Labor Cost + multi_view + clinic.print.wizard.labor.cost + clinic_menu + diff --git a/netforce_clinic/actions/clinic_report_account_hd_case_detail.xml b/netforce_clinic/actions/clinic_report_account_hd_case_detail.xml index 1ed5550..eda03e6 100644 --- a/netforce_clinic/actions/clinic_report_account_hd_case_detail.xml +++ b/netforce_clinic/actions/clinic_report_account_hd_case_detail.xml @@ -1,5 +1,5 @@ - Report Account HD Case Detail + Account HD Case Detail report clinic.report.account.hd.case.detail report_account_hd_case_detail diff --git a/netforce_clinic/actions/clinic_report_account_hd_case_summary.xml b/netforce_clinic/actions/clinic_report_account_hd_case_summary.xml deleted file mode 100644 index 9ed5b18..0000000 --- a/netforce_clinic/actions/clinic_report_account_hd_case_summary.xml +++ /dev/null @@ -1,8 +0,0 @@ - - Report Account HD Case Summary - report - clinic.report.account.hd.case.summary - report_account_hd_case_summary - report_account_hd_case_summary - account_menu - diff --git a/netforce_clinic/actions/clinic_report_hd_case_summary.xml b/netforce_clinic/actions/clinic_report_hd_case_summary.xml index 79241c0..f65314a 100644 --- a/netforce_clinic/actions/clinic_report_hd_case_summary.xml +++ b/netforce_clinic/actions/clinic_report_hd_case_summary.xml @@ -1,5 +1,5 @@ - HD Case Summary + HD Case Summary (old) report clinic.report.hd.case.summary report_hd_case_summary diff --git a/netforce_clinic/actions/clinic_report_wizard_labor_cost.xml b/netforce_clinic/actions/clinic_report_wizard_labor_cost.xml new file mode 100644 index 0000000..50f5b5c --- /dev/null +++ b/netforce_clinic/actions/clinic_report_wizard_labor_cost.xml @@ -0,0 +1,8 @@ + + Report Wizard Labor Cost + report + clinic.report.wizard.labor.cost + report_wizard_labor_cost + report_wizard_labor_cost + account_menu + diff --git a/netforce_clinic/actions/clinic_sickbed.xml b/netforce_clinic/actions/clinic_sickbed.xml index 5a0ae9a..a4b59ce 100644 --- a/netforce_clinic/actions/clinic_sickbed.xml +++ b/netforce_clinic/actions/clinic_sickbed.xml @@ -3,5 +3,6 @@ multi_view clinic.sickbed clinic_menu + 25 [["All",[]],["Archived",[["active","=",false]]],["Available",[["state","=","available"]]],["Not Available",[["state","=","not_available"]]]] diff --git a/netforce_clinic/actions/rdc_board.xml b/netforce_clinic/actions/rdc_board.xml new file mode 100644 index 0000000..723080b --- /dev/null +++ b/netforce_clinic/actions/rdc_board.xml @@ -0,0 +1,5 @@ + + template_view + rdc_page + account_menu + diff --git a/netforce_clinic/actions/report_hdcase_expense_summary.xml b/netforce_clinic/actions/report_hdcase_expense_summary.xml new file mode 100644 index 0000000..a842d6b --- /dev/null +++ b/netforce_clinic/actions/report_hdcase_expense_summary.xml @@ -0,0 +1,8 @@ + + HDCase Expense Summary + report + report.hdcase.expense.summary + report_hdcase_expense_summary + report_hdcase_expense_summary + account_menu + diff --git a/netforce_clinic/actions/report_hdcase_summary.xml b/netforce_clinic/actions/report_hdcase_summary.xml new file mode 100644 index 0000000..bf64ca8 --- /dev/null +++ b/netforce_clinic/actions/report_hdcase_summary.xml @@ -0,0 +1,9 @@ + + HD Case Summary + report + report.hdcase.summary + report_hdcase_summary + report_hdcase_summary + 1 + clinic_menu + diff --git a/netforce_clinic/controllers/__init__.py b/netforce_clinic/controllers/__init__.py index e69de29..c24bd68 100644 --- a/netforce_clinic/controllers/__init__.py +++ b/netforce_clinic/controllers/__init__.py @@ -0,0 +1 @@ +from . import json_rpc diff --git a/netforce_clinic/controllers/json_rpc.py b/netforce_clinic/controllers/json_rpc.py new file mode 100644 index 0000000..a465fb8 --- /dev/null +++ b/netforce_clinic/controllers/json_rpc.py @@ -0,0 +1,99 @@ +from netforce.controller import Controller +from netforce.model import get_model, clear_cache +from netforce import database +from netforce import access +import json +import traceback +import sys +import time +import random +from netforce.locale import translate +from netforce.utils import timeout +from netforce.log import rpc_log + + +class JsonRpc(Controller): + _path = "/json_rpc" + + def get(self): + self.render("base/json_rpc.xml") + + def post(self): + req = json.loads(self.request.body.decode()) + # open("/tmp/json_rpc.log","a").write(self.request.body.decode()+"\n###############################################################\n") + db = database.get_connection() + if db: + db.begin() + try: + clear_cache() + method = req["method"] + params = req["params"] + if method == "execute": + model = params[0] + method = params[1] + if method.startswith("_"): + raise Exception("Invalid method") + args = params[2] + if len(params) >= 4: + opts = params[3] or {} + else: + opts = {} + user_id = access.get_active_user() + rpc_log.info("EXECUTE db=%s model=%s method=%s user=%s" % + (database.get_active_db(), model, method, user_id)) + m = get_model(model) + f = getattr(m, method) + ctx = { + "request_handler": self, + "request": self.request, + } + ctx.update(self.get_cookies()) + opts.setdefault("context", {}).update(ctx) + with timeout(seconds=900): # XXX: can make this faster? (less signal sys handler overhead) + t0 = time.time() + res = f(*args, **opts) + t1 = time.time() + dt = (t1 - t0) * 1000 + rpc_log.info("<<< %d ms" % dt) + resp = { + "result": res, + "error": None, + "id": req["id"], + } + else: + raise Exception("Invalid method: %s" % method) + db = database.get_connection() + if db: + db.commit() + except Exception as e: + try: + msg = translate(str(e)) + except: + print("WARNING: Failed to translate error message") + msg = str(e) + rpc_log.error(msg) + db = database.get_connection() + if db: + db.rollback() + rpc_log.error(traceback.format_exc()) + err = { + "message": msg, + } + error_fields = getattr(e, "error_fields", None) + if error_fields: + err["error_fields"] = error_fields + resp = { + "result": None, + "error": err, + "id": req["id"], + } + access.clear_active_user() + try: + data = json.dumps(resp) + except: + print("JSONRPC ERROR: invalid response") + from pprint import pprint + pprint(resp) + self.write(data) + +JsonRpc.register() diff --git a/netforce_clinic/layouts/clinic_account_menu.xml b/netforce_clinic/layouts/clinic_account_menu.xml index 2b9c2a4..cb40bfd 100644 --- a/netforce_clinic/layouts/clinic_account_menu.xml +++ b/netforce_clinic/layouts/clinic_account_menu.xml @@ -1,34 +1,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/netforce_clinic/layouts/clinic_account_menu.xml.old b/netforce_clinic/layouts/clinic_account_menu.xml.old new file mode 100644 index 0000000..6477713 --- /dev/null +++ b/netforce_clinic/layouts/clinic_account_menu.xml.old @@ -0,0 +1,38 @@ + + + +
+ + + + + + + + + + + +
+ + + + + + + + + + +
+ + + +
+ + + + + + + diff --git a/netforce_clinic/layouts/clinic_account_setting.xml b/netforce_clinic/layouts/clinic_account_setting.xml index d0ff53a..0585c21 100644 --- a/netforce_clinic/layouts/clinic_account_setting.xml +++ b/netforce_clinic/layouts/clinic_account_setting.xml @@ -55,6 +55,7 @@ + diff --git a/netforce_clinic/layouts/clinic_dialyzer_form.xml b/netforce_clinic/layouts/clinic_dialyzer_form.xml index 07e5849..e91680b 100644 --- a/netforce_clinic/layouts/clinic_dialyzer_form.xml +++ b/netforce_clinic/layouts/clinic_dialyzer_form.xml @@ -16,7 +16,7 @@ - + diff --git a/netforce_clinic/layouts/clinic_dialyzer_list.xml b/netforce_clinic/layouts/clinic_dialyzer_list.xml index a4e31e0..afa5563 100644 --- a/netforce_clinic/layouts/clinic_dialyzer_list.xml +++ b/netforce_clinic/layouts/clinic_dialyzer_list.xml @@ -1,4 +1,4 @@ - + diff --git a/netforce_clinic/layouts/clinic_hd_case_dlz_form.xml b/netforce_clinic/layouts/clinic_hd_case_dlz_form.xml index 810ae6a..26d6fde 100644 --- a/netforce_clinic/layouts/clinic_hd_case_dlz_form.xml +++ b/netforce_clinic/layouts/clinic_hd_case_dlz_form.xml @@ -1,5 +1,6 @@
+ @@ -7,6 +8,11 @@ + + diff --git a/netforce_clinic/templates/report_account_hd_case_summary.hbs b/netforce_clinic/templates/report_hdcase_expense_summary.hbs similarity index 76% rename from netforce_clinic/templates/report_account_hd_case_summary.hbs rename to netforce_clinic/templates/report_hdcase_expense_summary.hbs index e64af47..96e08ab 100644 --- a/netforce_clinic/templates/report_account_hd_case_summary.hbs +++ b/netforce_clinic/templates/report_hdcase_expense_summary.hbs @@ -1,3 +1,24 @@ + +

{{title}} @@ -21,9 +42,9 @@ {{#ifeq reimbursable "no"}} - + {{else}} - + {{/ifeq}} {{#if ptype_id}} Total: {{total_qty}} @@ -53,7 +74,9 @@ Misc. Dlz Ref.Inv# + {{else}} Date Cycle# @@ -68,7 +91,9 @@ ค่ายา ค่าบริการฉีดยา Inv# + แพทย์ พยาบาล {{/ifeq}} @@ -98,21 +123,23 @@ {{/if}} {{epo_name}} - {{currency fee zero=""}} - {{currency mdc zero=""}} - {{currency lab zero=""}} - {{currency misc zero=""}} - {{currency dlz_price zero=""}} + {{fee}} + {{mdc}} + {{lab}} + {{misc}} + {{dlz_price}} {{#if inv_id}} {{view "link" string=inv_ref action="cust_invoice" action_options="form_view_xml&cust_invoice_form&mode=form" active_id=inv_id}} {{/if}} + {{else}} {{date}} {{cycle}} @@ -125,9 +152,9 @@ {{ptype}} {{hct}} {{epo_name}} - {{currency fee zero=""}} - {{currency mdc zero=""}} - {{currency srv zero=""}} + {{fee}} + {{mdc}} + {{srv}} {{#if inv_id}} {{view "link" string=inv_number action="cust_invoice" action_options="form_view_xml&cust_invoice_form&mode=form" active_id=inv_id}} @@ -136,6 +163,7 @@ {{/if}} + {{dname}} {{view "link" string="View" action="clinic_cycle_item" action_options="mode=form" active_id=cycle_item_id}} @@ -163,11 +192,12 @@ - {{currency total_fee zero=""}} - {{currency total_mdc zero=""}} - {{currency total_lab zero=""}} - {{currency total_misc zero=""}} - {{currency total_dlz zero=""}} + {{total_fee}} + {{total_mdc}} + {{total_lab}} + {{total_misc}} + {{total_dlz}} + {{else}} @@ -179,12 +209,33 @@ - {{currency total_fee zero=""}} - {{currency total_mdc zero=""}} - {{currency total_srv zero=""}} + {{total_fee}} + {{total_mdc}} + {{total_srv}} + {{/ifeq}} + + + diff --git a/netforce_clinic/templates/report_hdcase_summary.hbs b/netforce_clinic/templates/report_hdcase_summary.hbs new file mode 100644 index 0000000..828f730 --- /dev/null +++ b/netforce_clinic/templates/report_hdcase_summary.hbs @@ -0,0 +1,168 @@ +
+

+ {{title}} +

+

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

+

+ From {{date_from}} To {{date_to}} +

+
+ + + + + + + + + + {{#each lines}} + + + + + {{#ifeq qty '0'}} + + {{else}} + + {{/ifeq}} + + + {{/each}} + +
{{topic}}{{month}}เท่ากับ + {{qty}} + {{unit}}
+ + + + + + + + + + + + + +
+
+ + รายชื่อผู้ป่วยรับใหม่ + +
+
+
+ + รายชื่อผู้ป่วยจำหน่าย + +
+
+ + + + + + + + {{#if recent_patients}} + {{#each recent_patients}} + + + + + + + + {{/each}} + {{else}} + + + + {{/if}} + + + +
#วันที่ชื่อ
{{no}}{{reg_date}} + {{view "link" string=name action="clinic_patient_move" action_options="mode=form" active_id=pid}} +
+ No items to display. +
+
+ + + + + + + + {{#if resign_patients}} + {{#each resign_patients}} + + + + + + + + {{/each}} + {{else}} + + + + {{/if}} + + + +
#วันที่ชื่อ
{{no}}{{resign_date}} + {{view "link" string=name action="clinic_patient_move" action_options="mode=form" active_id=pid}} +
+ No items to display. +
+
+ +
+ + รวมจำนวนยาที่ใช้ประจำเดือน + +
+
+ + + {{#each titles}} + + {{/each}} + + + {{#each medicals}} + + + {{#each sub_lines}} + + {{/each}} + + {{/each}} + + + +
{{name}}
+ {{prod_name}} + + {{qty}} +
+
diff --git a/netforce_clinic/templates/report_receipt_summary.hbs b/netforce_clinic/templates/report_receipt_summary.hbs index d6365f3..07a7d2f 100644 --- a/netforce_clinic/templates/report_receipt_summary.hbs +++ b/netforce_clinic/templates/report_receipt_summary.hbs @@ -40,7 +40,7 @@ Print {{else}} {{/if}} diff --git a/netforce_clinic/todo.txt b/netforce_clinic/todo.txt index 5dd8b32..48df652 100644 --- a/netforce_clinic/todo.txt +++ b/netforce_clinic/todo.txt @@ -1,7 +1,10 @@ -redesign print payment & invoice from hdcase - - print payment - - direct payment - - invoice payment +========================================== +keep log: + patient_name, patient_type, walkin, location -migration: - match invoice less than 2015-06-30 to hdcase +=========================================== + +patient: + 1.new + 2. dispose + 3. move