示例#1
0
 def create_new_patient(cls, user_id, age, gender, phone):
     try:
         Database.add_patient(user_id, age, gender, phone)
     except DatabaseConnectionError:
         print('Something went wrong with the server! Please, try again.')
         sys.exit(1)
     return cls.find_patient(user_id)
示例#2
0
 def list_slots(self):
     doctor_slots = Database.list_doctor_slots(self.id)
     print('|  ID  |  Date  |  From  |  To  | Reservation Status |')
     print('|------|--------|--------|------|--------------------|')
     for slot in doctor_slots:
         print('| {:^8} | {:^8} | {:^8} | {:^8} | {:^8} |'.format(
             slot[0], slot[1], slot[2], slot[3], slot[4]))
示例#3
0
 def show_reservations(self):
     reservations = Database.list_reservations(self.id)
     print('|   ID    |       Slot       |  Status  |')
     print('|---------|------------------|----------|')
     for reservation in reservations:
         print('| {:^7} | {:^16} | {:^8} |'.format(reservation[0],
                                                   reservation[1],
                                                   reservation[2]))
示例#4
0
 def create_new_doctor(cls, user_id, specialty, phone):
     try:
         doctor = Database.add_doctor(user_id, specialty, phone)
     except DatabaseConnectionError:
         print(
             'Oops, something went wrong with the server! Please, try again.'
         )
         sys.exit(1)
     return cls.find_doctor(user_id)
示例#5
0
 def view_available_slots(self):
     doctor_slots = Database.list_available_slots()
     print(
         '|      ID      |    Date    |    From    |    To    | Reservation Status |'
     )
     print(
         '|--------------|------------|------------|----------|--------------------|'
     )
     for slot in doctor_slots:
         print('| {:^10} | {:^10} | {:^6} | {:^6} | {:^14} |'.format(
             slot[0], slot[1], slot[2], slot[3], slot[4]))
示例#6
0
 def remove_slot(self, slot_id):
     Database.delete_slot(slot_id)
示例#7
0
 def add_slot(self, slot_id, date, start_hour, end_hour,
              reservation_status):
     Database.add_available_slot(self.id, slot_id, date, start_hour,
                                 end_hour, reservation_status)
示例#8
0
 def find_doctor(cls, user_id):
     attr = Database.find_doctor(user_id)
     if attr:
         return cls(attr[0], attr[1], attr[2], attr[3])
示例#9
0
 def cancel_reservation(self, slot_id):
     Database.cancel_reservation(slot_id)
示例#10
0
 def reserve_slot(self, slot_id):
     Database.add_reservation(self.id, slot_id)
示例#11
0
 def find_patient(cls, user_id):
     attr = Database.find_patient(user_id)
     if attr:
         return cls(attr[0], attr[1], attr[2], attr[3], attr[4])
示例#12
0
 def _get_last_registered_status_patient(cls):
     return Database.last_reg_patient()[0]
示例#13
0
 def _get_last_registered_status_doctor(cls):
     return Database.last_reg_doctor()[
         0]  # return last registered doctors user_id
示例#14
0
 def find(cls, username, password):
     attr = Database.find_user(username, password)
     if attr:
         return cls(attr[0], attr[1], attr[2], attr[3], attr[4])
示例#15
0
 def create_new_user(cls, username, password, full_name, status):
     try:
         current_user = Database.add_user(username, password, full_name,
                                          status)
     except DatabaseConnectionError:
         print('Something went wrong with the server! Please, try again.')