通过一个项目让护士女友发了一万奖金,疫苗管理系统!

entry6 = tk.Entry(add_vaccine_distr_info, font=(“Arial, 9”), width=46)

entry7 = tk.Entry(add_vaccine_distr_info, font=(“Arial, 9”), width=46)

entry1.pack()

entry2.pack()

entry3.pack()

entry4.pack()

entry5.pack()

entry6.pack()

entry7.pack()

entry1.place(x=180, y=60, width=350)

entry2.place(x=180, y=90, width=350)

entry3.place(x=180, y=120, width=350)

entry4.place(x=180, y=150, width=350)

entry5.place(x=180, y=180, width=350)

entry6.place(x=180, y=210, width=350)

entry7.place(x=180, y=240, width=350)

def add():

text1 = entry1.get()

text2 = entry2.get()

text3 = entry3.get()

text4 = entry4.get()

text5 = entry5.get()

text6 = entry6.get()

text7 = entry7.get()

content = “INSERT INTO vaccine_distr_info (” \

“vaccine_distr_num, date, vaccine_num, vaccine_name, company_num, operator_num, num” \

“)” \

" VALUES (%s, ‘%s’, ‘%s’, ‘%s’, ‘%s’, ‘%s’, ‘%s’);" % (

text1, text2, text3, text4, text5, text6, text7)

self.connect_DBS(database=“vaccine_info”, content=content)

tkinter.messagebox.showinfo(title=“信息”, message=“数据添加成功!”)

def clear():

entry1.delete(0, “end”)

entry2.delete(0, “end”)

entry3.delete(0, “end”)

entry4.delete(0, “end”)

entry5.delete(0, “end”)

entry6.delete(0, “end”)

entry7.delete(0, “end”)

tkinter.messagebox.showinfo(title=“信息”, message=“数据已清空,请继续添加!”)

tk.Button(add_vaccine_distr_info, text=“添加”, bg=‘white’, font=(“Arial,9”), width=9, height=0,command=add).place(x=400,y=360)

tk.Button(add_vaccine_distr_info, text=“清空”, bg=‘white’, font=(“Arial,9”), width=9, height=0,command=clear).place(x=160,y=360)

新建疫苗养护信息

å¾ç

def add_vaccine_maintenance_info(self):

vaccine_maintenance_info = tk.Toplevel(app)

vaccine_maintenance_info.title(‘添加疫苗养护信息’)

vaccine_maintenance_info.geometry(“600x400”)

tk.Label(vaccine_maintenance_info, text=‘养护疫苗批号:’, font=(“Arial”, 9)).place(x=80, y=60)

tk.Label(vaccine_maintenance_info, text=‘养护疫苗名称:’, font=(‘Arial’, 9)).place(x=80, y=90)

