Auto stash before merge of "develop" and "origin/develop"

parent e91e20ff
...@@ -18,11 +18,17 @@ namespace Performance.Api.Controllers ...@@ -18,11 +18,17 @@ namespace Performance.Api.Controllers
[Route("api/[controller]")] [Route("api/[controller]")]
public class ConfigController : Controller public class ConfigController : Controller
{ {
private readonly ClaimService _claim;
private readonly ConfigService _configService; private readonly ConfigService _configService;
private readonly AllotService _allotService; private readonly AllotService _allotService;
private readonly DictionaryService _dictionaryService; private readonly DictionaryService _dictionaryService;
public ConfigController(ConfigService configService, AllotService allotService, DictionaryService dictionaryService) public ConfigController(
ClaimService claim,
ConfigService configService,
AllotService allotService,
DictionaryService dictionaryService)
{ {
_claim = claim;
_configService = configService; _configService = configService;
_allotService = allotService; _allotService = allotService;
_dictionaryService = dictionaryService; _dictionaryService = dictionaryService;
...@@ -882,7 +888,7 @@ public ApiResponse GetCustomList([FromBody] CustomPagingRequest request) ...@@ -882,7 +888,7 @@ public ApiResponse GetCustomList([FromBody] CustomPagingRequest request)
if (allot == null) if (allot == null)
return new ApiResponse(ResponseType.ParameterError, "AllotID错误"); return new ApiResponse(ResponseType.ParameterError, "AllotID错误");
return _configService.QueryCustom(request); return _configService.QueryCustom(_claim.GetUserId(), request);
} }
/// <summary> /// <summary>
......
...@@ -496,6 +496,36 @@ public List<dynamic> QueryComputeByDateAndTotal(string viewName, HospitalGrantSu ...@@ -496,6 +496,36 @@ public List<dynamic> QueryComputeByDateAndTotal(string viewName, HospitalGrantSu
} }
} }
/// <summary>
/// 科室
/// </summary>
/// <param name="tableName"></param>
/// <param name="allotId"></param>
/// <param name="accountingUnit"></param>
/// <param name="unitType"></param>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
public CustonPagingData QueryCustom(string tableName, int allotId, string accountingUnit, string[] unitType, int pageIndex = 1, int pageSize = 20)
{
string dataQuery = $@"SELECT * FROM {tableName} WHERE AllotId = @AllotId and AccountingUnit = @accountingUnit and UnitType in @unitType order by UnitType,AccountingUnit LIMIT {(pageIndex - 1) * pageSize},{pageSize} ";
string countQuery = $@"SELECT COUNT(*) FROM {tableName} WHERE AllotId = @AllotId and AccountingUnit = @accountingUnit and UnitType in @unitType ";
var result = new CustonPagingData
{
DataList = DapperQuery<dynamic>(dataQuery, new { allotId, unitType, accountingUnit })?.ToList(),
TotalCount = DapperQuery<int>(countQuery, new { allotId, unitType, accountingUnit })?.FirstOrDefault() ?? 0,
};
return result;
}
/// <summary>
/// 管理员
/// </summary>
/// <param name="request"></param>
/// <param name="IsHead"></param>
/// <returns></returns>
public CustonPagingData QueryCustom(CustomPagingRequest request, bool IsHead) public CustonPagingData QueryCustom(CustomPagingRequest request, bool IsHead)
{ {
var result = new CustonPagingData(); var result = new CustonPagingData();
......
...@@ -20,6 +20,8 @@ public class ConfigService : IAutoInjection ...@@ -20,6 +20,8 @@ public class ConfigService : IAutoInjection
{ {
private readonly IMapper _mapper; private readonly IMapper _mapper;
#region #region
private readonly UserService _userService;
private readonly RoleService _roleService;
private readonly PerforCofdirectorRepository _directorRepository; private readonly PerforCofdirectorRepository _directorRepository;
//private readonly PerforCofdrugpropRepository _drugpropRepository; //private readonly PerforCofdrugpropRepository _drugpropRepository;
private readonly PerforCofworkitemRepository _workitemRepository; private readonly PerforCofworkitemRepository _workitemRepository;
...@@ -48,6 +50,8 @@ public class ConfigService : IAutoInjection ...@@ -48,6 +50,8 @@ public class ConfigService : IAutoInjection
public ConfigService( public ConfigService(
IMapper mapper, IMapper mapper,
UserService userService,
RoleService roleService,
PerforCofdirectorRepository cofdirectorRepository, PerforCofdirectorRepository cofdirectorRepository,
//PerforCofdrugpropRepository cofdrugpropRepository, //PerforCofdrugpropRepository cofdrugpropRepository,
PerforCofagainRepository againRepository, PerforCofagainRepository againRepository,
...@@ -75,6 +79,8 @@ public class ConfigService : IAutoInjection ...@@ -75,6 +79,8 @@ public class ConfigService : IAutoInjection
PerforReportRepository perforReport) PerforReportRepository perforReport)
{ {
_mapper = mapper; _mapper = mapper;
_userService = userService;
_roleService = roleService;
this._directorRepository = cofdirectorRepository; this._directorRepository = cofdirectorRepository;
//this._drugpropRepository = cofdrugpropRepository; //this._drugpropRepository = cofdrugpropRepository;
this._workitemRepository = workitemRepository; this._workitemRepository = workitemRepository;
...@@ -1935,10 +1941,8 @@ public ApiResponse SaveCustomTable(SaveCustomData request) ...@@ -1935,10 +1941,8 @@ public ApiResponse SaveCustomTable(SaveCustomData request)
} }
public ApiResponse QueryCustom(CustomPagingRequest request) public ApiResponse QueryCustom(int userId, CustomPagingRequest request)
{ {
var result = new CustomResponse();
var heads = perforReport.QueryCustomColumn(request.TableName); var heads = perforReport.QueryCustomColumn(request.TableName);
var isExist = perforReport.QueryIsAllotId(request.TableName, "AllotId", "AccountingUnit", "UnitType"); var isExist = perforReport.QueryIsAllotId(request.TableName, "AllotId", "AccountingUnit", "UnitType");
if (isExist == false || heads == null) if (isExist == false || heads == null)
...@@ -1955,7 +1959,24 @@ public ApiResponse QueryCustom(CustomPagingRequest request) ...@@ -1955,7 +1959,24 @@ public ApiResponse QueryCustom(CustomPagingRequest request)
if (customGroup.Any()) if (customGroup.Any())
return new ApiResponse(ResponseType.ParameterError, "表不符合规范,请补全注释或修改重复注释"); return new ApiResponse(ResponseType.ParameterError, "表不符合规范,请补全注释或修改重复注释");
result.Heads = headList.ToList(); Dictionary<int, string[]> dic = new Dictionary<int, string[]>
{
{ (int)Role.科主任, new[]{ UnitType.医生组.ToString(), UnitType.其他医生组.ToString(), UnitType.医技组.ToString(), UnitType.其他医技组.ToString() } },
{ (int)Role.护士长, new[]{ UnitType.护理组.ToString(), UnitType.其他护理组.ToString()} },
{ (int)Role.特殊科室, new[]{ UnitType.特殊核算组.ToString() }},
{ (int)Role.行政科室, new[]{ UnitType.行政后勤.ToString() } },
};
var user = _userService.GetUser(userId);
var roleType = _roleService.GetUserRole(userId)?.FirstOrDefault()?.Type ?? 0;
var result = new CustomResponse
{
Heads = headList.ToList()
};
if (dic.Keys.Contains(roleType))
result.Datas = perforReport.QueryCustom(request.TableName, request.AllotId, user?.Department ?? "", dic[roleType], request.PageIndex, request.PageSize);
else
result.Datas = perforReport.QueryCustom(request, false); result.Datas = perforReport.QueryCustom(request, false);
return new ApiResponse(ResponseType.OK, result); return new ApiResponse(ResponseType.OK, result);
......
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