แก้ model
This commit is contained in:
parent
d8031bff98
commit
a31b72316e
8 changed files with 48 additions and 46 deletions
|
|
@ -224,10 +224,11 @@ namespace BMA.EHR.Report.Service.Services
|
|||
orgWithOrder = await GetAllOcItemByRootAsync(ocId);
|
||||
|
||||
var organizationPositions = await _context.OrganizationPositions
|
||||
.Select(x => new
|
||||
{
|
||||
x.Id, x.OrganizationId,
|
||||
x.PositionUserNote,
|
||||
.Select(x => new
|
||||
{
|
||||
x.Id,
|
||||
x.OrganizationId,
|
||||
x.PositionUserNote,
|
||||
x.PositionMasterId,
|
||||
x.PositionNumberId
|
||||
}).ToListAsync();
|
||||
|
|
@ -240,11 +241,11 @@ namespace BMA.EHR.Report.Service.Services
|
|||
x.PositionPathSideId,
|
||||
x.PositionExecutiveId,
|
||||
x.PositionExecutiveSideId,
|
||||
x.PositionTypeId,
|
||||
PositionTypeId = x.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionType.Id,
|
||||
x.PositionPathSideObject,
|
||||
x.PositionExecutiveSideObject,
|
||||
x.IsDirector
|
||||
})
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
var organizations = await _context.Organizations
|
||||
|
|
@ -352,7 +353,7 @@ namespace BMA.EHR.Report.Service.Services
|
|||
x.PositionPathSideId,
|
||||
x.PositionExecutiveId,
|
||||
x.PositionExecutiveSideId,
|
||||
x.PositionTypeId,
|
||||
PositionTypeId = x.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.PositionType.Id,
|
||||
x.PositionPathSideObject,
|
||||
x.PositionExecutiveSideObject,
|
||||
x.IsDirector,
|
||||
|
|
@ -360,13 +361,13 @@ namespace BMA.EHR.Report.Service.Services
|
|||
})
|
||||
.ToListAsync();
|
||||
|
||||
var profiles = await _applicationDbContext.Profiles.ToListAsync();
|
||||
var profiles = await _applicationDbContext.Profiles.Include(x => x.PositionLevel).ToListAsync();
|
||||
var organizationShortNames = await _applicationDbContext.OrganizationShortNames.ToListAsync();
|
||||
var report2s = await _context.Report2s.ToListAsync();
|
||||
var positionPathSides = await _applicationDbContext.PositionPathSides.ToListAsync();
|
||||
var positionExecutiveSides = await _applicationDbContext.PositionExecutiveSides.ToListAsync();
|
||||
var positionExecutives = await _applicationDbContext.PositionExecutives.ToListAsync();
|
||||
|
||||
|
||||
var orgData = await _applicationDbContext.Organizations
|
||||
.Select(x => new
|
||||
{
|
||||
|
|
@ -415,7 +416,7 @@ namespace BMA.EHR.Report.Service.Services
|
|||
from pnNew in pnNewGroup.DefaultIfEmpty()
|
||||
join ppNew in positionPaths on rp == null ? pm?.PositionPathId : rp?.PositionPathId equals ppNew?.Id into ppNewGroup
|
||||
from ppNew in ppNewGroup.DefaultIfEmpty()
|
||||
join plNew in positionLevels on rp == null ? p?.PositionLevelId : rp?.PositionLevelId equals plNew?.Id into plNewGroup
|
||||
join plNew in positionLevels on rp == null ? (p?.PositionLevel == null ? null : p?.PositionLevel.Id) : rp?.PositionLevelId equals plNew?.Id into plNewGroup
|
||||
from plNew in plNewGroup.DefaultIfEmpty()
|
||||
|
||||
join psNew in positionPathSides on rp == null ? pm?.PositionPathSideId : rp?.PositionPathSideId equals psNew?.Id into psNewGroup
|
||||
|
|
@ -440,7 +441,7 @@ namespace BMA.EHR.Report.Service.Services
|
|||
LastName = p == null ? null : p.LastName,
|
||||
PositionNumberOld = rp == null ? (pn == null ? null : pn.Name) : rp.PositionNumOld,
|
||||
PositionPathOld = rp == null ? (pPath == null ? null : pPath.Name) : rp.PositionPathOld,
|
||||
PositionLevelOld = rp == null ? (p == null ? null : p.PositionLevel) : rp.PositionLevelOld,
|
||||
PositionLevelOld = rp == null ? (p == null ? null : p.PositionLevel?.Name) : rp.PositionLevelOld,
|
||||
PositionNumberIdNew = pnNew == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : pnNew.Id,
|
||||
PositionNumberNew = pnNew == null ? null : pnNew.Name,
|
||||
PositionPathNew = ppNew == null ? null : ppNew.Name,
|
||||
|
|
@ -546,7 +547,7 @@ namespace BMA.EHR.Report.Service.Services
|
|||
var RootOcName = _profileService.GetOrganizationNameFullPath(ocId, false, false);
|
||||
|
||||
var organizationPositions = await _context.OrganizationPositions.ToListAsync();
|
||||
var positionMasters = await _context.PositionMasters.ToListAsync();
|
||||
var positionMasters = await _context.PositionMasters.Include(x => x.PositionType).ToListAsync();
|
||||
var organizations = await _context.Organizations.ToListAsync();
|
||||
var organizationOrganizations = await _applicationDbContext.OrganizationOrganizations.ToListAsync();
|
||||
var organizationShortNames = await _applicationDbContext.OrganizationShortNames.ToListAsync();
|
||||
|
|
@ -558,7 +559,7 @@ namespace BMA.EHR.Report.Service.Services
|
|||
var positionTypes = await _applicationDbContext.PositionTypes.ToListAsync();
|
||||
var profilePositions = await _context.ProfilePositions.ToListAsync();
|
||||
var prefixes = await _context.Prefixes.ToListAsync();
|
||||
var profiles = await _context.Profiles.ToListAsync();
|
||||
var profiles = await _context.Profiles.Include(x => x.PositionLevel).Include(x => x.PosNo).ToListAsync();
|
||||
var report2 = await _context.Report2s.ToListAsync();
|
||||
|
||||
var profile_data = (from p in profiles
|
||||
|
|
@ -575,10 +576,10 @@ namespace BMA.EHR.Report.Service.Services
|
|||
p.Position,
|
||||
p.PositionPathSide,
|
||||
p.PositionType,
|
||||
p.PositionLevel,
|
||||
PositionLevel = p.PositionLevel?.Name,
|
||||
p.PositionExecutive,
|
||||
p.PositionExecutiveSide,
|
||||
p.PosNo,
|
||||
PosNo = p.PosNo?.Name,
|
||||
p.OrganizationShortName,
|
||||
Degree = p.Educations == null || p.Educations.Count == 0 ? "" : $"{p.Educations.OrderBy(x => x.StartDate).Last().Degree}\r\n({p.Educations.OrderBy(x => x.StartDate).Last().Field})",
|
||||
Salary = p.Salaries == null || p.Salaries.Count == 0 ? 0 : p.Salaries.OrderBy(x => x.Date).Last().Amount,
|
||||
|
|
@ -658,9 +659,9 @@ namespace BMA.EHR.Report.Service.Services
|
|||
ShortName = r == null ? pf.OrganizationShortName : GetShortNameFromPosNo(r.PositionNum),
|
||||
PositionNumber = r == null ? pf.PosNo : r.PositionNum,
|
||||
PositionNumberInt = r == null ? GetPosnoIntFromPosNo(pf.PosNo) : GetPosnoIntFromPosNo(r.PositionNum),
|
||||
PositionPath = r == null ? pf.Position : r.PositionPath,
|
||||
PositionPath = r == null ? pf.Position?.Name : r.PositionPath,
|
||||
PositionPathSide = r == null ? pf.PositionPathSide : r.PositionPathSide,
|
||||
PositionType = r == null ? pf.PositionType : r.PositionType,
|
||||
PositionType = r == null ? pf.PositionType?.Name : r.PositionType,
|
||||
PositionLevel = r == null ? pf.PositionLevel : r.PositionLevel,
|
||||
PositionExecutive = r == null ? pf.PositionExecutive : r.PositionExecutive,
|
||||
PositionExecutiveSide = r == null ? pf.PositionExecutiveSide : r.PositionExecutiveSide,
|
||||
|
|
@ -788,7 +789,7 @@ namespace BMA.EHR.Report.Service.Services
|
|||
from pm_exp in pm_exp_join.DefaultIfEmpty()
|
||||
join ex_p_s in executivePositionSide on pm.PositionExecutiveSideId equals ex_p_s.Id into pm_exp_s_join
|
||||
from pm_exp_s in pm_exp_s_join.DefaultIfEmpty()
|
||||
join pt in positionTypes on pm.PositionTypeId equals pt.Id
|
||||
// join pt in positionTypes on pm.PositionTypeId equals pt.Id
|
||||
join rp2 in report2_data.ToList() on op.Id equals rp2.OrganizationPositionId into rp2_join
|
||||
from rp2_dt in rp2_join.DefaultIfEmpty()
|
||||
|
||||
|
|
@ -812,7 +813,7 @@ namespace BMA.EHR.Report.Service.Services
|
|||
PositionExecutiveSide = pm.PositionExecutiveSideObject is null ? "" : Newtonsoft.Json.JsonConvert.DeserializeObject<List<PositionExecutiveSideObject>>(pm.PositionExecutiveSideObject).GetNameList(),
|
||||
Remark = op.PositionUserNote,
|
||||
OcOrder = oc.OrganizationOrder.Value.ToString(),
|
||||
PositionType = pt.Name,
|
||||
PositionType = pm.PositionType?.Name,
|
||||
|
||||
|
||||
OcIdNew = rp2_dt == null ? op.OrganizationId.Value : rp2_dt.OcId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue