Commit 3cea149b by lcx

修改数据录入权限来源

parent 919bd101
......@@ -79,5 +79,20 @@ public class collect_data
/// 单元格value
/// </summary>
public string CellValue { get; set; }
/// <summary>
/// 1 保存 2 提交 3 审核通过 4 驳回
/// </summary>
public int Status { get; set; }
/// <summary>
/// 保存数据的用户
/// </summary>
public int SavedUser { get; set; }
/// <summary>
/// 保存数据的时间
/// </summary>
public int SavedTime { get; set; }
}
}
......@@ -31,6 +31,8 @@ public class CollectService : IAutoInjection
private readonly PerforUserroleRepository userroleRepository;
private readonly PerforImaccountbasicRepository perforImaccountbasicRepository;
private readonly PerforPerdeptdicRepository perforPerdeptdicRepository;
private readonly PerforExmoduleRepository exmoduleRepository;
private readonly PerforExitemRepository exitemRepository;
private readonly SheetSevice sheetSevice;
private readonly Application options;
......@@ -48,6 +50,8 @@ public class CollectService : IAutoInjection
PerforUserroleRepository userroleRepository,
PerforImaccountbasicRepository perforImaccountbasicRepository,
PerforPerdeptdicRepository perforPerdeptdicRepository,
PerforExmoduleRepository exmoduleRepository,
PerforExitemRepository exitemRepository,
SheetSevice sheetSevice,
IOptions<Application> options)
{
......@@ -64,6 +68,8 @@ public class CollectService : IAutoInjection
this.userroleRepository = userroleRepository;
this.perforImaccountbasicRepository = perforImaccountbasicRepository;
this.perforPerdeptdicRepository = perforPerdeptdicRepository;
this.exmoduleRepository = exmoduleRepository;
this.exitemRepository = exitemRepository;
this.sheetSevice = sheetSevice;
this.options = options.Value;
}
......@@ -92,37 +98,38 @@ public IEnumerable<CollectPermission> GetCollectContent(int hospitalId, int user
(int)SheetType.AccountDrugAssess, (int)SheetType.AccountMaterialsAssess, (int)SheetType.AccountScoreAverage,
(int)SheetType.BudgetRatio, (int)SheetType.AssessBeforeOtherFee };
var sheets = perforPersheetRepository.GetEntities(w => w.AllotID == allot.ID && types.Contains((w.SheetType ?? 0)));
var headers = perforImheaderRepository.GetEntities(w => w.AllotID == allot.ID);
var permissions = perforcollectpermissionRepository.GetEntities(w => w.HospitalId == hospitalId && w.UserId == userId);
var sheets = exmoduleRepository.GetEntities(w => w.HospitalId == hospitalId && types.Contains(w.SheetType ?? 0));
if (sheets == null || !sheets.Any())
return null;
var headers = exitemRepository.GetEntities(w => sheets.Select(m => m.Id).Contains(w.ModuleId ?? 0));
if (headers == null || !headers.Any())
return null;
var permissions = perforcollectpermissionRepository.GetEntities(w => w.HospitalId == hospitalId && w.UserId == userId);
// 查询sheet和列头对应
var sheetHeads = from sheet in sheets
join head in headers on sheet.ID equals head.SheetID
select new { sheet.SheetName, sheet.SheetType, HeadName = head.CellValue };
join head in headers on sheet.Id equals head.ModuleId
select new { sheet.ModuleName, sheet.SheetType, HeadName = head.ItemName };
List<CollectPermission> result;
// 查询列头和权限对应
if (permissions == null)
{
result = sheetHeads.Select(sh => new CollectPermission { HospitalId = hospitalId, SheetName = sh.SheetName, SheetType = sh.SheetType.Value, HeadName = sh.HeadName })?.ToList();
result = sheetHeads.Select(sh => new CollectPermission { HospitalId = hospitalId, SheetName = sh.ModuleName, SheetType = sh.SheetType.Value, HeadName = sh.HeadName })?.ToList();
}
else
{
result = (from sh in sheetHeads
join pmss in permissions on new { sh.SheetName, sh.HeadName } equals new { pmss.SheetName, pmss.HeadName }
join pmss in permissions on new { SheetName = sh.ModuleName, sh.HeadName } equals new { pmss.SheetName, pmss.HeadName }
into emppmss
from item in emppmss.DefaultIfEmpty()
select new CollectPermission
{
HospitalId = hospitalId,
SheetName = sh.SheetName,
SheetName = sh.ModuleName,
SheetType = sh.SheetType.Value,
HeadName = sh.HeadName,
PermissionId = item?.Id,
......@@ -655,7 +662,10 @@ public void SaveCollectData(int allotId, SaveCollectData request)
|| !string.IsNullOrEmpty(data.AccountingUnitNurse)
|| !string.IsNullOrEmpty(data.AccountingUnitDoctor)
|| !string.IsNullOrEmpty(data.Department))
{
data.Status = 1;
datas.Add(data);
}
}
perforcollectdataRepository.Execute("delete from collect_data where allotid = @allotid and sheetname=@sheetname", new { allotId, request.SheetName });
perforcollectdataRepository.AddRange(datas.ToArray());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment