diff --git a/healthcare/healthcare/doctype/patient_appointment/patient_appointment.js b/healthcare/healthcare/doctype/patient_appointment/patient_appointment.js index a96c879bff..c07f650ba9 100644 --- a/healthcare/healthcare/doctype/patient_appointment/patient_appointment.js +++ b/healthcare/healthcare/doctype/patient_appointment/patient_appointment.js @@ -81,7 +81,7 @@ frappe.ui.form.on('Patient Appointment', { }, __('View')); } - if (["Open", "Checked In"].includes(frm.doc.status) || (frm.doc.status == 'Scheduled' && !frm.doc.__islocal)) { + if (["Open", "Checked In", "Confirmed"].includes(frm.doc.status) || (frm.doc.status == "Scheduled" && !frm.doc.__islocal)) { frm.add_custom_button(__('Cancel'), function() { update_status(frm, 'Cancelled'); }); @@ -115,10 +115,17 @@ frappe.ui.form.on('Patient Appointment', { frm.add_custom_button(__('Vital Signs'), function() { create_vital_signs(frm); }, __('Create')); + + if (["Open", "Scheduled"].includes(frm.doc.status)) { + frm.add_custom_button(__("Confirm"), function() { + frm.set_value("status", "Confirmed"); + frm.save(); + }, __("Status")); + } } - if (!frm.doc.__islocal && frm.doc.status=="Open" && frm.doc.appointment_based_on_check_in) { - frm.add_custom_button(__('Check In'), () => { + if (!frm.doc.__islocal && ["Open", "Confirmed"].includes(frm.doc.status) && frm.doc.appointment_based_on_check_in) { + frm.add_custom_button(__("Check In"), () => { frm.set_value("status", "Checked In"); frm.save(); }); diff --git a/healthcare/healthcare/doctype/patient_appointment/patient_appointment.json b/healthcare/healthcare/doctype/patient_appointment/patient_appointment.json index 62cec722a6..573aaea0c6 100644 --- a/healthcare/healthcare/doctype/patient_appointment/patient_appointment.json +++ b/healthcare/healthcare/doctype/patient_appointment/patient_appointment.json @@ -106,7 +106,7 @@ "in_filter": 1, "in_list_view": 1, "label": "Status", - "options": "\nScheduled\nOpen\nChecked In\nChecked Out\nClosed\nCancelled\nNo Show", + "options": "\nScheduled\nOpen\nConfirmed\nChecked In\nChecked Out\nClosed\nCancelled\nNo Show", "read_only": 1, "search_index": 1 }, @@ -416,16 +416,16 @@ "fieldtype": "Column Break" }, { - "fieldname": "service_request", - "fieldtype": "Link", - "label": "Service Request", - "options": "Service Request", - "read_only": 1, - "search_index": 1 + "fieldname": "service_request", + "fieldtype": "Link", + "label": "Service Request", + "options": "Service Request", + "read_only": 1, + "search_index": 1 } ], "links": [], - "modified": "2023-06-10 13:39:03.455568", + "modified": "2024-11-20 08:21:29.729408", "modified_by": "Administrator", "module": "Healthcare", "name": "Patient Appointment", diff --git a/healthcare/healthcare/doctype/patient_appointment/patient_appointment.py b/healthcare/healthcare/doctype/patient_appointment/patient_appointment.py index 3f1e72d9cc..ec88f776c6 100755 --- a/healthcare/healthcare/doctype/patient_appointment/patient_appointment.py +++ b/healthcare/healthcare/doctype/patient_appointment/patient_appointment.py @@ -76,15 +76,14 @@ def set_status(self): # If appointment is created for today set status as Open else Scheduled if appointment_date == today: - if self.status not in ["Checked In", "Checked Out"]: + if self.status not in ["Checked In", "Checked Out", "Open", "Confirmed"]: self.status = "Open" - elif appointment_date > today: + elif appointment_date > today and self.status not in ["Scheduled", "Confirmed"]: self.status = "Scheduled" - elif appointment_date < today: - if self.status == "Scheduled": - self.status = "No Show" + elif appointment_date < today and self.status != "No Show": + self.status = "No Show" def validate_overlaps(self): if self.appointment_based_on_check_in: @@ -896,7 +895,7 @@ def get_prescribed_therapies(patient): def update_appointment_status(): # update the status of appointments daily appointments = frappe.get_all( - "Patient Appointment", {"status": ("not in", ["Closed", "Cancelled"])} + "Patient Appointment", {"status": ("not in", ["Closed", "Cancelled", "Confirmed"])} ) for appointment in appointments: diff --git a/healthcare/healthcare/doctype/patient_appointment/patient_appointment_list.js b/healthcare/healthcare/doctype/patient_appointment/patient_appointment_list.js index 0ae87f2060..7ba866a28f 100644 --- a/healthcare/healthcare/doctype/patient_appointment/patient_appointment_list.js +++ b/healthcare/healthcare/doctype/patient_appointment/patient_appointment_list.js @@ -1,7 +1,7 @@ /* (c) ESS 2015-16 */ -frappe.listview_settings['Patient Appointment'] = { +frappe.listview_settings["Patient Appointment"] = { filters: [["status", "=", "Open"]], get_indicator: function(doc) { var colors = { @@ -11,7 +11,9 @@ frappe.listview_settings['Patient Appointment'] = { "Cancelled": "red", "Expired": "grey", "Checked In": "blue", - "Checked Out": "orange" + "Checked Out": "orange", + "Confirmed": "green", + "No Show": "red" }; return [__(doc.status), colors[doc.status], "status,=," + doc.status]; }