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

View file

@ -163,9 +163,9 @@ namespace BMA.EHR.Application.Repositories.Reports
if (profiles.Count > 0)
{
mapProfiles = profiles
// .OrderBy(x => rootOrder.ToObject<List<string>>().IndexOf(x.root))
// .ThenBy(x => posTypeNameOrder.ToObject<List<string>>().IndexOf(x.posTypeName ?? ""))
// .ThenBy(x => posLevelNameOrder.ToObject<List<string>>().IndexOf(x.posLevelName ?? ""))
// .OrderBy(x => rootOrder.ToObject<List<string>>().IndexOf(x.root))
// .ThenBy(x => posTypeNameOrder.ToObject<List<string>>().IndexOf(x.posTypeName ?? ""))
// .ThenBy(x => posLevelNameOrder.ToObject<List<string>>().IndexOf(x.posLevelName ?? ""))
.Select((profile, index) =>
{
// bool isDuplicateRoot = profile.root == previousRoot;
@ -176,7 +176,7 @@ namespace BMA.EHR.Application.Repositories.Reports
// previousPosLevelName = profile.posLevelName;
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}",
root = "",
child = (profile.posExecutiveName == null ? "" : profile.posExecutiveName + "\n") +
@ -305,7 +305,7 @@ namespace BMA.EHR.Application.Repositories.Reports
previousPosLevelName = profile.posLevelName;
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}",
root = (isDuplicateRoot ? "" : profile.root + "\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,
LastName = item.LastName,
//Organization = item.Organization,
Organization = (item.Position == null ? "" : item.Position + " ") +
(item.child4 == null ? "" : item.child4 + " ") +
(item.child3 == null ? "" : item.child3 + " ") +
(item.child2 == null ? "" : item.child2 + " ") +
(item.child1 == null ? "" : item.child1 + " ") +
Organization = (item.Position == null ? "" : item.Position + "\n") +
(item.child4 == null ? "" : item.child4 + "\n") +
(item.child3 == null ? "" : item.child3 + "\n") +
(item.child2 == null ? "" : item.child2 + "\n") +
(item.child1 == null ? "" : item.child1 + "\n") +
(item.root == null ? "" : item.root),
root = item.root,

View file

@ -101,5 +101,7 @@ namespace BMA.EHR.Domain.Models.Placement
public string? posLevelOldId { get; set; }
[Comment("ชื่อระดับตำแหน่ง old")]
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")
.HasComment("profile Id");
b.Property<Guid?>("refId")
.HasColumnType("char(36)")
.HasComment("Id อ้างอิงช่วยราช");
b.Property<string>("rootDnaOldId")
.HasColumnType("longtext")
.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;
}
var apiUrlUpdate = $"{_configuration["API"]}/org/pos/officer/master-old/book";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _resUpdate = await client.PostAsJsonAsync(apiUrlUpdate, new
{
posMasterOldId = uppdated.posmasterId,
posMasterId = req.posmasterId,
profileId = uppdated.profileId,
});
}
// var apiUrlUpdate = $"{_configuration["API"]}/org/pos/officer/master-old/book";
// using (var client = new HttpClient())
// {
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
// var _resUpdate = await client.PostAsJsonAsync(apiUrlUpdate, new
// {
// posMasterOldId = uppdated.posmasterId,
// posMasterId = req.posmasterId,
// profileId = uppdated.profileId,
// });
// }
uppdated.typeCommand = req.typeCommand == null ? null : req.typeCommand.Trim().ToUpper();
uppdated.posmasterId = req.posmasterId;
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;
}
var apiUrlUpdate = $"{_configuration["API"]}/org/pos/employee/master-old/book";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _resUpdate = await client.PostAsJsonAsync(apiUrlUpdate, new
{
posMasterOldId = uppdated.posmasterId,
posMasterId = req.posmasterId,
profileId = uppdated.profileId,
});
}
// var apiUrlUpdate = $"{_configuration["API"]}/org/pos/employee/master-old/book";
// using (var client = new HttpClient())
// {
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
// var _resUpdate = await client.PostAsJsonAsync(apiUrlUpdate, new
// {
// posMasterOldId = uppdated.posmasterId,
// posMasterId = req.posmasterId,
// profileId = uppdated.profileId,
// });
// }
uppdated.typeCommand = req.typeCommand == null ? null : req.typeCommand.Trim().ToUpper();
uppdated.posmasterId = req.posmasterId;
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;
}
var apiUrlUpdate = $"{_configuration["API"]}/org/pos/officer/master-old/book";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _resUpdate = await client.PostAsJsonAsync(apiUrlUpdate, new
{
posMasterOldId = uppdated.posmasterId,
posMasterId = req.posmasterId,
profileId = uppdated.profileId,
});
}
// var apiUrlUpdate = $"{_configuration["API"]}/org/pos/officer/master-old/book";
// using (var client = new HttpClient())
// {
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
// var _resUpdate = await client.PostAsJsonAsync(apiUrlUpdate, new
// {
// posMasterOldId = uppdated.posmasterId,
// posMasterId = req.posmasterId,
// profileId = uppdated.profileId,
// });
// }
uppdated.posmasterId = req.posmasterId;
uppdated.node = req.node;
uppdated.nodeId = req.nodeId;

View file

@ -221,7 +221,7 @@ namespace BMA.EHR.Placement.Service.Controllers
[HttpPost()]
public async Task<ActionResult<ResponseObject>> Post([FromForm] PlacementAddProfileRequest req)
{
var placementOfficer = await _context.PlacementOfficers
.Where(x => x.Id == (req.OfficerId ?? Guid.Parse("00000000-0000-0000-0000-000000000000")))
.FirstOrDefaultAsync();
@ -230,6 +230,7 @@ namespace BMA.EHR.Placement.Service.Controllers
var placementRepatriation = new PlacementRepatriation
{
Organization = placementOfficer.Organization,
refId = req.OfficerId ?? Guid.Parse("00000000-0000-0000-0000-000000000000"),
// Reason = placementOfficer.Reason,
Date = placementOfficer.DateStart,
DateRepatriation = placementOfficer.DateEnd,
@ -298,6 +299,20 @@ namespace BMA.EHR.Placement.Service.Controllers
(org.result.root == null ? "" : org.result.root);
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.SaveChangesAsync();
@ -391,6 +406,20 @@ namespace BMA.EHR.Placement.Service.Controllers
.FirstOrDefaultAsync(x => x.Id == id);
if (deleted == null)
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);
await _context.SaveChangesAsync();

View file

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