api หนังสือเวียน
This commit is contained in:
parent
c54f3709ef
commit
6ab37f3ace
13 changed files with 32708 additions and 1 deletions
|
|
@ -60,6 +60,9 @@ namespace BMA.EHR.Domain.Models.HR
|
||||||
|
|
||||||
[Comment("ประเภทคำสั่ง")]
|
[Comment("ประเภทคำสั่ง")]
|
||||||
public string CommandTypeName { get; set; }
|
public string CommandTypeName { get; set; }
|
||||||
|
|
||||||
|
[Comment("ประเภทตำแหน่งกรณีพิเศษ")]
|
||||||
|
public string? SalaryStatus { get; set; }
|
||||||
public bool IsActive { get; set; } = true;
|
public bool IsActive { get; set; } = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,5 +24,6 @@ namespace BMA.EHR.Domain.Models.Retirement
|
||||||
public Profile Profile { get; set; }
|
public Profile Profile { get; set; }
|
||||||
[Comment("สถานะการใช้งาน")]
|
[Comment("สถานะการใช้งาน")]
|
||||||
public bool IsActive { get; set; } = true;
|
public bool IsActive { get; set; } = true;
|
||||||
|
public virtual List<RetirementDeceasedNoti> RetirementDeceasedNotis { get; set; } = new List<RetirementDeceasedNoti>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
45
BMA.EHR.Domain/Models/Retirement/RetirementDeceasedNoti.cs
Normal file
45
BMA.EHR.Domain/Models/Retirement/RetirementDeceasedNoti.cs
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -99,6 +99,7 @@
|
||||||
public static readonly string RetirementHistoryNotFound = "ไม่พบข้อมูลประวัติการประกาศเกษียณอายุราชการ";
|
public static readonly string RetirementHistoryNotFound = "ไม่พบข้อมูลประวัติการประกาศเกษียณอายุราชการ";
|
||||||
public static readonly string RetirementResignNotFound = "ไม่พบข้อมูลการคำขอลาออก";
|
public static readonly string RetirementResignNotFound = "ไม่พบข้อมูลการคำขอลาออก";
|
||||||
public static readonly string RetirementDeceasedNotFound = "ไม่พบข้อมูลบันทึกเวียนแจ้งการถึงแก่กรรม";
|
public static readonly string RetirementDeceasedNotFound = "ไม่พบข้อมูลบันทึกเวียนแจ้งการถึงแก่กรรม";
|
||||||
|
public static readonly string RetirementDeceasedNotiNotFound = "ไม่พบข้อมูลแจ้งเตือนบันทึกเวียนแจ้งการถึงแก่กรรม";
|
||||||
public static readonly string RetirementDischargeNotFound = "ไม่พบข้อมูลปลดออก";
|
public static readonly string RetirementDischargeNotFound = "ไม่พบข้อมูลปลดออก";
|
||||||
public static readonly string RetirementExpulsionNotFound = "ไม่พบข้อมูลไล่ออก";
|
public static readonly string RetirementExpulsionNotFound = "ไม่พบข้อมูลไล่ออก";
|
||||||
public static readonly string RetirementOtherNotFound = "ไม่พบข้อมูลอื่นๆ";
|
public static readonly string RetirementOtherNotFound = "ไม่พบข้อมูลอื่นๆ";
|
||||||
|
|
|
||||||
16022
BMA.EHR.Infrastructure/Migrations/20230901061213_update table profilesalary add SalaryStatus.Designer.cs
generated
Normal file
16022
BMA.EHR.Infrastructure/Migrations/20230901061213_update table profilesalary add SalaryStatus.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
16154
BMA.EHR.Infrastructure/Migrations/20230901074519_add table RetirementDeceasedNotis.Designer.cs
generated
Normal file
16154
BMA.EHR.Infrastructure/Migrations/20230901074519_add table RetirementDeceasedNotis.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4703,6 +4703,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.HasColumnType("longtext")
|
.HasColumnType("longtext")
|
||||||
.HasComment("เอกสารอ้างอิง");
|
.HasComment("เอกสารอ้างอิง");
|
||||||
|
|
||||||
|
b.Property<string>("SalaryStatus")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("ประเภทตำแหน่งกรณีพิเศษ");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("PositionLevelId");
|
b.HasIndex("PositionLevelId");
|
||||||
|
|
@ -12652,6 +12656,114 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
b.ToTable("RetirementDeceaseds");
|
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 =>
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementDischarge", b =>
|
||||||
{
|
{
|
||||||
b.Property<Guid>("Id")
|
b.Property<Guid>("Id")
|
||||||
|
|
@ -15520,6 +15632,25 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
b.Navigation("Profile");
|
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 =>
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementDischarge", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
|
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
|
||||||
|
|
@ -15993,6 +16124,11 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
b.Navigation("PlacementTransferDocs");
|
b.Navigation("PlacementTransferDocs");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementDeceased", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("RetirementDeceasedNotis");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementOther", b =>
|
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementOther", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("RetirementOtherDocs");
|
b.Navigation("RetirementOtherDocs");
|
||||||
|
|
|
||||||
|
|
@ -320,6 +320,7 @@ namespace BMA.EHR.Infrastructure.Persistence
|
||||||
public DbSet<RetirementPeriod> RetirementPeriods { get; set; }
|
public DbSet<RetirementPeriod> RetirementPeriods { get; set; }
|
||||||
public DbSet<RetirementProfile> RetirementProfiles { get; set; }
|
public DbSet<RetirementProfile> RetirementProfiles { get; set; }
|
||||||
public DbSet<RetirementDeceased> RetirementDeceaseds { get; set; }
|
public DbSet<RetirementDeceased> RetirementDeceaseds { get; set; }
|
||||||
|
public DbSet<RetirementDeceasedNoti> RetirementDeceasedNotis { get; set; }
|
||||||
public DbSet<RetirementResign> RetirementResigns { get; set; }
|
public DbSet<RetirementResign> RetirementResigns { get; set; }
|
||||||
public DbSet<RetirementResignDoc> RetirementResignDocs { get; set; }
|
public DbSet<RetirementResignDoc> RetirementResignDocs { get; set; }
|
||||||
public DbSet<RetirementOut> RetirementOuts { get; set; }
|
public DbSet<RetirementOut> RetirementOuts { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ using BMA.EHR.Domain.Common;
|
||||||
using BMA.EHR.Domain.Extensions;
|
using BMA.EHR.Domain.Extensions;
|
||||||
using BMA.EHR.Domain.Models.HR;
|
using BMA.EHR.Domain.Models.HR;
|
||||||
using BMA.EHR.Domain.Models.MetaData;
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
using BMA.EHR.Domain.Models.Notifications;
|
||||||
using BMA.EHR.Domain.Models.Retirement;
|
using BMA.EHR.Domain.Models.Retirement;
|
||||||
using BMA.EHR.Domain.Shared;
|
using BMA.EHR.Domain.Shared;
|
||||||
using BMA.EHR.Infrastructure.Persistence;
|
using BMA.EHR.Infrastructure.Persistence;
|
||||||
|
|
@ -11,6 +12,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
|
using System.Reflection.Metadata;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
|
|
@ -237,13 +239,14 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
};
|
};
|
||||||
await _context.RetirementDeceaseds.AddAsync(retirementDeceased);
|
await _context.RetirementDeceaseds.AddAsync(retirementDeceased);
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
var _doc = new Domain.Models.Documents.Document();
|
||||||
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
|
||||||
{
|
{
|
||||||
var file = Request.Form.Files[0];
|
var file = Request.Form.Files[0];
|
||||||
var fileExtension = Path.GetExtension(file.FileName);
|
var fileExtension = Path.GetExtension(file.FileName);
|
||||||
|
|
||||||
var doc = await _documentService.UploadFileAsync(file, 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);
|
.FirstOrDefaultAsync(x => x.Id == doc.Id);
|
||||||
if (_doc != null)
|
if (_doc != null)
|
||||||
retirementDeceased.Document = _doc;
|
retirementDeceased.Document = _doc;
|
||||||
|
|
@ -256,6 +259,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
SalaryClass = "-",
|
SalaryClass = "-",
|
||||||
PosNoEmployee = "-",
|
PosNoEmployee = "-",
|
||||||
CommandTypeName = "-",
|
CommandTypeName = "-",
|
||||||
|
SalaryStatus = "DEATH",
|
||||||
Profile = profile,
|
Profile = profile,
|
||||||
CreatedUserId = FullName ?? "",
|
CreatedUserId = FullName ?? "",
|
||||||
CreatedFullName = UserId ?? "System Administrator",
|
CreatedFullName = UserId ?? "System Administrator",
|
||||||
|
|
@ -264,6 +268,22 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
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,
|
||||||
|
});
|
||||||
|
}
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
|
|
@ -336,5 +356,189 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
|
|
||||||
return Success();
|
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([FromForm] RetirementDeceasedAddNotiRequest 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);
|
||||||
|
|
||||||
|
var profile = await _context.Profiles.AsQueryable()
|
||||||
|
.Include(x => x.Prefix)
|
||||||
|
.Include(x => x.Position)
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == req.ProfileId);
|
||||||
|
if (profile == null)
|
||||||
|
return Error(GlobalMessages.DataNotFound, 404);
|
||||||
|
|
||||||
|
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 = req.IsSendMail,
|
||||||
|
// IsSendInbox = req.IsSendInbox,
|
||||||
|
// IsSendNotification = req.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([FromForm] 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.Person.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.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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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> Person { 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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue