Merge branch 'develop' into working

This commit is contained in:
Suphonchai Phoonsawat 2023-09-02 13:26:14 +07:00
commit 69bd9c0a68
25 changed files with 49062 additions and 18 deletions

View file

@ -4612,7 +4612,7 @@ namespace BMA.EHR.Application.Repositories
var type3_level11 = await GetInsigniaCandidate_Type3_Level11(periodId, ocId);
var type4_level10 = await GetInsigniaCandidate_Type4_Level10(periodId, ocId);
var type4_level11 = await GetInsigniaCandidate_Type4_Level11(periodId, ocId);
var type_coin = await GetInsigniaCandidate(periodId, ocId);
// var type_coin = await GetInsigniaCandidate(periodId, ocId);
// union result
foreach (var r in type4_level11)
@ -4699,10 +4699,10 @@ namespace BMA.EHR.Application.Repositories
if (old == null)
result_candidate.Add(r);
}
foreach (var r in type_coin)
{
result_candidate.Add(r);
}
// foreach (var r in type_coin)
// {
// result_candidate.Add(r);
// }
return result_candidate.OrderBy(x => x.Seq).ThenBy(x => x.Gender).ThenBy(x => x.ProfileId).ToList();
}
@ -4843,6 +4843,7 @@ namespace BMA.EHR.Application.Repositories
Name = p.Name,
Round = p.Round,
Year = p.Year,
IsLock = p.IsLock,
})
.FirstOrDefaultAsync(x => x.Id == id);
@ -4862,6 +4863,8 @@ namespace BMA.EHR.Application.Repositories
Year = period.Year,
Round = period.Round,
Name = period.Name,
IsLock = period.IsLock,
RequestId = request == null ? null : request.Id,
RequestNote = request == null ? "" : request.RequestNote,
RequestStatus = request == null ? null : request.RequestStatus,
OrganizationName = request == null ? "" : request.Organization.OrganizationOrganization.Name
@ -4976,6 +4979,7 @@ namespace BMA.EHR.Application.Repositories
Id = h.Id,
CitizenId = h.Profile.CitizenId,
ProfileId = h.Profile.Id,
ProfileType = h.Profile.ProfileType,
FullName = $"{h.Profile.FirstName} {h.Profile.LastName}",
Position = h.Profile.Position.Name,
PosNo = h.Profile.PosNo.Id,

View file

@ -4,6 +4,7 @@
{
public Guid Id { get; set; }
public string CitizenId { get; set; }
public string? ProfileType { get; set; }
public Guid ProfileId { get; set; }
public string FullName { get; set; }
public string Position { get; set; }

View file

@ -5,12 +5,14 @@ namespace BMA.EHR.Application.Requests
public class InsigniaResults
{
public Guid PeriodId { get; set; }
public Guid? RequestId { get; set; }
public string? Name { get; set; }
public int Year { get; set; }
public int Round { get; set; }
public string RequestNote { get; set; }
public string RequestStatus { get; set; }
public string OrganizationName { get; set; }
public bool IsLock { get; set; }
public List<InsigniaRequestItem> Items { get; set; }
}
}

View file

@ -60,6 +60,9 @@ namespace BMA.EHR.Domain.Models.HR
[Comment("ประเภทคำสั่ง")]
public string CommandTypeName { get; set; }
[Comment("ประเภทตำแหน่งกรณีพิเศษ")]
public string? SalaryStatus { get; set; }
public bool IsActive { get; set; } = true;
}
}

View file

@ -22,6 +22,8 @@ namespace BMA.EHR.Domain.Models.Insignias
public int Round { get; set; } = 1;
[Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
[Comment("สถานะการ Freez ข้อมูล")]
public bool IsLock { get; set; } = false;
public virtual List<InsigniaRequest> InsigniaRequests { get; set; }
}
}

View file

@ -24,5 +24,6 @@ namespace BMA.EHR.Domain.Models.Retirement
public Profile Profile { get; set; }
[Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
public virtual List<RetirementDeceasedNoti> RetirementDeceasedNotis { get; set; } = new List<RetirementDeceasedNoti>();
}
}

View file

@ -0,0 +1,45 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using BMA.EHR.Domain.Models.Base;
using BMA.EHR.Domain.Models.MetaData;
using BMA.EHR.Domain.Models.Organizations;
using BMA.EHR.Domain.Models.Documents;
using BMA.EHR.Domain.Models.HR;
namespace BMA.EHR.Domain.Models.Retirement
{
public class RetirementDeceasedNoti : EntityBase
{
[Comment("รหัสอ้างอิงผู้ใช้งานระบบ")]
public Profile ReceiveUser { get; set; }
[Comment("Fk Table RetirementDeceased")]
public RetirementDeceased RetirementDeceased { get; set; }
[MaxLength(13), Required, Comment("เลขประจำตัวประชาชน")]
public string CitizenId { get; set; } = string.Empty;
[MaxLength(50), Required, Comment("คำนำหน้านาม")]
public string Prefix { get; set; } = string.Empty;
[MaxLength(100), Required, Comment("ชื่อ")]
public string FirstName { get; set; } = string.Empty;
[MaxLength(100), Required, Comment("นามสกุล")]
public string LastName { get; set; } = string.Empty;
[Required, Comment("ส่งอีเมล์หรือไม่?")]
public bool IsSendMail { get; set; } = true;
[Required, Comment("ส่งกล่องข้อความหรือไม่?")]
public bool IsSendInbox { get; set; } = true;
[Required, Comment("ส่งแจ้งเตือนหรือไม่?")]
public bool IsSendNotification { get; set; } = true;
[Comment("ชื่อหน่วยงานของผู้รับสำเนาคำสั่ง")]
public string OrganizationName { get; set; } = string.Empty;
[Comment("ชื่อตำแหน่งของผู้รับสำเนาคำสั่ง")]
public string PositionName { get; set; } = string.Empty;
}
}

View file

@ -99,6 +99,7 @@
public static readonly string RetirementHistoryNotFound = "ไม่พบข้อมูลประวัติการประกาศเกษียณอายุราชการ";
public static readonly string RetirementResignNotFound = "ไม่พบข้อมูลการคำขอลาออก";
public static readonly string RetirementDeceasedNotFound = "ไม่พบข้อมูลบันทึกเวียนแจ้งการถึงแก่กรรม";
public static readonly string RetirementDeceasedNotiNotFound = "ไม่พบข้อมูลแจ้งเตือนบันทึกเวียนแจ้งการถึงแก่กรรม";
public static readonly string RetirementDischargeNotFound = "ไม่พบข้อมูลปลดออก";
public static readonly string RetirementExpulsionNotFound = "ไม่พบข้อมูลไล่ออก";
public static readonly string RetirementOtherNotFound = "ไม่พบข้อมูลอื่นๆ";

View file

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableinsigniaperiodaddislock : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsLock",
table: "InsigniaPeriods",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการ Freez ข้อมูล");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsLock",
table: "InsigniaPeriods");
}
}
}

View file

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableprofilesalaryaddSalaryStatus : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "SalaryStatus",
table: "ProfileSalaries",
type: "longtext",
nullable: true,
comment: "ประเภทตำแหน่งกรณีพิเศษ")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "SalaryStatus",
table: "ProfileSalaries");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,83 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class addtableRetirementDeceasedNotis : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "RetirementDeceasedNotis",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
.Annotation("MySql:CharSet", "utf8mb4"),
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
.Annotation("MySql:CharSet", "utf8mb4"),
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
.Annotation("MySql:CharSet", "utf8mb4"),
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
.Annotation("MySql:CharSet", "utf8mb4"),
ReceiveUserId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
RetirementDeceasedId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
CitizenId = table.Column<string>(type: "varchar(13)", maxLength: 13, nullable: false, comment: "เลขประจำตัวประชาชน")
.Annotation("MySql:CharSet", "utf8mb4"),
Prefix = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, comment: "คำนำหน้านาม")
.Annotation("MySql:CharSet", "utf8mb4"),
FirstName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อ")
.Annotation("MySql:CharSet", "utf8mb4"),
LastName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "นามสกุล")
.Annotation("MySql:CharSet", "utf8mb4"),
IsSendMail = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "ส่งอีเมล์หรือไม่?"),
IsSendInbox = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "ส่งกล่องข้อความหรือไม่?"),
IsSendNotification = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "ส่งแจ้งเตือนหรือไม่?"),
OrganizationName = table.Column<string>(type: "longtext", nullable: false, comment: "ชื่อหน่วยงานของผู้รับสำเนาคำสั่ง")
.Annotation("MySql:CharSet", "utf8mb4"),
PositionName = table.Column<string>(type: "longtext", nullable: false, comment: "ชื่อตำแหน่งของผู้รับสำเนาคำสั่ง")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_RetirementDeceasedNotis", x => x.Id);
table.ForeignKey(
name: "FK_RetirementDeceasedNotis_Profiles_ReceiveUserId",
column: x => x.ReceiveUserId,
principalTable: "Profiles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_RetirementDeceasedNotis_RetirementDeceaseds_RetirementDeceas~",
column: x => x.RetirementDeceasedId,
principalTable: "RetirementDeceaseds",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_RetirementDeceasedNotis_ReceiveUserId",
table: "RetirementDeceasedNotis",
column: "ReceiveUserId");
migrationBuilder.CreateIndex(
name: "IX_RetirementDeceasedNotis_RetirementDeceasedId",
table: "RetirementDeceasedNotis",
column: "RetirementDeceasedId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "RetirementDeceasedNotis");
}
}
}

View file

