feat: set title for appointment, encounter, procedure and vitals

This commit is contained in:
anoop 2020-04-27 23:42:22 +05:30
parent ca6f3ec977
commit 0f541cb7ab
9 changed files with 113 additions and 34 deletions

View File

@ -8,6 +8,7 @@
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"naming_series", "naming_series",
"title",
"appointment", "appointment",
"procedure_template", "procedure_template",
"column_break_30", "column_break_30",
@ -279,11 +280,21 @@
{ {
"fieldname": "column_break_34", "fieldname": "column_break_34",
"fieldtype": "Column Break" "fieldtype": "Column Break"
},
{
"allow_on_submit": 1,
"fieldname": "title",
"fieldtype": "Data",
"hidden": 1,
"label": "Title",
"no_copy": 1,
"print_hide": 1,
"read_only": 1
} }
], ],
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2020-04-24 22:53:13.156901", "modified": "2020-04-27 21:36:23.796924",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Healthcare", "module": "Healthcare",
"name": "Clinical Procedure", "name": "Clinical Procedure",
@ -320,6 +331,6 @@
"restrict_to_domain": "Healthcare", "restrict_to_domain": "Healthcare",
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"title_field": "patient_name", "title_field": "title",
"track_changes": 1 "track_changes": 1
} }

View File

@ -16,6 +16,7 @@ from frappe.model.mapper import get_mapped_doc
class ClinicalProcedure(Document): class ClinicalProcedure(Document):
def validate(self): def validate(self):
self.set_status() self.set_status()
self.set_title()
if self.consume_stock: if self.consume_stock:
self.set_actual_qty() self.set_actual_qty()
@ -50,6 +51,9 @@ class ClinicalProcedure(Document):
elif self.docstatus == 2: elif self.docstatus == 2:
self.status = 'Cancelled' self.status = 'Cancelled'
def set_title(self):
self.title = _('{0} - {1}').format(self.patient_name or self.patient, self.procedure_template)[:100]
def complete_procedure(self): def complete_procedure(self):
if self.consume_stock and self.items: if self.consume_stock and self.items:
stock_entry = make_stock_entry(self) stock_entry = make_stock_entry(self)

View File

@ -10,6 +10,7 @@
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"naming_series", "naming_series",
"title",
"status", "status",
"patient", "patient",
"patient_name", "patient_name",
@ -26,6 +27,7 @@
"get_prescribed_therapies", "get_prescribed_therapies",
"therapy_plan", "therapy_plan",
"practitioner", "practitioner",
"practitioner_name",
"department", "department",
"section_break_12", "section_break_12",
"appointment_type", "appointment_type",
@ -327,10 +329,26 @@
{ {
"fieldname": "column_break_36", "fieldname": "column_break_36",
"fieldtype": "Column Break" "fieldtype": "Column Break"
},
{
"fieldname": "title",
"fieldtype": "Data",
"hidden": 1,
"label": "Title",
"no_copy": 1,
"print_hide": 1,
"read_only": 1
},
{
"fetch_from": "practitioner.practitioner_name",
"fieldname": "practitioner_name",
"fieldtype": "Data",
"label": "Practitioner Name",
"read_only": 1
} }
], ],
"links": [], "links": [],
"modified": "2020-04-25 17:23:49.841975", "modified": "2020-04-27 21:36:06.404062",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Healthcare", "module": "Healthcare",
"name": "Patient Appointment", "name": "Patient Appointment",
@ -378,7 +396,7 @@
"show_name_in_global_search": 1, "show_name_in_global_search": 1,
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"title_field": "patient", "title_field": "title",
"track_changes": 1, "track_changes": 1,
"track_seen": 1 "track_seen": 1
} }

View File

@ -21,6 +21,7 @@ class PatientAppointment(Document):
self.set_appointment_datetime() self.set_appointment_datetime()
self.validate_customer_created() self.validate_customer_created()
self.set_status() self.set_status()
self.set_title()
def after_insert(self): def after_insert(self):
self.update_prescription_details() self.update_prescription_details()
@ -28,6 +29,11 @@ class PatientAppointment(Document):
self.update_fee_validity() self.update_fee_validity()
send_confirmation_msg(self) send_confirmation_msg(self)
def set_title(self):
self.title = _('{0} with {1} on {2}').format(self.patient_name or self.patient,
self.practitioner_name or self.practitioner,
frappe.utils.format_datetime(self.appointment_datetime))[:100]
def set_status(self): def set_status(self):
today = getdate() today = getdate()
appointment_date = getdate(self.appointment_date) appointment_date = getdate(self.appointment_date)

