基于javaweb+springboot的宠物医院预约管理系统设计和实现(java+springboot+mysql+ssm)
项目使用java SpringMVC、springboot mybatis、layui为核心技术编写
首页登录有可爱的小猫咪:
系统主页主要功能有会员信息、宠物管理、预约管理和统计分析等:
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
List<Long> value = new ArrayList<>();
for (Map<String, Object> m : map){
String df = (String) m.get("df");
time.add(df);
Long v = (Long) m.get("c");
if (v == null) {
value.add(0L);
}else {
value.add(v);
}
}
model.addAttribute("time", time);
model.addAttribute("value", value);
return "tj/freeTime";
}
@RequestMapping(value = "/getFreeTime")
@ResponseBody
public Object getFreeTime(Long id, String date) {
User doctors = userService.selectByPrimaryKey(id);
Map<String, Object> result = new HashMap<>();
result.put("n", doctors.getName());
List<Map<String, Object>> map = appointmentService.getFreeTimeById(id, date+MyUtils.START_HOUR);
List<String> time = new ArrayList<>();
case 1: a1++;break;
case 2: a2++;break;
case 3: a3++;break;
case 4: a4++;break;
}
}
model.addAttribute("a1", a1);
model.addAttribute("a2", a2);
model.addAttribute("a3", a3);
model.addAttribute("a4", a4);
return "tj/tjApply";
}
/**
* 医生预约统计
*/
@RequestMapping("/tjApplyDoctor")
public String tjApplyDoctor(Model model) {
Appointment appointment = new Appointment();
appointment.setPage(1);
/**
* 返回有权限信息
*/
@RequestMapping(value = "/getMessage", method = RequestMethod.GET)
public ResultMap getMessage() {
return resultMap.success().message("您拥有用户权限,可以获得该接口的信息!");
}
/**
* 修改用户信息页面user/userEdit.html
*/
@RequestMapping(value = "/editUserPage")
public String editUserPage(Long userId, Model model) {
model.addAttribute("manageUser", userId);
if (null != userId) {
User user = userService.selectByPrimaryKey(userId);
model.addAttribute("manageUser", user);
}
return "user/userEdit";
}
standardService.add(pojo);
return "SUCCESS";
} catch (Exception e) {
logger.error("添加异常", e);
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return "ERROR";
}
}
}
宠物日志业务操作:
/**
* 宠物日志
*/
@Controller("UserPetDailyController")
@RequestMapping("/user/petDaily")
public class UserPetDailyController {
@Autowired
private PetDailyService petDailyService;
@Autowired
private PetService petService;
private final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
* 医生宠物日志页面user/petDailyListDoctor.html
*/
@RequestMapping("/petDailyListDoctor")
public String petListDoctor(Long petId, Model model) {
if (petId!=null){
Subject subject = SecurityUtils.getSubject();
User user = (User) subject.getPrincipal();
Appointment appointment = new Appointment();
appointment.setUserId(user.getId());
appointment.setPage(1);
appointment.setLimit(99999);
MMGridPageVoBean<Appointment> voBean = (MMGridPageVoBean<Appointment>) appointmentService.getAllByLimit(appointment);
List<Appointment> rows = voBean.getRows();
Integer a1 = 0;
Integer a2 = 0;
Integer a3 = 0;
Integer a4 = 0;
for (Appointment a: rows){
switch (a.getStatus()){
case 1: a1++;break;
t = t/psRows.size();
w = w/psRows.size();
h = h/psRows.size();
a = a/psRows.size();
pt.add(t);
pw.add(w);
ph.add(h);
pa.add(a);
// 获取标准
Standard standard = new Standard();
// 对应宠物类型
standard.setType(p.getType());
// 健康标准
standard.setStatus(1);
int petAge = MyUtils.get2DateDay(MyUtils.getDate2String(p.getBirthday(), "yyyy-MM-dd"), MyUtils.getDate2String(new Date(), "yyyy-MM-dd"));
petAge = (petAge<0? -petAge : petAge)/365;
// 年龄
standard.setAgeMax(petAge);
standard.setPage(1);
standard.setLimit(100);
MMGridPageVoBean<Standard> ss = (MMGridPageVoBean<Standard>) standardService.getAllByLimit(standard);
List<Standard> ssRows = ss.getRows();
double tsMin = 0;
double tsMax = 0;
double wsMin = 0;
double wsMax = 0;
double hsMin = 0;
model.addAttribute("pets", rows);
if (rows.size()>0){
pet = rows.get(0);
PetDaily daily = new PetDaily();
daily.setPetId(pet.getId());
daily.setPage(1);
daily.setLimit(99999);
MMGridPageVoBean<PetDaily> ppp = (MMGridPageVoBean<PetDaily>) petDailyService.getAllByLimit(daily);
List<PetDaily> list = ppp.getRows();
for (PetDaily p : list){
p.setDateTime(MyUtils.getDate2String(p.getCreateTime(), "yyyy-MM-dd"));
}
model.addAttribute("dailys", list);
}
return "tj/tjDailyDoctor";
}
/**
* 普通用户查询条件数据返回宠物日志
*/
@RequestMapping("/tjDailyData")
@ResponseBody
public Object tjDailyData(Long id){
PetDaily daily = new PetDaily();
daily.setPetId(id);
daily.setPage(1);
daily.setLimit(99999);
MMGridPageVoBean<PetDaily> ppp = (MMGridPageVoBean<PetDaily>) petDailyService.getAllByLimit(daily);
mh.add(hsMax);
ma.add(asMax);
if (t>=tsMin && t<=tsMax){
tsCount.add(" 体温正常");
}else if (t<tsMin){
tsCount.add( " 体温偏低");
}else if (t>tsMax){
tsCount.add( " 体温偏高");
}
if (w>=wsMin && w<=wsMax){
wsCount.add( " 体重正常");
}else if (w<wsMin){
wsCount.add(" 体重偏低");
}else if (w>wsMax){
wsCount.add(" 体重偏高");
}
if (h>=hsMin && h<=hsMax){
hsCount.add(" 身高正常");
}else if (h<hsMin){
hsCount.add( " 身高偏低");
@RequestMapping(value = "/freeTime")
public String freeTime(Model model) {
List<User> doctors = userService.listDoctor();
model.addAttribute("doctors", doctors);
Long docId = doctors.get(0).getId();
model.addAttribute("docName", doctors.get(0).getName());
String nowDateYMD = MyUtils.getNowDateYMD();
List<Map<String, Object>> map = appointmentService.getFreeTimeById(docId, nowDateYMD+MyUtils.START_HOUR);
List<String> time = new ArrayList<>();
List<Long> value = new ArrayList<>();
for (Map<String, Object> m : map){
String df = (String) m.get("df");
time.add(df);
Long v = (Long) m.get("c");
if (v == null) {
value.add(0L);
}else {
value.add(v);
}
@Autowired
private PetService petService;
private final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
* 医生宠物日志页面user/petDailyListDoctor.html
*/
@RequestMapping("/petDailyListDoctor")
public String petListDoctor(Long petId, Model model) {
if (petId!=null){
model.addAttribute("petId", petId);
}else {
model.addAttribute("petId", "petId");
}
return "user/petDailyListDoctor";
}
/**