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
edc1fe66
Commit
edc1fe66
authored
Aug 19, 2022
by
fshenye
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. 提供单个科室统计号源功能
2. 号源统计时,科室内医生也统计号源 3. 号源统计时,标记数据库中医生是否有号源 4. 查询科室医生时,从库中查,综合万达接口的返回
parent
e31be677
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
226 additions
and
72 deletions
+226
-72
HpgpBusyIdlePredictionService.java
...ict/theme/hpgp/service/HpgpBusyIdlePredictionService.java
+1
-1
HpgpBusyIdlePredictionServiceImpl.java
.../hpgp/service/impl/HpgpBusyIdlePredictionServiceImpl.java
+86
-23
HpDeptInfoController.java
...c/sict/theme/hphy/controller/mp/HpDeptInfoController.java
+13
-3
HpDocInfoController.java
...c/sict/theme/hphy/controller/web/HpDocInfoController.java
+1
-0
HpDocInfo.java
.../main/java/cn/sh/stc/sict/theme/hphy/model/HpDocInfo.java
+2
-0
RefreshJob.java
...n/java/cn/sh/stc/sict/theme/hphy/schedule/RefreshJob.java
+2
-1
HpDocInfoService.java
...a/cn/sh/stc/sict/theme/hphy/service/HpDocInfoService.java
+6
-0
HpDeptInfoServiceImpl.java
...c/sict/theme/hphy/service/impl/HpDeptInfoServiceImpl.java
+56
-19
HpDocInfoServiceImpl.java
...tc/sict/theme/hphy/service/impl/HpDocInfoServiceImpl.java
+27
-1
WanDaConstant.java
...main/java/cn/sh/stc/sict/theme/hphy/wd/WanDaConstant.java
+1
-0
WanDaHttpUtil.java
...main/java/cn/sh/stc/sict/theme/hphy/wd/WanDaHttpUtil.java
+31
-24
No files found.
smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/service/HpgpBusyIdlePredictionService.java
View file @
edc1fe66
...
...
@@ -24,7 +24,7 @@ public interface HpgpBusyIdlePredictionService extends IService<HpgpBusyIdlePred
*/
List
<
HpgpBusyIdlePrediction
>
busyIdlePrediction
(
String
deptName
);
void
statisticResourceInfo
(
HpgpDepartmentRank
dept
,
Date
startDate
,
Date
endDate
);
void
statisticResourceInfo
(
HpgpDepartmentRank
dept
,
Date
startDate
,
Date
endDate
,
Byte
flag
);
List
<
HpgpBusyIdlePrediction
>
listByDeptRank
(
HpgpDepartmentRank
dept
,
DateTime
startTime
,
DateTime
endTime
);
}
smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hpgp/service/impl/HpgpBusyIdlePredictionServiceImpl.java
View file @
edc1fe66
...
...
@@ -5,7 +5,9 @@ import cn.hutool.core.collection.CollectionUtil;
import
cn.hutool.core.date.DatePattern
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.json.JSONUtil
;
import
cn.sh.stc.sict.cloud.common.core.constant.Constant
;
import
cn.sh.stc.sict.cloud.common.core.util.NumberUtil
;
import
cn.sh.stc.sict.theme.hpgp.dao.HpgpBusyIdlePredictionMapper
;
import
cn.sh.stc.sict.theme.hpgp.dao.HpgpDepartmentRankMapper
;
...
...
@@ -13,6 +15,8 @@ import cn.sh.stc.sict.theme.hpgp.model.HpgpBusyIdlePrediction;
import
cn.sh.stc.sict.theme.hpgp.model.HpgpDepartmentRank
;
import
cn.sh.stc.sict.theme.hpgp.service.HpgpBusyIdlePredictionService
;
import
cn.sh.stc.sict.theme.hpgp.vo.DeptRankVO
;
import
cn.sh.stc.sict.theme.hphy.model.HpDocInfo
;
import
cn.sh.stc.sict.theme.hphy.service.HpDocInfoService
;
import
cn.sh.stc.sict.theme.hphy.wd.*
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
...
...
@@ -35,6 +39,7 @@ import java.util.stream.Collectors;
@Service
(
"hpgpBusyIdlPredictionService"
)
public
class
HpgpBusyIdlePredictionServiceImpl
extends
ServiceImpl
<
HpgpBusyIdlePredictionMapper
,
HpgpBusyIdlePrediction
>
implements
HpgpBusyIdlePredictionService
{
private
final
HpgpDepartmentRankMapper
departmentRankMapper
;
private
final
HpDocInfoService
hpDocInfoService
;
@Override
public
List
<
HpgpBusyIdlePrediction
>
busyIdlePrediction
(
String
deptName
)
{
...
...
@@ -66,30 +71,39 @@ public class HpgpBusyIdlePredictionServiceImpl extends ServiceImpl<HpgpBusyIdleP
return
vo
;
}
@Async
//
@Async
@Override
public
void
statisticResourceInfo
(
HpgpDepartmentRank
dept
,
Date
startDate
,
Date
endDate
)
{
DeptInfo
deptInfo
=
new
DeptInfo
();
deptInfo
.
setHosOrgCode
(
dept
.
getHospitalCode
());
deptInfo
.
setOneDeptCode
(
dept
.
getOneDeptCode
());
deptInfo
.
setDeptCode
(
dept
.
getDeptCode
());
List
<
OutPatInfo
>
outList
=
WanDaHttpUtil
.
getResourceOutPatInfo
(
deptInfo
);
List
<
DoctInfo
>
docList
=
WanDaHttpUtil
.
getResourceDoctInfo
(
deptInfo
);
if
(
CollUtil
.
isEmpty
(
outList
)
&&
CollUtil
.
isEmpty
(
docList
))
{
return
;
}
Map
<
String
,
HpgpBusyIdlePrediction
>
dateResultMap
=
new
HashMap
<>();
this
.
getOutResourceInfo
(
dept
,
outList
,
dateResultMap
,
startDate
,
endDate
);
this
.
getDocResourceInfo
(
dept
,
docList
,
dateResultMap
,
startDate
,
endDate
);
if
(
CollUtil
.
isNotEmpty
(
dateResultMap
))
{
dateResultMap
.
forEach
((
k
,
v
)
->
{
LambdaQueryWrapper
<
HpgpBusyIdlePrediction
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
HpgpBusyIdlePrediction:
:
getHospitalCode
,
v
.
getHospitalCode
())
.
eq
(
HpgpBusyIdlePrediction:
:
getOneDeptCode
,
v
.
getOneDeptCode
())
.
eq
(
HpgpBusyIdlePrediction:
:
getDeptCode
,
v
.
getDeptCode
())
.
eq
(
HpgpBusyIdlePrediction:
:
getPredictionDate
,
v
.
getPredictionDate
());
this
.
saveOrUpdate
(
v
,
wrapper
);
});
public
void
statisticResourceInfo
(
HpgpDepartmentRank
dept
,
Date
startDate
,
Date
endDate
,
Byte
flag
)
{
try
{
DeptInfo
deptInfo
=
new
DeptInfo
();
deptInfo
.
setHosOrgCode
(
dept
.
getHospitalCode
());
deptInfo
.
setOneDeptCode
(
dept
.
getOneDeptCode
());
deptInfo
.
setDeptCode
(
dept
.
getDeptCode
());
List
<
OutPatInfo
>
outList
=
WanDaHttpUtil
.
getResourceOutPatInfo
(
deptInfo
);
List
<
DoctInfo
>
docList
=
WanDaHttpUtil
.
getResourceDoctInfo
(
deptInfo
);
List
<
HpDocInfo
>
hpDocList
=
hpDocInfoService
.
listByDeptInfo
(
deptInfo
);
if
(
CollUtil
.
isEmpty
(
outList
)
&&
CollUtil
.
isEmpty
(
docList
)
&&
CollUtil
.
isEmpty
(
hpDocList
))
{
return
;
}
Map
<
String
,
HpgpBusyIdlePrediction
>
dateResultMap
=
new
HashMap
<>();
this
.
getOutResourceInfo
(
dept
,
outList
,
dateResultMap
,
startDate
,
endDate
);
this
.
getDocResourceInfo
(
dept
,
docList
,
dateResultMap
,
startDate
,
endDate
);
if
(
Constant
.
BYTE_YES
.
equals
(
flag
))
{
this
.
getHpDocResourceInfo
(
dept
,
hpDocList
,
docList
,
dateResultMap
,
startDate
,
endDate
);
}
if
(
CollUtil
.
isNotEmpty
(
dateResultMap
))
{
dateResultMap
.
forEach
((
k
,
v
)
->
{
LambdaQueryWrapper
<
HpgpBusyIdlePrediction
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
HpgpBusyIdlePrediction:
:
getHospitalCode
,
v
.
getHospitalCode
())
.
eq
(
HpgpBusyIdlePrediction:
:
getOneDeptCode
,
v
.
getOneDeptCode
())
.
eq
(
HpgpBusyIdlePrediction:
:
getDeptCode
,
v
.
getDeptCode
())
.
eq
(
HpgpBusyIdlePrediction:
:
getPredictionDate
,
v
.
getPredictionDate
());
this
.
saveOrUpdate
(
v
,
wrapper
);
});
}
}
catch
(
Exception
e
)
{
log
.
error
(
"统计号源异常, dept = {}"
,
JSONUtil
.
toJsonStr
(
dept
));
log
.
error
(
e
.
getMessage
(),
e
);
}
}
...
...
@@ -141,6 +155,53 @@ public class HpgpBusyIdlePredictionServiceImpl extends ServiceImpl<HpgpBusyIdleP
numSourceInfo
.
setResourceCode
(
doc
.
getResourceCode
());
List
<
NumSourceInfo
>
orderNumInfo
=
WanDaHttpUtil
.
getOrderNumInfo
(
numSourceInfo
);
if
(
CollUtil
.
isNotEmpty
(
orderNumInfo
))
{
hpDocInfoService
.
updateResource
(
numSourceInfo
,
Constant
.
BYTE_YES
);
Map
<
String
,
List
<
NumSourceInfo
>>
dateMap
=
orderNumInfo
.
stream
().
collect
(
Collectors
.
groupingBy
(
NumSourceInfo:
:
getScheduleDate
));
dateMap
.
forEach
((
date
,
numList
)
->
{
HpgpBusyIdlePrediction
vo
=
dateResultMap
.
getOrDefault
(
date
,
new
HpgpBusyIdlePrediction
());
vo
.
setDeptCode
(
dept
.
getDeptCode
());
vo
.
setDeptName
(
dept
.
getDeptName
());
vo
.
setHospitalName
(
dept
.
getHospitalName
());
vo
.
setHospitalCode
(
dept
.
getHospitalCode
());
vo
.
setPredictionDate
(
DateUtil
.
parseDate
(
date
));
vo
.
setOneDeptCode
(
dept
.
getOneDeptCode
());
int
reserveOrderNum
=
numList
.
stream
().
mapToInt
(
NumSourceInfo:
:
getReserveOrderNum
).
sum
();
vo
.
setReserveOrderNum
(
NumberUtil
.
isNullOrZero
(
vo
.
getReserveOrderNum
())
?
reserveOrderNum
:
vo
.
getReserveOrderNum
()
+
reserveOrderNum
);
int
remain
=
numList
.
stream
().
mapToInt
(
NumSourceInfo:
:
getRemainNum
).
sum
();
vo
.
setRemainNum
(
NumberUtil
.
isNullOrZero
(
vo
.
getRemainNum
())
?
remain
:
vo
.
getRemainNum
()
+
remain
);
vo
.
setScoreByNum
();
dateResultMap
.
put
(
date
,
vo
);
});
}
else
{
hpDocInfoService
.
updateResource
(
numSourceInfo
,
Constant
.
BYTE_NO
);
}
});
}
}
private
void
getHpDocResourceInfo
(
HpgpDepartmentRank
dept
,
List
<
HpDocInfo
>
hpDocList
,
List
<
DoctInfo
>
docList
,
Map
<
String
,
HpgpBusyIdlePrediction
>
dateResultMap
,
Date
startDate
,
Date
endDate
)
{
Set
<
String
>
resourceCodeSet
=
CollUtil
.
isEmpty
(
docList
)
?
new
HashSet
<>()
:
docList
.
stream
().
map
(
DoctInfo:
:
getResourceCode
).
collect
(
Collectors
.
toSet
());
if
(
CollUtil
.
isNotEmpty
(
hpDocList
))
{
hpDocList
.
forEach
(
doc
->
{
if
(
StrUtil
.
isEmpty
(
doc
.
getResourceCode
())
||
resourceCodeSet
.
contains
(
doc
.
getResourceCode
()))
{
return
;
}
NumSourceInfo
numSourceInfo
=
new
NumSourceInfo
();
numSourceInfo
.
setHosOrgCode
(
dept
.
getHospitalCode
());
numSourceInfo
.
setOneDeptCode
(
dept
.
getOneDeptCode
());
numSourceInfo
.
setDeptCode
(
dept
.
getDeptCode
());
numSourceInfo
.
setStartTime
(
DateUtil
.
format
(
startDate
,
DatePattern
.
NORM_DATE_FORMAT
));
numSourceInfo
.
setEndTime
(
DateUtil
.
format
(
endDate
,
DatePattern
.
NORM_DATE_FORMAT
));
numSourceInfo
.
setOrderType
(
WanDaConstant
.
ORDER_TYPE_OUTP
);
numSourceInfo
.
setPatient_type
(
WanDaConstant
.
PATIENT_TYPE_NORMAL
);
numSourceInfo
.
setResourceCode
(
doc
.
getResourceCode
());
List
<
NumSourceInfo
>
orderNumInfo
=
WanDaHttpUtil
.
getOrderNumInfo
(
numSourceInfo
);
if
(
CollUtil
.
isNotEmpty
(
orderNumInfo
))
{
hpDocInfoService
.
updateResource
(
numSourceInfo
,
Constant
.
BYTE_YES
);
Map
<
String
,
List
<
NumSourceInfo
>>
dateMap
=
orderNumInfo
.
stream
().
collect
(
Collectors
.
groupingBy
(
NumSourceInfo:
:
getScheduleDate
));
dateMap
.
forEach
((
date
,
numList
)
->
{
HpgpBusyIdlePrediction
vo
=
dateResultMap
.
getOrDefault
(
date
,
new
HpgpBusyIdlePrediction
());
...
...
@@ -157,6 +218,8 @@ public class HpgpBusyIdlePredictionServiceImpl extends ServiceImpl<HpgpBusyIdleP
vo
.
setScoreByNum
();
dateResultMap
.
put
(
date
,
vo
);
});
}
else
{
hpDocInfoService
.
updateResource
(
numSourceInfo
,
Constant
.
BYTE_NO
);
}
});
}
...
...
smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/mp/HpDeptInfoController.java
View file @
edc1fe66
...
...
@@ -3,12 +3,15 @@ package cn.sh.stc.sict.theme.hphy.controller.mp;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.sh.stc.sict.cloud.common.core.constant.Constant
;
import
cn.sh.stc.sict.cloud.common.core.util.R
;
import
cn.sh.stc.sict.theme.hpgp.model.HpgpDepartmentRank
;
import
cn.sh.stc.sict.theme.hpgp.service.HpgpBusyIdlePredictionService
;
import
cn.sh.stc.sict.theme.hpgp.service.HpgpDepartmentRankService
;
import
cn.sh.stc.sict.theme.hphy.model.HpDeptInfo
;
import
cn.sh.stc.sict.theme.hphy.service.HpDeptInfoService
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.api.ApiController
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -67,15 +70,22 @@ public class HpDeptInfoController extends ApiController {
@ApiOperation
(
"定时统计排行科室的号源信息"
)
@PostMapping
(
"/statistic/rank/wd/resource"
)
public
R
statisticRankDeptResourceInfo
()
{
List
<
HpgpDepartmentRank
>
deptList
=
hpgpDepartmentRankService
.
list
();
public
R
statisticRankDeptResourceInfo
(
@RequestParam
(
value
=
"hospCode"
,
required
=
false
)
String
hospCode
,
@RequestParam
(
value
=
"oneDeptCode"
,
required
=
false
)
String
oneDeptCode
,
@RequestParam
(
value
=
"dept"
,
required
=
false
)
String
deptCode
,
@RequestParam
(
value
=
"flag"
,
required
=
false
,
defaultValue
=
Constant
.
STRING_NO
)
Byte
flag
)
{
LambdaQueryWrapper
<
HpgpDepartmentRank
>
wrapper
=
Wrappers
.
lambdaQuery
();
wrapper
.
eq
(
StrUtil
.
isNotEmpty
(
hospCode
),
HpgpDepartmentRank:
:
getHospitalCode
,
hospCode
)
.
eq
(
StrUtil
.
isNotEmpty
(
oneDeptCode
),
HpgpDepartmentRank:
:
getOneDeptCode
,
oneDeptCode
)
.
eq
(
StrUtil
.
isNotEmpty
(
deptCode
),
HpgpDepartmentRank:
:
getDeptCode
,
deptCode
);
List
<
HpgpDepartmentRank
>
deptList
=
hpgpDepartmentRankService
.
list
(
wrapper
);
deptList
.
forEach
(
dept
->
{
if
(
StrUtil
.
isEmpty
(
dept
.
getOneDeptCode
())
||
StrUtil
.
isEmpty
(
dept
.
getDeptCode
()))
{
return
;
}
Date
startDate
=
DateUtil
.
date
();
Date
endDate
=
DateUtil
.
offsetDay
(
startDate
,
10
);
hpgpBusyIdlePredictionService
.
statisticResourceInfo
(
dept
,
startDate
,
endDate
);
hpgpBusyIdlePredictionService
.
statisticResourceInfo
(
dept
,
startDate
,
endDate
,
flag
);
});
return
new
R
();
}
...
...
smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/controller/web/HpDocInfoController.java
View file @
edc1fe66
...
...
@@ -23,4 +23,5 @@ public class HpDocInfoController extends ApiController {
* 服务对象
*/
private
final
HpDocInfoService
hpDocInfoService
;
}
\ No newline at end of file
smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/model/HpDocInfo.java
View file @
edc1fe66
...
...
@@ -55,6 +55,8 @@ public class HpDocInfo extends Model<HpDocInfo> {
@ApiModelProperty
(
hidden
=
false
,
value
=
"是否有资源(0有,1无)"
)
private
String
isResource
;
private
Byte
hasResource
;
/**
* 获取主键值
...
...
smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/schedule/RefreshJob.java
View file @
edc1fe66
...
...
@@ -3,6 +3,7 @@ package cn.sh.stc.sict.theme.hphy.schedule;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.sh.stc.sict.cloud.common.core.constant.Constant
;
import
cn.sh.stc.sict.theme.hpgp.model.HpgpDepartmentRank
;
import
cn.sh.stc.sict.theme.hpgp.service.HpgpBusyIdlePredictionService
;
import
cn.sh.stc.sict.theme.hpgp.service.HpgpDepartmentRankService
;
...
...
@@ -121,7 +122,7 @@ public class RefreshJob {
}
Date
startDate
=
DateUtil
.
date
();
Date
endDate
=
DateUtil
.
offsetDay
(
startDate
,
10
);
hpgpBusyIdlePredictionService
.
statisticResourceInfo
(
dept
,
startDate
,
endDate
);
hpgpBusyIdlePredictionService
.
statisticResourceInfo
(
dept
,
startDate
,
endDate
,
Constant
.
BYTE_NO
);
});
}
...
...
smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/HpDocInfoService.java
View file @
edc1fe66
...
...
@@ -4,6 +4,8 @@ import cn.sh.stc.sict.theme.hphy.model.HpDocInfo;
import
cn.sh.stc.sict.theme.hphy.model.HphyGuideRecord
;
import
cn.sh.stc.sict.theme.hphy.vo.DoctorMatchVO
;
import
cn.sh.stc.sict.theme.hphy.vo.PythonResult
;
import
cn.sh.stc.sict.theme.hphy.wd.DeptInfo
;
import
cn.sh.stc.sict.theme.hphy.wd.NumSourceInfo
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
java.util.List
;
...
...
@@ -26,4 +28,8 @@ public interface HpDocInfoService extends IService<HpDocInfo> {
List
<
DoctorMatchVO
>
getRecommendList
(
HphyGuideRecord
guide
,
List
<
PythonResult
>
pythonList
);
void
saveDoctor
(
List
<
HpDocInfo
>
docInfos
,
String
hosOrgCode
);
List
<
HpDocInfo
>
listByDeptInfo
(
DeptInfo
deptInfo
);
void
updateResource
(
NumSourceInfo
numSourceInfo
,
Byte
hasResource
);
}
\ 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 @
edc1fe66
...
...
@@ -2,14 +2,10 @@ package cn.sh.stc.sict.theme.hphy.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.date.DatePattern
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.json.JSONUtil
;
import
cn.sh.stc.sict.
theme.hpgp.model.HpgpDepartmentRank
;
import
cn.sh.stc.sict.
cloud.common.core.constant.Constant
;
import
cn.sh.stc.sict.theme.hphy.constant.DataConstant
;
import
cn.sh.stc.sict.theme.hphy.dao.HpDeptInfoMapper
;
import
cn.sh.stc.sict.theme.hphy.dao.HpDocInfoMapper
;
import
cn.sh.stc.sict.theme.hphy.dao.HpHosInfoMapper
;
import
cn.sh.stc.sict.theme.hphy.model.HpDeptInfo
;
import
cn.sh.stc.sict.theme.hphy.model.HpDocInfo
;
import
cn.sh.stc.sict.theme.hphy.model.HpHosInfo
;
...
...
@@ -17,7 +13,10 @@ import cn.sh.stc.sict.theme.hphy.service.HpDeptInfoService;
import
cn.sh.stc.sict.theme.hphy.service.HpDocInfoService
;
import
cn.sh.stc.sict.theme.hphy.service.HpHosInfoService
;
import
cn.sh.stc.sict.theme.hphy.vo.DeptDoctorsVO
;
import
cn.sh.stc.sict.theme.hphy.wd.*
;
import
cn.sh.stc.sict.theme.hphy.wd.DeptInfo
;
import
cn.sh.stc.sict.theme.hphy.wd.DoctInfo
;
import
cn.sh.stc.sict.theme.hphy.wd.OutPatInfo
;
import
cn.sh.stc.sict.theme.hphy.wd.WanDaHttpUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
lombok.AllArgsConstructor
;
...
...
@@ -25,7 +24,9 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -60,8 +61,10 @@ public class HpDeptInfoServiceImpl extends ServiceImpl<HpDeptInfoMapper, HpDeptI
}
LambdaQueryWrapper
<
HpDocInfo
>
docWrapper
=
new
LambdaQueryWrapper
<>();
docWrapper
.
eq
(
HpDocInfo:
:
getHosOrgCode
,
hospitalCode
);
docWrapper
.
eq
(
HpDocInfo:
:
getOneDeptCode
,
deptInfo
.
getOneDeptCode
());
docWrapper
.
eq
(
HpDocInfo:
:
getHosOrgCode
,
hospitalCode
)
.
eq
(
HpDocInfo:
:
getOneDeptCode
,
deptInfo
.
getOneDeptCode
())
.
eq
(
HpDocInfo:
:
getHasResource
,
Constant
.
BYTE_YES
);
if
(
DataConstant
.
TWO_DEPT
.
equals
(
deptInfo
.
getDeptLevel
()))
{
docWrapper
.
eq
(
HpDocInfo:
:
getDeptCode
,
deptInfo
.
getDeptCode
());
}
...
...
@@ -103,10 +106,9 @@ public class HpDeptInfoServiceImpl extends ServiceImpl<HpDeptInfoMapper, HpDeptI
private
List
<
HpDocInfo
>
getRemainDoctList
(
List
<
HpDocInfo
>
doctors
,
List
<
DoctInfo
>
resourceDoctInfo
)
{
Map
<
String
,
HpDocInfo
>
doctorMap
=
doctors
.
stream
().
collect
(
Collectors
.
groupingBy
(
HpDocInfo:
:
getResourceCode
,
Collectors
.
collectingAndThen
(
Collectors
.
toList
(),
x
->
x
.
get
(
0
))));
List
<
HpDocInfo
>
remainDoctors
=
new
ArrayList
<>();
remainDoctors
.
addAll
(
doctors
);
resourceDoctInfo
.
forEach
(
res
->
{
if
(
doctorMap
.
containsKey
(
res
.
getResourceCode
())){
remainDoctors
.
add
(
doctorMap
.
get
(
res
.
getResourceCode
()));
}
else
{
if
(!
doctorMap
.
containsKey
(
res
.
getResourceCode
()))
{
HpDocInfo
doctor
=
BeanUtil
.
toBean
(
res
,
HpDocInfo
.
class
);
hpDocInfoService
.
save
(
doctor
);
remainDoctors
.
add
(
doctor
);
...
...
@@ -161,21 +163,56 @@ public class HpDeptInfoServiceImpl extends ServiceImpl<HpDeptInfoMapper, HpDeptI
// List<NumSourceInfo> list = WanDaHttpUtil.getOrderNumInfo(numSourceInfo);
//
// log.error("list = {}", JSONUtil.toJsonStr(list));
// NumSourceInfo numSourceInfo = new NumSourceInfo();
// numSourceInfo.setHosOrgCode(orgCode);
// numSourceInfo.setOneDeptCode(oneDeptCode);
// numSourceInfo.setDeptCode(deptCode);
// numSourceInfo.setOrderType(WanDaConstant.ORDER_TYPE_DOCT);
// numSourceInfo.setResourceCode(docResourceCode);
// numSourceInfo.setPatient_type(WanDaConstant.PATIENT_TYPE_NORMAL);
// numSourceInfo.setStartTime("2022-08-20");
// numSourceInfo.setEndTime("2022-09-03");
// List<NumSourceInfo> result = WanDaHttpUtil.getOrderNumInfo(numSourceInfo);
// log.error("numSourceInfo = {}", JSONUtil.toJsonStr(result));
// NumSourceInfo numSourceInfo = new NumSourceInfo();
// numSourceInfo.setHosOrgCode(orgCode);
// numSourceInfo.setOneDeptCode(oneDeptCode);
// numSourceInfo.setDeptCode(deptCode);
// numSourceInfo.setOrderType(WanDaConstant.ORDER_TYPE_CLINC);
// numSourceInfo.setResourceCode(deptCode);
// numSourceInfo.setPatient_type(WanDaConstant.PATIENT_TYPE_NORMAL);
// numSourceInfo.setStartTime("2022-08-20");
// numSourceInfo.setEndTime("2022-09-03");
// List<NumSourceInfo> result = WanDaHttpUtil.getOrderNumInfo(numSourceInfo);
// log.error("numSourceInfo = {}", JSONUtil.toJsonStr(result));
// }
/**
* 消化内科 42503527600 上海市瑞金医院卢湾分院 1013 3122 消化科 1 1013 3122
* 消化内科 Y0180100700 上海交通大学医学院附属第九人民医院黄浦分院 293 3 消化内科 2 293 3
* 消化内科 42502763900 黄浦区肿瘤防治院 10 0002 消化专科 3 10 0002
* E7880343800 50 2006
* Y0180100700 293 3 上海交通大学医学院附属第九人民医院黄浦分院 内科 消化内科 03.02 消化内科
* Y0180100700 293 6 上海交通大学医学院附属第九人民医院黄浦分院 内科 心血管内科 03.04 心血管内科
* @param args
*/
// public static void main(String[] args) {
// String orgCode = "E7880343800";
// String oneDeptCode = "50";
// String deptCode = "2006";
// String orgCode = "Y0180100700";
// String oneDeptCode = "293";
// String deptCode = "2";
// String docResourceCode = "175"; // 陈芳
//
// NumSourceInfo numSourceInfo = new NumSourceInfo();
// numSourceInfo.setHosOrgCode(orgCode);
// numSourceInfo.setOneDeptCode(oneDeptCode);
// numSourceInfo.setDeptCode(deptCode);
// numSourceInfo.setOrderType(WanDaConstant.ORDER_TYPE_DOCT);
// numSourceInfo.setResourceCode(docResourceCode);
// numSourceInfo.setPatient_type(WanDaConstant.PATIENT_TYPE_NORMAL);
// numSourceInfo.setStartTime("2022-08-20");
// numSourceInfo.setEndTime("2022-09-03");
// List<NumSourceInfo> result = WanDaHttpUtil.getOrderNumInfo(numSourceInfo);
// log.error("numSourceInfo = {}", JSONUtil.toJsonStr(result));
// HosInfo hosInfo = new HosInfo();
// hosInfo.setHosOrgCode(orgCode);
// List<DeptInfo> oneDeptInfo = WanDaHttpUtil.getDeptInfoTop(hosInfo);
...
...
smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/service/impl/HpDocInfoServiceImpl.java
View file @
edc1fe66
package
cn
.
sh
.
stc
.
sict
.
theme
.
hphy
.
service
.
impl
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.sh.stc.sict.theme.hphy.dao.HpDocInfoMapper
;
import
cn.sh.stc.sict.theme.hphy.model.HpDocInfo
;
import
cn.sh.stc.sict.theme.hphy.model.HphyGuideMatch
;
...
...
@@ -9,7 +10,11 @@ import cn.sh.stc.sict.theme.hphy.service.HpDocInfoService;
import
cn.sh.stc.sict.theme.hphy.service.HphyGuideMatchService
;
import
cn.sh.stc.sict.theme.hphy.vo.DoctorMatchVO
;
import
cn.sh.stc.sict.theme.hphy.vo.PythonResult
;
import
cn.sh.stc.sict.theme.hphy.wd.DeptInfo
;
import
cn.sh.stc.sict.theme.hphy.wd.HosInfo
;
import
cn.sh.stc.sict.theme.hphy.wd.NumSourceInfo
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
lombok.AllArgsConstructor
;
import
org.springframework.stereotype.Service
;
...
...
@@ -41,7 +46,7 @@ public class HpDocInfoServiceImpl extends ServiceImpl<HpDocInfoMapper, HpDocInfo
@Override
public
List
<
DoctorMatchVO
>
getRecommendList
(
HphyGuideRecord
guide
,
List
<
PythonResult
>
pythonList
)
{
List
<
DoctorMatchVO
>
result
=
new
ArrayList
<>();
if
(
CollUtil
.
isNotEmpty
(
pythonList
))
{
if
(
CollUtil
.
isNotEmpty
(
pythonList
))
{
Map
<
String
,
Double
>
matchMap
=
pythonList
.
stream
().
collect
(
Collectors
.
toMap
(
PythonResult:
:
getDoctorId
,
PythonResult:
:
getMatchScore
));
List
<
String
>
doctorIdList
=
pythonList
.
stream
().
map
(
PythonResult:
:
getDoctorId
).
collect
(
Collectors
.
toList
());
LambdaQueryWrapper
<
HpDocInfo
>
wrapper
=
new
LambdaQueryWrapper
<>();
...
...
@@ -82,4 +87,25 @@ public class HpDocInfoServiceImpl extends ServiceImpl<HpDocInfoMapper, HpDocInfo
this
.
remove
(
new
LambdaQueryWrapper
<
HpDocInfo
>().
eq
(
HpDocInfo:
:
getHosOrgCode
,
hosOrgCode
));
this
.
saveBatch
(
docInfos
);
}
@Override
public
List
<
HpDocInfo
>
listByDeptInfo
(
DeptInfo
deptInfo
)
{
LambdaQueryWrapper
<
HpDocInfo
>
wrapper
=
Wrappers
.
lambdaQuery
();
wrapper
.
eq
(
HpDocInfo:
:
getHosOrgCode
,
deptInfo
.
getHosOrgCode
())
.
eq
(
HpDocInfo:
:
getOneDeptCode
,
deptInfo
.
getOneDeptCode
())
.
eq
(
StrUtil
.
isNotEmpty
(
deptInfo
.
getDeptCode
()),
HpDocInfo:
:
getDeptCode
,
deptInfo
.
getDeptCode
());
return
this
.
list
(
wrapper
);
}
@Override
public
void
updateResource
(
NumSourceInfo
num
,
Byte
hasResource
)
{
LambdaQueryWrapper
<
HpDocInfo
>
wrapper
=
Wrappers
.
lambdaQuery
();
wrapper
.
eq
(
HpDocInfo:
:
getHosOrgCode
,
num
.
getHosOrgCode
())
.
eq
(
HpDocInfo:
:
getOneDeptCode
,
num
.
getOneDeptCode
())
.
eq
(
StrUtil
.
isNotEmpty
(
num
.
getDeptCode
()),
HpDocInfo:
:
getDeptCode
,
num
.
getDeptCode
())
.
eq
(
HpDocInfo:
:
getResourceCode
,
num
.
getResourceCode
());
HpDocInfo
update
=
new
HpDocInfo
();
update
.
setHasResource
(
hasResource
);
this
.
update
(
update
,
wrapper
);
}
}
\ No newline at end of file
smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/wd/WanDaConstant.java
View file @
edc1fe66
...
...
@@ -5,6 +5,7 @@ public class WanDaConstant {
/**
* 预约类型:1-医生 2-门诊
*/
public
static
final
String
ORDER_TYPE_DOCT
=
"1"
;
public
static
final
String
ORDER_TYPE_OUTP
=
"1"
;
public
static
final
String
ORDER_TYPE_CLINC
=
"2"
;
...
...
smart-health-modules/theme-schema/src/main/java/cn/sh/stc/sict/theme/hphy/wd/WanDaHttpUtil.java
View file @
edc1fe66
...
...
@@ -197,28 +197,35 @@ public class WanDaHttpUtil {
*/
public
List
<
NumSourceInfo
>
getOrderNumInfo
(
NumSourceInfo
numSourceInfo
)
{
String
xml
=
WanDaUtil
.
GetOrderNumInfoServiceXML
(
numSourceInfo
);
String
body
=
HttpRequest
.
post
(
URL
)
.
body
(
xml
)
.
execute
()
.
body
();
if
(
StrUtil
.
isBlank
(
body
))
{
log
.
error
(
"号源查询 失败"
);
return
null
;
}
// log.info("号源查询:body = {}", body);
String
returnXml
=
getReturn
(
body
,
"GetOrderNumInfoService"
);
if
(
Constant
.
STRING_NO
.
equals
(
getCode
(
returnXml
)))
{
Document
document
=
XmlUtil
.
readXML
(
returnXml
);
NodeList
nodeList
=
document
.
getElementsByTagName
(
"NumSourceInfo"
);
List
<
NumSourceInfo
>
list
=
new
ArrayList
<>();
if
(
null
!=
nodeList
&&
nodeList
.
getLength
()
>
0
)
{
for
(
int
i
=
0
;
i
<
nodeList
.
getLength
();
i
++)
{
list
.
add
(
XmlUtil
.
xmlToBean
(
nodeList
.
item
(
i
),
NumSourceInfo
.
class
));
String
body
=
""
;
try
{
body
=
HttpRequest
.
post
(
URL
)
.
body
(
xml
)
.
execute
()
.
body
();
if
(
StrUtil
.
isBlank
(
body
))
{
log
.
error
(
"号源查询 失败"
);
return
null
;
}
String
returnXml
=
getReturn
(
body
,
"GetOrderNumInfoService"
);
if
(
Constant
.
STRING_NO
.
equals
(
getCode
(
returnXml
)))
{
Document
document
=
XmlUtil
.
readXML
(
returnXml
);
NodeList
nodeList
=
document
.
getElementsByTagName
(
"NumSourceInfo"
);
List
<
NumSourceInfo
>
list
=
new
ArrayList
<>();
if
(
null
!=
nodeList
&&
nodeList
.
getLength
()
>
0
)
{
for
(
int
i
=
0
;
i
<
nodeList
.
getLength
();
i
++)
{
list
.
add
(
XmlUtil
.
xmlToBean
(
nodeList
.
item
(
i
),
NumSourceInfo
.
class
));
}
}
return
list
;
}
else
{
return
null
;
}
return
list
;
}
else
{
}
catch
(
Exception
e
){
log
.
error
(
"号源查询失败,num = {}"
,
JSONUtil
.
toJsonStr
(
numSourceInfo
));
log
.
error
(
"号源查询失败,body = {}"
,
body
);
log
.
error
(
e
.
getMessage
(),
e
);
return
null
;
}
}
...
...
@@ -416,7 +423,7 @@ public class WanDaHttpUtil {
*/
public
List
<
DoctInfo
>
getResourceDoctInfo
(
DeptInfo
deptInfo
)
{
String
xml
=
WanDaUtil
.
GetResourceDoctInfoServiceXML
(
deptInfo
);
//log.error("获取可预约医生信息 xml = {}", xml);
String
body
=
HttpRequest
.
post
(
URL
)
.
body
(
xml
)
.
execute
()
...
...
@@ -426,7 +433,7 @@ public class WanDaHttpUtil {
log
.
error
(
"获取可预约医生信息 失败"
);
return
null
;
}
//
log.info("获取可预约医生信息:body = {}", body);
//log.info("获取可预约医生信息:body = {}", body);
String
returnXml
=
getReturn
(
body
,
"GetResourceDoctInfoService"
);
return
serialDoctInfo
(
returnXml
);
}
...
...
@@ -439,7 +446,7 @@ public class WanDaHttpUtil {
*/
public
List
<
OutPatInfo
>
getResourceOutPatInfo
(
DeptInfo
deptInfo
)
{
String
xml
=
WanDaUtil
.
GetResourceOutPatInfoServiceXML
(
deptInfo
);
//
log.error("
xml = {}", xml);
//
log.error("获取可预约门诊信息
xml = {}", xml);
String
body
=
HttpRequest
.
post
(
URL
)
.
body
(
xml
)
.
execute
()
...
...
@@ -449,7 +456,7 @@ public class WanDaHttpUtil {
log
.
error
(
"查询门诊信息失败"
);
return
null
;
}
//
log.info("查询门诊信息:body = {}", body);
//log.info("查询门诊信息:body = {}", body);
String
returnXml
=
getReturn
(
body
,
"GetResourceOutPatInfoService"
);
return
serialOutPatInfo
(
returnXml
);
}
...
...
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