项目运行
环境配置:
Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)
项目技术:
Springboot+ SpringMVC + MyBatis + Jsp + Html+ JavaScript + JQuery + Ajax + maven等等
宠物医院与商城一体的系统
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
/**
* 管理员注册
*/
@RequestMapping("/admin_Register")
public String admin_Register(Admin admin,Model model) {
int insertSelective = adminService.insertSelective(admin);
model.addAttribute("type",2);
return "login";
}
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);
}
}
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;
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")
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);
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";
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) {
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 =
* @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
@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);
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;