Skip to main content

Hospital Management Voice recognition Using Python


Folder Path:

Sqlite Database:

Python Code:

index.py


from tkinter import*
import tkinter
import webbrowser
import sqlite3
root=Tk()
root.geometry("1600x800+0+0")
root.title("SECURING PATIENT INFORMATION IN MEDICAL DATABASE")
w = Label(root,text="SECURING PATIENT INFORMATION IN MEDICAL DATABASE",bg="blue",fg="white",height=2,width=1000,font="Arial 20 bold").pack(side=TOP)
canvas = Canvas(root, width = 600, height = 330)      
canvas.pack()      
img = PhotoImage(file="image/3.png")      
canvas.create_image(5,5, anchor=NW, image=img)  
p="     Data security (patient privacy) has become especially critical to the healthcare industry with the adoption of electronic health records (EHR).\nIf  you  are trying to  figure out  what is the most secure    programming language, you are  probably  on  the wrong  path.  All  programming\n languages are not secure. An application becomes secure when the  developer  adopting  the  best  practice  and  best security  policies and \ntechniques.One of the most important functions for a medical practitioner while treating a patient  is  to study the patient's complete medical\n history by going through all records, from test results to doctor's notes. With  the increasing  use of technology  in  medicine, these records\n are mostly  digital, alleviating the problem of looking through a stack   of  papers,  which  are  easily misplaced,but some of  these  are  in  an\n unstructured form.Large parts of clinical reports are in written text form and are tedious to use directly without appropriate    pre-processing.\n In medical research, such health records may be a good, convenient source of medical data; however, lack of structure means that  the data \nis unfit for statistical evaluation. In this paper, we introduce a system to extract,store, retrieve,and analyse  information from health records,\nwith a focus on the Indian healthcare scene.                                                                                                                                                        "
L1=Label(root,text=(p),font="Arial 12 bold")
L1.pack()

# Doctor Menu Start

