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
d78b8a80
Commit
d78b8a80
authored
Aug 08, 2019
by
李承祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日记、抽取方按修改bug、设置cellstyle
parent
ec5066b6
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
45 deletions
+48
-45
performance/Performance.Api/Controllers/TemplateController.cs
+14
-3
performance/Performance.Extract.Api/Controllers/ExtractController.cs
+11
-2
performance/Performance.Services/CellStyle.cs
+6
-1
performance/Performance.Services/ModExtractService.cs
+3
-3
performance/Performance.Services/NewExtractService.cs
+14
-36
No files found.
performance/Performance.Api/Controllers/TemplateController.cs
View file @
d78b8a80
...
...
@@ -319,20 +319,32 @@ public ApiResponse SaveFile([FromForm] IFormCollection form, int allotId, int ho
byte
[]
bytes
=
new
byte
[
stream
.
Length
];
stream
.
Read
(
bytes
,
0
,
bytes
.
Length
);
if
(!
FileHelper
.
CreateFile
(
path
,
bytes
))
{
LogHelper
.
Error
(
$"保存失败"
,
"保存提取文件"
);
return
new
ApiResponse
(
ResponseType
.
Error
,
"保存失败"
);
}
}
var
allot
=
allotService
.
GetAllot
(
allotId
);
allot
.
ExtractPath
=
path
;
allot
.
IsExtracting
=
2
;
if
(!
string
.
IsNullOrEmpty
(
path
)
&&
allotService
.
Update
(
allot
))
if
(
string
.
IsNullOrEmpty
(
path
)
||
FileHelper
.
IsExistFile
(
path
))
{
LogHelper
.
Information
(
$"文件未保存成功,保存文件不存在!"
,
"保存提取文件"
);
return
new
ApiResponse
(
ResponseType
.
Fail
,
"上传成功!"
);
}
if
(!
allotService
.
Update
(
allot
))
{
LogHelper
.
Information
(
$"更新文件路径失败!"
,
"保存提取文件"
);
return
new
ApiResponse
(
ResponseType
.
Fail
,
"上传成功!"
);
}
return
new
ApiResponse
(
ResponseType
.
OK
,
"上传成功!"
);
}
catch
(
Exception
ex
)
{
logger
.
LogInformation
(
$"保存提取文件异常
{
ex
.
ToString
()}
"
);
LogHelper
.
Error
(
$"保存失败:"
+
ex
.
ToString
(),
"保存提取文件"
);
return
new
ApiResponse
(
ResponseType
.
Error
,
ex
.
Message
);
}
return
new
ApiResponse
(
ResponseType
.
Error
);
}
}
}
\ No newline at end of file
performance/Performance.Extract.Api/Controllers/ExtractController.cs
View file @
d78b8a80
...
...
@@ -119,23 +119,32 @@ public void ExtractData([CustomizeValidator, FromBody]ExtractRequest request)
{
LogHelper
.
Information
(
"请求参数:"
+
JsonHelper
.
Serialize
(
request
),
"提取绩效数据"
);
string
filePath
=
newExtractService
.
ExtractData
(
request
.
AllotId
,
request
.
Email
,
request
.
HospitalId
);
LogHelper
.
Information
(
"提取文件路径:"
+
filePath
,
"提取绩效数据"
);
if
(!
string
.
IsNullOrEmpty
(
filePath
)
&&
FileHelper
.
IsExistFile
(
filePath
))
{
LogHelper
.
Information
(
"请求路径:"
+
url
.
ImportFile
,
"保存提取文件"
);
int
i
=
1
;
while
(
i
<=
5
)
{
LogHelper
.
Information
(
"请求路径:"
+
url
.
ImportFile
,
"保存提取文件"
);
string
retJson
=
HttpHelper
.
HttpClient
(
url
.
ImportFile
+
$"?allotId=
{
request
.
AllotId
}
&hospitalId=
{
request
.
HospitalId
}
"
,
filePath
);
if
(
i
==
5
)
LogHelper
.
Information
(
$"保存文件失败,已尝试执行五次,请联系开发人员!"
,
"保存提取文件"
);
else
LogHelper
.
Information
(
$"正在尝试第
{
i
}
次保存!"
,
"保存提取文件"
);
LogHelper
.
Information
(
"返回结果:"
+
JsonHelper
.
Serialize
(
retJson
),
"保存提取文件"
);
logger
.
LogInformation
(
retJson
);
var
ret
=
JsonHelper
.
Deserialize
<
ApiResponse
>(
retJson
);
if
((
int
)
ret
.
State
==
1
)
{
LogHelper
.
Information
(
"保存成功!"
,
"保存提取文件"
);
break
;
}
i
++;
}
}
else
LogHelper
.
Information
(
$"提取文件不存在!"
,
"保存提取文件"
);
}
#
endregion
...
...
performance/Performance.Services/CellStyle.cs
View file @
d78b8a80
...
...
@@ -12,6 +12,7 @@ public enum StyleType
//列头固定,
列头
,
系数
,
数据
,
默认
,
}
public
enum
CellFormat
...
...
@@ -61,7 +62,11 @@ public static ICellStyle CreateCellStyle(IWorkbook wb, StyleType type = StyleTyp
cellStyle
.
FillPattern
=
FillPattern
.
SolidForeground
;
break
;
case
StyleType
.
系数
:
cellStyle
.
FillForegroundColor
=
HSSFColor
.
LightGreen
.
Index
;
cellStyle
.
FillForegroundColor
=
HSSFColor
.
Green
.
Index
;
cellStyle
.
FillPattern
=
FillPattern
.
SolidForeground
;
break
;
case
StyleType
.
数据
:
cellStyle
.
FillForegroundColor
=
HSSFColor
.
SkyBlue
.
Index
;
cellStyle
.
FillPattern
=
FillPattern
.
SolidForeground
;
break
;
case
StyleType
.
默认
:
...
...
performance/Performance.Services/ModExtractService.cs
View file @
d78b8a80
...
...
@@ -193,9 +193,9 @@ public mod_module EditModule(ModModuleRequest request)
throw
new
PerformanceException
(
"绩效模板已存在!"
);
entity
.
ModuleName
=
request
.
ModuleName
??
entity
.
ModuleName
;
entity
.
SheetType
=
request
.
SheetType
??
entity
.
SheetType
;
entity
.
Description
=
request
.
Description
??
entity
.
Description
;
entity
.
ExtractId
=
request
.
ExtractId
??
entity
.
ExtractId
;
entity
.
SheetType
=
request
.
SheetType
;
entity
.
Description
=
request
.
Description
;
entity
.
ExtractId
=
request
.
ExtractId
;
if
(!
perforModmoduleRepository
.
Update
(
entity
))
throw
new
PerformanceException
(
"修改失败!"
);
...
...
performance/Performance.Services/NewExtractService.cs
View file @
d78b8a80
...
...
@@ -113,29 +113,7 @@ public string ExtractData(int allotId, string email, int hospitalId)
CreateNotExistSheet
(
modulesList
,
workbook
);
#
region
单元格样式
style
=
workbook
.
CreateCellStyle
();
//字体
IFont
titleFont
=
workbook
.
CreateFont
();
titleFont
.
FontHeightInPoints
=
11
;
titleFont
.
FontName
=
"微软雅黑"
;
//设置字体大小
titleFont
.
Color
=
HSSFColor
.
Black
.
Index
;
//设置字体颜色
style
.
SetFont
(
titleFont
);
//边框
style
.
BorderBottom
=
BorderStyle
.
Thin
;
style
.
BorderLeft
=
BorderStyle
.
Thin
;
style
.
BorderRight
=
BorderStyle
.
Thin
;
style
.
BorderTop
=
BorderStyle
.
Thin
;
//前景色
style
.
FillForegroundColor
=
NPOI
.
HSSF
.
Util
.
HSSFColor
.
SkyBlue
.
Index
;
style
.
FillPattern
=
FillPattern
.
SolidForeground
;
//居中
style
.
Alignment
=
HorizontalAlignment
.
Center
;
//水平居中
style
.
VerticalAlignment
=
VerticalAlignment
.
Center
;
//垂直居中
#
endregion
style
=
CellStyle
.
CreateCellStyle
(
workbook
,
StyleType
.
数据
);
List
<
AccountUnitEntity
>
unitList
=
new
List
<
AccountUnitEntity
>();
if
(
allotLast
!=
null
)
...
...
@@ -241,7 +219,7 @@ private void WriteOtherIncome(ISheet sheet, int hospitalId, IPerSheetDataRead sh
int
cellStartIndex
=
sheetRead
.
Point
.
HeaderFirstCellNum
.
Value
+
4
;
LogHelper
.
Information
(
$"写入
额外收入列头信息
"
,
"提取绩效数据"
);
LogHelper
.
Information
(
$"写入
列头信息 --
{
module
.
ModuleName
}
"
,
"提取绩效数据"
);
//写入列头信息
foreach
(
var
item
in
itemList
)
{
...
...
@@ -277,7 +255,7 @@ private void WriteIncome(ISheet sheet, int hospitalId, List<AccountUnitEntity> u
var
technicianFactor
=
sheet
.
GetRow
(
sheetRead
.
Point
.
AccountingUnit
.
First
(
t
=>
t
.
UnitType
==
"医技组"
).
FactorRow
.
Value
);
var
head
=
GetOrCreate
(
sheet
,
sheetRead
.
Point
.
HeaderFirstRowNum
.
Value
);
LogHelper
.
Information
(
$"写入
收入列头信息
"
,
"提取绩效数据"
);
LogHelper
.
Information
(
$"写入
列头信息 --
{
module
.
ModuleName
}
"
,
"提取绩效数据"
);
//写入列头信息
int
cellStartIndex
=
sheetRead
.
Point
.
HeaderFirstCellNum
.
Value
+
4
;
foreach
(
var
item
in
itemList
)
...
...
@@ -306,12 +284,13 @@ private void WriteIncome(ISheet sheet, int hospitalId, List<AccountUnitEntity> u
List
<
ExtractDto
>
allExtract
=
new
List
<
ExtractDto
>();
foreach
(
var
item
in
extractList
)
{
LogHelper
.
Information
(
$"执行SQL脚本获取数据 --
{
module
.
ModuleName
}
,"
,
"提取绩效数据"
);
var
result
=
QueryDatabase
(
hospitalConfigList
,
item
,
allot
);
if
(
result
!=
null
)
allExtract
.
AddRange
(
result
);
}
LogHelper
.
Information
(
$"填充
收入数据
"
,
"提取绩效数据"
);
LogHelper
.
Information
(
$"填充
数据 --
{
module
.
ModuleName
}
"
,
"提取绩效数据"
);
//写入数据
var
rowIndex
=
sheetRead
.
Point
.
HeaderFirstRowNum
.
Value
+
1
;
foreach
(
var
department
in
allExtract
.
Select
(
t
=>
t
.
Department
).
Distinct
())
...
...
@@ -399,7 +378,7 @@ private void WriteWorkload(ISheet sheet, int hospitalId, List<AccountUnitEntity>
var
head
=
GetOrCreate
(
sheet
,
sheetRead
.
Point
.
HeaderFirstRowNum
.
Value
+
0
);
var
factor
=
GetOrCreate
(
sheet
,
sheetRead
.
Point
.
HeaderFirstRowNum
.
Value
+
1
);
LogHelper
.
Information
(
$"写入
工作量列头信息
"
,
"提取绩效数据"
);
LogHelper
.
Information
(
$"写入
列头信息 --
{
module
.
ModuleName
}
"
,
"提取绩效数据"
);
//写入列头信息
int
cellStartIndex
=
sheetRead
.
Point
.
HeaderFirstCellNum
.
Value
+
2
;
foreach
(
var
item
in
itemList
)
...
...
@@ -410,7 +389,7 @@ private void WriteWorkload(ISheet sheet, int hospitalId, List<AccountUnitEntity>
var
doctorcell
=
GetOrCreate
(
factor
,
cellStartIndex
);
doctorcell
.
SetCellValue
(
item
.
FactorValue1
!=
null
?
(
double
)
item
.
FactorValue1
:
0
);
doctorcell
.
CellStyle
=
CellStyle
.
CreateCellStyle
(
workbook
,
StyleType
.
系数
,
CellFormat
.
百分比
);
doctorcell
.
CellStyle
=
CellStyle
.
CreateCellStyle
(
workbook
,
StyleType
.
列头
,
CellFormat
.
数字
2
);
cellStartIndex
++;
}
//查询数据
...
...
@@ -425,6 +404,7 @@ private void WriteWorkload(ISheet sheet, int hospitalId, List<AccountUnitEntity>
if
(
category
==
null
||
category
.
Count
()
==
0
)
continue
;
foreach
(
var
moditem
in
category
)
{
LogHelper
.
Information
(
$"执行SQL脚本获取数据 --
{
module
.
ModuleName
}
,"
,
"提取绩效数据"
);
var
result
=
QueryDatabase
(
hospitalConfigList
,
item
,
allot
,
moditem
.
ItemName
);
if
(
result
!=
null
)
allExtract
.
AddRange
(
result
);
...
...
@@ -438,7 +418,7 @@ private void WriteWorkload(ISheet sheet, int hospitalId, List<AccountUnitEntity>
specialHead
=
itemList
.
Select
(
t
=>
t
.
ItemName
).
Intersect
(
extractHead
.
Distinct
())?.
ToList
();
}
LogHelper
.
Information
(
$"填充
工作量数据
"
,
"提取绩效数据"
);
LogHelper
.
Information
(
$"填充
数据 --
{
module
.
ModuleName
}
"
,
"提取绩效数据"
);
//写入数据
var
rowIndex
=
sheetRead
.
Point
.
HeaderFirstRowNum
.
Value
+
2
;
foreach
(
var
department
in
allExtract
.
Select
(
t
=>
t
.
Department
).
Distinct
())
...
...
@@ -474,7 +454,6 @@ private void WriteWorkload(ISheet sheet, int hospitalId, List<AccountUnitEntity>
private
List
<
ExtractDto
>
QueryDatabase
(
List
<
sys_hospitalconfig
>
hospitalConfigList
,
mod_extract
extract
,
per_allot
allot
,
string
category
=
null
)
{
LogHelper
.
Information
(
$"执行SQL脚本获取数据,"
,
"提取绩效数据"
);
var
config
=
hospitalConfigList
.
FirstOrDefault
(
t
=>
t
.
Type
==
extract
.
SourceType
);
var
parameters
=
GetParameters
(
allot
);
using
(
var
connection
=
ConnectionBuilder
.
Create
(
DatabaseType
.
SqlServer
,
config
.
DbSource
,
config
.
DbName
,
config
.
DbUser
,
config
.
DbPassword
))
...
...
@@ -484,7 +463,6 @@ private List<ExtractDto> QueryDatabase(List<sys_hospitalconfig> hospitalConfigLi
extract
.
ExecuteScript
=
Regex
.
Replace
(
extract
.
ExecuteScript
,
item
.
Key
,
item
.
Value
,
RegexOptions
.
IgnoreCase
);
}
LogHelper
.
Information
(
$"SQL脚本
{
extract
.
ExecuteScript
}
,"
,
"提取绩效数据"
);
var
result
=
connection
.
Query
<
ExtractDto
>(
extract
.
ExecuteScript
,
commandTimeout
:
20000
);
if
(
result
!=
null
&&
result
.
Count
()
>
0
)
{
...
...
@@ -514,7 +492,7 @@ private void WriteExpend(ISheet sheet, int hospitalId, IPerSheetDataRead sheetRe
int
cellStartIndex
=
sheetRead
.
Point
.
HeaderFirstCellNum
.
Value
+
4
;
LogHelper
.
Information
(
$"写入
成本支出列头信息
"
,
"提取绩效数据"
);
LogHelper
.
Information
(
$"写入
列头信息 --
{
module
.
ModuleName
}
"
,
"提取绩效数据"
);
//写入列头信息
foreach
(
var
item
in
itemList
)
{
...
...
@@ -551,7 +529,7 @@ private void WriteExpend(ISheet sheet, int hospitalId, IPerSheetDataRead sheetRe
private
void
WriteEmployee
(
ISheet
sheet
,
int
allotLastId
,
IPerSheetDataRead
sheetRead
)
{
LogHelper
.
Information
(
$"填充人员信息"
,
"提取绩效数据"
);
LogHelper
.
Information
(
$"填充
数据 --
人员信息"
,
"提取绩效数据"
);
var
dictionary
=
new
Dictionary
<
string
,
Func
<
im_employee
,
object
>>
{
{
"核算单元"
,
(
t
)
=>
t
.
AccountingUnit
},
...
...
@@ -591,7 +569,7 @@ private void WriteEmployee(ISheet sheet, int allotLastId, IPerSheetDataRead shee
private
void
WriteSpecialUnit
(
ISheet
sheet
,
int
hospitalId
,
per_allot
allotLast
,
IPerSheetDataRead
sheetRead
)
{
LogHelper
.
Information
(
$"填充特殊核算单元绩效测算表"
,
"提取绩效数据"
);
LogHelper
.
Information
(
$"填充
数据 --
特殊核算单元绩效测算表"
,
"提取绩效数据"
);
var
dictionary
=
new
Dictionary
<
string
,
Func
<
mod_special
,
List
<
im_specialunit
>,
object
>>
{
{
"科室"
,
(
special
,
lastAllot
)
=>
special
.
Department
},
...
...
@@ -671,7 +649,7 @@ private void WriteSpecialUnit(ISheet sheet, int hospitalId, per_allot allotLast,
private
void
WriteAccountBasic
(
ISheet
sheet
,
int
allotLastId
,
IPerSheetDataRead
sheetRead
)
{
LogHelper
.
Information
(
$"填充临床科室医护绩效测算表"
,
"提取绩效数据"
);
LogHelper
.
Information
(
$"填充
数据 --
临床科室医护绩效测算表"
,
"提取绩效数据"
);
var
dictionary
=
new
Dictionary
<
string
,
Func
<
im_accountbasic
,
object
>>
{
{
"核算单元类型"
,
(
t
)
=>
t
.
UnitType
},
...
...
@@ -821,7 +799,7 @@ public string Judge(int allotId, int hospitalId, int useTemplate)
catch
(
PerformanceException
ex
)
{
LogHelper
.
Error
(
ex
.
ToString
(),
"提取绩效数据"
);
result
=
ex
.
ToString
()
;
result
=
ex
.
Message
;
}
catch
(
Exception
ex
)
{
...
...
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