แก้ไข api รายงานบันทึกเวียนแจ้งการถึงแก่กรรม (ขาดบางฟิลด์)

This commit is contained in:
Harid Promsri (Bright) 2023-09-13 14:29:53 +07:00
parent cfaf90cb01
commit e801653d60
3 changed files with 98 additions and 15 deletions

View file

@ -49,7 +49,8 @@ namespace BMA.EHR.Application.Repositories.Reports
// throw;
// }
//}
#region
public async Task<dynamic> GetProfileRetirementdAsync(Guid retireId)
{
var retire = await _dbContext.Set<RetirementPeriod>()
@ -122,6 +123,68 @@ namespace BMA.EHR.Application.Repositories.Reports
return new { retire.Id, retire.CreatedAt, Year = retire.Year.ToThaiYear().ToString().ToThaiNumber(), retire.Round, retire.Type, retire.TypeReport, Total = profile_retire.Count.ToString().ToThaiNumber(), profile = profile_retire };
}
}
#endregion
#region
public async Task<dynamic> GetRetirementDeceasedAsync(Guid id)
{
var data = await _dbContext.Set<RetirementDeceased>().AsQueryable()
.Where(x => x.Id == id)
.Select(p => new
{
p.Id,
ProfileId = p.Profile.Id,
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
PrefixId = p.Profile.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Prefix.Id,
p.Profile.FirstName,
p.Profile.LastName,
Position = p.Profile.Position == null ? null : p.Profile.Position.Name,
PositionId = p.Profile.Position == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Position.Id,
PositionType = p.Profile.PositionType == null ? null : p.Profile.PositionType.Name,
PositionTypeId = p.Profile.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionType.Id,
p.Profile.PositionLine,
p.Profile.PositionLineId,
PositionLevel = p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name,
PositionLevelId = p.Profile.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionLevel.Id,
p.Profile.PositionExecutive,
p.Profile.PositionExecutiveId,
Organization = p.Profile.Oc,
OrganizationId = p.Profile.OcId,
p.Number,
p.Date,
p.Location,
p.Reason,
})
.FirstOrDefaultAsync();
if (data == null)
return null;
string Date = string.IsNullOrEmpty(data.Date.ToString()) ? "วันที่ - เดือน - พ.ศ. -" : DateTime.Parse(data.Date.ToString()).ToThaiFullDate().ToString().ToThaiNumber();
return new
{
data.Prefix,
data.FirstName,
data.LastName,
data.Position,
data.PositionExecutive,
data.PositionType,
data.PositionLine,
data.PositionLevel,
data.Organization,
data.PositionId,
data.PositionExecutiveId,
data.PositionTypeId,
data.PositionLineId,
data.PositionLevelId,
data.OrganizationId,
data.Number,
Date,
data.Location,
data.Reason,
};
}
#endregion
#endregion
}