基于springboot的智慧养老平台

news2024/9/23 17:17:25

末尾获取源码
开发语言:Java
Java开发工具:JDK1.8
后端框架:springboot
前端:html、Vue
数据库:MySQL5.7和Navicat管理工具结合
服务器:Tomcat8.5
开发软件:IDEA / Eclipse
是否Maven项目:是


目录

一、项目简介

二、系统设计

2.1软件功能模块设计

2.2概念模型设计

三、系统项目截图

3.1前台首页

3.2后台管理

四、核心代码

4.1登录相关

4.2文件上传

4.3封装


一、项目简介

首先,论文一开始便是清楚的论述了系统的研究内容。其次,剖析系统需求分析,弄明白“做什么”,分析包括业务分析和业务流程的分析以及用例分析,更进一步明确系统的需求。然后在明白了系统的需求基础上需要进一步地设计系统,主要包罗软件架构模式、整体功能模块、数据库设计。本项目软件架构选择B/S模式,总体功能模块运用自顶向下的分层思想。再然后就是实现系统并进行代码编写实现功能。论文的最后章节总结一下自己完成本论文和开发本项目的心得和总结。通过智慧养老平台将会使智慧养老各个方面的工作效率带来实质性的提升。


二、系统设计

2.1软件功能模块设计

网站整体功能如下:

2.2概念模型设计

概念模型是对现实中的问题出现的事物的进行描述,ER图是由实体及其关系构成的图,通过E-R图可以清楚地描述系统涉及到的实体之间的相互关系。



三、系统项目截图

3.1前台首页

智慧养老平台,在系统首页可以查看首页、活动信息、便利店、劳工、服务项目、个人中心、后台管理等内容,并进行详细操作;

 活动信息,在活动信息页面中可以查看活动标题、活动分类、开始时间、结束时间、活动地点等内容进行收藏等操作

 便利店,在便利店页面可以查看商品名称、生产地、数量、单价、商品分类等内容进行详情或收藏等操作

 服务项目,在服务项目页面可以查看项目名称、项目类型、项目价格、劳工姓名等内容进行详情或收藏等操作

  个人中心,在个人中心页面通过填写老人账号、密码、老人姓名、性别、年龄、图片、老人手机、积分、老人地址等内容进行更新信息等操作,并可以根据我的收藏进行相应的操作 

 

3.2后台管理

管理员和老人进入系统前在登录页面根据要求填写用户名和密码,选择角色等信息,点击登录进行登录操作


管理员登录系统后,可以对首页、个人中心、老人管理、亲属管理、每日健康管理、既往病史管理、活动分类管理、活动信息管理、商品类型管理、便利店管理、商品购买管理、劳工管理、服务类型管理、服务项目管理、服务购买管理、紧急求助管理、礼品发放管理、积分增加管理、系统管理等功能进行相应的操作管理

 

老人管理,在老人管理页面可以对索引、老人账号、老人姓名、性别、年龄、照片、老人手机、积分、老人地址等内容进行详情、礼品发放、积分增加、修改或删除等操作

 

亲属管理,在亲属管理页面可以对索引、老人账号、亲属姓名、性别、联系方式、与老人关系等内容进行详情、修改或删除等操作

每日健康管理,在每日健康管理页面可以对索引、老人账号、老人姓名、性别、年龄、体温、血压、心跳、健康报告、添加时间等内容进行详情、修改或删除等操作 

既往病史管理,在既往病史管理页面可以对索引、老人账号、老人姓名、性别、年龄、登记时间等内容进行详情、修改或删除等操作

 

活动信息管理,在活动信息管理页面中可以对索引、活动标题、封面、活动分类、开始时间、结束时间、活动地点等内容进行详情、修改或删除等操作

 

便利店管理,在便利店管理页面中可以对索引、商品编号、商品名称、出生地、数量、单价、商品分类、商品图片等内容进行详情、进货、修改或删除等操作

 

商品进货管理,在商品进货管理页面可以对索引、进货编号、商品名称、数量、进货单价、进货总价、进货时间、备注等内容进行详情、修改或删除等操作

 

劳工管理,在劳工管理页面中可以对索引、劳工姓名、性别、年龄、图片、工作年龄、专长等内容进行详情、修改、查看评论或删除等操作

 

服务购买管理,在服务购买管理页面中可以对索引、下单编号、项目名称、服务类型、项目价格、劳工姓名、老人姓名、老人手机、老人地址、预约时间、下单时间、备注、是否支付、审核回复、审核状态、审核等内容进行详情、修改或删除等操作

 

