Skip to content

Commit

Permalink
fix(Patient Appointment): add Confirmed status to Patient Appointment
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajinsr committed Nov 20, 2024
1 parent f84faf7 commit 649ce6a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
Expand Down Expand Up @@ -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();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -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];
}
Expand Down

0 comments on commit 649ce6a

Please sign in to comment.