@ -4703,6 +4703,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("เอกสารอ้างอิง");
b.Property<string>("SalaryStatus")
.HasColumnType("longtext")
.HasComment("ประเภทตำแหน่งกรณีพิเศษ");
b.HasKey("Id");
b.HasIndex("PositionLevelId");
@ -5777,6 +5781,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("tinyint(1)")
.HasComment("สถานะการใช้งาน");
b.Property<bool>("IsLock")
.HasColumnType("tinyint(1)")
.HasComment("สถานะการ Freez ข้อมูล");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
@ -12648,6 +12656,114 @@ namespace BMA.EHR.Infrastructure.Migrations
b.ToTable("RetirementDeceaseds");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementDeceasedNoti", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<string>("CitizenId")
.IsRequired()
.HasMaxLength(13)
.HasColumnType("varchar(13)")
.HasComment("เลขประจำตัวประชาชน");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasComment("ชื่อ");
b.Property<bool>("IsSendInbox")
.HasColumnType("tinyint(1)")
.HasComment("ส่งกล่องข้อความหรือไม่?");
b.Property<bool>("IsSendMail")
.HasColumnType("tinyint(1)")
.HasComment("ส่งอีเมล์หรือไม่?");
b.Property<bool>("IsSendNotification")
.HasColumnType("tinyint(1)")
.HasComment("ส่งแจ้งเตือนหรือไม่?");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasComment("นามสกุล");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("OrganizationName")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงานของผู้รับสำเนาคำสั่ง");
b.Property<string>("PositionName")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อตำแหน่งของผู้รับสำเนาคำสั่ง");
b.Property<string>("Prefix")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)")
.HasComment("คำนำหน้านาม");
b.Property<Guid>("ReceiveUserId")
.HasColumnType("char(36)");
b.Property<Guid>("RetirementDeceasedId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("ReceiveUserId");
b.HasIndex("RetirementDeceasedId");
b.ToTable("RetirementDeceasedNotis");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementDischarge", b =>
{
b.Property<Guid>("Id")
@ -15516,6 +15632,25 @@ namespace BMA.EHR.Infrastructure.Migrations
b.Navigation("Profile");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementDeceasedNoti", b =>
{
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "ReceiveUser")
.WithMany()
.HasForeignKey("ReceiveUserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BMA.EHR.Domain.Models.Retirement.RetirementDeceased", "RetirementDeceased")
.WithMany("RetirementDeceasedNotis")
.HasForeignKey("RetirementDeceasedId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ReceiveUser");
b.Navigation("RetirementDeceased");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementDischarge", b =>
{
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
@ -15989,6 +16124,11 @@ namespace BMA.EHR.Infrastructure.Migrations
b.Navigation("PlacementTransferDocs");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementDeceased", b =>
{
b.Navigation("RetirementDeceasedNotis");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementOther", b =>
{
b.Navigation("RetirementOtherDocs");

View file

@ -320,6 +320,7 @@ namespace BMA.EHR.Infrastructure.Persistence
public DbSet<RetirementPeriod> RetirementPeriods { get; set; }
public DbSet<RetirementProfile> RetirementProfiles { get; set; }
public DbSet<RetirementDeceased> RetirementDeceaseds { get; set; }
public DbSet<RetirementDeceasedNoti> RetirementDeceasedNotis { get; set; }
public DbSet<RetirementResign> RetirementResigns { get; set; }
public DbSet<RetirementResignDoc> RetirementResignDocs { get; set; }
public DbSet<RetirementOut> RetirementOuts { get; set; }

View file

@ -38,4 +38,9 @@
<ItemGroup>
<ProjectReference Include="..\BMA.EHR.Infrastructure\BMA.EHR.Infrastructure.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="Templates/PersonInsignia.xlsx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View file

@ -3,6 +3,7 @@ using System.Security.Claims;
using BMA.EHR.Application.Repositories;
using BMA.EHR.Application.Requests;
using BMA.EHR.Domain.Common;
using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Models.HR;
using BMA.EHR.Domain.Models.Insignias;
using BMA.EHR.Domain.Shared;
@ -50,6 +51,9 @@ namespace BMA.EHR.Insignia.Service.Controllers
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
private bool? RoleAdmin => _httpContextAccessor?.HttpContext?.User?.IsInRole("admin");
private bool? RoleInsignia1 => _httpContextAccessor?.HttpContext?.User?.IsInRole("insignia1");
private bool? RoleInsignia2 => _httpContextAccessor?.HttpContext?.User?.IsInRole("insignia2");
#endregion
@ -408,21 +412,27 @@ namespace BMA.EHR.Insignia.Service.Controllers
var result = await _repository.GetInsigniaRequest(insigniaPeriodId, ocId);
if (result != null)
{
Guid period = result.PeriodId;
var periodName = result.Name;
string requestStatus = result.RequestStatus;
string requestNote = result.RequestNote;
// Guid period = result.PeriodId;
// var periodName = result.Name;
// string requestStatus = result.RequestStatus;
// string requestNote = result.RequestNote;
var resend = new InsigniaResults
{
PeriodId = period,
PeriodId = result.PeriodId,
Year = result.Year,
Round = result.Round,
Name = periodName,
RequestStatus = requestStatus,
RequestNote = requestNote,
Name = result.Name,
RequestId = result.RequestId,
RequestStatus = result.RequestStatus,
RequestNote = result.RequestNote,
IsLock = result.IsLock,
OrganizationName = result.OrganizationName,
Items = new List<InsigniaRequestItem>()
};
if (RoleAdmin == true && result.RequestStatus != "st5")
return Success(resend);
if (RoleInsignia2 == true && (result.RequestStatus == "st1" || result.RequestStatus == "st2" || result.RequestStatus == "st3"))
return Success(resend);
// var candidate = await _repository.GetInsigniaCandidateBKK(period, ocId);
// // ตรวจสอบว่ารายการอยู่ใน table insignia_request_new
@ -433,7 +443,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
// }
if (role.Trim().ToUpper() == "OFFICER")
{
resend.Items = await _repository.InsigniaHasProfile(period, ocId, status);
resend.Items = await _repository.InsigniaHasProfile(result.PeriodId, ocId, status);
return Success(resend);
}
else
@ -681,7 +691,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
var requestNew = await _context.InsigniaRequests.FirstOrDefaultAsync(i => i.Id == requestId);
if (requestNew != null)
{
requestNew.RequestStatus = "st5";
requestNew.RequestStatus = "st2";
requestNew.RequestNote = req.Reason;
_context.SaveChanges();
return Success();
@ -1034,6 +1044,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
.FirstOrDefaultAsync(x => x.Id == insigniaPeriodId);
if (insigniaPeriod == null)
return Error(GlobalMessages.InsigniaRequestNotFound);
insigniaPeriod.IsLock = true;
var insigniaNote = await _context.InsigniaNotes
.Include(x => x.InsigniaNoteProfiles)
.ThenInclude(x => x.Profile)
@ -1063,6 +1074,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
}
var requestOlds = await _context.InsigniaRequests
.Where(p => p.Period == insigniaPeriod)
.Where(p => p.RequestStatus == "st5")
.ToListAsync();
foreach (var requestOld in requestOlds)
{
@ -1090,7 +1102,10 @@ namespace BMA.EHR.Insignia.Service.Controllers
noreProfileOld.LastUpdateUserId = UserId ?? "";
noreProfileOld.LastUpdatedAt = DateTime.Now;
}
else
{
if (profileOld.Profile == null)
continue;
await _context.InsigniaNoteProfiles.AddAsync(new InsigniaNoteProfile
{
RequestDate = profileOld.RequestDate,
@ -1115,6 +1130,27 @@ namespace BMA.EHR.Insignia.Service.Controllers
return Success();
}
// /// <summary>
// /// รายชื่อผู้ได้รับเครื่องราชส่งข้อมูลไปบันทึกผลได้รับเครื่องราช(อัพเดทstatus)
// /// </summary>
// /// <param name="insigniaPeriodId">Id รอบการยื่นขอ</param>
// /// <returns></returns>
// /// <response code="200"></response>
// /// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
// /// <response code="401">ไม่ได้ Login เข้าระบบ</response>
// /// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
// [HttpGet("send/note/{insigniaPeriodId:length(36)}")]
// public async Task<ActionResult<ResponseObject>> SendPeriodToNoteUpdateStatus(Guid insigniaPeriodId)
// {
// var insigniaPeriod = await _context.InsigniaPeriods
// .FirstOrDefaultAsync(x => x.Id == insigniaPeriodId);
// if (insigniaPeriod == null)
// return Error(GlobalMessages.InsigniaRequestNotFound);
// insigniaPeriod.IsLock = true;
// await _context.SaveChangesAsync();
// return Success();
// }
/// <summary>
/// list รอบบันทึกผลการได้รับพระราชทานเครื่องราชย์อิสริยสภรณ์/การจ่ายใบกำกับ
/// </summary>
@ -1887,5 +1923,110 @@ namespace BMA.EHR.Insignia.Service.Controllers
return Success(_insigniaNoteProfiles);
}
/// <summary>
/// Download รายชื่อข้าราชการสามัญฯ ที่มีสิทธิ์ยื่นขอพระราชทานเครื่องราชอิสริยาภรณ์
/// </summary>
/// <param name="RequestId">Id รอบเครื่องราช</param>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("download/excel/{RequestId:length(36)}")]
public async Task<ActionResult<ResponseObject>> DownloadExcalInsignia(Guid RequestId)
{
var insigniaPeriod = await _context.InsigniaRequests
.Include(x => x.Organization)
.ThenInclude(x => x.OrganizationOrganization)
.Include(x => x.RequestProfiles)
.ThenInclude(x => x.Profile)
.ThenInclude(x => x.Prefix)
.Include(x => x.RequestProfiles)
.ThenInclude(x => x.Profile)
.ThenInclude(x => x.Position)
.Include(x => x.RequestProfiles)
.ThenInclude(x => x.Profile)
.ThenInclude(x => x.PositionLevel)
.Include(x => x.RequestProfiles)
.ThenInclude(x => x.Profile)
.ThenInclude(x => x.Salaries)
.ThenInclude(x => x.PositionLevel)
.Include(x => x.RequestProfiles)
.ThenInclude(x => x.Profile)
.ThenInclude(x => x.Insignias)
.ThenInclude(x => x.Insignia)
.FirstOrDefaultAsync(x => x.Id == RequestId);
if (insigniaPeriod == null)
return Error(GlobalMessages.InsigniaPeriodNotFound);
var template_dir = Path.Combine(_hostingEnvironment.ContentRootPath, "Templates");
var template_file = Path.Combine(template_dir, "PersonInsignia.xlsx");
var tmpDir = Path.Combine(_hostingEnvironment.ContentRootPath, "tmp");
if (!Directory.Exists(tmpDir))
Directory.CreateDirectory(tmpDir);
var exportFile = Path.Combine(tmpDir, $"ExamList_{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx");
try
{
// copy template
System.IO.File.Copy(template_file, exportFile);
using (var excel = new ExcelPackage(new FileInfo(exportFile)))
{
var workSheet = excel.Workbook.Worksheets[0];
var requestProfiles = insigniaPeriod.RequestProfiles.Where(x => x.Status == "PENDING").ToList();
var row = 2;
foreach (var item in requestProfiles)
{
workSheet.Cells[row, 1].Value = insigniaPeriod.Organization.OrganizationOrganization == null ? "-" : insigniaPeriod.Organization.OrganizationOrganization.Name;
workSheet.Cells[row, 2].Value = item.Profile.CitizenId;
workSheet.Cells[row, 3].Value = item.Profile.Prefix == null ? "-" : item.Profile.Prefix.Name;
workSheet.Cells[row, 4].Value = "-";
workSheet.Cells[row, 5].Value = item.Profile.FirstName;
workSheet.Cells[row, 6].Value = item.Profile.LastName;
workSheet.Cells[row, 7].Value = item.Profile.Gender == null ? "-" : item.Profile.Gender.Name;
workSheet.Cells[row, 8].Value = item.Profile.BirthDate.ToThaiDate();
workSheet.Cells[row, 9].Value = item.Profile.DateAppoint == null ? null : item.Profile.DateAppoint.Value.ToThaiDate();
// workSheet.Cells[row, 10].Value = null;
// workSheet.Cells[row, 11].Value = item.Profile.Position == null ? null : item.Profile.Position.Name;
workSheet.Cells[row, 12].Value = item.Profile.PositionLevel == null ? null : (item.Profile.Salaries.Where(x => x.PositionLevel == item.Profile.PositionLevel).Count() == 0 ? null : (item.Profile.Salaries.Where(x => x.PositionLevel == item.Profile.PositionLevel).OrderBy(x => x.Order).FirstOrDefault().Date == null ? null : item.Profile.Salaries.Where(x => x.PositionLevel == item.Profile.PositionLevel).OrderBy(x => x.Order).FirstOrDefault().Date.Value.ToThaiDate()));
workSheet.Cells[row, 13].Value = item.Profile.PositionLevel == null ? null : item.Profile.PositionLevel.Name;
workSheet.Cells[row, 14].Value = item.Profile.Position == null ? null : (item.Profile.Salaries.Where(x => x.PositionId == item.Profile.Position.Id).Count() == 0 ? null : (item.Profile.Salaries.Where(x => x.PositionId == item.Profile.Position.Id).OrderBy(x => x.Order).FirstOrDefault().Date == null ? null : item.Profile.Salaries.Where(x => x.PositionId == item.Profile.Position.Id).OrderBy(x => x.Order).FirstOrDefault().Date.Value.ToThaiDate()));
workSheet.Cells[row, 15].Value = null;
workSheet.Cells[row, 16].Value = item.Profile.Position == null ? "-" : item.Profile.Position.Name;
workSheet.Cells[row, 17].Value = item.Profile.Salaries.Count() == 0 ? null : item.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount;
workSheet.Cells[row, 18].Value = null;
workSheet.Cells[row, 19].Value = item.Profile.Salaries.Count() == 0 ? null : item.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount;
workSheet.Cells[row, 20].Value = item.Profile.Insignias.Count() == 0 ? null : (item.Profile.Insignias.OrderByDescending(x => x.CreatedAt).FirstOrDefault().Insignia == null ? null : item.Profile.Insignias.OrderByDescending(x => x.CreatedAt).FirstOrDefault().Insignia.Name);
workSheet.Cells[row, 21].Value = item.Profile.Insignias.Count() == 0 ? null : (item.Profile.Insignias.OrderByDescending(x => x.CreatedAt).FirstOrDefault().ReceiveDate == null ? null : item.Profile.Insignias.OrderByDescending(x => x.CreatedAt).FirstOrDefault().ReceiveDate.Value.ToThaiDate());
workSheet.Cells[row, 22].Value = null;
row++;
}
excel.Save();
using (FileStream fs = new FileStream(exportFile, FileMode.Open, FileAccess.Read))
{
byte[] bytes = System.IO.File.ReadAllBytes(exportFile);
fs.Read(bytes, 0, System.Convert.ToInt32(fs.Length));
fs.Close();
var fname = Path.GetFileName(exportFile);
Response.Headers["Content-Disposition"] = $"inline; filename={fname}";
var ret = new FileContentResult(bytes, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
{
FileDownloadName = fname
};
return ret;
}
}
}
catch (Exception ex)
{
return Error(ex, "ไม่สามารถส่งออกรายชื่อผู้มีสิทธิ์สอบได้!!");
}
finally
{
if (System.IO.File.Exists(exportFile))
System.IO.File.Delete(exportFile);
}
}
}
}

Binary file not shown.

View file

@ -0,0 +1,85 @@
using BMA.EHR.Domain.Common;
using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Shared;
using BMA.EHR.Application.Repositories.Reports;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
using Swashbuckle.AspNetCore.Annotations;
using DocumentFormat.OpenXml.Drawing;
using Telerik.Reporting;
using Telerik.Reporting.Processing;
using System.IO;
namespace BMA.EHR.Report.Service.Controllers
{
[Route("api/v{version:apiVersion}/report/deceased")]
[ApiVersion("2.0")]
[ApiController]
[Produces("application/json")]
[Authorize]
[SwaggerTag("API รายงานบันทึกเวียนแจ้งการถึงแก่กรรม")]
public class DeceasedReportController : BaseController
{
#region " Fields "
private readonly IWebHostEnvironment _hostingEnvironment;
private readonly IConfiguration _configuration;
private readonly GenericReportGenerator _reportGenerator;
#endregion
#region " Constuctor and Destructor "
public DeceasedReportController(IWebHostEnvironment hostingEnvironment, IConfiguration configuration, GenericReportGenerator reportGenerator)
{
_hostingEnvironment = hostingEnvironment;
_configuration = configuration;
_reportGenerator = reportGenerator;
}
#endregion
#region " Methods "
#region 36-
/// <summary>
/// 36-บันทึกเวียนแจ้งการถึงแก่กรรม
/// </summary>
/// <param name="id">id </param>
/// <param name="exportType">pdf, docx หรือ xlsx</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("36/{exportType}/{id}")]
public IActionResult GetDeceasedConvertReportAsync(Guid id, string exportType = "pdf")
{
try
{
var mimeType = "";
switch (exportType.Trim().ToLower())
{
case "pdf": mimeType = "application/pdf"; break;
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
}
var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"36-บันทึกเวียนแจ้งการถึงแก่กรรม.trdp");
var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
return File(contentData, mimeType, $"deceased.{exportType.Trim().ToLower()}");
}
catch
{
throw;
}
}
#endregion
#endregion
}
}

View file

@ -3,6 +3,7 @@ using BMA.EHR.Domain.Common;
using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Models.HR;
using BMA.EHR.Domain.Models.MetaData;
using BMA.EHR.Domain.Models.Notifications;
using BMA.EHR.Domain.Models.Retirement;
using BMA.EHR.Domain.Shared;
using BMA.EHR.Infrastructure.Persistence;
@ -11,6 +12,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Swashbuckle.AspNetCore.Annotations;
using System.Reflection.Metadata;
using System.Security.Claims;
using System.Security.Cryptography;
@ -213,6 +215,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
public async Task<ActionResult<ResponseObject>> Post([FromForm] RetirementDeceasedRequest req)
{
var profile = await _context.Profiles
.Include(x => x.Prefix)
.FirstOrDefaultAsync(x => x.Id == req.ProfileId);
if (profile == null)
return Error(GlobalMessages.DataNotFound, 404);
@ -237,13 +240,14 @@ namespace BMA.EHR.Retirement.Service.Controllers
};
await _context.RetirementDeceaseds.AddAsync(retirementDeceased);
await _context.SaveChangesAsync();
var _doc = new Domain.Models.Documents.Document();
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
{
var file = Request.Form.Files[0];
var fileExtension = Path.GetExtension(file.FileName);
var doc = await _documentService.UploadFileAsync(file, file.FileName);
var _doc = await _context.Documents.AsQueryable()
_doc = await _context.Documents.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == doc.Id);
if (_doc != null)
retirementDeceased.Document = _doc;
@ -256,6 +260,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
SalaryClass = "-",
PosNoEmployee = "-",
CommandTypeName = "-",
SalaryStatus = "DEATH",
Profile = profile,
CreatedUserId = FullName ?? "",
CreatedFullName = UserId ?? "System Administrator",
@ -264,6 +269,61 @@ namespace BMA.EHR.Retirement.Service.Controllers
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
});
if (_doc != null)
{
await _context.ProfilePapers.AddAsync(new ProfilePaper
{
Detail = "ถึงแก่กรรม",
CategoryName = "DEATH",
Document = _doc,
Profile = profile,
CreatedUserId = FullName ?? "",
CreatedFullName = UserId ?? "System Administrator",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
});
}
var orgPos = await _context.ProfilePositions
.Include(x => x.Profile)
.ThenInclude(x => x!.Prefix)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x!.Organization)
.ThenInclude(x => x!.OrganizationOrganization)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x!.PositionMaster)
.ThenInclude(x => x!.PositionPath)
.Where(x => x.OrganizationPosition!.IsDirector! == true)
.Where(x => x.OrganizationPosition!.Organization!.Id == profile.OcId)
.FirstOrDefaultAsync();
if (orgPos != null)
{
if (orgPos.Profile != null)
{
retirementDeceased.RetirementDeceasedNotis.Add(new RetirementDeceasedNoti
{
CitizenId = orgPos!.Profile!.CitizenId!,
Prefix = orgPos!.Profile!.Prefix!.Name,
FirstName = orgPos!.Profile!.FirstName!,
LastName = orgPos!.Profile!.LastName!,
// IsSendMail = req.IsSendMail,
// IsSendInbox = req.IsSendInbox,
// IsSendNotification = req.IsSendNotification,
OrganizationName = orgPos!.OrganizationPosition!.Organization!.OrganizationOrganization!.Name,
PositionName = orgPos!.OrganizationPosition!.PositionMaster!.PositionPath!.Name,
ReceiveUser = profile,
CreatedUserId = FullName ?? "",
CreatedFullName = UserId ?? "System Administrator",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
});
}
}
await _context.SaveChangesAsync();
return Success();
@ -336,5 +396,193 @@ namespace BMA.EHR.Retirement.Service.Controllers
return Success();
}
/// <summary>
/// List รายชื่อส่งหนังสือเวียน
/// </summary>
/// <param name="id">Id การถึงแก่กรรม</param>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("detail/{id:length(36)}")]
public async Task<ActionResult<ResponseObject>> GetDetail(Guid id)
{
var data = await _context.RetirementDeceasedNotis.AsQueryable()
.Where(x => x.RetirementDeceased.Id == id)
.Select(p => new
{
p.Id,
p.CitizenId,
p.Prefix,
p.FirstName,
p.LastName,
p.IsSendMail,
p.IsSendInbox,
p.IsSendNotification,
p.OrganizationName,
p.PositionName,
ProfileId = p.ReceiveUser.Id,
})
.ToListAsync();
return Success(data);
}
/// <summary>
/// เพิ่มรายชื่อส่งหนังสือเวียน
/// </summary>
/// <param name="id">Id การถึงแก่กรรม</param>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("detail/{id:length(36)}")]
public async Task<ActionResult<ResponseObject>> UpdateDetail([FromBody] RetirementDeceasedAddNotiPersonRequest req, Guid id)
{
var retirementDeceased = await _context.RetirementDeceaseds.AsQueryable()
.Include(x => x.RetirementDeceasedNotis)
.FirstOrDefaultAsync(x => x.Id == id);
if (retirementDeceased == null)
return Error(GlobalMessages.RetirementDeceasedNotFound, 404);
foreach (var item in req.Persons)
{
var profile = await _context.Profiles.AsQueryable()
.Include(x => x.Prefix)
.Include(x => x.Position)
.FirstOrDefaultAsync(x => x.Id == item.ProfileId);
if (profile == null)
continue;
retirementDeceased.RetirementDeceasedNotis.Add(new RetirementDeceasedNoti
{
CitizenId = profile.CitizenId == null ? "" : profile.CitizenId,
Prefix = profile.Prefix == null ? "" : profile.Prefix.Name,
FirstName = profile.FirstName == null ? "" : profile.FirstName,
LastName = profile.LastName == null ? "" : profile.LastName,
IsSendMail = item.IsSendMail,
IsSendInbox = item.IsSendInbox,
IsSendNotification = item.IsSendNotification,
OrganizationName = profile.OrganizationOrganization == null ? "" : profile.OrganizationOrganization,
PositionName = profile.Position == null ? null : profile.Position.Name,
ReceiveUser = profile,
CreatedUserId = FullName ?? "",
CreatedFullName = UserId ?? "System Administrator",
CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
});
await _context.SaveChangesAsync();
}
return Success();
}
/// <summary>
/// ลบรายชื่อส่งหนังสือเวียน
/// </summary>
/// <param name="id">Id หนังสือเวียน</param>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpDelete("detail/{id:length(36)}")]
public async Task<ActionResult<ResponseObject>> DeleteDetail(Guid id)
{
var retirementDeceasedNoti = await _context.RetirementDeceasedNotis.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == id);
if (retirementDeceasedNoti == null)
return Error(GlobalMessages.RetirementDeceasedNotiNotFound, 404);
_context.RetirementDeceasedNotis.Remove(retirementDeceasedNoti);
await _context.SaveChangesAsync();
return Success();
}
/// <summary>
/// Noti ส่งหนังสือเวียน
/// </summary>
/// <param name="id">Id การถึงแก่กรรม</param>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("noti/{id:length(36)}")]
public async Task<ActionResult<ResponseObject>> NotiDeceased([FromBody] RetirementDeceasedAddNotiPersonRequest req, Guid id)
{
var items = await _context.RetirementDeceasedNotis.AsQueryable()
.Include(x => x.ReceiveUser)
.Include(x => x.RetirementDeceased)
.ThenInclude(x => x.Profile)
.ThenInclude(x => x.Prefix)
.Where(x => x.RetirementDeceased.Id == id)
.ToListAsync();
foreach (var item in items)
{
var prefix = item.RetirementDeceased.Profile.Prefix == null ? "" : item.RetirementDeceased.Profile.Prefix.Name;
var profile = req.Persons.FirstOrDefault(x => x.ProfileId == item.ReceiveUser.Id);
if (profile != null)
{
if (profile.IsSendInbox == true)
{
var inbox = new Inbox
{
Subject = $"หนังสือเวียนถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
Body = $"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
ReceiverUserId = item.ReceiveUser.Id,
Payload = "",
};
_context.Inboxes.Add(inbox);
}
if (profile.IsSendNotification == true)
{
var noti = new Notification
{
Body = $"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
ReceiverUserId = item.ReceiveUser.Id,
Type = "",
Payload = "",
};
_context.Notifications.Add(noti);
}
item.IsSendMail = profile.IsSendMail;
item.IsSendInbox = profile.IsSendInbox;
item.IsSendNotification = profile.IsSendNotification;
}
else
{
if (item.IsSendInbox == true)
{
var inbox = new Inbox
{
Subject = $"หนังสือเวียนถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
Body = $"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
ReceiverUserId = item.ReceiveUser.Id,
Payload = "",
};
_context.Inboxes.Add(inbox);
}
if (item.IsSendNotification == true)
{
var noti = new Notification
{
Body = $"แจ้งข่าวการถึงแก่กรรมของ {prefix}{item.RetirementDeceased.Profile.FirstName} {item.RetirementDeceased.Profile.LastName}",
ReceiverUserId = item.ReceiveUser.Id,
Type = "",
Payload = "",
};
_context.Notifications.Add(noti);
}
}
}
await _context.SaveChangesAsync();
return Success();
}
}
}