礼品发放管理,在礼品发放管理页面中可以对索引、老人账号、老人姓名、老人手机、积分、礼品、礼品图片、发放时间、发放人等内容进行详情、修改或删除等操作 

积分增加管理,在积分增加管理页面中可以对索引、老人账号、老人姓名、积分、增加时间等内容进行详情、修改或删除等操作


四、核心代码

4.1登录相关


package com.controller;


import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.TokenEntity;
import com.entity.UserEntity;
import com.service.TokenService;
import com.service.UserService;
import com.utils.CommonUtil;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;

/**
 * 登录相关
 */
@RequestMapping("users")
@RestController
public class UserController{
	
	@Autowired
	private UserService userService;
	
	@Autowired
	private TokenService tokenService;

	/**
	 * 登录
	 */
	@IgnoreAuth
	@PostMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
		if(user==null || !user.getPassword().equals(password)) {
			return R.error("账号或密码不正确");
		}
		String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
		return R.ok().put("token", token);
	}
	
	/**
	 * 注册
	 */
	@IgnoreAuth
	@PostMapping(value = "/register")
	public R register(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

	/**
	 * 退出
	 */
	@GetMapping(value = "logout")
	public R logout(HttpServletRequest request) {
		request.getSession().invalidate();
		return R.ok("退出成功");
	}
	
	/**
     * 密码重置
     */
    @IgnoreAuth
	@RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
    	UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
    	if(user==null) {
    		return R.error("账号不存在");
    	}
    	user.setPassword("123456");
        userService.update(user,null);
        return R.ok("密码已重置为:123456");
    }
	
	/**
     * 列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,UserEntity user){
        EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
    	PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/list")
    public R list( UserEntity user){
       	EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
      	ew.allEq(MPUtil.allEQMapPre( user, "user")); 
        return R.ok().put("data", userService.selectListView(ew));
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * 获取用户的session用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
    	Long id = (Long)request.getSession().getAttribute("userId");
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserEntity user){
//        ValidatorUtils.validateEntity(user);
        userService.updateById(user);//全部更新
        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        userService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}

4.2文件上传

package com.controller;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity;
import com.entity.EIException;
import com.service.ConfigService;
import com.utils.R;

/**
 * 上传文件映射表
 */
@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{
	@Autowired
    private ConfigService configService;
	/**
	 * 上传文件
	 */
	@RequestMapping("/upload")
	public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
		if (file.isEmpty()) {
			throw new EIException("上传文件不能为空");
		}
		String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
		File path = new File(ResourceUtils.getURL("classpath:static").getPath());
		if(!path.exists()) {
		    path = new File("");
		}
		File upload = new File(path.getAbsolutePath(),"/upload/");
		if(!upload.exists()) {
		    upload.mkdirs();
		}
		String fileName = new Date().getTime()+"."+fileExt;
		File dest = new File(upload.getAbsolutePath()+"/"+fileName);
		file.transferTo(dest);
		FileUtils.copyFile(dest, new File("C:\\Users\\Desktop\\jiadian\\springbootl7own\\src\\main\\resources\\static\\upload"+"/"+fileName));
		if(StringUtils.isNotBlank(type) && type.equals("1")) {
			ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
			if(configEntity==null) {
				configEntity = new ConfigEntity();
				configEntity.setName("faceFile");
				configEntity.setValue(fileName);
			} else {
				configEntity.setValue(fileName);
			}
			configService.insertOrUpdate(configEntity);
		}
		return R.ok().put("file", fileName);
	}
	
	/**
	 * 下载文件
	 */
	@IgnoreAuth
	@RequestMapping("/download")
	public ResponseEntity<byte[]> download(@RequestParam String fileName) {
		try {
			File path = new File(ResourceUtils.getURL("classpath:static").getPath());
			if(!path.exists()) {
			    path = new File("");
			}
			File upload = new File(path.getAbsolutePath(),"/upload/");
			if(!upload.exists()) {
			    upload.mkdirs();
			}
			File file = new File(upload.getAbsolutePath()+"/"+fileName);
			if(file.exists()){
				/*if(!fileService.canRead(file, SessionManager.getSessionUser())){
					getResponse().sendError(403);
				}*/
				HttpHeaders headers = new HttpHeaders();
			    headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);    
			    headers.setContentDispositionFormData("attachment", fileName);    
			    return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
	}
	
}

4.3封装

package com.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * 返回数据
 */
