-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCa3HEALTH.java
264 lines (233 loc) · 8.62 KB
/
Ca3HEALTH.java
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
import java.time.LocalDate;
import java.util.Scanner;
enum docter
{
a("Dr. Ashok Seth",2500,"Immunologists"),
b("Dr. Naresh Trehan",3000,"Anesthesiolog"),
c("Dr. Suresh H. Advani",5000,"Cardiologists"),
d("Dr. Sandeep Vaishya",6520,"Dermatologist"),
e("Dr. A.B. Govindaraj",7000,"Neurologist s");
private final String name;
private final int fee;
private final String spc;
docter(String nm, int fe, String sp)
{
this.name=nm;
this.fee=fe;
this.spc=sp;
}
public String getName() {
return name;
}
public int getFee() {
return fee;
}
public String getSpc() {
return spc;
}
}
public class Ca3HEALTH
{
static LocalDate ldt=LocalDate.now();
static String t_date=ldt.getDayOfMonth()+"-"+ldt.getMonth()+"-"+ldt.getYear()+" ("+ldt.getDayOfWeek()+")";
static Scanner inp=new Scanner(System.in);
static Ca3HEALTH [] patientArr=new Ca3HEALTH[100];
String patientName;
String docName;
static int pId=0;
int curPID;
public String getPatdate() {
return patdate;
}
public void setPatdate(String patdate) {
this.patdate = patdate;
}
int consFee;
String patdate;
String spclz;
int patAge;
Ca3HEALTH()
{
pId++;
}
public void setPatientName(String patientName) {
this.patientName = patientName;
}
public int getCurPID() {
return curPID;
}
public String getPatientName() {
return patientName;
}
public int getConsFee() {
return consFee;
}
public String getSpclz() {
return spclz;
}
public int getPatAge() {
return patAge;
}
public void setDocName(String docName) {
this.docName = docName;
}
public void setConsFee(int consFee) {
this.consFee = consFee;
}
public void setSpclz(String spclz) {
this.spclz = spclz;
}
public void setCurPID(int curPID) {
this.curPID = curPID;
}
public void setPatAge(int patAge) {
this.patAge = patAge;
}
public String getDocName() {
return docName;
}
public void appointment()
{ System.out.println();
System.out.println(" :::::APPOINTMENT SLIP::::::");
System.out.println("| Patient ID:"+ curPID);
System.out.println("| Date:"+ patdate);
System.out.println("| Name:"+patientName);
System.out.println("| Age:"+patAge);
System.out.println("| Docter:"+docName+", "+spclz);
System.out.println("| Consultation Fee: "+consFee);
}
public static void main(String ...ff)
{
boolean run=true;
int choice;
while (run)
{ System.out.println();
System.out.println(" ::::HEALTH CARE APPLICATION::::");
System.out.println("01: New Patient");
System.out.println("02: Patient Details");
System.out.println("03: Available Docters");
System.out.println("04: See patients");
System.out.println("05: Exit");
System.out.println("Enter Operation!");
choice=inp.nextInt();
switch (choice)
{
case 1:
{
Ca3HEALTH p1=new Ca3HEALTH();
System.out.println("---New Patient Entry---run:"+pId);
System.out.println("Enter patient NAME: ");
p1.setPatientName(inp.next());
System.out.println("Age: ");
p1.setPatAge(inp.nextInt());
System.out.println("Select from Available Docters:");
System.out.println(" CONS. FEE SPECIALIZATION NAME");
System.out.println("------------------------------------------------------");
for(docter d:docter.values())
System.out.println((d.ordinal()+1)+" : "+d.getFee()+" "+d.getSpc()+" "+d.getName());
System.out.println("Select docter by id:");
int dChoice=inp.nextInt();
switch (dChoice)
{
case 1:
{
docter d1= docter.valueOf("a");
p1.setDocName(d1.getName());
p1.setConsFee(d1.getFee());
p1.setSpclz(d1.getSpc());
break;
}
case 2:
{
docter d1= docter.valueOf("b");
p1.setDocName(d1.getName());
p1.setConsFee(d1.getFee());
p1.setSpclz(d1.getSpc());
break;
}
case 3:
{
docter d1= docter.valueOf("c");
p1.setDocName(d1.getName());
p1.setConsFee(d1.getFee());
p1.setSpclz(d1.getSpc());
break;
}
case 4:
{
docter d1= docter.valueOf("d");
p1.setDocName(d1.getName());
p1.setConsFee(d1.getFee());
p1.setSpclz(d1.getSpc());
break;
}
case 5:
{
docter d1= docter.valueOf("e");
p1.setDocName(d1.getName());
p1.setConsFee(d1.getFee());
p1.setSpclz(d1.getSpc());
break;
}
}
System.out.println("Docter chosen: "+p1.getDocName());
p1.setPatdate(t_date);
p1.setCurPID(pId);
patientArr[pId]=p1;
//System.out.println("array ref: "+patientArr[pId]);
p1.appointment();
System.out.println("------------------------------------------------");
break;
}
case 2:
{
System.out.println(" ---Patient Details---");
System.out.println("Enter PATIENT ID: ");
int i=inp.nextInt();
Ca3HEALTH a=patientArr[i];
System.out.println(" Name: "+a.getPatientName());
System.out.println(" Age: "+a.getPatAge());
System.out.println(" Docter: "+a.getDocName());
System.out.println(" Consultation fee: "+a.getConsFee());
System.out.println(" Date: "+a.getPatdate());
System.out.println("--------------------------------------------");
break;
}
case 3:
{
System.out.println(" ---Available Docters---");
System.out.println(" CONS. FEE SPECIALIZATION NAME");
System.out.println("---------------------------------------------------");
for(docter d:docter.values())
System.out.println((d.ordinal()+1)+" : "+d.getFee()+" "+d.getSpc()+" "+d.getName());
System.out.println("---------------------------------------------------");
break;
}
case 4:
{
int i=1;
if(patientArr[i]==null)
System.out.print("NO PATIENT !");
else
{
System.out.println("All patients: ");
System.out.println(" Date Age Name");
for(i=1;i<=pId;i++)
{
Ca3HEALTH a=patientArr[i];
System.out.println(a.getPatdate()+" "+a.getPatAge()+" "+a.getPatientName());
}
System.out.println("---------------------------------------------------");
}
break;
}
case 5:
{
run=false;
System.out.println("Exiting...");
break;
}
}
}
}
}