示例#1
0
 def appointmentDate(date):
     result = False
     for appointment in State.getAppointmentList():
         if appointment.date == date:
             result = True
             break
     return result
示例#2
0
 def getAppointmentStatus(appointment_id):
     result = False
     for appointment in State.getAppointmentList():
         if appointment.id == appointment_id:
             result = True
             break
     return result
示例#3
0
 def updateAppointmentStatus(appointment_id, status, remark=""):
     appointmentList = []
     for appointment in State.getAppointmentList():
         if appointment.id == appointment_id:
             appointment.status = status
             appointment.remark = remark
             appointmentList.append(appointment)
             break
     return appointmentList
示例#4
0
 def viewAppointmentsByDate(date):
     appointmentList = []
     for appointment in State.getAppointmentList():
         if appointment.date == date:
             appointment_dict = vars(appointment)
             appointment_dict[
                 "timeslot_time"] = Appointment.__appointment_slot[
                     appointment.timeslot]
             appointmentList.append(appointment_dict)
     appointmentList.sort(key=lambda appointment: appointment["date"])
     return appointmentList
示例#5
0
 def generateAppointmentSummaryByCustomerNRIC(customer_nric):
     appointmentList = []
     for appointment in State.getAppointmentList():
         if appointment.customer_nric == customer_nric:
             appointment_dict = vars(appointment)
             appointment_dict[
                 "timeslot_time"] = Appointment.__appointment_slot[
                     appointment.timeslot]
             appointmentList.append(appointment_dict)
     appointmentList.sort(key=lambda appointment: appointment["date"])
     return appointmentList
示例#6
0
 def cancelAppointment(appointment_id):
     cancelStatus = False
     currentDate = datetime.now()
     for appointment in State.getAppointmentList():
         if appointment.id == int(
                 appointment_id) and appointment.status == "Pending" and (
                     datetime.strptime(str(appointment.date), "%Y%m%d") -
                     currentDate).days >= 1:
             appointment.cancel = True
             cancelStatus = True
             break
     return cancelStatus
示例#7
0
 def createAppointment(customer_name, customer_nric, dentist, treatment,
                       date, timeslot):
     ableToCreate = True
     for appointment in State.getAppointmentList():
         if appointment.date == date and appointment.timeslot == timeslot:
             ableToCreate = False
             break
     newAppointment = Appointment(customer_name, customer_nric, dentist,
                                  treatment, date, timeslot,
                                  State.getLogonUser()["user_id"])
     State.addAppointment(newAppointment)
     return ableToCreate
示例#8
0
 def view7daysAppointmentCalendar():
     appointmentList = []
     for i in range(1, 7):
         currentDay = int(
             (date.today() + timedelta(days=i)).strftime("%Y%m%d"))
         for appointment in State.getAppointmentList():
             if appointment.date == currentDay:
                 appointment_dict = vars(appointment)
                 appointment_dict[
                     "timeslot_time"] = Appointment.__appointment_slot[
                         appointment.timeslot]
                 appointmentList.append(appointment_dict)
     appointmentList.sort(key=lambda appointment: appointment["date"])
     return appointmentList
示例#9
0
 def __init__(self,
              customer_name,
              customer_nric,
              dentist,
              treatment,
              date,
              timeslot,
              user_id,
              status="Pending"):
     self.id = len(State.getAppointmentList()) + 1
     self.customer_name = customer_name
     self.customer_nric = customer_nric
     self.dentist = dentist
     self.treatment = treatment
     self.date = date
     self.timeslot = timeslot
     self.user_id = user_id
     self.status = status
     self.remark = ""
     self.cancel = False
示例#10
0
 def viewAppointmentsStatus(user_id):
     appointmentList = []
     for appointment in State.getAppointmentList():
         if appointment.user_id == user_id:
             appointment_dict = {
                 "id":
                 appointment.id,
                 "date":
                 appointment.date,
                 "timeslot":
                 Appointment.__appointment_slot[appointment.timeslot],
                 "dentist":
                 appointment.dentist,
                 "treatment":
                 appointment.treatment,
                 "status":
                 appointment.status
             }
             appointmentList.append(appointment_dict)
     appointmentList.sort(key=lambda appointment: appointment["date"])
     return appointmentList
示例#11
0
 def viewTotalCustomersByTypes():
     totalCustomersByTypes = {
         "Extractions": [],
         "Fillings": [],
         "Repairs": [],
         "Teeth Cleaning": [],
         "Denture": []
     }
     returnData = []
     for appointment in State.getAppointmentList():
         if (appointment.user_id
                 not in totalCustomersByTypes[appointment.treatment]):
             totalCustomersByTypes[appointment.treatment].append(
                 appointment.user_id)
     for appointmentTypes in totalCustomersByTypes:
         returnData.append({
             "typeOfTreatment":
             appointmentTypes,
             "customerCount":
             len(totalCustomersByTypes[appointmentTypes])
         })
     return returnData
示例#12
0
 def generateAppointmentSummaryByDentistTreatment(treatment):
     appointmentList = []
     for appointment in State.getAppointmentList():
         if appointment.treatment == treatment:
             appointmentList.append(Appointment)
     return appointmentList