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
58010638
Commit
58010638
authored
Jul 25, 2019
by
李承祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
绩效抽取方案
parent
9d1fe79b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
587 additions
and
0 deletions
+587
-0
performance/Performance.DtoModels/Request/ModItemRequest.cs
+36
-0
performance/Performance.DtoModels/Request/ModModuleRequest.cs
+50
-0
performance/Performance.DtoModels/Request/ModSpecialRequest.cs
+26
-0
performance/Performance.Extract.Api/Controllers/ModExtractController.cs
+217
-0
performance/Performance.Services/ModExtractService.cs
+258
-0
No files found.
performance/Performance.DtoModels/Request/ModItemRequest.cs
0 → 100644
View file @
58010638
using
Performance.EntityModels
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Performance.DtoModels
{
public
class
ModItemRequest
:
ApiRequest
{
/// <summary>
///
/// </summary>
public
Nullable
<
int
>
ModuleId
{
get
;
set
;
}
/// <summary>
/// 绩效考核项id
/// </summary>
public
Nullable
<
int
>
ItemId
{
get
;
set
;
}
/// <summary>
/// 绩效考核项
/// </summary>
public
string
ItemName
{
get
;
set
;
}
}
public
class
ItemListRequest
:
ApiRequest
{
/// <summary> 方案Id </summary>
public
Nullable
<
int
>
ModuleId
{
get
;
set
;
}
/// <summary> 新增项 </summary>
public
List
<
mod_item
>
Items
{
get
;
set
;
}
}
}
performance/Performance.DtoModels/Request/ModModuleRequest.cs
0 → 100644
View file @
58010638
using
FluentValidation
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Performance.DtoModels
{
public
class
ModModuleRequest
:
ApiRequest
{
/// <summary> 绩效模块Id </summary>
public
Nullable
<
int
>
ModuleId
{
get
;
set
;
}
/// <summary> 医院Id </summary>
public
Nullable
<
int
>
HospitalId
{
get
;
set
;
}
public
Nullable
<
int
>
ExtractId
{
get
;
set
;
}
/// <summary> 类型 </summary>
public
Nullable
<
int
>
SheetType
{
get
;
set
;
}
/// <summary> 绩效模块 </summary>
public
string
ModuleName
{
get
;
set
;
}
/// <summary> 描述 </summary>
public
string
Description
{
get
;
set
;
}
}
public
class
ModModuleRequestValidator
:
AbstractValidator
<
ModModuleRequest
>
{
public
ModModuleRequestValidator
()
{
RuleSet
(
"Query"
,
()
=>
{
RuleFor
(
x
=>
x
.
HospitalId
).
NotNull
().
NotEmpty
().
GreaterThan
(
0
);
});
RuleSet
(
"Add"
,
()
=>
{
RuleFor
(
x
=>
x
.
HospitalId
).
NotNull
().
GreaterThan
(
0
);
RuleFor
(
x
=>
x
.
ModuleName
).
NotNull
().
NotEmpty
();
RuleFor
(
x
=>
x
.
SheetType
).
NotNull
().
NotEmpty
();
});
RuleSet
(
"Edit"
,
()
=>
{
RuleFor
(
x
=>
x
.
ModuleId
).
NotNull
().
NotEmpty
().
GreaterThan
(
0
);
});
}
}
}
performance/Performance.DtoModels/Request/ModSpecialRequest.cs
0 → 100644
View file @
58010638
using
Performance.EntityModels
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Performance.DtoModels
{
public
class
ModSpecialRequest
:
ApiRequest
{
/// <summary> 医院Id </summary>
public
Nullable
<
int
>
HospitalId
{
get
;
set
;
}
/// <summary> 特殊考核项Id </summary>
public
Nullable
<
int
>
SpecialId
{
get
;
set
;
}
}
public
class
SpecialListRequest
:
ApiRequest
{
/// <summary> 医院Id </summary>
public
int
HospitalId
{
get
;
set
;
}
/// <summary> 特殊考核项 </summary>
public
List
<
mod_special
>
Items
{
get
;
set
;
}
}
}
performance/Performance.Extract.Api/Controllers/ModExtractController.cs
0 → 100644
View file @
58010638
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
FluentValidation.AspNetCore
;
using
Microsoft.AspNetCore.Mvc
;
using
Performance.DtoModels
;
using
Performance.Services
;
namespace
Performance.Extract.Api.Controllers
{
[
Route
(
"api/[controller]"
)]
public
class
ModExtractController
:
Controller
{
private
ModExtractService
modExtractService
;
public
ModExtractController
(
ModExtractService
modExtractService
)
{
this
.
modExtractService
=
modExtractService
;
}
/// <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 不存在,请重新选择!"
);
var
list
=
modExtractService
.
ExtractScheme
(
request
.
HospitalId
.
Value
);
return
new
ApiResponse
(
ResponseType
.
OK
,
list
);
}
/// <summary>
/// 添加绩效抽取模块
/// </summary>
/// <returns></returns>
[
Route
(
"addmodule"
)]
[
HttpPost
]
public
ApiResponse
AddModule
([
CustomizeValidator
(
RuleSet
=
"Add"
),
FromBody
]
ModModuleRequest
request
)
{
if
(
request
.
HospitalId
==
null
||
request
.
HospitalId
.
Value
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"HospitalId 参数错误!"
);
var
entity
=
modExtractService
.
AddModule
(
request
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"添加成功!"
,
entity
);
}
/// <summary>
/// 查询绩效可抽取模块
/// </summary>
/// <returns></returns>
[
Route
(
"modules"
)]
[
HttpPost
]
public
ApiResponse
Module
([
CustomizeValidator
(
RuleSet
=
"Query"
),
FromBody
]
ModModuleRequest
request
)
{
if
(
request
.
HospitalId
==
null
||
request
.
HospitalId
.
Value
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"HospitalId 不存在,请重新选择!"
);
var
list
=
modExtractService
.
Module
(
request
.
HospitalId
.
Value
);
return
new
ApiResponse
(
ResponseType
.
OK
,
list
);
}
/// <summary>
/// 修改绩效收取模块
/// </summary>
/// <returns></returns>
[
Route
(
"editmodule"
)]
[
HttpPost
]
public
ApiResponse
EditModule
([
FromBody
]
ModModuleRequest
request
)
{
if
(
request
.
ModuleId
==
null
||
request
.
ModuleId
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"ModuleId 参数错误!"
);
var
entity
=
modExtractService
.
EditModule
(
request
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"修改成功!"
,
entity
);
}
/// <summary>
/// 删除绩效抽取模块
/// </summary>
/// <returns></returns>
[
Route
(
"deletemodule"
)]
[
HttpPost
]
public
ApiResponse
DelModule
([
FromBody
]
ModModuleRequest
request
)
{
if
(
request
.
ModuleId
==
null
||
request
.
ModuleId
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"ModuleId 参数错误!"
);
modExtractService
.
DelModule
(
request
.
ModuleId
.
Value
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"删除成功!"
);
}
/// <summary>
/// 添加Item
/// </summary>
/// <returns></returns>
[
Route
(
"additem"
)]
[
HttpPost
]
public
ApiResponse
AddItem
([
FromBody
]
ItemListRequest
request
)
{
if
(
request
.
ModuleId
==
null
&&
request
.
ModuleId
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"ModuleId 参数错误!"
);
if
(
request
.
Items
==
null
&&
!
request
.
Items
.
Any
())
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"Items 未发现任添加何项!"
);
modExtractService
.
AddItem
(
request
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"添加成功!"
);
}
/// <summary>
/// 查询模块中各项
/// </summary>
/// <returns></returns>
[
Route
(
"items"
)]
[
HttpPost
]
public
ApiResponse
Items
([
FromBody
]
ModItemRequest
request
)
{
var
list
=
modExtractService
.
Items
(
request
.
ModuleId
.
Value
);
return
new
ApiResponse
(
ResponseType
.
OK
,
list
);
}
/// <summary>
/// 修改Item
/// </summary>
/// <returns></returns>
[
Route
(
"edititem"
)]
[
HttpPost
]
public
ApiResponse
EditItem
([
FromBody
]
ItemListRequest
request
)
{
if
(
request
.
Items
==
null
||
!
request
.
Items
.
Any
())
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"请选择需要修改的数据!"
);
modExtractService
.
EditItem
(
request
.
Items
[
0
]);
return
new
ApiResponse
(
ResponseType
.
OK
,
"修改成功!"
);
}
/// <summary>
/// 删除Item
/// </summary>
/// <returns></returns>
[
Route
(
"deleteitem"
)]
[
HttpPost
]
public
ApiResponse
DelItem
([
FromBody
]
ModItemRequest
request
)
{
if
(
request
.
ItemId
==
null
&&
request
.
ItemId
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"ItemId 参数错误!"
);
modExtractService
.
DelItem
(
request
.
ItemId
.
Value
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"删除成功!"
);
}
/// <summary>
/// 添加special项
/// </summary>
/// <returns></returns>
[
Route
(
"addspecial"
)]
[
HttpPost
]
public
ApiResponse
AddSpecial
([
FromBody
]
SpecialListRequest
request
)
{
if
(
request
.
HospitalId
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"HospitalId 参数错误!"
);
if
(
request
.
Items
==
null
&&
!
request
.
Items
.
Any
())
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"Items 未发现任添加何项!"
);
modExtractService
.
AddSpecial
(
request
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"添加成功!"
);
}
/// <summary>
/// 查询模块中各项
/// </summary>
/// <returns></returns>
[
Route
(
"specials"
)]
[
HttpPost
]
public
ApiResponse
Specials
([
FromBody
]
ModSpecialRequest
request
)
{
var
list
=
modExtractService
.
Special
(
request
.
HospitalId
.
Value
);
return
new
ApiResponse
(
ResponseType
.
OK
,
list
);
}
/// <summary>
/// 修改Item
/// </summary>
/// <returns></returns>
[
Route
(
"editspecial"
)]
[
HttpPost
]
public
ApiResponse
EditSpecial
([
FromBody
]
SpecialListRequest
request
)
{
if
(
request
.
Items
==
null
||
!
request
.
Items
.
Any
())
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"请选择需要修改的数据!"
);
modExtractService
.
EditSpecial
(
request
.
Items
[
0
]);
return
new
ApiResponse
(
ResponseType
.
OK
,
"修改成功!"
);
}
/// <summary>
/// 删除Item
/// </summary>
/// <returns></returns>
[
Route
(
"deletespecial"
)]
[
HttpPost
]
public
ApiResponse
DelSpecial
([
FromBody
]
ModSpecialRequest
request
)
{
if
(
request
.
SpecialId
==
null
&&
request
.
SpecialId
==
0
)
return
new
ApiResponse
(
ResponseType
.
ParameterError
,
"SpecialId 参数错误!"
);
modExtractService
.
DelSpecial
(
request
.
SpecialId
.
Value
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"删除成功!"
);
}
}
}
\ No newline at end of file
performance/Performance.Services/ModExtractService.cs
0 → 100644
View file @
58010638
using
Performance.DtoModels
;
using
Performance.EntityModels
;
using
Performance.Repository
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Performance.Services
{
public
class
ModExtractService
:
IAutoInjection
{
private
PerforModextractRepository
perforModextractRepository
;
private
PerforModitemRepository
perforModitemRepository
;
private
PerforModmoduleRepository
perforModmoduleRepository
;
private
PerforModspecialRepository
perforModspecialRepository
;
private
PerforHospitalconfigRepository
perforHospitalconfigRepository
;
private
PerforExtractRepository
perforExtractRepository
;
public
ModExtractService
(
PerforModextractRepository
perforModextractRepository
,
PerforModitemRepository
perforModitemRepository
,
PerforModmoduleRepository
perforModmoduleRepository
,
PerforModspecialRepository
perforModspecialRepository
,
PerforHospitalconfigRepository
perforHospitalconfigRepository
,
PerforExtractRepository
perforExtractRepository
)
{
this
.
perforModextractRepository
=
perforModextractRepository
;
this
.
perforModitemRepository
=
perforModitemRepository
;
this
.
perforModmoduleRepository
=
perforModmoduleRepository
;
this
.
perforModspecialRepository
=
perforModspecialRepository
;
this
.
perforHospitalconfigRepository
=
perforHospitalconfigRepository
;
this
.
perforExtractRepository
=
perforExtractRepository
;
}
/// <summary>
/// 绩效抽取方案
/// </summary>
/// <returns></returns>
public
List
<
TitleValue
>
ExtractScheme
(
int
hospitalId
)
{
var
titlevalue
=
new
List
<
TitleValue
>();
var
list
=
perforModextractRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
||
t
.
HospitalId
==
null
);
if
(
list
!=
null
&&
list
.
Any
())
titlevalue
=
list
.
Select
(
t
=>
new
TitleValue
{
Title
=
t
.
EName
,
Value
=
t
.
Id
.
ToString
()
}).
ToList
();
return
titlevalue
;
}
/// <summary>
/// 添加新模块
/// </summary>
/// <returns></returns>
public
mod_module
AddModule
(
ModModuleRequest
request
)
{
mod_module
entity
=
new
mod_module
{
ModuleName
=
request
.
ModuleName
,
HospitalId
=
request
.
HospitalId
,
Description
=
request
.
Description
,
SheetType
=
request
.
SheetType
,
ExtractId
=
request
.
ExtractId
};
if
(!
perforModmoduleRepository
.
Add
(
entity
))
throw
new
PerformanceException
(
"添加失败!"
);
//收入 默认添加收费项
if
(
new
List
<
int
>
{
(
int
)
SheetType
.
Income
,
(
int
)
SheetType
.
OtherIncome
}.
Contains
(
request
.
SheetType
.
Value
))
{
var
configList
=
perforHospitalconfigRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
request
.
HospitalId
);
if
(
configList
!=
null
&&
configList
.
Any
())
{
var
hospitalConfig
=
configList
.
First
();
var
connection
=
ConnectionBuilder
.
Create
(
DatabaseType
.
SqlServer
,
hospitalConfig
.
DbSource
,
hospitalConfig
.
DbName
,
hospitalConfig
.
DbUser
,
hospitalConfig
.
DbPassword
);
var
dataList
=
perforExtractRepository
.
ExecuteScript
(
connection
,
"select distinct category from inpat_fee where category is not null;"
,
null
);
if
(
dataList
!=
null
&&
dataList
.
Any
())
{
var
list
=
dataList
.
Select
(
t
=>
new
mod_item
{
ItemName
=
t
.
Value
.
ToString
(),
FactorValue1
=
0
m
,
FactorValue2
=
0
m
,
ModuleId
=
entity
.
Id
,
ExtractId
=
entity
.
ExtractId
,
});
perforModitemRepository
.
AddRange
(
list
.
ToArray
());
}
}
}
return
entity
;
}
/// <summary>
/// 绩效可抽取模块
/// </summary>
/// <returns></returns>
public
List
<
mod_module
>
Module
(
int
hospitalId
)
{
var
list
=
perforModmoduleRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
return
list
;
}
/// <summary>
/// 修改绩效收取模块
/// </summary>
/// <returns></returns>
public
mod_module
EditModule
(
ModModuleRequest
request
)
{
var
entity
=
perforModmoduleRepository
.
GetEntity
(
t
=>
t
.
Id
==
request
.
ModuleId
);
if
(
entity
==
null
)
throw
new
PerformanceException
(
"该绩效抽取方案不存在!"
);
entity
.
ModuleName
=
request
.
ModuleName
??
entity
.
ModuleName
;
entity
.
SheetType
=
request
.
SheetType
??
entity
.
SheetType
;
entity
.
Description
=
request
.
Description
??
entity
.
Description
;
if
(!
perforModmoduleRepository
.
Update
(
entity
))
throw
new
PerformanceException
(
"修改失败!"
);
return
entity
;
}
/// <summary>
/// 删除绩效收取模块
/// </summary>
/// <returns></returns>
public
void
DelModule
(
int
moduleId
)
{
var
entity
=
perforModmoduleRepository
.
GetEntity
(
t
=>
t
.
Id
==
moduleId
);
if
(
entity
==
null
)
throw
new
PerformanceException
(
"该绩效抽取方案不存在!"
);
if
(!
perforModmoduleRepository
.
Remove
(
entity
))
throw
new
PerformanceException
(
"删除失败!"
);
if
(
entity
.
SheetType
!=
(
int
)
SheetType
.
SpecialUnit
)
{
var
itemList
=
perforModitemRepository
.
GetEntities
(
t
=>
t
.
ModuleId
==
moduleId
);
if
(
itemList
!=
null
&&
itemList
.
Any
())
perforModitemRepository
.
RemoveRange
(
itemList
.
ToArray
());
}
else
{
var
specialList
=
perforModspecialRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
entity
.
HospitalId
);
if
(
specialList
!=
null
&&
specialList
.
Any
())
perforModspecialRepository
.
RemoveRange
(
specialList
.
ToArray
());
}
}
/// <summary>
/// 获取抽取方案子项
/// </summary>
/// <returns></returns>
public
List
<
mod_item
>
Items
(
int
moduleId
)
{
var
list
=
perforModitemRepository
.
GetEntities
(
t
=>
t
.
ModuleId
==
moduleId
);
return
list
;
}
/// <summary>
/// 添加抽取方案子项
/// </summary>
/// <returns></returns>
public
void
AddItem
(
ItemListRequest
request
)
{
var
entity
=
perforModmoduleRepository
.
GetEntity
(
t
=>
t
.
Id
==
request
.
ModuleId
);
if
(
entity
==
null
)
throw
new
PerformanceException
(
"选择的绩效抽取方案不存在!"
);
var
list
=
request
.
Items
;
list
.
ForEach
(
t
=>
{
t
.
ModuleId
=
entity
.
Id
;
t
.
ExtractId
=
entity
.
ExtractId
;
});
if
(!
perforModitemRepository
.
AddRange
(
list
.
ToArray
()))
throw
new
PerformanceException
(
"添加失败!"
);
}
/// <summary>
/// 修改抽取方案子项
/// </summary>
/// <returns></returns>
public
mod_item
EditItem
(
mod_item
entity
)
{
var
item
=
perforModitemRepository
.
GetEntity
(
t
=>
t
.
Id
==
entity
.
Id
);
if
(
item
==
null
)
throw
new
PerformanceException
(
"选择修改的项不存在!"
);
item
.
FactorValue1
=
entity
.
FactorValue1
;
item
.
FactorValue2
=
entity
.
FactorValue2
;
if
(!
perforModitemRepository
.
Update
(
item
))
throw
new
PerformanceException
(
"修改失败!"
);
return
item
;
}
/// <summary>
/// 删除抽取方案子项
/// </summary>
/// <returns></returns>
public
void
DelItem
(
int
itemId
)
{
var
item
=
perforModitemRepository
.
GetEntity
(
t
=>
t
.
Id
==
itemId
);
if
(
item
==
null
)
throw
new
PerformanceException
(
"Item项不存在!"
);
perforModitemRepository
.
Remove
(
item
);
}
/// <summary>
/// 获取特殊抽取方案子项
/// </summary>
/// <returns></returns>
public
List
<
mod_special
>
Special
(
int
hospitalId
)
{
var
list
=
perforModspecialRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
return
list
;
}
/// <summary>
/// 添加抽取方案子项
/// </summary>
/// <returns></returns>
public
void
AddSpecial
(
SpecialListRequest
request
)
{
var
list
=
request
.
Items
;
if
(!
perforModspecialRepository
.
AddRange
(
list
.
ToArray
()))
throw
new
PerformanceException
(
"添加失败!"
);
}
/// <summary>
/// 修改特殊方案子项
/// </summary>
/// <returns></returns>
public
mod_special
EditSpecial
(
mod_special
entity
)
{
var
special
=
perforModspecialRepository
.
GetEntity
(
t
=>
t
.
Id
==
entity
.
Id
);
if
(
special
==
null
)
throw
new
PerformanceException
(
"选择修改的数据不存在!"
);
special
.
Department
=
entity
.
Department
??
special
.
Department
;
special
.
Target
=
entity
.
Target
;
special
.
TargetFactor
=
entity
.
TargetFactor
;
special
.
AdjustFactor
=
entity
.
AdjustFactor
;
if
(!
perforModspecialRepository
.
Update
(
special
))
throw
new
PerformanceException
(
"修改失败!"
);
return
special
;
}
/// <summary>
/// 删除特殊方案子项
/// </summary>
/// <returns></returns>
public
void
DelSpecial
(
int
specialId
)
{
var
special
=
perforModspecialRepository
.
GetEntity
(
t
=>
t
.
Id
==
specialId
);
if
(
special
==
null
)
throw
new
PerformanceException
(
"需要删除的项不存在!"
);
perforModspecialRepository
.
Remove
(
special
);
}
}
}
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