hospital mangement project report
Post on 22-Oct-2014
148 Views
Preview:
TRANSCRIPT
PROJECT REPORTON
HOSPITAL MANAGEMENT SYSTEM
SUBMITTED IN THE PARTIAL FULFILLMENT OF THE REQUIREMENT FOR THE DEGREE Bsc-IT
(2009-2012)
UNDER THE GUIDANCE OF SUBMITTED BY Mr
S.no Topic Page No.
1 Acknowlegement 2
2 Certificate 3
3 Introduction 4
4 Objectives 5
5 System Specification 6`
6 Data flow Diagram 7-8
7 Entity-Relationship Diagram 9
8 Software Description 10-12
9 Database Design 13-16
10 Coding 17-51
11 Output 52-60
12 Conclusion 6113 Future improvements 62
14 Bibliography 63
Table of Content
ACKNOWLEDGEMENT
1
I am heartily thankful to my supervisor, Mr. Nitin Pandey, whose
encouragement, guidance and support from the initial to the final level
enabled me to develop an understanding of the project.
Lastly, I offer my regards to all of those who supported me in any
respect during the completion of the project.
Certificate2
This is to certify that the project entitled “Hospital Management
System” is a bonafide record of the summer project carried out by
Mr.under my supervision and guidance of the requirement for the
degree B.Sc.-IT from University.
Mr. (Project Guide)
INTRODUCTION
3
Our project Hospital Management system includes registration of patients,
storing their details into the system, and also computerized billing in the 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 Hospital Management System can be entered using a username
and password. It is accessible either by an administrator or receptionist. Only they
can add data into the database. The data can be retrieved easily. The interface is
very user-friendly. The data are well protected for personal use and makes the data
processing very fast.
OBJECTIVE
4
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
SYSTEM SPECIFICATION
5
1. Hardware Requirements
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
OS : MS WINDOWS XP SP2
Front End : Visual Basic 6.0
Back End : Microsoft Access 2003
DATA FLOW DIAGRAMS
6
DFD for Login Module
DFD for Billing process
7
Ok
Rejected
User
Password Verifying User Name and Password
Administrator
Enter Administrator/User
Login File
User Password
Details
Item
Sales process
User
File
Stock FileBilling process
Updating process
Customer
Item
Bill
Quotation Details
Item Code
ENTITY RELATIONSHIP DIAGRAMS
8
SOFTWARE DESCRIPTION
9
Works On
Employee Department
Date-Started
Dept numberDept
Name
Emp- Number
Name
Address
Controls
Administrator
HOD
Doctor
Dr-ID
Name
Address
Works On
Name
Treated by
Patient
Patient ID
Name
Address
Microsoft Visual Basic 6.0
Visual Basic 6.0 is Microsoft’s latest version of the Visual Basic Programming
language. Although writing programs can be a tedious chore at time. Visual Basic
reduces the effort required on your part, and makes programming enjoyable. 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 language; the secret to Visual Basic
is in its name” Visual”. With to days Windows Operating System, a program 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 development environment
in which you can develop, run, test and debug your applications. The impressive
array of programming resources provided by Visual Basic enables to create the
objects extemporaneously which can range from pop-up menu to a message box.
A form is a major part of Visual Basic application, which allows the user to enter the
data as well as view the result. A control is an object that we draw on a form to
enable or enhance user interaction with an application. Hence a Visual Basic
application is a combination of object like forms and controls, procedures that can
respond to Events and other general-purpose procedures.
Microsoft Access 2003.
10
Microsoft Access is the default database of Microsoft Visual Basic. Microsoft Access
2003 provides many new features that make working with data and designing a
database even easier. Microsoft Access Database is a collection of data and objects
related to particular topic or purpose. Microsoft Access Database may contain tables;
queries, forms, 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 database can have several small tables.
Microsoft Office Access, previously known as Microsoft Access, is a relational
database management system from Microsoft that combines the relational Microsoft
Jet Database 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
ODBC-compliant 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 object-oriented 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 ProComm and other programs. This proved a failure and was dropped.
Years later Microsoft reused the name for its database software.
Access is used by small businesses, within departments of large corporations, and by
hobby programmers to create ad hoc customized desktop systems for handling the
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 professional application developers use Access for rapid application
development, especially for the creation of prototypes and standalone applications
that serve as tools for on-the-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
11
to rely on Client-Server based solutions. 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 query language) —queries may be viewed and
edited as SQL 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. 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.
In ADP files (supported in MS Access 2003 and later), the database-related 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).
12
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 quickly and effectively. After designing the input and output, the
analyst 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
File Name :- Login
Field Name Description Data Type Width
User Name User Name Text 50
Password User Name Text 50
File Name :- Doctor Registration
13
Field Name Description Data Type Width
Dr name Doctor Name Text 50
Sex Sex Text 50
Dept Department Text 50
Consultation time Consultation Time Text 50
Address Address Text 50
Contact no Contact Number Long 50
Emergency no Emergency Number Long 50
Consult fee Consultation fees Long 50
Date Date Date/Time 50
Consultation day Consultation Day Text 50
Tot pat Total Patient Double 50
File Name:-Patient Details
Field Name Description Data Type Width
Name Name Text 50
Age Age Integer 50
Sex Sex Text 50
Address Address Text 50
Doctor Doctor Text 50
Patient id Patient id Text 50
Reg fee Registration fees Double 50
14
Admin Date Admitted Date Date/Time 50
Room no Room Number Integer 50
File Name:-Medicine
Field Name Description Data Type Width
Medname Medicine Name Text
Medtype Medicine Type Text
Amt Amount Double
Expdate Expiry Date Date/Time
Stock Stock Double
File Name:-Discharge Sheet
Field Name Description Data Type Width
Patient id Patient id Double 50
Name Name Text 50
Doctor Doctor Text 50
Remark Remark Text 50
15
Totbill Total Bill Double 50
Date Date Date/Time 50
CODING
16
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
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
17
MsgBox "EOF Reached"
End If
End If
db.Close
End Sub
Private Sub Command4_Click()
db.Open
Set rs = db.Execute("SELECT * FROM STAFFLOGIN where username='" &
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
End Sub
Private Sub Form_Load()
connectdb
End Sub
ADMINISTRATOR REGISTRATION
18
Private Sub cmd_cancel_Click()
Unload Me
End Sub
Private Sub cmd_save_Click()
db.Open
db.Execute ("INSERT INTO LOGIN VALUES ('" & txt_username.Text & "','" &
txt_password.Text & "')")
MsgBox "Record added successfully"
db.Close
End Sub
Private Sub Form_Load ()
connectdb
End Sub
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
19
rs!contactno = txt_contactno.Text
rs!emergencyno = txt_emergency.Text
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
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"
20
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
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
21
m_MissingFields = m_MissingFields & "Fees,"
m_valid = False
End If
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 "SELECT totpat FROM DrREGISTRATION WHERE drname='" &
Combo_drpref.Text & "' ", db, adOpenDynamic, adLockOptimistic
If Not rs.EOF() Then
m_totpat = rs!totpat
Else
MsgBox "Not found"
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
22
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
Private Sub Combo_patid_Click()
db.Open
rs.Open "SELECT * FROM PATIENTDETAILS WHERE patientid='" &
Combo_patid.Text & "'", 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
23
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"
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.Execute ("UPDATE ADDROOM SET Allocated='Y' WHERE 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
End If
db.Close
'm_patid = m_patid + 1
txt_address.Text = ""
txt_age.Text = ""
24
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
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
25
db.Close
End If
End Sub
Private Sub Command4_Click ()
Unload Me
End Sub
Private Sub Command5_Click ()
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.Open "SELECT COUNT (*) FROM PATIENTDETAILS", db, adOpenDynamic,
adLockOptimistic
If (rs(0) = 0) Then
m_patid = 1
txt_patientid.Text = m_patid
Else
m_patid = rs(0) + 1
txt_patientid.Text = rs (0) + 1
End If
26
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
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,"
27
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
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.Open "SELECT roomno FROM ADDROOM WHERE Allocated='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
28
EDIT DOCTOR
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
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
29
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
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()
30
Unload Me
End Sub
Private Sub Form_Load()
connectdb
db.Open
rs.Open "PATIENTDETAILS", db, 3, 3
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
rs.Open "select * from LABBILL where patientid=" + Combo_patid.Text + " ", db,
adOpenDynamic, adLockOptimistic
If Not rs.EOF() Then
w = w + rs("total")
Else
31
'MsgBox "Record not found"
w = w
End If
rs.Close
rs.Open "select * from PHARBILL where patientid=" + Combo_patid.Text + " ", db,
adOpenDynamic, adLockOptimistic
If Not rs.EOF() Then
w = w + rs("tot")
Else
'MsgBox "Record not found"
w = w
End If
rs.Close
rs.Open "select * from IPBILL where patientid=" + Combo_patid.Text + " ", db,
adOpenDynamic, adLockOptimistic
If Not rs.EOF() Then
w = w + rs("tot")
Else
'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
32
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
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
If Not rs.EOF() Then
txt_regdate.Text = rs!admindate
txt_name.Text = rs!Name
txt_regdate.Text = rs!admindate
33
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
End Sub
Private Sub Form_Load()
connectdb
db.Open
rs.Open "SELECT patientid FROM PATIENTDETAILS WHERE Type='IP'", 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
34
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
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
35
OUTPATIENT BILL
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
db.Open
db.Execute "INSERT INTO OPBILL VALUES(" & txt_billno.Text & "," &
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
36
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"
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
37
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_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
Else
m_count = m_count + 1
txt_billno.Text = m_count
End If
db.Close
End Sub
38
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
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
39
PHARMACY BILL
Dim i As Integer
Dim j As Integer
Dim amt As Double
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 ("INSERT INTO PHARBILL VALUES( " & txt_billno.Text & ",'" &
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
If Not rs.EOF() Then
lblprice.Caption = rs!amt
40
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
rs.Close
rs.Open "SELECT COUNT(*) FROM PHARBILL", db, adOpenDynamic,
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()
41
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
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
42
LAB BILL
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.Execute ("INSERT INTO LABBILL VALUES( " & txt_billno.Text & ",'" &
Combo_patid.Text & _
"','" & 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 = ""
43
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
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
44
Command4.Enabled = True
End If
i = 1
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)
If (billno = 0) Then
txt_billno.Text = 1
Else
billno = billno
txt_billno.Text = billno
End If
rs.Close
End Sub
Private Function ValidateForm() As Boolean
Dim m_valid As Boolean
45
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
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.Open "SELECT RoomNo FROM PATIENTDETAILS WHERE patientid='" &
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
46
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()
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()
db.Open
47
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.Open "SELECT * FROM ROOMALLOCATION WHERE patientid= '" &
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
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
48
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
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
49
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
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"
db.Close
Else
50
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
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
51
OUTPUTS
Login
Pop up Screen
52
Admin Registration
Change Password
53
Doctor Registration
54
Patient Registration
55
In Patient Search
56
Medicine Update
57
IP Bill
Discharge Sheet
58
Doctor Search
59
CONCLUSION60
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 of personnel required is considerably less
Provides more security and integrity to data
FUTURE IMPROVEMENTS
61
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.
BIBLIOGRAPHY
62
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
63
top related