Commit 28115718 by 纪旭 韦

提取绩效修复,二次分配查看详情修复

parent f69cbd46
...@@ -20,11 +20,13 @@ public class PersonController : Controller ...@@ -20,11 +20,13 @@ public class PersonController : Controller
{ {
private readonly PersonService personService; private readonly PersonService personService;
private readonly ClaimService claimService; private readonly ClaimService claimService;
private readonly DapperService dapperService;
public PersonController(PersonService personService, ClaimService claimService) public PersonController(PersonService personService, ClaimService claimService, DapperService dapperService)
{ {
this.personService = personService; this.personService = personService;
this.claimService = claimService; this.claimService = claimService;
this.dapperService = dapperService;
} }
/// <summary> /// <summary>
...@@ -135,7 +137,7 @@ public IActionResult DownloadCurrentCalculationTable([FromRoute] int allotId) ...@@ -135,7 +137,7 @@ public IActionResult DownloadCurrentCalculationTable([FromRoute] int allotId)
[HttpPost] [HttpPost]
public ApiResponse GetDepartments(int allotId) public ApiResponse GetDepartments(int allotId)
{ {
var list = personService.GetDepartments(allotId); var list = dapperService.GetDepartments(allotId);
return new ApiResponse(ResponseType.OK, list); return new ApiResponse(ResponseType.OK, list);
} }
......
...@@ -4,9 +4,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121. ...@@ -4,9 +4,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
--> -->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<DeleteExistingFiles>False</DeleteExistingFiles> <DeleteExistingFiles>true</DeleteExistingFiles>
<ExcludeApp_Data>False</ExcludeApp_Data> <ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish> <LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform> <LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider> <PublishProvider>FileSystem</PublishProvider>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
}, },
"AppConnection": { "AppConnection": {
//"PerformanceConnectionString": "server=112.124.13.17;database=db_performance;uid=suvalue;pwd=suvalue2016;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;", //"PerformanceConnectionString": "server=112.124.13.17;database=db_performance;uid=suvalue;pwd=suvalue2016;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;",
"PerformanceConnectionString": "server=192.168.18.166;database=db_performance_screen;uid=root;pwd=1234qwer;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;" "PerformanceConnectionString": "server=192.168.18.166;database=db_beiliu2;uid=root;pwd=1234qwer;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;"
//"PerformanceConnectionString": "server=116.62.245.55;database=db_performance;uid=root;pwd=1234qwer;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;" //"PerformanceConnectionString": "server=116.62.245.55;database=db_performance;uid=root;pwd=1234qwer;pooling=true;charset=utf8;convert zero datetime=true;port=3306;connection timeout=120;max pool size=512;allow user variables=true;"
}, },
"Application": { "Application": {
......
...@@ -67,7 +67,7 @@ public AutoMapperConfigs() ...@@ -67,7 +67,7 @@ public AutoMapperConfigs()
CreateMap<PerData, im_data>() CreateMap<PerData, im_data>()
.ForMember(dest => dest.IsFactor, opt => opt.MapFrom(src => src.IsFactor ? 1 : 2)) .ForMember(dest => dest.IsFactor, opt => opt.MapFrom(src => src.IsFactor ? 1 : 2))
.ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => EnumHelper.GetItems<UnitType>().FirstOrDefault(t => t.Name == src.UnitType).Value)); .ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => EnumHelper.GetItems<UnitType>().FirstOrDefault(t => t.Name == src.UnitType.Replace("行政后勤", "行政工勤")).Value));
CreateMap<im_header, PerHeader>() CreateMap<im_header, PerHeader>()
.ForMember(dest => dest.IsMerge, opt => opt.MapFrom(src => src.IsMerge == 1 ? true : false)); .ForMember(dest => dest.IsMerge, opt => opt.MapFrom(src => src.IsMerge == 1 ? true : false));
...@@ -107,7 +107,7 @@ public AutoMapperConfigs() ...@@ -107,7 +107,7 @@ public AutoMapperConfigs()
//CreateMap<PerDataAccountBaisc, im_accountbasic>(); //CreateMap<PerDataAccountBaisc, im_accountbasic>();
//CreateMap<im_accountbasic, PerDataAccountBaisc>(); //CreateMap<im_accountbasic, PerDataAccountBaisc>();
CreateMap<PerDataAccountBaisc, im_accountbasic>() CreateMap<PerDataAccountBaisc, im_accountbasic>()
.ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => EnumHelper.GetItems<UnitType>().First(t => t.Name == src.UnitType).Value)) .ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => EnumHelper.GetItems<UnitType>().First(t => t.Name == src.UnitType.Replace("行政后勤", "行政工勤")).Value))
.ForMember(dest => dest.DoctorAccountingUnit, opt => opt.MapFrom(src => src.AccountingUnit)) .ForMember(dest => dest.DoctorAccountingUnit, opt => opt.MapFrom(src => src.AccountingUnit))
//.ForMember(dest => dest.Department, opt => opt.MapFrom(src => src.Department)) //.ForMember(dest => dest.Department, opt => opt.MapFrom(src => src.Department))
//.ForMember(dest => dest.DoctorDirectorNumber, opt => opt.MapFrom(src => src.ManagerNumber)) //.ForMember(dest => dest.DoctorDirectorNumber, opt => opt.MapFrom(src => src.ManagerNumber))
...@@ -148,7 +148,7 @@ public AutoMapperConfigs() ...@@ -148,7 +148,7 @@ public AutoMapperConfigs()
CreateMap<res_account, PerDataAccountBaisc>() CreateMap<res_account, PerDataAccountBaisc>()
.ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => src.UnitType.HasValue ? ((UnitType)src.UnitType).ToString() : "")); .ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => src.UnitType.HasValue ? ((UnitType)src.UnitType).ToString() : ""));
CreateMap<PerDataAccountBaisc, res_account>() CreateMap<PerDataAccountBaisc, res_account>()
.ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => string.IsNullOrEmpty(src.UnitType) ? -1 : EnumHelper.GetItems<UnitType>().First(t => t.Name == src.UnitType).Value)); .ForMember(dest => dest.UnitType, opt => opt.MapFrom(src => string.IsNullOrEmpty(src.UnitType) ? -1 : EnumHelper.GetItems<UnitType>().First(t => t.Name == src.UnitType.Replace("行政后勤", "行政工勤")).Value));
//CreateMap<PerDataAccountBaisc, res_accountnurse>(); //CreateMap<PerDataAccountBaisc, res_accountnurse>();
//CreateMap<res_accountdoctor, ComputeSource>(); //CreateMap<res_accountdoctor, ComputeSource>();
......
//-----------------------------------------------------------------------
// <copyright file=" per_dept_dic.cs">
// * FileName: per_dept_dic.cs
// </copyright>
//-----------------------------------------------------------------------
using Performance.EntityModels;
using System.Collections.Generic;
namespace Performance.Repository
{
/// <summary>
/// per_dept_dic Repository
/// </summary>
public partial class PerforPerdeptdicRepository : PerforRepository<per_dept_dic>
{
public IEnumerable<per_dept_dic> GetAccountBasicAccountingUnit(int hospitalId)
{
string sql = @"select * from
(
select distinct
unittype,
ifnull
(
max(case when source = '门诊' then accountingunit end),
max(case when source = '住院' then accountingunit end)
) accountingunit
from per_dept_dic
where hospitalid = @hospitalId
group by unittype,department,hisdeptname
) t
where ifnull(accountingunit, '无')<>'无'
order by unittype,accountingunit;";
return DapperQuery<per_dept_dic>(sql, new { hospitalId });
}
}
}
...@@ -708,13 +708,7 @@ public List<DeptResponse> GetAdminPerformance(int allotId) ...@@ -708,13 +708,7 @@ public List<DeptResponse> GetAdminPerformance(int allotId)
result.AddRange(hideOtherResult); result.AddRange(hideOtherResult);
#endregion #endregion
var enumItems = EnumHelper.GetItems<UnitType>(); var enumItems = UnitTypeUtil.GetUnitTypeFromEnum();
enumItems.ForEach(t =>
{
t.Value = UnitTypeUtil.Is(t.Name, UnitType.护理组.ToString()) ? t.Value + 2 : t.Value;
t.Name = t.Name == "行政后勤" ? UnitType.行政工勤.ToString() : t.Name;
});
result = result.OrderBy(t => enumItems.FirstOrDefault(e => e.Name == t.UnitName)?.Value).ThenBy(t => t.AccountingUnit).ToList(); result = result.OrderBy(t => enumItems.FirstOrDefault(e => e.Name == t.UnitName)?.Value).ThenBy(t => t.AccountingUnit).ToList();
return result; return result;
} }
...@@ -1747,7 +1741,7 @@ public ag_secondallot GetAccountId(int secondId, out int accountId) ...@@ -1747,7 +1741,7 @@ public ag_secondallot GetAccountId(int secondId, out int accountId)
var second = _perforAgsecondallotRepository.GetEntity(t => t.Id == secondId); var second = _perforAgsecondallotRepository.GetEntity(t => t.Id == secondId);
if (second != null) if (second != null)
{ {
var unitType = EnumHelper.GetItems<UnitType>().FirstOrDefault(t => t.Name == second.UnitType); var unitType = UnitTypeUtil.GetUnitTypeFromEnum(second.UnitType);
var account = perforResaccountRepository.GetEntity(t => t.AllotID == second.AllotId && t.UnitType == unitType.Value && t.AccountingUnit == second.Department); var account = perforResaccountRepository.GetEntity(t => t.AllotID == second.AllotId && t.UnitType == unitType.Value && t.AccountingUnit == second.Department);
if (account == null && second.UnitType != UnitType.特殊核算组.ToString()) if (account == null && second.UnitType != UnitType.特殊核算组.ToString())
throw new PerformanceException("科室信息错误"); throw new PerformanceException("科室信息错误");
......
...@@ -609,7 +609,7 @@ public HandsonTableBase GetBatchAccountingStructrue(int AllotId) ...@@ -609,7 +609,7 @@ public HandsonTableBase GetBatchAccountingStructrue(int AllotId)
if (column.Data == "核算组别") if (column.Data == "核算组别")
{ {
column.Type = "autocomplete"; column.Type = "autocomplete";
column.Source = EnumHelper.GetItems<UnitType>().Select(w => w.Description).ToArray(); column.Source = UnitTypeUtil.GetUnitTypeFromEnum().Select(w => w.Description).ToArray();
column.Strict = true; column.Strict = true;
} }
if (column.Data == "核算单元编码") if (column.Data == "核算单元编码")
...@@ -628,7 +628,7 @@ public ApiResponse BatchSaveAccounting(int allotId, SaveCollectData request) ...@@ -628,7 +628,7 @@ public ApiResponse BatchSaveAccounting(int allotId, SaveCollectData request)
if (dicData == null || !dicData.Any()) throw new PerformanceException("未提交数据"); if (dicData == null || !dicData.Any()) throw new PerformanceException("未提交数据");
var getAccounts = _cofaccountingRepository.GetEntities(t => t.AllotId == allotId) ?? new List<cof_accounting>(); var getAccounts = _cofaccountingRepository.GetEntities(t => t.AllotId == allotId) ?? new List<cof_accounting>();
var unitType = EnumHelper.GetItems<UnitType>().Select(w => w.Description).ToArray(); var unitType = UnitTypeUtil.GetUnitTypeFromEnum().Select(w => w.Description).ToArray();
var json = JsonHelper.Serialize(dicData); var json = JsonHelper.Serialize(dicData);
var accounts = JsonHelper.Deserialize<List<cof_accounting>>(json) var accounts = JsonHelper.Deserialize<List<cof_accounting>>(json)
...@@ -1354,7 +1354,7 @@ public HandsonTableBase QueryHandsCustom(CustomPagingRequest request) ...@@ -1354,7 +1354,7 @@ public HandsonTableBase QueryHandsCustom(CustomPagingRequest request)
if (dicCustom.FirstOrDefault(t => t.Comment.Equals(column.Data)).Name.ToLower() == "unittype") if (dicCustom.FirstOrDefault(t => t.Comment.Equals(column.Data)).Name.ToLower() == "unittype")
{ {
column.Type = "autocomplete"; column.Type = "autocomplete";
column.Source = EnumHelper.GetItems<UnitType>().Select(w => w.Description).ToArray(); column.Source = UnitTypeUtil.GetUnitTypeFromEnum().Select(w => w.Description).ToArray();
column.Strict = true; column.Strict = true;
} }
......
using Dapper; using Dapper;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using MySql.Data.MySqlClient; using MySql.Data.MySqlClient;
using Performance.DtoModels;
using Performance.DtoModels.AppSettings; using Performance.DtoModels.AppSettings;
using Performance.EntityModels;
using System; using System;
using System.Collections.Generic;
using System.Data; using System.Data;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Performance.Services namespace Performance.Services
...@@ -102,7 +106,7 @@ public void ClearAllotSync() ...@@ -102,7 +106,7 @@ public void ClearAllotSync()
}); });
} }
#endregion #endregion
public void SyncDataToResult(int allotId) public void SyncDataToResult(int allotId)
{ {
using (var connection = new MySqlConnection(_options.Value.PerformanceConnectionString)) using (var connection = new MySqlConnection(_options.Value.PerformanceConnectionString))
...@@ -119,5 +123,90 @@ public void SyncDataToResult(int allotId) ...@@ -119,5 +123,90 @@ public void SyncDataToResult(int allotId)
} }
} }
} }
#region 数据提取
public IEnumerable<per_dept_dic> GetAccountBasicAccountingUnit(int hospitalId)
{
using (var connection = new MySqlConnection(_options.Value.PerformanceConnectionString))
{
if (connection.State != ConnectionState.Open) connection.Open();
try
{
string sql = @"select * from
(
select distinct
unittype,
ifnull
(
max(case when source = '门诊' then accountingunit end),
max(case when source = '住院' then accountingunit end)
) accountingunit
from per_dept_dic
where hospitalid = @hospitalId
group by unittype,department,hisdeptname
) t
where ifnull(accountingunit, '无')<>'无'
order by unittype,accountingunit;";
return connection.Query<per_dept_dic>(sql, new { hospitalId }, commandTimeout: 60 * 60);
}
catch (Exception)
{
throw;
}
}
}
public IEnumerable<DeptdicResponse> GetDepartments(int allotId)
{
using (var connection = new MySqlConnection(_options.Value.PerformanceConnectionString))
{
if (connection.State != ConnectionState.Open) connection.Open();
try
{
var depts = connection.Query<per_dept_dic>("select * from per_dept_dic where allotid = @allotid", new { allotId }, commandTimeout: 60 * 60);
if (depts == null || !depts.Any()) return null;
var allot = connection.QueryFirstOrDefault<per_allot>("select * from per_allot where id = @allotid", new { allotId }, commandTimeout: 60 * 60);
if (allot == null || !depts.Any()) return null;
Deptdic GetDeptdic(List<per_dept_dic> dics, string department, string hISDeptName, UnitType unitType, string source = "")
{
var dic = dics.FirstOrDefault(group => group.Department == department && group.HISDeptName == hISDeptName && group.UnitType == unitType.ToString() && group.Source == source);
if (dic == null)
dic = dics.FirstOrDefault(group => group.Department == department && group.HISDeptName == hISDeptName && group.UnitType == unitType.ToString());
if (dic == null) return new Deptdic() { IsVerify = 1 };
return new Deptdic { Id = dic.Id, AccountingUnit = dic.AccountingUnit, IsVerify = dic.IsVerify ?? 1, VerifyMessage = dic.VerifyMessage, };
}
var result = depts
.GroupBy(t => new { t.HISDeptName, t.Department })
.Select(t => new DeptdicResponse
{
HospitalId = allot.HospitalId,
HISDeptName = t.Key.HISDeptName,
Department = t.Key.Department,
OutDoctorAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.医生组, "门诊"),
OutNurseAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.护理组, "门诊"),
OutTechnicAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.医技组, "门诊"),
InpatDoctorAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.医生组, "住院"),
InpatNurseAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.护理组, "住院"),
InpatTechnicAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.医技组, "住院"),
LogisticsAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.行政工勤),
SpecialAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.特殊核算组),
CreateTime = t.Max(group => group.CreateTime),
IsVerify = t.Min(w => w.IsVerify) ?? 1,
});
return result.OrderBy(w => w.IsVerify).ThenByDescending(t => t.CreateTime).ThenBy(t => t.Department);
}
catch (Exception)
{
throw;
}
}
}
#endregion
} }
} }
...@@ -1230,7 +1230,7 @@ public ComparisonResponse<DtoModels.Comparison<view_check_emp>> GetComparison(Co ...@@ -1230,7 +1230,7 @@ public ComparisonResponse<DtoModels.Comparison<view_check_emp>> GetComparison(Co
result.Datas = peremployeeRepository.CheckAccountingUnitRealGiveFeeDiff(request); result.Datas = peremployeeRepository.CheckAccountingUnitRealGiveFeeDiff(request);
result.Datas.Datas.ForEach(t => result.Datas.Datas.ForEach(t =>
{ {
t.UnitTypeId = EnumHelper.GetItems<UnitType>().FirstOrDefault(e => e.Name == t.UnitType).Value; t.UnitTypeId = UnitTypeUtil.GetUnitTypeFromEnum(t.UnitType).Value;
}); });
} }
else if (request.ViewName == "view_check_emp") else if (request.ViewName == "view_check_emp")
......
...@@ -33,6 +33,7 @@ public class ExtractService : IAutoInjection ...@@ -33,6 +33,7 @@ public class ExtractService : IAutoInjection
private readonly PerforPerdeptdicRepository perdeptdicRepository; private readonly PerforPerdeptdicRepository perdeptdicRepository;
private readonly PerforCofdrugtypefactorRepository drugtypefactorRepository; private readonly PerforCofdrugtypefactorRepository drugtypefactorRepository;
private readonly PerforExresultRepository exresultRepository; private readonly PerforExresultRepository exresultRepository;
private readonly DapperService dapperService;
public ExtractService( public ExtractService(
ILogger<ExtractService> logger, ILogger<ExtractService> logger,
...@@ -51,7 +52,8 @@ public class ExtractService : IAutoInjection ...@@ -51,7 +52,8 @@ public class ExtractService : IAutoInjection
PerforPeremployeeRepository peremployeeRepository, PerforPeremployeeRepository peremployeeRepository,
PerforPerdeptdicRepository perdeptdicRepository, PerforPerdeptdicRepository perdeptdicRepository,
PerforCofdrugtypefactorRepository drugtypefactorRepository, PerforCofdrugtypefactorRepository drugtypefactorRepository,
PerforExresultRepository exresultRepository PerforExresultRepository exresultRepository,
DapperService dapperService
) )
{ {
this.logger = logger; this.logger = logger;
...@@ -71,6 +73,7 @@ PerforExresultRepository exresultRepository ...@@ -71,6 +73,7 @@ PerforExresultRepository exresultRepository
this.perdeptdicRepository = perdeptdicRepository; this.perdeptdicRepository = perdeptdicRepository;
this.drugtypefactorRepository = drugtypefactorRepository; this.drugtypefactorRepository = drugtypefactorRepository;
this.exresultRepository = exresultRepository; this.exresultRepository = exresultRepository;
this.dapperService = dapperService;
} }
/// <summary> /// <summary>
...@@ -270,7 +273,7 @@ private object GetDataBySheetType(int hospitalId, SheetType sheetType, List<Extr ...@@ -270,7 +273,7 @@ private object GetDataBySheetType(int hospitalId, SheetType sheetType, List<Extr
return employeeDict; return employeeDict;
case SheetType.AccountBasic: case SheetType.AccountBasic:
return perdeptdicRepository.GetAccountBasicAccountingUnit(hospitalId); return dapperService.GetAccountBasicAccountingUnit(hospitalId);
default: default:
return extractDto; return extractDto;
...@@ -296,7 +299,7 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, int allotId, List< ...@@ -296,7 +299,7 @@ private List<ExtractTransDto> StandDataFormat(int hospitalId, int allotId, List<
var types = extypeRepository.GetEntities(w => w.HospitalId == hospitalId) ?? new List<ex_type>(); var types = extypeRepository.GetEntities(w => w.HospitalId == hospitalId) ?? new List<ex_type>();
var dict = personService.GetDepartments(allotId)?.ToList(); var dict = dapperService.GetDepartments(allotId)?.ToList();
if (dict == null || !dict.Any()) if (dict == null || !dict.Any())
{ {
return results.GroupBy(t => new { t.Department, t.Category, t.Source }).Select(t => new ExtractTransDto return results.GroupBy(t => new { t.Department, t.Category, t.Source }).Select(t => new ExtractTransDto
......
...@@ -229,7 +229,7 @@ public List<TitleValue> Accounting(int allotId) ...@@ -229,7 +229,7 @@ public List<TitleValue> Accounting(int allotId)
/// <returns></returns> /// <returns></returns>
public List<EnumItem> UnitType() public List<EnumItem> UnitType()
{ {
return EnumHelper.GetItems<UnitType>(); return UnitTypeUtil.GetUnitTypeFromEnum();
} }
} }
} }
...@@ -159,7 +159,7 @@ private List<HistoryData> ReadExcelData(int hospitalid, string path) ...@@ -159,7 +159,7 @@ private List<HistoryData> ReadExcelData(int hospitalid, string path)
var departmentDict = perdeptdicRepository.GetEntities(t => t.HospitalId == hospitalid); var departmentDict = perdeptdicRepository.GetEntities(t => t.HospitalId == hospitalid);
if (departmentDict != null && departmentDict.Any()) if (departmentDict != null && departmentDict.Any())
{ {
var unittype = EnumHelper.GetItems<UnitType>(); var unittype = UnitTypeUtil.GetUnitTypeFromEnum();
entities.ForEach(t => entities.ForEach(t =>
{ {
var accountingUnits = departmentDict.Where(w => w.Department == t.Department && w.Source == t.SourceType); var accountingUnits = departmentDict.Where(w => w.Department == t.Department && w.Source == t.SourceType);
......
...@@ -197,7 +197,7 @@ private bool EditAccountBasic(int userId, OriginalRequest request) ...@@ -197,7 +197,7 @@ private bool EditAccountBasic(int userId, OriginalRequest request)
if (request.Cell.FieldName == "核算单元类型") if (request.Cell.FieldName == "核算单元类型")
{ {
var cellvalue = EnumHelper.GetItems<UnitType>().FirstOrDefault(t => t.Name == request.Cell.CellValue.ToString()); var cellvalue = UnitTypeUtil.GetUnitTypeFromEnum().FirstOrDefault(t => t.Name == request.Cell.CellValue.ToString());
if (cellvalue == null) return false; if (cellvalue == null) return false;
if (cellvalue.Value == basic.UnitType) return true; if (cellvalue.Value == basic.UnitType) return true;
request.Cell.CellValue = cellvalue.Value; request.Cell.CellValue = cellvalue.Value;
......
...@@ -52,7 +52,7 @@ public PerSheet MergeCompute(PerExcel excel, List<EntityModels.cof_income> incom ...@@ -52,7 +52,7 @@ public PerSheet MergeCompute(PerExcel excel, List<EntityModels.cof_income> incom
//判断是否创建头部 //判断是否创建头部
if (!isHasData && dataList != null && dataList.Count() > 0) if (!isHasData && dataList != null && dataList.Count() > 0)
isHasData = true; isHasData = true;
foreach (var item in EnumHelper.GetItems<UnitType>().Where(t => t.Value <= 3)) foreach (var item in UnitTypeUtil.GetUnitTypeFromEnum().Where(t => t.Value <= 3))
{ {
var group = dataList.Where(t => t.UnitType == item.Name); var group = dataList.Where(t => t.UnitType == item.Name);
...@@ -161,7 +161,7 @@ public PerSheet OnceCompute(PerSheet sheet) ...@@ -161,7 +161,7 @@ public PerSheet OnceCompute(PerSheet sheet)
var typeClass = dataList.Where(t => header.Children.Select(s => s.CellValue).Contains(t.TypeName)); var typeClass = dataList.Where(t => header.Children.Select(s => s.CellValue).Contains(t.TypeName));
int pointcell = 0; int pointcell = 0;
foreach (var item in EnumHelper.GetItems<UnitType>().Where(t => t.Value <= 3)) foreach (var item in UnitTypeUtil.GetUnitTypeFromEnum().Where(t => t.Value <= 3))
{ {
pointcell++; pointcell++;
var group = typeClass.Where(t => t.UnitType == item.Name); var group = typeClass.Where(t => t.UnitType == item.Name);
......
...@@ -258,7 +258,7 @@ public ApiResponse CreatePerson(PerEmployeeResponse request) ...@@ -258,7 +258,7 @@ public ApiResponse CreatePerson(PerEmployeeResponse request)
if (employee != null) if (employee != null)
throw new PerformanceException($"员工工号为{request.PersonnelNumber}的数据已存在!"); throw new PerformanceException($"员工工号为{request.PersonnelNumber}的数据已存在!");
var unittype = EnumHelper.GetItems<UnitType>().Select(t => t.Description).ToList(); var unittype = UnitTypeUtil.GetUnitTypeFromEnum().Select(t => t.Description).ToList();
unittype.AddRange(EnumHelper.GetItems<AccountUnitType>().Select(t => t.Description)); unittype.AddRange(EnumHelper.GetItems<AccountUnitType>().Select(t => t.Description));
if (!unittype.Contains(request.UnitType)) if (!unittype.Contains(request.UnitType))
...@@ -323,7 +323,7 @@ public ApiResponse UpdatePerson(PerEmployeeResponse request) ...@@ -323,7 +323,7 @@ public ApiResponse UpdatePerson(PerEmployeeResponse request)
if (employees.Count() > 1) if (employees.Count() > 1)
throw new PerformanceException($"工号为“{request.PersonnelNumber}”存在多条数据,请删除多余数据!"); throw new PerformanceException($"工号为“{request.PersonnelNumber}”存在多条数据,请删除多余数据!");
var unittype = EnumHelper.GetItems<UnitType>().Select(t => t.Description).ToList(); var unittype = UnitTypeUtil.GetUnitTypeFromEnum().Select(t => t.Description).ToList();
unittype.AddRange(EnumHelper.GetItems<AccountUnitType>().Select(t => t.Description)); unittype.AddRange(EnumHelper.GetItems<AccountUnitType>().Select(t => t.Description));
if (!unittype.Contains(request.UnitType)) if (!unittype.Contains(request.UnitType))
...@@ -388,6 +388,8 @@ public bool DeleteAllPerson(int allotId) ...@@ -388,6 +388,8 @@ public bool DeleteAllPerson(int allotId)
return peremployeeRepository.RemoveRange(employees.ToArray()); return peremployeeRepository.RemoveRange(employees.ToArray());
} }
#region 弃用
///// <summary> ///// <summary>
///// 检查核算单元是否已存在 ///// 检查核算单元是否已存在
///// </summary> ///// </summary>
...@@ -415,44 +417,44 @@ public bool DeleteAllPerson(int allotId) ...@@ -415,44 +417,44 @@ public bool DeleteAllPerson(int allotId)
/// </summary> /// </summary>
/// <param name="allotId"></param> /// <param name="allotId"></param>
/// <returns></returns> /// <returns></returns>
public IEnumerable<DeptdicResponse> GetDepartments(int allotId) //public IEnumerable<DeptdicResponse> GetDepartments(int allotId)
{ //{
var depts = perdeptdicRepository.GetEntities(t => t.AllotId == allotId); // var depts = perdeptdicRepository.GetEntities(t => t.AllotId == allotId);
if (depts == null || !depts.Any()) return null; // if (depts == null || !depts.Any()) return null;
var allot = perallotRepository.GetEntity(t => t.ID == allotId); // var allot = perallotRepository.GetEntity(t => t.ID == allotId);
if (allot == null || !depts.Any()) return null; // if (allot == null || !depts.Any()) return null;
Deptdic GetDeptdic(List<per_dept_dic> dics, string department, string hISDeptName, UnitType unitType, string source = "") // Deptdic GetDeptdic(List<per_dept_dic> dics, string department, string hISDeptName, UnitType unitType, string source = "")
{ // {
var dic = dics.FirstOrDefault(group => group.Department == department && group.HISDeptName == hISDeptName && group.UnitType == unitType.ToString() && group.Source == source); // var dic = dics.FirstOrDefault(group => group.Department == department && group.HISDeptName == hISDeptName && group.UnitType == unitType.ToString() && group.Source == source);
if (dic == null) // if (dic == null)
dic = dics.FirstOrDefault(group => group.Department == department && group.HISDeptName == hISDeptName && group.UnitType == unitType.ToString()); // dic = dics.FirstOrDefault(group => group.Department == department && group.HISDeptName == hISDeptName && group.UnitType == unitType.ToString());
if (dic == null) return new Deptdic() { IsVerify = 1 }; // if (dic == null) return new Deptdic() { IsVerify = 1 };
return new Deptdic { Id = dic.Id, AccountingUnit = dic.AccountingUnit, IsVerify = dic.IsVerify ?? 1, VerifyMessage = dic.VerifyMessage, }; // return new Deptdic { Id = dic.Id, AccountingUnit = dic.AccountingUnit, IsVerify = dic.IsVerify ?? 1, VerifyMessage = dic.VerifyMessage, };
} // }
var result = depts // var result = depts
.GroupBy(t => new { t.HISDeptName, t.Department }) // .GroupBy(t => new { t.HISDeptName, t.Department })
.Select(t => new DeptdicResponse // .Select(t => new DeptdicResponse
{ // {
HospitalId = allot.HospitalId, // HospitalId = allot.HospitalId,
HISDeptName = t.Key.HISDeptName, // HISDeptName = t.Key.HISDeptName,
Department = t.Key.Department, // Department = t.Key.Department,
OutDoctorAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.医生组, "门诊"), // OutDoctorAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.医生组, "门诊"),
OutNurseAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.护理组, "门诊"), // OutNurseAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.护理组, "门诊"),
OutTechnicAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.医技组, "门诊"), // OutTechnicAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.医技组, "门诊"),
InpatDoctorAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.医生组, "住院"), // InpatDoctorAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.医生组, "住院"),
InpatNurseAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.护理组, "住院"), // InpatNurseAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.护理组, "住院"),
InpatTechnicAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.医技组, "住院"), // InpatTechnicAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.医技组, "住院"),
LogisticsAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.行政工勤), // LogisticsAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.行政工勤),
SpecialAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.特殊核算组), // SpecialAccounting = GetDeptdic(t.ToList(), t.Key.Department, t.Key.HISDeptName, UnitType.特殊核算组),
CreateTime = t.Max(group => group.CreateTime), // CreateTime = t.Max(group => group.CreateTime),
IsVerify = t.Min(w => w.IsVerify) ?? 1, // IsVerify = t.Min(w => w.IsVerify) ?? 1,
}); // });
return result.OrderBy(w => w.IsVerify).ThenByDescending(t => t.CreateTime).ThenBy(t => t.Department); // return result.OrderBy(w => w.IsVerify).ThenByDescending(t => t.CreateTime).ThenBy(t => t.Department);
} //}
//private (string dept, string[] unittype) GetDeptByUser(int userId) //private (string dept, string[] unittype) GetDeptByUser(int userId)
//{ //{
...@@ -472,6 +474,8 @@ Deptdic GetDeptdic(List<per_dept_dic> dics, string department, string hISDeptNam ...@@ -472,6 +474,8 @@ Deptdic GetDeptdic(List<per_dept_dic> dics, string department, string hISDeptNam
// return ("", new string[] { }); // return ("", new string[] { });
//} //}
#endregion
/// <summary> /// <summary>
/// 创建科室核算信息 /// 创建科室核算信息
/// </summary> /// </summary>
...@@ -755,7 +759,7 @@ public HandsonTableBase GetBatchPersonStructrue(int allotId) ...@@ -755,7 +759,7 @@ public HandsonTableBase GetBatchPersonStructrue(int allotId)
if (column.Data == "核算组别") if (column.Data == "核算组别")
{ {
column.Type = "autocomplete"; column.Type = "autocomplete";
column.Source = EnumHelper.GetItems<UnitType>().Select(w => w.Description).ToArray(); column.Source = UnitTypeUtil.GetUnitTypeFromEnum().Select(w => w.Description).ToArray();
column.Strict = true; column.Strict = true;
} }
else if (new[] { "出勤天数", "预留比例" }.Contains(column.Data)) else if (new[] { "出勤天数", "预留比例" }.Contains(column.Data))
......
...@@ -1573,7 +1573,7 @@ private List<ag_secondallot> SecondList(per_allot allot, List<res_account> accou ...@@ -1573,7 +1573,7 @@ private List<ag_secondallot> SecondList(per_allot allot, List<res_account> accou
Status = 1, Status = 1,
}; };
}); });
var enums = EnumHelper.GetItems<UnitType>(); var enums = UnitTypeUtil.GetUnitTypeFromEnum();
return result.Where(w => w.RealGiveFee.HasValue && w.RealGiveFee != 0) return result.Where(w => w.RealGiveFee.HasValue && w.RealGiveFee != 0)
.OrderBy(t => t.Status == 4 ? 2 : t.Status) .OrderBy(t => t.Status == 4 ? 2 : t.Status)
.ThenBy(t => enums.FirstOrDefault(f => f.Name == t.UnitType)?.Value) .ThenBy(t => enums.FirstOrDefault(f => f.Name == t.UnitType)?.Value)
......
using Performance.DtoModels; using Performance.DtoModels;
using Performance.Infrastructure;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -92,6 +93,22 @@ public static bool Is(string unit, params string[] types) ...@@ -92,6 +93,22 @@ public static bool Is(string unit, params string[] types)
{ {
return !string.IsNullOrEmpty(unit) && types.Any(w => IsEqualsUnitType(w, unit)); return !string.IsNullOrEmpty(unit) && types.Any(w => IsEqualsUnitType(w, unit));
} }
public static EnumItem GetUnitTypeFromEnum(string unitType)
{
unitType = unitType.Replace("行政后勤", "行政工勤");
return EnumHelper.GetItems<UnitType>().FirstOrDefault(t => t.Name == unitType);
}
public static List<EnumItem> GetUnitTypeFromEnum( )
{
var enumItems = EnumHelper.GetItems<UnitType>() ;
enumItems.ForEach(t =>
{
t.Value = Is(t.Name, UnitType.护理组.ToString()) ? t.Value + 2 : t.Value;
t.Name = t.Name == "行政后勤" ? UnitType.行政工勤.ToString() : t.Name;
});
return enumItems;
}
} }
public class AccountTypeUnit public class AccountTypeUnit
......
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