You are on page 1of 23

MINI PROJECT REPORT

On
“Expert System on Hospital Management System”

A Report Submitted for a mini project for Artificial Intelligence Laboratory (310256) in 2nd
Semester of Third Year Computer Engineering
Academic Year 2023-24

Submitted by-
Sr No. Name of Student Roll No.
1. Aniket Prakash Salunkhe T213031

Guided by-
Prof. Rahul Naware

Zeal Education Society’s


Zeal College of Engineering & Research, Narhe, Pune-
411041.
Zeal Education Society’s
Zeal College of Engineering & Research Department of
Computer Engineering

CERTIFICATE

This is to certify that Project Entitled “Expert System on Hospital Management System”
carried out by Aniket Salunkhe (T213031) are Bonafide students of this institute and the work
has been carried out by him under the supervision of Prof. Rahul Naware and it is approved for
the partial fulfilment of the requirement of Savitribai Phule Pune University, for the award of
Third Year Engineering (Computer Engineering). It is certified that all corrections/suggestions
indicated for internal assignment have been incorporated in the report. The project report has been
approved as it satisfies the academic requirements in respect of project work prescribed for the
Bachelor of Engineering Degree.

Prof. Rahul Naware Prof. A. V. Mote


Project Guide H. O. D
Acknowledgement

I would like to express our deepest appreciation to all those who provided me the possibility to
complete this report. A special gratitude I will give to my micro project guide, Prof. Rahul Naware who
invested his full effort in guiding me in achieving the goal. My great obligation would remain towards
our Head of Department Prof. Aparna Mote, whose contribution in stimulating suggestions and
encouragement helped me for writing report. She provided with an opportunity to undertake the Micro
project at Zeal College of Engineering & Research, Narhe, Pune. I appreciate the guidance given by
other staff members of Computer Engineering Department for improving my presentation skills thanks
to their comment and advice. I sincerely thanks to our respected Principal proved to be a constant
motivation for the knowledge acquisition and moral support during our course curriculum.
ABSTRACT

A Hospital Management System (HMS) is a software solution that helps healthcare providers
manage their daily operations more efficiently. The system is designed to streamline administrative
and clinical processes, improve communication between staff members, and enhance patient care.

The HMS typically includes features such as patient registration, appointment scheduling, medical
billing and coding, inventory management, and patient medical records. The system can also help
healthcare providers manage staff schedules, track patient progress, and generate reports for data
analysis.

One of the key benefits of an HMS is that it can help healthcare providers improve the quality of
care they provide to patients. By automating processes and providing real- time data insights, the
system can help providers identify areas for improvement and make more informed decisions about
patient care.

Another benefit of an HMS is that it can improve the efficiency of healthcare operations. By
automating administrative tasks and reducing the amount of paperwork, staff members can spend more
time on patient care and other important tasks.

Overall, a hospital management system can be a valuable tool for healthcare providers looking to
improve the quality of care they provide and streamline their operations. With the right system in
place, providers can enhance patient care, reduce costs, and improve their bottom line.
INDEX

Sr No. Topic Name Page No

1. INTRODUCTION 1

2. ARCHITECTURE 2

3. PROGRAM CODE 3-12

4. OUTPUT 13-16

5. CONCLUSION 17

6. REFERENCES 18
Introduction

 What is an Expert System?

An expert system is a computer programmer created to solve complicated issues and offer decision-
making capabilities similar to those of a human expert. This is accomplished by the system retrieving
information from its knowledge base in accordance with user queries, utilizing reasoning and inference
procedures.

The first expert system (ES), which was the first effective use of artificial intelligence, was established
in the year 1970 and is a subset of AI. By drawing on the knowledge that is kept in its knowledge base, it
can solve even the most complicated problems like an expert. Like a human expert, the system aids in
decision-making for difficult issues by using both facts and heuristics. It is so named because it possesses
in-depth knowledge of a certain field and is capable of resolving any challenging issue in that field.
These systems are created for a certain industry, like science, medical, etc.

