-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
128 lines (114 loc) · 3.62 KB
/
main.js
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
//=== Hospital Management System ---/////
//--Arrow Function in EcmaScript --///
Patient_info =() =>{
/// Variable Initialization Using EcmaScript ---///
let PatientName = prompt('Enter Patient Name');
let Father_HusbandName = prompt('Enter Father or Husband Name');
let d = new Date();
let NIC_no =+prompt("Enter Your NIC");
let Patient_Ward = ['ICU','Emergency Ward','Accident Ward']
let Patient_Diseas =['Fever','Flu','High/low Bp','Headache']
let Doctors_fields=['Ahmed(Heart Specialist)','Salman (General)','Hasan(Surgen)','Huzaifa(skin Specialist)',
'Ahsan (General)','Haider (General)','Ali (Heart Specialist)','Abbas (Heart Specialist)']
let x = Math.floor((Math.random() * 10) + 1);
let payment = ['Cash','Cheque','Card']
let select_ward=+prompt("Press 1 for ICU | 2 for Emergency Ward | 3 for Accident Ward");
let select_disease=+prompt('Press 1 for Fever | 2 for (General) | 3 for High/Low Blood Pressure | 4 for headache');
let select_doc=+prompt('Press 1 for (Heart Specialist Doctor) | 2 for ( 2nd skin Specialist Doctor) | 3 for (skin Specialist Doctor) | 4 for (2nd General Doctor) | 5 for (2nd Heart Specialist Doctor) | 6 for (2nd surgen) | 7 for (3rd General Doctor) ');
let select_payment_method =+ prompt('Press 1 for Cash | 2 for Cheque | 3 for Cards (Debit,Credit)');
///-- Print The Results of Above Inputs ---////
console.log('Patient Name : '+PatientName);
console.log('Father OR Husband Name is: ' +Father_HusbandName);
console.log("Your Appointment Date and time" +d);
console.log('Your generated Code is '+x);
console.log('Your NIC is : ' +NIC_no);
//-- Using If-Else Condition for desire outcome --//
if(select_disease == 1){
console.log('You choose : '+Patient_Diseas[0]);
}
else if (select_disease == 2)
{
console.log('You choose : '+Patient_Diseas[1]);
}
else if (select_disease == 3)
{
console.log('You choose : '+Patient_Diseas[2]);
}
else if (select_disease == 4){
console.log('You choose : '+Patient_Diseas[3]);
}
else {
console.log ('Invalid Command Kindly press no between 1 to 4')
}
{
if (select_ward == 1)
{
console.log('Your Ward is :'+Patient_Ward[0]);
}
else if (select_ward == 2)
{
console.log('Your Ward is :'+Patient_Ward[1]);
}
else if(select_ward == 3)
{
console.log('Your Ward is :'+Patient_Ward[2]);
}
else{
console.log('Invalid Command Kindly press no between 1 to 3');
}
}
{
if (select_doc == 1)
{
console.log('Your Doctor is : '+ Doctors_fields[0]);
}
else if (select_doc == 2)
{
console.log('Your Doctor is : '+ Doctors_fields[1]);
}
else if (select_doc == 3)
{
console.log('Your Doctor is : '+ Doctors_fields[2]);
}
else if (select_doc == 4)
{
console.log('Your Doctor is : '+ Doctors_fields[3]);
}
else if (select_doc == 5)
{
console.log('Your Doctor is : '+ Doctors_fields[4]);
}
else if (select_doc == 6)
{
console.log('Your Doctor is : '+ Doctors_fields[5]);
}
else if (select_doc == 7)
{
console.log('Your Doctor is : '+ Doctors_fields[6]);
}
else if (select_doc == 8)
{
console.log('Your Doctor is : '+ Doctors_fields[7]);
}
else{
console.log('Invalid Command Kindly press no between 1 to 8');
}
}
if (select_payment_method == 1)
{
console.log("You Select"+payment[0]);
}
else if (select_payment_method == 2)
{
console.log("You Select"+payment[1]);
}
else if (select_payment_method == 3)
{
console.log("You Select"+payment[2]);
}
else {
console.log('Invalid Command Kindly press no between 1 to 3');
}
}
// Calling Function///
Patient_info()