Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
hphy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
向怀芳
hphy
Commits
4f5cb72f
Commit
4f5cb72f
authored
Oct 11, 2023
by
gaozhaochen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: 科室、医院数据更新时,先删除后更新,失败回滚
parent
adad9945
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
76 additions
and
8 deletions
+76
-8
HpStatisticsController.java
...ict/theme/hphy/controller/web/HpStatisticsController.java
+19
-0
RefreshJob.java
...n/java/cn/sh/stc/sict/theme/hphy/schedule/RefreshJob.java
+25
-6
HpDeptInfoService.java
.../cn/sh/stc/sict/theme/hphy/service/HpDeptInfoService.java
+3
-1
HpHosInfoService.java
...a/cn/sh/stc/sict/theme/hphy/service/HpHosInfoService.java
+5
-0
HpDeptInfoServiceImpl.java
...c/sict/theme/hphy/service/impl/HpDeptInfoServiceImpl.java
+12
-1
HpHosInfoServiceImpl.java
...tc/sict/theme/hphy/service/impl/HpHosInfoServiceImpl.java
+12
-0
No files found.
smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/HpStatisticsController.java
View file @
4f5cb72f
...
...
@@ -5,6 +5,7 @@ import cn.sh.stc.sict.cloud.common.log.annotation.SysLog;
import
cn.sh.stc.sict.cloud.common.security.util.SecurityUtils
;
import
cn.sh.stc.sict.cloud.upms.dto.CurrentUser
;
import
cn.sh.stc.sict.theme.common.crypto.EncryptionUtil
;
import
cn.sh.stc.sict.theme.hphy.schedule.RefreshJob
;
import
cn.sh.stc.sict.theme.hphy.service.HpStatisticsService
;
import
cn.sh.stc.sict.theme.hphy.service.HpThirdInterfaceStatusService
;
import
io.swagger.annotations.Api
;
...
...
@@ -30,6 +31,8 @@ public class HpStatisticsController {
private
final
HpThirdInterfaceStatusService
hpThirdInterfaceStatusService
;
private
final
RefreshJob
refreshJob
;
@ApiOperation
(
"统计用户使用情况"
)
@GetMapping
(
"/usage-overview"
)
public
R
statisticsUsage
(
@RequestParam
(
"startTime"
)
String
startTime
,
...
...
@@ -64,4 +67,20 @@ public class HpStatisticsController {
return
new
R
();
}
@ApiOperation
(
"采集万达接口的医院、科室、患者数据"
)
@PutMapping
(
"/gather-wd"
)
@SysLog
public
R
gatherHosDeptDoc
(
@RequestParam
(
"tag"
)
String
tag
)
{
if
(
tag
.
contains
(
"hos"
)){
refreshJob
.
updateHosp
();
}
if
(
tag
.
contains
(
"dept"
)){
refreshJob
.
updateDept
();
}
if
(
tag
.
contains
(
"doc"
)){
refreshJob
.
updateDocInfo
();
}
return
new
R
();
}
}
smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/schedule/RefreshJob.java
View file @
4f5cb72f
...
...
@@ -62,10 +62,7 @@ public class RefreshJob {
MapperFactory
factory
=
new
DefaultMapperFactory
.
Builder
().
build
();
List
<
HpHosInfo
>
hpHosInfos
=
factory
.
getMapperFacade
().
mapAsList
(
list
,
HpHosInfo
.
class
);
for
(
HpHosInfo
hpHosInfo
:
hpHosInfos
)
{
saveOrUpdateHospital
(
hpHosInfo
);
}
hpHosInfoService
.
saveHospital
(
hpHosInfos
);
}
/**
...
...
@@ -80,11 +77,13 @@ public class RefreshJob {
MapperFactory
factory
=
new
DefaultMapperFactory
.
Builder
().
build
();
for
(
HpHosInfo
hospital
:
hospitals
)
{
saveOrUpdateDept
(
hospital
.
getHosOrgCode
(),
factory
);
// 获取一级科室
saveOrUpdateTopDept
(
hospital
.
getHosOrgCode
());
//
saveOrUpdateTopDept(hospital.getHosOrgCode());
// 获取二级科室
saveOrUpdateTwoDept
(
hospital
.
getHosOrgCode
(),
factory
);
//
saveOrUpdateTwoDept(hospital.getHosOrgCode(), factory);
}
}
...
...
@@ -158,6 +157,26 @@ public class RefreshJob {
}
}
private
void
saveOrUpdateDept
(
String
hosOrgCode
,
MapperFactory
factory
)
{
// 一级科室
List
<
DeptInfo
>
deptInfos
=
WanDaHttpUtil
.
getDeptInfoTop
(
new
HosInfo
(
hosOrgCode
));
if
(
CollectionUtil
.
isEmpty
(
deptInfos
))
{
return
;
}
List
<
HpDeptInfo
>
hpDeptInfos
=
cloneTopDept
(
deptInfos
);
deptInfoService
.
saveDept
(
hosOrgCode
,
hpDeptInfos
,
DataConstant
.
TOP_DEPT
);
// 二级科室
List
<
DeptInfo
>
twoDeptInfos
=
WanDaHttpUtil
.
getDeptInfoTwo
(
new
DeptInfo
(
hosOrgCode
));
if
(
CollectionUtil
.
isEmpty
(
twoDeptInfos
))
{
return
;
}
List
<
HpDeptInfo
>
twoDeptList
=
factory
.
getMapperFacade
().
mapAsList
(
twoDeptInfos
,
HpDeptInfo
.
class
);
deptInfoService
.
saveDept
(
hosOrgCode
,
twoDeptList
,
DataConstant
.
TWO_DEPT
);
}
private
void
saveOrUpdateTopDept
(
String
hosOrgCode
)
{
List
<
DeptInfo
>
deptInfos
=
WanDaHttpUtil
.
getDeptInfoTop
(
new
HosInfo
(
hosOrgCode
));
if
(
CollectionUtil
.
isEmpty
(
deptInfos
))
{
...
...
smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HpDeptInfoService.java
View file @
4f5cb72f
...
...
@@ -4,6 +4,8 @@ import cn.sh.stc.sict.theme.hphy.model.HpDeptInfo;
import
cn.sh.stc.sict.theme.hphy.vo.DeptDoctorsVO
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
java.util.List
;
/**
* (HpDeptInfo)表服务接口
*
...
...
@@ -22,7 +24,7 @@ public interface HpDeptInfoService extends IService<HpDeptInfo> {
void
asyncUpdate
(
HpDeptInfo
dept
);
void
saveDept
(
String
hosOrgCode
,
List
<
HpDeptInfo
>
deptList
,
Byte
deptLevel
);
}
smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HpHosInfoService.java
View file @
4f5cb72f
package
cn
.
sh
.
stc
.
sict
.
theme
.
hphy
.
service
;
import
cn.sh.stc.sict.theme.hphy.model.HpDocInfo
;
import
cn.sh.stc.sict.theme.hphy.model.HpHosInfo
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
java.util.List
;
/**
* (HpHosInfo)表服务接口
*
...
...
@@ -16,4 +19,6 @@ public interface HpHosInfoService extends IService<HpHosInfo> {
* @return true-存在;false-不存在
*/
boolean
hospitalExist
(
String
hosOrgCode
);
void
saveHospital
(
List
<
HpHosInfo
>
hosInfos
);
}
\ No newline at end of file
smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HpDeptInfoServiceImpl.java
View file @
4f5cb72f
...
...
@@ -23,6 +23,7 @@ import lombok.AllArgsConstructor;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -118,7 +119,17 @@ public class HpDeptInfoServiceImpl extends ServiceImpl<HpDeptInfoMapper, HpDeptI
return
remainDoctors
;
}
// public static void main(String[] args) {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
saveDept
(
String
hosOrgCode
,
List
<
HpDeptInfo
>
deptList
,
Byte
deptLevel
)
{
this
.
remove
(
new
LambdaQueryWrapper
<
HpDeptInfo
>()
.
eq
(
HpDeptInfo:
:
getHosOrgCode
,
hosOrgCode
)
.
eq
(
HpDeptInfo:
:
getDeptLevel
,
deptLevel
)
);
this
.
saveBatch
(
deptList
);
}
// public static void main(String[] args) {
//
// DeptInfo info = new DeptInfo();
// info.setHosOrgCode("Y0180100700");
...
...
smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HpHosInfoServiceImpl.java
View file @
4f5cb72f
package
cn
.
sh
.
stc
.
sict
.
theme
.
hphy
.
service
.
impl
;
import
cn.sh.stc.sict.theme.hphy.dao.HpHosInfoMapper
;
import
cn.sh.stc.sict.theme.hphy.model.HpDocInfo
;
import
cn.sh.stc.sict.theme.hphy.model.HpHosInfo
;
import
cn.sh.stc.sict.theme.hphy.service.HpHosInfoService
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
/**
* (HpHosInfo)表服务实现类
...
...
@@ -19,4 +24,11 @@ public class HpHosInfoServiceImpl extends ServiceImpl<HpHosInfoMapper, HpHosInfo
public
boolean
hospitalExist
(
String
hosOrgCode
)
{
return
this
.
getById
(
hosOrgCode
)
!=
null
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
saveHospital
(
List
<
HpHosInfo
>
hosInfos
)
{
this
.
remove
(
new
LambdaQueryWrapper
<>());
this
.
saveBatch
(
hosInfos
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment