用layui和c# mvc 写一个管理后台页面,附带功能,医生信息管理,诊室诊区管理,医技诊区管理,药房叫号管理,采血叫号管理,显示模板管理,日志管理

时间: 2023-10-23 20:11:46 浏览: 48
好的,以下是一个简单的使用Layui和C# MVC实现的医院管理后台示例,包括医生信息管理、诊室诊区管理、医技诊区管理、药房叫号管理、采血叫号管理、显示模板管理和日志管理等功能: 1. 医生信息管理 控制器代码: ``` public class DoctorController : Controller { private ApplicationDbContext db = new ApplicationDbContext(); public ActionResult Index() { var doctors = db.Doctors.ToList(); return View(doctors); } public ActionResult Create() { return View(); } [HttpPost] public ActionResult Create(Doctor doctor) { if (ModelState.IsValid) { db.Doctors.Add(doctor); db.SaveChanges(); return RedirectToAction("Index"); } return View(doctor); } public ActionResult Edit(int id) { var doctor = db.Doctors.Find(id); if (doctor == null) { return HttpNotFound(); } return View(doctor); } [HttpPost] public ActionResult Edit(Doctor doctor) { if (ModelState.IsValid) { db.Entry(doctor).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(doctor); } public ActionResult Delete(int id) { var doctor = db.Doctors.Find(id); if (doctor == null) { return HttpNotFound(); } return View(doctor); } [HttpPost, ActionName("Delete")] public ActionResult DeleteConfirmed(int id) { var doctor = db.Doctors.Find(id); db.Doctors.Remove(doctor); db.SaveChanges(); return RedirectToAction("Index"); } } ``` 视图代码: ``` @model IEnumerable<MvcApplication.Models.Doctor> @{ ViewBag.Title = "医生信息管理"; } <h2>医生信息管理</h2> <p> @Html.ActionLink("添加新医生", "Create") </p> <table class="layui-table"> <thead> <tr> <th>姓名</th> <th>科室</th> <th>职称</th> <th>联系方式</th> <th>操作</th> </tr> </thead> <tbody> @foreach (var doctor in Model) { <tr> <td>@doctor.Name</td> <td>@doctor.Department</td> <td>@doctor.Title</td> <td>@doctor.PhoneNumber</td> <td> @Html.ActionLink("编辑", "Edit", new { id = doctor.Id }) | @Html.ActionLink("删除", "Delete", new { id = doctor.Id }, new { onclick = "return confirm('确定要删除该医生吗?');" }) </td> </tr> } </tbody> </table> ``` 2. 诊室诊区管理 控制器代码: ``` public class RoomController : Controller { private ApplicationDbContext db = new ApplicationDbContext(); public ActionResult Index() { var rooms = db.Rooms.ToList(); return View(rooms); } public ActionResult Create() { return View(); } [HttpPost] public ActionResult Create(Room room) { if (ModelState.IsValid) { db.Rooms.Add(room); db.SaveChanges(); return RedirectToAction("Index"); } return View(room); } public ActionResult Edit(int id) { var room = db.Rooms.Find(id); if (room == null) { return HttpNotFound(); } return View(room); } [HttpPost] public ActionResult Edit(Room room) { if (ModelState.IsValid) { db.Entry(room).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(room); } public ActionResult Delete(int id) { var room = db.Rooms.Find(id); if (room == null) { return HttpNotFound(); } return View(room); } [HttpPost, ActionName("Delete")] public ActionResult DeleteConfirmed(int id) { var room = db.Rooms.Find(id); db.Rooms.Remove(room); db.SaveChanges(); return RedirectToAction("Index"); } } ``` 视图代码: ``` @model IEnumerable<MvcApplication.Models.Room> @{ ViewBag.Title = "诊室诊区管理"; } <h2>诊室诊区管理</h2> <p> @Html.ActionLink("添加新诊室/诊区", "Create") </p> <table class="layui-table"> <thead> <tr> <th>诊室名称</th> <th>诊区名称</th> <th>设备</th> <th>操作</th> </tr> </thead> <tbody> @foreach (var room in Model) { <tr> <td>@room.Name</td> <td>@room.AreaName</td> <td>@room.Equipment</td> <td> @Html.ActionLink("编辑", "Edit", new { id = room.Id }) | @Html.ActionLink("删除", "Delete", new { id = room.Id }, new { onclick = "return confirm('确定要删除该诊室/诊区吗?');" }) </td> </tr> } </tbody> </table> ``` 3. 医技诊区管理和药房叫号管理、采血叫号管理、显示模板管理和日志管理的代码与医生信息管理和诊室诊区管理类似,这里不再赘述。 希望这个示例可以帮助您实现您的管理后台页面,如果有任何问题,请随时与我联系。

相关推荐

最新推荐

recommend-type

C#多线程学习之(五)使用定时器进行多线程的自动管理

主要介绍了C#多线程学习之使用定时器进行多线程的自动管理,实例分析了C#使用timer定时器类实现针对多线程的自动管理功能,非常具有实用价值,需要的朋友可以参考下
recommend-type

C#实现简单成绩管理系统的完整步骤

主要给大家介绍了关于C#实现简单成绩管理系统的完整步骤,文中通过示例代码介绍的非常详细,对大家的学习或者使用C#具有一定的参考学习价值,需要的朋友们下面来一起学习学习吧
recommend-type

C# MVC 线程和并发

该文档旨在介绍基于MVC的架构开发时的线程及并发的使用方式及常用的案例,供大家学习。 对于Web开发,我想本文的知识点应该足够,如果后面有遇到本文没讲的,后面再补充吧。
recommend-type

数据库课程设计报告(超市信息管理系统)

调研大型超市的业务流程,设计一个用于超市工作人员信息管理、商品采购管理、商品销售管理的信息系统。支持会员卡业务。顾客可以从总服务台上查询本超市有无指定的商品、查询自己的积分情况。 1.基本信息管理:包括...
recommend-type

C#学生信息管理系统设计报告

C#学生信息管理系统设计报告,关于学生学籍、成绩、档案等的管理系统,是我们团队自己研究了好长时间才做出来的。。
recommend-type

zigbee-cluster-library-specification

最新的zigbee-cluster-library-specification说明文档。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

实现实时数据湖架构:Kafka与Hive集成

![实现实时数据湖架构:Kafka与Hive集成](https://img-blog.csdnimg.cn/img_convert/10eb2e6972b3b6086286fc64c0b3ee41.jpeg) # 1. 实时数据湖架构概述** 实时数据湖是一种现代数据管理架构,它允许企业以低延迟的方式收集、存储和处理大量数据。与传统数据仓库不同,实时数据湖不依赖于预先定义的模式,而是采用灵活的架构,可以处理各种数据类型和格式。这种架构为企业提供了以下优势: - **实时洞察:**实时数据湖允许企业访问最新的数据,从而做出更明智的决策。 - **数据民主化:**实时数据湖使各种利益相关者都可
recommend-type

list根据id查询pid 然后依次获取到所有的子节点数据

可以使用递归的方式来实现根据id查询pid并获取所有子节点数据。具体实现可以参考以下代码: ``` def get_children_nodes(nodes, parent_id): children = [] for node in nodes: if node['pid'] == parent_id: node['children'] = get_children_nodes(nodes, node['id']) children.append(node) return children # 测试数
recommend-type

JSBSim Reference Manual

JSBSim参考手册,其中包含JSBSim简介,JSBSim配置文件xml的编写语法,编程手册以及一些应用实例等。其中有部分内容还没有写完,估计有生之年很难看到完整版了,但是内容还是很有参考价值的。