当前位置:   article > 正文

基于javaweb+mysql的springboot宠物医院预约挂号系统(java+spring+springboot+mybatis+thymeleaf+html+layui+maven+mysql

基于javaweb+mysql的springboot宠物医院预约挂号系统(java+spring+springboot+mybatis+thymeleaf+html+layui+maven+mysql

基于javaweb+mysql的springboot宠物医院预约挂号系统(java+spring+springboot+mybatis+thymeleaf+html+layui+maven+mysql)

私信源码获取及调试交流

运行环境

Java≥8、MySQL≥5.7

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb的SpringBoot宠物医院预约挂号系统(java+spring+springboot+mybatis+thymeleaf+html+layui+maven+mysql)

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

二、项目运行 环境配置:

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

项目技术:

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

	    /**
	     * 判断管理员账号
	     */
	    @RequestMapping("/mimaUpate")
	    @ResponseBody
	    public Map<String,String> passwordUpate(Model model, String zhanghao) {
	            Map<String, String> map =  new HashMap<String, String>();
	            Admin ad = new Admin();
	            ad.setUsername(zhanghao);
	            List<Admin> selectAdmin = adminService.selectAdmin(ad);
	            if(selectAdmin.size() > 0){
	                map.put("pan","err");
	            }else{
	                map.put("pan","ok");
	            }
	           return    map;
	    }

	    /**
	     * 判断医生账号
	     */
	    @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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
	        //图片上传并保存上传的路径
	        for (int i = 0; i < mufile.length; i++) {
	            try {
	                String random   =  StringRandom.getRandom();
	                String filename =  mufile[i].getOriginalFilename();
	                //随机字符+原图片名用作新的图片名
	                filename = random+filename;
	                //文件保存路径  D:/Java/hospital  
	                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;
	    }

    
    
/*
    *//**
     * 管理员-非遗讲堂
     *//*
    @RequestMapping(value="/feiyi_videoList")
    public String feiyi_VideoList(Model model, Video video, @RequestParam(value="page",defaultValue="1")Integer page) {
        PageInfo<Video> pageInfo = videoService.selectPageList(video,page,size);
        model.addAttribute("videoList",pageInfo.getList());
        model.addAttribute("pageInfo",pageInfo);
        if(video.getTitle() != null){
            model.addAttribute("title",video.getTitle());
        }
        return "behind/admin/feiyi_videoList";
     }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
	    } 
	  
    
    
  	    
       /**
   		 *登录验证
         * @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;
	    }
    
	    /**
		   *科室查询
		 */
	    @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 ) {
		    	//科室详情
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
           }
          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";
         }
			/*
			 * PageInfo<Patient> pageInfo =
			 * patientService.selectPatientList(patient,1,size); List<Patient> list =
			 * pageInfo.getList(); List<Patient> list2 = new ArrayList<Patient>(); Messages
			 * messages = new Messages(); boolean pan = false; SimpleDateFormat sdf = new
			 * SimpleDateFormat("yyyy-MM-dd"); for (Patient pa : list) { if(pa.getPid() !=
			 * null && pa.getPid() != 0){ messages.setDid(dt.getId());
			 * messages.setUid(pa.getPid()); messages.setUsername(pa.getName());
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
	  		    	}
	  	        }
		    	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";
	    }
	    
	    
	    
	    /**
		   *取消预约
	     * @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 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
	         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) {
		    	 Messages		messages = 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();
		    }  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
    @Value("${fileUrl}") //在配置文件中获取文件的保存路径
    private String filePath;

    
    /**
     * 导入
     * @param file
     * @param response
     * @throws IOException 
     */
    
    @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";
    }
    
    /**
     	* 导出
     * 
     * @param file
     * @param response
     */
    @RequestMapping("/xiazai")
    public void  excelString(HttpServletRequest request,HttpServletResponse response) {
        try {
        	response.setCharacterEncoding("utf-8");
        	//content-type类型是告诉页面要响应内容的类型,以及字符编码,页面要以什么方式打开
        	response.setContentType("application/force-download");// 设置强制下载不打开
            //Content-Disposition是MIMI协议的扩展,浏览器以什么方式处理wenjian
            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());
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
   	    @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;
	    }
    
	    /**
		   *科室查询
		 */
	    @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);
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
@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";
    }
       /**
  		 *登录
        * @throws ParseException 
  		 */
  	    @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);
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
	    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;
	    }
	    /**
		   *预约信息列表
	     * @throws ParseException 
		 */
	    @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);
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
	     	//底层数据
	     	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) {
		    	 Messages		messages = 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); //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);
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
            model.addAttribute("message","密码错误");
            model.addAttribute("type",type);
            return "behind/login";
        }
        session.setAttribute("ADMIN",adminlist.get(0));
        return "redirect:/admin/index";
    }

    *//**
     * 退出登录
     * @param request
     * @return
     *//*
    @RequestMapping("/sessionInvalidate")
    public String boot(HttpServletRequest request,Model model) {
        HttpSession session = request.getSession();
        Integer type = (Integer) session.getAttribute("type");
        if(type == null){
            type=1;
        }
        model.addAttribute("type",type);
        session.invalidate();   //session销毁
        return "behind/login";
    }

    *//**
     *  管理员修改密码界面
     * @return
     *//*
    @RequestMapping("/adminUptatePage")
    public String adminUptatePage(Model model) {

        return "behind/admin/adminUptate";
    }

    *//**
     *  商户修改密码界面
     * @return
     *//*
    @RequestMapping("/merchantUptate")
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
	        bannersService.updateByPrimaryKeySelective(banners);
	        return map;
	    }
    
	    /**
	      *banner图片上传
	     */
	    @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;
	                //文件保存路径  D:/Java/hospital  
	                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());
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
	    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;
	    }
	    
	    /**
		   *预约信息列表
	     * @throws ParseException 
		 */
	    @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;
	    }
	    
	    
	    
	    
	    /** 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
    
    
  	    
       /**
   		 *登录验证
         * @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;
	    }
    
	    /**
		   *科室查询
		 */
	    @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);
	        }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
	        admin.setUsername(username);
	        admin.setPassword(password);
	        List<Admin> adminlist  = adminService.selectAdmin(admin);
	        if(adminlist.size() <= 0){
	            model.addAttribute("message","密码错误");
	            model.addAttribute("type",type);
	            return "login";
	        }
	        session.setAttribute("ADMIN",adminlist.get(0));
	        return "redirect:/admin/index";
	    }
	   
	    /**
	     * 退出登录
	     * @param request
	     * @return
	     */
	    @RequestMapping("/sessionInvalidate")
	    public String boot(HttpServletRequest request,Model model) {
	        HttpSession session = request.getSession();
	        Integer type = (Integer) session.getAttribute("type");
	        if(type == null){
	            type=1;
	        }
	        
	        if(type == 3){
	        	model.addAttribute("type",type);
		        session.invalidate();   //session销毁
	        	 return "loginByPatient";
	        }
	        
	        model.addAttribute("type",type);
	        session.invalidate();   //session销毁
	        return "login";
	    }
	   
		    

/*
    *//**
     * 跳转忘记密码界面
     *//*
    @RequestMapping("/mimaPageUptate")
    public String  passwordUpate() {
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
              admin.setId(ad.getId());
               adminService.updateByPrimaryKeySelective(admin);
        }
        return  "redirect:/admin/index";
    }
*/

}

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

    *//**
     * 后台主页
     * @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);

        //总评论数
        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";
    }

    *//**
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/377577?site
推荐阅读
相关标签
  

闽ICP备14008679号