Commit d976e60b by ruyun.zhang@suvalue.com

Merge branch 'v2020morge-rename' into v2020morge-job

parents b04b0dd6 7a606ea7
...@@ -142,29 +142,29 @@ public ApiResponse InpatFeeAvg([CustomizeValidator(RuleSet = "Query"), FromBody] ...@@ -142,29 +142,29 @@ public ApiResponse InpatFeeAvg([CustomizeValidator(RuleSet = "Query"), FromBody]
return new ApiResponse(ResponseType.OK, "", list); return new ApiResponse(ResponseType.OK, "", list);
} }
/// <summary> ///// <summary>
/// 科室药占比 ///// 科室药占比
/// </summary> ///// </summary>
/// <returns></returns> ///// <returns></returns>
[Route("medicine")] //[Route("medicine")]
[HttpPost] //[HttpPost]
public ApiResponse Medicine([CustomizeValidator(RuleSet = "Query"), FromBody] ReportRequest request) //public ApiResponse Medicine([CustomizeValidator(RuleSet = "Query"), FromBody] ReportRequest request)
{ //{
var list = reportService.Medicine(request.HospitalId, request.IsIndex); // var list = reportService.Medicine(request.HospitalId, request.IsIndex);
return new ApiResponse(ResponseType.OK, "", list); // return new ApiResponse(ResponseType.OK, "", list);
} //}
/// <summary> ///// <summary>
/// 科室有效收入占比 ///// 科室有效收入占比
/// </summary> ///// </summary>
/// <returns></returns> ///// <returns></returns>
[Route("income")] //[Route("income")]
[HttpPost] //[HttpPost]
public ApiResponse Income([CustomizeValidator(RuleSet = "Query"), FromBody] ReportRequest request) //public ApiResponse Income([CustomizeValidator(RuleSet = "Query"), FromBody] ReportRequest request)
{ //{
var list = reportService.Income(request.HospitalId, request.IsIndex); // var list = reportService.Income(request.HospitalId, request.IsIndex);
return new ApiResponse(ResponseType.OK, "", list); // return new ApiResponse(ResponseType.OK, "", list);
} //}
/// <summary> /// <summary>
/// 月群体人均绩效 /// 月群体人均绩效
......
...@@ -1142,18 +1142,6 @@ ...@@ -1142,18 +1142,6 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Performance.Api.Controllers.ReportController.Medicine(Performance.DtoModels.ReportRequest)">
<summary>
科室药占比
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportController.Income(Performance.DtoModels.ReportRequest)">
<summary>
科室有效收入占比
</summary>
<returns></returns>
</member>
<member name="M:Performance.Api.Controllers.ReportController.AvgPerfor(Performance.DtoModels.ReportRequest)"> <member name="M:Performance.Api.Controllers.ReportController.AvgPerfor(Performance.DtoModels.ReportRequest)">
<summary> <summary>
月群体人均绩效 月群体人均绩效
......
...@@ -1175,7 +1175,7 @@ ...@@ -1175,7 +1175,7 @@
</member> </member>
<member name="P:Performance.EntityModels.ag_secondallot.SubmitType"> <member name="P:Performance.EntityModels.ag_secondallot.SubmitType">
<summary> <summary>
提交类型 1使用模板 2 其他类型数据 提交类型 1 使用模板 2 其他类型数据
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.ag_secondallot.SubmitTime"> <member name="P:Performance.EntityModels.ag_secondallot.SubmitTime">
...@@ -1423,6 +1423,11 @@ ...@@ -1423,6 +1423,11 @@
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.ag_workload_source.WorkTypeId">
<summary>
1、单项奖励 2、工作量占比 ..(自定义占比)
</summary>
</member>
<member name="T:Performance.EntityModels.ag_workload_type"> <member name="T:Performance.EntityModels.ag_workload_type">
<summary> <summary>
......
...@@ -82,7 +82,7 @@ public class ag_secondallot ...@@ -82,7 +82,7 @@ public class ag_secondallot
public Nullable<int> Status { get; set; } public Nullable<int> Status { get; set; }
/// <summary> /// <summary>
/// 提交类型 1使用模板 2 其他类型数据 /// 提交类型 1 使用模板 2 其他类型数据
/// </summary> /// </summary>
public Nullable<int> SubmitType { get; set; } public Nullable<int> SubmitType { get; set; }
......
...@@ -55,5 +55,10 @@ public class ag_workload_source ...@@ -55,5 +55,10 @@ public class ag_workload_source
/// ///
/// </summary> /// </summary>
public Nullable<decimal> Value { get; set; } public Nullable<decimal> Value { get; set; }
/// <summary>
/// 1、单项奖励 2、工作量占比 ..(自定义占比)
/// </summary>
public Nullable<int> WorkTypeId { get; set; }
} }
} }
...@@ -213,7 +213,7 @@ public IEnumerable<ex_result> QueryIncomeData(int allotid, string source, string ...@@ -213,7 +213,7 @@ public IEnumerable<ex_result> QueryIncomeData(int allotid, string source, string
WHERE t1.allotid = @allotid WHERE t1.allotid = @allotid
AND t3.unittype = @unittype AND t3.unittype = @unittype
AND t3.accountingunit = @accountingunit AND t3.accountingunit = @accountingunit
AND t1.Source like '%{source}开单%' AND (t1.Source like '%{source}开单%' OR t1.Source like '%{source}就诊%')
AND T1.IsDelete = 0 AND T1.IsDelete = 0
ORDER BY t1.doctorname,t1.Category;"; ORDER BY t1.doctorname,t1.Category;";
return connection.Query<ex_result>(clear, new { allotid, accountingunit, unittype, hospitalid }, commandTimeout: 60 * 60); return connection.Query<ex_result>(clear, new { allotid, accountingunit, unittype, hospitalid }, commandTimeout: 60 * 60);
......
...@@ -59,33 +59,33 @@ public List<PerReport> InpatFeeAvg(int hospitalId, List<string> date) ...@@ -59,33 +59,33 @@ public List<PerReport> InpatFeeAvg(int hospitalId, List<string> date)
return DapperQuery(sql, new { date, hospitalId }).ToList(); return DapperQuery(sql, new { date, hospitalId }).ToList();
} }
/// <summary> // /// <summary>
/// 科室药占比 // /// 科室药占比
/// </summary> // /// </summary>
/// <returns></returns> // /// <returns></returns>
public List<PerReport> Medicine(int hospitalId, List<string> date) // public List<PerReport> Medicine(int hospitalId, List<string> date)
{ // {
string sql = @"select accountingunit x,concat(year,'-',lpad(month,2,'0')) y,round((sum(if(cd.id is null,0,cellvalue)) / sum(cellvalue))*100,2) value // string sql = @"select accountingunit x,concat(year,'-',lpad(month,2,'0')) y,round((sum(if(cd.id is null,0,cellvalue)) / sum(cellvalue))*100,2) value
from per_allot aot join per_sheet sht on aot.id=sht.allotid join im_data dt on dt.sheetid=sht.id // from per_allot aot join per_sheet sht on aot.id=sht.allotid join im_data dt on dt.sheetid=sht.id
left join cof_drugtype cd on cd.allotid=dt.allotid and cd.charge=dt.TypeName and cd.chargetype in ('药费') where unittype=1 and sheettype=3 //left join cof_drugtype cd on cd.allotid=dt.allotid and cd.charge=dt.TypeName and cd.chargetype in ('药费') where unittype=1 and sheettype=3
and sheetname like '%开单收入' and ifnull(accountingunit,'') not in ('') and concat(year,'-',lpad(month,2,'0')) // and sheetname like '%开单收入' and ifnull(accountingunit,'') not in ('') and concat(year,'-',lpad(month,2,'0'))
in @date and hospitalid = @hospitalId group by year,month,accountingunit order by y asc,value desc;"; // in @date and hospitalid = @hospitalId group by year,month,accountingunit order by y asc,value desc;";
return DapperQuery(sql, new { hospitalId, date }).ToList(); // return DapperQuery(sql, new { hospitalId, date }).ToList();
} // }
/// <summary> // /// <summary>
/// 科室有效收入占比 // /// 科室有效收入占比
/// </summary> // /// </summary>
/// <returns></returns> // /// <returns></returns>
public List<PerReport> Income(int hospitalId, List<string> date) // public List<PerReport> Income(int hospitalId, List<string> date)
{ // {
string sql = @"select accountingunit x,concat(year,'-',lpad(month,2,'0')) y,round((sum(if(cd.id is null,cellvalue,0)) / sum(cellvalue))*100,2) value // string sql = @"select accountingunit x,concat(year,'-',lpad(month,2,'0')) y,round((sum(if(cd.id is null,cellvalue,0)) / sum(cellvalue))*100,2) value
from per_allot aot join per_sheet sht on aot.id=sht.allotid join im_data dt on dt.sheetid=sht.id // from per_allot aot join per_sheet sht on aot.id=sht.allotid join im_data dt on dt.sheetid=sht.id
left join cof_drugtype cd on cd.allotid=dt.allotid and cd.charge=dt.TypeName and cd.chargetype in ('药费','材料费') //left join cof_drugtype cd on cd.allotid=dt.allotid and cd.charge=dt.TypeName and cd.chargetype in ('药费','材料费')
where unittype=1 and sheettype=3 and sheetname like '%开单收入' and ifnull(accountingunit,'') not in ('') and concat(year,'-',lpad(month,2,'0')) //where unittype=1 and sheettype=3 and sheetname like '%开单收入' and ifnull(accountingunit,'') not in ('') and concat(year,'-',lpad(month,2,'0'))
in @date and hospitalid = @hospitalId group by year,month,accountingunit order by y asc,value desc;"; // in @date and hospitalid = @hospitalId group by year,month,accountingunit order by y asc,value desc;";
return DapperQuery(sql, new { hospitalId, date }).ToList(); // return DapperQuery(sql, new { hospitalId, date }).ToList();
} // }
#region 首页报表 #region 首页报表
/// <summary> /// <summary>
......
...@@ -522,6 +522,7 @@ public void GenerateSecondAllot(per_allot allot) ...@@ -522,6 +522,7 @@ public void GenerateSecondAllot(per_allot allot)
List<ag_secondallot> tempSecond = new List<ag_secondallot>(); List<ag_secondallot> tempSecond = new List<ag_secondallot>();
List<ag_secondallot> insSecond = new List<ag_secondallot>(); List<ag_secondallot> insSecond = new List<ag_secondallot>();
List<ag_secondallot> updSecond = new List<ag_secondallot>(); List<ag_secondallot> updSecond = new List<ag_secondallot>();
List<ag_secondallot> delSecond = new List<ag_secondallot>();
var types = new List<int> { (int)UnitType.行政高层, (int)UnitType.行政中层, (int)UnitType.行政后勤 }; var types = new List<int> { (int)UnitType.行政高层, (int)UnitType.行政中层, (int)UnitType.行政后勤 };
//// 获取医院是否开启后勤二次分配 //// 获取医院是否开启后勤二次分配
...@@ -612,11 +613,37 @@ public void GenerateSecondAllot(per_allot allot) ...@@ -612,11 +613,37 @@ public void GenerateSecondAllot(per_allot allot)
} }
} }
if (secondList != null && secondList.Any())
{
foreach (var item in secondList)
{
var second = tempSecond?.FirstOrDefault(f => f.UnitType == item.UnitType && f.Department == item.Department);
if (second == null)
{
delSecond.Add(item);
}
}
}
if (insSecond.Any()) if (insSecond.Any())
perforAgsecondallotRepository.AddRange(insSecond.ToArray()); perforAgsecondallotRepository.AddRange(insSecond.ToArray());
if (updSecond.Any()) if (updSecond.Any())
{
perforAgsecondallotRepository.UpdateRange(updSecond.ToArray()); perforAgsecondallotRepository.UpdateRange(updSecond.ToArray());
foreach (var item in updSecond.Where(w => w.Status == 4))
{
// 自动驳回,需要清空该科室历史数据
var histories = perforAgcomputeRepository.GetEntities(w => w.SecondId == item.Id);
if (histories != null && histories.Any())
perforAgcomputeRepository.RemoveRange(histories.ToArray());
}
}
if (delSecond.Any())
{
perforAgsecondallotRepository.RemoveRange(delSecond.ToArray());
}
} }
} }
} }
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Performance.DtoModels.Request; using Performance.DtoModels.Request;
using Performance.DtoModels.Response; using Performance.DtoModels.Response;
using Performance.Services.ExtractExcelService;
namespace Performance.Services namespace Performance.Services
{ {
...@@ -1043,6 +1044,20 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId) ...@@ -1043,6 +1044,20 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId)
var headers = _perforImheaderRepository.GetEntities(t => t.AllotID == account.AllotID); var headers = _perforImheaderRepository.GetEntities(t => t.AllotID == account.AllotID);
var basicData = _perforImDataRepository.GetEntities(t => t.AllotID == account.AllotID && t.AccountingUnit == account.AccountingUnit); var basicData = _perforImDataRepository.GetEntities(t => t.AllotID == account.AllotID && t.AccountingUnit == account.AccountingUnit);
Func<string, string> getShowKey = (name) =>
{
string _key = "开单";
if (string.IsNullOrEmpty(name)) return _key;
if (name.IndexOf("就诊") > -1)
_key = "就诊";
return _key;
};
string key = getShowKey.Invoke(persheet.FirstOrDefault(t => t.SheetName.NoBlank().StartsWith("1.1.1"))?.SheetName);
DeptDataDetails deptDetails = new DeptDataDetails DeptDataDetails deptDetails = new DeptDataDetails
{ {
ShowFormula = allot.ShowFormula, ShowFormula = allot.ShowFormula,
...@@ -1050,7 +1065,7 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId) ...@@ -1050,7 +1065,7 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId)
Detail = new List<DetailDtos>() Detail = new List<DetailDtos>()
}; };
if (basicData == null || !basicData.Any()) return MergeDetails(deptDetails); if (basicData == null || !basicData.Any()) return MergeDetails(deptDetails, key);
var sheetType = new List<int> var sheetType = new List<int>
{ {
...@@ -1118,7 +1133,7 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId) ...@@ -1118,7 +1133,7 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId)
deptDetails.Pandect.MaterialsExtra = deptDetails.Detail?.FirstOrDefault(w => w.OriginalType == (int)SheetType.AccountMaterialsAssess)?.Amount ?? deptDetails.Pandect.MaterialsExtra; deptDetails.Pandect.MaterialsExtra = deptDetails.Detail?.FirstOrDefault(w => w.OriginalType == (int)SheetType.AccountMaterialsAssess)?.Amount ?? deptDetails.Pandect.MaterialsExtra;
deptDetails.Pandect.MedicineExtra = deptDetails.Detail?.FirstOrDefault(w => w.OriginalType == (int)SheetType.AccountDrugAssess)?.Amount ?? deptDetails.Pandect.MedicineExtra; deptDetails.Pandect.MedicineExtra = deptDetails.Detail?.FirstOrDefault(w => w.OriginalType == (int)SheetType.AccountDrugAssess)?.Amount ?? deptDetails.Pandect.MedicineExtra;
return MergeDetails(deptDetails); return MergeDetails(deptDetails, key);
//return deptDetails; //return deptDetails;
} }
...@@ -1243,7 +1258,7 @@ private List<DetailModule> CommonDetailItems(List<im_data> basicData, List<im_he ...@@ -1243,7 +1258,7 @@ private List<DetailModule> CommonDetailItems(List<im_data> basicData, List<im_he
return items; return items;
} }
private DeptDataDetails<DetailModuleExtend> MergeDetails(DeptDataDetails details) private DeptDataDetails<DetailModuleExtend> MergeDetails(DeptDataDetails details, string key)
{ {
if (details == null) return new DeptDataDetails<DetailModuleExtend>(); if (details == null) return new DeptDataDetails<DetailModuleExtend>();
...@@ -1267,7 +1282,7 @@ private DeptDataDetails<DetailModuleExtend> MergeDetails(DeptDataDetails details ...@@ -1267,7 +1282,7 @@ private DeptDataDetails<DetailModuleExtend> MergeDetails(DeptDataDetails details
{ {
depts.AddRange(t.Items.Select(o => o.ItemName)); depts.AddRange(t.Items.Select(o => o.ItemName));
}); });
var billing = data.FirstOrDefault(t => t.ItemName.Replace("就诊", "开单").IndexOf("开单") > -1); var billing = data.FirstOrDefault(t => t.ItemName.IndexOf(key) > -1);
var execute = data.FirstOrDefault(t => t.ItemName.IndexOf("执行") > -1); var execute = data.FirstOrDefault(t => t.ItemName.IndexOf("执行") > -1);
foreach (var dept in depts.Distinct().OrderBy(t => t)) foreach (var dept in depts.Distinct().OrderBy(t => t))
{ {
...@@ -1316,7 +1331,7 @@ private DeptDataDetails<DetailModuleExtend> MergeDetails(DeptDataDetails details ...@@ -1316,7 +1331,7 @@ private DeptDataDetails<DetailModuleExtend> MergeDetails(DeptDataDetails details
result.Detail.Add(new DetailDtos<DetailModuleExtend> result.Detail.Add(new DetailDtos<DetailModuleExtend>
{ {
ItemName = data.FirstOrDefault(t => t.ItemName.IndexOf("执行") > -1) is null ? data.First().ItemName : ItemName = data.FirstOrDefault(t => t.ItemName.IndexOf("执行") > -1) is null ? data.First().ItemName :
data.FirstOrDefault(t => t.ItemName.IndexOf("执行") > -1).ItemName?.Replace("执行", "开单/执行"), data.FirstOrDefault(t => t.ItemName.IndexOf("执行") > -1).ItemName?.Replace("执行", $"{key}/执行"),
IncomeType = data.First()?.IncomeType ?? 0, IncomeType = data.First()?.IncomeType ?? 0,
OriginalType = data.First()?.OriginalType ?? 0, OriginalType = data.First()?.OriginalType ?? 0,
Amount = data.Sum(w => w.Amount), Amount = data.Sum(w => w.Amount),
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -72,6 +72,7 @@ public List<ex_module> QueryModule(int hospitalId) ...@@ -72,6 +72,7 @@ public List<ex_module> QueryModule(int hospitalId)
DefaultModules(hospitalId); DefaultModules(hospitalId);
var list = exmoduleRepository.GetEntities(t => t.HospitalId == hospitalId).OrderBy(t => t.ModuleName).ToList(); var list = exmoduleRepository.GetEntities(t => t.HospitalId == hospitalId).OrderBy(t => t.ModuleName).ToList();
list?.ForEach(t => t.ReadOnly = t.SheetType == (int)SheetType.Income ? 0 : 1);
return list; return list;
} }
...@@ -90,7 +91,7 @@ private void DefaultModules(int hospitalId) ...@@ -90,7 +91,7 @@ private void DefaultModules(int hospitalId)
}; };
var data = exmoduleRepository.GetEntities(t => t.HospitalId == hospitalId); var data = exmoduleRepository.GetEntities(t => t.HospitalId == hospitalId);
var inexistence = data == null ? moduleList : moduleList.Where(t => !data.Select(p => p.ModuleName).ToArray().Contains(t.ModuleName)); var inexistence = data == null ? moduleList : moduleList.Where(t => !data.Any(w => w.ModuleName.StartsWith(t.ModuleName.Split(' ')[0])));
if (inexistence != null && inexistence.Any()) if (inexistence != null && inexistence.Any())
{ {
...@@ -102,7 +103,7 @@ private void DefaultModules(int hospitalId) ...@@ -102,7 +103,7 @@ private void DefaultModules(int hospitalId)
HospitalId = hospitalId, HospitalId = hospitalId,
ModuleName = item.ModuleName, ModuleName = item.ModuleName,
SheetType = (int)item.SheetType, SheetType = (int)item.SheetType,
ReadOnly = 1, ReadOnly = item.SheetType == (int)SheetType.Income ? 0 : 1,
TypeId = null, TypeId = null,
}; };
modules.Add(module); modules.Add(module);
...@@ -120,8 +121,7 @@ public ex_module AddModule(ModModuleRequest request) ...@@ -120,8 +121,7 @@ public ex_module AddModule(ModModuleRequest request)
string addname = ""; string addname = "";
if (request.SheetType == (int)SheetType.Income) if (request.SheetType == (int)SheetType.Income)
{ {
string[] array = new string[] { "开单收入", "执行收入" }; if (request.ModuleName.IndexOf("开单收入") == -1 && request.ModuleName.IndexOf("就诊收入") == -1 && request.ModuleName.IndexOf("执行收入") == -1)
if (request.ModuleName.IndexOf("开单收入") == -1 && request.ModuleName.IndexOf("执行收入") == -1)
throw new PerformanceException("模块名称规则错误"); throw new PerformanceException("模块名称规则错误");
//if (!Regex.IsMatch(request.ModuleName, @"^[\u4e00-\u9fa5]+$")) //if (!Regex.IsMatch(request.ModuleName, @"^[\u4e00-\u9fa5]+$"))
// throw new PerformanceException("模块名称规则错误,请使用全中文命名"); // throw new PerformanceException("模块名称规则错误,请使用全中文命名");
...@@ -132,7 +132,7 @@ public ex_module AddModule(ModModuleRequest request) ...@@ -132,7 +132,7 @@ public ex_module AddModule(ModModuleRequest request)
throw new PerformanceException("绩效模板已存在!"); throw new PerformanceException("绩效模板已存在!");
var moduleList = exmoduleRepository.GetEntities(t => t.HospitalId == request.HospitalId && t.ModuleName.IndexOf("1.") != -1); var moduleList = exmoduleRepository.GetEntities(t => t.HospitalId == request.HospitalId && t.ModuleName.IndexOf("1.") != -1);
string name = request.ModuleName.Replace("开单收入", "").Replace("执行收入", ""); string name = request.ModuleName.Replace("开单收入", "").Replace("就诊收入", "").Replace("执行收入", "");
var exist = moduleList.Where(t => t.ModuleName.Contains(name)); var exist = moduleList.Where(t => t.ModuleName.Contains(name));
if (exist != null && exist.Any()) if (exist != null && exist.Any())
{ {
......
...@@ -57,7 +57,7 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo ...@@ -57,7 +57,7 @@ public static void CreateNotExistSheet(List<ex_module> modulesList, IWorkbook wo
var sheet = workbook.GetSheet(module.ModuleName) ?? workbook.GetSheet(module.ModuleName.NoBlank()); var sheet = workbook.GetSheet(module.ModuleName) ?? workbook.GetSheet(module.ModuleName.NoBlank());
if (sheet == null) if (sheet == null)
{ {
string[] keyArray = new string[] { "开单", "执行" }; string[] keyArray = new string[] { "开单", "就诊", "执行" };
if (keyArray.Any(key => module.ModuleName.Contains(key))) if (keyArray.Any(key => module.ModuleName.Contains(key)))
{ {
var item = pairs.Where(t => t.Key.StartsWith("1.")).OrderByDescending(t => t.Key).First(); var item = pairs.Where(t => t.Key.StartsWith("1.")).OrderByDescending(t => t.Key).First();
......
...@@ -182,53 +182,53 @@ public List<PerReport> InpatFeeAvg(int hospitalId) ...@@ -182,53 +182,53 @@ public List<PerReport> InpatFeeAvg(int hospitalId)
return perforReportRepository.InpatFeeAvg(hospitalId, date); return perforReportRepository.InpatFeeAvg(hospitalId, date);
} }
/// <summary> ///// <summary>
/// 科室药占比 ///// 科室药占比
/// </summary> ///// </summary>
/// <returns></returns> ///// <returns></returns>
public List<PerReport> Medicine(int hospitalId, int isIndex) //public List<PerReport> Medicine(int hospitalId, int isIndex)
{ //{
var states = new List<int>() { 6, 8 }; // var states = new List<int>() { 6, 8 };
var allotList = perforPerallotRepository.GetEntities(t => t.HospitalId == hospitalId && states.Contains(t.States)); // var allotList = perforPerallotRepository.GetEntities(t => t.HospitalId == hospitalId && states.Contains(t.States));
if (allotList == null || !allotList.Any()) // if (allotList == null || !allotList.Any())
throw new PerformanceException("用户未创建绩效!"); // throw new PerformanceException("用户未创建绩效!");
var date = new List<string>(); // var date = new List<string>();
if (isIndex == 1) // if (isIndex == 1)
{ // {
var allot = allotList.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).FirstOrDefault(); // var allot = allotList.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).FirstOrDefault();
date.Add(allot.Year + "-" + allot.Month.ToString().PadLeft(2, '0')); // date.Add(allot.Year + "-" + allot.Month.ToString().PadLeft(2, '0'));
} // }
else // else
{ // {
date = allotList.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).Take(6).Select(t => t.Year + "-" + t.Month.ToString().PadLeft(2, '0')).ToList(); // date = allotList.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).Take(6).Select(t => t.Year + "-" + t.Month.ToString().PadLeft(2, '0')).ToList();
} // }
return perforReportRepository.Medicine(hospitalId, date); // return perforReportRepository.Medicine(hospitalId, date);
} //}
/// <summary> ///// <summary>
/// 科室有效收入占比 ///// 科室有效收入占比
/// </summary> ///// </summary>
/// <returns></returns> ///// <returns></returns>
public List<PerReport> Income(int hospitalId, int isIndex) //public List<PerReport> Income(int hospitalId, int isIndex)
{ //{
var states = new List<int>() { 6, 8 }; // var states = new List<int>() { 6, 8 };
var allotList = perforPerallotRepository.GetEntities(t => t.HospitalId == hospitalId && states.Contains(t.States)); // var allotList = perforPerallotRepository.GetEntities(t => t.HospitalId == hospitalId && states.Contains(t.States));
if (allotList == null || !allotList.Any()) // if (allotList == null || !allotList.Any())
throw new PerformanceException("用户未创建绩效!"); // throw new PerformanceException("用户未创建绩效!");
var date = new List<string>(); // var date = new List<string>();
if (isIndex == 1) // if (isIndex == 1)
{ // {
var allot = allotList.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).FirstOrDefault(); // var allot = allotList.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).FirstOrDefault();
date.Add(allot.Year + "-" + allot.Month.ToString().PadLeft(2, '0')); // date.Add(allot.Year + "-" + allot.Month.ToString().PadLeft(2, '0'));
} // }
else // else
{ // {
date = allotList.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).Take(6).Select(t => t.Year + "-" + t.Month.ToString().PadLeft(2, '0')).ToList(); // date = allotList.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).Take(6).Select(t => t.Year + "-" + t.Month.ToString().PadLeft(2, '0')).ToList();
} // }
return perforReportRepository.Income(hospitalId, date); // return perforReportRepository.Income(hospitalId, date);
} //}
/// <summary> /// <summary>
/// 只支持EXCEL抽取报表数据 /// 只支持EXCEL抽取报表数据
......
...@@ -133,7 +133,7 @@ public List<HeadItem> GetHeadItems(int hospitalId, int tempId, ag_secondallot se ...@@ -133,7 +133,7 @@ public List<HeadItem> GetHeadItems(int hospitalId, int tempId, ag_secondallot se
var configHeaders = agworkloadRepository.GetEntities(w => w.HospitalId == hospitalId && w.Department == secondAllot.Department && w.UnitType == secondAllot.UnitType); var configHeaders = agworkloadRepository.GetEntities(w => w.HospitalId == hospitalId && w.Department == secondAllot.Department && w.UnitType == secondAllot.UnitType);
if (SecondAllotService.defaultValues != null && SecondAllotService.defaultValues.Any()) if (SecondAllotService.defaultValues != null && SecondAllotService.defaultValues.Any())
configHeaders = configHeaders.Where(w => !SecondAllotService.defaultValues.Select(t => t.Item1).Contains(w.ItemName)).ToList(); configHeaders = configHeaders?.Where(w => !SecondAllotService.defaultValues.Select(t => t.Item1).Contains(w.ItemName)).ToList();
// 初始化固定列 // 初始化固定列
var headItems = Mapper.Map<List<HeadItem>>(fixedHeaders) ?? new List<HeadItem>(); var headItems = Mapper.Map<List<HeadItem>>(fixedHeaders) ?? new List<HeadItem>();
......
...@@ -420,10 +420,14 @@ public dynamic GetWorkloadDict(int secondId) ...@@ -420,10 +420,14 @@ public dynamic GetWorkloadDict(int secondId)
private dynamic GetWorkloadDictAfterAudit(int secondId) private dynamic GetWorkloadDictAfterAudit(int secondId)
{ {
var bodysources = agbodysourceRepository.GetEntities(t => t.SecondId == secondId); var bodysources = agbodysourceRepository.GetEntities(t => t.SecondId == secondId);
if (bodysources == null || !bodysources.Any()) return new string[] { };
var workloadsources = agworkloadsourceRepository.GetEntities(t => bodysources.Select(w => w.Id).Contains(t.BodyId)); var workloadsources = agworkloadsourceRepository.GetEntities(t => bodysources.Select(w => w.Id).Contains(t.BodyId));
if (workloadsources == null || !workloadsources.Any()) return new string[] { };
var dict = workloadsources.GroupBy(t => new { t.ItemId, t.ItemName, t.FactorValue }).Select(t => new var dict = workloadsources.GroupBy(t => new { t.ItemId, t.ItemName, t.FactorValue, t.Sort, t.WorkTypeId, t.WorkloadId })
.OrderBy(t => t.Key.WorkTypeId).ThenBy(t => t.Key.Sort)
.Select(t => new
{ {
Title = t.Key.ItemId, Title = t.Key.ItemId,
Value = t.Key.ItemName, Value = t.Key.ItemName,
...@@ -553,7 +557,8 @@ private void SaveSecondAllotBodyData(int hospitalId, ag_secondallot second, dyna ...@@ -553,7 +557,8 @@ private void SaveSecondAllotBodyData(int hospitalId, ag_secondallot second, dyna
ItemName = workload.ItemName, ItemName = workload.ItemName,
FactorValue = workload.FactorValue, FactorValue = workload.FactorValue,
Sort = workload.Sort, Sort = workload.Sort,
Value = ConvertHelper.To<decimal>(dict[key]) Value = ConvertHelper.To<decimal>(dict[key]),
WorkTypeId = workload.WorkTypeId
}); });
} }
} }
......
...@@ -1471,7 +1471,13 @@ public List<ag_secondallot> AuditList(int allotId) ...@@ -1471,7 +1471,13 @@ public List<ag_secondallot> AuditList(int allotId)
if (allot == null) if (allot == null)
throw new PerformanceException("所选绩效不存在!"); throw new PerformanceException("所选绩效不存在!");
var accountUnit = resaccountRepository.GetEntities(t => t.AllotID == allotId && !new int[] { (int)UnitType.行政高层, (int)UnitType.行政中层 }.Contains(t.UnitType.Value)); var types = new List<int> { (int)UnitType.行政高层, (int)UnitType.行政中层, (int)UnitType.行政后勤 };
var accountUnit = resaccountRepository.GetEntities(t => t.AllotID == allot.ID && !types.Contains(t.UnitType.Value));
// 查询需要进行二次分配的行政后勤科室
var xzAccountUnit = resaccountRepository.GetEntities(t => t.AllotID == allot.ID && t.UnitType.Value == (int)UnitType.行政后勤 && t.NeedSecondAllot == "是");
if (xzAccountUnit != null && xzAccountUnit.Count > 0)
(accountUnit ?? new List<res_account>()).AddRange(xzAccountUnit);
var specialunit = resspecialunitRepository.GetEntities(t => t.AllotID == allot.ID); var specialunit = resspecialunitRepository.GetEntities(t => t.AllotID == allot.ID);
return SecondList(allot, accountUnit, specialunit); return SecondList(allot, accountUnit, specialunit);
...@@ -1656,7 +1662,10 @@ public bool ConfirmAudit(int userId, SecondAuditRequest request) ...@@ -1656,7 +1662,10 @@ public bool ConfirmAudit(int userId, SecondAuditRequest request)
return true; return true;
var computes = new List<ag_compute>(); var computes = new List<ag_compute>();
if (second.SubmitType == 1)
var (tempId, name) = GetUsingTempId(hospital.ID, second);
if (new int[] { (int)Temp.crosswise, (int)Temp.lengthways }.Contains(tempId))
{ {
var items = agfixatitemRepository.GetEntities(t => t.SecondId == request.SecondId); var items = agfixatitemRepository.GetEntities(t => t.SecondId == request.SecondId);
if (items != null && items.Any()) if (items != null && items.Any())
...@@ -1686,7 +1695,7 @@ public bool ConfirmAudit(int userId, SecondAuditRequest request) ...@@ -1686,7 +1695,7 @@ public bool ConfirmAudit(int userId, SecondAuditRequest request)
} }
} }
} }
else if (second.SubmitType == 2) else if (tempId == (int)Temp.other)
{ {
var others = agothersourceRepository.GetEntities(t => t.SecondId == request.SecondId); var others = agothersourceRepository.GetEntities(t => t.SecondId == request.SecondId);
if (others != null && others.Any()) if (others != null && others.Any())
...@@ -1710,6 +1719,30 @@ public bool ConfirmAudit(int userId, SecondAuditRequest request) ...@@ -1710,6 +1719,30 @@ public bool ConfirmAudit(int userId, SecondAuditRequest request)
} }
} }
} }
else
{
var bodys = agbodysourceRepository.GetEntities(t => t.SecondId == request.SecondId);
if (bodys != null && bodys.Any())
{
foreach (var item in bodys)
{
computes.Add(new ag_compute
{
AllotId = second.AllotId,
SecondId = second.Id,
UnitType = second.UnitType,
Department = second.Department,
WorkPost = item.Post,
JobNumber = item.WorkNumber,
PersonName = item.Name,
PerforSumFee = item.DistPerformance,
OthePerfor = item.OtherPerformance,
NightWorkPerfor = item.NightWorkPerformance,
RealGiveFee = item.RealAmount,
});
}
}
}
agcomputeRepository.AddRange(computes.ToArray()); agcomputeRepository.AddRange(computes.ToArray());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment