Example #1
0
def main():
    ''' FLow of control starts here '''

    run = True
    while run:

        clrscr()
        print("\nLogin for:\n\n1. Patients\n2. Doctors\n3. Managers\n4. Exit")
        choice = int(input("\nEnter your choice: "))

        if choice == 1:
            patients()

        elif choice == 2:
            doctors()

        elif choice == 3:
            admins()

        else:
            clrscr()
            run = False
Example #2
0
def patients():

    patient = core.patients.Patient()

    clrscr()
    print("\nLogin or Signup:")
    patient.name = input("\nEnter your name: ")

    if patient.patient_exists():

        while True:

            clrscr()
            print(
                f"\nWelcome {patient.name}\n\n1. Make an appointment\n2. View Appointments\n3. Update personal information\n4. Logout"
            )
            choice = int(input("\nEnter your choice: "))
            clrscr()

            if choice == 1:
                specialization = input(
                    "\nWhat specialization of doctor would you like to consult with? (Ortho/Surgeon/Physician) "
                )
                doctors = patient.get_doctors(specialization)
                if doctors == 0:
                    print("\nNo doctors of that specialization")
                else:
                    print(f"\n\n \tDOCTOR{19 * ' '}SPECIALIZATION\n")
                    for i in range(len(doctors)):
                        print(
                            f"{i + 1}\t{doctors[i][0]}{(25 - len(doctors[i][0])) * ' '}{doctors[i][1]}"
                        )
                    selected_doctor = int(
                        input("\n\nEnter choice of doctor: "))
                    while (True):
                        clrscr()
                        time = int(
                            input(
                                "\nWhen would you like to make an appointment?\n\n1. Today\n2. Tomorrow\n3. Day After tomorrow\n\nEnter choice: "
                            ))
                        if patient.make_appointment(
                                doctors[selected_doctor - 1][0], time) == 1:
                            break
                        else:
                            print("\nInvalid Input")
                    input(
                        "\nAppointment made successfully\nPress enter to continue..."
                    )

            elif choice == 2:
                appointments = patient.get_appointments()
                if len(appointments) == 0:
                    print("\nNo appointments booked")
                else:
                    print(f"\nDOCTOR{19 * ' '}DATE{18 * ' '}PRESCRIPTION\n")
                    for appointment in appointments:
                        if len(appointment) == 3:
                            print(
                                f"{appointment[0]}{(25 - len(appointment[0])) * ' '}{appointment[2]}{(22 - len(str(appointment[2]))) * ' '}None"
                            )
                        else:
                            print(
                                f"{appointment[0]}{(25 - len(appointment[0])) * ' '}{appointment[2]}{(22 - len(str(appointment[2]))) * ' '}{appointment[3]}"
                            )
                input("\nPress enter to continue...")

            elif choice == 3:
                print("\nUpdate Personal Information")
                name = input("\nEnter your name: ")
                age = int(input("Enter your age: "))
                patient.update_user(name, age)
                input(
                    "\nDetails updated successfully\nPress enter to continue..."
                )

            else:
                del patient
                break

    else:

        age = int(input("Enter your age: "))
        gender = input("Gender ( male/female ): ")
        patient.create_user(age, gender)
        input("\nNew user created successfully\nPress enter to continue...")
        patients()
def patients():

    patient = core.patients.Patient()

    clrscr()
    print("\nLogin or Signup:")
    patient.name = input("\nEnter your name: ")

    if patient.patient_exists():

        while True:

            clrscr()
            print(
                "\nPatient Dashboard\n\n1. Make an appointment\n2. View Appointments\n3. Update personal information\n4. Logout"
            )
            choice = int(input("\nEnter your choice: "))
            clrscr()

            if choice == 1:
                specialization = input(
                    "\nWhat specialization of doctor would you like to consult with? "
                )
                doctors = patient.get_doctors(specialization)
                if doctors == 0:
                    print("No doctors of that specialization")
                else:
                    for i in range(len(doctors)):
                        print(f"\n{i + 1} : {doctors[i]}")
                    selected_doctor = input("\nEnter choice of doctor: ")
                    time = int(
                        input(
                            "When would you like to make an appointment?\n1. Today\n2. Tomorrow\n 3. Day After tomorrow\nEnter choice: "
                        ))
                    patient.make_appointment(selected_doctor, time)
                input(
                    "\nAppointment made successfully\nPress enter to continue..."
                )

            elif choice == 2:
                appointments = patient.get_appointments()
                print(appointments)
                input("\nPress enter to continue...")

            elif choice == 3:
                patient.name = input("\nEnter your name: ")
                patient.age = int(input("Enter your age: "))
                patient.update_user()
                input(
                    "\nDetails updated successfully\nPress enter to continue..."
                )

            else:
                del patient
                break

    else:

        patient.age = int(input("Enter your age: "))
        patient.gender = input("Gender ( male/female ): ")
        patient.create_user()
        input("\nNew user created successfully\nPress enter to continue...")
        patients()