-
Notifications
You must be signed in to change notification settings - Fork 1
/
patient.cpp
70 lines (60 loc) · 1.39 KB
/
patient.cpp
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
#include <bits/stdc++.h>
#include "receptionist.cpp"
void error(int num){
num++;
cout<<endl<<"Invalid Input"<<endl;
}
void readRecords(int num){
ifstream fin;
patient* prr=new patient();
fin.open("admin/records/records.txt");
while(fin.read(reinterpret_cast<char*>(prr), sizeof(patient))){
if(prr->LDAP==num)
break;
}
fin.close();
cout<<"Last Remarks: "<<prr->dRemarks<<endl;
cout<<"Full Records: "<<prr->record<<endl;
return;
}
int chooseDoctor(){
doctor d;
ifstream fin;
fin.open("admin/records/doctors.txt");
for (int i = 0; i < 10; ++i){
fin.read(reinterpret_cast<char*>(&d), sizeof(doctor));
if(d.available){
cout<<d.name<<" "<<d.LDAP<<" "<<d.speciality<<" "<<endl;
}
}
}
void takeAppointment(int num){
cout<<endl<<"Doctors Available"<<endl;
chooseDoctor();
int ind;
cout<<endl;
cout<<"Enter Id to choose doctor"<<endl;
cin>>ind;
receptionist r;
r.addToQueue(num,ind);
return;
}
void patientInit(int num,patient* p){
p->LDAP=num;
while(true){
char x;
cout<<"Press 1 to Take appointment"<<endl;
cout<<"Press 2 for online discussion"<<endl;
cout<<"Press 3 to View Medical Report"<<endl;
cout<<"Press 4 to logout"<<endl;
cin>>x;
int cmd=x-'0';
switch(cmd){
case 1:{takeAppointment(num);break;}
case 2:{p->onlineDiscussion(num);break;}
case 3:{readRecords(num);break;}
case 4:{cout<<"Logged Out"<<endl;return;}
default: cout<<"Invalid Value"<<endl;
}
}
}