no message

This commit is contained in:
Kittapath 2024-05-23 17:07:55 +07:00
parent 63b02dcc4c
commit afe16503ee
17 changed files with 36169 additions and 139 deletions

View file

@ -17,7 +17,7 @@ env:
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0 TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
jobs: jobs:
# act workflow_dispatch -W .github/workflows/release_command.yaml --input IMAGE_VER=command-1.0.0 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd # act workflow_dispatch -W .github/workflows/release_command.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357
release-dev: release-dev:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:

View file

@ -17,7 +17,7 @@ env:
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0 TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
jobs: jobs:
# act workflow_dispatch -W .github/workflows/release_discipline.yaml --input IMAGE_VER=discipline-1.0.0 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd # act workflow_dispatch -W .github/workflows/release_discipline.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357
release-dev: release-dev:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:

View file

@ -17,7 +17,7 @@ env:
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0 TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
jobs: jobs:
# act workflow_dispatch -W .github/workflows/release_report.yaml --input IMAGE_VER=report-1.0.0 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd # act workflow_dispatch -W .github/workflows/release_report.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357
release-dev: release-dev:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:

View file

@ -10,7 +10,9 @@ using BMA.EHR.Infrastructure.Persistence;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
using System.Net.Http.Headers;
using System.Security.Claims; using System.Security.Claims;
namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
@ -28,12 +30,14 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
private readonly MinIODisciplineService _documentService; private readonly MinIODisciplineService _documentService;
private readonly IHttpContextAccessor _httpContextAccessor; private readonly IHttpContextAccessor _httpContextAccessor;
private readonly NotificationRepository _repositoryNoti; private readonly NotificationRepository _repositoryNoti;
private readonly IConfiguration _configuration;
public DisciplineComplaint_AppealController(DisciplineDbContext context, public DisciplineComplaint_AppealController(DisciplineDbContext context,
NotificationRepository repositoryNoti, NotificationRepository repositoryNoti,
ApplicationDBContext contextMain, ApplicationDBContext contextMain,
MinIODisciplineService documentService, MinIODisciplineService documentService,
IHttpContextAccessor httpContextAccessor) IHttpContextAccessor httpContextAccessor,
IConfiguration configuration)
{ {
// _repository = repository; // _repository = repository;
_context = context; _context = context;
@ -41,6 +45,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
_repositoryNoti = repositoryNoti; _repositoryNoti = repositoryNoti;
_documentService = documentService; _documentService = documentService;
_httpContextAccessor = httpContextAccessor; _httpContextAccessor = httpContextAccessor;
_configuration = configuration;
} }
#region " Properties " #region " Properties "
@ -48,6 +53,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value; private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value; private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
private static string StatusDisciplineComplaintAppeal(string value) private static string StatusDisciplineComplaintAppeal(string value)
{ {
switch (value) switch (value)
@ -76,10 +82,24 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
[HttpGet("user")] [HttpGet("user")]
public async Task<ActionResult<ResponseObject>> GetDisciplineUser(string status = "ALL", string type = "ALL", int year = 0, int page = 1, int pageSize = 25, string keyword = "") public async Task<ActionResult<ResponseObject>> GetDisciplineUser(string status = "ALL", string type = "ALL", int year = 0, int page = 1, int pageSize = 25, string keyword = "")
{ {
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId); var id = "";
var profile = _contextMain.Profiles.FirstOrDefault(x => x.KeycloakId == userId); var apiUrl = $"{_configuration["API"]}org/profile/keycloak/position";
if (profile == null) using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<dynamic>(_result);
if (org == null || org.result == null)
return Success(new { data = new List<dynamic>(), total = 0 });
id = org.result.profileId;
}
if (id == "")
return Success(new { data = new List<dynamic>(), total = 0 }); return Success(new { data = new List<dynamic>(), total = 0 });
var data_search = (from x in _context.DisciplineComplaint_Appeals var data_search = (from x in _context.DisciplineComplaint_Appeals
where x.Title.Contains(keyword) || where x.Title.Contains(keyword) ||
x.Description.Contains(keyword) || x.Description.Contains(keyword) ||
@ -87,7 +107,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
x.CaseNumber.Contains(keyword) || x.CaseNumber.Contains(keyword) ||
x.Fullname.Contains(keyword) || x.Fullname.Contains(keyword) ||
x.CitizenId.Contains(keyword) x.CitizenId.Contains(keyword)
where x.ProfileId == profile.Id where x.ProfileId == Guid.Parse(id)
select x).ToList(); select x).ToList();
if (status.Trim().ToUpper() != "ALL") if (status.Trim().ToUpper() != "ALL")
data_search = data_search.Where(x => x.Status == status).ToList(); data_search = data_search.Where(x => x.Status == status).ToList();

View file

@ -38,5 +38,6 @@
"Hour": "08", "Hour": "08",
"Minute": "00" "Minute": "00"
}, },
"Protocol": "HTTPS" "Protocol": "HTTPS",
"API": "https://bma-ehr.frappet.synology.me/api/v1/"
} }

View file

@ -15,17 +15,17 @@ namespace BMA.EHR.Domain.Models.Placement
[MaxLength(40), Comment("วันเกิด")] [MaxLength(40), Comment("วันเกิด")]
public DateTime DateOfBirth { get; set; } public DateTime DateOfBirth { get; set; }
[Comment("Id เพศ")] [Comment("Id เพศ")]
public Gender? Gender { get; set; } public string? Gender { get; set; }
[MaxLength(100), Comment("สัญชาติ")] [MaxLength(100), Comment("สัญชาติ")]
public string? Nationality { get; set; } public string? Nationality { get; set; }
[MaxLength(100), Comment("เชื้อชาติ")] [MaxLength(100), Comment("เชื้อชาติ")]
public string? Race { get; set; } public string? Race { get; set; }
[Comment("Id ศาสนา")] [Comment("Id ศาสนา")]
public Religion? Religion { get; set; } public string? Religion { get; set; }
[Comment("Id กลุ่มเลือด")] [Comment("Id กลุ่มเลือด")]
public BloodGroup? BloodGroup { get; set; } public string? BloodGroup { get; set; }
[Comment("Id สถานะภาพ")] [Comment("Id สถานะภาพ")]
public Relationship? Relationship { get; set; } public string? Relationship { get; set; }
[MaxLength(50), Comment("เบอร์โทร")] [MaxLength(50), Comment("เบอร์โทร")]
public string? TelephoneNumber { get; set; } public string? TelephoneNumber { get; set; }
[Comment("สถานะคำขอ")] [Comment("สถานะคำขอ")]

View file

@ -59,6 +59,14 @@ namespace BMA.EHR.Domain.Models.Retirement
public string? CommanderRejectReason { get; set; } public string? CommanderRejectReason { get; set; }
[Comment("วันที่ยับยั้งผู้บังคับบัญชา")] [Comment("วันที่ยับยั้งผู้บังคับบัญชา")]
public DateTime? CommanderRejectDate { get; set; } public DateTime? CommanderRejectDate { get; set; }
[Comment("สถานะยับยั้งการเจ้าหน้าที่")]
public bool? OfficerReject { get; set; }
[Comment("เหตุผลอนุมัติการเจ้าหน้าที่")]
public string? OfficerApproveReason { get; set; }
[Comment("เหตุผลยับยั้งการเจ้าหน้าที่")]
public string? OfficerRejectReason { get; set; }
[Comment("วันที่ยับยั้งการเจ้าหน้าที่")]
public DateTime? OfficerRejectDate { get; set; }
[Comment("หมายเหตุแนวนอน")] [Comment("หมายเหตุแนวนอน")]
public string? RemarkHorizontal { get; set; } public string? RemarkHorizontal { get; set; }
[Comment("สังกัดเดิม")] [Comment("สังกัดเดิม")]

View file

@ -0,0 +1,65 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableRetirementResignsaddOfficerReject : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "OfficerApproveReason",
table: "RetirementResigns",
type: "longtext",
nullable: true,
comment: "เหตุผลอนุมัติการเจ้าหน้าที่")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<bool>(
name: "OfficerReject",
table: "RetirementResigns",
type: "tinyint(1)",
nullable: true,
comment: "สถานะยับยั้งการเจ้าหน้าที่");
migrationBuilder.AddColumn<DateTime>(
name: "OfficerRejectDate",
table: "RetirementResigns",
type: "datetime(6)",
nullable: true,
comment: "วันที่ยับยั้งการเจ้าหน้าที่");
migrationBuilder.AddColumn<string>(
name: "OfficerRejectReason",
table: "RetirementResigns",
type: "longtext",
nullable: true,
comment: "เหตุผลยับยั้งการเจ้าหน้าที่")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "OfficerApproveReason",
table: "RetirementResigns");
migrationBuilder.DropColumn(
name: "OfficerReject",
table: "RetirementResigns");
migrationBuilder.DropColumn(
name: "OfficerRejectDate",
table: "RetirementResigns");
migrationBuilder.DropColumn(
name: "OfficerRejectReason",
table: "RetirementResigns");
}
}
}

View file

@ -0,0 +1,191 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetablePlacementReceiveaddgender : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_PlacementReceives_BloodGroups_BloodGroupId",
table: "PlacementReceives");
migrationBuilder.DropForeignKey(
name: "FK_PlacementReceives_Genders_GenderId",
table: "PlacementReceives");
migrationBuilder.DropForeignKey(
name: "FK_PlacementReceives_Relationships_RelationshipId",
table: "PlacementReceives");
migrationBuilder.DropForeignKey(
name: "FK_PlacementReceives_Religions_ReligionId",
table: "PlacementReceives");
migrationBuilder.DropIndex(
name: "IX_PlacementReceives_BloodGroupId",
table: "PlacementReceives");
migrationBuilder.DropIndex(
name: "IX_PlacementReceives_GenderId",
table: "PlacementReceives");
migrationBuilder.DropIndex(
name: "IX_PlacementReceives_RelationshipId",
table: "PlacementReceives");
migrationBuilder.DropIndex(
name: "IX_PlacementReceives_ReligionId",
table: "PlacementReceives");
migrationBuilder.DropColumn(
name: "BloodGroupId",
table: "PlacementReceives");
migrationBuilder.DropColumn(
name: "GenderId",
table: "PlacementReceives");
migrationBuilder.DropColumn(
name: "RelationshipId",
table: "PlacementReceives");
migrationBuilder.DropColumn(
name: "ReligionId",
table: "PlacementReceives");
migrationBuilder.AddColumn<string>(
name: "BloodGroup",
table: "PlacementReceives",
type: "longtext",
nullable: true,
comment: "Id กลุ่มเลือด")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Gender",
table: "PlacementReceives",
type: "longtext",
nullable: true,
comment: "Id เพศ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Relationship",
table: "PlacementReceives",
type: "longtext",
nullable: true,
comment: "Id สถานะภาพ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Religion",
table: "PlacementReceives",
type: "longtext",
nullable: true,
comment: "Id ศาสนา")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "BloodGroup",
table: "PlacementReceives");
migrationBuilder.DropColumn(
name: "Gender",
table: "PlacementReceives");
migrationBuilder.DropColumn(
name: "Relationship",
table: "PlacementReceives");
migrationBuilder.DropColumn(
name: "Religion",
table: "PlacementReceives");
migrationBuilder.AddColumn<Guid>(
name: "BloodGroupId",
table: "PlacementReceives",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "GenderId",
table: "PlacementReceives",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "RelationshipId",
table: "PlacementReceives",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "ReligionId",
table: "PlacementReceives",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.CreateIndex(
name: "IX_PlacementReceives_BloodGroupId",
table: "PlacementReceives",
column: "BloodGroupId");
migrationBuilder.CreateIndex(
name: "IX_PlacementReceives_GenderId",
table: "PlacementReceives",
column: "GenderId");
migrationBuilder.CreateIndex(
name: "IX_PlacementReceives_RelationshipId",
table: "PlacementReceives",
column: "RelationshipId");
migrationBuilder.CreateIndex(
name: "IX_PlacementReceives_ReligionId",
table: "PlacementReceives",
column: "ReligionId");
migrationBuilder.AddForeignKey(
name: "FK_PlacementReceives_BloodGroups_BloodGroupId",
table: "PlacementReceives",
column: "BloodGroupId",
principalTable: "BloodGroups",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementReceives_Genders_GenderId",
table: "PlacementReceives",
column: "GenderId",
principalTable: "Genders",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementReceives_Relationships_RelationshipId",
table: "PlacementReceives",
column: "RelationshipId",
principalTable: "Relationships",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementReceives_Religions_ReligionId",
table: "PlacementReceives",
column: "ReligionId",
principalTable: "Religions",
principalColumn: "Id");
}
}
}

View file

