-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hospital Management.py
1904 lines (1466 loc) · 75.4 KB
/
Hospital Management.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
990
991
992
993
994
995
996
997
998
999
1000
# import all dependencies
from tkinter import *
from tkinter import messagebox, ttk
import easygui
from PIL import Image, ImageTk
from tkcalendar import Calendar
import mysql.connector as sqlcon
import pyglet
import pyttsx3
import random
# configure text-to-speech
engine = pyttsx3.init()
def speak(text):
pass
# engine.setProperty("rate", 150)
# engine.say(text)
# engine.runAndWait()
# config main window
pyglet.font.add_file(r"Data\\Miscs\\Evogria.otf")
pyglet.font.load("evogria")
root = Tk()
root.title("Chase Hospitals")
root.iconbitmap(r"Data\\Images\\Icons\\plus.ico")
root.config(bg = "#FFFFFF")
root.state("zoomed")
root.resizable(False, False)
# top frame (constant)
top_frame = LabelFrame(root)
top_frame.grid(row = 0, column = 0, rowspan = 2, columnspan = 8)
top_frame.grid_propagate(0)
# title
title = Label(top_frame, text = "Chase Hospitals", font = "evogria 45",
bg = "#FFE2E2", width = 42, anchor = CENTER)
title.pack()
# left frame (constant)
left_frame = LabelFrame(root, bg = "#FFE2E2")
left_frame.grid(row = 2, column = 0, padx = 4, pady = 4, columnspan = 3, ipady = 40)
# right frame (varies)
right_frame = LabelFrame(root, width = 979, height = 700, bg = "#FFE2E2")
right_frame.grid(row = 2, column = 4, columnspan = 4)
right_frame.grid_propagate(0)
# define all functions
# clean right frame - use in every button
def clean_right_frame():
global right_frame
main_window()
right_frame.grid_forget()
right_frame = LabelFrame(root, width = 979, height = 700, bg = "#FFE2E2")
right_frame.grid(row = 2, column = 4, columnspan = 4)
right_frame.grid_propagate(0)
# clean left and top frame (for services offered window)
def clean_left_frame():
global left_frame
main_window()
left_frame.grid_forget()
left_frame = LabelFrame(root, bg = "#FFE2E2")
left_frame.grid(row = 2, column = 0, padx = 4, pady = 4, columnspan = 3, ipady = 40)
left_frame.grid_propagate(0)
def clean_top_frame():
global top_frame
main_window()
top_frame.grid_forget()
top_frame = LabelFrame(root, bg = "#FFE2E2")
top_frame.grid(row = 0, column = 0, rowspan = 2, columnspan = 8)
top_frame.grid_propagate(0)
# registration main window
def registration_window():
global registration
clean_right_frame()
# highlight clicked button
registration.grid_forget()
registration = Button(left_frame, text = "Registration", font = "consolas 19 bold",
width = 27, padx = 10, pady = 4, borderwidth = 7, bg = "#2A363B",
fg = "#FF847C", anchor = CENTER, relief = SUNKEN, command = registration_window)
registration.grid(row = 0, column = 0, columnspan = 3, pady = 5, padx = 20)
global name_entry
global age_entry
global gender_entry
global contact_entry
global address_entry
global blood_group_entry
# labels
name_label = Label(right_frame, text = "Name", font = "consolas 25 bold", bg = "#FFE2E2")
age_label = Label(right_frame, text = "Age", font = "consolas 25 bold", bg = "#FFE2E2")
gender_label = Label(right_frame, text = "Gender", font = "consolas 25 bold", bg = "#FFE2E2")
contact_label = Label(right_frame, text = "Contact No.", font = "consolas 25 bold", bg = "#FFE2E2")
address_label = Label(right_frame, text = "Address", font = "consolas 25 bold", bg = "#FFE2E2")
blood_group_label = Label(right_frame, text = "Blood Group", font = "consolas 25 bold", bg = "#FFE2E2")
name_label.grid(row = 0, column = 0, padx = 10, sticky = W)
age_label.grid(row = 1, column = 0, padx = 10, sticky = W)
gender_label.grid(row = 2, column = 0, padx = 10, sticky = W)
contact_label.grid(row = 3, column = 0, padx = 10, sticky = W)
address_label.grid(row = 4, column = 0, padx = 10, sticky = W)
blood_group_label.grid(row = 5, column = 0, padx = 10, sticky = W)
for i in range(6):
colon = Label(right_frame, text = ":", font = "consolas 25 bold", bg = "#FFE2E2")
colon.grid(row = i, column = 1, sticky = W)
# entry fields
name_entry = Entry(right_frame, font = "consolas 20")
age_entry = Entry(right_frame, font = "consolas 20")
gender_entry = Entry(right_frame, font = "consolas 20")
contact_entry = Entry(right_frame, font = "consolas 20")
address_entry = Entry(right_frame, font = "consolas 20")
blood_group_entry = Entry(right_frame, font = "consolas 20")
name_entry.grid(row = 0, column = 2, columnspan = 3, ipadx = 160, ipady = 5, pady = 20, padx = 10)
age_entry.grid(row = 1, column = 2, columnspan = 3, ipadx = 160, ipady = 5, pady = 20, padx = 10)
gender_entry.grid(row = 2, column = 2, columnspan = 3, ipadx = 160, ipady = 5, pady = 20, padx = 10)
contact_entry.grid(row = 3, column = 2, columnspan = 3, ipadx = 160, ipady = 5, pady = 20, padx = 10)
address_entry.grid(row = 4, column = 2, columnspan = 3, ipadx = 160, ipady = 5, pady = 20, padx = 10)
blood_group_entry.grid(row = 5, column = 2, columnspan = 3, ipadx = 160, ipady = 5, pady = 20, padx = 10)
# submit button
submit_button = Button(right_frame, text = "Register", font = "consolas 20 bold",
bg = "#FF847C", borderwidth = 7, padx = 10, pady = 4, command = registration_submit)
submit_button.grid(row = 6, column = 0, columnspan = 4, padx = 10, pady = 54, ipadx = 350)
submit_button.update()
speak("Please fill your complete details")
# patient details main window
def patient_details_window():
clean_right_frame()
global right_frame
global patient_details
global field_to_search
global search_detail_entry
global submit_button
# highlight clicked button
patient_details.grid_forget()
patient_details = Button(left_frame, text = "Patient Details", font = "consolas 19 bold",
width = 27, padx = 10, pady = 4, borderwidth = 7, bg = "#2A363B", fg = "#FF847C",
anchor = CENTER, relief = SUNKEN, command = patient_details_window)
patient_details.grid(row = 1, column = 0, columnspan = 3, pady = 5, padx = 20)
# search button
submit_button = Button(right_frame, text = "Search", font = "consolas 17 bold", bg = "#FF847C",
borderwidth = 7, padx = 10, pady = 4, command = patient_details_search_submit)
submit_button.grid(row = 2, column = 0, columnspan = 4, padx = 10, pady = 54, ipadx = 375)
# select a field to search
field_to_search_label = Label(right_frame, text = "Field", font = "consolas 19 bold", bg = "#FFE2E2")
search_detail_label = Label(right_frame, text = "Details", font = "consolas 19 bold", bg = "#FFE2E2")
field_to_search_label.grid(row = 0, column = 0, padx = 5, sticky = W)
search_detail_label.grid(row = 1, column = 0, padx = 5, sticky = W)
for j in range(2):
colon = Label(right_frame, text = ":", font = "consolas 20 bold", bg = "#FFE2E2")
colon.grid(row = j, column = 1, sticky = W)
field_to_search_options = ["PID", "Name", "Age", "Gender", "Contact", "Address", "Blood Group"]
field_to_search = StringVar()
field_to_search.set("Name")
field_to_search_menu = OptionMenu(right_frame, field_to_search, *field_to_search_options)
field_to_search_menu.config(width = 62, height = 1, font = "consolas 15 bold")
field_to_search_menu.grid(row = 0, column = 2, columnspan = 3, padx = 15, pady = 5, sticky = W)
search_detail_entry = Entry(right_frame, font = "consolas 17")
search_detail_entry.grid(row = 1, column = 2, ipadx = 230, ipady = 5, padx = 15, pady = 10)
submit_button.update()
speak("Pleast enter details of the patient you want to see")
# display patient details after search
def display_patient_details_after_search():
global searched_patient_details
global patient_details
global resized_profile_pic_final
global display_profile_pic
clean_right_frame()
# highlight clicked button
patient_details.grid_forget()
patient_details = Button(left_frame, text = "Patient Details", font = "consolas 19 bold",
width = 27, padx = 10, pady = 4, borderwidth = 7, bg = "#2A363B", fg = "#FF847C",
anchor = CENTER, relief = SUNKEN, command = patient_details_window)
patient_details.grid(row = 1, column = 0, columnspan = 3, pady = 5, padx = 20)
# select a random image for profile pic
profile_pic_1 = Image.open(r"Data\\Images\\Profile Pics\\dp1.png")
profile_pic_2 = Image.open(r"Data\\Images\\Profile Pics\\dp2.png")
profile_pic_3 = Image.open(r"Data\\Images\\Profile Pics\\dp3.png")
profile_pic_4 = Image.open(r"Data\\Images\\Profile Pics\\dp4.png")
profile_pic_5 = Image.open(r"Data\\Images\\Profile Pics\\dp5.png")
profile_pics = [profile_pic_1, profile_pic_2, profile_pic_3, profile_pic_4, profile_pic_5]
random_profile_pic = random.choice(profile_pics)
resized_profile_pic = random_profile_pic.resize((100, 100), Image.ANTIALIAS)
resized_profile_pic_final = ImageTk.PhotoImage(resized_profile_pic)
display_profile_pic = Label(right_frame, image = resized_profile_pic_final,
width = 100, bd = 2, relief = SOLID, anchor = CENTER)
display_profile_pic.grid(row = 0, column = 0, padx = 5, pady = 5, columnspan = 4)
# display details
name_label = Label(right_frame, text = searched_patient_details[1], font = "evogria 30", bg = "#FFE2E2",
width = 40, anchor = CENTER)
pid_label = Label(right_frame, text = searched_patient_details[0], font = "evogria 22", bg = "#FFE2E2",
width = 47, anchor = CENTER)
name_label.grid(row = 1, column = 0, padx = 5, pady = 3, columnspan = 4)
pid_label.grid(row = 2, column = 0, padx = 5, pady = 3, columnspan = 4)
# blank label
blank_label = Label(right_frame, text = "", bg = "#FFE2E2")
blank_label.grid(row = 3, pady = 5)
for i in range(6):
blank_label = Label(right_frame, text = "", bg = "#FFE2E2")
blank_label.grid(row = i + 4, column = 0, padx = 20)
# labels
age_label = Label(right_frame, text = "Age", font = "consolas 19 bold",
bg = "#FFE2E2", width = 13, anchor = E)
gender_label = Label(right_frame, text = "Gender", font = "consolas 19 bold",
bg = "#FFE2E2", width = 13, anchor = E)
contact_label = Label(right_frame, text = "Contact", font = "consolas 19 bold",
bg = "#FFE2E2", width = 13, anchor = E)
address_label = Label(right_frame, text = "Address", font = "consolas 19 bold",
bg = "#FFE2E2", width = 13, anchor = E)
blood_group_label = Label(right_frame, text = "Blood Group", font = "consolas 19 bold",
bg = "#FFE2E2", width = 13, anchor = E)
appointment_label = Label(right_frame, text = "Appointment", font = "consolas 19 bold",
bg = "#FFE2E2", width = 13, anchor = E)
age_label.grid(row = 4, column = 1, pady = 3, sticky = W)
gender_label.grid(row = 5, column = 1, pady = 3, sticky = W)
contact_label.grid(row = 6, column = 1, pady = 3, sticky = W)
address_label.grid(row = 7, column = 1, pady = 3, sticky = W)
blood_group_label.grid(row = 8, column = 1, pady = 3, sticky = W)
appointment_label.grid(row = 9, column = 1, pady = 3, sticky = W)
for i in range(6):
colon = Label(right_frame, text = ":", font = "consolas 20 bold", bg = "#FFE2E2")
colon.grid(row = i + 4, column = 2, sticky = W)
# get appointment details
if (len(searched_patient_details) == 7):
details = "No appointments yet"
else:
details = "You have an appointment with {} on {}".format(searched_patient_details[7],
searched_patient_details[8])
# display details
patient_details_age_label = Label(right_frame, text = searched_patient_details[2],
font = "consolas 19 bold", bg = "#FFE2E2", width = 15, anchor = W)
patient_details_gender_label = Label(right_frame, text = searched_patient_details[3],
font = "consolas 19 bold", bg = "#FFE2E2", width = 15, anchor = W)
patient_details_contact_label = Label(right_frame, text = searched_patient_details[4],
font = "consolas 19 bold", bg = "#FFE2E2", width = 15, anchor = W)
patient_details_address_label = Label(right_frame, text = searched_patient_details[5],
font = "consolas 19 bold", bg = "#FFE2E2", width = 15, anchor = W)
patient_details_blood_group_label = Label(right_frame, text = searched_patient_details[6],
font = "consolas 19 bold", bg = "#FFE2E2", width = 15, anchor = W)
patient_details_appointment_label = Label(right_frame, text = details, font = "consolas 19 bold",
bg = "#FFE2E2", width = 15, anchor = W, wraplength = 225, justify = LEFT)
patient_details_age_label.grid(row = 4, column = 2, padx = 5, pady = 3)
patient_details_gender_label.grid(row = 5, column = 2, padx = 5, pady = 3)
patient_details_contact_label.grid(row = 6, column = 2, padx = 5, pady = 3)
patient_details_address_label.grid(row = 7, column = 2, padx = 5, pady = 3)
patient_details_blood_group_label.grid(row = 8, column = 2, padx = 5, pady = 3)
patient_details_appointment_label.grid(row = 9, column = 2, padx = 5, pady = 3)
# doctor"s details main window
def doctors_details_window():
doctor_id_values, doctor_name_values, doctor_age_values, \
doctor_contact_values, doctor_specialisation_values, \
doctor_qualification_values = doctor_details_values()
global doctor_details
clean_right_frame()
# highlight clicked button
doctor_details.grid_forget()
doctor_details = Button(left_frame, text = "Doctor Details", font = "consolas 19 bold",
width = 27, padx = 10, pady = 4, borderwidth = 7, bg = "#2A363B", fg = "#FF847C",
anchor = CENTER, relief = SUNKEN, command = patient_details_window)
doctor_details.grid(row = 2, column = 0, columnspan = 3, pady = 5, padx = 20)
# Doctors details
sno_id = 1
doctor_id_attribute = Label(right_frame, text = "ID", font = "evogria 17", width = 4,
anchor = CENTER, bg = "#FFE2E2")
doctor_id_attribute.grid(row = 0, column = 0)
for i in doctor_id_values:
value = Label(right_frame, text = i, font = "consolas 14", bg = "#FFE2E2")
value.grid(row = sno_id, column = 0)
sno_id += 1
sno_name = 1
doctor_name_attribute = Label(right_frame, text = "Name", font = "evogria 17", width = 10,
anchor = CENTER, bg = "#FFE2E2")
doctor_name_attribute.grid(row = 0, column = 1)
for i in doctor_name_values:
value = Label(right_frame, text = i, font = "consolas 14", bg = "#FFE2E2")
value.grid(row = sno_name, column = 1)
sno_name += 1
sno_age = 1
doctor_age_attribute = Label(right_frame, text = "Age", font = "evogria 17", width = 4,
anchor = CENTER, bg = "#FFE2E2")
doctor_age_attribute.grid(row = 0, column = 2)
for i in doctor_age_values:
value = Label(right_frame, text = i, font = "consolas 14", bg = "#FFE2E2")
value.grid(row = sno_age, column = 2)
sno_age += 1
sno_contact = 1
doctor_contact_attribute = Label(right_frame, text = "Contact Number", font = "evogria 17",
width = 15, anchor = CENTER, wraplength = 100, justify = "center", bg = "#FFE2E2")
doctor_contact_attribute.grid(row = 0, column = 3)
for i in doctor_contact_values:
value = Label(right_frame, text = i, font = "consolas 14", bg = "#FFE2E2")
value.grid(row = sno_contact, column = 3)
sno_contact += 1
sno_specialisation = 1
doctor_specialisation_attribute = Label(right_frame, text = "Specialistaion", font = "evogria 17",
width = 15, anchor = CENTER, bg = "#FFE2E2")
doctor_specialisation_attribute.grid(row = 0, column = 4)
for i in doctor_specialisation_values:
value = Label(right_frame, text = i, font = "consolas 14", anchor = W, bg = "#FFE2E2")
value.grid(row = sno_specialisation, column = 4)
sno_specialisation += 1
sno_qualification = 1
doctor_qualification_attribute = Label(right_frame, text = "Qualification", font = "evogria 17",
width = 15, anchor = CENTER, bg = "#FFE2E2")
doctor_qualification_attribute.grid(row = 0, column = 5)
for i in doctor_qualification_values:
value = Label(right_frame, text = i, font = "consolas 14", anchor = W, wraplength = 200,
justify = "center", bg = "#FFE2E2")
value.grid(row = sno_qualification, column = 5)
sno_qualification += 1
doctor_qualification_attribute.update()
speak("We have one of the best Doctors of the World")
# modify details main window
def modify_details_window():
global modify_details
global check_pid_modify
# get back to main menu
home_submit()
# check patient id
check_pid_modify = easygui.enterbox(title = "Modify Details", msg = "Enter your PID")
operation = """SELECT *
FROM patient_details"""
cursor.execute(operation)
data = cursor.fetchall()
existing_pid = []
for i in data:
existing_pid.append(str(i[0]))
if (check_pid_modify in existing_pid):
clean_right_frame()
# highlight clicked button
modify_details.grid_forget()
modify_details = Button(left_frame, text = "Modify Details", font = "consolas 19 bold", width = 27,
padx = 10, pady = 4, borderwidth = 7, bg = "#2A363B", fg = "#FF847C", anchor = CENTER,
relief = SUNKEN, command = modify_details_window)
modify_details.grid(row = 4, column = 0, columnspan = 3, pady = 5, padx = 20)
modify_details_after_verification()
else:
messagebox.showerror("Modify Details", "PID given is wrong")
return ()
# modify details after verifying
def modify_details_after_verification():
global old_details_frame
global update_frame
global field_to_update
global updated_detail_entry
global old_details
# fetch old details of the patient
operation = """SELECT *
FROM patient_details
WHERE pid = {}""".format(check_pid_modify)
cursor.execute(operation)
data = cursor.fetchone()
old_details = [str(i) for i in data]
for i in old_details[3]:
if (i == "M"):
old_details[1] = "Mr. " + old_details[1]
else:
old_details[1] = "Miss. " + old_details[1]
# define frame
# old details frame
old_details_frame = LabelFrame(right_frame, height = 362, width = 1000, text = "Old Records", bg = "#FFE2E2")
old_details_frame.grid(row = 0, column = 0, rowspan = 7, columnspan = 3, padx = 7)
old_details_frame.grid_propagate(0)
# update frame
update_frame = LabelFrame(right_frame, height = 283, width = 1000, text = "Update Record", bg = "#FFE2E2")
update_frame.grid(row = 8, column = 0, rowspan = 3, columnspan = 3, pady = 5, padx = 7)
update_frame.grid_propagate(0)
# old details
# labels
pid_label = Label(old_details_frame, text = "PID", font = "consolas 19 bold", bg = "#FFE2E2")
name_label = Label(old_details_frame, text = "Name", font = "consolas 19 bold", bg = "#FFE2E2")
age_label = Label(old_details_frame, text = "Age", font = "consolas 19 bold", bg = "#FFE2E2")
gender_label = Label(old_details_frame, text = "Gender", font = "consolas 19 bold", bg = "#FFE2E2")
contact_label = Label(old_details_frame, text = "Contact No.", font = "consolas 19 bold", bg = "#FFE2E2")
address_label = Label(old_details_frame, text = "Address", font = "consolas 19 bold", bg = "#FFE2E2")
blood_group_label = Label(old_details_frame, text = "Blood Group", font = "consolas 19 bold", bg = "#FFE2E2")
pid_label.grid(row = 0, column = 0, padx = 5, pady = 3, sticky = W)
name_label.grid(row = 1, column = 0, padx = 5, pady = 3, sticky = W)
age_label.grid(row = 2, column = 0, padx = 5, pady = 3, sticky = W)
gender_label.grid(row = 3, column = 0, padx = 5, pady = 3, sticky = W)
contact_label.grid(row = 4, column = 0, padx = 5, pady = 3, sticky = W)
address_label.grid(row = 5, column = 0, padx = 5, pady = 3, sticky = W)
blood_group_label.grid(row = 6, column = 0, padx = 5, pady = 3, sticky = W)
for i in range(7):
colon = Label(old_details_frame, text = ":", font = "consolas 20 bold", bg = "#FFE2E2")
colon.grid(row = i, column = 1, sticky = W)
# old details
display_old_pid = Button(old_details_frame, text = old_details[0], font = "consolas 19 bold",
width = 27, padx = 10, borderwidth = 1, bg = "#FFE2E2", relief = GROOVE, anchor = W)
display_name_pid = Button(old_details_frame, text = old_details[1], font = "consolas 19 bold",
width = 27, padx = 10, borderwidth = 1, bg = "#FFE2E2", relief = GROOVE, anchor = W)
display_age_pid = Button(old_details_frame, text = old_details[2], font = "consolas 19 bold",
width = 27, padx = 10, borderwidth = 1, bg = "#FFE2E2", relief = GROOVE, anchor = W)
display_gender_pid = Button(old_details_frame, text = old_details[3], font = "consolas 19 bold",
width = 27, padx = 10, borderwidth = 1, bg = "#FFE2E2", relief = GROOVE, anchor = W)
display_contact_pid = Button(old_details_frame, text = old_details[4], font = "consolas 19 bold",
width = 27, padx = 10, borderwidth = 1, bg = "#FFE2E2", relief = GROOVE, anchor = W)
display_address_pid = Button(old_details_frame, text = old_details[5], font = "consolas 19 bold",
width = 27, padx = 10, borderwidth = 1, bg = "#FFE2E2", relief = GROOVE, anchor = W)
display_blood_group_pid = Button(old_details_frame, text = old_details[6],
font = "consolas 19 bold", width = 27, padx = 10, borderwidth = 1,
bg = "#FFE2E2", relief = GROOVE, anchor = W)
display_old_pid.grid(row = 0, column = 2, columnspan = 3, padx = 20, ipadx = 120)
display_name_pid.grid(row = 1, column = 2, columnspan = 3, padx = 20, ipadx = 120)
display_age_pid.grid(row = 2, column = 2, columnspan = 3, padx = 20, ipadx = 120)
display_gender_pid.grid(row = 3, column = 2, columnspan = 3, padx = 20, ipadx = 120)
display_contact_pid.grid(row = 4, column = 2, columnspan = 3, padx = 20, ipadx = 120)
display_address_pid.grid(row = 5, column = 2, columnspan = 3, padx = 20, ipadx = 120)
display_blood_group_pid.grid(row = 6, column = 2, columnspan = 3, padx = 20, ipadx = 120)
# update details
field_to_update_label = Label(update_frame, text = "Field", font = "consolas 19 bold", bg = "#FFE2E2")
updated_detail_label = Label(update_frame, text = "New Details", font = "consolas 19 bold", bg = "#FFE2E2")
field_to_update_label.grid(row = 0, column = 0, padx = 5, sticky = W)
updated_detail_label.grid(row = 1, column = 0, padx = 5, sticky = W)
for i in range(2):
colon = Label(update_frame, text = ":", font = "consolas 20 bold", bg = "#FFE2E2")
colon.grid(row = i, column = 1, sticky = W)
field_to_update_options = ["Name", "Age", "Gender", "Contact", "Address", "Blood Group"]
field_to_update = StringVar()
field_to_update.set("Name")
field_to_update_menu = OptionMenu(update_frame, field_to_update, *field_to_update_options)
field_to_update_menu.config(width = 55, height = 1, font = "consolas 15 bold")
field_to_update_menu.grid(row = 0, column = 2, columnspan = 3, padx = 15, pady = 5, sticky = W)
updated_detail_entry = Entry(update_frame, font = "consolas 17")
updated_detail_entry.grid(row = 1, column = 2, ipadx = 193, ipady = 5, padx = 15, pady = 10)
# update button
submit_button = Button(update_frame, text = "Update", font = "consolas 17 bold", bg = "#FF847C",
borderwidth = 7, padx = 10, pady = 4, command = modify_submit)
submit_button.grid(row = 5, column = 0, columnspan = 4, padx = 10, pady = 54, ipadx = 360)
submit_button.update()
speak("Please select the field that you want to change")
# about us window
def about_window():
global about
global display_profile_pic1
global display_profile_pic2
global display_profile_pic3
global final_img1
global final_img2
global final_img3
clean_right_frame()
# highlight clicked button
about.grid_forget()
about = Button(left_frame, text = "About", font = "consolas 19 bold", width = 27, padx = 10, pady = 4,
borderwidth = 7, bg = "#2A363B", fg = "#FF847C", anchor = CENTER, relief = SUNKEN,
command = about_window)
about.grid(row = 6, column = 0, pady = 5, padx = 20)
# title
about_title = Label(right_frame, text = "About Us", font = "evogria 26 bold",
width = 44, anchor = CENTER, bg = "#FFE2E2")
about_title.grid(row = 0, column = 0, padx = 5, pady = 5)
# main content
details_1 = str(
"Talking about the features of this Hospital Management System, " +
"this project is aimed for a completely " +
"computerised management of our fictional hospital CHASE HOSPITALS. " +
"A patient can register themselves, view their details " +
"and modify their details as well. They can see the Details of Doctors, " +
"view the Services offered by the hospital. " +
"They can also make an appointment to a particular doctor."
)
details_2 = str(
"This project is created by Udit Pati and Robin Vats " +
"as part of their 12th CS project 2020 - 2021, under " +
"the able and very helpful guidance of PGT Mr. ML Meena Sir, " +
"Kendriya Vidyalaya No. 2 Delhi Cantt. All codes in this file " +
"is completely written by Udit Pati and Robin Vats only. " +
"All images and icons used under CC license."
)
about_project_label = Label(right_frame, text = "About Project",
font = "evogria 18", bg = "#FFE2E2")
about_project_label.grid(row = 1, column = 0, pady = 5, padx = 10, sticky = W)
display_details_1 = Label(right_frame, text = details_1, font = "consolas 14",
bg = "#FFE2E2", wraplength = 850, justify = LEFT)
display_details_1.grid(row = 2, column = 0, rowspan = 4, sticky = W, pady = 10, padx = 10)
about_developers_label = Label(right_frame, text = "About Developers",
font = "evogria 18", bg = "#FFE2E2")
about_developers_label.grid(row = 6, column = 0, pady = 10, padx = 10, sticky = W)
display_details_2 = Label(right_frame, text = details_2, font = "consolas 14",
bg = "#FFE2E2", wraplength = 850, justify = LEFT)
display_details_2.grid(row = 7, column = 0, rowspan = 4, sticky = W, padx = 10, pady = 10)
img3 = Image.open(r"Data\\Images\\Profile Pics\\meena_sir.jpg")
img1 = Image.open(r"Data\\Images\\Profile Pics\\lucifer.jpg")
img2 = Image.open(r"Data\\Images\\Profile Pics\\vats.jpg")
resized_img1 = img1.resize((175, 175), Image.ANTIALIAS)
resized_img2 = img2.resize((175, 175), Image.ANTIALIAS)
resized_img3 = img3.resize((175, 175), Image.ANTIALIAS)
final_img1 = ImageTk.PhotoImage(resized_img1)
final_img2 = ImageTk.PhotoImage(resized_img2)
final_img3 = ImageTk.PhotoImage(resized_img3)
display_profile_pic1 = Label(right_frame, image = final_img1, bd = 2, relief = SOLID)
display_profile_pic1.grid(row = 11, column = 0, padx = 30, pady = 5, sticky = W)
display_profile_pic2 = Label(right_frame, image = final_img2, bd = 2, relief = SOLID)
display_profile_pic2.grid(row = 11, column = 0, pady = 5)
display_profile_pic3 = Label(right_frame, image = final_img3, bd = 2, relief = SOLID)
display_profile_pic3.grid(row = 11, column = 0, padx = 60, pady = 5, sticky = E)
about_title_lucifer = Label(right_frame, text = "Udit Pati",
font = "evogria 16", anchor = CENTER, bg = "#FFE2E2")
about_title_lucifer.grid(row = 12, column = 0, padx = 70, sticky = W)
about_title_vats = Label(right_frame, text = "Robin Vats",
font = "evogria 16", anchor = CENTER, bg = "#FFE2E2")
about_title_vats.grid(row = 12, column = 0, padx = 5)
about_title_meena_sir = Label(right_frame, text = "M L Meena Sir", font = "evogria 16", anchor = CENTER,
bg = "#FFE2E2")
about_title_meena_sir.grid(row = 12, column = 0, padx = 70, sticky = E)
about_title_meena_sir.update()
speak("This project is made by Udit and Robin under the guidance of M L Meena Sir PGT(Computer Science)")
# appointment window
def appointment_window():
global appointment
global check_pid
# get back to main menu
home_submit()
# check patient id
check_pid = easygui.enterbox(title = "Check PID", msg = "Enter your PID")
operation = """SELECT * FROM PATIENT_DETAILS"""
cursor.execute(operation)
data = cursor.fetchall()
existing_pid = []
for i in data:
existing_pid.append(str(i[0]))
if (check_pid in existing_pid):
clean_right_frame()
# highlight clicked button
appointment.grid_forget()
appointment = Button(left_frame, text = "Appointment", font = "consolas 19 bold",
width = 27, padx = 10, pady = 4, borderwidth = 7, bg = "#2A363B", fg = "#FF847C",
anchor = CENTER, relief = SUNKEN, command = appointment_window)
appointment.grid(row = 3, column = 0, columnspan = 3, pady = 5, padx = 20)
appointing_the_doctor()
else:
messagebox.showerror("Modify Details", "PID given is wrong")
speak("You Are Not An Existing Patient Please Register Yourself")
return ()
date = "Pick Date"
# appointing the doctor
def appointing_the_doctor():
global existing_doctors
global doctor_frame
global field_to_update
global date_entry
global date_pick
global doctor_name
# selecting doctor
doctor_frame = LabelFrame(right_frame, height = 372, width = 1000,
text = "Doctor and Date select", bg = "#FFE2E2")
doctor_frame.grid(row = 0, column = 0, rowspan = 7, columnspan = 3, padx = 7)
doctor_frame.grid_propagate(0)
# collecting doctors names
operation = """SELECT * FROM doctor_details"""
cursor.execute(operation)
data = cursor.fetchall()
existing_doctors = {}
for i in data:
existing_doctors[i[0]] = i[1]
doctor_name = StringVar()
doctor_name.set("Doctors")
doctor_label = Label(doctor_frame, text = "Doctor", font = "consolas 25 bold", bg = "#FFE2E2")
date_label = Label(doctor_frame, text = "Date", font = "consolas 25 bold", bg = "#FFE2E2")
doctor_label.grid(row = 0, column = 0, columnspan = 3, padx = 10, sticky = W)
date_label.grid(row = 1, column = 0, columnspan = 3, padx = 10, sticky = W)
for i in range(2):
colon = Label(doctor_frame, text = ":", font = "consolas 20 bold", bg = "#FFE2E2")
colon.grid(row = i, column = 3, sticky = W)
date_pick = Button(doctor_frame, text = date, font = "consolas 15 bold", width = 57, command = get_date)
date_pick.grid(row = 1, column = 4, columnspan = 3, padx = 15, pady = 20, sticky = W)
doctor_select = OptionMenu(doctor_frame, doctor_name, *list(existing_doctors.values()))
doctor_select.config(width = 54, height = 1, font = "consolas 15 bold")
doctor_select.grid(row = 0, column = 4, columnspan = 3, padx = 15, pady = 20, sticky = W)
submit_button = Button(doctor_frame, text = "Submit", font = "consolas 20 bold", bg = "#FF847C", width = 55,
borderwidth = 7, padx = 10, pady = 4, command = appointment_submit)
submit_button.grid(row = 6, column = 0, columnspan = 7, padx = 10, pady = 54)
submit_button.update()
speak("Please select the doctor and time to meet")
# date picker
def get_date():
global date
global date_pick
def cal_done():
top.withdraw()
root.quit()
root = Tk()
root.withdraw() # keep the root window from appearing
top = Toplevel(root)
style = ttk.Style(top)
style.theme_use("alt")
style.configure("style.TButton", font = "evogria 20 bold", background = "#FF847C", width = 20)
style.map("TButton", background = [("active", "#2A363B")], foreground = [("active", "#FF847C")])
cal = Calendar(top, font = "Arial 14", selectmode = "day", cursor = "hand2")
cal.pack(fill = "both", expand = True)
ttk.Button(top, text = "ok", style = "style.TButton", command = cal_done).pack()
root.mainloop()
date = cal.selection_get()
date_pick.grid_forget()
date_pick = Button(doctor_frame, text = date, font = "consolas 15 bold", width = 57, command = get_date)
date_pick.grid(row = 1, column = 4, columnspan = 3, padx = 15, pady = 20, sticky = W)
return date
# services window
def service_window():
clean_left_frame()
clean_top_frame()
home_submit()
global services_offered_frame
global rooms
global testing_labs
global intensive_care_units
global pharmacy
global operation_theatre
global home
top_frame = LabelFrame(root)
top_frame.grid(row = 0, column = 0, rowspan = 2, columnspan = 8)
top_frame.grid_propagate(0)
services_offered_frame = LabelFrame(root, bg = "#FFE2E2")
services_offered_frame.grid(row = 2, column = 0, padx = 4, pady = 4, columnspan = 2, ipady = 30)
# title
title = Label(top_frame, text = "Services Offered", font = "evogria 45",
bg = "#FFE2E2", width = 42, anchor = CENTER)
title.pack()
rooms = Button(services_offered_frame, text = "Rooms", font = "consolas 21 bold", width = 25, padx = 12,
pady = 10, borderwidth = 7, bg = "#FF847C", anchor = CENTER, command = rooms_window)
testing_labs = Button(services_offered_frame, text = "Testing Labs", font = "consolas 21 bold", width = 25,
padx = 12, pady = 10, borderwidth = 7, bg = "#FF847C",
anchor = CENTER, command = testing_window)
intensive_care_units = Button(services_offered_frame, text = "Intensive Care Units", font = "consolas 21 bold",
width = 25, padx = 12, pady = 10, borderwidth = 7, bg = "#FF847C",
anchor = CENTER, command = ICU_window)
pharmacy = Button(services_offered_frame, text = "Pharmacy", font = "consolas 21 bold", width = 25, padx = 12,
pady = 10, borderwidth = 7, bg = "#FF847C", anchor = CENTER, command = pharmacy_window)
operation_theatre = Button(services_offered_frame, text = "Operation Theatre", font = "consolas 21 bold",
width = 25, padx = 12, pady = 10, borderwidth = 7, bg = "#FF847C",
anchor = CENTER, command = operation_window)
home = Button(services_offered_frame, text = "Home", font = "consolas 21 bold", width = 25, padx = 12,
pady = 10, borderwidth = 7, bg = "#FF847C", anchor = CENTER,
command = home_submit_services_offered)
rooms.grid(row = 0, column = 0, columnspan = 3, pady = 10, padx = 20)
testing_labs.grid(row = 1, column = 0, columnspan = 3, pady = 10, padx = 20)
intensive_care_units.grid(row = 2, column = 0, columnspan = 3, pady = 10, padx = 20)
pharmacy.grid(row = 3, column = 0, columnspan = 3, pady = 10, padx = 20)
operation_theatre.grid(row = 4, column = 0, columnspan = 3, pady = 10, padx = 20)
home.grid(row = 5, column = 0, columnspan = 3, pady = 10, padx = 20)
def rooms_window():
clean_right_frame()
wards_detail, rooms_detail, number_of_bed_detail, \
number_of_nurse_on_assistance, specialisations_of_wards = room_values()
# Doctors details
sno_ward = 1
wards_detail_attribute = Label(right_frame, text = "Wards",
font = "evogria 17", width = 10, anchor = CENTER, bg = "#FFE2E2")
wards_detail_attribute.grid(row = 0, column = 0)
for i in wards_detail:
value = Label(right_frame, text = i, font = "consolas 13", bg = "#FFE2E2")
value.grid(row = sno_ward, column = 0)
sno_ward += 1
sno_rooms = 1
rooms_details_attribute = Label(right_frame, text = "Room No",
font = "evogria 17", width = 9, anchor = CENTER, bg = "#FFE2E2")
rooms_details_attribute.grid(row = 0, column = 1)
for i in rooms_detail:
value = Label(right_frame, text = i, font = "consolas 13", bg = "#FFE2E2")
value.grid(row = sno_rooms, column = 1)
sno_rooms += 1
sno_number_of_bed = 1
no_of_bed_attribute = Label(right_frame, text = "No. of Bed",
font = "evogria 17", width = 11, wraplength = 100,
justify = CENTER, anchor = CENTER, bg = "#FFE2E2")
no_of_bed_attribute.grid(row = 0, column = 2)
for i in number_of_bed_detail:
value = Label(right_frame, text = i, font = "consolas 13", bg = "#FFE2E2")
value.grid(row = sno_number_of_bed, column = 2)
sno_number_of_bed += 1
sno_number_of_assistance = 1
number_of_assistance_attribute = Label(right_frame, text = "Number of Assistants",
font = "evogria 17", width = 12, anchor = CENTER, wraplength = 200,
justify = "center", bg = "#FFE2E2")
number_of_assistance_attribute.grid(row = 0, column = 3)
for i in number_of_nurse_on_assistance:
value = Label(right_frame, text = i, font = "consolas 13", bg = "#FFE2E2")
value.grid(row = sno_number_of_assistance, column = 3)
sno_number_of_assistance += 1
sno_specialisations = 1
specialisations_of_wards_attribute = Label(right_frame, text = "Specialistaion",
font = "evogria 17", width = 15, anchor = CENTER, bg = "#FFE2E2")
specialisations_of_wards_attribute.grid(row = 0, column = 4)
for i in specialisations_of_wards:
value = Label(right_frame, text = i, font = "consolas 13", wraplength = 297,
justify = CENTER, anchor = W, bg = "#FFE2E2")
value.grid(row = sno_specialisations, column = 4)
sno_specialisations += 1
def testing_window():
clean_top_frame()
home_submit()
global urine_test
global blood_test
global research
global central
global resized_images
top_frame = LabelFrame(root)
top_frame.grid(row = 0, column = 0, rowspan = 2, columnspan = 8)
top_frame.grid_propagate(0)
left_frame = LabelFrame(root, bg = "#FFE2E2")
left_frame.grid(row = 2, column = 0, padx = 4, pady = 4, columnspan = 2, ipady = 30)
# title
title = Label(top_frame, text = "Laboratories", font = "evogria 45",
bg = "#FFE2E2", width = 42, anchor = CENTER)
title.pack()
urine_test = Button(left_frame, text = "Urine Test Lab", font = "consolas 19 bold", width = 27,
padx = 10, pady = 4, borderwidth = 7, bg = "#FF847C",
anchor = CENTER, command = urine_test_window)
blood_test = Button(left_frame, text = "Blood Test Lab", font = "consolas 19 bold", width = 27,
padx = 10, pady = 4, borderwidth = 7, bg = "#FF847C",
anchor = CENTER, command = blood_test_window)
research = Button(left_frame, text = "Research Lab", font = "consolas 19 bold", width = 27,
padx = 10, pady = 4, borderwidth = 7, bg = "#FF847C",
anchor = CENTER, command = research_window)
central = Button(left_frame, text = "Central Lab", font = "consolas 19 bold", width = 27,
padx = 10, pady = 4, borderwidth = 7, bg = "#FF847C",
anchor = CENTER, command = central_window)
Home = Button(left_frame, text = "Home", font = "consolas 19 bold", width = 27, padx = 10,
pady = 4, borderwidth = 7, bg = "#FF847C", anchor = CENTER,
command = home_submit_services_offered)
urine_test.grid(row = 0, column = 0, columnspan = 3, pady = 30, padx = 20)
blood_test.grid(row = 1, column = 0, columnspan = 3, pady = 30, padx = 20)
research.grid(row = 2, column = 0, columnspan = 3, pady = 30, padx = 20)
central.grid(row = 3, column = 0, columnspan = 3, pady = 30, padx = 20)
Home.grid(row = 4, column = 0, columnspan = 3, pady = 31, padx = 20)
def urine_test_window():
global display_img
global status_bar
global num
global resized_images
clean_right_frame()
img1 = Image.open(r"Data\\Images\\Services\\urine_test_photo1.jpg")
img2 = Image.open(r"Data\\Images\\Services\\urine_test_photo2.jpg")
img3 = Image.open(r"Data\\Images\\Services\\urine_test_photo3.jpg")
img4 = Image.open(r"Data\\Images\\Services\\urine_test_photo2.png")
resized_img1 = img1.resize((865, 610), Image.ANTIALIAS)
resized_img2 = img2.resize((865, 610), Image.ANTIALIAS)
resized_img3 = img3.resize((865, 610), Image.ANTIALIAS)
resized_img4 = img4.resize((865, 610), Image.ANTIALIAS)
final_img1 = ImageTk.PhotoImage(resized_img1)
final_img2 = ImageTk.PhotoImage(resized_img2)
final_img3 = ImageTk.PhotoImage(resized_img3)
final_img4 = ImageTk.PhotoImage(resized_img4)
resized_images = [final_img1, final_img2, final_img3, final_img4]
display_img = Label(right_frame, image = final_img1)
display_img.grid(row = 0, column = 0, rowspan = 3, columnspan = 3)
status_bar = Label(right_frame, text = ("Image 1 of " + str(len(resized_images))), bd = 2,
relief = SUNKEN, anchor = E)
status_bar.grid(row = 5, column = 0, columnspan = 3, sticky = W + E)
num = 0
bkwd_button = Button(right_frame, text = "<<", width = 5,
borderwidth = 5, command = lambda: backward_button(num))
bkwd_button.grid(row = 4, column = 0)
exit_button = Button(right_frame, text = "Exit Program", width = 10, borderwidth = 5, command = home_submit)
exit_button.grid(row = 4, column = 1, pady = 10)
fwd_button = Button(right_frame, text = ">>", width = 5,
borderwidth = 5, command = lambda: forward_button(num))
fwd_button.grid(row = 4, column = 2)
def blood_test_window():
global display_img
global status_bar
global num
global resized_images
clean_right_frame()
img1 = Image.open(r"Data\\Images\\Services\\blood_test_photo1.jpg")
img2 = Image.open(r"Data\\Images\\Services\\blood_test_photo2.jpg")
img3 = Image.open(r"Data\\Images\\Services\\bloodtest_photo3.jpg")
img4 = Image.open(r"Data\\Images\\Services\\blood_test_photo4.jpg")
resized_img1 = img1.resize((865, 610), Image.ANTIALIAS)
resized_img2 = img2.resize((865, 610), Image.ANTIALIAS)
resized_img3 = img3.resize((865, 610), Image.ANTIALIAS)
resized_img4 = img4.resize((865, 610), Image.ANTIALIAS)
final_img1 = ImageTk.PhotoImage(resized_img1)
final_img2 = ImageTk.PhotoImage(resized_img2)
final_img3 = ImageTk.PhotoImage(resized_img3)
final_img4 = ImageTk.PhotoImage(resized_img4)
resized_images = [final_img1, final_img2, final_img3, final_img4]
display_img = Label(right_frame, image = final_img1)
display_img.grid(row = 0, column = 0, rowspan = 3, columnspan = 3)
status_bar = Label(right_frame, text = ("Image 1 of " + str(len(resized_images))), bd = 2, relief = SUNKEN,