-
Notifications
You must be signed in to change notification settings - Fork 1
/
receptionist.cpp
135 lines (123 loc) · 2.98 KB
/
receptionist.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
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
#include <bits/stdc++.h>
#include "doctor.cpp"
//using namespace std;
void initial_diagnosis(int ldapID){
float temp;
float weight;
char remarks[20];
char remrk[20];
cout<<"Enter the body tempearture in Fahrenheit : ";
cin>>temp;
cout<<"\nEnter the weight in kgs : ";
cin>>weight;
cout<<"\nEnter the remarks if any : ";
char x;
scanf("%c",&x);
fgets (remarks, 25, stdin);
patient p;
ofstream fout;
fout.open("admin/records/tempFiles/tempRecords.txt");
ifstream fin;
fin.open("admin/records/records.txt");
while(fin.read(reinterpret_cast<char*>(&p), sizeof(patient))){
if(p.LDAP==ldapID){
p.temp=temp;
p.weight=weight;
strcpy(p.rRemarks,remarks);
}
fout.write(reinterpret_cast<char*>(&p), sizeof(patient));
}
fin.close();fout.close();
fin.open("admin/records/tempFiles/tempRecords.txt");
fout.open("admin/records/records.txt");
while(fin.read(reinterpret_cast<char*>(&p), sizeof(patient)))
fout.write(reinterpret_cast<char*>(&p), sizeof(patient));
fin.close();fout.close();
}
class receptionist
{
public:
int LDAP;
void addToQueue(int num,int ind){
cout<<"Adding to queue"<<endl;
doctor d;
ifstream fin;
ofstream fout;
fin.open("admin/records/doctors.txt");
fout.open("admin/records/tempFiles/tempDoctors.txt");
while(fin.read(reinterpret_cast<char*>(&d), sizeof(doctor))){
if(d.LDAP==ind){
int i=0;
while(d.patientQ[i]!=0)i++;
d.patientQ[i]=num;
if(i==14)
d.available=false;
}
fout.write(reinterpret_cast<char*>(&d), sizeof(doctor));
}
fin.close();fout.close();
fin.open("admin/records/tempFiles/tempDoctors.txt");
fout.open("admin/records/doctors.txt");
while(fin.read(reinterpret_cast<char*>(&d), sizeof(doctor)))
fout.write(reinterpret_cast<char*>(&d), sizeof(doctor));
fin.close();fout.close();
fin.open("admin/records/doctors.txt");
while(fin.read(reinterpret_cast<char*>(&d), sizeof(doctor))){
int i=0;
// // uncomment this to check all queues
// while(d.patientQ[i]){
// cout<<'P'<<d.patientQ[i]<<" ";
// i++;
// }
// cout<<endl;
if(ind==d.LDAP){
cout<<"Name added to queue"<<endl<<"Current Queue for doctor "<<d.LDAP<<": ";
while(d.patientQ[i]&&i<15)
cout<<'P'<<d.patientQ[i++]<<" ";
}
}
cout<<endl;
fin.close();
}
int update_hospital_inventory()
{
}
int student_id()
{
int ldapID;
cout<<"\n Enter patient ID";
cin>>ldapID;
return ldapID;
}
receptionist(){};
};
void receptionistInit(int num,receptionist* r){
r->LDAP=num;
int cmd;
while(true){
cout<<"Press 1 to perform initial diagnosis"<<endl;
cout<<"Press 2 to logout"<<endl;
cin>>cmd;
if(cmd==2){
cout<<"Logging out..."<<endl;
return ;
}
cout<<"Enter the patient's LDAP Id (example: P10)"<<endl;
char cmd[3];
cin>>cmd;
int num;
if(cmd[2])
num=(cmd[1]-'0')*10 + cmd[2]-'0';
else
num=cmd[1]-'0';
initial_diagnosis(num);
}
}
/*int main()
{
receptionist r;
int ldapID;
ldapID=r.student_id();
r.initial_diagnosis(ldapID);
return 0;
}*/