宠物医院管理系统

文章目录

宠物医院管理系统

一、系统演示

宠物医院管理系统

二、项目介绍

语言:java

后端:SpringBoot、MybatisPlus

前端:HTML、CSS 、JS

开发环境

数据库:MySQL

运行工具:IDEA、Eclipse都可运行

三个角色:管理员、医生、用户

1.身份管理,宠物医生登录,宠物主人登录,系统管理员登录

2.系统管理,用户管理,页面管理,角色管理

3.宠物管理,宠物列表,宠物状态,宠物健康史

4.预约管理,预约列表,预约状态,医生时间

5.日常健康,健康指南,健康标准,宠物日志

三、12000字论文参考


四、系统部分页面展示







五、部分代码展示

java 复制代码
package com.phms.controller.admin;

import com.phms.model.ResultMap;
import com.phms.pojo.Page;
import com.phms.pojo.Role;
import com.phms.pojo.User;
import com.phms.pojo.UserParameter;
import com.phms.service.*;
import com.phms.utils.MD5;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;
import java.util.List;

/**
 * 管理员权限控制类
 */
@Controller("Admin")
@RequestMapping("/admin")
public class Adminontroller {

	@Autowired
	private PageService pageService;
	@Autowired
	private RoleService roleService;
	@Autowired
	private PageRoleService pageRoleService;
	@Autowired
	private UserRoleService userRoleService;
	@Autowired
	private UserService userService;

	private final Logger logger = LoggerFactory.getLogger(Adminontroller.class);

	/**
	 * Method name: page <BR>
	 * Description: 跳转到页面设置页面 <BR>
	 * 
	 * @param model
	 * @return String<BR>
	 */
	@RequestMapping("/page")
	public String page(Model model) {
		List<Page> pageList = pageService.getAllPage();
		model.addAttribute("pageList", pageList);
		return "sa/page";
	}

	/**
	 * Method name: role <BR>
	 * Description: 跳转到角色设置页面 <BR>
	 * 
	 * @param model
	 * @return String<BR>
	 */
	@RequestMapping("/role")
	public String role(Model model) {
		return "sa/role";
	}

	/**
	 * Method name: getAllRole <BR>
	 * Description: 获取所有权限 <BR>
	 * 
	 * @return List<Role><BR>
	 */
	@RequestMapping("/getAllRole")
	@ResponseBody
	public List<Role> getAllRole() {
		return roleService.getAllRole();
	}

	/**
	 * Method name: getAllPage <BR>
	 * Description: 获取所有页面 <BR>
	 * 
	 * @return List<Page><BR>
	 */
	@RequestMapping("/getAllPage")
	@ResponseBody
	public List<Page> getAllPage() {
		return pageService.getAllPage();
	}

	/**
	 * Method name: getPageByRole <BR>
	 * Description: 获取某个角色的权限页面 <BR>
	 */
	@RequestMapping("/getPageByRole")
	@ResponseBody
	public Object getPageByRole(Integer roleId) {
		return pageService.getAllPageByRoleId(roleId);
	}

	/**
	 * Method name: updatePageById <BR>
	 * Description: 根据页面id更新页面 <BR>
	 * 
	 * @param page
	 * @return ResultMap<BR>
	 */
	@RequestMapping("/updatePageById")
	@ResponseBody
	public ResultMap updatePageById(Page page) {
		return pageService.updatePageById(page);
	}

	/**
	 * Method name: addPage <BR>
	 * Description: 添加页面 <BR>
	 * 
	 * @param page
	 * @return Page<BR>
	 */
	@RequestMapping("/addPage")
	@ResponseBody
	public Page addPage(Page page) {
		return pageService.addPage(page);
	}

	/**
	 * Method name: delPageById <BR>
	 * Description: 根据页面id删除页面 <BR>
	 * 
	 * @param id
	 * @return ResultMap<BR>
	 */
	@RequestMapping("/delPageById")
	@ResponseBody
	public ResultMap delPageById(Integer id) {
		if (null == id) {
			return new ResultMap().fail().message("参数错误");
		}
		return pageService.delPageById(id);
	}

