赞
踩
基于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等等
//管理登录 @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); //设置时间的格式 SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //获取时间的方法 Date d = new Date(); //将获取的时间转换成设置的时间格式进行存储 forest_userEntity.setForest_User_Time(sf.format(d)); forest_userEntity.setForest_User_State(1); if(forest_userEntity.getEmailNum().equals(forest_userEntity.getForest_User_Code())){ int register=forest_userService.ForestUserEntityRegister(forest_userEntity); if(register==1){ map.put("code",200); return map; } }else{ map.put("code",400); return map; } map.put("code",500); return map; } //判断用户是否存在 @PostMapping("/ForestUserEntityIfExitLogin") public Map<String,Object> ForestUserEntityIfExitLogin(@RequestBody Forest_userEntity forest_userEntity){ list=forest_userService.ForestUserEntityIfExitLogin(forest_userEntity);
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; } /** * 求出统计的数据 */ public int count(Forest_VetDoctorEntity model) { //查询的统计数据 count = forest_vetDoctorService.ForestVetDoctorEntityRow(); //判断求出页数 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("/ForestVetDoctorEntitySearch") public Map<String, Object> ForestVetDoctorEntitySearch(@RequestBody Forest_VetDoctorEntity model, HttpServletRequest request) {
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; } }
//判断是否是首页 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; } /** * 求出统计的数据 */ public int count(Forest_VetDoctorEntity model) { //查询的统计数据 count = forest_vetDoctorService.ForestVetDoctorEntityRow(); //判断求出页数 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("/ForestVetDoctorEntitySearch") public Map<String, Object> ForestVetDoctorEntitySearch(@RequestBody Forest_VetDoctorEntity model, HttpServletRequest request) { //求出统计的数据 num = count1(model); //判断是否登录 if (new Forest_variable().variableNameSession(request) == 500) { map.put("code", 500); return map; } //判断是否是首页
@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; } /** * 求出统计的数据 */ public int count(Forest_VetDoctorEntity model) {
/** * 将图片存在对应文件中 宠物 */ @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); } catch (IOException e) { e.printStackTrace(); map.put("result", rs); } } else if (file.isEmpty()) { map.put("result", rs); } return map; } } public class Forest_variable implements variableImpl {
map.put("code", 200); return map; } /** * 求出统计的数据 */ public int count(Forest_VetDoctorEntity model) { //查询的统计数据 count = forest_vetDoctorService.ForestVetDoctorEntityRow(); //判断求出页数 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("/ForestVetDoctorEntitySearch") public Map<String, Object> ForestVetDoctorEntitySearch(@RequestBody Forest_VetDoctorEntity 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_VetDoctorEntity> list = forest_vetDoctorService.ForestVetDoctorEntitySearch(model); //存储xiaoc的登录名 map.put("name", new Forest_variable().sessionName(request)); //存储的数据 map.put("doctor", list); //存储页数 map.put("num", num); //状态码 200 map.put("code", 200);
map.put("result", rs); } catch (IOException e) { e.printStackTrace(); map.put("result", rs); } } else if (file.isEmpty()) { map.put("result", rs); } return map; } } 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; }
model.setNum(ss); } //查询的起始页 List<Forest_DiagnosisEntity> list = forest_diagnosisService.ForestDiagnosisEntitySearch(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 count1(Forest_DiagnosisEntity model) { //查询的统计数据 count = forest_diagnosisService.ForestDiagnosisEntitySearchRow(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("/ForestDiagnosisEntityDetails") public Map<String, Object> ForestCustomerEntityDetails(@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.ForestDiagnosisEntityDetails(model); if(list.size()==0) {
@RestController public class Forest_fileUploadController { 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);
} return map; } } 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();
@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); 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);
Date d = new Date(); //将获取的时间转换成设置的时间格式进行存储 model.setForest_Pets_Time(sf.format(d)); int list = forest_PetsService.ForestPetsEntityUpdateAll(model); if(list==1){ map.put("code", 200); return map; } //状态码 200 map.put("code", 400); return map; } //宠物详情 @PostMapping("/ForestCustomerPetsEntitySearchPetsAll") public Map<String, Object> ForestCustomerPetsEntitySearchPetsAll(@RequestBody Forest_Customer_PetsEntity model, HttpSession session) { List<Forest_Customer_PetsEntity> list =forest_customer_petsService.ForestCustomerPetsEntitySearchPetsAll(model); if(list.size()==0){ //状态码 200 map.put("code", 500); return map; } Forest_HistoryRecordEntity HistoryRecord=new Forest_HistoryRecordEntity(); //设置时间的格式 SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //获取时间的方法 Date d = new Date(); //将获取的时间转换成设置的时间格式进行存储 HistoryRecord.setForest_User_Pets_Time(sf.format(d)); HistoryRecord.setForest_Pets_ID(list.get(0).getForest_Pets_ID()); HistoryRecord.setForest_User_ID((Integer) session.getAttribute("id")); forest_historyRecordService.ForestUserPetsEntityAdd(HistoryRecord); //存储的数据 map.put("customerPet", list); //状态码 200 map.put("code", 200); return map; } }
//发送邮件收件人的账号 mails.setTo(mails.getCc()); //邮件接收人的姓名 //邮件的发送的调用函数 mailService.sendSimpleMail(mails.getFrom(),mails.getTo(),mails.getTo(),mails.getSubject(),mails.getContent(),mails.getName()); //返回值 map.put("code",200); map.put("emailNum",names); return map; } } public interface variableImpl { //存储用户的姓名 public String variableName(HttpSession session, Forest_userEntity model); //记住用户的用户名 public String variableNameTime(HttpSession session, Forest_userEntity model); //取数据中的session值 public int variableNameSession(HttpServletRequest request); public String sessionName(HttpServletRequest request); // //public String variableYeZhuName(HttpSession session, Forest_yezhumessage model); //取数据中的session值 public int variableYeZhuNameSession(HttpServletRequest request); public int sessionID(HttpServletRequest request); } @RestController public class Forest_tuiChuController {
@RestController public class Forest_HistoryRecordController { //使用map存储数据 private Map<String, Object> map = new HashMap<>(); //数据页数和起始值 private int count, num; //映射 @Autowired private Forest_HistoryRecordService forest_historyRecordService; /** * insertSelective * 首次加载页面 */ @PostMapping("/ForestUserPetsEntitySelect") public Map<String, Object> ForestUserPetsEntitySelect(@RequestBody Forest_HistoryRecordEntity model, HttpServletRequest request) { //求出统计的数据 num = count(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_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; } /**
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); //设置时间的格式 SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //获取时间的方法 Date d = new Date(); //将获取的时间转换成设置的时间格式进行存储 forest_userEntity.setForest_User_Time(sf.format(d)); forest_userEntity.setForest_User_State(1); if(forest_userEntity.getEmailNum().equals(forest_userEntity.getForest_User_Code())){ int register=forest_userService.ForestUserEntityRegister(forest_userEntity); if(register==1){ map.put("code",200); return map; } }else{ map.put("code",400); return map; }
@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); 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());
} //判断是否是首页 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; } /** * 求出统计的数据 */ public int count1(Forest_PetsEntity model) { //查询的统计数据 count = forest_PetsService.ForestPetsEntitySearchRow(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("/ForestPetsEntityRegister")
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。