CONTENTS
1
Abstract
2
2
Problem Description
3
3
System Specification
4
4
System Study
5
5
DFD
9
6
E-R Diagram
12
7
Software Description
13
8
Database Design
28
9
Sample Coding
32
10
Output
83
11
Conclusion
91
12
Bibliography
93
ABSTRACT
Our project Hospital Management system includes registration of patients, storing their details into the system, and also computerized computerized billing in the pharmacy, pharmacy, and labs. Our software has the facility to give a unique id for every patient and stores the details of every patient and the staff automatically. It includes a search facility to know the current status of each room. User can search availability of a doctor and the details of a patient using the id.
The Hosp Hospit ital al Manag Managem ement ent Syste System m can can be enter entered ed using using a userna username me and password. password. It is accessible accessible either either by an administra administrator tor or receptionis receptionist. t. Only they they can add data data into the database. The data can be retrieved easily. easily. The interface is very user-friendly. The data are well protected for personal use and makes the data processing very fast.
2
PROBLEM DESCRIPTION
The purpose of the project entitled as “HOSPITAL MANAGEMENT SYSTEM” is to computerize the Front Office Management of Hospital to develop software which is user friendly, simple, fast, and cost – effective. It deals with the collection of patient’s information, diagnosis details, etc. Traditionally, it was done manually.
The main function of the system is to register and store patient details and doctor details and retrieve these details as and when required, and also to manipulate these details meaningfully System input contains patient details, diagnosis details; while system output is to get these details on to the CRT screen.
NEED
1. Efficiently maintains the details about the patient 2. Simultaneously updates changes made to any data, item in the entire data base. 3. It is faster than manual system
3
SYSTEM SPECIFICATION
1. Hardwa Hardware re Requir Requirem ement entss Processor
: Intel Pentium IV 2.4 GHZ or above
Clock speed
: 500 MHZ
System bus
: 32 bits
RAM
: 256MB of RAM
HDD
: 40 GB or higher
Monitor
: SVGA COLOR
Keyboard
: 108 keys
Mouse
: 2 button mouse
2. Software Requirements Requirements OS
:
MS WINDOWS XP SP2
Front End
:
Visual Basic 6.0
Back End
:
Microsoft Access 2003
4
SYSTEM STUDY
INTRODUCTION
The goal of any system development is to develop and implement the system cost effectively; user-friendly and most suited to the user’s analysis is the heart of the process. Analysis is the study of the various operations performed by the system and their relationship within and outside of the system. During analysis, data collected on the files, decision points and transactions handled by the present system. Different kinds of tools are used in analysis of which interview is a common one.
INITIAL INVESTIGATION
The first step in system development life cycle is the identification of need of change to improve or enhance an existing system. An initial investigation on existing system was carried out. The present system of hospital is completely manual. Many problems were identified during the initial study of the existing system.
5
EXISTING SYSTEM
System analysis is a detailed study of the various operations performed by a system and their relationships within and outside of the system. Here the key question is – What all problems problems exist in the present present system? system? What must be done to solve the problem? problem? Analysis Analysis begins when when a user user or manager manager begins begins a study study of the the program program using existing existing system. system.
During analysis, data collected on the various files, decision points and transactions handle handled d by the the pres present ent syst system em.. The comm commonl only y used used tool toolss in the syst system em are are Data Data Flow Flow Diagram, interviews, etc. training, experience and common sense are required for collection of relevant information needed to develop the system. The success of the system depends largely on how clearly clearly the proble problem m is defined, defined, thoroug thoroughly hly investi investigat gated ed and proper properly ly carrie carried d out through the choice of solution. A good analysis model should provide not only the mechanisms of problem understanding but also the framework of the solution. Then the proposed system should be analyzed thoroughly in accordance with the needs.
System analysis can be categorized into four parts. •
System planning and initial investigation
•
Information gathering
6
•
Applying analysis tools for structured analysis
•
Feasibility study
•
Cost/benefit analysis
PROPOSED SYSTEM
The drawback of the existing system is that it is very difficult to retrieve data from case files. It is difficult to handle the whole system manually and it is less accurate and to keep the data in case files for future reference because it may get destroyed. Moreover it is very difficult to retrieve data. Redundancy of data may occur and this may lead to the inconsistency. The manual system is so time-consuming.
The proposed system system is very easy to operate. operate. Speed and accuracy are the main advantages advantages of proposed system. There is no redundancy of data. The data are stored in the computer’s secondary memories like hard disk, etc. it can be easily receive and used at any time. The proposed proposed system system will easily easily handle all the data and the the work done by the existing existing systems. systems. The proposed proposed systems systems eliminate eliminate the drawbacks drawbacks of the existing existing system system to a great extent and it provides provides tight security security to to data.
ABOUT OPERATING SYSTEM
Windows XP is a line of operating systems developed by Microsoft for use on general purpose purpose computer computer systems, systems, including including home and business business desktops, desktops, notebook computers computers and
7
media centers. The letters ‘XP’ stand for experience. Windows XP is the successor to both Windows 2000 and Windows Me and is first consumer oriented operating system produced by Microsoft to be built on the Windows NT kernel and architecture.
The most common editions of operating systems are Windows XP home edition, which is targeted at home users, and Windows XP professional, which has additional features such as, support for Windows server domain and two physical processors and is targeted at power users and business clients. Windows XP Tablet PC edition is designed to run the ink-aware Tablet PC platform. Two separate 64 bit versions of Windows XP were also released, Windows XP 64 bit edition for IA-64(Itanium) processors and Windows XP Professional x64 edition for x86-64 processors.
8
DATA FLOW DIAGRAMS DFD for Login Module Ok Password Administrator
User
Enter Administrator/User
Verifying User Name and and Password User Password
Re ecte ected d
Login File
DFD for Billing process File User
Item Code
Item Details Sales process
Updating process
Item Details
uotation Details
Stock File Billing process process
Bill Customer
9
Purchase Detail ils DFD. Medicine File Item Itemcode, code, Qty
User
Medicine Details
Purchase Process
Updating process
Quotation Details
Stock File File
10
ENTITY RELATIONSHIP DIAGRAMS
Administrator
DateStarted
Controls
HOD Name Wor ks On
Employee
Emp- Number
Department
Address
Dept number
Dept Name Works On Name
Name
Name Trea ted by
Patient
Patient ID
Doctor
Dr-ID
Address 11
Address
SOFTWARE DESCRIPTION
Microsoft Visual Basic 6.0
Visual Visual Basic Basic 6.0 is Micros Microsoft oft’s ’s latest latest version version of the Visual Visual Basic Basic Program Programming ming language. Although writing programs can be a tedious chore at time. Visual Basic reduces the effort required required on your part, and makes programming programming enjoyable. enjoyable. Visual Visual Basic makes many aspects of programming as simple as dragging graphics objects on to screen with your mouse.
Visual Basic 6.0 is more than just a programming programming language; language; the secret to Visual Basic is in its name” Visual”. With to days Windows Windows Operating Operating System, a program must must be able to interact with the screen. Keyboard, mouse and printer graphically.
The environment provided by Visual Basic is suitable for any type of application. Using this environment, the user can visually design the objects that your application uses. Visual Basic is not just a languages, it’s an integrated integrated development environment environment in which you can develop, run, test test and debug your applications. applications. The impressive impressive array array of programming programming resources resources provided by Visual Basic enables to create the objects extemporaneous extemporaneously ly which can range from pop-up menu to a message box.
12
A form is a major part of Visual Basic application, which allows the user to enter the data as well as view the result result.. A control control is an object object that we draw on a form form to enable or enhanc enhancee user user inter interact action ion with with an appl applica icati tion. on.
Hence Hence a Visu Visual al Basi Basicc appl applica icati tion on is a
combination of object like forms and controls, procedures that can respond to Events and other general-purpose procedures.
Starting Visual Basic
To start Visual Basic:
•
Click on the Start button on the Windows task bar.
•
Select Programs , then Microsoft Visual Basic # (where # is your version of
Visual Basic).
•
Click on Visual Basic # (where again # is your version).
13
Title Bar
Main Menu
14
Toolbar
At the top of the screen is the Visual Basic Main Window. At the top top of the main main window is the Title Bar. The title bar gives gives us information information about what program program we’re using and what Visual Basic program we are working with. Under the main menu is the Toolbar. Here little buttons with pictures pictures also allow us to control Visual Basic, much like the main menu. If you put the mouse cursor cursor over one of these buttons buttons for a second or so, a little ‘tool tip’ tip’ will pop up and tell you what that particular button does.
Parts of a Visual Basic Project
There are three major major components components in a Visual Basic project: project: the project project itself, the form, and the controls. Project is the word used to encompass everything in a Visual Basic project. project. Other words words used to describe describe a project project are application or program. The Form is the window where you create the interface between the user and the computer. Controls are graphical features or tools that are placed on forms to allow user interaction (text boxes, labels, scroll bars, command buttons). Recall the form itself is a control. Controls are also referred to as objects . Pictorially, a project is: is:
Control Project
Control Control
Form Control
15
Project consists of a form form containing several controls. In looking around your computer’s computer’s file directory, directory, you may find some files associated associated with a Visual Basic project. project. Two primary primary files are used to save a Visual Basic Basic project. project. The project project file will have an extension extension of vbp (in addition, there there is sometimes sometimes a file with a vbw extension). The form file has an extension extension of frm (in addition, there is sometimes a form file with an frx extension).
An important concept concerning a Visual Basic project is that of a property . Every characte characterist ristic ic of a control control (includin (including g the form itself) itself) is specifie specified d by a proper property. ty. Example Example properties properties include include names, names, captions, captions, sizes, sizes, colors, colors, position position on the form, form, and contents. contents. Visual Basic is an event-driven language language..
Visual Visual Basic Basic is gover governed ned by an event
processor . That means that nothing happens in a Visual Visual Basic project until some event occurs.
Once an event is detected, the project project finds a series series of instructions instructions related to that event, called an event procedure . That procedure procedure is executed, executed, and then program control control is returned returned to the event:
EVENT
Event processor
16 Event Procedure
Event Procedure
Event
Event procedures are where we do the actual computer programming and are saved with the form in the file with the frm extension. These procedures are where we write BASIC language statements. You will learn a lot lot of programming and BASIC language in this course. The BASIC you will learn is very similar to the original BASIC used by Bill Gates and Paul Allen when starting Microsoft.
Parts of the Visual Basic Program
Visu Visual al Basic Basic is more than than just just a comp comput uter er languag language. e.
It is a proje project ct buildi building ng
environment. environment. Within Within this one environment, environment, we can begin and build our project, run and test our project, project, eliminate errors errors (if any) in our project, and save our project for future future use. With other computer languages, many times you need a separate text editor to write your program, something called a compiler to create the program, and then a different area to test your program. program.
Visual Basic integrates integrates each step of the project project building process process into one
environment. Let’s look at the the parts of the the Visual Basic environment.
Main Window
17
Start Visual Basic using the procedure learned in Class 1. Notice that several windows appear. The Main Window is used to control most aspects of the Visual Basic project building and running running process. process.
The main window window consists of the the title bar, menu bar, and toolbar. toolbar. The title bar indicates indicates the project project name and the current Visual Basic operating operating mode (design, (design, break, run). The menu bar has drop-down menus from which you control the operation of the Visual Basic environment.
Form Window
The Form Window is central to developing Visual Basic applications. It is where you develop your application.
18
If the form window is not present on the screen:
Properties
Like all controls, the form has many (over 40) properties. properties. Fortunately, we only have to know about some of them. The properties we will be concerned with are:
Property
Description
Name
Name used used to identify identify form. form. Three letter letter prefix prefix for form names is frm.
Caption
Text that appears in the title bar of form.
Icon
Reference to icon that appears in title bar of form.
Left
Distance from left side of computer screen to left side of form.
Top
Distance from top side of computer screen to top side of form.
Width
Width of the form in twips.
Height
Height of form in twips.
Back Color
Background color of form.
Border Style
Form can either be sizable (can resize using the mouse) or fixed size.
19
Form Events
The form primarily acts as a ‘container’ for other controls, but it does support events. That is, it can respond respond to some user interactions. interactions. We will only be concerned concerned with two two form events in this course:
Event
Description
Click
Event executed when user clicks on the form with the mouse.
Load
Event executed when the form first loads into the computer’s memory. This is a good place to set initial values for various properties properties and other project project values. values.
Toolbox Window
20
The Toolbox Window is the selection menu for controls used in your application.
VB6:
Pointer
Picture Box
Label
Text Box
Frame
Command Button
Check Box
Option Button
Combo Box
List Box
Horizontal Scroll Bar
Vertical Scroll Bar
Timer
Drive
Directory
Files
Shape
Line
Image
Data Control
OLE
If the toolbox window is not present on the screen, click View on the main menu, then Toolbox .
Features of Visual Basic:
1. Good User Interface.
21
2. OLE Features. 3. Windows API Features. 4. 32 bit Programming Languages. 5. Data Management 6. Online Help 7. Data Access.
Areas of Application
The term " Personal Personal Programming Programming " refers to the idea that, wherever you work, whatever you do, you can expand your computer's usefulness by writing applications to use in your own job. Personal Programming is what Visual Basic is all about.
Using Visual Basic's tools, you quickly translate an abstract idea into a program design you can actually see on the screen. VB encourages you to experiment, revise, correct, and network your design until the new project meets your requirements. However, most of all, it inspires your imagination and creativity.
Visual Basic is ideal for developing applications that run in the new Windows 95 operating system. VB presents a 3-step approach for creating programs:
1. Design Design the the appear appearance ance of of your your appli applicat cation. ion. 2. Assign Assign prope property rty setti settings ngs to the object objectss of your progr program. am. 3. Wr Write ite the code code to direct direct spec specific ific task taskss at runtime runtime..
22
Visual Basic can and is used in a number of different areas, for example:
•
Education
•
Research
•
Medicine
•
Business
•
Commerce
•
Marketing and Sales
•
Accounting
•
Consulting
•
Law
•
Science
Microsoft Access 2003.
Microsoft Access is the default database of Microsoft Visual Basic. Microsoft Access 2003 provides provides many new features that make working with data and designing a database even easier. Microsoft Access Database Database is a collection of data and objects related to particular topic or purpose. purpose. Microsoft Microsoft Access Database Database may contain tables; tables; queries, forms, reports, reports, macros modules and shortcuts top data access pages. Microsoft Access is a Relational Database Management System. Using Access we can organize our data according to subject and can store information about how different subject are related. In general MS-Access MS-Access database can have several small tables.
23
Microsoft Office Access, previously known as Microsoft Access, is a relational database managem management ent system system from from Micros Microsoft oft that that combine combiness the relati relational onal Micros Microsoft oft Jet Databas Databasee Engine with a graphical user interface and software development tools. It is a member of the 2007 Microsoft Office system. Access can use data stored in Access/Jet, Microsoft SQL Server, Oracle, or any ODBCcompliant data container (including MySQL and PostgreSQL). Skilled software developers and data architects use it to develop application software. Relatively unskilled programmers and non-programmer "power users" can use it to build simple applications. It supports some objectoriented techniques but falls short of being a fully object-oriented development tool. Access was also the name of a communications program from Microsoft, meant to compete with with ProCom ProComm m and other other progra programs. ms. This proved proved a failur failuree and was dropped. dropped. Years Years later later Microsoft reused the name for its database software.
Access is used by small businesses, within departments of large corporations, and by hobby programmers programmers to create ad hoc customized customized desktop desktop systems systems for handling the creation creation and manipulation of data. Access can be used as a database for basic web based applications hosted on Microsoft's Internet Information Services and utilizing Microsoft Active Server Pages ASP. Most typical web applications should use tools like ASP/Microsoft SQL Server or the LAMP stack. Some profes professio sional nal applic applicati ation on develop developers ers use Access Access for rapid rapid applic applicatio ation n develop development ment,, especially especially for the creation of prototypes prototypes and standalone standalone applications applications that serve as tools for onthe-road salesmen. Access does not scale well if data access is via a network, so applications that are used by more than a handful of people tend to rely on Client-Server based solutions.
24
However, an Access "front end" (the forms, reports, queries and VB code) can be used against a host of database back ends, including JET (file-based database engine, used in Access by default), Microsoft SQL Server, Oracle, and any other ODBC-compliant product. Features One of the benefits of Access from a programmer's perspective is its relative compatibility with SQL (structured (structured query language) language) —queries —queries may be viewed and edited as SQL statements, statements, and SQL statements can be used directly in Macros and VBA Modules to manipulate Access tables. Users may mix and use both VBA and "Macros" for programming forms and logic and offers object-oriented possibilities. MSDE (Microsoft SQL Server Desktop Engine) 2000, a mini-version of MS SQL Server 2000, is included with the developer edition of Office XP and may be used with Access as an alternative to the Jet Database Engine. Unlike a modern RDBMS, the Access and the Jet Engine implements database triggers and stored procedures in a non-standard way. Stored Procedures are implemented in VBA, and Triggers are only available from embedded Forms. Both Triggers and Stored procedures are only available to applications built completely within the Access database management system. Client applications built with VB or C++ are not able to access these features. Starting in MS Access 2003 (Jet 4.0), there is a new syntax for creating queries with parameters, in a way that looks like creating stored procedures, but these procedures are still limited to one statement per procedure. procedure. Microsoft Microsoft Access does allow forms to contain code that is triggered as changes are made to the underlying table (as long as the modifications are done only with that form), and it is common to use pass-through queries and other techniques in Access to run stored procedures in RDBMSs that support these.
25
In ADP files (suppo (supporte rted d in MS Access Access 2003 2003 and later) later),, the databas database-re e-relat lated ed features features are entirely different, because this type of file connects to a MSDE or Microsoft SQL Server, instead of using the Jet Engine. Thus, it supports the creation of nearly all objects in the underlying server (tables with constraints and triggers, views, stored procedures and UDF-s). However, only forms, reports, macros and modules are stored in the ADP file (the other objects are stored in the back-end database).
DATABASE DESIGN
The general theme behind a database is to handle information as an integrated whole. A database is a collection of interrelated data stored with minimum redundancy to serve many users users quickl quickly y and effe effecti ctivel vely. y. Afte Afterr desi design gning ing the inpu inputt and output output,, the analys analystt must must concentrate on database design or how data should be organized around user requirements. The general objective is to make information access, easy, quick, inexpensive and flexible for other users. During database design, the following objectives are concerned:•
Controlled redundancy
•
Easy to learn and use
•
More information and low cost
•
Accuracy
•
Integrity
26
File Name :- Login
Field Name
Description
Data Type
Width
User Name Password
User Name User Name
Text Text
50 50
File Name :- Doctor Registration
Field Name
Description
Data Type
Width
Dr name Sex Dept Consultation time Address Contact no Emergency no Consult fee Date Consultation day Tot pat
Doctor Name Sex Department Consultation Time Address Contact Number Emergency Number Consultation fees Date Consultation Day Total Patient
Text Text Text Text Text Long Long Long Date/Time Text Double
50 50 50 50 50 50 50 50 50 50 50
File Name:-Patient Details
Field Name
Description
Data Type
Width
Name Age Sex
Name Age Sex
Text Integer Text
50 50 50
27
Address Doctor Patient id Reg fee Admin Date Room no
Address Doctor Patient id Registration fees Admitted Date Room Number
Text Text Text Double Date/Time Integer
50 50 50 50 50 50
Width
File Name:-Medicine Name:-Medicine
Field Name
Description
Data Type
Medname Medtype Amt Expdate Stock
Medicine Name Medicine Type Amount Expiry Date Stock
Text Text Double Date/Time Double
File Name:-Discharge Sheet
Field Name
Description
Data Type
Width
Patient id Name Doctor Remark Totbill Date
Patient id Name Doctor Remark Total Bill Date
Double Text Text Text Double Date/Time
50 50 50 50 50 50
28
SAMPLE CODING
LOGIN Private Sub Command2_Click () Unload Me End Sub Private Sub Command3_Click () Db. Open Set rs = db. Execute ("SELECT * FROM LOGIN where username='" & txt_username.Text & "'") If (txt_ password = "" And txt_ username = "") Then MsgBox "Login not possible" Else
29
If No t rs. EOF () Then If (rs(1) = txt_ password. Text) Then MsgBox "Login Successful" frmMDI.mn RegAdmin.Enabled = True frmMDI.mnuRegDr.Enabled = True frmMDI.mnuAddDept.Enabled = True frmMDI.mnuRegUser.Enabled = True frmMDI.mnuAddrooms.Enabled = True frmMDI.mnuEditdr.Enabled = True frmMDI.mnulogoff.Enabled = True frmMDI.mnuLogin.Enabled = False frmMDI.mnuPatient.Enabled = True frmMDI.mnuSearch.Enabled = True frmMDI.mnuBilling.Enabled = True frmMDI.mnuuser.Enabled = True Unload Me Else MsgBox "Login not success" End If Else MsgBox "EOF Reached" End If End If
30
db.Close End Sub Private Sub Command4_Click() db.Open Set Set rs = db.Exe db.Execut cute( e("SE "SELE LECT CT * FROM FROM STAF STAFFL FLOG OGIN IN wher wheree userna username me='" ='" & txt_username.Text & "'") If Not rs.EOF() Then If (rs(1) = txt_password.Text) Then MsgBox "Login Successful" frmMDI.mnulogoff.Enabled = True frmMDI.mnuLogin.Enabled = False frmMDI.mnuPatient.Enabled = True frmMDI.mnuSearch.Enabled = True frmMDI.mnuBilling.Enabled = True frmMDI.mnuuser.Enabled = True Unload Me Else MsgBox "Login not success" End If Else MsgBox "Invalid Username or Password" End If db.Close
31
End Sub Private Sub Form_Load() connectdb End Sub
ADMINISTRATOR REGISTRATION Private Sub cmd_cancel_Click() Unload Me End Sub Private Sub cmd_save_Click() db.Open db.E db.Exe xecu cute te ("IN ("INSE SERT RT INTO INTO LOGI LOGIN N VALUE ALUES S ('" ('" & txt_ txt_us user erna name me.T .Tex extt & "',' "','"" & txt_password.Text & "')") MsgBox "Record added successfully" db.Close End Sub Private Sub Form_Load () connectdb End Sub 32
DOCTOR’S REGISTRATION Dim m_time As String Dim m_MissingFields As String Private Sub Command1_Click () If ValidateForm = True Then db.Open m_time = txt_timefrom.Text & “to” & txt_timeto.Text rs.Open "DrREGISTRATION", db, adOpenDynamic, adLockOptimistic rs.AddNew rs!drname = txt_name.Text If Opt_male.Value = True Then rs!sex = "Male" Else rs!sex = "Female" End If rs!dept = cmb_dept.Text rs!consultationtime = m_time rs!address = txt_address.Text rs!contactno = txt_contactno.Text rs!emergencyno = txt_emergency.Text
33
rs!Date = DTP.Value rs!consultationday = comb_day.Text rs!totpat = txt_totpat.Text rs!consultfee = txt_fee.Text rs.Update MsgBox "One Doctor Registered", vbInformation, "Doctor ADDED" rs.Close rs.Open "PATCOUNT", db, adOpenDynamic, adLockOptimistic rs.AddNew rs!drname = txt_name.Text rs!patcount = txt_totpat.Text rs!Date = DTP.Value rs.Update db.Close Else m_MissingFields = Left (m_MissingFields, Len (m_MissingFields) - 1) MsgBox "Some fields (" & m_MissingFields & ")" & vbCrLf & " are missing, please fill the fields and try again", vbCritical + vbOKOnly, "Missing fields" m_MissingFields = "" End If End Sub Private Sub Command2_Click () Unload Me
34
End Sub Private Sub Form_Load() connectdb comb_day.AddItem "Monday" comb_day.AddItem "Tuesday" comb_day.AddItem "Wednesday" comb_day.AddItem "Thursday" comb_day.AddItem "Friday" comb_day.AddItem "Saturday" comb_day.AddItem "Sunday" End Sub Private Function ValidateForm() As Boolean Dim m_valid As Boolean m_valid = True If txt_name.Text = "" Then m_MissingFields = m_MissingFields & "Name," m_valid = False End If If cmb_dept.Text = "" Then m_MissingFields = m_MissingFields & "Dept Name," m_valid = False End If If txt_timefrom.Text = "" Then
35
m_MissingFields = m_MissingFields & "Time From," m_valid = False End If If txt_timeto.Text = "" Then m_MissingFields = m_MissingFields & "Time To," m_valid = False End If If txt_address.Text = "" Then m_MissingFields = m_MissingFields & "Address," m_valid = False End If If txt_contactno.Text = "" Then m_MissingFields = m_MissingFields & "Contact no," m_valid = False End If If txt_emergency.Text = "" Then m_MissingFields = m_MissingFields & "Emergency no," m_valid = False End If If txt_fee.Text = "" Then m_MissingFields = m_MissingFields & "Fees," m_valid = False End If
36
ValidateForm = m_valid End Function
PATIENT REGISTRATION
Dim m_sx As String Dim m_patid As Integer Dim m_patcount As Integer Dim m_totpat As Integer Dim m_MissingFields As String
Private Sub cmd_del_Click() 'MsgBox
("DELETE
FROM
PATIENTDETAILS
WHERE
timestampdiff(SQL_TSI_MONTH," & Date & ",ts admindate))") End Sub Private Sub Combo_drpref_Click() db.Open rs.Open
"SE "SELECT
totpat
FROM
DrREGIS EGIST TRATION
Combo_drpref.Text & "' ", db, adOpenDynamic, adLockOptimistic If Not rs.EOF() Then m_totpat = rs!totpat Else MsgBox "Not found"
37
WHERE
drnam name='"
&
End If rs.Close rs.Open "SELECT * FROM DrREGISTRATION WHERE drname='" & Combo_drpref.Text & "' ", db, adOpenDynamic, adLockOptimistic If Not rs.EOF() Then txt_regfee.Text = rs!consultfee Else MsgBox "Record not found" End If rs.Close rs.Open "SELECT * FROM PATCOUNT WHERE drname='" & Combo_drpref.Text & "'", db, adOpenDynamic, adLockOptimistic If Not rs.EOF() Then m_patcount = rs!patcount If (m_patcount > m_totpat) Then MsgBox "Patient Count Exceeds please assign to another Doctor" End If Else MsgBox "Record not Found" End If rs.Close db.Close End Sub
38
Private Sub Combo_patid_Click() db.Open rs.Open rs.Open "SELECT "SELECT * FROM PATIENTDETAILS PATIENTDETAILS WHERE patientid='" patientid='" & Combo_patid.T Combo_patid.Text ext & "'", db, adOpenDynamic, adLockOptimistic lst_names.AddItem rs!Name lst_age.AddItem rs!age lst_add.AddItem rs!address db.Close Command3.Enabled = False End Sub Private Sub Command1_Click () Dim pattype As String Dim rno As Integer If Opt_male = True Then m_sx = "male" Else m_sx = "female" End If db.Open rs.Open "SELECT * FROM PATIENTDETAILS where patientid='" & txt_patientid.Text & "' ", db, adOpenDynamic, adLockOptimistic If Not rs.EOF() Then MsgBox "Patient ID allready exist"
39
Else If ValidateForm = True Then If rdoIP.Value = True Then pattype = rdoIP.Caption rno = Val(cmbRoomNo.Text) Else pattype = rdoOP.Caption rno = -1 End If db.Execute ("INSERT INTO PATIENTDETAILS VALUES ('" & txt_name.Text & "'," & _ txt_age.Text & ",'" & m_sx & "','" & txt_address.Text & "','" & _ Combo_drpref.Text & "','" & txt_patientid & "'," & txt_regfee & ",' “& _ DTP.Value & "','" & pattype & "'," & rno & ")") db.Execu db.Execute te ("UPDA ("UPDATE TE ADDROO ADDROOM M SET Allocat Allocated=' ed='Y' Y' WHERE WHERE roomno= roomno="" & Val (cmbRoomNo.Text)) MsgBox "Record added successfully" m_patid = m_patid + 1 Else m_MissingFields = Left (m_MissingFields, Len (m_MissingFields) - 1) MsgBox "Some fields (" & m_MissingFields & ")" & vbCrLf & " are missing, please fill the fields and try again", vbCritical + vbOKOnly, "Missing fields" m_MissingFields = "" End If
40
End If db.Close 'm_patid = m_patid + 1 txt_address.Text = "" txt_age.Text = "" txt_name.Text = "" txt_regfee.Text = "" txt_patientid.Text = m_patid db.Open m_patcount = m_patcount + 1 rs.Open "SELECT * FROM PATCOUNT WHERE drname='" & Combo_drpref.Text & "'", db, adOpenDynamic, adLockOptimistic WHERE drname=' " & Combo_drpref.Text & "' ") If Not rs.EOF () Then rs!patcount = m_patcount rs.Update Else MsgBox "Please fill all the fields" End If db.Close End Sub Private Sub DTPicker1_Change () End Sub
41
Private Sub Command2_Click () Unload Me End Sub Private Sub Command3_Click () If (txt_dt.Text = "") Then MsgBox "Please enter the date", vbCritical, "Warning" Else db.Open rs.Open "SELECT * FROM PATIENTDETAILS WHERE admindate= #" & txt_dt.Text & "# ", db, adOpenDynamic, adLockOptimistic While Not rs.EOF() lst_names.AddItem rs!Name lst_age.AddItem rs!age lst_add.AddItem rs!address rs.MoveNext Wend db.Close End If End Sub Private Sub Command4_Click () Unload Me End Sub Private Sub Command5_Click ()
42
Combo_patid.Text = "" txt_dt.Text = "" lst_age.Clear lst_names.Clear lst_add.Clear End Sub Private Sub Command6_Click() End Sub Private Sub Form_Load () connectdb db.Open rs.Open "SELECT * FROM DrREGISTRATION", db, adOpenDynamic, adLockOptimistic While not rs.EOF () Combo_drpref.AddItem rs!drname rs.MoveNext Wend rs.Close rs.O rs.Ope pen n "SELE "SELECT CT COUN COUNT T (*) (*) FROM FROM PATI PATIEN ENTD TDET ETAI AILS LS", ", db, db, adOpe adOpenD nDyna ynami mic, c, adLockOptimistic If (rs(0) = 0) Then m_patid = 1 txt_patientid.Text = m_patid Else
43
m_patid = rs(0) + 1 txt_patientid.Text = rs (0) + 1 End If db.Close rdoOP.Value = True loadRooms cmbRoomNo.Enabled = False
End Sub
Private Sub rdoIP_Click () If rdoIP.Value = True Then cmbRoomNo.Enabled = True End If End Sub Private Sub rdoOP_Click () If rdoOP.Value = True Then cmbRoomNo.Enabled = False End If End Sub Private Sub SSTab1_Click (PreviousTab as Integer) db.Open rs.Open "PATIENTDETAILS", db, adOpenDynamic, adLockOptimistic
44
While not rs.EOF Combo_patid.AddItem rs!patientid rs.MoveNext Wend db.Close End Sub Private Sub txt_dt_GotFocus () Command3.Enabled = True End Sub Private Function ValidateForm () As Boolean Dim m_valid As Boolean m_valid = True If txt_name.Text = "" Then m_MissingFields = m_MissingFields & "Name," m_valid = False End If If txt_age.Text = "" Then m_MissingFields = m_MissingFields & "Age," m_valid = False End If If txt_address.Text = "" Then m_MissingFields = m_MissingFields & "Address," m_valid = False
45
End If If txt_regfee.Text = "" Then m_MissingFields = m_MissingFields & "Registration Fee," m_valid = False End If ValidateForm = m_valid End Function Public Sub loadRooms() db.Open rs.O rs.Ope pen n "SELE "SELECT CT room roomno no FROM FROM ADDR ADDROO OOM M WHER WHERE E Allo Alloca cate ted=' d='N' N'", ", db, adOpenDynamic, adLockOptimistic cmbRoomNo.Clear While Not rs.EOF cmbRoomNo.AddItem rs.Fields(0) rs.MoveNext Wend If (cmbRoomNo.ListCount > 0) Then cmbRoomNo.ListIndex = 0 End If db.Close End Sub
EDIT DOCTOR
46
Private Sub cmd_update_Click() db.Open rs.Open "SELECT * FROM DrREGISTRATION WHERE Drname= '" + Combo_drname.Text + "'", db, 3, 3 If Not rs.EOF() Then rs!consultationtime = txt_time.Text rs!address = txt_address.Text rs!contactno = txt_contactno.Text rs!emergencyno = txt_emergencyno.Text rs.Update MsgBox "Record updated Successfully" db.Close Else MsgBox "Record not found" End If End Sub
Private Sub Combo_drname_Click() db.Open rs.Open "SELECT * FROM DrREGISTRATION where drname='" + Combo_drname.Text + "' ", db, adOpenDynamic, adLockOptimistic txt_time.Text = rs!consultationtime txt_address.Text = rs!address
47
txt_contactno.Text = rs!contactno txt_emergencyno.Text = rs!emergencyno db.Close End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub Form_Load() connectdb db.Open rs.Open "DrREGISTRATION", db, adOpenDynamic, adLockOptimistic While Not rs.EOF Combo_drname.AddItem rs!drname rs.MoveNext Wend db.Close End Sub
EDIT PATIENT
Private Sub cmdupdate_Click() db.Open rs.Open "PATIENTDETAILS", db, adOpenDynamic, adLockOptimistic
48
rs!address = txt_address.Text rs.Update MsgBox "Record Updated" db.Close End Sub Private Sub Combo1_patid_Click() db.Open rs.Open "SELECT * FROM PATIENTDETAILS WHERE patientid='" + Combo1_patid.Text + "' ", db, adOpenDynamic, adLockOptimistic If Not rs.EOF() Then txt_address.Text = rs!address db.Close Else MsgBox "Record not found" End If End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub Form_Load() connectdb db.Open rs.Open "PATIENTDETAILS", db, 3, 3
49
While Not rs.EOF() Combo1_patid.AddItem rs!patientid rs.MoveNext Wend db.Close End Sub
INPATIENT BILL
Dim billno As Integer Dim w As Integer Dim addt As Date Dim diff As Integer Private Sub cm_close_Click() 'End If Unload Me End Sub Private Sub cmd_dis_Click() w=0 db.Open 'rs.Open "select * from PATIENTDETAILS where patientid='" + txtPatID.Text + "' ", db, adOpenDynamic, adLockOptimistic
50
rs.O rs.Ope pen n "sele "select ct * from from LABB LABBIL ILL L where where pati patien enti tid= d="" + Comb Combo_ o_pat patid id.T .Text ext + " ", db, db, adOpenDynamic, adLockOptimistic If Not rs.EOF() Then w = w + rs("total") Else 'MsgBox "Record not found" w=w End If rs.Close rs.O rs.Ope pen n "sel "select ect * from from PHAR PHARBI BILL LL where where pati patient entid= id="" + Comb Combo_ o_pa pati tid.T d.Tex extt + " ", db, db, adOpenDynamic, adLockOptimistic If Not rs.EOF() Then w = w + rs("tot") Else 'MsgBox "Record not found" w=w End If rs.Close rs.O rs.Ope pen n "sel "selec ectt * from from IPBI IPBILL LL wher wheree pati patien enti tid= d="" + Comb Combo_ o_pa pati tid. d.Te Text xt + " ", db, db, adOpenDynamic, adLockOptimistic If Not rs.EOF() Then w = w + rs("tot") Else
51
'MsgBox "Record not found" w=w End If rs.Close db.Close 'txt_totbill.Text = w Load DISCHARGEsheet DISCHARGEsheet.txt_totbill.Text = w DISCHARGEsheet.txtPatID.Text = Combo_patid.Text DISCHARGEsheet.txt_dr.Text = Combo_dr.Text DISCHARGEsheet.txt_name.Text = txt_name.Text DISCHARGEsheet.Show End Sub
Private Sub cmd_save_Click() If ValidateForm = True Then db.Open rs.Open "IPBILL", db, adOpenDynamic, adLockOptimistic rs.AddNew rs!Name = txt_name.Text rs!regdate = txt_regdate.Text rs!patientid = Combo_patid.Text rs!doctor = Combo_dr.Text
52
rs!regdate = txt_regdate.Text rs!billno = txt_billno.Text rs!room = txt_room.Text rs!amt = txt_amt.Text rs!tot = diff rs.Update rs.Close MsgBox "Recorded added sucessfully" Else m_MissingFields = Left(m_MissingFields, Len(m_MissingFields) - 1) MsgBox "Some fields(" & m_MissingFields & ")" & vbCrLf & " are missing, please fill the fields and try again", vbCritical + vbOKOnly, "Missing fields" m_MissingFields = "" End If db.Close cmd_dis.Enabled = True cmd_save.Enabled = False End Sub
Private Sub Combo_patid_Click() db.Open rs.Open "SELECT * FROM PATIENTDETAILS WHERE patientid='" + Combo_patid.Text + "'", db, adOpenDynamic, adLockOptimistic
53
If Not rs.EOF() Then txt_regdate.Text = rs!admindate txt_name.Text = rs!Name txt_regdate.Text = rs!admindate addt = rs!admindate Combo_dr.Text = rs!doctor Combo_patid.Text + "'", db, adOpenDynamic, adLockOptimistic txt_room.Text = rs!roomno 'txt_amt.Text = rs!amt rs.Close rs.Open "SELECT amt from ADDROOM WHERE roomno=" & Val(txt_room.Text) If Not rs.EOF Then txt_amt.Text = rs!amt End If Else MsgBox "No Rooms allotted" End If 'rs.Open "SELECT * FROM PATIENTDETAILS", db, adOpenDynamic, adLockOptimistic db.Close diff = DateDiff("d", addt, Now) diff = diff * Val(txt_amt.Text) 'MsgBox diff txt_tot.Text = diff
54
End Sub Private Sub Form_Load() connectdb db.Open rs.O rs.Ope pen n "SEL "SELEC ECT T
pati patient entid id FROM FROM PATI PATIEN ENTD TDET ETAI AILS LS WHER WHERE E Type Type='I ='IP'" P'",, db, db,
adOpenDynamic, adLockOptimistic While Not rs.EOF Combo_patid.AddItem rs!patientid rs.MoveNext Wend db.Close db.Open rs.Open "DrREGISTRATION", db, adOpenDynamic, adLockOptimistic While Not rs.EOF Combo_dr.AddItem rs!drname rs.MoveNext Wend db.Close 'db.Open db.Open rs.Open "SELECT COUNT(*) FROM IPBILL", db, adOpenDynamic, adLockOptimistic If (rs(0) = 0) Then txt_billno.Text = 1
55
Else billno = billno + 1 txt_billno.Text = billno End If db.Close End Sub Private Sub Label11_Click() End Sub Private Function ValidateForm() As Boolean Dim m_valid As Boolean m_valid = True If txt_name.Text = "" Then m_MissingFields = m_MissingFields & "Name," m_valid = False End If If txt_amt.Text = "" Then m_MissingFields = m_MissingFields & "Amount," m_valid = False End If ValidateForm = m_valid End Function
OUTPATIENT BILL
56
Dim m_count As Integer Dim total As Integer Dim m_MissingFields As String Private Sub Command1_Click() db.Open rs.Open "OPPHARMACY", db, adOpenDynamic, adLockOptimistic rs.AddNew rs!Name = txt_name.Text rs!Amount = txt_amt.Text rs!billno = txt_billno.Text rs!Date = DTP.Value rs!pamt = txt_pamt.Text rs!labamt = txt_lamt.Text rs!tot = txt_tot.Text rs!patientid = Combo_patid.Text rs!doctor = Combo_dr.Text rs.Update 'MsgBox "You are registered", vbInformation, "UserAdded" rs.Close db.Close End Sub Private Sub cmd_save_Click() If ValidateForm = True Then
57
db.Open db.E db.Ex xecute ute
"INSERT
INTO
OPBILL
VALUES( ES("
&
txt_bil billno.T no.Teext
&
"," ","
&
Combo_patid.Text & ",'" & txt_name.Text & _ "','" & Combo_dr.Text & "','" & DTP.Value & "'," & txt_amt.Text & _ "," & txt_pamt.Text & "," & txt_lamt.Text & "," & txt_tot.Text & " )" MsgBox "Record added successfully" db.Close Else m_MissingFields = Left(m_MissingFields, Len(m_MissingFields) - 1) MsgBox "Some fields(" & m_MissingFields & ")" & vbCrLf & " are missing, please fill the fields and try again", vbCritical + vbOKOnly, "Missing fields" m_MissingFields = "" End If End Sub Private Sub Combo_patid_Click() db.Open rs.Open "SELECT * FROM PATIENTDETAILS WHERE patientid='" + Combo_patid.Text + "'", db, adOpenDynamic, adLockOptimistic If Not rs.EOF() Then txt_name.Text = rs!Name Else MsgBox "Record not found"
58
End If rs.Close rs.Open "SELECT * FROM PHARBILL WHERE patientid=" + Combo_patid.Text + " ", db, adOpenDynamic, adLockOptimistic If Not rs.EOF() Then txt_pamt.Text = rs!tot rs.Close Else MsgBox "Not Found" End If rs.Close rs.Open "SELECT * FROM LABBILL WHERE patientid=" + Combo_patid.Text + " ", db, adOpenDynamic, adLockOptimistic If Not rs.EOF() Then txt_lamt.Text = rs!total rs.Close Else MsgBox "Amount field is empty" End If db.Close End Sub Private Sub Command2_Click() Unload Me
59
End Sub Private Sub Form_Load() connectdb db.Open rs.Open "DrREGISTRATION", db, adOpenDynamic, adLockOptimistic While Not rs.EOF Combo_dr.AddItem rs!drname rs.MoveNext Wend db.Close db.Open rs.Open "PATIENTDETAILS", db, adOpenDynamic, adLockOptimistic While Not rs.EOF Combo_patid.AddItem rs!patientid rs.MoveNext Wend db.Close db.Open rs.Open "SELECT COUNT(*) FROM OPBILL", db, adOpenDynamic, adLockOptimistic m_count = rs(0) If (m_count = 0) Then m_count = 1 txt_billno.Text = m_count
60
Else m_count = m_count + 1 txt_billno.Text = m_count End If db.Close End Sub Private Sub txt_amt_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then total = Val(txt_amt.Text) + Val(txt_lamt.Text) + Val(txt_pamt.Text) txt_tot.Text = total cmd_save.SetFocus End If End Sub Private Function ValidateForm() As Boolean Dim m_valid As Boolean m_valid = True If txt_name.Text = "" Then m_MissingFields = m_MissingFields & "Name," m_valid = False End If If txt_amt.Text = "" Then m_MissingFields = m_MissingFields & "Amount," m_valid = False
61
End If If txt_lamt.Text = "" Then m_MissingFields = m_MissingFields & "Lab Amount," m_valid = False End If If txt_pamt.Text = "" Then m_MissingFields = m_MissingFields & "Pharmacy Amount," m_valid = False End If If txt_tot.Text = "" Then m_MissingFields = m_MissingFields & "Total," m_valid = False End If ValidateForm = m_valid End Function
PHARMACY BILL
Dim i As Integer Dim j As Integer Dim amt As Double
62
Dim billno As Integer Dim m_MissingFields As String Private Sub cmd_save_Click() If ValidateForm = True Then For k = 1 To MSF.Rows - 2 db.Execute db.Execute ("INSERT ("INSERT INTO PHARBILL PHARBILL VALUES( " & txt_billno.Text txt_billno.Text & ",'" & DTP.Value DTP.Value & _ "','" & Combo_patid.Text & "','" & MSF.TextMatrix(k, 1) & "','" & MSF.TextMatrix(k, 2) & _ "'," & MSF.TextMatrix(k, 3) & "," & lblTotal.Caption & ")") Next MsgBox "Recorded added successfully" Else m_MissingFields = Left(m_MissingFields, Len(m_MissingFields) - 1) MsgBox "Some fields(" & m_MissingFields & ")" & vbCrLf & " are missing, please fill the fields and try again", vbCritical + vbOKOnly, "Missing fields" m_MissingFields = "" End If db.Close End Sub
Private Sub Combo_med_Click() rs.Open "SELECT * FROM MEDICINE WHERE medname='" + Combo_med.Text + "'", db, adOpenDynamic, adLockOptimistic
63
If Not rs.EOF() Then lblprice.Caption = rs!amt End If rs.Close txt_qty.SetFocus End Sub
Private Sub Command3_Click() Unload Me db.Close End Sub
Private Sub Form_Load() i=1 connectdb db.Open rs.Open "SELECT * FROM MEDICINE", db, adOpenDynamic, adLockOptimistic Combo_med.AddItem "" While Not rs.EOF() Combo_med.AddItem rs!medname rs.MoveNext Wend
64
rs.Close rs.O rs.Ope pen n
"SEL "SELEC ECT T
COUN COUNT( T(*) *) FROM FROM PHAR PHARBI BILL LL", ",
db, db,
adOp adOpen enDy Dyna nami mic, c,
adLockOptimistic billno = rs(0) If (billno = 0) Then txt_billno.Text = 1 Else billno = billno + 1 txt_billno.Text = billno End If rs.Close rs.Open "SELECT * FROM PATIENTDETAILS", db, adOpenDynamic, adLockOptimistic While Not rs.EOF() Combo_patid.AddItem rs!patientid rs.MoveNext Wend rs.Close End Sub
Private Sub txt_qty_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then MSF.TextMatrix(i, 0) = i MSF.TextMatrix(i, 1) = Combo_med.Text
65
MSF.TextMatrix(i, 2) = txt_qty.Text MSF.TextMatrix(i, 3) = CDbl(Val(txt_qty.Text) * Val(lblprice.Caption)) lblTotal.Caption = Val(lblTotal.Caption) + MSF.TextMatrix(i, 3) MSF.Rows = MSF.Rows + 1 i=i+1 txt_qty.Text = "" lblprice.Caption = "" Combo_med.ListIndex = 0 End If
End Sub Private Function ValidateForm() As Boolean Dim m_valid As Boolean m_valid = True If txt_qty.Text = "" Then m_MissingFields = m_MissingFields & "Qty," m_valid = False End If
ValidateForm = m_valid End Function
LAB BILL
66
Dim billno As Integer Dim i As Integer Dim k As Integer Dim m_MissingFields As String Private Sub combo_labtests_Click() If (combo_labtests.ListIndex = 0) Then Command4.Enabled = False Else Command4.Enabled = True End If rs.Open "SELECT * FROM LABUPDATE WHERE testname='" & combo_labtests.Text & "'", db, adOpenDynamic, adLockOptimistic If Not rs.EOF() Then lblamt.Caption = rs!amt End If rs.Close End Sub Private Sub Command2_Click() If ValidateForm = True Then For k = 1 To MSF.Rows - 2 db.E db.Exe xecu cute te ("IN ("INSE SER RT INT INTO LABB LABBIL ILL L VALUES LUES(( " & txt_ txt_bi bill llno no.T .Tex extt & ",'" ",'" & Combo_patid.Text & _
67
"','" & MSF.TextMatrix(k, 1) & "'," & MSF.TextMatrix(k, 2) & _ "," & lbl_tot.Caption & ")") Next MsgBox "Recorded added successfully" Else m_MissingFields = Left(m_MissingFields, Len(m_MissingFields) - 1) MsgBox "Some fields(" & m_MissingFields & ")" & vbCrLf & " are missing, please fill the fields and try again", vbCritical + vbOKOnly, "Missing fields" m_MissingFields = "" End If For k = 1 To MSF.Rows - 2 MSF.TextMatrix(k, 0) = "" MSF.TextMatrix(k, 1) = "" MSF.TextMatrix(k, 2) = "" Next MSF.Rows = 2 i=1 txt_billno.Text = billno + 1 db.Close End Sub
Private Sub Command3_Click() billno = billno - 1
68
db.Close Unload Me End Sub
Private Sub Command4_Click() MSF.TextMatrix(i, 0) = i MSF.TextMatrix(i, 1) = combo_labtests.Text MSF.TextMatrix(i, 2) = lblamt.Caption lbl_tot.Caption = Val(lbl_tot.Caption) + MSF.TextMatrix(i, 2) MSF.Rows = MSF.Rows + 1 i=i+1 combo_labtests.ListIndex = 0 lblamt.Caption = "" End Sub
Private Sub Form_Load()
If (combo_labtests.Text = "") Then Command4.Enabled = False Else Command4.Enabled = True End If i=1
69
connectdb db.Open combo_labtests.AddItem "" rs.Open "SELECT * FROM LABUPDATE", db, adOpenDynamic, adLockOptimistic While Not rs.EOF() combo_labtests.AddItem rs!testname rs.MoveNext Wend rs.Close rs.Open "SELECT * FROM PATIENTDETAILS", db, adOpenDynamic, adLockOptimistic While Not rs.EOF() Combo_patid.AddItem rs!patientid rs.MoveNext Wend rs.Close lbl_tot.Caption = 0 rs.Open "SELECT COUNT(*) FROM LABBILL", db, adOpenDynamic, adLockOptimistic billno = rs(0) rs(0) If (billno = 0) Then txt_billno.Text = 1 Else billno = billno txt_billno.Text = billno
70
End If rs.Close End Sub
Private Function ValidateForm() As Boolean Dim m_valid As Boolean m_valid = True If MSF.TextMatrix(2, 1) = "" Then m_MissingFields = m_MissingFields & "Test Name," m_valid = False End If ValidateForm = m_valid End Function
DISCHARGE SHEET
Dim m_MissingFields As String Dim w As Double Private Sub cmd_cancel_Click() Unload Me End Sub Private Sub cmd_save_Click() Dim roomno As Integer
71
If ValidateForm = True Then db.Open db.Execute ("INSERT INTO DISCHARGESHEET VALUES('" & txtPatID.Text & " ','" & txt_name.Text & "','" & txt_dr.Text & "', '" & txt_remarks.Text & "'," & txt_totbill.Text & ",'" & DTP.Value & "')") rs.Ope rs.Open n "SELECT "SELECT RoomNo RoomNo FROM FROM PATIEN PATIENTDE TDETAI TAILS LS WHERE WHERE patient patientid=' id='"" & Val(txtPatID.Text) & "'", db, adOpenDynamic, adLockOptimistic If Not rs.EOF Then roomno = rs!roomno End If rs.Close db.Execute ("UPDATE ADDROOM SET Allocated='N' WHERE roomno=" & roomno) MsgBox "Recorded added successfully" db.Close Else m_MissingFields = Left(m_MissingFields, Len(m_MissingFields) - 1) MsgBox "Some fields(" & m_MissingFields & ")" & vbCrLf & " are missing, please fill the fields and try again", vbCritical + vbOKOnly, "Missing fields" m_MissingFields = "" End If End Sub
Private Sub Form_Load()
72
connectdb End Sub Private Function ValidateForm() As Boolean Dim m_valid As Boolean m_valid = True If txt_remarks.Text = "" Then m_MissingFields = m_MissingFields & "Remarks ," m_valid = False End If If txt_totbill.Text = "" Then m_MissingFields = m_MissingFields & "Bill Amount," m_valid = False End If ValidateForm = m_valid End Function
INPATIENT SEARCH
Private Sub cmd_close_Click() Unload Me End Sub
Private Sub Combo_patid_Click()
73
db.Open rs.Open "SELECT * FROM PATIENTDETAILS WHERE patientid= '" + Combo_patid.Text + "'", db, adOpenDynamic, adLockOptimistic If Not rs.EOF() Then txt_name.Text = rs!Name txt_address.Text = rs!address Else MsgBox "Record not found" End If rs.Close 'rs 'rs.Op .Open
"SE "SELECT
*
FROM
ROOMALLOCA OCATION
WHERE
patie atient ntiid=
'"
&
Combo_patid.Text & "' " rs.Open "SELECT * FROM PATIENTDETAILS WHERE patientid= '" & Combo_patid.Text & "' and type='IP'" If Not rs.EOF() Then txt_roomno.Text = rs!roomno Else MsgBox "Record not found" End If db.Close End Sub Private Sub Form_Load() connectdb
74
db.Open rs.Open "SELECT * FROM PATIENTDETAILS WHERE type='IP'", db, adOpenDynamic, adLockOptimistic While Not rs.EOF() Combo_patid.AddItem rs!patientid rs.MoveNext Wend db.Close End Sub
DOCTOR SEARCH
Private Sub Combo1_Click() db.Open rs.Open "select * from DrREGISTRATION where drname='" + Combo1.Text + "' ", db, adOpenDynamic, adLockOptimistic Label6.Caption = rs!dept Label8.Caption = rs!consultationtime Label11.Caption = rs!address Label12.Caption = rs!contactno Label13.Caption = rs!emergencyno db.Close End Sub
75
Private Sub Command1_Click() Unload Me End Sub Private Sub Form_Load() connectdb db.Open rs.Open "DrREGISTRATION", db, adOpenDynamic, adLockOptimistic While Not rs.EOF Combo1.AddItem rs!drname rs.MoveNext Wend db.Close End Sub
MEDICINE UPDATES
Private Sub Command1_Click() db.Open db.Execute ("INSERT INTO MEDICINE VALUES('" & txt_mname.Text & "','" & Combo_medtype.Text & "'," & txt_amt.Text & ",'" & DTP.Value & "'," & txt_stock.Text & ")") MsgBox "Record Successfully added" db.Close
76
End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub Form_Load() connectdb Combo_medtype.Text = "Capsule" Combo_medtype.AddItem "Capsule" Combo_medtype.AddItem "Syrup" End Sub Private Sub Label1_Click() End Sub
ROOM ALLOCATION Dim m_MissingFields As String Private Sub Command1_Click() 'On Error GoTo er If ValidateForm = True Then db.Open db.Execute "INSERT INTO ROOMALLOCATION VALUES('" & txt_patid.Text & "'," & txt_roomno.Text & ",'" & combo_rtype.Text & "'," & txt_amt.Text & ")" MsgBox "Record added successfully"
77
db.Close Else m_MissingFields = Left(m_MissingFields, Len(m_MissingFields) - 1) MsgBox "Some fields(" & m_MissingFields & ")" & vbCrLf & " are missing, please fill the fields and try again", vbCritical + vbOKOnly, "Missing fields" m_MissingFields = "" End If End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub Form_Load() connectdb combo_rtype.Text = "Single room" combo_rtype.AddItem "Single room" combo_rtype.AddItem "Double room" End Sub Private Function ValidateForm() As Boolean Dim m_valid As Boolean m_valid = True If txt_patid.Text = "" Then m_MissingFields = m_MissingFields & "Patient ID," m_valid = False
78
End If If txt_roomno.Text = "" Then m_MissingFields = m_MissingFields & "Room No," m_valid = False End If If txt_amt.Text = "" Then m_MissingFields = m_MissingFields & "Amount," m_valid = False End If ValidateForm = m_valid End Function
79
OUTPUTS
Login
80
Admin Registration
Change Password
81
Doctor Registration
82
Patient Registration
83
In Patient Search
84
Medicine Update 85
IP Bill
Discharge Sheet
86
Doctor Search 87
88
CONCLUSION
The HOSPITAL MANAGEMENT SYSTEM is a great improvement over the manual system using case fields and paper. The computerization of the system has sped up the process. In the current system, the front office managing is very slow. The hospital managing system was thoroughly checked and tested with dummy data and thus is found to be very reliable.
ADVANTAGES
•
It is fast, efficient and reliable
•
Avoids data redundancy and inconsistency
•
Very user-friendly
•
Easy accessibility of data
•
•
Number Number of personnel personnel require required d is considerably considerably less Provides more security and integrity to data
89
FUTURE ENHANCEMENTS ENHANCEMENTS
The proposed system is Hospital Management System. We can enhance this system by including more facilities like billing system, inpatient room allotment for the admitted patients and the stock details of medicines in the pharmacy.
Providing such features enable the users to include more comments into the system.
90
BIBLIOGRAPHY
Books •
A Complete Guide to Programming in Visual Basic .Net -Michael McMillian
•
A Complete Visual Basic 6 Training Course: How to Programme: Package -Harvey M deitel,Paul j deitel,Tem R Neito
•
Advanced Programming Using Visual Basic: Version 6.0 -Julia Case Bradley
•
Access 2003 Power Programming with VBA -Allen G Taylor
•
Advanced MS Visual Basic -Peter Morris
Site Address •
www.associatedcontent.com
•
www.members.tripod.com
•
www.vbcodesource.com
91