tk.Label(vaccine_maintenance_info, text=’ 管理员编号:', font=(‘Arial’, 9)).place(x=80, y=120)

tk.Label(vaccine_maintenance_info, text=’ 管理员姓名:', font=(‘Arial’, 9)).place(x=80, y=150)

tk.Label(vaccine_maintenance_info, text=’ 养护时间:', font=(‘Arial’, 9)).place(x=80, y=180)

tk.Label(vaccine_maintenance_info, text=’ 冷藏室温度:', font=(‘Arial’, 9)).place(x=80, y=210)

tk.Label(vaccine_maintenance_info, text=’ 冷冻室温度:', font=(‘Arial’, 9)).place(x=80, y=240)

tk.Label(vaccine_maintenance_info, text=‘设备运转情况:’, font=(‘Arial’, 9)).place(x=80, y=270)

tk.Label(vaccine_maintenance_info, text=’ 是否报警:', font=(‘Arial’, 9)).place(x=80, y=300)

entry1 = tk.Entry(vaccine_maintenance_info, font=(“Arial, 9”), width=46)

entry2 = tk.Entry(vaccine_maintenance_info, font=(“Arial, 9”), width=46)

entry3 = tk.Entry(vaccine_maintenance_info, font=(“Arial, 9”), width=46)

entry4 = tk.Entry(vaccine_maintenance_info, font=(“Arial, 9”), width=46)

entry5 = tk.Entry(vaccine_maintenance_info, font=(“Arial, 9”), width=46)

entry6 = tk.Entry(vaccine_maintenance_info, font=(“Arial, 9”), width=46)

entry7 = tk.Entry(vaccine_maintenance_info, font=(“Arial, 9”), width=46)

entry8 = tk.Entry(vaccine_maintenance_info, font=(“Arial, 9”), width=46)

entry9 = tk.Entry(vaccine_maintenance_info, font=(“Arial, 9”), width=46)

entry1.pack()

entry2.pack()

entry3.pack()

entry4.pack()

entry5.pack()

entry6.pack()

entry7.pack()

entry8.pack()

entry9.pack()

entry1.place(x=180, y=60, width=350)

entry2.place(x=180, y=90, width=350)

entry3.place(x=180, y=120, width=350)

entry4.place(x=180, y=150, width=350)

entry5.place(x=180, y=180, width=350)

entry6.place(x=180, y=210, width=350)

entry7.place(x=180, y=240, width=350)

entry8.place(x=180, y=270, width=350)

entry9.place(x=180, y=300, width=350)

def add():

text1 = entry1.get()

text2 = entry2.get()

text3 = entry3.get()

text4 = entry4.get()

text5 = entry5.get()

text6 = entry6.get()

text7 = entry7.get()

text8 = entry8.get()

text9 = entry9.get()

content = “INSERT INTO vaccine_maintenance_info (” \

“vaccine_maintenance_num, vaccine_maintenance_name, admin_num, admin_name, maintenance_time, cold_storage_temp, freezer_temp, equipment_operation, alter_info” \

“)” \

" VALUES (%s, ‘%s’, ‘%s’, ‘%s’, ‘%s’, ‘%s’, ‘%s’, ‘%s’, ‘%s’);" % (

text1, text2, text3, text4, text5, text6, text7, text8, text9)

self.connect_DBS(database=“vaccine_info”, content=content)

tkinter.messagebox.showinfo(title=“信息”, message=“数据添加成功!”)

def clear():

entry1.delete(0, “end”)

entry2.delete(0, “end”)

entry3.delete(0, “end”)

entry4.delete(0, “end”)

entry5.delete(0, “end”)

entry6.delete(0, “end”)

entry7.delete(0, “end”)

entry8.delete(0, “end”)

entry9.delete(0, “end”)

tkinter.messagebox.showinfo(title=“信息”, message=“数据已清空,请继续添加!”)

tk.Button(vaccine_maintenance_info, text=“添加”, bg=‘white’, font=(“Arial,9”), width=9, height=0,command=add).place(x=400,y=360)

tk.Button(vaccine_maintenance_info, text=“清空”, bg=‘white’, font=(“Arial,9”), width=9, height=0,command=clear).place(x=160,y=360)

新建接种人员信息

å¾ç

def add_vaccination_person_info(self):

add_vaccination_person_info = tk.Toplevel(app)

add_vaccination_person_info.title(‘添加接种人员信息’)

add_vaccination_person_info.geometry(“600x400”)

tk.Label(add_vaccination_person_info, text=‘姓名:’, font=(“Arial”, 9)).place(x=80, y=60)

tk.Label(add_vaccination_person_info, text=‘性别:’, font=(‘Arial’, 9)).place(x=80, y=90)

tk.Label(add_vaccination_person_info, text=‘年龄:’, font=(‘Arial’, 9)).place(x=80, y=120)

tk.Label(add_vaccination_person_info, text=‘身份证号:’, font=(‘Arial’, 9)).place(x=80, y=150)

tk.Label(add_vaccination_person_info, text=‘家庭住址:’, font=(‘Arial’, 9)).place(x=80, y=180)

tk.Label(add_vaccination_person_info, text=‘是否过敏:’, font=(‘Arial’, 9)).place(x=80, y=210)

tk.Label(add_vaccination_person_info, text=‘接种时间:’, font=(‘Arial’, 9)).place(x=80, y=240)

entry1 = tk.Entry(add_vaccination_person_info, font=(“Arial, 9”), width=46)

entry2 = tk.Entry(add_vaccination_person_info, font=(“Arial, 9”), width=46)

entry3 = tk.Entry(add_vaccination_person_info, font=(“Arial, 9”), width=46)

entry4 = tk.Entry(add_vaccination_person_info, font=(“Arial, 9”), width=46)

entry5 = tk.Entry(add_vaccination_person_info, font=(“Arial, 9”), width=46)

entry6 = tk.Entry(add_vaccination_person_info, font=(“Arial, 9”), width=46)

entry7 = tk.Entry(add_vaccination_person_info, font=(“Arial, 9”), width=46)

entry1.pack()

entry2.pack()

entry3.pack()

entry4.pack()

entry5.pack()

entry6.pack()

entry7.pack()

entry1.place(x=180, y=60, width=350)

entry2.place(x=180, y=90, width=350)

entry3.place(x=180, y=120, width=350)

entry4.place(x=180, y=150, width=350)

entry5.place(x=180, y=180, width=350)

entry6.place(x=180, y=210, width=350)

entry7.place(x=180, y=240, width=350)

def add():

text1 = entry1.get()

text2 = entry2.get()

text3 = entry3.get()

text4 = entry4.get()

text5 = entry5.get()

text6 = entry6.get()

text7 = entry7.get()

content = “INSERT INTO vaccination_person_info (” \

“name, sexy, age, ID_num, address, allergy, date” \

“)” \

" VALUES (‘%s’, ‘%s’, ‘%s’, ‘%s’, ‘%s’, ‘%s’, ‘%s’);" % (

text1, text2, text3, text4, text5, text6, text7)

self.connect_DBS(database=“vaccine_info”, content=content)

tkinter.messagebox.showinfo(title=“信息”, message=“数据添加成功!”)

def clear():

entry1.delete(0, “end”)

entry2.delete(0, “end”)

entry3.delete(0, “end”)

entry4.delete(0, “end”)

entry5.delete(0, “end”)

entry6.delete(0, “end”)

entry7.delete(0, “end”)

tkinter.messagebox.showinfo(title=“信息”, message=“数据已清空,请继续添加!”)

tk.Button(add_vaccination_person_info, text=“添加”, bg=‘white’, font=(“Arial,9”), width=9, height=0,command=add).place(x=400, y=360)

tk.Button(add_vaccination_person_info, text=“清空”, bg=‘white’, font=(“Arial,9”), width=9, height=0,command=clear).place(x=160, y=360)

查询疫苗分配信息​

å¾ç

def vaccine_distr_info_query(self):

query = tk.Toplevel(app)

query.title(‘信息查询’)

query.geometry(“600x400”)

entry = tk.Entry(query, width=30)

entry.pack()

entry.place(x=200, y=80)

tk.Label(query, text=“请输入疫苗分配单号:”, font=(“Arial”, 9)).place(x=50, y=80)

tk.Label(query, text=‘查询结果:’, font=(‘Arial’, 9)).place(x=50, y=120)

text1 = tk.Text(query, width=50, height=20)

text1.pack()

text1.place(x=150, y=120)

def base_query():

vaccine_distr_num = entry.get()

print(vaccine_distr_num)

content = “SELECT * FROM vaccine_distr_info WHERE vaccine_distr_num = %s;” % vaccine_distr_num

data = self.connect_DBS(database=“vaccine_info”, content=content)

text1.delete(1.0, “end”)

text1.insert(chars=“{}”.format(data), index=“insert”)

tk.Button(query, text=‘查询’, bg=‘white’, font=(“Arial,12”), width=9, height=0, command=base_query).place(x=450,

y=75)

查询疫苗养护信息​

å¾ç

def vaccination_maintenance_info_query(self):

query = tk.Toplevel(app)

query.title(‘疫苗养护信息查询’)

query.geometry(“600x400”)

entry = tk.Entry(query, width=30)

entry.pack()

entry.place(x=200, y=80)

tk.Label(query, text=“请输入疫苗养护批号:”, font=(“Arial”, 9)).place(x=50, y=80)

tk.Label(query, text=‘查询结果:’, font=(‘Arial’, 9)).place(x=50, y=120)

text1 = tk.Text(query, width=50, height=20)

text1.pack()

text1.place(x=150, y=120)

def base_query():

vaccine_maintenance_num = entry.get()

print(vaccine_maintenance_num)

content = “SELECT * FROM vaccine_maintenance_info WHERE vaccine_maintenance_num = %s;” % vaccine_maintenance_num

data = self.connect_DBS(database=“vaccine_info”, content=content)

text1.delete(1.0, “end”)

text1.insert(chars=“{}”.format(data), index=“insert”)

tk.Button(query, text=‘查询’, bg=‘white’, font=(“Arial,12”), width=9, height=0, command=base_query).place(x=450,

y=75)

def vaccine_distr_info_query(self):

query = tk.Toplevel(app)

query.title(‘信息查询’)

query.geometry(“600x400”)

entry = tk.Entry(query, width=30)

entry.pack()

entry.place(x=200, y=80)

tk.Label(query, text=“请输入疫苗分配单号:”, font=(“Arial”, 9)).place(x=50, y=80)

tk.Label(query, text=‘查询结果:’, font=(‘Arial’, 9)).place(x=50, y=120)

text1 = tk.Text(query, width=50, height=20)

text1.pack()

text1.place(x=150, y=120)

def base_query():

vaccine_distr_num = entry.get()

print(vaccine_distr_num)

content = “SELECT * FROM vaccine_distr_info WHERE vaccine_distr_num = %s;” % vaccine_distr_num

data = self.connect_DBS(database=“vaccine_info”, content=content)

text1.delete(1.0, “end”)

text1.insert(chars=“{}”.format(data), index=“insert”)

tk.Button(query, text=‘查询’, bg=‘white’, font=(“Arial,12”), width=9, height=0, command=base_query).place(x=450,

y=75)

查询接种人员信息​

å¾ç

def vaccination_person_info_query(self):

query = tk.Toplevel(app)

query.title(‘接种人员信息查询’)

query.geometry(“600x400”)

entry = tk.Entry(query, width=30)

entry.pack()

entry.place(x=200, y=80)

tk.Label(query, text=“请输入接种人员身份证号:”, font=(“Arial”, 9)).place(x=50, y=80)

tk.Label(query, text=‘查询结果:’, font=(‘Arial’, 9)).place(x=50, y=120)

text1 = tk.Text(query, width=50, height=20)

text1.pack()

text1.place(x=150, y=120)

def base_query():

ID_num = entry.get()

content = “SELECT * FROM vaccination_person_info WHERE ID_num = %s;” % ID_num

data = self.connect_DBS(database=“vaccine_info”, content=content)

text1.delete(1.0, “end”)

text1.insert(chars=“{}”.format(data), index=“insert”)

tk.Button(query, text=‘查询’, bg=‘white’, font=(“Arial,12”), width=9, height=0, command=base_query).place(x=450, y=75)

查询疫苗信息

å¾ç

def vaccine_info_query(self):

query = tk.Toplevel(app)

query.title(‘疫苗信息查询’)

query.geometry(“600x400”)

entry = tk.Entry(query, width=30)

entry.pack()

entry.place(x=200, y=80)

tk.Label(query, text=“请输入疫苗批号:”, font=(“Arial”, 9)).place(x=50, y=80)

tk.Label(query, text=‘查询结果:’, font=(‘Arial’, 9)).place(x=50, y=120)

text1 = tk.Text(query, width=50, height=20)

text1.pack()

text1.place(x=150, y=120)

def base_query():

vaccine_num = entry.get()

content = “SELECT * FROM vaccine_info WHERE vaccine_num = %s;” % vaccine_num

data = self.connect_DBS(database=“vaccine_info”, content=content)

text1.delete(1.0, “end”)

text1.insert(chars=“{}”.format(data), index=“insert”)

tk.Button(query, text=‘查询’, bg=‘white’, font=(“Arial,12”), width=9, height=0, command=base_query).place(x=450, y=75)

修改疫苗信息​

å¾ç

def modify_vaccine_info(self):

modify_info = tk.Toplevel(app)

modify_info.title(‘疫苗信息修改’)

modify_info.geometry(“600x400”)

entry = tk.Entry(modify_info, width=30)

entry.pack()

entry.place(x=200, y=60)

tk.Label(modify_info, text=“请输入疫苗分配单号:”, font=(“Arial”, 9)).place(x=50, y=60)

tk.Label(modify_info, text=‘疫苗批号:’, font=(“Arial”, 9)).place(x=80, y=100)

tk.Label(modify_info, text=‘疫苗名称:’, font=(‘Arial’, 9)).place(x=80, y=130)

tk.Label(modify_info, text=‘企业名称:’, font=(‘Arial’, 9)).place(x=80, y=160)

tk.Label(modify_info, text=‘企业编号:’, font=(‘Arial’, 9)).place(x=80, y=190)

tk.Label(modify_info, text=’ 规格:', font=(‘Arial’, 9)).place(x=80, y=220)

tk.Label(modify_info, text=’ 进价:', font=(‘Arial’, 9)).place(x=80, y=250)

tk.Label(modify_info, text=’ 预售价:', font=(‘Arial’, 9)).place(x=80, y=280)

tk.Label(modify_info, text=‘企业上限:’, font=(‘Arial’, 9)).place(x=80, y=310)

tk.Label(modify_info, text=‘企业下限:’, font=(‘Arial’, 9)).place(x=80, y=340)

text1 = tk.Text(modify_info, width=50, height=1)

text2 = tk.Text(modify_info, width=50, height=1)

text3 = tk.Text(modify_info, width=50, height=1)

text4 = tk.Text(modify_info, width=50, height=1)

text5 = tk.Text(modify_info, width=50, height=1)

text6 = tk.Text(modify_info, width=50, height=1)

text7 = tk.Text(modify_info, width=50, height=1)

text8 = tk.Text(modify_info, width=50, height=1)

text9 = tk.Text(modify_info, width=50, height=1)

text1.pack()

text2.pack()

text3.pack()

text4.pack()

text5.pack()

text6.pack()

text7.pack()

text8.pack()

text9.pack()

text1.place(x=150, y=100)

text2.place(x=150, y=130)

text3.place(x=150, y=160)

text4.place(x=150, y=190)

text5.place(x=150, y=220)

text6.place(x=150, y=250)

text7.place(x=150, y=280)

text8.place(x=150, y=310)

text9.place(x=150, y=340)

def base_query():

vaccine_modify_num = entry.get()

content = “SELECT * FROM vaccine_info WHERE vaccine_num = %s;” % vaccine_modify_num

data = self.connect_DBS(database=“vaccine_info”, content=content)

text1.delete(1.0, “end”)

text2.delete(1.0, “end”)

text3.delete(1.0, “end”)

text4.delete(1.0, “end”)

text5.delete(1.0, “end”)

text6.delete(1.0, “end”)

text7.delete(1.0, “end”)

text8.delete(1.0, “end”)

text9.delete(1.0, “end”)

text1.insert(chars=“{}”.format(data[0]), index=“insert”)

text2.insert(chars=“{}”.format(data[1]), index=“insert”)

text3.insert(chars=“{}”.format(data[2]), index=“insert”)

text4.insert(chars=“{}”.format(data[3]), index=“insert”)

text5.insert(chars=“{}”.format(data[4]), index=“insert”)

text6.insert(chars=“{}”.format(data[5]), index=“insert”)

text7.insert(chars=“{}”.format(data[6]), index=“insert”)

text8.insert(chars=“{}”.format(data[7]), index=“insert”)

text9.insert(chars=“{}”.format(data[8]), index=“insert”)

def update_info():

vaccine_del_num = entry.get()

str_ls = [text1.get(“1.0”, “end”)[0:-1], text2.get(“1.0”, “end”)[0:-1], text3.get(“1.0”, “end”)[0:-1],

text4.get(“1.0”, “end”)[0:-1], text5.get(“1.0”, “end”)[0:-1], text6.get(“1.0”, “end”)[0:-1],

text7.get(“1.0”, “end”)[0:-1], text8.get(“1.0”, “end”)[0:-1], text9.get(“1.0”, “end”)[0:-1]]

str_ls = [str(i) for i in str_ls]

content = “UPDATE vaccine_info SET vaccine_num=‘%s’, vaccine_name=‘%s’, company_name=‘%s’, vaccine_num=‘%s’” \

", size=‘%s’, buy_price=‘%s’, pre_sale_price=‘%s’, limit_up=‘%s’, limit_down=‘%s’ WHERE " \

“vaccine_num = ‘%s’;” % (

str_ls[0], str_ls[1], str_ls[2], str_ls[3], str_ls[4], str_ls[5], str_ls[6], str_ls[7], str_ls[8],vaccine_del_num)

self.connect_DBS(database=“vaccine_info”, content=content)

tkinter.messagebox.showinfo(title=“信息”, message=“疫苗分配单号:{}数据修改成功!”.format(vaccine_modify_num)

return None

tk.Button(modify_info, text=‘查询’, bg=‘white’, font=(“Arial,12”), width=9, height=0, command=base_query).place(x=450,y=55)

tk.Button(modify_info, text=‘修改’, bg=‘white’, font=(“Arial,12”), width=9, height=0, command=update_info).place(x=260,y=370)

删除疫苗信息

å¾ç

def del_vaccine_info(self):

del_info = tk.Toplevel(app)

del_info.title(‘疫苗信息删除’)

del_info.geometry(“600x500”)

entry = tk.Entry(del_info, width=30)

entry.pack()

entry.place(x=200, y=80)

tk.Label(del_info, text=“请输入疫苗批号:”, font=(“Arial”, 9)).place(x=50, y=80)

tk.Label(del_info, text=‘查询结果:’, font=(‘Arial’, 9)).place(x=50, y=120)

text1 = tk.Text(del_info, width=50, height=20)

text1.pack()

text1.place(x=150, y=120)

def base_query():

vaccine_del_num = entry.get()

print(vaccine_del_num)

content = “SELECT * FROM vaccine_info WHERE vaccine_num = %s;” % vaccine_del_num

data = self.connect_DBS(database=“vaccine_info”, content=content)

text1.delete(1.0, “end”)

text1.insert(chars=“{}”.format(data), index=“insert”)

def del_infor():

vaccine_del_num = entry.get()

print(vaccine_del_num)

content = “DELETE FROM vaccine_info WHERE vaccine_num = %s;” % vaccine_del_num

data = self.connect_DBS(database=“vaccine_info”, content=content)

tkinter.messagebox.showinfo(title=“信息”, message=“疫苗批号:{}数据已删除!”.format(vaccine_del_num))

return None

tk.Button(del_info, text=‘查询’, bg=‘white’, font=(“Arial,12”), width=9, height=0, command=base_query).place(x=450,y=75)

tk.Button(del_info, text=‘删除’, bg=‘white’, font=(“Arial,12”), width=9, height=0, command=del_infor).place(x=280,

y=400)

数据库

在这里插入图片描述

感谢每一个认真阅读我文章的人,看着粉丝一路的上涨和关注,礼尚往来总是要有的:

① 2000多本Python电子书(主流和经典的书籍应该都有了)

② Python标准库资料(最全中文版)

③ 项目源码(四五十个有趣且经典的练手项目及源码)

④ Python基础入门、爬虫、web开发、大数据分析方面的视频(适合小白学习)

⑤ Python学习路线图(告别不入流的学习)

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化学习资料的朋友,可以戳这里无偿获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

  • 19
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,可以的。疫苗预约管理系统一般需要以下功能: 1. 用户注册登录:用户可以注册并登录系统,进行预约、查询等操作。 2. 疫苗信息管理:管理员可以添加、删除、修改疫苗信息,包括疫苗名称、疫苗剂次、疫苗价格等信息。 3. 预约管理:用户可以根据自己的需求选择预约疫苗,并填写个人信息进行预约。 4. 预约查询:用户可以查询自己的预约情况,包括已预约、待接种、已接种等状态。 5. 接种管理:管理员可以管理用户的接种情况,包括接种时间、接种地点、接种状态等信息。 下面是一个简单的疫苗预约管理系统的C语言代码示例,仅供参考: ```c #include <stdio.h> #include <stdlib.h> #include <string.h> // 定义疫苗结构体 typedef struct Vaccine { char name[20]; // 疫苗名称 int dose; // 疫苗剂次 float price; // 疫苗价格 } Vaccine; // 定义用户结构体 typedef struct User { char name[20]; // 用户姓名 int age; // 用户年龄 char phone[20]; // 用户电话 Vaccine vaccine; // 预约的疫苗 int status; // 预约状态:0-已预约,1-待接种,2-已接种 } User; // 定义全局变量 User users[100]; // 用户数组 int userCount = 0; // 用户数量 // 添加用户 void addUser() { User user; printf("请输入姓名:"); scanf("%s", user.name); printf("请输入年龄:"); scanf("%d", &user.age); printf("请输入电话:"); scanf("%s", user.phone); printf("请选择疫苗:\n"); printf("1. 新冠疫苗(第一剂) 价格:100\n"); printf("2. 新冠疫苗(第二剂) 价格:200\n"); printf("请选择(1或2):"); int choice; scanf("%d", &choice); if (choice == 1) { strcpy(user.vaccine.name, "新冠疫苗"); user.vaccine.dose = 1; user.vaccine.price = 100; } else if (choice == 2) { strcpy(user.vaccine.name, "新冠疫苗"); user.vaccine.dose = 2; user.vaccine.price = 200; } else { printf("选择错误!\n"); return; } user.status = 0; users[userCount++] = user; printf("预约成功!\n"); } // 查询用户预约情况 void queryUser() { char phone[20]; printf("请输入电话:"); scanf("%s", phone); for (int i = 0; i < userCount; i++) { if (strcmp(users[i].phone, phone) == 0) { printf("姓名:%s,年龄:%d,电话:%s,疫苗名称:%s,疫苗剂次:%d,疫苗价格:%.2f,预约状态:%d\n", users[i].name, users[i].age, users[i].phone, users[i].vaccine.name, users[i].vaccine.dose, users[i].vaccine.price, users[i].status); return; } } printf("未找到该用户!\n"); } // 修改用户预约情况 void updateUser() { char phone[20]; printf("请输入电话:"); scanf("%s", phone); for (int i = 0; i < userCount; i++) { if (strcmp(users[i].phone, phone) == 0) { printf("请选择疫苗状态:\n"); printf("1. 待接种\n"); printf("2. 已接种\n"); printf("请选择(1或2):"); int choice; scanf("%d", &choice); if (choice == 1) { users[i].status = 1; } else if (choice == 2) { users[i].status = 2; } else { printf("选择错误!\n"); return; } printf("修改成功!\n"); return; } } printf("未找到该用户!\n"); } // 主函数 int main() { while (1) { printf("欢迎使用疫苗预约管理系统!\n"); printf("1. 添加用户\n"); printf("2. 查询用户预约情况\n"); printf("3. 修改用户预约情况\n"); printf("4. 退出系统\n"); printf("请选择(1-4):"); int choice; scanf("%d", &choice); switch (choice) { case 1: addUser(); break; case 2: queryUser(); break; case 3: updateUser(); break; case 4: printf("谢谢使用!\n"); exit(0); default: printf("选择错误!\n"); break; } } } ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值