博主介绍:✌从事软件开发10年之余,专注于Java技术领域、Python人工智能及数据挖掘、小程序项目开发和Android项目开发等。CSDN、掘金、华为云、InfoQ、阿里云等平台优质作者✌
🍅文末获取源码联系🍅
👇🏻 精彩专栏推荐订阅👇🏻 不然下次找不到哟
————————————————
计算机毕业设计《1000套》✌
目录
1、项目介绍及开发技术
1.1 项目介绍
1.2 开发技术
2、系统功能设计结构图
3、功能截图
4、数据库表结构设计
5、关键模块
5.1 老人家属管理Controller模块
5.2 老人家属管理Service模块
5.3 老人家属管理ServiceImpl模块
5.4 老人家属管理Dao模块
6、论文目录结构
7、源码获取
1、项目介绍及开发技术
1.1 项目介绍
传统办法管理信息首先需要花费的时间比较多,其次数据出错率比较高,而且对错误的数据进行更改也比较困难,最后,检索数据费事费力。因此,在计算机上安装养老院管理系统软件来发挥其高效地信息处理的作用,可以规范信息管理流程,让管理工作可以系统化和程序化,同时,养老院管理系统的有效运用可以帮助管理人员准确快速地处理信息。
养老院管理系统是一款运用软件开发技术设计实现的应用系统,在信息处理上可以达到快速的目的,不管是针对数据添加,数据维护和统计,以及数据查询等处理要求,养老院管理系统都可以轻松应对。
1.2 开发技术
Java开发语言、SpringBoot框架、MyBatisPlus、MySQL5.7数据库、Maven3.3.9包、IDEA开发工具、JDK1.8+、Vue、HTML、CSS、JS。
2、系统功能设计结构图
3、功能截图
后台首页
老人管理
家属管理
家属意见管理
老人安全信息管理
体检管理
药物管理
出入信息管理
公告信息管理
4、数据库表结构设计
CREATE TABLE `config` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(100) NOT NULL COMMENT '配置参数名称',
`value` varchar(100) DEFAULT NULL COMMENT '配置参数值',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='配置文件';
/*Data for the table `config` */
/*Table structure for table `dictionary` */
DROP TABLE IF EXISTS `dictionary`;
CREATE TABLE `dictionary` (
`id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`dic_code` varchar(200) DEFAULT NULL COMMENT '字段',
`dic_name` varchar(200) DEFAULT NULL COMMENT '字段名',
`code_index` int(11) DEFAULT NULL COMMENT '编码',
`index_name` varchar(200) DEFAULT NULL COMMENT '编码名字 Search111 ',
`super_id` int(11) DEFAULT NULL COMMENT '父字段id',
`beizhu` varchar(200) DEFAULT NULL COMMENT '备注',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8 COMMENT='字典表';
/*Data for the table `dictionary` */
insert into `dictionary`(`id`,`dic_code`,`dic_name`,`code_index`,`index_name`,`super_id`,`beizhu`,`create_time`) values (1,'qinshi_types','寝室类型',1,'寝室类型1',NULL,NULL,'2023-02-16 15:19:14'),(2,'qinshi_types','寝室类型',2,'寝室类型2',NULL,NULL,'2023-02-16 15:19:14'),(3,'status_types','寝室状态',2,'已分配',NULL,NULL,'2023-02-16 15:19:14'),(4,'status_types','寝室状态',1,'未分配',NULL,NULL,'2023-02-16 15:19:14'),(5,'meishi_types','食物类型',1,'食物类型1',NULL,NULL,'2023-02-16 15:19:15'),(6,'meishi_types','食物类型',2,'食物类型2',NULL,NULL,'2023-02-16 15:19:15'),(7,'yinshixihao_types','食物类型',1,'食物类型1',NULL,NULL,'2023-02-16 15:19:15'),(8,'yinshixihao_types','食物类型',2,'食物类型2',NULL,NULL,'2023-02-16 15:19:15'),(9,'tijian_types','体检项目',1,'体检项目1',NULL,NULL,'2023-02-16 15:19:15'),(10,'tijian_types','体检项目',2,'体检项目2',NULL,NULL,'2023-02-16 15:19:15'),(11,'yaowu_types','药物类型',1,'药物类型1',NULL,NULL,'2023-02-16 15:19:15'),(12,'yaowu_types','药物类型',2,'药物类型2',NULL,NULL,'2023-02-16 15:19:15'),(13,'xuqiudai_types','需求状态',1,'未提交',NULL,NULL,'2023-02-16 15:19:15'),(14,'xuqiudai_types','需求状态',2,'已提交',NULL,NULL,'2023-02-16 15:19:15'),(15,'jiashuyijian_types','类型',1,'已处理',NULL,NULL,'2023-02-16 15:19:15'),(16,'jiashuyijian_types','类型',2,'未处理',NULL,NULL,'2023-02-16 15:19:15'),(17,'waichu_types','外出目的',1,'外出目的1',NULL,NULL,'2023-02-16 15:19:15'),(18,'waichu_types','外出目的',2,'外出目的2',NULL,NULL,'2023-02-16 15:19:15'),(19,'fangke_types','来访目的',1,'来访目的1',NULL,NULL,'2023-02-16 15:19:15'),(20,'fangke_types','来访目的',2,'来访目的2',NULL,NULL,'2023-02-16 15:19:15'),(21,'shigu_types','事故类型',1,'事故类型',NULL,NULL,'2023-02-16 15:19:15'),(22,'shigu_types','事故类型',2,'事故类型2',NULL,NULL,'2023-02-16 15:19:15'),(23,'yanzheng_types','严重程度',1,'严重程度',NULL,NULL,'2023-02-16 15:19:15'),(24,'yanzheng_types','严重程度',2,'严重程度2',NULL,NULL,'2023-02-16 15:19:15'),(25,'news_types','公告类型',1,'重大通知',NULL,NULL,'2023-02-16 15:19:15'),(26,'news_types','公告类型',2,'最新资讯',NULL,NULL,'2023-02-16 15:19:15'),(27,'news_types','公告类型',3,'其他',NULL,NULL,'2023-02-16 15:19:15'),(28,'sex_types','性别',1,'男',NULL,NULL,'2023-02-16 15:19:15'),(29,'sex_types','性别',2,'女',NULL,NULL,'2023-02-16 15:19:15'),(30,'baojing_types','健康报警',1,'正常',NULL,NULL,'2023-02-16 15:19:15'),(31,'baojing_types','健康报警',2,'危险',NULL,NULL,'2023-02-16 15:19:15'),(32,'jiankang_types','健康状态',1,'健康状态1',NULL,NULL,'2023-02-16 15:19:15'),(33,'jiankang_types','健康状态',2,'健康状态2',NULL,NULL,'2023-02-16 15:19:15'),(34,'jiankang_types','健康状态',3,'健康状态3',NULL,NULL,'2023-02-16 15:19:15'),(35,'jiashu_types','家属身份',1,'家属身份1',NULL,NULL,'2023-02-16 15:19:15'),(36,'jiashu_types','家属身份',2,'家属身份2',NULL,NULL,'2023-02-16 15:19:15'),(37,'jiashu_types','家属身份',3,'家属身份3',NULL,NULL,'2023-02-16 15:19:15');
/*Table structure for table `fangke` */
DROP TABLE IF EXISTS `fangke`;
CREATE TABLE `fangke` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`fangke_name` varchar(200) DEFAULT NULL COMMENT '标题 Search111 ',
`fangke_mingc` varchar(200) DEFAULT NULL COMMENT '来访人名称',
`fangke_phone` varchar(200) DEFAULT NULL COMMENT '来访人联系方式',
`fangke_types` int(11) DEFAULT NULL COMMENT '来访目的 Search111',
`fangke_time` timestamp NULL DEFAULT NULL COMMENT '来访时间',
`huilia_time` timestamp NULL DEFAULT NULL COMMENT '离开时间',
`yonghu_id` int(11) DEFAULT NULL COMMENT '老人',
`fangke_text` text COMMENT '备注',
`fangke_content` text COMMENT '详情',
`fangke_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow homeMain',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='访客信息';
/*Data for the table `fangke` */
insert into `fangke`(`id`,`fangke_name`,`fangke_mingc`,`fangke_phone`,`fangke_types`,`fangke_time`,`huilia_time`,`yonghu_id`,`fangke_text`,`fangke_content`,`fangke_delete`,`create_time`) values (1,'标题1','来访人名称1','17703786901',1,'2023-02-16 15:19:21','2023-02-16 15:19:21',3,'备注1','详情1',1,'2023-02-16 15:19:21'),(2,'标题2','来访人名称2','17703786902',2,'2023-02-16 15:19:21','2023-02-16 15:19:21',1,'备注2','详情2',1,'2023-02-16 15:19:21'),(3,'标题3','来访人名称3','17703786903',1,'2023-02-16 15:19:21','2023-02-16 15:19:21',2,'备注3','详情3',1,'2023-02-16 15:19:21'),(4,'标题4','来访人名称4','17703786904',2,'2023-02-16 15:19:21','2023-02-16 15:19:21',1,'备注4','详情4',1,'2023-02-16 15:19:21'),(5,'标题5','来访人名称5','17703786905',1,'2023-02-16 15:19:21','2023-02-16 15:19:21',1,'备注5','详情5',1,'2023-02-16 15:19:21');
/*Table structure for table `jiashu` */
DROP TABLE IF EXISTS `jiashu`;
CREATE TABLE `jiashu` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`username` varchar(200) DEFAULT NULL COMMENT '账号',
`password` varchar(200) DEFAULT NULL COMMENT '密码',
`jiashu_name` varchar(200) DEFAULT NULL COMMENT '家属名称 Search111 ',
`jiashu_photo` varchar(200) DEFAULT NULL COMMENT '家属照片',
`sex_types` int(11) DEFAULT NULL COMMENT '性别 Search111 ',
`jiashu_phone` varchar(200) DEFAULT NULL COMMENT '联系电话',
`jiashu_email` varchar(200) DEFAULT NULL COMMENT '邮箱',
`jiashu_types` int(11) DEFAULT NULL COMMENT '身份',
`jiashu_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='家属';
/*Data for the table `jiashu` */
insert into `jiashu`(`id`,`username`,`password`,`jiashu_name`,`jiashu_photo`,`sex_types`,`jiashu_phone`,`jiashu_email`,`jiashu_types`,`jiashu_delete`,`create_time`) values (1,'a1','123456','家属名称1','upload/jiashu1.jpg',1,'17703786901','1@qq.com',2,1,'2023-02-16 15:19:21'),(2,'a2','123456','家属名称2','upload/jiashu2.jpg',2,'17703786902','2@qq.com',3,1,'2023-02-16 15:19:21'),(3,'a3','123456','家属名称3','upload/jiashu3.jpg',1,'17703786903','3@qq.com',2,1,'2023-02-16 15:19:21');
/*Table structure for table `jiashuyijian` */
DROP TABLE IF EXISTS `jiashuyijian`;
CREATE TABLE `jiashuyijian` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`jiashuyijian_name` varchar(200) DEFAULT NULL COMMENT '标题 Search111 ',
`jiashuyijian_types` int(11) DEFAULT NULL COMMENT '类型 Search111-',
`jiashu_id` int(11) DEFAULT NULL COMMENT '家属',
`jiashuyijian_content` text COMMENT '详细信息',
`jiashuyijian_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow homeMain',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='家属意见';
/*Data for the table `jiashuyijian` */
insert into `jiashuyijian`(`id`,`jiashuyijian_name`,`jiashuyijian_types`,`jiashu_id`,`jiashuyijian_content`,`jiashuyijian_delete`,`create_time`) values (1,'标题1',1,1,'详细信息1',1,'2023-02-16 15:19:21'),(2,'标题2',1,1,'详细信息2',1,'2023-02-16 15:19:21'),(3,'标题3',1,2,'详细信息3',1,'2023-02-16 15:19:21'),(4,'标题4',1,2,'详细信息4',1,'2023-02-16 15:19:21'),(5,'标题5',1,1,'详细信息5',1,'2023-02-16 15:19:21'),(6,'123',2,1,'<p>123</p>',1,'2023-02-16 16:31:34');
/*Table structure for table `meishi` */
DROP TABLE IF EXISTS `meishi`;
CREATE TABLE `meishi` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`meishi_name` varchar(200) DEFAULT NULL COMMENT '食物名称 Search111 ',
`meishi_photo` varchar(200) DEFAULT NULL COMMENT '食物照片',
`meishi_types` int(11) DEFAULT NULL COMMENT '食物类型 Search111',
`meishi_new_money` decimal(10,2) DEFAULT NULL COMMENT '价格',
`meishi_content` text COMMENT '食物介绍 ',
`meishi_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow homeMain',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='食物';
/*Data for the table `meishi` */
insert into `meishi`(`id`,`meishi_name`,`meishi_photo`,`meishi_types`,`meishi_new_money`,`meishi_content`,`meishi_delete`,`create_time`) values (1,'食物名称1','upload/meishi1.jpg',1,'467.90','食物介绍1',1,'2023-02-16 15:19:21'),(2,'食物名称2','upload/meishi2.jpg',1,'77.84','食物介绍2',1,'2023-02-16 15:19:21'),(3,'食物名称3','upload/meishi3.jpg',1,'396.16','食物介绍3',1,'2023-02-16 15:19:21'),(4,'食物名称4','upload/meishi4.jpg',2,'218.37','食物介绍4',1,'2023-02-16 15:19:21'),(5,'食物名称5','upload/meishi5.jpg',2,'445.12','食物介绍5',1,'2023-02-16 15:19:21');
/*Table structure for table `news` */
DROP TABLE IF EXISTS `news`;
CREATE TABLE `news` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`news_name` varchar(200) DEFAULT NULL COMMENT '公告信息标题 Search111 ',
`news_types` int(11) DEFAULT NULL COMMENT '公告类型 Search111 ',
`news_photo` varchar(200) DEFAULT NULL COMMENT '公告信息图片',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',
`news_content` text COMMENT '公告详情',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 nameShow',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='公告信息';
/*Data for the table `news` */
insert into `news`(`id`,`news_name`,`news_types`,`news_photo`,`insert_time`,`news_content`,`create_time`) values (1,'公告信息标题1',1,'upload/news1.jpg','2023-02-16 15:19:21','公告详情1','2023-02-16 15:19:21'),(2,'公告信息标题2',3,'upload/news2.jpg','2023-02-16 15:19:21','公告详情2','2023-02-16 15:19:21'),(3,'公告信息标题3',3,'upload/news3.jpg','2023-02-16 15:19:21','公告详情3','2023-02-16 15:19:21'),(4,'公告信息标题4',1,'upload/news4.jpg','2023-02-16 15:19:21','公告详情4','2023-02-16 15:19:21'),(5,'公告信息标题5',2,'upload/news5.jpg','2023-02-16 15:19:21','公告详情5','2023-02-16 15:19:21');
/*Table structure for table `qinshi` */
DROP TABLE IF EXISTS `qinshi`;
CREATE TABLE `qinshi` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`qinshi_name` varchar(200) DEFAULT NULL COMMENT '寝室位置 Search111 ',
`qinshi_types` int(11) DEFAULT NULL COMMENT '寝室类型 Search111',
`status_types` int(11) DEFAULT NULL COMMENT '寝室状态 Search111',
`qinshi_content` text COMMENT '寝室详情 ',
`qinshi_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow homeMain',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='寝室信息';
/*Data for the table `qinshi` */
insert into `qinshi`(`id`,`qinshi_name`,`qinshi_types`,`status_types`,`qinshi_content`,`qinshi_delete`,`create_time`) values (1,'寝室位置1',1,1,'寝室详情1',1,'2023-02-16 15:19:21'),(2,'寝室位置2',2,1,'寝室详情2',1,'2023-02-16 15:19:21'),(3,'寝室位置3',2,1,'寝室详情3',1,'2023-02-16 15:19:21'),(4,'寝室位置4',2,1,'寝室详情4',1,'2023-02-16 15:19:21'),(5,'寝室位置5',1,1,'寝室详情5',1,'2023-02-16 15:19:21');
/*Table structure for table `qinshifenpei` */
DROP TABLE IF EXISTS `qinshifenpei`;
CREATE TABLE `qinshifenpei` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`yonghu_id` int(11) DEFAULT NULL COMMENT '老人',
`qinshi_id` int(11) DEFAULT NULL COMMENT '寝室',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '分配时间',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow homeMain',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='寝室分配信息';
/*Data for the table `qinshifenpei` */
/*Table structure for table `shigu` */
DROP TABLE IF EXISTS `shigu`;
CREATE TABLE `shigu` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`shigu_name` varchar(200) DEFAULT NULL COMMENT '标题 Search111 ',
`shigu_time` timestamp NULL DEFAULT NULL COMMENT '事故时间',
`shigu_address` varchar(200) DEFAULT NULL COMMENT '地点',
`shigu_types` int(11) DEFAULT NULL COMMENT '事故类型 Search111',
`yanzheng_types` int(11) DEFAULT NULL COMMENT '严重程度 Search111',
`yonghu_id` int(11) DEFAULT NULL COMMENT '老人',
`shigu_text` text COMMENT '备注',
`shigu_content` text COMMENT '详情',
`shigu_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow homeMain',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='老人事故信息';
/*Data for the table `shigu` */
insert into `shigu`(`id`,`shigu_name`,`shigu_time`,`shigu_address`,`shigu_types`,`yanzheng_types`,`yonghu_id`,`shigu_text`,`shigu_content`,`shigu_delete`,`create_time`) values (1,'标题1','2023-02-16 15:19:21','地点1',2,1,2,'备注1','详情1',1,'2023-02-16 15:19:21'),(2,'标题2','2023-02-16 15:19:21','地点2',2,2,3,'备注2','详情2',1,'2023-02-16 15:19:21'),(3,'标题3','2023-02-16 15:19:21','地点3',1,2,1,'备注3','详情3',1,'2023-02-16 15:19:21'),(4,'标题4','2023-02-16 15:19:21','地点4',1,1,2,'备注4','详情4',1,'2023-02-16 15:19:21'),(5,'标题5','2023-02-16 15:19:21','地点5',2,2,1,'备注5','详情5',1,'2023-02-16 15:19:21');
/*Table structure for table `token` */
DROP TABLE IF EXISTS `token`;
CREATE TABLE `token` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`userid` bigint(20) NOT NULL COMMENT '用户id',
`username` varchar(100) NOT NULL COMMENT '用户名',
`tablename` varchar(100) DEFAULT NULL COMMENT '表名',
`role` varchar(100) DEFAULT NULL COMMENT '角色',
`token` varchar(200) NOT NULL COMMENT '密码',
`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',
`expiratedtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '过期时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='token表';
/*Data for the table `token` */
insert into `token`(`id`,`userid`,`username`,`tablename`,`role`,`token`,`addtime`,`expiratedtime`) values (1,1,'admin','users','管理员','fumio34hjzgp8i5oix76ggbfg11gqerz','2023-02-16 14:31:43','2023-02-16 17:37:00'),(2,1,'a1','jiashu','家属','dzbazlgaztniayu4uekun8836n3epwx1','2023-02-16 15:38:17','2023-02-16 17:31:17'),(3,1,'a1','yonghu','老人','joa3y702kzdp1jfu5m2bw2dn40qqagqq','2023-02-16 15:43:50','2023-02-16 17:31:57'),(4,2,'a2','yonghu','老人','k2o0n1zawf5nsr3krfh2s151z9y2w843','2023-02-16 16:14:39','2023-02-16 17:14:40');
/*Table structure for table `users` */
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`username` varchar(100) NOT NULL COMMENT '用户名',
`password` varchar(100) NOT NULL COMMENT '密码',
`role` varchar(100) DEFAULT '管理员' COMMENT '角色',
`addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='管理员';
/*Data for the table `users` */
insert into `users`(`id`,`username`,`password`,`role`,`addtime`) values (1,'admin','admin','管理员','2022-05-01 00:00:00');
/*Table structure for table `waichu` */
DROP TABLE IF EXISTS `waichu`;
CREATE TABLE `waichu` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`waichu_name` varchar(200) DEFAULT NULL COMMENT '标题 Search111 ',
`waichu_types` int(11) DEFAULT NULL COMMENT '外出目的 Search111',
`waichu_time` timestamp NULL DEFAULT NULL COMMENT '外出时间',
`huilia_time` timestamp NULL DEFAULT NULL COMMENT '回来时间',
`yonghu_id` int(11) DEFAULT NULL COMMENT '老人',
`waichu_text` text COMMENT '备注',
`waichu_content` text COMMENT '详情',
`waichu_delete` int(11) DEFAULT NULL COMMENT '逻辑删除',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow homeMain',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='老人外出信息';
/*Data for the table `waichu` */
insert into `waichu`(`id`,`waichu_name`,`waichu_types`,`waichu_time`,`huilia_time`,`yonghu_id`,`waichu_text`,`waichu_content`,`waichu_delete`,`create_time`) values (1,'标题1',1,'2023-02-16 15:19:21','2023-02-16 15:19:21',1,'备注1','详情1',1,'2023-02-16 15:19:21'),(2,'标题2',2,'2023-02-16 15:19:21','2023-02-16 15:19:21',3,'备注2','详情2',1,'2023-02-16 15:19:21'),(3,'标题3',1,'2023-02-16 15:19:21','2023-02-16 15:19:21',3,'备注3','详情3',1,'2023-02-16 15:19:21'),(4,'标题4',2,'2023-02-16 15:19:21','2023-02-16 15:19:21',3,'备注4','详情4',1,'2023-02-16 15:19:21'),(5,'标题5',1,'2023-02-16 15:19:21','2023-02-16 15:19:21',1,'备注5','详情5',1,'2023-02-16 15:19:21');
/*Table structure for table `xuqiudai` */
DROP TABLE IF EXISTS `xuqiudai`;
CREATE TABLE `xuqiudai` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键 ',
`yaowu_id` int(11) DEFAULT NULL COMMENT '药物',
`yonghu_id` int(11) DEFAULT NULL COMMENT '老人',
`xuqiudai_kucun_number` int(11) DEFAULT NULL COMMENT '需求数量',
`xuqiudai_types` int(11) DEFAULT NULL COMMENT '需求状态 Search111',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow homeMain',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8 COMMENT='需求袋';
/*Data for the table `xuqiudai` */
insert into `xuqiudai`(`id`,`yaowu_id`,`yonghu_id`,`xuqiudai_kucun_number`,`xuqiudai_types`,`insert_time`,`create_time`) values (1,1,3,101,2,'2023-02-16 15:19:21','2023-02-16 15:19:21'),(2,2,1,102,2,'2023-02-16 15:19:21','2023-02-16 15:19:21'),(3,3,2,103,1,'2023-02-16 15:19:21','2023-02-16 15:19:21'),(4,4,1,104,2,'2023-02-16 15:19:21','2023-02-16 15:19:21'),(5,5,3,105,2,'2023-02-16 15:19:21','2023-02-16 15:19:21'),(11,5,1,100,2,'2023-02-16 16:02:12','2023-02-16 16:02:12');
/*Table structure for table `yonghu` */
DROP TABLE IF EXISTS `yonghu`;
CREATE TABLE `yonghu` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`username` varchar(200) DEFAULT NULL COMMENT '账号',
`password` varchar(200) DEFAULT NULL COMMENT '密码',
`yonghu_name` varchar(200) DEFAULT NULL COMMENT '老人姓名 Search111 ',
`yonghu_photo` varchar(255) DEFAULT NULL COMMENT '头像',
`sex_types` int(11) DEFAULT NULL COMMENT '性别 Search111 ',
`jiankang_types` int(11) DEFAULT NULL COMMENT '健康状态 Search111 ',
`yonghu_age` int(11) DEFAULT NULL COMMENT '年龄',
`yonghu_phone` varchar(200) DEFAULT NULL COMMENT '紧急联系方式',
`yonghu_address` varchar(200) DEFAULT NULL COMMENT '住址',
`baojing_types` int(11) DEFAULT NULL COMMENT '健康报警 Search111 ',
`jiashu_id` int(11) DEFAULT NULL COMMENT '家属',
`yonghu_delete` int(11) DEFAULT '1' COMMENT '假删',
`insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',
`create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='老人';
/*Data for the table `yonghu` */
insert into `yonghu`(`id`,`username`,`password`,`yonghu_name`,`yonghu_photo`,`sex_types`,`jiankang_types`,`yonghu_age`,`yonghu_phone`,`yonghu_address`,`baojing_types`,`jiashu_id`,`yonghu_delete`,`insert_time`,`create_time`) values (1,'a1','123456','老人姓名1','upload/yonghu1.jpg',1,1,242,'17703786901','住址1',1,2,1,'2023-02-16 15:19:21','2023-02-16 15:19:21'),(2,'a2','123456','老人姓名2','upload/yonghu2.jpg',1,3,137,'17703786902','住址2',2,3,1,'2023-02-16 15:19:21','2023-02-16 15:19:21'),(3,'a3','123456','老人姓名3','upload/yonghu3.jpg',2,3,326,'17703786903','住址3',2,1,1,'2023-02-16 15:19:21','2023-02-16 15:19:21');
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
5、关键模块
5.1 老人家属管理Controller模块
package com.controller;
import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;
import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
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.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;
/**
* 老人家属信息
* 后端接口
*
* @author
* @email
*/
@RestController
@Controller
@RequestMapping("/laorenjiashu")
public class LaorenjiashuController {
private static final Logger logger = LoggerFactory.getLogger(LaorenjiashuController.class);
private static final String TABLE_NAME = "laorenjiashu";
@Autowired
private LaorenjiashuService laorenjiashuService;
@Autowired
private TokenService tokenService;
@Autowired
private DictionaryService dictionaryService;
//级联表非注册的service
@Autowired
private YonghuService yonghuService;
@Autowired
private JiashuService jiashuService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request) {
logger.debug("page方法:,,Controller:{},,params:{}", this.getClass().getName(), JSONObject.toJSONString(params));
String role = String.valueOf(request.getSession().getAttribute("role"));
if (false)
return R.error(511, "永不会进入");
else if ("老人".equals(role))
params.put("yonghuId", request.getSession().getAttribute("userId"));
else if ("家属".equals(role))
params.put("jiashuId", request.getSession().getAttribute("userId"));
CommonUtil.checkMap(params);
PageUtils page = laorenjiashuService.queryPage(params);
//字典表数据转换
List<LaorenjiashuView> list = (List<LaorenjiashuView>) page.getList();
for (LaorenjiashuView c : list) {
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
return R.ok().put("data", page);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request) {
logger.debug("info方法:,,Controller:{},,id:{}", this.getClass().getName(), id);
LaorenjiashuEntity laorenjiashu = laorenjiashuService.selectById(id);
if (laorenjiashu != null) {
//entity转view
LaorenjiashuView view = new LaorenjiashuView();
BeanUtils.copyProperties(laorenjiashu, view);//把实体数据重构到view中
//级联表 老人
//级联表
YonghuEntity yonghu = yonghuService.selectById(laorenjiashu.getYonghuId());
if (yonghu != null) {
BeanUtils.copyProperties(yonghu, view, new String[]{"id", "createTime", "insertTime", "updateTime", "jiashuId"
, "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
view.setYonghuId(yonghu.getId());
}
//级联表 家属
//级联表
JiashuEntity jiashu = jiashuService.selectById(laorenjiashu.getJiashuId());
if (jiashu != null) {
BeanUtils.copyProperties(jiashu, view, new String[]{"id", "createTime", "insertTime", "updateTime", "jiashuId"
, "yonghuId"});//把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
view.setJiashuId(jiashu.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
} else {
return R.error(511, "查不到数据");
}
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody LaorenjiashuEntity laorenjiashu, HttpServletRequest request) {
logger.debug("save方法:,,Controller:{},,laorenjiashu:{}", this.getClass().getName(), laorenjiashu.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
if (false)
return R.error(511, "永远不会进入");
else if ("家属".equals(role))
laorenjiashu.setJiashuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
else if ("老人".equals(role))
laorenjiashu.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
Wrapper<LaorenjiashuEntity> queryWrapper = new EntityWrapper<LaorenjiashuEntity>()
.eq("yonghu_id", laorenjiashu.getYonghuId())
.eq("jiashu_id", laorenjiashu.getJiashuId());
logger.info("sql语句:" + queryWrapper.getSqlSegment());
LaorenjiashuEntity laorenjiashuEntity = laorenjiashuService.selectOne(queryWrapper);
if (laorenjiashuEntity == null) {
laorenjiashu.setInsertTime(new Date());
laorenjiashu.setCreateTime(new Date());
laorenjiashuService.insert(laorenjiashu);
return R.ok();
} else {
return R.error(511, "请不要重复添加");
}
}
/**
* 后端修改
*/
@RequestMapping("/update")
public R update(@RequestBody LaorenjiashuEntity laorenjiashu, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
logger.debug("update方法:,,Controller:{},,laorenjiashu:{}", this.getClass().getName(), laorenjiashu.toString());
LaorenjiashuEntity oldLaorenjiashuEntity = laorenjiashuService.selectById(laorenjiashu.getId());//查询原先数据
String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");
// else if("家属".equals(role))
// laorenjiashu.setJiashuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
// else if("老人".equals(role))
// laorenjiashu.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
//根据字段查询是否有相同数据
Wrapper<LaorenjiashuEntity> queryWrapper = new EntityWrapper<LaorenjiashuEntity>()
.notIn("id", laorenjiashu.getId())
.andNew()
.eq("yonghu_id", laorenjiashu.getYonghuId())
.eq("jiashu_id", laorenjiashu.getJiashuId())
.eq("laorenjiashu_types", laorenjiashu.getLaorenjiashuTypes());
logger.info("sql语句:" + queryWrapper.getSqlSegment());
LaorenjiashuEntity laorenjiashuEntity = laorenjiashuService.selectOne(queryWrapper);
if (laorenjiashuEntity == null) {
laorenjiashuService.updateById(laorenjiashu);//根据id更新
return R.ok();
} else {
return R.error(511, "表中有相同数据");
}
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids, HttpServletRequest request) {
logger.debug("delete:,,Controller:{},,ids:{}", this.getClass().getName(), ids.toString());
List<LaorenjiashuEntity> oldLaorenjiashuList = laorenjiashuService.selectBatchIds(Arrays.asList(ids));//要删除的数据
laorenjiashuService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 批量上传
*/
@RequestMapping("/batchInsert")
public R save(String fileName, HttpServletRequest request) {
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}", this.getClass().getName(), fileName);
Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
List<LaorenjiashuEntity> laorenjiashuList = new ArrayList<>();//上传的东西
Map<String, List<String>> seachFields = new HashMap<>();//要查询的字段
Date date = new Date();
int lastIndexOf = fileName.lastIndexOf(".");
if (lastIndexOf == -1) {
return R.error(511, "该文件没有后缀");
} else {
String suffix = fileName.substring(lastIndexOf);
if (!".xls".equals(suffix)) {
return R.error(511, "只支持后缀为xls的excel文件");
} else {
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
File file = new File(resource.getFile());
if (!file.exists()) {
return R.error(511, "找不到上传文件,请联系管理员");
} else {
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
dataList.remove(0);//删除第一行,因为第一行是提示
for (List<String> data : dataList) {
//循环
LaorenjiashuEntity laorenjiashuEntity = new LaorenjiashuEntity();
// laorenjiashuEntity.setYonghuId(Integer.valueOf(data.get(0))); //老人 要改的
// laorenjiashuEntity.setJiashuId(Integer.valueOf(data.get(0))); //家属 要改的
// laorenjiashuEntity.setLaorenjiashuTypes(Integer.valueOf(data.get(0))); //家属身份 要改的
// laorenjiashuEntity.setInsertTime(date);//时间
// laorenjiashuEntity.setCreateTime(date);//时间
laorenjiashuList.add(laorenjiashuEntity);
//把要查询是否重复的字段放入map中
}
//查询是否重复
laorenjiashuService.insertBatch(laorenjiashuList);
return R.ok();
}
}
}
} catch (Exception e) {
e.printStackTrace();
return R.error(511, "批量插入数据异常,请联系管理员");
}
}
}
5.2 老人家属管理Service模块
package com.service;
import com.baomidou.mybatisplus.service.IService;
import com.utils.PageUtils;
import com.entity.LaorenjiashuEntity;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.lang.Nullable;
import java.util.List;
/**
* 老人家属信息 服务类
*/
public interface LaorenjiashuService extends IService<LaorenjiashuEntity> {
/**
* @param params 查询参数
* @return 带分页的查询出来的数据
*/
PageUtils queryPage(Map<String, Object> params);
}
5.3 老人家属管理ServiceImpl模块
package com.service.impl;
import com.utils.StringUtil;
import com.service.DictionaryService;
import com.utils.ClazzDiff;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.lang.reflect.Field;
import java.util.*;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import com.utils.PageUtils;
import com.utils.Query;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import com.dao.LaorenjiashuDao;
import com.entity.LaorenjiashuEntity;
import com.service.LaorenjiashuService;
import com.entity.view.LaorenjiashuView;
/**
* 老人家属信息 服务实现类
*/
@Service("laorenjiashuService")
@Transactional
public class LaorenjiashuServiceImpl extends ServiceImpl<LaorenjiashuDao, LaorenjiashuEntity> implements LaorenjiashuService {
@Override
public PageUtils queryPage(Map<String,Object> params) {
Page<LaorenjiashuView> page =new Query<LaorenjiashuView>(params).getPage();
page.setRecords(baseMapper.selectListView(page,params));
return new PageUtils(page);
}
}
5.4 老人家属管理Dao模块
package com.dao;
import com.entity.LaorenjiashuEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import org.apache.ibatis.annotations.Param;
import com.entity.view.LaorenjiashuView;
/**
* 老人家属信息 Dao 接口
*
* @author
*/
public interface LaorenjiashuDao extends BaseMapper<LaorenjiashuEntity> {
List<LaorenjiashuView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
}
6、论文目录结构
7、源码获取
感谢大家的阅读,如有不懂的问题可以评论区交流或私聊!
喜欢文章可以点赞、收藏、关注、评论啦
→获取源码请私信←