def adminsignup():
	filewin = Toplevel(root)
	filewin.title("SECURING PATIENT INFORMATION IN MEDICAL DATABASE")
	w = Label(filewin,text="SECURING PATIENT INFORMATION IN MEDICAL DATABASE",bg="blue",fg="white",font="Arial 10 bold").pack(side=TOP)
	list1 = ["ID                  :", "PASSWORD  :"]
	L1=Label(filewin,text=list1[0],font="Arial 12 bold")
	L1.pack()
	E1 = Entry(filewin, bd =5)
	E1.pack()
	L2=Label(filewin,text=list1[1],font="Arial 12 bold")
	L2.pack()
	E2 = Entry(filewin,show=".", bd =5)
	E2.pack()

	
	def callback():
		E3=E1.get()
		E4=E2.get()
		E5=E3
		E5="saran"
		E6=E4
		E6="bala"
		if E3==E5 and E4==E6:
			filewin = Toplevel(root)
			filewin.title("SECURING PATIENT INFORMATION IN MEDICAL DATABASE")
			s= Label(filewin,text="SECURING PATIENT INFORMATION IN MEDICAL DATABASE",bg="blue",fg="white",font="Arial 10 bold").pack(side=TOP)
			L6=Label(filewin,text="successfully Login")
			L6.pack()
			b1= Button(filewin,text="Appointment", width=10,bd=10,command=Appoint)
			b1.pack()
			b2= Button(filewin,text="Display", width=10,bd=10,command=display,state=DISABLED)
			b2.pack()
			b3= Button(filewin,text="Update", width=10,bd=10,command=update)
			b3.pack()
		else:
			filewin = Toplevel(root)
			filewin.title("SECURING PATIENT INFORMATION IN MEDICAL DATABASE")
			s= Label(filewin,text="SECURING PATIENT INFORMATION IN MEDICAL DATABASE",bg="blue",fg="white",font="Arial 10 bold").pack(side=TOP)
			L7=Label(filewin,text="Login Unsuccessful")
			L7.pack()		
	
	b = Button(filewin,text="get", width=10,command=callback)
	b.pack()

	def Appoint():
		import sqlite3
		db=sqlite3.connect('saran.db')
		cursor=db.cursor()
		def appget():
			cursor.execute('insert into time (name,age,disese,doctorname,location,date,time,id) values("%s","%s","%s","%s","%s","%s","%s","%s")' % \
			(E7.get(),E8.get(),E9.get(),E10.get(),E11.get(),E12.get(),E13.get(),E14.get()))
			db.commit()
			db.close()
			if E7.get() and E8.get() and E9.get() and E10.get() and E11.get() and E12.get() and E13.get() and E14.get():
				filewin = Toplevel(root)
				filewin.title("SECURING PATIENT INFORMATION IN MEDICAL DATABASE")
				s= Label(filewin,text="SECURING PATIENT INFORMATION IN MEDICAL DATABASE",bg="blue",fg="white",font="Arial 10 bold").pack(side=TOP)
				L7=Label(filewin,text="Record Store Successfully")
				L7.pack()
			else:
				filewin = Toplevel(root)
				filewin.title("SECURING PATIENT INFORMATION IN MEDICAL DATABASE")
				s= Label(filewin,text="SECURING PATIENT INFORMATION IN MEDICAL DATABASE",bg="blue",fg="white",font="Arial 10 bold").pack(side=TOP)
				L7=Label(filewin,text="Record did not Record")
				L7.pack()
				
				
				
			
		filewin = Toplevel(root)
		filewin.title("SECURING PATIENT INFORMATION IN MEDICAL DATABASE")
		w = Label(filewin,text="SECURING PATIENT INFORMATION IN MEDICAL DATABASE",bg="blue",fg="white",font="Arial 10 bold").pack(side=TOP)
		list1 = ["Patient Name             :", "age :","Disese :","Doctor name:","Location:","Date:","Time:","Patient Id:"]
		L1=Label(filewin,text=list1[0],font="Arial 12 bold")
		L1.pack()
		E7 = Entry(filewin, bd =5)
		E7.pack()
		L2=Label(filewin,text=list1[1],font="Arial 12 bold")
		L2.pack()
		E8 = Entry(filewin, bd =5)
		E8.pack()
		L3=Label(filewin,text=list1[2],font="Arial 12 bold")
		L3.pack()
		E9 = Entry(filewin, bd =5)
		E9.pack()
		L4=Label(filewin,text=list1[3],font="Arial 12 bold")
		L4.pack()
		E10 = Entry(filewin, bd =5)
		E10.pack()
		L5=Label(filewin,text=list1[4],font="Arial 12 bold")
		L5.pack()
		E11 = Entry(filewin, bd =5)
		E11.pack()
		L6=Label(filewin,text=list1[5],font="Arial 12 bold")
		L6.pack()
		E12 = Entry(filewin, bd =5)
		E12.pack()
		L7=Label(filewin,text=list1[6],font="Arial 12 bold")
		L7.pack()
		E13 = Entry(filewin, bd =5)
		E13.pack()
		L8=Label(filewin,text=list1[7],font="Arial 12 bold")
		L8.pack()
		E14 = Entry(filewin, bd =5)
		E14.pack()		
		b = Button(filewin,text="get", width=10,command=appget)
		b.pack()

	def display():	
		import display
		execfile(display.py)


	def update():	
		import tkinter  
		import tkinter.messagebox 
		import sqlite3
		conn = sqlite3.connect('saran.db')
		c = conn.cursor()
		class Application:
			def __init__(self, master):
				self.master = master
				self.heading = Label(master, text="Update Appointments",bg="blue",fg="white",font="Arial 10 bold" )
				self.heading.pack(side=TOP)

        # search criteria -->name 
				self.name = Label(master, text="Enter Patient's id",font="Arial 12 bold")
				self.name.pack()

        # entry for  the name
				self.namenet = Entry(master,bd=5)
				self.namenet.pack()

        # search button
				self.search = Button(master, text="Search", width=10, command=self.search_db)
				self.search.pack()
    # function to search
			def search_db(self):
				self.input = self.namenet.get()
        # execute sql 

				sql = "SELECT * FROM time WHERE id LIKE ?"
				self.res = c.execute(sql, (self.input,))
				for self.row in self.res:
					self.name = self.row[0]
					self.age = self.row[1]
					self.disese = self.row[2]
					self.doctorname = self.row[3]
					self.location = self.row[4]
					self.date = self.row[5]
					self.time= self.row[6]
        # creating the update form
				self.uname = Label(self.master, text="Patient's Name", font="Arial 12 bold")
				self.uname.pack()
				self.ent1 = Entry(self.master,bd=5)
				self.ent1.pack()
				self.ent1.insert(END, str(self.name))

				self.uage = Label(self.master, text="Age", font="Arial 12 bold")
				self.uage.pack()
				self.ent2 = Entry(self.master, bd=5)
				self.ent2.pack()
				self.ent2.insert(END, str(self.age))


				self.udisese = Label(self.master, text="Disese", font="Arial 12 bold")
				self.udisese.pack()
				self.ent3 = Entry(self.master,bd=5)
				self.ent3.pack()
				self.ent3.insert(END, str(self.disese))

				self.udoctorname = Label(self.master, text="Doctor name",font="Arial 12 bold")
				self.udoctorname .pack()
				self.ent4 = Entry(self.master, bd=5)
				self.ent4.pack()
				self.ent4.insert(END, str(self.doctorname))

				self.ulocation = Label(self.master, text="Location",font="Arial 12 bold")
				self.ulocation.pack()
				self.ent5 = Entry(self.master, bd=5)
				self.ent5.pack()
				self.ent5.insert(END, str(self.location))

				self.udate = Label(self.master, text="Date",font="Arial 12 bold")
				self.udate.pack()
				self.ent6 = Entry(self.master, bd=5)
				self.ent6.pack()
				self.ent6.insert(END, str(self.date))

				self.utime = Label(self.master, text="Time",font="Arial 12 bold")
				self.utime.pack()
				self.ent7 = Entry(self.master, bd=5)
				self.ent7.pack()
				self.ent7.insert(END, str(self.time))

				self.update = Button(self.master, text="Update", width=10, bg='lightblue', command=self.update_db)
				self.update.pack()

        # button to delete
				self.delete = Button(self.master, text="Delete", width=10, bg='red', command=self.delete_db)
				self.delete.pack()
			def update_db(self):
        # declaring the variables to update
				self.var1 = self.ent1.get() #updated name
				self.var2 = self.ent2.get() #updated age
				self.var3 = self.ent3.get() #updated gender
				self.var4 = self.ent4.get() #updated location
				self.var5 = self.ent5.get() #updated phone
				self.var6 = self.ent6.get() #updated time
				self.var7 = self.ent7.get() #updated time

				query = "UPDATE time SET name=?, age=?, disese=?,doctorname=?,location=?, date=?,time=? WHERE id LIKE ?"
				c.execute(query, (self.var1, self.var2, self.var3, self.var4, self.var5, self.var6,self.var7, self.namenet.get(),))
				conn.commit()
				tkinter.messagebox.showinfo("Updated", "Successfully Updated.")
			def delete_db(self):
        # delete the appointment
				sql2 = "DELETE FROM time WHERE id LIKE ?"
				c.execute(sql2, (self.namenet.get(),))
				conn.commit()
				tkinter.messagebox.showinfo("Success", "Deleted Successfully")
				self.ent1.destroy()
				self.ent2.destroy()
				self.ent3.destroy()
				self.ent4.destroy()
				self.ent5.destroy()
				self.ent6.destroy()
				self.ent7.destroy()
