作者主页:源码空间站2022
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
项目介绍
本项目分为前后台,前台为普通会员用户登录,后台为管理员登录;
程序功能:
1.网站前台:用户注册登录、医院介绍、网站公告、科室医生、预约挂号、查看预约、留言板。
2.网站后台:修改密码、科室管理、医生管理、预约信息、挂号管理、病人管理、留言管理、公告管理
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.数据库:MySql 5.7版本;
6.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目
技术栈
1. 后端:spring+struts+hibernate
2. 前端:JSP+css+javascript
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中WebRoot/WEB-INF/applicationContext.xml配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入http://localhost:8080/yyghxt
普通用户:liusan/123456
管理员:admin/admin
运行截图
前台界面-用户角色
后台界面
相关代码
AdminAction
package com.biyeseng.action;
import java.util.List;
import java.util.Map;
import org.apache.struts2.ServletActionContext;
import com.biyeseng.dao.TAdminDAO;
import com.biyeseng.model.TAdmin;
import com.opensymphony.xwork2.ActionSupport;
import com.biyeseng.util.Pagination;
/**
* 管理员操作Action
* @author biyeseng
* @company www.biyeseng.cn
*
*/
public class AdminAction extends ActionSupport
{
private int userId;
private String userName;
private String userPw;
private String message;
private String path;
private int index=1;
private TAdminDAO adminDAO;
public String adminAdd()
{
TAdmin admin=new TAdmin();
admin.setUserName(userName);
admin.setUserPw(userPw);
adminDAO.save(admin);
this.setMessage("操作成功");
this.setPath("adminManage.action");
return "succeed";
}
public String adminManage()
{
List adminList=adminDAO.findAll();
Map request=(Map)ServletActionContext.getContext().get("request");
request.put("adminList", adminList);
return ActionSupport.SUCCESS;
}
public String adminManageFenye()
{
List adminList=adminDAO.findAll();
int pageSize=3;
int fromIndex = (index - 1) * pageSize;
int toIndex = Math.min(fromIndex + pageSize, adminList.size());
List adminListFenye = adminList.subList(fromIndex, toIndex);
Pagination p = new Pagination();//创建 分页对象
p.setIndex(index);//设置页数
p.setPageSize(pageSize);
p.setTotle(adminList.size());//设置总共的条数
p.setData(adminListFenye);//设置数据
p.setPath("adminManageFenye.action?");//跳转的路径
Map request=(Map)ServletActionContext.getContext().get("request");
request.put("page", p);
return ActionSupport.SUCCESS;
}
public String adminDel()
{
adminDAO.delete(adminDAO.findById(userId));
this.setMessage("删除成功");
this.setPath("adminManage.action");
return "succeed";
}
public TAdminDAO getAdminDAO()
{
return adminDAO;
}
public void setAdminDAO(TAdminDAO adminDAO)
{
this.adminDAO = adminDAO;
}
public String getMessage()
{
return message;
}
public int getIndex()
{
return index;
}
public void setIndex(int index)
{
this.index = index;
}
public void setMessage(String message)
{
this.message = message;
}
public String getPath()
{
return path;
}
public void setPath(String path)
{
this.path = path;
}
public int getUserId()
{
return userId;
}
public void setUserId(int userId)
{
this.userId = userId;
}
public String getUserName()
{
return userName;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getUserPw()
{
return userPw;
}
public void setUserPw(String userPw)
{
this.userPw = userPw;
}
}
如果也想学习本系统,下面领取。关注并回复:133ssh