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
debc4131
Commit
debc4131
authored
Apr 03, 2019
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
http://192.168.0.110:8880/zry/performance
into develop
parents
03cfac74
1c4df99b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
361 additions
and
8 deletions
+361
-8
performance/Performance.Api/Controllers/AgainAllotController.cs
+52
-4
performance/Performance.Api/Controllers/ConfigController.cs
+56
-0
performance/Performance.DtoModels/Request/CofAgainRequest.cs
+56
-0
performance/Performance.DtoModels/Response/AllotResponse.cs
+7
-1
performance/Performance.Repository/PerforCofdirectorRepository.cs
+14
-0
performance/Performance.Services/AgainAllotService.cs
+59
-2
performance/Performance.Services/ConfigService.cs
+117
-1
No files found.
performance/Performance.Api/Controllers/AgainAllotController.cs
View file @
debc4131
...
...
@@ -28,11 +28,20 @@ public class AgainAllotController : Controller
{
private
AgainAllotService
againAllotService
;
private
ClaimService
claimService
;
private
AllotService
allotService
;
private
IHostingEnvironment
evn
;
private
ConfigService
configService
;
public
AgainAllotController
(
AgainAllotService
againAllotService
,
ClaimService
claimService
)
ClaimService
claimService
,
AllotService
allotService
,
IHostingEnvironment
evn
,
ConfigService
configService
)
{
this
.
againAllotService
=
againAllotService
;
this
.
claimService
=
claimService
;
this
.
allotService
=
allotService
;
this
.
evn
=
evn
;
this
.
configService
=
configService
;
}
/// <summary>
...
...
@@ -41,9 +50,10 @@ public class AgainAllotController : Controller
/// <returns></returns>
[
Route
(
"allotlist"
)]
[
HttpPost
]
public
ApiResponse
AllotList
()
public
ApiResponse
AllotList
(
[
FromBody
]
UserRequest
request
)
{
throw
new
NotImplementedException
();
var
list
=
againAllotService
.
GetAllotList
(
request
.
ID
);
return
new
ApiResponse
(
ResponseType
.
OK
,
list
);
}
/// <summary>
...
...
@@ -55,7 +65,45 @@ public ApiResponse AllotList()
[
HttpPost
]
public
ApiResponse
Import
([
FromForm
]
IFormCollection
form
)
{
throw
new
NotImplementedException
();
var
allotid
=
form
.
ToDictionary
().
GetValue
(
"allotid"
,
0
);
if
(
allotid
<=
0
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"参数错误"
,
"allotid无效"
);
var
userid
=
form
.
ToDictionary
().
GetValue
(
"userid"
,
0
);
if
(
userid
<=
0
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"参数错误"
,
"userid无效"
);
var
file
=
((
FormFileCollection
)
form
.
Files
).
FirstOrDefault
();
if
(
file
==
null
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"参数错误"
,
"文件无效"
);
var
allot
=
allotService
.
GetAllot
(
allotid
);
if
(
allot
==
null
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"allotid不存在"
);
var
name
=
FileHelper
.
GetFileNameNoExtension
(
file
.
FileName
)
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssfff"
);
var
ext
=
FileHelper
.
GetExtension
(
file
.
FileName
);
var
dpath
=
Path
.
Combine
(
evn
.
ContentRootPath
,
"Files"
,
$"
{
allot
.
HospitalId
}
"
,
$"
{
allot
.
Year
}{
allot
.
Month
.
ToString
().
PadLeft
(
2
,
'0'
)}
"
);
FileHelper
.
CreateDirectory
(
dpath
);
var
path
=
Path
.
Combine
(
dpath
,
$"
{
name
}{
ext
}
"
);
using
(
var
stream
=
file
.
OpenReadStream
())
{
byte
[]
bytes
=
new
byte
[
stream
.
Length
];
stream
.
Read
(
bytes
,
0
,
bytes
.
Length
);
if
(!
FileHelper
.
CreateFile
(
path
,
bytes
))
return
new
ApiResponse
(
ResponseType
.
Fail
,
$"
{
file
.
FileName
}
上传失败"
);
allot
.
Path
=
path
;
allot
.
Remark
=
EnumHelper
.
GetDescription
(
AllotStates
.
FileUploaded
);
int
flag
=
againAllotService
.
Insert
(
allot
,
userid
);
if
(
flag
==
0
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
$"
{
file
.
FileName
}
上传成功,修改状态失败"
);
configService
.
ClearAgain
(
flag
);
configService
.
CopyAgain
(
flag
);
}
return
new
ApiResponse
(
ResponseType
.
OK
);
}
[
Route
(
"generate"
)]
...
...
performance/Performance.Api/Controllers/ConfigController.cs
View file @
debc4131
...
...
@@ -244,5 +244,60 @@ public ApiResponse WorkyearDelete([CustomizeValidator(RuleSet = "Delete"), FromB
return
new
ApiResponse
(
ResponseType
.
OK
);
}
#
endregion
#
region
cofagain
/// <summary>
/// 获取二次绩效配置列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[
Route
(
"cofagainlist"
)]
[
HttpPost
]
public
ApiResponse
GetAgainList
([
CustomizeValidator
(
RuleSet
=
"Select"
),
FromBody
]
CofAgainRequest
request
)
{
var
list
=
_configService
.
GetAgainList
(
request
.
AgainAllotID
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"ok"
,
list
);
}
/// <summary>
/// 新增二次绩效配置
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[
Route
(
"cofagaininsert"
)]
[
HttpPost
]
public
ApiResponse
AgainInsert
([
FromBody
]
CofAgainRequest
request
)
{
var
workyear
=
_configService
.
AgainInsert
(
request
);
return
new
ApiResponse
(
ResponseType
.
OK
,
workyear
);
}
/// <summary>
/// 修改二次绩效配置
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[
Route
(
"cofagainupdate"
)]
[
HttpPost
]
public
ApiResponse
AgainUpdate
([
CustomizeValidator
(
RuleSet
=
"Update"
),
FromBody
]
CofAgainRequest
request
)
{
var
workyear
=
_configService
.
AgainUpdate
(
request
);
return
new
ApiResponse
(
ResponseType
.
OK
,
workyear
);
}
/// <summary>
/// 删除二次绩效配置
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[
Route
(
"cofagaindelete"
)]
[
HttpPost
]
public
ApiResponse
AgainDelete
([
CustomizeValidator
(
RuleSet
=
"Delete"
),
FromBody
]
CofAgainRequest
request
)
{
if
(!
_configService
.
AgainDelete
(
request
))
return
new
ApiResponse
(
ResponseType
.
Fail
);
return
new
ApiResponse
(
ResponseType
.
OK
);
}
#
endregion
}
}
\ No newline at end of file
performance/Performance.DtoModels/Request/CofAgainRequest.cs
0 → 100644
View file @
debc4131
using
System
;
using
FluentValidation
;
namespace
Performance.DtoModels
{
public
class
CofAgainRequest
:
ApiRequest
{
public
int
ID
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
int
AllotID
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
int
AgainAllotID
{
get
;
set
;
}
/// <summary>
/// 1 职称绩效 2 工作量绩效 3 满勤天数
/// </summary>
public
int
Type
{
get
;
set
;
}
/// <summary>
/// 参数名称
/// </summary>
public
string
TypeName
{
get
;
set
;
}
/// <summary>
/// 参数值
/// </summary>
public
Nullable
<
decimal
>
Value
{
get
;
set
;
}
public
class
CofAgainRequestValidator
:
AbstractValidator
<
CofAgainRequest
>
{
public
CofAgainRequestValidator
()
{
RuleSet
(
"Select"
,
()
=>
{
RuleFor
(
x
=>
x
.
AgainAllotID
).
NotNull
().
NotEmpty
().
GreaterThan
(
0
);
});
RuleSet
(
"Update"
,
()
=>
{
RuleFor
(
x
=>
x
.
ID
).
NotNull
().
GreaterThan
(
0
);
});
RuleSet
(
"Delete"
,
()
=>
{
RuleFor
(
x
=>
x
.
ID
).
NotNull
().
GreaterThan
(
0
);
});
}
}
}
}
performance/Performance.DtoModels/Response/AllotResponse.cs
View file @
debc4131
...
...
@@ -39,8 +39,14 @@ public class AllotResponse
public
Nullable
<
DateTime
>
UploadDate
{
get
;
set
;
}
/// <summary>
///
/// 0 数据未上传 1 数据已上传 2 正在校验数据 3 数据验证通过 4 数据错误
/// 5 正在生成绩效 6 绩效结果解析成功 7 绩效解析失败 8 归档
/// </summary>
public
int
States
{
get
;
set
;
}
/// <summary>
/// 科室
/// </summary>
public
string
Department
{
get
;
set
;
}
}
}
performance/Performance.Repository/PerforCofdirectorRepository.cs
View file @
debc4131
...
...
@@ -36,5 +36,19 @@ public int DeleteData(int allotId)
return
Execute
(
sql
,
new
{
allotId
});
}
public
int
DelAgain
(
int
againid
)
{
List
<
string
>
tableArray
=
new
List
<
string
>
{
"ag_data"
,
"ag_employee"
,
"ag_header"
};
string
sql
=
""
;
tableArray
.
ForEach
(
t
=>
sql
+=
$"delete from
{
t
}
where againallotid=@againid;"
);
return
Execute
(
sql
,
new
{
againid
});
}
}
}
performance/Performance.Services/AgainAllotService.cs
View file @
debc4131
using
Microsoft.Extensions.Options
;
using
AutoMapper
;
using
Microsoft.Extensions.Options
;
using
Performance.DtoModels
;
using
Performance.DtoModels.AppSettings
;
using
Performance.EntityModels
;
using
Performance.Repository
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -17,11 +19,17 @@ public class AgainAllotService : IAutoInjection
private
PerforPeragainallotRepository
perforPeragainallotRepository
;
private
PerforResaccountdoctorRepository
perforResaccountdoctorRepository
;
private
PerforResaccountnurseRepository
perforResaccountnurseRepository
;
private
PerforUserRepository
perforUserRepository
;
private
PerforUserhospitalRepository
perforUserhospitalRepository
;
private
PerforPerallotRepository
perforPerallotRepository
;
public
AgainAllotService
(
IOptions
<
Application
>
options
,
AgainService
againService
,
PerforCofagainRepository
perforCofagainRepository
,
PerforPeragainallotRepository
perforPeragainallotRepository
,
PerforResaccountdoctorRepository
perforResaccountdoctorRepository
,
PerforResaccountnurseRepository
perforResaccountnurseRepository
)
PerforResaccountnurseRepository
perforResaccountnurseRepository
,
PerforUserRepository
perforUserRepository
,
PerforUserhospitalRepository
perforUserhospitalRepository
,
PerforPerallotRepository
perforPerallotRepository
)
{
this
.
application
=
options
.
Value
;
this
.
againService
=
againService
;
...
...
@@ -29,6 +37,9 @@ public class AgainAllotService : IAutoInjection
this
.
perforPeragainallotRepository
=
perforPeragainallotRepository
;
this
.
perforResaccountdoctorRepository
=
perforResaccountdoctorRepository
;
this
.
perforResaccountnurseRepository
=
perforResaccountnurseRepository
;
this
.
perforUserRepository
=
perforUserRepository
;
this
.
perforUserhospitalRepository
=
perforUserhospitalRepository
;
this
.
perforPerallotRepository
=
perforPerallotRepository
;
}
/// <summary>
...
...
@@ -216,5 +227,51 @@ public class AgainAllotService : IAutoInjection
return
(
response
,
situation
);
}
/// <summary>
/// 二次绩效新增记录
/// </summary>
/// <param name="allot"></param>
/// <param name="userid"></param>
/// <returns></returns>
public
int
Insert
(
per_allot
allot
,
int
userid
)
{
var
user
=
perforUserRepository
.
GetEntity
(
t
=>
t
.
ID
==
userid
);
var
model
=
new
per_againallot
{
AllotID
=
allot
.
ID
,
CreateUser
=
userid
,
CreateDateTime
=
DateTime
.
Now
,
Department
=
user
.
Department
,
Path
=
allot
.
Path
,
Remark
=
allot
.
Remark
};
if
(!
perforPeragainallotRepository
.
Add
(
model
))
return
0
;
return
model
.
ID
;
}
/// <summary>
/// 根据人物角色获取绩效列表
/// </summary>
/// <returns></returns>
public
List
<
AllotResponse
>
GetAllotList
(
int
userid
)
{
var
user
=
perforUserRepository
.
GetEntity
(
t
=>
t
.
ID
==
userid
);
if
(
user
==
null
)
throw
new
NotImplementedException
(
"人员ID无效"
);
var
hospital
=
perforUserhospitalRepository
.
GetEntity
(
t
=>
t
.
UserID
==
userid
);
if
(
hospital
==
null
)
throw
new
NotImplementedException
(
"人员未选择医院"
);
var
allot
=
perforPerallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospital
.
HospitalID
);
List
<
AllotResponse
>
list
=
Mapper
.
Map
<
List
<
AllotResponse
>>(
allot
);
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
list
=
list
.
OrderByDescending
(
t
=>
t
.
Year
).
ThenByDescending
(
t
=>
t
.
Month
).
ToList
();
list
.
ForEach
(
t
=>
t
.
Department
=
user
.
Department
);
}
return
list
;
}
}
}
performance/Performance.Services/ConfigService.cs
View file @
debc4131
...
...
@@ -16,20 +16,26 @@ public class ConfigService : IAutoInjection
private
PerforCofdrugpropRepository
_drugpropRepository
;
private
PerforCofincomeRepository
_incomeRepository
;
private
PerforCofworkyearRepository
_workyearRepository
;
private
PerforCofagainRepository
_againRepository
;
private
PerforPerallotRepository
perforPerAllotRepository
;
private
PerforPeragainallotRepository
perforPeragainallotRepository
;
private
PerforLogdbugRepository
logdbug
;
public
ConfigService
(
PerforCofdirectorRepository
cofdirectorRepository
,
PerforCofdrugpropRepository
cofdrugpropRepository
,
PerforCofincomeRepository
cofincomeRepository
,
PerforCofworkyearRepository
cofworkyearRepository
,
PerforCofagainRepository
againRepository
,
PerforPerallotRepository
perforPerAllotRepository
,
PerforPeragainallotRepository
perforPeragainallotRepository
,
PerforLogdbugRepository
logdbug
)
{
this
.
_directorRepository
=
cofdirectorRepository
;
this
.
_drugpropRepository
=
cofdrugpropRepository
;
this
.
_incomeRepository
=
cofincomeRepository
;
this
.
_workyearRepository
=
cofworkyearRepository
;
this
.
_againRepository
=
againRepository
;
this
.
perforPerAllotRepository
=
perforPerAllotRepository
;
this
.
perforPeragainallotRepository
=
perforPeragainallotRepository
;
this
.
logdbug
=
logdbug
;
}
...
...
@@ -279,7 +285,7 @@ public void Clear(int allotId)
logdbug
.
Add
(
allotId
,
"清理无效数据"
,
$"受影响行数:
{
count
}
"
);
}
#
region
Copy
/// <summary>
/// 复制报表基础配置
/// </summary>
...
...
@@ -326,5 +332,115 @@ public void Copy(per_allot allot)
_workyearRepository
.
AddRange
(
newWorkyears
.
ToArray
());
}
}
#
endregion
#
region
cof_again
/// <summary>
/// 获取cof_drugprop列表
/// </summary>
/// <returns></returns>
public
List
<
cof_again
>
GetAgainList
(
int
againId
)
{
var
list
=
_againRepository
.
GetEntities
(
t
=>
t
.
AgainAllotID
==
againId
);
return
list
;
}
/// <summary>
/// 添加数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public
cof_again
AgainInsert
(
CofAgainRequest
request
)
{
var
workyear
=
Mapper
.
Map
<
cof_again
>(
request
);
if
(!
_againRepository
.
Add
(
workyear
))
throw
new
PerformanceException
(
"保存失败"
);
return
workyear
;
}
/// <summary>
/// 更新数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public
cof_again
AgainUpdate
(
CofAgainRequest
request
)
{
var
again
=
_againRepository
.
GetEntity
(
t
=>
t
.
ID
==
request
.
ID
);
if
(
null
==
again
)
throw
new
PerformanceException
(
$"ID不存在 :
{
request
.
ID
}
"
);
again
.
Type
=
request
.
Type
;
again
.
TypeName
=
request
.
TypeName
;
again
.
Value
=
request
.
Value
;
if
(!
_againRepository
.
Update
(
again
))
throw
new
PerformanceException
(
"保存失败"
);
return
again
;
}
/// <summary>
/// 删除数据
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public
bool
AgainDelete
(
CofAgainRequest
request
)
{
var
again
=
_againRepository
.
GetEntity
(
t
=>
t
.
ID
==
request
.
ID
);
if
(
null
==
again
)
throw
new
PerformanceException
(
$"ID不存在 :
{
request
.
ID
}
"
);
return
_againRepository
.
Remove
(
again
);
}
#
endregion
/// <summary>
/// 清楚二次绩效中无效数据
/// </summary>
/// <param name="againId"></param>
public
void
ClearAgain
(
int
againId
)
{
var
count
=
_directorRepository
.
DelAgain
(
againId
);
logdbug
.
Add
(
againId
,
"清楚二次绩效中无效数据"
,
$"受影响行数:
{
count
}
"
);
}
#
region
CopyAgain
/// <summary>
/// 复制报表基础配置
/// </summary>
/// <param name="iD"></param>
public
void
CopyAgain
(
int
againid
)
{
var
again
=
perforPeragainallotRepository
.
GetEntity
(
t
=>
t
.
ID
==
againid
);
if
(
again
==
null
)
throw
new
PerformanceException
(
"二次绩效不存在"
);
var
allot
=
perforPerAllotRepository
.
GetEntity
(
t
=>
t
.
ID
==
again
.
AllotID
);
if
(
allot
==
null
)
throw
new
PerformanceException
(
"绩效不存在"
);
var
list
=
perforPerAllotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
allot
.
HospitalId
)
.
OrderBy
(
t
=>
t
.
Year
).
ThenBy
(
t
=>
t
.
Month
).
ToList
();
for
(
int
i
=
0
;
i
<
list
.
Count
;
i
++)
{
if
(
list
[
i
].
ID
==
allot
.
ID
&&
(
i
-
1
)
>=
0
)
allot
=
list
[
i
-
1
];
}
//根据上月绩效获取二次绩效信息
var
beforeAgain
=
perforPeragainallotRepository
.
GetEntity
(
t
=>
t
.
AllotID
==
allot
.
ID
&&
t
.
CreateUser
==
again
.
CreateUser
);
var
record
=
_againRepository
.
GetEntities
(
t
=>
t
.
AgainAllotID
==
-
1
);
if
(
again
.
AllotID
!=
allot
.
ID
&&
beforeAgain
!=
null
)
record
=
_againRepository
.
GetEntities
(
t
=>
t
.
AgainAllotID
==
beforeAgain
.
ID
);
int
days
=
DateTime
.
DaysInMonth
(
allot
.
Year
,
allot
.
Month
);
var
againList
=
record
.
Select
(
t
=>
new
cof_again
{
AllotID
=
allot
.
ID
,
AgainAllotID
=
againid
,
Type
=
t
.
Type
,
TypeName
=
t
.
TypeName
,
Value
=
(
t
.
Type
==
3
&&
beforeAgain
!=
null
)
?
days
:
t
.
Value
});
_againRepository
.
AddRange
(
againList
.
ToArray
());
}
#
endregion
}
}
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