-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin_diseases.py
122 lines (112 loc) · 4.42 KB
/
admin_diseases.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#Admin Module (Diseases Table)
import mysql.connector
def DisplayRec_Diseases():
conn=mysql.connector.connect(host="localhost",user="root",
password="tiger",database="project")
cur=conn.cursor()
print("*"*121)
cur.execute("Select * From diseases")
records=cur.fetchall()
for i in records:
print(i[0],i[1],i[2],i[3],i[4],sep=" | ")
print("*"*121)
#DisplayRec_Diseases()
def GetAdmno_Diseases():
conn=mysql.connector.connect(host="localhost",user="root",
password="tiger",database="project")
cur=conn.cursor()
query="SELECT SNO FROM diseases order by SNO desc limit 1"
cur.execute(query)
a=cur.fetchone()
return a[0]
def Insertion_Diseases():
conn=mysql.connector.connect(host="localhost",user="root",
password="tiger",database="project")
cur=conn.cursor()
print("*"*80)
SNo=GetAdmno_Diseases()+1
Dis=input("ENTER THE DISEASE \t\t:\t")
symp=input("ENTER THE SYMPTOMS \t\t:\t")
yoga=input("ENTER THE YOGA/ASANA \t\t:\t")
Diet=input("ENTER THE DIET OFFERED \t\t:\t")
print("*"*80)
query="INSERT INTO diseases VALUES({},'{}','{}','{}','{}')".format(SNo,Dis,symp,yoga,Diet)
cur.execute(query)
cur.execute("commit")
print("\t\t\t RECORD INSERTED SUCCESSFULLY")
print("*"*80)
#Insertion_Diseases()
def Updation_Diseases():
conn=mysql.connector.connect(host="localhost",user="root",
password="tiger",database="project")
cur=conn.cursor()
print("*"*80)
Dis=input("ENTER THE DISEASE\t\t:\t")
m1="SELECT * from Diseases where diseases='{}'".format(Dis)
cur.execute(m1)
cur.fetchall()
if cur.rowcount==0:
print("*"*80)
print("\t\t NO RECORD FOUND OF SUCH DISEASE NAME")
print("*"*80)
else:
print("*"*80)
while True:
print("\t\t\t 1. UPDATE SYMPTOMS ")
print("\t\t\t 2. UPDATE YOGA ASANA")
print("\t\t\t 3. UPDATE DIET OFFERED")
print("\t\t\t 4. EXIT")
print("*"*80)
choice =int(input("ENTER THE CHOICE\t\t:\t"))
print("*"*80)
if choice == 1:
new_sym= input("ENTER THE SYMPTOMS \t\t:\t")
print("*"*80)
query= "UPDATE Diseases SET Symptoms ='{}' WHERE Diseases='{}'".format(new_sym,Dis)
cur.execute(query)
cur.execute("commit")
print(" \t\t\t RECORD UPDATED SUCCESSFULLY")
print("*"*80)
if choice == 2:
new_asan= input("ENTER THE YOGA/ASANS \t\t:\t")
print("*"*80)
query= "UPDATE Diseases SET Yoga_Asanas ='{}' WHERE Diseases='{}'".format(new_asan,Dis)
cur.execute(query)
cur.execute("commit")
print(" \t\t\t RECORD UPDATED SUCCESSFULLY")
print("*"*80)
if choice == 3:
new_diet= input("ENTER THE DIET OFFERED \t\t:\t")
print("*"*80)
query= "UPDATE Diseases SET diet_offered ='{}' WHERE Diseases='{}'".format(new_diet,Dis)
cur.execute(query)
cur.execute("commit")
print(" \t\t\t RECORD UPDATED SUCCESSFULLY")
print("*"*80)
if choice==4:
break
print("*"*80)
#Updation_Diseases()
def Deletionmain_Diseases():
def Deletion(x):
query="SELECT * FROM Diseases WHERE Diseases = '{}'".format(x)
cur.execute(query)
cur.fetchall()
return cur.rowcount
conn=mysql.connector.connect(host="localhost",user="root",
password="tiger",database="project")
cur=conn.cursor()
print("*"*80)
x =input("ENTER THE DISEASE NAME \t:\t")
print("*"*80)
count= Deletion(x)
if count!= 0:
query= "DELETE FROM Diseases WHERE Diseases='{}'".format(x)
cur.execute(query)
print("\t\t\tRECORD DELETED SUCCESSFULLY")
print("*"*80)
cur.execute("commit")
else:
print(" \t\t NO RECORD FOUND OF SUCH DISEASE NAME")
print("*"*80)
#Deletionmain_Diseases()