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
880cb1ef
Commit
880cb1ef
authored
Jun 08, 2020
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
抽取写入Excel
parent
0bcf471a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
41 deletions
+58
-41
performance/Performance.Api/Controllers/ExConfigController.cs
+8
-5
performance/Performance.Api/Controllers/TemplateController.cs
+1
-1
performance/Performance.DtoModels/Request/ModModuleRequest.cs
+1
-1
performance/Performance.Services/DFExtractService1.cs
+26
-26
performance/Performance.Services/ExConfigService.cs
+22
-8
No files found.
performance/Performance.Api/Controllers/ExConfigController.cs
View file @
880cb1ef
...
...
@@ -161,12 +161,15 @@ public ApiResponse AddItem([FromBody] ItemListRequest request)
[
HttpPost
]
public
ApiResponse
Items
([
FromBody
]
ModItemRequest
request
)
{
if
(!
configService
.
QueryHosConfigs
(
request
.
ModuleId
.
Value
))
if
(!
configService
.
QueryHosConfigs
(
request
.
ModuleId
.
Value
,
out
int
sheetType
))
return
new
ApiResponse
(
ResponseType
.
Fail
,
"当前医院未配置地址"
);
logger
.
LogInformation
(
$"绩效收入模板配置项列表 : 请求地址
{
url
.
HttpPost
}
/modextract/items"
);
HttpHelper
.
HttpPost
(
url
.
HttpPost
+
"/modextract/items"
,
JsonHelper
.
Serialize
(
request
),
true
);
logger
.
LogInformation
(
$"绩效收入模板配置项列表在
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd hh:mm:ss完成请求"
)}
"
);
if
(
sheetType
==
(
int
)
SheetType
.
Income
)
{
logger
.
LogInformation
(
$"绩效收入模板配置项列表 : 请求地址
{
url
.
HttpPost
}
/modextract/items"
);
HttpHelper
.
HttpPost
(
url
.
HttpPost
+
"/modextract/items"
,
JsonHelper
.
Serialize
(
request
),
true
);
logger
.
LogInformation
(
$"绩效收入模板配置项列表在
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd hh:mm:ss完成请求"
)}
"
);
}
var
list
=
configService
.
QueryItems
(
request
.
ModuleId
.
Value
);
return
new
ApiResponse
(
ResponseType
.
OK
,
list
);
}
...
...
@@ -182,7 +185,7 @@ public ApiResponse EditItem([FromBody] ItemListRequest request)
if
(
request
.
Items
==
null
||
!
request
.
Items
.
Any
())
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"请选择需要修改的数据!"
);
var
entity
=
0
;
//=
configService.EditItem(request.Items[0]);
var
entity
=
configService
.
EditItem
(
request
.
Items
[
0
]);
return
new
ApiResponse
(
ResponseType
.
OK
,
"修改成功!"
,
entity
);
}
...
...
performance/Performance.Api/Controllers/TemplateController.cs
View file @
880cb1ef
...
...
@@ -220,7 +220,7 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody]ExtractRequest r
// 判断是那种抽取
try
{
string
message
=
extractService
.
Judge
(
request
.
AllotId
,
request
.
HospitalId
,
request
.
UseScheme
,
out
string
filePath
);
string
message
=
extractService
.
Judge
(
request
.
AllotId
,
request
.
HospitalId
,
request
.
UseScheme
,
out
string
filePath
);
if
(!
string
.
IsNullOrEmpty
(
message
))
return
new
ApiResponse
(
ResponseType
.
Fail
,
message
);
...
...
performance/Performance.DtoModels/Request/ModModuleRequest.cs
View file @
880cb1ef
...
...
@@ -13,7 +13,7 @@ public class ModModuleRequest
/// <summary> 医院Id </summary>
public
Nullable
<
int
>
HospitalId
{
get
;
set
;
}
public
Nullable
<
int
>
Extract
Id
{
get
;
set
;
}
public
Nullable
<
int
>
Type
Id
{
get
;
set
;
}
/// <summary>
/// 数据库地址
...
...
performance/Performance.Services/DFExtractService1.cs
View file @
880cb1ef
...
...
@@ -98,7 +98,7 @@ public string ExtractData(int allotId, string email, int hospitalId, string file
{
typeIds
.
AddRange
(
modules
.
Select
(
t
=>
t
.
TypeId
??
0
));
items
=
perforExitemRepository
.
GetEntities
(
t
=>
t
.
ModuleId
.
HasValue
&&
modules
.
Select
(
m
=>
m
.
Id
).
Contains
(
t
.
ModuleId
.
Value
));
&&
modules
.
Where
(
m
=>
m
.
SheetType
!=
(
int
)
SheetType
.
Income
).
Select
(
m
=>
m
.
Id
).
Contains
(
t
.
ModuleId
.
Value
));
typeIds
.
AddRange
(
items
?.
Select
(
t
=>
t
.
TypeId
??
0
)
??
new
List
<
int
>());
}
...
...
@@ -155,12 +155,11 @@ private List<ex_result> ExtractIncome<TEntity>(List<TEntity> entities, List<ex_s
foreach
(
var
module
in
modules
.
Where
(
t
=>
t
.
TypeId
>
0
))
{
foreach
(
var
item
in
scripts
.
Where
(
t
=>
t
.
TypeId
==
module
.
TypeId
)
)
foreach
(
var
config
in
configs
)
{
foreach
(
var
config
in
configs
)
{
data
.
AddRange
(
QueryData
(
config
,
allot
,
item
.
ExecScript
,
module
.
ModuleName
));
}
var
item
=
scripts
.
FirstOrDefault
(
t
=>
t
.
TypeId
==
module
.
TypeId
&&
t
.
DatabaseType
==
config
.
DataBaseType
);
if
(
item
==
null
)
continue
;
data
.
AddRange
(
QueryData
(
config
,
allot
,
item
.
ExecScript
,
module
.
ModuleName
));
}
}
if
(
data
!=
null
&&
data
.
Any
())
...
...
@@ -188,15 +187,15 @@ private List<ex_result> ExtractItems<TEntity>(List<TEntity> entities, List<ex_sc
foreach
(
var
exitem
in
items
.
Where
(
t
=>
t
.
TypeId
>
0
))
{
var
mod
el
=
modules
.
FirstOrDefault
(
t
=>
t
.
Id
==
exitem
.
ModuleId
);
foreach
(
var
item
in
scripts
.
Where
(
t
=>
t
.
TypeId
==
exitem
.
TypeId
)
)
var
mod
ule
=
modules
.
FirstOrDefault
(
t
=>
t
.
Id
==
exitem
.
ModuleId
);
foreach
(
var
config
in
configs
)
{
foreach
(
var
config
in
configs
)
{
var
result
=
QueryData
(
config
,
allot
,
item
.
ExecScript
,
model
.
ModuleName
);
result
.
ForEach
(
t
=>
t
.
Category
=
exitem
.
Item
Name
);
data
.
AddRange
(
result
);
}
var
item
=
scripts
.
FirstOrDefault
(
t
=>
t
.
TypeId
==
exitem
.
TypeId
&&
t
.
DatabaseType
==
config
.
DataBaseType
);
if
(
item
==
null
)
continue
;
var
result
=
QueryData
(
config
,
allot
,
item
.
ExecScript
,
module
.
Module
Name
);
result
.
ForEach
(
t
=>
t
.
Category
=
exitem
.
ItemName
);
data
.
AddRange
(
result
);
}
}
if
(
data
!=
null
&&
data
.
Any
())
...
...
@@ -223,18 +222,18 @@ private List<ex_result> ExtractSpcial<TEntity>(List<TEntity> entities, List<ex_s
foreach
(
var
special
in
specials
.
Where
(
t
=>
t
.
TypeId
>
0
))
{
foreach
(
var
item
in
scripts
.
Where
(
t
=>
t
.
TypeId
==
special
.
TypeId
)
)
foreach
(
var
config
in
configs
)
{
foreach
(
var
config
in
configs
)
var
item
=
scripts
.
FirstOrDefault
(
t
=>
t
.
TypeId
==
special
.
TypeId
&&
t
.
DatabaseType
==
config
.
DataBaseType
);
if
(
item
==
null
)
continue
;
var
result
=
QueryData
(
config
,
allot
,
item
.
ExecScript
,
"4.2 特殊核算单元绩效测算表"
);
result
.
ForEach
(
t
=>
{
var
result
=
QueryData
(
config
,
allot
,
item
.
ExecScript
,
""
);
result
.
ForEach
(
t
=>
{
t
.
Category
=
special
.
Target
;
t
.
Department
=
special
.
Department
;
});
data
.
AddRange
(
result
);
}
t
.
Category
=
special
.
Target
;
t
.
Department
=
special
.
Department
;
});
data
.
AddRange
(
result
);
}
}
if
(
data
!=
null
&&
data
.
Any
())
...
...
@@ -425,6 +424,7 @@ private List<ex_result> QueryData(sys_hospitalconfig config, per_allot allot, st
Source
=
source
,
DatabaseType
=
config
.
DataBaseType
,
ConfigId
=
config
.
Id
,
AllotId
=
allot
.
ID
,
}).
ToList
();
}
return
data
;
...
...
@@ -636,7 +636,7 @@ private void WriteIncome(ISheet sheet, IPerSheetDataRead sheetRead, List<Account
var
itemList
=
items
.
Where
(
t
=>
t
.
ModuleId
==
module
.
Id
).
ToList
();
logger
.
LogInformation
(
$"item有
{
itemList
?.
Count
??
0
}
个."
);
if
(
itemList
==
null
||
!
itemList
.
Any
())
return
;
//
if (itemList == null || !itemList.Any()) return;
var
extractdata
=
data
.
Where
(
t
=>
t
.
AllotId
==
Allot
.
ID
&&
t
.
Source
==
module
.
ModuleName
);
if
(
extractdata
==
null
||
!
extractdata
.
Any
())
...
...
@@ -650,7 +650,7 @@ private void WriteIncome(ISheet sheet, IPerSheetDataRead sheetRead, List<Account
Value
=
t
.
Fee
??
0
}).
ToList
();
logger
.
LogInformation
(
$"
{
sheet
.
SheetName
}
合计值为: "
+
allExtract
.
Sum
(
t
=>
t
.
Value
));
//
logger.LogInformation($"{sheet.SheetName}合计值为: " + allExtract.Sum(t => t.Value));
var
category
=
allExtract
.
Select
(
t
=>
t
.
Category
).
Distinct
().
ToList
();
WriteIncomeHeaderAndFactor
(
sheet
,
sheetRead
,
category
,
isNewTemp
);
...
...
performance/Performance.Services/ExConfigService.cs
View file @
880cb1ef
...
...
@@ -8,6 +8,7 @@
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
System.Text
;
using
System.Text.RegularExpressions
;
...
...
@@ -138,7 +139,7 @@ public ex_module AddModule(ModModuleRequest request)
HospitalId
=
request
.
HospitalId
,
Description
=
request
.
Description
,
SheetType
=
request
.
SheetType
,
TypeId
=
request
.
Extract
Id
,
TypeId
=
request
.
Type
Id
,
ReadOnly
=
0
,
};
if
(!
exmoduleRepository
.
Add
(
entity
))
...
...
@@ -161,7 +162,7 @@ public ex_module EditModule(ModModuleRequest request)
entity
.
ModuleName
=
request
.
ModuleName
??
entity
.
ModuleName
;
entity
.
SheetType
=
request
.
SheetType
;
entity
.
Description
=
request
.
Description
;
entity
.
TypeId
=
request
.
Extract
Id
;
entity
.
TypeId
=
request
.
Type
Id
;
entity
.
ConfigId
=
request
.
ConfigId
;
if
(!
exmoduleRepository
.
Update
(
entity
))
throw
new
PerformanceException
(
"修改失败!"
);
...
...
@@ -311,14 +312,15 @@ public void DelSpecial(int specialId)
#
endregion
public
bool
QueryHosConfigs
(
int
moduleId
)
public
bool
QueryHosConfigs
(
int
moduleId
,
out
int
sheetType
)
{
var
module
=
exmoduleRepository
.
GetEntity
(
t
=>
t
.
Id
==
moduleId
);
if
(
module
==
null
)
throw
new
PerformanceException
(
"绩效模板不存在,请重新选择!"
);
if
(
module
.
SheetType
!=
(
int
)
SheetType
.
Income
)
throw
new
PerformanceException
(
"当前模板不能进行考核项目自动添加"
);
sheetType
=
(
int
)
SheetType
.
Income
;
//if (module.SheetType != (int)SheetType.Income)
// throw new PerformanceException("当前模板不能进行考核项目自动添加");
var
hospitalConfigs
=
hospitalconfigRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
module
.
HospitalId
);
if
(
hospitalConfigs
!=
null
&&
hospitalConfigs
.
Any
())
...
...
@@ -438,12 +440,24 @@ public List<sys_hospitalconfig> GetHospitalconfigs(int hospitalId)
public
List
<
TitleValue
>
ExtractScheme
(
int
hospitalId
,
List
<
int
>
executeType
)
{
var
titlevalue
=
new
List
<
TitleValue
>();
var
list
=
extypeRepository
.
GetEntities
(
t
=>
new
List
<
int
>
{
0
,
hospitalId
}.
Contains
(
t
.
HospitalId
)
&&
executeType
.
Contains
(
t
.
Source
));
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
exp
=
exp
.
And
(
t
=>
t
.
Source
!=
(
int
)
SheetType
.
Income
);
var
list
=
extypeRepository
.
GetEntities
(
exp
);
if
(
list
!=
null
&&
list
.
Any
())
{
var
scripts
=
exscriptRepository
.
GetEntities
(
t
=>
list
.
Select
(
w
=>
w
.
Id
).
Contains
(
t
.
TypeId
));
//var scripts = exscriptRepository.GetEntities(t => list.Select(w => w.Id).Contains(t.TypeId));
//titlevalue = list.Where(t => scripts.Select(w => w.TypeId).Contains(t.Id)).Select(t => new TitleValue
//{
// Title = string.IsNullOrEmpty(t.Description) ? t.EName : $"{t.EName}({t.Description})",
// Value = t.Id.ToString()
//}).OrderBy(t => t.Title).ToList();
titlevalue
=
list
.
Where
(
t
=>
scripts
.
Select
(
w
=>
w
.
TypeId
).
Contains
(
t
.
Id
)).
Select
(
t
=>
new
TitleValue
titlevalue
=
list
.
Select
(
t
=>
new
TitleValue
{
Title
=
string
.
IsNullOrEmpty
(
t
.
Description
)
?
t
.
EName
:
$"
{
t
.
EName
}
(
{
t
.
Description
}
)"
,
Value
=
t
.
Id
.
ToString
()
...
...
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