-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprogram copied to word.py
990 lines (969 loc) · 65.3 KB
/
program copied to word.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
import mysql.connector as sql
import stdiomask
conn=sql.connect(host='localhost',user='root',passwd='student')
if conn.is_connected():
print('SUCCESSFULLY CONNECTED')
c1=conn.cursor()
c1.execute('create database if not exists ThumbayMedicalCenter')
c1.execute('use ThumbayMedicalCenter')
CH='yes'
while CH.lower()=="yes":
print()
print()
print("================================================================================")
print()
print("\t\t*_*_*_WELCOME TO THUMBAY MEDICAL CENTER_*_*_*")
print("\t\t ~ Your Health is in GOOD hands ~ ")
print()
print("================================================================================")
print()
print()
print("\t\t\t\t1.LOGIN\n\n\t\t\t\t2.EXIT")
print()
print()
print("================================================================================")
print()
choice1=int(input("ENTER YOUR CHOICE:"))
print()
if choice1==1:
Ch='yes'
while Ch.lower()=='yes':
u1=input("ENTER USERNAME:")
pwd1=stdiomask.getpass(prompt="ENTER PASSWORD:",mask="*")
ch='yes'
while ch.lower()=="yes":
if u1=='ADMIN'and pwd1=='123THUMBAY!@#':
print()
print('---WELCOME ADMIN---')
print()
print("==============================================================\
==================")
print()
print()
print("\t\t\t\t***MAIN MENU***\n\n\t\t\t\t1.Registeration\n\n\t\t\t\t\
2.Veiwing\n\n\t\t\t\t3.Updation")
print()
print()
print("================================================================\
================")
print()
choice=int(input("ENTER YOUR CHOICE:"))
if choice==1:
c1.execute('create table if not exists patient_details(p_id varchar(10)\
primary key not null,p_name char(20),p_age int(3),p_problems char(20),p_phoneno int(15))')
c1.execute('create table if not exists staff_details(st_id varchar(10)\
primary key not null,st_name char(20),st_age int(3),st_department char(20),st_phoneno int(15))')
c1.execute('create table if not exists doctor_details(d_id varchar(10)\
primary key not null,d_name char(20),d_age int(3),d_department char(20),d_phoneno int(15))')
c1.execute('create table if not exists nurse_details(n_id varchar(10)\
primary key not null,n_name char(20),n_age int(3),n_department char(20),n_phoneno int(15))')
ch1="yes"
print()
print("===============================================================\
=================")
print()
print()
print("\t\t\t\t***MENU I***\n\n\t\t\t1.Registering Patient Details\n\n\t\t\t\
2.Registering Doctor Details\n\n\t\t\t3.Registering Nurse Details\n\n\t\t\t\
4.Registering Non Medical Staff Details")
print()
print()
print("=================================================================\
===============")
print()
while ch1.lower()=="yes":
choice1=int(input("ENTER YOUR CHOICE:"))
if choice1==1:
print("Patient ID:",end='')
c1.execute('select max(p_id) from patient_details;')
check=c1.fetchall()
alph='P'
for tup in check:
for maxno in tup:
if maxno==None:
num=1
p_id=alph+str(num)
else:
num=eval(maxno[-1])+1
p_id=alph+str(num)
print(p_id)
p_name=input('Enter Patient Name:')
p_age=int(input('Enter Age:'))
p_problems=input('Enter the Problem/Disease:')
p_phoneno=int(input('Enter Phone number:'))
sql_insert="insert into patient_details(p_id,p_name,p_age,p_problems,p_phoneno)\
values(%s,%s,%s,%s,%s)"
c1.execute(sql_insert,(p_id,p_name,p_age,p_problems,p_phoneno))
print('====================SUCCESSFULLY REGISTERED====================')
conn.commit()
elif choice1==2:
print("Doctor ID:",end='')
c1.execute('select max(d_id) from doctor_details;')
check=c1.fetchall()
alph='D'
for tup in check:
for maxno in tup:
if maxno==None:
num=1
d_id=alph+str(num)
else:
num=eval(maxno[-1])+1
d_id=alph+str(num)
print(d_id)
d_name=input('Enter Doctor Name:')
d_age=int(input('Enter Age:'))
d_department=input('Enter the Department:')
d_phoneno=int(input('Enter Phone number:'))
sql_insert="insert into doctor_details(d_id,d_name,d_age,d_department,d_phoneno)\
values(%s,%s,%s,%s,%s)"
c1.execute(sql_insert,(d_id,d_name,d_age,d_department,d_phoneno))
print('====================SUCCESSFULLY REGISTERED====================')
conn.commit()
elif choice1==3:
print("Nurse ID:",end='')
c1.execute('select max(n_id) from nurse_details;')
check=c1.fetchall()
alph='N'
for tup in check:
for maxno in tup:
if maxno==None:
num=1
n_id=alph+str(num)
else:
num=eval(maxno[-1])+1
n_id=alph+str(num)
print(n_id)
n_name=input('Enter Nurse Name:')
n_age=int(input('Enter Age:'))
n_department=input('Enter the Department:')
n_phoneno=int(input('Enter Phone number:'))
sql_insert="insert into nurse_details(n_id,n_name,n_age,n_department,n_phoneno)\
values(%s,%s,%s,%s,%s)"
c1.execute(sql_insert,(n_id,n_name,n_age,n_department,n_phoneno))
print('====================SUCCESSFULLY REGISTERED====================')
conn.commit()
elif choice1==4:
print("Non Med Staff ID:",end='')
c1.execute('select max(st_id) from staff_details;')
check=c1.fetchall()
alph='S'
for tup in check:
for maxno in tup:
if maxno==None:
num=1
st_id=alph+str(num)
else:
num=eval(maxno[-1])+1
st_id=alph+str(num)
print(st_id)
st_name=input('Enter Non Med Staff Name:')
st_age=int(input('Enter Age:'))
st_department=input('Enter type of job:')
st_phoneno=int(input('Enter Phone number:'))
sql_insert="insert into staff_details(st_id,st_name,st_age,st_department,st_phoneno)\
values(%s,%s,%s,%s,%s)"
c1.execute(sql_insert,(st_id,st_name,st_age,st_department,st_phoneno))
print('====================SUCCESSFULLY REGISTERED====================')
conn.commit()
else:
print("Invalid input. Please refer the menu to specify choices")
print()
ch1=input("Do you want to continue registering?:[yes/no]")
elif choice==2:
ch2='yes'
print()
print("=========================================================\
=======================")
print()
print()
print("\t\t\t\t***MENU II***\n\n\t\t\t1.View all Patient Details\n\n\t\t\t\
2.View all Doctor Details\n\n\t\t\t3.View all Nurse Details\n\n\t\t\t4.View all Staff Details\n\n\t\t\t\
5.View specific Patient Details\n\n\t\t\t6.View specific Doctor Details\n\n\t\t\t\
7.View specific Nurse Details\n\n\t\t\t8.View specific Staff Details\n\n\t\t\t9.View all Departments\n\n\t\t\t\
10.View members of specific Department")
print()
print()
print("=========================================================\
=======================")
print()
while ch2.lower()=='yes':
choice2=int(input('ENTER YOUR CHOICE:'))
if choice2==1:
c1.execute('select*from patient_details')
r=c1.fetchall()
if r==[]:
print('\n! ! No records found ! !\n')
else:
print("PATIENT ID\t\tPATIENT NAME\t\tAGE\t\t\tPROBLEM\t\t\tCONTACT NO.")
for i in r :
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
elif choice2==2:
c1.execute("select*from doctor_details")
s=c1.fetchall()
if s==[]:
print('\n! ! No records found ! !\n')
else:
print("DOCTOR ID\t\tDOCTOR NAME\t\t\tAGE\t\t\tDEPARTMENT\t\t\tCONTACT NO.")
for i in s:
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
elif choice2==3:
c1.execute("select*from nurse_details")
t=c1.fetchall()
if t==[]:
print('\n! ! No records found ! !\n')
else:
print("NURSE ID\t\tNURSE NAME\t\t\tAGE\t\t\tDEPARTMENT\t\t\tCONTACT NO.")
for i in t:
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
elif choice2==4:
c1.execute("select*from staff_details")
u=c1.fetchall()
if u==[]:
print('\n! ! No records found ! !\n')
else:
print("STAFF ID\t\tSTAFF NAME\t\t\tAGE\t\t\tDEPARTMENT\t\tCONTACT NO.")
for i in u:
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
elif choice2==5:
pid=input("Enter Patient ID:")
c1.execute('select*from patient_details where p_id=%s',(pid,))
v=c1.fetchall()
if v==[]:
print('\n! ! No records found ! !\n')
else:
print("PATIENT ID\t\tPATIENT NAME\t\tAGE\t\t\tPROBLEM\t\t\tCONTACT NO.")
for i in v :
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
elif choice2==6:
did=input("Enter Doctor ID:")
c1.execute('select*from doctor_details where d_id=%s',(did,))
w=c1.fetchall()
if w==[]:
print('\n! ! No records found ! !\n')
else:
print("DOCTOR ID\t\tDOCTOR NAME\t\t\tAGE\t\t\tDEPARTMENT\t\tCONTACT NO.")
for i in w:
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
elif choice2==7:
nid=input("Enter Nurse ID:")
c1.execute('select*from nurse_details where n_id=%s',(nid,))
x=c1.fetchall()
if x==[]:
print('\n! ! No records found ! !\n')
else:
print("NURSE ID\t\tNURSE NAME\t\t\tAGE\t\t\tDEPARTMENT\t\tCONTACT NO.")
for i in x:
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
elif choice2==8:
stid=input("Enter Staff ID:")
c1.execute('select*from staff_details where st_id=%s',(stid,))
y=c1.fetchall()
if y==[]:
print('\n! ! No records found ! !\n')
else:
print("STAFF ID\t\tSTAFF NAME\t\t\tAGE\t\t\tDEPARTMENT\t\tCONTACT NO.")
for i in y:
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
elif choice2==9:
c1.execute('select d.d_department,n.n_department from doctor_details d,\
nurse_details n')
y=c1.fetchall()
dpt=[]
if y==[]:
print('\n! ! No records found ! !\n')
else:
for i in y:
for j in i:
if j not in dpt:
dpt.append(j)
print('DEPARTMENTS')
for i in dpt:
print(i)
elif choice2==10:
dept=input('Enter the department:')
c1.execute('select d_name from doctor_details where \
d_department=%s',(dept.upper(),))
y=c1.fetchall()
c1.execute('select n_name from nurse_details where \
n_department=%s',(dept.upper(),))
z=c1.fetchall()
if y==[]:
print('\n! ! No records of doctors found ! !\n')
else:
list=[]
print('DOCTORS')
for i in y:
if i[0] not in list:
list.append(i[0])
print(i[0])
print()
if z==[]:
print('\n! ! No records of nurses found ! !\n')
else:
list=[]
print('NURSES')
for i in z:
if i[0] not in list:
list.append(i[0])
print(i[0])
else:
print("Invalid input. Please refer the menu to specify choices")
ch2=input("Do you want to continue veiwing?:[yes/no]")
elif choice==3:
ch3='yes'
while ch3.lower()=='yes':
print()
print("==================================================\
==============================")
print()
print()
print("\t\t\t\t***MENU III***\n\n\t\t\t1.Updating Patient Details\n\n\t\t\t\
2.Updating Doctor Details\n\n\t\t\t3.Updating Nurse Details\n\n\t\t\t4.Updating Non Medical Staff Details")
print()
print()
print("==================================================\
==============================")
print()
choice3=int(input('ENTER YOUR CHOICE:'))
if choice3==1:
chP='yes'
while chP.lower()=='yes':
print()
print("========================================================\
========================")
print()
print()
print("\t\t\t\t***SUB - MENU***\n\n\t\t\tA:Updating Patient record\n\n\t\t\t\
B:Deleting Patient record")
print()
print()
print("==========================================================\
======================")
print()
subchoice=input('ENTER YOUR CHOICE:')
if subchoice.upper()=='A':
print()
print("========================================================\
========================")
print()
print()
print("\t\t\t\t***SUB - MENU I***\n\n\t\t\t1.Patient Name\n\n\t\t\t\
2.Patient Age\n\n\t\t\t3.Patient Disease\n\n\t\t\t4.Patient Phone no")
print()
print()
print("=============================================================\
===================")
print()
chA='yes'
while chA.lower()=='yes':
choiceA=int(input('ENTER YOUR CHOICE:'))
if choiceA==1:
p_id=input('Enter ID of Patient whose name is to be changed:')
c1.execute('SELECT p_name FROM patient_details WHERE p_id=%s',(p_id,))
t=c1.fetchall()
if t==[]:
print('\n! ! No such record found ! !\n')
else:
for i in t:
for j in i:
print('Previous Name:',j)
p_name=input('Enter Updated Name of Patient:')
c1.execute('UPDATE patient_details SET p_name=%s \
WHERE p_id=%s',(p_name,p_id))
print('====================SUCCESSFULLY UPDATED\
====================')
c1.execute('select*from patient_details where p_id=%s',(p_id,))
v=c1.fetchall()
print("PATIENT ID\t\tPATIENT NAME\t\tAGE\t\t\tPROBLEM\t\t\t\
CONTACT NO.")
for i in v :
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
elif choiceA==2:
p_id=input('Enter ID of Patient whose age is to be changed:')
c1.execute('SELECT p_age FROM patient_details WHERE p_id=%s',(p_id,))
t=c1.fetchall()
if t==[]:
print('\n! ! No such record found ! !\n')
else:
for i in t:
for j in i:
print('Previous Age:',j)
p_age=input('Enter Updtaed Age of Patient:')
c1.execute('UPDATE patient_details SET p_age=%s \
WHERE p_id=%s',(p_age,p_id))
print('====================SUCCESSFULLY UPDATED\
====================')
c1.execute('select*from patient_details where p_id=%s',(p_id,))
v=c1.fetchall()
print("PATIENT ID\t\tPATIENT NAME\t\tAGE\t\t\tPROBLEM\t\t\t\
CONTACT NO.")
for i in v :
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
elif choiceA==3:
p_id=input('Enter ID of Patient whose disease is to be changed:')
c1.execute('SELECT p_problems FROM patient_details \
WHERE p_id=%s',(p_id,))
t=c1.fetchall()
if t==[]:
print('\n! ! No such record found ! !\n')
else:
for i in t:
for j in i:
print('Previous Disease:',j)
p_problems=input('Enter Updtaed Disease of Patient:')
c1.execute('UPDATE patient_details SET p_problems=%s \
WHERE p_id=%s',(p_problems,p_id))
print('====================SUCCESSFULLY UPDATED\
====================')
c1.execute('select*from patient_details where p_id=%s',(p_id,))
v=c1.fetchall()
print("PATIENT ID\t\tPATIENT NAME\t\tAGE\t\t\tPROBLEM\t\t\t\
CONTACT NO.")
for i in v :
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
elif choiceA==4:
p_id=input('Enter ID of Patient whose phone no. is to be changed:')
c1.execute('SELECT p_phoneno FROM patient_details \
WHERE p_id=%s',(p_id,))
t=c1.fetchall()
if t==[]:
print('\n! ! No such record found ! !\n')
else:
for i in t:
for j in i:
print('Previous Phone no:',j)
p_phoneno=input('Enter Updtaed Phone no of Patient:')
c1.execute('UPDATE patient_details SET p_phoneno=%s \
WHERE p_id=%s',(p_phoneno,p_id))
print('====================SUCCESSFULLY UPDATED\
====================')
c1.execute('select*from patient_details where p_id=%s',(p_id,))
v=c1.fetchall()
print("PATIENT ID\t\tPATIENT NAME\t\tAGE\t\t\tPROBLEM\t\t\t\
CONTACT NO.")
for i in v :
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
else:
print("Invalid input. Please refer the menu to specify choices")
chA=input("Do you want to continue updating patient details?:[yes/no]")
elif subchoice.upper()=='B':
p_id=input('Enter ID of Patient whose Record is to be deleted:')
c1.execute('SELECT * FROM patient_details WHERE p_id=%s',(p_id,))
t=c1.fetchall()
if t==[]:
print('\n! ! No such record found ! !\n')
else:
sure=input('Are you sure you want to delete this record:[yes/no]')
if sure.lower()=='yes':
c1.execute('DELETE FROM patient_details WHERE p_id=%s',(p_id,))
print('====================SUCCESSFULLY DELETED====================')
else:
break
else:
print("Invalid input. Please refer the menu to specify choices")
chP=input("Do you want to continue updating?:[yes/no]")
elif choice3==2:
chD='yes'
while chD.lower()=='yes':
print()
print("=========================================\
=======================================")
print()
print()
print("\t\t\t\t***SUB - MENU***\n\n\t\t\tA:Updating Doctor record\n\n\t\t\t\
B:Deleting Doctor record")
print()
print()
print("=========================================\
=======================================")
print()
subchoice=input('ENTER YOUR CHOICE:')
if subchoice.upper()=='A':
print()
print("===============================================\
=================================")
print()
print()
print("\t\t\t\t***SUB - MENU I***\n\n\t\t\t1.Doctor Name\n\n\t\t\t\
2.Doctor Age\n\n\t\t\t3.Doctor Department\n\n\t\t\t4.Doctor Phone no")
print()
print()
print("=========================================\
=======================================")
print()
chA='yes'
while chA.lower()=='yes':
choiceA=int(input('ENTER YOUR CHOICE:'))
if choiceA==1:
d_id=input('Enter ID of Doctor whose name is to be changed:')
c1.execute('SELECT d_name FROM doctor_details WHERE d_id=%s',(d_id,))
t=c1.fetchall()
if t==[]:
print('\n! ! No such record found ! !\n')
else:
for i in t:
for j in i:
print('Previous Name:',j)
d_name=input('Enter Updated Name of Doctor:')
c1.execute('UPDATE doctor_details SET d_name=%s \
WHERE d_id=%s',(d_name,d_id))
print('====================SUCCESSFULLY UPDATED\
====================')
c1.execute('select*from doctor_details where d_id=%s',(d_id,))
v=c1.fetchall()
print("DOCTOR ID\t\tDOCTOR NAME\t\t\tAGE\t\t\tDEPARTMENT\t\t\
CONTACT NO.")
for i in v :
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
elif choiceA==2:
d_id=input('Enter ID of Doctor whose age is to be changed:')
c1.execute('SELECT d_age FROM doctor_details WHERE d_id=%s',(d_id,))
t=c1.fetchall()
if t==[]:
print('\n! ! No such record found ! !\n')
else:
for i in t:
for j in i:
print('Previous Age:',j)
d_age=input('Enter Updtaed Age of Doctor:')
c1.execute('UPDATE doctor_details SET d_age=%s \
WHERE d_id=%s',(d_age,d_id))
print('====================SUCCESSFULLY UPDATED\
====================')
c1.execute('select*from doctor_details where d_id=%s',(d_id,))
v=c1.fetchall()
print("DOCTOR ID\t\tDOCTOR NAME\t\t\tAGE\t\t\tDEPARTMENT\t\t\
CONTACT NO.")
for i in v :
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
elif choiceA==3:
d_id=input('Enter ID of Doctor whose department is to be changed:')
c1.execute('SELECT d_department FROM doctor_details \
WHERE d_id=%s',(d_id,))
t=c1.fetchall()
if t==[]:
print('\n! ! No such record found ! !\n')
else:
for i in t:
for j in i:
print('Previous Department:',j)
d_department=input('Enter Updtaed Deparment of Doctor:')
c1.execute('UPDATE doctor_details SET d_department=%s \
WHERE d_id=%s',(d_department,d_id))
print('====================SUCCESSFULLY UPDATED\
====================')
c1.execute('select*from doctor_details where d_id=%s',(d_id,))
v=c1.fetchall()
print("DOCTOR ID\t\tDOCTOR NAME\t\t\tAGE\t\t\tDEPARTMENT\t\t\
CONTACT NO.")
for i in v :
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
elif choiceA==4:
d_id=input('Enter ID of Doctor whose phone no. is to be changed:')
c1.execute('SELECT d_phoneno FROM doctor_details \
WHERE d_id=%s',(d_id,))
t=c1.fetchall()
if t==[]:
print('\n! ! No such record found ! !\n')
else:
for i in t:
for j in i:
print('Previous Phone no:',j)
d_phoneno=input('Enter Updtaed Phone no of Doctor:')
c1.execute('UPDATE doctor_details SET d_phoneno=%s \
WHERE d_id=%s',(d_phoneno,d_id))
print('====================SUCCESSFULLY UPDATED\
====================')
c1.execute('select*from doctor_details where d_id=%s',(d_id,))
v=c1.fetchall()
print("DOCTOR ID\t\tDOCTOR NAME\t\t\tAGE\t\t\tDEPARTMENT\t\t\
CONTACT NO.")
for i in v :
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
else:
print("Invalid input. Please refer the menu to specify choices")
chA=input("Do you want to continue updating Doctor details?:[yes/no]")
elif subchoice.upper()=='B':
d_id=input('Enter ID of Doctor whose Record is to be deleted:')
c1.execute('SELECT * FROM doctor_details WHERE d_id=%s',(d_id,))
t=c1.fetchall()
if t==[]:
print('\n! ! No such record found ! !\n')
else:
sure=input('Are you sure you want to delete this record:[yes/no]')
if sure.lower()=='yes':
c1.execute('DELETE FROM doctor_details WHERE d_id=%s',(d_id,))
print('====================SUCCESSFULLY DELETED====================')
else:
break
else:
print("Invalid input. Please refer the menu to specify choices")
chD=input("Do you want to continue updating?:[yes/no]")
elif choice3==3:
chN='yes'
while chN.lower()=='yes':
print()
print("==================================================================\
==============")
print()
print()
print("\t\t\t\t***SUB - MENU***\n\n\t\t\tA:Updating Nurse record\n\n\t\t\t\
B:Deleting Nurse record")
print()
print()
print("==================================================\
==============================")
print()
subchoice=input('ENTER YOUR CHOICE:')
if subchoice.upper()=='A':
print()
print("=================================================================\
===============")
print()
print()
print("\t\t\t\t***SUB - MENU I***\n\n\t\t\t1.Nurse Name\n\n\t\t\t\
2.Nurse Age\n\n\t\t\t3.Nurse Department\n\n\t\t\t4.Nurse Phone no")
print()
print()
print("==================================================\
==============================")
print()
chA='yes'
while chA.lower()=='yes':
choiceA=int(input('ENTER YOUR CHOICE:'))
if choiceA==1:
n_id=input('Enter ID of Nurse whose name is to be changed:')
c1.execute('SELECT n_name FROM nurse_details WHERE n_id=%s',(n_id,))
t=c1.fetchall()
if t==[]:
print('\n! ! No such record found ! !\n')
else:
for i in t:
for j in i:
print('Previous Name:',j)
n_name=input('Enter Updated Name of Nurse:')
c1.execute('UPDATE nurse_details SET n_name=%s \
WHERE n_id=%s',(n_name,n_id))
print('====================SUCCESSFULLY UPDATED\
====================')
c1.execute('select*from nurse_details where n_id=%s',(n_id,))
v=c1.fetchall()
print("NURSE ID\t\tNURSE NAME\t\t\tAGE\t\t\tDEPARTMENT\t\t\
CONTACT NO.")
for i in v :
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
elif choiceA==2:
n_id=input('Enter ID of Nurse whose age is to be changed:')
c1.execute('SELECT n_age FROM nurse_details WHERE n_id=%s',(n_id,))
t=c1.fetchall()
if t==[]:
print('\n! ! No such record found ! !\n')
else:
for i in t:
for j in i:
print('Previous Age:',j)
n_age=input('Enter Updtaed Age of Nurse:')
c1.execute('UPDATE nurse_details SET n_age=%s \
WHERE n_id=%s',(n_age,n_id))
print('====================SUCCESSFULLY UPDATED\
====================')
c1.execute('select*from nurse_details where n_id=%s',(n_id,))
v=c1.fetchall()
print("NURSE ID\t\tNURSE NAME\t\t\tAGE\t\t\tDEPARTMENT\t\t\
CONTACT NO.")
for i in v :
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
elif choiceA==3:
n_id=input('Enter ID of Nurse whose department is to be changed:')
c1.execute('SELECT n_department FROM nurse_details \
WHERE n_id=%s',(n_id,))
t=c1.fetchall()
if t==[]:
print('\n! ! No such record found ! !\n')
else:
for i in t:
for j in i:
print('Previous Department:',j)
n_department=input('Enter Updtaed Deparment of Nurse:')
c1.execute('UPDATE nurse_details SET n_department=%s \
WHERE n_id=%s',(n_department,n_id))
print('====================SUCCESSFULLY UPDATED\
====================')
c1.execute('select*from nurse_details where n_id=%s',(n_id,))
v=c1.fetchall()
print("NURSE ID\t\tNURSE NAME\t\t\tAGE\t\t\tDEPARTMENT\t\t\
CONTACT NO.")
for i in v :
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
elif choiceA==4:
n_id=input('Enter ID of Nurse whose phone no. is to be changed:')
c1.execute('SELECT n_phoneno FROM nurse_details WHERE n_id=%s',(n_id,))
t=c1.fetchall()
if t==[]:
print('\n! ! No such record found ! !\n')
else:
for i in t:
for j in i:
print('Previous Phone no:',j)
n_phoneno=input('Enter Updtaed Phone no of Nurse:')
c1.execute('UPDATE nurse_details SET n_phoneno=%s \
WHERE n_id=%s',(n_phoneno,n_id))
print('====================SUCCESSFULLY UPDATED\
====================')
c1.execute('select*from nurse_details where n_id=%s',(n_id,))
v=c1.fetchall()
print("NURSE ID\t\tNURSE NAME\t\t\tAGE\t\t\tDEPARTMENT\t\t\
CONTACT NO.")
for i in v :
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
else:
print("Invalid input. Please refer the menu to specify choices")
chA=input("Do you want to continue updating nurse details?:[yes/no]")
elif subchoice.upper()=='B':
n_id=input('Enter ID of Nurse whose Record is to be deleted:')
c1.execute('SELECT * FROM nurse_details WHERE n_id=%s',(n_id,))
t=c1.fetchall()
if t==[]:
print('\n! ! No such record found ! !\n')
else:
sure=input('Are you sure you want to delete this record:[yes/no]')
if sure.lower()=='yes':
c1.execute('DELETE FROM nurse_details WHERE n_id=%s',(n_id,))
print('====================SUCCESSFULLY DELETED====================')
else:
break
else:
print("Invalid input. Please refer the menu to specify choices")
chN=input("Do you want to continue updating?:[yes/no]")
elif choice3==4:
chS='yes'
while chS.lower()=='yes':
print()
print("======================================================\
==========================")
print()
print()
print("\t\t\t\t***SUB - MENU***\n\n\t\t\tA:Updating Staff record\n\n\t\t\t\
B:Deleting Staff record")
print()
print()
print("===========================================================\
=====================")
print()
subchoice=input('ENTER YOUR CHOICE:')
if subchoice.upper()=='A':
print()
print("=================================================================\
===============")
print()
print()
print("\t\t\t\t***SUB - MENU I***\n\n\t\t\t1.Staff Name\n\n\t\t\t\
2.Staff Age\n\n\t\t\t3.Staff Department\n\n\t\t\t4.Staff Phone no")
print()
print()
print("================================================================\
================")
print()
chA='yes'
while chA.lower()=='yes':
choiceA=int(input('ENTER YOUR CHOICE:'))
if choiceA==1:
st_id=input('Enter ID of Staff whose name is to be changed:')
c1.execute('SELECT st_name FROM staff_details WHERE st_id=%s',(st_id,))
t=c1.fetchall()
if t==[]:
print('\n! ! No such record found ! !\n')
else:
for i in t:
for j in i:
print('Previous Name:',j)
st_name=input('Enter Updated Name of Staff:')
c1.execute('UPDATE staff_details SET st_name=%s \
WHERE st_id=%s',(st_name,st_id))
print('====================SUCCESSFULLY UPDATED\
====================')
c1.execute('select*from staff_details where st_id=%s',(st_id,))
v=c1.fetchall()
print("STAFF ID\t\tSTAFF NAME\t\t\tAGE\t\t\tDEPARTMENT\t\t\
CONTACT NO.")
for i in v :
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
elif choiceA==2:
st_id=input('Enter ID of Staff whose age is to be changed:')
c1.execute('SELECT st_age FROM staff_details WHERE st_id=%s',(st_id,))
t=c1.fetchall()
if t==[]:
print('\n! ! No such record found ! !\n')
else:
for i in t:
for j in i:
print('Previous Age:',j)
st_age=input('Enter Updtaed Age of Staff:')
c1.execute('UPDATE staff_details SET st_age=%s \
WHERE st_id=%s',(st_age,st_id))
print('====================SUCCESSFULLY UPDATED\
====================')
c1.execute('select*from staff_details where st_id=%s',(st_id,))
v=c1.fetchall()
print("STAFF ID\t\tSTAFF NAME\t\t\tAGE\t\t\tDEPARTMENT\t\t\
CONTACT NO.")
for i in v :
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
elif choiceA==3:
st_id=input('Enter ID of Staff whose department is to be changed:')
c1.execute('SELECT st_department FROM staff_details \
WHERE st_id=%s',(st_id,))
t=c1.fetchall()
if t==[]:
print('\n! ! No such record found ! !\n')
else:
for i in t:
for j in i:
print('Previous Department:',j)
st_department=input('Enter Updtaed Deparment of Staff:')
c1.execute('UPDATE staff_details SET st_department=%s \
WHERE st_id=%s',(st_department,st_id))
print('====================SUCCESSFULLY UPDATED\
====================')
c1.execute('select*from staff_details where st_id=%s',(st_id,))
v=c1.fetchall()
print("STAFF ID\t\tSTAFF NAME\t\t\tAGE\t\t\tDEPARTMENT\t\t\
CONTACT NO.")
for i in v :
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
elif choiceA==4:
st_id=input('Enter ID of Staff whose phone no. is to be changed:')
c1.execute('SELECT st_phoneno FROM staff_details \
WHERE st_id=%s',(st_id,))
t=c1.fetchall()
if t==[]:
print('\n! ! No such record found ! !\n')
else:
for i in t:
for j in i:
print('Previous Phone no:',j)
st_phoneno=input('Enter Updtaed Phone no of Staff:')
c1.execute('UPDATE staff_details SET st_phoneno=%s \
WHERE st_id=%s',(st_phoneno,st_id))
print('====================SUCCESSFULLY UPDATED\
====================')
c1.execute('select*from staff_details where st_id=%s',(st_id,))
v=c1.fetchall()
print("STAFF ID\t\tSTAFF NAME\t\t\tAGE\t\t\tDEPARTMENT\t\t\
CONTACT NO.")
for i in v :
for j in i:
print(j,end='\t\t\t')
print()
conn.commit()
else:
print("Invalid input. Please refer the menu to specify choices")
chA=input("Do you want to continue updating staff details?:[yes/no]")
elif subchoice.upper()=='B':
st_id=input('Enter ID of Staff whose Record is to be deleted:')
c1.execute('SELECT * FROM staff_details WHERE st_id=%s',(st_id,))
t=c1.fetchall()
if t==[]:
print('\n! ! No such record found ! !\n')
else:
sure=input('Are you sure you want to delete this record:[yes/no]')
if sure.lower()=='yes':
c1.execute('DELETE FROM staff_details WHERE st_id=%s',(st_id,))
print('====================SUCCESSFULLY DELETED====================')
else:
break
else:
print("Invalid input. Please refer the menu to specify choices")
chS=input("Do you want to continue updating?:[yes/no]")
else:
print("Invalid input. Please refer the menu to specify choices")
ch3=input("Do you want to continue with main menu of updation/deletion?:[yes/no]")
else:
print("Invalid input. Please refer the menu to specify choices")
print("==========YOU HAVE RETURNED TO MAIN PAGE==========")
ch=input("Do you want to continue to main menu?:[yes/no]")
else:
print('USERNAME OR PASSWORD APPEARS TO BE INCORRECT!!')
break
Ch=input("Do you want to login again?:[yes/no]")
elif choice1==2:
break
else:
print("Invalid input. Please refer the menu to specify choices")
CH=input("Do you want to start all over again ?:[yes/no]")
print()
print("! ! (^_^) Thank You for visitng THUMBAY MEDICAL CENTER(^_^) ! !")
print("! ! \t\t~ Your Health is in GOOD hands ~\t ! !")
print()
conn.close()
else:
print('! ! ERROR IN CONNECTION ! !')