Merge branch 'develop' into working

This commit is contained in:
Suphonchai Phoonsawat 2025-04-02 09:17:42 +07:00
commit 24d9da8412
12 changed files with 20248 additions and 100 deletions

View file

@ -68,40 +68,40 @@ jobs:
docker compose pull docker compose pull
docker compose up -d docker compose up -d
echo "${{ steps.gen_ver.outputs.image_ver }}"> success echo "${{ steps.gen_ver.outputs.image_ver }}"> success
# - name: Notify Discord Success - name: Notify Discord Success
# if: success() if: success()
# run: | run: |
# curl -H "Content-Type: application/json" \ curl -H "Content-Type: application/json" \
# -X POST \ -X POST \
# -d '{ -d '{
# "embeds": [{ "embeds": [{
# "title": "✅ Deployment Success!", "title": "✅ Deployment Success!",
# "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`", "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
# "color": 3066993, "color": 3066993,
# "footer": { "footer": {
# "text": "Release Notification", "text": "Release Notification",
# "icon_url": "https://example.com/success-icon.png" "icon_url": "https://example.com/success-icon.png"
# }, },
# "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'" "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
# }] }]
# }' \ }' \
# ${{ secrets.DISCORD_WEBHOOK }} ${{ secrets.DISCORD_WEBHOOK }}
# - name: Notify Discord Failure - name: Notify Discord Failure
# if: failure() if: failure()
# run: | run: |
# curl -H "Content-Type: application/json" \ curl -H "Content-Type: application/json" \
# -X POST \ -X POST \
# -d '{ -d '{
# "embeds": [{ "embeds": [{
# "title": "❌ Deployment Failed!", "title": "❌ Deployment Failed!",
# "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`", "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
# "color": 15158332, "color": 15158332,
# "footer": { "footer": {
# "text": "Release Notification", "text": "Release Notification",
# "icon_url": "https://example.com/failure-icon.png" "icon_url": "https://example.com/failure-icon.png"
# }, },
# "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'" "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
# }] }]
# }' \ }' \
# ${{ secrets.DISCORD_WEBHOOK }} ${{ secrets.DISCORD_WEBHOOK }}

View file

