From d2b61bbe8a868bf634475dcb785103f64dccf348 Mon Sep 17 00:00:00 2001 From: Akash Krishna Date: Wed, 26 Jan 2022 14:13:40 +0530 Subject: [PATCH] fix(healthcare): populate current practitioner in appointment availability popup (#29405) * fix: Remove two-way patient fetch from inpatient_record (Lab Test, Vital Signs, Sample Collection) * fix: Patient Appointment - practitioner field gettng cleared on Check Availability dialog, added Practitioner name in the dialog * fix: Patient Appointment - set practitioner in check availability dialog load Co-authored-by: Chillar Anand --- erpnext/healthcare/doctype/lab_test/lab_test.json | 3 +-- .../patient_appointment/patient_appointment.js | 13 +++++++++---- .../patient_appointment/patient_appointment.py | 3 ++- .../sample_collection/sample_collection.json | 3 +-- .../healthcare/doctype/vital_signs/vital_signs.json | 3 +-- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/erpnext/healthcare/doctype/lab_test/lab_test.json b/erpnext/healthcare/doctype/lab_test/lab_test.json index ac61fea3ad7..cdf27aa06b3 100644 --- a/erpnext/healthcare/doctype/lab_test/lab_test.json +++ b/erpnext/healthcare/doctype/lab_test/lab_test.json @@ -99,7 +99,6 @@ "search_index": 1 }, { - "fetch_from": "inpatient_record.patient", "fieldname": "patient", "fieldtype": "Link", "ignore_user_permissions": 1, @@ -559,7 +558,7 @@ ], "is_submittable": 1, "links": [], - "modified": "2020-11-30 11:04:17.195848", + "modified": "2022-01-20 12:37:07.943153", "modified_by": "Administrator", "module": "Healthcare", "name": "Lab Test", diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.js b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.js index bba001c9c0e..ba862783caa 100644 --- a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.js +++ b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.js @@ -337,9 +337,13 @@ let check_and_set_availability = function(frm) { }); d.fields_dict['department'].df.onchange = () => { - d.set_values({ - 'practitioner': '' - }); + if (d.get_value('department') == frm.doc.department) { + d.set_value('practitioner', frm.doc.practitioner); + } else { + d.set_value('practitioner', ''); + d.fields_dict.available_slots.html(''); + d.get_primary_btn().attr('disabled', true); + } let department = d.get_value('department'); if (department) { d.fields_dict.practitioner.get_query = function() { @@ -426,7 +430,8 @@ let check_and_set_availability = function(frm) { slot_details.forEach((slot_info) => { slot_html += `
- ${__('Practitioner Schedule:')} ${slot_info.slot_name}
+ ${slot_info.practitioner_name}
+ ${__('Schedule:')} ${slot_info.slot_name}
${__('Service Unit:')} ${slot_info.service_unit} `; if (slot_info.service_unit_capacity) { diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py index 1e4608f84e0..c4f253a062f 100755 --- a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py +++ b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py @@ -388,7 +388,8 @@ def get_available_slots(practitioner_doc, date): fields=['name', 'appointment_time', 'duration', 'status']) slot_details.append({'slot_name': slot_name, 'service_unit': schedule_entry.service_unit, 'avail_slot': available_slots, - 'appointments': appointments, 'allow_overlap': allow_overlap, 'service_unit_capacity': service_unit_capacity}) + 'appointments': appointments, 'allow_overlap': allow_overlap, 'service_unit_capacity': service_unit_capacity, + 'practitioner_name': practitioner_doc.practitioner_name}) return slot_details diff --git a/erpnext/healthcare/doctype/sample_collection/sample_collection.json b/erpnext/healthcare/doctype/sample_collection/sample_collection.json index 83383e34457..f8525f7e14b 100644 --- a/erpnext/healthcare/doctype/sample_collection/sample_collection.json +++ b/erpnext/healthcare/doctype/sample_collection/sample_collection.json @@ -66,7 +66,6 @@ "search_index": 1 }, { - "fetch_from": "inpatient_record.patient", "fieldname": "patient", "fieldtype": "Link", "hide_days": 1, @@ -224,7 +223,7 @@ ], "is_submittable": 1, "links": [], - "modified": "2020-07-30 16:53:13.076104", + "modified": "2022-01-20 12:38:55.382621", "modified_by": "Administrator", "module": "Healthcare", "name": "Sample Collection", diff --git a/erpnext/healthcare/doctype/vital_signs/vital_signs.json b/erpnext/healthcare/doctype/vital_signs/vital_signs.json index 15ab5047bc4..a945032c7e0 100644 --- a/erpnext/healthcare/doctype/vital_signs/vital_signs.json +++ b/erpnext/healthcare/doctype/vital_signs/vital_signs.json @@ -51,7 +51,6 @@ "read_only": 1 }, { - "fetch_from": "inpatient_record.patient", "fieldname": "patient", "fieldtype": "Link", "ignore_user_permissions": 1, @@ -259,7 +258,7 @@ ], "is_submittable": 1, "links": [], - "modified": "2020-05-17 22:23:24.632286", + "modified": "2022-01-20 12:30:07.515185", "modified_by": "Administrator", "module": "Healthcare", "name": "Vital Signs",