基于javaweb+jsp的宠物医院商城系统(java+Springboot+Jsp+maven+Mysql)
项目运行
环境配置:
Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)
项目技术:
Springboot+ SpringMVC + MyBatis + Jsp + Html+ Javascript + JQuery + Ajax + maven等等
宠物医院与商城一体的系统
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
@Autowired
private DoctorService doctorService;
@Autowired
private SectionService sectionService;
@Autowired
private PatientService patientService;
@Autowired
private MessagesService messagesService;
private Integer size = 8;//每页显示数量
@RequestMapping("/tiaomessagelist")
* @throws ParseException */ @RequestMapping(value = "/messagesList") @ResponseBody public ListmessagesList(@RequestParam("type")Integer type,@RequestParam("uid")Integer uid) throws ParseException { Messages message = new Messages(); List list = null; message.setType(type); message.setUid(uid); if(type != null && type == 1) { message.setTime(new Date()); list = messagesService.selectMessagesPai(message);
}
PageInfo pageInfo = doctorService.selectDoctorList(doctor,page,size);
List list = pageInfo.getList();
model.addAttribute("doctorList",pageInfo.getList());
model.addAttribute("pageInfo",pageInfo);
model.addAttribute("doctor",doctor);
return "patient/doctorList";
}
@RequestMapping(value = "/userLogin")
@ResponseBody
public Patient userLogin(@RequestBody Patient patient) throws ParseException {
List list = patientService.selectPatient(patient);
if(patient != null && patient.getUsername() != null && patient.getPassword() != null) {
if(list.size() > 0) {
return list.get(0);
}
}
return patient;
ListselectDoctor = doctorService.selectDoctor(doctor); return selectDoctor; } @RequestMapping(value = "/doctorIdList") @ResponseBody public Section doctorIdList(Integer sid) {
@RequestMapping(value = "/messageAjax") @ResponseBody public ListdoctorList(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 pageInfo2 = messagesService.selectMessagesListDemo(messages,1,99); return pageInfo2.getList(); }
}
@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);
@Autowired
private DoctorService doctorService;
@Autowired
private SectionService sectionService;
@Autowired
private PatientService patientService;
@Autowired
private MessagesService messagesService;
private Integer size = 8;//每页显示数量
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";
}
}
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;
@RequestMapping(value = "/doctortimeSelect")
@ResponseBody
public List 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 selectDoctor = doctorService.selectTime(doctor);
return selectDoctor;
}
@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";
return "redirect:/api/doctorList1"; } Admin admin = new Admin(); admin.setUsername(username); admin.setPassword(password); Listadminlist = 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"; } @RequestMapping("/sessionInvalidate")
*科室查询 */ @RequestMapping(value = "/sectionList") @ResponseBody public Map> sectionList() { Map > map = new HashMap >(); List sectionlist2 = null; Section se = new Section(); se.setType(1); List sectionlist = sectionService.selectByExample(se); if(sectionlist.size() > 0 ) {
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(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);
}
@RequestMapping(value = "/doctorGeRenList")
@ResponseBody
public Doctor doctorGeRenList(Integer id) throws ParseException {
Doctor doctor = doctorService.selectByPrimaryKey(id);
return doctor;
}
@RequestMapping(value = "/doctorYuyueTime")
@ResponseBody
public Map doctorYuyueTime(Integer id) {
Map map = new HashMap();
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()));
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);
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) {
doctor = new Doctor();
}
PageInfo pageInfo = doctorService.selectDoctorList(doctor,page,size);
List list = pageInfo.getList();
model.addAttribute("doctorList",pageInfo.getList());
model.addAttribute("pageInfo",pageInfo);
model.addAttribute("doctor",doctor);
return "patient/doctorList";
}
@RequestMapping(value = "/userLogin")
@ResponseBody
public Patient userLogin(@RequestBody Patient patient) throws ParseException {
List list = patientService.selectPatient(patient);
if(patient != null && patient.getUsername() != null && patient.getPassword() != null) {
if(list.size() > 0) {
@RequestMapping(value = "/sectionList") @ResponseBody public Map> sectionList() { Map > map = new HashMap >(); List sectionlist2 = null; Section se = new Section(); se.setType(1); List 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; }
* PageInfopageInfo = * patientService.selectPatientList(patient,1,size); List list = * pageInfo.getList(); List list2 = new ArrayList (); 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 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 pageInfo = messagesService.selectMessagesList(messages, 1, size); model.addAttribute("doctorList",pageInfo.getList());
String substring = filename.substring(indexOf); System.out.println(substring); }*/ @RequestMapping(value ="/zixunAdd") @ResponseBody public MapzixunAdd(@RequestParam("mf")MultipartFile mufile,@RequestParam("id")Integer id) throws IOException{ Map map = new HashMap (); String random = StringRandom.getRandom(); String filename = mufile.getOriginalFilename(); //随机字符+原图片名用作新的图片名 filename = random+".jpg"; try { //文件保存路径 D:/xxxx/xxxx/ File file = new File(filePath+filename);
}
return patient;
}
@RequestMapping(value = "/patientUpdate")
@ResponseBody
public Patient patientUpdate(@RequestBody Patient patient) {
patientService.updateByPrimaryKeySelective(patient);
return null;
*/
@Controller
@RequestMapping("/login")
public class LoginController {
@Autowired
private AdminService adminService;
@Autowired
private DoctorService doctorService;
@Autowired
private SectionService sectionService;
section.setPid(id);
selectByExample = sectionService.selectByExample(section);
}
return selectByExample;
}
@RequestMapping("/mimaUpate")
@ResponseBody
public Map passwordUpate(Model model, String zhanghao) {
Map map = new HashMap();
Admin ad = new Admin();
ad.setUsername(zhanghao);
List selectAdmin = adminService.selectAdmin(ad);
if(selectAdmin.size() > 0){
map.put("pan","err");
}else{
map.put("pan","ok");
}
return map;



