基于javaweb+mysql的springboot宠物医院预约挂号系统(java+spring+springboot+mybatis+thymeleaf+html+layui+maven+mysql)
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的SpringBoot宠物医院预约挂号系统(java+spring+springboot+mybatis+thymeleaf+html+layui+maven+mysql)
一、项目简述功能包括: 用户分为宠物,医生,管理员,宠物主人可进行注册选择医生挂号,选择日期,选择号源,医生可进行宠物接诊,管理员可对宠物,医生信息的维护等等功能。
二、项目运行 环境配置:
Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)
项目技术:
JSP +Spring + SpringBoot + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等
if(banners == null){
banners = new Banners();
banners.setId(1);
bannersService.insertSelective(banners);
}
}
if(banners.getImg() != null && !"".equals(banners.getImg())){
imgnames = banners.getImg().split(",");
}
model.addAttribute("imgnames",imgnames);
model.addAttribute("banners",banners);
return "admin/bannersUpdate";
}
/**
*轮播图片删除
*/
@RequestMapping(value ="/bannersDel")
@ResponseBody
public Map<String, Object> bannersDel(Integer id,String src) throws IOException{
Map<String, Object> map = new HashMap<String, Object>();
StringBuffer sb = new StringBuffer();
if(id != null && src != null){
Banners banner = bannersService.selectByPrimaryKey(id);
if(banner.getImg() != null){
String[] split = banner.getImg().split(",");
for(int i = 0; i<split.length;i++){
if(src.equals(split[i])){
//String fp= filePath.substring(filePath.indexOf("/")+1);//文件的真实路径
String path = src.substring(src.indexOf("s") + 2); //获取文件名
File file = new File(filePath +path);
if(file.exists()){
//file.delete();
map.put("massage","删除成功");
}else{
map.put("massage","删除失败");
}
}else{
sb.append(split[i]+",");
}
}
}
}
Banners banners = new Banners();
return "behind/admin/feiyi_videoList";
}
*//**
* 非遗讲堂-删除
*//*
@RequestMapping("/videoDelete")
public String videoDelete(Model model,Integer id) {
if(id != null){
//String fp= filePath.substring(filePath.indexOf("/")+1);//文件的真实路径
Video video = videoService.selectByPrimaryKey(id);
String urlsrls = video.getUrls();
String name = urlsrls.substring(urlsrls.indexOf("s") + 2); //获取文件名
File file = new File(filePath +name);
if(file.exists()){
file.delete();
}
videoService.deleteByPrimaryKey(id);
}
return "redirect:/admin/feiyi_videoList";
}
*//**
* 管理员-人物列表
*//*
@RequestMapping("/personList")
public String personList(Model model,Person person,@RequestParam(value="page",defaultValue="1")Integer page,String sou) {
PageInfo<Person> pageInfo = personService.selectPageList(person,page,size);
List<Person> list = pageInfo.getList();
List<Person> list2 = new ArrayList<Person>();
//默认显示第一张图片
for(int i =0; i<list.size();i++){
Person sh = list.get(i);
String[] img = sh.getImg().split(",");
if(img.length > 0){
sh.setImg(img[0]);
list.set(i,sh);
}
}
if(sou != null && !"".equals(sou)){
char sz = sou.charAt(0);
//判断是否是大写
if(Character.isUpperCase(sz)){
sz = StringRandom.toLower(sz); //大写转小写
}
/**
*取消预约
* @throws ParseException
*/
@RequestMapping(value = "/messagesQuXiao")
public String messagesQuXiao(Integer id) throws ParseException {
Messages ma = new Messages();
ma.setId(id);
ma.setType(2); //取消预约
messagesService.updateByPrimaryKeySelective(ma);
Messages mes = messagesService.selectByPrimaryKey(id);
Messages messages = new Messages();
messages.setType(1);
messages.setUid(mes.getUid());
messages.setTime(new Date());
List<Messages> list = messagesService.selectMessages(messages);
return "redirect:/api/patientList2";
}
/**
*预约信息列表
* @throws ParseException
*/
@RequestMapping(value = "/messagesUidList")
@ResponseBody
public List<Messages> messagesUidList(@RequestBody Messages message) throws ParseException {
List<Messages> list = null;
if(message.getType() != null && message.getType() == 1) {
message.setTime(new Date());
list = messagesService.selectMessagesPai(message);
}else {
list = messagesService.selectMessagesTWO(message);
}
Messages me = new Messages();
me.setType(1);
me.setTime(new Date());
for (int i = 0; i < list.size(); i++) {
me.setDid(list.get(i).getDid());
List<Messages> lin = messagesService.selectMessagesPai(me);
list.get(i).setAge(lin.size());
}
return list;
public String feiyisDelete(Model model,Integer id,Integer type) {
if (id != null) {
Feiyis feiyis = feiyisService.selectByPrimaryKey(id);
//删除图片
// String fp= filePath.substring(filePath.indexOf("/")+1);//文件的真实路径
if (feiyis.getImg() != null) {
String name = feiyis.getImg().substring(feiyis.getImg().indexOf("s") + 2);//获取文件
File file = new File(filePath + name);
if (file.exists()) {
file.delete();
}
}
feiyisService.deleteByPrimaryKey(id);
}
return "redirect:/admin/feiyisList?type=" + type;
}
*//**
* 后台主页
* @return
*//*
@RequestMapping("/index")
public String index(Model model) {
//图表信息
int zixun = zixunService.countByExample(null);
int video = videoService.countByExample(null);
int person = personService.countByExample(null);
int zuocount = feiyisService.countByExamples(1);
int huocount = feiyisService.countByExamples(2);
int zoucount = feiyisService.countByExamples(3);
int facount = feiyisService.countByExamples(4);
model.addAttribute("zixun",zixun);
model.addAttribute("video",video);
model.addAttribute("person",person);
model.addAttribute("zuocount",zuocount);
model.addAttribute("huocount",huocount);
model.addAttribute("zoucount",zoucount);
model.addAttribute("facount",facount);
//总评论数
/**
* 后端管理员控制层
*/
@Controller
@RequestMapping("/admin")
public class AdminController {
@Autowired
private AdminService adminService;
@Autowired
private SectionService sectionService;
@Autowired
private BannersService bannersService;
@Autowired
private DoctorService doctorService;
@Autowired
private PatientService patientService;
@Autowired
private MessagesService messagesService;
private Integer size = 6;//每页显示数量
@Value("${fileUrl}") //在配置文件中获取文件的保存路径
private String filePath;
/**
* 后端管理员控制层
*/
@Controller
@RequestMapping("/api")
public class PatientController {
private Integer size = 6;//每页显示数量
@Autowired
private AdminService adminService;
@Autowired
private SectionService sectionService;
@Autowired
private BannersService bannersService;
@Autowired
private DoctorService doctorService;
@Autowired
private PatientService patientService;
@Autowired
private MessagesService messagesService;
/**
* 医生列表
*/
@RequestMapping("/doctorList1")
public String doctorList(Model model, Doctor doctor, @RequestParam(value="page",defaultValue="1")Integer page) {
if(doctor == null) {
doctor = new Doctor();
}
PageInfo<Doctor> pageInfo = doctorService.selectDoctorList(doctor,page,size);
List<Doctor> list = pageInfo.getList();
* 判断医生账号
*/
@RequestMapping("/panzhanghao")
@ResponseBody
public Map<String,String> panzhanghao(Model model, String zhanghao) {
Map<String, String> map = new HashMap<String, String>();
DoctorExample se = new DoctorExample();
DoctorExample.Criteria criteria = se.createCriteria();
criteria.andUsernameEqualTo(zhanghao);
List<Doctor> selectByExample = doctorService.selectByExample(se);
if(selectByExample.size() > 0){
map.put("pan","err");
}else{
map.put("pan","ok");
}
return map;
}
/**
* 医生添加
* @param model
* @param zixun
* @return
*/
@RequestMapping("/zixunInsert")
public String zixunInsert(Model model,Doctor doctor){
if(doctor.getId() != null){
if(doctor.getSid() != null) {
Section selectByPrimaryKey = sectionService.selectByPrimaryKey(doctor.getSid());
doctor.setSname(selectByPrimaryKey.getName());
}
doctorService.updateByPrimaryKeySelective(doctor);
}
model.addAttribute("type",1);
return "login";
}
/**
* 管理员注册界面
*/
@RequestMapping("/mimaPageUptate")
public String mimaPageUptate(Integer type,Model model) {
//1医生 2 管理员
if(type == 1 ) {
return "doctorRegister";
}
return "adminRegister";
}
Map<String, String> map = new HashMap<String, String>();
PatientExample se = new PatientExample();
PatientExample.Criteria criteria = se.createCriteria();
criteria.andUsernameEqualTo(zhanghao);
List<Patient> selectByExample = patientService.selectByExample(se);
if(selectByExample.size() > 0){
map.put("pan","err");
}else{
map.put("pan","ok");
}
return map;
}
/**
* 患者注册界面
*/
@RequestMapping("/patientAddPage")
public String patientAddPage(Model model) {
return "patientRegister";
}
/**
*患者信息列表
*/
@RequestMapping(value = "/patientList")
@ResponseBody
public List<Patient> patientList(Integer pid,HttpServletRequest request) {
Patient pa = new Patient();
pa.setPid(pid);
List<Patient> selectPatient = patientService.selectPatient(pa);
return selectPatient;
}
/**
*患者信息列表
*/
@RequestMapping("/patientList2")
public String messageList2(Model model, Patient patient, @RequestParam(value="page",defaultValue="1")Integer page,HttpServletRequest request) {
if(patient == null) {
patient = new Patient();
}
HttpSession session = request.getSession();
Patient patient1 = (Patient) session.getAttribute("PATIENT");
if(patient1 == null){
return "redirect:/login/font/index";
}
/*
messages.setDid(dt.getId());
PageInfo<Messages> pageInfo = messagesService.selectMessagesList(messages, 1, size);
model.addAttribute("doctorList",pageInfo.getList());
model.addAttribute("pageInfo",pageInfo);
model.addAttribute("patient",patient);
return "doctor/patientList";
}
/**
*预约信息列表
* @throws ParseException
*/
@RequestMapping(value = "/tiaozhuanList")
@ResponseBody
public String messagesList(@RequestParam("xiao")Integer xiao,@RequestParam("da")Integer da) {
Messages message = new Messages();
if(xiao != null & da != null) {
Messages mexiao = messagesService.selectByPrimaryKey(xiao);
Integer px = mexiao.getPai();
Messages meda = messagesService.selectByPrimaryKey(da);
mexiao.setPai(meda.getPai());
meda.setPai(px);
messagesService.updateByPrimaryKeySelective(mexiao);
messagesService.updateByPrimaryKeySelective(meda);
}
return null;
}
/**
* 确定预约
*/
@RequestMapping("/messagesUptate")
public String messagesUptate(Integer id) {
if(id != null) {
Messages messages = new Messages();
messages.setId(id);
messages.setType(3); //3表示预约成功
messagesService.updateByPrimaryKeySelective(messages);
}
return "redirect:/doctor/messageList?type=1";
}
/**
* 取消
*/
@RequestMapping("/messagesQuXiao")
public String messagesQuXiao(Integer id) {
if(id != null) {
Messages messages = new Messages();
messages.setId(id);
messages.setType(2); //2取消预约
messagesService.updateByPrimaryKeySelective(messages);
}
return "redirect:/doctor/messageList?type=1";
* @throws ParseException
*/
@RequestMapping(value = "/passwordSave")
@ResponseBody
public String passwordSave(@RequestBody Patient patient ) throws ParseException {
if(patient != null && patient.getUsername() != null && patient.getPassword() != null) {
Patient pa = new Patient();
pa.setUsername(patient.getUsername());
List<Patient> list = patientService.selectPatient(pa);
if(list.size() > 0) {
return "err";
}
patientService.insertSelective(patient);
return "ok";
}
return "err";
}
/**
*登录验证
* @throws ParseException
*/
@RequestMapping(value = "/userLoginView")
@ResponseBody
public String userLoginView(HttpServletRequest request) throws ParseException {
HttpSession session = request.getSession();
Patient patient =(Patient) session.getAttribute("USER");
System.out.println("*********登陆验证********");
System.out.println(patient);
if(patient != null) {
return "ok";
}
return "err";
}
/**
*banner图
*/
@RequestMapping(value = "/bannerList")
@ResponseBody
public String[] formAdd() {
Banners banners = bannersService.selectByPrimaryKey(1);
String[] split = null;
if(banners != null && banners.getImg() != null) {
split = banners.getImg().split(",");
}
return split;
model.addAttribute("patient",patient);
model.addAttribute("messages",messages);
PageInfo<Doctor> pageInfo = doctorService.selectDoctorList(null,1,4);
if(pageInfo.getList() != null && pageInfo.getList().size() >0 ) {
List<Doctor> list = pageInfo.getList();
StringBuffer sb = new StringBuffer();
StringBuffer shu = new StringBuffer();
int v = list.size()-1;
for(int i=0;i<list.size();i++) {
if(v==i) {
sb.append(list.get(i).getName());
shu.append(list.get(i).getYipeoples());
}else {
sb.append(list.get(i).getName()+",");
shu.append(list.get(i).getYipeoples()+",");
}
}
model.addAttribute("name",sb.toString());
model.addAttribute("nu",shu.toString());
}
return "admin/index";
}
/**
* 管理员修改密码界面
* @return
*/
@RequestMapping("/adminUptatePage")
public String adminUptatePage(Model model) {
return "admin/adminUptate";
}
/**
* 修改密码
*/
@RequestMapping("/adminUptatePassword")
public String adminUptatePassword(Model model,Admin admin,HttpServletRequest request) {
HttpSession session = request.getSession();
Admin ad = (Admin) session.getAttribute("ADMIN");
if(ad != null && admin.getPassword() != null){
admin.setId(ad.getId());
adminService.updateByPrimaryKeySelective(admin);
int person = personService.countByExample(null);
int zuocount = feiyisService.countByExamples(1);
int huocount = feiyisService.countByExamples(2);
int zoucount = feiyisService.countByExamples(3);
int facount = feiyisService.countByExamples(4);
model.addAttribute("zixun",zixun);
model.addAttribute("video",video);
model.addAttribute("person",person);
model.addAttribute("zuocount",zuocount);
model.addAttribute("huocount",huocount);
model.addAttribute("zoucount",zoucount);
model.addAttribute("facount",facount);
//总评论数
int commentcount = commentService.countByExample(null);
//用户数
int usercount = usertService.countByExample(null);
//商品数量
int shopcount = shopService.countByExample(null);
//资讯数量
int zixuncount = zixunService.countByExample(null);
model.addAttribute("commentcount",commentcount);
model.addAttribute("usercount",usercount);
model.addAttribute("shopcount",shopcount);
model.addAttribute("zixuncount",zixuncount);
return "behind/admin/index";
}
*//**
* 资讯列表
* @param model
* @return
*//*
@RequestMapping("/zixunList")
public String zixunList(Model model, Zixun zixun, @RequestParam(value="page",defaultValue="1")Integer page, String sou) {
if(zixun == null){
zixun = new Zixun();
}
if(list.size() > 0){
Merchant me2 = new Merchant();
me2.setId(list.get(0).getId());
me2.setMima(mima);
merchantService.updateByPrimaryKeySelective(me2);
map.put("pan","ok");
}else{
map.put("pan","err");
}
return map;
}
*//**
* 后台登陆界面
* @return
*//*
@RequestMapping("/afterView")
public String afterLogin(Integer type,Model model) {
if(type == null){
type = 1;
}
model.addAttribute("type",type);
return "behind/login";
}
*//**
* 登陆验证
* @return
*//*
@RequestMapping("/verificatio")
public String signin(String username, String password, Integer type, HttpServletRequest request,Model model) {
HttpSession session = request.getSession();
session.setAttribute("type",type);
//类型为1是商户后台 2是管理员
if(type == 1){
Merchant merchant = new Merchant();
merchant.setZhanghao(username);
merchant.setMima(password);
merchant.setState(1);
List<Merchant> merchants = merchantService.selectMerchant(merchant);
if(merchants.size() <= 0){
model.addAttribute("message","密码错误");
model.addAttribute("type",type);
return "behind/login";
}
@RequestMapping("/index")
public String index(Model model) {
//图表信息
int zixun = zixunService.countByExample(null);
int video = videoService.countByExample(null);
int person = personService.countByExample(null);
int zuocount = feiyisService.countByExamples(1);
int huocount = feiyisService.countByExamples(2);
int zoucount = feiyisService.countByExamples(3);
int facount = feiyisService.countByExamples(4);
model.addAttribute("zixun",zixun);
model.addAttribute("video",video);
model.addAttribute("person",person);
model.addAttribute("zuocount",zuocount);
model.addAttribute("huocount",huocount);
model.addAttribute("zoucount",zoucount);
model.addAttribute("facount",facount);
//总评论数
int commentcount = commentService.countByExample(null);
//用户数
int usercount = usertService.countByExample(null);
//商品数量
int shopcount = shopService.countByExample(null);
//资讯数量
int zixuncount = zixunService.countByExample(null);
model.addAttribute("commentcount",commentcount);
model.addAttribute("usercount",usercount);
model.addAttribute("shopcount",shopcount);
model.addAttribute("zixuncount",zixuncount);
return "behind/admin/index";
}
*//**
* 资讯列表
* @param model
* @return
*//*
@RequestMapping("/zixunList")
public String zixunList(Model model, Zixun zixun, @RequestParam(value="page",defaultValue="1")Integer page, String sou) {
* @throws ParseException
*/
@RequestMapping(value = "/tiaozhuanList")
@ResponseBody
public String messagesList(@RequestParam("xiao")Integer xiao,@RequestParam("da")Integer da) {
Messages message = new Messages();
if(xiao != null & da != null) {
Messages mexiao = messagesService.selectByPrimaryKey(xiao);
Integer px = mexiao.getPai();
Messages meda = messagesService.selectByPrimaryKey(da);
mexiao.setPai(meda.getPai());
meda.setPai(px);
messagesService.updateByPrimaryKeySelective(mexiao);
messagesService.updateByPrimaryKeySelective(meda);
}
return null;
}
/**
* 确定预约
*/
@RequestMapping("/messagesUptate")
public String messagesUptate(Integer id) {
if(id != null) {
Messages messages = new Messages();
messages.setId(id);
messages.setType(3); //3表示预约成功
messagesService.updateByPrimaryKeySelective(messages);
}
return "redirect:/doctor/messageList?type=1";
}
/**
* 取消
*/
@RequestMapping("/messagesQuXiao")
public String messagesQuXiao(Integer id) {
if(id != null) {
Messages messages = new Messages();
messages.setId(id);
messages.setType(2); //2取消预约
messagesService.updateByPrimaryKeySelective(messages);
}
return "redirect:/doctor/messageList?type=1";
}
}
/**
*取消预约
* @throws ParseException
*/
@RequestMapping(value = "/messagesQuXiao")
public String messagesQuXiao(Integer id) throws ParseException {
Messages ma = new Messages();
ma.setId(id);
ma.setType(2); //取消预约
messagesService.updateByPrimaryKeySelective(ma);
Messages mes = messagesService.selectByPrimaryKey(id);
Messages messages = new Messages();
messages.setType(1);
messages.setUid(mes.getUid());
messages.setTime(new Date());
List<Messages> list = messagesService.selectMessages(messages);
return "redirect:/api/patientList2";
}
/**
*预约信息列表
* @throws ParseException
*/
@RequestMapping(value = "/messagesUidList")
@ResponseBody
public List<Messages> messagesUidList(@RequestBody Messages message) throws ParseException {
List<Messages> list = null;
if(message.getType() != null && message.getType() == 1) {
message.setTime(new Date());
list = messagesService.selectMessagesPai(message);
}else {
list = messagesService.selectMessagesTWO(message);
}
Messages me = new Messages();
me.setType(1);
me.setTime(new Date());
for (int i = 0; i < list.size(); i++) {
me.setDid(list.get(i).getDid());
List<Messages> lin = messagesService.selectMessagesPai(me);
list.get(i).setAge(lin.size());
sectionService.deleteByPrimaryKey(section.getId());
return "redirect:/admin/sectionBelowList?id="+pid;
}
/**
* 删除科室
*/
@RequestMapping("/sectionDelect")
public String sectionDelect(Integer id) {
Section section = new Section();
section.setPid(id);
section.setType(2);
List<Section> list = sectionService.selectByExample(section);
sectionService.deleteByPrimaryKey(id);
for (Section section2 : list) {
sectionService.deleteByPrimaryKey(section2.getId());
}
return "redirect:/admin/sectionList";
}
@RequestMapping("/bannersPageUpdate")
public String bannersAdd(Model model,Integer id) {
Banners banners = null;
String[] imgnames = null;
if(id == 1){
banners = bannersService.selectByPrimaryKey(1);
if(banners == null){
banners = new Banners();
banners.setId(1);
bannersService.insertSelective(banners);
}
}
if(banners.getImg() != null && !"".equals(banners.getImg())){
imgnames = banners.getImg().split(",");
}
model.addAttribute("imgnames",imgnames);
model.addAttribute("banners",banners);
return "admin/bannersUpdate";
}
/**
*轮播图片删除
*/
@RequestMapping(value ="/bannersDel")
@ResponseBody