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() ...@@ -92,13 +92,13 @@ public ApiResponse<JwtToken> Refresh()
var userClaim = _claim.GetUserClaim(); var userClaim = _claim.GetUserClaim();
var claims = new Claim[] var claims = new Claim[]
{ {
new Claim(JwtClaimTypes.Id, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.Id).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.Login, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.Login)?.Value??""),
new Claim(JwtClaimTypes.RealName, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.RealName).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.Mail, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.Mail)?.Value??""),
new Claim(JwtClaimTypes.AppName, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.AppName).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.Device, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.Device)?.Value??""),
new Claim(JwtClaimTypes.Department, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.Department).Value), new Claim(JwtClaimTypes.Department, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.Department)?.Value??""),
}; };
var jwtToken = JwtTokenHelper.GenerateToken(claims, _options.ExpirationMinutes); var jwtToken = JwtTokenHelper.GenerateToken(claims, _options.ExpirationMinutes);
...@@ -271,9 +271,9 @@ public ApiResponse<JwtToken> DemoUsers(int userId) ...@@ -271,9 +271,9 @@ public ApiResponse<JwtToken> DemoUsers(int userId)
new Claim(JwtClaimTypes.Id, user.UserID.ToString()), new Claim(JwtClaimTypes.Id, user.UserID.ToString()),
new Claim(JwtClaimTypes.Login, user.Login), new Claim(JwtClaimTypes.Login, user.Login),
new Claim(JwtClaimTypes.RealName, user.RealName), new Claim(JwtClaimTypes.RealName, user.RealName),
new Claim(JwtClaimTypes.Mail, user.Mail), new Claim(JwtClaimTypes.Mail, user.Mail??""),
new Claim(JwtClaimTypes.AppName, userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.AppName).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.Device,userClaim.FirstOrDefault(t => t.Type == JwtClaimTypes.Device)?.Value??""),
new Claim(JwtClaimTypes.Department, user.Department ?? ""), new Claim(JwtClaimTypes.Department, user.Department ?? ""),
}; };
......
...@@ -290,7 +290,7 @@ public ApiResponse AllComputeByPM([FromBody] ComputerRequest request) ...@@ -290,7 +290,7 @@ public ApiResponse AllComputeByPM([FromBody] ComputerRequest request)
throw new PerformanceException("当前绩效记录不存在"); throw new PerformanceException("当前绩效记录不存在");
var isShowManage = _computeService.IsShowManage(request.AllotId); 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()) if (list == null || !list.Any())
return new ApiResponse(ResponseType.OK, "ok", list); return new ApiResponse(ResponseType.OK, "ok", list);
......
...@@ -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>
/// 月群体人均绩效 /// 月群体人均绩效
......
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 @@ ...@@ -40,6 +40,7 @@
<PackageReference Include="AutoMapper" Version="8.0.0" /> <PackageReference Include="AutoMapper" Version="8.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.0.0" /> <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.0.0" />
<PackageReference Include="CSRedisCore" Version="3.0.45" /> <PackageReference Include="CSRedisCore" Version="3.0.45" />
<PackageReference Include="FluentScheduler" Version="5.5.1" />
<PackageReference Include="FluentValidation.AspNetCore" Version="8.1.3" /> <PackageReference Include="FluentValidation.AspNetCore" Version="8.1.3" />
<PackageReference Include="GraphQL" Version="2.4.0" /> <PackageReference Include="GraphQL" Version="2.4.0" />
<PackageReference Include="Hangfire" Version="1.6.22" /> <PackageReference Include="Hangfire" Version="1.6.22" />
......
...@@ -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>
...@@ -6833,36 +6838,11 @@ ...@@ -6833,36 +6838,11 @@
医院状态 1 启用 2 禁用 医院状态 1 启用 2 禁用
</summary> </summary>
</member> </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"> <member name="P:Performance.EntityModels.sys_hospital.IsShowManage">
<summary> <summary>
是否显示绩效合计 1 显示绩效合计 2 显示管理绩效 是否显示绩效合计 1 显示绩效合计 2 显示管理绩效
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.sys_hospital.IsOpenCMIPercent">
<summary>
是否开启科室CMI占比 1 启用 2 禁用
</summary>
</member>
<member name="P:Performance.EntityModels.sys_hospital.IsOpenNursingDeptAudit"> <member name="P:Performance.EntityModels.sys_hospital.IsOpenNursingDeptAudit">
<summary> <summary>
是否开启护理部审核 1 启用 2 禁用 是否开启护理部审核 1 启用 2 禁用
...@@ -6873,9 +6853,9 @@ ...@@ -6873,9 +6853,9 @@
是否显示二次绩效科主任1 启用 2 禁用 是否显示二次绩效科主任1 启用 2 禁用
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.sys_hospital.IsOpenLogisticsSecondAllot"> <member name="P:Performance.EntityModels.sys_hospital.IsOpenTimedTasks">
<summary> <summary>
是否开启行政后勤二次绩效分配 1 启用 2 禁用 是否开启定时抽取任务 1 是 2 否
</summary> </summary>
</member> </member>
<member name="P:Performance.EntityModels.sys_hospital.IsSingleProject"> <member name="P:Performance.EntityModels.sys_hospital.IsSingleProject">
......
...@@ -8,7 +8,7 @@ namespace Performance.DtoModels ...@@ -8,7 +8,7 @@ namespace Performance.DtoModels
public class WorkDetailRequest public class WorkDetailRequest
{ {
public int AllotId { get; set; } public int AllotId { get; set; }
public int SecondId { get; set; } //public int SecondId { get; set; }
public string Source { get; set; } public string Source { get; set; }
public string AccountingUnit { get; set; } public string AccountingUnit { get; set; }
} }
...@@ -20,7 +20,7 @@ public WorkDetailRequestValidator() ...@@ -20,7 +20,7 @@ public WorkDetailRequestValidator()
RuleSet("Select", () => RuleSet("Select", () =>
{ {
RuleFor(x => x.AllotId).NotNull().NotEmpty().GreaterThan(0); 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(); RuleFor(x => x.AccountingUnit).NotNull().NotEmpty();
}); });
} }
......
...@@ -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; }
} }
} }
...@@ -7,105 +7,110 @@ ...@@ -7,105 +7,110 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels namespace Performance.EntityModels
{ {
/// <summary> /// <summary>
/// 医院信息 /// 医院信息
/// </summary> /// </summary>
[Table("sys_hospital")] [Table("sys_hospital")]
public class sys_hospital public class sys_hospital
{ {
/// <summary> /// <summary>
/// ID /// ID
/// </summary> /// </summary>
[Key] [Key]
public int ID { get; set; } public int ID { get; set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public Nullable<DateTime> CreateDate { get; set; } public Nullable<DateTime> CreateDate { get; set; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public Nullable<int> CreateUser { get; set; } public Nullable<int> CreateUser { get; set; }
/// <summary> /// <summary>
/// 医院名称 /// 医院名称
/// </summary> /// </summary>
public string HosName { get; set; } public string HosName { get; set; }
/// <summary> /// <summary>
/// 简称 /// 简称
/// </summary> /// </summary>
public string ShortName { get; set; } public string ShortName { get; set; }
/// <summary> /// <summary>
/// 医院区域编码 /// 医院区域编码
/// </summary> /// </summary>
public string AreaCode { get; set; } public string AreaCode { get; set; }
/// <summary> /// <summary>
/// 医院等级 /// 医院等级
/// </summary> /// </summary>
public string HosLevel { get; set; } public string HosLevel { get; set; }
/// <summary> /// <summary>
/// 医院类型 /// 医院类型
/// </summary> /// </summary>
public string HosType { get; set; } public string HosType { get; set; }
/// <summary> /// <summary>
/// 医院状态 1 启用 2 禁用 /// 医院状态 1 启用 2 禁用
/// </summary> /// </summary>
public Nullable<int> States { get; set; } public Nullable<int> States { get; set; }
/// <summary> ///// <summary>
/// 是否开启年资系数 1 启用 2 禁用 ///// 是否开启年资系数 1 启用 2 禁用
/// </summary> ///// </summary>
public Nullable<int> IsOpenWorkYear { get; set; } //public Nullable<int> IsOpenWorkYear { get; set; }
/// <summary> ///// <summary>
/// 是否开启药占比系数 1 启用 2 禁用 ///// 是否开启药占比系数 1 启用 2 禁用
/// </summary> ///// </summary>
public Nullable<int> IsOpenDrugprop { get; set; } //public Nullable<int> IsOpenDrugprop { get; set; }
/// <summary> ///// <summary>
/// 是否开启ICU有效收入系数 1 启用 2 禁用 ///// 是否开启ICU有效收入系数 1 启用 2 禁用
/// </summary> ///// </summary>
public Nullable<int> IsOpenIncome { get; set; } //public Nullable<int> IsOpenIncome { get; set; }
/// <summary> ///// <summary>
/// 是否开启规模/效率绩效 1 启用 2 禁用 ///// 是否开启规模/效率绩效 1 启用 2 禁用
/// </summary> ///// </summary>
public Nullable<int> IsOpenDirector { get; set; } //public Nullable<int> IsOpenDirector { get; set; }
/// <summary> /// <summary>
/// 是否显示绩效合计 1 显示绩效合计 2 显示管理绩效 /// 是否显示绩效合计 1 显示绩效合计 2 显示管理绩效
/// </summary> /// </summary>
public Nullable<int> IsShowManage { get; set; } public Nullable<int> IsShowManage { get; set; }
/// <summary> ///// <summary>
/// 是否开启科室CMI占比 1 启用 2 禁用 ///// 是否开启科室CMI占比 1 启用 2 禁用
/// </summary> ///// </summary>
public Nullable<int> IsOpenCMIPercent { get; set; } //public Nullable<int> IsOpenCMIPercent { get; set; }
/// <summary> /// <summary>
/// 是否开启护理部审核 1 启用 2 禁用 /// 是否开启护理部审核 1 启用 2 禁用
/// </summary> /// </summary>
public Nullable<int> IsOpenNursingDeptAudit { get; set; } public Nullable<int> IsOpenNursingDeptAudit { get; set; }
/// <summary> /// <summary>
/// 是否显示二次绩效科主任1 启用 2 禁用 /// 是否显示二次绩效科主任1 启用 2 禁用
/// </summary> /// </summary>
public Nullable<int> IsShowSecondDirector { get; set; } public Nullable<int> IsShowSecondDirector { get; set; }
///// <summary>
///// 是否开启行政后勤二次绩效分配 1 启用 2 禁用
///// </summary>
//public Nullable<int> IsOpenLogisticsSecondAllot { get; set; }
/// <summary> /// <summary>
/// 是否开启行政后勤二次绩效分配 1 启用 2 禁用 /// 是否开启定时抽取任务 1 是 2 否
/// </summary> /// </summary>
public Nullable<int> IsOpenLogisticsSecondAllot { get; set; } public Nullable<int> IsOpenTimedTasks { get; set; }
/// <summary> /// <summary>
/// 抽取项目是否在同一环境 1 是 2 否 /// 抽取项目是否在同一环境 1 是 2 否
/// </summary> /// </summary>
......
...@@ -118,6 +118,16 @@ public bool UpdateByState(TEntity entity) ...@@ -118,6 +118,16 @@ public bool UpdateByState(TEntity entity)
return context.SaveChanges() > 0; 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) public bool Update(TEntity entity, Action<TEntity> action)
{ {
action?.Invoke(entity); action?.Invoke(entity);
......
...@@ -173,22 +173,25 @@ public void ImportWorkloadData(per_allot allot, object parameters) ...@@ -173,22 +173,25 @@ public void ImportWorkloadData(per_allot allot, object parameters)
/// 查询工作量数据 /// 查询工作量数据
/// </summary> /// </summary>
/// <param name="allotid"></param> /// <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()) using (var connection = context.Database.GetDbConnection())
{ {
if (connection.State != ConnectionState.Open) connection.Open(); if (connection.State != ConnectionState.Open) connection.Open();
try 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 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 JOIN (select distinct AccountingUnit,HISDeptName,unittype from per_dept_dic where HospitalId = @hospitalid) t3 ON t1.Department = t3.HISDeptName
WHERE t1.allotid = @allotid WHERE t1.allotid = @allotid
AND t3.unittype = @unittype AND t3.unittype in @unittypes
AND t3.accountingunit = @accountingunit AND t3.accountingunit = @accountingunit
AND t1.Source LIKE CONCAT('%',@unittype,'工作量%') AND t1.Source LIKE CONCAT('%',@unittype,'工作量%')
AND T1.IsDelete = 0 AND T1.IsDelete = 0
ORDER BY t1.doctorname,t1.Category;"; 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) catch (Exception ex)
{ {
...@@ -201,7 +204,7 @@ public IEnumerable<report_original_workload> QueryWorkloadData(int allotid, stri ...@@ -201,7 +204,7 @@ public IEnumerable<report_original_workload> QueryWorkloadData(int allotid, stri
/// 查询门诊收入数据 /// 查询门诊收入数据
/// </summary> /// </summary>
/// <param name="allotid"></param> /// <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()) using (var connection = context.Database.GetDbConnection())
{ {
...@@ -211,9 +214,9 @@ public IEnumerable<ex_result> QueryIncomeData(int allotid, string source, string ...@@ -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 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 JOIN (select distinct AccountingUnit,HISDeptName,unittype from per_dept_dic where HospitalId = @hospitalid) t3 ON t1.Department = t3.HISDeptName
WHERE t1.allotid = @allotid WHERE t1.allotid = @allotid
AND t3.unittype = @unittype AND t3.unittype in @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>
......
...@@ -268,7 +268,7 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, per_allot ...@@ -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 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 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 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[] var pairs = new[]
{ {
...@@ -303,7 +303,7 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, per_allot ...@@ -303,7 +303,7 @@ public List<PerSheet> Compute(PerExcel excel, List<PerSheet> perSheet, per_allot
if (UnitType.医技组 == unitType && workDoctor == null) if (UnitType.医技组 == unitType && workDoctor == null)
workDoctor = info.Data.FirstOrDefault(t => t.UnitType == UnitType.医生组.ToString() && t.AccountingUnit == dept.AccountingUnit); 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.NightShiftWorkPerforFee = nightShift;
//dept.MedicineFactor = workDoctor?.MedicineFactor; //dept.MedicineFactor = workDoctor?.MedicineFactor;
...@@ -349,7 +349,7 @@ public void ComputeOffice(per_allot allot, PerExcel excel) ...@@ -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 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> List<string> involves = new List<string>
{ {
...@@ -383,11 +383,11 @@ public void ComputeOffice(per_allot allot, PerExcel excel) ...@@ -383,11 +383,11 @@ public void ComputeOffice(per_allot allot, PerExcel excel)
dept.NeedSecondAllot = empolyees.Any(w => w.NeedSecondAllot == "是") ? "是" : "否"; dept.NeedSecondAllot = empolyees.Any(w => w.NeedSecondAllot == "是") ? "是" : "否";
if (UnitTypeUtil.IsOffice(resAccount?.UnitType) && dept.NeedSecondAllot == "是") 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.ScoringAverage = resAccount?.ScoringAverage == null ? 0 : resAccount.ScoringAverage;
dept.AdjustFactor = (isBudget ? adjust : resAccount?.AdjustFactor) ?? 1; dept.AdjustFactor = (isBudget ? adjust : resAccount?.AdjustFactor) ?? 1;
dept.Extra = resAccount?.Extra ?? 0; dept.Extra = resAccount?.Extra ?? 0;
...@@ -416,7 +416,7 @@ public void ComputeOffice(per_allot allot, PerExcel excel) ...@@ -416,7 +416,7 @@ public void ComputeOffice(per_allot allot, PerExcel excel)
//dept.MedicineExtra = 0;// (drugExtra ?? 0); //dept.MedicineExtra = 0;// (drugExtra ?? 0);
//dept.MaterialsExtra = 0;//(materialsExtra ?? 0); //dept.MaterialsExtra = 0;//(materialsExtra ?? 0);
dept.PerforFee = empolyees.Sum(w => w.PerforTotal ?? 0); dept.PerforFee = empolyees.Sum(w => w.PerforTotal ?? 0);
dept.PerforTotal = Math.Round(empolyees.Sum(w => w.GiveFee ?? 0)); dept.PerforTotal = Math.Round(empolyees.Sum(w => w.GiveFee ?? 0));
dept.AssessLaterPerforTotal = Math.Round((dept.PerforTotal * dept.ScoringAverage + dept.MedicineExtra + dept.MaterialsExtra + dept.Extra) ?? 0); dept.AssessLaterPerforTotal = Math.Round((dept.PerforTotal * dept.ScoringAverage + dept.MedicineExtra + dept.MaterialsExtra + dept.Extra) ?? 0);
...@@ -645,10 +645,11 @@ public IEnumerable<AccountUnitTotal> GetAccountScoreAverage(PerExcel excel, Shee ...@@ -645,10 +645,11 @@ public IEnumerable<AccountUnitTotal> GetAccountScoreAverage(PerExcel excel, Shee
/// 获取药占比分割比例 /// 获取药占比分割比例
/// </summary> /// </summary>
/// <param name="excel"></param> /// <param name="excel"></param>
/// <param name="sheetType"></param>
/// <returns></returns> /// <returns></returns>
private IEnumerable<CofDrugProp> GetFactors(PerExcel excel, SheetType sheetType) 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 var factors = perDatas
?.Where(w => w.IsTotal == 1) ?.Where(w => w.IsTotal == 1)
.Select(w => new CofDrugProp .Select(w => new CofDrugProp
......
...@@ -140,7 +140,7 @@ public void SpecialUnitCompute(PerExcel excel, per_allot allot, List<res_baiscno ...@@ -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 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>(); List<res_specialunit> resDataList = new List<res_specialunit>();
...@@ -179,7 +179,7 @@ public void SpecialUnitCompute(PerExcel excel, per_allot allot, List<res_baiscno ...@@ -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 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; decimal? headcount = null;
if (typeList.Any(o => o.Description == item.QuantitativeIndicators)) if (typeList.Any(o => o.Description == item.QuantitativeIndicators))
...@@ -262,6 +262,7 @@ public void SpecialUnitCompute(PerExcel excel, per_allot allot, List<res_baiscno ...@@ -262,6 +262,7 @@ public void SpecialUnitCompute(PerExcel excel, per_allot allot, List<res_baiscno
//OtherPerfor = empolyee.OtherPerfor, //OtherPerfor = empolyee.OtherPerfor,
OtherManagePerfor = empolyee?.OtherManagePerfor ?? 0, OtherManagePerfor = empolyee?.OtherManagePerfor ?? 0,
Number = resAccount.Number, Number = resAccount.Number,
PermanentStaff = empolyee.PermanentStaff,
PerforTotal = resAccount.PerforTotal, PerforTotal = resAccount.PerforTotal,
Adjust = empolyeeAdjust ?? 1m, Adjust = empolyeeAdjust ?? 1m,
Grant = isBudget ? grant : empolyee.Management, Grant = isBudget ? grant : empolyee.Management,
...@@ -522,6 +523,7 @@ public void GenerateSecondAllot(per_allot allot) ...@@ -522,6 +523,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.行政后勤 };
//// 获取医院是否开启后勤二次分配 //// 获取医院是否开启后勤二次分配
...@@ -608,15 +610,42 @@ public void GenerateSecondAllot(per_allot allot) ...@@ -608,15 +610,42 @@ public void GenerateSecondAllot(per_allot allot)
second.NursingDeptRemark = "科室绩效结果发生变更,需要重新提交"; second.NursingDeptRemark = "科室绩效结果发生变更,需要重新提交";
} }
second.RealGiveFee = item.RealGiveFee; second.RealGiveFee = item.RealGiveFee;
second.NightShiftWorkPerforFee = item.NightShiftWorkPerforFee;
updSecond.Add(second); 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()) 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
{ {
...@@ -717,7 +718,7 @@ public DeptDetailResponse GetDepartmentDetail(int allotId, int accountId, int ty ...@@ -717,7 +718,7 @@ public DeptDetailResponse GetDepartmentDetail(int allotId, int accountId, int ty
/// <param name="hospitalId"></param> /// <param name="hospitalId"></param>
/// <param name="isShowManage"> 仅显示管理绩效 isShowManage == 1 </param> /// <param name="isShowManage"> 仅显示管理绩效 isShowManage == 1 </param>
/// <returns></returns> /// <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); var list = GetAllotPerformance(allotId, hospitalId, isShowManage);
...@@ -761,9 +762,12 @@ public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowM ...@@ -761,9 +762,12 @@ public List<ComputeResponse> AllCompute(int allotId, int hospitalId, int isShowM
item.ReservedRatioFee = Math.Round(real * (item.ReservedRatio ?? 0), 2, MidpointRounding.AwayFromZero); item.ReservedRatioFee = Math.Round(real * (item.ReservedRatio ?? 0), 2, MidpointRounding.AwayFromZero);
item.RealGiveFee = Math.Round(item.ShouldGiveFee - (item.ReservedRatioFee ?? 0) ?? 0, 2, MidpointRounding.AwayFromZero); item.RealGiveFee = Math.Round(item.ShouldGiveFee - (item.ReservedRatioFee ?? 0) ?? 0, 2, MidpointRounding.AwayFromZero);
// 人员信息使用人员字典中数据 // 人员信息使用人员字典中数据
item.AccountingUnit = empDic?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.AccountingUnit ?? ""; if (isEmpDic)
item.UnitType = empDic?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.UnitType ?? ""; {
item.EmployeeName = empDic?.FirstOrDefault(w => w.PersonnelNumber == item.JobNumber)?.DoctorName ?? ""; 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 ?? "";
}
} }
} }
...@@ -1043,6 +1047,20 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId) ...@@ -1043,6 +1047,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 +1068,7 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId) ...@@ -1050,7 +1068,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 +1136,7 @@ public DeptDataDetails<DetailModuleExtend> DeptDetail(int accountId) ...@@ -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.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 +1261,7 @@ private List<DetailModule> CommonDetailItems(List<im_data> basicData, List<im_he ...@@ -1243,7 +1261,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 +1285,7 @@ private DeptDataDetails<DetailModuleExtend> MergeDetails(DeptDataDetails details ...@@ -1267,7 +1285,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 +1334,7 @@ private DeptDataDetails<DetailModuleExtend> MergeDetails(DeptDataDetails details ...@@ -1316,7 +1334,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),
......
...@@ -324,7 +324,7 @@ public class ConfigService : IAutoInjection ...@@ -324,7 +324,7 @@ public class ConfigService : IAutoInjection
/// <returns></returns> /// <returns></returns>
public List<cof_drugtype> GetDrugtypeList(int HospitalId, int allotId) 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; return list;
} }
...@@ -705,9 +705,9 @@ public void Copy(per_allot allot) ...@@ -705,9 +705,9 @@ public void Copy(per_allot allot)
logger.LogInformation($"workItem"); logger.LogInformation($"workItem");
var workItem = _workitemRepository.GetEntities(t => t.AllotID == allot.ID); 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) if (workItem != null && workItem.Count > 0)
{ {
var newWorkItem = workItem.Select(t => new cof_workitem { AllotID = allot.ID, Type = t.Type, Item = t.Item }); 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) ...@@ -720,7 +720,7 @@ public void Copy(per_allot allot)
if (cofDrugtype == null || cofDrugtype.Count == 0) if (cofDrugtype == null || cofDrugtype.Count == 0)
{ {
var drugtype = _drugtypeRepository.GetEntities(t => t.AllotID == allotId) ?? _drugtypeRepository.GetEntities(t => t.AllotID == -1); 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()); _drugtypeRepository.AddRange(newAgains.ToArray());
} }
...@@ -845,8 +845,8 @@ private void CopyAprData(int prevAllotId, int allotId) ...@@ -845,8 +845,8 @@ private void CopyAprData(int prevAllotId, int allotId)
#region HRP人员科室 #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 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() ...@@ -921,13 +921,13 @@ public HandsonTable GetSecondaryAlias()
if (column.Data == "状态") if (column.Data == "状态")
{ {
column.Type = "autocomplete"; column.Type = "autocomplete";
column.Source = new[] {"可用", "禁用"}; column.Source = new[] { "可用", "禁用" };
column.Strict = true; column.Strict = true;
} }
} }
} }
var data = perforCofaliasRepository.GetEntities()?.OrderBy(t=>t.Route); var data = perforCofaliasRepository.GetEntities()?.OrderBy(t => t.Route);
if (data==null) return result; if (data == null) return result;
List<HandsonRowData> rowDatas = new List<HandsonRowData>(); List<HandsonRowData> rowDatas = new List<HandsonRowData>();
int i = 0; int i = 0;
...@@ -935,13 +935,13 @@ public HandsonTable GetSecondaryAlias() ...@@ -935,13 +935,13 @@ public HandsonTable GetSecondaryAlias()
{ {
var json = JsonHelper.Serialize(item); var json = JsonHelper.Serialize(item);
var firstDic = JsonHelper.Deserialize<Dictionary<string, string>>(json); 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(); 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++; i++;
} }
result.SetRowData(rowDatas,rowDatas!=null); result.SetRowData(rowDatas, rowDatas != null);
return result; return result;
} }
...@@ -952,22 +952,22 @@ public void SaveSecondaryAlias(SaveCollectData request) ...@@ -952,22 +952,22 @@ public void SaveSecondaryAlias(SaveCollectData request)
List<cof_alias> aliases = new List<cof_alias>(); List<cof_alias> aliases = new List<cof_alias>();
foreach (var item in dicData) foreach (var item in dicData)
{ {
var states = new[] {"可用", "禁用"}; var states = new[] { "可用", "禁用" };
if (item["States"]!=null && states.Contains(item["States"])) if (item["States"] != null && states.Contains(item["States"]))
{ {
item["States"] = item["States"] == "可用" ? "1" : "0"; item["States"] = item["States"] == "可用" ? "1" : "0";
} }
else continue; else continue;
var json = JsonHelper.Serialize(item); var json = JsonHelper.Serialize(item);
var data = JsonHelper.Deserialize<cof_alias>(json); 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); aliases.Add(data);
} }
} }
perforCofaliasRepository.Execute("delete from cof_alias",null); perforCofaliasRepository.Execute("delete from cof_alias", null);
perforCofaliasRepository.AddRange(aliases.ToArray()); perforCofaliasRepository.AddRange(aliases.ToArray());
} }
...@@ -1015,7 +1015,7 @@ public void SaveSecondaryAlias(SaveCollectData request) ...@@ -1015,7 +1015,7 @@ public void SaveSecondaryAlias(SaveCollectData request)
return result; return result;
} }
///// <summary> ///// <summary>
///// CMI值 ///// CMI值
///// </summary> ///// </summary>
......
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();
...@@ -154,7 +154,7 @@ public static void ClearSheetTemplate(ISheet sheet, PerSheetPoint point, SheetTy ...@@ -154,7 +154,7 @@ public static void ClearSheetTemplate(ISheet sheet, PerSheetPoint point, SheetTy
sheet.ShiftRows(point.DataFirstRowNum.Value, sheet.LastRowNum + 1, -1); sheet.ShiftRows(point.DataFirstRowNum.Value, sheet.LastRowNum + 1, -1);
} }
} }
public static void CloseAutoFilter(string path) public static void CloseAutoFilter(string path)
{ {
try try
......
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 ...@@ -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)}"); logger.LogInformation($"allotId: {allot.ID}: 总金额 - {extractDto?.Sum(s => s.Value ?? 0)}");
WriteDataFactory factory = new WriteDataFactory(); 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; decimal ratio = 60m;
for (int sheetIndex = 0; sheetIndex < workbook.NumberOfSheets; sheetIndex++) for (int sheetIndex = 0; sheetIndex < workbook.NumberOfSheets; sheetIndex++)
{ {
...@@ -209,14 +209,12 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re ...@@ -209,14 +209,12 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, List<ex_result> re
var dict = personService.GetDepartments(hospitalId)?.ToList(); var dict = personService.GetDepartments(hospitalId)?.ToList();
if (dict == null || !dict.Any()) 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, SheetName = t.Key.Source,
DoctorName = t.DoctorName, Department = t.Key.Department,
PersonnelNumber = t.PersonnelNumber, Category = t.Key.Category,
Department = t.Department, Value = t.Sum(group => group.Fee) == 0 ? null : t.Sum(group => group.Fee),
Category = t.Category,
Value = t.Fee ?? 0
}).ToList(); }).ToList();
dict.ForEach(t => dict.ForEach(t =>
......
...@@ -131,9 +131,9 @@ public HospitalResponse Update(HospitalRequest request) ...@@ -131,9 +131,9 @@ public HospitalResponse Update(HospitalRequest request)
hospital.States = request.States; hospital.States = request.States;
//hospital.IsOpenWorkYear = request.IsOpenWorkYear; //hospital.IsOpenWorkYear = request.IsOpenWorkYear;
//hospital.IsOpenDirector = request.IsOpenDirector; //hospital.IsOpenDirector = request.IsOpenDirector;
hospital.IsOpenDrugprop = request.IsOpenDrugprop; //hospital.IsOpenDrugprop = request.IsOpenDrugprop;
hospital.IsShowManage = request.IsShowManage; hospital.IsShowManage = request.IsShowManage;
hospital.IsOpenCMIPercent = request.IsOpenCMIPercent; //hospital.IsOpenCMIPercent = request.IsOpenCMIPercent;
//hospital.IsOpenLogisticsSecondAllot = request.IsOpenLogisticsSecondAllot; //hospital.IsOpenLogisticsSecondAllot = request.IsOpenLogisticsSecondAllot;
//hospital.IsOpenIncome = request.IsOpenIncome; //hospital.IsOpenIncome = request.IsOpenIncome;
......
...@@ -71,7 +71,7 @@ public static string GetValue(this ICell cell) ...@@ -71,7 +71,7 @@ public static string GetValue(this ICell cell)
case CellType.Numeric: case CellType.Numeric:
return cell?.NumericCellValue.ToString(); return cell?.NumericCellValue.ToString();
case CellType.String: case CellType.String:
return cell?.StringCellValue.ToString(); return cell?.StringCellValue?.ToString() ?? "";
case CellType.Formula: case CellType.Formula:
cell?.SetCellType(CellType.String); cell?.SetCellType(CellType.String);
return cell?.StringCellValue?.ToString(); return cell?.StringCellValue?.ToString();
......
...@@ -39,14 +39,15 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader) ...@@ -39,14 +39,15 @@ public List<IPerData> ReadData(ISheet sheet, List<PerHeader> perHeader)
var unit = Point.AccountingUnit.First(); 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++) for (int r = Point.DataFirstRowNum.Value; r < sheet.LastRowNum + 1; r++)
{ {
var row = sheet.GetRow(r); var row = sheet.GetRow(r);
if (row == null) continue; 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 athead = vhead.ElementAt(c);
//var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell)); //var cellValue = NopiSevice.GetCellValue(row.GetCell(athead.PointCell));
......
...@@ -509,15 +509,14 @@ public List<TitleValue> DeptDics(int hospitalId, int type) ...@@ -509,15 +509,14 @@ public List<TitleValue> DeptDics(int hospitalId, int type)
/// <returns></returns> /// <returns></returns>
public object DeptWorkloadDetail(WorkDetailRequest request, int userId) public object DeptWorkloadDetail(WorkDetailRequest request, int userId)
{ {
var second = agsecondallotRepository.GetEntity(w => w.Id == request.SecondId); string[] unitTypes = GetUnitType(userId);
if (second == null) if (unitTypes == null || !unitTypes.Any()) return new string[] { };
return null;
var allot = perallotRepository.GetEntity(w => w.ID == request.AllotId); var allot = perallotRepository.GetEntity(w => w.ID == request.AllotId);
if (allot == null) if (allot == null)
return 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()) if (data != null && data.Any())
{ {
return data.GroupBy(t => new { t.Department, t.DoctorName, t.PersonnelNumber, t.Category }) return data.GroupBy(t => new { t.Department, t.DoctorName, t.PersonnelNumber, t.Category })
...@@ -541,9 +540,8 @@ public object DeptWorkloadDetail(WorkDetailRequest request, int userId) ...@@ -541,9 +540,8 @@ public object DeptWorkloadDetail(WorkDetailRequest request, int userId)
/// <returns></returns> /// <returns></returns>
public object DeptIncomeDetail(WorkDetailRequest request, int userId) public object DeptIncomeDetail(WorkDetailRequest request, int userId)
{ {
var second = agsecondallotRepository.GetEntity(w => w.Id == request.SecondId); string[] unitTypes = GetUnitType(userId);
if (second == null) if (unitTypes == null || !unitTypes.Any()) return new string[] { };
return null;
var allot = perallotRepository.GetEntity(w => w.ID == request.AllotId); var allot = perallotRepository.GetEntity(w => w.ID == request.AllotId);
if (allot == null) if (allot == null)
...@@ -552,7 +550,7 @@ public object DeptIncomeDetail(WorkDetailRequest request, int userId) ...@@ -552,7 +550,7 @@ public object DeptIncomeDetail(WorkDetailRequest request, int userId)
if (!sources.Contains(request.Source)) if (!sources.Contains(request.Source))
throw new PerformanceException($"数据来源错误,只支持:{string.Join(";", sources)}"); 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()) if (data != null && data.Any())
{ {
return data.GroupBy(t => new { t.Department, t.DoctorName, t.PersonnelNumber, t.Category }) return data.GroupBy(t => new { t.Department, t.DoctorName, t.PersonnelNumber, t.Category })
...@@ -568,5 +566,27 @@ public object DeptIncomeDetail(WorkDetailRequest request, int userId) ...@@ -568,5 +566,27 @@ public object DeptIncomeDetail(WorkDetailRequest request, int userId)
return new string[] { }; 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) ...@@ -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抽取报表数据
......
...@@ -60,7 +60,7 @@ public List<RoleResponse> GetUsersRole(int userid) ...@@ -60,7 +60,7 @@ public List<RoleResponse> GetUsersRole(int userid)
List<RoleResponse> roleResponses = new List<RoleResponse>(); List<RoleResponse> roleResponses = new List<RoleResponse>();
var user=_userRepository.GetEntity(c => c.ID == userid); var user=_userRepository.GetEntity(c => c.ID == userid);
var ParentUser = _userRepository.GetEntities(c => c.ParentID == 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); ParentUser=_userRepository.GetEntities(c => c.ParentID == user.ParentID);
} }
......
...@@ -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>();
...@@ -743,7 +743,7 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is ...@@ -743,7 +743,7 @@ public List<ag_othersource> GetOtherTempDetails(int userId, int secondId, int is
var types = new string[] { "行政后勤", "行政工勤" }; var types = new string[] { "行政后勤", "行政工勤" };
var logistics = _imemployeelogisticsRepository.GetEntities(w => w.AllotID == secondAllot.AllotId && types.Contains(w.AccountType) && w.AccountingUnit == secondAllot.Department); var logistics = _imemployeelogisticsRepository.GetEntities(w => w.AllotID == secondAllot.AllotId && types.Contains(w.AccountType) && w.AccountingUnit == secondAllot.Department);
result = (logistics ?? new List<im_employee_logistics>()) 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, SecondId = secondId,
WorkNumber = w.PersonnelNumber, WorkNumber = w.PersonnelNumber,
......
...@@ -420,15 +420,19 @@ public dynamic GetWorkloadDict(int secondId) ...@@ -420,15 +420,19 @@ 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)
Title = t.Key.ItemId, .Select(t => new
Value = t.Key.ItemName, {
Factor = t.Key.FactorValue Title = t.Key.ItemId,
}); Value = t.Key.ItemName,
Factor = t.Key.FactorValue
});
return dict; return dict;
} }
...@@ -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());
} }
...@@ -1966,28 +1999,14 @@ private void SupplementSecondDetail(ag_secondallot second, List<per_employee> em ...@@ -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) 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); var existEntities = agothersourceRepository.GetEntities(t => t.SecondId == secondId);
if (existEntities != null && existEntities.Any()) 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)); var delIds = existEntities.Select(t => t.Id).Except(request.Select(t => t.Id));
if (delIds != null) if (delIds != null)
agothersourceRepository.RemoveRange(existEntities.Where(t => delIds.Contains(t.Id)).ToArray()); 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) ...@@ -526,8 +526,8 @@ public UserResponse ResetPwd(int userId, int loginUserId)
if (user == null) if (user == null)
throw new PerformanceException($"用户不存在 UserId:{userId}"); throw new PerformanceException($"用户不存在 UserId:{userId}");
if (user.CreateUser != loginUserId) //if (user.CreateUser != loginUserId)
throw new PerformanceException($"当前用户无权限重置用户密码"); // throw new PerformanceException($"当前用户无权限重置用户密码");
user.Password = "123456"; user.Password = "123456";
if (!_userRepository.Update(user)) 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