Bootstrap

基于javaweb+SSM的养老院管理系统(java+SSM+BootStrap+jsp+Maven+mysql)

养老院管理系统
该系统主要功能室养老院系统,采用mvc三层架构

1、采用技术书spring、springmvc、mybatis、maven等技术
2、数据库是mysql,共11张表
3、前端使用bootstrap架构
4、本系统提供两个角色,管理员和普通护理人员,在登录时会进行角色管理,不同角色看到内容不同
5、用户管理包括用户的展示、查询、新增、删除、分页等功能
6、老人管理包括老人信息详情、查询、联系人、事故、护理等级、修改、删除、新增等功能
7、房间管理包括房间详情、查询、修改、删除、新增,支持多个同时删除
8、工资管理主要功能室对员工工资的管理
9、请假管理是管理员工的请假天数、扣除工资等
10、护理等级包括老人和护理人员配对管理

11、工资统计是对工作人员工资管理

环境需要
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.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目
6.数据库:MySql 5.7版本;

技术栈

  1. 后端:Spring SpringMVC MyBatis
  2. 前端:JSP+bootstrap+jQuery

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

  2. 将项目中applicationContext.xml配置文件中的数据库配置改为自己的配置;

  3. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;

若为maven项目,导入成功后请执行maven clean;maven install命令,配置tomcat,然后运行;

  1. 运行项目,输入localhost:8080/xxx 登录请添加图片描述
    请添加图片描述
    请添加图片描述
    请添加图片描述
    请添加图片描述
    请添加图片描述
    请添加图片描述
    请添加图片描述

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

		if (roomName == null) roomName = "";
		if (roomState == null) roomState = "";
		if(rows != 0)roomService.setRows(rows);
		List<Room> roomList = roomService.queryRoom(roomNo, roomTypeObj, roomName, roomState, page);
	    /*计算总的页数和总的记录数*/
	    roomService.queryTotalPageAndRecordNumber(roomNo, roomTypeObj, roomName, roomState);
	    /*获取到总的页码数目*/
	    int totalPage = roomService.getTotalPage();
	    /*当前查询条件下总记录数*/
	    int recordNumber = roomService.getRecordNumber();
        response.setContentType("text/json;charset=UTF-8");
		PrintWriter out = response.getWriter();
		//将要被返回到客户端的对象
		JSONObject jsonObj=new JSONObject();
		jsonObj.accumulate("total", recordNumber);
		/*根据主键oldManId获取OldMan对象*/
        OldMan oldMan = oldManService.getOldMan(oldManId);
        List<UserInfo> userInfoList = userInfoService.queryAllUserInfo();
        request.setAttribute("userInfoList", userInfoList);
        request.setAttribute("oldMan",  oldMan);
        return "OldMan/oldMan_frontshow";
	}
	/*ajax方式显示老人修改jsp视图页*/
	@RequestMapping(value="/{oldManId}/update",method=RequestMethod.GET)
	public void update(@PathVariable Integer oldManId,Model model,HttpServletRequest request,HttpServletResponse response) throws Exception {
        /*根据主键oldManId获取OldMan对象*/
        OldMan oldMan = oldManService.getOldMan(oldManId);
        response.setContentType("text/json;charset=UTF-8");
        PrintWriter out = response.getWriter();
		//将要被返回到客户端的对象 
		JSONObject jsonOldMan = oldMan.getJsonObject();
		out.println(jsonOldMan.toString());
		out.flush();
		out.close();
	}
	/*ajax方式更新老人信息*/
	@RequestMapping(value = "/{oldManId}/update", method = RequestMethod.POST)
	public void update(@Validated OldMan oldMan, BindingResult br,
			Model model, HttpServletRequest request,HttpServletResponse response) throws Exception {
		String message = "";
    	boolean success = false;
			}catch(IOException e){ 
				e.printStackTrace(); 
			} 
		}
    }
}
老人管理控制层:
//Room管理控制层
@Controller
@RequestMapping("/Room")
public class RoomController extends BaseController {
    /*业务层对象*/
    @Resource RoomService roomService;
    @Resource RoomTypeService roomTypeService;
	@InitBinder("roomTypeObj")
	public void initBinderroomTypeObj(WebDataBinder binder) {
		binder.setFieldDefaultPrefix("roomTypeObj.");
	}
	@InitBinder("room")
	public void initBinderRoom(WebDataBinder binder) {
		binder.setFieldDefaultPrefix("room.");
	}
	/*跳转到添加Room视图*/
	@RequestMapping(value = "/add", method = RequestMethod.GET)
	public String add(Model model,HttpServletRequest request) throws Exception {
        	writeJsonResponse(response, success, message);
        } catch (Exception e) { 
            //e.printStackTrace();
            message = "有记录存在外键约束,删除失败";
            writeJsonResponse(response, success, message);
        }
	}
	/*按照查询条件导出房间信息到Excel*/
	@RequestMapping(value = { "/OutToExcel" }, method = {RequestMethod.GET,RequestMethod.POST})
	public void OutToExcel(String roomNo,@ModelAttribute("roomTypeObj") RoomType roomTypeObj,String roomName,String roomState, Model model, HttpServletRequest request,HttpServletResponse response) throws Exception {
        if(roomNo == null) roomNo = "";
        if(roomName == null) roomName = "";
        if(roomState == null) roomState = "";
        List<Room> roomList = roomService.queryRoom(roomNo,roomTypeObj,roomName,roomState);
        ExportExcelUtil ex = new ExportExcelUtil();
        String _title = "Room信息记录"; 
        String[] headers = { "房间编号","房间类型","房间名称","房间主图","房间价格","房间状态"};
        List<String[]> dataset = new ArrayList<String[]>(); 
        for(int i=0;i<roomList.size();i++) {
        	Room room = roomList.get(i); 
        	dataset.add(new String[]{room.getRoomNo(),room.getRoomTypeObj().getTypeName(),room.getRoomName(),room.getMainPhoto(),room.getPrice() + "",room.getRoomState()});
        }
        /*
        OutputStream out = null;
		try {
        /*
        OutputStream out = null;
		try {
			out = new FileOutputStream("C://output.xls");
			ex.exportExcel(title,headers, dataset, out);
		    out.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		*/
		OutputStream out = null;//创建一个输出流对象 
		try { 
			out = response.getOutputStream();//
			response.setHeader("Content-disposition","attachment; filename="+"OldMan.xls");//filename是下载的xls的名,建议最好用英文 
			response.setContentType("application/msexcel;charset=UTF-8");//设置类型 
			response.setHeader("Pragma","No-cache");//设置头 
			response.setHeader("Cache-Control","no-cache");//设置头 
			response.setDateHeader("Expires", 0);//设置日期头  
			String rootPath = request.getSession().getServletContext().getRealPath("/");
			ex.exportExcel(rootPath,_title,headers, dataset, out);
			out.flush();
				e.printStackTrace(); 
			} 
		}
    }
}
老人管理控制层:
//Room管理控制层
@Controller
@RequestMapping("/Room")
public class RoomController extends BaseController {
    /*业务层对象*/
    @Resource RoomService roomService;
    @Resource RoomTypeService roomTypeService;
        UserInfo userInfo = userInfoService.getUserInfo(user_name);
        response.setContentType("text/json;charset=UTF-8");
        PrintWriter out = response.getWriter();
		//将要被返回到客户端的对象 
		JSONObject jsonUserInfo = userInfo.getJsonObject();
		out.println(jsonUserInfo.toString());
		out.flush();
		out.close();
	}
	/*ajax方式更新用户信息*/
	@RequestMapping(value = "/{user_name}/update", method = RequestMethod.POST)
	public void update(@Validated UserInfo userInfo, BindingResult br,
			Model model, HttpServletRequest request,HttpServletResponse response) throws Exception {
	    List<RoomType> roomTypeList = roomTypeService.queryAllRoomType();
	    request.setAttribute("roomTypeList", roomTypeList);
		return "Room/room_frontquery_result"; 
	}
     /*前台查询Room信息*/
	@RequestMapping(value="/{roomNo}/frontshow",method=RequestMethod.GET)
	public String frontshow(@PathVariable String roomNo,Model model,HttpServletRequest request) throws Exception {
		/*根据主键roomNo获取Room对象*/
        Room room = roomService.getRoom(roomNo);
        List<RoomType> roomTypeList = roomTypeService.queryAllRoomType();
        request.setAttribute("roomTypeList", roomTypeList);
        request.setAttribute("room",  room);
        return "Room/room_frontshow";
	}
		}finally{
			try{
				if(out!=null){ 
					out.close(); 
				}
			}catch(IOException e){ 
				e.printStackTrace(); 
			} 
		}
    }
}
老人管理控制层:
//OldMan管理控制层
@Controller
@RequestMapping("/OldMan")
public class OldManController extends BaseController {
    /*业务层对象*/
    @Resource OldManService oldManService;
    @Resource UserInfoService userInfoService;
	@InitBinder("userObj")
	public void initBinderuserObj(WebDataBinder binder) {
		binder.setFieldDefaultPrefix("userObj.");
	}
	@InitBinder("oldMan")
				return "error";
	        }
	}
	/*ajax方式删除多条用户记录*/
	@RequestMapping(value="/deletes",method=RequestMethod.POST)
	public void delete(String user_names,HttpServletRequest request,HttpServletResponse response) throws IOException, JSONException {
		String message = "";
    	boolean success = false;
        try { 
        	int count = userInfoService.deleteUserInfos(user_names);
        	success = true;
        	message = count + "条记录删除成功";
        	writeJsonResponse(response, success, message);
        } catch (Exception e) { 
            //e.printStackTrace();
            message = "有记录存在外键约束,删除失败";
            writeJsonResponse(response, success, message);
        }
	}
	/*按照查询条件导出用户信息到Excel*/
	@RequestMapping(value = { "/OutToExcel" }, method = {RequestMethod.GET,RequestMethod.POST})
	public void OutToExcel(String user_name,String name,String birthDate,String telephone, Model model, HttpServletRequest request,HttpServletResponse response) throws Exception {
        	message = count + "条记录删除成功";
        	writeJsonResponse(response, success, message);
        } catch (Exception e) { 
            //e.printStackTrace();
            message = "有记录存在外键约束,删除失败";
            writeJsonResponse(response, success, message);
        }
	}
	/*按照查询条件导出老人信息到Excel*/
	@RequestMapping(value = { "/OutToExcel" }, method = {RequestMethod.GET,RequestMethod.POST})
	public void OutToExcel(String name,@ModelAttribute("userObj") UserInfo userObj,String addTime, Model model, HttpServletRequest request,HttpServletResponse response) throws Exception {
        if(name == null) name = "";
        if(addTime == null) addTime = "";
        List<OldMan> oldManList = oldManService.queryOldMan(name,userObj,addTime);
        ExportExcelUtil ex = new ExportExcelUtil();
        String _title = "OldMan信息记录"; 
        String[] headers = { "老人编号","姓名","性别","年龄","老人照片","登记用户","登记时间"};
        List<String[]> dataset = new ArrayList<String[]>(); 
        for(int i=0;i<oldManList.size();i++) {
        	OldMan oldMan = oldManList.get(i); 
        	dataset.add(new String[]{oldMan.getOldManId() + "",oldMan.getName(),oldMan.getSex(),oldMan.getAge() + "",oldMan.getManPhoto(),oldMan.getUserObj().getName(),oldMan.getAddTime()});
        }
        /*
        OutputStream out = null;
		try {
			out = new FileOutputStream("C://output.xls");

;