-
Notifications
You must be signed in to change notification settings - Fork 0
/
T.py
178 lines (127 loc) · 6.32 KB
/
T.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
import mysql.connector
mydb = mysql.connector.connect(host="localhost", user="root", passwd="tarun123")
mycursor = mydb.cursor()
mydb.autocommit = True
mycursor.execute("create database if not exists covid_management")
mycursor.execute("use covid_management")
def add_patient():
name = input("\nEnter patients name: ")
age = int(input("Enter patients age: "))
gender = input("Enter patients gender(m/f): ")
date = input("Enter date of confirmation of covid: ")
mycursor.execute("select * from sno")
for i in mycursor:
patient, staff=i
patient = int(patient) + 1
mycursor.execute("insert into patients values('"+str(patient)+"','"+name+"','"+str(age)+"','"+gender+"','"+date+"')")
mycursor.execute("update sno set patient='"+str(patient)+"'")
mydb.commit()
print("\nData of Patient has been saved successfully!!\n")
mycursor.execute("select * from patients")
t=0
for i in mycursor:
t+=1
t_id1,name1,age1,gender1,date1=i
print(f"Total number of Corona infected patients: {patient}\n")
print(f"Active Corona cases: {t}\n")
print(f"This patient with id {t_id1} will be quarantine upto 14 days from {date1}")
def add_staff():
name = input("\nEnter staff name: ")
age = input("Enter age: ")
gender=input("Enter gender(m/f): ")
post = input("Enter his/her post: ")
salary = input("Enter his/her Salary: ")
mycursor.execute("select * from sno")
for i in mycursor:
patient,staff=i
staff=int(staff)+1
mycursor.execute("insert into staff values('"+str(staff)+"','"+name+"','"+age+"','"+gender+"','"+post+"','"+salary+"')")
mycursor.execute("update sno set staff='"+str(staff)+"'")
mydb.commit()
print(f"Staff with id(staff) has been saved successfully..")
mycursor.execute("select * from staff")
t=0
for i in mycursor:
t+=1
print(f"\nActive staff members: {t}\n")
def display_patients_record():
idd = input("\nEnter Patient's ID: ")
t_id2,name2,age2,gender2,date2=["", "", "", "", ""]
mycursor.execute("select * from patients where sno = '"+idd+"'")
for i in mycursor:
t_id2,name2,age2,gender2,date2=i
print("| ID | NAME | AGE | GENDER | CORONA POSITIVE DATE |")
print(f" | {t_id2} | {name2} | {age2} | {gender2} | {date2} |")
def display_staff_record():
idd = input("\nEnter Staff ID: ")
t_id3,name3,age3,gender3,past3,salary3=["", "", "", "", "", ""]
mydb.commit()
mycursor.execute("select * from staff where sno = '"+idd+"'")
for i in mycursor:
t_id3,name3,age3,gender3,past3,salary3=i
print("| ID | NAME | AGE | GENDER | POST | SALARY |")
print(f" | {t_id3} | {name3} | {age3} | {gender3} | {past3} | {salary3} |")
def remove_patient():
idd = input("\nEnter Patient ID: ")
mycursor.execute("delete from patients where sno = '"+idd+"'")
mydb.commit()
print("Patient has been removed successfully")
def remove_staff():
idd = input("\nEnter Staff ID: ")
mycursor.execute("delete from Staff where sno = '"+idd+"'")
mydb.commit()
print("Staff has been removed successfully")
def test():
print("Thank you for coming forward for your test")
icough=input("Are you feeling cough?(y/n): ").lower() #Y-->y
dry_cough = "n"
cough = "n"
if(icough == 'y' or icough == 'Y'):
dry_cough = input("Are you feeling dry cough(y/n): ").lower()
cough= input("Are you feeling wet cough(y/n): ").lower()
sneeze=input("Are you feeling sneeze?(y/n): ").lower()
pain=input("Are you feeling pain in your body?(y/n): ").lower()
weakness=input("Are you feeling weakness?(y/n): ").lower()
mucus=input("Are you feeling mucus?(y/n): ").lower()
itemp=int(input("Please enter your temprature: "))
if(itemp<=100):
temp="low" #low = <98
else:
temp="high" #high = >98
breath=input("Are you facing difficulty in breathing(y/n): ").lower()
if (dry_cough=='y'and sneeze=='y'and pain=='y'and weakness=='y'and mucus=='y' and temp =='high' and breath=='y'):
print("\n\nSORRY BUT ACCORDING TO THE ABOVE TEST RESULTS YOU ARE SUFFERING FROM COVID-19")
print("YOU ARE ADVISED TO BE IN SELF ISOLATION AS SOON AS POSSIBLE")
print("PLEASE CONTACT THE HEALTH SERVICES")
print("HELPLINE NUMBER: +91-11-23978046")
print("TOLL FREE: 1075")
print("HELPLINE E-MAIL ID: [email protected]\n\n")
name=input("Enter your name: ") #TAKES YOUR INFO. AND SAVES IT TO THE DATABASE
age=int(input("Enter your age: "))
gender=input("Enter your gender(m/f): ")
mycursor.execute("select * from sno")
for i in mycursor:
patient,staff=i
patient=int(patient)+1
mycursor.execute("insert into patients values('"+str(patient)+"','"+name+"','"+str(age)+"','"+gender+"',now())")
mycursor.execute("update sno set patient='"+str(patient)+"'")
mydb.commit()
print("Data of Patient has been saved successfully!!")
print(f"Total number of Corona infected patients: {patient}\n")
mycursor.execute("select * from patients")
#runs through the records and count them
t=0
for i in mycursor:
t+=1
print(f"Active Corona Cases are: {t}")
mycursor.execute("Select * from patients")
for i in mycursor:
t_id5,name5,age5,gender5,date5=i
print(f"This patient with id {t_id5} will be in quarantine for upto 14 days from {date5}")
elif(dry_cough == 'y' and sneeze == 'y' and pain == 'n' and weakness == 'n' and temp == 'low' and breath == 'n'):
print("\nNothing to worry, its just due to Air Pollution :) STAY HOME, STAY SAFE \n")
elif(cough == 'y' and mucus == 'y' and sneeze == 'y' and pain == 'n' and weakness == 'n' and temp == 'low' and breath == 'n'):
print("\nNothing to worry its just Common Cold :) STAY HOME, STAY SAFE \n")
else:
print("\nYou are not Corona infected, if you are not feeling well you just need to rest :)\n")
print("Still if you can't feel better, please consult doctor asap \n!!")