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
245866cc
Commit
245866cc
authored
Jul 06, 2021
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
费用类型系数查询、保存
parent
61a31bc8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
264 additions
and
53 deletions
+264
-53
performance/Performance.Api/Controllers/ConfigController.cs
+4
-4
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
+3
-5
performance/Performance.DtoModels/Request/DrugtypeFactorRequest.cs
+13
-0
performance/Performance.EntityModels/Context/PerformanceDbContext.cs
+3
-1
performance/Performance.EntityModels/Entity/cof_drugtype_factor.cs
+0
-5
performance/Performance.Services/ConfigService.cs
+241
-38
No files found.
performance/Performance.Api/Controllers/ConfigController.cs
View file @
245866cc
...
...
@@ -727,15 +727,15 @@ public ApiResponse GetDrugtypeFactor([FromBody] AllotDeptRequest request)
[
HttpPost
(
"drugtype/factor/config"
)]
public
ApiResponse
GetDrugtypeFactorConfig
([
FromBody
]
AllotDeptRequest
request
)
{
var
data
=
_configService
.
GetDrugtypeFactorConfig
(
request
.
HospitalId
);
var
data
=
_configService
.
GetDrugtypeFactorConfig
(
request
.
HospitalId
,
request
.
AllotId
);
return
new
ApiResponse
(
ResponseType
.
OK
,
data
);
}
[
HttpPost
(
"drugtype/factor/save"
)]
public
ApiResponse
SaveDrugtypeFactor
([
FromBody
]
int
hospitalId
)
public
ApiResponse
SaveDrugtypeFactor
([
FromBody
]
DrugtypeFactorRequest
request
)
{
var
data
=
_configService
.
GetDrugtypeFactorConfig
(
hospitalId
);
return
new
ApiResponse
(
ResponseType
.
OK
,
data
);
_configService
.
SaveDrugtypeFactor
(
request
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"保存成功!"
);
}
#
endregion
...
...
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
View file @
245866cc
...
...
@@ -100,6 +100,9 @@
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.cof_drugtype"
>
<summary>
药占比费用列头名称
</summary>
</member>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.cof_drugtype_factor"
>
<summary>
药占比费用列头名称系数
</summary>
</member>
<member
name=
"P:Performance.EntityModels.PerformanceDbContext.cof_guarantee"
>
<summary>
保底科室配置
</summary>
</member>
...
...
@@ -1884,11 +1887,6 @@
费用名称
</summary>
</member>
<member
name=
"P:Performance.EntityModels.cof_drugtype_factor.ChargeType"
>
<summary>
费用类别
</summary>
</member>
<member
name=
"P:Performance.EntityModels.cof_drugtype_factor.ExModuleId"
>
<summary>
收入类型
...
...
performance/Performance.DtoModels/Request/DrugtypeFactorRequest.cs
0 → 100644
View file @
245866cc
using
System.Collections.Generic
;
namespace
Performance.DtoModels
{
public
class
DrugtypeFactorRequest
{
public
int
HospitalId
{
get
;
set
;
}
public
int
AllotId
{
get
;
set
;
}
public
List
<
Dictionary
<
string
,
object
>>
Data
{
get
;
set
;
}
}
}
performance/Performance.EntityModels/Context/PerformanceDbContext.cs
View file @
245866cc
...
...
@@ -77,7 +77,9 @@ public PerformanceDbContext(DbContextOptions<PerformanceDbContext> options)
public
virtual
DbSet
<
cof_drugprop
>
cof_drugprop
{
get
;
set
;
}
/// <summary> 药占比费用列头名称 </summary>
public
virtual
DbSet
<
cof_drugtype
>
cof_drugtype
{
get
;
set
;
}
/// <summary> 保底科室配置 </summary>
/// <summary> 药占比费用列头名称系数 </summary>
public
virtual
DbSet
<
cof_drugtype_factor
>
cof_drugtype_factor
{
get
;
set
;
}
/// <summary> 保底科室配置 </summary>
public
virtual
DbSet
<
cof_guarantee
>
cof_guarantee
{
get
;
set
;
}
/// <summary> </summary>
public
virtual
DbSet
<
cof_hrp_department
>
cof_hrp_department
{
get
;
set
;
}
...
...
performance/Performance.EntityModels/Entity/cof_drugtype_factor.cs
View file @
245866cc
...
...
@@ -35,11 +35,6 @@ public class cof_drugtype_factor
/// 费用名称
/// </summary>
public
string
Charge
{
get
;
set
;
}
/// <summary>
/// 费用类别
/// </summary>
public
string
ChargeType
{
get
;
set
;
}
/// <summary>
/// 收入类型
...
...
performance/Performance.Services/ConfigService.cs
View file @
245866cc
...
...
@@ -878,6 +878,24 @@ public void Copy(per_allot allot)
_drugtypeRepository
.
AddRange
(
newAgains
.
ToArray
());
}
logger
.
LogInformation
(
$"cofDrugtypefactor"
);
var
cofDrugtypeFactor
=
cofdrugtypefactorRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allot
.
ID
);
if
(
cofDrugtypeFactor
==
null
||
cofDrugtypeFactor
.
Count
==
0
)
{
var
drugtypefactoe
=
cofdrugtypefactorRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotId
)
??
cofdrugtypefactorRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
-
1
);
var
newAgains
=
drugtypefactoe
.
Select
(
t
=>
new
cof_drugtype_factor
{
HospitalId
=
allot
.
HospitalId
,
AllotID
=
allot
.
ID
,
ExModuleId
=
t
.
ExModuleId
,
Charge
=
t
.
Charge
,
YSZ
=
t
.
YSZ
,
HLZ
=
t
.
HLZ
,
YJZ
=
t
.
YJZ
,
});
cofdrugtypefactorRepository
.
AddRange
(
newAgains
.
ToArray
());
}
logger
.
LogInformation
(
$"cofDepttype"
);
var
cofDepttype
=
perforCofdepttypeRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allot
.
ID
);
if
(
cofDepttype
==
null
||
cofDepttype
.
Count
==
0
)
...
...
@@ -1213,12 +1231,124 @@ public void SaveSecondaryAlias(SaveCollectData request)
#
region
费用类型系数
public
List
<
view_dic_category_factor
>
GetDrugtypeFactor
(
AllotDeptRequest
request
)
public
SheetExportResponse
GetDrugtypeFactor
(
AllotDeptRequest
request
)
{
return
_directorRepository
.
QueryCategoryFactor
(
request
.
HospitalId
,
request
.
AllotId
)?.
ToList
();
SheetExportResponse
sheet
=
new
SheetExportResponse
();
#
region
header
var
models
=
perforExmoduleRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
request
.
HospitalId
&&
t
.
SheetType
==
(
int
)
SheetType
.
Income
);
if
(
models
==
null
||
!
models
.
Any
())
{
exConfigService
.
DefaultModules
(
request
.
HospitalId
);
models
=
perforExmoduleRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
request
.
HospitalId
&&
t
.
SheetType
==
(
int
)
SheetType
.
Income
);
if
(
models
==
null
||
!
models
.
Any
())
return
sheet
;
}
var
mergeCells
=
new
List
<
Cell
>
{
new
Cell
{
CellType
=
"header"
,
CellValue
=
""
,
PointCell
=
0
,
MergeRow
=
1
,
MergeCell
=
1
},
new
Cell
{
CellType
=
"header"
,
CellValue
=
""
,
PointCell
=
1
,
MergeRow
=
1
,
MergeCell
=
1
},
};
var
cells
=
new
List
<
Cell
>
{
new
Cell
{
CellType
=
"header"
,
CellValue
=
"项目小类(测算表)"
,
PointCell
=
0
,
MergeRow
=
1
,
MergeCell
=
1
},
new
Cell
{
CellType
=
"header"
,
CellValue
=
"费用大类(大屏展示)"
,
PointCell
=
1
,
MergeRow
=
1
,
MergeCell
=
1
}
};
var
defaultColumns
=
new
Dictionary
<
string
,
string
>
{
{
UnitType
.
医生组
.
ToString
(),
"ysz"
},
{
UnitType
.
护理组
.
ToString
(),
"hlz"
},
{
UnitType
.
医技组
.
ToString
(),
"yjz"
}
};
int
index
=
0
;
foreach
(
var
model
in
models
)
{
mergeCells
.
Add
(
new
Cell
{
CellType
=
"header"
,
CellValue
=
model
.
ModuleName
,
PointCell
=
2
+
index
*
3
,
MergeRow
=
1
,
MergeCell
=
defaultColumns
.
Count
});
int
i
=
0
;
cells
.
AddRange
(
defaultColumns
.
Select
(
t
=>
{
i
++;
return
new
Cell
{
CellType
=
"header"
,
CellValue
=
t
.
Key
,
PointCell
=
1
+
index
*
3
+
i
,
MergeRow
=
1
,
MergeCell
=
1
};
}));
index
++;
}
sheet
.
Header
=
new
List
<
Row
>
{
new
Row
(
0
){
Data
=
mergeCells
},
new
Row
(
1
){
Data
=
cells
}
};
#
endregion
#
region
data
List
<
Row
>
rows
=
new
List
<
Row
>();
var
querydata
=
_directorRepository
.
QueryCategoryFactor
(
request
.
HospitalId
,
request
.
AllotId
)?.
ToList
();
if
(
querydata
!=
null
&&
querydata
.
Any
())
{
var
fields
=
new
Dictionary
<
string
,
Func
<
view_dic_category_factor
,
object
>>
{
{
"ysz"
,
t
=>
t
.
YSZ
},
{
"hlz"
,
t
=>
t
.
HLZ
},
{
"yjz"
,
t
=>
t
.
YJZ
}
};
var
charges
=
querydata
.
Select
(
t
=>
new
{
t
.
Charge
,
t
.
ChargeType
}).
Distinct
().
OrderBy
(
t
=>
t
.
Charge
).
ThenBy
(
t
=>
t
.
ChargeType
);
index
=
0
;
foreach
(
var
charge
in
charges
)
{
var
rowcells
=
new
List
<
Cell
>
{
new
Cell
{
CellType
=
"body"
,
CellValue
=
charge
.
Charge
,
PointCell
=
0
,
MergeRow
=
1
,
MergeCell
=
1
},
new
Cell
{
CellType
=
"body"
,
CellValue
=
charge
.
ChargeType
,
PointCell
=
0
,
MergeRow
=
1
,
MergeCell
=
1
},
};
int
i
=
0
;
foreach
(
var
model
in
models
)
{
var
modeldata
=
querydata
.
FirstOrDefault
(
t
=>
t
.
Charge
==
charge
.
Charge
&&
t
.
ChargeType
==
charge
.
ChargeType
&&
t
.
ExModuleId
==
model
.
Id
);
int
j
=
1
;
foreach
(
var
column
in
defaultColumns
)
{
rowcells
.
Add
(
new
Cell
{
CellType
=
"body"
,
CellValue
=
modeldata
==
null
?
null
:
fields
[
column
.
Value
].
Invoke
(
modeldata
),
PointCell
=
1
+
i
*
3
+
j
,
MergeRow
=
1
,
MergeCell
=
1
});
j
++;
}
i
++;
}
rows
.
Add
(
new
Row
(
index
)
{
Data
=
rowcells
});
index
++;
}
}
sheet
.
Row
=
rows
;
#
endregion
return
sheet
;
}
public
HandsonTable
GetDrugtypeFactorConfig
(
int
hospitalId
)
public
HandsonTable
GetDrugtypeFactorConfig
(
int
hospitalId
,
int
allotId
)
{
HandsonTable
table
=
new
HandsonTable
((
int
)
SheetType
.
Unidentifiable
,
new
string
[]
{
},
new
List
<
collect_permission
>());
...
...
@@ -1231,7 +1361,13 @@ public HandsonTable GetDrugtypeFactorConfig(int hospitalId)
if
(
models
==
null
||
!
models
.
Any
())
return
table
;
}
var
defaultColumns
=
new
List
<
string
>
{
UnitType
.
医生组
.
ToString
(),
UnitType
.
护理组
.
ToString
(),
UnitType
.
医技组
.
ToString
()
};
var
defaultColumns
=
new
Dictionary
<
string
,
string
>
{
{
UnitType
.
医生组
.
ToString
(),
"ysz"
},
{
UnitType
.
护理组
.
ToString
(),
"hlz"
},
{
UnitType
.
医技组
.
ToString
(),
"yjz"
}
};
var
mergeCells
=
new
List
<
NestedHeader
>
{
new
NestedHeader
(
""
,
1
),
...
...
@@ -1241,63 +1377,130 @@ public HandsonTable GetDrugtypeFactorConfig(int hospitalId)
{
"项目小类(测算表)"
,
"费用大类(大屏展示)"
,
};
var
columns
=
new
List
<
HandsonColumn
>
{
new
HandsonColumn
(
"
项目小类(测算表)
"
,
false
),
new
HandsonColumn
(
"
费用大类(大屏展示)
"
,
false
),
new
HandsonColumn
(
"
charge
"
,
false
),
new
HandsonColumn
(
"
chargetype
"
,
false
),
};
foreach
(
var
model
in
models
)
{
mergeCells
.
Add
(
new
NestedHeader
(
model
.
ModuleName
,
defaultColumns
.
Count
));
cells
.
AddRange
(
defaultColumns
);
columns
.
AddRange
(
defaultColumns
.
Select
(
t
=>
new
HandsonColumn
(
t
,
false
,
DataFormat
.
百分比
)));
cells
.
AddRange
(
defaultColumns
.
Select
(
t
=>
t
.
Key
));
columns
.
AddRange
(
defaultColumns
.
Select
(
t
=>
new
HandsonColumn
(
t
.
Value
+
$"_
{
model
.
Id
}
"
,
false
,
DataFormat
.
百分比
)));
}
#
region
data
List
<
Dictionary
<
string
,
object
>>
data
=
new
List
<
Dictionary
<
string
,
object
>>();
var
querydata
=
_directorRepository
.
QueryCategoryFactor
(
hospitalId
,
allotId
)?.
ToList
();
if
(
querydata
!=
null
&&
querydata
.
Any
())
{
var
fields
=
new
Dictionary
<
string
,
Func
<
view_dic_category_factor
,
object
>>
{
{
"ysz"
,
t
=>
t
.
YSZ
},
{
"hlz"
,
t
=>
t
.
HLZ
},
{
"yjz"
,
t
=>
t
.
YJZ
}
};
var
charges
=
querydata
.
Select
(
t
=>
new
{
t
.
Charge
,
t
.
ChargeType
}).
Distinct
().
OrderBy
(
t
=>
t
.
Charge
).
ThenBy
(
t
=>
t
.
ChargeType
);
foreach
(
var
charge
in
charges
)
{
Dictionary
<
string
,
object
>
dict
=
new
Dictionary
<
string
,
object
>
{
{
"Charge"
,
charge
.
Charge
},
{
"ChargeType"
,
charge
.
ChargeType
}
};
foreach
(
var
model
in
models
)
{
var
modeldata
=
querydata
.
FirstOrDefault
(
t
=>
t
.
Charge
==
charge
.
Charge
&&
t
.
ChargeType
==
charge
.
ChargeType
&&
t
.
ExModuleId
==
model
.
Id
);
foreach
(
var
column
in
defaultColumns
)
{
if
(
modeldata
==
null
)
{
dict
.
Add
(
column
.
Value
+
$"_
{
model
.
Id
}
"
,
null
);
}
else
{
dict
.
Add
(
column
.
Value
+
$"_
{
model
.
Id
}
"
,
fields
[
column
.
Value
].
Invoke
(
modeldata
));
}
}
}
data
.
Add
(
dict
);
}
}
#
endregion
table
.
Columns
=
columns
;
table
.
NestedHeadersArray
=
new
object
[]
{
mergeCells
,
cells
};
table
.
ColHeaders
=
cells
;
table
.
Data
=
data
;
return
table
;
}
public
void
SaveDrugtypeFactor
(
List
<
object
>
nestedHeadersArray
,
string
[][]
data
,
int
hospitalId
,
int
allotId
)
public
void
SaveDrugtypeFactor
(
DrugtypeFactorRequest
request
)
{
if
(
data
==
null
||
!
data
.
Any
(
t
=>
t
!=
null
&&
t
.
Count
()
>
0
&&
!
string
.
IsNullOrEmpty
(
t
[
0
])))
return
;
if
(
request
.
Data
==
null
||
!
request
.
Data
.
Any
())
return
;
var
moduleIds
=
request
.
Data
.
FirstOrDefault
().
Keys
.
Where
(
t
=>
t
.
Contains
(
"_"
)).
Select
(
t
=>
t
.
Split
(
'_'
)[
1
]).
Distinct
();
var
factors
=
new
List
<
cof_drugtype_factor
>();
var
charges
=
new
List
<
cof_drugtype
>();
bool
isHasChargeData
=
false
;
var
charges
=
new
List
<
view_dic_category_factor
>();
if
(
nestedHeadersArray
[
0
]
is
List
<
NestedHeader
>
modelHeaders
&&
modelHeaders
.
Any
(
t
=>
!
string
.
IsNullOrEmpty
(
t
.
Label
)))
foreach
(
var
item
in
request
.
Data
)
{
var
headers
=
nestedHeadersArray
[
1
]
as
List
<
string
>;
var
modelnames
=
modelHeaders
.
Where
(
t
=>
!
string
.
IsNullOrEmpty
(
t
.
Label
)).
Select
(
t
=>
t
.
Label
);
var
models
=
perforExmoduleRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
&&
t
.
SheetType
==
(
int
)
SheetType
.
Income
);
if
(
models
==
null
||
!
models
.
Any
())
return
;
string
charge
=
string
.
Empty
;
string
chargeType
=
string
.
Empty
;
if
(
item
.
ContainsKey
(
"charge"
))
charge
=
item
[
"charge"
]?.
ToString
();
if
(
item
.
ContainsKey
(
"chargetype"
))
chargeType
=
item
[
"chargetype"
]?.
ToString
();
if
(
string
.
IsNullOrEmpty
(
charge
)
&&
string
.
IsNullOrEmpty
(
chargeType
))
continue
;
isHasChargeData
=
true
;
charges
.
Add
(
new
cof_drugtype
{
HospitalId
=
request
.
HospitalId
,
AllotID
=
request
.
AllotId
,
Charge
=
charge
,
ChargeType
=
chargeType
,
});
foreach
(
var
item
in
data
.
Where
(
t
=>
t
!=
null
&&
t
.
Count
()
==
headers
.
Count
&&
!
string
.
IsNullOrEmpty
(
t
[
0
]))
)
foreach
(
var
moduleId
in
moduleIds
)
{
string
charge
=
item
[
0
];
string
chargeType
=
item
[
1
];
int
index
=
0
;
foreach
(
var
modelname
in
modelnames
)
var
data
=
item
.
Where
(
t
=>
t
.
Key
.
EndsWith
(
moduleId
));
factors
.
Add
(
new
cof_drugtype_factor
{
index
++;
var
exmodel
=
models
.
FirstOrDefault
(
t
=>
t
.
ModuleName
==
modelname
);
if
(
exmodel
==
null
)
continue
;
HospitalId
=
request
.
HospitalId
,
AllotID
=
request
.
AllotId
,
Charge
=
charge
,
ExModuleId
=
ConvertHelper
.
To
<
int
>(
moduleId
),
YSZ
=
item
.
ContainsKey
(
"ysz_"
+
moduleId
)
?
ConvertHelper
.
To
<
decimal
?>(
item
[
"ysz_"
+
moduleId
])
:
null
,
HLZ
=
item
.
ContainsKey
(
"hlz_"
+
moduleId
)
?
ConvertHelper
.
To
<
decimal
?>(
item
[
"hlz_"
+
moduleId
])
:
null
,
YJZ
=
item
.
ContainsKey
(
"yjz_"
+
moduleId
)
?
ConvertHelper
.
To
<
decimal
?>(
item
[
"yjz_"
+
moduleId
])
:
null
,
});
}
}
var
dic
=
new
view_dic_category_factor
{
HospitalId
=
hospitalId
,
AllotID
=
allotId
,
Charge
=
charge
,
ChargeType
=
chargeType
,
ExModuleId
=
exmodel
.
Id
,
ModuleName
=
modelname
,
YSZ
=
ConvertHelper
.
To
<
decimal
?>(
item
[
2
+
3
*
(
index
-
1
)]),
HLZ
=
ConvertHelper
.
To
<
decimal
?>(
item
[
3
+
3
*
(
index
-
1
)]),
YJZ
=
ConvertHelper
.
To
<
decimal
?>(
item
[
4
+
3
*
(
index
-
1
)]),
};
charges
.
Add
(
dic
);
}
var
savedData
=
cofdrugtypefactorRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
request
.
HospitalId
&&
t
.
AllotID
==
request
.
AllotId
);
if
(
savedData
!=
null
&&
savedData
.
Any
())
{
cofdrugtypefactorRepository
.
RemoveRange
(
savedData
.
ToArray
());
}
if
(
factors
!=
null
&&
factors
.
Any
())
cofdrugtypefactorRepository
.
AddRange
(
factors
.
ToArray
());
if
(
isHasChargeData
)
{
var
drugtypes
=
_drugtypeRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
request
.
HospitalId
&&
t
.
AllotID
==
request
.
AllotId
);
if
(
drugtypes
!=
null
&&
drugtypes
.
Any
())
{
_drugtypeRepository
.
RemoveRange
(
drugtypes
.
ToArray
());
}
if
(
charges
!=
null
&&
charges
.
Any
())
_drugtypeRepository
.
AddRange
(
charges
.
ToArray
());
}
}
...
...
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