Hospital Management Sample System
Hospital Management Sample System
Hospital Management Sample System
UNIVERSITY UNDER SUPERVISION OF JAY PRAKASH JAY SENIOR FACULTY (IT) MCA SOFTDOT HI-TECH EDUCATIONAL & TRAINING INSTITUTE SUBMITTED BY ANKUR DIXIT REGN. NO. SUBMITTED TO SCHOOL OF DISTANCE EDUCATION JAMIA HAMDARD UNIVERSITHY KOTTAYAM, KERALA
THROUGH: CENTRE CODE: 1010 SOFTDOT HI-TECH EDUCATIONAL & TRAINING INSTITUTE K-16, SOUTH EX-I, NEW DELHI-110049
DECLARATION
1
I here by declare that minor work entitled Hospital Management System submitted for BCA (3 years) is my original work carried out by me under the guidance of Mr. Jay Prakash Jay for the partial fulfillment of the award of the degree of the Bachelor of Computer Applications. The matter embodied in this report has not been submitted anywhere else for the award of any other degree/ diploma.
Date:
CERTIFICATE
2
This is to certify that Arathi Nair M Registration No. 80454 has carried out the project work presented in this project report entitled Hospital Management System for the award of Bachelor of Computer Application from Softdot Hi-Tech Educational & Training Institute to be submitted to Mahatma Gandhi University under my supervision. The work embodied in this report is original. The work has not been submitted in part or full to this or any other university for the award of any degree or diploma.
Forwarded by head study centre (with signature, name of head and seal)
ACKNOWLEDGEMENT
3
I take this opportunity to express my deep sense of gratitude and indebtedness to a humble guide, Mr. Jay Prakash Jay whose help, encouragement and constant critics kept my moral high during my work. Without his assistance and guidance, it would have been indeed difficult for me to shape up this work. I would like to extend my sincere thanks to Mr. Ganesh Kumar, Dean, Softdot South Ex. Branch and Ms. Deepika Singh (Faculty) for creating the necessary conditions conducive to the initiation and completion of the study. I am also thankful to all teachers who have taught me, improved my capabilities and all faculty members whose inspiration gave me a valuable support as because of them I am in a position to successfully design my project. I extend my acknowledgement to my friends for their co-operation and support during this period and for making moments cherished for lifetime. Last but not the least, I pay my gratitude and reverence to my parents for their love, entire moral boosting. Above all I thank Almighty God who showered his blessings upon me throughout the period of this work.
CONTENTS
DECLARATION CERTIFICATE ACKNOWLEDGEMENT INTRODUCTION WHY C++ IS USED FOR MAKING THIS PROJECT? SRS (Software Requirement Specification) 6.1 SOFTWARE REQUIREMENT SPECIFICATION 6.2 HARDWARE REQUIREMENT SPECIFICATION 7. SYSTEM ANALYSIS AND DESIGN 7.1 SYSTEM ANALYSIS AND DESIGN 7.2 DFD (Data Flow Diagram) 7.3 SOFTWARE MODEL 7.4 FEASIBILITY STUDY 7.4.1 ECONOMICAL 7.4.2 TECHNICAL 7.4.3 LEGAL 7.4.4 ORGANISATIONAL 7.4.5 ENVIRONMENTAL 8. SCHEDULE 8.1 PERT CHART 8.2 GANTT CHART 9. CODING 10. REPORT/ OUTPUT FORMS 11. TESTING 12. FUTURE SCOPE OF THE PROJECT 13. BIBLIOGRAPHY
1. 2. 3. 4. 5. 6.
A Hospital Management System is an automated software system that manages the function of a health care. The presented project here is made in view overcoming the problems faced by many Hospitals regarding Maintaining patient records , Recording and keeping of Doctors information, Bed management , Report generation etc. i.e. General HMS Automation. This project can be widely used in any Hospital which contain different departments with various employees having different designations etc. HMS not only provides an opportunity to the hospital to enhance their patient care but also can increase the profitability of the organization.
Patient Record
7
The patient record is a comprehensive patient care module that tracks the episodes of care for all patients and maintains and arranges the clinical information including their address. It is the central repository for holding the entire medical records of the patient. It stores data in an organized and structured manner so that a clinician or any other clinical user easily accesses clinical data based on his role on needs basis.
Our Vision :
We shall define ourselves in the cutting edge technology in the coming era. We shall create honest working environment with seethrough-glass planning.
Our Mission :
To create opportunity for growth & self actualization and provide an environment of highly conducive works culture.
PROJECT RECORD MAINTENANCE To maintain the proper details of hospital management system provides the following : Admission, list of patients, adding doctors, record of patients, modify details, discharge of patients so on under various provision provided by the management. MAINTAIN FLEXIBILITIES
The system should be modified depending on the changing needs of the user such modification should be entire reconstructing on recreation of software. It should also be portable to different computer system. INCREASE PRACTICABILITY
The system should be a stable and can be operated by people with average intelligence means it should be user friendly. INCREASE EFFICIENCY
This project involves accuracy, timeliness & comprehensiveness of the system output. COST
It is desirable to aim for a system with a minimum cost subject to the condition that must satisfy all the requirements. MAINTAIN THE SECURITY This is very important aspect of the design and should cover areas of hardware reliability, physical security of data.
PROPOSED SYSTEM 9
In the proposed system transactions are made at the time of admission of the patient or to get the information from previous records. It is basically a deal between the hospital management and the patient that are included in the system at the time of admission. The full detail about every patient is maintained in the transaction like. Admission List of patient Adding Doctors Patient Record Assigning rooms Availability of bed Discharge of patient ADVANTAGES OF PROPOSED SYSTEM This package is designed by taking all the aspects and need of hospital management system. This system is easy to handle and easy to maintain. The front page of the software provides easy selection of options and thus easy access to the capabilities of the system. The system is also very flexible, the changes required are made in very less time and resources of the user. So, it is very advantages to the user that modification are easy to handle. The system is capable of printing all the reports timely and accurately which a manual system cant.
10
C++ is an ideal programming language for developing professional application for any organization. Object Oriented Programming (OOP) has become the preferred programming approach by the software industries, as it offers a powerful way to cope the complexity of real world problems. C++ is a type of computer language created in 1983 by Bjarne Stroustrip, C++ was designed to serve as an enhanced version of the C programming language. C++ is Objected Oriented Programming lauguage and is considered a high level language. Object oriented programming allows decomposition of a problem into a number of entities called objects and then builds data and functions around these objects.
Object C Functions
Data
The organization of data and functions in object oriented programs is shown in fig. the data of an object can be accessed only the functions associated with that object. However, functions of an object can access the functions of other objects.
ADVANTAGES OF C++
reused. checking.
New programs would be developed in less time because old code can be Creating and using new data types would be easier in C++ than in C The memory management under C++ would be easier and more transparent. Programs would be less bug prone, as C++ uses a stricter syntax and type
Data hiding the usage of data by one program part while other program being easier to implement with c++.
12
REQUIREMENT SPECIFICATION
13
Requirement specifications very important part of the software development project. IT requires the understanding of the whole project and its objectives and hence we can say that requirement specification evolves out of the requirement analysis task, which species what is to be done. Both software developer and customer conduct review of a software requirement specification.The software requirement specification is produced at the culmination of the analysis task. Software project constraints: 1. The process should not be too cumbersome to handle. 2. Economically viable.
REQUIREMENT ANALYSIS
Requirement analysis results in the specification of softwares operational characteristics; indicates softwares interface with other system elements and establishes constraints that software must meet. Requirement analysis allows the software engineer (sometimes called an analyst or modeler in this role) to elaborate on basic requirements established during earlier requirement engineering tasks and build, models that depict user scenario, functional activities, problem classes and their relationships, System and class behavior, and the flow of data as it is transformed. Throughout analysis modeling, the software engineers primary focus is on What objects does the system manipulate. What functions must the system perform. What behavior does the System exhibit. What interfaces are defined. What constraints apply.
OBJECTIVES OF ANALYSIS MODEL
To describe what the customer requires. To establish a basis for the creation of a software design. To define a set of requirements that can be validated once the software is built.
System Description
Analysis Model
Design Model
14
Analysis model bridges the gap between a system- level, description that describes overall system functionality as it is achieved by applying software, hardware, data, human and other System elements and a software design that describes the softwares application architecture, user interface and component level structure.
REQUIREMENT DOCUMENTATION
Requirement documentation is very important activity after the requirements elicitation and analysis. This is the way to represent requirements in a consistent format. Requirement documents is called software Requirements Specification (SRS). The SRS is a specification for a particular software product, program or set of programs that performs certain functions in a specific environment. It serves a number of purposes depending on who is writing it. First, the SRS could be written by the customer of a System second, the SRS could be written by developer of the system. The two scenarios establish different purpose and serves as a contract document between customer and developer.
NATURE OF THE SRS 1) 2)
EXTERNAL INTERFACES: How does the software interact with people, the Systems hardware, other hardware and other software? PERFORMANCE: What is the speed availability, response time, recovery time, etc of various software functions?
3)
ATTRIBUTES: What are the considerations for portability, correctness, maintainability, security, reliability etc?
4)
DESIGN CONSTRAINTS IMPOSED ON AN IMPLEMENTATION: Are there any required standards in effect, implementation language, policies for dbase integrity, resource limits, operating environments etc.
5) SOFTWARE REQUIREMENT SPECIFICATION
15
STEP I:
The project titled Hospital Management System has been prepared for removing the time consuming manual systems. This package is designed by taking all the aspects and need of hospital using system which is very easy to handle and easy to maintain. Basically the purpose of this project is to provide necessary things like individual admission, discharge, availability of rooms etc. to each and every patient in a computerised form, so that no patient has to wait in a long queues for admission and discharge as they did earlier.
STEP II :
DEVELOPMENT,OPERATING AND MAINTENANCE ENVIRONMENT
The development, operating and maintenance environment of the product consists of the following:
SOFTWARES REQUIREMENTS 1. Operating System : - Windows 98,99,2000,XP, NT
HARDWARE REQUIREMENTS
FUNCTIONAL REQUIRMENTS
Since, the project is prepared on the computerized Hospital Management System and the end user who will use this software must have some basic knowledge. So, a good level of user friendliness is the requirement.
STEP IV :
PERFORMANCE REQUIREMENTS
The records in it should not overlap and we can able to get the record by providing the room number and somehow the proper security of all the records should be maintained.
STEP V :
EXCEPTIONAL HANDLING
The software must be able to display proper error messages in case if some error encounters.
STEP VI :
FORESEEABLE MODIFICATIONS AND ENHANCEMENTS
This project is very flexible i.e. we can modify it in future in case if some need arises.
16
17
SYSTEM ANALYSIS
System analysis describes the detailed description of the scenario, and the functioning of the system. The transaction and input/output requirements are also presented. The problems in the current system are discussed and the necessary improvements are recommended. Systems Development can generally be thought of as having two major components : o o System Analysis System Design
System Design : System Design is the process of planning a new business system or one to replace or complement an existing system. But before this planning can be done, we must thoroughly understand the old system and determine how computers can best be used (if at all) to make its operation more effective. System Analysis : System Analysis is the process of gathering and interpreting facts, diagnosing problems , and using the information to recommend improvements to the system.
18
19
20
COMMUNICATION
MODELING
Analysis Design CONSTRUCTION Code Test DEPLOYMENT Delivery Support Feedback
21
This model has five phases : Requirement analysis and specification. Design Implementation and unit Testing Integration and system testing. Operation and maintenance.
The phases always occur in this order that they do not overlap. The developer must complete each phase before the next phase begins. This model is named Waterfall Model because its diagrammatic representation resembles a cascade of waterfalls.
Requirement analysis and specification Design Implementation and unit testing Integration and system Testing Operation and Maintenance
22
The goal of this phase is to understand the exact requirements of the customer and to documents them properly. This activity is usually executed together with the customer, as the goal is to document all functions, performance and interfacing requirements for the software. The requirements describe the what of a system, not the how. This phase produces a large document, written in a natural language, contains a description of what the System will do without describing how it will be done. The resultant document is known as software requirement specification document (SRS).
DESIGN PHASE:
The SRS document contains the exact requirements of the customer. The goal of this phase is to transform the requirements specification into a structure that is suitable for implementation in some programming language. Here overall software architecture is defined, and the high level and detailed design work is performed. This work is documented and known as software design description (SDD) document. The information contained in the SDD should be sufficient to begin the coding phase.
IMPLEMENTING AND UNIT TESTING PHASE :
During this phase, design is implemented. If the SDD is complete, the implementation or coding phase proceeds smoothly, because all the information needed by the software developers is contained in SDD. During testing, the major activities are centered the exam and modification of code. Initially, small modules are tested in isolation from the rest of the software product. The problem that are encountered while testing a module in isolation are solved in this phase and modules are tested after writing some overhead code.
INTEGRATION AND SYSTEM TESTING PHASE :
This is a very important phase effective testing will contribute to the delivery of higher quality software products, more satisfied users, lower maintenance costs and more accurate and reliable results. Unit testing is used for implementing each independent module correctly, due to which there are less chances that whether the interface between modules are correct, for this reason
23
integration testing is performed. System testing involves the testing of the entire System, where as software is the part of the System.
Software maintenance is a task that every development group has to face, when the software is delivered to the customers site, installed and is operational. Therefore, release of software inaugurates the operation and maintenance phase of the life cycle. Software maintenance includes error correction, enhancement of capabilities, deletion of obsolete capabilities and optimization. The purpose of this phase is to preserve the value of the software over time
MODEL CHOSEN
The model chosen for this project is Waterfall Model because of the following reasons:ADVANTAGES OF WATERFALL MODEL
It can serve as a useful process model in situations where requirements are fixed and work is to proceed to completion in a linear manner. Testing is inherent to every phase of the waterfall model. It is a simple and elegant model which can be used in testing projects. It is an enforced disciplined approach It is not costly It is documentation driven, i.e. documentation is produced at every stage.
24
FEASIBILITY STUDY
All the projects are feasible given unlimited resources and infinite time. Unfortunately, the development of a computer based system is more likely to be played by a scarcity of resources and difficult delivery date. It is both necessary and prudent to evaluate the feasibility of a project at the earliest possible time. In the development of the present project, no such limitation was imposed that was not feasible, s all the resources where easily available and time given was sufficient enough.
OBJECTIVES OF FEASIBILITY STUDY
1.
What are the problems with conventional System? What are the solutions available to overcome these problems? What are the goals and sub goals of the proposed System? What the proposed System would be achieve? Who all should be involved in the administering the System? The benefits, the System will give over the conventional System? The estimated cost of the implementation. The estimated time needed to develop and implement the proposed System?
ECONOMIC FEASIBILITY
This involves questions such as whether the form can afford to built the system, whether its benefits should substantially exceed its costs, and whether the project has higher priority and profits than other projects that might use the same resources. Since, our project is made on C++ it is not very costly as it is very common available software. We dont need any extra software or hardware requirements or any GUI (Graphic user interface)
2. TECHNICAL FEASIBILITY
This involves question such as whether the technology needed for the system exists, how difficult it will be to build and whether the firm has enough experience using that technology. The software made is on C++ which is a very common language, so we can get the experienced persons in it very easily.
25
3.
LEGAL FEASIBILITY
All projects must face legal scrutiny. When an organization either has legal council on staff or on retainer, such reviews are typically standard. However, any project may face legal issue after completing too.Our software is legally feasible.
4.
ORGANISATIONAL FEASIBILITY
This involves question such as whether the System has enough support to be implemented successfully, whether it brings an excessive amount of change, and whether the organization is changing too rapidly to absorb it. Since, it is a very small project its purpose is for submission of BCA (3 year) degree and all the members are equally include for the submission of project. So, there is a good Coordinating among all the members.
5. ENVIRONMENTAL FEASIBILITY
People are inherently resistant to change and computers have been known to facilitate change. An estimate should be made of how strong a reaction the user staff is likely to have towards the development of a computerized system.
26
SCHEDULING
Scheduling of a software project does not greatly from scheduling of any multitask engineering effort. Therefore, generalized project scheduling tools and techniques can be applied with little modification for software projects. Program Evaluation and Review technique (PERT) and the critical path method (CPM) are two project scheduling methods that can be applied to software development. Both technique are driven by information already developed in earlier project planning activities. Estimated of effort. A Decomposition of the product function model and task set. Decomposition of tasks. Interdependencies among tasks may be defined using a task network. Tasks, sometimes called the project work breakdown structure (WBS), are defined for the product as a whole or for individual functions. Both PERT and CPM provide quantitative tools that allow the software planner to (1)Determines the critical path the chain of tasks that determines the duration of the project; (2) Establish most likely time estimates for individual tasks by applying statistical models; and (3) Calculate Boundary times that define window for a particular task.
PERT CHART
The program (or project) Evaluation and review Technique (PERT) is a model for a project management designed to analyze and represent the tasks involved in completing a given project.
T=1mo D T=2mo T=3mo A B T=4mo C T=3mo E F t=3mo
27
PERT model was invented by BOOZ Allen Hamilton, inc. under contract of United States Department of Defences US NAVY special projects office in 1958 as a part of the polaris mobile submarine launched ballistic missile project PERT was developed primarily to simplify the planning and scheduling of large and complex projects.
BENEFITS OF PERT
PERT is useful because of the following reasons: Expected project completion time. Probability of completion before a specified date. Critical path activities that directly impart the completion time. The activities that have stack time and that can lend resources to critical path activities. Activity start and end dates.
LIMITATIONS OF PERT
Some of PERT Weakness are:The activity time estimates are somewhat subjective and depend on judgement. In cases where there is little experience in performing an activity, the numbers may be only a guess. In other cases, if the person or group performing the activity estimates the time there may be bias in the estimate. Even if the activity times are well-estimated, PERT assumes a beta distribution for these time estimates, but the actual distribution may be different. Even if the beta distribution assumption holds, PERT assumes that the portability distribution of the project completion time is same as that of the critical path because other parts can become the critical path because other parts can become the critical path if there is associated are delayed, PERT consistently underestimates the expected project completion time.
STEPS IN PERT PLANING PROGRESS
1) 2)
PERT planning involves the following steps:Identify the specific activities & milestone. Determines the proper sequence of the activities.
3)
4)
5) 6)
Determine the critical path. Update the PERT chart as the project progresses.
GANTT CHART
A timeline chart, also called Gantt chart is a graphical representation of time. A Gantt chart is a useful tool for planning & scheduling project. A Gantt chart is helpful when monitoring a projects progress.
PLANNIG AND SCHEDULING
o A Gantt chart allows you to asses how long a project should take. o A Gantt chart lays out the order in which tasks need to be carried out. o A Gantt chart helps manage the dependencies between tasks.
MONITORING A PROJECT o A Gantt chart allows you to see immediately what should have been achieved
at a point in time. o A Gantt chart allows you to see how remedial action may bring the project back on course. A Gantt chart is constructed with a horizontal axis representing the total time span of the project, broken down into increments (days, weeks or months)
TIMELINE/GANTT CHART
A figure illustrates the format of a timeline chart. It depicts a part of a software project schedule that emphasizes the concept scoping task for a word-processing (WPS) software product. All project tasks (for concept scoping) are listed in the lefts- hand column. The horizontal bars indicate the duration of each task. Where multiple bars occur at the same time on the calendar, task concurrency is implied. The diamonds indicates milestone.
29
Time in days
0 120 15 30 45 60 75 90 105
Form Design
Prog Design
30
31
//********************************************************** // PROJECT HOSPITAL MANAGEMENT //********************************************************** //********************************************************** // INCLUDED HEADER FILES //********************************************************** #include <fstream.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <conio.h> #include <dos.h> #include <ctype.h> ofstream print("PRN"); void print_title(); void print_dashline(); void print_date(); void print_time(); ///////////////////////// void title(); void dashline(); void date(); void time(); void print_dashline() { for(int a=0;a<80;a++) print<<'-'; } void print_time() { struct dostime_t t; _dos_gettime(&t); int hour=t.hour; int minute=t.minute; print<<"\t\t\t\t\t\t Time: "<<hour<<":"<<minute<<"\n"; }
32
void print_date() { struct dosdate_t d; _dos_getdate(&d); int day=d.day; int month=d.month; int year=d.year; print<<" Date: "<<day<<"/"<<month<<"/"<<year; }
void title() { // gotoxy(30,2); cout<<"\t\t\t\tGANGA RAM HOSPITAL"; cout<<"\n"; date();cout<<"\t\t\t\t\t\t"; time(); cout<<"\n"; dashline(); } //GETS AND DISPLAYS THE CURRENT DATE void date() { struct dosdate_t d; _dos_getdate(&d); gotoxy(5,2); printf("Date: %d/%d/%d", d.day,d.month,d.year); }
33
//GETS AND DISPLAYS THE CURRENT TIME void time() { struct dostime_t t; _dos_gettime(&t); // gotoxy(68,3); printf("Time: %2d:%02d\n", t.hour, t.minute); } void dashline() { for(int a=0;a<80;a++) cout<<'-'; }
//********************************************************** // THIS CLASS CONTAINS ALL THE DRAWING FUNCTIONS //********************************************************** class LINES { public : void LINE_HOR(int, int, int, char) ; void LINE_VER(int, int, int, char) ; void BOX(int, int, int, int, char) ; void CLEARUP(int, int) ; void CLEARDOWN(int, int) ; }; //********************************************************** // THIS CLASS CONTROL ALL THE FUNCTIONS IN THE MENU //********************************************************** class MENU { public : void MAIN_MENU(void) ; private : void EDIT_MENU(void) ; int CREATE_MENU(char*[], int, int, int) ;
34
int st1, st2 ; }; //********************************************************** // THIS CLASS CONTROL ALL THE FUNCTIONS RELATED TO PATIENTS //********************************************************** class PATIENT { public : void ADMIT(void) ; void DISCHARGE(void) ; void MODIFY(void) ; void LIST(void) ; void DISPLAY(void) ; friend BILL; private : //void MODIFY_RECORD(int,int,int,int,int); void DISPLAY_RECORD(int, int) ; void DISPLAY_RECORD1(int, int) ; //****MY DIFINE void DELETE_RECORD(int, int) ; void PRINT_BILL(void); int roomno, bedno, age, dd, mm, yy ,deposite; char name[26], address[36], phone[10], sex, disease[16], doctor[26] ; }; //********************************************************** // THIS CLASS CONTROL ALL THE FUNCTIONS RELATED TO ROOMS //********************************************************** class ROOM { public : void ADD_ROOMS(void) ; int AVAILABLE(int, int) ; int EMPTY(int) ; void CHANGE_STATUS(int, int, char) ; void LIST(void) ; int ROOMNO() ; int BEDNO(int) ; int LAST_ROOMNO(void) ; friend BILL; private :
35
int RECORDNO(int, int) ; int roomno, bedno ; char status ; }; //********************************************************** // THIS CLASS CONTROL ALL THE FUNCTIONS RELATED TO DOCTORS //********************************************************** class DOCTOR { public : void ADD(void) ; void DELETE(void) ; void LIST(void) ; char *DOCTOR_NAME(int) ; int RECORDS(void) ; void DEFAULT(void) ; friend BILL; private : char name[26] ; }; //********************************************************** //CLASS CONTRIL THE BILLING SYSTEM //********************************************************** class BILL { public: int r,n,d,m,y; //friend PATIENT; void print_bill() { title(); PATIENT p; p.DISPLAY_RECORD1(r,n); } }; //********************************************************** // THIS FUNCTION DRAWS THE HORRIZONTAL LINE //********************************************************** void LINES :: LINE_HOR(int column1, int column2, int row, char c) {
36
for ( column1; column1<=column2; column1++ ) { gotoxy(column1,row) ; cout <<c ; } } //********************************************************** // THIS FUNCTION DRAWS THE VERTICAL LINE //********************************************************** void LINES :: LINE_VER(int row1, int row2, int column, char c) { for ( row1; row1<=row2; row1++ ) { gotoxy(column,row1) ; cout <<c ; } } //********************************************************** // THIS FUNCTION DRAWS THE BOX //********************************************************** void LINES :: BOX(int column1, int row1, int column2, int row2, char c) { char ch=218 ; char c1, c2, c3, c4 ; char l1=196, l2=179 ; if (c == ch) { c1=218 ; c2=191 ; c3=192 ; c4=217 ; l1 = 196 ; l2 = 179 ; } else { c1=c ; c2=c ; c3=c ; c4=c ;
37
l1 = c ; l2 = c ; } gotoxy(column1,row1) ; cout <<c1 ; gotoxy(column2,row1) ; cout <<c2 ; gotoxy(column1,row2) ; cout <<c3 ; gotoxy(column2,row2) ; cout <<c4 ; column1++ ; column2-- ; LINE_HOR(column1,column2,row1,l1) ; LINE_HOR(column1,column2,row2,l1) ; column1-- ; column2++ ; row1++ ; row2-- ; LINE_VER(row1,row2,column1,l2) ; LINE_VER(row1,row2,column2,l2) ; } //********************************************************** // THIS FUNCTION CLEAR THE SCREEN LINE BY LINE UPWARD //********************************************************** void LINES :: CLEARUP(int start, int end) { for (int i=start; i>=end; i--) { delay(20) ; gotoxy(1,i) ; clreol() ; } } //********************************************************** // THIS FUNCTION CLEAR THE SCREEN LINE BY LINE DOWNWORD //********************************************************** void LINES :: CLEARDOWN(int start, int end) { for (int i=start; i<=end; i++) {
38
delay(20) ; gotoxy(1,i) ; clreol() ; } } //********************************************************** // THIS FUNCTION CONTROL ALL THE FUNCTIONS IN THE MAIN MENU //********************************************************** void MENU :: MAIN_MENU(void) { int ch=0 ; char *options[7]={ " ADMISSION ", " DISCHARGE ", " ROOM STATUS ", " PATIENT LIST ", " PATIENT RECORD ", " EDIT ", " QUIT " }; while (1) { st1 = 12 ; st2 = 8 ; textmode(C40) ; clrscr() ; textbackground(WHITE) ; textcolor(BLACK) ; gotoxy(13,8) ; cprintf("O P T I O N S ") ; textbackground(BLACK) ; textcolor(LIGHTGRAY) ; ch = CREATE_MENU(options,7,12,11) ; textmode(C80) ; clrscr() ; if (ch == 0) { PATIENT p ; p.ADMIT() ; } else if (ch == 1) { PATIENT p ;
39
p.DISCHARGE() ; } else if (ch == 2) { ROOM r ; r.LIST() ; } else if (ch == 3) { PATIENT p ; p.LIST() ; } else if (ch == 4) { PATIENT p ; p.DISPLAY() ; } else if (ch == 5) EDIT_MENU() ; else if (ch == 6) break ; } } //********************************************************** // THIS FUNCTION CONTROL ALL THE FUNCTIONS IN THE EDIT MENU //********************************************************** void MENU :: EDIT_MENU(void) { int ch=0 ; char *options[5]={ " ADD ROOMS ", " ADD DOCTOR RECORD ", " DELETE DOCTOR RECORD ", " RETURN " }; while (1) { st1 = 14 ;
40
st2 = 10 ; textmode(C40) ; clrscr() ; textbackground(WHITE) ; textcolor(BLACK) ; gotoxy(15,10) ; cprintf("EDIT MENU ") ; textbackground(BLACK) ; textcolor(LIGHTGRAY) ; ch = CREATE_MENU(options,5,8,13) ; textmode(C80) ; clrscr() ; if (ch == 0) { ROOM r ; r.ADD_ROOMS() ; } else if (ch == 1) { DOCTOR d ; d.ADD() ; } else if (ch == 2) { DOCTOR d ; d.DELETE() ; } else if (ch == 3) break ; } } //********************************************************** // THIS FUNCTION CREATE MENU FOR THE GIVEN OPTIONS //********************************************************** int MENU :: CREATE_MENU(char *options[], int size, int y, int x) { int valid ; int n = 0 ; char ch1, ch2 ; char chr1=219 ;
41
char c1=24, c2=25 ; gotoxy(3,24) ; cout <<c1 ; cout <<c2 ; cout <<"=Move <ENTER>=Select <ESC>=Exit" ; gotoxy(st1,st2) ; cout <<chr1 ; int t = x ; for (int i=0; i<size; i++) { gotoxy(y,t) ; cout <<options[i] ; t++ ; } textbackground(WHITE) ; textcolor(BLACK) ; gotoxy(y,x) ; cprintf("%s",options[n]) ; textbackground(BLACK) ; textcolor(LIGHTGRAY) ; gotoxy(st1,st2) ; do { do { do { ch1 = getch() ; if ( ch1 == 27 ) return(size-1) ; } while (( ch1 != 0 ) && ( ch1 != 13 )) ; if ( ch1 != 13 ) { do { ch2 = getch() ; if ( ch2 == 27 ) return(size-1) ; } while ((ch2 != 72) && (ch2 != 80) && (ch2 != 13)) ; } } while (((ch1 != 0) || ((ch2 != 72) && (ch2 != 80))) && ((ch1 != 13) && (ch2 != 13))) ; if ((ch1 == 0) && (ch2 == 80)) { textbackground(BLACK) ; textcolor(LIGHTGRAY) ; gotoxy(y,x) ; cprintf("%s",options[n]) ; if (n == size-1)
42
{ n=0; x = x - (size-1) ; } else { n++ ; x++ ; } textbackground(WHITE) ; textcolor(BLACK) ; gotoxy(y,x) ; cprintf("%s",options[n]) ; textbackground(BLACK) ; textcolor(LIGHTGRAY) ; gotoxy(st1,st2) ; } if ((ch1 == 0) && (ch2 == 72)) { textbackground(BLACK) ; textcolor(LIGHTGRAY) ; gotoxy(y,x) ; cprintf("%s",options[n]) ; if ( n == 0 ) { n = size-1 ; x = x + (size-1) ; } else { n-- ; x-- ; } textbackground(WHITE) ; textcolor(BLACK) ; gotoxy(y,x) ; cprintf("%s",options[n]) ; textbackground(BLACK) ; textcolor(LIGHTGRAY) ; gotoxy(st1,st2) ; } } while (( ch1 != 13 ) && ( ch2 != 13 )) ; return n ; } //********************************************************** // THIS FUNCTION RETURNS THE CODE OF LAST ROOM NO. //********************************************************** int ROOM :: LAST_ROOMNO(void)
43
{ fstream file ; file.open("ROOMS.DAT", ios::in) ; if (file.fail()) { file.close() ; return 0 ; } int last=0 ; while (file.read((char *) this, sizeof(ROOM))) last = roomno ; file.close() ; return last ; } //********************************************************** // THIS FUNCTION ADDS ROOMS TO THE FILE //********************************************************** void ROOM :: ADD_ROOMS(void) { clrscr() ; char ch ; do { gotoxy(5,5) ; clreol() ; cout <<"Do you want to add rooms (y/n) " ; ch = getche() ; ch = toupper(ch) ; } while (ch != 'Y' && ch != 'N') ; if (ch == 'N') return ; int rno = LAST_ROOMNO() + 1 ; int bno=1 ; fstream file ; file.open("ROOMS.DAT", ios::app) ; for (int i=1; i<=2; i++) { roomno = rno ; bedno = bno ; status = 'A' ; file.write((char *) this, sizeof(ROOM)) ; bno = 2 ; } LINES line ;
44
line.BOX(8,9,42,15,218) ; gotoxy(10,10) ; cout <<"Room no. : " <<rno ; gotoxy(10,11) ; cout <<"Total no. of beds : 2" ; gotoxy(10,12) ; cout <<"STATUS:" ; gotoxy(20,13) ; cout <<"Bed no. 1 : Available" ; gotoxy(20,14) ; cout <<"Bed no. 2 : Available" ; file.close() ; gotoxy(5,24) ; cout <<"\7Room Added" ; gotoxy(5,25) ; cout <<"Press any key to continue..." ; getch() ; } //********************************************************** // THIS FUNCTION RETURNS 0 IF GIVEN ROOM IS NOT EMPTY //********************************************************** int ROOM :: EMPTY(int rno) { fstream file ; file.open("ROOMS.DAT", ios::in) ; int empty=1 ; while (file.read((char *) this, sizeof(ROOM))) { if (roomno == rno && status == 'N') { empty = 0 ; break ; } } file.close() ; return empty ; } //********************************************************** // THIS FUNCTION RETURNS 0 IF GIVEN BED NO. OF THE ROOM IS // NOT AVAILABLE //**********************************************************
45
int ROOM :: AVAILABLE(int rno, int bno) { fstream file ; file.open("ROOMS.DAT", ios::in) ; int avail=0 ; while (file.read((char *) this, sizeof(ROOM))) { if (roomno == rno && bedno == bno && status == 'A') { avail = 1 ; break ; } } file.close() ; return avail ; } //********************************************************** // THIS FUNCTION RETURNS RECORD NO. OF THE GIVEN ROOM AND // BED NO. //********************************************************** int ROOM :: RECORDNO(int rno, int bno) { fstream file ; file.open("ROOMS.DAT", ios::in) ; int recordno=0 ; while (file.read((char *) this, sizeof(ROOM))) { recordno++ ; if (roomno == rno && bedno == bno) break ; } file.close() ; return recordno ; } //********************************************************** // THIS FUNCTION DISPLAY THE LIST OF THE ROOMS //********************************************************** void ROOM :: LIST(void) {
46
clrscr() ; int row = 4, flag ; int sta = 0 ; char ch ; textbackground(WHITE) ; textcolor(BLACK) ; gotoxy(30,1); cprintf("ROOM STATUS"); gotoxy(1,3) ; cprintf("Room no. Bed no. Status ") ;
textbackground(BLACK) ; textcolor(LIGHTGRAY) ; fstream file ; file.open("ROOMS.DAT", ios::in) ; if (file.fail()) { gotoxy(5,10) ; cout <<"\7Records not found" ; getch() ; file.close() ; return ; } while (file.read((char *) this, sizeof(ROOM))) { flag = 0 ; delay(20) ; gotoxy(2,row) ; cout <<roomno ; gotoxy(12,row) ; cout <<bedno ; gotoxy(23,row) ; cout <<status ; if (status == 'A') sta++ ; file.read((char *) this, sizeof(ROOM)) ; gotoxy(41,row) ; cout <<roomno ; gotoxy(51,row) ; cout <<bedno ; gotoxy(62,row) ; cout <<status ; if (status == 'A') sta++ ; if (row == 22) {
47
flag = 1 ; gotoxy(1,25) ; cout <<"Press any key to continue..." ; ch = getch() ; if (ch == 27) break ; row = 3 ; } else row++ ; } if (!flag) { gotoxy(1,25) ; cout <<"Press any key to continue..." ; getch() ; } LINES line ; line.CLEARDOWN(3,25) ; gotoxy(1,16) ; cout <<"Total room : " <<roomno ; gotoxy(1,17) ; cout <<"Total occupied beds : " <<(roomno*2)-sta ; textbackground(WHITE) ; textcolor(BLACK) ; gotoxy(1,18) ; cprintf("Total available beds : %d",sta) ; textbackground(BLACK) ; textcolor(LIGHTGRAY) ; gotoxy(1,25) ; cout <<"Press any key to continue..." ; getch() ; line.CLEARUP(25,1) ; } int ROOM :: ROOMNO(void) { fstream file ; file.open("ROOMS.DAT", ios::in) ; int rno=0 ; while (file.read((char *) this, sizeof(ROOM))) { if (status == 'A') { rno = roomno ;
48
break ; } } file.close() ; return rno ; } int ROOM :: BEDNO(int rno) { fstream file ; file.open("ROOMS.DAT", ios::in) ; int bno=0 ; while (file.read((char *) this, sizeof(ROOM))) { if (rno == roomno && status == 'A') { bno = bedno ; break ; } } file.close() ; return bno ; } void ROOM :: CHANGE_STATUS(int rno, int bno, char rstatus) { fstream file ; file.open("ROOMS.DAT", ios::in) ; fstream temp ; temp.open("temp.dat", ios::out) ; file.seekg(0,ios::beg) ; while (!file.eof()) { file.read((char *) this, sizeof(ROOM)) ; if (file.eof()) break ; if (rno == roomno && bno == bedno) { status = rstatus ; temp.write((char *) this, sizeof(ROOM)) ; } else temp.write((char *) this, sizeof(ROOM)) ; }
49
file.close() ; temp.close() ; file.open("ROOMS.DAT", ios::out) ; temp.open("temp.dat", ios::in) ; temp.seekg(0,ios::beg) ; while (!temp.eof()) { temp.read((char *) this, sizeof(ROOM)) ; if (temp.eof()) break ; file.write((char *) this, sizeof(ROOM)) ; } file.close() ; temp.close() ; } //********************************************************** // THIS FUNCTION ADD NAME OF DOCTOR IN THE FILE //********************************************************** void DOCTOR :: ADD(void) { clrscr() ; if (RECORDS() >= 20) { gotoxy(5,10) ; cout <<"Sorry no more records can be added" ; getch() ; return ; } char ch ; do { gotoxy(5,5) ; clreol() ; cout <<"Do you want to add Doctors (y/n) " ; ch = getche() ; ch = toupper(ch) ; } while (ch != 'Y' && ch != 'N') ; if (ch == 'N') return ; LIST() ; int valid ; do { valid = 1 ;
50
gotoxy(5,25) ; clreol() ; cout <<"Enter the name of the New Doctor" ; gotoxy(5,7) ; clreol() ; cout <<"Name : " ; gets(name) ; strupr(name) ; if (strlen(name) < 1 || strlen(name) > 25) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"\7Enter correctly (Range: 1..25)" ; getch() ; } } while (!valid) ; gotoxy(5,25) ; clreol() ; fstream file ; file.open("DOCTOR.DAT", ios::app) ; file.write((char *) this, sizeof(DOCTOR)) ; file.close() ; LIST() ; gotoxy(5,24) ; cout <<"Doctor Name Added" ; gotoxy(5,25) ; cout <<"Press any key to continue..." ; getch() ; } //********************************************************** // THIS FUNCTION ADD A NAME OF DOCTOR AS A DEFAULT RECORD //********************************************************** void DOCTOR :: DEFAULT(void) { fstream file ; file.open("DOCTOR.DAT",ios::out) ; strcpy(name,"RAKESH PRASAD") ; file.write((char *) this, sizeof(DOCTOR)) ; file.close() ; }
51
void DOCTOR :: LIST(void) { int row = 13, col=2, sno=1 ; char ch ; textbackground(WHITE) ; textcolor(BLACK) ; gotoxy(1,11) ; clreol() ; cprintf("S.No. Name ") ; textbackground(BLACK) ; textcolor(LIGHTGRAY) ; fstream file ; file.open("DOCTOR.DAT", ios::in) ; while (file.read((char *) this, sizeof(DOCTOR))) { delay(20) ; gotoxy(col,row) ; cout <<sno ; gotoxy(col+6,row) ; cout <<name ; if (row == 22) { row = 13 ; col = 40 ; } else { sno++ ; row++ ; } } } //********************************************************** // THIS FUNCTION RETURNS NO. OF RECORDS IN THE DOCTOR'S FILE //********************************************************** int DOCTOR :: RECORDS(void) { fstream file ; file.open("DOCTOR.DAT", ios::in) ; int records=0 ; while (file.read((char *) this, sizeof(DOCTOR))) records++ ; file.close() ;
52
return records ; } //********************************************************** // THIS FUNCTION RETURNS NAME OF THE DOCTOR //********************************************************** char *DOCTOR :: DOCTOR_NAME(int pd) { fstream file ; file.open("DOCTOR.DAT", ios::in) ; int i=0 ; while (file.read((char *) this, sizeof(DOCTOR))) { i++ ; if (i == pd) break ; } file.close() ; return name ; } //********************************************************** // THIS FUNCTION DELETES DOCTOR RECORD IN DOCTOR FILE //********************************************************** void DOCTOR :: DELETE(void) { clrscr() ; LIST() ; char t1[5] ; int t2, sno ; do { gotoxy(5,5) ; clreol() ; cout <<"Enter S.No. of the Doctor to be Deleted " ; gets(t1) ; t2 = atof(t1) ; if (t1[0] == '0') return ; sno = t2 ; } while (sno < 1 || sno > RECORDS()) ; fstream file ; file.open("DOCTOR.DAT", ios::in) ;
53
fstream temp ; temp.open("temp.dat", ios::out) ; file.seekg(0,ios::beg) ; int i=0 ; while (!file.eof()) { file.read((char *) this, sizeof(DOCTOR)) ; i++ ; if (file.eof()) break ; if (i != sno) temp.write((char *) this, sizeof(DOCTOR)) ; } file.close() ; temp.close() ; file.open("DOCTOR.DAT", ios::out) ; temp.open("temp.dat", ios::in) ; temp.seekg(0,ios::beg) ; while (!temp.eof()) { temp.read((char *) this, sizeof(DOCTOR)) ; if (temp.eof()) break ; file.write((char *) this, sizeof(DOCTOR)) ; } file.close() ; temp.close() ; LINES line ; line.CLEARDOWN(13,23) ; LIST() ; gotoxy(5,7) ; cout <<"\7Record Deleted" ; gotoxy(5,25) ; cout <<"Press any key to continue..." ; getch() ; } //*************** PATIENT RECORD ********************************* //****************************************************************** void PATIENT :: ADMIT(void) { int t2, rno, bno, page, pd ,deposite1=1000; char t1[5], pname[26], paddress[36], pphone[10], psex, pdisease[16], pdoctor[26], ch ; int d1, m1, y1, valid ; ROOM r ;
54
rno = r.ROOMNO() ; if (rno == 0) { gotoxy(5,10) ; cout <<"\7Sorry no. room is available for the Patient" ; getch() ; return ; } bno = r.BEDNO(rno) ; struct date d; getdate(&d); d1 = d.da_day ; m1 = d.da_mon ; y1 = d.da_year ; textcolor(BLACK) ; textbackground(WHITE) ; gotoxy(5,1) ; cprintf("Date: %d/%d/%d",d1,m1,y1) ; gotoxy(60,1) ; cprintf("Room no.: %d",rno) ; gotoxy(60,2) ; cprintf("Bed no. : %d",bno) ; textcolor(LIGHTGRAY) ; textbackground(BLACK) ; gotoxy(5,3) ; cout <<"Name : " ; gotoxy(5,4) ; cout <<"Address : " ; gotoxy(5,5) ; cout <<"Phone : " ; gotoxy(5,6) ; cout <<"Age : " ; gotoxy(5,7) ; cout <<"Sex : " ; gotoxy(5,8); cout <<"Deposite:"<<deposite1; do { valid = 1 ; gotoxy(5,25) ; clreol() ; cout <<"ENTER NAME OF THE PATIENT" ; gotoxy(15,3) ; clreol() ; gets(pname) ; strupr(pname) ; if (pname[0] == '0') return ; if (strlen(pname) < 1 || strlen(pname) > 25) {
55
valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"\7Enter correctly (Range: 1..25)" ; getch() ; } } while (!valid) ; do { valid = 1 ; gotoxy(5,25) ; clreol() ; cout <<"ENTER ADDRESS OF THE PATIENT" ; gotoxy(15,4) ; clreol() ; gets(paddress) ; strupr(paddress) ; if (paddress[0] == '0') return ; if (strlen(paddress) < 1 || strlen(paddress) > 35) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"\7Enter correctly (Range: 1..35)" ; getch() ; } } while (!valid) ; do { valid = 1 ; gotoxy(5,25) ; clreol() ; cout <<"ENTER PHONE NO. OF THE PATIENT or <ENTER> FOR NONE" ; gotoxy(15,5) ; clreol() ; gets(pphone) ; if (pphone[0] == '0') return ; if ((strlen(pphone) < 7 && strlen(pphone) > 0) || (strlen(pphone) > 9)) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"\7Enter correctly" ; getch() ; } } while (!valid) ; do { valid = 1 ; gotoxy(5,25) ; clreol() ;
56
cout <<"ENTER AGE OF THE PATIENT" ; gotoxy(15,6) ; clreol() ; gets(t1) ; t2 = atof(t1) ; page = t2 ; if (t1[0] == '0') return ; if (page < 1 || page > 100) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"\7ENTER CORRECTLY" ; getch() ; } } while (!valid) ; do { gotoxy(5,25) ; clreol() ; cout <<"ENTER SEX OF THE PATIENT (M/F)" ; gotoxy(15,7) ; clreol() ; psex = getche() ; psex = toupper(psex) ; } while (psex != 'M' && psex != 'F') ; do { valid = 1 ; gotoxy(5,25) ; clreol() ; cout <<"ENTER DISEASE OF THE PATIENT" ; gotoxy(5,8) ; clreol() ; cout <<"Disease : " ; gets(pdisease) ; strupr(pdisease) ; if (pdisease[0] == '0') return ; if (strlen(pdisease) < 1 || strlen(pdisease) > 15) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"\7Enter correctly (Range: 1..15)" ; getch() ; } } while (!valid) ; gotoxy(5,25) ; clreol() ; DOCTOR dr ; fstream file ; file.open("DOCTOR.DAT", ios::in) ;
57
if (file.fail()) dr.DEFAULT() ; file.close() ; dr.LIST() ; do { valid = 1 ; gotoxy(5,25) ; clreol() ; gotoxy(5,24) ; clreol() ; cout <<"ENTER S.No. OF THE DOCTOR " ; gets(t1) ; t2 = atof(t1) ; pd = t2 ; if (t1[0] == '0') return ; if (pd < 1 || pd > dr.RECORDS()) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"\7ENTER CORRECTLY" ; getch() ; } } while (!valid) ; strcpy(pdoctor,dr.DOCTOR_NAME(pd)) ; LINES line ; line.CLEARUP(25,10) ; gotoxy(5,10) ; cout <<"Doctor Assigned : Dr." <<pdoctor ; do { gotoxy(5,13) ; clreol() ; cout <<"Do you want to save (y/n) " ; ch = getche() ; ch = toupper(ch) ; } while (ch != 'Y' && ch != 'N') ; if (ch == 'N') return ; r.CHANGE_STATUS(rno,bno,'N') ; roomno = rno ; bedno = bno ; strcpy(name,pname) ; strcpy(address,paddress) ; strcpy(phone,pphone) ; age = page ; sex = psex ;
58
dd = d1 ; mm = m1 ; yy = y1 ; strcpy(disease,pdisease) ; deposite=deposite1; //ENTER BY MYSELF strcpy(doctor,pdoctor) ; file.open("PATIENT.DAT", ios::app) ; file.write((char *) this, sizeof(PATIENT)) ; file.close() ; } //********************************************************** // THIS FUNCTION DISPLAYS THE LIST OF THE PATIENTS //********************************************************** void PATIENT :: LIST(void) { clrscr() ; int row = 5 , found=0, flag=0 ; char ch ; textcolor(BLACK+BLINK) ; textbackground(WHITE) ; gotoxy(31,1) ; cprintf(" LIST OF PATIENTS ") ; textcolor(BLACK) ; gotoxy(1,3) ; clreol() ; gotoxy(1,3) ; cout <<"ROOM NO. BED NO. PATIENT'S NAME" ; textcolor(LIGHTGRAY) ; textbackground(BLACK) ; fstream file ; file.open("PATIENT.DAT", ios::in) ; file.seekg(0,ios::beg) ; while (file.read((char *) this, sizeof(PATIENT))) { flag = 0 ; delay(20) ; found = 1 ; gotoxy(3,row) ; cout <<roomno ; gotoxy(15,row) ; cout <<bedno ; gotoxy(28,row) ; cout <<name ; if ( row == 23 ) { flag = 1 ;
59
row = 5 ; gotoxy(1,25) ; cout <<"Press any key to continue or Press <ESC> to exit" ; ch = getch() ; if (ch == 27) break ; clrscr() ; textcolor(BLACK) ; textbackground(WHITE) ; gotoxy(31,1) ; cout <<" LIST OF PATIENTS " ; gotoxy(1,3) ; clreol() ; gotoxy(1,3) ; cout <<"ROOM NO. BED NO. PATIENT'S NAME" ; textcolor(LIGHTGRAY) ; textbackground(BLACK) ; } else row++ ; } if (!found) { gotoxy(5,10) ; cout <<"\7Records not found" ; } if (!flag) { gotoxy(1,25) ; cout <<"Press any key to continue..." ; getche() ; } file.close () ; } void PATIENT :: DISPLAY_RECORD(int rno, int bno) { fstream file ; file.open("PATIENT.DAT", ios::in) ; file.seekg(0,ios::beg) ; while (file.read((char *) this, sizeof(PATIENT))) { if (rno == roomno && bno == bedno) { textcolor(BLACK) ; textbackground(WHITE) ; gotoxy(5,1) ; cprintf("Date of Admit : %d/%d/%d",dd,mm,yy) ; gotoxy(60,1) ;
60
cprintf("Room no.: %d",roomno) ; gotoxy(60,2) ; cprintf("Bed no. : %d",bedno) ; textcolor(LIGHTGRAY) ; textbackground(BLACK) ; gotoxy(5,3) ; cout <<"Name : " <<name ; gotoxy(5,4) ; cout <<"Address : " <<address ; gotoxy(5,5) ; cout <<"Phone : " <<phone ; gotoxy(5,6) ; cout <<"Age : " <<age ; gotoxy(5,7) ; cout <<"Sex : " <<sex ; gotoxy(5,8) ; cout <<"Disease : " <<disease ; gotoxy(5,9); cout <<"Deposite :" <<deposite; gotoxy(5,10) ; cout <<"Doctor Assigned : Dr." <<doctor ; break ; } } file.close() ; } //************************ MY DIFINE********************************** void PATIENT :: DISPLAY_RECORD1(int rno, int bno) { fstream file ; file.open("PATIENT.DAT", ios::in) ; file.seekg(0,ios::beg) ; while (file.read((char *) this, sizeof(PATIENT))) { if (rno == roomno && bno == bedno) { textcolor(BLACK) ; textbackground(WHITE) ; gotoxy(5,1) ; cprintf("Date of Admit : %d/%d/%d",dd,mm,yy) ; // gotoxy(60,1) ; // cprintf("Room no.: %d",roomno) ; // gotoxy(60,2) ; // cprintf("Bed no. : %d",bedno) ; // textcolor(LIGHTGRAY) ; textbackground(BLACK) ; gotoxy(20,1) ;
61
/* cout*/ print<<"Name : " <<name ; gotoxy(5,2) ; cout <<"Address : " <<address ; gotoxy(20,2) ; // /*cout*/ <<"Phone : " <<phone ; gotoxy(5,3) ; cout <<"Age : " <<age ; gotoxy(20,3) ; cout <<"Sex : " <<sex ; gotoxy(5,4) ; cout <<"Disease : " <<disease ; gotoxy(20,4); cout <<"Deposite :" <<deposite; gotoxy(5,5) ; cout <<"Doctor Assigned : Dr." <<doctor ; break ; } } file.close() ; } //************************ CLOSE *************************** //******************** DISPLAY ******************************** void PATIENT :: DISPLAY(void) { clrscr() ; char t1[5], ch ; int rno, bno, valid, t2 ; ROOM r ; do { valid = 1 ; gotoxy(5,5) ; cout <<"Room no. : " ; gotoxy(5,7) ; cout <<"Bed no. : " ; gotoxy(5,25) ; clreol() ; cout <<"ENTER ROOM NO. OF THE PATIENT or <ENTER> FOR HELP" ; gotoxy(16,5) ; clreol() ; gets(t1) ; t2 = atof(t1) ; rno = t2 ; if (t1[0] == '0') return ; if (strlen(t1) == 0)
62
{ valid = 0 ; r.LIST() ; clrscr() ; } if ((rno < 1 || rno > r.LAST_ROOMNO()) && valid) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"\7ENTER CORRECTLY" ; getch() ; } } while (!valid) ; do { valid = 1 ; gotoxy(5,5) ; cout <<"Room no. : " <<rno ; gotoxy(5,7) ; cout <<"Bed no. : " ; gotoxy(5,25) ; clreol() ; cout <<"ENTER BED NO. OF THE PATIENT or <ENTER> FOR HELP" ; gotoxy(16,7) ; clreol() ; gets(t1) ; t2 = atof(t1) ; bno = t2 ; if (t1[0] == '0') return ; if (strlen(t1) == 0) { valid = 0 ; r.LIST() ; clrscr() ; } if ((bno < 1 || bno > 2) && valid) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"\7ENTER CORRECTLY" ; getch() ; } } while (!valid) ; gotoxy(5,25) ; clreol() ; if (r.AVAILABLE(rno,bno)) {
63
gotoxy(5,20) ; cout <<"\7Sorry, there is no. Patient in this Room no." ; getch() ; return ; } clrscr() ; DISPLAY_RECORD(rno,bno) ; gotoxy(5,25) ; cout <<"Press any key to continue..." ; getch() ; } void PATIENT :: DELETE_RECORD(int rno, int bno) { fstream file ; file.open("PATIENT.DAT", ios::in) ; fstream temp ; temp.open("temp.dat", ios::out) ; file.seekg(0,ios::beg) ; while (!file.eof()) { file.read((char *) this, sizeof(PATIENT)) ; if (file.eof()) break ; if (rno != roomno || bno != bedno) temp.write((char *) this, sizeof(PATIENT)) ; } file.close() ; temp.close() ; file.open("PATIENT.DAT", ios::out) ; temp.open("temp.dat", ios::in) ; temp.seekg(0,ios::beg) ; while (!temp.eof()) { temp.read((char *) this, sizeof(PATIENT)) ; if (temp.eof()) break ; file.write((char *) this, sizeof(PATIENT)) ; } file.close() ; temp.close() ; } void PATIENT :: DISCHARGE(void)
64
{ clrscr() ; char t1[5], ch ; int rno, bno, valid, t2, t_r_room,d_fee,mis_exp; ROOM r ; do { valid = 1 ; gotoxy(5,5) ; cout <<"Room no. : " ; gotoxy(5,7) ; cout <<"Bed no. : " ; gotoxy(5,25) ; clreol() ; cout <<"ENTER ROOM NO. OF THE PATIENT or <ENTER> FOR HELP" ; gotoxy(16,5) ; clreol() ; gets(t1) ; t2 = atof(t1) ; rno = t2 ; if (t1[0] == '0') return ; if (strlen(t1) == 0) { valid = 0 ; r.LIST() ; clrscr() ; } if ((rno < 1 || rno > r.LAST_ROOMNO()) && valid) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"\7ENTER CORRECTLY" ; getch() ; } } while (!valid) ; do { valid = 1 ; gotoxy(5,5) ; cout <<"Room no. : " <<rno ; gotoxy(5,7) ; cout <<"Bed no. : " ; gotoxy(5,25) ; clreol() ; cout <<"ENTER BED NO. OF THE PATIENT or <ENTER> FOR HELP" ; gotoxy(16,7) ; clreol() ;
65
gets(t1) ; t2 = atof(t1) ; bno = t2 ; if (t1[0] == '0') return ; if (strlen(t1) == 0) { valid = 0 ; r.LIST() ; clrscr() ; } if ((bno < 1 || bno > 2) && valid) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"\7ENTER CORRECTLY" ; getch() ; } } while (!valid) ; gotoxy(5,25) ; clreol() ; if (r.AVAILABLE(rno,bno)) { gotoxy(5,20) ; cout <<"\7Sorry, there is no. Patient in this Room no." ; getch() ; return ; } clrscr() ; // gotoxy(5,1); // title(); // show the name of hospital DISPLAY_RECORD(rno,bno) ;//see line no:- (5,3)----(5,10) // cout<<"\n"; do { gotoxy(5,13) ; clreol() ; cout <<"Discharge this Patient (y/n) " ; ch = getche() ; ch = toupper(ch) ; } while (ch != 'Y' && ch != 'N') ; if (ch == 'N') return ; r.CHANGE_STATUS(rno,bno,'A') ; DELETE_RECORD(rno,bno) ; LINES line ; line.CLEARDOWN(1,22) ;
66
gotoxy(5,23) ; cout <<"\7Record Deleted" ; gotoxy(5,25) ; cout <<"Press any key to continue..." ; getch() ; } void PATIENT :: MODIFY(void) { clrscr() ; char t1[5], ch ; int rno, bno, valid, t2 ; ROOM r ; do { valid = 1 ; gotoxy(5,5) ; cout <<"Room no. : " ; gotoxy(5,7) ; cout <<"Bed no. : " ; gotoxy(5,25) ; clreol() ; cout <<"ENTER ROOM NO. OF THE PATIENT or <ENTER> FOR HELP" ; gotoxy(16,5) ; clreol() ; gets(t1) ; t2 = atof(t1) ; rno = t2 ; if (t1[0] == '0') return ; if (strlen(t1) == 0) { valid = 0 ; r.LIST() ; clrscr() ; } if ((rno < 1 || rno > r.LAST_ROOMNO()) && valid) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"\7ENTER CORRECTLY" ; getch() ; } } while (!valid) ; do {
67
valid = 1 ; gotoxy(5,5) ; cout <<"Room no. : " <<rno ; gotoxy(5,7) ; cout <<"Bed no. : " ; gotoxy(5,25) ; clreol() ; cout <<"ENTER BED NO. OF THE PATIENT or <ENTER> FOR HELP" ; gotoxy(16,7) ; clreol() ; gets(t1) ; t2 = atof(t1) ; bno = t2 ; if (t1[0] == '0') return ; if (strlen(t1) == 0) { valid = 0 ; r.LIST() ; clrscr() ; } if ((bno < 1 || bno > 2) && valid) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"\7ENTER CORRECTLY" ; getch() ; } } while (!valid) ; gotoxy(5,25) ; clreol() ; if (r.AVAILABLE(rno,bno)) { gotoxy(5,20) ; cout <<"\7Sorry, there is no. Patient in this Room no." ; getch() ; return ; } clrscr() ; DISPLAY_RECORD(rno,bno); do { gotoxy(5,13) ; clreol() ; cout <<"Modify this Patient Record (y/n) " ; ch = getche() ; ch = toupper(ch) ; } while (ch != 'Y' && ch != 'N') ;
68
if (ch == 'N') return ; do { valid = 1 ; clrscr() ; gotoxy(29,1) ; cout <<"MODIFY PATIENT RECORD" ; gotoxy(29,2) ; cout <<"~~~~~~~~~~~~~~~~~~~~~" ; gotoxy(5,4) ; cout <<"Room no. : " ; gotoxy(5,6) ; cout <<"Bed no. : " ; do { valid = 1 ; gotoxy(5,25) ; clreol() ; cout <<"ENTER ROOM NO. OF THE PATIENT" ; gotoxy(16,4) ; clreol() ; gets(t1) ; t2 = atof(t1) ; rno = t2 ; if (t1[0] == '0') return ; if (rno < 1 || rno > r.LAST_ROOMNO()) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"\7ENTER CORRECTLY" ; getch() ; } } while (!valid) ; do { valid = 1 ; gotoxy(5,25) ; clreol() ; cout <<"ENTER BED NO. OF THE PATIENT" ; gotoxy(16,6) ; clreol() ; gets(t1) ; t2 = atof(t1) ; bno = t2 ; if (t1[0] == '0') return ; if (bno < 1 || bno > 2)
69
{ valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"\7ENTER CORRECTLY" ; getch() ; } } while (!valid) ; gotoxy(5,25) ; clreol() ; if (!r.AVAILABLE(rno,bno) && (rno != rno || bno != bno)) { valid = 0 ; gotoxy(5,20) ; cout <<"\7Sorry, there is already a Patient in this Room no." ; getch() ; } } while (!valid) ; DOCTOR dr ; dr.LIST() ; do { valid = 1 ; gotoxy(5,25) ; clreol() ; gotoxy(5,24) ; clreol() ; cout <<"ENTER S.No. OF THE DOCTOR " ; gets(t1) ; t2 = atof(t1) ; int pd; char pdoctor[15]; pd = t2 ; if (t1[0] == '0') return ; if (pd < 1 || pd > dr.RECORDS()) { valid = 0 ; gotoxy(5,25) ; clreol() ; cout <<"\7ENTER CORRECTLY" ; getch() ; } } while (!valid) ; char pdoctor[15]; int pd; strcpy(pdoctor,dr.DOCTOR_NAME(pd)) ; LINES line ; line.CLEARUP(25,10) ; gotoxy(5,8) ; cout <<"Doctor Assigned : Dr." <<pdoctor ;
70
r.CHANGE_STATUS(rno,bno,'A') ; r.CHANGE_STATUS(rno,bno,'N') ; // MODIFY_RECORD(rno,bno,rno,bno,pdoctor) ; gotoxy(5,23) ; cout <<"\7Record Modified" ; gotoxy(5,25) ; cout <<"Press any key to continue..." ; getch() ; }
71
72
73
74
Add rooms : This page is to add new rooms in the hospital. This shows availability of rooms.
75
76
77
78
79
80
81
82
83
84
TESTING
Testing is the process of executing a program with the intent of finding errors in software development process, errors can be injected at any stages during development. There are various techniques that are used for detecting and eliminating errors but no method is perfect because most of the verification methods of earlier phases are manual. During testing, the program to be tested is executed with a test case is evaluate to determine if the program is performing as expected. Testing is a set of activities that can be planned in advance and conducted systematically. Its a process of analyzing a software item to detect the difference between existing and required conditions (i.e. bugs) and to evaluate the features of the software items.
Test case designs are constructed for each path and for all logical decisions, and boundary values conditions. There are four paths in the process flow and therefore four test case designs would be built to test path processing. A test case will test whether logical decisions are made through condition testing and on that result whether control of process moves to the appropriate branch. The white-box testing can be applied to the operations defined for a class basis path, loop testing, or data flow techniques can help to ensure that every statement in an operation has been tested. However, the concise structure of many class operations causes some to argue that the effort applied to white box testing might be better redirected to tests at a class level. Black box testing methods are as appropriate for Object Oriented System as they are for Systems developed using conventional Software engineering methods.
UNIT TESTING
Unit testing focuses verification effort on the smallest unit of software design the software component or module. Using the component level design description as a guide, important control paths are tested to uncover errors within the boundary of the module. The relative complexity of tests and the errors those tests uncover is limited by the constrained scope established for unit testing. The unit test focuses on the internal processing login and data structures within the boundaries of a component. This typw of testing can be conducted in parallel for multiple components.
85
Module
Interface Local data structures Boundary Conditions Independent paths Error handling paths
Test Codes
The module interface is tested to ensure that information properly flows into and out of the program unit under test local data structures are examined to ensure that data stored temporarily maintains its integrity during all steps an algorithm execution. All independent paths through the control structure are exercised to ensure that all statements in a module have been executed at once. For unit testing two testing techniques are applied : white box testing and black box testing.
WHITE BOX TESTING
a) b) c) d)
White box testing, sometimes called glass box testing, uses the flow and control structure of the process to derive the test case design white box testing is carried out to test whether . All paths in a process are correctly operational. All logical decisions are executed with true or false conditions. All loops are executed with their limit values tested. To ascertain whether input data structure specifications are tested and then used for other processing. In order to handle complexities of unit level
86
processing, test case designs are built after drawing process flow charts and flow graphs.
PROCESS FLOW CHART Logical Sequence Loop Logical Design Process Logical design If
Sta rt
1 1 2 7 stop 3 1 4
While 7
6 8 stop
7 7
Analysis of process flow chart reveals following process paths: Start -1 7 stop Start 1 -2 3 -3 4 - 8 stop Start 1 2 3 6 - 1 (Loop) Start 1 2 3 5 1 (Loop)
BLACK BOX TESTING
Stop
87
Black box testing is also called behavioral testing, concentrates on functions and features of the software. Black box testing is not an alternative to white box testing, but is complementary to it. Black box testing confirms whether for a give valid input, the software executes correctly to produce the required results. Black box testing discovers errors that are not revealed by white box testing. The errors discovered through black box testing are:Incorrect function Missing function Interface errors not able to receive or send the data to other Systems. Incorrect pre conditions resulting into incorrect function processing Incorrect terminal conditions not responding to stoppage or continues to execute the function. Erroneous processing even though data structure is not correct.
CONCLUSION
As a student of BCA (3 years) I have done this project according to my level of technical knowledge and expertise but in future this project can be enhanced by using advanced technology so that it can become more user friendly and technically advanced besides that more functionalities can also be given to the software.
FUTURE SCOPE
The scope of Hospital Management System is : Large patient database can be accommodated in our application in the future. Necessary steps can be taken to develop/ revise all the documents preferably the patient bill make more understandable to the patient as well as to the departmental staff. Necessary steps can be taken in the proposed system to accommodate the forth coming changes regarding the course scheduling.
88
The formats of different types of reports can be made to suite the requirements.
BIBLOGRAPHY
BOOKS:
1. Roger S Pressman, Software Engineering and practitioners
Approach, Tata Mc Graw Hill ,6th edition. 2. Waman S Jawadekar, Software Engineering principles and practice. 3. E. Balaguruswamy, Object Oriented Programming through C++ 4. Timothy Budd, Programming. An Introduction to Object Oriented
WEB:
www.c++projects.com www.tatamcgrawhill.com www.google.co.in
89