Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
performance
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zry
performance
Commits
a81b9382
Commit
a81b9382
authored
Jan 22, 2021
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
抽取数据前检查科室、收费类型是否缺失,配置成本收入抽取项时根据sheettype返回相应的数据
parent
b4ee3f44
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
170 additions
and
46 deletions
+170
-46
performance/Performance.Api/Controllers/ExConfigController.cs
+1
-1
performance/Performance.Api/Controllers/TemplateController.cs
+4
-7
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
+4
-4
performance/Performance.Extract.Api/Controllers/ModExtractController.cs
+34
-30
performance/Performance.Services/ExConfigService.cs
+126
-3
performance/Performance.Services/ExtractExcelService/QueryService.cs
+1
-1
No files found.
performance/Performance.Api/Controllers/ExConfigController.cs
View file @
a81b9382
...
...
@@ -44,7 +44,7 @@ public ApiResponse Extract([CustomizeValidator(RuleSet = "Query"), FromBody] Mod
if
(
request
.
ExecuteType
==
null
||
!
request
.
ExecuteType
.
Any
())
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"ExecuteType 不存在,请重新选择!"
);
var
list
=
configService
.
ExtractScheme
(
request
.
HospitalId
.
Value
,
request
.
ExecuteType
);
var
list
=
configService
.
ExtractScheme
(
request
.
HospitalId
.
Value
,
request
.
ExecuteType
,
request
.
SheetType
);
return
new
ApiResponse
(
ResponseType
.
OK
,
list
);
}
...
...
performance/Performance.Api/Controllers/TemplateController.cs
View file @
a81b9382
...
...
@@ -31,9 +31,8 @@ public class TemplateController : Controller
private
readonly
WebapiUrl
url
;
private
readonly
Application
application
;
private
readonly
TemplateService
templateService
;
private
readonly
DFExtractService
extractService
;
private
readonly
ExtractIncomeService
extractIncomeService
;
private
readonly
Ex
tractService
extractE
Service
;
private
readonly
Ex
ConfigService
config
Service
;
private
readonly
HospitalService
hospitalService
;
private
readonly
AllotService
allotService
;
private
readonly
LogManageService
logService
;
...
...
@@ -46,9 +45,8 @@ public class TemplateController : Controller
IOptions
<
WebapiUrl
>
url
,
IOptions
<
Application
>
options
,
TemplateService
templateService
,
DFExtractService
extractService
,
ExtractIncomeService
extractIncomeService
,
Ex
tractService
extractE
Service
,
Ex
ConfigService
config
Service
,
HospitalService
hospitalService
,
AllotService
allotService
,
LogManageService
logService
,
...
...
@@ -60,9 +58,8 @@ public class TemplateController : Controller
this
.
url
=
url
.
Value
;
this
.
application
=
options
.
Value
;
this
.
templateService
=
templateService
;
this
.
extractService
=
extractService
;
this
.
extractIncomeService
=
extractIncomeService
;
this
.
extractEService
=
extractE
Service
;
this
.
configService
=
config
Service
;
this
.
hospitalService
=
hospitalService
;
this
.
allotService
=
allotService
;
this
.
logService
=
logService
;
...
...
@@ -184,7 +181,7 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
try
{
bool
isSingle
=
false
;
string
message
=
extract
Service
.
Judge
(
request
.
AllotId
,
request
.
HospitalId
,
request
.
UseScheme
,
ref
isSingle
,
out
string
filePath
);
string
message
=
config
Service
.
Judge
(
request
.
AllotId
,
request
.
HospitalId
,
request
.
UseScheme
,
ref
isSingle
,
out
string
filePath
);
if
(!
string
.
IsNullOrEmpty
(
message
))
return
new
ApiResponse
(
ResponseType
.
Fail
,
message
);
...
...
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
View file @
a81b9382
...
...
@@ -180,11 +180,11 @@
<summary>
日期
</summary>
</member>
<member
name=
"M:Performance.DtoModels.HandsonTable.SetRowData(System.Collections.Generic.IEnumerable{Performance.DtoModels.HandsonRowData},System.Boolean)"
>
<summary>
<summary>
</summary>
<param
name=
"datas"
></param>
<param
name=
"isTypein"
>
是否是用户录入的 是:true 不是:false
</param>
</summary>
<param
name=
"datas"
></param>
<param
name=
"isTypein"
>
是否是用户录入的 是:true 不是:false
</param>
</member>
<member
name=
"P:Performance.DtoModels.HistoryData.Year"
>
<summary>
...
...
performance/Performance.Extract.Api/Controllers/ModExtractController.cs
View file @
a81b9382
...
...
@@ -16,6 +16,7 @@ public class ModExtractController : Controller
{
private
readonly
ILogger
<
ModExtractController
>
logger
;
private
ExConfigService
service
;
public
ModExtractController
(
ILogger
<
ModExtractController
>
logger
,
ExConfigService
service
)
...
...
@@ -24,34 +25,38 @@ public class ModExtractController : Controller
this
.
service
=
service
;
}
/// <summary>
/// 绩效数据抽取模板
/// </summary>
/// <returns></returns>
[
Route
(
"scheme"
)]
[
HttpPost
]
public
ApiResponse
Extract
([
CustomizeValidator
(
RuleSet
=
"Query"
),
FromBody
]
ModModuleRequest
request
)
{
if
(
request
.
HospitalId
==
null
||
request
.
HospitalId
.
Value
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"HospitalId 不存在,请重新选择!"
);
if
(
request
.
ExecuteType
==
null
||
!
request
.
ExecuteType
.
Any
())
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"ExecuteType 不存在,请重新选择!"
);
#
region
弃用
var
list
=
service
.
ExtractScheme
(
request
.
HospitalId
.
Value
,
request
.
ExecuteType
);
return
new
ApiResponse
(
ResponseType
.
OK
,
list
);
}
///// <summary>
///// 绩效数据抽取模板
///// </summary>
///// <returns></returns>
//[Route("scheme")]
//[HttpPost]
//public ApiResponse Extract([CustomizeValidator(RuleSet = "Query"), FromBody]ModModuleRequest request)
//{
// if (request.HospitalId == null || request.HospitalId.Value == 0)
// return new ApiResponse(ResponseType.ParameterError, "HospitalId 不存在,请重新选择!");
// if (request.ExecuteType == null || !request.ExecuteType.Any())
// return new ApiResponse(ResponseType.ParameterError, "ExecuteType 不存在,请重新选择!");
/// <summary>
/// 费用类型
/// </summary>
/// <returns></returns>
[
Route
(
"type"
)]
[
HttpPost
]
public
ApiResponse
FeeType
()
{
var
list
=
service
.
FeeType
();
return
new
ApiResponse
(
ResponseType
.
OK
,
list
);
}
// var list = service.ExtractScheme(request.HospitalId.Value, request.ExecuteType);
// return new ApiResponse(ResponseType.OK, list);
//}
///// <summary>
///// 费用类型
///// </summary>
///// <returns></returns>
//[Route("type")]
//[HttpPost]
//public ApiResponse FeeType()
//{
// var list = service.FeeType();
// return new ApiResponse(ResponseType.OK, list);
//}
#
endregion
弃用
/// <summary>
/// 绩效考核项费用来源
...
...
@@ -59,7 +64,7 @@ public ApiResponse FeeType()
/// <returns></returns>
[
Route
(
"source"
)]
[
HttpPost
]
public
ApiResponse
FeeSource
([
FromBody
]
ModModuleRequest
request
)
public
ApiResponse
FeeSource
([
FromBody
]
ModModuleRequest
request
)
{
if
(
request
.
HospitalId
==
null
||
request
.
HospitalId
.
Value
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"HospitalId 参数错误!"
);
...
...
@@ -75,11 +80,11 @@ public ApiResponse FeeSource([FromBody]ModModuleRequest request)
/// <returns></returns>
[
Route
(
"items"
)]
[
HttpPost
]
public
ApiResponse
Items
([
FromBody
]
ModItemRequest
request
)
public
ApiResponse
Items
([
FromBody
]
ModItemRequest
request
)
{
logger
.
LogInformation
(
$"绩效收入模板配置项列表:
{
JsonHelper
.
Serialize
(
request
)}
"
);
service
.
AddItems
(
request
.
ModuleId
.
Value
);
return
new
ApiResponse
(
ResponseType
.
OK
);
}
}
}
\ No newline at end of file
}
performance/Performance.Services/ExConfigService.cs
View file @
a81b9382
...
...
@@ -4,6 +4,7 @@
using
Performance.EntityModels
;
using
Performance.Infrastructure
;
using
Performance.Repository
;
using
Performance.Services.ExtractExcelService
;
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
...
...
@@ -22,10 +23,13 @@ public class ExConfigService : IAutoInjection
private
readonly
PerforExitemRepository
exitemRepository
;
private
readonly
PerforExspecialRepository
exspecialRepository
;
private
readonly
PerforPerallotRepository
perallotRepository
;
private
readonly
PerforPersheetRepository
persheetRepository
;
private
readonly
PerforImdataRepository
imdataRepository
;
private
readonly
PerforHospitalconfigRepository
hospitalconfigRepository
;
private
readonly
PerforHospitalRepository
hospitalRepository
;
private
readonly
PerforExtractRepository
extractRepository
;
private
readonly
PerforModdicRepository
moddicRepository
;
private
readonly
QueryService
queryService
;
private
readonly
ILogger
logger
;
public
ExConfigService
(
PerforExtypeRepository
extypeRepository
,
...
...
@@ -34,11 +38,15 @@ public class ExConfigService : IAutoInjection
PerforExitemRepository
exitemRepository
,
PerforExspecialRepository
exspecialRepository
,
PerforPerallotRepository
perallotRepository
,
PerforPersheetRepository
persheetRepository
,
PerforImdataRepository
imdataRepository
,
PerforHospitalconfigRepository
hospitalconfigRepository
,
PerforHospitalRepository
hospitalRepository
,
PerforExtractRepository
extractRepository
,
PerforModdicRepository
moddicRepository
,
ILogger
<
ExConfigService
>
logger
)
QueryService
queryService
,
ILogger
<
ExConfigService
>
logger
)
{
this
.
extypeRepository
=
extypeRepository
;
this
.
exscriptRepository
=
exscriptRepository
;
...
...
@@ -46,10 +54,13 @@ public class ExConfigService : IAutoInjection
this
.
exitemRepository
=
exitemRepository
;
this
.
exspecialRepository
=
exspecialRepository
;
this
.
perallotRepository
=
perallotRepository
;
this
.
persheetRepository
=
persheetRepository
;
this
.
imdataRepository
=
imdataRepository
;
this
.
hospitalconfigRepository
=
hospitalconfigRepository
;
this
.
hospitalRepository
=
hospitalRepository
;
this
.
extractRepository
=
extractRepository
;
this
.
moddicRepository
=
moddicRepository
;
this
.
queryService
=
queryService
;
this
.
logger
=
logger
;
}
...
...
@@ -476,12 +487,14 @@ public List<sys_hospitalconfig> GetHospitalconfigs(int hospitalId)
/// 绩效数据抽取模板
/// </summary>
/// <returns></returns>
public
List
<
TitleValue
>
ExtractScheme
(
int
hospitalId
,
List
<
int
>
executeType
)
public
List
<
TitleValue
>
ExtractScheme
(
int
hospitalId
,
List
<
int
>
executeType
,
int
?
sheetType
)
{
var
titlevalue
=
new
List
<
TitleValue
>();
Expression
<
Func
<
ex_type
,
bool
>>
exp
=
t
=>
new
List
<
int
>
{
0
,
hospitalId
}.
Contains
(
t
.
HospitalId
);
if
(
executeType
.
FirstOrDefault
()
==
1
)
exp
=
exp
.
And
(
t
=>
t
.
Source
==
(
int
)
SheetType
.
Income
);
else
if
(
sheetType
!=
null
&&
!
new
int
[]
{
0
,
(
int
)
SheetType
.
Income
}.
Contains
(
sheetType
.
Value
))
exp
=
exp
.
And
(
t
=>
t
.
Source
==
sheetType
);
else
exp
=
exp
.
And
(
t
=>
t
.
Source
!=
(
int
)
SheetType
.
Income
);
...
...
@@ -513,7 +526,15 @@ public List<TitleValue> ExtractScheme(int hospitalId, List<int> executeType)
public
List
<
TitleValue
>
FeeType
()
{
var
titlevalue
=
new
List
<
TitleValue
>();
var
type
=
EnumHelper
.
GetItems
<
SheetType
>().
Where
(
t
=>
new
List
<
int
>
{
(
int
)
SheetType
.
Income
,
(
int
)
SheetType
.
OtherIncome
,
(
int
)
SheetType
.
Expend
,
(
int
)
SheetType
.
Workload
,
(
int
)
SheetType
.
SpecialUnit
,
(
int
)
SheetType
.
OtherWorkload
}.
Contains
(
t
.
Value
));
var
type
=
EnumHelper
.
GetItems
<
SheetType
>().
Where
(
t
=>
new
List
<
int
>
{
(
int
)
SheetType
.
Income
,
(
int
)
SheetType
.
OtherIncome
,
(
int
)
SheetType
.
Expend
,
(
int
)
SheetType
.
Workload
,
(
int
)
SheetType
.
SpecialUnit
,
(
int
)
SheetType
.
OtherWorkload
}.
Contains
(
t
.
Value
));
if
(
type
!=
null
&&
type
.
Any
())
{
titlevalue
=
type
.
Select
(
t
=>
new
TitleValue
...
...
@@ -571,5 +592,107 @@ public ModFeeResponse FeeSource(ModModuleRequest request)
return
new
ModFeeResponse
();
}
#
region
配置校验
/// <summary>
/// 配置校验
/// </summary>
/// <param name="allotId"></param>
/// <param name="hospitalId"></param>
/// <param name="useTemplate"></param>
public
string
Judge
(
int
allotId
,
int
hospitalId
,
int
useTemplate
,
ref
bool
isSingle
,
out
string
filePath
)
{
string
result
=
null
;
filePath
=
""
;
try
{
// 获取绩效信息
var
allot
=
perallotRepository
.
GetEntity
(
t
=>
t
.
ID
==
allotId
);
if
(
allot
==
null
)
throw
new
PerformanceException
(
"AllotID错误"
);
// 获取医院信息
var
hospital
=
hospitalRepository
.
GetEntity
(
t
=>
t
.
ID
==
hospitalId
);
if
(
hospital
==
null
)
throw
new
PerformanceException
(
"医院ID错误"
);
isSingle
=
(
hospital
.
IsSingleProject
??
2
)
==
1
;
// 获取医院配置信息
var
hospitalConfigList
=
hospitalconfigRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
if
(
hospitalConfigList
==
null
||
hospitalConfigList
.
Count
==
0
)
throw
new
PerformanceException
(
"当前医院暂不支持HIS数据抽取"
);
// 获取最近一次绩效
var
statesArray
=
new
int
[]
{
(
int
)
AllotStates
.
GenerateSucceed
,
(
int
)
AllotStates
.
Archive
};
var
allotList
=
perallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
&&
statesArray
.
Contains
(
t
.
States
));
var
allotLast
=
allotList
?.
OrderByDescending
(
t
=>
t
.
Year
).
ThenByDescending
(
t
=>
t
.
Month
).
First
();
if
(
allotLast
!=
null
)
filePath
=
allotLast
.
Path
;
// 获取当前医院模版信息
var
modulesList
=
exmoduleRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
if
(
modulesList
==
null
||
modulesList
.
Count
==
0
)
throw
new
PerformanceException
(
"当前医院还未配置模版"
);
// 获取模板项
var
moduleIdList
=
modulesList
.
Select
(
t
=>
t
.
Id
).
ToList
();
var
itemsList
=
exitemRepository
.
GetEntities
(
t
=>
t
.
ModuleId
.
HasValue
&&
moduleIdList
.
Contains
(
t
.
ModuleId
.
Value
));
if
(
itemsList
==
null
||
itemsList
.
Count
==
0
)
throw
new
PerformanceException
(
"当前医院还未配置模版项"
);
// 获取当前模板所有相关抽取SQL语句
var
extypeIds
=
itemsList
.
Select
(
t
=>
t
.
TypeId
).
Union
(
modulesList
.
Select
(
t
=>
t
.
TypeId
)).
Distinct
().
ToList
();
var
extractList
=
exscriptRepository
.
GetEntities
(
t
=>
extypeIds
.
Contains
(
t
.
TypeId
));
if
(
extractList
==
null
||
extractList
.
Count
==
0
)
throw
new
PerformanceException
(
"当前医院配置模板无需抽取"
);
}
catch
(
PerformanceException
ex
)
{
logger
.
LogError
(
$"提取绩效数据异常
{
ex
.
ToString
()}
"
);
result
=
ex
.
Message
;
}
catch
(
Exception
ex
)
{
logger
.
LogError
(
$"提取绩效数据异常
{
ex
.
ToString
()}
"
);
throw
new
Exception
(
ex
.
Message
);
}
return
result
;
}
#
endregion
配置校验
#
region
检查是否有新增的科室或费用类别
public
void
CheckHasNewDepartmentOrCategory
(
int
allotId
)
{
var
allot
=
perallotRepository
.
GetEntity
(
t
=>
t
.
ID
==
allotId
);
var
allotList
=
perallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
allot
.
HospitalId
&&
new
int
[]
{
(
int
)
AllotStates
.
GenerateSucceed
,
(
int
)
AllotStates
.
Archive
}.
Contains
(
t
.
States
));
var
prevAllot
=
allotList
?.
OrderByDescending
(
t
=>
t
.
Year
).
ThenByDescending
(
t
=>
t
.
Month
).
First
();
if
(
prevAllot
!=
null
)
return
;
var
modDics
=
moddicRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
allot
.
HospitalId
&&
t
.
Type
==
"checksql"
);
if
(
modDics
==
null
||
!
modDics
.
Any
())
return
;
var
hospitalconfigs
=
hospitalconfigRepository
.
GetEntities
(
t
=>
modDics
.
Select
(
s
=>
s
.
ConfigId
).
Distinct
().
Contains
(
t
.
Id
));
if
(
hospitalconfigs
==
null
||
!
hospitalconfigs
.
Any
())
return
;
var
sheets
=
persheetRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
prevAllot
.
ID
&&
t
.
SheetType
==
(
int
)
SheetType
.
Income
);
var
importdata
=
imdataRepository
.
GetEntities
(
t
=>
sheets
.
Select
(
s
=>
s
.
ID
).
Contains
(
t
.
SheetID
.
Value
));
Dictionary
<
string
,
object
>
paramtemers
=
new
Dictionary
<
string
,
object
>();
foreach
(
var
dic
in
modDics
)
{
if
(
paramtemers
.
ContainsKey
(
dic
.
Remark
))
continue
;
var
config
=
hospitalconfigs
.
FirstOrDefault
(
t
=>
t
.
Id
==
dic
.
ConfigId
);
if
(
config
==
null
)
continue
;
var
data
=
queryService
.
QueryData
(
config
,
allot
,
dic
.
Content
);
if
(
data
==
null
||
!
data
.
Any
())
continue
;
var
sheet
=
sheets
.
FirstOrDefault
(
t
=>
t
.
SheetName
.
Contains
(
dic
.
Remark
));
if
(
sheet
==
null
)
continue
;
var
sheetdata
=
importdata
.
Where
(
t
=>
t
.
SheetID
==
sheet
.
ID
)?.
ToList
()
??
new
List
<
im_data
>();
}
}
#
endregion
检查是否有新增的科室或费用类别
}
}
performance/Performance.Services/ExtractExcelService/QueryService.cs
View file @
a81b9382
...
...
@@ -367,7 +367,7 @@ private List<ex_result> ExtractSpecialData(per_allot allot, string groupName, bo
/// <param name="source"></param>
/// <param name="category"></param>
/// <returns></returns>
p
rivate
IEnumerable
<
ExtractDto
>
QueryData
(
sys_hospitalconfig
config
,
per_allot
allot
,
string
execsql
)
p
ublic
IEnumerable
<
ExtractDto
>
QueryData
(
sys_hospitalconfig
config
,
per_allot
allot
,
string
execsql
)
{
var
parameters
=
GetParameters
(
allot
);
using
(
var
connection
=
ConnectionBuilder
.
Create
((
DatabaseType
)
config
.
DataBaseType
,
config
.
DbSource
,
config
.
DbName
,
config
.
DbUser
,
config
.
DbPassword
))
...
...
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