View File

@ -157,24 +157,25 @@ 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); let values = {
frappe.model.set_value(frm.doctype, frm.docname, 'patient_age', age); 'patient_age': age,
frappe.model.set_value(frm.doctype, frm.docname, 'patient_sex', data.message.sex); 'patient_name':data.message.patient_name,
if (data.message.inpatient_record) { 'patient_sex': data.message.sex,
frappe.model.set_value(frm.doctype, frm.docname, 'inpatient_record', data.message.inpatient_record); 'inpatient_record': data.message.inpatient_record,
frappe.model.set_value(frm.doctype, frm.docname, 'inpatient_status', data.message.inpatient_status); 'inpatient_status': data.message.inpatient_status
} else { };
frappe.model.set_value(frm.doctype, frm.docname, 'inpatient_record', ''); frm.set_value(values);
frappe.model.set_value(frm.doctype, frm.docname, 'inpatient_status', '');
}
} }
}); });
} else { } else {
frappe.model.set_value(frm.doctype, frm.docname, 'patient_mame', ''); let values = {
frappe.model.set_value(frm.doctype, frm.docname, 'patient_sex', ''); 'patient_age': '',
frappe.model.set_value(frm.doctype, frm.docname, 'patient_age', ''); 'patient_name':'',
frappe.model.set_value(frm.doctype, frm.docname, 'inpatient_record', ''); 'patient_sex': '',
frappe.model.set_value(frm.doctype, frm.docname, 'inpatient_status', ''); 'inpatient_record': '',
'inpatient_status': ''
};
frm.set_value(values);
} }
} }
}); });
@ -226,7 +227,6 @@ let create_vital_signs = function (frm) {
} }
frappe.route_options = { frappe.route_options = {
'patient': frm.doc.patient, 'patient': frm.doc.patient,
'appointment': frm.doc.appointment,
'encounter': frm.doc.name, 'encounter': frm.doc.name,
'company': frm.doc.company 'company': frm.doc.company
}; };

View File

@ -11,6 +11,7 @@
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"naming_series", "naming_series",
"title",
"appointment", "appointment",
"appointment_type", "appointment_type",
"patient", "patient",
@ -311,11 +312,21 @@
"in_list_view": 1, "in_list_view": 1,
"label": "Practitioner Name", "label": "Practitioner Name",
"read_only": 1 "read_only": 1
},
{
"allow_on_submit": 1,
"fieldname": "title",
"fieldtype": "Data",
"hidden": 1,
"label": "Title",
"no_copy": 1,
"print_hide": 1,
"read_only": 1
} }
], ],
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2020-04-27 18:59:25.713887", "modified": "2020-04-27 21:58:29.789797",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Healthcare", "module": "Healthcare",
"name": "Patient Encounter", "name": "Patient Encounter",
@ -342,7 +353,7 @@
"show_name_in_global_search": 1, "show_name_in_global_search": 1,
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"title_field": "patient_name", "title_field": "title",
"track_changes": 1, "track_changes": 1,
"track_seen": 1 "track_seen": 1
} }

View File

@ -10,6 +10,9 @@ from frappe.utils import cstr
from frappe import _ from frappe import _
class PatientEncounter(Document): class PatientEncounter(Document):
def validate(self):
self.set_title()
def on_update(self): def on_update(self):
if self.appointment: if self.appointment:
frappe.db.set_value('Patient Appointment', self.appointment, 'status', 'Closed') frappe.db.set_value('Patient Appointment', self.appointment, 'status', 'Closed')
@ -26,6 +29,10 @@ class PatientEncounter(Document):
def on_submit(self): def on_submit(self):
create_therapy_plan(self) create_therapy_plan(self)
def set_title(self):
self.title = _('{0} with {1}').format(self.patient_name or self.patient,
self.practitioner_name or self.practitioner)[:100]
def create_therapy_plan(encounter): def create_therapy_plan(encounter):
if len(encounter.therapies): if len(encounter.therapies):
doc = frappe.new_doc('Therapy Plan') doc = frappe.new_doc('Therapy Plan')