@ -12594,8 +12594,9 @@ namespace BMA.EHR.Infrastructure.Migrations
b.Property<Guid?>("AvatarId") b.Property<Guid?>("AvatarId")
.HasColumnType("char(36)"); .HasColumnType("char(36)");
b.Property<Guid?>("BloodGroupId") b.Property<string>("BloodGroup")
.HasColumnType("char(36)"); .HasColumnType("longtext")
.HasComment("Id กลุ่มเลือด");
b.Property<DateTime>("CreatedAt") b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)") .HasColumnType("datetime(6)")
@ -12625,8 +12626,9 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("วุฒิ/สาขาเดิม"); .HasComment("วุฒิ/สาขาเดิม");
b.Property<Guid?>("GenderId") b.Property<string>("Gender")
.HasColumnType("char(36)"); .HasColumnType("longtext")
.HasComment("Id เพศ");
b.Property<bool>("IsActive") b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)") .HasColumnType("tinyint(1)")
@ -12689,11 +12691,13 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("เหตุผลที่รับโอนราชการ"); .HasComment("เหตุผลที่รับโอนราชการ");
b.Property<Guid?>("RelationshipId") b.Property<string>("Relationship")
.HasColumnType("char(36)"); .HasColumnType("longtext")
.HasComment("Id สถานะภาพ");
b.Property<Guid?>("ReligionId") b.Property<string>("Religion")
.HasColumnType("char(36)"); .HasColumnType("longtext")
.HasComment("Id ศาสนา");
b.Property<DateTime?>("ReportingDate") b.Property<DateTime?>("ReportingDate")
.HasColumnType("datetime(6)") .HasColumnType("datetime(6)")
@ -12921,14 +12925,6 @@ namespace BMA.EHR.Infrastructure.Migrations
b.HasIndex("AvatarId"); b.HasIndex("AvatarId");
b.HasIndex("BloodGroupId");
b.HasIndex("GenderId");
b.HasIndex("RelationshipId");
b.HasIndex("ReligionId");
b.ToTable("PlacementReceives"); b.ToTable("PlacementReceives");
}); });
@ -15554,6 +15550,22 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("สถานที่ยื่นขอลาออกราชการ"); .HasComment("สถานที่ยื่นขอลาออกราชการ");
b.Property<string>("OfficerApproveReason")
.HasColumnType("longtext")
.HasComment("เหตุผลอนุมัติการเจ้าหน้าที่");
b.Property<bool?>("OfficerReject")
.HasColumnType("tinyint(1)")
.HasComment("สถานะยับยั้งการเจ้าหน้าที่");
b.Property<DateTime?>("OfficerRejectDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่ยับยั้งการเจ้าหน้าที่");
b.Property<string>("OfficerRejectReason")
.HasColumnType("longtext")
.HasComment("เหตุผลยับยั้งการเจ้าหน้าที่");
b.Property<string>("OligarchApproveReason") b.Property<string>("OligarchApproveReason")
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("เหตุผลอนุมัติผู้ดูแล"); .HasComment("เหตุผลอนุมัติผู้ดูแล");
@ -17210,31 +17222,7 @@ namespace BMA.EHR.Infrastructure.Migrations
.WithMany() .WithMany()
.HasForeignKey("AvatarId"); .HasForeignKey("AvatarId");
b.HasOne("BMA.EHR.Domain.Models.MetaData.BloodGroup", "BloodGroup")
.WithMany()
.HasForeignKey("BloodGroupId");
b.HasOne("BMA.EHR.Domain.Models.MetaData.Gender", "Gender")
.WithMany()
.HasForeignKey("GenderId");
b.HasOne("BMA.EHR.Domain.Models.MetaData.Relationship", "Relationship")
.WithMany()
.HasForeignKey("RelationshipId");
b.HasOne("BMA.EHR.Domain.Models.MetaData.Religion", "Religion")
.WithMany()
.HasForeignKey("ReligionId");
b.Navigation("Avatar"); b.Navigation("Avatar");
b.Navigation("BloodGroup");
b.Navigation("Gender");
b.Navigation("Relationship");
b.Navigation("Religion");
}); });
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementReceiveDoc", b => modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementReceiveDoc", b =>

View file

