[免费]基于Python的Django医院管理系统【论文+源码+SQL脚本】
大家好,我是python222_小锋老师,看到一个不错的基于Python的Django医院管理系统,分享下哈。
项目视频演示
https://www.bilibili.com/video/BV1iPH8zmEut/
项目介绍
随着人民生活水平日益增长,科技日益发达的今天,人们对身体健康的重视也越来越高。医院的需求也随之增加。中国有句古话称“病从口入”,随着生活水平的提高,人们在饮食方面也提出了更高的要求。然而,各种食品添加剂的使用使得人们的身体也出现了一些问题。因此,人们对医院的需求迅速增长,而与之相应的是管理方面的挑战。
为了提高医院的经济效益,使其在同行竞争中立于不败之地,迫切需要一个科学的医院信息管理系统来解决医院面临的各种困难。这个系统需要充分了解患者的基本情况,并集结众多患者的管理经验,融合先进的管理思想,同时考虑医院的实际情况,将信息流作为主线,优化流程,为医院管理层提供最佳的管理手段,帮助医院实现资源充分共享,快捷简便地查询资源,全面提升医院整体水平,从而增强医院的竞争力[1]。因此,现代化医院管理变得尤为重要。
系统展示
部分代码
from django.contrib import admin# Register your models here.
from .models import *@admin.register(Department)
class DepartmentAdmin(admin.ModelAdmin):# 要显示的字段list_display = ('id', 'name','doctor_name', 'create_time')# 需要搜索的字段search_fields = ('name',)# 分页显示,一页的数量list_per_page = 10actions_on_top = True@admin.register(Doctor)
class DoctorAdmin(admin.ModelAdmin):#resource_class = ProxyResourcelist_display = ( 'name', 'gender', 'phone', 'stu_no','department', 'enable', 'create_time','idCard')# search_fields = ('name', 'enable', 'idCard', 'department')search_fields = ('name', 'phone')list_per_page = 20# raw_id_fields = ('department',)# list_filter = ('department', AgeListFilter, 'create_time')# list_filter = (AgeListFilter, 'department', 'create_time', 'birthday', 'time', 'enable', 'gender')list_display_links = ('name',)#fields = ('user_name', 'idCard', 'birthday') # 编辑界面只显示No、Name和Age#exclude = ('pass_word','user_name') # 记得元祖需要在后面加个逗号,不然会报错list_editable = ('department', 'phone', 'enable', 'gender','idCard','stu_no')date_hierarchy = 'create_time'@admin.register(House)
class HouseAdmin(admin.ModelAdmin):# 要显示的字段list_display = ('no', 'name','level','amount', 'create_time')fields = ('no', 'name', 'level','amount' ) # 编辑界面只显示No、Name和Age# 需要搜索的字段search_fields = ('no',)# 分页显示,一页的数量list_per_page = 10actions_on_top = True# inlines = [# HealthLogInline,# MaintanceInline# ]import xlwt
from django.http import HttpResponse, JsonResponse
import datetime@admin.register(Medical)
class MedicalAdmin(admin.ModelAdmin):# 要显示的字段list_display = ('id', 'name', 'price', 'qr_code', 'create_time', 'prescription')fields = ('name', 'qr_code', 'price', 'prescription') # 编辑界面只显示No、Name和Ageactions = ['output']# 需要搜索的字段search_fields = ('name', 'qr_code', 'price', 'prescription')# 分页显示,一页的数量list_per_page = 10actions_on_top = True# inlines = [# HealthLogInline,# MaintanceInline# ]def output(self, request, queryset):response = HttpResponse(content_type='application/vnd.ms-excel') # 指定返回格式为excel,excel文件MINETYPE为application/vnd.ms-excelresponse['Content-Disposition'] = 'attachment;filename=instorage.xls'wb = xlwt.Workbook(encoding='utf-8') # 创建一个工作簿sheet = wb.add_sheet('药品单据') # 创建一个工作表# 创建一个居中对齐的样式style = xlwt.XFStyle()alignment = xlwt.Alignment()alignment.horz = xlwt.Alignment.HORZ_CENTERstyle.alignment = alignmentfont = xlwt.Font()font.name = '宋体'font.bold = Truefont.height = 20 * 11 # 设置字体大小style.font = font# 将样式应用于单元格sheet.write_merge(0, 0, 0, 5, '药品单据', style)sheet.write(1, 0, 'id', style)sheet.write(1, 1, '名称', style)sheet.write(1, 2, '描述', style)sheet.write(1, 3, '价格', style)sheet.write(1, 4, '数量', style)sheet.write(1, 5, '创建时间', style)data_row = 2for obj in queryset:# 创建一个居中对齐的样式style = xlwt.XFStyle()alignment = xlwt.Alignment()alignment.horz = xlwt.Alignment.HORZ_CENTERstyle.alignment = alignmentsheet.write(data_row, 0, obj.id, style)sheet.write(data_row, 1, obj.name, style)sheet.write(data_row, 2, obj.prescription, style)sheet.write(data_row, 3, str(obj.price), style)sheet.write(data_row, 4, obj.qr_code, style)sheet.write(data_row, 5, obj.create_time.strftime('%Y-%m-%d'), style)data_row = data_row + 1wb.save(response)return responseoutput.short_description = '生成药品单据'output.type = 'success'output.style = 'background-color: #00a65a; color: #fff; border-color: #008d4c;'@admin.register(Patient)
class PatientAdmin(admin.ModelAdmin):#resource_class = ProxyResourcelist_display = ( 'name', 'gender', 'phone', 'idCard','department', 'in_time','doctor_name', 'create_time','idCard')# search_fields = ('name', 'enable', 'idCard', 'department')search_fields = ('name', 'department__name')list_per_page = 20# raw_id_fields = ('department',)# list_filter = ('department', AgeListFilter, 'create_time')# list_filter = (AgeListFilter, 'department', 'create_time', 'birthday', 'time', 'enable', 'gender')list_display_links = ('name',)#fields = ('user_name', 'idCard', 'birthday') # 编辑界面只显示No、Name和Age#exclude = ('pass_word','user_name') # 记得元祖需要在后面加个逗号,不然会报错list_editable = ('department', 'phone', 'idCard', 'doctor_name', 'gender','idCard','in_time')date_hierarchy = 'create_time'
#!/usr/bin/env python
import os
import sysif __name__ == '__main__':os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'simpleui_demo.settings')try:from django.core.management import execute_from_command_lineexcept ImportError as exc:raise ImportError("Couldn't import Django. Are you sure it's installed and ""available on your PYTHONPATH environment variable? Did you ""forget to activate a virtual environment?") from excexecute_from_command_line(sys.argv)
源码下载
链接:https://pan.baidu.com/s/167Mx6cYeKROqhKl2I2dLCQ
提取码:1234