forked from Puneeth-Aacharya/HMS_FS_mini-project
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhms.cpp
167 lines (153 loc) · 3.76 KB
/
hms.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
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
#include<iostream>
#include<fstream>
using namespace std;
class admin
{
string buffer,dname,address,id,age;
public:
void adddoc();
void display_doctor();
void dunpack();
void print();
int dsearch1(char *);
} a;
void admin::adddoc()
{
fstream fp;
cout << "\nEnter Name\n";
cin >> dname;
cout << "\nID\n";
cin >> id;
cout << "\nAge\n";
cin >> age;
cout << "\nAddress\n";
cin >> address;
buffer=id+"|"+dname+"|"+age+"|"+address+" $\n";
fp.open("doctor.txt",ios::out|ios::app);
fp<<buffer;
fp.close ();
}
void admin::display_doctor()
{
fstream fp;
fp.open("doctor.txt",ios::in);
while(!fp.eof())
{
buffer.erase();
getline(fp,buffer);
dunpack();
if(!fp.eof()&& buffer[0]!='*')
print();
}
fp.close();
}
void admin::dunpack()
{
int i=0;
id.erase();
while(buffer[i]!='|')
id+=buffer[i++];
i++;
dname.erase();
while(buffer[i]!='|')
dname+=buffer[i++];
i++;
age.erase();
while(buffer[i]!='$')
age+=buffer[i++];
i++;
address.erase();
while(buffer[i]!='$')
address+=buffer[i++];
}
void admin::print()
{
cout<<"ID:"<<id<<" Name:"<<dname<<" Age:"<<age<<"address:"<<address<<endl;
}
int main()
{
int ch;
cout<<"HOSPITAL MANAGEMENT SYSTEM\n";
cout<<"Enter \n1. Admin\n2. Doctor\n3.Nurse\n4.Receptionist\n";
cout<<"\nEnter your choice\n";
cin>>ch;
switch(ch)
{
case 1:
{
string username="admin",password="jnnce",u,p;
cout<<"Enter your username\n";
cin>>u;
cout<<"Enter your password\n";
cin>>p;
if(u==username && p==password)
{
int ach;
cout<<"Welcome Admin";
cout<<"\n1. ADD Doctors\t\t2. Display doctors records\n3. Add Nurse\t\t4. Display Nurse records\n4. Add Receptionist\t5. Display Receptionist Record\n6. Add lab\t\t 7. Display Lab details\n8. add ward\t\t9. Display Ward details\n\n Enter your choice\n";
cin>>ach;
switch(ach)
{
case 1:a.adddoc();
break;
case 2:a.display_doctor();
break;
/* case 3:addrecep();
break;
case 4:addlab();
break;
case 5:addward();
break;
*/
defalut:cout<<"invalid choice";
}
}
}
case 2:
{
int dch;
cout<<"Welcome doctor";
cout<<"1. Search Patient Record\n2. Display Patient Record\nEnter your choice \n";
cin>>dch;
switch(dch)
{
// case 1:search_p_record();
// break;
// case 2:display_p_record();
// break;
}
}
case 3:
{
int nch;
cout<<"Welcome Nurse";
cout<<"1. Search Patient Record\n2. Display Patient Record\nEnter your choice \n";
cin>>nch;
switch(nch)
{
/* case 1:search_p_record();
break;
case 2:display_p_record();
break;
*/
}
}
case 4:
{
int rch;
cout<<"Welcome Receptionist";
cout<<"1. Add Patient\n2.Generate Bill\n";
cout<<"Enter your choice\n";
cin>>rch;
switch(rch)
{
/* case 1:addpatient();
break;
case 2:generatebill();
break;
defalut:cout<<"Invalid choice";
*/
}
}
}
}