# creating the object
		root = Tk()
		b = Application(root)
		root.mainloop()	
		
		


		
		
menubar = Menu(root)
Adminmenu = Menu(menubar, tearoff=0)
Adminmenu.add_command(label="SignUp", command=adminsignup)
Adminmenu.add_separator()
Adminmenu.add_command(label="Exit", command=root.quit)
menubar.add_cascade(label="ADMIN", menu=Adminmenu)

# Doctor Menu End




# About Menu Start

def Medicinedetails():
	filewin = Toplevel(root)
	w = Label(filewin,text="SECURING PATIENT INFORMATION IN MEDICAL DATABASE",bg="blue",fg="white",font="Arial 20 bold").pack(side=TOP)
	Google=webbrowser.open_new(r"http://WWW.google.com")
	Google="Google"
	link=Label(filewin,text=(Google),fg="blue",cursor="hand2")
	link.pack()

	
def onlinebuy():
	filewin = Toplevel(root)
	w = Label(filewin,text="SECURING PATIENT INFORMATION IN MEDICAL DATABASE",bg="blue",fg="white",font="Arial 20 bold").pack(side=TOP)	

medimenu = Menu(menubar, tearoff=0)
medimenu.add_command(label="Medicine Details", command=Medicinedetails)
medimenu.add_command(label="Online Buy", command=onlinebuy)
medimenu.add_separator()
medimenu.add_command(label="Exit", command=root.quit)
menubar.add_cascade(label="MEDICINE", menu=medimenu)
root.config(menu=menubar)
# About Menu End