@ -197,12 +197,12 @@ namespace BMA.EHR.Placement.Service.Controllers
p.firstName, p.firstName,
p.lastName, p.lastName,
p.DateOfBirth, p.DateOfBirth,
Gender = p.Gender == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Gender.Id, Gender = p.Gender,
p.Nationality, p.Nationality,
p.Race, p.Race,
Religion = p.Religion == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Religion.Id, Religion = p.Religion,
BloodGroup = p.BloodGroup == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.BloodGroup.Id, BloodGroup = p.BloodGroup,
Relationship = p.Relationship == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Relationship.Id, Relationship = p.Relationship,
p.TelephoneNumber, p.TelephoneNumber,
p.Status, p.Status,
p.Amount, p.Amount,
@ -389,12 +389,12 @@ namespace BMA.EHR.Placement.Service.Controllers
firstName = req.firstName, firstName = req.firstName,
lastName = req.lastName, lastName = req.lastName,
DateOfBirth = req.BirthDate, DateOfBirth = req.BirthDate,
Gender = await _context.Genders.FindAsync(req.GenderId), Gender = req.Gender,
Nationality = req.Nationality, Nationality = req.Nationality,
Race = req.Race, Race = req.Race,
Religion = await _context.Religions.FindAsync(req.ReligionId), Religion = req.Religion,
BloodGroup = await _context.BloodGroups.FindAsync(req.BloodGroupId), BloodGroup = req.BloodGroup,
Relationship = await _context.Relationships.FindAsync(req.RelationshipId), Relationship = req.Relationship,
TelephoneNumber = req.TelephoneNumber, TelephoneNumber = req.TelephoneNumber,
Status = "WAITTING", Status = "WAITTING",
CreatedFullName = FullName ?? "System Administrator", CreatedFullName = FullName ?? "System Administrator",
@ -700,37 +700,10 @@ namespace BMA.EHR.Placement.Service.Controllers
return Error("ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง", 500); return Error("ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง", 500);
} }
if (req.RelationshipId != null) uppdated.Relationship = req.Relationship;
{ uppdated.Religion = req.Religion;
var save = await _context.Relationships.FindAsync(req.RelationshipId); uppdated.BloodGroup = req.BloodGroup;
if (save == null) uppdated.Gender = req.Gender;
return Error(GlobalMessages.RelationshipNotFound, 404);
uppdated.Relationship = save;
}
if (req.ReligionId != null)
{
var save = await _context.Religions.FindAsync(req.ReligionId);
if (save == null)
return Error(GlobalMessages.ReligionNotFound, 404);
uppdated.Religion = save;
}
if (req.BloodGroupId != null)
{
var save = await _context.BloodGroups.FindAsync(req.BloodGroupId);
if (save == null)
return Error(GlobalMessages.BloodGroupNotFound, 404);
uppdated.BloodGroup = save;
}
if (req.GenderId != null)
{
var save = await _context.Genders.FindAsync(req.GenderId);
if (save == null)
return Error(GlobalMessages.GenderNotFound, 404);
uppdated.Gender = save;
}
uppdated.citizenId = req.citizenId; uppdated.citizenId = req.citizenId;
uppdated.prefix = req.prefix; uppdated.prefix = req.prefix;
uppdated.firstName = req.firstName; uppdated.firstName = req.firstName;

View file

@ -10,12 +10,12 @@ namespace BMA.EHR.Placement.Service.Requests
public string firstName { get; set; } public string firstName { get; set; }
public string lastName { get; set; } public string lastName { get; set; }
public DateTime DateOfBirth { get; set; } public DateTime DateOfBirth { get; set; }
public Guid? GenderId { get; set; } public string? Gender { get; set; }
public string? Nationality { get; set; } public string? Nationality { get; set; }
public string? Race { get; set; } public string? Race { get; set; }
public Guid? ReligionId { get; set; } public string? Religion { get; set; }
public Guid? BloodGroupId { get; set; } public string? BloodGroup { get; set; }
public Guid? RelationshipId { get; set; } public string? Relationship { get; set; }
public string? TelephoneNumber { get; set; } public string? TelephoneNumber { get; set; }
public string? Reason { get; set; } public string? Reason { get; set; }
public string? EducationOld { get; set; } public string? EducationOld { get; set; }

View file

