功能包括:
用户分为宠物,医生,管理员,宠物主人可进行注册选择医生挂号,选择日期,选择号源,医生可进行宠物接诊,管理员可对宠物,医生信息的维护等等功能。
环境配置:
jdk1.8 + tomcat8.5 + mysql + eclispe(intellij idea,eclispe,myeclispe,sts都支持)
项目技术:
jsp +spring + springboot + mybatis + html+ css + javascript + jquery + ajax + layui+ maven等等
后端管理员控制层:
/*** 后端管理员控制层*/@controller@requestmapping("/api")public class patientcontroller {private integer size = 6;//每页显示数量@autowiredprivate adminrvice adminrvice;@autowiredprivate ctionrvice ctionrvice;@autowiredprivate bannersrvice bannersrvice; @autowiredprivate doctorrvice doctorrvice;@autowiredprivate patientrvice patientrvice;@autowiredprivate messagesrvice messagesrvice;/*** 医生列表*/@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 = doctorrvice.lectdoctorlist(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 parexception */@requestmapping(value = "/urlogin")@responbodypublic patient urlogin(@requestbody patient patient) throws parexception {list<patient> list = patientrvice.lectpatient(patient);if(patient != null && patient.geturname() != null && patient.getpassword() != null) {if(list.size() > 0) {return list.get(0);}}return patient;} /***登录* @throws parexception */@requestmapping(value = "/passwordsave")@responbodypublic string passwordsave(@requestbody patient patient ) throws parexception {if(patient != null && patient.geturname() != null && patient.getpassword() != null) {patient pa = new patient();pa.turname(patient.geturname());list<patient> list = patientrvice.lectpatient(pa);if(list.size() > 0) {return "err";}patientrvice.inrtlective(patient);return "ok";}return "err";} /***登录验证* @throws parexception */@requestmapping(value = "/urloginview")@responbodypublic string urloginview(httprvletrequest request) throws parexception {httpssion ssion = request.getssion();patient patient =(patient) ssion.getattribute("ur");system.out.println("*********登陆验证********");system.out.println(patient); if(patient != null) {return "ok";}return "err";} /***banner图*/@requestmapping(value = "/bannerlist")@responbodypublic string[] formadd() {banners banners = bannersrvice.lectbyprimarykey(1);string[] split = null;if(banners != null && banners.getimg() != null) {split = banners.getimg().split(",");}return split;}/***科室查询*/@requestmapping(value = "/ctionlist")@responbodypublic map<string,list<ction>> ctionlist() {map<string,list<ction>> map = new hashmap<string,list<ction>>();list<ction> ctionlist2 = null;ction = new ction();.ttype(1);list<ction> ctionlist = ctionrvice.lectbyexample();if(ctionlist.size() > 0 ) {//科室详情ction ction = new ction();ction.tpid(ctionlist.get(0).getid());ction.ttype(2);ctionlist2 = ctionrvice.lectbyexample(ction);}map.put("ctionlist",ctionlist);map.put("ctionlist2",ctionlist2); return map;}/***科室下级查询*/@requestmapping(value = "/ctionxialist")@responbodypublic list<ction> ctionxialist(integer id) {ction = new ction();.tpid(id);.ttype(2);list<ction> ctionlist = ctionrvice.lectbyexample();return ctionlist;}/***科室下级查询*/@requestmapping(value = "/patientpai")@responbodypublic integer patientpai(integer id) {patient pa = new patient();pa.tpid(id);patientexample = new patientexample();patientexample.criteria criteria = .createcriteria();if(pa != null){if(pa.getpid() != null) {criteria.andpidequalto(pa.getpid());}}list<patient> lectbyexample = patientrvice.lectbyexample();if(lectbyexample.size() >0 ) {list<messages> lmlist = messagesrvice.lectbyexample(null);int j = 0 ;for (messages me : lmlist) {if(me.getuid() == id) {return j;}j++;}}return -1;}/***查询科室*/@requestmapping(value = "/ctionamelist")@responbodypublic list<ction> ctionamelist(string name) {ction = new ction();.tname(name);.ttype(2);list<ction> ctionlist = ctionrvice.lectbyexample();if(ctionlist.size() > 0) {//查询全部科室.tname(null);.tpid(ctionlist.get(0).getpid());.ttype(2);ctionlist = ctionrvice.lectbyexample();}return ctionlist;}/*** 坐诊时间yuyue*/@requestmapping("/doctortimepage")public string doctortimepage(integer id,model model) {if(id != null) {doctor doctor = doctorrvice.lectbyprimarykey(id);model.addattribute("doctor",doctor);}return "patient/doctortime";}/***医生列表查询*/@requestmapping(value = "/doctorlist")@responbodypublic list<doctor> doctorlist(integer sid) {doctor doctor = new doctor();doctor.tsid(sid);list<doctor> lectdoctor = doctorrvice.lectdoctor(doctor);return lectdoctor;} /***医生列表查询*/@requestmapping(value = "/doctorlike")@responbodypublic list<doctor> doctorlike(string name) {doctor doctor = new doctor();doctor.tname(name);list<doctor> lectdoctor = doctorrvice.lectdoctor(doctor);return lectdoctor;} /***科室查询*/@requestmapping(value = "/doctoridlist")@responbodypublic ction doctoridlist(integer sid) {ction lectbyprimarykey = ctionrvice.lectbyprimarykey(sid);return lectbyprimarykey;} /***医生列表查询* @throws parexception */@requestmapping(value = "/doctortimelect")@responbodypublic list<doctor> doctortimelect(@requestparam("datetimei")string datetimei,@requestparam("id")integer id) throws parexception {doctor doctor = new doctor();simpledateformat simpledateformat = new simpledateformat("yyyy-mm-dd");doctor.tsid(id);doctor.tbegindate(simpledateformat.par(datetimei));list<doctor> lectdoctor = doctorrvice.lecttime(doctor);return lectdoctor;} /***医生列表查询* @throws parexception */@requestmapping(value = "/doctorgerenlist")@responbodypublic doctor doctorgerenlist(integer id) throws parexception {doctor doctor = doctorrvice.lectbyprimarykey(id);return doctor;} /***时间格式转换*/@requestmapping(value = "/doctoryuyuetime")@responbodypublic map<string,string> doctoryuyuetime(integer id) {map<string,string> map = new hashmap<string,string>();simpledateformat sdf = new simpledateformat("hh:mm"); doctor doctor = doctorrvice.lectbyprimarykey(id);map.put("begin",sdf.format(doctor.getbegintime()));map.put("end",sdf.format(doctor.getendtime())); return map;}/***时间格式转换* @throws parexception */@requestmapping(value = "/timezhuan")@responbodypublic string timezhuan(string time) throws parexception {date par = new date();simpledateformat sdf = new simpledateformat("yyyy-mm-dd"); if(time != null) {par = sdf.par(time);}return sdf.format(par);}/***添加患者信息*/@requestmapping(value = "/loginbypatient")public string loginbypatient(@requestbody patient patient) {return "loginbypatient";}/***添加患者信息*/@requestmapping(value = "/patientsave")public string patientsave(patient patient) {patientrvice.inrtlective(patient);return "loginbypatient";}/*** 判断患者账号*/@requestmapping("/panzhanghao")@responbodypublic map<string,string> panzhanghao(model model, string zhanghao) {map<string, string> map = new hashmap<string, string>();patientexample = new patientexample();patientexample.criteria criteria = .createcriteria();criteria.andurnameequalto(zhanghao);list<patient> lectbyexample = patientrvice.lectbyexample();if(lectbyexample.size() > 0){map.put("pan","err");}el{map.put("pan","ok");}return map;}/*** 患者注册界面*/@requestmapping("/patientaddpage")public string patientaddpage(model model) {return "patientregister";}/***患者信息列表*/@requestmapping(value = "/patientlist")@responbodypublic list<patient> patientlist(integer pid,httprvletrequest request) {patient pa = new patient();pa.tpid(pid);list<patient> lectpatient = patientrvice.lectpatient(pa);return lectpatient;}/***患者信息列表*/@requestmapping("/patientlist2")public string messagelist2(model model, patient patient, @requestparam(value="page",defaultvalue="1")integer page,httprvletrequest request) {if(patient == null) {patient = new patient();}httpssion ssion = request.getssion();patient patient1 = (patient) ssion.getattribute("patient");if(patient1 == null){return "redirect:/login/font/index";}/** pageinfo<patient> pageinfo =* patientrvice.lectpatientlist(patient,1,size); list<patient> list =* pageinfo.getlist(); list<patient> list2 = new arraylist<patient>(); messages* messages = new messages(); boolean pan = fal; simpledateformat sdf = new* simpledateformat("yyyy-mm-dd"); for (patient pa : list) { if(pa.getpid() !=* null && pa.getpid() != 0){ messages.tdid(dt.getid());* messages.tuid(pa.getpid()); messages.turname(pa.getname());* list<messages> ml = messagesrvice.lectmessages(messages); if(ml.size() >* 0 ){ date time = ml.get(0).gettime(); pa.turname(sdf.format(time));* pa.tphone(dt.getname()); pa.tidentitys(dt.getsname()); list2.add(pa); }* * } } if(list2.size() <= 8) { pageinfo.tpages(1); }*/messages messages = new messages();// messages.ttime(new date());messages.ttype(1);messages.tuid(patient1.getpid()); pageinfo<messages> pageinfo = messagesrvice.lectmessageslist(messages, 1, size);model.addattribute("doctorlist",pageinfo.getlist());model.addattribute("pageinfo",pageinfo);model.addattribute("patient",patient);return "patient/patientlist";}/***患者信息列表*/@requestmapping(value = "/patiendel")@responbodypublic list<patient> patiendel(integer id) {if(id != null) {patientrvice.deletebyprimarykey(id);}list<patient> lectbyexample = patientrvice.lectbyexample(null);return lectbyexample;}/***患者信息查看*/@requestmapping(value = "/patientupatepage")@responbodypublic patient patientupatepage(integer id) {patient patient = null;if(id != null) {patient = patientrvice.lectbyprimarykey(id);}return patient;}/***患者信息修改*/@requestmapping(value = "/patientupdate")@responbodypublic patient patientupdate(@requestbody patient patient) {patientrvice.updatebyprimarykeylective(patient);return null;}/***预约信息* @throws parexception */@requestmapping(value = "/messagessave")public string messagessave(messages patient,httprvletrequest request) throws parexception {httpssion ssion = request.getssion();patient patient1 = (patient) ssion.getattribute("patient");messages hui = null;simpledateformat simpledateformat = new simpledateformat("yyyy-mm-dd");date shijian = simpledateformat.par(patient.getsname());patient.ttime(shijian);patient.ttype(1);//待预约doctor doctor = doctorrvice.lectbyprimarykey(patient.getdid());//医生if(doctor != null) {patient.tdname(doctor.getname());if(doctor.getyipeoples() == null) {doctor.tyipeoples(0);}doctor.tyipeoples(doctor.getyipeoples()+1);doctorrvice.updatebyprimarykeylective(doctor);}ction ction = ctionrvice.lectbyprimarykey(patient.getsid());//科室if(ction != null) {patient.tsname(ction.getname());}patient pa = patientrvice.lectbyprimarykey(patient1.getid()); //患者if(pa != null) {patient.tuid(pa.getpid());patient.turid(pa.getid());patient.tphone(pa.getphone()); patient.turname(pa.geturname());patient.tage(pa.getage());int countbyexample = messagesrvice.countbyexample(null);patient.tbianhao(countbyexample+1);//排序messages message = new messages();// message.tuid(patient.getuid());message.ttime(patient.gettime());message.tdid(patient.getdid());message.ttype(-1);list<messages> list = messagesrvice.lectmessages(message);if(list.size() <= 0) {patient.tpai(1);}el {patient.tpai(list.size()+1);}}messagesrvice.inrtlective(patient);if(patient.getid() != null) {hui= messagesrvice.lectbyprimarykey(patient.getid());messages xin = new messages();xin.tdid(hui.getdid());xin.ttype(1);xin.ttime(shijian);list<messages> lectmessagespai = messagesrvice.lectmessagespai(xin);hui.tage(lectmessagespai.size());}return "redirect:/api/doctorlist1";}/***取消预约* @throws parexception */@requestmapping(value = "/messagesquxiao")public string messagesquxiao(integer id) throws parexception {messages ma = new messages();ma.tid(id);ma.ttype(2); //取消预约messagesrvice.updatebyprimarykeylective(ma);messages mes = messagesrvice.lectbyprimarykey(id);messages messages = new messages();messages.ttype(1);messages.tuid(mes.getuid());messages.ttime(new date());list<messages> list = messagesrvice.lectmessages(messages);return "redirect:/api/patientlist2";}/***预约信息列表* @throws parexception */@requestmapping(value = "/messagesuidlist")@responbodypublic list<messages> messagesuidlist(@requestbody messages message) throws parexception {list<messages> list = null;if(message.gettype() != null && message.gettype() == 1) {message.ttime(new date());list = messagesrvice.lectmessagespai(message);}el {list = messagesrvice.lectmessagestwo(message); }messages me = new messages();me.ttype(1);me.ttime(new date());for (int i = 0; i < list.size(); i++) {me.tdid(list.get(i).getdid());list<messages> lin = messagesrvice.lectmessagespai(me);list.get(i).tage(lin.size());}return list;}/***预约信息列表* @throws parexception */@requestmapping(value = "/messageslist")@responbodypublic list<messages> messageslist(@requestparam("type")integer type,@requestparam("uid")integer uid) throws parexception {messages message = new messages();list<messages> list = null;message.ttype(type);message.tuid(uid);if(type != null && type == 1) {message.ttime(new date());list = messagesrvice.lectmessagespai(message); messages me = new messages();me.ttype(1);me.ttime(new date());for (int i = 0; i < list.size(); i++) {me.tdid(list.get(i).getdid());list<messages> lin = messagesrvice.lectmessagespai(me);list.get(i).tage(lin.size());}}el {list = messagesrvice.lectmessagestwo(message); }return list;}/***预约信息列表* @throws parexception */@requestmapping(value = "/messageslists")@responbodypublic list<messages> messageslists(integer uid) throws parexception {messages message = new messages();message.tuid(uid);list<messages> list = messagesrvice.lectmessagestwo(message);messages me = new messages();me.ttype(1);me.ttime(new date());for (int i = 0; i < list.size(); i++) {if(list.get(i).gettype() == 1) {me.tdid(list.get(i).getdid());list<messages> lin = messagesrvice.lectmessagespai(me);list.get(i).tage(lin.size()); }}return list;}/** * @throws parexception */@requestmapping(value = "/doctortoulist")@responbodypublic list<doctor> doctortoulist() {pageinfo<doctor> pageinfo = doctorrvice.lectdoctorlist(null,1,4);return pageinfo.getlist();}/** * @throws parexception */@requestmapping(value = "/datatimegua")@responbodypublic integer datatimegua(@requestparam("datetime")string datetime,@requestparam用似乎造句("did")integer did) throws parexception {simpledateformat sdf = new simpledateformat("yyyy-mm-dd");date par = sdf.par(datetime);messages message = new messages();message.ttime(par);message.tdid(did);message.ttype(-1);list<messages> list = messagesrvice.lectmessages(message);return list.size();}}
医生端控制层:
/*** 医生端*/@controller@requestmapping("/doctor")public class doctorcontroller {@autowiredprivate adminrvice adminrvice;@autowiredprivate doctorrvice doctorrvice;@autowiredprivate ctionrvice ctionrvice;@autowiredprivate patientrvice patientrvice;@autowiredprivate messagesrvice messagesrvice;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,httprvletrequest request) {httpssion ssion = request.getssion();doctor dt = (doctor) ssion.getattribute("doctor");if(dt == null) {return "redirect:/login/index"; }int doctor = doctorrvice.countbyexample(null); //医生总数int ction = ctionrvice.count(); //科室总数//患者总数int patient = 0;list<patient> lectbyexample = patientrvice.lectbyexample(null);messages mess = new messages();for (patient pa : lectbyexample) {if(pa.getname() != null) {mess.tdid(dt.getid());mess.turname(pa.getname());list<messages> lectmessages = messagesrvice.lectmessages(mess);if(lectmessages.size() > 0 ){patient++;}}}//预约总数messagexample me = new messagexample();messagexample.criteria mecriteria = me.createcriteria();mecriteria.anddidequalto(dt.getid());int messages = messagesrvice.countbyexample(me); model.addattribute("doctor",doctor);model.addattribute("ction",ction);model.addattribute("patient",patient);model.addattribute("messages",messages);pageinfo<doctor> pageinfo = doctorrvice.lectdoctorlist(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());}el {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,httprvletrequest request) {httpssion ssion = request.getssion();doctor dt = (doctor) ssion.getattribute("doctor");if(dt != null) {doctor doctor = doctorrvice.lectbyprimarykey(dt.getid());list<ction> ctionlist2 = null;model.addattribute("doctor",doctor);//科室ction = new ction();.ttype(1);list<ction> ctionlist = ctionrvice.lectbyexample();model.addattribute("ctionlist", ctionlist);//科室详情ction 1 = ctionrvice.lectbyprimarykey(doctor.getsid());if(1 != null) {ction ction = new ction();ction.tpid(1.getpid());ction.ttype(2);ctionlist2 = ctionrvice.lectbyexample(ction);model.addattribute("ctionlist2", ctionlist2);model.addattribute("1", 1);} }return "doctor/doctoruptate";}/*** 修改医生信息*/@requestmapping("/messagetime")public string messagetime(string name,model model,httprvletrequest request) {httpssion ssion = request.getssion();doctor dt = (doctor) ssion.getattribute("doctor");if(name != null) {messages mess = new messages();mess.tdid(dt.getid());mess.turname(name);list<messages> lectmessages = messagesrvice.lectmessagestwo(mess);model.addattribute("messageslist", lectmessages);}return "doctor/messagetime";}/*** 修改医生信息*/@requestmapping("/admindoctoruptate")public string adminuptatepassword(doctor doctor,model model) {if(doctor != null && doctor.getid() != null) {if(doctor.getsid() != null) {ction ction = ctionrvice.lectbyprimarykey(doctor.getsid());doctor.tsid(ction.getid());doctor.tsname(ction.getname());}doctorrvice.updatebyprimarykeylective(doctor);}return "redirect:/doctor/index";}/*** 预约信息列表*/@requestmapping("/messagelist")public string doctorlist(model model, messages messages, @requestparam(value="page",defaultvalue="1")integer page,integer type,httprvletrequest request) {if(messages == null) {messages = new messages();}httpssion ssion = request.getssion();doctor dt = (doctor) ssion.getattribute("doctor");if(dt != null){messages.tdid(dt.getid());}el{return "redirect:/login/index";}messages.ttype(type);//底层数据pageinfo<messages> pageinfo = messagesrvice.lectmessageslist(messages,page,size);//工作区数据messages.ttime(new date());list<messages> list = messagesrvice.lectmessagespai(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")@responbodypublic list<messages> doctorlist(httprvletrequest request) {messagesmessages = new messages();httpssion ssion = request.getssion();doctor dt = (doctor) ssion.getattribute("doctor");messages.tdid(dt.getid());messages.ttype(1);messages.ttime(new date());pageinfo<messages> pageinfo2 = messagesrvice.lectmessageslistdemo(messages,1,99);return pageinfo2.getlist();} /***医生列表查询*/@requestmapping(value = "/messagesqundinguptate")@responbodypublic string messagesqundinguptate(integer id) {if(id != null) {messages messages = new messages();messages.tid(id);messages.ttype(3); //3表示预约成功messagesrvice.updatebyprimarykeylective(messages);messages lectbyprimarykey = messagesrvice.lectbyprimarykey(id);messages mes = new messages();mes.ttype(1);mes.ttime(new date());mes.tdid(lectbyprimarykey.getdid());list<messages> list = messagesrvice.lectmessagespai(mes);for (int i = 0; i < list.size(); i++) {list.get(i).tpai(i+1);messagesrvice.updatebyprimarykeylective(list.get(i));}}return "ok";} /***患者信息列表*/@requestmapping("/patientlist")public string messagelist(model model, patient patient, @requestparam(value="page",defaultvalue="1")integer page,httprvletrequest request) {if(patient == null) {patient = new patient();}httpssion ssion = request.getssion();doctor dt = (doctor) ssion.getattribute("doctor");if(dt == null){return "redirect:/login/index";}/** pageinfo<patient> pageinfo =* patientrvice.lectpatientlist(patient,1,size); list<patient> list =* pageinfo.getlist(); list<patient> list2 = new arraylist<patient>(); messages* messages = new messages(); boolean pan = fal; simpledateformat sdf = new* simpledateformat("yyyy-mm-dd"); for (patient pa : list) { if(pa.getpid() !=* null && pa.getpid() != 0){ messages.tdid(dt.getid());* messages.tuid(pa.getpid()); messages.turname(pa.getname());* list<messages> ml = messagesrvice.lectmessages(messages); if(ml.size水的由来() >* 0 ){ date time = ml.get(0).gettime(); pa.turname(sdf.format(time));* pa.tphone(dt.getname()); pa.tidentitys(dt.getsname()); list2.add(pa); }* * } } if(list2.size() <= 8) { pageinfo.tpages(1); }*/messages messages = new messages();// messages.ttime(new date());messages.ttype(1);messages.tdid(dt.getid()); pageinfo<messages> pageinfo = messagesrvice.lectmessageslist(messages, 1, size);model.addattribute("doctorlist",pageinfo.getlist());model.addattribute("pageinfo",pageinfo);model.addattribute("patient",patient);return "doctor/patientlist";}/***预约信息列表* @throws parexception */@requestmapping(value = "/tiaozhuanlist")@responbodypublic string messageslist(@requestparam("xiao")integer xiao,@requestparam("da")integer da) {messages message = new messages();if(xiao != null & da != null) {messages mexiao = messagesrvice.lectbyprimarykey(xiao);integer px = mexiao.getpai();messages meda = messagesrvice.lectbyprimarykey(da);mexiao.tpai(meda.getpai());meda.tpai(px);messagesrvice.updatebyprimarykeylective(mexiao);messagesrvice.updatebyprimarykeylective(meda);}return null;}/*** 确定预约*/@requestmapping("/messagesuptate")public string messagesuptate(integer id) {if(id != null) {messages messages = new messages();messages.tid(id);messages.ttype(3); //3表示预约成功messagesrvice.updatebyprimarykeylective(messages);}return "redirect:/doctor/messagelist?type=1";}/*** 取消*/@requestmapping("/messagesquxiao")public string messagesquxiao(integer id) {if(id != null) {messages messages = new messages();messages.tid(id);messages.ttype(2); //2取消预约messagesrvice.updatebyprimarykeylective(messages);}return "redirect:/doctor/messagelist?type=1";}/*** 退号*/@requestmapping("/messagestui")public string messagestui(integer id) {if(id != null) {messages messages = new messages();messages.tid(id);messages.ttype(4); //4退号失败messagesrvice.updatebyprimarykeylective(messages);}return "redirect:/doctor/messagelist?type=3";}}
后端管理员控制层:
/*** 后端管理员控制层*/@controller@requestmapping("/admin")public class admincontroller {@autowiredprivate adminrvice adminrvice;@autowiredprivate ctionrvice ctionrvice;@autowiredprivate bannersrvice bannersrvice; @autowiredprivate doctorrvice doctorrvice;@autowiredprivate patientrvice patientrvice;@autowiredprivate messagesrvice messagesrvice;private integer size = 6;//每页显示数量@value("${fileurl}") //在配置文件中获取文件的保存路径private string filepath;/*** 导入* @param file* @param respon* @throws ioexception */@requestmapping("/excelinput")public string excelinput(multipartfile file,httprvletrespon respon) 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 respon*/@requestmapping("/xiazai")public void excelstring(httprvletrequest request,httprvletrespon respon) {try {respon.tcharacterencoding("utf-8");//content-type类型是告诉页面要响应内容的类型,以及字符编码,页面要以什么方式打开respon.tcontenttype("application/force-download");// 设置强制下载不打开//content-disposition是mimi协议的扩展,浏览器以什么方式处理wenjianrespon.theader("content-disposition", "attachment; filename=exportfile.xlsx");string[] title = new string[]{"姓名","科室id","科室","日期"};list<doctor> list = doctorrvice.lectbyexample(null);workbook wo = excelutils.getexcel("xlsx",title,list);wo.write(respon.getoutputstream());//files.copy(file, respon.getoutputstream()); } catch (ioexception e) {system.out.println("发生异常");e.printstacktrace();}}@requestmapping("/index")public string index(model model) {int doctor = doctorrvice.countbyexample(null); //医生总数int ction = ctionrvice.countbyexample(null); //科室总数int patient = patientrvice.countbyexample(null); //患者总数int messages = messagesrvice.countbyexample(null); //预约总数model.addattribute("doctor",doctor);model.addattribute("ction",ction);model.addattribute("patient",patient);model.addattribute("messages",messages);pageinfo<doctor> pageinfo = doctorrvice.lectdoctorlist(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());}el {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,httprvletrequest request) {httpssion ssion = request.getssion();admin ad = (admin) ssion.getattribute("admin");if(ad != null && admin.getpassword() != null){admin.tid(ad.getid());adminrvice.updatebyprimarykeylective(admin);}return "redirect:/admin/index";}/*** 坐诊时间设置界面*/@requestmapping("/doctortimepage")public string doctortimepage(integer id,model model) {if(id != null) {doctor doctor = doctorrvice.lectbyprimarykey(id);model.addattribute("doctor",doctor);}return "admin/doctortime";}/*** 坐诊时间设置界面* @throws parexception */@requestmapping("/doctortimeupdate")public string doctortimeupdate(integer id,model model,string begindate,string enddate,string begintime,string endtime) throws parexception {if(id != null) {simpledateformat simpledateformat = new simpledateformat("yyyy-mm-dd");simpledateformat simpledateformat2 = new simpledateformat("hh:mm"); doctor doctor = new doctor();doctor.tid(id);doctor.tbegindate(simpledateformat.par(begindate)); doctor.tenddate(simpledateformat.par(enddate));doctor.tbegintime(simpledateformat2.par(begintime));doctor.tendtime(simpledateformat2.par(endtime)); doctorrvice.updatebyprimarykeylective(doctor);}return "redirect:/admin/doctorlist";} /*** 修改医生信息*/@requestmapping("/admindoctoruptate")public string adminuptatepassword(doctor doctor,model model) {if(doctor != null && doctor.getid() != null) {if(doctor.getsid() != null) {ction ction = ctionrvice.lectbyprimarykey(doctor.getsid());doctor.tsid(ction.getid());doctor.tsname(ction.getname());}doctorrvice.updatebyprimarykeylective(doctor);}return "redirect:/admin/doctorlist";}/*** 删除医生信息*/@requestmapping("/doctordelect")public string doctordelect(integer id,model model) {if(id != null) {doctorrvice.deletebyprimarykey(id);}return "redirect:/admin/doctorlist";}/*** 医生注册界面*/@requestmapping("/doctoraddpage")public string doctoraddpage(model model) {list<ction> ctionlist2 = null;ction = new ction();.ttype(1);list<ction> ctionlist = ctionrvice.lectbyexample();if(ctionlist.size() > 0 ) {//科室详情ction ction = new ction();ction.tpid(ctionlist.get(0).getid());ction.ttype(2);ctionlist2 = ctionrvice.lectbyexample(ction);}model.addattribute("ctionlist", ctionlist);model.addattribute("ctionlist2", ctionlist2);return "admin/doctoradd";}@requestmapping("/admindoctoradd")public string admindoctoradd(doctor doctor,model model) {if(doctor.getid() != null){if(doctor.getsid() != null) {ction lectbyprimarykey = ctionrvice.lectbyprimarykey(doctor.getsid());doctor.tsname(lectbyprimarykey.getname());}doctorrvice.updatebyprimarykeylective(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 = doctorrvice.lectdoctorlist(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("/doctorup关于元宵节的古诗tatepage")public string doctoruptatepage(model model,integer id) {if(id != null) {doctor doctor = doctorrvice.lectbyprimarykey(id);list<ction> ctionlist2 = null;model.addattribute("doctor",doctor);//科室ction = new ction();.ttype(1);list<ction> ctionlist = ctionrvice.lectbyexample();model.addattribute("ctionlist", ctionlist);//科室详情ction 1 = ctionrvice.lectbyprimarykey(doctor.getsid());ction ction = new ction();if(1 != null) {ction.tpid(1.getpid());ction.ttype(2);ctionlist2 = ctionrvice.lectbyexample(ction);}el {if(ctionlist.size() >0 ) {ction.tpid(ctionlist.get(0).getid());ction.ttype(2);ctionlist2 = ctionrvice.lectbyexample(ction);}1 = new ction();}model.addattribute("ctionlist2", ctionlist2);model.addattribute("1", 1);}return "admin/doctoruptate";}/*** 科室列表*/@requestmapping("/ctionlist")public string ctionlist(model model, ction ction, @requestparam(value="page",defaultvalue="1")integer page) {if(ction == null) {ction = new ction();}ction.ttype(1);//1 科室pageinfo<ction> pageinfo = ctionrvice.lectctionlistt(ction,page,size);list<ction> list = pageinfo.getlist();list<ction> list2 = new arraylist<ction>();ction cs = new ction();for (ction : list) {cs.tpid(.getid());list<ction> lectbyexample = ctionrvice.lectbyexample(cs);.tslist(lectbyexample);list2.add();}model.addattribute("ctionlist",list2);model.addattribute("pageinfo",pageinfo);model.addattribute("ction",ction);return "admin/ctionlist";}/*** 科室详情下级列表*/@requestmapping("/ctionbelowlist")public string ctionbelowlist(model model, ction ction, integer id) {if(ction == null) {ction = new ction();}ction.ttype(2);// 2 科室详情ction.tpid(id);ction = ctionrvice.lectbyprimarykey(id);list<ction> list = ctionrvice.lectbyexample(ction);model.addattribute("ctionlist",list);model.addattribute("ction",ction);model.addattribute("",);return "admin/ctionbelow";}/*** 跳转添加科室界面*/@requestmapping("/ctionaddpage")public string zuopinlist() {return "admin/ctionadd";}/*** 跳转添加科室下级界面*/@requestmapping("/ctionaddbelowpage")public string zuopinlist(model model,integer id) {if(id != null) {ction = ctionrvice.lectbyprimarykey(id);model.addattribute("",);}return "admin/ctionaddbelow";}/*** 跳转修改科室下级界面*/@requestmapping("/ctionbelowuptatepage")public string ctionbelowuptatepage(model model,integer id) {if(id != null) {ction = ctionrvice.lectbyprimarykey(id);ction ction = ctionrvice.lectbyprimarykey(.getpid());model.addattribute("",);model.addattribute("sname",ction.getname());}return "admin/ctionbelowuptate";}/*** 跳转修改科室界面*/@requestmapping("/ctionuptatepage")public string ctionuptatepage(model model,integer id) {if(id != null) {ction = ctionrvice.lectbyprimarykey(id);model.addattribute("",);}return "admin/ctionuptate";}/*** 添加科室*/@requestmapping("/ctionadd")@responbodypublic map<string,string> ctionadd(string name) {map<string, string> map = new hashmap<string, string>();if(name != null ){ction ction = new ction();ction.tname(name);ction.ttype(1);ctionrvice.inrtlective(ction);map.put("pan","ok");}el{map.put("pan","err");}return map;}/*** 添加科室下级*/@requestmapping("/ctionaddbelow")public string ctionaddbelow(ction ction) {ction.ttype(2);ctionrvice.inrtlective(ction);//"redirect:/admin/ctionbelowlist?id="+ction.getpid();return "redirect:/admin/ctionlist";}/*** 修改科室*/@requestmapping("/ctionuptate")public string ctionuptate(ction ction) {ctionrvice.updatebyprimarykeylective(ction);return "redirect:/admin/ctionlist";}/*** 修改科室下级*/@requestmapping("/ctionbelowuptate")public string ctionbelowuptate(ction ction) {ctionrvice.updatebyprimarykeylective(ction);return "redirect:/admin/ctionbelowlist?id="+ction.getpid();}/*** 删除科室下级*/@requestmapping("/ctionbelowdelect")public string ctionbelowuptate(integer id) {ction ction = ctionrvice.lectbyprimarykey(id);integer pid = ction.getpid();ctionrvice.deletebyprimarykey(ction.getid());return "redirect:/admin/ctionbelowlist?id="+pid;}/*** 删除科室*/@requestmapping("/ctiondelect")public string ctiondelect(integer id) {ction ction = new ction();ction.tpid(id);ction.ttype(2);list<ction> list = ctionrvice.lectbyexample(ction);ctionrvice.deletebyprimarykey(id);for (ction ction2 : list) {ctionrvice.deletebyprimarykey(ction2.getid());}return "redirect:/admin/ctionlist";}@requestmapping("/bannerspageupdate")public string bannersadd(model model,integer id) {banners banners = null;string[] imgnames = null;if(id == 1){banners = bannersrvice.lectbyprimarykey(1);if(banners == null){banners = new banners();banners.tid(1);bannersrvice.inrtlective(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")@responbodypublic map<string, object> bannersdel(integer id,string src) throws ioexception{map<string, o秋天的作文结尾bject> map = new hashmap<string, object>();stringbuffer sb = new stringbuffer();if(id != null && src != null){banners banner = bannersrvice.lectbyprimarykey(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","删除成功");}el{map.put("massage","删除失败");}}el{sb.append(split[i]+",");}}}}banners banners = new banners();banners.tid(id);banners.timg(sb.tostring());bannersrvice.updatebyprimarykeylective(banners);return map;}/***banner图片上传*/@requestmapping(value ="/bannersadd")@responbodypublic 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 = bannersrvice.lectbyprimarykey(id);banners.tid(id);if(sh.getimg() != null ){banners.timg(sh.getimg()+path.tostring());}el{banners.timg(path.tostring());}bannersrvice.updatebyprimarykeylective(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 = videorvice.lectpagelist(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 = videorvice.lectbyprimarykey(id);string urlsrls = video.geturls();string name = urlsrls.substring(urlsrls.indexof("s") + 2); //获取文件名file file = new file(filepath +name);if(file.exists()){file.delete();}videorvice.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 = personrvice.lectpagelist(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.timg(img[0]);list.t(i,sh);}}if(sou != null && !"".equals(sou)){char sz = sou.charat(0);//判断是否是大写if(character.isupperca(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);}el{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 = personrvice.lectbyprimarykey(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();}personrvice.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.tstate(0);//0为正常 1是管理员下架的pageinfo<feiyis> pageinfo = feiyisrvice.lectfeiyis(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 = feiyisrvice.lectbyprimarykey(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();}}feiyisrvice.deletebyprimarykey(id);}return "redirect:/admin/feiyislist?type=" + type;}*//*** 后台主页* @return*//*@requestmapping("/index")public string index(model model) {//图表信息int zixun = zixunrvice.countbyexample(null);int video = videorvice.countbyexample(null);int person = personrvice.countbyexample(null);int zuocount = feiyisrvice.countbyexamples(1);int huocount = feiyisrvice.countbyexamples(2);int zoucount = feiyisrvice.countbyexamples(3);int facount = feiyisrvice.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 = commentrvice.countbyexample(null);//用户数int urcount = urtrvice.countbyexample(null);//商品数量int shopcount = shoprvice.countbyexample(null);//资讯数量int zixuncount = zixunrvice.countbyexample(null);model.addattribute("commentcount",commentcount);model.addattribute("urcount",urcount);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.tstate(0);// 0 是正常 1被下架的pageinfo<zixun> pageinfo = zixunrvice.lectzixunlist(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.tid(id);zixun.tstate(1); //1是下架zixunrvice.updatebyprimarykeylective(zixun);}return "redirect:/admin/zixunlist";}*//*** 管理评论* @return*//*@requestmapping("/commentlist")public string commentlist(model model,integer type) {if(type != null){comment comment = new comment();comment.ttype(type);//商品评论comment.treport(1);//1为举报的list<comment> commentslist = commentrvice.lectcomment(comment);model.addattribute("commentslist",commentslist);}return 写作能力 "behind/admin/commentlist";}*//*** 评论删除* @return*//*@requestmapping("/commentdel")public string commentdel(model model,integer id) {if(id != null){commentrvice.deletebyprimarykey(id);}return "redirect:/admin/commentlist";}*//***审核* @return*//*@requestmapping("/merchantlist")public string merchantlist(model model,integer id) {merchant merchant = new merchant();merchant.tstate(0);list<merchant> merchantlist = merchantrvice.lectmerchant(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.tid(id);merchant.tstate(1);merchantrvice.updatebyprimarykeylective(merchant);}return "redirect:/admin/merchantlist";}*//***未通过* @return*//*@requestmapping("/merchandel")public string merchandel(model model,integer id) {if(id != null){merchantrvice.deletebyprimarykey(id);}return "redirect:/admin/merchantlist";}*//***用户列表* @return*//*@requestmapping("/urlist")public string urlist(model model) {list<ur> urlist = urtrvice.lectfull(null);model.addattribute("urlist",urlist);return "behind/admin/urlist";}*//***用户删除* @return*//*@requestmapping("/urdel")public string urdel(model model,integer id) {if(id != null){urtrvice.deletebyprimarykey(id);}return "redirect:/admin/urlist";}*//***修改密码* @return*//*@requestmapping("/adminuptatepassword")public string adminuptatepassword(model model,admin admin,httprvletrequest request) {httpssion ssion = request.getssion();admin ad = (admin) ssion.getattribute("admin");if(ad != null && admin.getpassword() != null){admin.tid(ad.getid());adminrvice.updatebyprimarykeylective(admin);}return "redirect:/admin/index";}*/}
到此这篇关于java实战宠物医院预约挂号系统的实现流程的文章就介绍到这了,更多相关java 宠物医院预约挂号系统内容请搜索www.887551.com以前的文章或继续浏览下面的相关文章希望大家以后多多支持www.887551.com!
本文发布于:2023-04-04 09:36:21,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/beaaa867fdbcb75176cb5fad08d4d7f7.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:Java实战宠物医院预约挂号系统的实现流程.doc
本文 PDF 下载地址:Java实战宠物医院预约挂号系统的实现流程.pdf
留言与评论(共有 0 条评论) |