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

news2024/10/5 14:15:58

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);
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/66808.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

HummerRisk V0.6.0发布:升级列表高级搜索功能,扩充对象存储和操作审计支持范围等

HummerRisk V0.6.0发布&#xff1a;新增表头高级搜索功能&#xff0c;可按名称快速搜索与组合查询&#xff0c;动态调整显示列&#xff0c;新增对象存储七牛云与青云类型&#xff0c;新增操作审计火山引擎&#xff08;火山云&#xff09;类型。 感谢社区中小伙伴们的反馈&…

用DIV+CSS技术设计的西安旅游网站18页(web前端网页制作课作业)HTML+CSS旅游网站设计与实现

&#x1f468;‍&#x1f393;静态网站的编写主要是用 HTML DⅣV CSSJS等来完成页面的排版设计&#x1f469;‍&#x1f393;&#xff0c;一般的网页作业需要融入以下知识点&#xff1a;div布局、浮动定位、高级css、表格、表单及验证、js轮播图、音频视频Fash的应用、uli、下拉…

C# WPF 基础等待动画Loading...动态转圈 Storyboard ContentControl

这个效果图...直接放上吧&#xff0c;实际是转圈效果&#xff0c;使用起来最方便的一种。 【这是个基础版&#xff0c;灵活度很高】 Xaml 绘制Loading图案&#xff0c;及触发的动画效果&#xff0c;实际控制的每个组件 Opacity - 透明度 属性。 <Style TargetType"{x…

元宇宙工程系,来了一位“吃螃蟹”者

转自《中国科学报》 记者 温才妃 潘志庚&#xff08;右&#xff09;给学生讲授元宇宙技术。受访者供图 元宇宙办学潮正在高校中暗涌。 不久前&#xff0c;南京信息工程大学人工智能学院&#xff08;未来技术学院&#xff09;信息工程系正式更名为元宇宙工程系&#xff0c;成为…

【密码加密原则二】

目录 1 密码加密原则&#xff08;续&#xff09; 1.1 使用加盐的方式可以使得“密码” 1.2 优缺点 1 密码加密原则&#xff08;续&#xff09; 1.1 使用加盐的方式可以使得“密码” 如果用户的密码过于简单&#xff0c;使用加盐的方式可以使得“密码”&#xff08;其实是…

数据结构-八大排序

八大排序一&#xff0c;直接插入排序二&#xff0c;希尔排序三&#xff0c;选择排序四&#xff0c;堆排序五&#xff0c;冒泡排序六&#xff0c;快速排序1&#xff0c;递归版本&#xff08;1&#xff09;hoare法&#xff08;2&#xff09;挖坑法&#xff08;3&#xff09;前后指…

5 年 Python ,总结的 10 条 Python 使用技巧

今天给大家分享 10 个我平时整理非常实用的 Python 开发小技巧&#xff0c;内容目录如下&#xff1a; 值得一提的是&#xff0c;这 10 个技巧全部收录在我自己写的 《Python黑魔法指南》里。 1. 如何在运行状态查看源代码&#xff1f; 查看函数的源代码&#xff0c;我们通常…

Apache Drill的学习

Drill的下载地址&#xff1a; Index of /dist/drill 上传安装包后&#xff0c;解压&#xff0c;测试环境中&#xff0c;我直接放到/root目录下了 tar -zxvf apache-drill-1.11.0.tar.gz 进入/root/apache-drill-1.11.0/bin 启动命令&#xff1a; ./sqlline -u jdbc:drill:…

VMware创建Linux虚拟机之(四)ZooKeeperHBase完全分布式安装

Hello&#xff0c;world&#xff01; &#x1f412;本篇博客使用到的工具有&#xff1a;VMware16 &#xff0c;Xftp7 若不熟悉操作命令&#xff0c;推荐使用带GUI页面的CentOS7虚拟机 我将使用带GUI页面的虚拟机演示 虚拟机&#xff08;Virtual Machine&#xff09; 指通过软…

C语言基础

文章目录二. 前言1.vscode 搭建C语言开发环境2.编程语言的演变2-1.计算机语言2-2 解释型vs编译型2-2 面向过程vs面向对象三. C语言基础0.数据存储范围1.变量与常量2.数据类型2-1 整型数据2-2 浮点型数据2-3 字符型数据2-4 格式化输出2-5 输入框语句2-5 字符输入函数2-6 字符输出…