@ -163,9 +163,9 @@ namespace BMA.EHR.Application.Repositories.Reports
if (profiles.Count > 0) if (profiles.Count > 0)
{ {
mapProfiles = profiles mapProfiles = profiles
// .OrderBy(x => rootOrder.ToObject<List<string>>().IndexOf(x.root)) // .OrderBy(x => rootOrder.ToObject<List<string>>().IndexOf(x.root))
// .ThenBy(x => posTypeNameOrder.ToObject<List<string>>().IndexOf(x.posTypeName ?? "")) // .ThenBy(x => posTypeNameOrder.ToObject<List<string>>().IndexOf(x.posTypeName ?? ""))
// .ThenBy(x => posLevelNameOrder.ToObject<List<string>>().IndexOf(x.posLevelName ?? "")) // .ThenBy(x => posLevelNameOrder.ToObject<List<string>>().IndexOf(x.posLevelName ?? ""))
.Select((profile, index) => .Select((profile, index) =>
{ {
// bool isDuplicateRoot = profile.root == previousRoot; // bool isDuplicateRoot = profile.root == previousRoot;
@ -176,7 +176,7 @@ namespace BMA.EHR.Application.Repositories.Reports
// previousPosLevelName = profile.posLevelName; // previousPosLevelName = profile.posLevelName;
return new ProfileRetireJsonRequest return new ProfileRetireJsonRequest
{ {
order = $"{ (index + 1).ToString().ToThaiNumber() }. ลำดับที่ { (profile.order).ToString().ToThaiNumber() }", order = retireHistorys.TypeReport == null ? (index + 1).ToString().ToThaiNumber() : $"{(index + 1).ToString().ToThaiNumber()}. ลำดับที่ {(profile.order).ToString().ToThaiNumber()}",
fullName = $"{profile.prefix}{profile.firstName} {profile.lastName}", fullName = $"{profile.prefix}{profile.firstName} {profile.lastName}",
root = "", root = "",
child = (profile.posExecutiveName == null ? "" : profile.posExecutiveName + "\n") + child = (profile.posExecutiveName == null ? "" : profile.posExecutiveName + "\n") +
@ -305,7 +305,7 @@ namespace BMA.EHR.Application.Repositories.Reports
previousPosLevelName = profile.posLevelName; previousPosLevelName = profile.posLevelName;
return new ProfileRetireJsonRequest return new ProfileRetireJsonRequest
{ {
order = (index + 1).ToString().ToThaiNumber(), order = retire.TypeReport == null ? (index + 1).ToString().ToThaiNumber() : $"{(index + 1).ToString().ToThaiNumber()}. ลำดับที่ {(profile.order).ToString().ToThaiNumber()}",
fullName = $"{profile.prefix}{profile.firstName} {profile.lastName}", fullName = $"{profile.prefix}{profile.firstName} {profile.lastName}",
root = (isDuplicateRoot ? "" : profile.root + "\n") + root = (isDuplicateRoot ? "" : profile.root + "\n") +
(isDuplicateHospital || !hospital.ToObject<List<string>>().Contains(profile.child1) ? "" : profile.child1 + "\n") + (isDuplicateHospital || !hospital.ToObject<List<string>>().Contains(profile.child1) ? "" : profile.child1 + "\n") +

View file

@ -1455,11 +1455,11 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
FirstName = item.FirstName, FirstName = item.FirstName,
LastName = item.LastName, LastName = item.LastName,
//Organization = item.Organization, //Organization = item.Organization,
Organization = (item.Position == null ? "" : item.Position + " ") + Organization = (item.Position == null ? "" : item.Position + "\n") +
(item.child4 == null ? "" : item.child4 + " ") + (item.child4 == null ? "" : item.child4 + "\n") +
(item.child3 == null ? "" : item.child3 + " ") + (item.child3 == null ? "" : item.child3 + "\n") +
(item.child2 == null ? "" : item.child2 + " ") + (item.child2 == null ? "" : item.child2 + "\n") +
(item.child1 == null ? "" : item.child1 + " ") + (item.child1 == null ? "" : item.child1 + "\n") +
(item.root == null ? "" : item.root), (item.root == null ? "" : item.root),
root = item.root, root = item.root,

View file

@ -101,5 +101,7 @@ namespace BMA.EHR.Domain.Models.Placement
public string? posLevelOldId { get; set; } public string? posLevelOldId { get; set; }
[Comment("ชื่อระดับตำแหน่ง old")] [Comment("ชื่อระดับตำแหน่ง old")]
public string? posLevelNameOld { get; set; } public string? posLevelNameOld { get; set; }
[Comment("Id อ้างอิงช่วยราช")]
public Guid? refId { get; set; }
} }
} }

View file

@ -0,0 +1,31 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class update_table_placementRepatriation_add_refId : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "refId",
table: "PlacementRepatriations",
type: "char(36)",
nullable: true,
comment: "Id อ้างอิงช่วยราช",
collation: "ascii_general_ci");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "refId",
table: "PlacementRepatriations");
}
}
}

View file

@ -14083,6 +14083,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("profile Id"); .HasComment("profile Id");
b.Property<Guid?>("refId")
.HasColumnType("char(36)")
.HasComment("Id อ้างอิงช่วยราช");
b.Property<string>("rootDnaOldId") b.Property<string>("rootDnaOldId")
.HasColumnType("longtext") .HasColumnType("longtext")
.HasComment("id หน่วยงาน rootDna old"); .HasComment("id หน่วยงาน rootDna old");

View file

@ -556,18 +556,18 @@ namespace BMA.EHR.Placement.Service.Controllers
uppdated.child4ShortName = req.node <= 3 ? null : org.result.child4ShortName; uppdated.child4ShortName = req.node <= 3 ? null : org.result.child4ShortName;
} }
var apiUrlUpdate = $"{_configuration["API"]}/org/pos/officer/master-old/book"; // var apiUrlUpdate = $"{_configuration["API"]}/org/pos/officer/master-old/book";
using (var client = new HttpClient()) // using (var client = new HttpClient())
{ // {
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); // client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _resUpdate = await client.PostAsJsonAsync(apiUrlUpdate, new // var _resUpdate = await client.PostAsJsonAsync(apiUrlUpdate, new
{ // {
posMasterOldId = uppdated.posmasterId, // posMasterOldId = uppdated.posmasterId,
posMasterId = req.posmasterId, // posMasterId = req.posmasterId,
profileId = uppdated.profileId, // profileId = uppdated.profileId,
}); // });
} // }
uppdated.typeCommand = req.typeCommand == null ? null : req.typeCommand.Trim().ToUpper(); uppdated.typeCommand = req.typeCommand == null ? null : req.typeCommand.Trim().ToUpper();
uppdated.posmasterId = req.posmasterId; uppdated.posmasterId = req.posmasterId;
uppdated.node = req.node; uppdated.node = req.node;

View file