	/**
	 * Method name: addRole <BR>
	 * Description: 增加角色 <BR>
	 * 
	 * @param name
	 * @return String<BR>
	 */
	@RequestMapping("/addRole")
	@ResponseBody
	public String addRole(String name) {
		return roleService.addRole(name);
	}

	/**
	 * Method name: delManageRole <BR>
	 * Description: 根据角色id删除角色 <BR>
	 * 
	 * @param id
	 * @return String<BR>
	 */
	@RequestMapping("/delRole")
	@ResponseBody
	public String delRole(int id) {
		// 删除角色
		boolean flag1 = roleService.delRoleById(id);
		// 删除角色_权限表
		boolean flag2 = pageRoleService.delPageRoleByRoleId(id);
		// 删除某个角色的所有用户
		boolean flag3 = userRoleService.delUserRoleByRoleId(id);

		if (flag1 && flag2 && flag3) {
			return "SUCCESS";
		}
		return "ERROR";
	}

	/**
	 * Method name: updateRole <BR>
	 * Description: 根据权限id修改权限信息 <BR>
	 * 
	 * @param id
	 * @param name
	 * @return String<BR>
	 */
	@RequestMapping("/updateRole")
	@ResponseBody
	public String updateRole(Integer id, String name) {
		int n = roleService.updateRoleById(id, name);
		if (n != 0) {
			return "SUCCESS";
		}
		return "ERROR";
	}

	/**
	 * Method name: addPageRoleByRoleId <BR>
	 * Description: 增加某个角色的权限页面 <BR>
	 * 
	 * @param roleId
	 * @param pageIds
	 * @return String<BR>
	 */
	@RequestMapping("/addPageRoleByRoleId")
	@ResponseBody
	public String addPageRoleByRoleId(Integer roleId, Integer[] pageIds) {

		if (null == roleId) {
			return "ERROR";
		}

		// 先删除老的权限
		boolean flag1 = pageRoleService.delPageRoleByRoleId(roleId);
		boolean flag2 = pageRoleService.addPageRoles(roleId, pageIds);

		if (flag1 && flag2) {
			return "SUCCESS";
		}
		return "ERROR";
	}

	/**
	 * Method name: getAllUserByMap <BR>
	 * Description: 根据角色查询下面所有的人员/非角色下所有人员 <BR>
	 */
	@RequestMapping("/getAllUserByRoleId")
	@ResponseBody
	public Object getAllUserByRoleId(Integer roleId, String roleNot, Integer page, Integer limit) {
		if (null == roleNot) {
			return userService.getAllUserByRoleId(roleId, page, limit);
		}
		return userService.getAllUserByNotRoleId(roleId, page, limit);
	}

	/**
	 * Method name: delUserRoleByUserIdAndRoleId <BR>
	 * Description: 根据用户id权限id删除用户权限表 <BR>
	 * 
	 * @param userId
	 * @param roleId
	 * @return ResultMap<BR>
	 */
	@RequestMapping("/delUserRoleByUserIdAndRoleId")
	@ResponseBody
	public ResultMap delUserRoleByUserIdAndRoleId(String userId, Integer roleId) {
		return userRoleService.delUserRoleByUserIdAndRoleId(userId, roleId);
	}

	/**
	 * Method name: selectUserRole <BR>
	 * Description: 跳转到选择用户角色页面 <BR>
	 * 
	 * @return String<BR>
	 */
	@RequestMapping("/selectUserRole")
	public String selectUserRole() {
		return "sa/selectUserRole";
	}

	/**
	 * Method name: addUserRole <BR>
	 * Description: 增加用户的角色 <BR>
	 * 
	 * @param roleId
	 * @param userIds
	 * @return String<BR>
	 */
	@RequestMapping("/addUserRole")
	@ResponseBody
	public String addUserRole(Integer roleId, String[] userIds) {
		return userRoleService.addUserRole(roleId, userIds);
	}