硬件内存模型

Hardware Memory Models 这是Go语言作者之一的rsc语言内存模型相关博文之一&#xff1b;硬件内存模型的笔记。硬件内存模型对应的是汇编指令的执行&#xff0c;可以认为每一条指令原子执行。 Sequential Consistency 顺序一致性模型 多个进程的操作按照一定顺序执行&#xf…

(附源码)ssm小米购物网站 毕业设计 261624

基于ssm小米购物网站 摘 要 近年来&#xff0c;随着移动互联网的快速发展&#xff0c;电子商务越来越受到网民们的欢迎&#xff0c;电子商务对国家经济的发展也起着越来越重要的作用。简单的流程、便捷可靠的支付方式、快捷畅通的物流快递、安全的信息保护都使得电子商务越来越…

[附源码]计算机毕业设计宁财二手物品交易网站Springboot程序

项目运行 环境配置&#xff1a; Jdk1.8 Tomcat7.0 Mysql HBuilderX&#xff08;Webstorm也行&#xff09; Eclispe&#xff08;IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持&#xff09;。 项目技术&#xff1a; SSM mybatis Maven Vue 等等组成&#xff0c;B/S模式 M…

数据结构(13)最小生成树JAVA版:prim算法、kruskal算法

目录 13.1.概述 13.2.prim算法 13.2.1.概述 13.2.2.代码实现 13.3.kruskal算法 13.3.1.概述 13.3.2.代码实现 13.1.概述 最小生成树&#xff0c;包含图的所有顶点的一棵树&#xff0c;树的边采用包含在图中的原有边中权重和最小的边。翻译成人话就是遍历一遍全图所有顶点…

Java基于J2EE的流浪动物收容与领养管理系统

随着城市饲养宠物日益增加&#xff0c;流浪动物也越来越多&#xff0c;本文对流浪动物出现的原因&#xff0c;引发的社会问题以及流浪动物的保护等方面进行思考阐述,以期唤醒人们对动物福利的关注和对生命的珍爱。 通过以上的调研研究发现&#xff0c;如此多的流浪动物是如此的…

肠道菌群代谢组学之粪便微生物移植治疗原发性硬化性胆管炎

​ The American Journal of GASTROENTEROLOGY (IF10.241) 10位原发性硬化性胆管炎患者的粪便微生物移植&#xff1a;一个试点的临床试验 研究背景 百趣代谢组学分享&#xff0c;原发性硬化性胆管炎&#xff08;Primary sclerosing cholangitis&#xff0c;PSC&#xff09;是…

【Java语言】— 快速入门

Java背景知识 Java是美国sun公司在1995年推出的一门计算机高级编程语言。 Java早期称为Oak&#xff08;橡树&#xff09;&#xff0c;后改为Java。 Java之父:詹姆斯高斯林。 2009年sun公司被Oracle公司收购。 为什么用Java 世界上最流行的编程语言之一&#xff0c;在国内使用…

生成式AI结合3D、XR怎么玩?NVIDIA、Niantic等公司已入局

最近生成式AI风头有点大&#xff0c;这种技术只需要用文字就能作画&#xff0c;而且效果惊艳&#xff0c;堪比专业画师的作品。其中一些热门的方案包括DALL-E 2、Midjourney、BariumAI、D-ID AI、Stable Diffusion等等&#xff0c;这些工具简单、好玩&#xff0c;已经被无数网友…

BYD精制项目除铜工艺去除铜离子

某精细化工公司BYD精制项目 工艺选择 过滤系统螯合树脂除铜系统合格品回收箱 工艺原理 在不应该1,4丁炔二醇的情况下去除铜离子 项目背景 1,4-丁炔二醇BYD&#xff08;but-2-yne-1,4-diol&#xff09;是一种重要的中间体化工原料&#xff0c;广泛应用于生产丁二醇及其下游产…

2022CTF培训(五)字符串混淆进阶代码自解密

附件下载链接 复杂的字符串混淆 原理 之前的字符串混淆是一次性解密的&#xff0c;找到解密函数即可获得所有字符串&#xff0c;同时执行解密函数后内存中也可直接获得所有字符串。 因此对抗人员升级了混淆技术&#xff0c;使得解密仅在使用时发生&#xff0c;从而避免了全部…