Commit 02f608ea by lcx

Merge branch 'v2020morge-reportdate' into v2020morge-ratelimit

# Conflicts:
#	performance/Performance.Api/Startup.cs
parents 86095285 093c48d7
......@@ -92,13 +92,13 @@ public ApiResponse<JwtToken> Refresh()
var userClaim = _claim.GetUserClaim();
var claims = new Claim[]
{
new Claim(JwtClaimTypes.Id, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.Id).Value),
new Claim(JwtClaimTypes.Login, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.Login).Value),
new Claim(JwtClaimTypes.RealName, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.RealName).Value),
new Claim(JwtClaimTypes.Mail, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.Mail).Value),
new Claim(JwtClaimTypes.AppName, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.AppName).Value),
new Claim(JwtClaimTypes.Device, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.Device).Value),
new Claim(JwtClaimTypes.Department, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.Department).Value),
new Claim(JwtClaimTypes.Id, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.Id)?.Value??""),
new Claim(JwtClaimTypes.Login, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.Login)?.Value??""),
new Claim(JwtClaimTypes.RealName, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.RealName)?.Value??""),
new Claim(JwtClaimTypes.Mail, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.Mail)?.Value??""),
new Claim(JwtClaimTypes.AppName, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.AppName)?.Value??""),
new Claim(JwtClaimTypes.Device, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.Device)?.Value??""),
new Claim(JwtClaimTypes.Department, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.Department)?.Value??""),
};
var jwtToken = JwtTokenHelper.GenerateToken(claims, _options.ExpirationMinutes);
......@@ -271,9 +271,9 @@ public ApiResponse<JwtToken> DemoUsers(int userId)
new Claim(JwtClaimTypes.Id, user.UserID.ToString()),
new Claim(JwtClaimTypes.Login, user.Login),
new Claim(JwtClaimTypes.RealName, user.RealName),
new Claim(JwtClaimTypes.Mail, user.Mail),
new Claim(JwtClaimTypes.AppName, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.AppName).Value),
new Claim(JwtClaimTypes.Device,userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.Device).Value),
new Claim(JwtClaimTypes.Mail, user.Mail??""),
new Claim(JwtClaimTypes.AppName, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.AppName)?.Value??""),
new Claim(JwtClaimTypes.Device,userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.Device)?.Value??""),
new Claim(JwtClaimTypes.Department, user.Department ?? ""),
};
......
......@@ -290,7 +290,7 @@ public ApiResponse AllComputeByPM([FromBody] ComputerRequest request)
throw new PerformanceException("当前绩效记录不存在");
var isShowManage = _computeService.IsShowManage(request.AllotId);
var list = _computeService.AllCompute(request.AllotId, allot.HospitalId, isShowManage);
var list = _computeService.AllCompute(request.AllotId, allot.HospitalId, isShowManage, true);
if (list == null || !list.Any())
return new ApiResponse(ResponseType.OK, "ok", list);
......
......@@ -142,29 +142,29 @@ public ApiResponse InpatFeeAvg([CustomizeValidator(RuleSet = "Query"), FromBody]
return new ApiResponse(ResponseType.OK, "", list);
}
/// <summary>
/// 科室药占比
/// </summary>
/// <returns></returns>
[Route("medicine")]
[HttpPost]
public ApiResponse Medicine([CustomizeValidator(RuleSet = "Query"), FromBody] ReportRequest request)
{
var list = reportService.Medicine(request.HospitalId, request.IsIndex);
return new ApiResponse(ResponseType.OK, "", list);
}
///// <summary>
///// 科室药占比
///// </summary>
///// <returns></returns>
//[Route("medicine")]
//[HttpPost]
//public ApiResponse Medicine([CustomizeValidator(RuleSet = "Query"), FromBody] ReportRequest request)
//{
// var list = reportService.Medicine(request.HospitalId, request.IsIndex);
// return new ApiResponse(ResponseType.OK, "", list);
//}
/// <summary>
/// 科室有效收入占比
/// </summary>
/// <returns></returns>
[Route("income")]
[HttpPost]
public ApiResponse Income([CustomizeValidator(RuleSet = "Query"), FromBody] ReportRequest request)
{
var list = reportService.Income(request.HospitalId, request.IsIndex);
return new ApiResponse(ResponseType.OK, "", list);
}
///// <summary>
///// 科室有效收入占比
///// </summary>
///// <returns></returns>
//[Route("income")]
//[HttpPost]
//public ApiResponse Income([CustomizeValidator(RuleSet = "Query"), FromBody] ReportRequest request)
//{
// var list = reportService.Income(request.HospitalId, request.IsIndex);
// return new ApiResponse(ResponseType.OK, "", list);
//}
/// <summary>
/// 月群体人均绩效
......
using FluentScheduler;
using Microsoft.Extensions.DependencyInjection;
using Performance.Services;
using Performance.Services.ExtractExcelService;
namespace Performance.Api
{
public class ExtractDataJob : IJob
{
private readonly ExtractJobService extractJobService;
public ExtractDataJob()
{
this.extractJobService = ServiceLocator.Instance.GetService<ExtractJobService>();
}
public void Execute()
{
extractJobService.Execute();
}
}
}
using FluentScheduler;
namespace Performance.Api
{
public class JobRegistry : Registry
{
public JobRegistry()
{
Schedule<ExtractDataJob>().ToRunNow().AndEvery(1).Days().At(23, 0);
//Schedule<ExtractDataJob>().ToRunEvery(1).Days().At(23, 0);
}
}
}
......@@ -40,6 +40,7 @@
<PackageReference Include="AutoMapper" Version="8.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.0.0" />
<PackageReference Include="CSRedisCore" Version="3.0.45" />
<PackageReference Include="FluentScheduler" Version="5.5.1" />
<PackageReference Include="FluentValidation.AspNetCore" Version="8.1.3" />
<PackageReference Include="GraphQL" Version="2.4.0" />
<PackageReference Include="Hangfire" Version="1.6.22" />
......
......@@ -1142,18 +1142,6 @@
</summary>
<returns></returns>
</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)">
<summary>
月群体人均绩效
......
......@@ -1175,7 +1175,7 @@
</member>
<member name="P:Performance.EntityModels.ag_secondallot.SubmitType">
<summary>
提交类型 1使用模板 2 其他类型数据
提交类型 1 使用模板 2 其他类型数据
</summary>
</member>
<member name="P:Performance.EntityModels.ag_secondallot.SubmitTime">
......@@ -1423,6 +1423,11 @@
</summary>
</member>
<member name="P:Performance.EntityModels.ag_workload_source.WorkTypeId">
<summary>
1、单项奖励 2、工作量占比 ..(自定义占比)
</summary>
</member>
<member name="T:Performance.EntityModels.ag_workload_type">
<summary>
......@@ -6833,36 +6838,11 @@
医院状态 1 启用 2 禁用
</summary>
</member>
<member name="P:Performance.EntityModels.sys_hospital.IsOpenWorkYear">
<summary>
是否开启年资系数 1 启用 2 禁用
</summary>
</member>
<member name="P:Performance.EntityModels.sys_hospital.IsOpenDrugprop">
<summary>
是否开启药占比系数 1 启用 2 禁用
</summary>
</member>
<member name="P:Performance.EntityModels.sys_hospital.IsOpenIncome">
<summary>
是否开启ICU有效收入系数 1 启用 2 禁用
</summary>
</member>
<member name="P:Performance.EntityModels.sys_hospital.IsOpenDirector">
<summary>
是否开启规模/效率绩效 1 启用 2 禁用
</summary>
</member>
<member name="P:Performance.EntityModels.sys_hospital.IsShowManage">
<summary>
是否显示绩效合计 1 显示绩效合计 2 显示管理绩效
</summary>
</member>
<member name="P:Performance.EntityModels.sys_hospital.IsOpenCMIPercent">
<summary>
是否开启科室CMI占比 1 启用 2 禁用
</summary>
</member>
<member name="P:Performance.EntityModels.sys_hospital.IsOpenNursingDeptAudit">
<summary>
是否开启护理部审核 1 启用 2 禁用
......@@ -6873,9 +6853,9 @@
是否显示二次绩效科主任1 启用 2 禁用
</summary>
</member>
<member name="P:Performance.EntityModels.sys_hospital.IsOpenLogisticsSecondAllot">
<member name="P:Performance.EntityModels.sys_hospital.IsOpenTimedTasks">
<summary>
是否开启行政后勤二次绩效分配 1 启用 2 禁用
是否开启定时抽取任务 1 是 2 否
</summary>
</member>
<member name="P:Performance.EntityModels.sys_hospital.IsSingleProject">
......
......@@ -8,7 +8,7 @@ namespace Performance.DtoModels
public class WorkDetailRequest
{
public int AllotId { get; set; }
public int SecondId { get; set; }
//public int SecondId { get; set; }
public string Source { get; set; }
public string AccountingUnit { get; set; }
}
......@@ -20,7 +20,7 @@ public WorkDetailRequestValidator()
RuleSet("Select", () =>
{
RuleFor(x => x.AllotId).NotNull().NotEmpty().GreaterThan(0);
RuleFor(x => x.SecondId).NotNull().NotEmpty().GreaterThan(0);
//RuleFor(x => x.SecondId).NotNull().NotEmpty().GreaterThan(0);
RuleFor(x => x.AccountingUnit).NotNull().NotEmpty();
});
}
......
......@@ -82,7 +82,7 @@ public class ag_secondallot
public Nullable<int> Status { get; set; }
/// <summary>
/// 提交类型 1使用模板 2 其他类型数据
/// 提交类型 1 使用模板 2 其他类型数据
/// </summary>
public Nullable<int> SubmitType { get; set; }
......
......@@ -55,5 +55,10 @@ public class ag_workload_source
///
/// </summary>
public Nullable<decimal> Value { get; set; }
/// <summary>
/// 1、单项奖励 2、工作量占比 ..(自定义占比)
/// </summary>
public Nullable<int> WorkTypeId { get; set; }
}
}
......@@ -61,35 +61,35 @@ public class sys_hospital
/// </summary>
public Nullable<int> States { get; set; }
/// <summary>
/// 是否开启年资系数 1 启用 2 禁用
/// </summary>
public Nullable<int> IsOpenWorkYear { get; set; }
///// <summary>
///// 是否开启年资系数 1 启用 2 禁用
///// </summary>
//public Nullable<int> IsOpenWorkYear { get; set; }
/// <summary>
/// 是否开启药占比系数 1 启用 2 禁用
/// </summary>
public Nullable<int> IsOpenDrugprop { get; set; }
///// <summary>
///// 是否开启药占比系数 1 启用 2 禁用
///// </summary>
//public Nullable<int> IsOpenDrugprop { get; set; }
/// <summary>
/// 是否开启ICU有效收入系数 1 启用 2 禁用
/// </summary>
public Nullable<int> IsOpenIncome { get; set; }
///// <summary>
///// 是否开启ICU有效收入系数 1 启用 2 禁用
///// </summary>
//public Nullable<int> IsOpenIncome { get; set; }
/// <summary>
/// 是否开启规模/效率绩效 1 启用 2 禁用
/// </summary>
public Nullable<int> IsOpenDirector { get; set; }
///// <summary>
///// 是否开启规模/效率绩效 1 启用 2 禁用
///// </summary>
//public Nullable<int> IsOpenDirector { get; set; }
/// <summary>
/// 是否显示绩效合计 1 显示绩效合计 2 显示管理绩效
/// </summary>
public Nullable<int> IsShowManage { get; set; }
/// <summary>
/// 是否开启科室CMI占比 1 启用 2 禁用
/// </summary>
public Nullable<int> IsOpenCMIPercent { get; set; }
///// <summary>
///// 是否开启科室CMI占比 1 启用 2 禁用
///// </summary>
//public Nullable<int> IsOpenCMIPercent { get; set; }
/// <summary>
/// 是否开启护理部审核 1 启用 2 禁用
......@@ -101,10 +101,15 @@ public class sys_hospital
/// </summary>
public Nullable<int> IsShowSecondDirector { get; set; }
///// <summary>
///// 是否开启行政后勤二次绩效分配 1 启用 2 禁用
///// </summary>
//public Nullable<int> IsOpenLogisticsSecondAllot { get; set; }
/// <summary>
/// 是否开启行政后勤二次绩效分配 1 启用 2 禁用
/// 是否开启定时抽取任务 1 是 2 否
/// </summary>
public Nullable<int> IsOpenLogisticsSecondAllot { get; set; }
public Nullable<int> IsOpenTimedTasks { get; set; }
/// <summary>
/// 抽取项目是否在同一环境 1 是 2 否
......
......@@ -118,6 +118,16 @@ public bool UpdateByState(TEntity entity)
return context.SaveChanges() > 0;
}
public bool UpdateRangeByState(IEnumerable<TEntity> entities)
{
foreach (var entity in entities)
{
var entry = context.Entry(entity);
entry.State = EntityState.Modified;
}
return context.SaveChanges() > 0;
}
public bool Update(TEntity entity, Action<TEntity> action)
{
action?.Invoke(entity);
......
......@@ -173,22 +173,25 @@ public void ImportWorkloadData(per_allot allot, object parameters)
/// 查询工作量数据
/// </summary>
/// <param name="allotid"></param>
public IEnumerable<report_original_workload> QueryWorkloadData(int allotid, string accountingunit, string unittype, int hospitalid)
public IEnumerable<report_original_workload> QueryWorkloadData(int allotid, string accountingunit, string[] unittypes, int hospitalid)
{
using (var connection = context.Database.GetDbConnection())
{
if (connection.State != ConnectionState.Open) connection.Open();
try
{
string unittype = unittypes.Any(t => !string.IsNullOrEmpty(t) && t.Contains("医生"))
? "医生组"
: unittypes.Any(t => !string.IsNullOrEmpty(t) && t.Contains("护理")) ? "护理组" : "其他组";
string clear = @"SELECT DISTINCT t3.AccountingUnit as Department,ifnull(t1.DoctorName, '未知') DoctorName,t1.PersonnelNumber,t1.Category,t1.Fee FROM ex_result t1
JOIN (select distinct AccountingUnit,HISDeptName,unittype from per_dept_dic where HospitalId = @hospitalid) t3 ON t1.Department = t3.HISDeptName
WHERE t1.allotid = @allotid
AND t3.unittype = @unittype
AND t3.unittype in @unittypes
AND t3.accountingunit = @accountingunit
AND t1.Source LIKE CONCAT('%',@unittype,'工作量%')
AND T1.IsDelete = 0
ORDER BY t1.doctorname,t1.Category;";
return connection.Query<report_original_workload>(clear, new { allotid, accountingunit, unittype, hospitalid }, commandTimeout: 60 * 60);
return connection.Query<report_original_workload>(clear, new { allotid, accountingunit, unittypes, unittype, hospitalid }, commandTimeout: 60 * 60);
}
catch (Exception ex)
{
......@@ -201,7 +204,7 @@ public IEnumerable<report_original_workload> QueryWorkloadData(int allotid, stri
/// 查询门诊收入数据
/// </summary>
/// <param name="allotid"></param>
public IEnumerable<ex_result> QueryIncomeData(int allotid, string source, string accountingunit, string unittype, int hospitalid)
public IEnumerable<ex_result> QueryIncomeData(int allotid, string source, string accountingunit, string[] unittype, int hospitalid)
{
using (var connection = context.Database.GetDbConnection())
{
......@@ -211,9 +214,9 @@ public IEnumerable<ex_result> QueryIncomeData(int allotid, string source, string
string clear = $@"SELECT DISTINCT t3.AccountingUnit as Department,ifnull(t1.DoctorName, '未知') DoctorName,t1.PersonnelNumber,t1.Category,t1.Fee FROM ex_result t1
JOIN (select distinct AccountingUnit,HISDeptName,unittype from per_dept_dic where HospitalId = @hospitalid) t3 ON t1.Department = t3.HISDeptName
WHERE t1.allotid = @allotid
AND t3.unittype = @unittype
AND t3.unittype in @unittype
AND t3.accountingunit = @accountingunit
AND t1.Source like '%{source}开单%'
AND (t1.Source like '%{source}开单%' OR t1.Source like '%{source}就诊%')
AND T1.IsDelete = 0
ORDER BY t1.doctorname,t1.Category;";
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)
return DapperQuery(sql, new { date, hospitalId }).ToList();
}
/// <summary>
/// 科室药占比
/// </summary>
/// <returns></returns>
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
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
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;";
return DapperQuery(sql, new { hospitalId, date }).ToList();
}
// /// <summary>
// /// 科室药占比
// /// </summary>
// /// <returns></returns>
// 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
// 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
// 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;";
// return DapperQuery(sql, new { hospitalId, date }).ToList();
// }
/// <summary>
/// 科室有效收入占比
/// </summary>
/// <returns></returns>
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
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 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;";
return DapperQuery(sql, new { hospitalId, date }).ToList();
}
// /// <summary>
// /// 科室有效收入占比
// /// </summary>
// /// <returns></returns>
// 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
// 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 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;";
// return DapperQuery(sql, new { hospitalId, date }).ToList();
// }
#region 首页报表
/// <summary>
......
......@@ -268,7 +268,7 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, per_allot
var economicData = perSheet.FirstOrDefault(t => t.SheetType == SheetType.ComputeEconomic)?.PerData?.Select(t => (PerData)t);
var doctorWorkloadData = perSheet.FirstOrDefault(t => t.SheetType == SheetType.ComputeDoctorWorkload)?.PerData?.Select(t => (PerData)t);
var nurseWorkloadData = perSheet.FirstOrDefault(t => t.SheetType == SheetType.ComputeNurseWorkload)?.PerData?.Select(t => (PerData)t);
var accountExtraData = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.AccountExtra)?.PerData?.Select(t => (PerData)t);
var adjustLaterOtherFee = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.AccountAdjustLaterOtherFee)?.PerData?.Select(t => (PerData)t);
var pairs = new[]
{
......@@ -303,7 +303,7 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, per_allot
if (UnitType.医技组 == unitType && workDoctor == null)
workDoctor = info.Data.FirstOrDefault(t => t.UnitType == UnitType.医生组.ToString() && t.AccountingUnit == dept.AccountingUnit);
// 夜班绩效 从医院奖罚的明细项中获取
var nightShift = accountExtraData?.FirstOrDefault(w => w.UnitType == dept.UnitType && w.AccountingUnit == dept.AccountingUnit && w.TypeName?.Trim() == "夜班绩效")?.CellValue ?? 0;
var nightShift = adjustLaterOtherFee?.FirstOrDefault(w => w.UnitType == dept.UnitType && w.AccountingUnit == dept.AccountingUnit && w.TypeName?.Trim() == "夜班绩效")?.CellValue ?? 0;
dept.NightShiftWorkPerforFee = nightShift;
//dept.MedicineFactor = workDoctor?.MedicineFactor;
......@@ -349,7 +349,7 @@ public void ComputeOffice(per_allot allot, PerExcel excel)
{
//取出科室
var accountList = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.AccountBasic)?.PerData?.Select(t => (PerDataAccountBaisc)t);
var accountExtraData = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.AccountExtra)?.PerData?.Select(t => (PerData)t);
var adjustLaterOtherFee = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.AccountAdjustLaterOtherFee)?.PerData?.Select(t => (PerData)t);
List<string> involves = new List<string>
{
......@@ -385,9 +385,9 @@ public void ComputeOffice(per_allot allot, PerExcel excel)
if (UnitTypeUtil.IsOffice(resAccount?.UnitType) && dept.NeedSecondAllot == "是")
{
// 夜班绩效 从医院奖罚的明细项中获取
var nightShift = accountExtraData?.FirstOrDefault(w => w.UnitType == resAccount?.UnitType && w.AccountingUnit == dept.AccountingUnit && w.TypeName?.Trim() == "夜班绩效")?.CellValue ?? 0;
var nightShift = adjustLaterOtherFee?.FirstOrDefault(w => w.UnitType == resAccount?.UnitType && w.AccountingUnit == dept.AccountingUnit && w.TypeName?.Trim() == "夜班绩效")?.CellValue ?? 0;
dept.NightShiftWorkPerforFee = 0;
dept.NightShiftWorkPerforFee = nightShift;
dept.ScoringAverage = resAccount?.ScoringAverage == null ? 0 : resAccount.ScoringAverage;
dept.AdjustFactor = (isBudget ? adjust : resAccount?.AdjustFactor) ?? 1;
dept.Extra = resAccount?.Extra ?? 0;
......@@ -645,10 +645,11 @@ public IEnumerable<AccountUnitTotal> GetAccountScoreAverage(PerExcel excel, Shee
/// 获取药占比分割比例
/// </summary>
/// <param name="excel"></param>
/// <param name="sheetType"></param>
/// <returns></returns>
private IEnumerable<CofDrugProp> GetFactors(PerExcel excel, SheetType sheetType)
{
var perDatas = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.WorkloadMedicineProp)?.PerData.Select(w => (PerData)w);
var perDatas = excel.PerSheet.FirstOrDefault(t => t.SheetType == sheetType)?.PerData.Select(w => (PerData)w);
var factors = perDatas
?.Where(w => w.IsTotal == 1)
.Select(w => new CofDrugProp
......
......@@ -140,7 +140,7 @@ public void SpecialUnitCompute(PerExcel excel, per_allot allot, List<res_baiscno
//取出科室
var accountList = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.AccountBasic)?.PerData?.Select(t => (PerDataAccountBaisc)t);
var accountExtraData = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.AccountExtra)?.PerData?.Select(t => (PerData)t);
var adjustLaterOtherFee = excel.PerSheet.FirstOrDefault(t => t.SheetType == SheetType.AccountAdjustLaterOtherFee)?.PerData?.Select(t => (PerData)t);
List<res_specialunit> resDataList = new List<res_specialunit>();
......@@ -179,7 +179,7 @@ public void SpecialUnitCompute(PerExcel excel, per_allot allot, List<res_baiscno
//var scoreAverage = accountScoreAverages?.FirstOrDefault(w => w.UnitType == UnitType.特殊核算组.ToString() && w.AccountingUnit == dept?.AccountingUnit)?.TotelValue;
// 夜班绩效 从医院奖罚的明细项中获取
var nightShift = accountExtraData?.FirstOrDefault(w => w.UnitType == dept.UnitType && w.AccountingUnit == dept.AccountingUnit && w.TypeName?.Trim() == "夜班绩效")?.CellValue ?? 0;
var nightShift = adjustLaterOtherFee?.FirstOrDefault(w => w.UnitType == dept.UnitType && w.AccountingUnit == dept.AccountingUnit && w.TypeName?.Trim() == "夜班绩效")?.CellValue ?? 0;
decimal? headcount = null;
if (typeList.Any(o => o.Description == item.QuantitativeIndicators))
......@@ -262,6 +262,7 @@ public void SpecialUnitCompute(PerExcel excel, per_allot allot, List<res_baiscno
//OtherPerfor = empolyee.OtherPerfor,
OtherManagePerfor = empolyee?.OtherManagePerfor ?? 0,
Number = resAccount.Number,
PermanentStaff = empolyee.PermanentStaff,
PerforTotal = resAccount.PerforTotal,
Adjust = empolyeeAdjust ?? 1m,
Grant = isBudget ? grant : empolyee.Management,
......@@ -522,6 +523,7 @@ public void GenerateSecondAllot(per_allot allot)
List<ag_secondallot> tempSecond = new List<ag_secondallot>();
List<ag_secondallot> insSecond = 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.行政后勤 };
//// 获取医院是否开启后勤二次分配
......@@ -608,15 +610,42 @@ public void GenerateSecondAllot(per_allot allot)
second.NursingDeptRemark = "科室绩效结果发生变更,需要重新提交";
}
second.RealGiveFee = item.RealGiveFee;
second.NightShiftWorkPerforFee = item.NightShiftWorkPerforFee;
updSecond.Add(second);
}
}
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())
perforAgsecondallotRepository.AddRange(insSecond.ToArray());
if (updSecond.Any())
{
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 @@
using System.Text.RegularExpressions;
using Performance.DtoModels.Request;
using Performance.DtoModels.Response;
using Performance.Services.ExtractExcelService;
namespace Performance.Services
{
......@@ -717,7 +718,7 @@ public DeptDetailResponse GetDepartmentDetail(int allotId, int accountId, int ty
/// <param name="hospitalId"></param>
/// <param name="isShowManage"> 仅显示管理绩效 isShowManage == 1 </param>
/// <returns></returns>
public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowManage)
public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowManage, bool isEmpDic = false)
{
// 获取一次次绩效结果
var list = GetAllotPerformance(allotId, hospitalId, isShowManage);
......@@ -761,11 +762,14 @@ public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowM
item.ReservedRatioFee = Math.Round(real * (item.ReservedRatio ?? 0), 2, MidpointRounding.AwayFromZero);
item.RealGiveFee = Math.Round(item.ShouldGiveFee - (item.ReservedRatioFee ?? 0) ?? 0, 2, MidpointRounding.AwayFromZero);
// 人员信息使用人员字典中数据
if (isEmpDic)
{
item.AccountingUnit = empDic?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.AccountingUnit ?? "";
item.UnitType = empDic?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.UnitType ?? "";
item.EmployeeName = empDic?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.DoctorName ?? "";
}
}
}
return result?.OrderByDescending(t => t.AccountingUnit).ToList();
}
......@@ -1043,6 +1047,20 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId)
var headers = _perforImheaderRepository.GetEntities(t => t.AllotID == account.AllotID);
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
{
ShowFormula = allot.ShowFormula,
......@@ -1050,7 +1068,7 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId)
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>
{
......@@ -1118,7 +1136,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.MedicineExtra = deptDetails.Detail?.FirstOrDefault(w => w.OriginalType == (int)SheetType.AccountDrugAssess)?.Amount ?? deptDetails.Pandect.MedicineExtra;
return MergeDetails(deptDetails);
return MergeDetails(deptDetails, key);
//return deptDetails;
}
......@@ -1243,7 +1261,7 @@ private List<DetailModule> CommonDetailItems(List<im_data> basicData, List<im_he
return items;
}
private DeptDataDetails<DetailModuleExtend> MergeDetails(DeptDataDetails details)
private DeptDataDetails<DetailModuleExtend> MergeDetails(DeptDataDetails details, string key)
{
if (details == null) return new DeptDataDetails<DetailModuleExtend>();
......@@ -1267,7 +1285,7 @@ private DeptDataDetails<DetailModuleExtend> MergeDetails(DeptDataDetails details
{
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);
foreach (var dept in depts.Distinct().OrderBy(t => t))
{
......@@ -1316,7 +1334,7 @@ private DeptDataDetails<DetailModuleExtend> MergeDetails(DeptDataDetails details
result.Detail.Add(new DetailDtos<DetailModuleExtend>
{
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,
OriginalType = data.First()?.OriginalType ?? 0,
Amount = data.Sum(w => w.Amount),
......
......@@ -324,7 +324,7 @@ public class ConfigService : IAutoInjection
/// <returns></returns>
public List<cof_drugtype> GetDrugtypeList(int HospitalId, int allotId)
{
var list = _drugtypeRepository.GetEntities(t => t.AllotID == allotId && t.HospitalId==HospitalId);
var list = _drugtypeRepository.GetEntities(t => t.AllotID == allotId && t.HospitalId == HospitalId);
return list;
}
......@@ -705,9 +705,9 @@ public void Copy(per_allot allot)
logger.LogInformation($"workItem");
var workItem = _workitemRepository.GetEntities(t => t.AllotID == allot.ID);
if (hospital != null && hospital?.IsOpenDrugprop == 1 && (workItem == null || workItem.Count == 0))
if (workItem == null || workItem.Count == 0)
{
workItem = _workitemRepository.GetEntities(t => t.AllotID == allotId);
workItem = _workitemRepository.GetEntities(t => t.AllotID == allotId) ?? _workitemRepository.GetEntities(t => t.AllotID == -1);
if (workItem != null && workItem.Count > 0)
{
var newWorkItem = workItem.Select(t => new cof_workitem { AllotID = allot.ID, Type = t.Type, Item = t.Item });
......@@ -720,7 +720,7 @@ public void Copy(per_allot allot)
if (cofDrugtype == null || cofDrugtype.Count == 0)
{
var drugtype = _drugtypeRepository.GetEntities(t => t.AllotID == allotId) ?? _drugtypeRepository.GetEntities(t => t.AllotID == -1);
var newAgains = drugtype.Select(t => new cof_drugtype {HospitalId=allot.HospitalId, AllotID = allot.ID, Charge = t.Charge, ChargeType = t.ChargeType });
var newAgains = drugtype.Select(t => new cof_drugtype { HospitalId = allot.HospitalId, AllotID = allot.ID, Charge = t.Charge, ChargeType = t.ChargeType });
_drugtypeRepository.AddRange(newAgains.ToArray());
}
......@@ -846,7 +846,7 @@ private void CopyAprData(int prevAllotId, int allotId)
#region HRP人员科室
public HandsonTable GetHrpDeptHands(int HospitalId,int AllotId)
public HandsonTable GetHrpDeptHands(int HospitalId, int AllotId)
{
var result = new HandsonTable((int)SheetType.Unidentifiable, HrpDept.Select(t => t.Value).ToArray(), HrpDept.Select(t => new collect_permission
{
......@@ -921,13 +921,13 @@ public HandsonTable GetSecondaryAlias()
if (column.Data == "状态")
{
column.Type = "autocomplete";
column.Source = new[] {"可用", "禁用"};
column.Source = new[] { "可用", "禁用" };
column.Strict = true;
}
}
}
var data = perforCofaliasRepository.GetEntities()?.OrderBy(t=>t.Route);
if (data==null) return result;
var data = perforCofaliasRepository.GetEntities()?.OrderBy(t => t.Route);
if (data == null) return result;
List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 0;
......@@ -935,13 +935,13 @@ public HandsonTable GetSecondaryAlias()
{
var json = JsonHelper.Serialize(item);
var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json);
firstDic["states"]=firstDic["states"] == "1" ? "可用" : "禁用";
firstDic["states"] = firstDic["states"] == "1" ? "可用" : "禁用";
var cells = (from conf in Alias join fst in firstDic on conf.Key.ToUpper() equals fst.Key.ToUpper() select new HandsonCellData(conf.Value, fst.Value)).ToList();
rowDatas.Add(new HandsonRowData(i,cells));
rowDatas.Add(new HandsonRowData(i, cells));
i++;
}
result.SetRowData(rowDatas,rowDatas!=null);
result.SetRowData(rowDatas, rowDatas != null);
return result;
}
......@@ -952,8 +952,8 @@ public void SaveSecondaryAlias(SaveCollectData request)
List<cof_alias> aliases = new List<cof_alias>();
foreach (var item in dicData)
{
var states = new[] {"可用", "禁用"};
if (item["States"]!=null && states.Contains(item["States"]))
var states = new[] { "可用", "禁用" };
if (item["States"] != null && states.Contains(item["States"]))
{
item["States"] = item["States"] == "可用" ? "1" : "0";
}
......@@ -961,13 +961,13 @@ public void SaveSecondaryAlias(SaveCollectData request)
var json = JsonHelper.Serialize(item);
var data = JsonHelper.Deserialize<cof_alias>(json);
if (!string.IsNullOrEmpty(data.Name) && !string.IsNullOrEmpty(data.OriginalName)&& !string.IsNullOrEmpty(data.Route) && !string.IsNullOrEmpty(data.Alias))
if (!string.IsNullOrEmpty(data.Name) && !string.IsNullOrEmpty(data.OriginalName) && !string.IsNullOrEmpty(data.Route) && !string.IsNullOrEmpty(data.Alias))
{
aliases.Add(data);
}
}
perforCofaliasRepository.Execute("delete from cof_alias",null);
perforCofaliasRepository.Execute("delete from cof_alias", null);
perforCofaliasRepository.AddRange(aliases.ToArray());
}
......
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)
DefaultModules(hospitalId);
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;
}
......@@ -90,7 +91,7 @@ private void DefaultModules(int 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())
{
......@@ -102,7 +103,7 @@ private void DefaultModules(int hospitalId)
HospitalId = hospitalId,
ModuleName = item.ModuleName,
SheetType = (int)item.SheetType,
ReadOnly = 1,
ReadOnly = item.SheetType == (int)SheetType.Income ? 0 : 1,
TypeId = null,
};
modules.Add(module);
......@@ -120,8 +121,7 @@ public ex_module AddModule(ModModuleRequest request)
string addname = "";
if (request.SheetType == (int)SheetType.Income)
{
string[] array = new string[] { "开单收入", "执行收入" };
if (request.ModuleName.IndexOf("开单收入") == -1 && request.ModuleName.IndexOf("执行收入") == -1)
if (request.ModuleName.IndexOf("开单收入") == -1 && request.ModuleName.IndexOf("就诊收入") == -1 && request.ModuleName.IndexOf("执行收入") == -1)
throw new PerformanceException("模块名称规则错误");
//if (!Regex.IsMatch(request.ModuleName, @"^[\u4e00-\u9fa5]+$"))
// throw new PerformanceException("模块名称规则错误,请使用全中文命名");
......@@ -132,7 +132,7 @@ public ex_module AddModule(ModModuleRequest request)
throw new PerformanceException("绩效模板已存在!");
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));
if (exist != null && exist.Any())
{
......
......@@ -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());
if (sheet == null)
{
string[] keyArray = new string[] { "开单", "执行" };
string[] keyArray = new string[] { "开单", "就诊", "执行" };
if (keyArray.Any(key => module.ModuleName.Contains(key)))
{
var item = pairs.Where(t => t.Key.StartsWith("1.")).OrderByDescending(t => t.Key).First();
......
using Microsoft.Extensions.Logging;
using Performance.DtoModels;
using Performance.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Performance.Services.ExtractExcelService
{
public class ExtractJobService : IAutoInjection
{
private readonly ILogger logger;
private readonly AllotService allotService;
private readonly ConfigService configService;
private readonly DictionaryService dictionaryService;
private readonly QueryService queryService;
private readonly PerforUserRepository userRepository;
private readonly PerforHospitalRepository hospitalRepository;
private readonly PerforPerallotRepository perallotRepository;
public ExtractJobService(
ILogger<ExtractJobService> logger,
AllotService allotService,
ConfigService configService,
DictionaryService dictionaryService,
QueryService queryService,
PerforUserRepository userRepository,
PerforHospitalRepository hospitalRepository,
PerforPerallotRepository perallotRepository
)
{
this.logger = logger;
this.allotService = allotService;
this.configService = configService;
this.dictionaryService = dictionaryService;
this.queryService = queryService;
this.userRepository = userRepository;
this.hospitalRepository = hospitalRepository;
this.perallotRepository = perallotRepository;
}
public void Execute()
{
var hospitals = hospitalRepository.GetEntities(w => w.IsOpenTimedTasks == 1);
if (hospitals == null || !hospitals.Any()) return;
var userId = userRepository.GetEntity(t => t.Login.ToLower() == "admin" && t.States == 1 && t.IsDelete == 1)?.ID ?? 1;
var date = DateTime.Now;
var allots = perallotRepository.GetEntities(t => hospitals.Select(w => w.ID).Contains(t.HospitalId) && t.Year == date.Year && t.Month == date.Month);
foreach (var hospital in hospitals)
{
try
{
var allot = allots?.FirstOrDefault(t => t.HospitalId == hospital.ID);
if (allot == null)
{
allot = allotService.InsertAllot(new AllotRequest
{
HospitalId = hospital.ID,
Year = date.Year,
Month = date.Month
}, userId);
configService.Copy(allot);
}
if (allot == null || allot.ID == 0) continue;
var dict = new Dictionary<ExDataDict, object>();
var isSingle = hospital.IsSingleProject == 1;
dictionaryService.Handler(hospital.ID, allot, "", isSingle);
var data = queryService.Handler(hospital.ID, allot, "", isSingle, ref dict);
}
catch (Exception ex)
{
logger.LogError(ex.ToString());
}
}
}
}
}
......@@ -139,7 +139,7 @@ private void WriteDataToFile(IWorkbook workbook, per_allot allot, Dictionary<ExD
logger.LogInformation($"allotId: {allot.ID}: 总金额 - {extractDto?.Sum(s => s.Value ?? 0)}");
WriteDataFactory factory = new WriteDataFactory();
var types = new List<SheetType> { SheetType.OtherIncome, SheetType.Income, SheetType.Expend, SheetType.Workload, SheetType.OtherWorkload, SheetType.AccountBasic };
var types = new List<SheetType> { SheetType.OtherIncome, SheetType.Income, SheetType.Expend, SheetType.Workload, SheetType.OtherWorkload/*, SheetType.AccountBasic*/ };
decimal ratio = 60m;
for (int sheetIndex = 0; sheetIndex < workbook.NumberOfSheets; sheetIndex++)
{
......@@ -209,14 +209,12 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re
var dict = personService.GetDepartments(hospitalId)?.ToList();
if (dict == null || !dict.Any())
return results.Select(t => new ExtractTransDto
return results.GroupBy(t => new { t.Department, t.Category, t.Source }).Select(t => new ExtractTransDto
{
SheetName = t.Source,
DoctorName = t.DoctorName,
PersonnelNumber = t.PersonnelNumber,
Department = t.Department,
Category = t.Category,
Value = t.Fee ?? 0
SheetName = t.Key.Source,
Department = t.Key.Department,
Category = t.Key.Category,
Value = t.Sum(group => group.Fee) == 0 ? null : t.Sum(group => group.Fee),
}).ToList();
dict.ForEach(t =>
......
......@@ -131,9 +131,9 @@ public HospitalResponse Update(HospitalRequest request)
hospital.States = request.States;
//hospital.IsOpenWorkYear = request.IsOpenWorkYear;
//hospital.IsOpenDirector = request.IsOpenDirector;
hospital.IsOpenDrugprop = request.IsOpenDrugprop;
//hospital.IsOpenDrugprop = request.IsOpenDrugprop;
hospital.IsShowManage = request.IsShowManage;
hospital.IsOpenCMIPercent = request.IsOpenCMIPercent;
//hospital.IsOpenCMIPercent = request.IsOpenCMIPercent;
//hospital.IsOpenLogisticsSecondAllot = request.IsOpenLogisticsSecondAllot;
//hospital.IsOpenIncome = request.IsOpenIncome;
......
......@@ -71,7 +71,7 @@ public static string GetValue(this ICell cell)
case CellType.Numeric:
return cell?.NumericCellValue.ToString();
case CellType.String:
return cell?.StringCellValue.ToString();
return cell?.StringCellValue?.ToString() ?? "";
case CellType.Formula:
cell?.SetCellType(CellType.String);
return cell?.StringCellValue?.ToString();
......
......@@ -39,14 +39,15 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
var unit = Point.AccountingUnit.First();
//查询除了 核算单元 科室名称 有效数据列头位置
var vhead = perHeader.Where(t => t.PointCell != unit.UnitTypeNum && t.PointCell != unit.AccountingUnitCellNum && t.PointCell != unit.DeptCellNum).OrderBy(t => t.PointCell);
var vhead = perHeader.Where(t => t.PointCell != unit.UnitTypeNum && t.PointCell != unit.AccountingUnitCellNum && t.PointCell != unit.JobCellNum && t.PointCell != unit.EmpNameCellNum).OrderBy(t => t.PointCell);
//var vhead = perHeader.OrderBy(t => t.PointCell);
for (int r = Point.DataFirstRowNum.Value; r < sheet.LastRowNum + 1; r++)
{
var row = sheet.GetRow(r);
if (row == null) continue;
for (int c = Point.DataFirstCellNum.Value; c < vhead.Count(); c++)
for (int c = 0; c < vhead.Count(); c++)
{
var athead = vhead.ElementAt(c);
//var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell));
......
......@@ -509,15 +509,14 @@ public List<TitleValue> DeptDics(int hospitalId, int type)
/// <returns></returns>
public object DeptWorkloadDetail(WorkDetailRequest request, int userId)
{
var second = agsecondallotRepository.GetEntity(w => w.Id == request.SecondId);
if (second == null)
return null;
string[] unitTypes = GetUnitType(userId);
if (unitTypes == null || !unitTypes.Any()) return new string[] { };
var allot = perallotRepository.GetEntity(w => w.ID == request.AllotId);
if (allot == null)
return null;
var data = perallotRepository.QueryWorkloadData(request.AllotId, request.AccountingUnit, second.UnitType, allot.HospitalId);
var data = perallotRepository.QueryWorkloadData(request.AllotId, request.AccountingUnit, unitTypes, allot.HospitalId);
if (data != null && data.Any())
{
return data.GroupBy(t => new { t.Department, t.DoctorName, t.PersonnelNumber, t.Category })
......@@ -541,9 +540,8 @@ public object DeptWorkloadDetail(WorkDetailRequest request, int userId)
/// <returns></returns>
public object DeptIncomeDetail(WorkDetailRequest request, int userId)
{
var second = agsecondallotRepository.GetEntity(w => w.Id == request.SecondId);
if (second == null)
return null;
string[] unitTypes = GetUnitType(userId);
if (unitTypes == null || !unitTypes.Any()) return new string[] { };
var allot = perallotRepository.GetEntity(w => w.ID == request.AllotId);
if (allot == null)
......@@ -552,7 +550,7 @@ public object DeptIncomeDetail(WorkDetailRequest request, int userId)
if (!sources.Contains(request.Source))
throw new PerformanceException($"数据来源错误,只支持:{string.Join(";", sources)}");
var data = perallotRepository.QueryIncomeData(request.AllotId, request.Source, request.AccountingUnit, second.UnitType, allot.HospitalId);
var data = perallotRepository.QueryIncomeData(request.AllotId, request.Source, request.AccountingUnit, unitTypes, allot.HospitalId);
if (data != null && data.Any())
{
return data.GroupBy(t => new { t.Department, t.DoctorName, t.PersonnelNumber, t.Category })
......@@ -568,5 +566,27 @@ public object DeptIncomeDetail(WorkDetailRequest request, int userId)
return new string[] { };
}
private string[] GetUnitType(int userId)
{
Dictionary<int, string[]> dict = new Dictionary<int, string[]>
{
{ application.DirectorRole, new string []{ UnitType.医生组.ToString(), UnitType.其他医生组.ToString(), UnitType.其他医技组.ToString(), UnitType.医技组.ToString() } },
{ application.NurseRole, new string []{ UnitType.护理组.ToString(), UnitType.其他护理组.ToString() } },
{ application.SpecialRole, new string []{ UnitType.特殊核算组.ToString() } },
{ application.OfficeRole, new string []{ UnitType.行政后勤.ToString() } },
};
var user = perforUserRepository.GetEntity(t => t.ID == userId);
if (user == null)
throw new NotImplementedException("人员ID无效");
var userrole = perforUserroleRepository.GetEntity(t => t.UserID == userId);
var role = perforRoleRepository.GetEntity(t => t.ID == userrole.RoleID);
if (!role.Type.HasValue || !dict.ContainsKey(role.Type.Value))
return new string[] { };
return dict[role.Type.Value];
}
}
}
......@@ -182,53 +182,53 @@ public List<PerReport> InpatFeeAvg(int hospitalId)
return perforReportRepository.InpatFeeAvg(hospitalId, date);
}
/// <summary>
/// 科室药占比
/// </summary>
/// <returns></returns>
public List<PerReport> Medicine(int hospitalId, int isIndex)
{
var states = new List<int>() { 6, 8 };
var allotList = perforPerallotRepository.GetEntities(t => t.HospitalId == hospitalId && states.Contains(t.States));
if (allotList == null || !allotList.Any())
throw new PerformanceException("用户未创建绩效!");
var date = new List<string>();
if (isIndex == 1)
{
var allot = allotList.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).FirstOrDefault();
date.Add(allot.Year + "-" + allot.Month.ToString().PadLeft(2, '0'));
}
else
{
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);
}
/// <summary>
/// 科室有效收入占比
/// </summary>
/// <returns></returns>
public List<PerReport> Income(int hospitalId, int isIndex)
{
var states = new List<int>() { 6, 8 };
var allotList = perforPerallotRepository.GetEntities(t => t.HospitalId == hospitalId && states.Contains(t.States));
if (allotList == null || !allotList.Any())
throw new PerformanceException("用户未创建绩效!");
var date = new List<string>();
if (isIndex == 1)
{
var allot = allotList.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).FirstOrDefault();
date.Add(allot.Year + "-" + allot.Month.ToString().PadLeft(2, '0'));
}
else
{
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);
}
///// <summary>
///// 科室药占比
///// </summary>
///// <returns></returns>
//public List<PerReport> Medicine(int hospitalId, int isIndex)
//{
// var states = new List<int>() { 6, 8 };
// var allotList = perforPerallotRepository.GetEntities(t => t.HospitalId == hospitalId && states.Contains(t.States));
// if (allotList == null || !allotList.Any())
// throw new PerformanceException("用户未创建绩效!");
// var date = new List<string>();
// if (isIndex == 1)
// {
// var allot = allotList.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).FirstOrDefault();
// date.Add(allot.Year + "-" + allot.Month.ToString().PadLeft(2, '0'));
// }
// else
// {
// 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);
//}
///// <summary>
///// 科室有效收入占比
///// </summary>
///// <returns></returns>
//public List<PerReport> Income(int hospitalId, int isIndex)
//{
// var states = new List<int>() { 6, 8 };
// var allotList = perforPerallotRepository.GetEntities(t => t.HospitalId == hospitalId && states.Contains(t.States));
// if (allotList == null || !allotList.Any())
// throw new PerformanceException("用户未创建绩效!");
// var date = new List<string>();
// if (isIndex == 1)
// {
// var allot = allotList.OrderByDescending(t => t.Year).ThenByDescending(t => t.Month).FirstOrDefault();
// date.Add(allot.Year + "-" + allot.Month.ToString().PadLeft(2, '0'));
// }
// else
// {
// 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);
//}
/// <summary>
/// 只支持EXCEL抽取报表数据
......
......@@ -60,7 +60,7 @@ public List<RoleResponse> GetUsersRole(int userid)
List<RoleResponse> roleResponses = new List<RoleResponse>();
var user=_userRepository.GetEntity(c => c.ID == userid);
var ParentUser = _userRepository.GetEntities(c => c.ParentID == userid);
if (user.ParentID!=null || user.ParentID==0)
if (user.ParentID!=null && user.ParentID!=0)
{
ParentUser=_userRepository.GetEntities(c => c.ParentID == user.ParentID);
}
......
......@@ -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);
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>();
......@@ -743,7 +743,7 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
var types = new string[] { "行政后勤", "行政工勤" };
var logistics = _imemployeelogisticsRepository.GetEntities(w => w.AllotID == secondAllot.AllotId && types.Contains(w.AccountType) && w.AccountingUnit == secondAllot.Department);
result = (logistics ?? new List<im_employee_logistics>())
.OrderBy(t => Convert.ToInt32(t.PersonnelNumber)).Select(w => new ag_othersource
.OrderBy(t => ConvertHelper.To<Int64>(t.PersonnelNumber, 0)).Select(w => new ag_othersource
{
SecondId = secondId,
WorkNumber = w.PersonnelNumber,
......
......@@ -420,10 +420,14 @@ public dynamic GetWorkloadDict(int secondId)
private dynamic GetWorkloadDictAfterAudit(int 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));
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,
Value = t.Key.ItemName,
......@@ -553,7 +557,8 @@ private void SaveSecondAllotBodyData(int hospitalId, ag_secondallot second, dyna
ItemName = workload.ItemName,
FactorValue = workload.FactorValue,
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)
if (allot == null)
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);
return SecondList(allot, accountUnit, specialunit);
......@@ -1656,7 +1662,10 @@ public bool ConfirmAudit(int userId, SecondAuditRequest request)
return true;
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);
if (items != null && items.Any())
......@@ -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);
if (others != null && others.Any())
......@@ -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());
}
......@@ -1966,28 +1999,14 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em
public List<ag_othersource> OtherSave(int secondId, List<ag_othersource> request)
{
if (request == null || !request.Any()) return new List<ag_othersource>();
if (request.Any(t => t.Id != 0))
agothersourceRepository.UpdateRangeByState(request.Where(t => t.Id != 0));
var existEntities = agothersourceRepository.GetEntities(t => t.SecondId == secondId);
if (existEntities != null && existEntities.Any())
{
foreach (var item in request.Where(t => t.Id != 0))
{
existEntities.First(t => t.Id == item.Id).WorkNumber = item.WorkNumber;
existEntities.First(t => t.Id == item.Id).Name = item.Name;
existEntities.First(t => t.Id == item.Id).Department = item.Department;
existEntities.First(t => t.Id == item.Id).WorkPost = item.WorkPost;
existEntities.First(t => t.Id == item.Id).TitlePerformance = item.TitlePerformance;
existEntities.First(t => t.Id == item.Id).WorkPerformance = item.WorkPerformance;
existEntities.First(t => t.Id == item.Id).DeptReward = item.DeptReward;
existEntities.First(t => t.Id == item.Id).DistPerformance = item.DistPerformance;
existEntities.First(t => t.Id == item.Id).OtherPerformance = item.OtherPerformance;
existEntities.First(t => t.Id == item.Id).NightWorkPerformance = item.NightWorkPerformance;
existEntities.First(t => t.Id == item.Id).RealAmount = item.RealAmount;
existEntities.First(t => t.Id == item.Id).ManagementAllowance = item.ManagementAllowance;
existEntities.First(t => t.Id == item.Id).IndividualReward = item.IndividualReward;
existEntities.First(t => t.Id == item.Id).AllocationOfKeySpecialty = item.AllocationOfKeySpecialty;
}
agothersourceRepository.UpdateRange(existEntities.ToArray());
var delIds = existEntities.Select(t => t.Id).Except(request.Select(t => t.Id));
if (delIds != null)
agothersourceRepository.RemoveRange(existEntities.Where(t => delIds.Contains(t.Id)).ToArray());
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Performance.Services
{
public static class ServiceLocator
{
public static IServiceProvider Instance { get; set; }
}
}
......@@ -526,8 +526,8 @@ public UserResponse ResetPwd(int userId, int loginUserId)
if (user == null)
throw new PerformanceException($"用户不存在 UserId:{userId}");
if (user.CreateUser != loginUserId)
throw new PerformanceException($"当前用户无权限重置用户密码");
//if (user.CreateUser != loginUserId)
// throw new PerformanceException($"当前用户无权限重置用户密码");
user.Password = "123456";
if (!_userRepository.Update(user))
......
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