	/**
	 * Method name: userAddPage <BR>
	 * Description: 用户添加页面 <BR>
	 * 
	 * @return String<BR>
	 */
	@RequestMapping(value = "/userAddPage")
	public String userAddPage() {
		return "sa/userAdd";
	}

	/**
	 * Method name: userPage <BR>
	 * Description: 用户管理页面 <BR>
	 * 
	 * @return String<BR>
	 */
	@RequestMapping(value = "/userPage")
	public String userPage() {
		return "sa/userList";
	}

	/**
	 * Method name: getAllUserByLimit <BR>
	 * Description: 根据条件获取所有用户 <BR>
	 * 
	 * @param userParameter
	 * @return Object<BR>
	 */
	@RequestMapping("/getAllUserByLimit")
	@ResponseBody
	public Object getAllUserByLimit(UserParameter userParameter) {
		return userService.getAllUserByLimit(userParameter);
	}

	/**
	 * Method name: getAllDelUserByLimit <BR>
	 * Description: 获取所有删除用户 <BR>
	 * 
	 * @param userParameter
	 * @return Object<BR>
	 */
	@RequestMapping("/getAllDelUserByLimit")
	@ResponseBody
	public Object getAllDelUserByLimit(UserParameter userParameter) {
		return userService.getAllDelUserByLimit(userParameter);
	}

	/**
	 * Method name: delUser <BR>
	 * Description: 批量删除用户 <BR>
	 * 
	 * @param ids
	 * @return String<BR>
	 */
	@RequestMapping(value = "delUser")
	@ResponseBody
	@Transactional
	public String delUser(Long[] ids) {
		Subject subject = SecurityUtils.getSubject();
		User user = (User) subject.getPrincipal();
		try {
			for (Long id : ids) {
				if (id.equals(user.getId())) {
					return "DontOP";
				}
				userService.delUserById(id);
			}
			return "SUCCESS";
		} catch (Exception e) {
			logger.error("根据用户id更新用户异常", e);
			TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
			return "ERROR";
		}
	}

	/**
	 * Method name: addUserPage <BR>
	 * Description: 增加用户界面 <BR>
	 * 
	 * @return String<BR>
	 */
	@RequestMapping(value = "/addUserPage")
	public String addUserPage(Long userId, Model model) {
		model.addAttribute("manageUser", userId);
		if (null != userId) {
			User user = userService.selectByPrimaryKey(userId);
			model.addAttribute("manageUser", user);
		}
		return "sa/userAdd";
	}

	/**
	 * Method name: checkUserId <BR>
	 * Description: 检测用户账号是否存在 <BR>
	 * 
	 * @param userId
	 * @return User<BR>
	 */
	@ResponseBody
	@RequestMapping("/checkUserId")
	public User checkUserId(Long userId) {
		return userService.selectByPrimaryKey(userId);
	}

	/**
	 * Method name: addUser <BR>
	 * Description: 用户添加 <BR>
	 * 
	 * @param user
	 * @return String<BR>
	 */
	@ResponseBody
	@RequestMapping("/addUser")
	public String addUser(User user) {
		try {
			user.setPassword(MD5.md5(user.getPassword()));
			user.setCreateTime(new Date());
			userService.addUser(user);

			User u = userService.getUserByPhoneAndName(user.getPhone(), user.getName());

			String[] ids = new String[1];
			ids[0] = u.getId()+"";
			// 医生角色
			userRoleService.addUserRole(3, ids);
			return "SUCCESS";
		} catch (Exception e) {
			return "ERR";
		}
	}

	/**
	 * Method name: updateUser <BR>
	 * Description: 更新用户 <BR>
	 * 
	 * @param user
	 * @return String<BR>
	 */
	@ResponseBody
	@RequestMapping("/updateUser")
	public String updateUser(User user, Long oldId) {
		return userService.updateUser(oldId, user);
	}

	/**
	 * Method name: delUserPage <BR>
	 * Description: 已删除用户列表 <BR>
	 * 
	 * @return String<BR>
	 */
	@RequestMapping("/delUserPage")
	public String delUserPage() {
		return "sa/userDelPage";
	}
}
java 复制代码
package com.phms.controller.user;

import com.phms.pojo.Appointment;
import com.phms.pojo.User;
import com.phms.service.AppointmentService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;

/**
 * 用户预约
 */
@Controller("UserApplyController")
@RequestMapping("/user/apply")
public class UserApplyController {
    @Autowired
    private AppointmentService appointmentService;


    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    /**
     * 医生管理预约页面
     * user/applyListDoctor.html
     */
    @RequestMapping("/applyListDoctor")
    public String applyListDoctor(Long petId, Model model) {
        if (petId!=null){
            model.addAttribute("petId", petId);
        }
        return "user/applyListDoctor";
    }

    /**
     * 普通用户预约页面
     * user/applyList.html
     */
    @RequestMapping("/applyList")
    public String applyList(Long petId, Model model) {
        if (petId!=null){
            model.addAttribute("petId", petId);
        }
        return "user/applyList";
    }
    /**
     * 普通用户返回查询数据渲染表格
     */
    @RequestMapping("/getAllByLimit")
    @ResponseBody
    public Object getAllByLimit(Appointment appointment) {
        Subject subject = SecurityUtils.getSubject();
        User user = (User) subject.getPrincipal();
        appointment.setUserId(user.getId());
        return appointmentService.getAllByLimit(appointment);
    }
    /**
     * 医生角色返回查询数据渲染表格
     */
    @RequestMapping("/getAllByLimitDoctor")
    @ResponseBody
    public Object getAllByLimitBaoJie(Appointment appointment) {
        return appointmentService.getAllByLimit(appointment);
    }

    /**
     * 根据id删除预约
     */
    @RequestMapping(value = "/del")
    @ResponseBody
    @Transactional
    public String delUser(Long id) {
        try {
            appointmentService.deleteById(id);
            return "SUCCESS";
        } catch (Exception e) {
            logger.error("删除异常", e);
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return "ERROR";
        }
    }

    /**
     * 添加预约页面 user/applyAdd.html
     */
    @RequestMapping(value = "/add")
    public String addUserPage(Long id, Model model) {
        model.addAttribute("petId", id);
        return "user/applyAdd";
    }

    /**
     * 预约信息插入数据库
     */
    @RequestMapping(value = "/doAdd")
    @ResponseBody
    @Transactional
    public String doAdd(Appointment appointment) {
        Subject subject = SecurityUtils.getSubject();
        User user = (User) subject.getPrincipal();
        if (appointment.getPetId() == null){
            return "noPetId";
        }
        try {
            // 当前预约人的id
            appointment.setUserId(user.getId());
            appointment.setCreateTime(new Date());
            // 状态:1申请中,2申请通过,3不通过,4已完成
            appointment.setStatus(1);
            appointmentService.add(appointment);
            return "SUCCESS";
        } catch (Exception e) {
            logger.error("添加异常", e);
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return "ERROR";
        }
    }

    /**
     * 改变预约状态
     */
    @RequestMapping(value = "/chStatus")
    @ResponseBody
    @Transactional
    public String chStatus(Appointment appointment) {
        Subject subject = SecurityUtils.getSubject();
        User user = (User) subject.getPrincipal();


        try {
            appointment.setDoctorId(user.getId());
            appointmentService.update(appointment);
            // 就诊
            if (appointment.getStatus() == 4){
                return "jz";
            }
            return "SUCCESS";
        } catch (Exception e) {
            logger.error("添加异常", e);
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return "ERROR";
        }
    }
}
java 复制代码
package com.phms.service.impl;

import com.phms.mapper.DiagnosisMapper;
import com.phms.model.MMGridPageVoBean;
import com.phms.pojo.Diagnosis;
import com.phms.pojo.Pet;
import com.phms.pojo.User;
import com.phms.service.DiagnosisService;
import com.phms.service.PetService;
import com.phms.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

@Service
public class DiagnosisServiceImpl implements DiagnosisService {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    @Resource
    DiagnosisMapper diagnosisMapper;
    @Resource
    UserService userService;
    @Resource
    PetService petService;


