首页 > 分享 > Java如何实现宠物医院预约挂号系统

Java如何实现宠物医院预约挂号系统

发布时间:2022-01-04 12:04:12 阅读:225 作者:小新 栏目:开发技术

Java开发者专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

这篇文章主要为大家展示了“Java如何实现宠物医院预约挂号系统”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“Java如何实现宠物医院预约挂号系统”这篇文章吧。

一、项目简述

功能包括:

用户分为宠物,医生,管理员,宠物主人可进行注册选择医生挂号,选择日期,选择号源,医生可进行宠物接诊,管理员可对宠物,医生信息的维护等等功能。

二、项目运行

环境配置:

Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)

项目技术:

JSP +Spring + SpringBoot + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等
 

Java如何实现宠物医院预约挂号系统

Java如何实现宠物医院预约挂号系统

Java如何实现宠物医院预约挂号系统

Java如何实现宠物医院预约挂号系统

Java如何实现宠物医院预约挂号系统

Java如何实现宠物医院预约挂号系统

Java如何实现宠物医院预约挂号系统

后端管理员控制层:

@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();         model.addAttribute("doctorList",pageInfo.getList());         model.addAttribute("pageInfo",pageInfo);         model.addAttribute("doctor",doctor);         return    "patient/doctorList";     }               @RequestMapping(value = "/userLogin")       @ResponseBody       public  Patient  userLogin(@RequestBody Patient patient) throws ParseException {       List<Patient>  list = patientService.selectPatient(patient);       if(patient != null && patient.getUsername() != null && patient.getPassword() != null) {      if(list.size() > 0) {          return  list.get(0);      }       }         return  patient;       }             @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";    }                                    @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";        }           @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;    }             @RequestMapping(value = "/sectionList")    @ResponseBody    public  Map<String,List<Section>>  sectionList() {             Map<String,List<Section>> map =  new HashMap<String,List<Section>>();    List<Section> sectionlist2  = null;    Section  se = new  Section();    se.setType(1);    List<Section> sectionlist = sectionService.selectByExample(se);    if(sectionlist.size() > 0 ) {        Section  section = new  Section();    section.setPid(sectionlist.get(0).getId());    section.setType(2);    sectionlist2 = sectionService.selectByExample(section);        }    map.put("sectionlist",sectionlist);    map.put("sectionlist2",sectionlist2);          return map;    }                     @RequestMapping(value = "/sectionXiaList")    @ResponseBody    public  List<Section>  sectionXiaList(Integer id) {    Section  se = new  Section();    se.setPid(id);    se.setType(2);    List<Section> sectionlist = sectionService.selectByExample(se);        return sectionlist;    }            @RequestMapping(value = "/patientPai")    @ResponseBody    public Integer  patientPai(Integer id) {    Patient pa = new Patient();    pa.setPid(id);  PatientExample se  = new PatientExample();  PatientExample.Criteria criteria = se.createCriteria();        if(pa != null){   if(pa.getPid() != null) {   criteria.andPidEqualTo(pa.getPid());   }        }           List<Patient> selectByExample = patientService.selectByExample(se);    if(selectByExample.size() >0 ) {    List<Messages> lmlist = messagesService.selectByExample(null);    int j = 0 ;    for (Messages me : lmlist) {if(me.getUid() == id) {   return j;}    j++;}    }        return -1;    }                    @RequestMapping(value = "/sectioNameList")    @ResponseBody    public  List<Section>  sectioNameList(String name) {    Section  se = new  Section();    se.setName(name);    se.setType(2);    List<Section> sectionlist = sectionService.selectByExample(se);    if(sectionlist.size() > 0) {        se.setName(null);    se.setPid(sectionlist.get(0).getPid());    se.setType(2);    sectionlist = sectionService.selectByExample(se);    }        return sectionlist;    }        @RequestMapping("/doctorTimePage")    public String doctorTimePage(Integer id,Model model) {       if(id !=  null) {       Doctor doctor = doctorService.selectByPrimaryKey(id);       model.addAttribute("doctor",doctor);       }        return  "patient/doctorTime";    }          @RequestMapping(value = "/doctorList")    @ResponseBody    public  List<Doctor>  doctorList(Integer sid) {       Doctor doctor = new Doctor();       doctor.setSid(sid);       List<Doctor> selectDoctor = doctorService.selectDoctor(doctor);       return selectDoctor;    }                         @RequestMapping(value = "/doctorLike")       @ResponseBody       public  List<Doctor>  doctorLike(String name) {          Doctor doctor = new Doctor();          doctor.setName(name);                    List<Doctor> selectDoctor = doctorService.selectDoctor(doctor);          return selectDoctor;       }                   @RequestMapping(value = "/doctorIdList")    @ResponseBody    public  Section  doctorIdList(Integer sid) {       Section selectByPrimaryKey = sectionService.selectByPrimaryKey(sid);              return selectByPrimaryKey;    }                              @RequestMapping(value = "/doctortimeSelect")       @ResponseBody       public  List<Doctor>  doctortimeSelect(@RequestParam("datetimei")String datetimei,@RequestParam("id")Integer id) throws ParseException {          Doctor doctor = new Doctor();          SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");          doctor.setSid(id);          doctor.setBegindate(simpleDateFormat.parse(datetimei));          List<Doctor> selectDoctor = doctorService.selectTime(doctor);          return selectDoctor;       }                       @RequestMapping(value = "/doctorGeRenList")      @ResponseBody      public  Doctor  doctorGeRenList(Integer id) throws ParseException {         Doctor doctor = doctorService.selectByPrimaryKey(id);         return doctor;      }                   @RequestMapping(value = "/doctorYuyueTime")    @ResponseBody    public  Map<String,String>  doctorYuyueTime(Integer id) {             Map<String,String> map =  new HashMap<String,String>();    SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");      Doctor doctor = doctorService.selectByPrimaryKey(id);     map.put("begin",sdf.format(doctor.getBegintime()));    map.put("end",sdf.format(doctor.getEndtime()));          return  map;    }            @RequestMapping(value = "/timeZhuan")    @ResponseBody    public  String  timeZhuan(String time) throws ParseException {          Date parse = new Date();      SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");       if(time != null) {      parse = sdf.parse(time);      }                return   sdf.format(parse);    }                         @RequestMapping(value = "/loginByPatient")    public  String  loginByPatient(@RequestBody Patient patient) {        return  "loginByPatient";    }            @RequestMapping(value = "/patientSave")    public  String  patientSave(Patient patient) {    patientService.insertSelective(patient);    return  "loginByPatient";    }            @RequestMapping("/panzhanghao")    @ResponseBody    public Map<String,String> panzhanghao(Model model, String zhanghao) {     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 messages = new Messages();          messages.setType(1);          messages.setUid(patient1.getPid());             PageInfo<Messages> pageInfo = messagesService.selectMessagesList(messages, 1, size);          model.addAttribute("doctorList",pageInfo.getList());          model.addAttribute("pageInfo",pageInfo);          model.addAttribute("patient",patient);          return    "patient/patientList";      }        @RequestMapping(value = "/patienDel")    @ResponseBody    public  List<Patient>   patienDel(Integer id) {    if(id != null) {    patientService.deleteByPrimaryKey(id);    }    List<Patient> selectByExample = patientService.selectByExample(null);        return  selectByExample;    }            @RequestMapping(value = "/patientUpatePage")    @ResponseBody    public  Patient  patientUpatePage(Integer id) {     Patient patient = null;         if(id != null) {         patient = patientService.selectByPrimaryKey(id);                  }        return  patient;    }                @RequestMapping(value = "/patientUpdate")    @ResponseBody    public  Patient  patientUpdate(@RequestBody Patient patient) {    patientService.updateByPrimaryKeySelective(patient);        return  null;    }                    @RequestMapping(value = "/messagesSave")    public  String  messagesSave(Messages patient,HttpServletRequest request) throws ParseException {     HttpSession session =  request.getSession();         Patient       patient1   =  (Patient) session.getAttribute("PATIENT");        Messages  hui = null;        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");        Date shijian = simpleDateFormat.parse(patient.getSname());          patient.setTime(shijian);          patient.setType(1);                   Doctor doctor = doctorService.selectByPrimaryKey(patient.getDid());          if(doctor != null) {          patient.setDname(doctor.getName());          if(doctor.getYipeoples() == null) {          doctor.setYipeoples(0);          }          doctor.setYipeoples(doctor.getYipeoples()+1);          doctorService.updateByPrimaryKeySelective(doctor);                    }          Section section = sectionService.selectByPrimaryKey(patient.getSid());          if(section != null) {          patient.setSname(section.getName());          }                    Patient pa = patientService.selectByPrimaryKey(patient1.getId());           if(pa != null) {          patient.setUid(pa.getPid());          patient.setUserid(pa.getId());          patient.setPhone(pa.getPhone());           patient.setUsername(pa.getUsername());          patient.setAge(pa.getAge());          int countByExample = messagesService.countByExample(null);          patient.setBianhao(countByExample+1);                    Messages message = new Messages();      message.setTime(patient.getTime());      message.setDid(patient.getDid());      message.setType(-1);      List<Messages>  list  = messagesService.selectMessages(message);      if(list.size() <= 0) {      patient.setPai(1);      }else {      patient.setPai(list.size()+1);      }          }    messagesService.insertSelective(patient);    if(patient.getId() != null) {    hui= messagesService.selectByPrimaryKey(patient.getId());    Messages xin = new Messages();    xin.setDid(hui.getDid());    xin.setType(1);    xin.setTime(shijian);    List<Messages> selectMessagesPai = messagesService.selectMessagesPai(xin);    hui.setAge(selectMessagesPai.size());        }     return "redirect:/api/doctorList1";    }                    @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";    }            @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;    }        @RequestMapping(value = "/messagesList")    @ResponseBody    public  List<Messages>  messagesList(@RequestParam("type")Integer type,@RequestParam("uid")Integer uid) throws ParseException {    Messages message = new Messages();    List<Messages>  list = null;    message.setType(type);    message.setUid(uid);    if(type != null && type == 1) {      message.setTime(new Date());      list  = messagesService.selectMessagesPai(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());           }    }else {      list  = messagesService.selectMessagesTWO(message);      }                  return  list;    }            @RequestMapping(value = "/messagesLists")    @ResponseBody    public  List<Messages>  messagesLists(Integer uid) throws ParseException {    Messages message = new Messages();    message.setUid(uid);    List<Messages>  list  = messagesService.selectMessagesTWO(message);      Messages me  = new  Messages();      me.setType(1);      me.setTime(new Date());  for (int i = 0; i < list.size(); i++) {  if(list.get(i).getType() == 1) {   me.setDid(list.get(i).getDid());   List<Messages> lin = messagesService.selectMessagesPai(me);   list.get(i).setAge(lin.size());   }           }    return  list;    }                        @RequestMapping(value = "/doctortouList")    @ResponseBody    public  List<Doctor>  doctortouList() {      PageInfo<Doctor> pageInfo  =  doctorService.selectDoctorList(null,1,4);    return   pageInfo.getList();    }                @RequestMapping(value = "/datatimeGua")    @ResponseBody    public  Integer  datatimeGua(@RequestParam("datetime")String datetime,@RequestParam("did")Integer did) throws ParseException {         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");         Date parse = sdf.parse(datetime);         Messages message = new Messages();    message.setTime(parse);    message.setDid(did);    message.setType(-1);    List<Messages>  list  = messagesService.selectMessages(message);    return  list.size();    }     }