View File

@ -2,15 +2,22 @@
"actions": [], "actions": [],
"allow_copy": 1, "allow_copy": 1,
"allow_import": 1, "allow_import": 1,
"autoname": "naming_series:",
"beta": 1, "beta": 1,
"creation": "2017-02-02 11:00:24.853005", "creation": "2017-02-02 11:00:24.853005",
"doctype": "DocType", "doctype": "DocType",
"editable_grid": 1, "editable_grid": 1,
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"naming_series",
"title",
"patient", "patient",
"patient_name", "patient_name",
"inpatient_record",
"appointment",
"encounter",
"column_break_2", "column_break_2",
"company",
"signs_date", "signs_date",
"signs_time", "signs_time",
"sb_vs", "sb_vs",
@ -32,11 +39,6 @@
"column_break_14", "column_break_14",
"nutrition_note", "nutrition_note",
"sb_references", "sb_references",
"inpatient_record",
"appointment",
"encounter",
"column_break_28",
"company",
"amended_from" "amended_from"
], ],
"fields": [ "fields": [
@ -70,7 +72,8 @@
"fieldname": "appointment", "fieldname": "appointment",
"fieldtype": "Link", "fieldtype": "Link",
"in_filter": 1, "in_filter": 1,
"label": "Appointment", "label": "Patient Appointment",
"no_copy": 1,
"options": "Patient Appointment", "options": "Patient Appointment",
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
@ -83,8 +86,7 @@
"no_copy": 1, "no_copy": 1,
"options": "Patient Encounter", "options": "Patient Encounter",
"print_hide": 1, "print_hide": 1,
"read_only": 1, "read_only": 1
"report_hide": 1
}, },
{ {
"fieldname": "column_break_2", "fieldname": "column_break_2",
@ -237,13 +239,26 @@
"fieldtype": "Section Break" "fieldtype": "Section Break"
}, },
{ {
"fieldname": "column_break_28", "fieldname": "naming_series",
"fieldtype": "Column Break" "fieldtype": "Select",
"label": "Series",
"options": "HLC-VTS-.YYYY.-",
"reqd": 1
},
{
"allow_on_submit": 1,
"fieldname": "title",
"fieldtype": "Data",
"hidden": 1,
"label": "Title",
"no_copy": 1,
"print_hide": 1,
"read_only": 1
} }
], ],
"is_submittable": 1, "is_submittable": 1,
"links": [], "links": [],
"modified": "2020-04-03 23:06:29.786184", "modified": "2020-04-27 23:18:08.278064",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Healthcare", "module": "Healthcare",
"name": "Vital Signs", "name": "Vital Signs",
@ -283,7 +298,7 @@
"show_name_in_global_search": 1, "show_name_in_global_search": 1,
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"title_field": "patient", "title_field": "title",
"track_changes": 1, "track_changes": 1,
"track_seen": 1 "track_seen": 1
} }

View File

@ -9,12 +9,19 @@ from frappe.utils import cstr
from frappe import _ from frappe import _
class VitalSigns(Document): class VitalSigns(Document):
def validate(self):
self.set_title()
def on_submit(self): def on_submit(self):
insert_vital_signs_to_medical_record(self) insert_vital_signs_to_medical_record(self)
def on_cancel(self): def on_cancel(self):
delete_vital_signs_from_medical_record(self) delete_vital_signs_from_medical_record(self)
def set_title(self):
self.title = _('{0} on {1} {2}').format(self.patient_name or self.patient,
frappe.utils.format_date(self.signs_date), frappe.utils.format_time(self.signs_time))[:100]
def insert_vital_signs_to_medical_record(doc): def insert_vital_signs_to_medical_record(doc):
subject = set_subject_field(doc) subject = set_subject_field(doc)
medical_record = frappe.new_doc('Patient Medical Record') medical_record = frappe.new_doc('Patient Medical Record')