@ -581,18 +581,18 @@ namespace BMA.EHR.Placement.Service.Controllers
uppdated.child4ShortName = req.node <= 3 ? null : org.result.child4ShortName; uppdated.child4ShortName = req.node <= 3 ? null : org.result.child4ShortName;
} }
var apiUrlUpdate = $"{_configuration["API"]}/org/pos/employee/master-old/book"; // var apiUrlUpdate = $"{_configuration["API"]}/org/pos/employee/master-old/book";
using (var client = new HttpClient()) // using (var client = new HttpClient())
{ // {
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); // client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _resUpdate = await client.PostAsJsonAsync(apiUrlUpdate, new // var _resUpdate = await client.PostAsJsonAsync(apiUrlUpdate, new
{ // {
posMasterOldId = uppdated.posmasterId, // posMasterOldId = uppdated.posmasterId,
posMasterId = req.posmasterId, // posMasterId = req.posmasterId,
profileId = uppdated.profileId, // profileId = uppdated.profileId,
}); // });
} // }
uppdated.typeCommand = req.typeCommand == null ? null : req.typeCommand.Trim().ToUpper(); uppdated.typeCommand = req.typeCommand == null ? null : req.typeCommand.Trim().ToUpper();
uppdated.posmasterId = req.posmasterId; uppdated.posmasterId = req.posmasterId;
uppdated.node = req.node; uppdated.node = req.node;

View file

@ -654,18 +654,18 @@ namespace BMA.EHR.Placement.Service.Controllers
uppdated.child4ShortName = req.node <= 3 ? null : org.result.child4ShortName; uppdated.child4ShortName = req.node <= 3 ? null : org.result.child4ShortName;
} }
var apiUrlUpdate = $"{_configuration["API"]}/org/pos/officer/master-old/book"; // var apiUrlUpdate = $"{_configuration["API"]}/org/pos/officer/master-old/book";
using (var client = new HttpClient()) // using (var client = new HttpClient())
{ // {
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); // client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _resUpdate = await client.PostAsJsonAsync(apiUrlUpdate, new // var _resUpdate = await client.PostAsJsonAsync(apiUrlUpdate, new
{ // {
posMasterOldId = uppdated.posmasterId, // posMasterOldId = uppdated.posmasterId,
posMasterId = req.posmasterId, // posMasterId = req.posmasterId,
profileId = uppdated.profileId, // profileId = uppdated.profileId,
}); // });
} // }
uppdated.posmasterId = req.posmasterId; uppdated.posmasterId = req.posmasterId;
uppdated.node = req.node; uppdated.node = req.node;
uppdated.nodeId = req.nodeId; uppdated.nodeId = req.nodeId;

View file

@ -221,7 +221,7 @@ namespace BMA.EHR.Placement.Service.Controllers
[HttpPost()] [HttpPost()]
public async Task<ActionResult<ResponseObject>> Post([FromForm] PlacementAddProfileRequest req) public async Task<ActionResult<ResponseObject>> Post([FromForm] PlacementAddProfileRequest req)
{ {
var placementOfficer = await _context.PlacementOfficers var placementOfficer = await _context.PlacementOfficers
.Where(x => x.Id == (req.OfficerId ?? Guid.Parse("00000000-0000-0000-0000-000000000000"))) .Where(x => x.Id == (req.OfficerId ?? Guid.Parse("00000000-0000-0000-0000-000000000000")))
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
@ -230,6 +230,7 @@ namespace BMA.EHR.Placement.Service.Controllers
var placementRepatriation = new PlacementRepatriation var placementRepatriation = new PlacementRepatriation
{ {
Organization = placementOfficer.Organization, Organization = placementOfficer.Organization,
refId = req.OfficerId ?? Guid.Parse("00000000-0000-0000-0000-000000000000"),
// Reason = placementOfficer.Reason, // Reason = placementOfficer.Reason,
Date = placementOfficer.DateStart, Date = placementOfficer.DateStart,
DateRepatriation = placementOfficer.DateEnd, DateRepatriation = placementOfficer.DateEnd,
@ -298,6 +299,20 @@ namespace BMA.EHR.Placement.Service.Controllers
(org.result.root == null ? "" : org.result.root); (org.result.root == null ? "" : org.result.root);
placementRepatriation.OrganizationPositionOld = org.result.position + "\n" + (placementRepatriation.PositionExecutiveOld == null ? "" : placementRepatriation.PositionExecutiveOld + "\n") + placementRepatriation.OrganizationOld; placementRepatriation.OrganizationPositionOld = org.result.position + "\n" + (placementRepatriation.PositionExecutiveOld == null ? "" : placementRepatriation.PositionExecutiveOld + "\n") + placementRepatriation.OrganizationOld;
} }
var baseAPIOrg = _configuration["API"];
var apiUrlOrg = $"{baseAPIOrg}/org/profile/assistance/status";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
{
refId = req.OfficerId ?? Guid.Parse("00000000-0000-0000-0000-000000000000"),
status = "DONE"
});
var _result = await _res.Content.ReadAsStringAsync();
}
await _context.PlacementRepatriations.AddAsync(placementRepatriation); await _context.PlacementRepatriations.AddAsync(placementRepatriation);
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
@ -391,6 +406,20 @@ namespace BMA.EHR.Placement.Service.Controllers
.FirstOrDefaultAsync(x => x.Id == id); .FirstOrDefaultAsync(x => x.Id == id);
if (deleted == null) if (deleted == null)
return NotFound(); return NotFound();
var baseAPIOrg = _configuration["API"];
var apiUrlOrg = $"{baseAPIOrg}/org/profile/assistance/status";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _res = await client.PostAsJsonAsync(apiUrlOrg, new
{
refId = deleted.refId ?? Guid.Parse("00000000-0000-0000-0000-000000000000"),
status = "PENDING"
});
var _result = await _res.Content.ReadAsStringAsync();
}
_context.PlacementRepatriations.Remove(deleted); _context.PlacementRepatriations.Remove(deleted);
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();