public class R extends HashMap<String, Object> {
	private static final long serialVersionUID = 1L;
	
	public R() {
		put("code", 0);
	}
	
	public static R error() {
		return error(500, "未知异常,请联系管理员");
	}
	
	public static R error(String msg) {
		return error(500, msg);
	}
	
	public static R error(int code, String msg) {
		R r = new R();
		r.put("code", code);
		r.put("msg", msg);
		return r;
	}

	public static R ok(String msg) {
		R r = new R();
		r.put("msg", msg);
		return r;
	}
	
	public static R ok(Map<String, Object> map) {
		R r = new R();
		r.putAll(map);
		return r;
	}
	
	public static R ok() {
		return new R();
	}

	public R put(String key, Object value) {
		super.put(key, value);
		return this;
	}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/60930.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

SpringBoot+Vue项目便捷洗衣服务平台

文末获取源码 开发语言&#xff1a;Java 使用框架&#xff1a;spring boot 前端技术&#xff1a;JavaScript、Vue.js 、css3 开发工具&#xff1a;IDEA/MyEclipse/Eclipse、Visual Studio Code 数据库&#xff1a;MySQL 5.7/8.0 数据库管理工具&#xff1a;phpstudy/Navicat JD…

线程间实现通信的几种方式

目录线程通信相关概述提出问题方式一&#xff1a;使用Object类的wait() 和 notify() 方法方式二&#xff1a;Lock 接口中的 newContition() 方法返回 Condition 对象&#xff0c;Condition 类也可以实现等待/通知模式方法三&#xff1a;使用 volatile 关键字方法四&#xff1a;…

微服务系列之微服务架构

引言 他发现了人类行为的一大法则&#xff0c;那就是&#xff0c;为了要使一个大人或小孩极想干某样事情&#xff0c;只需要设法把那件事情弄得不易到手就行了----《汤姆索亚历险记》 参考书籍&#xff1a; “凤凰架构”“微服务架构设计模式” 在了解微服务架构之前&#…

WorkTool企微机器人APP分享自定义链接

移动端应用怎么分享自定义网页链接到企业微信 前言 我们知道分享自定义网页可以采用转发形式发到企业微信的客户或群里&#xff0c;但是如果我们业务需要配置每次链接入口不同&#xff0c;如链接附带一些业务参数&#xff0c;这时单纯使用转发常常不能满足需求。找到一种替代…

脉冲触发的触发器

唯一的不同在于时钟信号的控制不一样 前面的叫做主触发器&#xff0c;后面叫做从触发器 为什么在一个时钟周期内只可能改变一次&#xff1f;&#xff08;工作原理&#xff09; 在时钟信号等于0期间&#xff0c;看看时钟信号的工作 CLK1期间&#xff0c;主FF工作&#xff0c;…

JeecgBoot搭建(低代码)

环境安装 后端&#xff1a;JDK: 1.8 (小于11)、Maven: 3.5、MySql: 5.7、Redis: 3.2 前端&#xff1a;Node Js: 14.18 / 16、Npm: 5.6.0、Yarn: 1.21.1 、Pnpm 工具&#xff1a; IDEA、Navicat、Git、TortoiseGit拉取代码 后端&#xff1a;git clone https://gitee.com/jeecg/…

[附源码]计算机毕业设计网上电影购票系统Springboot程序

项目运行 环境配置&#xff1a; Jdk1.8 Tomcat7.0 Mysql HBuilderX&#xff08;Webstorm也行&#xff09; Eclispe&#xff08;IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持&#xff09;。 项目技术&#xff1a; SSM mybatis Maven Vue 等等组成&#xff0c;B/S模式 M…

升级Seata Server 1.5.2

目录引言下载地址配置初始Mysql数据库支持TCC Fence引言 最近在做Seata TCC集成&#xff0c;集成过程中将Seata Server由原来的1.4.2升级为最新的1.5.2&#xff0c;本文记录了Seata 1.5的升级过程。 原Seata 1.4.2的安装过程可参见我之前的博客&#xff1a; 分布式事务 - Seat…

TPU编程竞赛系列|基于TPU平台的人车目标检测初赛收官!

近日&#xff0c;AI算法创新赛-“基于TPU平台的人车目标检测”初赛正式结束&#xff0c;经过激烈地角逐&#xff0c;最终排名TOP20的队伍成功进入复赛&#xff0c;开启新的赛程&#xff01; 目标检测是计算机视觉的热门方向&#xff0c;广泛应用于各种智能视频监控系统中。人、…

Flink系列之Flink中State设计详解与企业案例实践

title: Flink系列 二、Flink State 设计详解 Flink 官网解释&#xff1a;Apache Flink — Stateful Computations over Data Streams 前课中 WordCount 的例子&#xff0c;可以得知&#xff1a;其实我们会发现&#xff0c;单词出现的次数有累计的效果。如果没有状态的管理&am…

自制肥鲨HDO2电源升压延长线

自制肥鲨HDO2电源升压延长线1. 问题源由2. 解决方案3. 材料准备4. 最终延长线产出4.1 裸照4.2 成品5. 参考资料1. 问题源由 之前我们介绍了【自制肥鲨HDO2电源降压延长线&#xff0c;支持3S~6S动力电池】&#xff0c;主要解决使用动力电池给眼镜供电的问题。 但是马上有兄弟反…

SpringMVC执行流程

SpringMVC的流程 整个过程开始于客户端发出的一个HTTP请求&#xff0c;Web应用服务器接收到这个请求。如果匹配DispatcherServlet的请求映射路径&#xff0c;则Web容器将该请求转交给DispatcherServlet处理。DispatcherServlet接收到这个请求后&#xff0c;将根据请求的信息&a…

Linux环境下Vivado和HLS功能测试

一. 简介 针对已经完成的Vivado在Linux下的安装与运行&#xff0c;本文主要通过一个LED灯闪烁的案例对Vivado和HLS在Linux操作系统下的运行流程进行介绍&#xff0c;并对已安装软件功能进行一个简单的测试。 HLS将C代码的编译综合为Verilog或VHDL代码&#xff0c;本文对HLS生成…

[附源码]计算机毕业设计JAVA医院门诊信息管理系统

[附源码]计算机毕业设计JAVA医院门诊信息管理系统 项目运行 环境配置&#xff1a; Jdk1.8 Tomcat7.0 Mysql HBuilderX&#xff08;Webstorm也行&#xff09; Eclispe&#xff08;IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持&#xff09;。 项目技术&#xff1a; SSM my…

MySQL视图

MySQL视图 VIEW&#xff08;视图&#xff09; 概念 可以被当作是虚拟表或存储查询 视图跟表格的不同是&#xff0c;表格中有实际储存资料&#xff0c;而视图是建立在表格之上的一个架构&#xff0c;它本身并不实际储存资料。 临时表在用户退出或同数据库的连接断开后就自动…

[LeetCode解题报告] 1610. 可见点的最大数目

[LeetCode解题报告] 1610. 可见点的最大数目一、 题目1. 题目描述2. 原题链接二、 解题报告1. 思路分析2. 复杂度分析3. 代码实现三、 本题小结四、 参考链接一、 题目 1. 题目描述 可见点的最大数目 难度&#xff1a;2147 给你一个点数组 points 和一个表示角度的整数 ang…

01-25-javajvm-JVM和Java体系架构

01-java-JVM和Java体系架构: 1、jvm底层&#xff0c;对性能调优&#xff0c;java是动态内存分配 2、java的跨平台性&#xff1a; Java虚拟机关心“字节码”文件&#xff0c;Java虚拟机和语言关性&#xff0c;只要其他编程语言的编译结果满足并包含Java虚拟机的内部指令集、符…

ch55xduino

1.把wch的ch55x系列单片机&#xff0c;移植到Arduino&#xff0c;制成所谓的“ch55xduino”&#xff1a;GitHub - DeqingSun/ch55xduino: An Arduino-like programming API for the CH55X 2.ch55x系列单片机比较&#xff08;立创/云汉2022年12月报价&#xff09; (1)CH552T:2…

ECMAScript新特性

代码 ECMAScript概述 ECMAScript 是脚本语言的标准化规范&#xff0c;也就是语言的语法。比如&#xff1a;怎样定义变量、怎样定义函数和逻辑运算等等。 那么ECMAScript 和 JavaScript 是何关系&#xff1f; JavaScript 是ECMAScript 的扩展语言&#xff0c;JavaScript实现了…

项目管理逻辑:日志\周报\月报, 一直要求写, 有用吗?

目录 1.公司管控项目: 2.什么是项目的生命周期? 3.项目管控举例 3.1装修项目阶段划分 3.2研发项目 4.控制项目的核心 1.公司管控项目: 写周报,日报,项目问题照样失控, 其实本质上的问题就是 我们没有如何设置好项目的阶段和项目的里程碑. 项目管理的五个阶段 2.什么是…