@ -10,12 +10,12 @@ namespace BMA.EHR.Placement.Service.Requests
public string firstName { get; set; } public string firstName { get; set; }
public string lastName { get; set; } public string lastName { get; set; }
public DateTime BirthDate { get; set; } public DateTime BirthDate { get; set; }
public Guid? GenderId { get; set; } public string? Gender { get; set; }
public string? Nationality { get; set; } public string? Nationality { get; set; }
public string? Race { get; set; } public string? Race { get; set; }
public Guid? ReligionId { get; set; } public string? Religion { get; set; }
public Guid? BloodGroupId { get; set; } public string? BloodGroup { get; set; }
public Guid? RelationshipId { get; set; } public string? Relationship { get; set; }
public string? TelephoneNumber { get; set; } public string? TelephoneNumber { get; set; }
public List<FormFile>? File { get; set; } public List<FormFile>? File { get; set; }
} }

View file

@ -242,10 +242,18 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.CommanderApproveReason, p.CommanderApproveReason,
p.CommanderRejectReason, p.CommanderRejectReason,
p.CommanderRejectDate, p.CommanderRejectDate,
p.OfficerReject,
p.OfficerApproveReason,
p.OfficerRejectReason,
p.OfficerRejectDate,
p.RemarkHorizontal, p.RemarkHorizontal,
p.position,
p.posTypeName,
p.posLevelName,
p.posMasterNo,
// Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id, // Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
RetirementResignDocs = p.RetirementResignDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }), RetirementResignDocs = p.RetirementResignDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
RetirementResignDebtDocs = p.RetirementResignDebtDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }), // RetirementResignDebtDocs = p.RetirementResignDebtDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
}) })
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
if (data == null) if (data == null)
@ -262,17 +270,17 @@ namespace BMA.EHR.Retirement.Service.Controllers
}; };
retirementResignDocs.Add(_doc); retirementResignDocs.Add(_doc);
} }
var retirementResignDebtDocs = new List<dynamic>(); // var retirementResignDebtDocs = new List<dynamic>();
foreach (var doc in data.RetirementResignDebtDocs) // foreach (var doc in data.RetirementResignDebtDocs)
{ // {
var _doc = new // var _doc = new
{ // {
FileName = doc.FileName, // FileName = doc.FileName,
PathName = await _documentService.ImagesPath(doc.Id), // PathName = await _documentService.ImagesPath(doc.Id),
doc.Id, // doc.Id,
}; // };
retirementResignDebtDocs.Add(_doc); // retirementResignDebtDocs.Add(_doc);
} // }
var _data = new var _data = new
{ {
data.Id, data.Id,
@ -303,10 +311,18 @@ namespace BMA.EHR.Retirement.Service.Controllers
data.CommanderApproveReason, data.CommanderApproveReason,
data.CommanderRejectReason, data.CommanderRejectReason,
data.CommanderRejectDate, data.CommanderRejectDate,
data.OfficerReject,
data.OfficerApproveReason,
data.OfficerRejectReason,
data.OfficerRejectDate,
data.RemarkHorizontal, data.RemarkHorizontal,
data.position,
data.posTypeName,
data.posLevelName,
data.posMasterNo,
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar), // Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
Docs = retirementResignDocs, Docs = retirementResignDocs,
DocDebts = retirementResignDebtDocs, // DocDebts = retirementResignDebtDocs,
}; };
return Success(_data); return Success(_data);
@ -501,32 +517,32 @@ namespace BMA.EHR.Retirement.Service.Controllers
updated.LastUpdateUserId = UserId ?? ""; updated.LastUpdateUserId = UserId ?? "";
updated.LastUpdatedAt = DateTime.Now; updated.LastUpdatedAt = DateTime.Now;
if (Request.Form.Files != null && Request.Form.Files.Count != 0) // if (Request.Form.Files != null && Request.Form.Files.Count != 0)
{ // {
foreach (var file in Request.Form.Files) // foreach (var file in Request.Form.Files)
{ // {
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() // var _doc = await _context.Documents.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == doc.Id); // .FirstOrDefaultAsync(x => x.Id == doc.Id);
if (_doc != null) // if (_doc != null)
{ // {
var retirementResignDebtDoc = new RetirementResignDebtDoc // var retirementResignDebtDoc = new RetirementResignDebtDoc
{ // {
RetirementResign = updated, // RetirementResign = updated,
Document = _doc, // Document = _doc,
CreatedFullName = FullName ?? "System Administrator", // CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "", // CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now, // CreatedAt = DateTime.Now,
LastUpdateFullName = FullName ?? "System Administrator", // LastUpdateFullName = FullName ?? "System Administrator",
LastUpdateUserId = UserId ?? "", // LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now, // LastUpdatedAt = DateTime.Now,
}; // };
await _context.RetirementResignDebtDocs.AddAsync(retirementResignDebtDoc); // await _context.RetirementResignDebtDocs.AddAsync(retirementResignDebtDoc);
} // }
} // }
} // }
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
return Success(); return Success();
} }
@ -661,6 +677,92 @@ namespace BMA.EHR.Retirement.Service.Controllers
return Success(); 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>
[HttpPut("officer/confirm/{id:length(36)}")]
public async Task<ActionResult<ResponseObject>> OfficerConfirm([FromBody] RetirementReasonRequest req, Guid id)
{
var updated = await _context.RetirementResigns
.FirstOrDefaultAsync(x => x.Id == id);
if (updated == null)
return Error(GlobalMessages.RetirementResignNotFound, 404);
// updated.Status = "APPROVE";
updated.OfficerReject = false;
updated.OfficerApproveReason = req.Reason;
updated.LastUpdateFullName = FullName ?? "System Administrator";
updated.LastUpdateUserId = UserId ?? "";
updated.LastUpdatedAt = DateTime.Now;
await _repositoryNoti.PushNotificationAsync(
Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6"),
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
"",
true
);
await _repositoryNoti.PushNotificationAsync(
Guid.Parse("08dbc953-61ac-47eb-82d7-0e72df7669b5"),
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ได้รับการอนุมัติจากการเจ้าหน้าที่",
"",
true
);
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>
[HttpPut("officer/reject/{id:length(36)}")]
public async Task<ActionResult<ResponseObject>> OfficerReject([FromBody] RetirementReasonDateRequest req, Guid id)
{
var updated = await _context.RetirementResigns
.FirstOrDefaultAsync(x => x.Id == id);
if (updated == null)
return Error(GlobalMessages.RetirementResignNotFound, 404);
if ((DateTime.Now - updated.CreatedAt).TotalDays >= 90)
return Error("สามารถยับยั้งได้ไม่เกิน 90 วัน");
// updated.Status = "REJECT";
updated.OfficerReject = true;
updated.OfficerRejectReason = req.Reason;
updated.OfficerRejectDate = req.Date;
updated.LastUpdateFullName = FullName ?? "System Administrator";
updated.LastUpdateUserId = UserId ?? "";
updated.LastUpdatedAt = DateTime.Now;
await _repositoryNoti.PushNotificationAsync(
Guid.Parse("08dbca3a-8b6a-4a4e-8b23-1f62e4f30ef6"),
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
"",
true
);
await _repositoryNoti.PushNotificationAsync(
Guid.Parse("08dbc953-61ac-47eb-82d7-0e72df7669b5"),
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
$"คำขอลาออกขอ {updated.prefix}{updated.firstName} {updated.lastName} ถูกยับยั้งจากการเจ้าหน้าที่",
"",
true
);
await _context.SaveChangesAsync();
return Success();
}
/// <summary> /// <summary>
/// ผู้บังคับบัญชา อนุมัติคำลาออก /// ผู้บังคับบัญชา อนุมัติคำลาออก
/// </summary> /// </summary>
@ -930,6 +1032,10 @@ namespace BMA.EHR.Retirement.Service.Controllers
LastUpdatedAt = p.LastUpdatedAt, LastUpdatedAt = p.LastUpdatedAt,
OrganizationPositionOld = p.RetirementResign.OrganizationPositionOld, OrganizationPositionOld = p.RetirementResign.OrganizationPositionOld,
CreatedAt = p.CreatedAt, CreatedAt = p.CreatedAt,
position = p.RetirementResign.position,
posTypeName = p.RetirementResign.posTypeName,
posLevelName = p.RetirementResign.posLevelName,
posMasterNo = p.RetirementResign.posMasterNo,
Score1 = p.Score1, Score1 = p.Score1,
Score2 = p.Score2, Score2 = p.Score2,

View file

@ -6,6 +6,6 @@ namespace BMA.EHR.Retirement.Service.Requests
public class RetirementResignDebtRequest public class RetirementResignDebtRequest
{ {
public bool IsNoDebt { get; set; } public bool IsNoDebt { get; set; }
public List<FormFile>? File { get; set; } // public List<FormFile>? File { get; set; }
} }
} }