Commit 3cea149b by lcx

修改数据录入权限来源

parent 919bd101
...@@ -79,5 +79,20 @@ public class collect_data ...@@ -79,5 +79,20 @@ public class collect_data
/// 单元格value /// 单元格value
/// </summary> /// </summary>
public string CellValue { get; set; } 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 ...@@ -31,6 +31,8 @@ public class CollectService : IAutoInjection
private readonly PerforUserroleRepository userroleRepository; private readonly PerforUserroleRepository userroleRepository;
private readonly PerforImaccountbasicRepository perforImaccountbasicRepository; private readonly PerforImaccountbasicRepository perforImaccountbasicRepository;
private readonly PerforPerdeptdicRepository perforPerdeptdicRepository; private readonly PerforPerdeptdicRepository perforPerdeptdicRepository;
private readonly PerforExmoduleRepository exmoduleRepository;
private readonly PerforExitemRepository exitemRepository;
private readonly SheetSevice sheetSevice; private readonly SheetSevice sheetSevice;
private readonly Application options; private readonly Application options;
...@@ -48,6 +50,8 @@ public class CollectService : IAutoInjection ...@@ -48,6 +50,8 @@ public class CollectService : IAutoInjection
PerforUserroleRepository userroleRepository, PerforUserroleRepository userroleRepository,
PerforImaccountbasicRepository perforImaccountbasicRepository, PerforImaccountbasicRepository perforImaccountbasicRepository,
PerforPerdeptdicRepository perforPerdeptdicRepository, PerforPerdeptdicRepository perforPerdeptdicRepository,
PerforExmoduleRepository exmoduleRepository,
PerforExitemRepository exitemRepository,
SheetSevice sheetSevice, SheetSevice sheetSevice,
IOptions<Application> options) IOptions<Application> options)
{ {
...@@ -64,6 +68,8 @@ public class CollectService : IAutoInjection ...@@ -64,6 +68,8 @@ public class CollectService : IAutoInjection
this.userroleRepository = userroleRepository; this.userroleRepository = userroleRepository;
this.perforImaccountbasicRepository = perforImaccountbasicRepository; this.perforImaccountbasicRepository = perforImaccountbasicRepository;
this.perforPerdeptdicRepository = perforPerdeptdicRepository; this.perforPerdeptdicRepository = perforPerdeptdicRepository;
this.exmoduleRepository = exmoduleRepository;
this.exitemRepository = exitemRepository;
this.sheetSevice = sheetSevice; this.sheetSevice = sheetSevice;
this.options = options.Value; this.options = options.Value;
} }
...@@ -92,37 +98,38 @@ public IEnumerable<CollectPermission> GetCollectContent(int hospitalId, int user ...@@ -92,37 +98,38 @@ public IEnumerable<CollectPermission> GetCollectContent(int hospitalId, int user
(int)SheetType.AccountDrugAssess, (int)SheetType.AccountMaterialsAssess, (int)SheetType.AccountScoreAverage, (int)SheetType.AccountDrugAssess, (int)SheetType.AccountMaterialsAssess, (int)SheetType.AccountScoreAverage,
(int)SheetType.BudgetRatio, (int)SheetType.AssessBeforeOtherFee }; (int)SheetType.BudgetRatio, (int)SheetType.AssessBeforeOtherFee };
var sheets = perforPersheetRepository.GetEntities(w => w.AllotID == allot.ID && types.Contains((w.SheetType ?? 0))); var sheets = exmoduleRepository.GetEntities(w => w.HospitalId == hospitalId && 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);
if (sheets == null || !sheets.Any()) if (sheets == null || !sheets.Any())
return null; return null;
var headers = exitemRepository.GetEntities(w => sheets.Select(m => m.Id).Contains(w.ModuleId ?? 0));
if (headers == null || !headers.Any()) if (headers == null || !headers.Any())
return null; return null;
var permissions = perforcollectpermissionRepository.GetEntities(w => w.HospitalId == hospitalId && w.UserId == userId);
// 查询sheet和列头对应 // 查询sheet和列头对应
var sheetHeads = from sheet in sheets var sheetHeads = from sheet in sheets
join head in headers on sheet.ID equals head.SheetID join head in headers on sheet.Id equals head.ModuleId
select new { sheet.SheetName, sheet.SheetType, HeadName = head.CellValue }; select new { sheet.ModuleName, sheet.SheetType, HeadName = head.ItemName };
List<CollectPermission> result; List<CollectPermission> result;
// 查询列头和权限对应 // 查询列头和权限对应
if (permissions == null) 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 else
{ {
result = (from sh in sheetHeads 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 into emppmss
from item in emppmss.DefaultIfEmpty() from item in emppmss.DefaultIfEmpty()
select new CollectPermission select new CollectPermission
{ {
HospitalId = hospitalId, HospitalId = hospitalId,
SheetName = sh.SheetName, SheetName = sh.ModuleName,
SheetType = sh.SheetType.Value, SheetType = sh.SheetType.Value,
HeadName = sh.HeadName, HeadName = sh.HeadName,
PermissionId = item?.Id, PermissionId = item?.Id,
...@@ -655,7 +662,10 @@ public void SaveCollectData(int allotId, SaveCollectData request) ...@@ -655,7 +662,10 @@ public void SaveCollectData(int allotId, SaveCollectData request)
|| !string.IsNullOrEmpty(data.AccountingUnitNurse) || !string.IsNullOrEmpty(data.AccountingUnitNurse)
|| !string.IsNullOrEmpty(data.AccountingUnitDoctor) || !string.IsNullOrEmpty(data.AccountingUnitDoctor)
|| !string.IsNullOrEmpty(data.Department)) || !string.IsNullOrEmpty(data.Department))
{
data.Status = 1;
datas.Add(data); datas.Add(data);
}
} }
perforcollectdataRepository.Execute("delete from collect_data where allotid = @allotid and sheetname=@sheetname", new { allotId, request.SheetName }); perforcollectdataRepository.Execute("delete from collect_data where allotid = @allotid and sheetname=@sheetname", new { allotId, request.SheetName });
perforcollectdataRepository.AddRange(datas.ToArray()); 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