+ All Categories
Home > Documents > C.S Project Work (Patient Database management)

C.S Project Work (Patient Database management)

Date post: 13-Nov-2014
Category:
Upload: neil-mahaseth
View: 1,900 times
Download: 4 times
Share this document with a friend
Description:
A Computer science project work for class xii Provided by http://www.loookinto.blogspot.com/
27
Provided by http://www.loookinto.blogspot.com/
Transcript
Page 1: C.S Project Work (Patient Database management)

Provided by http://www.loookinto.blogspot.com/

Page 2: C.S Project Work (Patient Database management)

.: Certificate :.

This is to certify that Neil Mahaseth & Mohit Pandya , student of Class XII C, Kendriya Vidyalay No.1 ,Shahibaugh has completed the project titled 'Patient Database' during the academic year 2008-2009 towards partial fulfillment of credit for the Computer Science Provided by http://www.loookinto.blogspot.com/

Page 3: C.S Project Work (Patient Database management)

Practical Evaluation, under my supervision.

Miss Komal Rola External Examiner PGT Computer Science SignatureSignature

:Acknowledgements:

"There are times when silence speaks so much more loudly than words ofProvided by http://www.loookinto.blogspot.com/

Page 4: C.S Project Work (Patient Database management)

praise to only as good as belittle a person, whose words do not express, butonly put a veneer over true feelings, which are of gratitude at this point oftime."

I would like to express my sincere gratitude to my computer sciencementor Miss Komal Rola, for her vital support, guidance andencouragement - without which this project would not have come forth. I would also like to express my gratitude to Shri M.K. Kulshreshtha, Principal ,K.V. No 1 Shahibaug.

.: Index :.

Provided by http://www.loookinto.blogspot.com/

Page 5: C.S Project Work (Patient Database management)

1. About The Project.........................................52. Source Code................................................. 63. Output Screenshots ………………….............184. Bibliography…………………………………….21

About The ProjectProvided by http://www.loookinto.blogspot.com/

Page 6: C.S Project Work (Patient Database management)

This project uses the concept of data file handling and other concepts of “object oriented programming”. Its Aim is to collect various vital data like blood pressure, body temperature, heart beat, respiration rate etc. This project helps to store data in a very compact easily accessible way instead of storing data in huge bulks of files.

***************************************

Provided by http://www.loookinto.blogspot.com/

Page 7: C.S Project Work (Patient Database management)

Source Code /* C.S Project Work By Neil,Mohit

Patient Database */#include<stdio.h>#include<fstream.h>#include<conio.h>#include<process.h>#include<graphics.h>#include<dos.h>#include<string.h>void intro_screen() // introduction screen graphics{

int left = 50,top = 200,bottom = top+85,depth = 25,time = 5;

/*Set bar styles*/setfillstyle(1,BLACK);settextstyle( 7, HORIZ_DIR, 8);

/*First bar*/for( int i=620; i>left; i-- )

Provided by http://www.loookinto.blogspot.com/

Page 8: C.S Project Work (Patient Database management)

{

/*Draw bar*/setcolor(LIGHTRED);bar3d( i, top, i+460, bottom, depth, 1 );

/*Label the bar*/setcolor(RED);outtextxy( i+10, top-12, "Loading...");

delay(time);

/*Delete bar*/setcolor(BLACK);bar3d( i, top, i+460, bottom, depth, 1 );

}/*Last time it must be drawn again and not deleted*/setcolor(LIGHTCYAN);bar3d( i, top, i+460, bottom, depth, 1 );setcolor(WHITE);outtextxy( i+10, top-12, "Loaded!");delay(1200);

}

void exit_screen() // exit screen graphics{

int left = 50,top = 200,bottom = top+85,depth = 25,time = 5;

/*Set bar styles*/

Provided by http://www.loookinto.blogspot.com/

Page 9: C.S Project Work (Patient Database management)

setfillstyle(1,BLACK);settextstyle( 7, HORIZ_DIR, 8);

/*First bar*/for( int i=620; i>left; i-- ){

}/*Last time it must be drawn again and not deleted*/setcolor(LIGHTCYAN);bar3d( i, top, i+460, bottom, depth, 1 );setcolor(RED);outtextxy( i+10, top-12, "Thank You");

/*Set bar styles*/setfillstyle(1,WHITE);settextstyle( 7, HORIZ_DIR, 8);/*Set new peimeters*/left += 60;top += 120;bottom += 120;settextstyle( 1, HORIZ_DIR, 4 );setcolor(LIGHTCYAN);bar3d( 20, 410, 620, 450 , 15, 1 );setcolor(BLACK);outtextxy(30,412,"CREATED BY: Neil & Mohit");delay(4000);

}

/* The folowing class deals with all the details regarding a patient.*/

class Patient{ long int phoneno; char date[15];

Provided by http://www.loookinto.blogspot.com/

Page 10: C.S Project Work (Patient Database management)

int age,temp,pulse; char bloodp[10]; char name[20],sex[10],address[100],email[30],bloodgr[10]; char addictions[100],complains[100],duration[20]; char respiratoryrate[20],symptoms[200];

public: int opdno; void display(); void write(); void del(); void search(); void input(Patient); void output(Patient);

};void Patient::output(Patient read) // function to show patient details{ cout<<"\n Name: "; cout<<read.name; cout<<"\n Date(dd/mm/yy): "; cout<<read.date; cout<<"\n Age: "; cout<<read.age; cout<<"\n Sex(M/F): "; cout<<read.sex; cout<<"\n Address: "; cout<<read.address; cout<<"\n Phone number: "; cout<<read.phoneno; cout<<"\n Email id: "; cout<<read.email; cout<<"\n Blood group: "; cout<<read.bloodgr; cout<<"\n Pulse rate(beats/min): "; cout<<read.pulse;

Provided by http://www.loookinto.blogspot.com/

Page 11: C.S Project Work (Patient Database management)

cout<<"\n Blood pressure(mm Hg): "; cout<<read.bloodp; cout<<"\n Temperature(F): "; cout<<read.temp; cout<<"\n Addictions: "; cout<<read.addictions; cout<<"\n Complains: "; cout<<read.complains; cout<<"\n Duration: "; cout<<read.duration; cout<<"\n Respiratory rate(inhalation per min): "; cout<<read.respiratoryrate;

}void Patient::input(Patient write) // function to read patient's details{ ofstream outf; outf.open("pdatbase.dat",ios::out|ios::binary|ios::app); cout<<"\n Name: "; gets(write.name); cout<<"\n Date(dd/mm/yy): "; gets(write.date); cout<<"\n Age: "; cin>>write.age; cout<<"\n Sex(M/F): "; gets(write.sex); cout<<"\n Address: "; gets(write.address); cout<<"\n Phone number: "; cin>>write.phoneno; cout<<"\n Email id: "; gets(write.email); cout<<"\n Blood group: "; gets(write.bloodgr); cout<<"\n Pulse rate(beats/min): "; cin>>write.pulse; cout<<"\n Blood pressure(mm Hg): "; cin>>write.bloodp;

Provided by http://www.loookinto.blogspot.com/

Page 12: C.S Project Work (Patient Database management)

cout<<"\n Temperature(F): "; cin>>write.temp; cout<<"\n Addictions: "; gets(write.addictions); cout<<"\n Complains: "; gets(write.complains); cout<<"\n Duration: "; gets(write.duration); cout<<"\n Respiratory rate(inhalation per min): "; gets(write.respiratoryrate); cout<<"\nSaving........"; delay(1200); cout<<"\nSaved"; delay(1000); outf.write((char*)&write,sizeof(Patient)); outf.close();}void Patient::display() // to display a patient's details{ clrscr(); int opd,flag=0; cout<<" Give the opd no:"; cin>>opd; ifstream fin; Patient read; fin.open("pdatbase.dat",ios::in|ios::binary); while(!fin.eof()) { fin.read((char*)&read,sizeof(Patient)); if(read.opdno==opd) { flag=1; cout<<" Patient's opdnumber:"<<read.opdno; output(read); cout<<"\n Press any key to continue\n"; cin.get(); cin.get(); break;

Provided by http://www.loookinto.blogspot.com/

Page 13: C.S Project Work (Patient Database management)

}

} fin.close(); if(!flag) { cout<<" No entry exists\n"; cout<<" Press any key to continue\n"; cin.get(); cin.get(); }}

void Patient::del() // function to delete an entry{ ifstream fin; ofstream outf; clrscr(); char cho; int opd,flag=0; cout<<"\nGive the opd number of the record to be deleted:"; cin>>opd; Patient write,read; fin.open("pdatbase.dat",ios::binary|ios::in); outf.open("temp.dat",ios::binary|ios::out); while(!fin.eof()) { fin.read((char*)&read,sizeof(Patient)); if(read.opdno==opd) { flag=1; } else outf.write((char*)&read,sizeof(Patient));

}

Provided by http://www.loookinto.blogspot.com/

Page 14: C.S Project Work (Patient Database management)

if(!flag) { cout<<"No entry exists\n"; cout<<"Press any key to continue\n"; cin.get(); cin.get();

} fin.close(); outf.close(); remove("pdatbase.dat"); rename("temp.dat","pdatbase.dat");

}void Patient::write() // function to write details in the database{ start: clrscr(); char cho; Patient write; cout<<"\t\t\tType the Patient's data\n"; cout<<" Patient's opdnumber:"; ifstream fin; int a=0; fin.open("pdatbase.dat",ios::out|ios::binary); while(!fin.eof()) {

fin.read((char*)&write,sizeof(Patient)); if(write.opdno<a) break; a++;

} fin.close(); cout<<a<<'\n'; write.opdno=a; input(write);

Provided by http://www.loookinto.blogspot.com/

Page 15: C.S Project Work (Patient Database management)

cin.get(); cin.get(); cout<<"\nDo you want to add more entry(y/n):"; cin>>cho; if(cho=='Y'||cho=='y') goto start;}void Patient::search() // function to search a patient{ int i,opdno,flag=0; ifstream fin; fin.open("pdatbase.dat",ios::binary|ios::in); Patient search; clrscr(); cout<<"\n ******************************"; cout<<"\n * 1.)Search by OPD no. *"; cout<<"\n * 2.)Search by Patient name.*"; cout<<"\n ******************************"; cout<<"\n Enter your choice:"; cin>>i; switch(i) { case 1: clrscr();

cout<<"Enter the OPD no. of the patient to be searched:";

cin>>opdno; while(!fin.eof()) { fin.read((char*)&search,sizeof(Patient)); if(search.opdno==opdno) {

flag=1; cout<<"Patient's opdnumber:"<<search.opdno; output(search); cout<<"\n Press any key to continue\n"; cin.get(); cin.get(); break;

} }

Provided by http://www.loookinto.blogspot.com/

Page 16: C.S Project Work (Patient Database management)

if(!flag) {

cout<<" No entry exists\n"; cout<<" Press any key to continue\n"; cin.get(); cin.get();

}

break; case 2: clrscr();

int i,str,temp; char name[20]; cout<<" Enter the name of the patient to be

searched: "; gets(name); while(!fin.eof()) { fin.read((char*)&search,sizeof(Patient)); temp=strcmp(name,search.name); if(temp==0) {

flag=1; cout<<" Patient's opdnumber:"<<search.opdno; output(search); cout<<"\n Press any key to continue\n"; cin.get(); cin.get(); break;

} } if(!flag) {

cout<<" No entry exists\n"; cout<<" Press any key to continue\n"; cin.get(); cin.get();

}

Provided by http://www.loookinto.blogspot.com/

Page 17: C.S Project Work (Patient Database management)

break; default : clrscr();

cout<<" Wrong choice selected."; cout<<"\n The program will exit."; exit(0);

} fin.close();}

// main function beginsvoid main(){ textcolor(3); //for coloured text int driver = DETECT,mode;

initgraph(&driver,&mode,"c:\\tc\\bgi");intro_screen();

closegraph(); start: clrscr(); Patient p1; //object of class patient int choice; char cho; ofstream fout; // object to link the program with pdatbase fout.open("pdatbase.dat",ios::binary|ios::nocreate|ios::app); if(!fout) { ofstream fout1; fout1.open("pdatbase.dat",ios::binary); Patient write; write.opdno=0; fout1.write((char*)&write,sizeof(Patient)); fout1.close(); } fout.close(); cout<<"\t\t\ Red Cross Hospital"; cout<<"\n ********************************************"; cout<<"\n\n * 1. View patient details *"; cout<<"\n\n * 2. Add new patient detail *";

Provided by http://www.loookinto.blogspot.com/

Page 18: C.S Project Work (Patient Database management)

cout<<"\n\n * 3. Delete a patient details *"; cout<<"\n\n * 4. Search a patient details *"; cout<<"\n\n * 5. Exit *"; cout<<"\n ********************************************"; cout<<"\n\n Enter your choice:"; cin>>choice;

switch(choice) { case 1:{

p1.display(); break; }

case 2:{ p1.write(); break; }

case 3:{ p1.del(); break; }

case 4:{ p1.search(); break; }

case 5:{ clrscr(); int driver = DETECT,mode;

initgraph(&driver,&mode,"c:\\tc\\bgi");exit_screen();closegraph(); cout<<" Press any key to exit.....\n"<<" "; getch(); exit(0); break; }

default:{ clrscr();

Provided by http://www.loookinto.blogspot.com/

Page 19: C.S Project Work (Patient Database management)

cout<<" Invalid choice."<<" "; cout<<" Press any key to continue...."<<" "; getch(); clrscr(); }

}goto start;}

Output Screenshots

Provided by http://www.loookinto.blogspot.com/

Page 20: C.S Project Work (Patient Database management)

Provided by http://www.loookinto.blogspot.com/

Page 21: C.S Project Work (Patient Database management)

Provided by http://www.loookinto.blogspot.com/

Page 22: C.S Project Work (Patient Database management)

Provided by http://www.loookinto.blogspot.com/

Page 23: C.S Project Work (Patient Database management)

BibliographyFor our project we have taken help from following sources

1) COMPUTER SCIENCE WITH C++ BY SUMITA ARORA2) INTERNET3) Computer Science 12: Cbse BY PREETI GEHLOT AND CHARU GUPTA

Provided by http://www.loookinto.blogspot.com/


Recommended