基于javaweb+mysql的springboot宠物医院管理系统设计和实现(java+springboot+ssm+mysql+thymeleaf+html+maven)
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot宠物医院管理系统设计和实现(java+springboot+ssm+mysql+thymeleaf+html+maven)
一、项目简述
功能描叙: 医生信息,客户信息,宠物管理,浏览管理,诊断管理, 医生管理,用户管理等等模块。
二、项目运行
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP +Springboot+ SpringMVC + MyBatis + ThymeLeaf + HTML+ JavaScript + JQuery + Ajax + maven等等
}
map.put("code",500);
return map;
}
//编号详情
@PostMapping("/ForestVetDoctorEntityID")
public Map<String, Object> ForestVetDoctorEntityID(@RequestBody Forest_VetDoctorEntity model, HttpServletRequest request) {
//判断是否登录
if (new Forest_variable().variableNameSession(request) == 500) {
map.put("code", 500);
return map;
}
List<Forest_VetDoctorEntity> list = forest_vetDoctorService.ForestVetDoctorEntityID(model);
//存储的数据
map.put("doctor", list);
//状态码 200
map.put("code", 200);
return map;
}
//更改数据
@PostMapping("/ForestVetDoctorEntityUpdateAll")
public Map<String, Object> ForestVetDoctorEntityUpdateAll(@RequestBody Forest_VetDoctorEntity model) {
//设置时间的格式
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//获取时间的方法
Date d = new Date();
//将获取的时间转换成设置的时间格式进行存储
model.setForest_VetDoctor_Time(sf.format(d));
int list = forest_vetDoctorService.ForestVetDoctorEntityUpdateAll(model);
if(list==1){
map.put("code", 200);
return map;
}
//状态码 200
map.put("code", 400);
return map;
}
//编号详情
@PostMapping("/ForestVetDoctorEntityState")
public Map<String, Object> ForestVetDoctorEntityState(@RequestBody Forest_VetDoctorEntity model, HttpServletRequest request) {
//判断是否登录
if (new Forest_variable().variableNameSession(request) == 500) {
map.put("code", 500);
return map;
}
int list = forest_vetDoctorService.ForestVetDoctorEntityState(model);
if(list==1){
map.put("code", 200);
return map;
}
//状态码 200
map.put("code", 400);
public class Forest_variable implements variableImpl {
@Override
public String variableName(HttpSession session, Forest_userEntity model) {
//存储用户名
session.setAttribute("name",model.getForest_User_LoginName());
session.setAttribute("id",model.getForest_User_ID());
//2个小时
session.setMaxInactiveInterval(2 * 60 * 60);
return null;
}
//七天内免登录
@Override
public String variableNameTime(HttpSession session, Forest_userEntity model) {
session.setAttribute("name",model.getForest_User_LoginName());
session.setAttribute("id",model.getForest_User_ID());
session.setMaxInactiveInterval(7 * 24 * 60 * 60);
return null;
}
/**
* 如果500表示没有名字
* 如果200表示有名字
* @param request
* @return
*/
@Override
public int variableNameSession(HttpServletRequest request) {
HttpSession session = request.getSession();
String name = (String) session.getAttribute("name");
if(name==null)
{
return 500;
}
return 200;
}
public String sessionName(HttpServletRequest request) {
HttpSession session = request.getSession();
String name = (String) session.getAttribute("name");
return name;
//数据页数和起始值
private int count, num;
//service层的映射
@Autowired
Forest_userService forest_userService;
//全局访问类
private Forest_variable Forest_variable = new Forest_variable();
//存储数据
private List<Forest_userEntity> list;
//登录
@PostMapping("/login")
public Map<String,Object> login(@RequestBody Forest_userEntity forest_userEntity, HttpSession session){
//用户登录
forest_userEntity.setForest_User_Grade(1);
forest_userEntity.setForest_User_State(1);
list=forest_userService.ForestUserEntityLogin(forest_userEntity);
if(list.size()==0){
map.put("code",500);
return map;
}
forest_userEntity.setForest_User_ID(list.get(0).getForest_User_ID());
//使用全局变量存储 将编号 和 登录名存储到session中
session.setAttribute("num", 1);
Forest_variable.variableName(session, forest_userEntity);
map.put("code",200);
return map;
}
//管理登录
@PostMapping("/UserLogin")
public Map<String,Object> UserLogin(@RequestBody Forest_userEntity forest_userEntity, HttpSession session){
//用户登录
forest_userEntity.setForest_User_Grade(2);
forest_userEntity.setForest_User_State(1);
list=forest_userService.ForestUserEntityLogin(forest_userEntity);
if(list.size()==0){
map.put("code",500);
return map;
}
forest_userEntity.setForest_User_ID(list.get(0).getForest_User_ID());
//使用全局变量存储 将编号 和 登录名存储到session中
session.setAttribute("num", 2);
Forest_variable.variableName(session, forest_userEntity);
map.put("code",200);
return map;
}
//注册
@PostMapping("/register")
public Map<String,Object> register(@RequestBody Forest_userEntity forest_userEntity){
forest_userEntity.setForest_User_Grade(1);
//设置时间的格式
List<Forest_DiagnosisEntity> list = forest_diagnosisService.ForestDiagnosisEntitySelect(model);
//存储xiaoc的登录名
map.put("name", new Forest_variable().sessionName(request));
//存储的数据
map.put("diagnosis", list);
//存储页数
map.put("num", num);
//状态码 200
map.put("code", 200);
return map;
}
/**
* 求出统计的数据
*/
public int count(Forest_DiagnosisEntity model) {
//查询的统计数据
count = forest_diagnosisService.ForestDiagnosisEntityRow();
//判断求出页数
if (count % model.getSize() == 0) {
num = count / model.getSize();
} else {
num = count / model.getSize() + 1;
}
//如果信息大于8页 只显示8页
if (num >= 8) {
return 8;
}
return num;
}
//搜索数据
@PostMapping("/ForestDiagnosisEntitySearch")
public Map<String, Object> ForestDiagnosisEntitySearch(@RequestBody Forest_DiagnosisEntity model, HttpServletRequest request) {
//求出统计的数据
num = count1(model);
//判断是否登录
if (new Forest_variable().variableNameSession(request) == 500) {
map.put("code", 500);
return map;
}
//判断是否是首页
if (model.getNum() != 0) {
//若不是首页,则获取起始值
int ss = model.getNum() * model.getSize();
//存储起始值
model.setNum(ss);
}
//查询的起始页
List<Forest_DiagnosisEntity> list = forest_diagnosisService.ForestDiagnosisEntitySearch(model);
//存储xiaoc的登录名
map.put("name", new Forest_variable().sessionName(request));
/**
* 求出统计的数据
*/
public int count(Forest_PetsEntity model) {
//查询的统计数据
count = forest_PetsService.ForestPetsEntityRow();
//判断求出页数
if (count % model.getSize() == 0) {
num = count / model.getSize();
} else {
num = count / model.getSize() + 1;
}
//如果信息大于8页 只显示8页
if (num >= 8) {
return 8;
}
return num;
}
//搜索数据
@PostMapping("/ForestPetsEntitySearch")
public Map<String, Object> ForestPetsEntitySearch(@RequestBody Forest_PetsEntity model, HttpServletRequest request) {
//求出统计的数据
num = count1(model);
//判断是否登录
if (new Forest_variable().variableNameSession(request) == 500) {
map.put("code", 500);
return map;
}
//判断是否是首页
if (model.getNum() != 0) {
//若不是首页,则获取起始值
int ss = model.getNum() * model.getSize();
//存储起始值
model.setNum(ss);
}
//查询的起始页
List<Forest_PetsEntity> list = forest_PetsService.ForestPetsEntitySearch(model);
//存储xiaoc的登录名
map.put("name", new Forest_variable().sessionName(request));
//存储的数据
map.put("Pets", list);
//存储页数
map.put("num", num);
//状态码 200
map.put("code", 200);
return map;
model.setForest_Pets_ID(list.get(0).getForest_Pets_ID());
//新增数据
int register=forest_diagnosisService.ForestDiagnosisEntityRegister(model);
if(register==1){
map.put("code",200);
return map;
}
map.put("code",500);
return map;
}
//编号详情
@PostMapping("/ForestDiagnosisEntityID")
public Map<String, Object> ForestDiagnosisEntityID(@RequestBody Forest_DiagnosisEntity model, HttpServletRequest request) {
//判断是否登录
if (new Forest_variable().variableNameSession(request) == 500) {
map.put("code", 500);
return map;
}
List<Forest_DiagnosisEntity> list = forest_diagnosisService.ForestDiagnosisEntityID(model);
//存储的数据
map.put("diagnosis", list);
//状态码 200
map.put("code", 200);
return map;
}
//更改数据
@PostMapping("/ForestDiagnosisEntityUpdate")
public Map<String, Object> ForestDiagnosisEntityUpdate(@RequestBody Forest_DiagnosisEntity model) {
//设置时间的格式
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//获取时间的方法
Date d = new Date();
//将获取的时间转换成设置的时间格式进行存储
model.setForest_Diagnosis_Time(sf.format(d));
int list = forest_diagnosisService.ForestDiagnosisEntityUpdate(model);
if(list==1){
map.put("code", 200);
return map;
}
//状态码 200
map.put("code", 400);
return map;
}
}
//存储起始值
model.setNum(ss);
}
//查询的起始页
List<Forest_VetDoctorEntity> list = forest_vetDoctorService.ForestVetDoctorEntitySelect1(model);
//存储xiaoc的登录名
map.put("name", new Forest_variable().sessionName(request));
//存储的数据
map.put("doctor", list);
//存储页数1
map.put("num", num);
//状态码 200
map.put("code", 200);
return map;
}
/**
* 求出统计的数据
*/
public int count2(Forest_VetDoctorEntity model) {
//查询的统计数据
count = forest_vetDoctorService.ForestVetDoctorEntityRow1();
//判断求出页数
if (count % model.getSize() == 0) {
num = count / model.getSize();
} else {
num = count / model.getSize() + 1;
}
//如果信息大于8页 只显示8页
if (num >= 8) {
return 8;
}
return num;
}
//搜索数据
@RequestMapping("/ForestVetDoctorEntitySearch1")
public Map<String, Object> ForestVetDoctorEntitySearch1(@RequestBody Forest_VetDoctorEntity model, HttpServletRequest request) {
//求出统计的数据
num = count11(model);
//判断是否登录
if (new Forest_variable().variableNameSession(request) == 500) {
map.put("code", 500);
return map;
}
//判断是否是首页
if (model.getNum() != 0) {
//若不是首页,则获取起始值
int ss = model.getNum() * model.getSize();
//存储起始值
model.setNum(ss);
}
//查询的起始页
List<Forest_VetDoctorEntity> list = forest_vetDoctorService.ForestVetDoctorEntitySearch1(model);
//存储xiaoc的登录名
@RestController
public class Forest_CustomerController {
//使用map存储数据
private Map<String, Object> map = new HashMap<>();
//数据页数和起始值
private int count, num;
//映射
@Autowired
private Forest_CustomerService forest_customerService;
@Autowired
private Forest_Customer_PetsService forest_customer_petsService;
/**
* insertSelective
* 首次加载页面
*/
@RequestMapping("/ForestCustomerEntitySelect")
public Map<String, Object> ForestCustomerEntitySelect(@RequestBody Forest_CustomerEntity model, HttpServletRequest request) {
//求出统计的数据
num = count(model);
//判断是否登录
if (new Forest_variable().variableNameSession(request) == 500) {
map.put("code", 500);
return map;
}
//判断是否是首页
if (model.getNum() != 0) {
//若不是首页,则获取起始值
//判断求出页数
if (count % model.getSize() == 0) {
num = count / model.getSize();
} else {
num = count / model.getSize() + 1;
}
//如果信息大于8页 只显示8页
if (num >= 8) {
return 8;
}
return num;
}
//详情
@PostMapping("/Forest_VetDoctorEntityDetails")
public Map<String, Object> Forest_VetDoctorEntityDetails(@RequestBody Forest_VetDoctorEntity model, HttpServletRequest request) {
//判断是否登录
if (new Forest_variable().variableNameSession(request) == 500) {
map.put("code", 500);
return map;
}
List<Forest_VetDoctorEntity> list = forest_vetDoctorService.Forest_VetDoctorEntityDetails(model);
//存储的数据
map.put("doctor", list);
//状态码 200
map.put("code", 200);
return map;
}
//新增数据
@PostMapping("/ForestVetDoctorEntityRegister")
public Map<String,Object> ForestVetDoctorEntityRegister(@RequestBody Forest_VetDoctorEntity forest_vetDoctorEntity){
//设置时间的格式
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//获取时间的方法
Date d = new Date();
//将获取的时间转换成设置的时间格式进行存储
forest_vetDoctorEntity.setForest_VetDoctor_Time(sf.format(d));
forest_vetDoctorEntity.setForest_VetDoctor_Detail("生活上:活泼开朗、乐观上进、待人热情,可以和老师、同学友好相处。\n" +
"学习上:能吃苦耐劳,用于承受压力,勇于创新。\n" +
"工作上:担任项目助理一职,对待工作认真负责,善于沟通、喜欢积极地去帮助同学,有较强的抗压能力");
int register=forest_vetDoctorService.ForestVetDoctorEntityRegister(forest_vetDoctorEntity);
if(register==1){
map.put("code",200);
return map;
}
map.put("code",500);
return map;
}
//编号详情
@PostMapping("/ForestVetDoctorEntityID")
Forest_PetsEntity forest_petsEntity = new Forest_PetsEntity();
Forest_VetDoctorEntity forest_vetDoctorEntity = new Forest_VetDoctorEntity();
@Autowired
Forest_PetsService forest_petsService;
@Autowired
Forest_VetDoctorService forest_vetDoctorService;
/**
* 将图片存在对应文件中 宠物
*/
@RequestMapping("upload")
public Map fileUpload(@RequestParam MultipartFile file, String Forest_Pets_ID, HttpServletRequest request) {
Map map = new HashMap();
boolean rs = false;
if (!file.isEmpty()) {
String fileName = System.currentTimeMillis() + file.getOriginalFilename();
forest_petsEntity.setForest_Pets_ID(Integer.parseInt(Forest_Pets_ID));
forest_petsEntity.setForest_Pets_Photo(fileName);
forest_petsService.ForestPetsEntityUpdate(forest_petsEntity);
String savePath = WebMvcConfig.uploadImagePath;
File dest = new File(savePath + File.separator + fileName);
try {
file.transferTo(dest);
rs = true;
map.put("result", rs);
} catch (IOException e) {
e.printStackTrace();
map.put("result", rs);
}
} else if (file.isEmpty()) {
map.put("result", rs);
}
return map;
}
/**
* 将图片存在对应文件中 宠物
*/
@RequestMapping("uploadAdministrator")
public Map uploadAdministrator(@RequestParam MultipartFile file, String Forest_VetDoctor_ID, HttpServletRequest request) {
Map map = new HashMap();
boolean rs = false;
if (!file.isEmpty()) {
String fileName = System.currentTimeMillis() + file.getOriginalFilename();
forest_vetDoctorEntity.setForest_VetDoctor_ID(Integer.parseInt(Forest_VetDoctor_ID));
forest_vetDoctorEntity.setForest_VetDoctor_Image(fileName);
forest_vetDoctorService.ForestVetDoctorEntityUpdate(forest_vetDoctorEntity);
String savePath = WebMvcConfig.uploadImagePath;
File dest = new File(savePath + File.separator + fileName);
try {
file.transferTo(dest);
rs = true;
map.put("result", rs);
public int count1(Forest_userEntity model) {
//查询的统计数据
count = forest_userService.ForestUserEntitySearchRow(model);
//判断求出页数
if (count % model.getSize() == 0) {
num = count / model.getSize();
} else {
num = count / model.getSize() + 1;
}
//如果信息大于8页 只显示8页
if (num >= 8) {
return 8;
}
return num;
}
@PostMapping("/ForestUserEntityState")
public Map<String, Object> ForestUserEntityState(@RequestBody Forest_userEntity model, HttpServletRequest request) {
//判断是否登录
if (new Forest_variable().variableNameSession(request) == 500) {
map.put("code", 500);
return map;
}
int list = forest_userService.ForestUserEntityState(model);
if(list==1){
map.put("code", 200);
return map;
}
//状态码 200
map.put("code", 400);
return map;
}
}
}
//新增数据
@PostMapping("/ForestCustomerEntityRegister")
public Map<String,Object> ForestCustomerEntityRegister(@RequestBody Forest_CustomerEntity forest_customerEntity){
//设置时间的格式
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//获取时间的方法
Date d = new Date();
//将获取的时间转换成设置的时间格式进行存储
forest_customerEntity.setForest_Customer_Time(sf.format(d));
int register=forest_customerService.ForestCustomerEntityRegister(forest_customerEntity);
if(register==1){
map.put("code",200);
return map;
}
map.put("code",500);
return map;
}
//编号详情
@PostMapping("/ForestCustomerEntityID")
public Map<String, Object> ForestCustomerEntityID(@RequestBody Forest_CustomerEntity model, HttpServletRequest request) {
//判断是否登录
if (new Forest_variable().variableNameSession(request) == 500) {
map.put("code", 500);
return map;
}
List<Forest_CustomerEntity> list = forest_customerService.ForestCustomerEntityID(model);
//存储的数据
map.put("customer", list);
//状态码 200
map.put("code", 200);
return map;
}
//更改数据
@PostMapping("/ForestCustomerEntityUpdate")
public Map<String, Object> ForestCustomerEntityUpdate(@RequestBody Forest_CustomerEntity model) {
//设置时间的格式
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//获取时间的方法
Date d = new Date();
//将获取的时间转换成设置的时间格式进行存储
model.setForest_Customer_Time(sf.format(d));
int list = forest_customerService.ForestCustomerEntityUpdate(model);
if(list==1){
map.put("code", 200);
return map;
}
//状态码 200
map.put("code", 400);
return 8;
}
return num;
}
}
@RestController
public class Forest_userCongtroller {
//map存储数据
private Map<String, Object> map = new HashMap<>();
//数据页数和起始值
private int count, num;
//service层的映射
@Autowired
Forest_userService forest_userService;
//全局访问类
private Forest_variable Forest_variable = new Forest_variable();
//存储数据
private List<Forest_userEntity> list;
//登录
@PostMapping("/login")
public Map<String,Object> login(@RequestBody Forest_userEntity forest_userEntity, HttpSession session){
//用户登录
forest_userEntity.setForest_User_Grade(1);
forest_userEntity.setForest_User_State(1);
list=forest_userService.ForestUserEntityLogin(forest_userEntity);
if(list.size()==0){
map.put("code",500);
return map;
}
forest_userEntity.setForest_User_ID(list.get(0).getForest_User_ID());
//使用全局变量存储 将编号 和 登录名存储到session中
session.setAttribute("num", 1);
Forest_variable.variableName(session, forest_userEntity);
/**
* 求出统计的数据
*/
public int count1(Forest_userEntity model) {
//查询的统计数据
count = forest_userService.ForestUserEntitySearchRow(model);
//判断求出页数
if (count % model.getSize() == 0) {
num = count / model.getSize();
} else {
num = count / model.getSize() + 1;
}
//如果信息大于8页 只显示8页
if (num >= 8) {
return 8;
}
return num;
}
@PostMapping("/ForestUserEntityState")
public Map<String, Object> ForestUserEntityState(@RequestBody Forest_userEntity model, HttpServletRequest request) {
//判断是否登录
if (new Forest_variable().variableNameSession(request) == 500) {
map.put("code", 500);
return map;
}
int list = forest_userService.ForestUserEntityState(model);
if(list==1){
map.put("code", 200);
return map;
}
//状态码 200
map.put("code", 400);
return map;
}
}
//存储起始值
model.setNum(ss);
}
//查询的起始页
List<Forest_HistoryRecordEntity> list = forest_historyRecordService.ForestUserPetsEntitySelect(model);
//存储xiaoc的登录名
map.put("name", new Forest_variable().sessionName(request));
//存储的数据
map.put("UserPet", list);
//存储页数
map.put("num", num);
//状态码 200
map.put("code", 200);
return map;
}
/**
* 求出统计的数据
*/
public int count(Forest_HistoryRecordEntity model) {
//查询的统计数据
count = forest_historyRecordService.ForestUserPetsEntityRow();
//判断求出页数
if (count % model.getSize() == 0) {
num = count / model.getSize();
} else {
num = count / model.getSize() + 1;
}
//如果信息大于8页 只显示8页
if (num >= 8) {
return 8;
}
return num;
}
//搜索数据
@PostMapping("/ForestUserPetsEntitySearch")
public Map<String, Object> ForestUserPetsEntitySearch(@RequestBody Forest_HistoryRecordEntity model, HttpServletRequest request) {
//求出统计的数据
num = count1(model);
//判断是否登录
if (new Forest_variable().variableNameSession(request) == 500) {
map.put("code", 500);
return map;
}
//判断是否是首页
if (model.getNum() != 0) {
//若不是首页,则获取起始值
int ss = model.getNum() * model.getSize();
}
List<Forest_DiagnosisEntity> list = forest_diagnosisService.ForestDiagnosisEntityID(model);
//存储的数据
map.put("diagnosis", list);
//状态码 200
map.put("code", 200);
return map;
}
//更改数据
@PostMapping("/ForestDiagnosisEntityUpdate")
public Map<String, Object> ForestDiagnosisEntityUpdate(@RequestBody Forest_DiagnosisEntity model) {
//设置时间的格式
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//获取时间的方法
Date d = new Date();
//将获取的时间转换成设置的时间格式进行存储
model.setForest_Diagnosis_Time(sf.format(d));
int list = forest_diagnosisService.ForestDiagnosisEntityUpdate(model);
if(list==1){
map.put("code", 200);
return map;
}
//状态码 200
map.put("code", 400);
return map;
}
}
@RestController
public class Forest_HistoryRecordController {
//使用map存储数据
private Map<String, Object> map = new HashMap<>();
//数据页数和起始值
private int count, num;
//映射
@Autowired
private Forest_HistoryRecordService forest_historyRecordService;
//映射
@Autowired
private Forest_VetDoctorService forest_vetDoctorService;
/**
* insertSelective
* 首次加载页面
*/
@RequestMapping("/ForestVetDoctorEntitySelect")
public Map<String, Object> insertSelective(@RequestBody Forest_VetDoctorEntity model, HttpServletRequest request, HttpSession session) {
//求出统计的数据
num = count(model);
//判断是否登录
if (new Forest_variable().variableNameSession(request) == 500) {
map.put("code", 500);
return map;
}
String nums = String.valueOf(session.getAttribute("num"));
int tt = Integer.parseInt(nums);
if (tt != 2 ) {
map.put("code", 500);
return map;
}
//判断是否是首页
if (model.getNum() != 0) {
//若不是首页,则获取起始值
int ss = model.getNum() * model.getSize();
//存储起始值
model.setNum(ss);
}
//查询的起始页
List<Forest_VetDoctorEntity> list = forest_vetDoctorService.ForestVetDoctorEntitySelect(model);
//存储xiaoc的登录名
map.put("name", new Forest_variable().sessionName(request));
//存储的数据
map.put("doctor", list);
//存储页数
map.put("num", num);
//状态码 200
map.put("code", 200);
return map;