Skip to content

Commit

Permalink
Project Almost Completed ⚡
Browse files Browse the repository at this point in the history
  • Loading branch information
ahammadshawki8 committed Jan 27, 2021
1 parent e200ba5 commit 74a164b
Show file tree
Hide file tree
Showing 6 changed files with 998 additions and 139 deletions.
20 changes: 10 additions & 10 deletions backup_&_restore_folder/doctor.csv
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
hpt,Basic Hospital,[email protected],1990-05-01,12345,all,0,This is the default account of hospital.
brm,Byram Marflitt,[email protected],1990-05-02,YthQS,Eye,1000,Logged In
hbt,Hedda Bulteel,[email protected],1990-05-03,T3wcY,Eye,1500,Logged In
lrc,Lorrin Cruce,[email protected],1990-05-04,yoTVI,Skin,1000,Logged In
jlg,Joletta Gettins,[email protected],1990-05-05,KkZsH,Bone,2000,Logged In
coz,Codee Ovize,[email protected],1990-05-06,zVVsn,Internal,1000,Logged In
mrh,Mavra Haggerwood,[email protected],1990-05-07,plRgV,Internal,1000,Logged In
ddb,Danie Dumbreck,[email protected],1990-05-08,m1dLP,Internal,1000,Logged In
ssc,Scot Sincock,[email protected],1990-05-09,ISpDJ,Brain,2000,Logged In
ehb,Eberhard Brittin,[email protected],1990-05-10,tbpR8,Brain,2000,Logged In
btc,Bekki Titchen,[email protected],1990-05-11,4C4zr,Skin,1500,Logged In
brm,Byram Marflitt,[email protected],1990-05-02,YthQS,eye,1000,Logged In
hbt,Hedda Bulteel,[email protected],1990-05-03,T3wcY,eye,1500,Logged In
lrc,Lorrin Cruce,[email protected],1990-05-04,yoTVI,skin,1000,Logged In
jlg,Joletta Gettins,[email protected],1990-05-05,KkZsH,bone,2000,Logged In
coz,Codee Ovize,[email protected],1990-05-06,zVVsn,internal,1000,Logged In
mrh,Mavra Haggerwood,[email protected],1990-05-07,plRgV,internal,1000,Logged In
ddb,Danie Dumbreck,[email protected],1990-05-08,m1dLP,internal,1000,Logged In
ssc,Scot Sincock,[email protected],1990-05-09,ISpDJ,brain,2000,Logged In
ehb,Eberhard Brittin,[email protected],1990-05-10,tbpR8,brain,2000,Logged In
btc,Bekki Titchen,[email protected],1990-05-11,4C4zr,skin,1500,Logged In
20 changes: 10 additions & 10 deletions doctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ def salary(username, logged_in):
return (total_earning, total_cost, nit_salary)


def show_all_employee(employee_work, logged_in):
def show_all_employee(logged_in):
if logged_in:
with psycopg2.connect(**config()) as all_employee:
cur1 = all_employee.cursor()
cur1.execute("""
SELECT username, fullname, email, date_of_birth, salary FROM employee WHERE work = %s;
""", [employee_work])
SELECT username, fullname, email, date_of_birth, work, salary FROM employee;
""")

rows = cur1.fetchall()
# print part
Expand Down Expand Up @@ -189,17 +189,17 @@ def see_all_patients_of_my_specialty(username, logged_in):
cur0.execute("""
SELECT specialty FROM doctor WHERE username = %s;
""", [username])
specialty = cur0.fetchall()[0][0]
specialty = str(cur0.fetchall()[0][0]).lower()
cur0.close()

cur1 = all_under_specialty.cursor()
cur1.execute("""
SELECT username, fullname, email, date_of_birth, requested_doctor, approved_doctor FROM patient WHERE problem = %s;
SELECT username, fullname, email, date_of_birth, requested_doctor_username, approved_doctor_username FROM patient WHERE problem = %s;
""", [specialty])

rows = cur1.fetchall()
for row in rows:
print("Username:", row[0], "\tFullname:", row[1], "\tEmail:", row[2], "\tRequested Doctor:", row[3], "\tApproved Doctor:", row[4])
# for row in rows:
# print("Username:", row[0], "\tFullname:", row[1], "\tEmail:", row[2], "\tRequested Doctor:", row[3], "\tApproved Doctor:", row[4])
cur1.close()
all_under_specialty.close()
return rows
Expand All @@ -210,7 +210,7 @@ def see_my_patient(username, logged_in):
with psycopg2.connect(**config()) as my_patient:
cur0 = my_patient.cursor()
cur0.execute("""
SELECT username, fullname, email, date_of_birth, problem FROM patient WHERE approved_doctor_username = %s;
SELECT username, fullname, email, date_of_birth, problem, appointment_timestamp FROM patient WHERE approved_doctor_username = %s;
""", [username])

rows = cur0.fetchall()
Expand Down Expand Up @@ -246,8 +246,8 @@ def remove_patient(patient_username, logged_in):
with psycopg2.connect(**config()) as removing_patient:
cur0 = removing_patient.cursor()
cur0.execute("""
UPDATE patient SET approved_doctor_username = 'NULL', appointment_timestamp = 'NULL' WHERE username = %s;
""", [patient_username])
UPDATE patient SET approved_doctor_username = %s, appointment_timestamp = %s WHERE username = %s;
""", [None, None, patient_username])
print(cur0.statusmessage)
cur0.close()
removing_patient.commit()
Expand Down
2 changes: 1 addition & 1 deletion employee.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def see_my_doctors(username, logged_in):
doctors_bucket.append(temporary[0])
cur2.close()
else:
doctors_bucket.append(('adm', 'admin', '[email protected]', 'all'))
doctors_bucket.append(('adm', 'admin','[email protected]',"2004-12-28", 'all'))

# print part
# for row in doctors_bucket:
Expand Down
Loading

0 comments on commit 74a164b

Please sign in to comment.