基于javaweb+mysql的ssm医院人事管理系统(java+ssm+jsp+layui+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SSM医院人事管理系统(java+ssm+jsp+layui+mysql)
jsp+ssm(spring+springMVC+mybatis)实现的医院人事管理系统,系统比较简单,前端界面采用的是layui框架,非常精简友好,主要实现了上班签到,下班签到,生成考勤数据,员工管理、部门管理、职位管理、请假管理、加班管理等功能。
}
@RequestMapping("/yeslist.do")
public String selectYesList(Model model, HttpSession session){
//获取登录用户的信息
Employee employee = (Employee) session.getAttribute("loged");
List<Leave> list = leaveService.selectListByStatus(employee.getDepartmentNumber(), "已批准");
model.addAttribute("list", list);
return "admin/leave_yeslist";
}
}
@Controller
@RequestMapping("/history")
public class HistoryController {
@Autowired
private HistoryService historyService;
@Autowired
private EmployeeService employeeService;
@RequestMapping("/retireListPage.do")
public String selectRetireByPage(Model model, int pageNo){
Page<History> page = historyService.selectRetireByPage(pageNo);
model.addAttribute("page", page);
return "admin/retire_list";
}
@RequestMapping("/{id}/detail.do")
@Controller
@RequestMapping("/overtime")
public class OvertimeController {
@Autowired
private OvertimeService overtimeService;
@Autowired
private EmployeeService employeeService;
@Autowired
private DepartmentService departmentService;
@RequestMapping("/listPage.do")
public String selectListByPgae(Model model, int pageNo){
Page<Overtime> page = overtimeService.selectListByPage(pageNo);
model.addAttribute("page",page);
return "admin/overtime_list";
}
@RequestMapping("/toAdd.do")
public String toAdd(Model model){
//查询出所有的部门
List<Department> dList = departmentService.selectList(new EntityWrapper<Department>());
model.addAttribute("dList", dList);
//查询出所有的员工
List<Employee> eList = employeeService.selectList(new EntityWrapper<Employee>());
model.addAttribute("eList", eList );
return "admin/overtime_add";
}
@RequestMapping("/add.do")
public String add(Overtime overtime, String date){
overtime.setDay(MTimeUtil.stringParse(date));
overtimeService.insert(overtime);
return "forward:/overtime/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/toUpdate.do")
public String toUpdate(Model model, @PathVariable Integer id){
//查询出要修改的记录信息
Overtime overtime = overtimeService.selectById(id);
model.addAttribute("overtime", overtime);
//查询出所有的部门
List<Department> dList = departmentService.selectList(new EntityWrapper<Department>());
model.addAttribute("dList", dList);
//查询出所有的员工
List<Employee> eList = employeeService.selectList(new EntityWrapper<Employee>());
model.addAttribute("eList", eList );
return "admin/overtime_update";
public String seletByEmployee(HttpSession session, int pageNo, Model model){
Employee employee = (Employee)session.getAttribute("loged");
Page<Leave> page = leaveService.seletByEmployee(employee.getEmployeeNumber(), pageNo);
model.addAttribute("page", page);
return "admin/oneself_leave";
}
@RequestMapping("/notlist.do")
public String selectNotList(Model model, HttpSession session){
//获取登录用户的信息
Employee employee = (Employee) session.getAttribute("loged");
List<Leave> list = leaveService.selectListByStatus(employee.getDepartmentNumber(), "未批准");
model.addAttribute("list", list);
return "admin/leave_notlist";
}
@RequestMapping("/yeslist.do")
public String selectYesList(Model model, HttpSession session){
//获取登录用户的信息
Employee employee = (Employee) session.getAttribute("loged");
List<Leave> list = leaveService.selectListByStatus(employee.getDepartmentNumber(), "已批准");
model.addAttribute("list", list);
return "admin/leave_yeslist";
}
}
@Controller
@RequestMapping("/history")
public class HistoryController {
@Autowired
private HistoryService historyService;
@Autowired
private EmployeeService employeeService;
@RequestMapping("/retireListPage.do")
@Controller
@RequestMapping("/department")
public class DepartmentController {
@Autowired
private DepartmentService departmentService;
@RequestMapping("/listPage.do")
public String selectListByPgae(Model model, int pageNo){
Page<Department> page = departmentService.selectListByPage(pageNo);
model.addAttribute("page",page);
return "admin/department_list";
}
@RequestMapping("/toAdd.do")
public String toAdd(Model model){
List<Department> dList = departmentService.selectList(new EntityWrapper<Department>()
.orderBy("department_number", false));
model.addAttribute("departmentNumber", dList.get(0).getDepartmentNumber()+1);
return "admin/department_add";
}
@RequestMapping("/add.do")
public String add(Department department){
departmentService.insert(department);
return "forward:/department/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/toUpdate.do")
public String toUpdate(@PathVariable Integer id, Model model){
Department department = departmentService.selectById(id);
model.addAttribute("department", department);
return "admin/department_update";
}
@RequestMapping("/{id}/update.do")
public String updateById(@PathVariable Integer id, Department department){
department.setId(id);
departmentService.updateById(department);
return "forward:/department/listPage.do?pageNo=1";
}
@RequestMapping("/toAdd.do")
public String toAdd(){
return "admin/leave_add";
}
@RequestMapping("/add.do")
public String add(HttpSession session,Integer employeeNumber, Leave leave, String start, String end){
leave.setEmployeeNumber(employeeNumber);
leave.setStartTime(MTimeUtil.stringParse(start));
leave.setEndTime(MTimeUtil.stringParse(end));
Employee employee = (Employee)session.getAttribute("loged");
leave.setDepartmentNumber(employee.getDepartmentNumber());
leaveService.insert(leave);
return "forward:/employee/welcome.do";
}
@RequestMapping("/oneself.do")
public String seletByEmployee(HttpSession session, int pageNo, Model model){
Employee employee = (Employee)session.getAttribute("loged");
Page<Leave> page = leaveService.seletByEmployee(employee.getEmployeeNumber(), pageNo);
model.addAttribute("page", page);
return "admin/oneself_leave";
}
@RequestMapping("/notlist.do")
public String selectNotList(Model model, HttpSession session){
//获取登录用户的信息
Employee employee = (Employee) session.getAttribute("loged");
List<Leave> list = leaveService.selectListByStatus(employee.getDepartmentNumber(), "未批准");
model.addAttribute("list", list);
return "admin/leave_notlist";
}
@RequestMapping("/yeslist.do")
public String selectYesList(Model model, HttpSession session){
//获取登录用户的信息
Employee employee = (Employee) session.getAttribute("loged");
List<Leave> list = leaveService.selectListByStatus(employee.getDepartmentNumber(), "已批准");
model.addAttribute("list", list);
return "admin/leave_yeslist";
}
}
@RequestMapping("/oneself/{id}/toUpdate.do")
public String toUpdate2(Model model, @PathVariable Integer id){
Employee employee = employeeService.selectById(id);
model.addAttribute("employee", employee);
return "admin/oneself_update";
}
@RequestMapping("/search")
public String search(Model model, String input, int pageNo){
Page<Employee> page = employeeService.search(input, pageNo);
model.addAttribute("page", page);
return "admin/search_result";
}
@RequestMapping("/logout.do")
public String logout(HttpSession session){
session.removeAttribute("loged");
return "login";
}
}
@Controller
@RequestMapping("/overtime")
public String toAdd(Model model){
//查询出所有的部门
List<Department> dList = departmentService.selectList(new EntityWrapper<Department>());
model.addAttribute("dList", dList);
//查询出所有的员工
List<Employee> eList = employeeService.selectList(new EntityWrapper<Employee>());
model.addAttribute("eList", eList );
return "admin/overtime_add";
}
@RequestMapping("/add.do")
public String add(Overtime overtime, String date){
overtime.setDay(MTimeUtil.stringParse(date));
overtimeService.insert(overtime);
return "forward:/overtime/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/toUpdate.do")
public String toUpdate(Model model, @PathVariable Integer id){
//查询出要修改的记录信息
Overtime overtime = overtimeService.selectById(id);
model.addAttribute("overtime", overtime);
//查询出所有的部门
List<Department> dList = departmentService.selectList(new EntityWrapper<Department>());
model.addAttribute("dList", dList);
//查询出所有的员工
List<Employee> eList = employeeService.selectList(new EntityWrapper<Employee>());
model.addAttribute("eList", eList );
return "admin/overtime_update";
}
@RequestMapping("/{id}/update.do")
public String updateById(@PathVariable Integer id, String date, Overtime overtime){
overtime.setId(id);
overtime.setDay(MTimeUtil.stringParse(date));
overtimeService.updateById(overtime);
return "forward:/overtime/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/delete.do")
public String deleteById(@PathVariable Integer id){
overtimeService.deleteById(id);
return "forward:/overtime/listPage.do?pageNo=1";
}
@RequestMapping("/{employeeNumber}/oneself.do")
public String select(Model model, @PathVariable Integer employeeNumber, int pageNo){
Page<Overtime> page = overtimeService.selectByEmployee(pageNo, employeeNumber);
model.addAttribute("page",page);
return "admin/oneself_overtime";
@Controller
@RequestMapping("/leave")
public class LeaveController {
@Autowired
private LeaveService leaveService;
@RequestMapping("/list.do")
public String selectList(Model model){
List<Leave> list = leaveService.selectList();
model.addAttribute("list", list);
return "admin/leave_list";
}
@RequestMapping("/{id}/detail.do")
public String selectLeave(@PathVariable Integer id, Model model){
Leave leave = leaveService.selectLeave(id);
model.addAttribute("leave", leave);
return "admin/leave_detail";
}
@RequestMapping("/{id}/update.do")
public String updateStatus(@PathVariable Integer id){
leaveService.updateStatus(id);
return "forward:/leave/notlist.do";
}
@RequestMapping("/toAdd.do")
public String toAdd(){
return "admin/leave_add";
}
@RequestMapping("/add.do")
public String add(HttpSession session,Integer employeeNumber, Leave leave, String start, String end){
leave.setEmployeeNumber(employeeNumber);
leave.setStartTime(MTimeUtil.stringParse(start));
leave.setEndTime(MTimeUtil.stringParse(end));
Employee employee = (Employee)session.getAttribute("loged");
leave.setDepartmentNumber(employee.getDepartmentNumber());
leaveService.insert(leave);
return "forward:/employee/welcome.do";
}
}
@RequestMapping("/{id}/updateRetire.do")
public String updateRetire(@PathVariable Integer id, History history, String date){
history.setId(id);
history.setBirthday(MTimeUtil.stringParse(date));
historyService.updateById(history);
return "forward:/history/retireListPage.do?pageNo=1";
}
@RequestMapping("/listPage.do")
public String selectListByPage(Model model, int pageNo){
Page<History> page = historyService.selectLisByPage(pageNo);
model.addAttribute("page", page);
return "admin/history_list";
}
@RequestMapping("/{id}/update.do")
public String updateById(@PathVariable Integer id, History history, String date){
history.setId(id);
history.setBirthday(MTimeUtil.stringParse(date));
historyService.updateById(history);
return "redirect:/history/retireListPage.do?pageNo=1";
}
@RequestMapping("/list.do")
public String list(Model model){
List<History> hList = historyService.selectList();
model.addAttribute("hList", hList);
return "admin/history_list";
}
}
@Controller
@RequestMapping("/department")
public class DepartmentController {
@RequestMapping("/add.do")
public String add(Department department){
departmentService.insert(department);
return "forward:/department/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/toUpdate.do")
public String toUpdate(@PathVariable Integer id, Model model){
Department department = departmentService.selectById(id);
model.addAttribute("department", department);
return "admin/department_update";
}
@RequestMapping("/{id}/update.do")
public String updateById(@PathVariable Integer id, Department department){
department.setId(id);
departmentService.updateById(department);
return "forward:/department/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/delete.do")
public String deleteById(@PathVariable Integer id){
departmentService.deleteById(id);
return "forward:/department/listPage.do?pageNo=1";
}
}
@Controller
@RequestMapping("/position")
public class PositionController {
public String updateById(@PathVariable Integer id, Position position){
position.setId(id);
positionService.updateById(position);
return "forward:/position/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/delete.do")
public String deleteById(@PathVariable Integer id){
positionService.deleteById(id);
return "forward:/position/listPage.do?pageNo=1";
}
}
@Controller
@RequestMapping("/attendance")
public class AttendanceController {
@Autowired
private AttendanceService attendanceService;
@RequestMapping("/addStart.do")
public String addStart(Integer employeeNumber){
attendanceService.addStart(employeeNumber);
return "welcome";
}
@RequestMapping("/addEnd.do")
public String addEnd(Integer employeeNumber){
attendanceService.addEnd(employeeNumber);
return "welcome";
}
@Controller
@RequestMapping("/position")
public class PositionController {
@Autowired
private PositionService positionService;
@RequestMapping("/listPage.do")
public String selecListByPage(int pageNo, Model model){
Page<Position> page = positionService.selectListByPage(pageNo);
model.addAttribute("page", page);
return "admin/position_list";
}
@RequestMapping("/toAdd.do")
public String toAdd(Model model){
List<Position> dList = positionService.selectList(new EntityWrapper<Position>()
.orderBy("position_number", false));
model.addAttribute("positionNumber", dList.get(0).getPositionNumber()+1);
return "admin/position_add";
}
@RequestMapping("/add.do")
public String add(Position position){
positionService.insert(position);
return "forward:/position/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/toUpdate.do")
public String toUpdate(@PathVariable Integer id, Model model){
Position position = positionService.selectById(id);
model.addAttribute("position", position);
return "admin/position_update";
}
@RequestMapping("/{id}/update.do")
public String updateById(@PathVariable Integer id, Position position){
position.setId(id);
positionService.updateById(position);
return "forward:/position/listPage.do?pageNo=1";
}
model.addAttribute("positionNumber", dList.get(0).getPositionNumber()+1);
return "admin/position_add";
}
@RequestMapping("/add.do")
public String add(Position position){
positionService.insert(position);
return "forward:/position/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/toUpdate.do")
public String toUpdate(@PathVariable Integer id, Model model){
Position position = positionService.selectById(id);
model.addAttribute("position", position);
return "admin/position_update";
}
@RequestMapping("/{id}/update.do")
public String updateById(@PathVariable Integer id, Position position){
position.setId(id);
positionService.updateById(position);
return "forward:/position/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/delete.do")
public String deleteById(@PathVariable Integer id){
positionService.deleteById(id);
return "forward:/position/listPage.do?pageNo=1";
}
}
@Controller
@RequestMapping("/attendance")
public class AttendanceController {
model.addAttribute("pList", pList);
return "admin/employee_update";
}
@RequestMapping("/{id}/update.do")
public String updateById(@PathVariable Integer id, Employee employee, String date, String status,
HttpSession session){
employee.setId(id);
employee.setBirthday(MTimeUtil.stringParse(date));
//得到操作人员的名字
Employee employee2 = (Employee) session.getAttribute("loged");
if(employee.getDepartmentNumber() == null){
employee.setDepartment(employee2.getDepartment());
employee.setDepartmentNumber(employee2.getDepartmentNumber());
}
if(employee.getPositionNumber() == null){
employee.setPosition(employee2.getPosition());
employee.setPositionNumber(employee2.getPositionNumber());
}
if(status == null){
status = "在职";
}
employeeService.updateEmployee(employee, status, employee2.getName());
return "forward:/employee/listPage.do?pageNo=1";
}
@RequestMapping("/{id}/delete.do")
public String deleteById(@PathVariable Integer id){
employeeService.deleteEmployee(id);
return "forward:/employee/listPage.do?pageNo=1";
}
@RequestMapping("/oneself/{id}/detial.do")
public String selectEmployee2(@PathVariable Integer id, Model model){
Employee employee = employeeService.selectEmployee(id);
model.addAttribute("employee", employee);
return "admin/oneself_detail";
}
@RequestMapping("/oneself/{id}/toUpdate.do")
public String toUpdate2(Model model, @PathVariable Integer id){
Employee employee = employeeService.selectById(id);
model.addAttribute("employee", employee);
return "admin/oneself_update";
}
@RequestMapping("/search")
public String search(Model model, String input, int pageNo){
Page<Employee> page = employeeService.search(input, pageNo);
model.addAttribute("page", page);
return "admin/search_result";
}
@RequestMapping("/logout.do")
}
}
@Controller
@RequestMapping("/overtime")
public class OvertimeController {
@Autowired
private OvertimeService overtimeService;
@Autowired
private EmployeeService employeeService;
@Autowired
private DepartmentService departmentService;
@RequestMapping("/listPage.do")
public String selectListByPgae(Model model, int pageNo){
Page<Overtime> page = overtimeService.selectListByPage(pageNo);
model.addAttribute("page",page);
return "admin/overtime_list";
}
@RequestMapping("/toAdd.do")
public String toAdd(Model model){
//查询出所有的部门
List<Department> dList = departmentService.selectList(new EntityWrapper<Department>());
model.addAttribute("dList", dList);
//查询出所有的员工
List<Employee> eList = employeeService.selectList(new EntityWrapper<Employee>());
model.addAttribute("eList", eList );
return "admin/overtime_add";
}
@Controller
@RequestMapping("/leave")
public class LeaveController {
@Autowired
private LeaveService leaveService;
@RequestMapping("/list.do")
public String selectList(Model model){
List<Leave> list = leaveService.selectList();
model.addAttribute("list", list);
return "admin/leave_list";
}
@RequestMapping("/{id}/detail.do")
public String selectLeave(@PathVariable Integer id, Model model){
Leave leave = leaveService.selectLeave(id);
model.addAttribute("leave", leave);
return "admin/leave_detail";
}
@RequestMapping("/{id}/update.do")
public String updateStatus(@PathVariable Integer id){
leaveService.updateStatus(id);
return "forward:/leave/notlist.do";
}
}
@RequestMapping("/{id}/detail.do")
public String selectLeave(@PathVariable Integer id, Model model){
Leave leave = leaveService.selectLeave(id);
model.addAttribute("leave", leave);
return "admin/leave_detail";
}
@RequestMapping("/{id}/update.do")
public String updateStatus(@PathVariable Integer id){
leaveService.updateStatus(id);
return "forward:/leave/notlist.do";
}
@RequestMapping("/toAdd.do")
public String toAdd(){
return "admin/leave_add";
}
@RequestMapping("/add.do")
public String add(HttpSession session,Integer employeeNumber, Leave leave, String start, String end){
leave.setEmployeeNumber(employeeNumber);
leave.setStartTime(MTimeUtil.stringParse(start));
leave.setEndTime(MTimeUtil.stringParse(end));
Employee employee = (Employee)session.getAttribute("loged");
leave.setDepartmentNumber(employee.getDepartmentNumber());
leaveService.insert(leave);
return "forward:/employee/welcome.do";
}
@RequestMapping("/oneself.do")
public String seletByEmployee(HttpSession session, int pageNo, Model model){
Employee employee = (Employee)session.getAttribute("loged");
Page<Leave> page = leaveService.seletByEmployee(employee.getEmployeeNumber(), pageNo);
model.addAttribute("page", page);
return "admin/oneself_leave";
}
@RequestMapping("/notlist.do")