Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
别团等shy哥发育
Yygh Parent
提交
8456277e
Y
Yygh Parent
项目概览
别团等shy哥发育
/
Yygh Parent
9 个月 前同步成功
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
Yygh Parent
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
8456277e
编写于
1月 02, 2022
作者:
别团等shy哥发育
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
查询排班接口开发实现
上级
e151f2ab
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
71 addition
and
1 deletion
+71
-1
service/service_hosp/src/main/java/com/atguigu/yygu/hosp/controller/api/ApiController.java
...a/com/atguigu/yygu/hosp/controller/api/ApiController.java
+40
-1
service/service_hosp/src/main/java/com/atguigu/yygu/hosp/service/ScheduleService.java
...n/java/com/atguigu/yygu/hosp/service/ScheduleService.java
+7
-0
service/service_hosp/src/main/java/com/atguigu/yygu/hosp/service/impl/ScheduleServiceImpl.java
...m/atguigu/yygu/hosp/service/impl/ScheduleServiceImpl.java
+24
-0
未找到文件。
service/service_hosp/src/main/java/com/atguigu/yygu/hosp/controller/api/ApiController.java
浏览文件 @
8456277e
...
...
@@ -2,7 +2,9 @@ package com.atguigu.yygu.hosp.controller.api;
import
com.atguigu.yygh.model.hosp.Department
;
import
com.atguigu.yygh.model.hosp.Hospital
;
import
com.atguigu.yygh.model.hosp.Schedule
;
import
com.atguigu.yygh.vo.hosp.DepartmentQueryVo
;
import
com.atguigu.yygh.vo.hosp.ScheduleQueryVo
;
import
com.atguigu.yygu.common.exception.YyghException
;
import
com.atguigu.yygu.common.helper.HttpRequestHelper
;
import
com.atguigu.yygu.common.result.Result
;
...
...
@@ -189,7 +191,6 @@ public class ApiController {
Map
<
String
,
Object
>
paramMap
=
HttpRequestHelper
.
switchMap
(
requestMap
);
String
hoscode
=
(
String
)
paramMap
.
get
(
"hoscode"
);
//签名校验
//1、获取医院系统传递过来的签名,签名是MD5加密之后的
String
hospSign
=
(
String
)
paramMap
.
get
(
"sign"
);
...
...
@@ -204,6 +205,44 @@ public class ApiController {
scheduleService
.
save
(
paramMap
);
return
Result
.
ok
();
}
//查询排班接口
@PostMapping
(
"schedule/list"
)
public
Result
findSchedule
(
HttpServletRequest
request
){
//获取传递过来的医院信息
Map
<
String
,
String
[]>
requestMap
=
request
.
getParameterMap
();
Map
<
String
,
Object
>
paramMap
=
HttpRequestHelper
.
switchMap
(
requestMap
);
//医院编号
String
hoscode
=
(
String
)
paramMap
.
get
(
"hoscode"
);
//科室编号
String
depcode
=
(
String
)
paramMap
.
get
(
"depcode"
);
//当前页 和 每页记录数
int
page
=
StringUtils
.
isEmpty
(
paramMap
.
get
(
"page"
))
?
1
:
Integer
.
parseInt
((
String
)
paramMap
.
get
(
"page"
));
int
limit
=
StringUtils
.
isEmpty
(
paramMap
.
get
(
"limit"
))
?
1
:
Integer
.
parseInt
((
String
)
paramMap
.
get
(
"limit"
));
//签名校验
//1、获取医院系统传递过来的签名,签名是MD5加密之后的
String
hospSign
=
(
String
)
paramMap
.
get
(
"sign"
);
//2、根据传递过来的医院编号,查询数据库,查询签名
String
signKey
=
hospitalSetService
.
getSignKey
(
hoscode
);
//3、把数据库查询出来的签名进行MD5加密
String
signKeyMd5
=
MD5
.
encrypt
(
signKey
);
//4、判断签名是否一致
if
(!
hospSign
.
equals
(
signKeyMd5
)){
throw
new
YyghException
(
ResultCodeEnum
.
SIGN_ERROR
);
}
ScheduleQueryVo
scheduleQueryVo
=
new
ScheduleQueryVo
();
scheduleQueryVo
.
setHoscode
(
hoscode
);
scheduleQueryVo
.
setDepcode
(
depcode
);
//调用service方法
Page
<
Schedule
>
pageModel
=
scheduleService
.
findPageSchedule
(
page
,
limit
,
scheduleQueryVo
);
return
Result
.
ok
(
pageModel
);
}
...
...
service/service_hosp/src/main/java/com/atguigu/yygu/hosp/service/ScheduleService.java
浏览文件 @
8456277e
package
com.atguigu.yygu.hosp.service
;
import
com.atguigu.yygh.model.hosp.Schedule
;
import
com.atguigu.yygh.vo.hosp.ScheduleQueryVo
;
import
org.springframework.data.domain.Page
;
import
java.util.Map
;
public
interface
ScheduleService
{
//上传排班接口
void
save
(
Map
<
String
,
Object
>
paramMap
);
//查询排班接口
Page
<
Schedule
>
findPageSchedule
(
int
page
,
int
limit
,
ScheduleQueryVo
scheduleQueryVo
);
}
service/service_hosp/src/main/java/com/atguigu/yygu/hosp/service/impl/ScheduleServiceImpl.java
浏览文件 @
8456277e
...
...
@@ -2,9 +2,12 @@ package com.atguigu.yygu.hosp.service.impl;
import
com.alibaba.fastjson.JSONObject
;
import
com.atguigu.yygh.model.hosp.Schedule
;
import
com.atguigu.yygh.vo.hosp.ScheduleQueryVo
;
import
com.atguigu.yygu.hosp.repository.ScheduleRepository
;
import
com.atguigu.yygu.hosp.service.ScheduleService
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.*
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
...
...
@@ -40,4 +43,25 @@ public class ScheduleServiceImpl implements ScheduleService {
scheduleRepository
.
save
(
schedule
);
}
}
//查询排班接口
@Override
public
Page
<
Schedule
>
findPageSchedule
(
int
page
,
int
limit
,
ScheduleQueryVo
scheduleQueryVo
)
{
// 创建Pageable对象,设置当前页和每页记录数
//0是第一页
Pageable
pageable
=
PageRequest
.
of
(
page
-
1
,
limit
);
// 创建Example对象
Schedule
schedule
=
new
Schedule
();
BeanUtils
.
copyProperties
(
scheduleQueryVo
,
schedule
);
schedule
.
setIsDeleted
(
0
);
schedule
.
setStatus
(
1
);
ExampleMatcher
matcher
=
ExampleMatcher
.
matching
()
.
withStringMatcher
(
ExampleMatcher
.
StringMatcher
.
CONTAINING
)
.
withIgnoreCase
(
true
);
Example
<
Schedule
>
example
=
Example
.
of
(
schedule
,
matcher
);
Page
<
Schedule
>
all
=
scheduleRepository
.
findAll
(
example
,
pageable
);
return
all
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录