Computer Science C++ Project On Hospital Management System For CBSE Class XII
Computer Science C++ Project On Hospital Management System For CBSE Class XII
PROJECT
~~~TOPIC~~~
HOSPITAL
MANAGEMENT
SYSTEM
BY
AMAN
XII GUPTA..
SCIENCE
TO THE
READERS
ACKNOWLEDGEMENT: - I am AMAN
GUPTA in NORTH POINT SENIOR SECONDARY
BOARDING SCHOOL I have got a GOLDEN
OPPERTUNITY to complete this Computer
Science Project on the topic of HOSPITAL
MANAGEMENT our respected teacher MINTU
GHOSH .
Yours sincerely..
-: SYSTEM DESIGN:-
1TECHNICAL FEASIBILITY:
b MINIMUM SOFTWARE
REQUIREMENT:
2 ECONOMIC FEASIBILITY:
Any company/ workstation platform can
provide this much technical feasibility. Therefore
this project is
technically feasible
.
3 OPERATION FEASIBILITY:
This project is very user friendly. One can handle this
very easily. The project itself guides the user. The
program itself interacts with the user by
understandable message. The user is only responsible
for providing the input data values and rest everything
is the programs responsibility.
SYSTEM ANALYSIS
Modules and their description:
1 Display the Entire patient list :-
4 Deletion of a Record :-
5 Modification of a Record :-
10 Menu :-
DISPLAY
ENTIRE
PATIENT'S
LIST.
UNIT WISE
RECORD.
DOCTOR
WISE
RECORD.
DISPLAY
ONLY A
PATIENT'S
LIST.
ADDITION OF
RECORD.
MENU
DISEASE
WISE
RECORD.
DELEITION OF
RECORD.
BED WISE
RECORD.
MODIFICATION
OF RECORD.
_________________________________________________________
-: FEASIBILITY STUDY:-
-: CODING:#include<iostream.h>
#include<conio.h>
#include<ctype.h>
#include<iomanip>
#include<stdio.h>
#include<fstream>
#include<string.h>
#define max 200
struct hospital
{
char name[25];
char sex[6];
int age;
char add_date[20];
char address[50];
char phone[20];
char bed[20];
char doc[25];
char disease[20];
char doc_phone[20];
char release[20];
char doc_address[50];
char unit[10];
};
void reading(char fname[10])
{
struct hospital patient;
ifstream infile;
infile.open(fname,ios::in);
int n=0;
int i=0;
i=sizeof(patient);
infile.seekg(0,ios::end);
n=infile.tellg();
int j=0;
j=(n/i);
infile.seekg(0);
fflush(stdin);
char name11[20];
cout<<"\n Enter Name of the patient-> ";
fflush(stdin);
gets(name11);
fflush(stdin);
cout<<"\nYou want record is Here--> ";
for(int t=0;t<=j-1;++t)
{
infile.read((char*)&patient,sizeof(patient));
if(strcmp(name11,patient.name)==0)
{
cout<<"\nPatient Name->
"<<patient.name;
cout<<"\nAge->"<<patient.age;
cout<<"\nSex->"<<patient.sex;
cout<<"\nAddress>"<<patient.address;
cout<<"\nTelephone No>"<<patient.phone;
cout<<"\nDisease>"<<patient.disease;
cout<<"\nAddimision Data>"<<patient.add_date;
cout<<"\nDate of Release>"<<patient.release;
cout<<"\nBed No>"<<patient.bed;
cout<<"\nUnit->"<<patient.unit;
cout<<"\nDoctore
Name"<<patient.doc;
cout<<"\nDoctore Ph No->"
<<patient.doc_phone;
cout<<"\nDoctore Address>"<<patient.doc_address;
getch();
clrscr();
}
infile.close();
}
}
void addition(char fname[10])
{
struct hospital patient[max];
ifstream infile;
int i=0, n=0;
fflush(stdin);
cout<<"\n How Many Records Are To Be Stored?-->";
cin>>n;
cout<<"\n Enter the following information..\n\n";
for (i = 0; i < n-1; ++i)
{
cout<<"\n Name-->";
gets(patient[i].name);
cout<<"\n Sex (M/F)-->";
cin>>patient[i].sex;
cout<<"\n Age-->";
cin>>patient[i].age;
cout<<"\n Addmission Date of the Patient-->";
gets(patient[i].add_date);
cout<<"\n Phone Number of the Patient-->";
gets(patient[i].phone);
cout<<"\n Bed Number-->";
cin>>patient[i].bed;
cout<<"\n DOCTOR's Name-->";
fflush(stdin);
gets(patient[i].doc);
fflush(stdin);
cout<<"\n Disease-->";
fflush(stdin);
gets(patient[i].disease);
fflush(stdin);
cout<<"\n DOCTOR's Phone Number-->";
fflush(stdin);
gets(patient[i].doc_phone);
fflush(stdin);
cout<<"\n Date of Release from the Hospital-->";
fflush(stdin);
gets(patient[i].release);
fflush(stdin);
cout<<"\n DOCTOR's Address-->";
fflush(stdin);
gets(patient[i].doc_address);
fflush(stdin);
cout<<"\n Unit-->";
fflush(stdin);
gets(patient[i].unit);
fflush(stdin);
}
infile.open(fname,ios::app);
cout<<"\n\n Storing on to the file...\n\n";
cout<<"\n\n Do you want to return to main menu... Press any key";
for(i=0;i<=n-1;i++)
{
infile.write((char*)&patient[i],sizeof(patient[i]));
}
infile.close();
}
void unit1(char fname[20])
{
struct hospital patient;
ifstream infile;
infile.open(fname,ios::in);
int n=0,i=0;
i=sizeof(patient);
infile.seekg(0,ios::end);
n=infile.tellg();
int j=0;
j=(n/i);
infile.seekg(0);
fflush(stdin);
fflush(stdin);
char name1[30];
cout<<"\n Enter the number of bed-->";
fflush(stdin);
gets(name1);
cout<<"\n\n Your wanted record is here-->";
for(int t=0;t<=j-1;++t)
{
infile.read((char*)&patient,sizeof(patient));
if(strcmp(name1,patient.bed)==0)
{
cout<<"\nPatient Name->
"<<patient.name;
cout<<"\nAge->"<<patient.age;
cout<<"\nSex->"<<patient.sex;
cout<<"\nAddress>"<<patient.address;
cout<<"\nTelephone No>"<<patient.phone;
cout<<"\nDisease>"<<patient.disease;
cout<<"\nAddimision Data>"<<patient.add_date;
cout<<"\nDate of Release>"<<patient.release;
cout<<"\nBed No>"<<patient.bed;
cout<<"\nUnit->"<<patient.unit;
cout<<"\nDoctore
Name"<<patient.doc;
cout<<"\nDoctore Ph No->"
<<patient.doc_phone;
cout<<"\nDoctore Address>"<<patient.doc_address;
getch();
clrscr();
}
infile.close();
}
}
void menu(void)
{
cout<<"\n\n WELCOME TO OUR HOSPITAL PATIR\ENT ADDMISSION
SYSTEM\N\N ";
cout<<"===========================================
=============\n";
cout<<"
***** Menu **
\n\n";
cout<<" What do you annt do,please insert the charcater \n\n";
cout<<"
A->Addition of new Record\n\n";
cout<<"
C->Complete display thepresent List\n";
cout<<"
R->Display onle present Recored\n\n";
cout<<"
D->Delete of the present record\n";
cout<<"
U->Unit wise present record\n";
cout<<"
x->Disese wise present report\n\n";
cout<<"
Z->Doctor wise present \n";
cout<<"
Q->Quit\n";
cout<<"===========================================
======\n";
cout<<"
Option please-->";
}
void modi(char fname[10])
{
struct hospital patient;
ifstream infile;
fstream tfile;
infile.open(fname,ios::in);
cout<<" Reading Feom the File--> ";
int n=0,i=0;
i=sizeof(patient);
infile.seekg(0,ios::end);
n=infile.tellg();
int j=0;
j=(n/i);
infile.seekg(0);
fflush(stdin);
fflush(stdin);
char name1[30];
for(int t=0;t<=j-1;++t)
{
infile.read((char*)&patient,sizeof(patient));
cout<<"
Record Number--> "<<(t+1);
cout<<"\n===============================\n";
cout<<"\nPatient Name->
"<<patient.name;
cout<<"\nAge->"<<patient.age;
cout<<"\nSex->"<<patient.sex;
cout<<"\nAddress>"<<patient.address;
cout<<"\nTelephone No>"<<patient.phone;
cout<<"\nDisease>"<<patient.disease;
cout<<"\nAddimision Data>"<<patient.add_date;
cout<<"\nDate of Release>"<<patient.release;
cout<<"\nBed No>"<<patient.bed;
cout<<"\nUnit->"<<patient.unit;
cout<<"\nDoctore
Name"<<patient.doc;
cout<<"\nDoctore Ph No->"
<<patient.doc_phone;
cout<<"\nDoctore Address>"<<patient.doc_address;
getch();
clrscr();
}
infile.close();
infile.open(fname,ios::in);
tfile.open("temp1",ios::out);
cout<<"\n Enter the Name of the patient to modified->
";
fflush(stdin);
gets(name1);
fflush(stdin);
cout<<"\nYou want record is Here--> ";
for(int t=0;t<=j-1;++t)
{
infile.read((char*)&patient,sizeof(patient));
if(strcmp(name1,patient.disease)!=0)
{
tfile.write((char*)&patient,sizeof(patient));
}
clrscr();
} infile.close();
tfile.close();
remove(fname);
rename("temp1",fname);
infile.open(fname,ios::app);
cout<<"\nEnter the following information-->\n";
cout<<"\n Name-->";
gets(patient[i].name);
cout<<"\n Sex (M/F)-->";
cin>>patient[i].sex;
cout<<"\n Age-->";
cin>>patient[i].age;
cout<<"\n Addmission Date of the Patient-->";
gets(patient[i].add_date);
cout<<"\n Phone Number of the Patient-->";
gets(patient[i].phone);
cout<<"\n Bed Number-->";
cin>>patient[i].bed;
cout<<"\n DOCTOR's Name-->";
fflush(stdin);
gets(patient[i].doc);
fflush(stdin);
cout<<"\n Disease-->";
fflush(stdin);
gets(patient[i].disease);
fflush(stdin);
cout<<"\n DOCTOR's Phone Number-->";
fflush(stdin);
gets(patient[i].doc_phone);
fflush(stdin);
cout<<"\n Date of Release from the Hospital-->";
fflush(stdin);
gets(patient[i].release);
fflush(stdin);
cout<<"\n DOCTOR's Address-->";
fflush(stdin);
gets(patient[i].doc_address);
fflush(stdin);
cout<<"\n Unit-->";
fflush(stdin);
gets(patient.unit);
fflush(stdin);
infile.write((char*)&patient,sizeof(patient));
infile.close();
}
void disease(char fname[20])
{
struct hospital patient;
ifstream infile;
infile.open(fname,ios::in);
int n=0,i=0;
i=sizeof(patient);
infile.seekg(0,ios::end);
n=infile.tellg();
int j=0;
j=(n/i);
infile.seekg(0);
fflush(stdin);
fflush(stdin);
char name1[30];
cout<<"\n Enter Disease of thr Present-> ";
fflush(stdin);
gets(name1);
fflush(stdin);
cout<<"\nYou want record is Here--> ";
for(int t=0;t<=j-1;++t)
{
infile.read((char*)&patient,sizeof(patient));
if(strcmp(name1,patient.disease)==0)
{
cout<<"\nPatient Name->
"<<patient.name;
cout<<"\nAge->"<<patient.age;
cout<<"\nSex->"<<patient.sex;
cout<<"\nAddress>"<<patient.address;
cout<<"\nTelephone No>"<<patient.phone;
cout<<"\nDisease>"<<patient.diseae;
cout<<"\nAddimision Data>"<<patient.add_date;
cout<<"\nDate of Release>"<<patient.realease;
cout<<"\nBed No>"<<patient.bed;
cout<<"\nUnit->"<<patient.unit;
cout<<"\nDoctore
Name"<<patient.doc;
cout<<"\nDoctore Ph No->"
<<patient.doc_phone;
cout<<"\nDoctore Address>"<<patient.doc_address;
getch();
clrscr();
}
} infile.close();
}
void doc(char fname[30])
{
struct hospital patient;
ifstream infile;
infile.open(fname,ios::in);
int n=0,i=0;
i=sizeof(patient);
infile.seekg(0,ios::end);
n=infile.tellg();
int j=0;
j=(n/i);
infile.seekg(0);
fflush(stdin);
fflush(stdin);
char name1[30];
cout<<"\n Enter Doctore Name-> ";
fflush(stdin);
gets(name1);
fflush(stdin);
cout<<"\nYou want record is Here--> ";
for(int t=0;t<=j-1;++t)
{
infile.read((char*)&patient,sizeof(patient));
if(strcmp(name1,patient.disease)==0)
{
cout<<"\nPatient Name->
"<<patient.name;
cout<<"\nAge->"<<patient.age;
cout<<"\nSex->"<<patient.sex;
cout<<"\nAddress>"<<patient.address;
cout<<"\nTelephone No>"<<patient.phone;
cout<<"\nDisease>"<<patient.diseae;
cout<<"\nAddimision Data>"<<patient.add_date;
cout<<"\nDate of Release>"<<patient.realease;
cout<<"\nBed No>"<<patient.bed;
cout<<"\nUnit->"<<patient.unit;
cout<<"\nDoctore
Name"<<patient.doc;
cout<<"\nDoctore Ph No->"
<<patient.doc_phone;
cout<<"\nDoctore Address>"<<patient.doc_address;
getch();
clrscr();
}
}
infile.close();
}
void add12(char fname[30])
{
struct hospital patient;
fstream infile;
infile.open(fname,ios::in);
cout<<"\nEnter the following information-->\n";
cout<<"\n Name-->";
gets(patient[i].name);
cout<<"\n Sex (M/F)-->";
cin>>patient[i].sex;
cout<<"\n Age-->";
cin>>patient[i].age;
cout<<"\n Addmission Date of the Patient-->";
gets(patient[i].add_date);
cout<<"\n Phone Number of the Patient-->";
gets(patient[i].phone);
cout<<"\n Bed Number-->";
cin>>patient[i].bed;
cout<<"\n DOCTOR's Name-->";
fflush(stdin);
gets(patient[i].doc);
fflush(stdin);
cout<<"\n Disease-->";
fflush(stdin);
gets(patient[i].disease);
fflush(stdin);
cout<<"\n DOCTOR's Phone Number-->";
fflush(stdin);
gets(patient[i].doc_phone);
fflush(stdin);
cout<<"\n Date of Release from the Hospital-->";
fflush(stdin);
gets(patient[i].release);
fflush(stdin);
cout<<"\n DOCTOR's Address-->";
fflush(stdin);
gets(patient[i].doc_address);
fflush(stdin);
cout<<"\n Unit-->";
fflush(stdin);
gets(patient.unit);
fflush(stdin);
infile.write((char*)&patient,sizeof(patient));
infile.close();
}
void delete1(char fname[20])
{
struct hospital patient;
ifstream infile;
infile.open(fname,ios::in);
cout<<" Reading From the File--> ";
int n=0,i=0;
i=sizeof(patient);
infile.seekg(0,ios::end);
n=infile.tellg();
int j=0;
j=(n/i);
infile.seekg(0);
fflush(stdin);
char name1[30];
for(int t=0;t<=j-1;++t)
{
infile.read((char*)&patient,sizeof(patient));
cout<<"
Record Number--> "<<(t+1);
cout<<"\n===============================\n"
cout<<"\nPatient Name->
"<<patient.name;
cout<<"\nAge->"<<patient.age;
cout<<"\nSex->"<<patient.sex;
cout<<"\nAddress>"<<patient.address;
cout<<"\nTelephone No>"<<patient.phone;
cout<<"\nDisease>"<<patient.diseae;
cout<<"\nAddimision Data>"<<patient.add_date;
cout<<"\nDate of Release>"<<patient.realease;
cout<<"\nBed No>"<<patient.bed;
cout<<"\nUnit->"<<patient.unit;
cout<<"\nDoctore
Name"<<patient.doc;
cout<<"\nDoctore Ph No->"
<<patient.doc_phone;
cout<<"\nDoctore Address>"<<patient.doc_address;
getch();
clrscr();
}
infile.close();
infile.open(fname,ios::in);
tfile.open("temp1",ios::out);
cout<<"\n Enter the Name of the patient-> ";
cout<<"\n Record Deleted";
fflush(stdin);
gets(name1);
fflush(stdin);
for(int t=0;t<=j-1;++t)
{
infile.read((char*)&patient,sizeof(patient));
if(strcmp(name1,patient.disease)!=0)
{
tfile.write((char*)&patient,sizeof(patient));
}
clrscr();
} infile.close();
tfile.close();
remove(fname);
rename("temp1",fname);
cout<<"\nUnit->"<<patient.unit;
cout<<"\nDoctore
Name"<<patient.doc;
cout<<"\nDoctore Ph No->"
<<patient.doc_phone;
cout<<"\nDoctore Address>"<<patient.doc_address;
getch();
clrscr();
}
infile.close();
}
void display(char fname[30])
{
struct hospital patient;
ifstream infile;
fstream tfile;
infile.open(fname,ios::in);
cout<<" Reading From the File--> ";
int n=0,i=0;
i=sizeof(patient);
infile.seekg(0,ios::end);
n=infile.tellg();
int j=0;
j=(n/i);
infile.seekg(0);
fflush(stdin);
for(int t=0;t<=j-1;++t)
{
infile.read((char*)&patient,sizeof(patient));
cout<<"
Record Number--> "<<(t+1);
cout<<"\n===============================\n"
cout<<"\nPatient Name->
"<<patient.name;
cout<<"\nAge->"<<patient.age;
cout<<"\nSex->"<<patient.sex;
cout<<"\nAddress>"<<patient.address;
cout<<"\nTelephone No>"<<patient.phone;
cout<<"\nDisease>"<<patient.diseae;
cout<<"\nAddimision Data>"<<patient.add_date;
cout<<"\nDate of Release>"<<patient.realease;
cout<<"\nBed No>"<<patient.bed;
cout<<"\nUnit->"<<patient.unit;
cout<<"\nDoctore
Name"<<patient.doc;
cout<<"\nDoctore Ph No->"
<<patient.doc_phone;
cout<<"\nDoctore Address>"<<patient.doc_address;
getch();
clrscr();
}
infile.close();
}
cout<<"\nAddimision Data>"<<patient.add_date;
cout<<"\nDate of Release>"<<patient.realease;
cout<<"\nBed No>"<<patient.bed;
cout<<"\nUnit->"<<patient.unit;
cout<<"\nDoctore
Name"<<patient.doc;
cout<<"\nDoctore Ph No->"
<<patient.doc_phone;
cout<<"\nDoctore Address>"<<patient.doc_address;
getch();
clrscr();
}
infile.close();
}
}
void main()
{
clrscr();
char fname[20];
cout<<"\n\n Enter the file to be stored";
fflush(stdin);
gets(fname);
fflush(stdin);
clrscr();
char ch;
menu();
while((ch=toupper(getchar()))!='Q')
{
switch(toupper(ch))
{
case 'M' :
clrscr();
modi(fname);
menu();
getch();
break;
case 'C' :
clrscr();
display(fname);
menu();
getch();
break;
case 'A' :
clrscr();
add12(fname);
menu();
getch();
break;
case 'R' :
case 'D' :
case 'U' :
case 'B' :
case 'X' :
case 'Z' :
}
}
}
clrscr();
reading(fname);
menu();
getch();
break;
clrscr();
delete1(fname);
menu();
getch();
break;
clrscr();
unit1(fname);
menu();
getch();
break;
clrscr();
bed(fname);
menu();
getch();
break;
clrscr();
desease(fname);
menu();
getch();
break;
clrscr();
doc(fname);
menu();
getch();
break;
REPORTS
OUTPUT SCREENS:MENU SCREEN:
-: WELCOME TO OUR HOSPITALS PATIENT ADMISSION
SYSTEM:=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
=*=*=*=*=*=*=*=*=*=*=*
********MENU********
What do you want to do, please insert that character?
A -> Addition of new record.
C -> Complete display of the patient list.
R -> Display only a patients record.
M ->Modification of a patients record.
D -> Deletion of a patients record.
U -> Unit wise report.
B -> Bed wise report.
X -> Disease wise report.
Z -> doctor wise report.
Q -> Quit.
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
=*=*=*=*=*=*=*=*=*=*=*=
Option Please ->
ADDITION OF RECORD:
HOW MANY RECORDS ARE TO BE MADE->
NAME ->
SEX (M/F) ->
AGE ->
ADMISSION DATE OF THE PATIENT ->
DISEASE ->
DOCTORS PHONE NUMBER ->
DATE OF RELEASE FROM THE HOSPITAL ->
DOCTORS ADDRESS ->
UNIT ->
MODIFICATION OF RECORDS:
Reading from the File
RECORD NUMBER ->
============================================
==========
DELETION OF RECORD
Reading from the File
PATIENTS NAME ->
AGE ->
SEX (M/F) ->
BIBLIOGRAPHY
Computer Science with C++ -- Sumita Arora.
C++ projects and practical
-- Sumita Arora.
Programming with C++
-- D. Ravichandran.