View file

@ -514,7 +514,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
.FirstOrDefaultAsync(x => x.Id == id);
if (updated == null)
return Error(GlobalMessages.RetirementResignNotFound, 404);
if ((DateTime.Now - updated.CreatedAt).TotalDays > 90)
if ((DateTime.Now - updated.CreatedAt).TotalDays >= 90)
return Error("สามารถยับยั้งได้ไม่เกิน 90 วัน");
// updated.Status = "REJECT";
updated.CommanderReject = true;
@ -571,7 +571,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
.FirstOrDefaultAsync(x => x.Id == id);
if (updated == null)
return Error(GlobalMessages.RetirementResignNotFound, 404);
if ((DateTime.Now - updated.CreatedAt).TotalDays > 90)
if ((DateTime.Now - updated.CreatedAt).TotalDays >= 90)
return Error("สามารถยับยั้งได้ไม่เกิน 90 วัน");
updated.Status = "REJECT";
updated.OligarchReject = true;
@ -647,6 +647,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
Suggestion = p.Suggestion,
LastUpdatedAt = p.LastUpdatedAt,
CreatedAt = p.CreatedAt,
AppointDate = p.AppointDate,
})
.ToListAsync();
return Success(data);

View file

@ -0,0 +1,17 @@
using BMA.EHR.Domain.Models.MetaData;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Retirement.Service.Requests
{
public class RetirementDeceasedAddNotiPersonRequest
{
public List<RetirementDeceasedAddNotiPerson> Persons { get; set; }
}
public class RetirementDeceasedAddNotiPerson
{
public Guid ProfileId { get; set; }
public bool IsSendMail { get; set; }
public bool IsSendInbox { get; set; }
public bool IsSendNotification { get; set; }
}
}

View file

@ -0,0 +1,10 @@
using BMA.EHR.Domain.Models.MetaData;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Retirement.Service.Requests
{
public class RetirementDeceasedAddNotiRequest
{
public Guid ProfileId { get; set; }
}
}