医生端控制层:

@Controller @RequestMapping("/doctor") public class DoctorController {      @Autowired      private AdminService adminService;        @Autowired      private DoctorService doctorService;            @Autowired      private SectionService sectionService;            @Autowired      private  PatientService  patientService;                  @Autowired      private   MessagesService  messagesService;                  private Integer size  = 8;                                @RequestMapping("/tiaomessagelist")      public String tiaomessagelist(@RequestBody  List<Messages> mlist,Model model) {        System.out.println(mlist.size());                model.addAttribute("mlist",mlist);          return    "doctor/messageList";      }                        @RequestMapping("/index")      public String index(Model model,HttpServletRequest request) {       HttpSession session = request.getSession();           Doctor dt = (Doctor) session.getAttribute("DOCTOR");           if(dt == null) {           return  "redirect:/login/index";             }          int  doctor  = doctorService.countByExample(null);           int  section = sectionService.count();                     int patient = 0;          List<Patient> selectByExample = patientService.selectByExample(null);          Messages   mess  = new Messages();          for (Patient pa : selectByExample) {          if(pa.getName() != null) {         mess.setDid(dt.getId());           mess.setUsername(pa.getName());              List<Messages> selectMessages = messagesService.selectMessages(mess);              if(selectMessages.size() > 0 )              {              patient++;              }          } }       MessagesExample me  = new  MessagesExample(); MessagesExample.Criteria mecriteria = me.createCriteria(); mecriteria.andDidEqualTo(dt.getId());          int  messages = messagesService.countByExample(me);           model.addAttribute("doctor",doctor);          model.addAttribute("section",section);          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  "doctor/index";      }                      @RequestMapping("/doctorUptatePage")      public String doctorUptatePage(Model model,HttpServletRequest request) {          HttpSession session = request.getSession();          Doctor dt = (Doctor) session.getAttribute("DOCTOR");          if(dt != null) {          Doctor  doctor = doctorService.selectByPrimaryKey(dt.getId());  List<Section> sectionlist2  = null;  model.addAttribute("doctor",doctor);        Section  se = new  Section();      se.setType(1);      List<Section> sectionlist = sectionService.selectByExample(se);      model.addAttribute("sectionlist", sectionlist);            Section se1 = sectionService.selectByPrimaryKey(doctor.getSid());      if(se1 != null) {      Section  section = new  Section();      section.setPid(se1.getPid());      section.setType(2);      sectionlist2 = sectionService.selectByExample(section);      model.addAttribute("sectionlist2", sectionlist2);      model.addAttribute("se1", se1);      }           }          return  "doctor/doctorUptate";      }                              @RequestMapping("/messageTime")      public String messageTime(String name,Model model,HttpServletRequest request) {   HttpSession session = request.getSession();         Doctor dt = (Doctor) session.getAttribute("DOCTOR");         if(name !=  null) {         Messages  mess  = new Messages();         mess.setDid(dt.getId());       mess.setUsername(name);          List<Messages> selectMessages = messagesService.selectMessagesTWO(mess);          model.addAttribute("messagesList", selectMessages);         }          return  "doctor/messageTime";      }                      @RequestMapping("/admindoctorUptate")     public String adminUptatePassword(Doctor doctor,Model model) {        if(doctor !=  null && doctor.getId() != null) {        if(doctor.getSid() != null) {        Section section = sectionService.selectByPrimaryKey(doctor.getSid());        doctor.setSid(section.getId());        doctor.setSname(section.getName());        }        doctorService.updateByPrimaryKeySelective(doctor);        }         return  "redirect:/doctor/index";     }                    @RequestMapping("/messageList")     public String doctorList(Model model,  Messages messages, @RequestParam(value="page",defaultValue="1")Integer page,Integer type,HttpServletRequest request) {     if(messages == null) {     messages = new Messages();     }         HttpSession session = request.getSession();         Doctor dt = (Doctor) session.getAttribute("DOCTOR");         if(dt != null){         messages.setDid(dt.getId());         }else{          return  "redirect:/login/index";         }          messages.setType(type);          PageInfo<Messages> pageInfo = messagesService.selectMessagesList(messages,page,size);          messages.setTime(new Date());    List<Messages> list = messagesService.selectMessagesPai(messages);     model.addAttribute("mlist",list);     model.addAttribute("messagesList",pageInfo.getList());         model.addAttribute("pageInfo",pageInfo);         model.addAttribute("messages",messages);         model.addAttribute("type",type);         return    "doctor/messageList";     }                   @RequestMapping(value = "/messageAjax")    @ResponseBody    public  List<Messages>  doctorList(HttpServletRequest request) {     Messagesmessages = new Messages();         HttpSession session = request.getSession();         Doctor dt = (Doctor) session.getAttribute("DOCTOR");         messages.setDid(dt.getId());            messages.setType(1);     messages.setTime(new Date());    PageInfo<Messages> pageInfo2 = messagesService.selectMessagesListDemo(messages,1,99);              return pageInfo2.getList();    }                 @RequestMapping(value = "/messagesQundingUptate")    @ResponseBody    public String  messagesQundingUptate(Integer id) {       if(id != null) {        Messages messages = new Messages();        messages.setId(id);        messages.setType(3);         messagesService.updateByPrimaryKeySelective(messages);        Messages selectByPrimaryKey = messagesService.selectByPrimaryKey(id);        Messages  mes = new Messages();        mes.setType(1);        mes.setTime(new Date());        mes.setDid(selectByPrimaryKey.getDid());    List<Messages> list = messagesService.selectMessagesPai(mes);    for (int i = 0; i < list.size(); i++) {    list.get(i).setPai(i+1);    messagesService.updateByPrimaryKeySelective(list.get(i));}        }              return "ok";    }                        @RequestMapping("/patientList")     public String messageList(Model model, Patient patient, @RequestParam(value="page",defaultValue="1")Integer page,HttpServletRequest request) {     if(patient == null) {     patient = new Patient();     }        HttpSession session = request.getSession();         Doctor dt = (Doctor) session.getAttribute("DOCTOR");         if(dt == null){          return  "redirect:/login/index";         }         Messages messages = new Messages();         messages.setType(1);         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";     }             @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);         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);         messagesService.updateByPrimaryKeySelective(messages);        }         return  "redirect:/doctor/messageList?type=1";     }                    @RequestMapping("/messagesTui")     public String messagesTui(Integer id) {        if(id != null) {        Messages messages = new Messages();        messages.setId(id);        messages.setType(4);         messagesService.updateByPrimaryKeySelective(messages);        }         return  "redirect:/doctor/messageList?type=3";     }           }

后端管理员控制层:

@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;                      @RequestMapping("/excelInput")     public String  excelInput(MultipartFile file,HttpServletResponse response) throws IOException {     String sb = file.getOriginalFilename();         List<String[]> jieExcel = ExcelInput.jieExcel(file.getInputStream(), sb.substring(sb.indexOf(".")+1));  for (String[] strings : jieExcel) {  System.out.println(Arrays.toString(strings));    }         return  "redirect:/admin/index";     }               @RequestMapping("/xiazai")     public void  excelString(HttpServletRequest request,HttpServletResponse response) {         try {         response.setCharacterEncoding("utf-8");                  response.setContentType("application/force-download");                          response.setHeader("Content-Disposition", "attachment; fileName=exportFile.xlsx");           String[] title = new String[]{"姓名","科室id","科室","日期"};             List<Doctor> list = doctorService.selectByExample(null);             Workbook   wo     = ExcelUtils.getExcel("xlsx",title,list);             wo.write(response.getOutputStream());          } catch (IOException e) {     System.out.println("发生异常");     e.printStackTrace();     }          }                      @RequestMapping("/index")     public String index(Model model) {         int  doctor  = doctorService.countByExample(null);          int  section = sectionService.countByExample(null);          int  patient = patientService.countByExample(null);          int  messages = messagesService.countByExample(null);          model.addAttribute("doctor",doctor);         model.addAttribute("section",section);         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";     }                     @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);         }         return  "redirect:/admin/index";     }                    @RequestMapping("/doctorTimePage")     public String doctorTimePage(Integer id,Model model) {        if(id !=  null) {        Doctor doctor = doctorService.selectByPrimaryKey(id);        model.addAttribute("doctor",doctor);        }         return  "admin/doctorTime";     }               @RequestMapping("/doctorTimeUpdate")     public String doctorTimeUpdate(Integer id,Model model,String begindate,String enddate,String begintime,String endtime) throws ParseException {        if(id !=  null) {       SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");       SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("HH:mm");         Doctor   doctor = new Doctor();        doctor.setId(id);        doctor.setBegindate(simpleDateFormat.parse(begindate));         doctor.setEnddate(simpleDateFormat.parse(enddate));            doctor.setBegintime(simpleDateFormat2.parse(begintime));        doctor.setEndtime(simpleDateFormat2.parse(endtime));            doctorService.updateByPrimaryKeySelective(doctor);        }         return "redirect:/admin/doctorList";     }                          @RequestMapping("/admindoctorUptate")     public String adminUptatePassword(Doctor doctor,Model model) {        if(doctor !=  null && doctor.getId() != null) {        if(doctor.getSid() != null) {        Section section = sectionService.selectByPrimaryKey(doctor.getSid());        doctor.setSid(section.getId());        doctor.setSname(section.getName());        }        doctorService.updateByPrimaryKeySelective(doctor);        }         return  "redirect:/admin/doctorList";     }               @RequestMapping("/doctorDelect")     public String doctorDelect(Integer id,Model model) {        if(id !=  null) {             doctorService.deleteByPrimaryKey(id);        }         return  "redirect:/admin/doctorList";     }                   @RequestMapping("/doctorAddPage")    public String  doctorAddPage(Model model) {   List<Section> sectionlist2  = null;   Section  se = new  Section();   se.setType(1);List<Section> sectionlist = sectionService.selectByExample(se);    if(sectionlist.size() > 0 ) {        Section  section = new  Section();    section.setPid(sectionlist.get(0).getId());    section.setType(2);    sectionlist2 = sectionService.selectByExample(section);    }    model.addAttribute("sectionlist", sectionlist);    model.addAttribute("sectionlist2", sectionlist2);   return    "admin/doctorAdd";    }                   @RequestMapping("/admindoctorAdd")     public String admindoctorAdd(Doctor doctor,Model model) {       if(doctor.getId() !=  null){         if(doctor.getSid() != null) {        Section selectByPrimaryKey = sectionService.selectByPrimaryKey(doctor.getSid());        doctor.setSname(selectByPrimaryKey.getName());        }            doctorService.updateByPrimaryKeySelective(doctor);        }         return  "redirect:/admin/doctorList";     }                    @RequestMapping("/doctorList")     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();         model.addAttribute("doctorList",pageInfo.getList());         model.addAttribute("pageInfo",pageInfo);         model.addAttribute("doctor",doctor);         return    "admin/doctorList";     }               @RequestMapping("/doctorUptatePage")public String doctorUptatePage(Model model,Integer id) {if(id != null) {Doctor  doctor = doctorService.selectByPrimaryKey(id);List<Section> sectionlist2  = null;model.addAttribute("doctor",doctor);    Section  se = new  Section();    se.setType(1);    List<Section> sectionlist = sectionService.selectByExample(se);    model.addAttribute("sectionlist", sectionlist);     Section  se1 = sectionService.selectByPrimaryKey(doctor.getSid());Section  section = new  Section(); if(se1 != null) {    section.setPid(se1.getPid());    section.setType(2);    sectionlist2 = sectionService.selectByExample(section); }else { if(sectionlist.size() >0 ) {     section.setPid(sectionlist.get(0).getId());     section.setType(2);     sectionlist2 = sectionService.selectByExample(section);     } se1 = new   Section(); }    model.addAttribute("sectionlist2", sectionlist2);    model.addAttribute("se1", se1);    }    return "admin/doctorUptate";}              @RequestMapping("/sectionList")     public String sectionList(Model model, Section section, @RequestParam(value="page",defaultValue="1")Integer page) {     if(section == null) {     section = new Section();     }     section.setType(1);     PageInfo<Section> pageInfo   = sectionService.selectSectionListt(section,page,size);     List<Section> list = pageInfo.getList();     List<Section> list2 = new ArrayList<Section>();     Section cs = new Section();     for (Section se : list) {     cs.setPid(se.getId());     List<Section> selectByExample = sectionService.selectByExample(cs);     se.setSlist(selectByExample);     list2.add(se);     }                        model.addAttribute("sectionList",list2);         model.addAttribute("pageInfo",pageInfo);         model.addAttribute("section",section);         return    "admin/sectionList";     }               @RequestMapping("/sectionBelowList")     public String sectionBelowList(Model model, Section section, Integer id) {     if(section == null) {     section = new Section();     }     section.setType(2);     section.setPid(id);     Section se = sectionService.selectByPrimaryKey(id);     List<Section> list  = sectionService.selectByExample(section);         model.addAttribute("sectionList",list);         model.addAttribute("section",section);         model.addAttribute("se",se);         return    "admin/sectionBelow";     }                   @RequestMapping("/sectionAddPage")     public String zuopinList() {         return  "admin/sectionAdd";     }           @RequestMapping("/sectionAddBelowPage")    public String zuopinList(Model model,Integer id) {   if(id != null) {  Section se = sectionService.selectByPrimaryKey(id);      model.addAttribute("se",se);   }        return  "admin/sectionAddBelow";    }                   @RequestMapping("/sectionBelowUptatePage")   public String sectionBelowUptatePage(Model model,Integer id) {   if(id != null) {  Section se = sectionService.selectByPrimaryKey(id);  Section section = sectionService.selectByPrimaryKey(se.getPid());      model.addAttribute("se",se);      model.addAttribute("sname",section.getName());   }       return  "admin/sectionBelowUptate";   }       @RequestMapping("/sectionUptatePage")   public String sectionUptatePage(Model model,Integer id) {   if(id != null) {  Section se = sectionService.selectByPrimaryKey(id);  model.addAttribute("se",se);   }       return  "admin/sectionUptate";   }                  @RequestMapping("/sectionAdd")     @ResponseBody     public Map<String,String> sectionAdd(String name) {             Map<String, String> map =  new HashMap<String, String>();             if(name != null ){             Section section = new Section();             section.setName(name);             section.setType(1);             sectionService.insertSelective(section);                 map.put("pan","ok");             }else{                 map.put("pan","err");             }            return    map;     }              @RequestMapping("/sectionAddBelow")     public String sectionAddBelow(Section section) {             section.setType(2);             sectionService.insertSelective(section);                        return "redirect:/admin/sectionList";       }               @RequestMapping("/sectionUptate")     public String sectionUptate(Section section) {           sectionService.updateByPrimaryKeySelective(section);           return  "redirect:/admin/sectionList";       }          @RequestMapping("/sectionBelowUptate")     public String sectionBelowUptate(Section section) {           sectionService.updateByPrimaryKeySelective(section);           return "redirect:/admin/sectionBelowList?id="+section.getPid();       }          @RequestMapping("/sectionBelowDelect")     public String sectionBelowUptate(Integer id) {    Section section = sectionService.selectByPrimaryKey(id);    Integer pid =  section.getPid();             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    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 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();        banners.setId(id);        banners.setImg(sb.toString());        bannersService.updateByPrimaryKeySelective(banners);        return map;    }             @RequestMapping(value ="/bannersAdd")    @ResponseBody    public  Map<String, Object>  bannersAdd(@RequestParam("mf")MultipartFile[] mufile,@RequestParam("id")Integer  id) throws IOException{        Map<String, Object> map =  new HashMap<String, Object>();        StringBuffer path       =  new StringBuffer();                for (int i = 0; i < mufile.length; i++) {            try {                String random   =  StringRandom.getRandom();                String filename =  mufile[i].getOriginalFilename();                                filename = random+filename;                                File file = new File(filePath+filename);                                if (!file.getParentFile().exists()) {                    file.getParentFile().mkdir();                }                path.append("/files/"+filename+",");                mufile[i].transferTo(file);            } catch (IllegalStateException | IOException e) {                e.printStackTrace();            }        }        Banners banners = new  Banners();        if(id != null){                        Banners  sh  = bannersService.selectByPrimaryKey(id);            banners.setId(id);            if(sh.getImg() != null ){                banners.setImg(sh.getImg()+path.toString());            }else{                banners.setImg(path.toString());            }            bannersService.updateByPrimaryKeySelective(banners);        }        return map;    }               }

以上是“Java如何实现宠物医院预约挂号系统”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注亿速云行业资讯频道!

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

相关知识

基于Java的宠物医院预约挂号系统的设计与实现论文
ssm725基于Java的宠物医院预约挂号系统的设计与实现+vue
ssm725基于Java的宠物医院预约挂号系统的设计与实现
分享一个基于node.js的宠物医院预约挂号系统vue宠物医院管理系统(源码、调试、LW、开题、PPT)
案例12:Java宠物医院预约管理系统设计与实现开题报告
java基于ssm+vue+elementui的宠物医院挂号管理系统
基于java+ssm+vue的宠物医院预约挂号系统
基于ssm+vue宠物医院预约管理系统(开题报告+程序+论文+java)
Java 宠物医院预约挂号系统的实现流程
java ssm爱宠宠物医院挂号预约系统管理系统设计与实现

网址: Java如何实现宠物医院预约挂号系统 https://m.mcbbbk.com/newsview263326.html

所属分类:萌宠日常
上一篇: 互联网宠物医院系统软件:便捷管理
下一篇: 宠物医院线上预约软件【宠物医院线