当前位置: 首页 > 编程日记 > 正文

Java项目:医院预约挂号系统(java+SpringBoot+Maven+Vue+mysql)

源码获取:博客首页 "资源" 里下载!

一、项目运行

环境配置:

Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)。

项目技术:

Spring + SpringBoot+ mybatis + Maven + Vue 等等组成,B/S模式 + Maven管理等等。

后端管理员控制层:

/*** 后端管理员控制层*/
@Controller
@RequestMapping("/api")
public class PatientController {private Integer size  = 6;//每页显示数量@Autowiredprivate AdminService adminService;@Autowiredprivate SectionService sectionService;@Autowiredprivate BannersService  bannersService;   @Autowiredprivate DoctorService doctorService;@Autowiredprivate   PatientService  patientService;@Autowiredprivate   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")@ResponseBodypublic  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")@ResponseBodypublic  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")@ResponseBodypublic  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")@ResponseBodypublic 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")@ResponseBodypublic  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")@ResponseBodypublic  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")@ResponseBodypublic 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")@ResponseBodypublic  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")@ResponseBodypublic  List<Doctor>  doctorList(Integer sid) {Doctor doctor = new Doctor();doctor.setSid(sid);List<Doctor> selectDoctor = doctorService.selectDoctor(doctor);return selectDoctor;}  /***医生列表查询*/@RequestMapping(value = "/doctorLike")@ResponseBodypublic  List<Doctor>  doctorLike(String name) {Doctor doctor = new Doctor();doctor.setName(name);List<Doctor> selectDoctor = doctorService.selectDoctor(doctor);return selectDoctor;}  /***科室查询*/@RequestMapping(value = "/doctorIdList")@ResponseBodypublic  Section  doctorIdList(Integer sid) {Section selectByPrimaryKey = sectionService.selectByPrimaryKey(sid);return selectByPrimaryKey;}  /***医生列表查询* @throws ParseException */@RequestMapping(value = "/doctortimeSelect")@ResponseBodypublic  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")@ResponseBodypublic  Doctor  doctorGeRenList(Integer id) throws ParseException {Doctor doctor = doctorService.selectByPrimaryKey(id);return doctor;}  /***时间格式转换*/@RequestMapping(value = "/doctorYuyueTime")@ResponseBodypublic  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")@ResponseBodypublic  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")@ResponseBodypublic 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")@ResponseBodypublic  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")@ResponseBodypublic  List<Patient>   patienDel(Integer id) {if(id != null) {patientService.deleteByPrimaryKey(id);}List<Patient> selectByExample = patientService.selectByExample(null);return  selectByExample;}/***患者信息查看*/@RequestMapping(value = "/patientUpatePage")@ResponseBodypublic  Patient  patientUpatePage(Integer id) {Patient patient = null;if(id != null) {patient = patientService.selectByPrimaryKey(id);}return  patient;}/***患者信息修改*/@RequestMapping(value = "/patientUpdate")@ResponseBodypublic  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")@ResponseBodypublic  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")@ResponseBodypublic  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")@ResponseBodypublic  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")@ResponseBodypublic  List<Doctor>  doctortouList() {PageInfo<Doctor> pageInfo  =  doctorService.selectDoctorList(null,1,4);return   pageInfo.getList();}/** * @throws ParseException */@RequestMapping(value = "/datatimeGua")@ResponseBodypublic  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 {@Autowiredprivate AdminService adminService;@Autowiredprivate DoctorService doctorService;@Autowiredprivate SectionService sectionService;@Autowiredprivate  PatientService  patientService;@Autowiredprivate   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")@ResponseBodypublic  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")@ResponseBodypublic 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")@ResponseBodypublic  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("/login")
public class LoginController {@Autowiredprivate AdminService adminService;@Autowiredprivate DoctorService doctorService;@Autowiredprivate SectionService sectionService;@Autowiredprivate   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")@ResponseBodypublic  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")@ResponseBodypublic 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")@ResponseBodypublic 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")@ResponseBodypublic 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")@ResponseBodypublic 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("/admin")
public class AdminController {@Autowiredprivate AdminService adminService;@Autowiredprivate SectionService sectionService;@Autowiredprivate BannersService  bannersService;   @Autowiredprivate DoctorService doctorService;@Autowiredprivate  PatientService  patientService;@Autowiredprivate   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协议的扩展,浏览器以什么方式处理wenjianresponse.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")@ResponseBodypublic 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")@ResponseBodypublic  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")@ResponseBodypublic  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";}
*/}

