博主介绍:专注于Java(springboot ssm 等开发框架) vue .net php phython node.js uniapp 微信小程序 等诸多技术领域和毕业项目实战、企业信息化系统建设,从业十五余年开发设计教学工作
☆☆☆ 精彩专栏推荐订阅☆☆☆☆☆不然下次找不到哟
我的博客空间发布了2000+毕设题目 方便大家学习使用
感兴趣的可以先收藏起来,还有大家在毕设选题,项目以及论文编写等相关问题都可以给我留言咨询,希望帮助更多的人
文末下方有源码获取地址
ssm594常见小儿疾病中医护理系统的设计+jsp录像
4.3 系统功能结构设计
在分析并得出使用者对程序的功能要求时,就可以进行程序设计了。如图4.3展示的就是管理员功能结构图,管理员在后台主要管理字典管理、公告信息管理、小儿常见疾病管理、小儿常见疾病收藏管理、小儿常见疾病留言管理、中医小儿推拿管理、中医小儿推拿收藏管理、中医小儿推拿留言管理、用户管理、资讯管理、管理员管理等。
图4.3 管理员功能结构图
开发一个系统也需要提前设计数据库。这里的数据库是相关数据的集合,存储在一起的这些数据也是按照一定的组织方式进行的。目前,数据库能够服务于多种应用程序,则是源于它存储方式最佳,具备数据冗余率低的优势。虽然数据库为程序提供信息存储服务,但它与程序之间也可以保持较高的独立性。总而言之,数据库经历了很长一段时间的发展,从最初的不为人知,到现在的人尽皆知,其相关技术也越发成熟,同时也拥有着坚实的理论基础。
4.4.1 数据库概念设计
这部分内容需要借助数据库关系图来完成,也需要使用专门绘制数据库关系图的工具,比如Visio工具就可以设计E-R图(数据库关系图)。设计数据库,也需要按照设计的流程进行,首先还是要根据需求完成实体的确定,分析实体具有的特征,还有对实体间的关联关系进行确定。最后才是使用E-R模型的表示方法,绘制本系统的E-R图。不管是使用亿图软件,还是Visio工具,对于E-R模型的表示符号都一样,通常矩形代表实体,实体间存在的关系用菱形符号表示,实体的属性也就是实体的特征用符号椭圆表示。最后使用直线将矩形,菱形和椭圆等符号连接起来。接下来就开始对本系统的E-R图进行绘制。
(
4.4.2 数据库表结构设计
数据库系统一旦选定之后,需要根据程序要求在数据库中建立数据库文件,并在已经完成创建的数据库文件里面,为程序运行中产生的数据建立对应的数据表格,数据表结构设计就是对创建的数据表格进行字段设计,字段长度设计,字段类型设计等,当数据表格合理设计完成之后,才能正常存储相关程序运行产生的数据信息。
表4.1字典表
序号 |
列名 |
数据类型 |
说明 |
允许空 |
1 |
Id |
Int |
id |
否 |
2 |
dic_code |
String |
字段 |
是 |
3 |
dic_name |
String |
字段名 |
是 |
4 |
code_index |
Integer |
编码 |
是 |
5 |
index_name |
String |
编码名字 |
是 |
6 |
super_id |
Integer |
父字段id |
是 |
7 |
beizhu |
String |
备注 |
是 |
8 |
create_time |
Date |
创建时间 |
是 |
表4.2公告信息表
序号 |
列名 |
数据类型 |
说明 |
允许空 |
1 |
Id |
Int |
id |
否 |
2 |
gonggao_name |
String |
公告名称 |
是 |
3 |
gonggao_photo |
String |
公告图片 |
是 |
4 |
gonggao_types |
Integer |
公告类型 |
是 |
5 |
insert_time |
Date |
公告发布时间 |
是 |
6 |
gonggao_content |
String |
公告详情 |
是 |
7 |
create_time |
Date |
创建时间 |
是 |
表4.3小儿常见疾病表
序号 |
列名 |
数据类型 |
说明 |
允许空 |
1 |
Id |
Int |
id |
否 |
2 |
xiaoerjibing_name |
String |
疾病名称 |
是 |
3 |
xiaoerjibing_photo |
String |
疾病照片 |
是 |
4 |
xiaoerjibing_types |
Integer |
疾病类型 |
是 |
5 |
xiaoerjibing_zhengzhuang |
String |
常见症状 |
是 |
6 |
xiaoerjibing_clicknum |
Integer |
点击次数 |
是 |
7 |
xiaoerjibing_content |
String |
小儿常见疾病详细介绍 |
是 |
8 |
xiaoerjibing_hulifangfa_content |
String |
护理方法 |
是 |
9 |
xiaoerjibing_delete |
Integer |
逻辑删除 |
是 |
10 |
insert_time |
Date |
添加时间 |
是 |
11 |
create_time |
Date |
创建时间 |
是 |
表4.4小儿常见疾病收藏表
序号 |
列名 |
数据类型 |
说明 |
允许空 |
1 |
Id |
Int |
id |
否 |
2 |
xiaoerjibing_id |
Integer |
小儿常见疾病 |
是 |
3 |
yonghu_id |
Integer |
用户 |
是 |
4 |
xiaoerjibing_collection_types |
Integer |
类型 |
是 |
5 |
insert_time |
Date |
收藏时间 |
是 |
6 |
create_time |
Date |
创建时间 |
是 |
表4.5小儿常见疾病留言表
序号 |
列名 |
数据类型 |
说明 |
允许空 |
1 |
Id |
Int |
id |
否 |
2 |
xiaoerjibing_id |
Integer |
小儿常见疾病 |
是 |
3 |
yonghu_id |
Integer |
用户 |
是 |
4 |
xiaoerjibing_liuyan_text |
String |
留言内容 |
是 |
5 |
insert_time |
Date |
留言时间 |
是 |
6 |
reply_text |
String |
回复内容 |
是 |
7 |
update_time |
Date |
回复时间 |
是 |
8 |
create_time |
Date |
创建时间 |
是 |
表4.6中医小儿推拿表
序号 |
列名 |
数据类型 |
说明 |
允许空 |
1 |
Id |
Int |
id |
否 |
2 |
xiaoertuina_name |
String |
推拿名称 |
是 |
3 |
xiaoertuina_photo |
String |
推拿照片 |
是 |
4 |
xiaoertuina_types |
Integer |
推拿类型 |
是 |
5 |
xiaoertuina_video |
String |
教学视频 |
是 |
6 |
xiaoertuina_content |
String |
中医小儿推拿详细介绍 |
是 |
7 |
xiaoertuina_delete |
Integer |
逻辑删除 |
是 |
8 |
xiaoertuina_clicknum |
Integer |
点击次数 |
是 |
9 |
insert_time |
Date |
添加时间 |
是 |
10 |
create_time |
Date |
创建时间 |
是 |
表4.7中医小儿推拿收藏表
序号 |
列名 |
数据类型 |
说明 |
允许空 |
1 |
Id |
Int |
id |
否 |
2 |
xiaoertuina_id |
Integer |
中医小儿推拿 |
是 |
3 |
yonghu_id |
Integer |
用户 |
是 |
4 |
xiaoertuina_collection_types |
Integer |
类型 |
是 |
5 |
insert_time |
Date |
收藏时间 |
是 |
6 |
create_time |
Date |
创建时间 |
是 |
表4.8中医小儿推拿留言表
序号 |
列名 |
数据类型 |
说明 |
允许空 |
1 |
Id |
Int |
id |
否 |
2 |
xiaoertuina_id |
Integer |
中医小儿推拿 |
是 |
3 |
yonghu_id |
Integer |
用户 |
是 |
4 |
xiaoertuina_liuyan_text |
String |
留言内容 |
是 |
5 |
insert_time |
Date |
留言时间 |
是 |
6 |
reply_text |
String |
回复内容 |
是 |
7 |
update_time |
Date |
回复时间 |
是 |
8 |
create_time |
Date |
创建时间 |
是 |
表4.9用户表
序号 |
列名 |
数据类型 |
说明 |
允许空 |
1 |
Id |
Int |
id |
否 |
2 |
yonghu_name |
String |
用户姓名 |
是 |
3 |
yonghu_phone |
String |
用户手机号 |
是 |
4 |
yonghu_id_number |
String |
用户身份证号 |
是 |
5 |
yonghu_photo |
String |
用户头像 |
是 |
6 |
yonghu_email |
String |
电子邮箱 |
是 |
7 |
create_time |
Date |
创建时间 |
是 |
表4.10资讯表
序号 |
列名 |
数据类型 |
说明 |
允许空 |
1 |
Id |
Int |
id |
否 |
2 |
zixun_name |
String |
新闻资讯名称 |
是 |
3 |
zixun_photo |
String |
新闻资讯图片 |
是 |
4 |
zixun_types |
Integer |
新闻资讯类型 |
是 |
5 |
insert_time |
Date |
新闻资讯发布时间 |
是 |
6 |
zixun_content |
String |
新闻资讯详情 |
是 |
7 |
create_time |
Date |
创建时间 |
是 |
表4.11管理员表
序号 |
列名 |
数据类型 |
说明 |
允许空 |
1 |
Id |
Int |
id |
否 |
2 |
username |
String |
用户名 |
是 |
3 |
password |
String |
密码 |
是 |
4 |
role |
String |
角色 |
是 |
5 |
addtime |
Date |
新增时间 |
是 |
5 系统实现
系统实现部分就是将系统分析,系统设计部分的内容通过编码进行功能实现,以一个实际应用系统的形式展示系统分析与系统设计的结果。前面提到的系统分析,系统设计最主要还是进行功能,系统操作逻辑的设计,也包括了存储数据的数据库方面的设计等内容,系统实现就是一个最终的实施阶段,将前面的设计成果进行物理转化,最终出具可以运用于实际的软件系统。
5.1 管理员功能介绍
5.1.1 小儿常见疾病列表
如图5.1显示的就是小儿常见疾病列表页面,此页面提供给管理员的功能有:查看小儿常见疾病、新增小儿常见疾病、修改小儿常见疾病、删除小儿常见疾病等。
图5.1 小儿常见疾病列表页面
package com.controller;
import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;
import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;
/**
* 小儿常见疾病
* 后端接口
* @author
* @email
*/
@RestController
@Controller
@RequestMapping("/xiaoerjibing")
public class XiaoerjibingController {
private static final Logger logger = LoggerFactory.getLogger(XiaoerjibingController.class);
@Autowired
private XiaoerjibingService xiaoerjibingService;
@Autowired
private TokenService tokenService;
@Autowired
private DictionaryService dictionaryService;
//级联表service
@Autowired
private YonghuService yonghuService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永不会进入");
else if("用户".equals(role))
params.put("yonghuId",request.getSession().getAttribute("userId"));
params.put("xiaoerjibingDeleteStart",1);params.put("xiaoerjibingDeleteEnd",1);
if(params.get("orderBy")==null || params.get("orderBy")==""){
params.put("orderBy","id");
}
PageUtils page = xiaoerjibingService.queryPage(params);
//字典表数据转换
List<XiaoerjibingView> list =(List<XiaoerjibingView>)page.getList();
for(XiaoerjibingView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
XiaoerjibingEntity xiaoerjibing = xiaoerjibingService.selectById(id);
if(xiaoerjibing !=null){
//entity转view
XiaoerjibingView view = new XiaoerjibingView();
BeanUtils.copyProperties( xiaoerjibing , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody XiaoerjibingEntity xiaoerjibing, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,xiaoerjibing:{}",this.getClass().getName(),xiaoerjibing.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if(false)
return R.error(511,"永远不会进入");
Wrapper<XiaoerjibingEntity> queryWrapper = new EntityWrapper<XiaoerjibingEntity>()
.eq("xiaoerjibing_name", xiaoerjibing.getXiaoerjibingName())
.eq("xiaoerjibing_types", xiaoerjibing.getXiaoerjibingTypes())
.eq("xiaoerjibing_zhengzhuang", xiaoerjibing.getXiaoerjibingZhengzhuang())
.eq("xiaoerjibing_clicknum", xiaoerjibing.getXiaoerjibingClicknum())
.eq("xiaoerjibing_delete", xiaoerjibing.getXiaoerjibingDelete())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
XiaoerjibingEntity xiaoerjibingEntity = xiaoerjibingService.selectOne(queryWrapper);
if(xiaoerjibingEntity==null){
xiaoerjibing.setXiaoerjibingClicknum(1);
xiaoerjibing.setXiaoerjibingDelete(1);
xiaoerjibing.setInsertTime(new Date());
xiaoerjibing.setCreateTime(new Date());
xiaoerjibingService.insert(xiaoerjibing);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody XiaoerjibingEntity xiaoerjibing, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,xiaoerjibing:{}",this.getClass().getName(),xiaoerjibing.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");
//根据字段查询是否有相同数据
Wrapper<XiaoerjibingEntity> queryWrapper = new EntityWrapper<XiaoerjibingEntity>()
.notIn("id",xiaoerjibing.getId())
.andNew()
.eq("xiaoerjibing_name", xiaoerjibing.getXiaoerjibingName())
.eq("xiaoerjibing_types", xiaoerjibing.getXiaoerjibingTypes())
.eq("xiaoerjibing_zhengzhuang", xiaoerjibing.getXiaoerjibingZhengzhuang())
.eq("xiaoerjibing_clicknum", xiaoerjibing.getXiaoerjibingClicknum())
.eq("xiaoerjibing_delete", xiaoerjibing.getXiaoerjibingDelete())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
XiaoerjibingEntity xiaoerjibingEntity = xiaoerjibingService.selectOne(queryWrapper);
if("".equals(xiaoerjibing.getXiaoerjibingPhoto()) || "null".equals(xiaoerjibing.getXiaoerjibingPhoto())){
xiaoerjibing.setXiaoerjibingPhoto(null);
}
if(xiaoerjibingEntity==null){
xiaoerjibingService.updateById(xiaoerjibing);//根据id更新
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
ArrayList<XiaoerjibingEntity> list = new ArrayList<>();
for(Integer id:ids){
XiaoerjibingEntity xiaoerjibingEntity = new XiaoerjibingEntity();
xiaoerjibingEntity.setId(id);
xiaoerjibingEntity.setXiaoerjibingDelete(2);
list.add(xiaoerjibingEntity);
}
if(list != null && list.size() >0){
xiaoerjibingService.updateBatchById(list);
}
return R.ok();
}
/**
* 批量上传
*/
@RequestMapping("/batchInsert")
public R save( String fileName){
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
try {
List<XiaoerjibingEntity> xiaoerjibingList = new ArrayList<>();//上传的东西
Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
Date date = new Date();
int lastIndexOf = fileName.lastIndexOf(".");
if(lastIndexOf == -1){
return R.error(511,"该文件没有后缀");
}else{
String suffix = fileName.substring(lastIndexOf);
if(!".xls".equals(suffix)){
return R.error(511,"只支持后缀为xls的excel文件");
}else{
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
File file = new File(resource.getFile());
if(!file.exists()){
return R.error(511,"找不到上传文件,请联系管理员");
}else{
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
dataList.remove(0);//删除第一行,因为第一行是提示
for(List<String> data:dataList){
//循环
XiaoerjibingEntity xiaoerjibingEntity = new XiaoerjibingEntity();
// xiaoerjibingEntity.setXiaoerjibingName(data.get(0)); //疾病名称 要改的
// xiaoerjibingEntity.setXiaoerjibingPhoto("");//照片
// xiaoerjibingEntity.setXiaoerjibingTypes(Integer.valueOf(data.get(0))); //疾病类型 要改的
// xiaoerjibingEntity.setXiaoerjibingZhengzhuang(data.get(0)); //常见症状 要改的
// xiaoerjibingEntity.setXiaoerjibingClicknum(Integer.valueOf(data.get(0))); //点击次数 要改的
// xiaoerjibingEntity.setXiaoerjibingContent("");//照片
// xiaoerjibingEntity.setXiaoerjibingHulifangfaContent("");//照片
// xiaoerjibingEntity.setXiaoerjibingDelete(1);//逻辑删除字段
// xiaoerjibingEntity.setInsertTime(date);//时间
// xiaoerjibingEntity.setCreateTime(date);//时间
xiaoerjibingList.add(xiaoerjibingEntity);
//把要查询是否重复的字段放入map中
}
//查询是否重复
xiaoerjibingService.insertBatch(xiaoerjibingList);
return R.ok();
}
}
}
}catch (Exception e){
return R.error(511,"批量插入数据异常,请联系管理员");
}
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
// 没有指定排序字段就默认id倒序
if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
params.put("orderBy","id");
}
PageUtils page = xiaoerjibingService.queryPage(params);
//字典表数据转换
List<XiaoerjibingView> list =(List<XiaoerjibingView>)page.getList();
for(XiaoerjibingView c:list)
dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
return R.ok().put("data", page);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
XiaoerjibingEntity xiaoerjibing = xiaoerjibingService.selectById(id);
if(xiaoerjibing !=null){
//点击数量加1
xiaoerjibing.setXiaoerjibingClicknum(xiaoerjibing.getXiaoerjibingClicknum()+1);
xiaoerjibingService.updateById(xiaoerjibing);
//entity转view
XiaoerjibingView view = new XiaoerjibingView();
BeanUtils.copyProperties( xiaoerjibing , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody XiaoerjibingEntity xiaoerjibing, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,xiaoerjibing:{}",this.getClass().getName(),xiaoerjibing.toString());
Wrapper<XiaoerjibingEntity> queryWrapper = new EntityWrapper<XiaoerjibingEntity>()
.eq("xiaoerjibing_name", xiaoerjibing.getXiaoerjibingName())
.eq("xiaoerjibing_types", xiaoerjibing.getXiaoerjibingTypes())
.eq("xiaoerjibing_zhengzhuang", xiaoerjibing.getXiaoerjibingZhengzhuang())
.eq("xiaoerjibing_clicknum", xiaoerjibing.getXiaoerjibingClicknum())
.eq("xiaoerjibing_delete", xiaoerjibing.getXiaoerjibingDelete())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
XiaoerjibingEntity xiaoerjibingEntity = xiaoerjibingService.selectOne(queryWrapper);
if(xiaoerjibingEntity==null){
xiaoerjibing.setXiaoerjibingDelete(1);
xiaoerjibing.setInsertTime(new Date());
xiaoerjibing.setCreateTime(new Date());
xiaoerjibingService.insert(xiaoerjibing);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
}
5.1.2 公告信息管理
公告信息管理页面提供的功能操作有:新增公告,修改公告,删除公告操作。下图就是公告信息管理页面。
图5.3 公告信息管理页面
5.1.3公告类型管理
公告类型管理页面显示所有公告类型,在此页面既可以让管理员添加新的公告信息类型,也能对已有的公告类型信息执行编辑更新,失效的公告类型信息也能让管理员快速删除。下图就是公告类型管理页面。
图5.4 公告类型列表页面
大家点赞、收藏、关注、评论啦 其他的定制服务 商务合作 下方联系卡片↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ 或者私信作者