root.mainloop()

display.py


from tkinter import *
import sqlite3
import pyttsx3

# connection to database
conn = sqlite3.connect('saran.db')
c = conn.cursor()

# empty lists to append later
number = []
patients = []

sql = "SELECT * FROM time"
res = c.execute(sql)
for r in res:
    id = r[7]
    name = r[0]
    number.append(id)
    patients.append(name)

# window
class Application:
    def __init__(self, master):
        self.master = master

        self.x = 0
        
        # heading
        self.heading = Label(master,text="APPOINTMENT",bg="blue",fg="white",height=2,width=1000,font="Arial 20 bold")
        self.heading.pack(side=TOP)
        

        # button to change patients
        self.change = Button(master, text="Next Patient", width=25, height=2, bg='steelblue', command=self.func)
        self.change.place(x=550, y=600)

        # empty text labels to later config
        self.n = Label(master, text="",font="Arial 100 bold" )
        self.n.place(x=500, y=100)

        self.pname = Label(master, text="", font=('arial 80 bold'))
        self.pname.place(x=500, y=400)
    # function to speak the text and update the text
    def func(self):
        self.n.config(text=str(number[self.x]))
        self.pname.config(text=str(patients[self.x]))
        engine = pyttsx3.init()
        voices = engine.getProperty('voices')
        rate = engine.getProperty('rate')
        engine.setProperty('rate', rate-100)
        engine.say('Patient number ' + str(number[self.x]) + str(patients[self.x]))
        engine.runAndWait()
        self.x += 1
root = Tk()
b = Application(root)
root.geometry("1366x768+0+0")
root.mainloop()

Output:

Code & Concept Copyrights@Saravanakumar from psktechnology

Comments

Popular posts from this blog

SK Political Analytics-About us

புலவர் பழனிசாமி (மாவட்ட இலக்கிய அணி செயலாளர்) HOME            ABOUT US         OUR WORK        IMPACT

SK Political Analytics-Home

புலவர் பழனிசாமி (மாவட்ட இலக்கிய அணி செயலாளர்) HOME          ABOUT  US       OUR WORK        IMPACT

Swift UI Design

  // //  ContentView.swift //  test // //  Created by saravana kumar on 18/10/23. // import SwiftUI import CoreData struct ContentView : View {     @State private var selectedValue = "One"        let counts = [ "One" , "Two" , "Three" ]     var body : some View {       List () {                  HStack         {         Text ( "Add Paln" )                 . foregroundColor ( Color . gray )                 . font (. system ( size : 36 ))             Spacer ()         Image ( systemName : "xmark" )                 . foregroundColor ( Color . red )                     } ...