report retirement

This commit is contained in:
moss 2025-03-27 15:58:22 +07:00
parent 94100e304e
commit 066f49cad7
2 changed files with 76 additions and 24 deletions

View file

@ -147,30 +147,28 @@ namespace BMA.EHR.Application.Repositories.Reports
profiles = profiles.OrderBy(x => x.order).ToList();
}
var mapProfiles = new List<ProfileRetireJsonRequest>();
string previousRoot = null;
string previousPosTypeName = null;
string previousPosLevelName = null;
// string previousRoot = null;
// string previousPosTypeName = null;
// string previousPosLevelName = null;
if (profiles.Count > 0)
{
mapProfiles = profiles
.OrderBy(x => rootOrder.ToObject<List<string>>().IndexOf(x.root))
.ThenBy(x => posTypeNameOrder.ToObject<List<string>>().IndexOf(x.posTypeName ?? ""))
.ThenBy(x => posLevelNameOrder.ToObject<List<string>>().IndexOf(x.posLevelName ?? ""))
// .OrderBy(x => rootOrder.ToObject<List<string>>().IndexOf(x.root))
// .ThenBy(x => posTypeNameOrder.ToObject<List<string>>().IndexOf(x.posTypeName ?? ""))
// .ThenBy(x => posLevelNameOrder.ToObject<List<string>>().IndexOf(x.posLevelName ?? ""))
.Select((profile, index) =>
{
bool isDuplicateRoot = profile.root == previousRoot;
previousRoot = profile.root;
bool isDuplicatePosType = profile.posTypeName == previousPosTypeName;
previousPosTypeName = profile.posTypeName;
bool isDuplicatePosLevel = profile.posLevelName == previousPosLevelName;
previousPosLevelName = profile.posLevelName;
// bool isDuplicateRoot = profile.root == previousRoot;
// previousRoot = profile.root;
// bool isDuplicatePosType = profile.posTypeName == previousPosTypeName;
// previousPosTypeName = profile.posTypeName;
// bool isDuplicatePosLevel = profile.posLevelName == previousPosLevelName;
// previousPosLevelName = profile.posLevelName;
return new ProfileRetireJsonRequest
{
order = (index + 1).ToString().ToThaiNumber(),
order = $"{ (index + 1).ToString().ToThaiNumber() }. ลำดับที่ { (profile.order).ToString().ToThaiNumber() }",
fullName = $"{profile.prefix}{profile.firstName} {profile.lastName}",
root = (isDuplicateRoot ? "" : profile.root + "\n") +
(isDuplicatePosType ? "" : profile.posTypeName + "\n") +
(isDuplicatePosLevel ? "" : profile.posLevelName),
root = "",
child = (profile.posExecutiveName == null ? "" : profile.posExecutiveName + "\n") +
(profile.child4 == null ? "" : profile.child4 + "\n") +
(profile.child3 == null ? "" : profile.child3 + "\n") +
@ -262,11 +260,13 @@ namespace BMA.EHR.Application.Repositories.Reports
string previousPosLevelName = null;
if (profile_retire.Count > 0)
{
mapProfiles = profile_retire
.OrderBy(x => rootOrder.ToObject<List<string>>().IndexOf(x.root))
.ThenBy(x => posTypeNameOrder.ToObject<List<string>>().IndexOf(x.posTypeName ?? ""))
.ThenBy(x => posLevelNameOrder.ToObject<List<string>>().IndexOf(x.posLevelName ?? ""))
.Select((profile, index) =>
if (retire.TypeReport == null)
{
profile_retire = profile_retire.OrderBy(x => rootOrder.ToObject<List<string>>().IndexOf(x.root))
.ThenBy(x => posTypeNameOrder.ToObject<List<string>>().IndexOf(x.posTypeName ?? ""))
.ThenBy(x => posLevelNameOrder.ToObject<List<string>>().IndexOf(x.posLevelName ?? "")).ToList();
}
mapProfiles = profile_retire.Select((profile, index) =>
{
bool isDuplicateRoot = profile.root == previousRoot;
previousRoot = profile.root;