The knowledge that an expert system has stored in its knowledge base determines how well it performs.
The performance of the system increases as more knowledge is kept in the KB. The Google search box's
recommendation of spelling problems is one of the typical examples of an ES.

1
Architecture

Fig: Architecture for Hospital Management System

2
Program Code

import Read_Hospital_Excel_Sheet
import Write_Hospital_Excel_Sheet

def AppointmentIndexInDoctorsDataBase (patient_ID) :


for i in Doctors_DataBase :
for j in Doctors_DataBase[i] :
if str(patient_ID) == str(j[0]) :
Appointment_index = Doctors_DataBase[i].index(j)
return Appointment_index,i

print("********************************************************************")
print("* *")
print("* Welcome to Hospital Management System *")
print("* *")
print("********************************************************************")

tries = 0
tries_flag = ""
while tries_flag != "Close the program" :

Patients_DataBase = Read_Hospital_Excel_Sheet.Read_Patients_DataBase()
Doctors_DataBase = Read_Hospital_Excel_Sheet.Read_Doctors_DataBase()

print(" ")
print("|Enter 1 for Admin mode |\n|Enter 2 for User mode |")
print(" ")
Admin_user_mode = input("Enter your mode : ")

if Admin_user_mode == "1" : #Admin mode


print("*****************************************\n| Welcome to admin mode
|\n*****************************************")
Password = input("Please enter your password : ")
while True :

if Password == "1234" :
print(" ")
print("|To manage patients Enter 1 |\n|To manage doctors Enter 2 |\n|To manage
appointments Enter 3 |\n|To be back Enter E |")
print(" ")
AdminOptions = input ("Enter your choice : ")
3
AdminOptions = AdminOptions.upper()

if AdminOptions == "1" : #Admin mode --> Pateints


Management
print(" ")
print("|To add new patient Enter 1 |")
print("|To display patient Enter 2 |")
print("|To delete patient data Enter 3 |")
print("|To edit patient data Enter 4 |")
print("|To Back enter E |")
print(" ")
Admin_choice = input ("Enter your choice : ")
Admin_choice = Admin_choice.upper()

if Admin_choice == "1" : #Admin mode --> Pateints Management -->


Enter new patient data
try : #To avoid non integer input
patient_ID = int(input("Enter patient ID : "))
while patient_ID in Patients_DataBase : #if Admin entered used ID
patient_ID = int(input("This ID is unavailable, please try another ID : "))
Department=input("Enter patient department : ")
DoctorName=input("Enter name of doctor following the case : ")
Name =input("Enter patient name : ")
Age =input("Enter patient age : ")
Gender =input("Enter patient gender : ")
Address =input("Enter patient address : ")
RoomNumber=input("Enter patient room number : ")

Patients_DataBase[patient_ID]=[Department,DoctorName,Name,Age,Gender,Address,RoomNumber]
print(" Patient added successfully ")
except :
print("Patient ID should be an integer number")

elif Admin_choice == "2" : #Admin mode --> Pateints Management -->


Display patient data
try : #To avoid non integer input
patient_ID = int(input("Enter patient ID : "))
while patient_ID not in Patients_DataBase :
patient_ID = int(input("Incorrect ID, Please Enter patient ID : "))
print("\npatient name : ",Patients_DataBase[patient_ID][2])
print("patient age : ",Patients_DataBase[patient_ID][3])
print("patient gender : ",Patients_DataBase[patient_ID][4])
print("patient address : ",Patients_DataBase[patient_ID][5])
print("patient room number : ",Patients_DataBase[patient_ID][6])
print("patient is in "+Patients_DataBase[patient_ID][0]+" department")
print("patient is followed by doctor : "+Patients_DataBase[patient_ID][1])
4
except :
print("Patient ID should be an integer number")

elif Admin_choice == "3" : #Admin mode --> Pateints Management -->


Delete patient data
try : #To avoid non integer input
patient_ID = int(input("Enter patient ID : "))
while patient_ID not in Patients_DataBase :
patient_ID = int(input("Incorrect ID, Please Enter patient ID : "))
Patients_DataBase.pop(patient_ID)
print("----------------------Patient data deleted successfully --------------------- ")
except :
print("Patient ID should be an integer number")

elif Admin_choice == "4" : #Admin mode --> Pateints Management -->


Edit patient data
try : #To avoid non integer input
patient_ID=int(input("Enter patient ID : "))
while patient_ID not in Patients_DataBase :
patient_ID = int(input("Incorrect ID, Please Enter patient ID : "))
while True :
print(" ")
print("|To Edit pateint Department Enter 1 : |")
print("|To Edit Doctor following case Enter 2 : |")
print("|To Edit patient Name Enter 3 : |")
print("|To Edit patient Age Enter 4 : |")
print("|To Edit patient Gender Enter 5 : |")
print("|To Edit patient Address Enter 6 : |")
print("|To Edit patient RoomNumber Enter 7 : |")
print("|To be Back Enter E |")
print(" ")
Admin_choice = input("Enter your choice : ")
Admin_choice = Admin_choice.upper()
if Admin_choice == "1" :
Patients_DataBase[patient_ID][0]=input("\nEnter patient department : ")
print("----------------------Patient Department edited successfully-----------------
")

elif Admin_choice == "2" :


Patients_DataBase[patient_ID][1]=input("\nEnter Doctor follouing case : ")
print("----------------------Doctor follouing case edited successfully---------------
")

elif Admin_choice == "3" :


Patients_DataBase[patient_ID][2]=input("\nEnter patient name : ")
print("----------------------Patient name edited successfully --------------------- ")
5
elif Admin_choice == "4" :
Patients_DataBase[patient_ID][3]=input("\nEnter patient Age : ")
print("----------------------Patient age edited successfully --------------------- ")

elif Admin_choice == "5" :


Patients_DataBase[patient_ID][4]=input("\nEnter patient gender : ")
print("----------------------Patient address gender successfully----------------------
")

elif Admin_choice == "6" :


Patients_DataBase[patient_ID][5]=input("\nEnter patient address : ")
print("----------------------Patient address edited successfully----------------------
")

elif Admin_choice == "7" :


Patients_DataBase[patient_ID][6]=input("\nEnter patient RoomNumber : ")
print("----------------------Patient Room Number edited successfully--------------
")

elif Admin_choice == "E" :


break

else :
print("Please Enter a correct choice")
except :
print("Patient ID should be an integer number")

elif Admin_choice == "E" : #Admin mode --> Pateints Management -->


Back
break

else :
print("Please enter a correct choice\n")

elif AdminOptions == "2" : #Admin mode --> Doctors


Management
print(" ")
print("|To add new doctor Enter 1 |")
print("|To display doctor Enter 2 |")
print("|To delete doctor data Enter 3 |")
print("|To edit doctor data Enter 4 |")
print("|To be back enter E |")
print(" ")
Admin_choice = input ("Enter your choice : ")
Admin_choice = Admin_choice.upper()
6
if Admin_choice == "1" : #Admin mode --> Doctors Management -->
Enter new doctor data
try : #To avoid non integer input
Doctor_ID = int(input("Enter doctor ID : "))
while Doctor_ID in Doctors_DataBase : #if Admin entered used ID
Doctor_ID = int(input("This ID is unavailable, please try another ID : "))

Department=input("Enter Doctor department : ")


Name =input("Enter Doctor name : ")
Address =input("Enter Doctor address : ")
Doctors_DataBase[Doctor_ID]=[[Department,Name,Address]]
print(" Doctor added successfully ")
except :
print("Doctor ID should be an integer number")

elif Admin_choice == "2" : #Admin mode --> Doctors Management --


> Display doctor data
try : #To avoid non integer input
Doctor_ID = int(input("Enter doctor ID : "))
while Doctor_ID not in Doctors_DataBase :
Doctor_ID = int(input("Incorrect ID, Please Enter doctor ID : "))
print("Doctor name : ",Doctors_DataBase[Doctor_ID][0][1])
print("Doctor address : ",Doctors_DataBase[Doctor_ID][0][2])
print("Doctor is in "+Doctors_DataBase[Doctor_ID][0][0]+" department")
except :
print("Doctor ID should be an integer number")

elif Admin_choice == "3" : #Admin mode --> Doctors Management -->


Delete doctor data
try : #To avoid non integer input
Doctor_ID = int(input("Enter doctor ID : "))
while Doctor_ID not in Doctors_DataBase :
Doctor_ID = int(input("Incorrect ID, Please Enter doctor ID : "))
Doctors_DataBase.pop(Doctor_ID)
print("/----------------------Doctor data deleted successfully --------------------- /")
except :
print("Doctor ID should be an integer number")

elif Admin_choice == "4" : #Admin mode --> Doctors Management -->


Edit Doctor data
try : #To avoid non integer input
Doctor_ID=input("Enter doctor ID : ")
while Doctor_ID not in Doctors_DataBase :
Doctor_ID = int(input("Incorrect ID, Please Enter doctor ID : "))
print(" ")
7
print("|To Edit doctor's department Enter 1 |")
print("|To Edit doctor's name Enter 2 |")
print("|To Edit doctor's address Enter 3 |")
print("To be Back Enter E |")
print(" ")
Admin_choice=input("Enter your choice : ")
Admin_choice = Admin_choice.upper()
if Admin_choice == "1" :
Doctors_DataBase[Doctor_ID][0][0]=input("Enter Doctor's Department : ")
print("/----------------------Doctor's department edited successfully----------------------
/")

elif Admin_choice == "2" :


Doctors_DataBase[Doctor_ID][0][1]=input("Enter Doctor's Name : ")
print("----------------------Doctor's name edited successfully----------------------")

elif Admin_choice == "3" :


Doctors_DataBase[Doctor_ID][0][2]=input("Enter Doctor's Address : ")
print("----------------------Doctor's address edited successfully --------------------- ")

elif Admin_choice == "E" :


break
else :
print("\nPlease enter a correct choice\n")
except :
print("Doctor ID should be an integer number")
elif Admin_choice == "E" : #Back
break
else :
print("\nPlease enter a correct choice\n")

elif AdminOptions == "3" : #Admin mode --> Appointment


Management
print(" ")
print("|To book an appointment Enter 1 |")
print("|To edit an appointment Enter 2 |")
print("|To cancel an appointment Enter 3 |")
print("|To be back enter E |")
print(" ")
Admin_choice = input ("Enter your choice : ")
Admin_choice = Admin_choice.upper()
if Admin_choice == "1" : #Admin mode --> Appointment
Management --> Book an appointment
try : #To avoid non integer input
Doctor_ID = int(input("Enter the ID of doctor : "))
while Doctor_ID not in Doctors_DataBase :
8
Doctor_ID = int(input("Doctor ID incorrect, Please enter a correct doctor ID : "))
print(" ")
print("|For book an appointment for an exist patient Enter 1 |\n|For book an
appointment for a new patient Enter 2 |\n|To be Back Enter E |")
print(" ")
Admin_choice = input ("Enter your choice : ")
Admin_choice = Admin_choice.upper()
if Admin_choice == "1" :
patient_ID = int(input("Enter patient ID : "))
while patient_ID not in Patients_DataBase : #if Admin entered incorrect ID
patient_ID = int(input("Incorrect ID, please Enter a correct patient ID : "))

elif Admin_choice == "2" :


patient_ID = int(input("Enter patient ID : "))
while patient_ID in Patients_DataBase : #if Admin entered used ID
patient_ID = int(input("This ID is unavailable, please try another ID : "))
Department=Doctors_DataBase[Doctor_ID][0][0]
DoctorName=Doctors_DataBase[Doctor_ID][0][1]
Name =input("Enter patient name : ")
Age =input("Enter patient age : ")
Gender =input("Enter patient gender : ")
Address =input("Enter patient address : ")
RoomNumber=""

Patients_DataBase[patient_ID]=[Department,DoctorName,Name,Age,Gender,Address,RoomNumber]

elif Admin_choice == "E" :


break

Session_Start = input("Session starts at : ")


while Session_Start[ :2] == "11" or Session_Start[ :2] == "12" :
Session_Start = input("Appointments should be between 01:00PM to 10:00PM,
Please enter a time between working hours : ")

for i in Doctors_DataBase[Doctor_ID] :
if type(i[0])!=str :
while Session_Start >= i[1] and Session_Start < i[2] :
Session_Start = input("This appointment is already booked, Please Enter an
other time for start of session : ")
Session_End = input("Session ends at : ")

New_Appointment=list()
New_Appointment.append(patient_ID)
New_Appointment.append(Session_Start)
New_Appointment.append(Session_End)
9
Doctors_DataBase[Doctor_ID].append(New_Appointment)
print("/----------------------Appointment booked successfully --------------------- /")
except :
print("Doctor ID should be an integer number")

elif Admin_choice == "2" : #Admin mode --> Appointment


Management --> Edit an appointment
try : #To avoid non integer input
patient_ID = int(input("Enter patient ID : "))
while patient_ID not in Patients_DataBase :
patient_ID = int(input("Incorrect Id, Please Enter correct patient ID : "))
try : #To avoid no return function
AppointmentIndex,PairKey = AppointmentIndexInDoctorsDataBase(patient_ID)
Session_Start = input ("Please enter the new start time : ")
while Session_Start[ :2] == "11" or Session_Start[ :2] == "12" :
Session_Start = input("Appointments should be between 01:00PM to 10:00PM,
Please enter a time between working hours : ")

for i in Doctors_DataBase[Doctor_ID] :
if type(i[0])!=str :
while Session_Start >= i[1] and Session_Start < i[2] :
Session_Start = input("This appointment is already booked, Please Enter an
other time for start of session : ")
Session_End = input ("Please enter the new end time : ")

Doctors_DataBase[PairKey][AppointmentIndex]=[patient_ID,Session_Start,Session_End]
print("/----------------------appointment edited successfully --------------------- /")
except :
print("No Appointment for this patient")
except :
print("Doctor ID should be an integer number")

elif Admin_choice == "3" : #Admin mode --> Appointment


Management --> Cancel an appointment
try : #To avoid non integer input
patient_ID = int(input("Enter patient ID : "))
while patient_ID not in Patients_DataBase :
patient_ID = int(input("Invorrect ID, Enter patient ID : "))
try :
AppointmentIndex,PairKey = AppointmentIndexInDoctorsDataBase(patient_ID)
Doctors_DataBase[PairKey].pop(AppointmentIndex)
print("/----------------------appointment canceled successfully--------------------- /")
except :
print("No Appointment for this patient")
except : #To avoid no return function
print("Patient ID should be an integer number")
10
elif Admin_choice == "E" : #Back
break
else :
print("please enter a correct choice")
elif AdminOptions == "E" : #Back
break
else :
print("Please enter a correct option")
elif Password != "1234" :
if tries < 2 :
Password = input("Password incorrect, please try again : ")
tries += 1
else :
print("Incorrect password, no more tries")
tries_flag = "Close the program"
break

Write_Hospital_Excel_Sheet.Write_Patients_DataBase(Patients_DataBase)
Write_Hospital_Excel_Sheet.Write_Doctors_DataBase(Doctors_DataBase)

elif Admin_user_mode == "2" : #User mode


print("****************************************\n| Welcome to user mode
|\n****************************************")
while True :
print("\n ")
print("|To view hospital's departments Enter 1 |")
print("|To view hospital's doctors Enter 2 |")
print("|To view patients' residents Enter 3 |")
print("|To view patient's details Enter 4 |")
print("|To view doctor's appointments Enter 5 |")
print("|To be Back Enter E |")
print(" ")
UserOptions = input("Enter your choice : ")
UserOptions = UserOptions.upper()

if UserOptions == "1" : #User mode --> view hospital's departments


print("Hospital's departments :")
for i in Doctors_DataBase :
print(" "+Doctors_DataBase[i][0][0])

elif UserOptions == "2" : #User mode --> view hospital's Doctors


print("Hospital's doctors :")
for i in Doctors_DataBase :
print(" "+Doctors_DataBase[i][0][1]+" in "+Doctors_DataBase[i][0][0]+" department,
11
from "+Doctors_DataBase[i][0][2])

elif UserOptions == "3" : #User mode --> view patients' residents


for i in Patients_DataBase :
print(" Patient : "+Patients_DataBase[i][2]+" in "+Patients_DataBase[i][0]+" department
and followed by "+Patients_DataBase[i][1]+", age : "+Patients_DataBase[i][3]+", from :
"+Patients_DataBase[i][5]+", RoomNumber : "+Patients_DataBase[i][6])

elif UserOptions == "4" : #User mode --> view patient's details


try : #To avoid non integer input
patient_ID = int(input("Enter patient's ID : "))
while patient_ID not in Patients_DataBase :
patient_ID = int(input("Incorrect Id, Please enter patient ID : "))
print(" patient name : ",Patients_DataBase[patient_ID][2])
print(" patient age : ",Patients_DataBase[patient_ID][3])
print(" patient gender : ",Patients_DataBase[patient_ID][4])
print(" patient address : ",Patients_DataBase[patient_ID][5])
print(" patient room number : ",Patients_DataBase[patient_ID][6])
print(" patient is in "+Patients_DataBase[patient_ID][0]+" department")
print(" patient is followed by doctor : "+Patients_DataBase[patient_ID][1])
except :
print("Patient ID should be an integer number")

elif UserOptions == "5" : #User mode --> view doctor's appointments


try : #To avoid non integer input
Doctor_ID = int(input("Enter doctor's ID : "))
while Doctor_ID not in Doctors_DataBase :
Doctor_ID = int(input("Incorrect Id, Please enter doctor ID : "))
print(Doctors_DataBase[Doctor_ID][0][1]+" has appointments :")
for i in Doctors_DataBase[Doctor_ID] :
if type(i[0])==str :
continue
else :
print(" from : "+i[1]+" to : "+i[2])
except :
print("Doctor ID should be an integer number")

elif UserOptions == "E" : #Back


break

else :
print("Please Enter a correct choice")

else :

print("Please choice just 1 or 2")


12
Output

13
14
15
16
Conclusion

A hospital management system that includes admin and user management can greatly improve
the efficiency and effectiveness of healthcare facilities. With a user-friendly interface and streamlined
workflows, these systems can simplify administrative tasks and enable medical professionals to focus
more on patient care. Admin management features can include functions such as patient admissions,
doctors’ information, appointment scheduling, departments updating etc. User management features
can include access control, user authentication, hospital information and their appointments. By
centralizing information and automating processes, hospital management systems can reduce errors,
improve communication between staff members, and increase overall productivity. These systems can
also provide valuable data insights that can help healthcare administrators make informed decisions
about resource allocation and facility management. In conclusion, a hospital management system that
includes admin and user management can provide significant benefits to healthcare facilities, including
improved efficiency, increased productivity, and better patient care. Careful consideration and
implementation of such a system can result in a positive impact on the overall functioning of the
hospital.

17
REFERENCES

 https://www.javatpoint.com/expert-systems-in-artificial-intelligence

 https://www.researchgate.net/publication/367532226_Expert_system_in_hospital

 https://github.com/ronak-07/Medical-Expert-System-Knowledge-Base

 https://www.geeksforgeeks.org/expert-systems/

Submitted By:

Aniket Salunkhe
Roll no.: T213031
Div: TE-C

18

You might also like