💖💖作者:计算机编程小咖 💙💙个人简介:曾长期从事计算机专业培训教学,本人也热爱上课教学,语言擅长Java、微信小程序、Python、Golang、安卓Android等,开发项目包括大数据、深度学习、网站、小程序、安卓、算法。平常会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学习实战项目
@TOC
缪氏诊所预约挂号系统介绍
缪氏诊所预约挂号系统是一个集成现代信息技术的综合性医疗服务管理平台,该系统采用先进的C/S与B/S混合架构设计,为用户提供便捷高效的医疗预约服务体验。系统后端支持Java和Python双语言开发模式,其中Java版本基于成熟稳定的Spring Boot框架构建,整合Spring、SpringMVC和MyBatis组件,确保系统的高性能与可维护性;Python版本则采用功能强大的Django框架,为开发者提供更加灵活的技术选择。前端采用uni-app跨平台开发框架,同时支持微信小程序和安卓应用,实现了真正的多端覆盖,用户可以通过不同终端设备seamlessly访问系统服务。数据存储方面,系统选用MySQL关系型数据库,保障数据的安全性和一致性。系统功能模块涵盖完整的医疗预约流程,包括系统首页展示、个人中心管理、用户密码修改、用户信息维护、医生信息查询、预约信息处理、预约取消操作、就诊信息记录等核心业务功能,同时配备系统管理模块、轮播图管理、公告资讯分类及公告资讯发布等辅助管理功能,形成了一个功能完善、操作便捷的现代化诊所预约挂号解决方案,有效提升了医疗服务效率和患者就医体验。
缪氏诊所预约挂号系统演示视频
缪氏诊所预约挂号系统演示图片
缪氏诊所预约挂号系统代码展示
from pyspark.sql import SparkSession
from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
from django.utils.decorators import method_decorator
from django.views import View
from .models import Appointment, User, Doctor
from datetime import datetime, timedelta
import json
import hashlib
spark = SparkSession.builder.appName("MiaoClinicSystem").config("spark.sql.adaptive.enabled", "true").getOrCreate()
@method_decorator(csrf_exempt, name='dispatch')
class AppointmentProcessView(View):
def post(self, request):
data = json.loads(request.body)
user_id = data.get('user_id')
doctor_id = data.get('doctor_id')
appointment_date = data.get('appointment_date')
appointment_time = data.get('appointment_time')
try:
user = User.objects.get(id=user_id)
doctor = Doctor.objects.get(id=doctor_id)
existing_appointments = Appointment.objects.filter(
doctor_id=doctor_id,
appointment_date=appointment_date,
appointment_time=appointment_time,
status__in=['confirmed', 'pending']
)
if existing_appointments.exists():
return JsonResponse({'status': 'error', 'message': '该时间段已被预约'})
user_today_appointments = Appointment.objects.filter(
user_id=user_id,
appointment_date=appointment_date,
status__in=['confirmed', 'pending']
).count()
if user_today_appointments >= 3:
return JsonResponse({'status': 'error', 'message': '每日最多预约3次'})
appointment_datetime = datetime.strptime(f"{appointment_date} {appointment_time}", "%Y-%m-%d %H:%M")
if appointment_datetime <= datetime.now():
return JsonResponse({'status': 'error', 'message': '预约时间不能早于当前时间'})
if appointment_datetime > datetime.now() + timedelta(days=30):
return JsonResponse({'status': 'error', 'message': '预约时间不能超过30天'})
appointment = Appointment.objects.create(
user_id=user_id,
doctor_id=doctor_id,
appointment_date=appointment_date,
appointment_time=appointment_time,
status='pending',
created_time=datetime.now()
)
doctor.available_slots -= 1
doctor.save()
appointment_data = [{
'appointment_id': appointment.id,
'user_name': user.username,
'doctor_name': doctor.name,
'appointment_date': str(appointment_date),
'appointment_time': str(appointment_time),
'status': 'pending'
}]
df = spark.createDataFrame(appointment_data)
df.createOrReplaceTempView("new_appointments")
result = spark.sql("SELECT appointment_id, user_name, doctor_name FROM new_appointments WHERE status = 'pending'").collect()
return JsonResponse({
'status': 'success',
'message': '预约成功',
'appointment_id': appointment.id,
'spark_result': [row.asDict() for row in result]
})
except User.DoesNotExist:
return JsonResponse({'status': 'error', 'message': '用户不存在'})
except Doctor.DoesNotExist:
return JsonResponse({'status': 'error', 'message': '医生不存在'})
except Exception as e:
return JsonResponse({'status': 'error', 'message': str(e)})
@method_decorator(csrf_exempt, name='dispatch')
class UserManagementView(View):
def post(self, request):
data = json.loads(request.body)
action = data.get('action')
if action == 'create':
username = data.get('username')
password = data.get('password')
phone = data.get('phone')
email = data.get('email')
real_name = data.get('real_name')
if User.objects.filter(username=username).exists():
return JsonResponse({'status': 'error', 'message': '用户名已存在'})
if User.objects.filter(phone=phone).exists():
return JsonResponse({'status': 'error', 'message': '手机号已被注册'})
if len(password) < 6:
return JsonResponse({'status': 'error', 'message': '密码长度至少6位'})
hashed_password = hashlib.md5(password.encode()).hexdigest()
user = User.objects.create(
username=username,
password=hashed_password,
phone=phone,
email=email,
real_name=real_name,
status='active',
created_time=datetime.now()
)
user_data = [{
'user_id': user.id,
'username': username,
'phone': phone,
'email': email,
'real_name': real_name,
'registration_date': str(datetime.now().date())
}]
df = spark.createDataFrame(user_data)
df.createOrReplaceTempView("user_registrations")
today_registrations = spark.sql(f"SELECT COUNT(*) as count FROM user_registrations WHERE registration_date = '{datetime.now().date()}'").collect()[0]['count']
return JsonResponse({
'status': 'success',
'message': '用户创建成功',
'user_id': user.id,
'today_registrations': today_registrations
})
elif action == 'update':
user_id = data.get('user_id')
try:
user = User.objects.get(id=user_id)
if 'phone' in data and data['phone'] != user.phone:
if User.objects.filter(phone=data['phone']).exclude(id=user_id).exists():
return JsonResponse({'status': 'error', 'message': '手机号已被其他用户使用'})
user.phone = data['phone']
if 'email' in data:
user.email = data['email']
if 'real_name' in data:
user.real_name = data['real_name']
if 'password' in data and data['password']:
if len(data['password']) < 6:
return JsonResponse({'status': 'error', 'message': '密码长度至少6位'})
user.password = hashlib.md5(data['password'].encode()).hexdigest()
user.updated_time = datetime.now()
user.save()
return JsonResponse({'status': 'success', 'message': '用户信息更新成功'})
except User.DoesNotExist:
return JsonResponse({'status': 'error', 'message': '用户不存在'})
@method_decorator(csrf_exempt, name='dispatch')
class DoctorQueryView(View):
def get(self, request):
department = request.GET.get('department', '')
available_only = request.GET.get('available_only', 'false').lower() == 'true'
search_keyword = request.GET.get('search', '')
doctors = Doctor.objects.all()
if department:
doctors = doctors.filter(department=department)
if available_only:
doctors = doctors.filter(available_slots__gt=0, status='active')
if search_keyword:
doctors = doctors.filter(name__icontains=search_keyword)
doctor_list = []
for doctor in doctors:
appointment_count = Appointment.objects.filter(
doctor_id=doctor.id,
appointment_date__gte=datetime.now().date(),
status__in=['confirmed', 'pending']
).count()
doctor_info = {
'doctor_id': doctor.id,
'name': doctor.name,
'department': doctor.department,
'title': doctor.title,
'available_slots': doctor.available_slots,
'appointment_count': appointment_count,
'rating': float(doctor.rating or 0),
'experience_years': doctor.experience_years or 0
}
doctor_list.append(doctor_info)
if doctor_list:
df = spark.createDataFrame(doctor_list)
df.createOrReplaceTempView("doctor_stats")
popular_doctors = spark.sql("""
SELECT name, department, appointment_count, rating
FROM doctor_stats
WHERE appointment_count > 0
ORDER BY appointment_count DESC, rating DESC
LIMIT 5
""").collect()
department_stats = spark.sql("""
SELECT department, COUNT(*) as doctor_count, AVG(rating) as avg_rating
FROM doctor_stats
GROUP BY department
ORDER BY doctor_count DESC
""").collect()
return JsonResponse({
'status': 'success',
'doctors': doctor_list,
'popular_doctors': [row.asDict() for row in popular_doctors],
'department_stats': [row.asDict() for row in department_stats],
'total_count': len(doctor_list)
})
else:
return JsonResponse({
'status': 'success',
'doctors': [],
'popular_doctors': [],
'department_stats': [],
'total_count': 0
})
缪氏诊所预约挂号系统文档展示
💖💖作者:计算机编程小咖 💙💙个人简介:曾长期从事计算机专业培训教学,本人也热爱上课教学,语言擅长Java、微信小程序、Python、Golang、安卓Android等,开发项目包括大数据、深度学习、网站、小程序、安卓、算法。平常会做一些项目定制化开发、代码讲解、答辩教学、文档编写、也懂一些降重方面的技巧。平常喜欢分享一些自己开发中遇到的问题的解决办法,也喜欢交流技术,大家有技术代码这一块的问题可以问我! 💛💛想说的话:感谢大家的关注与支持! 💜💜 网站实战项目 安卓/小程序实战项目 大数据实战项目 深度学习实战项目