View file

@ -168,7 +168,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.Status, p.Status,
p.Amount, p.Amount,
p.ReportingDate, p.ReportingDate,
p.CreatedAt, p.CreatedAt,
p.Reason, p.Reason,
p.MilitaryDate, p.MilitaryDate,
@ -268,7 +268,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.posTypeName, p.posTypeName,
p.posLevelId, p.posLevelId,
p.posLevelName, p.posLevelName,
p.rootOld, p.rootOld,
p.rootOldId, p.rootOldId,
p.rootShortNameOld, p.rootShortNameOld,
@ -297,7 +297,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.Status, p.Status,
p.Amount, p.Amount,
p.ReportingDate, p.ReportingDate,
p.CreatedAt, p.CreatedAt,
p.Reason, p.Reason,
p.MilitaryDate, p.MilitaryDate,
@ -458,8 +458,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
.FirstOrDefaultAsync(x => x.Id == id); .FirstOrDefaultAsync(x => x.Id == id);
if (uppdated == null) if (uppdated == null)
return Error(GlobalMessages.RetirementOtherNotFound, 404); return Error(GlobalMessages.RetirementOtherNotFound, 404);
var apiUrl = $"{_configuration["API"]}/org/find/all"; var apiUrl = $"{_configuration["API"]}/org/find/all";
using (var client = new HttpClient()) using (var client = new HttpClient())
{ {
@ -498,18 +498,18 @@ namespace BMA.EHR.Retirement.Service.Controllers
uppdated.child4ShortName = req.node <= 3 ? null : org.result.child4ShortName; uppdated.child4ShortName = req.node <= 3 ? null : org.result.child4ShortName;
} }
var apiUrlUpdate = $"{_configuration["API"]}/org/pos/officer/master-old/book"; // var apiUrlUpdate = $"{_configuration["API"]}/org/pos/officer/master-old/book";
using (var client = new HttpClient()) // using (var client = new HttpClient())
{ // {
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", "")); // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]); // client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _resUpdate = await client.PostAsJsonAsync(apiUrlUpdate, new // var _resUpdate = await client.PostAsJsonAsync(apiUrlUpdate, new
{ // {
posMasterOldId = uppdated.posmasterId, // posMasterOldId = uppdated.posmasterId,
posMasterId = req.posmasterId, // posMasterId = req.posmasterId,
profileId = uppdated.profileId, // profileId = uppdated.profileId,
}); // });
} // }
uppdated.posmasterId = req.posmasterId; uppdated.posmasterId = req.posmasterId;
uppdated.node = req.node; uppdated.node = req.node;
uppdated.nodeId = req.nodeId; uppdated.nodeId = req.nodeId;
@ -822,6 +822,9 @@ namespace BMA.EHR.Retirement.Service.Controllers
commandCode = r.commandCode, commandCode = r.commandCode,
commandName = r.commandName, commandName = r.commandName,
remark = r.remark, remark = r.remark,
positionTypeNew = p.posTypeId,
positionLevelNew = p.posLevelId,
positionNameNew = p.position,
}).ToList(); }).ToList();
var baseAPIOrg = _configuration["API"]; var baseAPIOrg = _configuration["API"];
@ -1047,6 +1050,9 @@ namespace BMA.EHR.Retirement.Service.Controllers
commandCode = r.commandCode, commandCode = r.commandCode,
commandName = r.commandName, commandName = r.commandName,
remark = r.remark, remark = r.remark,
positionTypeNew = p.posTypeId,
positionLevelNew = p.posLevelId,
positionNameNew = p.position,
}).ToList(); }).ToList();
var baseAPIOrg = _configuration["API"]; var baseAPIOrg = _configuration["API"];