源码获取:博客首页 "资源" 里下载!

相关文章:

《暗时间》读后感

什么是暗时间 什么是暗时间&#xff1f;你走路、买菜、洗脸洗手、坐公车、逛街、出游、吃饭、睡觉&#xff0c;所有这些时间都可以称为“暗时间”。我理解暗时间就是把自己平时在不知不觉中度过的&#xff0c;看不到它流逝的时光充分利用起来的时间。这些时间在作者的眼里是可以…

AbstractMap详解

/ 包:java.util// 包:java.util package java . util;Map.Entry;​同 SimpleEntry 一样,都继承了 Map.Entry 和 序列化接口。

OpenGL渲染流水中的处理步骤

显示列表:不管数据描述的是几何体还是像素,都可以被存储在显示列表中,供现在或以后使用;也可以不将数据存储在显示列表中,而是立刻对数据进行处理,这被称为直接模式.显示列表被执行时,其中存储的数据被发送出去,就像在应用程序中用直接模式发送一样.求值程序:所有的几何图元最终…

需要在method方法被调用之后,仅打印出a=100,b=200,请写出method方法的代码

通常,此流对应于显示器输出或者由主机环境或用户指定的另一个输出目标。通常,此流对应于键盘输入或者由主机环境或用户指定的另一个输入源。public static final PrintStream err“标准”错误输出流。PrintStream 是打印输出流,它继承于FilterOutputStream。第二个用的是用的是char类型,根本不是方法,当要输出方法体的时候,会给你遍历数组。通常,此流对应于显示器输出或者由主机环境或用户指定的另一个输出目标。诡异的是,如果错了,面试官对你说了一句:你回去看看,

Linux复制文件scp

cp 复制文件(copy) cp sourcefile destfile scp 跨服务器复制(secure copy) (1) 复制文件&#xff1a; scp local_file remote_usernameremote_ip:remote_folder 或 scp local_file remote_usernameremote_ip:remote_file 或 scp local_file remote_ip:remote_folder 或 scp lo…

一键部署 SpringCloud 微服务,这套流程值得学习一波儿!

一键部署 springcloud 微服务,需要用到 Jenkins K8S Docker等工具。本文使用jenkins部署,流程如下图开发者将代码push到git运维人员通过jenkins部署,自动到git上pull代码通过maven构建代码将maven构建后的jar打包成docker镜像 并 push docker镜像到docker registry通过k8s发起 发布/更新 服务 操作其中 2~5步骤都会在jenkins中进行操作。

Observer Pattern 观察者模式

Observer Pattern (观察者模式) 定义&#xff1a; 《设计模式》中对Observer模式的意图是这样描述的&#xff1a;“定义对象间的一种一对多的依赖关系&#xff0c;当一个对象的状态发生改变时&#xff0c;所有依赖于它的对象都将得到通知并且自动更新”。 The Observer Patt…

Java项目:精美风在线音乐网站(java+JDBC+C3P0+servlet+mysql+JSP)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 1.运行环境 环境配置&#xff1a; Jdk1.8 Tomcat8.5 mysql Eclispe&#xff08;IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持&#xff09; 项目技术&#xff1a; JSP C3P0 Servlert html css JavaS…

Solution 24: 链表翻转

