基于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等等
宠物医院与商城一体的系统
PageInfopageInfo = messagesService.selectMessagesList(messages,page,size); //工作区数据 messages.setTime(new Date()); List 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 = "/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; } @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 selectByExample = patientService.selectByExample(se); if(selectByExample.size() >0 ) { List lmlist = messagesService.selectByExample(null); int j = 0 ; for (Messages me : lmlist) { if(me.getUid() == id) { return j; }
session.setAttribute("PATIENT",list.get(0));
return "redirect:/api/doctorList1";
}
Admin admin = new Admin();
admin.setUsername(username);
admin.setPassword(password);
List 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";
}
@RequestMapping("/sessionInvalidate")
Messages messages = new Messages();
messages.setId(id);
messages.setType(2); //2取消预约
messagesService.updateByPrimaryKeySelective(messages);
}
return "redirect:/doctor/messageList?type=1";
}
@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";
}
@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";
}
@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;//每页显示数量
return list; } @RequestMapping(value = "/messagesLists") @ResponseBody
*医生列表查询 */ @RequestMapping(value = "/doctorList") @ResponseBody public ListdoctorList(Integer sid) { Doctor doctor = new Doctor(); doctor.setSid(sid); List selectDoctor = doctorService.selectDoctor(doctor); return selectDoctor; } @RequestMapping(value = "/doctorLike") @ResponseBody public List doctorLike(String name) { Doctor doctor = new Doctor(); doctor.setName(name);
@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";
}
}
后端管理员控制层:
}
@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);
me2.setId(list.get(0).getId());
me2.setMima(mima);
merchantService.updateByPrimaryKeySelective(me2);
map.put("pan","ok");
}else{
map.put("pan","err");
}
return map;
}
*/
@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);
* @throws ParseException */ @RequestMapping(value = "/doctortouList") @ResponseBody public ListdoctortouList() { PageInfo pageInfo = doctorService.selectDoctorList(null,1,4); return pageInfo.getList(); } @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);
@ResponseBody public ListsectionameList(String name) { Section se = new Section(); se.setName(name); se.setType(2); List 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; } @RequestMapping("/doctorTimePage") public String doctorTimePage(Integer id,Model model) {
int indexOf = filename.indexOf(".");
String substring = filename.substring(indexOf);
System.out.println(substring);
}*/
@RequestMapping(value ="/zixunAdd")
@ResponseBody
public Map zixunAdd(@RequestParam("mf")MultipartFile mufile,@RequestParam("id")Integer id) throws IOException{
@RequestMapping("/panzhanghao")
@ResponseBody
public Map panzhanghao(Model model, String zhanghao) {
Map map = new HashMap();
PatientExample se = new PatientExample();
PatientExample.Criteria criteria = se.createCriteria();
criteria.andUsernameEqualTo(zhanghao);
List selectByExample = patientService.selectByExample(se);
if(selectByExample.size() > 0){
map.put("pan","err");
}else{
map.put("pan","ok");
}
return map;
}
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 pageInfo = messagesService.selectMessagesList(messages,page,size);
@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) {
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(); //科室总数
PageInfopageInfo = doctorService.selectDoctorList(null,1,4); if(pageInfo.getList() != null && pageInfo.getList().size() >0 ) { List list = pageInfo.getList(); StringBuffer sb = new StringBuffer(); StringBuffer shu = new StringBuffer(); int v = list.size()-1; for(int i=0;i zixunAdd(@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/
Listlist = messagesService.selectMessages(message); return list.size(); } } 登录控制层: @Controller @RequestMapping("/login") public class LoginController {
* @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 sectionlist2 = null;
model.addAttribute("doctor",doctor);
//科室
Section se = new Section();
se.setType(1);
List sectionlist = sectionService.selectByExample(se);
model.addAttribute("sectionlist", sectionlist);
//科室详情
Section se1 = sectionService.selectByPrimaryKey(doctor.getSid());
if(se1 != null) {
Section section = new Section();
@RequestMapping(value = "/messagesLists") @ResponseBody public ListmessagesLists(Integer uid) throws ParseException { Messages message = new Messages(); message.setUid(uid); List 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());
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()); //患者



