欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Java实战宠物医院预约挂号系统的实现流程

程序员文章站 2022-03-09 22:57:39
一、项目简述功能包括:用户分为宠物,医生,管理员,宠物主人可进行注册选择医生挂号,选择日期,选择号源,医生可进行宠物接诊,管理员可对宠物,医生信息的维护等等功能。二、项目运行环境配置:jdk1.8 +...

一、项目简述

功能包括:

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

二、项目运行

环境配置:

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";
    }
       /**
  		 *登录
        * @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);
	  	    	}
  	    	}
  	      return  patient;
  	    } 
       /**
	 	 *登录
        * @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;
	    }
    
	    /**
		   *科室查询
		 */
	    @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;
	    }
	    /**
	     *  坐诊时间yuyue
	     */
	    @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;
	    }  
	    
	    
    
       /**
  		 *医生列表查询
     * @throws parseexception 
  		 */
  	    @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;
  	    }  
  	  
 
       /**
 		 *医生列表查询
         * @throws parseexception 
 	     */
 	    @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;
	    }
	    
	    /**
			   *时间格式转换
	     * @throws parseexception 
			 */
		    @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";
         }
			/*
			 * 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());
			 * list<messages> ml = messagesservice.selectmessages(messages); if(ml.size() >
			 * 0 ){ date time = ml.get(0).gettime(); pa.setusername(sdf.format(time));
			 * pa.setphone(dt.getname()); pa.setidentitys(dt.getsname()); list2.add(pa); }
			 * 
			 * } } if(list2.size() <= 8) { pageinfo.setpages(1); }
			 */
         messages messages = new messages();
//         messages.settime(new date());
         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;
	    }
	    
	    
	    
	    /**
		   *预约信息
	     * @throws parseexception 
		 */
	    @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.setuid(patient.getuid());
	  		    	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";
	    }
	    
	    
	    
	    /**
		   *取消预约
	     * @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;
	    }
	    /**
		   *预约信息列表
	     * @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);
	    	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;
	    }
	    
	    
	    
	    
	    /** 
	    * @throws parseexception 
		 */
	    @requestmapping(value = "/doctortoulist")
	    @responsebody
	    public  list<doctor>  doctortoulist() {
	      	pageinfo<doctor> pageinfo  =  doctorservice.selectdoctorlist(null,1,4);
	
		    return   pageinfo.getlist();
	    }
	    
	    
	    /** 
	    * @throws parseexception 
		 */
	    @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;//每页显示数量
 
     
     
     
     /**
  	  * 修改信息
      * @param model
      * @return
      */
     @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";
     }
     
	    
     /**
  	  * 修改信息
      * @param model
      * @return
      */
     @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) {
		    	 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);
				    	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";
	         }
				/*
				 * 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());
				 * list<messages> ml = messagesservice.selectmessages(messages); if(ml.size() >
				 * 0 ){ date time = ml.get(0).gettime(); pa.setusername(sdf.format(time));
				 * pa.setphone(dt.getname()); pa.setidentitys(dt.getsname()); list2.add(pa); }
				 * 
				 * } } if(list2.size() <= 8) { pageinfo.setpages(1); }
				 */
	         messages messages = new messages();