程序 public class ListReverse {public ListNode reverseList(ListNode head) {if (head null) {return head;}ListNode pre head;ListNode cur pre.next;pre.next null;while (cur ! null) {ListNode next cur.next;cur.next pre;pre cur;cur next;}return pre;}pu…

Android开发实践:以“专业”的态度处理多线程

刚开始学一门编程语言的时候&#xff0c;我总是会有一种困惑&#xff0c;怎样让自己的代码看起来更“专业”&#xff1f;很多时候&#xff0c;我们可以照着教材实现一些基本的功能&#xff0c;比如用Socket发送/接收几个字符&#xff0c;写一个线程完成某个异步任务&#xff0c…

js 正则匹配URL,网址,带端口,带query的

function isURL(url) {const strRegex ^((https|http|ftp)://)?//(https或http或ftp):// 可有可无 (([\\w_!~*\()\\.&$%-]: )?[\\w_!~*\()\\.&$%-])? //ftp的user 可有可无 (([0-9]{1,3}\\.){3}[0-9]{1,3} // IP形式的URL- 3位数字.3位数字.3位数字.3位数字 | // 允…

接入层的流程和非接入层

所谓接入层的流程和非接入层的流程&#xff0c;实际是从协议栈的角度出发的。在协议栈中&#xff0c;RRC和RANAP层及其以下的协议层称为接入层&#xff0c;它们之上的MM、SM、CC、SMS 等称为非接入层。简单地说&#xff0c;接入层的流程&#xff0c;也就是指无线接入层的设备RN…

Java项目:精美网上音乐平台(前后端分离+java+vue+Springboot+ssm+mysql+maven+redis)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 一、项目简述 本系统功能包括&#xff1a; 音乐播放 用户登录注册 用户信息编辑、头像修改 歌曲、歌单搜索 歌单打分 歌单、歌曲评论 歌单列表、歌手列表分页显示 歌词同步显不 音乐收藏、下载、拖动控制、…

UICollectionView的使用方法

1、遵守协议 <UICollectionViewDataSource,UICollectionViewDelegateFlowLayout> 2、创建 UICollectionViewFlowLayout * layout [[UICollectionViewFlowLayout alloc]init]; layout.minimumInteritemSpacing 10; //最小item之间的间距 layout.minimumLineSpaci…

python学习--服务期间通讯和mysql数据库操作

服务端import socket import json ssocket.socket(socket.AF_INET,socket.SOCK_STREAM,0) host port1234 s.bind((host,port)) s.listen(3) while True:client,ipaddrs.accept()print "Got a connect from %s" %str(ipaddr)dataclient.recv(1024)metadatajson.loads(…

[Angular JS教程] HeroService: getHeroes failed: undefined 问题解决方法

最近在学习入门Angular JS&#xff0c;学习资源是https://angular.cn/tutorial&#xff0c; 在学习到 “https://angular.cn/tutorial/toh-pt6模拟数据服务器” 阶段时&#xff0c;客户端访问http://localhost:4200/无法get到英雄列表&#xff0c;Message系统记录日志如下&…

BZOJ 4059: [Cerc2012]Non-boring sequences ( )

要快速在一段子序列中判断一个元素是否只出现一次 , 我们可以预处理出每个元素左边和右边最近的相同元素的位置 , 这样就可以 O( 1 ) 判断.考虑一段序列 [ l , r ] , 假如我们找到了序列中唯一元素的位置 p , 那我们只需检查 [ l , p - 1 ] & [ p 1 , r ] 是否 non-boring…

Java项目:小蜜蜂扩音器网上商城系统(java+JSP+Servlet+JDBC+Ajax+mysql)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 一、项目简述 用户功能模块&#xff1a; 用户注册&#xff1a; 用户登录&#xff1a;商品模块&#xff1a;订单模块&#xff1b;后台管理系统功能&#xff1a;管理员模块&#xff1a; 商品模块&#xff1a;…

WebBrowserProgramming - Python Wiki

WebBrowserProgramming - Python WikiWeb Browser Programming in Python

C++ transform for_each

#include<iostream>#include<vector>#include <list>#include <algorithm>#include <functional> using namespace std; //不需拷贝&#xff0c;速度快void square(int &elementParam){ elementParam elementParam*elementParam;} //速度…

When should static_cast, dynamic_cast and reinterpret_cast be used?

这是我偶然在 http://stackoverflow.com/questions/ 网页上发现的一个问题&#xff08;类似博客园的博问&#xff09;&#xff0c;问题主要是关于询问应该怎样使用&#xff0c;以及何时使用C里面的这几种类型转换操作符&#xff1a;static_case, dynamic_cast&#xff0c;以及 …

Java项目:养老院管理系统(java+SSM+JSP+Easyui+maven+mysql)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 运行环境&#xff1a; JDK1.8、tomcat8、eclipse、mysql5.6、Navicat 功能实现&#xff1a; 用户: 用户名,登录密码,姓名,性别,出生日期,用户照片,联系电话,邮箱,家庭地址,注册时间 老人: 老人编号,姓名,…

Linux访问Windows磁盘实现共享

业务需求说明&#xff1a;公司在部署hadoop集群和DB server与SAN存储&#xff0c;公司的想法是前端通过DB Server能够将非结构化的数据能放进SAN存储当中&#xff0c;而hadoop集群也能够访问这个SAN存储。因此需要在SAN磁盘阵列中开辟一个共享区域&#xff0c;这个区域技能让DB…

ubuntu环境ceph配置入门(一)

为什么80%的码农都做不了架构师&#xff1f;>>> 环境&#xff1a;ubuntu server 14.04 64bit&#xff0c;安装ceph版本0.79 正常情况下应有多个主机&#xff0c;这里为了快速入门以一台主机为例&#xff0c;多台主机配置方式类似。 1. 配置静态IP及主机名 静态IP配…

mysql查看当前实时连接数

静态查看: SHOW PROCESSLIST; SHOW FULL PROCESSLIST; SHOW VARIABLES LIKE %max_connections%; SHOW STATUS LIKE %Connection%; 实时查看&#xff1a; mysql> show status like Threads%; -------------------------- | Variable_name | Value | ------------…

lsof 简介

lsof简介 lsof&#xff08;listopen files&#xff09;是一个列出当前系统打开文件的工具。在linux环境下&#xff0c;任何事物都以文件的形式存在&#xff0c;通过文件不仅仅可以访问常规数据&#xff0c;还可以访问网络连接和硬件。所以如传输控制协议 (TCP) 和用户数据报协…

Java项目:健身器材商城系统(java+Jdbc+Servlet+Ajax+Fileupload+mysql)

源码获取&#xff1a;博客首页 "资源" 里下载&#xff01; 一、项目运行 环境配置&#xff1a; Jdk1.8 Tomcat8.5 mysql Eclispe&#xff08;IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持&#xff09; 项目技术&#xff1a; Jdbc Servlert html css JavaScrip…

Xcode中如何解决无法使用svn命令行的问题

今天在自己机器上安装了xp虚拟机,然后在xp虚拟机上安装了svn的服务器.发现原本Xcode5以后就自带的svn竟然在终端无法使用命令行,出现了以下的错误: xcrun: error: active developer path ("/Volumes/Xcode/Xcode.app/Contents/Developer") does not exist, use xcode…

查看和设置MySQL数据库字符集(转)

查看和设置MySQL数据库字符集作者&#xff1a;scorpio 2008-01-21 10:05:17 标签&#xff1a; 杂谈 Liunx下修改MySQL字符集&#xff1a;1.查找MySQL的cnf文件的位置find / -iname *.cnf -print /usr/share/mysql/my-innodb-heavy-4G.cnf/usr/share/mysql/my-large.cnf/usr/sha…

数据库管理工具dbeaver

https://dbeaver.io/ 转载于:https://www.cnblogs.com/mingzhang/p/11016229.html