














Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Computer science program code for class 12 on the topic inventory management
Typology: Study Guides, Projects, Research
1 / 22
This page cannot be seen from the preview
Don't miss anything!















On special offer
Kanjurmarg (W), Mumbai, Maharashtra - 400078 Entitled as
Name: - Sriraj Sunil Pillai Class: - XII - A Roll No: - 12148
Input/Output Requirement
Source Code ##hospital management software ##PRINTING WELCOME NOTE while(True): print(""" ==================================================== ============================= WELCOME TO SP HOSPITALS PVT. LTD. ==================================================== ============================= """) ##creating database connectivity import mysql.connector passwd=str(input("ENTER THE DATABASE PASSWORD;")) mysql=mysql.connector.connect(host="localhost",user= "root",passwd="ADMINISTRATOR12345") mycursor=mysql.cursor() #creating database mycursor.execute("create database if not exists SP_hospitals") mycursor.execute("use SP_hospitals") #creating the tables we need mycursor.execute("create table if not exists patient_details(name varchar(30) primary key, age int(3),address varchar(50),doctor_recommended varchar(30))") mycursor.execute("create table if not exists doctor_details(name varchar(30) primary key,specialisation varchar(40),age int(2),address varchar(30),contact varchar(15),fees int(10),monthly_salary int(10))")
u=input("ENTER YOUR PREFERRED USERNAME!!:") p=input("ENTER YOUR PREFERRED PASSWORD (PASSWORD SHOULD BE STRONG!!!:") #ENTERING THE ENTERED VALUE TO THE USER_DATA TABLE mycursor.execute("insert into user_data values('"+u+"','"+p+"')") mysql.commit() print(""" ==================================================== ============================= !!!!!!!!!!!!!!!!!!!!!!!!!!!REGISTERED SUCCESSFULLY!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ==================================================== ============================= """) x=input("enter any key to continue:") #IF USER WANTS TO LOGIN elif r==1: #PRINTING THE SINGIN OPTION AGAIN TO THE USER AFTER REGISTRATION print(""" ==================================================== ============================= !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! {{SIGN IN }} !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
un=input("ENTER THE USERNAME!!:") ps=input("ENTER THE PASSWORD!!:") mycursor.execute("select password from user_data where username='"+un+"'") row=mycursor.fetchall() for i in row: a=list(i) if a[0]==str(ps): while(True): ##displaying the task you can perform print(""" 1.ADMINISTRATION 2.PATIENT (ADMISSION AND DISCHARGE PROCESS) 3.SIGN OUT """) ##asking for the task from user a=int(input("ENTER YOUR CHOICE:")) #if user wants to enter administration option if a==1: print("""
d=dict(zip(k,v)) print(d) #if user wants to see the details of nurses elif c==2: mycursor.execute("select * from nurse_details") row=mycursor.fetchall() for i in row: v=list(i) k=["NAME","AGE","ADDRESS","CONTACT","MONTHLY_SALARY" ] d=dict(zip(k,v)) print(d) #if user wants to see the details of other_workers elif c==3: mycursor.execute("select * from other_workers_details") row=mycursor.fetchall() for i in row: v=list(i) k=["NAME","AGE","ADDRESS","CONTACT NO","MONTHLY_SALARY"] d=dict(zip(k,v)) print(d) #IF USER WANTS TO ENTER DETAILS elif b==2:
print("""
mycursor.execute("insert into other_workers_details values('"+name+"','"+age+"','"+add+"','"+cont+"','"+ ms+"')") mysql.commit() print("SUCCESSFULLY ADDED") #if unser wants to delete data elif b==3: print("""
print("SUCCESSFULLY DELETED!!") else: print("NOT DELETED") #deleting nurse details elif c==2: name=input("ENTER NURSE NAME:") mycursor.execute("select * nurse_details where name=='"+name+"'") row=mycursor.fetchall() print(row) p=input("you really wanna delete this data? (y/n):") if p=="y": mycursor.execute("delete from nurse_details where name='"+name+"'") mysql.commit() print("SUCCESSFULLY DELETED!!") else: print("NOT DELETED") #deleting other_workers details elif c==3: name=input("ENTER THE WORKER NAME:") mycursor.execute("select * from workers_details where name=='"+name+"'") row=mycursor.fetchall()
row=mycursor.fetchall() for i in row: b= v=list(i) k=["NAME","GENDER","AGE","ADDRESS","CONTACT"] d=dict(zip(k,v)) print(d) #adding new patient elif b==2: name=str(input("ENTER NAME: ")) age=str(input("ENTER AGE: ")) address=str(input("ADDRESS: ")) doc_r=str(input("iSSUE OF THE PATIENT: ")) mycursor.execute ("insert into patient_details values('"+name+"','"+age+"','"+address+"','"+doc_r+" ')") mysql.commit() mycursor.execute("select * from patient_details") for i in mycursor: v=list(i) k=['NAME','AGE','ADDRESS','ISSUE OF THE PATIENT'] print(dict(zip(k,v))) print(""" ==================================================== =============================
#dischare process elif b==3: name=input("ENTER THE PATIENT NAME:") mycursor.execute("select * from patient_details where name='"+name+"'") row=mycursor.fetchall() print(row) bill=input("HAS HE PAID ALL THE BILLS? (y/n):") if bill=="y": mycursor.execute("delete from patient_details where name='"+name+"'") mysql.commit() #if user wants to exit elif b==4: break ###SIGN OUT elif a==3: break #IF THE USERNAME AND PASSWORD IS NOT IN THE DATABASE else: print("The Entered Username and Password does not match with the accounts stored in the Database") break