Hospital Management System PDF
Document Details
Uploaded by FancyPinkTourmaline7677
Tags
Summary
This project details a hospital management system designed using Python and MySQL. The system aims to automate hospital processes, including patient registration, appointments, and managing patient data. The project also outlines the system's functions, modules, and objectives.
Full Transcript
TOPIC OF THE PROJECT HOSPITAL MANAGEMENT 20__-__ Group members: 1) _____________ 2) _____________ 3) _____________ 1 BACKGROUND OF THE PROJECT 2 Pref...
TOPIC OF THE PROJECT HOSPITAL MANAGEMENT 20__-__ Group members: 1) _____________ 2) _____________ 3) _____________ 1 BACKGROUND OF THE PROJECT 2 Preface In this era of technology many systems are going to be automated through computerized systems. Hospital is also one of them. We are visiting hospitals quite often when someone is ill or any other health issue. Previous week I visited Krishna Hospital where my grandfather was admitted. There I have observed they are doing the work manually using register. This thought creates an idea to make this project for my practical evaluation and I talk to my group members and they all agreed to do so. Then I talked to my teacher and he said develop it using menu driven program in Python with MySQL connectivity. We have started working on it and here it is!! AIM: To develop a software to understand how the Hospital is managing the data of patients, doctors and others Title: Hospital Management System Problem Definition: Developing a software for a Hospital to understand how the hospital handles data and managing the database. 3 Introduction to Hospital Management In today’s world, all the things have become computerized. Generally, the hospital works on paper work. To register patient information, there is need of a lot paper work. So, this software is useful for doing hospital work easy. It registers the patient’s information. This information are follows: 1) aadhar no. 2) patient name 3) age 4) gender 5) phone no. 6) blood group. Generally, to take appointment, the patient has to call or meet the receptionist of the hospital. By using this software, you can easily take the appointment to the consultant doctor with date and time and appointment no. of that day. Hence, this software makes easy work for both patient and hospital management. 4 Objectives of the project Main objectives of a Hospital Management System are: Design a system for better patient care. Reduce hospital operating costs. Provide MIS (Management Information System) report on demand to management for better decision making. Better co-ordination among the different departments. Provide top management a single point of control. Hospital management System handles activities of major departments in a hospital like: 1. Front Office/OPD Management 2. Patient management (scheduling, registration and long-term care) 3. Patient care management and departmental modules (radiology, pharmacy and pathology labs) 4. Investigative Labs 5. Billing 6. Medical Stores 7. Financial Accounting (billing, insurance processing, materials management, accounts payable/receivable, payroll and general ledger) 8. Payroll Hospital management system is developed by using Python and MySQL for SSCE Practical Exam. It describes a development method that is linear and sequential. It has distinct goals for each phase of development. In this model once, a phase of development is completed, there is no turning back, the development proceeds to the next phase. The advantage of this model is that it allows for departmentalization and managerial control. 5 FUNCTIONS AND MODULES MODULES mysql.connecter: By importing this package, we are able to establish the connection between SQL and Python. datetime: This package provides basic functions for display date related values in the program. random: This package has functionality to generate random numbers and select numbers within a range. FUNCTIONS connect(): This function establishes connection between Python and MySQL. cursor(): It is a special control structure that facilitates the row-by-row processing of records in the result set. The syntax is: =.cursor() execute(): This function is use to execute the sql query and retrieve records using python. The syntax is:.execute() def(): This function is a block of code which only runs when it is called. fetchall(): This function will return all the rows from the result set in the form of a tuple containing the records. commit(): This function provides changes in the database physically. 6 FLOW OF THE PROJECT Our project is based on HOSPITAL MANAGEMENT. The project consists of 3 modules : 1. PATIENT 2. DOCTOR 3. EXIT In the PATIENT MODULE, you can have 5 options i.e. I. REGISTER YOURSELF: In this option, the patient can register himself/herself by entering their AADHAR NO., PATIENT NAME, AGE, GENDER, and PHONE NO. And BLOOD GROUP. II. APPOINTMENT: In this option, the patient can take appointment by entering AADHAR NO. After entering it, you will get list of doctor i.e. CARDIOLOGIST, RHEUMATOLOGIST, PSYCHITRIST, NEUROLOGIST, OTOLARYNGONOLOGIST and MI ROOM. III. LIST OF DOCTORS: In this option, you will get the LIST OF DOCTORS with their SPECIALITY and ROOM NO. IV. SERVICES AVAILABLE: In this option, you will get the list of services available in our hospital such as: X-RAY MRI CT SCAN ENDOSCOPY DIALYSIS ULTRASOUND EEG ENMG ECG 7 V. TO MODIFY DATA: In this option, you can change/modify the registered details given by patient. In the DOCTOR (ADMIN) MODULE, doctor has to enter his/her ID NO. And PASSWORD to know the appointment of the patient with their names, age, and appointment no. he/she has. In the last and final module i.e. EXIT MODULE, user can end the program. At last, program will display THANK YOU with giving a positive message i.e. ”STAY SAFE, STAY HEALTHY.” and “HEALTH IS WEALTH.” It will also display the names of developers. 8 USE OF TECHNOLOGY MySQL WHAT IS MySQL? MySQL is a relational DBMS that can run virtually all platforms, including Linux, Unix and Windows. Popular for web-based applications and online publishing, MySQL is a part of open-source enterprise stack LAMP (Linux, Apache, MySQL, PHP). MySQL is a freely available open source RDBMS that uses Structured Query Language (SQL). It is down-loadable from site www.mysql.org. MySQL is fast, reliable, scalable alternative to many of the commercial RDBMs available today. MySQL provides you with a rich set of features that support a secure environment for storing, maintaining, and accessing data. MySQL was created and supported by MySQL AB, a company based in Sweden. This company is now a subsidiary of Sun Microsystems, which holds the copyright to most of the codebase. On April 20th, 2009 Oracle Corp., which develops and sells the proprietary Oracle database, announced a deal to acquire Sun Microsystems. SQL provides many different types of commands used for different purposes. SQL commands can be divided into following categories: i. Data Definition Language (DDL) ii. Data Manipulation Language (DML) iii. Transaction Control Language (TCL) iv. Session Control Commands v. System Control Commands 9 WHAT IS PYTHON? Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding; make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python's simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse. The Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms, and can be freely distributed. Often, programmers fall in love with Python because of the increased productivity it provides. Debugging Python programs is easy: a bug or bad input will never cause a segmentation fault. Instead, when the interpreter discovers an error, it raises an exception. A source level debugger allows inspection of local and global variables, evaluation of arbitrary expressions, setting breakpoints, stepping through the code a line at a time, and so on. The debugger is written in Python itself, testifying to Python's introspective power. On the other hand, often the quickest way to debug a program is to add a few print statements to the source: the fast edit-test-debug cycle makes this simple approach very effective. 10 HARDWARE AND SOFTWARE REQUIREMENT SYSTEM: OS- Windows 7 Professional 32-Bit (6.1, Build 7601) Language: English System Manufacture-Gigabyte Technology Co., Ltd BIOS:- BIOS Date: 08/03/13 09:45:07 Ver: 04.06.05 Processor:- Intel (R) Core ™ i3-3220CPU @3.30 GHz (4CPUs), ~3.3GHz Memory: 2048 MB RAM DirectX Version: Direct XII DISPLAY DEVICE: Name:-Intel(R) HD Graphics Manufacturer: - Gigabyte Technology Co., Ltd Chip Type: - Intel(R) HD Graphics Family DAC Type:-Internal Approx. Total Memory:-775 MB Current Display mode: - 1336 X 768 (32 Bit)(60Hz) Monitor:- Generic PnP Monitor 11 Database Dictionary 1. Doctors 2. Nurses 3. Patients 12 4. Users 5. Workers 13 SOURCE CODE ##hospital management software @tutorialaicsip ##PRINTING WELCOME MESSAGE print(""" ================================ Welcome to Krishna Hospital ================================ """) ##Establishing connection and creating database along with required tables import mysql.connector as ms pd=str(input("Enter Database Password:")) cn=ms.connect(host="localhost",user="root",passwd="root") cur=cn.cursor() #creating database for hospital cur.execute("create database if not exists krishna_hospital") cur.execute("use krishna_hospital") cur.execute("create table if not exists patients\ (pid int(10) primary key,\ name varchar(30) not null,\ mobile varchar(10),\ age int(3),\ city varchar(50),\ doc_rec varchar(30))") 14 cur.execute("create table if not exists doctors\ (name varchar(30) primary key,\ department varchar(40),\ age int(2),\ city varchar(30),\ mobile varchar(15),\ fees int(10),\ salary int(10))") cur.execute("create table if not exists nurses\ (name varchar(30) primary key,\ age int(2),\ city varchar(30),\ mobile varchar(15),\ salary int(10))") cur.execute("create table if not exists workers\ (name varchar(30) primary key,\ age int(2),\ city varchar(30),\ mobile varchar(15),\ salary int(10))") #login or signup option for users #creating table for storing the username and password of the new user cur.execute("create table if not exists users\ (username varchar(30) primary key,\ 15 password varchar(30) default'000')") def sign_up(): print(""" ============================================ !!!!!!!Please enter new user details!!!!!!!! ============================================ """) u=input("Enter New User Name!!:") p=input("Enter password (Combination of Letters, Digits etc.):") #ENTERING THE ENTERED VALUE TO THE USER_DATA TABLE cur.execute("insert into users values('"+u+"','"+p+"')") cn.commit() print(""" ============================================= !!!!!!!!Congratulations!!!, New User Created...!!!!!!!! ============================================= """) def login(): #Login with username and password print(""" ============================================= !!!!!!!! {{Loginwith username and password }} !!!!!!!!!! ============================================= 16 """) un=input("Username!!:") ps=input("Password!!:") pid=0 cur.execute("select password from users where username='"+un+"'") rec=cur.fetchall() for i in rec: a=list(i) if a==str(ps): while(True): #Menu for Administrative Tasks print(""" 1.Admin Tasks 2.Patient (Admit and Discharge) 3.Sign Out """) #prompt message for the task from user a=int(input("Enter your choice:")) #Admin tasks if a==1: print(""" 1. Show Details 2. Add new member 17 3. Delete existing member 4. Exit """) b=int(input("Eter your choice:")) #Showing details of doctors, nurses and workers if b==1: print(""" 1. Doctors 2. Nurses 3. Workers """) #Prompt Message for users to show details c=int(input("ENTER YOUR CHOICE:")) #See the details of doctors if c==1: cur.execute("select * from doctors") rec=cur.fetchall() for i in rec: b=0 v=list(i) k=["NAME","DEPARTEMNT","AGE","CITY","MOBILE","FEES","SALARY"] d=dict(zip(k,v)) for i in d: print(i,":",d[i]) 18 print() #See the details of nurses elif c==2: cur.execute("select * from nurses") rec=cur.fetchall() for i in rec: v=list(i) k=["NAME","AGE","CITY","MOBILE","SALARY"] d=dict(zip(k,v)) for i in d: print(i,":",d[i]) print() #See the details of workers elif c==3: cur.execute("select * from workers") rec=cur.fetchall() for i in rec: v=list(i) k=["NAME","AGE","CITY","MOBILE","SALARY"] d=dict(zip(k,v)) for i in d: print(i,":",d[i]) print() #Add new member into hosptial team 19 elif b==2: print(""" 1. Doctor 2. Nurse 3. Worker """) c=int(input("Enter your choice:")) #New doctor details if c==1: #Prompt messages for doctor details name=input("Enter name of doctor:") dep=input("Enter department:") age=input("Enter age:") city=input("Enter city doctor belongs to:") mno=input("Enter 10 digit mobile no.:") fees=input("Enter fees:") sal=input("Enter Salary of doctor:") #Insert values into doctors table cur.execute("insert into doctors values('"+name+"','"+dep+"','"+age+"','"+city+"','"+mno+"','"+fees+"',' "+sal+"')") cn.commit() print("New doctor details has been added successfully. ") 20 #New nurse details elif c==2: #Prompt message for nurse details name=input("Enter name of nurse:") age=input("Enter age:") city=input("Enter city nurse belongs to:") mno=input("Enter mobile no.:") sal=int(input("Enter salary:")) #Insert value into nurses table cur.execute("insert into nurses values('"+name+"','"+age+"','"+city+"','"+mno+"','"+str(sal)+"')") cn.commit() print("New nurse details has been added successfully.") #New worker details elif c==3: #Prompt message for worker details name=input("Enter name of worker:") age=input("Enter Age:") city=input("Enter city:") mno=input("Enter mobile no:") ms=input("Enter Salary:") #Insert worker details into doctors table 21 cur.execute("insert into workers values('"+name+"','"+age+"','"+city+"','"+mno+"','"+ms+"')") cn.commit() print("SUCCESSFULLY ADDED") #Menu for delete data elif b==3: print(""" 1. Doctors 2. Nurses 3. Workers """) c=int(input("Enter your choice:")) #deleting doctor's details if c==1: name=input("Enter doctor name to delete:") cur.execute("select * from doctors where name='"+name+"'") rec=cur.fetchall() print(rec) p=input("you really wanna delete this data? (y/n):") if p=="y": cur.execute("delete from doctors where name='"+name+"'") 22 cn.commit() print("Doctor has been deleted successfully") else: print("Error in deletion....") #deleting nurse details elif c==2: name=input("Enter name of nurse:") cur.execute("select * nurses where name='"+name+"'") rec=cur.fetchall() print(rec) p=input("Are you really wanna delete this data? (y/n):") if p=="y": cur.execute("delete from nurses where name='"+name+"'") mysql.commit() print("Nurse has been deleted successfully.") else: print("Error in deletion") #deleting worker details elif c==3: name=input("Enter name of worker:") 23 cur.execute("select * from workers where name='"+name+"'") rec=cur.fetchall() print(rec) p=input("Are you really wanna delete this data? (y/n):") if p=="y": cur.execute("delete from workers where name='"+name+"'") cn.commit() print("Worker has been deleted.") else: print("Error in deletion.") elif b==4: print("Thank you! See you again! Have nice Day!") break #entering the patient details table elif a==2: print(""" 1. Show patient record 2. Admit new patient 3. Discharge Patient 4. Exit 24 """) b=int(input("ENTER YOUR CHOICE:")) #showing the existing details of patients #See the details of patient if b==1: cur.execute("select * from patients") rec=cur.fetchall() for i in rec: b=0 v=list(i) k=["NAME","GENDER","AGE","CITY","MOBILE NO"] d=dict(zip(k,v)) for i in d: print(i,":",d[i]) #Admit a new patient elif b==2: pid=pid+1 name=str(input("Enter name of patient: ")) age=str(input("Enter age: ")) city=str(input("Enter City: ")) mn=str(input("Enter Mobile no.: ")) cur.execute("select name from doctors") rec=cur.fetchall() 25 print(rec) dr=str(input("Enter doctorname to be recommended:")) cur.execute ("insert into patients values('"+str(pid)+"','"+str(name)+"','"+str(mn)+"','"+str(age)+"','"+str( city)+"','"+str(dr)+"')") cn.commit() print(""" ==================================== !!!!!!!New patient admitted!!!!!! ==================================== """) #dischare a patient elif b==3: name=input("Enter the name of patient to discharge:") cur.execute("select * from patients where name='"+name+"'") rec=cur.fetchall() print(rec) bill=input("Bill payemt (y/n):") if bill=="y": cur.execute("delete from patients where name like'%"+name+"%'") 26 cn.commit() elif bill=="n": print("Please pay your pending bill amount to discahrge patient.") else: print("Bill payment status is unknown....") #if user wants to exit elif b==4: break ###SIGN OUT elif a==3: break def change_pass(): cur.execute("select username from users") rec=cur.fetchall() for i in rec: v=list(i) k=["USERNAME"] d=dict(zip(k,v)) print(d) u=input("Enter username to change password from above:") if u in d.values(): pd=input("Enter New Password:") pd1=input("Renter New Password again:") 27 if pd==pd1: cur.execute("update users set password='"+pd+"'where username='"+u+"'") cn.commit() print("Password Changed Successfully.") else: print("Password did not match...") else: print("Username not found") #Main Menu r=0 while r!=4: print(""" 1. Sign Up (New User) 2. Log In 3. Change Password 4. Exit """) r=int(input("Enter your choice:")) #New User Registration if r==1: sign_up() elif r==2: login() elif r==3: change_pass() elif r==4: print("Thank you for using Krishna Hospital App, Have a nice day!") break 28 Output 1. Main Menu 2. Sign Up 29 3. Log In 4. Change password 5. Admin Task 30 6. Show details & Doctor Details 7. Add New member 31 8. Delete Doctor 9. Show Patient details 32 10. Admit a patient 11. Show patient record 33 12. Discharge Patient 13. Sign Out 34 BIBLIOGRAPHY To develop this project many references were used: 1. Computer Science Textbook Class 12: Sumita Arora 2. NCERT Textbook 3. https://www.google.com 4. https://www.python.org.in 5. https://www.mysql.org 6. https://www.tutorialaicsip.com 35