//	         messages.settime(new date());
	         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";
	     }
	     
	    /**
		   *预约信息列表
	     * @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";
	     }
	     
	     
	     /**
	      *  退号
	      */
	     @requestmapping("/messagestui")
	     public string messagestui(integer id) {
	        if(id != null) {
	        	messages messages = new messages();
	        	messages.setid(id);
	        	messages.settype(4); //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;
 
    
    /**
     * 导入
     * @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());
    		//files.copy(file, 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";
    }
 
     
 
 
	    /**
	     *  管理员修改密码界面
	     * @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);
        }
        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";
    }
    
    /**
     *  坐诊时间设置界面
     * @throws parseexception 
     */
    @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";
    }
    
    
    /**
     *  修改医生信息界面
     * @return
     */
	@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);//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);// 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);
            	//"redirect:/admin/sectionbelowlist?id="+section.getpid();
          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 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();
	        banners.setid(id);
	        banners.setimg(sb.tostring());
	        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());
	            }
	            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";
     }
    *//**
     *  非遗讲堂-删除
     *//*
    @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); //大写转小写
            }
            for(int i =0; i<list.size();i++){
                person sh = list.get(i);
                if(sh.getname() != null){
                    char names = stringrandom.getpinyinheadchar(sh.getname()); //名字的首字母
                    if(names == sz){
                        list2.add(sh);
                    }
                }
            }
            model.addattribute("personlist",list2);
        }else{
            model.addattribute("personlist",list);
        }
        model.addattribute("sou",sou);
        model.addattribute("pageinfo",pageinfo);
        model.addattribute("person",person);
        return  "behind/admin/feiyi_personlist";
    }
    *//**
     * 人物删除
     * @param model
     * @return
     *//*
    @requestmapping("/persondelete")
    public string persondelete(model model,integer id) {
        if(id !=  null){
            person person = personservice.selectbyprimarykey(id);
            //删除人物的图片
            //string fp= filepath.substring(filepath.indexof("/")+1);//文件的真实路径
            string name = person.getimg().substring(person.getimg().indexof("s") + 2);   //获取文件名
            file file = new file(filepath +name);
            if(file.exists()){
                file.delete();
            }
            personservice.deletebyprimarykey(id);
        }
        return  "redirect:/admin/personlist";
    }
    *//**
     * 管理员
     *//*
    @requestmapping("/feiyislist")
    public string zuopinlist(model model,feiyis feiyis,@requestparam(value="page",defaultvalue="1")integer page,string sou) {
        feiyis.setstate(0);//0为正常 1是管理员下架的
        pageinfo<feiyis> pageinfo =  feiyisservice.selectfeiyis(feiyis,page,size);
        model.addattribute("feiyilist",pageinfo.getlist());
        model.addattribute("pageinfo",pageinfo);
        model.addattribute("feiyis",feiyis);
        return  "behind/admin/feiyislist";
    }
    *//**
     * 非遗视界删除
     * @param model
     * @return
     *//*
    @requestmapping("/feiyisdelete")
    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);
        //总评论数
        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();
        }
        zixun.setstate(0);// 0 是正常 1被下架的
        pageinfo<zixun> pageinfo =  zixunservice.selectzixunlist(zixun,page,size);
        model.addattribute("zixunlist",pageinfo.getlist());
        model.addattribute("pageinfo",pageinfo);
        model.addattribute("zixun",zixun);
        return    "behind/admin/zixunlist";
    }
    *//**
     * 资讯下架
     * @param model
     * @return
     *//*
    @requestmapping("/zixunuptate")
    public string zixunuptate(model model,integer id) {
       if(id != null){
           zixun  zixun = new zixun();
           zixun.setid(id);
           zixun.setstate(1); //1是下架
           zixunservice.updatebyprimarykeyselective(zixun);
       }
        return    "redirect:/admin/zixunlist";
    }
    *//**
     * 管理评论
     * @return
     *//*
    @requestmapping("/commentlist")
    public string commentlist(model model,integer type) {
        if(type != null){
            comment comment = new comment();
            comment.settype(type);//商品评论
            comment.setreport(1);//1为举报的
            list<comment> commentslist = commentservice.selectcomment(comment);
            model.addattribute("commentslist",commentslist);
        }
        return  "behind/admin/commentlist";
    }
    *//**
     * 评论删除
     * @return
     *//*
    @requestmapping("/commentdel")
    public string commentdel(model model,integer id) {
        if(id != null){
            commentservice.deletebyprimarykey(id);
        }
        return  "redirect:/admin/commentlist";
    }
    *//**
     *审核
     * @return
     *//*
    @requestmapping("/merchantlist")
    public string merchantlist(model model,integer id) {
        merchant merchant = new merchant();
        merchant.setstate(0);
        list<merchant> merchantlist =   merchantservice.selectmerchant(merchant);
        model.addattribute("merchantlist",merchantlist);
        return  "behind/admin/merchantlist";
    }
    *//**
     *通过
     * @return
     *//*
    @requestmapping("/merchanupate")
    public string merchanupate(model model,integer id) {
        merchant merchant = new merchant();
        if(id != null){
            merchant.setid(id);
            merchant.setstate(1);
            merchantservice.updatebyprimarykeyselective(merchant);
        }
        return  "redirect:/admin/merchantlist";
    }
    *//**
     *未通过
     * @return
     *//*
    @requestmapping("/merchandel")
    public string merchandel(model model,integer id) {
        if(id != null){
            merchantservice.deletebyprimarykey(id);
        }
        return  "redirect:/admin/merchantlist";
    }
    *//**
     *用户列表
     * @return
     *//*
    @requestmapping("/userlist")
    public string userlist(model model) {
        list<user> userlist = usertservice.selectfull(null);
        model.addattribute("userlist",userlist);
        return  "behind/admin/userlist";
    }
    *//**
     *用户删除
     * @return
     *//*
    @requestmapping("/userdel")
    public string userdel(model model,integer id) {
         if(id != null){
             usertservice.deletebyprimarykey(id);
         }
        return  "redirect:/admin/userlist";
    }
    *//**
     *修改密码
     * @return
     *//*
    @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";
    }
*/
 
}

到此这篇关于java实战宠物医院预约挂号系统的实现流程的文章就介绍到这了,更多相关java 宠物医院预约挂号系统内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!