目录
SSM居家健康管理
综合信息
框架介绍
功能演示
管理员后台演示
小程序APP端功能演示:
代码参考
源码下载
SSM居家健康管理
综合信息
uniapp小程序 + ssm服务端 + 后台管理
运行环境:tomcat9,java8,mysql5.7
后台技术:springmvc,spring,mybatis,
页面技术:bootstrap,jquery,vue
前台技术:uniapp小程序
框架介绍
Spring
Spring就像是整个项目中装配bean的大工厂,在配置文件中可以指定使用特定的参数去调用实体类的构造方法来实例化对象。也可以称之为项目中的粘合剂。
Spring的核心思想是IoC(控制反转),即不再需要程序员去显式地`new`一个对象,而是让Spring框架帮你来完成这一切。
SpringMVC
SpringMVC在项目中拦截用户请求,它的核心Servlet即DispatcherServlet承担中介或是前台这样的职责,将用户请求通过HandlerMapping去匹配Controller,Controller就是具体对应请求所执行的操作。SpringMVC相当于SSH框架中struts。
mybatis
mybatis是对jdbc的封装,它让数据库底层操作变的透明。mybatis的操作都是围绕一个sqlSessionFactory实例展开的。mybatis通过配置文件关联到各实体类的Mapper文件,Mapper文件中配置了每个类对数据库所需进行的sql语句映射。在每次与数据库交互时,通过sqlSessionFactory拿到一个sqlSession,再执行sql命令。
页面发送请求给控制器,控制器调用业务层处理逻辑,逻辑层向持久层发送请求,持久层与数据库交互,后将结果返回给业务层,业务层将处理逻辑发送给控制器,控制器再调用视图展现数据。
功能演示
管理员后台演示
01-管理员登录
02-后台管理首页
03-修改密码
4-食物分类管理
05-食物信息管理
06-专家信息管理
7-视频信息管理
8-血糖日历
9-用户咨询管理
10-控糖计划
小程序APP端功能演示:
登录界面 登录成功首页
个人主页 播放视频
我的页面 糖友圈
代码参考
视频信息评论
/**
* 视频信息评论表
* 后端接口
* @author
* @email
* @date 2021-02-24 09:09:44
*/
@RestController
@RequestMapping("/discussshipinxinxi")
public class DiscussshipinxinxiController {
@Autowired
private DiscussshipinxinxiService discussshipinxinxiService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,DiscussshipinxinxiEntity discussshipinxinxi, HttpServletRequest request){
EntityWrapper<DiscussshipinxinxiEntity> ew = new EntityWrapper<DiscussshipinxinxiEntity>();
PageUtils page = discussshipinxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, discussshipinxinxi), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,DiscussshipinxinxiEntity discussshipinxinxi, HttpServletRequest request){
EntityWrapper<DiscussshipinxinxiEntity> ew = new EntityWrapper<DiscussshipinxinxiEntity>();
PageUtils page = discussshipinxinxiService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, discussshipinxinxi), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( DiscussshipinxinxiEntity discussshipinxinxi){
EntityWrapper<DiscussshipinxinxiEntity> ew = new EntityWrapper<DiscussshipinxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( discussshipinxinxi, "discussshipinxinxi"));
return R.ok().put("data", discussshipinxinxiService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(DiscussshipinxinxiEntity discussshipinxinxi){
EntityWrapper< DiscussshipinxinxiEntity> ew = new EntityWrapper< DiscussshipinxinxiEntity>();
ew.allEq(MPUtil.allEQMapPre( discussshipinxinxi, "discussshipinxinxi"));
DiscussshipinxinxiView discussshipinxinxiView = discussshipinxinxiService.selectView(ew);
return R.ok("查询视频信息评论表成功").put("data", discussshipinxinxiView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
DiscussshipinxinxiEntity discussshipinxinxi = discussshipinxinxiService.selectById(id);
return R.ok().put("data", discussshipinxinxi);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
DiscussshipinxinxiEntity discussshipinxinxi = discussshipinxinxiService.selectById(id);
return R.ok().put("data", discussshipinxinxi);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody DiscussshipinxinxiEntity discussshipinxinxi, HttpServletRequest request){
discussshipinxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(discussshipinxinxi);
discussshipinxinxiService.insert(discussshipinxinxi);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody DiscussshipinxinxiEntity discussshipinxinxi, HttpServletRequest request){
discussshipinxinxi.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(discussshipinxinxi);
discussshipinxinxiService.insert(discussshipinxinxi);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody DiscussshipinxinxiEntity discussshipinxinxi, HttpServletRequest request){
//ValidatorUtils.validateEntity(discussshipinxinxi);
discussshipinxinxiService.updateById(discussshipinxinxi);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
discussshipinxinxiService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<DiscussshipinxinxiEntity> wrapper = new EntityWrapper<DiscussshipinxinxiEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = discussshipinxinxiService.selectCount(wrapper);
return R.ok().put("count", count);
}
}
系统资讯
/**
* 系统资讯
* 后端接口
* @author
* @email
* @date 2021-02-24 09:09:44
*/
@RestController
@RequestMapping("/news")
public class NewsController {
@Autowired
private NewsService newsService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,NewsEntity news, HttpServletRequest request){
EntityWrapper<NewsEntity> ew = new EntityWrapper<NewsEntity>();
PageUtils page = newsService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, news), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,NewsEntity news, HttpServletRequest request){
EntityWrapper<NewsEntity> ew = new EntityWrapper<NewsEntity>();
PageUtils page = newsService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, news), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( NewsEntity news){
EntityWrapper<NewsEntity> ew = new EntityWrapper<NewsEntity>();
ew.allEq(MPUtil.allEQMapPre( news, "news"));
return R.ok().put("data", newsService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(NewsEntity news){
EntityWrapper< NewsEntity> ew = new EntityWrapper< NewsEntity>();
ew.allEq(MPUtil.allEQMapPre( news, "news"));
NewsView newsView = newsService.selectView(ew);
return R.ok("查询系统资讯成功").put("data", newsView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
NewsEntity news = newsService.selectById(id);
return R.ok().put("data", news);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
NewsEntity news = newsService.selectById(id);
return R.ok().put("data", news);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody NewsEntity news, HttpServletRequest request){
news.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(news);
newsService.insert(news);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody NewsEntity news, HttpServletRequest request){
news.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(news);
newsService.insert(news);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody NewsEntity news, HttpServletRequest request){
//ValidatorUtils.validateEntity(news);
newsService.updateById(news);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
newsService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<NewsEntity> wrapper = new EntityWrapper<NewsEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = newsService.selectCount(wrapper);
return R.ok().put("count", count);
}
}
血糖日历
/**
* 血糖日历
* 后端接口
* @author
* @email
* @date 2021-02-24 09:09:43
*/
@RestController
@RequestMapping("/xuetangrili")
public class XuetangriliController {
@Autowired
private XuetangriliService xuetangriliService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,XuetangriliEntity xuetangrili, HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("zhuanjia")) {
xuetangrili.setZhuanjiabianhao((String)request.getSession().getAttribute("username"));
}
if(tableName.equals("yonghu")) {
xuetangrili.setYonghuming((String)request.getSession().getAttribute("username"));
}
EntityWrapper<XuetangriliEntity> ew = new EntityWrapper<XuetangriliEntity>();
PageUtils page = xuetangriliService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, xuetangrili), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,XuetangriliEntity xuetangrili, HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("zhuanjia")) {
xuetangrili.setZhuanjiabianhao((String)request.getSession().getAttribute("username"));
}
if(tableName.equals("yonghu")) {
xuetangrili.setYonghuming((String)request.getSession().getAttribute("username"));
}
EntityWrapper<XuetangriliEntity> ew = new EntityWrapper<XuetangriliEntity>();
PageUtils page = xuetangriliService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, xuetangrili), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( XuetangriliEntity xuetangrili){
EntityWrapper<XuetangriliEntity> ew = new EntityWrapper<XuetangriliEntity>();
ew.allEq(MPUtil.allEQMapPre( xuetangrili, "xuetangrili"));
return R.ok().put("data", xuetangriliService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(XuetangriliEntity xuetangrili){
EntityWrapper< XuetangriliEntity> ew = new EntityWrapper< XuetangriliEntity>();
ew.allEq(MPUtil.allEQMapPre( xuetangrili, "xuetangrili"));
XuetangriliView xuetangriliView = xuetangriliService.selectView(ew);
return R.ok("查询血糖日历成功").put("data", xuetangriliView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
XuetangriliEntity xuetangrili = xuetangriliService.selectById(id);
return R.ok().put("data", xuetangrili);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
XuetangriliEntity xuetangrili = xuetangriliService.selectById(id);
return R.ok().put("data", xuetangrili);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody XuetangriliEntity xuetangrili, HttpServletRequest request){
xuetangrili.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(xuetangrili);
xuetangriliService.insert(xuetangrili);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody XuetangriliEntity xuetangrili, HttpServletRequest request){
xuetangrili.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(xuetangrili);
xuetangrili.setUserid((Long)request.getSession().getAttribute("userId"));
xuetangriliService.insert(xuetangrili);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody XuetangriliEntity xuetangrili, HttpServletRequest request){
//ValidatorUtils.validateEntity(xuetangrili);
xuetangriliService.updateById(xuetangrili);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
xuetangriliService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<XuetangriliEntity> wrapper = new EntityWrapper<XuetangriliEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("zhuanjia")) {
wrapper.eq("zhuanjiabianhao", (String)request.getSession().getAttribute("username"));
}
if(tableName.equals("yonghu")) {
wrapper.eq("yonghuming", (String)request.getSession().getAttribute("username"));
}
int count = xuetangriliService.selectCount(wrapper);
return R.ok().put("count", count);
}
}
源码下载
49元,加q 401618487
项目已经开发完成,完整源码可运行。