fix: field order, minor fixes -
patient - update customer, releated fields patient appointment - send message
This commit is contained in:
parent
c02eceb989
commit
e30cc83591
@ -87,8 +87,8 @@ frappe.ui.form.on('Clinical Procedure', {
|
|||||||
['<a class="bold" href="#Form/Stock Entry/'+ r.message + '">' + r.message + '</a>']),
|
['<a class="bold" href="#Form/Stock Entry/'+ r.message + '">' + r.message + '</a>']),
|
||||||
indicator: 'green'
|
indicator: 'green'
|
||||||
});
|
});
|
||||||
frm.reload_doc();
|
|
||||||
}
|
}
|
||||||
|
frm.reload_doc();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -156,11 +156,13 @@ frappe.ui.form.on('Clinical Procedure', {
|
|||||||
age = __('{0} as on {1}', [age, data.message.age_as_on]);
|
age = __('{0} as on {1}', [age, data.message.age_as_on]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
frm.set_value('patient_name', data.message.patient_name);
|
||||||
frm.set_value('patient_age', age);
|
frm.set_value('patient_age', age);
|
||||||
frm.set_value('patient_sex', data.message.sex);
|
frm.set_value('patient_sex', data.message.sex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
frm.set_value('patient_name', '');
|
||||||
frm.set_value('patient_age', '');
|
frm.set_value('patient_age', '');
|
||||||
frm.set_value('patient_sex', '');
|
frm.set_value('patient_sex', '');
|
||||||
}
|
}
|
||||||
@ -179,6 +181,7 @@ frappe.ui.form.on('Clinical Procedure', {
|
|||||||
'patient':data.message.patient,
|
'patient':data.message.patient,
|
||||||
'procedure_template': data.message.procedure_template,
|
'procedure_template': data.message.procedure_template,
|
||||||
'medical_department': data.message.department,
|
'medical_department': data.message.department,
|
||||||
|
'practitioner': data.message.practitioner,
|
||||||
'start_date': data.message.appointment_date,
|
'start_date': data.message.appointment_date,
|
||||||
'start_time': data.message.appointment_time,
|
'start_time': data.message.appointment_time,
|
||||||
'notes': data.message.notes,
|
'notes': data.message.notes,
|
||||||
@ -188,8 +191,7 @@ frappe.ui.form.on('Clinical Procedure', {
|
|||||||
frm.set_value(values);
|
frm.set_value(values);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
let values = {
|
let values = {
|
||||||
'patient': '',
|
'patient': '',
|
||||||
'patient_name': '',
|
'patient_name': '',
|
||||||
@ -252,9 +254,11 @@ frappe.ui.form.on('Clinical Procedure', {
|
|||||||
name: frm.doc.practitioner
|
name: frm.doc.practitioner
|
||||||
},
|
},
|
||||||
callback: function (data) {
|
callback: function (data) {
|
||||||
frappe.model.set_value(frm.doctype,frm.docname, 'medical_department',data.message.department);
|
frappe.model.set_value(frm.doctype,frm.docname, 'practitioner_name', data.message.practitioner_name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
frappe.model.set_value(frm.doctype,frm.docname, 'practitioner_name', '');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -302,14 +306,6 @@ frappe.ui.form.on('Clinical Procedure', {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
cur_frm.set_query('procedure_template', function(doc) {
|
|
||||||
return {
|
|
||||||
filters: {
|
|
||||||
'medical_department': doc.medical_department
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
frappe.ui.form.on('Clinical Procedure Item', {
|
frappe.ui.form.on('Clinical Procedure Item', {
|
||||||
qty: function(frm, cdt, cdn) {
|
qty: function(frm, cdt, cdn) {
|
||||||
let d = locals[cdt][cdn];
|
let d = locals[cdt][cdn];
|
||||||
|
@ -9,27 +9,29 @@
|
|||||||
"field_order": [
|
"field_order": [
|
||||||
"naming_series",
|
"naming_series",
|
||||||
"appointment",
|
"appointment",
|
||||||
"column_break_30",
|
|
||||||
"procedure_template",
|
"procedure_template",
|
||||||
|
"column_break_30",
|
||||||
|
"company",
|
||||||
|
"invoiced",
|
||||||
"section_break_6",
|
"section_break_6",
|
||||||
"patient",
|
"patient",
|
||||||
"patient_name",
|
"patient_name",
|
||||||
"patient_sex",
|
"patient_sex",
|
||||||
"patient_age",
|
"patient_age",
|
||||||
"medical_department",
|
"inpatient_record",
|
||||||
"practitioner",
|
"notes",
|
||||||
"practitioner_name",
|
|
||||||
"column_break_7",
|
"column_break_7",
|
||||||
"status",
|
"status",
|
||||||
|
"practitioner",
|
||||||
|
"practitioner_name",
|
||||||
|
"medical_department",
|
||||||
"service_unit",
|
"service_unit",
|
||||||
"warehouse",
|
|
||||||
"start_date",
|
"start_date",
|
||||||
"start_time",
|
"start_time",
|
||||||
"sample",
|
"sample",
|
||||||
"invoiced",
|
|
||||||
"notes",
|
|
||||||
"consumables_section",
|
"consumables_section",
|
||||||
"consume_stock",
|
"consume_stock",
|
||||||
|
"warehouse",
|
||||||
"items",
|
"items",
|
||||||
"section_break_24",
|
"section_break_24",
|
||||||
"invoice_separately_as_consumables",
|
"invoice_separately_as_consumables",
|
||||||
@ -38,8 +40,6 @@
|
|||||||
"column_break_27",
|
"column_break_27",
|
||||||
"consumption_details",
|
"consumption_details",
|
||||||
"sb_refs",
|
"sb_refs",
|
||||||
"inpatient_record",
|
|
||||||
"company",
|
|
||||||
"column_break_34",
|
"column_break_34",
|
||||||
"prescription",
|
"prescription",
|
||||||
"amended_from"
|
"amended_from"
|
||||||
@ -64,10 +64,10 @@
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"in_standard_filter": 1,
|
"in_standard_filter": 1,
|
||||||
"label": "Appointment",
|
"label": "Appointment",
|
||||||
"options": "Patient Appointment"
|
"options": "Patient Appointment",
|
||||||
|
"set_only_once": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fetch_from": "inpatient_record.patient",
|
|
||||||
"fieldname": "patient",
|
"fieldname": "patient",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"in_standard_filter": 1,
|
"in_standard_filter": 1,
|
||||||
@ -217,6 +217,7 @@
|
|||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"depends_on": "eval:!doc.__islocal",
|
||||||
"fieldname": "status",
|
"fieldname": "status",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
@ -235,6 +236,8 @@
|
|||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"collapsible": 1,
|
||||||
|
"collapsible_depends_on": "consume_stock",
|
||||||
"fieldname": "consumables_section",
|
"fieldname": "consumables_section",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Consumables"
|
"label": "Consumables"
|
||||||
@ -261,14 +264,12 @@
|
|||||||
"fieldtype": "Section Break"
|
"fieldtype": "Section Break"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fetch_from": "patient.patient_name",
|
|
||||||
"fieldname": "patient_name",
|
"fieldname": "patient_name",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Patient Name",
|
"label": "Patient Name",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fetch_from": "practitioner.practitioner_name",
|
|
||||||
"fieldname": "practitioner_name",
|
"fieldname": "practitioner_name",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
@ -282,7 +283,7 @@
|
|||||||
],
|
],
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-04-03 23:06:04.009856",
|
"modified": "2020-04-24 22:53:13.156901",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Healthcare",
|
"module": "Healthcare",
|
||||||
"name": "Clinical Procedure",
|
"name": "Clinical Procedure",
|
||||||
@ -298,6 +299,21 @@
|
|||||||
"report": 1,
|
"report": 1,
|
||||||
"role": "Nursing User",
|
"role": "Nursing User",
|
||||||
"share": 1,
|
"share": 1,
|
||||||
|
"submit": 1,
|
||||||
|
"write": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cancel": 1,
|
||||||
|
"create": 1,
|
||||||
|
"delete": 1,
|
||||||
|
"email": 1,
|
||||||
|
"export": 1,
|
||||||
|
"print": 1,
|
||||||
|
"read": 1,
|
||||||
|
"report": 1,
|
||||||
|
"role": "Physician",
|
||||||
|
"share": 1,
|
||||||
|
"submit": 1,
|
||||||
"write": 1
|
"write": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -137,13 +137,13 @@ var get_lab_test_prescribed = function(frm){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
frappe.msgprint(__("Please select a Patient to get Lab Orders"));
|
frappe.msgprint(__("Please select a Patient to get Lab Tests"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var show_lab_tests = function(frm, result){
|
var show_lab_tests = function(frm, result){
|
||||||
var d = new frappe.ui.Dialog({
|
var d = new frappe.ui.Dialog({
|
||||||
title: __("Lab Test Prescriptions"),
|
title: __("Lab Tests"),
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
fieldtype: "HTML", fieldname: "lab_test"
|
fieldtype: "HTML", fieldname: "lab_test"
|
||||||
@ -161,7 +161,7 @@ var show_lab_tests = function(frm, result){
|
|||||||
<div class="col-xs-1">\
|
<div class="col-xs-1">\
|
||||||
<a data-name="%(name)s" data-lab-test="%(lab_test)s"\
|
<a data-name="%(name)s" data-lab-test="%(lab_test)s"\
|
||||||
data-encounter="%(encounter)s" data-practitioner="%(practitioner)s"\
|
data-encounter="%(encounter)s" data-practitioner="%(practitioner)s"\
|
||||||
data-invoiced="%(invoiced)s" href="#"><button class="btn btn-default btn-xs">Get Lab Test\
|
data-invoiced="%(invoiced)s" href="#"><button class="btn btn-default btn-xs">Get Lab Tests\
|
||||||
</button></a></div></div>', {name:y[0], lab_test: y[1], encounter:y[2], invoiced:y[3], practitioner:y[4], date:y[5]})).appendTo(html_field);
|
</button></a></div></div>', {name:y[0], lab_test: y[1], encounter:y[2], invoiced:y[3], practitioner:y[4], date:y[5]})).appendTo(html_field);
|
||||||
row.find("a").click(function() {
|
row.find("a").click(function() {
|
||||||
frm.doc.template = $(this).attr("data-lab-test");
|
frm.doc.template = $(this).attr("data-lab-test");
|
||||||
@ -181,7 +181,7 @@ var show_lab_tests = function(frm, result){
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
if(!result.length){
|
if(!result.length){
|
||||||
var msg = "No Lab Orders found for patient <b>" + frm.doc.patient_name + "</b>";
|
var msg = __("No Lab Tests found for the Patient {0}", [frm.doc.patient_name.bold()]);
|
||||||
html_field.empty();
|
html_field.empty();
|
||||||
$(repl('<div class="col-xs-12" style="padding-top:0px;" >%(msg)s</div>', {msg: msg})).appendTo(html_field);
|
$(repl('<div class="col-xs-12" style="padding-top:0px;" >%(msg)s</div>', {msg: msg})).appendTo(html_field);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ def create_multiple(doctype, docname):
|
|||||||
lab_test_created = create_lab_test_from_encounter(docname)
|
lab_test_created = create_lab_test_from_encounter(docname)
|
||||||
|
|
||||||
if lab_test_created:
|
if lab_test_created:
|
||||||
frappe.msgprint(_("Lab Test(s) " + lab_test_created + " created."))
|
frappe.msgprint(_("Lab Test(s) {0} created".format(lab_test_created)))
|
||||||
else:
|
else:
|
||||||
frappe.msgprint(_("No Lab Tests created"))
|
frappe.msgprint(_("No Lab Tests created"))
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ def create_lab_test_from_invoice(invoice_name):
|
|||||||
if lab_test_created != 1:
|
if lab_test_created != 1:
|
||||||
template = get_lab_test_template(item.item_code)
|
template = get_lab_test_template(item.item_code)
|
||||||
if template:
|
if template:
|
||||||
lab_test = create_lab_test_doc(True, invoice.ref_practitioner, patient, template, company, invoice.company)
|
lab_test = create_lab_test_doc(True, invoice.ref_practitioner, patient, template, invoice.company)
|
||||||
if item.reference_dt == "Lab Prescription":
|
if item.reference_dt == "Lab Prescription":
|
||||||
lab_test.prescription = item.reference_dn
|
lab_test.prescription = item.reference_dn
|
||||||
lab_test.save(ignore_permissions = True)
|
lab_test.save(ignore_permissions = True)
|
||||||
|
@ -10,6 +10,8 @@ frappe.ui.form.on('Patient', {
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
frm.set_query('customer_group', {'is_group': 0});
|
||||||
|
frm.set_query('default_price_list', { 'selling': 1});
|
||||||
|
|
||||||
if (frappe.defaults.get_default('patient_name_by') != 'Naming Series') {
|
if (frappe.defaults.get_default('patient_name_by') != 'Naming Series') {
|
||||||
frm.toggle_display('naming_series', false);
|
frm.toggle_display('naming_series', false);
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "inpatient_status",
|
"fieldname": "inpatient_status",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
|
"in_preview": 1,
|
||||||
"label": "Inpatient Status",
|
"label": "Inpatient Status",
|
||||||
"options": "\nAdmission Scheduled\nAdmitted\nDischarge Scheduled",
|
"options": "\nAdmission Scheduled\nAdmitted\nDischarge Scheduled",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
@ -106,6 +107,7 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "sex",
|
"fieldname": "sex",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
|
"in_preview": 1,
|
||||||
"label": "Gender",
|
"label": "Gender",
|
||||||
"options": "Gender",
|
"options": "Gender",
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
@ -114,6 +116,7 @@
|
|||||||
"bold": 1,
|
"bold": 1,
|
||||||
"fieldname": "blood_group",
|
"fieldname": "blood_group",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
|
"in_preview": 1,
|
||||||
"label": "Blood Group",
|
"label": "Blood Group",
|
||||||
"options": "\nA Positive\nA Negative\nAB Positive\nAB Negative\nB Positive\nB Negative\nO Positive\nO Negative"
|
"options": "\nA Positive\nA Negative\nAB Positive\nAB Negative\nB Positive\nB Negative\nO Positive\nO Negative"
|
||||||
},
|
},
|
||||||
@ -121,6 +124,7 @@
|
|||||||
"bold": 1,
|
"bold": 1,
|
||||||
"fieldname": "dob",
|
"fieldname": "dob",
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
|
"in_preview": 1,
|
||||||
"label": "Date of birth"
|
"label": "Date of birth"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -147,6 +151,7 @@
|
|||||||
"fieldname": "image",
|
"fieldname": "image",
|
||||||
"fieldtype": "Attach Image",
|
"fieldtype": "Attach Image",
|
||||||
"hidden": 1,
|
"hidden": 1,
|
||||||
|
"in_preview": 1,
|
||||||
"label": "Image",
|
"label": "Image",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
@ -161,9 +166,9 @@
|
|||||||
"fieldname": "customer",
|
"fieldname": "customer",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"ignore_user_permissions": 1,
|
"ignore_user_permissions": 1,
|
||||||
"in_preview": 1,
|
|
||||||
"label": "Customer",
|
"label": "Customer",
|
||||||
"options": "Customer"
|
"options": "Customer",
|
||||||
|
"set_only_once": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "report_preference",
|
"fieldname": "report_preference",
|
||||||
@ -390,7 +395,7 @@
|
|||||||
"image_field": "image",
|
"image_field": "image",
|
||||||
"links": [],
|
"links": [],
|
||||||
"max_attachments": 50,
|
"max_attachments": 50,
|
||||||
"modified": "2020-04-11 14:53:48.767245",
|
"modified": "2020-04-25 17:24:32.146415",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Healthcare",
|
"module": "Healthcare",
|
||||||
"name": "Patient",
|
"name": "Patient",
|
||||||
|
@ -10,6 +10,7 @@ from frappe.utils import cint, cstr, getdate
|
|||||||
import dateutil
|
import dateutil
|
||||||
from frappe.model.naming import set_name_by_naming_series
|
from frappe.model.naming import set_name_by_naming_series
|
||||||
from frappe.utils.nestedset import get_root_of
|
from frappe.utils.nestedset import get_root_of
|
||||||
|
from erpnext import get_default_currency
|
||||||
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account, get_income_account, send_registration_sms
|
from erpnext.healthcare.doctype.healthcare_settings.healthcare_settings import get_receivable_account, get_income_account, send_registration_sms
|
||||||
|
|
||||||
class Patient(Document):
|
class Patient(Document):
|
||||||
@ -17,6 +18,9 @@ class Patient(Document):
|
|||||||
self.set_full_name()
|
self.set_full_name()
|
||||||
self.add_as_website_user()
|
self.add_as_website_user()
|
||||||
|
|
||||||
|
def before_insert(self):
|
||||||
|
self.set_missing_customer_details()
|
||||||
|
|
||||||
def after_insert(self):
|
def after_insert(self):
|
||||||
self.add_as_website_user()
|
self.add_as_website_user()
|
||||||
self.reload()
|
self.reload()
|
||||||
@ -28,12 +32,44 @@ class Patient(Document):
|
|||||||
send_registration_sms(self)
|
send_registration_sms(self)
|
||||||
self.reload() # self.notify_update()
|
self.reload() # self.notify_update()
|
||||||
|
|
||||||
|
def on_update(self):
|
||||||
|
if self.customer:
|
||||||
|
customer = frappe.get_doc('Customer', self.customer)
|
||||||
|
if self.customer_group:
|
||||||
|
customer.customer_group = self.customer_group
|
||||||
|
if self.territory:
|
||||||
|
customer.territory = self.territory
|
||||||
|
|
||||||
|
customer.default_price_list = self.default_price_list
|
||||||
|
customer.default_currency = self.default_currency
|
||||||
|
customer.language = self.language
|
||||||
|
customer.save(ignore_permissions=True)
|
||||||
|
else:
|
||||||
|
if frappe.db.get_single_value('Healthcare Settings', 'link_customer_to_patient'):
|
||||||
|
create_customer(self)
|
||||||
|
|
||||||
def set_full_name(self):
|
def set_full_name(self):
|
||||||
if self.last_name:
|
if self.last_name:
|
||||||
self.patient_name = ' '.join(filter(None, [self.first_name, self.last_name]))
|
self.patient_name = ' '.join(filter(None, [self.first_name, self.last_name]))
|
||||||
else:
|
else:
|
||||||
self.patient_name = self.first_name
|
self.patient_name = self.first_name
|
||||||
|
|
||||||
|
def set_missing_customer_details(self):
|
||||||
|
if not self.customer_group:
|
||||||
|
self.customer_group = frappe.db.get_single_value('Selling Settings', 'customer_group') or get_root_of('Customer Group')
|
||||||
|
if not self.territory:
|
||||||
|
self.territory = frappe.db.get_single_value('Selling Settings', 'territory') or get_root_of('Territory')
|
||||||
|
if not self.default_price_list:
|
||||||
|
self.default_price_list = frappe.db.get_single_value('Selling Settings', 'selling_price_list')
|
||||||
|
|
||||||
|
if not self.customer_group or not self.territory or not self.default_price_list:
|
||||||
|
frappe.msgprint(_('Please set defaults for Customer Group, Territory and Selling Price List in Selling Settings'), alert=True)
|
||||||
|
|
||||||
|
if not self.default_currency:
|
||||||
|
self.default_currency = get_default_currency()
|
||||||
|
if not self.language:
|
||||||
|
self.language = frappe.db.get_single_value('System Settings', 'language')
|
||||||
|
|
||||||
def add_as_website_user(self):
|
def add_as_website_user(self):
|
||||||
if self.email:
|
if self.email:
|
||||||
if not frappe.db.exists ('User', self.email):
|
if not frappe.db.exists ('User', self.email):
|
||||||
@ -87,21 +123,14 @@ class Patient(Document):
|
|||||||
return {'invoice': sales_invoice.name}
|
return {'invoice': sales_invoice.name}
|
||||||
|
|
||||||
def create_customer(doc):
|
def create_customer(doc):
|
||||||
customer_group = doc.customer_group or frappe.db.get_single_value('Selling Settings', 'customer_group')
|
|
||||||
territory = doc.territory or frappe.db.get_single_value('Selling Settings', 'territory')
|
|
||||||
if not (customer_group and territory):
|
|
||||||
customer_group = get_root_of('Customer Group')
|
|
||||||
territory = get_root_of('Territory')
|
|
||||||
frappe.msgprint(_('Please set default customer group and territory in Selling Settings'), alert=True)
|
|
||||||
|
|
||||||
customer = frappe.get_doc({
|
customer = frappe.get_doc({
|
||||||
'doctype': 'Customer',
|
'doctype': 'Customer',
|
||||||
'customer_name': doc.patient_name,
|
'customer_name': doc.patient_name,
|
||||||
'customer_group': customer_group,
|
'customer_group': doc.customer_group or frappe.db.get_single_value('Selling Settings', 'customer_group'),
|
||||||
'territory' : territory,
|
'territory' : doc.territory or frappe.db.get_single_value('Selling Settings', 'territory'),
|
||||||
'customer_type': 'Individual',
|
'customer_type': 'Individual',
|
||||||
'default_currency': doc.default_currency,
|
'default_currency': doc.default_currency,
|
||||||
'default_price_ist': doc.default_price_list,
|
'default_price_list': doc.default_price_list,
|
||||||
'language': doc.language
|
'language': doc.language
|
||||||
}).insert(ignore_permissions=True, ignore_mandatory=True)
|
}).insert(ignore_permissions=True, ignore_mandatory=True)
|
||||||
|
|
||||||
|
@ -127,6 +127,11 @@ frappe.ui.form.on('Patient Appointment', {
|
|||||||
patient: function(frm) {
|
patient: function(frm) {
|
||||||
if (frm.doc.patient) {
|
if (frm.doc.patient) {
|
||||||
frm.trigger('toggle_payment_fields');
|
frm.trigger('toggle_payment_fields');
|
||||||
|
} else {
|
||||||
|
frm.set_value('patient_name', '');
|
||||||
|
frm.set_value('patient_sex', '');
|
||||||
|
frm.set_value('patient_age', '');
|
||||||
|
frm.set_value('inpatient_record', '');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -10,33 +10,30 @@
|
|||||||
"engine": "InnoDB",
|
"engine": "InnoDB",
|
||||||
"field_order": [
|
"field_order": [
|
||||||
"naming_series",
|
"naming_series",
|
||||||
|
"status",
|
||||||
"patient",
|
"patient",
|
||||||
"patient_name",
|
"patient_name",
|
||||||
"patient_sex",
|
"patient_sex",
|
||||||
"patient_age",
|
"patient_age",
|
||||||
"column_break_1",
|
|
||||||
"inpatient_record",
|
"inpatient_record",
|
||||||
|
"column_break_1",
|
||||||
"company",
|
"company",
|
||||||
"service_unit",
|
"service_unit",
|
||||||
"status",
|
|
||||||
"section_break_11",
|
|
||||||
"get_procedure_from_encounter",
|
|
||||||
"column_break_13",
|
|
||||||
"procedure_template",
|
"procedure_template",
|
||||||
|
"get_procedure_from_encounter",
|
||||||
"procedure_prescription",
|
"procedure_prescription",
|
||||||
"therapy_type",
|
"therapy_type",
|
||||||
"get_prescribed_therapies",
|
"get_prescribed_therapies",
|
||||||
"therapy_plan",
|
"therapy_plan",
|
||||||
"service_unit",
|
|
||||||
"section_break_12",
|
|
||||||
"practitioner",
|
"practitioner",
|
||||||
"department",
|
"department",
|
||||||
|
"section_break_12",
|
||||||
"appointment_type",
|
"appointment_type",
|
||||||
|
"duration",
|
||||||
"column_break_17",
|
"column_break_17",
|
||||||
"appointment_date",
|
"appointment_date",
|
||||||
"appointment_time",
|
"appointment_time",
|
||||||
"appointment_datetime",
|
"appointment_datetime",
|
||||||
"duration",
|
|
||||||
"section_break_16",
|
"section_break_16",
|
||||||
"mode_of_payment",
|
"mode_of_payment",
|
||||||
"billing_item",
|
"billing_item",
|
||||||
@ -45,9 +42,10 @@
|
|||||||
"invoiced",
|
"invoiced",
|
||||||
"ref_sales_invoice",
|
"ref_sales_invoice",
|
||||||
"section_break_3",
|
"section_break_3",
|
||||||
"notes",
|
|
||||||
"referring_practitioner",
|
"referring_practitioner",
|
||||||
"reminded"
|
"reminded",
|
||||||
|
"column_break_36",
|
||||||
|
"notes"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
@ -59,7 +57,6 @@
|
|||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fetch_from": "inpatient_record.patient",
|
|
||||||
"fieldname": "patient",
|
"fieldname": "patient",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"ignore_user_permissions": 1,
|
"ignore_user_permissions": 1,
|
||||||
@ -83,7 +80,8 @@
|
|||||||
"fieldname": "duration",
|
"fieldname": "duration",
|
||||||
"fieldtype": "Int",
|
"fieldtype": "Int",
|
||||||
"in_filter": 1,
|
"in_filter": 1,
|
||||||
"label": "Duration (In Minutes)"
|
"label": "Duration (In Minutes)",
|
||||||
|
"set_only_once": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "column_break_1",
|
"fieldname": "column_break_1",
|
||||||
@ -102,6 +100,7 @@
|
|||||||
"search_index": 1
|
"search_index": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"depends_on": "eval:doc.patient;",
|
||||||
"fieldname": "procedure_template",
|
"fieldname": "procedure_template",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Clinical Procedure Template",
|
"label": "Clinical Procedure Template",
|
||||||
@ -133,7 +132,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "section_break_12",
|
"fieldname": "section_break_12",
|
||||||
"fieldtype": "Section Break"
|
"fieldtype": "Section Break",
|
||||||
|
"label": "Appointment Details"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "practitioner",
|
"fieldname": "practitioner",
|
||||||
@ -179,11 +179,13 @@
|
|||||||
"fieldtype": "Time",
|
"fieldtype": "Time",
|
||||||
"in_list_view": 1,
|
"in_list_view": 1,
|
||||||
"label": "Time",
|
"label": "Time",
|
||||||
"read_only": 1
|
"read_only": 1,
|
||||||
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "section_break_16",
|
"fieldname": "section_break_16",
|
||||||
"fieldtype": "Section Break"
|
"fieldtype": "Section Break",
|
||||||
|
"label": "Payments"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fetch_from": "patient.patient_name",
|
"fetch_from": "patient.patient_name",
|
||||||
@ -212,6 +214,7 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "appointment_datetime",
|
"fieldname": "appointment_datetime",
|
||||||
"fieldtype": "Datetime",
|
"fieldtype": "Datetime",
|
||||||
|
"hidden": 1,
|
||||||
"label": "Appointment Datetime",
|
"label": "Appointment Datetime",
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
@ -243,9 +246,12 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "company",
|
"fieldname": "company",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
|
"in_standard_filter": 1,
|
||||||
"label": "Company",
|
"label": "Company",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"options": "Company"
|
"options": "Company",
|
||||||
|
"reqd": 1,
|
||||||
|
"set_only_once": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"collapsible": 1,
|
"collapsible": 1,
|
||||||
@ -311,24 +317,20 @@
|
|||||||
"options": "HLC-APP-.YYYY.-",
|
"options": "HLC-APP-.YYYY.-",
|
||||||
"set_only_once": 1
|
"set_only_once": 1
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "section_break_11",
|
|
||||||
"fieldtype": "Section Break"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"fieldname": "column_break_13",
|
|
||||||
"fieldtype": "Column Break"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "billing_item",
|
"fieldname": "billing_item",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Billing Item",
|
"label": "Billing Item",
|
||||||
"options": "Item",
|
"options": "Item",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "column_break_36",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-04-23 11:16:34.981240",
|
"modified": "2020-04-25 17:23:49.841975",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Healthcare",
|
"module": "Healthcare",
|
||||||
"name": "Patient Appointment",
|
"name": "Patient Appointment",
|
||||||
|
@ -369,17 +369,19 @@ def send_appointment_reminder():
|
|||||||
frappe.db.set_value('Patient Appointment', doc.name, 'reminded', 1)
|
frappe.db.set_value('Patient Appointment', doc.name, 'reminded', 1)
|
||||||
|
|
||||||
def send_message(doc, message):
|
def send_message(doc, message):
|
||||||
patient = frappe.get_doc('Patient', doc.patient)
|
patient_mobile = frappe.db.get_value("Patient", doc.patient, "mobile")
|
||||||
if patient.mobile:
|
if patient_mobile:
|
||||||
context = {'doc': doc, 'alert': doc, 'comments': None}
|
context = {'doc': doc, 'alert': doc, 'comments': None}
|
||||||
if doc.get('_comments'):
|
if doc.get('_comments'):
|
||||||
context['comments'] = json.loads(doc.get('_comments'))
|
context['comments'] = json.loads(doc.get('_comments'))
|
||||||
|
|
||||||
# jinja to string convertion happens here
|
# jinja to string convertion happens here
|
||||||
message = frappe.render_template(message, context)
|
message = frappe.render_template(message, context)
|
||||||
number = [patient.mobile]
|
number = [patient_mobile]
|
||||||
send_sms(number, message)
|
try:
|
||||||
|
send_sms(number, message)
|
||||||
|
except Exception as e:
|
||||||
|
frappe.msgprint(_("SMS not sent, please check SMS Settings"), alert=True)
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_events(start, end, filters=None):
|
def get_events(start, end, filters=None):
|
||||||
|
@ -25,15 +25,16 @@ frappe.ui.form.on('Patient Encounter', {
|
|||||||
refresh_field('lab_test_prescription');
|
refresh_field('lab_test_prescription');
|
||||||
|
|
||||||
if (!frm.doc.__islocal) {
|
if (!frm.doc.__islocal) {
|
||||||
|
if (frm.doc.docstatus == 1) {
|
||||||
if (frm.doc.inpatient_status == 'Admission Scheduled' || frm.doc.inpatient_status == 'Admitted') {
|
if (frm.doc.inpatient_status == 'Admission Scheduled' || frm.doc.inpatient_status == 'Admitted') {
|
||||||
frm.add_custom_button(__('Schedule Discharge'), function() {
|
frm.add_custom_button(__('Schedule Discharge'), function() {
|
||||||
schedule_discharge(frm);
|
schedule_discharge(frm);
|
||||||
});
|
});
|
||||||
} else if (frm.doc.inpatient_status != 'Discharge Scheduled') {
|
} else if (frm.doc.inpatient_status != 'Discharge Scheduled') {
|
||||||
frm.add_custom_button(__('Schedule Admission'), function() {
|
frm.add_custom_button(__('Schedule Admission'), function() {
|
||||||
schedule_inpatient(frm);
|
schedule_inpatient(frm);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
frm.add_custom_button(__('Patient History'), function() {
|
frm.add_custom_button(__('Patient History'), function() {
|
||||||
@ -101,6 +102,11 @@ frappe.ui.form.on('Patient Encounter', {
|
|||||||
frm.events.set_patient_info(frm);
|
frm.events.set_patient_info(frm);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
practitioner: function(frm) {
|
||||||
|
if(!frm.doc.practitioner) {
|
||||||
|
frm.set_value('practitioner_name', '');
|
||||||
|
}
|
||||||
|
},
|
||||||
set_appointment_fields: function(frm) {
|
set_appointment_fields: function(frm) {
|
||||||
if (frm.doc.appointment) {
|
if (frm.doc.appointment) {
|
||||||
frappe.call({
|
frappe.call({
|
||||||
@ -118,6 +124,7 @@ frappe.ui.form.on('Patient Encounter', {
|
|||||||
'company': data.message.company
|
'company': data.message.company
|
||||||
};
|
};
|
||||||
frm.set_value(values);
|
frm.set_value(values);
|
||||||
|
frm.set_df_property('patient', 'read_only', 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -134,6 +141,7 @@ frappe.ui.form.on('Patient Encounter', {
|
|||||||
'inpatient_status': ''
|
'inpatient_status': ''
|
||||||
};
|
};
|
||||||
frm.set_value(values);
|
frm.set_value(values);
|
||||||
|
frm.set_df_property('patient', 'read_only', 0);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -149,15 +157,20 @@ frappe.ui.form.on('Patient Encounter', {
|
|||||||
if (data.message.dob) {
|
if (data.message.dob) {
|
||||||
age = calculate_age(data.message.dob);
|
age = calculate_age(data.message.dob);
|
||||||
}
|
}
|
||||||
|
frappe.model.set_value(frm.doctype, frm.docname, 'patient_mame', data.message.patient_mame);
|
||||||
frappe.model.set_value(frm.doctype, frm.docname, 'patient_age', age);
|
frappe.model.set_value(frm.doctype, frm.docname, 'patient_age', age);
|
||||||
frappe.model.set_value(frm.doctype, frm.docname, 'patient_sex', data.message.sex);
|
frappe.model.set_value(frm.doctype, frm.docname, 'patient_sex', data.message.sex);
|
||||||
if (data.message.inpatient_record) {
|
if (data.message.inpatient_record) {
|
||||||
frappe.model.set_value(frm.doctype, frm.docname, 'inpatient_record', data.message.inpatient_record);
|
frappe.model.set_value(frm.doctype, frm.docname, 'inpatient_record', data.message.inpatient_record);
|
||||||
frappe.model.set_value(frm.doctype, frm.docname, 'inpatient_status', data.message.inpatient_status);
|
frappe.model.set_value(frm.doctype, frm.docname, 'inpatient_status', data.message.inpatient_status);
|
||||||
|
} else {
|
||||||
|
frappe.model.set_value(frm.doctype, frm.docname, 'inpatient_record', '');
|
||||||
|
frappe.model.set_value(frm.doctype, frm.docname, 'inpatient_status', '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
frappe.model.set_value(frm.doctype, frm.docname, 'patient_mame', '');
|
||||||
frappe.model.set_value(frm.doctype, frm.docname, 'patient_sex', '');
|
frappe.model.set_value(frm.doctype, frm.docname, 'patient_sex', '');
|
||||||
frappe.model.set_value(frm.doctype, frm.docname, 'patient_age', '');
|
frappe.model.set_value(frm.doctype, frm.docname, 'patient_age', '');
|
||||||
frappe.model.set_value(frm.doctype, frm.docname, 'inpatient_record', '');
|
frappe.model.set_value(frm.doctype, frm.docname, 'inpatient_record', '');
|
||||||
|
@ -17,17 +17,16 @@
|
|||||||
"patient_name",
|
"patient_name",
|
||||||
"patient_sex",
|
"patient_sex",
|
||||||
"patient_age",
|
"patient_age",
|
||||||
|
"inpatient_record",
|
||||||
|
"inpatient_status",
|
||||||
"column_break_6",
|
"column_break_6",
|
||||||
|
"company",
|
||||||
|
"encounter_date",
|
||||||
|
"encounter_time",
|
||||||
"practitioner",
|
"practitioner",
|
||||||
"practitioner_name",
|
"practitioner_name",
|
||||||
"medical_department",
|
"medical_department",
|
||||||
"encounter_date",
|
|
||||||
"encounter_time",
|
|
||||||
"invoiced",
|
"invoiced",
|
||||||
"section_break_1",
|
|
||||||
"inpatient_record",
|
|
||||||
"column_break_17",
|
|
||||||
"inpatient_status",
|
|
||||||
"sb_symptoms",
|
"sb_symptoms",
|
||||||
"symptoms",
|
"symptoms",
|
||||||
"symptoms_in_print",
|
"symptoms_in_print",
|
||||||
@ -48,7 +47,6 @@
|
|||||||
"section_break_33",
|
"section_break_33",
|
||||||
"encounter_comment",
|
"encounter_comment",
|
||||||
"sb_refs",
|
"sb_refs",
|
||||||
"company",
|
|
||||||
"amended_from"
|
"amended_from"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
@ -59,12 +57,6 @@
|
|||||||
"options": "Inpatient Record",
|
"options": "Inpatient Record",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"collapsible": 1,
|
|
||||||
"fieldname": "section_break_1",
|
|
||||||
"fieldtype": "Section Break",
|
|
||||||
"label": "Inpatient Details"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "naming_series",
|
"fieldname": "naming_series",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
@ -79,10 +71,10 @@
|
|||||||
"ignore_user_permissions": 1,
|
"ignore_user_permissions": 1,
|
||||||
"label": "Appointment",
|
"label": "Appointment",
|
||||||
"options": "Patient Appointment",
|
"options": "Patient Appointment",
|
||||||
"search_index": 1
|
"search_index": 1,
|
||||||
|
"set_only_once": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fetch_from": "inpatient_record.patient",
|
|
||||||
"fieldname": "patient",
|
"fieldname": "patient",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"ignore_user_permissions": 1,
|
"ignore_user_permissions": 1,
|
||||||
@ -93,7 +85,6 @@
|
|||||||
"search_index": 1
|
"search_index": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fetch_from": "patient.patient_name",
|
|
||||||
"fieldname": "patient_name",
|
"fieldname": "patient_name",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Patient Name",
|
"label": "Patient Name",
|
||||||
@ -206,29 +197,29 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "codification_table",
|
"fieldname": "codification_table",
|
||||||
"fieldtype": "Table",
|
"fieldtype": "Table",
|
||||||
"label": "Medical Coding",
|
"label": "Medical Codes",
|
||||||
"options": "Codification Table"
|
"options": "Codification Table"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "sb_drug_prescription",
|
"fieldname": "sb_drug_prescription",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Medication"
|
"label": "Medications"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "drug_prescription",
|
"fieldname": "drug_prescription",
|
||||||
"fieldtype": "Table",
|
"fieldtype": "Table",
|
||||||
"label": "Drug Prescription",
|
"label": "Items",
|
||||||
"options": "Drug Prescription"
|
"options": "Drug Prescription"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "sb_test_prescription",
|
"fieldname": "sb_test_prescription",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"label": "Investigation"
|
"label": "Investigations"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "lab_test_prescription",
|
"fieldname": "lab_test_prescription",
|
||||||
"fieldtype": "Table",
|
"fieldtype": "Table",
|
||||||
"label": "Lab Prescription",
|
"label": "Lab Tests",
|
||||||
"options": "Lab Prescription"
|
"options": "Lab Prescription"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -239,7 +230,7 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "procedure_prescription",
|
"fieldname": "procedure_prescription",
|
||||||
"fieldtype": "Table",
|
"fieldtype": "Table",
|
||||||
"label": "Procedure Prescription",
|
"label": "Clinical Procedures",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"options": "Procedure Prescription"
|
"options": "Procedure Prescription"
|
||||||
},
|
},
|
||||||
@ -309,10 +300,6 @@
|
|||||||
"label": "Inpatient Status",
|
"label": "Inpatient Status",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"fieldname": "column_break_17",
|
|
||||||
"fieldtype": "Column Break"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"fieldname": "sb_refs",
|
"fieldname": "sb_refs",
|
||||||
"fieldtype": "Section Break"
|
"fieldtype": "Section Break"
|
||||||
@ -328,7 +315,7 @@
|
|||||||
],
|
],
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-04-23 23:06:16.348846",
|
"modified": "2020-04-27 18:59:25.713887",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Healthcare",
|
"module": "Healthcare",
|
||||||
"name": "Patient Encounter",
|
"name": "Patient Encounter",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user