api import เครื่องราช,ใบกำกับ
This commit is contained in:
parent
9c610407f4
commit
69f23fd0cb
21 changed files with 47554 additions and 55 deletions
|
|
@ -4857,6 +4857,7 @@ namespace BMA.EHR.Application.Repositories
|
||||||
Year = period.Year,
|
Year = period.Year,
|
||||||
Round = period.Round,
|
Round = period.Round,
|
||||||
Name = period.Name,
|
Name = period.Name,
|
||||||
|
RequestNote = request == null ? "" : request.RequestNote,
|
||||||
RequestStatus = request == null ? null : request.RequestStatus,
|
RequestStatus = request == null ? null : request.RequestStatus,
|
||||||
OrganizationName = request == null ? "" : request.Organization.OrganizationOrganization.Name
|
OrganizationName = request == null ? "" : request.Organization.OrganizationOrganization.Name
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ namespace BMA.EHR.Application.Requests
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
public int Year { get; set; }
|
public int Year { get; set; }
|
||||||
public int Round { get; set; }
|
public int Round { get; set; }
|
||||||
|
public string RequestNote { get; set; }
|
||||||
public string RequestStatus { get; set; }
|
public string RequestStatus { get; set; }
|
||||||
public string OrganizationName { get; set; }
|
public string OrganizationName { get; set; }
|
||||||
public List<InsigniaRequestItem> Items { get; set; }
|
public List<InsigniaRequestItem> Items { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,9 @@ namespace BMA.EHR.Domain.Models.Insignias
|
||||||
[Comment("วันที่ได้รับพระราชทานเครื่องราชฯ")]
|
[Comment("วันที่ได้รับพระราชทานเครื่องราชฯ")]
|
||||||
public DateTime? DateReceive { get; set; }
|
public DateTime? DateReceive { get; set; }
|
||||||
[Comment("สังกัด ณ วันที่ขอพระราชทานเครื่องราชฯ")]
|
[Comment("สังกัด ณ วันที่ขอพระราชทานเครื่องราชฯ")]
|
||||||
public OrganizationOrganization? OrganizationOrganizationSend { get; set; }
|
public string? OrganizationOrganizationSend { get; set; }
|
||||||
|
[Comment("สังกัด ณ วันที่ได้รับพระราชทานเครื่องราชฯ")]
|
||||||
|
public string? OrganizationOrganizationReceive { get; set; }
|
||||||
[Comment("วันที่")]
|
[Comment("วันที่")]
|
||||||
public DateTime? Date { get; set; }
|
public DateTime? Date { get; set; }
|
||||||
[Comment("เล่มที่")]
|
[Comment("เล่มที่")]
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,9 @@ namespace BMA.EHR.Domain.Models.Insignias
|
||||||
[Comment("สถานะตำแหน่งที่ยื่นขอ")]
|
[Comment("สถานะตำแหน่งที่ยื่นขอ")]
|
||||||
public string Status { get; set; } = "PENDING";
|
public string Status { get; set; } = "PENDING";
|
||||||
|
|
||||||
|
[Comment("เหตุผลไม่ยื่นขอ")]
|
||||||
|
public string? Reason { get; set; }
|
||||||
|
|
||||||
public Profile Profile { get; set; }
|
public Profile Profile { get; set; }
|
||||||
|
|
||||||
public Insignia RequestInsignia { get; set; }
|
public Insignia RequestInsignia { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,8 @@ namespace BMA.EHR.Domain.Models.Organizations
|
||||||
|
|
||||||
[Column(Order = 17), Comment("กอง")]
|
[Column(Order = 17), Comment("กอง")]
|
||||||
public string? Pile { get; set; }
|
public string? Pile { get; set; }
|
||||||
|
[Comment("สถานะการใช้งาน")]
|
||||||
|
public bool IsActive { get; set; } = true;
|
||||||
|
|
||||||
public OrganizationStatus? OrganizationStatus { get; set; }
|
public OrganizationStatus? OrganizationStatus { get; set; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ namespace BMA.EHR.Domain.Models.Retirement
|
||||||
[Comment("อื่นๆ เหตุใดท่านจึงตัดสินใจร่วมงานกับกรุงเทพมหานคร")]
|
[Comment("อื่นๆ เหตุใดท่านจึงตัดสินใจร่วมงานกับกรุงเทพมหานคร")]
|
||||||
public string? ReasonWorkOther { get; set; }
|
public string? ReasonWorkOther { get; set; }
|
||||||
[Comment("สำหรับการลาออกในครั้งนี้ ท่านได้คิดทบทวนอย่างจริงจังเป็นระยะเวลานานเท่าใด")]
|
[Comment("สำหรับการลาออกในครั้งนี้ ท่านได้คิดทบทวนอย่างจริงจังเป็นระยะเวลานานเท่าใด")]
|
||||||
public string? TimeThink { get; set; }
|
public int? TimeThink { get; set; }
|
||||||
[Comment("ปัจจัยใดที่ทำให้ท่านตัดสินใจลาออกจากราชการ")]
|
[Comment("ปัจจัยใดที่ทำให้ท่านตัดสินใจลาออกจากราชการ")]
|
||||||
public string? ExitFactor { get; set; }
|
public string? ExitFactor { get; set; }
|
||||||
[Comment("อื่นๆ ปัจจัยใดที่ทำให้ท่านตัดสินใจลาออกจากราชการ")]
|
[Comment("อื่นๆ ปัจจัยใดที่ทำให้ท่านตัดสินใจลาออกจากราชการ")]
|
||||||
|
|
|
||||||
15599
BMA.EHR.Infrastructure/Migrations/20230824031748_update table InsigniaRequestProfile add reason.Designer.cs
generated
Normal file
15599
BMA.EHR.Infrastructure/Migrations/20230824031748_update table InsigniaRequestProfile add reason.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 updatetableInsigniaRequestProfileaddreason : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Reason",
|
||||||
|
table: "InsigniaRequestProfiles",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "เหตุผลไม่ยื่นขอ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Reason",
|
||||||
|
table: "InsigniaRequestProfiles");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15604
BMA.EHR.Infrastructure/Migrations/20230824045808_update table InsigniaRequestProfile add reason1.Designer.cs
generated
Normal file
15604
BMA.EHR.Infrastructure/Migrations/20230824045808_update table InsigniaRequestProfile add reason1.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,98 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class updatetableInsigniaRequestProfileaddreason1 : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_InsigniaNoteProfiles_OrganizationOrganizations_OrganizationO~",
|
||||||
|
table: "InsigniaNoteProfiles");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_InsigniaNoteProfiles_OrganizationOrganizationSendId",
|
||||||
|
table: "InsigniaNoteProfiles");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "OrganizationOrganizationSendId",
|
||||||
|
table: "InsigniaNoteProfiles");
|
||||||
|
|
||||||
|
// migrationBuilder.AddColumn<bool>(
|
||||||
|
// name: "IsActive",
|
||||||
|
// table: "Organizations",
|
||||||
|
// type: "tinyint(1)",
|
||||||
|
// nullable: false,
|
||||||
|
// defaultValue: false,
|
||||||
|
// comment: "สถานะการใช้งาน");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "InvoiceNumber",
|
||||||
|
table: "InsigniaNoteProfiles",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "หมายเลขใบกำกับ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "OrganizationOrganizationReceive",
|
||||||
|
table: "InsigniaNoteProfiles",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "สังกัด ณ วันที่ได้รับพระราชทานเครื่องราชฯ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "OrganizationOrganizationSend",
|
||||||
|
table: "InsigniaNoteProfiles",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "สังกัด ณ วันที่ขอพระราชทานเครื่องราชฯ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
// migrationBuilder.DropColumn(
|
||||||
|
// name: "IsActive",
|
||||||
|
// table: "Organizations");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "InvoiceNumber",
|
||||||
|
table: "InsigniaNoteProfiles");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "OrganizationOrganizationReceive",
|
||||||
|
table: "InsigniaNoteProfiles");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "OrganizationOrganizationSend",
|
||||||
|
table: "InsigniaNoteProfiles");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "OrganizationOrganizationSendId",
|
||||||
|
table: "InsigniaNoteProfiles",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_InsigniaNoteProfiles_OrganizationOrganizationSendId",
|
||||||
|
table: "InsigniaNoteProfiles",
|
||||||
|
column: "OrganizationOrganizationSendId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_InsigniaNoteProfiles_OrganizationOrganizations_OrganizationO~",
|
||||||
|
table: "InsigniaNoteProfiles",
|
||||||
|
column: "OrganizationOrganizationSendId",
|
||||||
|
principalTable: "OrganizationOrganizations",
|
||||||
|
principalColumn: "Id");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
15600
BMA.EHR.Infrastructure/Migrations/20230824054136_update table InsigniaRequestProfile remove invoice.Designer.cs
generated
Normal file
15600
BMA.EHR.Infrastructure/Migrations/20230824054136_update table InsigniaRequestProfile remove invoice.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 updatetableInsigniaRequestProfileremoveinvoice : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "InvoiceNumber",
|
||||||
|
table: "InsigniaNoteProfiles");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "InvoiceNumber",
|
||||||
|
table: "InsigniaNoteProfiles",
|
||||||
|
type: "longtext",
|
||||||
|
nullable: true,
|
||||||
|
comment: "หมายเลขใบกำกับ")
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5407,8 +5407,13 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.HasColumnType("longtext")
|
.HasColumnType("longtext")
|
||||||
.HasComment("หมายเลขประกาศนียบัตรกำกับเครื่องราชฯ");
|
.HasComment("หมายเลขประกาศนียบัตรกำกับเครื่องราชฯ");
|
||||||
|
|
||||||
b.Property<Guid?>("OrganizationOrganizationSendId")
|
b.Property<string>("OrganizationOrganizationReceive")
|
||||||
.HasColumnType("char(36)");
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("สังกัด ณ วันที่ได้รับพระราชทานเครื่องราชฯ");
|
||||||
|
|
||||||
|
b.Property<string>("OrganizationOrganizationSend")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("สังกัด ณ วันที่ขอพระราชทานเครื่องราชฯ");
|
||||||
|
|
||||||
b.Property<string>("Page")
|
b.Property<string>("Page")
|
||||||
.HasColumnType("longtext")
|
.HasColumnType("longtext")
|
||||||
|
|
@ -5447,8 +5452,6 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
|
||||||
b.HasIndex("InsigniaNoteId");
|
b.HasIndex("InsigniaNoteId");
|
||||||
|
|
||||||
b.HasIndex("OrganizationOrganizationSendId");
|
|
||||||
|
|
||||||
b.HasIndex("ProfileId");
|
b.HasIndex("ProfileId");
|
||||||
|
|
||||||
b.HasIndex("RequestInsigniaId");
|
b.HasIndex("RequestInsigniaId");
|
||||||
|
|
@ -5670,6 +5673,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
b.Property<Guid>("ProfileId")
|
b.Property<Guid>("ProfileId")
|
||||||
.HasColumnType("char(36)");
|
.HasColumnType("char(36)");
|
||||||
|
|
||||||
|
b.Property<string>("Reason")
|
||||||
|
.HasColumnType("longtext")
|
||||||
|
.HasComment("เหตุผลไม่ยื่นขอ");
|
||||||
|
|
||||||
b.Property<DateTime>("RequestDate")
|
b.Property<DateTime>("RequestDate")
|
||||||
.HasColumnType("datetime(6)");
|
.HasColumnType("datetime(6)");
|
||||||
|
|
||||||
|
|
@ -9234,6 +9241,10 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.HasColumnOrder(15)
|
.HasColumnOrder(15)
|
||||||
.HasComment("ส่วนราชการ");
|
.HasComment("ส่วนราชการ");
|
||||||
|
|
||||||
|
b.Property<bool>("IsActive")
|
||||||
|
.HasColumnType("tinyint(1)")
|
||||||
|
.HasComment("สถานะการใช้งาน");
|
||||||
|
|
||||||
b.Property<string>("LastUpdateFullName")
|
b.Property<string>("LastUpdateFullName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(200)
|
.HasMaxLength(200)
|
||||||
|
|
@ -14066,10 +14077,6 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationOrganization", "OrganizationOrganizationSend")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("OrganizationOrganizationSendId");
|
|
||||||
|
|
||||||
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
|
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("ProfileId")
|
.HasForeignKey("ProfileId")
|
||||||
|
|
@ -14084,8 +14091,6 @@ namespace BMA.EHR.Infrastructure.Migrations
|
||||||
|
|
||||||
b.Navigation("InsigniaNote");
|
b.Navigation("InsigniaNote");
|
||||||
|
|
||||||
b.Navigation("OrganizationOrganizationSend");
|
|
||||||
|
|
||||||
b.Navigation("Profile");
|
b.Navigation("Profile");
|
||||||
|
|
||||||
b.Navigation("RequestInsignia");
|
b.Navigation("RequestInsignia");
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Security.Claims;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Security.Claims;
|
||||||
using BMA.EHR.Application.Repositories;
|
using BMA.EHR.Application.Repositories;
|
||||||
using BMA.EHR.Application.Requests;
|
using BMA.EHR.Application.Requests;
|
||||||
using BMA.EHR.Domain.Common;
|
using BMA.EHR.Domain.Common;
|
||||||
|
|
@ -10,6 +11,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using OfficeOpenXml;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
|
|
||||||
namespace BMA.EHR.Insignia.Service.Controllers
|
namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
|
|
@ -68,6 +70,60 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
default: return "สถานะไม่ถูกต้อง";
|
default: return "สถานะไม่ถูกต้อง";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private List<string> GetOcNameFullPath(Guid id, bool showRoot = false)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var ocList = new List<string>();
|
||||||
|
|
||||||
|
var oc = (from o in _context.Organizations.Include(x => x.Parent).Include(x => x.OrganizationOrganization).Where(x => x.OrganizationOrganization != null).AsQueryable()
|
||||||
|
join oc_name in _context.OrganizationOrganizations.AsQueryable() on o.OrganizationOrganization.Id equals oc_name.Id
|
||||||
|
where o.Parent != null
|
||||||
|
select new
|
||||||
|
{
|
||||||
|
Id = o.Id,
|
||||||
|
Name = oc_name.Name,
|
||||||
|
o.IsActive,
|
||||||
|
o.Parent
|
||||||
|
}).FirstOrDefault(x => x.Id == id && x.IsActive);
|
||||||
|
|
||||||
|
if (oc == null)
|
||||||
|
return ocList;
|
||||||
|
|
||||||
|
ocList.Add(oc.Name);
|
||||||
|
|
||||||
|
if (oc.Parent?.Id != null)
|
||||||
|
{
|
||||||
|
ocList.AddRange(GetOcNameFullPath(oc.Parent.Id, showRoot));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ocList;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string FindOCFullPath(Guid id, bool showRoot = false)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var ocList = GetOcNameFullPath(id, showRoot);
|
||||||
|
var ret = String.Empty;
|
||||||
|
foreach (var oc in ocList)
|
||||||
|
{
|
||||||
|
ret = oc + "/" + ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ret.Substring(0, ret.Length - 1);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
@ -287,6 +343,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
Guid period = result.PeriodId;
|
Guid period = result.PeriodId;
|
||||||
var periodName = result.Name;
|
var periodName = result.Name;
|
||||||
string requestStatus = result.RequestStatus;
|
string requestStatus = result.RequestStatus;
|
||||||
|
string requestNote = result.RequestNote;
|
||||||
var resend = new InsigniaResults
|
var resend = new InsigniaResults
|
||||||
{
|
{
|
||||||
PeriodId = period,
|
PeriodId = period,
|
||||||
|
|
@ -294,6 +351,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
Round = result.Round,
|
Round = result.Round,
|
||||||
Name = periodName,
|
Name = periodName,
|
||||||
RequestStatus = requestStatus,
|
RequestStatus = requestStatus,
|
||||||
|
RequestNote = requestNote,
|
||||||
OrganizationName = result.OrganizationName,
|
OrganizationName = result.OrganizationName,
|
||||||
Items = new List<InsigniaRequestItem>()
|
Items = new List<InsigniaRequestItem>()
|
||||||
};
|
};
|
||||||
|
|
@ -522,7 +580,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("officer/approve/{ocId:length(36)}")]
|
[HttpGet("officer/approve/{id:length(36)}/{ocId:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> ApproveChangeStatusToSt2(Guid id, Guid ocId)
|
public async Task<ActionResult<ResponseObject>> ApproveChangeStatusToSt2(Guid id, Guid ocId)
|
||||||
{
|
{
|
||||||
await _repository.SaveAprove(id, ocId);
|
await _repository.SaveAprove(id, ocId);
|
||||||
|
|
@ -531,6 +589,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
if (requestNew != null)
|
if (requestNew != null)
|
||||||
{
|
{
|
||||||
requestNew.RequestStatus = "st3";
|
requestNew.RequestStatus = "st3";
|
||||||
|
requestNew.RequestNote = "";
|
||||||
_context.SaveChanges();
|
_context.SaveChanges();
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
@ -546,15 +605,16 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("officer/reject/{ocId:length(36)}")]
|
[HttpPut("officer/reject/{id:length(36)}/{ocId:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> RejectChangeStatusToSt1(Guid id, Guid ocId)
|
public async Task<ActionResult<ResponseObject>> RejectChangeStatusToSt1([FromBody] InsigniaReasonRequest req, Guid id, Guid ocId)
|
||||||
{
|
{
|
||||||
await _repository.SaveAprove(id, ocId);
|
await _repository.SaveAprove(id, ocId);
|
||||||
var requestId = await _repository.GetRequestId(id, ocId);
|
var requestId = await _repository.GetRequestId(id, ocId);
|
||||||
var requestNew = await _context.InsigniaRequests.FirstOrDefaultAsync(i => i.Id == requestId);
|
var requestNew = await _context.InsigniaRequests.FirstOrDefaultAsync(i => i.Id == requestId);
|
||||||
if (requestNew != null)
|
if (requestNew != null)
|
||||||
{
|
{
|
||||||
requestNew.RequestStatus = "st2";
|
requestNew.RequestStatus = "st5";
|
||||||
|
requestNew.RequestNote = req.Reason;
|
||||||
_context.SaveChanges();
|
_context.SaveChanges();
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
@ -570,7 +630,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("director/approve/{ocId:length(36)}")]
|
[HttpGet("director/approve/{id:length(36)}/{ocId:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> ApproveChangeStatusToSt3(Guid id, Guid ocId)
|
public async Task<ActionResult<ResponseObject>> ApproveChangeStatusToSt3(Guid id, Guid ocId)
|
||||||
{
|
{
|
||||||
var requestId = await _repository.GetRequestId(id, ocId);
|
var requestId = await _repository.GetRequestId(id, ocId);
|
||||||
|
|
@ -578,6 +638,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
if (requestNew != null)
|
if (requestNew != null)
|
||||||
{
|
{
|
||||||
requestNew.RequestStatus = "st5";
|
requestNew.RequestStatus = "st5";
|
||||||
|
requestNew.RequestNote = "";
|
||||||
_context.SaveChanges();
|
_context.SaveChanges();
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
@ -593,14 +654,15 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("director/reject/{ocId:length(36)}")]
|
[HttpPut("director/reject/{id:length(36)}/{ocId:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> RejectChangeStatusToSt2(Guid id, Guid ocId)
|
public async Task<ActionResult<ResponseObject>> RejectChangeStatusToSt2([FromBody] InsigniaReasonRequest req, Guid id, Guid ocId)
|
||||||
{
|
{
|
||||||
var requestId = await _repository.GetRequestId(id, ocId);
|
var requestId = await _repository.GetRequestId(id, ocId);
|
||||||
var requestNew = await _context.InsigniaRequests.FirstOrDefaultAsync(i => i.Id == requestId);
|
var requestNew = await _context.InsigniaRequests.FirstOrDefaultAsync(i => i.Id == requestId);
|
||||||
if (requestNew != null)
|
if (requestNew != null)
|
||||||
{
|
{
|
||||||
requestNew.RequestStatus = "st4";
|
requestNew.RequestStatus = "st4";
|
||||||
|
requestNew.RequestNote = req.Reason;
|
||||||
_context.SaveChanges();
|
_context.SaveChanges();
|
||||||
return Success();
|
return Success();
|
||||||
}
|
}
|
||||||
|
|
@ -656,23 +718,20 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ย้ายขอมูลไปเป็น คนที่ไม่ยื่นขอ
|
/// ย้ายขอมูลไปเป็น คนที่ไม่ยื่นขอ
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="profileId">Id ผู้ยื่นขอ</param>
|
/// <param name="insigniaRequestProfileId">Id รายชื่อคนที่ยื่นของในรอบ</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <response code="200"></response>
|
/// <response code="200"></response>
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("status/reject/{profileId:length(36)}")]
|
[HttpPut("status/reject/{insigniaRequestProfileId:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> RejectProfileInsignia(Guid profileId)
|
public async Task<ActionResult<ResponseObject>> RejectProfileInsignia([FromBody] InsigniaReasonRequest req, Guid insigniaRequestProfileId)
|
||||||
{
|
{
|
||||||
var profile = await _context.Profiles.AsQueryable()
|
var insigniaRequestProfile = await _context.InsigniaRequestProfiles.FirstOrDefaultAsync(x => x.Id == insigniaRequestProfileId);
|
||||||
.FirstOrDefaultAsync(x => x.Id == profileId);
|
|
||||||
if (profile == null)
|
|
||||||
return Error(GlobalMessages.DataNotFound);
|
|
||||||
var insigniaRequestProfile = await _context.InsigniaRequestProfiles.FirstOrDefaultAsync(x => x.Profile == profile);
|
|
||||||
if (insigniaRequestProfile == null)
|
if (insigniaRequestProfile == null)
|
||||||
return Error(GlobalMessages.InsigniaPeriodNotFound);
|
return Error(GlobalMessages.InsigniaPeriodNotFound);
|
||||||
insigniaRequestProfile.Status = "REJECT";
|
insigniaRequestProfile.Status = "REJECT";
|
||||||
|
insigniaRequestProfile.Reason = req.Reason;
|
||||||
insigniaRequestProfile.LastUpdateFullName = FullName ?? "System Administrator";
|
insigniaRequestProfile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
insigniaRequestProfile.LastUpdateUserId = UserId ?? "";
|
insigniaRequestProfile.LastUpdateUserId = UserId ?? "";
|
||||||
insigniaRequestProfile.LastUpdatedAt = DateTime.Now;
|
insigniaRequestProfile.LastUpdatedAt = DateTime.Now;
|
||||||
|
|
@ -683,23 +742,20 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ย้ายขอมูลไปเป็น คนที่ถูกลบออก
|
/// ย้ายขอมูลไปเป็น คนที่ถูกลบออก
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="profileId">Id ผู้ยื่นขอ</param>
|
/// <param name="insigniaRequestProfileId">Id รายชื่อคนที่ยื่นของในรอบ</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <response code="200"></response>
|
/// <response code="200"></response>
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("status/delete/{profileId:length(36)}")]
|
[HttpPut("status/delete/{insigniaRequestProfileId:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> DeleteProfileInsignia(Guid profileId)
|
public async Task<ActionResult<ResponseObject>> DeleteProfileInsignia([FromBody] InsigniaReasonRequest req, Guid insigniaRequestProfileId)
|
||||||
{
|
{
|
||||||
var profile = await _context.Profiles.AsQueryable()
|
var insigniaRequestProfile = await _context.InsigniaRequestProfiles.FirstOrDefaultAsync(x => x.Id == insigniaRequestProfileId);
|
||||||
.FirstOrDefaultAsync(x => x.Id == profileId);
|
|
||||||
if (profile == null)
|
|
||||||
return Error(GlobalMessages.DataNotFound);
|
|
||||||
var insigniaRequestProfile = await _context.InsigniaRequestProfiles.FirstOrDefaultAsync(x => x.Profile == profile);
|
|
||||||
if (insigniaRequestProfile == null)
|
if (insigniaRequestProfile == null)
|
||||||
return Error(GlobalMessages.InsigniaPeriodNotFound);
|
return Error(GlobalMessages.InsigniaPeriodNotFound);
|
||||||
insigniaRequestProfile.Status = "DELETE";
|
insigniaRequestProfile.Status = "DELETE";
|
||||||
|
insigniaRequestProfile.Reason = req.Reason;
|
||||||
insigniaRequestProfile.LastUpdateFullName = FullName ?? "System Administrator";
|
insigniaRequestProfile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
insigniaRequestProfile.LastUpdateUserId = UserId ?? "";
|
insigniaRequestProfile.LastUpdateUserId = UserId ?? "";
|
||||||
insigniaRequestProfile.LastUpdatedAt = DateTime.Now;
|
insigniaRequestProfile.LastUpdatedAt = DateTime.Now;
|
||||||
|
|
@ -958,7 +1014,6 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
noreProfileOld.RequestDate = profileOld.RequestDate;
|
noreProfileOld.RequestDate = profileOld.RequestDate;
|
||||||
noreProfileOld.Salary = profileOld.Salary;
|
noreProfileOld.Salary = profileOld.Salary;
|
||||||
noreProfileOld.IsApprove = profileOld.IsApprove;
|
noreProfileOld.IsApprove = profileOld.IsApprove;
|
||||||
noreProfileOld.Status = profileOld.Status;
|
|
||||||
noreProfileOld.RequestInsignia = profileOld.RequestInsignia;
|
noreProfileOld.RequestInsignia = profileOld.RequestInsignia;
|
||||||
noreProfileOld.CreatedUserId = FullName ?? "";
|
noreProfileOld.CreatedUserId = FullName ?? "";
|
||||||
noreProfileOld.CreatedFullName = UserId ?? "System Administrator";
|
noreProfileOld.CreatedFullName = UserId ?? "System Administrator";
|
||||||
|
|
@ -973,10 +1028,10 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
RequestDate = profileOld.RequestDate,
|
RequestDate = profileOld.RequestDate,
|
||||||
Salary = profileOld.Salary,
|
Salary = profileOld.Salary,
|
||||||
IsApprove = profileOld.IsApprove,
|
IsApprove = profileOld.IsApprove,
|
||||||
Status = profileOld.Status,
|
Status = "PENDING",
|
||||||
Profile = profileOld.Profile,
|
Profile = profileOld.Profile,
|
||||||
RequestInsignia = profileOld.RequestInsignia,
|
RequestInsignia = profileOld.RequestInsignia,
|
||||||
OrganizationOrganizationSend = await _context.OrganizationOrganizations.FirstOrDefaultAsync(x => x.Id == profileOld.Profile.OrganizationOrganizationId),
|
OrganizationOrganizationSend = profileOld.Profile == null || profileOld.Profile.OcId == null ? null : FindOCFullPath(profileOld.Profile.OcId.Value, true),
|
||||||
InsigniaNote = insigniaNote,
|
InsigniaNote = insigniaNote,
|
||||||
CreatedUserId = FullName ?? "",
|
CreatedUserId = FullName ?? "",
|
||||||
CreatedFullName = UserId ?? "System Administrator",
|
CreatedFullName = UserId ?? "System Administrator",
|
||||||
|
|
@ -1063,13 +1118,21 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
.Where(x => req.InsigniaId == null ? x.RequestInsignia != null : (x.RequestInsignia.Id == req.InsigniaId))
|
.Where(x => req.InsigniaId == null ? x.RequestInsignia != null : (x.RequestInsignia.Id == req.InsigniaId))
|
||||||
.Select(x => new
|
.Select(x => new
|
||||||
{
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
Prefix = x.Profile.Prefix == null ? null : x.Profile.Prefix.Name,
|
||||||
|
Position = x.Profile.Position == null ? null : x.Profile.Position.Name,
|
||||||
|
ProfileType = x.Profile.ProfileType,
|
||||||
|
OcId = x.Profile.OcId,
|
||||||
|
CitizenId = x.Profile.CitizenId,
|
||||||
FullName = $"{x.Profile.FirstName} {x.Profile.LastName}",
|
FullName = $"{x.Profile.FirstName} {x.Profile.LastName}",
|
||||||
RequestInsignia = x.RequestInsignia.Name,
|
RequestInsignia = x.RequestInsignia.Name,
|
||||||
RequestInsigniaId = x.RequestInsignia.Id,
|
RequestInsigniaId = x.RequestInsignia.Id,
|
||||||
RequestInsigniaShortName = x.RequestInsignia.ShortName,
|
RequestInsigniaShortName = x.RequestInsignia.ShortName,
|
||||||
DateReceive = x.DateReceive,
|
DateReceive = x.DateReceive,
|
||||||
OrganizationOrganizationSend = x.OrganizationOrganizationSend == null ? null : x.OrganizationOrganizationSend.Name,
|
OrganizationOrganizationSend = x.OrganizationOrganizationSend,
|
||||||
OrganizationOrganizationReceive = x.Profile.OrganizationOrganization,
|
OrganizationOrganizationReceive = x.OrganizationOrganizationReceive,
|
||||||
|
Status = x.Status,
|
||||||
|
Issue = x.Issue,
|
||||||
Date = x.Date,
|
Date = x.Date,
|
||||||
VolumeNo = x.VolumeNo,
|
VolumeNo = x.VolumeNo,
|
||||||
Section = x.Section,
|
Section = x.Section,
|
||||||
|
|
@ -1078,15 +1141,123 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
DatePayment = x.DatePayment,
|
DatePayment = x.DatePayment,
|
||||||
TypePayment = x.TypePayment,
|
TypePayment = x.TypePayment,
|
||||||
Address = x.Address,
|
Address = x.Address,
|
||||||
|
Number = x.Number,
|
||||||
Salary = x.Salary,
|
Salary = x.Salary,
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
var _insigniaNoteProfiles = new List<dynamic>();
|
||||||
|
foreach (var insigniaNoteProfile in insigniaNoteProfiles)
|
||||||
|
{
|
||||||
|
_insigniaNoteProfiles.Add(
|
||||||
|
new
|
||||||
|
{
|
||||||
|
insigniaNoteProfile.Id,
|
||||||
|
insigniaNoteProfile.Prefix,
|
||||||
|
insigniaNoteProfile.Position,
|
||||||
|
insigniaNoteProfile.CitizenId,
|
||||||
|
insigniaNoteProfile.ProfileType,
|
||||||
|
insigniaNoteProfile.FullName,
|
||||||
|
insigniaNoteProfile.RequestInsignia,
|
||||||
|
insigniaNoteProfile.RequestInsigniaId,
|
||||||
|
insigniaNoteProfile.RequestInsigniaShortName,
|
||||||
|
insigniaNoteProfile.DateReceive,
|
||||||
|
insigniaNoteProfile.OrganizationOrganizationSend,
|
||||||
|
OrganizationOrganizationReceive = insigniaNoteProfile.OrganizationOrganizationReceive == null ? (insigniaNoteProfile.OcId == null ? null : FindOCFullPath(insigniaNoteProfile.OcId.Value, true)) : insigniaNoteProfile.OrganizationOrganizationReceive,
|
||||||
|
insigniaNoteProfile.Status,
|
||||||
|
insigniaNoteProfile.Issue,
|
||||||
|
insigniaNoteProfile.Date,
|
||||||
|
insigniaNoteProfile.VolumeNo,
|
||||||
|
insigniaNoteProfile.Section,
|
||||||
|
insigniaNoteProfile.Page,
|
||||||
|
insigniaNoteProfile.No,
|
||||||
|
insigniaNoteProfile.DatePayment,
|
||||||
|
insigniaNoteProfile.TypePayment,
|
||||||
|
insigniaNoteProfile.Address,
|
||||||
|
insigniaNoteProfile.Number,
|
||||||
|
insigniaNoteProfile.Salary,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return Success(insigniaNoteProfiles);
|
return Success(_insigniaNoteProfiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get รายชื่อบันทึกผลการได้รับพระราชทานเครื่องราชย์อิสริยสภรณ์/การจ่ายใบกำกับ
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="insigniaNoteProfileId">Id บุคคลในบันทึกผลเครื่องราช</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpGet("note/{insigniaNoteProfileId:length(36)}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetListNoteProfile(Guid insigniaNoteProfileId)
|
||||||
|
{
|
||||||
|
var insigniaNoteProfile = await _context.InsigniaNoteProfiles
|
||||||
|
.Where(x => x.Id == insigniaNoteProfileId)
|
||||||
|
.Select(x => new
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
Prefix = x.Profile.Prefix == null ? null : x.Profile.Prefix.Name,
|
||||||
|
Position = x.Profile.Position == null ? null : x.Profile.Position.Name,
|
||||||
|
ProfileType = x.Profile.ProfileType,
|
||||||
|
OcId = x.Profile.OcId,
|
||||||
|
CitizenId = x.Profile.CitizenId,
|
||||||
|
FullName = $"{x.Profile.FirstName} {x.Profile.LastName}",
|
||||||
|
RequestInsignia = x.RequestInsignia.Name,
|
||||||
|
RequestInsigniaId = x.RequestInsignia.Id,
|
||||||
|
RequestInsigniaShortName = x.RequestInsignia.ShortName,
|
||||||
|
DateReceive = x.DateReceive,
|
||||||
|
OrganizationOrganizationSend = x.OrganizationOrganizationSend,
|
||||||
|
OrganizationOrganizationReceive = x.OrganizationOrganizationReceive,
|
||||||
|
Status = x.Status,
|
||||||
|
Issue = x.Issue,
|
||||||
|
Date = x.Date,
|
||||||
|
VolumeNo = x.VolumeNo,
|
||||||
|
Section = x.Section,
|
||||||
|
Page = x.Page,
|
||||||
|
No = x.No,
|
||||||
|
DatePayment = x.DatePayment,
|
||||||
|
TypePayment = x.TypePayment,
|
||||||
|
Address = x.Address,
|
||||||
|
Number = x.Number,
|
||||||
|
Salary = x.Salary,
|
||||||
|
}).FirstOrDefaultAsync();
|
||||||
|
var _insigniaNoteProfile = new
|
||||||
|
{
|
||||||
|
insigniaNoteProfile.Id,
|
||||||
|
insigniaNoteProfile.Prefix,
|
||||||
|
insigniaNoteProfile.Position,
|
||||||
|
insigniaNoteProfile.CitizenId,
|
||||||
|
insigniaNoteProfile.ProfileType,
|
||||||
|
insigniaNoteProfile.FullName,
|
||||||
|
insigniaNoteProfile.RequestInsignia,
|
||||||
|
insigniaNoteProfile.RequestInsigniaId,
|
||||||
|
insigniaNoteProfile.RequestInsigniaShortName,
|
||||||
|
insigniaNoteProfile.DateReceive,
|
||||||
|
insigniaNoteProfile.OrganizationOrganizationSend,
|
||||||
|
OrganizationOrganizationReceive = insigniaNoteProfile.OrganizationOrganizationReceive == null ? (insigniaNoteProfile.OcId == null ? null : FindOCFullPath(insigniaNoteProfile.OcId.Value, true)) : insigniaNoteProfile.OrganizationOrganizationReceive,
|
||||||
|
insigniaNoteProfile.Status,
|
||||||
|
insigniaNoteProfile.Issue,
|
||||||
|
insigniaNoteProfile.Date,
|
||||||
|
insigniaNoteProfile.VolumeNo,
|
||||||
|
insigniaNoteProfile.Section,
|
||||||
|
insigniaNoteProfile.Page,
|
||||||
|
insigniaNoteProfile.No,
|
||||||
|
insigniaNoteProfile.DatePayment,
|
||||||
|
insigniaNoteProfile.TypePayment,
|
||||||
|
insigniaNoteProfile.Address,
|
||||||
|
insigniaNoteProfile.Number,
|
||||||
|
insigniaNoteProfile.Salary,
|
||||||
|
};
|
||||||
|
|
||||||
|
return Success(_insigniaNoteProfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// เพิ่ม/แก้ไขรายชื่อบันทึกผลการได้รับพระราชทานเครื่องราชย์อิสริยสภรณ์/การจ่ายใบกำกับ
|
/// เพิ่ม/แก้ไขรายชื่อบันทึกผลการได้รับพระราชทานเครื่องราชย์อิสริยสภรณ์/การจ่ายใบกำกับ
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="insigniaNoteId">Id รอบบันทึกผลเครื่องราช</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <response code="200"></response>
|
/// <response code="200"></response>
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
|
@ -1118,7 +1289,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
{
|
{
|
||||||
Salary = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
Salary = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||||
IsApprove = true,
|
IsApprove = true,
|
||||||
Status = "PENDING",
|
Status = "DONE",
|
||||||
Profile = profile,
|
Profile = profile,
|
||||||
Issue = req.Issue,
|
Issue = req.Issue,
|
||||||
Number = req.Number,
|
Number = req.Number,
|
||||||
|
|
@ -1132,7 +1303,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
TypePayment = req.TypePayment,
|
TypePayment = req.TypePayment,
|
||||||
Address = req.Address,
|
Address = req.Address,
|
||||||
RequestInsignia = insignia,
|
RequestInsignia = insignia,
|
||||||
OrganizationOrganizationSend = await _context.OrganizationOrganizations.FirstOrDefaultAsync(x => x.Id == profile.OrganizationOrganizationId),
|
OrganizationOrganizationReceive = req.OrganizationOrganizationReceive,
|
||||||
|
OrganizationOrganizationSend = req.OrganizationOrganizationSend,
|
||||||
InsigniaNote = insigniaNote,
|
InsigniaNote = insigniaNote,
|
||||||
CreatedUserId = FullName ?? "",
|
CreatedUserId = FullName ?? "",
|
||||||
CreatedFullName = UserId ?? "System Administrator",
|
CreatedFullName = UserId ?? "System Administrator",
|
||||||
|
|
@ -1141,6 +1313,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
LastUpdateUserId = UserId ?? "",
|
LastUpdateUserId = UserId ?? "",
|
||||||
LastUpdatedAt = DateTime.Now,
|
LastUpdatedAt = DateTime.Now,
|
||||||
});
|
});
|
||||||
|
//////////////บันทึกลงทะเบียน
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1167,6 +1340,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// เพิ่มเอกสารบันทึกผลการได้รับพระราชทานเครื่องราชย์อิสริยสภรณ์/การจ่ายใบกำกับ
|
/// เพิ่มเอกสารบันทึกผลการได้รับพระราชทานเครื่องราชย์อิสริยสภรณ์/การจ่ายใบกำกับ
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="insigniaNoteId">Id รอบบันทึกผลเครื่องราช</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <response code="200"></response>
|
/// <response code="200"></response>
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
|
@ -1214,13 +1388,14 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List เอกสารบันทึกผลการได้รับพระราชทานเครื่องราชย์อิสริยสภรณ์/การจ่ายใบกำกับ
|
/// List เอกสารบันทึกผลการได้รับพระราชทานเครื่องราชย์อิสริยสภรณ์/การจ่ายใบกำกับ
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="insigniaNoteId">Id รอบบันทึกผลเครื่องราช</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <response code="200"></response>
|
/// <response code="200"></response>
|
||||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("note/doc/{insigniaNoteId:length(36)}")]
|
[HttpGet("note/doc/{insigniaNoteId:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> GetDocumentProfile([FromBody] InsigniaNoteDocRequest req, Guid insigniaNoteId)
|
public async Task<ActionResult<ResponseObject>> GetDocumentProfile(Guid insigniaNoteId)
|
||||||
{
|
{
|
||||||
var insigniaNote = await _context.InsigniaNotes
|
var insigniaNote = await _context.InsigniaNotes
|
||||||
.Include(x => x.InsigniaNoteDocs)
|
.Include(x => x.InsigniaNoteDocs)
|
||||||
|
|
@ -1233,6 +1408,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
{
|
{
|
||||||
var _doc = new
|
var _doc = new
|
||||||
{
|
{
|
||||||
|
Reason = doc.Reason,
|
||||||
FileName = doc.Document.FileName,
|
FileName = doc.Document.FileName,
|
||||||
PathName = await _documentService.ImagesPath(doc.Document.Id)
|
PathName = await _documentService.ImagesPath(doc.Document.Id)
|
||||||
};
|
};
|
||||||
|
|
@ -1241,5 +1417,206 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
return Success(insigniaNoteDocs);
|
return Success(insigniaNoteDocs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// import บันทึกผลการได้รับเครื่องราชฯ
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="insigniaNoteId">Id รอบบันทึกผลเครื่องราช</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPut("import/receice/{insigniaNoteId:length(36)}"), DisableRequestSizeLimit]
|
||||||
|
public async Task<ActionResult<ResponseObject>> ImportReceiceProfile([FromForm] ImportFileRequest req, Guid insigniaNoteId)
|
||||||
|
{
|
||||||
|
var insigniaNote = await _context.InsigniaNotes
|
||||||
|
.Include(x => x.InsigniaNoteProfiles)
|
||||||
|
.ThenInclude(x => x.Profile)
|
||||||
|
.Include(x => x.InsigniaNoteProfiles)
|
||||||
|
.ThenInclude(x => x.RequestInsignia)
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == insigniaNoteId);
|
||||||
|
if (insigniaNote == null)
|
||||||
|
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||||
|
|
||||||
|
if (Request.Form.Files == null || Request.Form.Files.Count == 0)
|
||||||
|
{
|
||||||
|
return Error(GlobalMessages.NoFileToUpload);
|
||||||
|
}
|
||||||
|
var file = Request.Form.Files[0];
|
||||||
|
if (!Path.GetExtension(file.FileName).Equals(".xlsx", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return Error("นามสกุลไฟล์ต้องเป็น .xlsx!");
|
||||||
|
}
|
||||||
|
var items = await ReadExcelImportReceive(file);
|
||||||
|
foreach (var item in items)
|
||||||
|
{
|
||||||
|
var profile = insigniaNote.InsigniaNoteProfiles.FirstOrDefault(x => x.Profile.CitizenId == item.CitizanId);
|
||||||
|
if (profile == null)
|
||||||
|
{
|
||||||
|
var _profile = await _context.Profiles
|
||||||
|
.Include(x => x.Salaries)
|
||||||
|
.FirstOrDefaultAsync(x => x.CitizenId == item.CitizanId);
|
||||||
|
if (_profile == null)
|
||||||
|
continue;
|
||||||
|
var _insignia = await _context.Insignias.FirstOrDefaultAsync(x => x.Name == item.RequestInsignia);
|
||||||
|
if (_insignia == null)
|
||||||
|
continue;
|
||||||
|
await _context.InsigniaNoteProfiles.AddAsync(new InsigniaNoteProfile
|
||||||
|
{
|
||||||
|
RequestDate = DateTime.Now,
|
||||||
|
Salary = _profile.Salaries.Count() == 0 ? null : _profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||||
|
IsApprove = true,
|
||||||
|
Status = "DONE",
|
||||||
|
Number = item.Number,
|
||||||
|
RequestInsignia = _insignia,
|
||||||
|
DateReceive = item.DateReceive,
|
||||||
|
Date = item.Date,
|
||||||
|
VolumeNo = item.VolumeNo,
|
||||||
|
Section = item.Section,
|
||||||
|
Page = item.Page,
|
||||||
|
No = item.No,
|
||||||
|
Profile = _profile,
|
||||||
|
InsigniaNote = insigniaNote,
|
||||||
|
LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
LastUpdateUserId = UserId ?? "",
|
||||||
|
LastUpdatedAt = DateTime.Now,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
profile.Status = "DONE";
|
||||||
|
profile.Number = item.Number;
|
||||||
|
profile.RequestInsignia = await _context.Insignias.FirstOrDefaultAsync(x => x.Name == item.RequestInsignia) == null ? profile.RequestInsignia : await _context.Insignias.FirstOrDefaultAsync(x => x.Name == item.RequestInsignia);
|
||||||
|
profile.DateReceive = item.DateReceive;
|
||||||
|
profile.Date = item.Date;
|
||||||
|
profile.VolumeNo = item.VolumeNo;
|
||||||
|
profile.Section = item.Section;
|
||||||
|
profile.Page = item.Page;
|
||||||
|
profile.No = item.No;
|
||||||
|
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
|
profile.LastUpdateUserId = UserId ?? "";
|
||||||
|
profile.LastUpdatedAt = DateTime.Now;
|
||||||
|
}
|
||||||
|
//////////////บันทึกลงทะเบียน
|
||||||
|
}
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// import บันทึกผลใบกำกับเครื่องราชฯ
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="insigniaNoteId">Id รอบบันทึกผลเครื่องราช</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpPut("import/invoice/{insigniaNoteId:length(36)}"), DisableRequestSizeLimit]
|
||||||
|
public async Task<ActionResult<ResponseObject>> ImportInvoiceProfile([FromForm] ImportFileRequest req, Guid insigniaNoteId)
|
||||||
|
{
|
||||||
|
var insigniaNote = await _context.InsigniaNotes
|
||||||
|
.Include(x => x.InsigniaNoteProfiles)
|
||||||
|
.ThenInclude(x => x.Profile)
|
||||||
|
.Include(x => x.InsigniaNoteProfiles)
|
||||||
|
.ThenInclude(x => x.RequestInsignia)
|
||||||
|
.FirstOrDefaultAsync(x => x.Id == insigniaNoteId);
|
||||||
|
if (insigniaNote == null)
|
||||||
|
return Error(GlobalMessages.InsigniaRequestNotFound);
|
||||||
|
|
||||||
|
if (Request.Form.Files == null || Request.Form.Files.Count == 0)
|
||||||
|
{
|
||||||
|
return Error(GlobalMessages.NoFileToUpload);
|
||||||
|
}
|
||||||
|
var file = Request.Form.Files[0];
|
||||||
|
if (!Path.GetExtension(file.FileName).Equals(".xlsx", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return Error("นามสกุลไฟล์ต้องเป็น .xlsx!");
|
||||||
|
}
|
||||||
|
var items = await ReadExcelImportInvoice(file);
|
||||||
|
foreach (var item in items)
|
||||||
|
{
|
||||||
|
var profile = insigniaNote.InsigniaNoteProfiles.FirstOrDefault(x => x.Profile.CitizenId == item.CitizanId);
|
||||||
|
if (profile == null)
|
||||||
|
continue;
|
||||||
|
profile.Number = item.Number;
|
||||||
|
profile.DatePayment = item.DatePayment;
|
||||||
|
profile.TypePayment = item.TypePayment;
|
||||||
|
profile.Address = item.Address;
|
||||||
|
profile.LastUpdateFullName = FullName ?? "System Administrator";
|
||||||
|
profile.LastUpdateUserId = UserId ?? "";
|
||||||
|
profile.LastUpdatedAt = DateTime.Now;
|
||||||
|
}
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
return Success();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<List<ImportReceiveRequest>> ReadExcelImportReceive(IFormFile formFile)
|
||||||
|
{
|
||||||
|
var list = new List<ImportReceiveRequest>();
|
||||||
|
using (var stream = new MemoryStream())
|
||||||
|
{
|
||||||
|
await formFile.CopyToAsync(stream);
|
||||||
|
using (var package = new ExcelPackage(stream))
|
||||||
|
{
|
||||||
|
for (int i = 0; i < package.Workbook.Worksheets.Count(); i++)
|
||||||
|
{
|
||||||
|
ExcelWorksheet worksheet = package.Workbook.Worksheets[i];
|
||||||
|
var rowCount = worksheet.Dimension.Rows;
|
||||||
|
for (int row = 2; row <= rowCount; row++)
|
||||||
|
{
|
||||||
|
list.Add(new ImportReceiveRequest
|
||||||
|
{
|
||||||
|
Number = worksheet.Cells[row, 1].Value != null ? worksheet.Cells[row, 1].Value.ToString() : null,
|
||||||
|
RequestInsignia = worksheet.Cells[row, 2].Value != null ? worksheet.Cells[row, 2].Value.ToString() : null,
|
||||||
|
CitizanId = worksheet.Cells[row, 3].Value != null ? worksheet.Cells[row, 3].Value.ToString() : null,
|
||||||
|
Prefix = worksheet.Cells[row, 4].Value != null ? worksheet.Cells[row, 4].Value.ToString() : null,
|
||||||
|
FullName = worksheet.Cells[row, 5].Value != null ? worksheet.Cells[row, 5].Value.ToString() : null,
|
||||||
|
Position = worksheet.Cells[row, 6].Value != null ? worksheet.Cells[row, 6].Value.ToString() : null,
|
||||||
|
DateReceive = worksheet.Cells[row, 7].Value != null ? DateTime.Parse(worksheet.Cells[row, 7].Value.ToString()) : null,
|
||||||
|
OrgSend = worksheet.Cells[row, 8].Value != null ? worksheet.Cells[row, 8].Value.ToString() : null,
|
||||||
|
OrgReceive = worksheet.Cells[row, 9].Value != null ? worksheet.Cells[row, 9].Value.ToString() : null,
|
||||||
|
Date = worksheet.Cells[row, 10].Value != null ? DateTime.Parse(worksheet.Cells[row, 10].Value.ToString()) : null,
|
||||||
|
VolumeNo = worksheet.Cells[row, 11].Value != null ? worksheet.Cells[row, 11].Value.ToString() : null,
|
||||||
|
Section = worksheet.Cells[row, 12].Value != null ? worksheet.Cells[row, 12].Value.ToString() : null,
|
||||||
|
Page = worksheet.Cells[row, 13].Value != null ? worksheet.Cells[row, 13].Value.ToString() : null,
|
||||||
|
No = worksheet.Cells[row, 14].Value != null ? worksheet.Cells[row, 14].Value.ToString() : null,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<List<ImportInvoiceRequest>> ReadExcelImportInvoice(IFormFile formFile)
|
||||||
|
{
|
||||||
|
var list = new List<ImportInvoiceRequest>();
|
||||||
|
using (var stream = new MemoryStream())
|
||||||
|
{
|
||||||
|
await formFile.CopyToAsync(stream);
|
||||||
|
using (var package = new ExcelPackage(stream))
|
||||||
|
{
|
||||||
|
for (int i = 0; i < package.Workbook.Worksheets.Count(); i++)
|
||||||
|
{
|
||||||
|
ExcelWorksheet worksheet = package.Workbook.Worksheets[i];
|
||||||
|
var rowCount = worksheet.Dimension.Rows;
|
||||||
|
for (int row = 2; row <= rowCount; row++)
|
||||||
|
{
|
||||||
|
list.Add(new ImportInvoiceRequest
|
||||||
|
{
|
||||||
|
CitizanId = worksheet.Cells[row, 1].Value != null ? worksheet.Cells[row, 1].Value.ToString() : null,
|
||||||
|
Number = worksheet.Cells[row, 2].Value != null ? worksheet.Cells[row, 2].Value.ToString() : null,
|
||||||
|
DatePayment = worksheet.Cells[row, 3].Value != null ? DateTime.Parse(worksheet.Cells[row, 3].Value.ToString()) : null,
|
||||||
|
TypePayment = worksheet.Cells[row, 4].Value != null ? worksheet.Cells[row, 4].Value.ToString() : null,
|
||||||
|
Address = worksheet.Cells[row, 5].Value != null ? worksheet.Cells[row, 5].Value.ToString() : null,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
BMA.EHR.Insignia.Service/Requests/ImportFileRequest.cs
Normal file
10
BMA.EHR.Insignia.Service/Requests/ImportFileRequest.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Insignia.Service.Requests
|
||||||
|
{
|
||||||
|
public class ImportFileRequest
|
||||||
|
{
|
||||||
|
public List<FormFile>? File { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
14
BMA.EHR.Insignia.Service/Requests/ImportInvoiceRequest.cs
Normal file
14
BMA.EHR.Insignia.Service/Requests/ImportInvoiceRequest.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Insignia.Service.Requests
|
||||||
|
{
|
||||||
|
public class ImportInvoiceRequest
|
||||||
|
{
|
||||||
|
public string? CitizanId { get; set; }
|
||||||
|
public string? Number { get; set; }
|
||||||
|
public DateTime? DatePayment { get; set; }
|
||||||
|
public string? TypePayment { get; set; }
|
||||||
|
public string? Address { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
23
BMA.EHR.Insignia.Service/Requests/ImportReceiveRequest.cs
Normal file
23
BMA.EHR.Insignia.Service/Requests/ImportReceiveRequest.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Insignia.Service.Requests
|
||||||
|
{
|
||||||
|
public class ImportReceiveRequest
|
||||||
|
{
|
||||||
|
public string? Number { get; set; }
|
||||||
|
public string? RequestInsignia { get; set; }
|
||||||
|
public string? CitizanId { get; set; }
|
||||||
|
public string? Prefix { get; set; }
|
||||||
|
public string? FullName { get; set; }
|
||||||
|
public string? Position { get; set; }
|
||||||
|
public DateTime? DateReceive { get; set; }
|
||||||
|
public string? OrgSend { get; set; }
|
||||||
|
public string? OrgReceive { get; set; }
|
||||||
|
public DateTime? Date { get; set; }
|
||||||
|
public string? VolumeNo { get; set; }
|
||||||
|
public string? Section { get; set; }
|
||||||
|
public string? Page { get; set; }
|
||||||
|
public string? No { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -19,5 +19,7 @@ namespace BMA.EHR.Insignia.Service.Requests
|
||||||
public DateTime? DatePayment { get; set; }
|
public DateTime? DatePayment { get; set; }
|
||||||
public string? TypePayment { get; set; }
|
public string? TypePayment { get; set; }
|
||||||
public string? Address { get; set; }
|
public string? Address { get; set; }
|
||||||
|
public string? OrganizationOrganizationSend { get; set; }
|
||||||
|
public string? OrganizationOrganizationReceive { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
10
BMA.EHR.Insignia.Service/Requests/RetirementReasonRequest.cs
Normal file
10
BMA.EHR.Insignia.Service/Requests/RetirementReasonRequest.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
using BMA.EHR.Domain.Models.MetaData;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Insignia.Service.Requests
|
||||||
|
{
|
||||||
|
public class InsigniaReasonRequest
|
||||||
|
{
|
||||||
|
public string Reason { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -46,6 +46,60 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
private List<string> GetOcNameFullPath(Guid id, bool showRoot = false)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var ocList = new List<string>();
|
||||||
|
|
||||||
|
var oc = (from o in _context.Organizations.Include(x => x.Parent).Include(x => x.OrganizationOrganization).Where(x => x.OrganizationOrganization != null).AsQueryable()
|
||||||
|
join oc_name in _context.OrganizationOrganizations.AsQueryable() on o.OrganizationOrganization.Id equals oc_name.Id
|
||||||
|
where o.Parent != null
|
||||||
|
select new
|
||||||
|
{
|
||||||
|
Id = o.Id,
|
||||||
|
Name = oc_name.Name,
|
||||||
|
o.IsActive,
|
||||||
|
o.Parent
|
||||||
|
}).FirstOrDefault(x => x.Id == id && x.IsActive);
|
||||||
|
|
||||||
|
if (oc == null)
|
||||||
|
return ocList;
|
||||||
|
|
||||||
|
ocList.Add(oc.Name);
|
||||||
|
|
||||||
|
if (oc.Parent?.Id != null)
|
||||||
|
{
|
||||||
|
ocList.AddRange(GetOcNameFullPath(oc.Parent.Id, showRoot));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ocList;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private string FindOCFullPath(Guid id, bool showRoot = false)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var ocList = GetOcNameFullPath(id, showRoot);
|
||||||
|
var ret = String.Empty;
|
||||||
|
foreach (var oc in ocList)
|
||||||
|
{
|
||||||
|
ret = oc + "/" + ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ret.Substring(0, ret.Length - 1);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// list รายการลาออกของ User
|
/// list รายการลาออกของ User
|
||||||
|
|
@ -446,7 +500,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
Id = p.Id,
|
Id = p.Id,
|
||||||
ReasonWork = p.ReasonWork == null ? p.ReasonWork : Newtonsoft.Json.JsonConvert.DeserializeObject(p.ReasonWork),
|
ReasonWork = p.ReasonWork == null ? p.ReasonWork : Newtonsoft.Json.JsonConvert.DeserializeObject(p.ReasonWork),
|
||||||
ReasonWorkOther = p.ReasonWorkOther,
|
ReasonWorkOther = p.ReasonWorkOther,
|
||||||
TimeThink = p.TimeThink == null ? p.TimeThink : Newtonsoft.Json.JsonConvert.DeserializeObject(p.TimeThink),
|
TimeThink = p.TimeThink,
|
||||||
ExitFactor = p.ExitFactor == null ? p.ExitFactor : Newtonsoft.Json.JsonConvert.DeserializeObject(p.ExitFactor),
|
ExitFactor = p.ExitFactor == null ? p.ExitFactor : Newtonsoft.Json.JsonConvert.DeserializeObject(p.ExitFactor),
|
||||||
ExitFactorOther = p.ExitFactorOther,
|
ExitFactorOther = p.ExitFactorOther,
|
||||||
Adjust = p.Adjust == null ? p.Adjust : Newtonsoft.Json.JsonConvert.DeserializeObject(p.Adjust),
|
Adjust = p.Adjust == null ? p.Adjust : Newtonsoft.Json.JsonConvert.DeserializeObject(p.Adjust),
|
||||||
|
|
@ -484,9 +538,15 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
.Select(p => new
|
.Select(p => new
|
||||||
{
|
{
|
||||||
Id = p.Id,
|
Id = p.Id,
|
||||||
|
Position = p.RetirementResign.Profile.Position == null ? null : p.RetirementResign.Profile.Position.Name,
|
||||||
|
PositionLevel = p.RetirementResign.Profile.PositionLevel == null ? null : p.RetirementResign.Profile.PositionLevel.Name,
|
||||||
|
Org = p.RetirementResign.Profile.OcId == null ? null : p.RetirementResign.Profile.OcId,
|
||||||
|
Fullname = $"{p.RetirementResign.Profile.FirstName} {p.RetirementResign.Profile.LastName}",
|
||||||
|
Prefix = p.RetirementResign.Profile.Prefix == null ? null : p.RetirementResign.Profile.Prefix.Name,
|
||||||
|
Avatar = p.RetirementResign.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.RetirementResign.Profile.Avatar.Id,
|
||||||
ReasonWork = p.ReasonWork == null ? p.ReasonWork : Newtonsoft.Json.JsonConvert.DeserializeObject(p.ReasonWork),
|
ReasonWork = p.ReasonWork == null ? p.ReasonWork : Newtonsoft.Json.JsonConvert.DeserializeObject(p.ReasonWork),
|
||||||
ReasonWorkOther = p.ReasonWorkOther,
|
ReasonWorkOther = p.ReasonWorkOther,
|
||||||
TimeThink = p.TimeThink == null ? p.TimeThink : Newtonsoft.Json.JsonConvert.DeserializeObject(p.TimeThink),
|
TimeThink = p.TimeThink,
|
||||||
ExitFactor = p.ExitFactor == null ? p.ExitFactor : Newtonsoft.Json.JsonConvert.DeserializeObject(p.ExitFactor),
|
ExitFactor = p.ExitFactor == null ? p.ExitFactor : Newtonsoft.Json.JsonConvert.DeserializeObject(p.ExitFactor),
|
||||||
ExitFactorOther = p.ExitFactorOther,
|
ExitFactorOther = p.ExitFactorOther,
|
||||||
Adjust = p.Adjust == null ? p.Adjust : Newtonsoft.Json.JsonConvert.DeserializeObject(p.Adjust),
|
Adjust = p.Adjust == null ? p.Adjust : Newtonsoft.Json.JsonConvert.DeserializeObject(p.Adjust),
|
||||||
|
|
@ -506,6 +566,34 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
.FirstOrDefaultAsync();
|
.FirstOrDefaultAsync();
|
||||||
if (data == null)
|
if (data == null)
|
||||||
return Error(GlobalMessages.RetirementQuestionNotFound, 404);
|
return Error(GlobalMessages.RetirementQuestionNotFound, 404);
|
||||||
|
var _data = new
|
||||||
|
{
|
||||||
|
data.Id,
|
||||||
|
data.Position,
|
||||||
|
data.PositionLevel,
|
||||||
|
Org = data.Org == null ? null : FindOCFullPath(data.Org.Value, true),
|
||||||
|
data.Fullname,
|
||||||
|
data.Prefix,
|
||||||
|
Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
|
||||||
|
data.ReasonWork,
|
||||||
|
data.ReasonWorkOther,
|
||||||
|
data.TimeThink,
|
||||||
|
data.ExitFactor,
|
||||||
|
data.ExitFactorOther,
|
||||||
|
data.Adjust,
|
||||||
|
data.AdjustOther,
|
||||||
|
data.RealReason,
|
||||||
|
data.NotExitFactor,
|
||||||
|
data.Havejob,
|
||||||
|
data.HavejobReason,
|
||||||
|
data.SuggestFriends,
|
||||||
|
data.SuggestFriendsReason,
|
||||||
|
data.FutureWork,
|
||||||
|
data.FutureWorkReason,
|
||||||
|
data.Suggestion,
|
||||||
|
data.LastUpdatedAt,
|
||||||
|
data.CreatedAt,
|
||||||
|
};
|
||||||
|
|
||||||
return Success(data);
|
return Success(data);
|
||||||
}
|
}
|
||||||
|
|
@ -519,7 +607,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpPost("questionnaire")]
|
[HttpPost("questionnaire")]
|
||||||
public async Task<ActionResult<ResponseObject>> PostQuestion([FromForm] RetirementQuestionRequest req)
|
public async Task<ActionResult<ResponseObject>> PostQuestion([FromBody] RetirementQuestionRequest req)
|
||||||
{
|
{
|
||||||
var retirementResign = await _context.RetirementResigns.AsQueryable()
|
var retirementResign = await _context.RetirementResigns.AsQueryable()
|
||||||
.FirstOrDefaultAsync(x => x.Id == req.RetirementResignId);
|
.FirstOrDefaultAsync(x => x.Id == req.RetirementResignId);
|
||||||
|
|
@ -531,7 +619,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
RetirementResign = retirementResign,
|
RetirementResign = retirementResign,
|
||||||
ReasonWork = Newtonsoft.Json.JsonConvert.SerializeObject(req.ReasonWork),
|
ReasonWork = Newtonsoft.Json.JsonConvert.SerializeObject(req.ReasonWork),
|
||||||
ReasonWorkOther = req.ReasonWorkOther,
|
ReasonWorkOther = req.ReasonWorkOther,
|
||||||
TimeThink = Newtonsoft.Json.JsonConvert.SerializeObject(req.TimeThink),
|
TimeThink = req.TimeThink,
|
||||||
ExitFactor = Newtonsoft.Json.JsonConvert.SerializeObject(req.ExitFactor),
|
ExitFactor = Newtonsoft.Json.JsonConvert.SerializeObject(req.ExitFactor),
|
||||||
ExitFactorOther = req.ExitFactorOther,
|
ExitFactorOther = req.ExitFactorOther,
|
||||||
Adjust = Newtonsoft.Json.JsonConvert.SerializeObject(req.Adjust),
|
Adjust = Newtonsoft.Json.JsonConvert.SerializeObject(req.Adjust),
|
||||||
|
|
@ -592,7 +680,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpPut("questionnaire/{id:length(36)}")]
|
[HttpPut("questionnaire/{id:length(36)}")]
|
||||||
public async Task<ActionResult<ResponseObject>> PutQuestion([FromForm] RetirementQuestionRequest req, Guid id)
|
public async Task<ActionResult<ResponseObject>> PutQuestion([FromBody] RetirementQuestionRequest req, Guid id)
|
||||||
{
|
{
|
||||||
var uppdated = await _context.RetirementQuestions.AsQueryable()
|
var uppdated = await _context.RetirementQuestions.AsQueryable()
|
||||||
.FirstOrDefaultAsync(x => x.Id == id);
|
.FirstOrDefaultAsync(x => x.Id == id);
|
||||||
|
|
@ -607,7 +695,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
|
||||||
// uppdated.RetirementResign = retirementResign;
|
// uppdated.RetirementResign = retirementResign;
|
||||||
uppdated.ReasonWork = Newtonsoft.Json.JsonConvert.SerializeObject(req.ReasonWork);
|
uppdated.ReasonWork = Newtonsoft.Json.JsonConvert.SerializeObject(req.ReasonWork);
|
||||||
uppdated.ReasonWorkOther = req.ReasonWorkOther;
|
uppdated.ReasonWorkOther = req.ReasonWorkOther;
|
||||||
uppdated.TimeThink = Newtonsoft.Json.JsonConvert.SerializeObject(req.TimeThink);
|
uppdated.TimeThink = req.TimeThink;
|
||||||
uppdated.ExitFactor = Newtonsoft.Json.JsonConvert.SerializeObject(req.ExitFactor);
|
uppdated.ExitFactor = Newtonsoft.Json.JsonConvert.SerializeObject(req.ExitFactor);
|
||||||
uppdated.ExitFactorOther = req.ExitFactorOther;
|
uppdated.ExitFactorOther = req.ExitFactorOther;
|
||||||
uppdated.Adjust = Newtonsoft.Json.JsonConvert.SerializeObject(req.Adjust);
|
uppdated.Adjust = Newtonsoft.Json.JsonConvert.SerializeObject(req.Adjust);
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,12 @@ namespace BMA.EHR.Retirement.Service.Requests
|
||||||
public class RetirementQuestionRequest
|
public class RetirementQuestionRequest
|
||||||
{
|
{
|
||||||
public Guid RetirementResignId { get; set; }
|
public Guid RetirementResignId { get; set; }
|
||||||
public List<string>? ReasonWork { get; set; }
|
public List<int>? ReasonWork { get; set; }
|
||||||
public string? ReasonWorkOther { get; set; }
|
public string? ReasonWorkOther { get; set; }
|
||||||
public List<string>? TimeThink { get; set; }
|
public int? TimeThink { get; set; }
|
||||||
public List<string>? ExitFactor { get; set; }
|
public List<int>? ExitFactor { get; set; }
|
||||||
public string? ExitFactorOther { get; set; }
|
public string? ExitFactorOther { get; set; }
|
||||||
public List<string>? Adjust { get; set; }
|
public List<int>? Adjust { get; set; }
|
||||||
public string? AdjustOther { get; set; }
|
public string? AdjustOther { get; set; }
|
||||||
public string? RealReason { get; set; }
|
public string? RealReason { get; set; }
|
||||||
public string? NotExitFactor { get; set; }
|
public string? NotExitFactor { get; set; }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue