✨作者主页:IT研究室✨
个人简介:曾从事计算机专业培训教学,擅长Java、Python、微信小程序、Golang、安卓Android等。接项目定制开发、代码讲解、答辩教学、文档编写、降重等。
☑文末获取源码☑
精彩专栏推荐⬇⬇⬇
Java项目
Python项目
安卓项目
微信小程序项目
一、开发环境
- 开发语言:Python
- 数据库:MySQL
- 系统架构:B/S
- 后端:Django
- 前端:Vue
二、系统功能模块
- 角色:患者、医生、管理员
- 功能:
患者:
出诊医生信息、医院公告、挂号信息管理、取消挂号管理、问诊记录管理、处方开具管理;
医生:
出诊医生信息、挂号信息管理、取消挂号管理、问诊记录管理、药品信息管理、处方开具管理;
管理员:
患者管理、科室管理、医生管理、出诊医生管理、挂号信息管理、取消挂号管理、问诊记录管理、药品信息管理、处方开具管理、公告管理。
三、系统界面展示
四、部分代码设计
# 挂号列表
def orderList(request):
user_id = request.POST.get('user_id')
department_id = request.POST.get('department_id')
doctor_id = request.POST.get('doctor_id')
status = request.POST.get('status')
list = order.objects.all()
if user_id:
list = list.filter(patient_id=user_id)
if department_id:
list = list.filter(department_id=department_id)
if doctor_id:
list = list.filter(doctor_id=doctor_id)
if status:
list = list.filter(status=status)
arr = []
print('list:', list)
for item in list:
temp = {}
temp['id'] = item.id
temp['patient_id'] = item.patient_id
temp['patient_name'] = user_patient.objects.filter(id=item.patient_id).first().name
temp['department_id'] = item.department_id
temp['department_name'] = department.objects.filter(id=item.department_id).first().name
temp['readme'] = item.readme
temp['registration_fee'] = item.registration_fee
temp['doctor_id'] = item.doctor_id
temp['medicine_list'] = item.medicine_list
checkDoctor = user_doctor.objects.filter(id=item.doctor_id).first()
if checkDoctor:
temp['doctor_name'] = checkDoctor.name
else:
temp['doctor_name'] = ''
temp['order_advice'] = item.order_advice
temp['total_cost'] = item.total_cost
temp['status'] = item.status
temp['time'] = item.time
arr.append(temp)
return Action.success(arr)
@api_view(['GET',"POST"])
# 添加就诊
def orderAdd(request):
# 获取参数
user_id = request.POST.get('user_id')
department_id = request.POST.get('department_id')
readme = request.POST.get('readme')
# 查询
checkOrder = order.objects.filter(patient_id=user_id,department_id=department_id,status=1).first()
if checkOrder:
return Action.fail("请勿重复挂号")
checkDepartment = department.objects.filter(id=department_id).first()
# 若没注册,添加入数据库
newOrder = order(patient_id=user_id, department_id=department_id, readme=readme, registration_fee=checkDepartment.registration_fee,status=1)
newOrder.save()
return Action.success()
@api_view(['GET',"POST"])
# 就诊详情
def orderInfo(request):
# 获取参数
id = request.POST.get('id')
# 查询
checkOrder = order.objects.filter(id=id).first()
print('checkOrder:', checkOrder)
temp = {}
temp['id'] = checkOrder.id
temp['patient_id'] = checkOrder.patient_id
temp['patient_name'] = user_patient.objects.filter(id=checkOrder.patient_id).first().name
temp['department_id'] = checkOrder.department_id
temp['department_name'] = department.objects.filter(id=checkOrder.department_id).first().name
temp['readme'] = checkOrder.readme
temp['registration_fee'] = checkOrder.registration_fee
temp['doctor_id'] = checkOrder.doctor_id
temp['order_advice'] = checkOrder.order_advice
temp['total_cost'] = checkOrder.total_cost
temp['status'] = checkOrder.status
temp['time'] = checkOrder.time
return Action.success(temp)
@api_view(['GET',"POST"])
# 完成就诊
def orderFinish(request):
# 获取参数
id = request.POST.get('id')
order_advice = request.POST.get('order_advice')
medicine_list = request.POST.get('medicine_list')
doctor_id = request.POST.get('doctor_id')
medicine_list_arr = medicine_list.split(',')
# 查询
checkOrder = order.objects.filter(id=id).first()
if checkOrder.status != 1:
return Action.fail("该病人已处理")
cost_sum = int(checkOrder.registration_fee)
for de in medicine_list_arr:
cost_sum = cost_sum + int(medicine.objects.filter(id=de).first().price)
checkOrder.doctor_id = doctor_id
checkOrder.order_advice = order_advice
checkOrder.medicine_list = medicine_list
checkOrder.status = 2
checkOrder.total_cost = cost_sum
checkOrder.save()
return Action.success()
# 添加科室
def departmentAdd(request):
# 获取参数
name = request.POST.get('name')
registration_fee = request.POST.get('registration_fee')
doctor_num = request.POST.get('doctor_num')
# 查询
sameIdCardUserList = department.objects.filter(name=name)
if sameIdCardUserList.exists() == True:
# 如果已经被注册,则直接返回错误消息
return Action.fail("已存在")
# 若没注册,添加入数据库
new_department = department(
name=name, registration_fee=registration_fee, doctor_num=doctor_num)
new_department.save()
# 添加成功
return Action.success()
@api_view(['GET', "POST"])
# 删除科室
def departmentDelete(request):
# 获取参数
id = request.POST.get('id')
# 查询
sameIdCardUserList = department.objects.filter(id=int(id))
if not sameIdCardUserList:
return Action.fail("没有此药品")
new_department = department(id=id)
new_department.delete()
# 删除成功
return Action.success()
# 医生列表
def doctorList(request):
list = user_doctor.objects.all()
arr = []
for item in list:
temp = {}
temp['id'] = item.id
temp['name'] = item.name
temp['id_card'] = item.id_card
temp['department_id'] = item.department_id
temp['department_name'] = department.objects.filter(id=item.department_id).first().name
arr.append(temp)
# 登陆成功
return Action.success(arr)
@api_view(['GET',"POST"])
# 添加医生
def doctorAdd(request):
# 获取参数
name = request.POST.get('name')
id_card = request.POST.get('id_card')
department_id = request.POST.get('department_id')
password = request.POST.get('password')
# 查询身份证号是否已被注册
sameIdCardUserList = user_doctor.objects.filter(id_card=id_card)
if sameIdCardUserList.exists() == True :
# 如果已经被注册,则直接返回错误消息
return Action.fail("身份重复")
# 若没注册,添加入数据库
doctor = user_doctor(name=name, id_card=id_card, department_id=department_id, password=password)
doctor.save()
# 添加成功
return Action.success()
@api_view(['GET',"POST"])
#修改密码
def setdpassword(request):
# 获取参数
id=request.POST.get('id')
oldpassword=request.POST.get('password')
newpassword = request.POST.get('newpassword')
repassword = request.POST.get('apassword')
result = user_doctor.objects.filter(id=int(id)).first()
password = result.password
if password == oldpassword and newpassword == repassword and newpassword and repassword:
user_doctor.objects.filter(id=int(id)).update(password = newpassword)
password=newpassword
else:
return Action.fail("新密码与确认新密码不一致!")
return Action.success()
@api_view(['GET', "POST"])
# 删除医生
def doctorDelete(request):
# 获取参数
id = request.POST.get('id')
sameIdCardUserList = user_doctor.objects.filter(id=int(id))
if not sameIdCardUserList:
return Action.fail("没有此医生")
doctor = user_doctor(id=id)
doctor.delete()
# 删除成功
return Action.success()
五、论文参考
六、系统视频
基于Python的医院信息管理系统
结语
大家可以帮忙点赞、收藏、关注、评论啦~
源码获取:私信我