-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhospital management system.c
2939 lines (2671 loc) · 81.6 KB
/
hospital management system.c
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
/*
Name: Hospital Management system
Author: Tejas A. Sheth
Version: 3.6 //(major change . minor edit )
Description:
create a new patients file, manage his/her appointment, keep a note of all specialists,
tests provided by the hospital, final bill incured by a patient.
v1.0 = refer hospital_demo1.c => created an admin,staff function and tried to get a log in id for both
v1.1 = created log in id for admin(static) and added fucntions like add_staff,delete_staff,etc
v1.2 = created the staff function which asked the staff to input any patients details and financial condition and medical background
v2.0 = revamped the whole code to make a different approach, the one that is followed here.
v2.1 = added ambulance services function
v2.2 = added insurance function
v2.3 = added specialist charges and consultation charges
v2.4 = added a report function to generate an overview of the patients activity
v2.5 = added random function and files to the code, to generate an unique code each time executed
v2.6 = added code to read data from the file using id
v2.7 = minor adjustments, font size, indentation in O/P,etc
v2.8 = added pending medical background function, still unfunctional...oopss!!!!
v2.9 = added more specialists to the list and increased consulting charges
v3.0 = a major change: linked the bank to the code, so we can even execute amount deduction from bank while paying the hospital charges
v3.1 = the data automatically gets stored in a .txt file, and the final report is stored in a .pdf form
v3.2 = displayed the account status(like Y/N), then account number (like 7** )
V3.3 = added contact us footer on each page
v3.4 = added time and date, updated the test list in such a way that it is more user-friendly now(no need to select any test no, automatically picks em up and displays the sum of all the tests).
v3.5 = added medical store facility, updated price for medicines.
v3.6 = added Blood Group
*/
// most imp part is done
// DONE === adding a file to the code to store a patients data safely and accessing it whenever called upon.
// DONE === ### find how to extract line by line the contents of the file ###
// DONE === calculating final_bill with an 5% gst, displaying (patients personal details + medical background questionairre + government aid(y/n) + specialist visited + tests taken + FINAL BILL)
// DONE === can also add specialist charges seperately. !!
// DONE === calculating the final report is a challenge...!!!
// DONE === insurance aahe ki nahi just...
// DONE === ambulance used or not...
// DONE === a code to print date and time automatically in the report and bill.
// NOT NEEDED // link another code(.c file) which would generate the customer bill
// DONE === link the bank to this code for better transactions
// NOT NEEDED // before that, update the bank.c to alow user-2-user transactions
// DONE === need to find a way to just extract a single line from a file using a code and modify the value for bank_transaction
// DONE ===generate a file with account_no as file_name, store basic amount in it and deduct at the end.
// ON IT === CANTEEEN, medical store for visitors
/*
system("pause");
system("cls");
*/
//global variables
/*
float sub_total=0, cnslt_chrg=0, amb_chrg=0, total, grand_total;
char moretests;
char id[7];
char buffer[1000];
int test;
char name[1000], locality[1000], city[1000], state[1000], mno[1000], tele[1000], age[100];
char conf_sub_total[1000], conf_cnslt_chrg[1000], conf_total[1000], conf_grand_total[1000];
int num;
*/
// Actual Code Starts Right Here...
#include<stdio.h>
#include<string.h>
#include<stdlib.h> //general purpose standard library, includes functions->memory allocation, process control, conversions
#include<math.h>
#include<time.h>
//#include<windows.h>
//#include <stdbool.h>
char ext_txt[10]=".txt";
char ext_pdf[10]=".pdf";
//delay loop
int iteration, temp_var, delay_dur;
//variables used for storing input and initialization
//int lower=1,upper=300000,count=1;
char id[10];
int num;
int num1;
char name[1000], address[1000], mno[1000], tele[1000], age[100], gender[10], bg[10];
char pat_id[100]; //unused
char bankacc, new_bankacc, more, b_acc[10];;
int check;
char a[10], b[10], c[10], d[10], e[10], f[10], g[10], h[10], i[10], j[10];
char buffer[1000];
int loop;
//bank
float principalamount=0.00, depositamount, bill_amount, min_amt=1000.00;
char updated_pamt[100], amt_bank[100];
char accno[10];
//medical store
int med_no=1;
int medicine;
char moremeds, shop, store[10];
//variables used for charges incured in hospital
float amb_chrg=0.00;
float cnslt_chrg=0.00;
float sub_total=0.00;
float med_total=0.00;
float test_total=0.00;
float total;
float conc_total;
float grand_total;
char conf_amb_chrg[1000];
char conf_sub_total[1000];
char conf_cnslt_chrg[1000];
char conf_med_total[1000];
char conf_test_total[1000];
char conf_total[1000];
char conf_conc_total[1000];
char conf_grand_total[1000];
//used for loop iterations,
char amb;
int amb_typ;
int fc;
char insur;
int h_insur;
int sp;
char loadmore;
int test;
char moretests;
//function declarations - hospital
void hospital_mngmt(); //
void intro(); //introduction of the hospital
void header(); //header of the hospital
void dspy_headerhosp(); //display in file
void flow(); //dictates the flow of the whole program in all
void p_new(); //new patient function
void pers_det(); //personal details of patient function
void dspy_persdet(); //DONE
void amb_srvs(); //ambulance services
void pat_medbg(); //patient medical background questionaire function
void dspy_pat_medbg(); //DONE
void pat_fc(); //patient financial condition and corresponding government aids available function
void specialist(); //specialists available in the hospital list function
void dspy_splst(); //UN-USED
void test_det(); //tests needed to perform and their prices function
void dspy_testdet(); //UN-USED
void bill(); //final bill generation function
void dspy_bill(); //UN-USED
void report(); //display per_det,pat_medbg,specialist,test_det,bill function
void random_hospid(); //function for genrating an id( random ) for user-identification in hospital
void contactus(); //contact details
//function declaration - medical store
void header_medicalstore(); //
void medical_store(); //
void med_opthalmologist(); //
void med_nephrologist(); //
void med_neurologist(); //
void med_genphysician(); //
void med_pediatrician(); //
void med_accupunctarist(); //
void med_entspecs(); //
void med_oncologist(); //
void med_gastoenterologist(); //
void med_endocrinologist(); //
void med_dermatologist(); //
void med_gensurgeon(); //
void med_naturopathist(); //
void med_psychiatrist(); //
void med_cardiologist(); //
//function declaration - bank
void bank_mngmt(); //
void dspy_bank(); //
void random_bank_acc(); //function for genrating an id( random ) for user-identification for bank
void intro_bank(); //introduction of the bank
void header_bank(); //header of the bank
void new_acc(); //opening a new bank account
void bank(); //carrying out bank processes, like account balance, deposit, withdraw, transfer
void deposit(); //deposit money
void protect(); //protect the user/patient from mis-use of his bank account no., * marks account number values...(5**)
void pay_bill(); //pay bill from bank, deducting from the bank as well
void dspy_time(); //unused
FILE *pat_data; //patients details file (as .txt)
FILE *pat_d; //as .pdf
//not working currently
FILE *acc_no; //bank account and bank balance maintaining file
void fordelay(delay_dur)
{
for(iteration = 0;iteration < delay_dur;iteration++)
{
temp_var = iteration;
}
}
void random_hospid(int lower, int upper, int count)
{
num = (rand()%(upper-lower+1))+lower;
printf("\tYour Unique-ID is: %d \n",num);
}
void random_bank_acc(int lower, int upper, int count)
{
num1 = (rand()%(upper-lower+1))+lower;
printf("\tYour Bank-AC No. is: %d \n",num1);
}
void contactus()
{
printf("\tREACH US:-\n");
printf("\tDIAL: 1010 0101\n");
printf("\tEMAIL: a3hosp@hosp.com\n");
printf("\tFOR ANY HELP.\n");
printf("\t\t -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- \n");
}
/*
void dspy_time()
{
time_t now;
time(&now);
printf("\t\t\t\t\t%s", ctime(&now));
}
*/
void header()
{
printf("\n\n\t\t\t\t***WELCOME TO A3 HOSPITAL***\n");
printf("\t\t\t\t\t\tPATIENT FIRST.\n");
printf("\t\t\t\t\t\tAssuring.Advanced.Accessible.\n\n");
}
void dspy_headerhosp()
{
fprintf(pat_data,"\n\n\t\t\t\t***WELCOME TO A3 HOSPITAL***\n");
fprintf(pat_data,"\t\t\t\t\t\tPATIENT FIRST.\n");
fprintf(pat_data,"\t\t\t\t\t\tAssuring.Advanced.Accessible.\n\n");
}
void header_bank()
{
printf("\n\n\t\t\t\t***WELCOME TO INDIA BANK***\n");
printf("\t\t\t\t\t\tDesi.CashFree.Safe.\n\n");
// fprintf(acc_no,"\n\n\t\t\t\t***WELCOME TO INDIA BANK***\n");
// fprintf(acc_no,"\t\t\t\t\t\tDesi.CashFree.Safe.\n\n");
}
void header_medicalstore()
{
printf("\n\n\t\t\t\t***WELCOME TO INDIANA MEDICALS***\n");
printf("\t\t\t\t\t\t24*7.Hassle-Free.Authentic.\n\n");
}
void intro()
{
header();
printf("\t\tThe quality of care provided at A3 Hospital is tantamount to any other top-ranking hospitals in the world.\n");
printf("\t\t\tWe are equipped with the finest cardiac, cancer and paediatric care,\n");
printf("\t\t\tas well as liver and kidney transplantation facility.\n");
printf("\t\tWe are the regions first institution with an NABH accreditation by the Quality Council of India.\n\n");
}
void intro_bank()
{
header_bank();
printf("\t\t\tThe AIM is to provide World-Class Facilities in Minimum Efforts.\n");
printf("\t\t\t\tQUALITY,QUICK TRANSFERS and WITHDRAWAL & DEPOSIT.\n");
printf("\t\t\t\t24*7 ATM Service around the Country.\n\n");
}
void hospital_mngmt()
{
for(loop=1;loop<=10;loop++)
{
fordelay(100000000);
printf("\n");
}
intro();
printf("\n\t");
system("pause");
system("cls");
header();
int lower=10001,upper=99999,count=1;
tryagain:
srand(time(0));
random_hospid(lower,upper,count);
printf("\tRe-Enter your Unique-ID: ");
gets(id);
pat_data=fopen(strcat(id,ext_txt),"a");
// pat_data=fopen(id,"a");
if(pat_data!=NULL)
{
printf("\tFILE CREATED \n\n\tOPENING");
for(loop=0;loop<=6;loop++)
{
fordelay(100000000);
printf(". ");
}
printf("\n\t");
system("pause");
system("cls");
flow();
fclose(pat_data);
}
else
{
printf("\tFILE NOT FOUND...! \n\n");
printf("\tLOADING");
for(loop=0;loop<=6;loop++)
{
fordelay(100000000);
printf(". ");
}
printf("\n\t");
system("pause");
system("cls");
header();
goto tryagain;
}
printf("\tLOADING");
for(loop=0;loop<=6;loop++)
{
fordelay(100000000);
printf(". ");
}
printf("\n\t");
system("pause");
system("cls");
//read file begins
report();
}
void bank_mngmt()
{
intro_bank();
int lower=100,upper=999,count=1;
tryagain:
srand(time(0));
random_bank_acc(lower,upper,count);
printf("\tRe-Enter ");
gets(accno);
printf("your Bank-AC No.: ");
gets(accno);
acc_no=fopen(strcat(accno,ext_txt),"a");
if(acc_no!=NULL)
{
printf("\tFILE CREATED \n\n\tOPENING");
for(loop=0;loop<=6;loop++)
{
fordelay(100000000);
printf(". ");
}
printf("\n\t");
system("pause");
system("cls");
new_acc();
// go to bank page and for manipulate...
fclose(acc_no);
}
else
{
printf("\tFILE NOT FOUND...! \n\n");
printf("\tLOADING");
for(loop=0;loop<=6;loop++)
{
fordelay(100000000);
printf(". ");
}
printf("\n");
// printf("\t");
// system("pause");
// system("cls");
goto tryagain;
}
printf("\tLOADING");
for(loop=0;loop<=6;loop++)
{
fordelay(100000000);
printf(". ");
}
printf("\n\n");
// system("pause");
// system("cls");
// read file begins
// report();
}
void new_acc()
{
header_bank();
printf("\n\n\t\tWELCOME USER # %d .\n",num1);
printf("\tNew Bank Account\n\n");
printf("\t\tPrincipal Amount = %.2f \n\n",principalamount);
minimum:
printf("\t\tYou need to have a minimum of Rs.1000 for your account to be active. \n\n");
printf("\t\t\t NOTE: Principal Amount should be- \n");
printf("\t\t\t 1. Greater than or Equal to Rs.1000. \n");
printf("\t\t\t 2. Multiple of Rs.1000. \n\n");
printf("\tEnter the Amount you wish to Deposit in your Bank Account : ");
scanf("%f",&principalamount);
printf("\n");
if(principalamount < 1000 || (int)principalamount % 1000 != 0)
{
goto minimum;
}
else
{
printf("\tConfirm ");
gets(amt_bank);
printf("your Deposit Amount : ");
gets(amt_bank);
printf("\n");
fputs(amt_bank,acc_no);
}
}
void flow()
{
p_new();
// printf("\t\t\t-X--X--X--X--X--X- \n\n");
specialist();
// printf("\t\t\t-X--X--X--X--X--X- \n\n");
test_det();
// printf("\t\t\t-X--X--X--X--X--X- \n\n");
medical_store();
// printf("\t\t\t-X--X--X--X--X--X- \n\n");
bill();
// printf("\t\t\t-X--X--X--X--X--X- \n\n");
pay_bill();
// printf("\t\t\t-X--X--X--X--X--X- \n\n");
}
void p_new()
{
header();
printf("\n\t\t\tEnter the Patient's Personal Details: \n\n");
pers_det();
header();
printf("\n\t\t\tEnter the Patient's Medical History: \n\n");
pat_medbg();
header();
printf("\n\t\t\tDescribe the Patient's Financial Condition: \n\n");
pat_fc();
}
void pers_det()
{
// printf("\tEnter PATIENT ID: \t");
// scanf("%s",&name);
// gets(pat_id);
printf("\tEnter Full Name: \t");
// scanf("%s",&name);
gets(name);
printf("\tEnter Age(in years): \t");
// scanf("%d",&age);
gets(age);
printf("\tEnter Blood Group: \t");
// scanf("%s",&bg);
gets(bg);
printf("\tEnter Residential Address: \t");
gets(address);
printf("\tEnter Contact Information :- \n");
printf("\t\tMobile Number (Mandatory): \t");
// scanf("%s",&mno);
gets(mno);
printf("\t\tEnter Landline / Emergency Contact Number (Optional, enter '/' if N.A.): \t");
// scanf("%s",&tele);
gets(tele);
printf("\n");
printf("\tEnter Gender (M - Male / F- Female): \t");
// scanf("%s",&tele);
gets(gender);
printf("\n\t");
system("pause");
system("cls");
bank();
//data stored successfully..
dspy_persdet();
dspy_bank();
amb_srvs();
}
void bank()
{
header_bank();
bank_check:
printf("\n\tDo you have an Existing Bank Account? (Y/N): ");
// gets(bankacc);
scanf("%s",&bankacc);
// printf("\n");
printf("\t\t");
gets(b_acc);
printf("CONFIRM YOUR ANSWER? (Y/N): ");
gets(b_acc);
printf("\n");
if(bankacc=='Y' || bankacc=='y')
{
check:
printf("\tEnter your Bank-AC No.: ");
gets(accno);
// acc_no=fopen(strcat(accno,ext_txt),"a");
acc_no=fopen(accno,"a");
printf("\n");
do
{
printf("\tWhat do you want to do: \n");
printf("\t01. Check Account Balance.\n");
printf("\t02. Deposit Amount.\n");
printf("\t03. Exit from Bank Portal.\n");
check1:
printf("\tEnter your Option: ");
scanf("%d",&check);
printf("\n\n");
switch(check)
{
case 1:
// acc_no=fopen(strcat(accno,ext_txt),"r");
//just open the file and print account balance
acc_no=fopen(accno,"r");
if(acc_no!=NULL)
{
printf("\tTotal Amount in your Account = ");
while(fgets(buffer,100,acc_no)!=NULL)
{
printf("%s",buffer);
}
}
else
{
printf("\tFILE NOT FOUND...!\n");
}
printf("\n\n");
fclose(acc_no);
break;
case 2:
// acc_no=fopen(strcat(accno,ext_txt),"r");
acc_no=fopen(accno,"r");
//ask user to input the amount to be deposited and show updated amount
printf("\tTotal Amount in your Account = ");
if(acc_no!=NULL)
{
while(fgets(buffer,100,acc_no)!=NULL)
{
printf("%s",buffer);
}
}
else
{
printf("\tFILE NOT FOUND...!\n");
}
printf("\n\n");
// fclose(acc_no);
// acc_no=fopen(strcat(accno,ext_txt),"w");
acc_no=fopen(accno,"w");
printf("\tRe-Enter Total Amount in your Account: ");
scanf("%f",&principalamount);
printf("\n");
deposit();
// printf("\t\t\t NOTE: Deposit Amount should be- \n");
// printf("\t\t\t 01. Greater than or Equal to Rs.1000. \n");
// printf("\t\t\t 02. Multiple of Rs.1000. \n\n");
// reenter:
// printf("\tEnter the Amount to be Deposited: ");
// scanf("%f",&depositamount);
// printf("\n");
// if(depositamount < 1000 || (int)depositamount % 1000 != 0)
// {
// goto reenter;
// }
// else
// {
// principalamount = principalamount + depositamount;
//
// printf("\tUpdated Amount in your Account = %.2f \n",principalamount);
//
// printf("\tRe-Enter ");
// gets(updated_pamt);
// printf("Updated Amount = ");
// gets(updated_pamt);
// printf("\n");
// fputs(updated_pamt,acc_no);
//
///* printf("Updated Amount = ");
// while(fgets(buffer,100,acc_no)!=NULL)
// {
// printf("%s",buffer);
// }
//*/
// fclose(acc_no);
// }
break;
case 3:
goto exit;
break;
default:
printf("\t\tWRONG INPUT...! \n\n");
goto check1;
}
printf("\tWish to Check/Deposit again(Y/N): ");
scanf("%s",&more);
printf("\n");
}while(more=='Y' || more=='y');
}
else if(bankacc=='N' || bankacc=='n')
{
new_bacc:
printf("\tDo you wish to Open a \'NEW\' Bank Account (Y/N): \t");
// gets(new_bankacc);
scanf("%s",&new_bankacc);
printf("\n");
if(new_bankacc=='Y' || new_bankacc=='y')
{
printf("\tThat\'s Great..\n\tHold on till we transfer you to the Bank.\n\n");
}
else if(new_bankacc=='N' || new_bankacc=='n')
{
printf("\tThis Hospital is going Cash-Less...\n");
printf("\tWhy don\'t you??\n");
printf("\tTHINK WISE: Open a Bank Account & Go Digital..!\n\n");
}
else
{
printf("\t\tWRONG INPUT...! \n\n");
goto new_bacc;
}
printf("\tTAKING YOU TO THE BANK ");
for(loop=0;loop<=6;loop++)
{
fordelay(100000000);
printf(". ");
}
printf("\n\t");
system("pause");
system("cls");
bank_mngmt(); //create a file fucntion? account new
goto check;
// bank function to create a new acc./
}
else
{
printf("\t\tWRONG INPUT...! \n\n");
goto bank_check;
}
exit:
printf("\tLOADING");
for(loop=0;loop<=6;loop++)
{
fordelay(100000000);
printf(". ");
}
printf("\n\t");
system("pause");
system("cls");
}
void deposit()
{
printf("\t\t\t NOTE: Deposit Amount should be- \n");
printf("\t\t\t 01. Greater than or Equal to Rs.%.2f . \n",min_amt);
printf("\t\t\t 02. Multiple of Rs.1000 . \n\n");
reenter:
printf("\tEnter the Amount to be Deposited: ");
scanf("%f",&depositamount);
printf("\n");
if(depositamount < min_amt || (int)depositamount % 1000 != 0)
{
printf("\t\tWRONG INPUT...!\n\n");
goto reenter;
}
else
{
principalamount = principalamount + depositamount;
printf("\tUpdated Amount in your Account = %.2f \n",principalamount);
printf("\tRe-Enter ");
gets(updated_pamt);
printf("Updated Amount = ");
gets(updated_pamt);
printf("\n");
fputs(updated_pamt,acc_no);
/* printf("Updated Amount = ");
while(fgets(buffer,100,acc_no)!=NULL)
{
printf("%s",buffer);
}
*/
// fclose(acc_no);
}
}
void dspy_persdet()
{
// dspy_headerhosp();
// dspy_time();
time_t now;
time(&now);
fprintf(pat_data,"\tREGISTRATION COMMENCED @ %s ",ctime(&now));
fprintf(pat_data,"\n\t\t PATIENT\'s FILE-NAME: ");
fputs(id,pat_data);
// fprintf(num,pat_data);
// fprintf(pat_id,pat_data);
fprintf(pat_data, "\n\n");
fprintf(pat_data,"\t\t\t A) PERSONAL DETAILS ===>");
fprintf(pat_data, "\n\n");
// fprintf(pat_data, "\n");
fprintf(pat_data,"tFull Name: ");
fputs(name,pat_data);
fprintf(pat_data, "\n");
fprintf(pat_data,"\tAge: ");
fputs(age,pat_data);
fprintf(pat_data, "\n");
fprintf(pat_data,"\tBlood Group: ");
fputs(bg,pat_data);
fprintf(pat_data, "\n");
fprintf(pat_data,"\tAddress: ");
fputs(address,pat_data);
fprintf(pat_data, "\n");
fprintf(pat_data,"\tMobile Number: ");
fputs(mno,pat_data);
fprintf(pat_data, "\n");
fprintf(pat_data,"\tTelephone Number: ");
fputs(tele,pat_data);
fprintf(pat_data, "\n");
fprintf(pat_data,"\tGender: ");
fputs(gender,pat_data);
fprintf(pat_data, "\n\n");
}
void dspy_bank()
{
// diplay bank status, amount deposited
fprintf(pat_data,"\t\t\t B) BANK DETAILS ===>");
fprintf(pat_data, "\n\n");
fprintf(pat_data,"\tBank Account (Y/N): ");
fputs(b_acc,pat_data);
fprintf(pat_data, "\n");
if(bankacc=='Y' || bankacc=='y')
{
fprintf(pat_data,"\n");
protect();
}
else if(bankacc=='N' || bankacc=='n')
{
fprintf(pat_data,"\n\tCreated a New Bank Account:- \n");
protect();
}
else
{
fprintf(pat_data,"\tWRONG INPUT...!\n\n");
}
fprintf(pat_data, "\n");
// fprintf(pat_data, "\n");
}
void protect()
{
if(num1 / 100 == 1)
{
fprintf(pat_data,"\tBank Account No: 1**.\n");
}
else if(num1 / 100 == 2)
{
fprintf(pat_data,"\tBank Account No: 2**.\n");
}
else if(num1 / 100 == 3)
{
fprintf(pat_data,"\tBank Account No: 3**.\n");
}
else if(num1 / 100 == 4)
{
fprintf(pat_data,"\tBank Account No: 4**.\n");
}
else if(num1 / 100 == 5)
{
fprintf(pat_data,"\tBank Account No: 5**.\n");
}
else if(num1 / 100 == 6)
{
fprintf(pat_data,"\tBank Account No: 6**.\n");
}
else if(num1 / 100 == 7)
{
fprintf(pat_data,"\tBank Account No: 7**.\n");
}
else if(num1 / 100 == 8)
{
fprintf(pat_data,"\tBank Account No: 8**.\n");
}
else if(num1 / 100 == 9)
{
fprintf(pat_data,"\tBank Account No: 9**.\n");
}
}
void amb_srvs()
{
header();
fprintf(pat_data,"\t\t\t C) AMBULANCE SERVICE ===>");
fprintf(pat_data, "\n\n");
printf("\tIs the Patient brought to the Hospital in an Ambulance? (Y/N): ");
// scanf("%c",&amb);
scanf("%s",&amb);
printf("\n");
if(amb=='y' || amb=='Y')
{
ambulance:
printf("\tWhich type of Ambulance was used? \n");
printf("\t00. No Ambulance. \n");
printf("\t01. Basic type of Ambulance. \n");
printf("\t02. Mobile Intensive Care Unit Ambulance. \n");
// printf("\t03. Motorcycle Ambulance. \n");
printf("\t03. Small vehicle for Minor road Ambulance. \n");
printf("\tEnter your Option:- ");
scanf("%d",&amb_typ);
printf("\n");
switch(amb_typ)
{
case 0:
printf("\tAmbulance Type: N.A. \n");
fprintf(pat_data,"\tAmbulance Type: N.A.");
fprintf(pat_data, "\n\n");
printf("\n");
break;
case 1:
printf("\tAmbulance Type: Basic. \n");
printf("\tAmbulance Charge = Rs. 1500\n");
fprintf(pat_data,"\tAmbulance Type: Basic.");
fprintf(pat_data, "\n\n");
amb_chrg=amb_chrg+1500;
printf("\n");
break;
case 2:
printf("\tAmbulance Type: Mobile Intensive Care Unit. \n");
printf("\tAmbulance Charge = Rs. 3000\n");
fprintf(pat_data,"\tAmbulance Type: Mobile Intensive Care Unit.");
fprintf(pat_data, "\n\n");
amb_chrg=amb_chrg+3000;
printf("\n");
break;
/* case 3:
printf("\tAmbulance Type: Motorcycle. \n");
printf("\tAmbulance Charge = Rs. 2750\n");
fprintf(pat_data,"\tAmbulance Type: Motorcycle.");
fprintf(pat_data, "\n\n");
amb_chrg=amb_chrg+2750;
printf("\n");
break;
*/ case 3:
printf("\tAmbulance Type: Small vehicle for Minor Road. \n");
printf("\tAmbulance Charge = Rs. 4000\n");
fprintf(pat_data,"\tAmbulance Type: Small vehicle for Minor Road.");
fprintf(pat_data, "\n\n");
amb_chrg=amb_chrg+4000;
printf("\n");
break;
default:
printf("\t\tWRONG INPUT...! \n\n");
goto ambulance;
}
}
else
{
printf("\tAmbulance Service Availed: NO. \n");
fprintf(pat_data,"\tAmbulance Type: N.A.");
fprintf(pat_data, "\n\n");
}
printf("\tAMBULANCE-CHARGE = %.2f \n",amb_chrg);
printf("\tConfirm ");
gets(conf_amb_chrg); //not printing, if written directly.
printf("AMBULANCE-CHARGE = ");
gets(conf_amb_chrg);
fprintf(pat_data,"\tAMBULANCE-CHARGE = Rs. ");
fputs(conf_amb_chrg,pat_data);
fprintf(pat_data, "\n\n");
printf("\n\n");
printf("\tUPDATING");
for(loop=0;loop<=6;loop++)
{
fordelay(100000000);
printf(". ");
}
printf("\n\t");
system("pause");
system("cls");
}
void pat_medbg()
{
printf("\tAnswer the Following Questions to the most of your Knowledge. \n");
printf("\t01. Has you doctor ever said your blood pressure was too high or too low?(Y/N): ");
// scanf("%s",&a);
gets(a);
printf("\n");
printf("\t02. Do you have any known cardiovascular problems (abnormal ECG, previous heart attack, etc)?(Y/N): ");
// scanf("%s",&b);
gets(b);
printf("\n");
printf("\t03. Has your doctor ever told you that your cholesterol was too high?(Y/N): ");
// scanf("%s",&c);
gets(c);
printf("\n");
printf("\t04. Have you (or a family member) ever been told that you have diabetes?(Y/N): ");
// scanf("%s",&d);
gets(d);
printf("\n");
printf("\t05. Do you have any injuries or orthopedic problems (back, knees, etc)?(Y/N): ");
// scanf("%s",&e);
gets(e);
printf("\n");
printf("\t06. Do you have stisff or swollen joints?(Y/N): ");
// scanf("%s",&f);
gets(f);
printf("\n");
printf("\t07. Do you have tension or soreness in any area?(Y/N): ");
// scanf("%s",&g);
gets(g);
printf("\n");
printf("\t08. Are you taking any prescribed medications or dietary supplementation?(Y/N): ");
// scanf("%s",&h);
gets(h);
printf("\n");
printf("\t09. Do you ever have problems sleeping?(Y/N): ");
// scanf("%s",&i);
gets(i);