Java毕业设计实战之宠物医院与商城一体的系统的实现
程序员文章站
2022-06-15 14:18:43
项目运行:环境配置:jdk1.8 + tomcat8.5 + mysql + eclispe(intellij idea,eclispe,myeclispe,sts都支持)项目技术:springboo...
项目运行:
环境配置:
jdk1.8 + tomcat8.5 + mysql + eclispe(intellij idea,eclispe,myeclispe,sts都支持)
项目技术:
springboot+ springmvc + mybatis + jsp + html+ javascript + jquery + ajax + maven等等
宠物医院与商城一体的系统
后端管理员控制层:
/** * 后端管理员控制层 */ @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("/login") public class logincontroller { @autowired private adminservice adminservice; @autowired private doctorservice doctorservice; @autowired private sectionservice sectionservice; @autowired private patientservice patientservice; @value("${fileurl}") //在配置文件中获取文件的保存路径 private string filepath; /** * 后台登陆界面 * @throws ioexception */ @requestmapping("/afterview") public string afterlogin(integer type,model model) { if(type == null) { type = 1; } model.addattribute("type",type); return "login"; } /** * 后台登陆界面 */ @requestmapping("/index") public string index(integer type,model model) { if(type == null){ type = 1; } model.addattribute("type",type); return "login"; } /** * 后台登陆界面 */ @requestmapping("/font/index") public string fontindex(integer type,model model) { if(type == null){ type = 3; } model.addattribute("type",type); return "loginbypatient"; } /* public static void main(string[] args) { string filename ="c:\\users\\administrator\\pictures\\项目图片\\1156.jpg_wh1200.jpg"; int indexof = filename.indexof("."); string substring = filename.substring(indexof); system.out.println(substring); }*/ /** * 医生图片上传 * @param mufile * @param id * @return * @throws ioexception */ @requestmapping(value ="/zixunadd") @responsebody public map<string, object> zixunadd(@requestparam("mf")multipartfile mufile,@requestparam("id")integer id) throws ioexception{ map<string, object> map = new hashmap<string, object>(); string random = stringrandom.getrandom(); string filename = mufile.getoriginalfilename(); //随机字符+原图片名用作新的图片名 filename = random+".jpg"; try { //文件保存路径 d:/xxxx/xxxx/ file file = new file(filepath+filename); //判断父级文件是否存在 if (!file.getparentfile().exists()) { file.getparentfile().mkdir(); } mufile.transferto(file); } catch (illegalstateexception | ioexception e) { e.printstacktrace(); } doctor doctor = new doctor(); if(id != -1){ doctor.setid(id); doctor.setimg("/files/"+filename); doctorservice.updatebyprimarykeyselective(doctor); }else { //添加图片路径 doctor.setimg("/files/"+filename); doctorservice.insertselective(doctor); system.out.println("id:"+doctor.getid()); map.put("id",doctor.getid()); } return map; } /** * 判断管理员账号 */ @requestmapping("/sectionxlist") @responsebody public list<section> sectionxlist(model model, integer id) { list<section> selectbyexample = null; if(id != null) { section section = new section(); section.setpid(id); selectbyexample = sectionservice.selectbyexample(section); } return selectbyexample; } /** * 判断管理员账号 */ @requestmapping("/mimaupate") @responsebody public map<string,string> passwordupate(model model, string zhanghao) { map<string, string> map = new hashmap<string, string>(); admin ad = new admin(); ad.setusername(zhanghao); list<admin> selectadmin = adminservice.selectadmin(ad); if(selectadmin.size() > 0){ map.put("pan","err"); }else{ map.put("pan","ok"); } return map; } /** * 判断医生账号 */ @requestmapping("/panzhanghao") @responsebody public map<string,string> panzhanghao(model model, string zhanghao) { map<string, string> map = new hashmap<string, string>(); doctorexample se = new doctorexample(); doctorexample.criteria criteria = se.createcriteria(); criteria.andusernameequalto(zhanghao); list<doctor> selectbyexample = doctorservice.selectbyexample(se); if(selectbyexample.size() > 0){ map.put("pan","err"); }else{ map.put("pan","ok"); } return map; } /** * 医生添加 * @param model * @param zixun * @return */ @requestmapping("/zixuninsert") public string zixuninsert(model model,doctor doctor){ if(doctor.getid() != null){ if(doctor.getsid() != null) { section selectbyprimarykey = sectionservice.selectbyprimarykey(doctor.getsid()); doctor.setsname(selectbyprimarykey.getname()); } doctorservice.updatebyprimarykeyselective(doctor); } model.addattribute("type",1); return "login"; } /** * 管理员注册界面 */ @requestmapping("/mimapageuptate") public string mimapageuptate(integer type,model model) { //1医生 2 管理员 if(type == 1 ) { return "doctorregister"; } return "adminregister"; } /** * 医生注册界面 */ @requestmapping("/doctorregisterpage") public string doctorregister(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 "doctorregister"; } /** * 管理员注册 */ @requestmapping("/admin_register") public string admin_register(admin admin,model model) { int insertselective = adminservice.insertselective(admin); model.addattribute("type",2); return "login"; } /** * 登陆验证 * @return */ @requestmapping("/verificatio") public string verificatio(string username, string password, integer type, httpservletrequest request,model model) { httpsession session = request.getsession(); session.setattribute("type",type); //类型为1是医院 2是管理员 if(type == 1){ doctor doctor = new doctor(); doctor.setusername(username); doctor.setpasswoed(password); list<doctor> doctorlist = doctorservice.selectdoctor(doctor); if(doctorlist.size() <= 0){ model.addattribute("message","密码错误"); model.addattribute("type",type); return "login"; } session.setattribute("doctor",doctorlist.get(0)); return "redirect:/doctor/index"; } if(type == 3){ patient patient = new patient(); patient.setusername(username); patient.setpassword(password); list<patient> list = patientservice.selectpatient(patient); if(list.size() <= 0) { model.addattribute("message","密码错误"); model.addattribute("type",type); return "loginbypatient"; } session.setattribute("patient",list.get(0)); return "redirect:/api/doctorlist1"; } admin admin = new admin(); admin.setusername(username); admin.setpassword(password); list<admin> adminlist = adminservice.selectadmin(admin); if(adminlist.size() <= 0){ model.addattribute("message","密码错误"); model.addattribute("type",type); return "login"; } session.setattribute("admin",adminlist.get(0)); return "redirect:/admin/index"; } /** * 退出登录 * @param request * @return */ @requestmapping("/sessioninvalidate") public string boot(httpservletrequest request,model model) { httpsession session = request.getsession(); integer type = (integer) session.getattribute("type"); if(type == null){ type=1; } if(type == 3){ model.addattribute("type",type); session.invalidate(); //session销毁 return "loginbypatient"; } model.addattribute("type",type); session.invalidate(); //session销毁 return "login"; } /* *//** * 跳转忘记密码界面 *//* @requestmapping("/mimapageuptate") public string passwordupate() { return "behind/merchant/mibaouptate"; } *//** * 修改密码 *//* @requestmapping("/mimaupate") @responsebody public map<string,string> passwordupate(model model, string mima, string mibao, string zhanghao) { map<string, string> map = new hashmap<string, string>(); merchant me = new merchant(); me.setzhanghao(zhanghao); me.setmibao(mibao); list<merchant> list = merchantservice.selectmerchant(me); if(list.size() > 0){ merchant me2 = new merchant(); me2.setid(list.get(0).getid()); me2.setmima(mima); merchantservice.updatebyprimarykeyselective(me2); map.put("pan","ok"); }else{ map.put("pan","err"); } return map; } *//** * 后台登陆界面 * @return *//* @requestmapping("/afterview") public string afterlogin(integer type,model model) { if(type == null){ type = 1; } model.addattribute("type",type); return "behind/login"; } *//** * 登陆验证 * @return *//* @requestmapping("/verificatio") public string signin(string username, string password, integer type, httpservletrequest request,model model) { httpsession session = request.getsession(); session.setattribute("type",type); //类型为1是商户后台 2是管理员 if(type == 1){ merchant merchant = new merchant(); merchant.setzhanghao(username); merchant.setmima(password); merchant.setstate(1); list<merchant> merchants = merchantservice.selectmerchant(merchant); if(merchants.size() <= 0){ model.addattribute("message","密码错误"); model.addattribute("type",type); return "behind/login"; } session.setattribute("merchant",merchants.get(0)); return "redirect:/merchant/index"; } admin admin = new admin(); admin.setusername(username); admin.setpassword(password); list<admin> adminlist = adminservice.selectadmin(admin); if(adminlist.size() <= 0){ model.addattribute("message","密码错误"); model.addattribute("type",type); return "behind/login"; } session.setattribute("admin",adminlist.get(0)); return "redirect:/admin/index"; } *//** * 退出登录 * @param request * @return *//* @requestmapping("/sessioninvalidate") public string boot(httpservletrequest request,model model) { httpsession session = request.getsession(); integer type = (integer) session.getattribute("type"); if(type == null){ type=1; } model.addattribute("type",type); session.invalidate(); //session销毁 return "behind/login"; } *//** * 管理员修改密码界面 * @return *//* @requestmapping("/adminuptatepage") public string adminuptatepage(model model) { return "behind/admin/adminuptate"; } *//** * 商户修改密码界面 * @return *//* @requestmapping("/merchantuptate") public string merchantuptate(model model) { return "behind/merchant/merchantuptate"; } */ }
医生端:
/** * 医生端 */ @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"; } }
到此这篇关于java毕业设计实战之宠物医院与商城一体的系统的实现的文章就介绍到这了,更多相关java 宠物医院内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!