草庐IT

基于Springboot的宠物医院管理系统-JAVA【毕业设计、论文、源码、开题报告】

程序设计_itrjxxs 2023-04-17 原文

 

1 绪论

1.1 课题背景

在信息技术高速发展的今天,新知识、新技术层出不穷,计算机技术早已广泛的应用于各行各业之中,利用计算机的强大数据处理能力和辅助决策能力叫,实现行业管理的规范化、标准化、效率化。

管理信息系统(Management Information System,简称MIS〉是一个以人为主导,利用计算机软硬件技术以及网络通信技术,实现对信息的收集、传输、储存、更新。

目前,管理信息系统广泛采用WEB技术作为开发的主要技术。在经过多年的技术积累与更新,WEB技术已经从一种简单的信息浏览和信息交互平台发展为复杂的企业级应用。

目前宠物宠物医院一直以来都是使用传统的人工方式管理各种文件档案,对宠物诊疗等重要信息进行人工手写记录,工作效率低,且时间一长,将产生大量文件,这对于文件的查找、信息查询造成很多困难,存在着许多缺点。随着社区越来越多的家庭开始饲养宠物,宠物宠物医院管理方法落后的问题越来越明显,管理上面临的问题越来越突出。

为了能够方便宠物医院的管理,一套完善的管理机制是必不可少的,也是宠物医院提供良好服务质量的一个前提,而应用信息技术的现代化宠物宠物医院管理系统已成为宠物宠物医院运营必不可少的基础设施与技术支撑。

宠物宠物医院管理系统的应用,不仅可以实现将宠物宠物医院工作中的挂号业务、诊疗业务、收费业务、宠物住院业务、宠物美容业务等有机的结合起来;还可以通过建立宠物档案,帮助医生更好更及时的了解宠物病情,制定宠物治疗计划,满足宠物主人的治疗需求,同时宠物档案的建立也有利于宠物的防疫工作。除此之外,管理系统对用户权限划分,帮助宠物医院规范化工作流程,提高工作效率,全面提高宠物宠物医院的管理水平。

因此如何利用计算机技术实现宠物宠物医院信息化管理*是一个值得研究的问题。基于这个背景,本组决定开发一套适合宠物宠物医院的信息管理系统。

1.2 课题研究的现状

随着经济的发展,人们生活水平不断地进步和提高,越来越多的家庭开始饲养宠物,与此同时,宠物的卫生、防疫、诊疗也得到了人们越来越多的关注,由此派生出的宠物宠物医院在发展上也越来越迅猛l5。

宠物宠物医院在欧美发达国家作为产业早已经形成了国民经济的一部分,由于欧美发达国家的信息化程度高,信息技术、各种研究成果较早的应用于各行各业,宠物宠物医院在管理上早已实现了信息化建设。

当前,信息化已成为全球发展的主题,世界各国对信息的需求快速增长,信息产品和信息服务广泛的应用于各个国家、地区、企业、单位、家庭、个人。

早在20世纪8O年代,发达国家就已经开始信息化建设的工作。目前,欧美发达国家早已为宠物建立了宠物电子档案,这对于宠物的防疫、卫生、安全等起到了重要的管理作用,同时各种新技术不断应用于宠物宠物医院的日常管理工作中,宠物宠物医院在管理上早己实现了规范化、标准化。

相对于欧美发达国家,我国信息化建设从20世纪90年代初开始,信息化程度还处于较低水平,且发展很不平衡,大部分宠物宠物医院的信息化建设还处于以划价收费为中心的信息管理系统,缺少其他业务的信息化管理,造成很多工作还停留在人工操作上,这

就对当前宠物宠物医院的信息化管理造成了很多问题。

随着我国信息技术在宠物宠物医院行业应用程度的不断提高,东南沿海较发达城市已经实现了宠物宠物医院管理的信息化,但是并没有完全普遍,大部分欠发达地区,尤其是小型的社区宠物宠物医院,还是处于传统的管理方式。

虽然目前仍与欧美发达国家存在较大差距,但“十二五”规划,我国提出了信息化建设的“3521工程”,我国宠物宠物医院的信息化建设迎来了发展的好时机。

宠物宠物医院信息化建设的不断进行对宠物医疗卫生行业的发展具有重要的意义,既能提高宠物医院的服务质量,又能方便宠物医院的管理,更为重要的是对于保障宠物防疫、·卫生、安全具有重要意义。

1.3 课题研究的意义

该宠物宠物医院管理系统可以满足宠物宠物医院在信息管理方面的需要,提高宠物宠物医院管理的效率,达到信息管理科学化和规范化的目标。

宠物宠物医院管理系统主要研究的范围是:

1、根据宠物宠物医院管理工作的流程,对用户的功能以及权限进行合理的划分,规范

化工作流程。

  1. 系统在设计时,需要考虑系统的可扩展性和可维护性,满足以后对系统的升级
  2. 本课题的研究成果能够较好地解决宠物宠物医院的管理难题,同时该系统整合了挂号、收费、诊疗、医生绩效考察等功能,既可以帮助宠物医院更好的管理,也可以帮助医生更好的为宠物诊疗。除此之外,该系统对加强城市宠物的管理,确保对宠物审查、监管、防疫检疫等措施的实施,起到很好的辅助作用,保障社区居民安全和公共卫生,促进社区生活和谐。


2 需求分析

2.1 需求描述

项目的使用者可以避免排队挂号,比较方便,也方便于宠物医院的管理。现在的宠物本系统根据华阳社区宠物医院管理工作流程将系统使用者划分为三类,分别为、宠物医生、宠物主人以及系统管理人员,以下是对该三类类用户的具体功能需求分析。

2.2 需求功能描述

1.身份管理

宠物医生登录

宠物主人登录

系统管理员登录

2.系统管理

用户管理

页面管理

角色管理

3.宠物管理

宠物列表

宠物状态

宠物健康史

4.预约管理

预约列表

预约状态

医生时间

5.日常健康

健康指南

健康标准

宠物日志

2.3 用例模型

2.3.1 业务用例模型

宠物医院管理系统主要包括以下几个用例:登录、系统管理、宠物管理、预约管理、日常健康。

登录:不同身份的角色可以登录不同的界面,得到所对应的需求。

系统管理:可以根据自己的需求进行页面管理,并对不同的用户进行权限的管理。

宠物管理:管理员可以从中看到宠物的状态,健康史等等。

预约管理:当业务繁忙的时候,用户可以发起预约。

日常健康:医生可以从中看到健康只能,标准与宠物每天的情况。

具体业务用例模型如图2-1所示。

图2-1系统用例模型

(1)参与者

用户:可以看到宠物的状况,预约的安排,每天的日常安排。

医生:具体的工作安排。

系统管理员:拥有所有的权限。

(2)业务用例

登录:不同身份的角色可以登录不同的界面,得到所对应的需求。

系统管理:可以根据自己的需求进行页面管理,并对不同的用户进行权限的管理。

宠物管理:管理员可以从中看到宠物的状态,健康史等等。

预约管理:当业务繁忙的时候,用户可以发起预约。

日常健康:医生可以从中看到健康只能,标准与宠物每天的情况。

2.3.2 系统用例模型

(1)登录业务的系统用例模型

登录业务的用例规约见表2-1

表2-1 登录业务用例规约

标题

内容

用例名称

用户登录

用例描述

用户想要更多权限必须登录

执行者

用户

前置条件

用户具有操作条件

后置条件

正常流

1.用户登录

1.1 用户输入账号

1.2 用户输入密码

替代流以及异常处理

1.密码不正确时用户无法登录

业务规则

全局规则

Rule00001:用户登录后操作软件

涉及实体

用户

用户登录是用户通过登录账户获得更多权限,登录系统用例图如图2-1所示

图2-1 登录系统用例图

  1. 系统管理业务的系统用例模型。

系统管理业务的用例规约见表2-2

表2-2 系统管理业务用例规约

标题

内容

用例名称

系统管理

用例描述

管理员对系统进行管理

执行者

管理人员

前置条件

系统已经存在

后置条件

正常流

1.管理员进行菜单管理

1.1管理员进行增加菜单

1.2管理员进行查询菜单

1.3管理员进行编辑菜单

1.4管理员进行删除菜单

2.管理员进行角色权限管理

2.1管理员进行增加角色权限

2.2管理员进行查询角色权限

2.3管理员进行编辑角色权限

2.4管理员进行删除角色权限

3.管理员进行用户管理

3.1管理员进行增加用户

3.2管理员进行查询用户

3.3管理员进行编辑用户

3.4管理员进行删除用户

替代流以及异常处理

  1. 当各个列表为空时,无法进行删除编辑操作

业务规则

  1. 全局规则

Rule0001:管理员需要登录后才能操作软件功能

  1. 交互规则

涉及实体

管理员

系统用例图是由软件需求分析到最终实现的第一步,它描述人们如何使用一个系统。该系统用例图的参与者是管理员,管理员可以进行菜单管理,角色管理以及用户管理。菜单管理:增加系统菜单,可以管理系统左边菜单。角色管理:包括添加角色,修改角色,删除角色,编辑角色,系统中有不同的角色,每个角色分配的菜单不同,只有给角色分配菜单后,角色才有相应的菜单。用户管理:添加用户,添加的用户是登陆系统的账户及用户信息,用户的密码为默认密码(可以进行修该),添加用户后需要给用户分配角色,每个角色拥有的菜单不同。系统管理系统用例图如图2-2所示

图2-2 系统管理系统用例图

(3)预约业务的系统用例模型

预约管理问题业务的用例规约见表2-3

表2-3 预约管理业务用例规约

标题

内容

用例名称

宠物预约管理

用例描述

对宠物预约治疗的情况进行查看,修改,删除等等

执行者

宠物医院管理员

前置条件

宠物的档案生成

后置条件

正常流

1.查看宠物预约治疗列表信息

1.1 查看宠物治疗的病情

1.2 查看宠物主人的电话

1.3 查看宠物主人的地址

1.4 查看宠物预约的申请时间

1.5 查看宠物预约的状态

2. 管理员对于宠物预约治疗申请的操作

  2.1 查看宠物预约的状态操作

2.2 处理宠物预约状态

3. 查看预约治疗医生的时间

  3.1 查询医生

  3.2 查询医生的时间

替代流以及异常处理

  1. 提交申请新增后,列表没有该宠物
  2. 提交删除申请后,档案列表没有档案

业务规则

  1. 全局规则

Rule0001:管理员需要登录后进行操作功能

  1. 交互规则

Rule0002:管理员提交相对应的宠物预约信息

涉及实体

宠物实体类

使用预约管理业务用例规约进行系统用例建模,预约管理系统用例图如图2-4所示

图2-3 预约管理系统用例图

  1. 健康指南管理业务的系统用例模型

管理员在该平台上发布宠物健康指南,可对其进行修改删除添加。健康指南管理业务的用例规约见表2-4

表2-4 健康指南管理业务用例规约

标题

内容

用例名称

健康指南管理

用例描述

健康指南管理员管理健康指南药物

执行者

健康指南管理人员

前置条件

管理员已经登录并实时查询健康指南选项

后置条件

完成查询问题后,进行处理

正常流

1.库存药品查询

1.1 库存药品汇总

1.2 库存不足

2. 库房采购问题

  2.1 缺货报警

2.2 健康指南紧急补给

2.3 过期药品报警

2.4 健康指南药品回收

3. 药物入库

  3.1 入库单

4. 药物出库

  4.1 出库单

替代流以及异常处理

1.药物是否过期

业务规则

全局规则

Rule0001:客服管理员需要登录后操作软件功能

交互规则

Rule0002:用户提交相对应的信息

涉及实体

管理员实体,药物实体

使用健康指南管理用例规约进行系统用例建模,健康指南管理系统用例图如图2-4所示

图2-4健康指南管理系统用例图

  1. 宠物管理业务的系统用例模型

宠物管理业务的用例规约见表2-5

表2-5 宠物管理业务用例规约

标题

内容

用例名称

宠物档案管理

用例描述

对宠物的情况进行查看,修改,删除等等

执行者

宠物医院管理员

前置条件

宠物档案生成

后置条件

正常流

1. 申请查看宠物信息

1.1 查看宠物身高

1.2 查看宠物体重

1.3 查看宠物出生日期

1.4 查看宠物的类型

1.5 查看宠物病例

1.6 给宠物预约就诊

2. 查询宠物健康史

  2.1 查看该宠物主人用户

2.2 查看宠物医生

2.3 查看宠物状态

2.4 宠物诊疗建议

3. 删除宠物健康史信息

  3.1 查询诊疗建议

  3.2 删除宠物档案信息

替代流以及异常处理

  1. 提交申请查看后,列表没有该宠物
  2. 提交删除申请后,档案列表没有档案

业务规则

  1. 全局规则

Rule0001:用户需要登录后操作软件功能

  1. 交互规则

Rule0002:用户提交相对应的工单服务地址信息

涉及实体

宠物实体类

使用宠物管理业务用例规约进行系统用例建模,宠物管理系统用例图如图2-1所示

图2-5宠物管理系统用例图

2.4 动态模型

2.4.1 项目泳道图

泳道图,一种UML活动图,能够清晰体现出某个动作发生在哪个部门。绘图元素与传统流程图类似,但在业务流程主体上,通过泳道(纵向条)区分出执行主体,即部门和岗位 来。将模型中的活动按照职责组织起来。这种分配可以通过将活动组织成用线分开的不同 区域来表示。由于它们的外观的缘故,这些区域被称作泳道。它可以方便的描述企业的各 种业务流程,能够直观地描述系统的各活动之间的逻辑关系,利于用户理解业务逻辑。下 图中的课题泳道图头部体现了执行操作的各类角色信息,主体部分体现了该系统主要的操 作流程。泳道图的整体体现了这个系统所要完成的主要功能。按照程序在保证正确性的条件下 执行的顺序,可以看出,系统主要业务:登录、系统管理、宠物管理、预约管理、日常健康等。在此基础上进行相应的延申与判断。

2.4.2 业务泳道图

(1)登录管理业务的泳道图

登录业务用例图如图2-6所示:

用户登录业务的泳道图,见图2-6 用户登录业务泳道图。

图2-6 用户登录业务泳道图

(2)系统管理业务的泳道图

系统管理的业务泳道图如图2-7所示

图2-7 系统管理业务的泳道图

  1. 预约管理业务的泳道图

宠物的主人,宠物店的医生,系统后台管理员分别进行身份验证,宠物主人去宠物店医生那边查看自家宠物的预约情况,预约治疗的措施或预约医生等,宠物店医生可以处理该宠物的预约状态。系统管理的业务泳道图如图2-8所示

图2-8 预约管理业务的泳道图

  1. 健康指南管理业务的泳道图

系统管理的业务泳道图如图2-9所示

图2-9 健康指南管理业务的泳道图

(5)宠物管理业务的泳道图

宠物主人,宠物医生,系统后台分别进行身份验证,宠物主人去宠物医生那边查看自家宠物的一些基本情况,可预约治疗的措施或预约医生等,可以删除该宠物档案,可查询医生对宠物的诊疗建议。

宠物管理系统泳道图如图2-10所示:

图2-10 宠物管理系统泳道图

2.5 静态类模型

2.5.1 分析类图

(1)登录管理系统用例的分析类图

登录管理用例的分析类图如图2-11所示:

图2-11 登录管理用例的分析类图

(2)系统管理系统用例的分析类图

系统管理系统用例的分析类图如图2-12所示

图2-12 系统管理系统用例的分析类图

(3)预约管理系统用例的分析类图

预约管理系统用例的分析类图如图2-13所示

图2-13 预约管理系统用例的分析类图

(4)健康指南管理系统用例的分析类图

健康指南管理用例的分析类图如图2-14所示

图2-14 健康指南管理系统用例的分析类图

(5)宠物管理系统用例的分析类图

宠物管理系统用例的分析类图如图2-15所示:

图2-15 宠物管理系统用例的分析类图

2.5.2 实体类图

实体类图主要展示的实在建模过程中,所用到的各个实体与实体之间的联系。实体间的关系也是按照分析类图进行设计的,其中有的联系为:一对多、一对一、多对一、多对多的关联关系。

登录管理实体类图如图2-16所示:

图2-16 登录管理实体类图

系统管理实体类图如图2-17所示:

图2-17 系统管理实体类图

预约管理实体类图如图2-18所示:

图2-18 预约管理实体类图

健康指南管理实体类图如图2-19所示:

图2-19 健康指南管理实体类图

宠物管理实体类图如图2-20所示:

图2-20宠物管理实体类图


3 子系统设计

3.1 软件体系结构设计

SSM(Spring+SpringMVC+MyBatis)框架集由Spring、MyBatis两个开源框架整合而成(SpringMVC是Spring中的部分内容)。常作为数据源较简单的web项目的框架。

Spring就像是整个项目中装配bean的大工厂,在配置文件中可以指定使用特定的参数去调用实体类的构造方法来实例化对象。也可以称之为项目中的粘合剂。Spring的核心思想是IoC(控制反转),即不再需要程序员去显式地new一个对象,而是让Spring框架帮你来完成这一切。

SpringMVC在项目中拦截用户请求,它的核心Servlet即DispatcherServlet承担中介或是前台这样的职责,将用户请求通过HandlerMapping去匹配Controller,Controller就是具体对应请求所执行的操作。SpringMVC相当于SSH框架中struts。

mybatis是对jdbc的封装,它让数据库底层操作变的透明。mybatis的操作都是围绕一个sqlSessionFactory实例展开的。mybatis通过配置文件关联到各实体类的Mapper文件,Mapper文件中配置了每个类对数据库所需进行的sql语句映射。在每次与数据库交互时,通过sqlSessionFactory拿到一个sqlSession,再执行sql命令。

页面发送请求给控制器,控制器调用业务层处理逻辑,逻辑层向持久层发送请求,持久层与数据库交互,后将结果返回给业务层,业务层将处理逻辑发送给控制器,控制器再调用视图展现数据。

体系结构图如图3-1所示。

图3-1体系结构设计图

体系结构包图如图3-2所示。

图3-2体系结构包图

3.2 软件功能总体设计

图3-3层次方框图

3.3 软件功能详细设计

3.3.1 登录管理功能

登录管理设计类图如图3-4所示

图3-4 登录管理设计类图

  1. 表示层设计

采用的是 MVC 设计模式,get()方法,可以获得用户的操作选项,或者将用户的需要用的数值接收,init()将用户申请的数据展示在客户端,post()时更新操作,用户更新信息的操作传入数据库,alert()将警告信息展示在客户端,提示用户操作有错误。

(2)业务逻辑层设计

业务逻辑层是专门处理软件业务需求的一层,处于数据库之上,服务层之下,完成一些列对Domain Object的CRUD,作为一组微服务提供给服务层来组织在暴露给表现层。如图3-5 用户登录业务逻辑层设计图。

活动图如图3-5所示

图3-5 活动图

(3)数据访问层设计

数据访问层设计提供了各种数据库操作的接口,通过MyBatis的动态映射在XML,有多个方法。登录管理顺序图如图3-6所示

图3-6登录管理顺序图

3.3.2 系统管理功能

系统管理设计类图如图3-7所示

图3-7 系统管理设计类图

  1. 表示层设计

采用的是 MVC 设计模式,View层的get()方法,可以获得客服人员的操作选项,或者将客服人员的需要用的数值接收,init()将登录申请的数据展示在客户端,post()时更新操作,登录更新信息的操作传入数据库,

  1. 业务逻辑层设计

将数据访问层查询出的数据进行封装,通过getinformation ()得到所有的已经完成的病例信息,将处理的结算结果封装成对应的数据,并且在业务逻辑层实现内容的判断是否符合要求。如果不符合则需要提示客服内容不合法,否则提示结算成功。

  1. 数据访问层设计

数据访问层设计提供了各种数据库操作的接口,通过MyBatis的动态映射在XML,有多个方法。

系统管理顺序图如图3-8所示

3-8系统管理顺序图

3.3.3 预约管理功能

对系统所涉及到的预约管理的功能都要进行设定,需要严格判断宠物档案列表是否有该宠物,并且预约该宠物的情况。存储时还要对当前数据库中存储的系统开放时间进行判断,具体判断如下:

1. 首先用户查询的宠物列表必须有该宠物。若满足可以进行下一步判断,若不满足则提示宠物列表为空,不可进行操作;

2. 其次在满足入宠物列表有该宠物前提下,在判断该宠物档案表是否有该宠物,若是有则可进行预约该宠物,若没有无法进行操作;

预约管理设计类图如图3-4所示

图3-9 预约管理设计类图

(3)数据访问层设计

数据访问层设计提供了各种数据库操作的接口,通过MyBatis的动态映射在XML,有多个方法。办理预约管理顺序图如图3-10所示

图3-10预约管理顺序图

3.3.4 健康指南管理功能

发布指南功能

管理员可自行对指南框进行增加删除修改查询清空等操作,在修改完毕后,用户可以查看其内容。

表示层设计

采用的是 MVC 设计模式,xzx2_Orders.Generate.Controller.Web 控制器对外提供访问接口, getOrderGenerateDetail()获取指南类的列表详情,submitOrder()提交指南界面。健康指南设计类图如图3-11所示

图3-11 健康指南管理设计类图

(3)数据访问层设计

数据访问层设计提供了各种数据库操作的接口,通过MyBatis的动态映射在XML,有多个方法。健康指南管理顺序图如图3-12所示

图3-12健康指南管理顺序图

3.3.5 宠物管理功能

对系统所涉及到的宠物管理的功能都要进行设定,需要严格判断宠物档案列表是否有该宠物,并且严格查询该宠物的健康史。存储时还要对当前数据库中存储的系统开放时间进行判断,具体判断如下:

1. 首先用户查询的宠物列表列表必须有该宠物。若满足可以进行下一步判断,若不满足则提示宠物列表为空,不可进行操作;

2. 其次在满足入宠物列表有该宠物前提下,在判断该宠物档案表是否有该宠物,若是有则可进行删除档案,若没有无法进行操作;

宠物管理设计类图如图3-13所示

图3-13 宠物管理设计类图

(3)数据访问层设计

数据访问层设计提供了各种数据库操作的接口,通过MyBatis的动态映射在XML,有多个方法。宠物管理顺序图如图3-14所示

图3-14宠物管理顺序图

3.4 数据库设计

3.4.1 系统概念模型

系统的E-R图如图3-13所示

图3-13系统E-R图

3.4.2 数据表设计

    1. 用户(role)数据表,角色的身份权限,见表3-1

表3-1 role表

 序号

名称

类型

长度

是否主键

说明

1

Id

varchar

10

用户编号

2

Desc

Varchar

10

用户身份

3

Name

varchar

30

用户姓名

    1. 角色页数(role_page)数据表,用于存储角色事务的页数,见表3-2

表3-2 role_page表

 序号

名称

类型

长度

是否主键

说明

1

Rp_Id

Number

10

业务编号

2

Role_id

Number

10

角色编号

3

Page_id

Number

30

页数

    1. 标准(standard)数据表,用于存储宠物的标准情况,见表3-3

表3-3 standard表

序号

名称

类型

长度

是否主键

说明

1

Id

int

30

编号

2

Age_min

Varchar

25

年龄最小

3

Age_max

Number

20

年龄最大

4

Temp_min

Number

20

温度最小

5

Temp_max

Number

20

温度最大

6

Weight_min

Number

20

体重最小

7

Weight_max

Number

20

体重最大

8

Height_min

Number

20

高度最小

9

Height_max

Number

20

高度最高

10

Appetite_min

Number

20

进食量最小

11

Appetite_max

Number

20

进食量最大

12

Type

Number

20

种类

13

Status

Number

20

状态

    1. 用户信息(user)数据表,用于存储用户信息,见表3-4

表3-4 user表

序号

名称

类型

长度

是否主键

说明

1

Id

int

30

编号

2

Age

Number

20

年龄

3

Name

varchar

30

姓名

4

Password

varchar

30

密码

5

Phone

Number

20

电话

6

Adress

varchar

30

地址

    1. 用户角色(user_role)数据表,用于存储用户信息,见表3-5

表3-5 user_role表

 序号

名称

类型

长度

是否主键

说明

1

Ur_Id

Number

10

业务编号

2

User_id

Number

10

用户编号

3

Role_id

Number

30

角色编号

    1. 业务(appointment)数据表,用于业务订单信息,见表3-6

表3-6 appointment表

序号

名称

类型

长度

是否主键

说明

1

Id

bigint

20

编号

1

Id

varchar

30

订单编号

2

3

4

5

6

7

8

pet_id

user_id

doctor_id

app_time

info

create_time

status

bigint

bigint

bigint

datetime

varchar

datetime

int

20

20

20

20

255

20

20

商品名称

宠物编号

医生编号

App时间

信息

创建时间

状态        

9

10

phone

address

varchar

varchar

255

255

电话

地址

    1. 诊断(diagnosi)数据表,用于存储宠物诊断接种信息,见表3-7

表3-7 diagnosi表

序号

名称

类型

长度

是否主键

说明

1

Id

bigint

20

编号

2

3

4

5

6

7

8

pet_id

user_id

doctor_id

info

type

status

create_time

bigint

bigint

bigint

varchar

int

int

datetime

20

20

20

255

20

20

20

宠物编号

用户编号

医生编号

信息

类型

状态

创建时间        

(8)指南(notice)数据表,用于记录科室信息,见表3-8

表3-8 notice表

序号

名称

类型

长度

是否主键

说明

1

Id

bigint

20

编号

2

content

Varchar

255

内容

3

view_count

bigint

20

计数

4

5

create_time

title

datetime

varchar

20

255

创建时间

标题

(9)页数(page)数据表,用于网页系统url的信息,见表3-9

表3-12 page表

序号

名称

类型

长度

是否主键

说明

1

page_id

int

20

分页编号

2

3

4

5

6

7

8

parent_id

name

url

level_type

level_index

delete_flag

desc

int

varchar

Varchar

Int

int

int

Varchar

20

255

255

20

20

1

255

父母编号

姓名

链接

水平类型

水平指数

删除

描述

(10)宠物(pet)数据表,用于存储用户宠物信息,见表3-10

表3-10 pet表

序号

名称

类型

长度

是否主键

说明

1

2

3

4

5

6

Id

Name

Weight

Height

Type

Birthday

Varchar

Varchar

Number

Number

Number

Date

110

50

11

20

20

100

编号

姓名

体重

身高

种类

生日

(12)宠物信息(pet_daily)数据表,用于存储宠物身体信息,见表3-12

表3-15 workorder表

序号

名称

类型

长度

是否主键

说明

1

Id

int

30

编号

2

Pet_id

Varchar

25

宠物编号

3

User_id

Number

20

用户编号

4

Temp

Number

20

温度

5

Weight

Number

20

体重

6

Height

Number

20

身高

7

Appetite

Number

20

进食情况

8

Status

Number

20

状态

9

Time

Data

20

创建时间


4 子系统实现

功能介绍

用于查询宠物店预约列表情况,可以管理员进行删除和查询。

(1)控制层编码实现

package com.phms.controller.user;

import com.phms.pojo.Appointment;
import com.phms.pojo.User;
import com.phms.service.AppointmentService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;

/**
 * 用户预约
 */
@Controller("UserApplyController")
@RequestMapping("/user/apply")
public class UserApplyController {
    @Autowired
    private AppointmentService appointmentService;


    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    /**
     * 医生管理预约页面
     * user/applyListDoctor.html
     */
    @RequestMapping("/applyListDoctor")
    public String applyListDoctor(Long petId, Model model) {
        if (petId!=null){
            model.addAttribute("petId", petId);
        }
        return "user/applyListDoctor";
    }

    /**
     * 普通用户预约页面
     * user/applyList.html
     */
    @RequestMapping("/applyList")
    public String applyList(Long petId, Model model) {
        if (petId!=null){
            model.addAttribute("petId", petId);
        }
        return "user/applyList";
    }
    /**
     * 普通用户返回查询数据渲染表格
     */
    @RequestMapping("/getAllByLimit")
    @ResponseBody
    public Object getAllByLimit(Appointment appointment) {
        Subject subject = SecurityUtils.getSubject();
        User user = (User) subject.getPrincipal();
        appointment.setUserId(user.getId());
        return appointmentService.getAllByLimit(appointment);
    }
    /**
     * 医生角色返回查询数据渲染表格
     */
    @RequestMapping("/getAllByLimitDoctor")
    @ResponseBody
    public Object getAllByLimitBaoJie(Appointment appointment) {
        return appointmentService.getAllByLimit(appointment);
    }

    /**
     * 根据id删除预约
     */
    @RequestMapping(value = "/del")
    @ResponseBody
    @Transactional
    public String delUser(Long id) {
        try {
            appointmentService.deleteById(id);
            return "SUCCESS";
        } catch (Exception e) {
            logger.error("删除异常", e);
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return "ERROR";
        }
    }

    /**
     * 添加预约页面 user/applyAdd.html
     */
    @RequestMapping(value = "/add")
    public String addUserPage(Long id, Model model) {
        model.addAttribute("petId", id);
        return "user/applyAdd";
    }

    /**
     * 预约信息插入数据库
     */
    @RequestMapping(value = "/doAdd")
    @ResponseBody
    @Transactional
    public String doAdd(Appointment appointment) {
        Subject subject = SecurityUtils.getSubject();
        User user = (User) subject.getPrincipal();
        if (appointment.getPetId() == null){
            return "noPetId";
        }
        try {
            // 当前预约人的id
            appointment.setUserId(user.getId());
            appointment.setCreateTime(new Date());
            // 状态:1申请中,2申请通过,3不通过,4已完成
            appointment.setStatus(1);
            appointmentService.add(appointment);
            return "SUCCESS";
        } catch (Exception e) {
            logger.error("添加异常", e);
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return "ERROR";
        }
    }

    /**
     * 改变预约状态
     */
    @RequestMapping(value = "/chStatus")
    @ResponseBody
    @Transactional
    public String chStatus(Appointment appointment) {
        Subject subject = SecurityUtils.getSubject();
        User user = (User) subject.getPrincipal();


        try {
            appointment.setDoctorId(user.getId());
            appointmentService.update(appointment);
            // 就诊
            if (appointment.getStatus() == 4){
                return "jz";
            }
            return "SUCCESS";
        } catch (Exception e) {
            logger.error("添加异常", e);
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return "ERROR";
        }
    }
}

(2)Service层编码实现

package com.phms.service;

import com.phms.pojo.Appointment;

import java.util.List;
import java.util.Map;

public interface AppointmentService {
    Object getAllByLimit(Appointment appointment);

    void deleteById(Long id);

    void add(Appointment appointment);

    void update(Appointment appointment);

    Appointment getById(Long id);

    List<Map<String, Object>> getFreeTimeById(Long docId, String s);
}

(3)Mapper层编码实现

package com.phms.mapper;

import com.phms.pojo.Appointment;
import com.phms.pojo.AppointmentExample;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface AppointmentMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table appointment
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    long countByExample(AppointmentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table appointment
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int deleteByExample(AppointmentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table appointment
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table appointment
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int insert(Appointment record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table appointment
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int insertSelective(Appointment record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table appointment
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    List<Appointment> selectByExample(AppointmentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table appointment
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    Appointment selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table appointment
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int updateByExampleSelective(@Param("record") Appointment record, @Param("example") AppointmentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table appointment
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int updateByExample(@Param("record") Appointment record, @Param("example") AppointmentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table appointment
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int updateByPrimaryKeySelective(Appointment record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table appointment
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int updateByPrimaryKey(Appointment record);

    List<Appointment> getAllByLimit(Appointment appointment);

    int countAllByLimit(Appointment appointment);

    List<Map<String, Object>> getFreeTimeById(@Param("id") Long id, @Param("s") String s);
}

4.2 用户管理功能实现

功能介绍

用于查询宠物店用户列表情况,可以管理员进行删除和查询、增加。

(1)控制层编码实现

package com.phms.controller.user;

import com.phms.model.ResultMap;
import com.phms.pojo.User;
import com.phms.service.UserRoleService;
import com.phms.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 用户控制
 */
@Controller("User")
@RequestMapping("/user")
public class UserController {
    private final Logger logger = LoggerFactory.getLogger(UserController.class);
    private final ResultMap resultMap;
    @Autowired
    private UserService userService;

    @Autowired
    private UserRoleService userRoleService;

    @Autowired
    public UserController(ResultMap resultMap) {
        this.resultMap = resultMap;
    }

    /**
     * 返回有权限信息
     */
    @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";
    }

    /**
     * 更新数据库
     */
    @ResponseBody
    @RequestMapping("/updateUser")
    public String updateUser(User user) {
        return userService.updateUser(user);
    }
}

(2)Service层编码实现

package com.phms.service;

import com.phms.model.ResultMap;
import com.phms.pojo.User;
import com.phms.pojo.UserParameter;

import java.util.List;

public interface UserService {
   User selectUserByUserId(Long userId);

   public ResultMap login(String username, String password);

   public boolean checkUserPassword(String password);

   public String updatePassword(String password);

   Object getAllUserByRoleId(Integer roleId, Integer page, Integer limit);

   Object getAllUserByNotRoleId(Integer roleId, Integer page, Integer limit);

   User selectByPrimaryKey(Long userId);

   List<User> getAdmins();

   Object getAllUserByLimit(UserParameter userParameter);

   void delUserById(Long id);

   void addUser(User user) throws Exception;

   String updateUser(Long oldId, User user);

   String updateUser(User user);

   List<User> getAllUser();

   User getAdminById(Long userId);

   Object getAllDelUserByLimit(UserParameter userParameter);

   List<User> selectAllUser();

   User getUserByPhoneAndName(String phone, String name);

    void save(User user);

   User getByIdCard(String idCard);

    List<User> listDoctor();
}

(3)Mapper层编码实现

package com.phms.mapper;

import com.phms.pojo.User;
import com.phms.pojo.UserExample;
import com.phms.pojo.UserParameter;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public interface UserMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table user
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    long countByExample(UserExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table user
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int deleteByExample(UserExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table user
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table user
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int insert(User record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table user
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int insertSelective(User record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table user
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    List<User> selectByExample(UserExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table user
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    User selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table user
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int updateByExampleSelective(@Param("record") User record, @Param("example") UserExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table user
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int updateByExample(@Param("record") User record, @Param("example") UserExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table user
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int updateByPrimaryKeySelective(User record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table user
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int updateByPrimaryKey(User record);


    int countAllUserByRoleId(Integer roleId);

    List<User> getAllUserByRoleId(@Param("roleId") Integer roleId,
                                  @Param("begin") Integer begin, @Param("count") Integer count);

    int countAllUserByNotRoleId(Integer roleId);

    List<User> getAllUserByNotRoleId(@Param("roleId") Integer roleId,
                                     @Param("begin") Integer begin, @Param("count") Integer count);

    List<User> getAllUserByLimit(UserParameter userParameter);

    int countAllUserByLimit(UserParameter userParameter);

    List<User> getAllDelUserByLimit(UserParameter userParameter);

    int countAllDelUserByLimit(UserParameter userParameter);

    List<User> selectAllUser();

    User getByName(@Param("username") String username);

    User getUserByPhoneAndName(@Param("phone") String phone, @Param("name")String name);

    User selectByIdCard(@Param("idCard") String idCard);
}

用于查询宠物店宠物列表情况,可以管理员进行删除和查询、增加。

(1)控制层编码实现

package com.phms.controller.user;

import com.phms.pojo.Appointment;
import com.phms.pojo.Diagnosis;
import com.phms.pojo.User;
import com.phms.service.AppointmentService;
import com.phms.service.DiagnosisService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;

/**
 * 宠物健康史
 */
@Controller("UserDiagnosisController")
@RequestMapping("/user/diagnosis")
public class UserDiagnosisController {
    @Autowired
    private DiagnosisService diagnosisService;
    @Autowired
    private AppointmentService appointmentService;

    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    /**
     * 医生宠物健康史页面user/diagnosisListDoctor.html
     */
    @RequestMapping("/diagnosisListDoctor")
    public String diagnosisListDoctor(Long petId, Model model) {
        if (petId!=null){
            model.addAttribute("petId", petId);
        }else {
            model.addAttribute("petId", "petId");
        }
        return "user/diagnosisListDoctor";
    }
    /**
     * 普通用户宠物健康史页面user/diagnosisList.html
     */
    @RequestMapping("/diagnosisList")
    public String diagnosisList(Long petId, Model model) {
        if (petId!=null){
            model.addAttribute("petId", petId);
        }else {
            model.addAttribute("petId", "petId");
        }
        return "user/diagnosisList";
    }
    /**
     * 普通用户返回查询数据
     */
    @RequestMapping("/getAllByLimit")
    @ResponseBody
    public Object getAllByLimit(Diagnosis diagnosis) {
        Subject subject = SecurityUtils.getSubject();
        User user = (User) subject.getPrincipal();
        diagnosis.setUserId(user.getId());
        return diagnosisService.getAllByLimit(diagnosis);
    }
    /**
     * 医生返回查询数据
     */
    @RequestMapping("/getAllByLimitDoctor")
    @ResponseBody
    public Object getAllByLimitBaoJie(Diagnosis diagnosis) {
        return diagnosisService.getAllByLimit(diagnosis);
    }

    /**
     * 删除记录
     */
    @RequestMapping(value = "/del")
    @ResponseBody
    @Transactional
    public String del(Long id) {
        try {
            diagnosisService.deleteById(id);
            return "SUCCESS";
        } catch (Exception e) {
            logger.error("删除异常", e);
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return "ERROR";
        }
    }

    /**
     * 增加页面user/diagnosisAdd.html
     */
    @RequestMapping(value = "/add")
    public String add(Long id, Model model) {
        Appointment byId = appointmentService.getById(id);
        model.addAttribute("userId", byId.getUserId());
        model.addAttribute("petId", byId.getPetId());
        return "user/diagnosisAdd";
    }

    /**
     * 插入数据库
     */
    @RequestMapping(value = "/doAdd")
    @ResponseBody
    @Transactional
    public String doAdd(Diagnosis diagnosis) {
        Subject subject = SecurityUtils.getSubject();
        User user = (User) subject.getPrincipal();
        try {
            // 医生登录id
            diagnosis.setDoctorId(user.getId());
            diagnosis.setCreateTime(new Date());
            // 状态:1申请中,2申请通过,3不通过,4已完成
            diagnosis.setStatus(1);
            diagnosisService.add(diagnosis);
            return "SUCCESS";
        } catch (Exception e) {
            logger.error("添加异常", e);
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return "ERROR";
        }
    }

    /**
     * 修改状态
     */
    @RequestMapping(value = "/chStatus")
    @ResponseBody
    @Transactional
    public String chStatus(Diagnosis diagnosis) {
        Subject subject = SecurityUtils.getSubject();
        User user = (User) subject.getPrincipal();
        try {
            // 医生登录id
            diagnosis.setDoctorId(user.getId());
            diagnosisService.update(diagnosis);
            return "SUCCESS";
        } catch (Exception e) {
            logger.error("添加异常", e);
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return "ERROR";
        }
    }
}

(2)Service层编码实现

package com.phms.service;

import com.phms.pojo.Diagnosis;

public interface DiagnosisService {
    void update(Diagnosis diagnosis);

    void add(Diagnosis diagnosis);

    void deleteById(Long id);

    Object getAllByLimit(Diagnosis diagnosis);
}

(3)Mapper层编码实现

package com.phms.mapper;

import com.phms.pojo.Diagnosis;
import com.phms.pojo.DiagnosisExample;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface DiagnosisMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table diagnosis
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    long countByExample(DiagnosisExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table diagnosis
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int deleteByExample(DiagnosisExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table diagnosis
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table diagnosis
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int insert(Diagnosis record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table diagnosis
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int insertSelective(Diagnosis record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table diagnosis
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    List<Diagnosis> selectByExample(DiagnosisExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table diagnosis
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    Diagnosis selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table diagnosis
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int updateByExampleSelective(@Param("record") Diagnosis record, @Param("example") DiagnosisExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table diagnosis
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int updateByExample(@Param("record") Diagnosis record, @Param("example") DiagnosisExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table diagnosis
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int updateByPrimaryKeySelective(Diagnosis record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table diagnosis
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int updateByPrimaryKey(Diagnosis record);

    List<Diagnosis> getAllByLimit(Diagnosis diagnosis);

    int countAllByLimit(Diagnosis diagnosis);
}

4.4 医院管理功能实现

功能介绍

用于查询宠物店医院指南情况,可以管理员进行编辑和查询、增加。

(1)控制层编码实现

package com.phms.controller.user;


import com.phms.pojo.Notice;
import com.phms.service.NoticeService;
import com.phms.utils.MyUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.ui.Model;
import java.util.Date;

/**
 * 健康指南
 */
@Controller("UserNoticeController")
@RequestMapping("/user/notice")
public class UserNoticeController {
    @Autowired
    private NoticeService noticeService;

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    /**
     * 查看详情页面/user/xqWord.html
     */
    @RequestMapping("/xq")
    public String xq(Long id, Model model) {
        noticeService.view(id);
        Notice word = noticeService.getById(id);
        System.out.println(word.getContent());
        model.addAttribute("c", word.getContent());
        model.addAttribute("title", word.getTitle());
        model.addAttribute("view", word.getViewCount());
        model.addAttribute("time", MyUtils.getDate2String(word.getCreateTime()));
        return "/user/xqWord";
    }

    /**
     * 普通用户查看列表/user/wordList.html
     */
    @RequestMapping("/list")
    public String list() {
        return "/user/wordList";
    }

    /**
     * 医生查看列表/user/wordListDoctor.html
     */
    @RequestMapping("/listDoctor")
    public String listDoctor() {
        return "/user/wordListDoctor";
    }

    /**
     * 医生发布指南页面/user/word.html
     */
    @RequestMapping("/publish")
    public String publish() {
        return "/user/word";
    }

    /**
     * 添加到数据库
     */
    @ResponseBody
    @RequestMapping("/addWord")
    public String addWord(Notice notice) {
        try {
            notice.setCreateTime(new Date());
            notice.setViewCount(0L);
            noticeService.add(notice);
            return "SUCCESS";
        } catch (Exception e) {
            e.printStackTrace();
            return "ERR";
        }
    }

    /**
     * 获取所有指南数据
     */
    @RequestMapping("/getAllWordByLimit")
    @ResponseBody
    public Object getAllWordByLimit(Notice word) {
        return noticeService.getAllByLimit(word);
    }

    /**
     * 删除指南
     */
    @ResponseBody
    @RequestMapping("/delWord")
    public String delWord(String[] ids) {
        try {
            for (String id : ids){
                noticeService.deleteById(Long.parseLong(id));
            }
            return "SUCCESS";
        } catch (Exception e) {
            e.printStackTrace();
            return "ERR";
        }
    }
}

(2)Service层编码实现

package com.phms.service;

import com.phms.pojo.Notice;

public interface NoticeService {
    void update(Notice notice);

    void add(Notice notice);

    void deleteById(Long id);

    Object getAllByLimit(Notice notice);

    Notice getById(Long id);

    void view(Long id);
}

(3)Mapper层编码实现

package com.phms.mapper;

import com.phms.pojo.Notice;
import com.phms.pojo.NoticeExample;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface NoticeMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table notice
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    long countByExample(NoticeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table notice
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int deleteByExample(NoticeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table notice
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table notice
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int insert(Notice record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table notice
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int insertSelective(Notice record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table notice
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    List<Notice> selectByExample(NoticeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table notice
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    Notice selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table notice
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int updateByExampleSelective(@Param("record") Notice record, @Param("example") NoticeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table notice
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int updateByExample(@Param("record") Notice record, @Param("example") NoticeExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table notice
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int updateByPrimaryKeySelective(Notice record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table notice
     *
     * @mbg.generated Mon Apr 06 17:03:33 CST 2020
     */
    int updateByPrimaryKey(Notice record);

    List<Notice> getAllByLimit(Notice po);

    int countAllByLimit(Notice po);
}

有关基于Springboot的宠物医院管理系统-JAVA【毕业设计、论文、源码、开题报告】的更多相关文章

  1. java - 等价于 Java 中的 Ruby Hash - 2

    我真的很习惯使用Ruby编写以下代码:my_hash={}my_hash['test']=1Java中对应的数据结构是什么? 最佳答案 HashMapmap=newHashMap();map.put("test",1);我假设? 关于java-等价于Java中的RubyHash,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/22737685/

  2. java - 从 JRuby 调用 Java 类的问题 - 2

    我正在尝试使用boilerpipe来自JRuby。我看过guide从JRuby调用Java,并成功地将它与另一个Java包一起使用,但无法弄清楚为什么同样的东西不能用于boilerpipe。我正在尝试基本上从JRuby中执行与此Java等效的操作:URLurl=newURL("http://www.example.com/some-location/index.html");Stringtext=ArticleExtractor.INSTANCE.getText(url);在JRuby中试过这个:require'java'url=java.net.URL.new("http://www

  3. java - 我的模型类或其他类中应该有逻辑吗 - 2

    我只想对我一直在思考的这个问题有其他意见,例如我有classuser_controller和classuserclassUserattr_accessor:name,:usernameendclassUserController//dosomethingaboutanythingaboutusersend问题是我的User类中是否应该有逻辑user=User.newuser.do_something(user1)oritshouldbeuser_controller=UserController.newuser_controller.do_something(user1,user2)我

  4. java - 什么相当于 ruby​​ 的 rack 或 python 的 Java wsgi? - 2

    什么是ruby​​的rack或python的Java的wsgi?还有一个路由库。 最佳答案 来自Python标准PEP333:Bycontrast,althoughJavahasjustasmanywebapplicationframeworksavailable,Java's"servlet"APImakesitpossibleforapplicationswrittenwithanyJavawebapplicationframeworktoruninanywebserverthatsupportstheservletAPI.ht

  5. 叮咚买菜基于 Apache Doris 统一 OLAP 引擎的应用实践 - 2

    导读:随着叮咚买菜业务的发展,不同的业务场景对数据分析提出了不同的需求,他们希望引入一款实时OLAP数据库,构建一个灵活的多维实时查询和分析的平台,统一数据的接入和查询方案,解决各业务线对数据高效实时查询和精细化运营的需求。经过调研选型,最终引入ApacheDoris作为最终的OLAP分析引擎,Doris作为核心的OLAP引擎支持复杂地分析操作、提供多维的数据视图,在叮咚买菜数十个业务场景中广泛应用。作者|叮咚买菜资深数据工程师韩青叮咚买菜创立于2017年5月,是一家专注美好食物的创业公司。叮咚买菜专注吃的事业,为满足更多人“想吃什么”而努力,通过美好食材的供应、美好滋味的开发以及美食品牌的孵

  6. Observability:从零开始创建 Java 微服务并监控它 (二) - 2

    这篇文章是继上一篇文章“Observability:从零开始创建Java微服务并监控它(一)”的续篇。在上一篇文章中,我们讲述了如何创建一个Javaweb应用,并使用Filebeat来收集应用所生成的日志。在今天的文章中,我来详述如何收集应用的指标,使用APM来监控应用并监督web服务的在线情况。源码可以在地址 https://github.com/liu-xiao-guo/java_observability 进行下载。摄入指标指标被视为可以随时更改的时间点值。当前请求的数量可以改变任何毫秒。你可能有1000个请求的峰值,然后一切都回到一个请求。这也意味着这些指标可能不准确,你还想提取最小/

  7. 【Java 面试合集】HashMap中为什么引入红黑树,而不是AVL树呢 - 2

    HashMap中为什么引入红黑树,而不是AVL树呢1.概述开始学习这个知识点之前我们需要知道,在JDK1.8以及之前,针对HashMap有什么不同。JDK1.7的时候,HashMap的底层实现是数组+链表JDK1.8的时候,HashMap的底层实现是数组+链表+红黑树我们要思考一个问题,为什么要从链表转为红黑树呢。首先先让我们了解下链表有什么不好???2.链表上述的截图其实就是链表的结构,我们来看下链表的增删改查的时间复杂度增:因为链表不是线性结构,所以每次添加的时候,只需要移动一个节点,所以可以理解为复杂度是N(1)删:算法时间复杂度跟增保持一致查:既然是非线性结构,所以查询某一个节点的时候

  8. 基于C#实现简易绘图工具【100010177】 - 2

    C#实现简易绘图工具一.引言实验目的:通过制作窗体应用程序(C#画图软件),熟悉基本的窗体设计过程以及控件设计,事件处理等,熟悉使用C#的winform窗体进行绘图的基本步骤,对于面向对象编程有更加深刻的体会.Tutorial任务设计一个具有基本功能的画图软件**·包括简单的新建文件,保存,重新绘图等功能**·实现一些基本图形的绘制,包括铅笔和基本形状等,学习橡皮工具的创建**·设计一个合理舒适的UI界面**注明:你可能需要先了解一些关于winform窗体应用程序绘图的基本知识,以及关于GDI+类和结构的知识二.实验环境Windows系统下的visualstudio2017C#窗体应用程序三.

  9. 计算机毕业设计ssm+vue基本微信小程序的小学生兴趣延时班预约小程序 - 2

    项目介绍随着我国经济迅速发展,人们对手机的需求越来越大,各种手机软件也都在被广泛应用,但是对于手机进行数据信息管理,对于手机的各种软件也是备受用户的喜爱小学生兴趣延时班预约小程序的设计与开发被用户普遍使用,为方便用户能够可以随时进行小学生兴趣延时班预约小程序的设计与开发的数据信息管理,特开发了小程序的设计与开发的管理系统。小学生兴趣延时班预约小程序的设计与开发的开发利用现有的成熟技术参考,以源代码为模板,分析功能调整与小学生兴趣延时班预约小程序的设计与开发的实际需求相结合,讨论了小学生兴趣延时班预约小程序的设计与开发的使用。开发环境开发说明:前端使用微信微信小程序开发工具:后端使用ssm:VU

  10. kvm虚拟机安装centos7基于ubuntu20.04系统 - 2

    需求:要创建虚拟机,就需要给他提供一个虚拟的磁盘,我们就在/opt目录下创建一个10G大小的raw格式的虚拟磁盘CentOS-7-x86_64.raw命令格式:qemu-imgcreate-f磁盘格式磁盘名称磁盘大小qemu-imgcreate-f磁盘格式-o?1.创建磁盘qemu-imgcreate-fraw/opt/CentOS-7-x86_64.raw10G执行效果#ls/opt/CentOS-7-x86_64.raw2.安装虚拟机使用virt-install命令,基于我们提供的系统镜像和虚拟磁盘来创建一个虚拟机,另外在创建虚拟机之前,提前打开vnc客户端,在创建虚拟机的时候,通过vnc

随机推荐