    @Override
    public Object getAllByLimit(Diagnosis diagnosis) {
        int size = 0;
        // 计算分页
        Integer begin = (diagnosis.getPage() - 1) * diagnosis.getLimit();
        diagnosis.setPage(begin);

        List<Diagnosis> rows = new ArrayList<>();
        List<Diagnosis> resule = new ArrayList<>();
        try {
            rows = diagnosisMapper.getAllByLimit(diagnosis);
            size = diagnosisMapper.countAllByLimit(diagnosis);
            for (Diagnosis d: rows){
                if (d.getPetId()!=null){
                    Pet my = petService.selectByPrimaryKey(d.getPetId());
                    if (my !=null){
                        d.setName(my.getName());
                    }

                }
                if (d.getUserId()!=null){
                    User my = userService.selectByPrimaryKey(d.getUserId());
                    if (my != null) {
                        d.setUserName(my.getName());
                    }
                }

                if (d.getDoctorId()!=null){
                    User dt = userService.selectByPrimaryKey(d.getDoctorId());
                    if (dt != null) {
                        d.setDoctorName(dt.getName());
                    }
                }
                resule.add(d);
            }
            if (diagnosis.getName()!=null && ""!=diagnosis.getName()){
                Iterator<Diagnosis> iterator = resule.iterator();
                while (iterator.hasNext()){
                    Diagnosis p = iterator.next();
                    if (!p.getName().contains(diagnosis.getName())){
                        iterator.remove();
                    }
                }
                size = rows.size();
            }
        } catch (Exception e) {
            logger.error("根据条件查询异常", e);
        }
        MMGridPageVoBean<Diagnosis> vo = new MMGridPageVoBean<>();
        vo.setTotal(size);
        vo.setRows(resule);

        return vo;
    }

    @Override
    public void deleteById(Long id) {
        diagnosisMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void add(Diagnosis diagnosis) {
        diagnosisMapper.insert(diagnosis);
    }

    @Override
    public void update(Diagnosis diagnosis) {
        diagnosisMapper.updateByPrimaryKeySelective(diagnosis);
    }
}

六、底部获取项目源码和万字论文参考(9.9¥带走)

有问题,或者需要协助调试运行项目的也可以

相关推荐
551只玄猫15 分钟前
【数学建模 matlab 实验报告12】聚类分析和判别分析
开发语言·数学建模·matlab·课程设计·聚类·实验报告
551只玄猫2 天前
【数学建模 matlab 实验报告10】插值
开发语言·数学建模·matlab·课程设计·插值·实验报告
点灯小铭2 天前
基于单片机的智能感应式汽车雨刮器控制系统设计
单片机·嵌入式硬件·汽车·毕业设计·课程设计·期末大作业
清风6666662 天前
基于单片机的自动存包柜设计
单片机·嵌入式硬件·mongodb·毕业设计·课程设计·期末大作业
点灯小铭2 天前
基于单片机的火焰与温度联动检测及声光灭火控制系统
单片机·嵌入式硬件·毕业设计·课程设计·期末大作业
551只玄猫2 天前
【数学建模 matlab 实验报告11】拟合
开发语言·数学建模·matlab·数据分析·课程设计·实验报告·拟合
yuanmazhiwu2 天前
计算机毕业设计:Python全国空气质量与气象监测平台 Flask框架 可视化 数据分析 机器学习 天气 深度学习 AI 空气质量分析(建议收藏)✅
人工智能·python·深度学习·数据挖掘·flask·汽车·课程设计
551只玄猫3 天前
【数学建模 matlab 实验报告9】数据的统计分析与描述
数学建模·matlab·数据分析·课程设计·实验报告
点灯小铭4 天前
基于单片机的多路温湿度采集与WIFI智能报警控制系统设计
单片机·嵌入式硬件·毕业设计·课程设计·期末大作业
源码之屋4 天前
计算机毕业设计:Python出行数据智能分析与预测平台 Django框架 可视化 数据分析 PyEcharts 交通 深度学习(建议收藏)✅
人工智能·python·深度学习·数据分析·django·汽车·课程设计