Merge branch 'develop' into working

This commit is contained in:
Suphonchai Phoonsawat 2025-01-21 19:41:19 +07:00
commit f70fbff8f0
73 changed files with 121122 additions and 833 deletions

View file

@ -1,13 +1,10 @@
name: release-dev
run-name: release-dev ${{ github.actor }}
on:
# push:
# tags:
# - 'v[0-9]+.[0-9]+.[0-9]+'
# tags-ignore:
# - '2.*'
# Allow run workflow manually from Action tab
workflow_dispatch:
push:
tags:
- "reportv2-[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:
env:
REGISTRY: docker.frappet.com
IMAGE_NAME: ehr/bma-ehr-report-v2-service
@ -23,20 +20,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# skip Set up QEMU because it fail on act and container
- name: Set output tags
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Gen Version
id: gen_ver
run: |
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
IMAGE_VER='${GITHUB_REF/refs\/tags\//}'
else
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
fi
if [[ $IMAGE_VER == '' ]]; then
IMAGE_VER='test-vBeta'
fi
echo '::set-output name=image_ver::'$IMAGE_VER
- name: Test Version
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
IMAGE_VER=${{ steps.vars.outputs.tag }}
else
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
fi
if [[ $IMAGE_VER == '' ]]; then
IMAGE_VER='test-vBeta'
fi
echo '::set-output name=image_ver::'$IMAGE_VER
- name: Check Version
run: |
echo $GITHUB_REF
echo ${{ steps.gen_ver.outputs.image_ver }}
@ -69,21 +68,40 @@ jobs:
docker compose pull
docker compose up -d
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
- uses: snow-actions/line-notify@v1.1.0
- name: Notify Discord Success
if: success()
with:
access_token: ${{ env.TOKEN_LINE }}
message: |
-Success✅✅✅
Image: ${{env.IMAGE_NAME}}
Version: ${{ github.event.inputs.IMAGE_VER }}
By: ${{secrets.DOCKER_USER}}
- uses: snow-actions/line-notify@v1.1.0
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()
with:
access_token: ${{ env.TOKEN_LINE }}
message: |
-Failure❌❌❌
Image: ${{env.IMAGE_NAME}}
Version: ${{ github.event.inputs.IMAGE_VER }}
By: ${{secrets.DOCKER_USER}}
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

@ -1,6 +1,6 @@
version: 37
jobs:
- name: CI for Checkin [UAT]
- name: CI for UAT
steps:
- !CheckoutStep
name: checkout code
@ -33,32 +33,44 @@ jobs:
dotnet test -l trx --collect:"XPlat Code Coverage"
#/root/.dotnet/tools/roslynator analyze -o roslynator-analysis.xml
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
condition: NEVER
- !PublishTRXReportStep
name: publish unit test report
reportName: Unit Test
filePatterns: '**/*.trx'
condition: ALWAYS
condition: NEVER
- !PublishCoberturaReportStep
name: publish code coverage report
reportName: Code Coverage
filePatterns: '**/coverage.cobertura.xml'
condition: ALWAYS
condition: NEVER
- !PublishRoslynatorReportStep
name: publish code problem report
reportName: Code Problems
filePatterns: roslynator-analysis.xml
failThreshold: HIGH
condition: ALWAYS
condition: NEVER
- !SetBuildVersionStep
name: set build version
buildVersion: '@tag@'
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !BuildImageStep
name: build docker image
name: build docker image - Leave
dockerfile: ./BMA.EHR.Leave/Dockerfile
output: !RegistryOutput
tags: hrms-git.chin.in.th/bma-hrms/hrms-api-leave:@build_version@ hrms-git.chin.in.th/bma-hrms/hrms-api-leave:latest
condition: NEVER
- !BuildImageStep
name: build docker image - Checkin
dockerfile: ./BMA.EHR.CheckInConsumer/Dockerfile
output: !RegistryOutput
tags: hrms-git.chin.in.th/bma-hrms/hrms-api-checkin:@build_version@ hrms-git.chin.in.th/bma-hrms/hrms-api-checkin:latest
condition: NEVER
- !BuildImageStep
name: build docker image - Insignia
dockerfile: ./BMA.EHR.Insignia/Dockerfile
output: !RegistryOutput
tags: hrms-git.chin.in.th/bma-hrms/hrms-api-insignia:@build_version@ hrms-git.chin.in.th/bma-hrms/hrms-api-insignia:latest
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
triggers:
- !TagCreateTrigger
@ -68,53 +80,3 @@ jobs:
maxRetries: 3
retryDelay: 30
timeout: 14400
- name: CI for PROD
steps:
- !CheckoutStep
name: checkout code
cloneCredential: !DefaultCredential {}
withLfs: false
withSubmodules: false
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !GenerateChecksumStep
name: generate package checksum
files: package-lock.json yarn.lock
targetFile: checksum
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !SetupCacheStep
name: set up npm cache
key: node_modules_@file:checksum@
loadKeys:
- node_modules
paths:
- node_modules
uploadStrategy: UPLOAD_IF_NOT_HIT
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !SetBuildVersionStep
name: set build version
buildVersion: '@tag@'
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: build & test
runInContainer: true
image: node
interpreter: !DefaultInterpreter
commands: |
npm install
npm run build
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !BuildImageStep
name: build docker image
dockerfile: ./docker/Dockerfile
output: !RegistryOutput
tags: hrms-git.bangkok.go.th/bma-hrms/hrms-api-checkin:@build_version@ hrms-git.bangkok.go.th/bma-hrms/hrms-api-checkin:latest
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
triggers:
- !TagCreateTrigger
tags: prod-*
branches: main
retryCondition: never
maxRetries: 3
retryDelay: 30
timeout: 14400

View file

@ -138,12 +138,6 @@ namespace BMA.EHR.Application.Repositories.Commands
join p in _dbContext.Set<PlacementProfile>()
.Include(x => x.PlacementEducations)
.Include(x => x.Placement)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.Organization)
.Include(x => x.PositionPath)
.Include(x => x.PositionLevel)
.Include(x => x.PositionNumber)
.Include(x => x.PositionType)
on r.RefPlacementProfileId equals p.Id
orderby r.Sequence
select new CommandType01Response
@ -196,12 +190,6 @@ namespace BMA.EHR.Application.Repositories.Commands
join p in _dbContext.Set<PlacementProfile>()
.Include(x => x.PlacementEducations)
.Include(x => x.Placement)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.Organization)
.Include(x => x.PositionPath)
.Include(x => x.PositionLevel)
.Include(x => x.PositionNumber)
.Include(x => x.PositionType)
on r.RefPlacementProfileId equals p.Id
orderby r.Sequence
select new CommandType03Response
@ -267,12 +255,6 @@ namespace BMA.EHR.Application.Repositories.Commands
join p in _dbContext.Set<PlacementProfile>()
.Include(x => x.PlacementEducations)
.Include(x => x.Placement)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.Organization)
.Include(x => x.PositionPath)
.Include(x => x.PositionLevel)
.Include(x => x.PositionNumber)
.Include(x => x.PositionType)
on r.RefPlacementProfileId equals p.Id
orderby r.Sequence
select new CommandType03Response
@ -333,12 +315,6 @@ namespace BMA.EHR.Application.Repositories.Commands
join p in _dbContext.Set<PlacementProfile>()
.Include(x => x.PlacementEducations)
.Include(x => x.Placement)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.Organization)
.Include(x => x.PositionPath)
.Include(x => x.PositionLevel)
.Include(x => x.PositionNumber)
.Include(x => x.PositionType)
on r.RefPlacementProfileId equals p.Id
orderby r.Sequence
select new CommandType03Response

View file

@ -2981,37 +2981,8 @@ namespace BMA.EHR.Application.Repositories.Commands
var placementProfile = await _dbContext.Set<PlacementProfile>()
.Include(x => x.PlacementProfileDocs)
.ThenInclude(x => x.Document)
.Include(x => x.PositionPath)
.Include(x => x.PositionPathSide)
.Include(x => x.PositionType)
.Include(x => x.PositionLine)
.Include(x => x.PositionLevel)
.Include(x => x.PositionNumber)
.Include(x => x.PlacementCertificates)
.Include(x => x.PlacementEducations)
.ThenInclude(x => x.EducationLevel)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.Organization)
.ThenInclude(x => x.OrganizationShortName)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.PositionMaster)
.ThenInclude(x => x.PositionExecutive)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.PositionMaster)
.ThenInclude(x => x.PositionExecutiveSide)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.PositionMaster)
.ThenInclude(x => x.PositionLine)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.Organization)
.ThenInclude(x => x.OrganizationOrganization)
.FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
if (placementProfile == null)
@ -3093,7 +3064,7 @@ namespace BMA.EHR.Application.Repositories.Commands
other = edu.Other == null ? string.Empty : edu.Other,
startDate = edu.StartDate == null ? (DateTime?)null : edu.StartDate,
endDate = edu.EndDate == null ? (DateTime?)null : edu.EndDate,
educationLevel = edu.EducationLevel == null ? string.Empty : edu.EducationLevel.Name,
educationLevel = edu.EducationLevelName,
educationLevelId = string.Empty,
positionPath = edu.PositionPath == null ? null : edu.PositionPath,
positionPathId = string.Empty,
@ -10162,13 +10133,12 @@ namespace BMA.EHR.Application.Repositories.Commands
var data = await (from r in _dbContext.Set<CommandReceiver>()
.Include(x => x.Command)
join pf in _dbContext.Set<PlacementProfile>()
.Include(x => x.PositionPath)
on r.RefPlacementProfileId equals pf.Id
where r.Command.Id == id
select new
{
r.RefPlacementProfileId,
Position = pf.PositionPath!.Name
Position = pf.positionName
}).ToListAsync();
if (data.Count > 0)
@ -10678,27 +10648,6 @@ namespace BMA.EHR.Application.Repositories.Commands
}
}
public async Task<List<PositionPath>> GetPlacementPositionPath(Guid id)
{
try
{
var data = await _dbContext.Set<PlacementProfile>()
.Include(x => x.PositionPath)
.Include(x => x.Placement)
.Where(x => x.Placement!.Id == id)
.Where(x => x.PositionPath != null)
.Select(x => x.PositionPath)
.Distinct()
.ToListAsync();
return data!;
}
catch
{
throw;
}
}
#endregion
#region " Command Info "

View file

@ -3,6 +3,7 @@ using BMA.EHR.Application.Common.Interfaces;
using BMA.EHR.Application.Repositories.MessageQueue;
using BMA.EHR.Application.Responses;
using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Models.Commands.Core;
using BMA.EHR.Domain.Models.HR;
using BMA.EHR.Domain.Models.Insignias;
using BMA.EHR.Domain.Models.MetaData;
@ -14,7 +15,9 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Metadata;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Net;
using System.Net.Http.Headers;
namespace BMA.EHR.Application.Repositories.Reports
{
@ -743,31 +746,81 @@ namespace BMA.EHR.Application.Repositories.Reports
}
//44-บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ
public async Task<dynamic> GetSummaryCoinReport(Guid id)
public async Task<dynamic> GetSummaryCoinReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
{
var period = await _dbContext.Set<InsigniaPeriod>()
.FirstOrDefaultAsync(x => x.Id == id);
if (period == null)
throw new Exception(GlobalMessages.InsigniaPeriodNotFound);
var data_insignia = await _dbContext.Set<InsigniaRequestProfile>()
//.Include(x => x.Profile)
.Where(x => x.Request.Period.Id == period.Id)
.Where(x => x.IsApprove == true)
.Where(x => x.Status == "PENDING")
.Where(x => x.RequestInsignia.InsigniaType != null)
.Where(x => x.RequestInsignia.InsigniaType.Name == "เหรียญบำเหน็จในราชการ")
.Select(x => new
{
//Gendor = x.Profile.Gender == null ? null : x.Profile.Gender.Name,
Gendor = x.Gender, //_userProfileRepository.GetOfficerProfileById(x.ProfileId, AccessToken).Gender ?? "",
RequestInsigniaName = x.RequestInsignia.Name,
InsigniaInitial = $"{x.RequestInsignia.Name}({x.RequestInsignia.ShortName})",
OcId = x.Request.OrganizationId
})
.ToListAsync();
/* var data_insignia = await _dbContext.Set<InsigniaRequestProfile>()
//.Include(x => x.Profile)
.Where(x => x.Request.Period.Id == period.Id)
.Where(x => x.IsApprove == true)
.Where(x => x.Status == "PENDING")
.Where(x => x.RequestInsignia.InsigniaType != null)
.Where(x => x.RequestInsignia.InsigniaType.Name == "เหรียญบำเหน็จในราชการ")
.Select(x => new
{
//Gendor = x.Profile.Gender == null ? null : x.Profile.Gender.Name,
Gendor = x.Gender, //_userProfileRepository.GetOfficerProfileById(x.ProfileId, AccessToken).Gender ?? "",
RequestInsigniaName = x.RequestInsignia.Name,
InsigniaInitial = $"{x.RequestInsignia.Name}({x.RequestInsignia.ShortName})",
OcId = x.Request.OrganizationId
})
.ToListAsync();*/
var data_insigniaQuery = _dbContext.Set<InsigniaRequestProfile>()
.Where(x => x.Request.Period.Id == period.Id)
.Where(x => x.IsApprove == true)
.Where(x => x.Status == "PENDING")
.Where(x => x.RequestInsignia.InsigniaType != null)
.Where(x => x.RequestInsignia.InsigniaType.Name == "เหรียญบำเหน็จในราชการ");
var insignia = (from r in data_insignia
if (type == "officer")
{
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType == "officer");
}
else if (type == "employee")
{
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType == "employee");
}
switch (node)
{
case 0:
data_insigniaQuery = data_insigniaQuery.Where(r => r.RootId == nodeId);
break;
case 1:
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child1Id == nodeId);
break;
case 2:
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child2Id == nodeId);
break;
case 3:
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child3Id == nodeId);
break;
case 4:
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child4Id == nodeId);
break;
default:
break;
}
var data = await data_insigniaQuery
.Select(x => new
{
Gendor = x.Gender, // Gender as is, directly from x.Gender
RequestInsigniaName = x.RequestInsignia.Name, // Name of the Insignia
InsigniaInitial = $"{x.RequestInsignia.Name}({x.RequestInsignia.ShortName})", // Insignia's full name and short name
OcId = x.Request.OrganizationId // Organization ID
})
.ToListAsync();
var insignia = (from r in data
group r by new { OcId = r.OcId, InsigniaInitial = r.InsigniaInitial } into g
select new
{
@ -832,7 +885,7 @@ namespace BMA.EHR.Application.Repositories.Reports
}
//45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา
public async Task<dynamic> GetCoinReport(Guid id)
public async Task<dynamic> GetCoinReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
{
var period = await _dbContext.Set<InsigniaPeriod>()
.FirstOrDefaultAsync(x => x.Id == id);
@ -856,45 +909,89 @@ namespace BMA.EHR.Application.Repositories.Reports
&& r.Status == "PENDING"
&& r.RequestInsignia.InsigniaType != null
&& r.RequestInsignia.InsigniaType.Name != "เหรียญบำเหน็จในราชการ"
select new
select new
{
Male = r.Gender == "ชาย" ? 1 : 0,
Female = r.Gender == "หญิง" ? 1 : 0,
})
.Distinct()
.ToList();
var data = (from r in await _dbContext.Set<InsigniaRequestProfile>()
//.Include(x => x.Profile)
//.ThenInclude(x => x.Gender)
//.Include(x => x.Profile)
//.ThenInclude(x => x.Prefix)
.Include(x => x.Request)
.ThenInclude(x => x.Period)
.Include(x => x.Request)
//.ThenInclude(x => x.Organization)
.Include(x => x.RequestInsignia)
.ThenInclude(x => x.InsigniaType)
.ToListAsync()
where r.Request.Period == period
&& r.IsApprove == true
&& r.Status == "PENDING"
&& r.RequestInsignia.InsigniaType != null
&& r.RequestInsignia.InsigniaType.Name != "เหรียญบำเหน็จในราชการ"
select new
{
InsigniaInitial = r.RequestInsignia.ShortName,
InsigniaName = r.RequestInsignia.Name,
ProfileId = r.ProfileId,
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
// $"{r.Profile.Prefix?.Name}{r.Profile.FirstName} {r.Profile.LastName}",
Gender = r.Gender,
Male = gender.Sum(x => x.Male),
Female = gender.Sum(x => x.Female),
InsigniaId = r.RequestInsignia.Id,
OCName = _userProfileRepository.GetOc(r.Request.OrganizationId, 0, AccessToken).Root, //_organizationCommonRepository.GetOrganizationNameFullPath(g.Key.OcId, false, false),
})
.Distinct()
.ToList();
var dataQuery = _dbContext.Set<InsigniaRequestProfile>()
.Include(x => x.Request)
.ThenInclude(x => x.Period)
.Include(x => x.Request)
/*.ThenInclude(x => x.Organization)*/
.Include(x => x.RequestInsignia)
.ThenInclude(x => x.InsigniaType)
.Where(r => r.Request.Period == period
&& r.IsApprove == true
&& r.Status == "PENDING"
&& r.RequestInsignia.InsigniaType != null
&& r.RequestInsignia.InsigniaType.Name != "เหรียญบำเหน็จในราชการ");
if (type == "officer")
{
dataQuery = dataQuery.Where(r => r.ProfileType == "officer");
}
else if (type == "employee")
{
dataQuery = dataQuery.Where(r => r.ProfileType == "employee");
}
switch (node)
{
case 0:
dataQuery = dataQuery.Where(r => r.RootId == nodeId);
break;
case 1:
dataQuery = dataQuery.Where(r => r.Child1Id == nodeId);
break;
case 2:
dataQuery = dataQuery.Where(r => r.Child2Id == nodeId);
break;
case 3:
dataQuery = dataQuery.Where(r => r.Child3Id == nodeId);
break;
case 4:
dataQuery = dataQuery.Where(r => r.Child4Id == nodeId);
break;
default:
break;
}
// Grouping by ProfileId and InsigniaId, and calculating the sum for Male and Female
var data = await dataQuery
.GroupBy(r => new
{
r.RequestInsignia.ShortName,
r.RequestInsignia.Name,
r.ProfileId,
r.Prefix,
r.FirstName,
r.LastName,
r.Gender,
r.RequestInsignia.Id,
r.Request.OrganizationId
})
.Select(group => new
{
InsigniaInitial = group.Key.ShortName,
InsigniaName = group.Key.Name,
ProfileId = group.Key.ProfileId,
FullName = $"{group.Key.Prefix}{group.Key.FirstName} {group.Key.LastName}",
Gender = group.Key.Gender,
Male = group.Count(r => r.Gender == "Male"), // Count male entries
Female = group.Count(r => r.Gender == "Female"), // Count female entries
InsigniaId = group.Key.Id,
OCName = _userProfileRepository.GetOc(group.Key.OrganizationId, 0, AccessToken).Root
})
.Distinct()
.ToListAsync();
// loop to add temp row with 50 rows per page
var insigniaList = data.Select(x => new { InsigniaId = x.InsigniaId, InsigniaInitial = x.InsigniaInitial, InsigniaName = x.InsigniaName })
@ -959,6 +1056,115 @@ namespace BMA.EHR.Application.Repositories.Reports
return s_data;
}
//47-บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี
public async Task<dynamic> GetEvaluationResultReport(Guid id, string type = null, int node = -1, Guid nodeId = default)
{
var period = await _dbContext.Set<InsigniaPeriod>()
.FirstOrDefaultAsync(x => x.Id == id);
if (period == null)
throw new Exception(GlobalMessages.InsigniaPeriodNotFound);
var data_insigniaQuery = _dbContext.Set<InsigniaRequestProfile>()
.Where(x => x.Request.Period.Id == period.Id)
.Where(x => x.IsApprove == true)
.Where(x => x.Status == "PENDING")
.Where(x => x.RequestInsignia.InsigniaType != null);
/*.Where(x => x.RequestInsignia.InsigniaType.Name == "เหรียญบำเหน็จในราชการ");*/
if (type == "officer")
{
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType == "officer");
}
else if (type == "employee")
{
data_insigniaQuery = data_insigniaQuery.Where(r => r.ProfileType == "employee");
}
switch (node)
{
case 0:
data_insigniaQuery = data_insigniaQuery.Where(r => r.RootId == nodeId);
break;
case 1:
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child1Id == nodeId);
break;
case 2:
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child2Id == nodeId);
break;
case 3:
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child3Id == nodeId);
break;
case 4:
data_insigniaQuery = data_insigniaQuery.Where(r => r.Child4Id == nodeId);
break;
default:
break;
}
var data = await data_insigniaQuery
.Select(x => new
{
FullName = $"{x.Prefix}{x.FirstName} {x.LastName}",
RequestInsigniaName = x.RequestInsignia.Name, // Name of the Insignia
})
.ToListAsync();
/* var seq = 1;
foreach (var d in response!.result)
{
var _baseAPI = _configuration["API"];
var _apiUrl = $"{_baseAPI}/org/profile/profileid/position/{d.person.id}";
using (var _client = new HttpClient())
{
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
_client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Get, _apiUrl);
var _res = await _client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
if (org == null || org.result == null)
continue;
var receiver = new CommandReceiver
{
Sequence = seq,
CitizenId = org.result.citizenId == null ? "" : org.result.citizenId,
Prefix = org.result.prefix == null ? "" : org.result.prefix,
FirstName = org.result.firstName == null ? "" : org.result.firstName,
LastName = org.result.lastName == null ? "" : org.result.lastName,
RefPlacementProfileId = org.result.profileId == null ? null : Guid.Parse(org.result.profileId),
};
seq++;
resultData.Add(receiver);
}
}*/
var insignia = data.Select((r, index) => new
{
RowNo = (index + 1).ToNumericText().ToThaiNumber(),
FullName = r.FullName,
RequestInsigniaName = r.RequestInsigniaName,
ResultY1APR = "-",
ResultY1OCT = "-",
ResultY2APR = "-",
ResultY2OCT = "-",
ResultY3APR = "-",
ResultY3OCT = "-",
ResultY4APR = "-",
ResultY4OCT = "-",
ResultY5APR = "-",
ResultY5OCT = "-",
Remark = "",
}).ToList();
return insignia;
}
//noti ยื่นเสนอคน
public async Task NotifyInsignia()
{
@ -1109,13 +1315,10 @@ namespace BMA.EHR.Application.Repositories.Reports
{
if (insigniaPeriod.StartDate >= DateTime.Now.Date || insigniaPeriod.InsigniaRequests.Count > 0)
continue;
//var organizationType = await _dbContext.Set<OrganizationType>().Where(x => x.Name == "หน่วยงาน").FirstOrDefaultAsync();
//if (organizationType == null)
// continue;
//var organizations = await _dbContext.Set<OrganizationEntity>().Where(x => x.OrganizationType == organizationType).ToListAsync();
var organizations = await _userProfileRepository.GetActiveRootLatestAsync(AccessToken);
if (organizations == null)
continue;
insigniaPeriod.RevisionId = Guid.Parse(organizations[0].OrgRevisionId);
foreach (var organization in organizations)
{
if (organization == null)

View file

@ -46,7 +46,7 @@ namespace BMA.EHR.Application.Repositories.Reports
#region 13
public async Task<object> GetProbationAssignAsync(Guid assign_id, string token)
{
var api_url = $"{_configuration["APIPROBATION"]}/assign?assign_id={assign_id}";
var api_url = $"{_configuration["APIPROBATION"]}/assign?assign_id={assign_id}&isReport=true";
ProbationAssignResponse probation_assign;
using (var client = new HttpClient())
{
@ -82,6 +82,15 @@ namespace BMA.EHR.Application.Repositories.Reports
: (Regex.Replace(x.description, "<.*?>", string.Empty)).Replace("&nbsp;", " ").ToString().ToThaiNumber(),
}).ToList();
var competencyGroups = probation_assign.result.competency_groups.Select(x => new
{
name = string.IsNullOrEmpty(x.name) ? string.Empty : x.name.ToThaiNumber(),
level = string.IsNullOrEmpty(x.level) ? string.Empty : x.level.ToThaiNumber(),
description = string.IsNullOrEmpty(x.description)
? string.Empty
: (Regex.Replace(x.description, "<.*?>", string.Empty)).Replace("&nbsp;", " ").ToString().ToThaiNumber(),
}).ToList();
var outputs = probation_assign.result.outputs.Select(x => new
{
id = string.IsNullOrEmpty(x.id.ToString()) ? string.Empty : x.id.ToString().ToThaiNumber(),
@ -89,11 +98,26 @@ namespace BMA.EHR.Application.Repositories.Reports
output_desc = string.IsNullOrEmpty(x.output_desc) ? string.Empty : x.output_desc.ToThaiNumber(),
}).ToList();
var skills = probation_assign.result.skills.Select(x => new
{
name = string.IsNullOrEmpty(x.title) ? string.Empty : x.title.ToThaiNumber(),
level = string.IsNullOrEmpty(x.level) ? string.Empty : x.level.ToThaiNumber(),
description = string.IsNullOrEmpty(x.description)
? string.Empty
: (Regex.Replace(x.description, "<.*?>", string.Empty)).Replace("&nbsp;", " ").ToString().ToThaiNumber(),
}).ToList();
var laws = probation_assign.result.laws.Where(x => x.selected == true).Select((x, Index) => new
{
title = string.IsNullOrEmpty(x.description) ? string.Empty : $"{(Index + 1).ToString().ToThaiNumber()}. {x.description.ToThaiNumber()}",
}).ToList();
return new
{
Name = string.IsNullOrEmpty(probation_assign.result.profile.name) ? "-" : probation_assign.result.profile.name,
Position = string.IsNullOrEmpty(probation_assign.result.profile.Position) ? "-" : probation_assign.result.profile.Position,
PositionLevel = string.IsNullOrEmpty(probation_assign.result.profile.positionLevelName) ? "-" : probation_assign.result.profile.positionLevelName,
PositionAndLevel = string.IsNullOrEmpty(probation_assign.result.profile.PositionAndLevel) ? "-" : probation_assign.result.profile.PositionAndLevel,
Department = string.IsNullOrEmpty(probation_assign.result.profile.Department) ? "-" : probation_assign.result.profile.Department,
OrganizationOrganization = string.IsNullOrEmpty(probation_assign.result.profile.OrganizationOrganization) ? "-" : probation_assign.result.profile.OrganizationOrganization,
Oc = string.IsNullOrEmpty(probation_assign.result.profile.Oc) ? "-" : probation_assign.result.profile.Oc,
@ -111,7 +135,10 @@ namespace BMA.EHR.Application.Repositories.Reports
Jobs = jobs,
Knowledges = knowledges,
Competencys = competencys,
CompetencyGroups = competencyGroups,
Outputs = outputs,
Skills = skills,
Laws = laws,
OtherDesc = string.IsNullOrEmpty(probation_assign.result.assign.other_desc) ? "-" : probation_assign.result.assign.other_desc,
Other4Desc = string.IsNullOrEmpty(probation_assign.result.assign.other4_desc) ? "-" : probation_assign.result.assign.other4_desc,
Other5No1Desc = string.IsNullOrEmpty(probation_assign.result.assign.other5_no1_desc) ? "-" : probation_assign.result.assign.other5_no1_desc,
@ -147,26 +174,8 @@ namespace BMA.EHR.Application.Repositories.Reports
var training_seminar = evaluate_record.result.evaluate.training_seminar == "1" ? "🗹 ดำเนินการแล้ว ☐ ยังไม่ได้ดำเนินการ" : "☐ ดำเนินการแล้ว 🗹 ยังไม่ได้ดำเนินการ";
var other_training = evaluate_record.result.evaluate.other_training == "1" ? "🗹 ดำเนินการแล้ว ☐ ยังไม่ได้ดำเนินการ" : "☐ ดำเนินการแล้ว 🗹 ยังไม่ได้ดำเนินการ";
var expects = evaluate_record.result.evaluate != null && evaluate_record.result.evaluate.achievements.Count > 0
? new
{
col1 = evaluate_record.result.evaluate.achievements[0].evaluate_expect_level.col1 == "/" ? "✓" : string.Empty,
col2 = evaluate_record.result.evaluate.achievements[0].evaluate_expect_level.col2 == "/" ? "✓" : string.Empty,
col3 = evaluate_record.result.evaluate.achievements[0].evaluate_expect_level.col3 == "/" ? "✓" : string.Empty,
col4 = evaluate_record.result.evaluate.achievements[0].evaluate_expect_level.col4 == "/" ? "✓" : string.Empty,
col5 = evaluate_record.result.evaluate.achievements[0].evaluate_expect_level.col5 == "/" ? "✓" : string.Empty,
}
: null;
var outputs = evaluate_record.result.evaluate != null && evaluate_record.result.evaluate.achievements.Count > 0
? new
{
col1 = evaluate_record.result.evaluate.achievements[0].evaluate_output_level.col1 == "/" ? "✓" : string.Empty,
col2 = evaluate_record.result.evaluate.achievements[0].evaluate_output_level.col2 == "/" ? "✓" : string.Empty,
col3 = evaluate_record.result.evaluate.achievements[0].evaluate_output_level.col3 == "/" ? "✓" : string.Empty,
col4 = evaluate_record.result.evaluate.achievements[0].evaluate_output_level.col4 == "/" ? "✓" : string.Empty,
col5 = evaluate_record.result.evaluate.achievements[0].evaluate_output_level.col5 == "/" ? "✓" : string.Empty,
}
: null;
var expects = evaluate_record?.result?.evaluate?.achievements?.evaluate_expect_level ?? null;
var outputs = evaluate_record?.result?.evaluate?.achievements?.evaluate_output_level ?? null;
var knows = evaluate_record.result.evaluate != null
? new
{
@ -365,6 +374,7 @@ namespace BMA.EHR.Application.Repositories.Reports
DirectorDated = string.IsNullOrEmpty(evaluate_record.result.evaluate.sign_dated.ToString()) ? "-" : evaluate_record.result.evaluate.sign_dated.ToThaiFullDate().ToString().ToThaiNumber(),
Name = string.IsNullOrEmpty(evaluate_record.result.experimentee.name) ? string.Empty : evaluate_record.result.experimentee.name,
Position = string.IsNullOrEmpty(evaluate_record.result.experimentee.Position) ? string.Empty : evaluate_record.result.experimentee.Position,
PositionLevel = string.IsNullOrEmpty(evaluate_record.result.experimentee.PositionLevelName) ? "-" : evaluate_record.result.experimentee.PositionLevelName,
Department = string.IsNullOrEmpty(evaluate_record.result.experimentee.Department) ? string.Empty : evaluate_record.result.experimentee.Department,
Organization = string.IsNullOrEmpty(evaluate_record.result.experimentee.OrganizationOrganization) ? string.Empty : evaluate_record.result.experimentee.OrganizationOrganization,
Oc = string.IsNullOrEmpty(evaluate_record.result.experimentee.Oc) ? string.Empty : evaluate_record.result.experimentee.Oc,
@ -375,13 +385,7 @@ namespace BMA.EHR.Application.Repositories.Reports
EvaluateDateFinish = string.IsNullOrEmpty(evaluate_record.result.evaluate.date_finish.ToString()) ? string.Empty : evaluate_record.result.evaluate.date_finish.ToThaiFullDate().ToString().ToThaiNumber(),
Role = evaluate_record.result.evaluate.role == "mentor" ? "ผู้ดูแลการทดลองปฏิบัติหน้าที่ราชการ" : "ผู้บังคับบัญชา",
Expects = expects,
ExpectDesc = evaluate_record.result.evaluate != null && evaluate_record.result.evaluate.achievements.Count > 0
? evaluate_record.result.evaluate.achievements[0].evaluate_expect_desc
: string.Empty,
Outputs = outputs,
OutputDesc = evaluate_record.result.evaluate != null && evaluate_record.result.evaluate.achievements.Count > 0
? evaluate_record.result.evaluate.achievements[0].evaluate_output_desc
: string.Empty,
AchievementOtherDesc = evaluate_record.result.evaluate.achievement_other_desc,
AchievementStrengthDesc = evaluate_record.result.evaluate.achievement_strength_desc,
AchievementImproveDesc = evaluate_record.result.evaluate.achievement_improve_desc,
@ -592,6 +596,7 @@ namespace BMA.EHR.Application.Repositories.Reports
EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.result.evaluate.date_finish.ToString()) ? "-" : evaluate_assign.result.evaluate.date_finish.ToThaiFullDate().ToString().ToThaiNumber(),
Name = string.IsNullOrEmpty(evaluate_assign.result.experimentee.name) ? string.Empty : evaluate_assign.result.experimentee.name,
Position = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Position) ? string.Empty : evaluate_assign.result.experimentee.Position,
PositionLevel = string.IsNullOrEmpty(evaluate_assign.result.experimentee.PositionLevelName) ? "-" : evaluate_assign.result.experimentee.PositionLevelName,
Department = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Department) ? string.Empty : evaluate_assign.result.experimentee.Department,
Organization = string.IsNullOrEmpty(evaluate_assign.result.experimentee.OrganizationOrganization) ? string.Empty : evaluate_assign.result.experimentee.OrganizationOrganization,
Oc = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Oc) ? string.Empty : evaluate_assign.result.experimentee.Oc,
@ -822,6 +827,7 @@ namespace BMA.EHR.Application.Repositories.Reports
EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.result.evaluate.date_finish.ToString()) ? "-" : evaluate_assign.result.evaluate.date_finish.ToThaiFullDate().ToString().ToThaiNumber(),
Name = string.IsNullOrEmpty(evaluate_assign.result.experimentee.name) ? string.Empty : evaluate_assign.result.experimentee.name,
Position = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Position) ? string.Empty : evaluate_assign.result.experimentee.Position,
PositionLevel = string.IsNullOrEmpty(evaluate_assign.result.experimentee.PositionLevelName) ? "-" : evaluate_assign.result.experimentee.PositionLevelName,
Department = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Department) ? string.Empty : evaluate_assign.result.experimentee.Department,
Organization = string.IsNullOrEmpty(evaluate_assign.result.experimentee.OrganizationOrganization) ? string.Empty : evaluate_assign.result.experimentee.OrganizationOrganization,
Oc = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Oc) ? string.Empty : evaluate_assign.result.experimentee.Oc,
@ -881,9 +887,9 @@ namespace BMA.EHR.Application.Repositories.Reports
#endregion
#region 18 ( )
public async Task<object> GetEvaluateResultAssignAsync(Guid id, string token)
public async Task<object> GetEvaluateResultAssignAsync(Guid id, int no, string token)
{
var api_url = $"{_configuration["APIPROBATION"]}/evaluate-result?assign_id={id}";
var api_url = $"{_configuration["APIPROBATION"]}/evaluate-result?assign_id={id}&evaluate_no={no}";
EvaluateResultAssignResponse evaluate_assign;
using (var client = new HttpClient())
{
@ -933,6 +939,7 @@ namespace BMA.EHR.Application.Repositories.Reports
EvaluateDateStart = string.IsNullOrEmpty(evaluate_assign.result.evaluate.date_start.ToString()) ? "-" : evaluate_assign.result.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(),
EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.result.evaluate.date_start.ToString()) ? "-" : evaluate_assign.result.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(),
Position = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Position) ? string.Empty : evaluate_assign.result.experimentee.Position,
PositionLevel = string.IsNullOrEmpty(evaluate_assign.result.experimentee.PositionLevelName) ? "-" : evaluate_assign.result.experimentee.PositionLevelName,
Department = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Department) ? string.Empty : evaluate_assign.result.experimentee.Department,
Organization = string.IsNullOrEmpty(evaluate_assign.result.experimentee.OrganizationOrganization) ? string.Empty : evaluate_assign.result.experimentee.OrganizationOrganization,
Oc = string.IsNullOrEmpty(evaluate_assign.result.experimentee.Oc) ? string.Empty : evaluate_assign.result.experimentee.Oc,
@ -945,7 +952,7 @@ namespace BMA.EHR.Application.Repositories.Reports
CommanderPosition = string.IsNullOrEmpty(evaluate_assign.result.commander.Position) ? string.Empty : evaluate_assign.result.commander.Position,
CommanderDate = string.IsNullOrEmpty(evaluate_assign.result.evaluate.director1_dated.ToString()) ? "-" : evaluate_assign.result.evaluate.director1_dated.ToThaiFullDate().ToString().ToThaiNumber(),
Name = evaluate_assign.result.experimentee.name,
RoundNo = evaluate_assign.result.assign.round_no.ToString().ToThaiNumber(),
RoundNo = no.ToString().ToThaiNumber(),
DateStart = evaluate_assign.result.assign.date_start != string.Empty ? dateStart_ : "-",
DateFinish = evaluate_assign.result.assign.date_finish != string.Empty ? dateFinish_ : "-",
Develop1 = developComplete1,

View file

@ -26,6 +26,8 @@ namespace BMA.EHR.Application.Responses
public string Position { get; set; } = string.Empty;
public string Department { get; set; } = string.Empty;
public string Oc { get; set; } = string.Empty;
public string PositionLevelName { get; set; } = string.Empty;
}
public class Commander

View file

@ -26,6 +26,7 @@ namespace BMA.EHR.Application.Responses
public string PositionLineId { get; set; } = string.Empty;
public string OrganizationOrganization { get; set; } = string.Empty;
public string Position { get; set; } = string.Empty;
public string PositionLevelName { get; set; } = string.Empty;
public string Department { get; set; } = string.Empty;
public string Oc { get; set; } = string.Empty;
}

View file

@ -26,6 +26,7 @@ namespace BMA.EHR.Application.Responses
public string Department { get; set; }
public string OrganizationOrganization { get; set; }
public string Oc { get; set; }
public string PositionLevelName { get; set; }
}
public class Director
@ -89,19 +90,20 @@ namespace BMA.EHR.Application.Responses
public string role { get; set; }
public DateTime createdAt { get; set; }
public DateTime updatedAt { get; set; }
public List<Achievement> achievements { get; set; }
public Achievement achievements { get; set; }
}
public class Achievement
{
public string evaluate_expect_desc { get; set; }
public EvaluateExpectLevel evaluate_expect_level { get; set; }
public string evaluate_output_desc { get; set; }
public EvaluateOutputLevel evaluate_output_level { get; set; }
// public string evaluate_expect_desc { get; set; }
public List<EvaluateExpectLevel> evaluate_expect_level { get; set; }
// public string evaluate_output_desc { get; set; }
public List<EvaluateOutputLevel> evaluate_output_level { get; set; }
}
public class EvaluateExpectLevel
{
public string? title { get; set; }
public string col1 { get; set; }
public string col2 { get; set; }
public string col3 { get; set; }
@ -111,6 +113,7 @@ namespace BMA.EHR.Application.Responses
public class EvaluateOutputLevel
{
public string? title { get; set; }
public string col1 { get; set; }
public string col2 { get; set; }
public string col3 { get; set; }

View file

@ -64,6 +64,7 @@ namespace BMA.EHR.Application.Responses
public string PositionLevelId { get; set; }
public string PositionLineId { get; set; }
public string Position { get; set; }
public string PositionLevelName { get; set; }
public string Department { get; set; }
public string OrganizationOrganization { get; set; }
public string Oc { get; set; }

View file

@ -9,7 +9,7 @@
public Guid LastUpdateUserId { get; set; }
public string CreatedFullName { get; set; } = string.Empty;
public string LastUpdateFullName { get; set; } = string.Empty;
public string OrgRootName { get; set; } = string.Empty;
public string OrgRevisionId { get; set; } = string.Empty;
}
}

View file

@ -14,7 +14,10 @@
public List<Job> jobs { get; set; }
public List<Knowledge> knowledges { get; set; }
public List<Competency> competencys { get; set; }
public List<Competency> competency_groups { get; set; }
public List<Output> outputs { get; set; }
public List<Law> laws { get; set; }
public List<Skill> skills { get; set; }
}
public class Profile
@ -28,6 +31,8 @@
public string Position { get; set; } = string.Empty;
public string Department { get; set; } = string.Empty;
public string Oc { get; set; } = string.Empty;
public string positionLevelName { get; set; } = string.Empty;
public string PositionAndLevel { get; set; } = string.Empty;
}
public class Assign
@ -72,6 +77,21 @@
public string description { get; set; } = string.Empty;
}
public class Skill
{
public int id { get; set; }
public string level { get; set; } = string.Empty;
public string title { get; set; } = string.Empty;
public string description { get; set; } = string.Empty;
}
public class Law
{
public int id { get; set; }
public string description { get; set; } = string.Empty;
public bool selected { get; set; }
}
public class Competency
{
public string id { get; set; } = string.Empty;

View file

@ -9,10 +9,12 @@ namespace BMA.EHR.Application.Responses.Profiles
public string? Prefix { get; set; }
public string? FirstName { get; set; }
public string? LastName { get; set; }
public string? CitizenId { get; set; }
public Guid? Keycloak { get; set; }
public string? PosNo { get; set; }
public string? Position { get; set; }
public string? PositionLevel { get; set; }
public string? PositionType { get; set; }
public string? Oc { get; set; }
}
}

View file

@ -42,6 +42,8 @@ RUN dotnet restore
# คัดลอกไฟล์ทั้งหมดและ build
COPY . ./
RUN dotnet build -c Release -o /app/build
# WORKDIR "/src/BMA.EHR.CheckInConsumer"
# RUN dotnet build "BMA.EHR.CheckInConsumer.csproj" -c Release -o /app/build
# ใช้ stage ใหม่สำหรับการ runtime
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS runtime
@ -53,4 +55,4 @@ WORKDIR /app
COPY --from=build /app/build .
# ระบุ entry point ของแอปพลิเคชัน
ENTRYPOINT ["dotnet", "BMA.EHR.CheckInConsumer.dll"]
ENTRYPOINT ["dotnet", "BMA.EHR.CheckInConsumer.dll"]

View file

@ -259,6 +259,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
Oc = x.Oc,
Position = x.Position,
LastUpdatedAt = x.LastUpdatedAt,
profileType = x.profileType,
HistoryStatus = x.DisciplineComplaint_Appeal_Historys.Select(p => new
{
Status = p.Status,
@ -298,6 +299,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
_data.Oc,
_data.Position,
_data.LastUpdatedAt,
_data.profileType,
_data.HistoryStatus,
disciplineComplaint_Appeal_Docs,
};
@ -346,6 +348,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
ProfileId = id,
Position = req.Position,
Oc = req.Oc,
profileType = org.result.profileType,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
@ -432,6 +435,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
ProfileId = req.ProfileId,
Position = req.Position,
Oc = req.Oc,
profileType = req.profileType,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
CreatedAt = DateTime.Now,
@ -631,8 +635,10 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
CitizenId = x.CitizenId,
ProfileId = x.ProfileId,
LastUpdatedAt = x.LastUpdatedAt,
profileType = x.profileType
})
.OrderByDescending(x => x.LastUpdatedAt)
.OrderByDescending(x => x.profileType)
.ThenByDescending(x => x.LastUpdatedAt)
.Skip((page - 1) * pageSize)
.Take(pageSize)
.ToList();

View file

@ -1,9 +1,12 @@
using BMA.EHR.Application.Repositories;
using BMA.EHR.Application.Repositories.MessageQueue;
using BMA.EHR.Application.Responses;
using BMA.EHR.Application.Responses.Profiles;
using BMA.EHR.Discipline.Service.Requests;
using BMA.EHR.Domain.Common;
using BMA.EHR.Domain.Models.Discipline;
using BMA.EHR.Domain.Shared;
using BMA.EHR.Domain.Extensions;
using BMA.EHR.Infrastructure.Persistence;
// using BMA.EHR.Placement.Service.Requests;
using Microsoft.AspNetCore.Authorization;
@ -28,17 +31,20 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
private readonly MinIODisciplineService _documentService;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly PermissionRepository _permission;
private readonly UserProfileRepository _userProfileRepository;
public DisciplineReportController(DisciplineDbContext context,
MinIODisciplineService documentService,
IHttpContextAccessor httpContextAccessor,
PermissionRepository permission)
PermissionRepository permission,
UserProfileRepository userProfileRepository)
{
// _repository = repository;
_context = context;
_documentService = documentService;
_httpContextAccessor = httpContextAccessor;
_permission = permission;
_userProfileRepository = userProfileRepository;
}
#region " Properties "
@ -46,6 +52,8 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
private string? AccessToken => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
#endregion
@ -60,39 +68,99 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
[HttpPost("{type}")]
public async Task<ActionResult<ResponseObject>> GetReportDiscipline([FromBody] DisciplineReportRequest req, string type)
{
// var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
// .Include(x => x.DisciplineDisciplinary)
// .Where(x => x.Id == d.id)
// .FirstOrDefaultAsync();
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_DISCIPLINE_REPORT");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var profile = new List<GetProfileByKeycloakIdRootDto>();
if (type.Trim().ToUpper() == "OFFICER")
{
profile = await _userProfileRepository.GetProfileWithKeycloakAllOfficer(AccessToken, req.node, req.nodeId, jsonData["result"] == "OWNER" || jsonData["result"] == "CHILD");
}
else
{
profile = await _userProfileRepository.GetProfileWithKeycloakAllEmployee(AccessToken, req.node, req.nodeId, jsonData["result"] == "OWNER" || jsonData["result"] == "CHILD");
}
// var profile = new List<GetProfileByKeycloakIdRootDto>();
// if (type.Trim().ToUpper() == "OFFICER")
// {
// profile = await _userProfileRepository.GetProfileWithKeycloakAllOfficer(AccessToken, req.node, req.nodeId, jsonData["result"] == "OWNER" || jsonData["result"] == "CHILD");
// }
// else
// {
// profile = await _userProfileRepository.GetProfileWithKeycloakAllEmployee(AccessToken, req.node, req.nodeId, jsonData["result"] == "OWNER" || jsonData["result"] == "CHILD");
// }
if (req.posLevel != null || req.posType != null)
{
profile = profile.Where(x => x.PositionType == req.posType || x.PositionLevel == req.posLevel).ToList();
}
var data_search = await _context.DisciplineDisciplinarys
.Include(x => x.DisciplineDisciplinary_ProfileComplaintInvestigates)
.OrderByDescending(x => x.CreatedAt)
.ToListAsync();
if (req.status.Trim().ToUpper() != "ALL")
data_search = data_search.Where(x => x.Status.Contains(req.status.Trim().ToUpper())).ToList();
if (req.offenseDetail.Trim().ToUpper() != "ALL")
data_search = data_search.Where(x => x.OffenseDetails.Contains(req.status.Trim().ToUpper())).ToList();
if (req.disciplinaryFaultLevel.Trim().ToUpper() != "ALL")
data_search = data_search.Where(x => x.DisciplinaryFaultLevel.Contains(req.status.Trim().ToUpper())).ToList();
var mapData = data_search
.SelectMany((d) => d.DisciplineDisciplinary_ProfileComplaintInvestigates.Select((profile) => new
{
fullName = $"{profile.Prefix}{profile.FirstName} {profile.LastName}",
citizenId = profile.CitizenId,
position = profile.Position,
posLevel = profile.posLevelName,
oc = profile.Organization,
CreatedAt = profile.CreatedAt,
offense = d.OffenseDetails != null && d.OffenseDetails != ""
? d.OffenseDetails == "NOT_SPECIFIED"
? "ความผิดวินัยยังไม่ระบุ"
: d.OffenseDetails == "NOT_DEADLY"
? "ความผิดวินัยไม่ร้ายแรง"
: d.OffenseDetails == "DEADLY"
? "ความผิดวินัยร้ายแรง"
: ""
: "",
faultLevel = d.DisciplinaryFaultLevel,
}))
.Where(x =>
x.citizenId != null && profile.Any(p => p.CitizenId == x.citizenId))
.OrderByDescending(x => x.CreatedAt)
.ToList();
var count = 1;
var employees = new List<dynamic>();
foreach (var p in mapData)
{
var emp = new
{
no = count,
fullName = p.fullName,
citizenId = p.citizenId,
position = p.position,
posLevel = p.posLevel,
oc = profile.FirstOrDefault(x => x.CitizenId == p.citizenId)?.Oc ?? "",
offense = p.offense,
faultLevel = p.faultLevel,
one = 0,
two = 0,
three = 0,
};
employees.Add(emp);
count++;
}
var result = new
{
template = "reportDiscipline",
reportName = "reportDiscipline",
reportName = "xlsx-report",
data = new
{
year = req.year + 543,
data = new List<dynamic>()
year = (req.year + 543).ToString().ToThaiNumber(),
dateCurrent = $"ณ วันที่ {DateTime.Now.Date.ToThaiShortDate().ToThaiNumber()}",
data = employees
}
};
return Success(result);
}
}

View file

@ -468,7 +468,8 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
foreach (var data in data1)
{
data2.Add(data);
};
}
;
return Success(data2);
}
@ -820,10 +821,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
level = p.DisciplineDisciplinary.DisciplinaryFaultLevel,
unStigma = "คำสั่งลงโทษ ปลดออกจากราชการ",
amount = r.amount,
amountSpecial = r.amountSpecial,
positionSalaryAmount = r.positionSalaryAmount,
mouthSalaryAmount = r.mouthSalaryAmount,
isGovernment = false,
profileType = p.profileType,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];
@ -918,10 +922,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
level = p.DisciplineDisciplinary.DisciplinaryFaultLevel,
unStigma = "คำสั่งลงโทษ ไล่ออกจากราชการ",
amount = r.amount,
amountSpecial = r.amountSpecial,
positionSalaryAmount = r.positionSalaryAmount,
mouthSalaryAmount = r.mouthSalaryAmount,
isGovernment = false,
profileType = p.profileType,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];
@ -1021,17 +1028,18 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
.ToListAsync();
var report_data = (from p in data
join r in req.refIds
on p.Id.ToString() equals r.refId
select new
{
fullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
positionname = p.Position,
positionno = p.PosNo,
organizationname = p.Organization,
salary = r.Amount,
RemarkHorizontal = r.RemarkHorizontal
}).ToList();
join r in req.refIds
on p.Id.ToString() equals r.refId
select new
{
fullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
positionname = p.Position,
positionno = p.PosNo,
organizationname = p.Organization,
salary = r.Amount,
RemarkVertical = r.RemarkVertical,
RemarkHorizontal = r.RemarkHorizontal,
}).ToList();
var result = new List<dynamic>();
@ -1039,8 +1047,10 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
result.Add(new {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
fullName = _null,
positionname = r.RemarkHorizontal,
positionno = _null,
@ -1091,10 +1101,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
level = p.DisciplineDisciplinary.DisciplinaryFaultLevel,
unStigma = "คำสั่งลงโทษ พักจากราชการ",
amount = r.amount,
amountSpecial = r.amountSpecial,
positionSalaryAmount = r.positionSalaryAmount,
mouthSalaryAmount = r.mouthSalaryAmount,
isGovernment = false,
profileType = p.profileType,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];
@ -1205,10 +1218,13 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
level = p.DisciplineDisciplinary.DisciplinaryFaultLevel,
unStigma = "คำสั่งลงโทษ ให้ออกจากราชการไว้ก่อน",
amount = r.amount,
amountSpecial = r.amountSpecial,
positionSalaryAmount = r.positionSalaryAmount,
mouthSalaryAmount = r.mouthSalaryAmount,
isGovernment = false,
profileType = p.profileType,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];
@ -1318,9 +1334,12 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
level = p.DisciplineDisciplinary.DisciplinaryFaultLevel,
unStigma = "คำสั่งลงโทษ ลงโทษ ภาคทัณฑ์",
amount = r.amount,
amountSpecial = r.amountSpecial,
positionSalaryAmount = r.positionSalaryAmount,
mouthSalaryAmount = r.mouthSalaryAmount,
profileType = p.profileType,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];
@ -1430,9 +1449,12 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
level = p.DisciplineDisciplinary.DisciplinaryFaultLevel,
unStigma = "คำสั่งลงโทษ ตัดเงินเดือน",
amount = r.amount,
amountSpecial = r.amountSpecial,
positionSalaryAmount = r.positionSalaryAmount,
mouthSalaryAmount = r.mouthSalaryAmount,
profileType = p.profileType,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];
@ -1542,9 +1564,12 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
level = p.DisciplineDisciplinary.DisciplinaryFaultLevel,
unStigma = "คำสั่งลงโทษ ลดขั้นเงินเดือน",
amount = r.amount,
amountSpecial = r.amountSpecial,
positionSalaryAmount = r.positionSalaryAmount,
mouthSalaryAmount = r.mouthSalaryAmount,
profileType = p.profileType,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];
@ -1654,9 +1679,12 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
level = p.DisciplineDisciplinary.DisciplinaryFaultLevel,
unStigma = "คำสั่งเพิ่มโทษ",
amount = r.amount,
amountSpecial = r.amountSpecial,
positionSalaryAmount = r.positionSalaryAmount,
mouthSalaryAmount = r.mouthSalaryAmount,
profileType = p.profileType,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];
@ -1766,9 +1794,12 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
level = p.DisciplineDisciplinary.DisciplinaryFaultLevel,
unStigma = "คำสั่งงดโทษ",
amount = r.amount,
amountSpecial = r.amountSpecial,
positionSalaryAmount = r.positionSalaryAmount,
mouthSalaryAmount = r.mouthSalaryAmount,
profileType = p.profileType,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];
@ -1894,9 +1925,12 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
level = "",
unStigma = "คำสั่งยุติเรื่อง",
amount = r.amount,
amountSpecial = r.amountSpecial,
positionSalaryAmount = r.positionSalaryAmount,
mouthSalaryAmount = r.mouthSalaryAmount,
profileType = p.profileType,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave-discipline";

View file

@ -15,6 +15,7 @@ namespace BMA.EHR.Discipline.Service.Requests
public string? Fullname { get; set; }
public string? Position { get; set; }
public string? Oc { get; set; }
public string? profileType { get; set; }
public List<FormFile>? File { get; set; }
}
}

View file

@ -17,8 +17,8 @@ namespace BMA.EHR.Discipline.Service.Requests
public string status { get; set; }
public string posType { get; set; }
public string? posType { get; set; }
public string posLevel { get; set; }
public string? posLevel { get; set; }
}
}

View file

@ -16,7 +16,10 @@ namespace BMA.EHR.Discipline.Service.Requests
public int commandYear { get; set; }
public string? templateDoc { get; set; }
public double? amount { get; set; }
public double? amountSpecial { get; set; }
public double? positionSalaryAmount { get; set; }
public double? mouthSalaryAmount { get; set; }
public string? refCommandCode { get; set; }
public string? refCommandName { get; set; }
}
}

View file

@ -45,6 +45,9 @@ namespace BMA.EHR.Domain.Models.Discipline
[Comment("สังกัดผู้อุทธรณ์/ร้องทุกข์")]
public string? Oc { get; set; }
[Comment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)")]
public string? profileType { get; set; }
public virtual List<DisciplineComplaint_Appeal_Doc> DisciplineComplaint_Appeal_Docs { get; set; } = new List<DisciplineComplaint_Appeal_Doc>();
public virtual List<DisciplineComplaint_Appeal_History> DisciplineComplaint_Appeal_Historys { get; set; } = new List<DisciplineComplaint_Appeal_History>();
}

View file

@ -24,6 +24,9 @@ namespace BMA.EHR.Domain.Models.Placement
[Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
[Comment("Id การสอบ")]
public Guid? RefId { get; set; }
public virtual List<PlacementProfile> PlacementProfiles { get; set; } = new List<PlacementProfile>();
}
}

View file

@ -10,7 +10,9 @@ namespace BMA.EHR.Domain.Models.Placement
[Required, Comment("Id ผู้สมัคร")]
public virtual PlacementProfile? PlacementProfile { get; set; }
[Comment("Idวุฒิที่ได้รับ")]
public virtual EducationLevel? EducationLevel { get; set; }
public Guid? EducationLevelId { get; set; }
[Comment("วุฒิที่ได้รับ")]
public string? EducationLevelName { get; set; }
[MaxLength(1000), Comment("สถานศึกษา")]
public string? Institute { get; set; }
[MaxLength(200), Comment("วุฒิการศึกษา")]

View file

@ -28,10 +28,10 @@ namespace BMA.EHR.Domain.Models.Placement
// [Comment("ลำดับที่สอบได้")]
// public int? Number { get; set; }
[Comment("Id ตำแหน่งที่สอบได้")]
public PositionPath? PositionCandidate { get; set; }
[Comment("Id เลขที่ตำแหน่ง")]
public OrganizationPositionEntity? OrganizationPosition { get; set; }
// [Comment("Id ตำแหน่งที่สอบได้")]
// public PositionPath? PositionCandidate { get; set; }
// [Comment("Id เลขที่ตำแหน่ง")]
// public OrganizationPositionEntity? OrganizationPosition { get; set; }
[Comment("วันที่บรรจุ")]
public DateTime? RecruitDate { get; set; }
[Comment("วันที่รายงานตัว")]
@ -198,21 +198,12 @@ namespace BMA.EHR.Domain.Models.Placement
[MaxLength(20), Comment("โทรศัพท์ บริษัท")]
public string? OccupationTelephone { get; set; }
[Comment("ชื่อตำแหน่งเลขที่")]
public PositionNumberEntity? PositionNumber { get; set; }
[Comment("ชื่อตำแหน่ง")]
public PositionPath? PositionPath { get; set; }
[Comment("Id ด้าน/สาขา")]
public PositionPathSide? PositionPathSide { get; set; }
[Comment("ตำแหน่งสอบ")]
public string? PositionCandidate { get; set; }
[Comment("ประเภทตำแหน่ง")]
public string? PositionType { get; set; }
[Comment("Id สายงาน")]
public PositionLine? PositionLine { get; set; }
[Comment("ระดับ")]
public string? PositionLevel { get; set; }
@ -331,7 +322,6 @@ namespace BMA.EHR.Domain.Models.Placement
[Comment("ประเภทคำสั่ง")]
public string? typeCommand { get; set; }
[Comment("ข้อมูลเก่า")]
public bool? IsOld { get; set; }

View file

@ -82,6 +82,9 @@ namespace BMA.EHR.Domain.Models.Retirement
[Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
[Comment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)")]
public string? profileType { get; set; }
public virtual List<RetirementDeceasedNoti> RetirementDeceasedNotis { get; set; } = new List<RetirementDeceasedNoti>();
}
}

View file

@ -89,5 +89,8 @@ namespace BMA.EHR.Domain.Models.Retirement
[Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
[Comment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)")]
public string? profileType { get; set; }
}
}

View file

@ -18,6 +18,8 @@ namespace BMA.EHR.Domain.Models.Retirement
[Comment("วันที่ขอออกราชการ")]
public DateTime? ActiveDate { get; set; }
[Comment("เหตุผลที่ลาออกจากราชการ")]
public string? ReasonResign { get; set; } = string.Empty;
[Comment("เหตุผลที่ลาออกจากราชการ")]
public string? Reason { get; set; } = string.Empty;
[Comment("เหตุผลที่ลาออกจากราชการ(อื่นๆ)")]
public string? Remark { get; set; } = string.Empty;

View file

@ -18,6 +18,8 @@ namespace BMA.EHR.Domain.Models.Retirement
[Comment("วันที่ขอออกราชการ")]
public DateTime? ActiveDate { get; set; }
[Comment("เหตุผลที่ลาออกจากราชการ")]
public string? ReasonResign { get; set; } = string.Empty;
[Comment("เหตุผลที่ลาออกจากราชการ")]
public string? Reason { get; set; } = string.Empty;
[Comment("เหตุผลที่ลาออกจากราชการ(อื่นๆ)")]
public string? Remark { get; set; } = string.Empty;

View file

@ -0,0 +1,261 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableplacementprofiledeleteposcandidate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_PlacementEducations_EducationLevels_EducationLevelId",
table: "PlacementEducations");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_OrganizationPositions_OrganizationPosition~",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_PositionLines_PositionLineId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_PositionNumbers_PositionNumberId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_PositionPathSides_PositionPathSideId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_PositionPaths_PositionCandidateId",
table: "PlacementProfiles");
migrationBuilder.DropForeignKey(
name: "FK_PlacementProfiles_PositionPaths_PositionPathId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_OrganizationPositionId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_PositionCandidateId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_PositionLineId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_PositionNumberId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_PositionPathId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementProfiles_PositionPathSideId",
table: "PlacementProfiles");
migrationBuilder.DropIndex(
name: "IX_PlacementEducations_EducationLevelId",
table: "PlacementEducations");
migrationBuilder.DropColumn(
name: "OrganizationPositionId",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "PositionCandidateId",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "PositionLineId",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "PositionNumberId",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "PositionPathId",
table: "PlacementProfiles");
migrationBuilder.DropColumn(
name: "PositionPathSideId",
table: "PlacementProfiles");
migrationBuilder.AlterColumn<Guid>(
name: "EducationLevelId",
table: "PlacementEducations",
type: "char(36)",
nullable: true,
comment: "Idวุฒิที่ได้รับ",
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AddColumn<string>(
name: "EducationLevelName",
table: "PlacementEducations",
type: "longtext",
nullable: true,
comment: "วุฒิที่ได้รับ")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "EducationLevelName",
table: "PlacementEducations");
migrationBuilder.AddColumn<Guid>(
name: "OrganizationPositionId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "PositionCandidateId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "PositionLineId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "PositionNumberId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "PositionPathId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "PositionPathSideId",
table: "PlacementProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AlterColumn<Guid>(
name: "EducationLevelId",
table: "PlacementEducations",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true,
oldComment: "Idวุฒิที่ได้รับ")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_OrganizationPositionId",
table: "PlacementProfiles",
column: "OrganizationPositionId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_PositionCandidateId",
table: "PlacementProfiles",
column: "PositionCandidateId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_PositionLineId",
table: "PlacementProfiles",
column: "PositionLineId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_PositionNumberId",
table: "PlacementProfiles",
column: "PositionNumberId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_PositionPathId",
table: "PlacementProfiles",
column: "PositionPathId");
migrationBuilder.CreateIndex(
name: "IX_PlacementProfiles_PositionPathSideId",
table: "PlacementProfiles",
column: "PositionPathSideId");
migrationBuilder.CreateIndex(
name: "IX_PlacementEducations_EducationLevelId",
table: "PlacementEducations",
column: "EducationLevelId");
migrationBuilder.AddForeignKey(
name: "FK_PlacementEducations_EducationLevels_EducationLevelId",
table: "PlacementEducations",
column: "EducationLevelId",
principalTable: "EducationLevels",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_OrganizationPositions_OrganizationPosition~",
table: "PlacementProfiles",
column: "OrganizationPositionId",
principalTable: "OrganizationPositions",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_PositionLines_PositionLineId",
table: "PlacementProfiles",
column: "PositionLineId",
principalTable: "PositionLines",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_PositionNumbers_PositionNumberId",
table: "PlacementProfiles",
column: "PositionNumberId",
principalTable: "PositionNumbers",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_PositionPathSides_PositionPathSideId",
table: "PlacementProfiles",
column: "PositionPathSideId",
principalTable: "PositionPathSides",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_PositionPaths_PositionCandidateId",
table: "PlacementProfiles",
column: "PositionCandidateId",
principalTable: "PositionPaths",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_PlacementProfiles_PositionPaths_PositionPathId",
table: "PlacementProfiles",
column: "PositionPathId",
principalTable: "PositionPaths",
principalColumn: "Id");
}
}
}

View file

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableplacementprofileaddposcandidate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "PositionCandidate",
table: "PlacementProfiles",
type: "longtext",
nullable: true,
comment: "ตำแหน่งสอบ")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PositionCandidate",
table: "PlacementProfiles");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableplacementaddrefId : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,31 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableplacementaddrefIds : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "RefId",
table: "Placements",
type: "char(36)",
nullable: true,
comment: "Id การสอบ",
collation: "ascii_general_ci");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "RefId",
table: "Placements");
}
}
}

View file

@ -0,0 +1,42 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableRetirementResignsaddReasonResign : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "ReasonResign",
table: "RetirementResigns",
type: "longtext",
nullable: true,
comment: "เหตุผลที่ลาออกจากราชการ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "ReasonResign",
table: "RetirementResignEmployees",
type: "longtext",
nullable: true,
comment: "เหตุผลที่ลาออกจากราชการ")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ReasonResign",
table: "RetirementResigns");
migrationBuilder.DropColumn(
name: "ReasonResign",
table: "RetirementResignEmployees");
}
}
}

View file

@ -0,0 +1,42 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableRetirementResignsaddprofiletype : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "profileType",
table: "RetirementOuts",
type: "longtext",
nullable: true,
comment: "สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "profileType",
table: "RetirementDeceaseds",
type: "longtext",
nullable: true,
comment: "สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "profileType",
table: "RetirementOuts");
migrationBuilder.DropColumn(
name: "profileType",
table: "RetirementDeceaseds");
}
}
}

View file

@ -11245,6 +11245,10 @@ namespace BMA.EHR.Infrastructure.Migrations
b.Property<Guid>("PlacementTypeId")
.HasColumnType("char(36)");
b.Property<Guid?>("RefId")
.HasColumnType("char(36)")
.HasComment("Id การสอบ");
b.Property<string>("Round")
.IsRequired()
.HasColumnType("longtext")
@ -11786,7 +11790,12 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasComment("ระยะเวลาหลักสูตร");
b.Property<Guid?>("EducationLevelId")
.HasColumnType("char(36)");
.HasColumnType("char(36)")
.HasComment("Idวุฒิที่ได้รับ");
b.Property<string>("EducationLevelName")
.HasColumnType("longtext")
.HasComment("วุฒิที่ได้รับ");
b.Property<DateTime?>("EndDate")
.HasColumnType("datetime(6)")
@ -11860,8 +11869,6 @@ namespace BMA.EHR.Infrastructure.Migrations
b.HasKey("Id");
b.HasIndex("EducationLevelId");
b.HasIndex("PlacementProfileId");
b.HasIndex("PositionPathId");
@ -12409,9 +12416,6 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("varchar(20)")
.HasComment("โทรศัพท์ บริษัท");
b.Property<Guid?>("OrganizationPositionId")
.HasColumnType("char(36)");
b.Property<string>("Pass")
.HasColumnType("longtext")
.HasComment("ผลสมัครสอบ");
@ -12456,25 +12460,14 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("ชื่อตำแหน่ง");
b.Property<Guid?>("PositionCandidateId")
.HasColumnType("char(36)");
b.Property<string>("PositionCandidate")
.HasColumnType("longtext")
.HasComment("ตำแหน่งสอบ");
b.Property<string>("PositionLevel")
.HasColumnType("longtext")
.HasComment("ระดับ");
b.Property<Guid?>("PositionLineId")
.HasColumnType("char(36)");
b.Property<Guid?>("PositionNumberId")
.HasColumnType("char(36)");
b.Property<Guid?>("PositionPathId")
.HasColumnType("char(36)");
b.Property<Guid?>("PositionPathSideId")
.HasColumnType("char(36)");
b.Property<double?>("PositionSalaryAmount")
.HasColumnType("double")
.HasComment("เงินประจำตำแหน่ง");
@ -12802,20 +12795,8 @@ namespace BMA.EHR.Infrastructure.Migrations
b.HasKey("Id");
b.HasIndex("OrganizationPositionId");
b.HasIndex("PlacementId");
b.HasIndex("PositionCandidateId");
b.HasIndex("PositionLineId");
b.HasIndex("PositionNumberId");
b.HasIndex("PositionPathId");
b.HasIndex("PositionPathSideId");
b.HasIndex("ProfileImgId");
b.HasIndex("ReliefDocId");
@ -14343,6 +14324,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("profile Id");
b.Property<string>("profileType")
.HasColumnType("longtext")
.HasComment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)");
b.Property<string>("root")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน root");
@ -15140,6 +15125,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("profile Id");
b.Property<string>("profileType")
.HasColumnType("longtext")
.HasComment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)");
b.Property<string>("rootOld")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน root old");
@ -16040,6 +16029,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("เหตุผลที่ลาออกจากราชการ");
b.Property<string>("ReasonResign")
.HasColumnType("longtext")
.HasComment("เหตุผลที่ลาออกจากราชการ");
b.Property<string>("RejectReason")
.HasColumnType("longtext")
.HasComment("เหตุผลไม่อนุมัติ");
@ -16741,6 +16734,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("เหตุผลที่ลาออกจากราชการ");
b.Property<string>("ReasonResign")
.HasColumnType("longtext")
.HasComment("เหตุผลที่ลาออกจากราชการ");
b.Property<string>("RejectReason")
.HasColumnType("longtext")
.HasComment("เหตุผลไม่อนุมัติ");
@ -18471,10 +18468,6 @@ namespace BMA.EHR.Infrastructure.Migrations
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementEducation", b =>
{
b.HasOne("BMA.EHR.Domain.Models.MetaData.EducationLevel", "EducationLevel")
.WithMany()
.HasForeignKey("EducationLevelId");
b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementProfile", "PlacementProfile")
.WithMany("PlacementEducations")
.HasForeignKey("PlacementProfileId")
@ -18485,8 +18478,6 @@ namespace BMA.EHR.Infrastructure.Migrations
.WithMany()
.HasForeignKey("PositionPathId");
b.Navigation("EducationLevel");
b.Navigation("PlacementProfile");
b.Navigation("PositionPath");
@ -18494,34 +18485,10 @@ namespace BMA.EHR.Infrastructure.Migrations
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementProfile", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationPositionEntity", "OrganizationPosition")
.WithMany()
.HasForeignKey("OrganizationPositionId");
b.HasOne("BMA.EHR.Domain.Models.Placement.Placement", "Placement")
.WithMany("PlacementProfiles")
.HasForeignKey("PlacementId");
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionCandidate")
.WithMany()
.HasForeignKey("PositionCandidateId");
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLine", "PositionLine")
.WithMany()
.HasForeignKey("PositionLineId");
b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", "PositionNumber")
.WithMany()
.HasForeignKey("PositionNumberId");
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "PositionPath")
.WithMany()
.HasForeignKey("PositionPathId");
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPathSide", "PositionPathSide")
.WithMany()
.HasForeignKey("PositionPathSideId");
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "ProfileImg")
.WithMany()
.HasForeignKey("ProfileImgId");
@ -18530,20 +18497,8 @@ namespace BMA.EHR.Infrastructure.Migrations
.WithMany()
.HasForeignKey("ReliefDocId");
b.Navigation("OrganizationPosition");
b.Navigation("Placement");
b.Navigation("PositionCandidate");
b.Navigation("PositionLine");
b.Navigation("PositionNumber");
b.Navigation("PositionPath");
b.Navigation("PositionPathSide");
b.Navigation("ProfileImg");
b.Navigation("ReliefDoc");

View file

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
{
/// <inheritdoc />
public partial class updatetabledisciplinecomaddprofiletype : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "profileType",
table: "DisciplineComplaint_Appeals",
type: "longtext",
nullable: true,
comment: "สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "profileType",
table: "DisciplineComplaint_Appeals");
}
}
}

View file

@ -241,6 +241,10 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
.HasColumnType("int")
.HasComment("ปีงบประมาณ");
b.Property<string>("profileType")
.HasColumnType("longtext")
.HasComment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)");
b.HasKey("Id");
b.ToTable("DisciplineComplaint_Appeals");

View file

@ -94,7 +94,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var data = await _repository.GetCoinReport(req.roundId);
var data = await _repository.GetCoinReport(req.roundId, type, req.node, req.nodeId);
var yearInsignalPeriod = await _repository.GetYearInsigniaPeriod(req.roundId);
var dataResult = new List<dynamic>();
@ -157,6 +157,15 @@ namespace BMA.EHR.Insignia.Service.Controllers
colLeft = start;
colRight = start + 25;
}
// ดึงข้อมูล NameLeft และ NameRight
var nameLeft = left.ElementAt(i).GetType().GetProperty("FullName").GetValue(left.ElementAt(i));
var nameRight = right.ElementAt(i).GetType().GetProperty("FullName").GetValue(right.ElementAt(i));
// ถ้าไม่มีทั้ง NameLeft และ NameRight ให้ข้ามไป
if (string.IsNullOrEmpty((string)nameLeft) && string.IsNullOrEmpty((string)nameRight))
{
continue; // ข้ามการทำงานของลูปในรอบนี้
}
mergeList.Add(new
{
row = mergeList.Count + 1,
@ -187,7 +196,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
reportName = "reportInsignia1",
data = new
{
yearInsignalPeriod,
yearInsignalPeriod = yearInsignalPeriod,
data = dataResult,
}
};
@ -200,6 +209,52 @@ namespace BMA.EHR.Insignia.Service.Controllers
}
#endregion
#region 5
/// <summary>
/// บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี
/// </summary>
/// <param name="type">type </param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("report2/{type}")]
public async Task<ActionResult<ResponseObject>> GetInsigniaReport3Async([FromBody] GetInsigniaDetailByNodeReportDto req, string type)
{
try
{
var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_INSIGNIA_REPORT");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var yearInsignalPeriod = await _repository.GetYearInsigniaPeriod(req.roundId);
var agency = "";
var data = await _repository.GetEvaluationResultReport(req.roundId, type, req.node, req.nodeId);
var result = new
{
template = "reportInsignia2",
reportName = "reportInsignia2",
data = new
{
agency = agency,
yearInsignalPeriod = yearInsignalPeriod,
data = data,
}
};
return Success(result);
}
catch
{
throw;
}
}
#endregion
#region
/// <summary>
/// บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ
@ -209,18 +264,18 @@ namespace BMA.EHR.Insignia.Service.Controllers
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("report2/{type}")]
[HttpPost("report3/{type}")]
public async Task<ActionResult<ResponseObject>> GetInsigniaReport2Async([FromBody] GetInsigniaDetailByNodeReportDto req, string type)
{
try
{
var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_INSIGNIA_REPORT");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var data = await _repository.GetSummaryCoinReport(req.roundId);
/* var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_INSIGNIA_REPORT");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}*/
var data = await _repository.GetSummaryCoinReport(req.roundId, type, req.node, req.nodeId);
var summaryTotal = await _repository.GetSummaryTotalCoinReport(req.roundId);
var yearInsignalPeriod = await _repository.GetYearInsigniaPeriod(req.roundId);
@ -242,12 +297,12 @@ namespace BMA.EHR.Insignia.Service.Controllers
var result = new
{
template = "reportInsignia2",
reportName = "reportInsignia2",
template = "reportInsignia3",
reportName = "reportInsignia3",
data = new
{
yearInsignalPeriod,
summaryTotal,
yearInsignalPeriod = yearInsignalPeriod,
summaryTotal = summaryTotal,
data = dataResult,
}
};
@ -261,44 +316,6 @@ namespace BMA.EHR.Insignia.Service.Controllers
}
#endregion
#region 5
/// <summary>
/// บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี
/// </summary>
/// <param name="type">type </param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("report3/{type}")]
public async Task<ActionResult<ResponseObject>> GetInsigniaReport3Async([FromBody] GetInsigniaDetailByNodeReportDto req, string type)
{
try
{
var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_INSIGNIA_REPORT");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var result = new
{
template = "reportInsignia2",
reportName = "reportInsignia2",
data = new List<dynamic>()
};
return Success(result);
}
catch
{
throw;
}
}
#endregion
}
}

View file

@ -5,6 +5,6 @@ namespace BMA.EHR.Insignia.Service.Requests
{
public Guid roundId { get; set; }
public int node { get; set; }
public string nodeId { get; set; }
public Guid nodeId { get; set; }
}
}

View file

@ -13,7 +13,7 @@ COPY ["BMA.EHR.Application/BMA.EHR.Application.csproj", "BMA.EHR.Application/"]
COPY ["BMA.EHR.Infrastructure/BMA.EHR.Infrastructure.csproj", "BMA.EHR.Infrastructure/"]
COPY ["BMA.EHR.Leave/BMA.EHR.Leave.csproj", "BMA.EHR.Leave/"]
RUN dotnet restore "BMA.EHR.Leave/BMA.EHR.Leave.csproj"
RUN dotnet restore "BMA.EHR.Leave/BMA.EHR.Leave.csproj"
COPY . .
WORKDIR "/src/BMA.EHR.Leave"
RUN dotnet build "BMA.EHR.Leave.csproj" -c Release -o /app/build
@ -24,4 +24,4 @@ RUN dotnet publish "BMA.EHR.Leave.csproj" -c Release -o /app/publish /p:UseAppHo
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "BMA.EHR.Leave.dll"]
ENTRYPOINT ["dotnet", "BMA.EHR.Leave.dll"]

View file

@ -341,7 +341,7 @@ namespace BMA.EHR.Placement.Service.Controllers
data.CreatedAt,
data.Reason,
educationOld = data.EducationOld == "/" || data.EducationOld == null ? null : data.EducationOld,
data.EducationOld,
data.salary,
data.PositionTypeOld,
data.PositionLevelOld,
@ -844,7 +844,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -918,6 +919,8 @@ namespace BMA.EHR.Placement.Service.Controllers
templateDoc = r.templateDoc,
posmasterId = p.posmasterId,
positionId = p.positionId,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];
@ -1056,7 +1059,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -1130,6 +1134,8 @@ namespace BMA.EHR.Placement.Service.Controllers
templateDoc = r.templateDoc,
posmasterId = p.posmasterId,
positionId = p.positionId,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];
@ -1265,7 +1271,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -1330,6 +1337,8 @@ namespace BMA.EHR.Placement.Service.Controllers
templateDoc = r.templateDoc,
posmasterId = p.posmasterId,
positionId = p.positionId,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];
@ -1470,7 +1479,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -1535,6 +1545,8 @@ namespace BMA.EHR.Placement.Service.Controllers
templateDoc = r.templateDoc,
posmasterId = p.posmasterId,
positionId = p.positionId,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];
@ -1618,13 +1630,13 @@ namespace BMA.EHR.Placement.Service.Controllers
{
try
{
var report_data = (from p in _context.PlacementAppointments
//.Include(x => x.PlacementEducation)
// .ThenInclude(x => x.PlacementType)
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
// .Where(x => x.Placement!.PlacementType!.Name == "เลื่อนข้าราชการ")
// .Where(x => x.typeCommand.Trim().ToUpper() == "SLIP")
.ToList()
var report_data = (from p in _context.PlacementAppointments
//.Include(x => x.PlacementEducation)
// .ThenInclude(x => x.PlacementType)
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
// .Where(x => x.Placement!.PlacementType!.Name == "เลื่อนข้าราชการ")
// .Where(x => x.typeCommand.Trim().ToUpper() == "SLIP")
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
orderby r.Sequence
@ -1686,7 +1698,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -1759,6 +1772,8 @@ namespace BMA.EHR.Placement.Service.Controllers
templateDoc = r.templateDoc,
posmasterId = p.posmasterId,
positionId = p.positionId,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];

View file

@ -217,7 +217,7 @@ namespace BMA.EHR.Placement.Service.Controllers
IsRelief = x.IsRelief,
posLevelCandidate = x.PositionLevel,
posTypeCandidate = x.PositionType,
positionCandidate = x.positionName,
positionCandidate = x.PositionCandidate,
}).OrderBy(x => x.ExamNumber).ToListAsync();
var result1 = new List<dynamic>();
@ -329,7 +329,7 @@ namespace BMA.EHR.Placement.Service.Controllers
IsRelief = x.IsRelief,
posLevelCandidate = x.PositionLevel,
posTypeCandidate = x.PositionType,
positionCandidate = x.positionName,
positionCandidate = x.PositionCandidate,
}).OrderBy(x => x.ExamNumber).ToListAsync();
var result = new List<dynamic>();
@ -397,6 +397,50 @@ namespace BMA.EHR.Placement.Service.Controllers
return Success(new List<dynamic>());
}
[HttpGet("exam-probation/{citizenId:length(13)}")]
public async Task<ActionResult<ResponseObject>> GetDataExamByPlacement(string citizenId)
{
var dateAppoint = string.Empty;
var apiUrl = $"{_configuration["API"]}/org/profile/citizenid/position/{citizenId}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
if (_res.IsSuccessStatusCode)
{
var json = JObject.Parse(_result);
var dateAppointToken = json["result"]?["dateAppoint"];
if (dateAppointToken != null)
{
dateAppoint = dateAppointToken.ToString();
}
}
}
var placementProfile = await _context.PlacementProfiles
.Include(x => x.Placement)
.Select(x => new
{
fullName = $"{x.Prefix}{x.Firstname} {x.Lastname}",
citizenId = x.CitizenId,
examName = x.Placement.Name,
})
.Where(x => x.citizenId == citizenId.ToString())
.FirstOrDefaultAsync();
var data = new
{
fullName = placementProfile != null ? placementProfile.fullName : "",
citizenId = placementProfile != null ? placementProfile.citizenId : "",
examName = placementProfile != null ? placementProfile.examName : "",
dateAppoint = dateAppoint
};
return Success(data);
}
[HttpGet("personal/{personalId:length(36)}")]
public async Task<ActionResult<ResponseObject>> GetProfileByUser(Guid personalId)
{
@ -432,7 +476,7 @@ namespace BMA.EHR.Placement.Service.Controllers
DateOfBirth = x.DateOfBirth,
Age = x.DateOfBirth == null ? null : x.DateOfBirth.Value.CalculateAgeStrV2(0, 0),
Telephone = x.Telephone,
PositionCandidate = x.positionName,
PositionCandidate = x.PositionCandidate,
Gender = x.Gender,
Relationship = x.Relationship,
BloodGroup = x.BloodGroup,
@ -445,8 +489,8 @@ namespace BMA.EHR.Placement.Service.Controllers
Education = x.PlacementEducations.Select(p => new
{
Id = p.Id,
EducationLevel = p.EducationLevel == null ? null : p.EducationLevel.Name,
EducationLevelId = p.EducationLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.EducationLevel.Id,
EducationLevel = p.EducationLevelName,
EducationLevelId = p.EducationLevelId,
Institute = p.Institute,
Degree = p.Degree,
Field = p.Field,
@ -717,23 +761,11 @@ namespace BMA.EHR.Placement.Service.Controllers
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var person = await _context.PlacementProfiles
.Include(x => x.OrganizationPosition)
.Include(x => x.PositionNumber)
.Include(x => x.PositionPath)
// .Include(x => x.PositionLevel)
.Include(x => x.PositionLine)
.Include(x => x.PositionPathSide)
// .Include(x => x.PositionType)
.FirstOrDefaultAsync(x => x.Id == req.PersonalId);
if (person == null)
return Error(GlobalMessages.DataNotFound, 404);
bool? _nullBool = null;
person.OrganizationPosition = null;
person.PositionNumber = null;
person.PositionPath = null;
person.PositionLevel = null;
person.PositionLine = null;
person.PositionPathSide = null;
person.PositionType = null;
person.Amount = null;
person.MouthSalaryAmount = null;
@ -762,7 +794,7 @@ namespace BMA.EHR.Placement.Service.Controllers
person.child4ShortName = null;
person.orgRevisionId = null;
person.posMasterNo = null;
//person.positionName = null;
//person.positionName = null;
person.positionField = null;
person.posTypeId = null;
person.posTypeName = null;
@ -837,19 +869,6 @@ namespace BMA.EHR.Placement.Service.Controllers
if (person.Draft == true)
return Error("ไม่สามารถแก้ไขข้อมูลนี้ได้เนื่องจากเผยแพร่ไปแล้ว");
// person.organizationName = req.organizationName;
// person.orgTreeShortName = req.orgTreeShortName;
// person.PosPath = req.posPath;
// person.PosNumber = req.posNumber;
// person.node = req.node;
// person.nodeId = req.nodeId;
// person.posmasterId = req.posmasterId;
// person.positionId = req.positionId;
// person.Amount = req.SalaryAmount;
// person.MouthSalaryAmount = req.MouthSalaryAmount;
// person.PositionSalaryAmount = req.PositionSalaryAmount;
// person.RecruitDate = req.ReportingDate;
var apiUrl = $"{_configuration["API"]}/org/find/all";
using (var client = new HttpClient())
@ -1135,10 +1154,6 @@ namespace BMA.EHR.Placement.Service.Controllers
if (profile == null)
return Error(GlobalMessages.DataNotFound, 404);
var educationLevel = await _context.EducationLevels.FirstOrDefaultAsync(x => x.Id == req.EducationLevelId);
if (educationLevel == null && req.EducationLevelId != null)
return Error(GlobalMessages.DataNotFound, 404);
var positionPath = await _context.PositionPaths.FirstOrDefaultAsync(x => x.Id == req.PositionPathId);
if (positionPath == null && req.PositionPathId != null)
return Error(GlobalMessages.DataNotFound, 404);
@ -1146,7 +1161,7 @@ namespace BMA.EHR.Placement.Service.Controllers
var data = new PlacementEducation
{
PlacementProfile = profile,
EducationLevel = educationLevel,
EducationLevelId = req.EducationLevelId,
PositionPath = positionPath,
Institute = req.Institute,
Degree = req.Degree,
@ -1180,10 +1195,6 @@ namespace BMA.EHR.Placement.Service.Controllers
if (profile == null)
return Error(GlobalMessages.DataNotFound, 404);
var educationLevel = await _context.EducationLevels.FirstOrDefaultAsync(x => x.Id == req.EducationLevelId);
if (educationLevel == null && req.EducationLevelId != null)
return Error(GlobalMessages.DataNotFound, 404);
var positionPath = await _context.PositionPaths.FirstOrDefaultAsync(x => x.Id == req.PositionPathId);
if (positionPath == null && req.PositionPathId != null)
return Error(GlobalMessages.DataNotFound, 404);
@ -1192,7 +1203,7 @@ namespace BMA.EHR.Placement.Service.Controllers
if (education == null)
return Error(GlobalMessages.EducationNotFound, 404);
education.EducationLevel = educationLevel;
education.EducationLevelId = req.EducationLevelId;
education.PositionPath = positionPath;
education.Institute = req.Institute;
education.Degree = req.Degree;
@ -1256,13 +1267,6 @@ namespace BMA.EHR.Placement.Service.Controllers
public async Task<ActionResult<ResponseObject>> UpdatePositionDraft(Guid personalId)
{
var profile = await _context.PlacementProfiles
.Include(x => x.OrganizationPosition)
.Include(x => x.PositionNumber)
.Include(x => x.PositionPath)
// .Include(x => x.PositionLevel)
.Include(x => x.PositionLine)
.Include(x => x.PositionPathSide)
// .Include(x => x.PositionType)
.FirstOrDefaultAsync(x => x.Id == personalId);
if (profile == null)
return Error(GlobalMessages.DataNotFound, 404);
@ -1301,16 +1305,11 @@ namespace BMA.EHR.Placement.Service.Controllers
profile.posLevelId = null;
profile.posLevelName = null;
profile.OrganizationPosition = null;
profile.PositionNumber = null;
profile.PositionPath = null;
profile.PositionLevel = null;
profile.PositionLine = null;
profile.PositionPathSide = null;
profile.PositionType = null;
profile.Amount = null;
profile.MouthSalaryAmount = null;
profile.PositionSalaryAmount = null;
// profile.PositionLevel = null;
// profile.PositionType = null;
// profile.Amount = null;
// profile.MouthSalaryAmount = null;
// profile.PositionSalaryAmount = null;
profile.RecruitDate = null;
profile.ReportingDate = null;
@ -1574,7 +1573,7 @@ namespace BMA.EHR.Placement.Service.Controllers
No = r.Sequence.ToString().ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "-" :
p.PlacementEducations.FirstOrDefault().Degree,
$"{p.PlacementEducations.FirstOrDefault().Degree} {p.PlacementEducations.FirstOrDefault().Field}",
PositionName = p.positionName == null ? "-" : p.positionName,
ExamNumber = p.ExamNumber == null ? "-" : p.ExamNumber.Value.ToString().ToThaiNumber(),
PlacementName = $"{p.Placement.Name.ToThaiNumber()} ครั้งที่ {p.Placement.Round.ToThaiNumber()}/{p.Placement.Year.ToThaiYear().ToString().ToThaiNumber()}",
@ -1601,8 +1600,8 @@ namespace BMA.EHR.Placement.Service.Controllers
AppointDate = p.ReportingDate == null ? "-" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
CommandExcecuteDate = string.IsNullOrEmpty(r.CommandExcecuteDate.ToString()) ? "-" : r.CommandExcecuteDate.Value.ToThaiShortDate2().ToThaiNumber(),
OccupationPosition = p.OccupationPosition == null ? "-" : p.OccupationPosition, //ตำแหน่งเก่าก่อนสอบ
PositionCandidate = p.positionName, //ตำแหน่งที่สอบแข่งขัน
OcCandidate = p.root == null ? p.PositionCandidate == null ? "-" : $"{p.PositionCandidate}/-" :
PositionCandidate = p.PositionCandidate, //ตำแหน่งที่สอบแข่งขัน
OcCandidate = p.root == null ? p.positionName == null ? "-" : $"{p.positionName}/-" :
p.node == 4
? p.positionName == null ? $"{p.child4}/{p.child3}/{p.child2}/{p.child1}/{p.root}" : $"{p.positionName}/{p.child4}/{p.child3}/{p.child2}/{p.child1}/{p.root}" :
p.node == 3
@ -1672,7 +1671,6 @@ namespace BMA.EHR.Placement.Service.Controllers
var placementProfile = await _context.PlacementProfiles
.Include(x => x.PlacementCertificates)
.Include(x => x.PlacementEducations)
.ThenInclude(x => x.EducationLevel)
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.ToListAsync();
@ -1741,8 +1739,8 @@ namespace BMA.EHR.Placement.Service.Controllers
other = e.Other ?? string.Empty,
startDate = e.StartDate ?? null,
endDate = e.EndDate ?? null,
educationLevel = e.EducationLevel?.Name ?? string.Empty,
educationLevelId = e.EducationLevel?.Id.ToString() ?? string.Empty,
educationLevel = e.EducationLevelName,
educationLevelId = e.EducationLevelId,
positionPath = e.PositionPath?.Name ?? string.Empty,
positionPathId = e.PositionPath?.Id.ToString() ?? string.Empty,
isDate = e.IsDate ?? false,
@ -1781,7 +1779,9 @@ namespace BMA.EHR.Placement.Service.Controllers
positionLevel = p.posLevelName == null ? string.Empty : p.posLevelName,
refCommandNo = $"{r.commandNo}/{r.commandYear.ToThaiYear()}",
templateDoc = r.templateDoc,
isGovernment = true
isGovernment = true,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
},
bodyPosition = new
{
@ -1893,7 +1893,7 @@ namespace BMA.EHR.Placement.Service.Controllers
No = r.Sequence.ToString().ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "-" :
p.PlacementEducations.FirstOrDefault().Degree,
$"{p.PlacementEducations.FirstOrDefault().Degree} {p.PlacementEducations.FirstOrDefault().Field}",
PositionName = p.positionName == null ? "-" : p.positionName,
ExamNumber = p.ExamNumber == null ? "-" : p.ExamNumber.Value.ToString().ToThaiNumber(),
PlacementName = $"{p.Placement.Name.ToThaiNumber()} ครั้งที่ {p.Placement.Round.ToThaiNumber()}/{p.Placement.Year.ToThaiYear().ToString().ToThaiNumber()}",
@ -1919,7 +1919,7 @@ namespace BMA.EHR.Placement.Service.Controllers
Salary = r.Amount == null ? "-" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "-" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
CommandExcecuteDate = string.IsNullOrEmpty(r.CommandExcecuteDate.ToString()) ? "-" : r.CommandExcecuteDate.Value.ToThaiShortDate2().ToThaiNumber(),
PositionCandidate = p.positionName,
PositionCandidate = p.PositionCandidate,
RemarkHorizontal = r.RemarkHorizontal,
RemarkVertical = r.RemarkVertical,
}).ToList();
@ -1930,7 +1930,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -1977,7 +1978,6 @@ namespace BMA.EHR.Placement.Service.Controllers
var placementProfile = await _context.PlacementProfiles
.Include(x => x.PlacementCertificates)
.Include(x => x.PlacementEducations)
.ThenInclude(x => x.EducationLevel)
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.ToListAsync();
@ -2000,7 +2000,7 @@ namespace BMA.EHR.Placement.Service.Controllers
posLevelId = p.posLevelId == null ? string.Empty : p.posLevelId,
posTypeId = p.posTypeId == null ? string.Empty : p.posTypeId,
email = p.Email == null ? string.Empty : p.Email,
phone = p.MobilePhone == null ? string.Empty : p.MobilePhone,
phone = p.Telephone == null ? string.Empty : p.Telephone,
keycloak = string.Empty,
isProbation = true,
isLeave = false,
@ -2017,16 +2017,16 @@ namespace BMA.EHR.Placement.Service.Controllers
gender = p.Gender == null ? string.Empty : p.Gender,
relationship = p.Relationship == null ? string.Empty : p.Relationship,
religion = p.Religion == null ? string.Empty : p.Religion,
bloodGroup = string.Empty,
bloodGroup = p.BloodGroup,
registrationAddress = p.RegistAddress == null ? string.Empty : p.RegistAddress,
registrationProvinceId = (String?)null,
registrationDistrictId = (String?)null,
registrationSubDistrictId = (String?)null,
registrationProvinceId = p.RegistProvinceId,
registrationDistrictId = p.RegistDistrictId,
registrationSubDistrictId = p.RegistSubDistrictId,
registrationZipCode = p.RegistZipCode == null ? string.Empty : p.RegistZipCode,
currentAddress = p.CurrentAddress == null ? string.Empty : p.CurrentAddress,
currentProvinceId = (String?)null,
currentDistrictId = (String?)null,
currentSubDistrictId = (String?)null,
currentProvinceId = p.CurrentProvinceId,
currentDistrictId = p.CurrentDistrictId,
currentSubDistrictId = p.CurrentSubDistrictId,
currentZipCode = p.CurrentZipCode == null ? string.Empty : p.CurrentZipCode,
amount = r.amount,
amountSpecial = r.amountSpecial,
@ -2046,8 +2046,8 @@ namespace BMA.EHR.Placement.Service.Controllers
other = e.Other ?? string.Empty,
startDate = e.StartDate ?? null,
endDate = e.EndDate ?? null,
educationLevel = e.EducationLevel?.Name ?? string.Empty,
educationLevelId = e.EducationLevel?.Id.ToString() ?? string.Empty,
educationLevel = e.EducationLevelName,
educationLevelId = e.EducationLevelId,
positionPath = e.PositionPath?.Name ?? string.Empty,
positionPathId = e.PositionPath?.Id.ToString() ?? string.Empty,
isDate = e.IsDate ?? false,
@ -2086,7 +2086,9 @@ namespace BMA.EHR.Placement.Service.Controllers
positionLevel = p.posLevelName == null ? string.Empty : p.posLevelName,
refCommandNo = $"{r.commandNo}/{r.commandYear.ToThaiYear()}",
templateDoc = r.templateDoc,
isGovernment = true
isGovernment = true,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
},
bodyPosition = new
{
@ -2255,7 +2257,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -2330,6 +2333,8 @@ namespace BMA.EHR.Placement.Service.Controllers
templateDoc = r.templateDoc,
posmasterId = p.posmasterId,
positionId = p.positionId,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];
@ -2483,7 +2488,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -2558,6 +2564,8 @@ namespace BMA.EHR.Placement.Service.Controllers
templateDoc = r.templateDoc,
posmasterId = p.posmasterId,
positionId = p.positionId,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];
@ -2702,7 +2710,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -2722,7 +2731,7 @@ namespace BMA.EHR.Placement.Service.Controllers
AppointDate = _null,
RemarkHorizontal = _null,
RemarkVertical = _null,
});
});
}
}
return Success(result);
@ -2775,6 +2784,8 @@ namespace BMA.EHR.Placement.Service.Controllers
templateDoc = r.templateDoc,
posmasterId = p.posmasterId,
positionId = p.positionId,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];
@ -2806,15 +2817,285 @@ namespace BMA.EHR.Placement.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("report1")]
public async Task<ActionResult<ResponseObject>> report1(string? nodeId = null, int? node = 0, DateOnly? startDate = null, DateOnly? startEnd = null)
public async Task<ActionResult<ResponseObject>> report1(string nodeId = "", int? node = null, DateTime? startDate = null, DateTime? endDate = null)
{
var data = new
var apiUrl = $"{_configuration["API"]}/org/find/node-all";
var data = new object();
var data1 = new List<dynamic>();
var data2 = new List<dynamic>();
using (var client = new HttpClient())
{
template = "placement01",
reportName = "xlsx-report",
data = ""
};
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
var _res = await client.PostAsJsonAsync(apiUrl, new
{
node,
nodeId,
});
var _result = await _res.Content.ReadAsStringAsync();
var orgs = JsonConvert.DeserializeObject<NodeAllRequest>(_result);
if (orgs == null || orgs.result == null)
return Error("ไม่พบหน่วยงานนี้ในระบบ", 404);
int no = 1;
foreach (var item in orgs.result.isRootTrue)
{
var placementProfiles = _context.PlacementProfiles
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootId.Contains(item.rootId) &&
x.PlacementStatus.Trim().ToUpper() == "DONE")
.GroupBy(x => x.typeCommand.Trim().ToUpper())
.Select(g => new
{
TypeCommand = g.Key,
Count = g.Count()
})
.ToList();
var placementAppointments = _context.PlacementAppointments
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootId.Contains(item.rootId) &&
x.Status.Trim().ToUpper() == "DONE" &&
x.type.Trim().ToUpper() == "OFFICER")
.GroupBy(x => x.typeCommand.Trim().ToUpper())
.Select(g => new
{
TypeCommand = g.Key,
Count = g.Count()
})
.ToList();
var pt_count = _context.PlacementTransfers
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootOldId.Contains(item.rootId) &&
x.Status.Trim().ToUpper() == "DONE")
.Count();
var pr_count = _context.PlacementReceives
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootId.Contains(item.rootId) &&
x.Status.Trim().ToUpper() == "DONE")
.Count();
var po_count = _context.PlacementOfficers
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootOldId.Contains(item.rootId) &&
x.Status.Trim().ToUpper() == "DONE")
.Count();
var prp_count = _context.PlacementRepatriations
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootOldId.Contains(item.rootId) &&
x.Status.Trim().ToUpper() == "DONE")
.Count();
var ro_count = _context.RetirementOthers
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootOldId.Contains(item.rootId) &&
x.Status.Trim().ToUpper() == "DONE")
.Count();
var pp_appoint = placementProfiles.FirstOrDefault(x => x.TypeCommand == "APPOINT")?.Count ?? 0;
var pp_slip = placementProfiles.FirstOrDefault(x => x.TypeCommand == "SLIP")?.Count ?? 0;
var pp_move = placementProfiles.FirstOrDefault(x => x.TypeCommand == "MOVE")?.Count ?? 0;
var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINT")?.Count ?? 0;
var pa_slip = placementAppointments.FirstOrDefault(x => x.TypeCommand == "SLIP")?.Count ?? 0;
var pa_move = placementAppointments.FirstOrDefault(x => x.TypeCommand == "MOVE")?.Count ?? 0;
data1.Add(new
{
no = no,
rootName = item.name,
pp_appoint = pp_appoint,
pp_slip = pp_slip,
pp_move = pp_move,
pa_appoint = pa_appoint,
pa_slip = pa_slip,
pa_move = pa_move,
pt_count = pt_count,
pr_count = pr_count,
po_count = po_count,
prp_count = prp_count,
ro_count = ro_count,
total = (pp_appoint + pp_slip + pp_move + pa_appoint + pa_slip + pa_move + pt_count + pr_count + po_count + prp_count + ro_count)
});
no++;
}
no = 1;
foreach (var item in orgs.result.isRootFalse)
{
var placementProfiles = _context.PlacementProfiles
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootId.Contains(item.rootId) &&
x.PlacementStatus.Trim().ToUpper() == "DONE")
.GroupBy(x => x.typeCommand.Trim().ToUpper())
.Select(g => new
{
TypeCommand = g.Key,
Count = g.Count()
})
.ToList();
var placementAppointments = _context.PlacementAppointments
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootId.Contains(item.rootId) &&
x.Status.Trim().ToUpper() == "DONE" &&
x.type.Trim().ToUpper() == "OFFICER")
.GroupBy(x => x.typeCommand.Trim().ToUpper())
.Select(g => new
{
TypeCommand = g.Key,
Count = g.Count()
})
.ToList();
var pt_count = _context.PlacementTransfers
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootOldId.Contains(item.rootId) &&
x.Status.Trim().ToUpper() == "DONE")
.Count();
var pr_count = _context.PlacementReceives
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootId.Contains(item.rootId) &&
x.Status.Trim().ToUpper() == "DONE")
.Count();
var po_count = _context.PlacementOfficers
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootOldId.Contains(item.rootId) &&
x.Status.Trim().ToUpper() == "DONE")
.Count();
var prp_count = _context.PlacementRepatriations
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootOldId.Contains(item.rootId) &&
x.Status.Trim().ToUpper() == "DONE")
.Count();
var ro_count = _context.RetirementOthers
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootOldId.Contains(item.rootId) &&
x.Status.Trim().ToUpper() == "DONE")
.Count();
var pp_appoint = placementProfiles.FirstOrDefault(x => x.TypeCommand == "APPOINT")?.Count ?? 0;
var pp_slip = placementProfiles.FirstOrDefault(x => x.TypeCommand == "SLIP")?.Count ?? 0;
var pp_move = placementProfiles.FirstOrDefault(x => x.TypeCommand == "MOVE")?.Count ?? 0;
var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINT")?.Count ?? 0;
var pa_slip = placementAppointments.FirstOrDefault(x => x.TypeCommand == "SLIP")?.Count ?? 0;
var pa_move = placementAppointments.FirstOrDefault(x => x.TypeCommand == "MOVE")?.Count ?? 0;
data2.Add(new
{
no = no,
rootName = item.name,
pp_appoint = pp_appoint,
pp_slip = pp_slip,
pp_move = pp_move,
pa_appoint = pa_appoint,
pa_slip = pa_slip,
pa_move = pa_move,
pt_count = pt_count,
pr_count = pr_count,
po_count = po_count,
prp_count = prp_count,
ro_count = ro_count,
total = (pp_appoint + pp_slip + pp_move + pa_appoint + pa_slip + pa_move + pt_count + pr_count + po_count + prp_count + ro_count)
});
no++;
}
}
data = new
{
template = "reportPlacement01All",
reportName = "xlsx-report",
data = new
{
date = $"ตั้งแต่วันที่ {startDate.Value.Date.ToThaiShortDate().ToThaiNumber()} ถึง {endDate.Value.Date.ToThaiShortDate().ToThaiNumber()}",
dateCurrent = $"ณ วันที่ {DateTime.Now.Date.ToThaiShortDate().ToThaiNumber()}",
data1,
data1Count = new
{
pp_appoint = data1.Where(x => x.pp_appoint > 0).Sum(x => x.pp_appoint),
pp_slip = data1.Where(x => x.pp_slip > 0).Sum(x => x.pp_slip),
pp_move = data1.Where(x => x.pp_move > 0).Sum(x => x.pp_move),
pa_appoint = data1.Where(x => x.pa_appoint > 0).Sum(x => x.pa_appoint),
pa_slip = data1.Where(x => x.pa_slip > 0).Sum(x => x.pa_slip),
pa_move = data1.Where(x => x.pa_move > 0).Sum(x => x.pa_move),
pt_count = data1.Where(x => x.pt_count > 0).Sum(x => x.pt_count),
pr_count = data1.Where(x => x.pr_count > 0).Sum(x => x.pr_count),
po_count = data1.Where(x => x.po_count > 0).Sum(x => x.po_count),
prp_count = data1.Where(x => x.prp_count > 0).Sum(x => x.prp_count),
ro_count = data1.Where(x => x.ro_count > 0).Sum(x => x.ro_count),
total = data1.Where(x => x.total > 0).Sum(x => x.total)
},
data2,
data2Count = new
{
pp_appoint = data2.Where(x => x.pp_appoint > 0).Sum(x => x.pp_appoint),
pp_slip = data2.Where(x => x.pp_slip > 0).Sum(x => x.pp_slip),
pp_move = data2.Where(x => x.pp_move > 0).Sum(x => x.pp_move),
pa_appoint = data2.Where(x => x.pa_appoint > 0).Sum(x => x.pa_appoint),
pa_slip = data2.Where(x => x.pa_slip > 0).Sum(x => x.pa_slip),
pa_move = data2.Where(x => x.pa_move > 0).Sum(x => x.pa_move),
pt_count = data2.Where(x => x.pt_count > 0).Sum(x => x.pt_count),
pr_count = data2.Where(x => x.pr_count > 0).Sum(x => x.pr_count),
po_count = data2.Where(x => x.po_count > 0).Sum(x => x.po_count),
prp_count = data2.Where(x => x.prp_count > 0).Sum(x => x.prp_count),
ro_count = data2.Where(x => x.ro_count > 0).Sum(x => x.ro_count),
total = data2.Where(x => x.total > 0).Sum(x => x.total)
},
sum = new
{
pp_appoint = data1.Where(x => x.pp_appoint > 0).Sum(x => x.pp_appoint) + data2.Where(x => x.pp_appoint > 0).Sum(x => x.pp_appoint),
pp_slip = data1.Where(x => x.pp_slip > 0).Sum(x => x.pp_slip) + data2.Where(x => x.pp_slip > 0).Sum(x => x.pp_slip),
pp_move = data1.Where(x => x.pp_move > 0).Sum(x => x.pp_move) + data2.Where(x => x.pp_move > 0).Sum(x => x.pp_move),
pa_appoint = data1.Where(x => x.pa_appoint > 0).Sum(x => x.pa_appoint) + data2.Where(x => x.pa_appoint > 0).Sum(x => x.pa_appoint),
pa_slip = data1.Where(x => x.pa_slip > 0).Sum(x => x.pa_slip) + data2.Where(x => x.pa_slip > 0).Sum(x => x.pa_slip),
pa_move = data1.Where(x => x.pa_move > 0).Sum(x => x.pa_move) + data2.Where(x => x.pa_move > 0).Sum(x => x.pa_move),
pt_count = data1.Where(x => x.pt_count > 0).Sum(x => x.pt_count) + data2.Where(x => x.pt_count > 0).Sum(x => x.pt_count),
pr_count = data1.Where(x => x.pr_count > 0).Sum(x => x.pr_count) + data2.Where(x => x.pr_count > 0).Sum(x => x.pr_count),
po_count = data1.Where(x => x.po_count > 0).Sum(x => x.po_count) + data2.Where(x => x.po_count > 0).Sum(x => x.po_count),
prp_count = data1.Where(x => x.prp_count > 0).Sum(x => x.prp_count) + data2.Where(x => x.prp_count > 0).Sum(x => x.prp_count),
ro_count = data1.Where(x => x.ro_count > 0).Sum(x => x.ro_count) + data2.Where(x => x.ro_count > 0).Sum(x => x.ro_count),
total = data1.Where(x => x.total > 0).Sum(x => x.total) + data2.Where(x => x.total > 0).Sum(x => x.total)
}
}
};
return Success(data);
}
@ -2827,17 +3108,129 @@ namespace BMA.EHR.Placement.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("report2")]
public async Task<ActionResult<ResponseObject>> report2(string? nodeId = null, int? node = 0, DateOnly? startDate = null, DateOnly? startEnd = null)
public async Task<ActionResult<ResponseObject>> report2(string nodeId = "", int? node = null, DateTime? startDate = null, DateTime? endDate = null)
{
var data = new
var apiUrl = $"{_configuration["API"]}/org/find/node-all";
var data = new object();
var data1 = new List<dynamic>();
var data2 = new List<dynamic>();
using (var client = new HttpClient())
{
template = "placement02",
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
var _res = await client.PostAsJsonAsync(apiUrl, new
{
node,
nodeId,
});
var _result = await _res.Content.ReadAsStringAsync();
var orgs = JsonConvert.DeserializeObject<NodeAllRequest>(_result);
if (orgs == null || orgs.result == null)
return Error("ไม่พบหน่วยงานนี้ในระบบ", 404);
int no = 1;
foreach (var item in orgs.result.isRootTrue)
{
var placementAppointments = _context.PlacementAppointments
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootId.Contains(item.rootId) &&
x.Status.Trim().ToUpper() == "DONE" &&
x.type.Trim().ToUpper() == "OFFICER")
.GroupBy(x => x.typeCommand.Trim().ToUpper())
.Select(g => new
{
TypeCommand = g.Key,
Count = g.Count()
})
.ToList();
var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINT")?.Count ?? 0;
var pa_slip = placementAppointments.FirstOrDefault(x => x.TypeCommand == "SLIP")?.Count ?? 0;
var pa_move = placementAppointments.FirstOrDefault(x => x.TypeCommand == "MOVE")?.Count ?? 0;
data1.Add(new
{
no = no,
rootName = item.name,
pa_appoint = pa_appoint,
pa_slip = pa_slip,
pa_move = pa_move,
total = (pa_appoint + pa_slip + pa_move)
});
no++;
}
no = 1;
foreach (var item in orgs.result.isRootFalse)
{
var placementAppointments = _context.PlacementAppointments
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootId.Contains(item.rootId) &&
x.Status.Trim().ToUpper() == "DONE" &&
x.type.Trim().ToUpper() == "OFFICER")
.GroupBy(x => x.typeCommand.Trim().ToUpper())
.Select(g => new
{
TypeCommand = g.Key,
Count = g.Count()
})
.ToList();
var pa_appoint = placementAppointments.FirstOrDefault(x => x.TypeCommand == "APPOINT")?.Count ?? 0;
var pa_slip = placementAppointments.FirstOrDefault(x => x.TypeCommand == "SLIP")?.Count ?? 0;
var pa_move = placementAppointments.FirstOrDefault(x => x.TypeCommand == "MOVE")?.Count ?? 0;
data2.Add(new
{
no = no,
rootName = item.name,
pa_appoint = pa_appoint,
pa_slip = pa_slip,
pa_move = pa_move,
total = (pa_appoint + pa_slip + pa_move)
});
no++;
}
}
data = new
{
template = "reportPlacement02All",
reportName = "xlsx-report",
data = ""
data = new
{
date = $"ตั้งแต่วันที่ {startDate.Value.Date.ToThaiShortDate().ToThaiNumber()} ถึง {endDate.Value.Date.ToThaiShortDate().ToThaiNumber()}",
dateCurrent = $"ณ วันที่ {DateTime.Now.Date.ToThaiShortDate().ToThaiNumber()}",
data1,
data1Count = new
{
pa_appoint = data1.Where(x => x.pa_appoint > 0).Sum(x => x.pa_appoint),
pa_slip = data1.Where(x => x.pa_slip > 0).Sum(x => x.pa_slip),
pa_move = data1.Where(x => x.pa_move > 0).Sum(x => x.pa_move),
total = data1.Where(x => x.total > 0).Sum(x => x.total)
},
data2,
data2Count = new
{
pa_appoint = data2.Where(x => x.pa_appoint > 0).Sum(x => x.pa_appoint),
pa_slip = data2.Where(x => x.pa_slip > 0).Sum(x => x.pa_slip),
pa_move = data2.Where(x => x.pa_move > 0).Sum(x => x.pa_move),
total = data2.Where(x => x.total > 0).Sum(x => x.total)
},
sum = new
{
pa_appoint = data1.Where(x => x.pa_appoint > 0).Sum(x => x.pa_appoint) + data2.Where(x => x.pa_appoint > 0).Sum(x => x.pa_appoint),
pa_slip = data1.Where(x => x.pa_slip > 0).Sum(x => x.pa_slip) + data2.Where(x => x.pa_slip > 0).Sum(x => x.pa_slip),
pa_move = data1.Where(x => x.pa_move > 0).Sum(x => x.pa_move) + data2.Where(x => x.pa_move > 0).Sum(x => x.pa_move),
total = data1.Where(x => x.total > 0).Sum(x => x.total) + data2.Where(x => x.total > 0).Sum(x => x.total)
}
}
};
return Success(data);
}
}

View file

@ -628,7 +628,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -674,6 +675,7 @@ namespace BMA.EHR.Placement.Service.Controllers
date = r.commandAffectDate,
amount = r.amount,
commandId = r.commandId,
amountSpecial = r.amountSpecial,
positionSalaryAmount = r.positionSalaryAmount,
mouthSalaryAmount = r.mouthSalaryAmount,
posNo = p.PositionNumberOld,
@ -685,6 +687,8 @@ namespace BMA.EHR.Placement.Service.Controllers
positionLevel = p.PositionLevelOld,
refCommandNo = $"{r.commandNo}/{r.commandYear.ToThaiYear()}",
templateDoc = r.templateDoc,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];

View file

@ -335,14 +335,14 @@ namespace BMA.EHR.Placement.Service.Controllers
data.CreatedAt,
data.Reason,
educationOld = data.EducationOld == "/" || data.EducationOld == null ? null : data.EducationOld,
data.EducationOld,
data.AmountOld,
data.PositionOld,
organizationOld = data.OrganizationOld == "/" || data.OrganizationOld == null ? null : data.OrganizationOld,
data.PositionTypeOld,
data.PositionLevelOld,
data.PositionNumberOld,
organizationPositionOld = data.OrganizationPositionOld == "/" || data.OrganizationPositionOld == null ? null: data.OrganizationPositionOld,
organizationPositionOld = data.OrganizationPositionOld == "/" || data.OrganizationPositionOld == null ? null : data.OrganizationPositionOld,
data.IsActive,
data.rootOld,
@ -488,8 +488,8 @@ namespace BMA.EHR.Placement.Service.Controllers
placementReceive.posLevelOldId = org.result.posLevelId;
placementReceive.posLevelNameOld = org.result.posLevelName;
// placementReceive.EducationOld = profile.Educations.Count() == 0 ? null : $"{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Degree}-{profile.Educations.OrderByDescending(x => x.FinishDate).FirstOrDefault().Field}";
// placementReceive.AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount;
placementReceive.EducationOld = org.result.education;
placementReceive.AmountOld = org.result.Amount;
placementReceive.PositionOld = org.result.position;
placementReceive.PositionLevelOld = org.result.posLevelName;
@ -974,7 +974,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -994,7 +995,7 @@ namespace BMA.EHR.Placement.Service.Controllers
CommandExcecuteDate = _null,
RemarkHorizontal = _null,
RemarkVertical = _null,
});
});
}
}
return Success(result);
@ -1037,7 +1038,7 @@ namespace BMA.EHR.Placement.Service.Controllers
email = (String?)null,
phone = (String?)null,
keycloak = string.Empty,
isProbation = true,
isProbation = false,
isLeave = false,
dateRetire = (DateTime?)null,
dateAppoint = r.commandAffectDate,
@ -1088,7 +1089,9 @@ namespace BMA.EHR.Placement.Service.Controllers
positionType = p.posTypeName == null ? string.Empty : p.posTypeName,
positionLevel = p.posLevelName == null ? string.Empty : p.posLevelName,
refCommandNo = $"{r.commandNo}/{r.commandYear.ToThaiYear()}",
templateDoc = r.templateDoc
templateDoc = r.templateDoc,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
},
bodyPosition = new
{

View file

@ -500,6 +500,7 @@ namespace BMA.EHR.Placement.Service.Controllers
date = r.commandAffectDate,
amount = r.amount,
commandId = r.commandId,
amountSpecial = r.amountSpecial,
positionSalaryAmount = r.positionSalaryAmount,
mouthSalaryAmount = r.mouthSalaryAmount,
posNo = p.PositionNumberOld,
@ -511,6 +512,8 @@ namespace BMA.EHR.Placement.Service.Controllers
positionLevel = p.PositionLevelOld,
refCommandNo = $"{r.commandNo}/{r.commandYear.ToThaiYear()}",
templateDoc = r.templateDoc,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];

View file

@ -838,7 +838,8 @@ namespace BMA.EHR.Placement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -903,6 +904,8 @@ namespace BMA.EHR.Placement.Service.Controllers
leaveReason = "โอนออก",
dateLeave = r.commandAffectDate,
isLeave = true,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];

View file

@ -0,0 +1,24 @@
using BMA.EHR.Domain.Models.MetaData;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Placement.Service.Requests
{
public class NodeAllRequest
{
public NodeAllResult result { get; set; } = new();
}
public class NodeAllResult
{
public List<NodeAllRequestData> isRootTrue { get; set; } = new();
public List<NodeAllRequestData> isRootFalse { get; set; } = new();
}
public class NodeAllRequestData
{
public string? name { get; set; }
public string? rootId { get; set; }
public string? child1Id { get; set; }
public string? child2Id { get; set; }
public string? child3Id { get; set; }
public string? child4Id { get; set; }
}
}

View file

@ -42,6 +42,7 @@ namespace BMA.EHR.Placement.Service.Requests
public string? posLevelName { get; set; }
public double? salary { get; set; }
public string? education { get; set; }
public double? Amount { get; set; }
}
}

View file

@ -19,5 +19,7 @@ namespace BMA.EHR.Placement.Service.Requests
public double? amountSpecial { get; set; }
public double? positionSalaryAmount { get; set; }
public double? mouthSalaryAmount { get; set; }
public string? refCommandCode { get; set; }
public string? refCommandName { get; set; }
}
}

View file

@ -78,7 +78,7 @@ namespace BMA.EHR.Report.Service.Controllers
// try
// {
// // Get avatar Image
//var picContent = await _minIOExamService.DownloadFileAsync(avatar);
var picContent = avatar == null ? null : await _minIOExamService.ImagesPath(avatar);
//var pictureBox = (Telerik.Reporting.PictureBox)report.Items["detailSection1"].Items["picAvatar"];
//pictureBox.Value = Image.FromStream(new MemoryStream(picContent.FileContent));
// }
@ -141,7 +141,7 @@ namespace BMA.EHR.Report.Service.Controllers
ContactRelations = candidate.GetType().GetProperty("ContactRelations").GetValue(candidate),
ContactTel = candidate.GetType().GetProperty("ContactTel").GetValue(candidate),
RegisterDate = candidate.GetType().GetProperty("RegisterDate").GetValue(candidate),
Url = "https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg",
Url = picContent ?? "https://bma-ehr.frappet.synology.me/assets/avatar_user-89f22423.jpg",
Careers = careers,
};

View file

@ -31,7 +31,7 @@ namespace BMA.EHR.Report.Service.Controllers
public ProbationReportController(IWebHostEnvironment hostingEnvironment, IConfiguration configuration, ProbationReportRepository repository, GenericReportGenerator reportGenerator)
{
_hostingEnvironment = hostingEnvironment;
_configuration = configuration;
_repository = repository;
@ -66,7 +66,7 @@ namespace BMA.EHR.Report.Service.Controllers
token = authorizationHeader.Substring("Bearer ".Length).Trim();
var probation = await _repository.GetProbationAssignAsync(id, token);
if(probation != null)
if (probation != null)
{
var mimeType = "";
switch (exportType.Trim().ToLower())
@ -1064,8 +1064,8 @@ namespace BMA.EHR.Report.Service.Controllers
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("18/{exportType}/{id}")]
public async Task<ActionResult<ResponseObject>> GetProbation19ConvertReportAsync(Guid id, string exportType = "pdf")
[HttpGet("18/{exportType}/{id}/{no}")]
public async Task<ActionResult<ResponseObject>> GetProbation19ConvertReportAsync(Guid id, int no, string exportType = "pdf")
{
try
{
@ -1075,7 +1075,7 @@ namespace BMA.EHR.Report.Service.Controllers
if (!string.IsNullOrEmpty(authorizationHeader) && authorizationHeader.StartsWith("Bearer "))
{
token = authorizationHeader.Substring("Bearer ".Length).Trim();
var evaluateAssign = await _repository.GetEvaluateResultAssignAsync(id, token);
var evaluateAssign = await _repository.GetEvaluateResultAssignAsync(id, no, token);
if (evaluateAssign != null)
{
@ -1131,10 +1131,10 @@ namespace BMA.EHR.Report.Service.Controllers
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
//RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo);
//return File(result.DocumentBytes, mimeType, $"แบบรายงานการประเมินผล.{exportType.Trim().ToLower()}");
var ExpandMonth = evaluateAssign.GetType().GetProperty("ExpandMonth").GetValue(evaluateAssign).ToString();
var data = new
{
template = ExpandMonth == "" ? "probation-18-1" : "probation-18-2",
template = no == 1 ? "probation-18-1" : "probation-18-2",
reportName = "docx-report",
data = evaluateAssign
};

View file

@ -33,7 +33,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly IConfiguration _configuration;
private readonly PermissionRepository _permission;
private readonly DisciplineDbContext _contextDiscipline;
public RetirementController(RetirementRepository repository,
NotificationRepository repositoryNoti,
ApplicationDBContext context,
@ -41,7 +41,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
IConfiguration configuration,
OrganizationCommonRepository organizationCommonRepository,
IHttpContextAccessor httpContextAccessor,
PermissionRepository permission)
PermissionRepository permission,
DisciplineDbContext contextDiscipline)
{
_repository = repository;
_repositoryNoti = repositoryNoti;
@ -51,6 +52,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
_httpContextAccessor = httpContextAccessor;
_configuration = configuration;
_permission = permission;
_contextDiscipline = contextDiscipline;
}
#region " Properties "
@ -1290,15 +1292,286 @@ namespace BMA.EHR.Retirement.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("report1")]
public async Task<ActionResult<ResponseObject>> report1(string? nodeId = null, int? node = 0, DateOnly? startDate = null, DateOnly? startEnd = null)
public async Task<ActionResult<ResponseObject>> report1(string nodeId = "", int? node = null, DateTime? startDate = null, DateTime? endDate = null)
{
var data = new
{
template = "retirement01",
reportName = "xlsx-report",
data = ""
};
var apiUrl = $"{_configuration["API"]}/org/find/node-all";
var data = new object();
var data1 = new List<dynamic>();
var data2 = new List<dynamic>();
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
var _res = await client.PostAsJsonAsync(apiUrl, new
{
node,
nodeId
});
var _result = await _res.Content.ReadAsStringAsync();
var orgs = JsonConvert.DeserializeObject<NodeAllRequest>(_result);
if (orgs == null || orgs.result == null)
return Error("ไม่พบหน่วยงานนี้ในระบบ", 404);
int no = 1;
foreach (var org in orgs.result.isRootTrue)
{
//เกษียณ
var retire = _context.RetirementPeriods
.Include(x => x.RetirementProfiles.Where(x => x.rootId == org.rootId))
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.Type.Trim().ToUpper() == "OFFICER")
.FirstOrDefault();
var rt_count = retire != null ? retire.RetirementProfiles.Count() : 0;
//ลาออก
var retirementResigns = _context.RetirementResigns
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootOldId == org.rootId &&
x.IsCancel == false && x.Status == "DONE")
.ToList();
var career_count = retirementResigns.Where(x => x.Reason == "CAREER").Count();
var move_count = retirementResigns.Where(x => x.Reason == "MOVE").Count();
var family_count = retirementResigns.Where(x => x.Reason == "FAMILY").Count();
var education_count = retirementResigns.Where(x => x.Reason == "EDUCATION").Count();
var other_count = retirementResigns.Where(x => x.Reason == "OTHER").Count();
//ขอโอน
var pt_count = _context.PlacementTransfers
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootOldId.Contains(org.rootId) &&
x.Status.Trim().ToUpper() == "DONE")
.Count();
//ถึงแก่กรรม
var rd_count = _context.RetirementDeceaseds
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.profileType.Trim().ToUpper() == "OFFICER" &&
x.rootId.Contains(org.rootId))
.Count();
//ให้ออก
var ro_count = _context.RetirementOuts
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.Status.Trim().ToUpper() == "DONE" &&
x.profileType.Trim().ToUpper() == "OFFICER" &&
x.rootOldId.Contains(org.rootId))
.Count();
//ปลดออก
var dl_cm19_count = _contextDiscipline.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.Status.Trim().ToUpper() == "DONE" &&
x.profileType.Trim().ToUpper() == "OFFICER" &&
x.CommandTypeId == Guid.Parse("ef8db4d7-1472-4c1d-b73f-9114e618a96f") &&
x.rootId.Contains(org.rootId))
.Count();
//ไล่ออก
var dl_cm20_count = _contextDiscipline.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.Status.Trim().ToUpper() == "DONE" &&
x.profileType.Trim().ToUpper() == "OFFICER" &&
x.CommandTypeId == Guid.Parse("d9dee5c3-b75a-4927-9ce2-51e2233cf20b") &&
x.rootId.Contains(org.rootId))
.Count();
data1.Add(new
{
no = no,
rootName = org.name,
rt_count,
career_count,
move_count,
family_count,
education_count,
other_count,
pt_count,
rd_count,
ro_count,
dl_cm19_count,
dl_cm20_count,
total = (rt_count + career_count + move_count + family_count + education_count + other_count + pt_count + rd_count + ro_count + dl_cm19_count + dl_cm20_count)
});
no++;
}
no = 1;
foreach (var org in orgs.result.isRootFalse)
{
//เกษียณ
var retire = _context.RetirementPeriods
.Include(x => x.RetirementProfiles.Where(x => x.rootId == org.rootId))
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.Type.Trim().ToUpper() == "OFFICER")
.FirstOrDefault();
var rt_count = retire != null ? retire.RetirementProfiles.Count() : 0;
//ลาออก
var retirementResigns = _context.RetirementResigns
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootOldId == org.rootId &&
x.IsCancel == false && x.Status == "DONE")
.ToList();
var career_count = retirementResigns.Where(x => x.Reason == "CAREER").Count();
var move_count = retirementResigns.Where(x => x.Reason == "MOVE").Count();
var family_count = retirementResigns.Where(x => x.Reason == "FAMILY").Count();
var education_count = retirementResigns.Where(x => x.Reason == "EDUCATION").Count();
var other_count = retirementResigns.Where(x => x.Reason == "OTHER").Count();
//ขอโอน
var pt_count = _context.PlacementTransfers
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootOldId.Contains(org.rootId) &&
x.Status.Trim().ToUpper() == "DONE")
.Count();
//ถึงแก่กรรม
var rd_count = _context.RetirementDeceaseds
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.profileType.Trim().ToUpper() == "OFFICER" &&
x.rootId.Contains(org.rootId))
.Count();
//ให้ออก
var ro_count = _context.RetirementOuts
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.Status.Trim().ToUpper() == "DONE" &&
x.profileType.Trim().ToUpper() == "OFFICER" &&
x.rootOldId.Contains(org.rootId))
.Count();
//ปลดออก
var dl_cm19_count = _contextDiscipline.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.Status.Trim().ToUpper() == "DONE" &&
x.profileType.Trim().ToUpper() == "OFFICER" &&
x.CommandTypeId == Guid.Parse("ef8db4d7-1472-4c1d-b73f-9114e618a96f") &&
x.rootId.Contains(org.rootId))
.Count();
//ไล่ออก
var dl_cm20_count = _contextDiscipline.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.Status.Trim().ToUpper() == "DONE" &&
x.profileType.Trim().ToUpper() == "OFFICER" &&
x.CommandTypeId == Guid.Parse("d9dee5c3-b75a-4927-9ce2-51e2233cf20b") &&
x.rootId.Contains(org.rootId))
.Count();
data2.Add(new
{
no = no,
rootName = org.name,
rt_count,
career_count,
move_count,
family_count,
education_count,
other_count,
pt_count,
rd_count,
ro_count,
dl_cm19_count,
dl_cm20_count,
total = (rt_count + career_count + move_count + family_count + education_count + other_count + pt_count + rd_count + ro_count + dl_cm19_count + dl_cm20_count)
});
no++;
}
}
data = new
{
template = "reportRetirement01All",
reportName = "xlsx-report",
data = new
{
date = $"ตั้งแต่วันที่ {startDate.Value.Date.ToThaiShortDate().ToThaiNumber()} ถึง {endDate.Value.Date.ToThaiShortDate().ToThaiNumber()}",
dateCurrent = $"ณ วันที่ {DateTime.Now.Date.ToThaiShortDate().ToThaiNumber()}",
data1,
data1Count = new
{
rt_count = data1.Where(x => x.rt_count > 0).Sum(x => x.rt_count),
career_count = data1.Where(x => x.career_count > 0).Sum(x => x.career_count),
move_count = data1.Where(x => x.move_count > 0).Sum(x => x.move_count),
family_count = data1.Where(x => x.family_count > 0).Sum(x => x.family_count),
education_count = data1.Where(x => x.education_count > 0).Sum(x => x.education_count),
other_count = data1.Where(x => x.other_count > 0).Sum(x => x.other_count),
pt_count = data1.Where(x => x.pt_count > 0).Sum(x => x.pt_count),
rd_count = data1.Where(x => x.rd_count > 0).Sum(x => x.rd_count),
ro_count = data1.Where(x => x.ro_count > 0).Sum(x => x.ro_count),
dl_cm19_count = data1.Where(x => x.dl_cm19_count > 0).Sum(x => x.dl_cm19_count),
dl_cm20_count = data1.Where(x => x.dl_cm20_count > 0).Sum(x => x.dl_cm20_count),
total = data1.Where(x => x.total > 0).Sum(x => x.total)
},
data2,
data2Count = new
{
rt_count = data2.Where(x => x.rt_count > 0).Sum(x => x.rt_count),
career_count = data2.Where(x => x.career_count > 0).Sum(x => x.career_count),
move_count = data2.Where(x => x.move_count > 0).Sum(x => x.move_count),
family_count = data2.Where(x => x.family_count > 0).Sum(x => x.family_count),
education_count = data2.Where(x => x.education_count > 0).Sum(x => x.education_count),
other_count = data2.Where(x => x.other_count > 0).Sum(x => x.other_count),
pt_count = data2.Where(x => x.pt_count > 0).Sum(x => x.pt_count),
rd_count = data2.Where(x => x.rd_count > 0).Sum(x => x.rd_count),
ro_count = data2.Where(x => x.ro_count > 0).Sum(x => x.ro_count),
dl_cm19_count = data2.Where(x => x.dl_cm19_count > 0).Sum(x => x.dl_cm19_count),
dl_cm20_count = data2.Where(x => x.dl_cm20_count > 0).Sum(x => x.dl_cm20_count),
total = data2.Where(x => x.total > 0).Sum(x => x.total)
},
sum = new
{
rt_count = data1.Where(x => x.rt_count > 0).Sum(x => x.rt_count) + data2.Where(x => x.rt_count > 0).Sum(x => x.rt_count),
career_count = data1.Where(x => x.career_count > 0).Sum(x => x.career_count) + data2.Where(x => x.career_count > 0).Sum(x => x.career_count),
move_count = data1.Where(x => x.move_count > 0).Sum(x => x.move_count) + data2.Where(x => x.move_count > 0).Sum(x => x.move_count),
family_count = data1.Where(x => x.family_count > 0).Sum(x => x.family_count) + data2.Where(x => x.family_count > 0).Sum(x => x.family_count),
education_count = data1.Where(x => x.education_count > 0).Sum(x => x.education_count) + data2.Where(x => x.education_count > 0).Sum(x => x.education_count),
other_count = data1.Where(x => x.other_count > 0).Sum(x => x.other_count) + data2.Where(x => x.other_count > 0).Sum(x => x.other_count),
pt_count = data1.Where(x => x.pt_count > 0).Sum(x => x.pt_count) + data2.Where(x => x.pt_count > 0).Sum(x => x.pt_count),
rd_count = data1.Where(x => x.rd_count > 0).Sum(x => x.rd_count) + data2.Where(x => x.rd_count > 0).Sum(x => x.rd_count),
ro_count = data1.Where(x => x.ro_count > 0).Sum(x => x.ro_count) + data2.Where(x => x.ro_count > 0).Sum(x => x.ro_count),
dl_cm19_count = data1.Where(x => x.dl_cm19_count > 0).Sum(x => x.dl_cm19_count) + data2.Where(x => x.dl_cm19_count > 0).Sum(x => x.dl_cm19_count),
dl_cm20_count = data1.Where(x => x.dl_cm20_count > 0).Sum(x => x.dl_cm20_count) + data2.Where(x => x.dl_cm20_count > 0).Sum(x => x.dl_cm20_count),
total = data1.Where(x => x.total > 0).Sum(x => x.total) + data2.Where(x => x.total > 0).Sum(x => x.total)
}
}
};
return Success(data);
}
@ -1311,17 +1584,263 @@ namespace BMA.EHR.Retirement.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("report2")]
public async Task<ActionResult<ResponseObject>> report2(string? nodeId = null, int? node = 0, DateOnly? startDate = null, DateOnly? startEnd = null)
public async Task<ActionResult<ResponseObject>> report2(string nodeId = "", int? node = null, DateTime? startDate = null, DateTime? endDate = null)
{
var data = new
var apiUrl = $"{_configuration["API"]}/org/find/node-all";
var data = new object();
var data1 = new List<dynamic>();
var data2 = new List<dynamic>();
using (var client = new HttpClient())
{
template = "retirement02",
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
var _res = await client.PostAsJsonAsync(apiUrl, new
{
node,
nodeId
});
var _result = await _res.Content.ReadAsStringAsync();
var orgs = JsonConvert.DeserializeObject<NodeAllRequest>(_result);
if (orgs == null || orgs.result == null)
return Error("ไม่พบหน่วยงานนี้ในระบบ", 404);
int no = 1;
foreach (var org in orgs.result.isRootTrue)
{
//เกษียณ
var retire = _context.RetirementPeriods
.Include(x => x.RetirementProfiles.Where(x => x.rootId == org.rootId))
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.Type.Trim().ToUpper() == "OFFICER")
.FirstOrDefault();
var rt_count = retire != null ? retire.RetirementProfiles.Count() : 0;
//ลาออก
var retirementResigns = _context.RetirementResigns
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootOldId == org.rootId &&
x.IsCancel == false && x.Status == "DONE")
.ToList();
var career_count = retirementResigns.Where(x => x.Reason == "CAREER").Count();
var move_count = retirementResigns.Where(x => x.Reason == "MOVE").Count();
var family_count = retirementResigns.Where(x => x.Reason == "FAMILY").Count();
var education_count = retirementResigns.Where(x => x.Reason == "EDUCATION").Count();
var other_count = retirementResigns.Where(x => x.Reason == "OTHER").Count();
//ถึงแก่กรรม
var rd_count = _context.RetirementDeceaseds
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.profileType.Trim().ToUpper() == "OFFICER" &&
x.rootId.Contains(org.rootId))
.Count();
//ให้ออก
var ro_count = _context.RetirementOuts
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.Status.Trim().ToUpper() == "DONE" &&
x.profileType.Trim().ToUpper() == "OFFICER" &&
x.rootOldId.Contains(org.rootId))
.Count();
//ปลดออก
var dl_cm19_count = _contextDiscipline.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.Status.Trim().ToUpper() == "DONE" &&
x.profileType.Trim().ToUpper() == "OFFICER" &&
x.CommandTypeId == Guid.Parse("ef8db4d7-1472-4c1d-b73f-9114e618a96f") &&
x.rootId.Contains(org.rootId))
.Count();
//ไล่ออก
var dl_cm20_count = _contextDiscipline.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.Status.Trim().ToUpper() == "DONE" &&
x.profileType.Trim().ToUpper() == "OFFICER" &&
x.CommandTypeId == Guid.Parse("d9dee5c3-b75a-4927-9ce2-51e2233cf20b") &&
x.rootId.Contains(org.rootId))
.Count();
data1.Add(new
{
no = no,
rootName = org.name,
rt_count,
career_count,
move_count,
family_count,
education_count,
other_count,
rd_count,
ro_count,
dl_cm19_count,
dl_cm20_count,
total = (rt_count + career_count + move_count + family_count + education_count + other_count + rd_count + ro_count + dl_cm19_count + dl_cm20_count)
});
no++;
}
no = 1;
foreach (var org in orgs.result.isRootFalse)
{
//เกษียณ
var retire = _context.RetirementPeriods
.Include(x => x.RetirementProfiles.Where(x => x.rootId == org.rootId))
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.Type.Trim().ToUpper() == "OFFICER")
.FirstOrDefault();
var rt_count = retire != null ? retire.RetirementProfiles.Count() : 0;
//ลาออก
var retirementResigns = _context.RetirementResigns
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.rootOldId == org.rootId &&
x.IsCancel == false && x.Status == "DONE")
.ToList();
var career_count = retirementResigns.Where(x => x.Reason == "CAREER").Count();
var move_count = retirementResigns.Where(x => x.Reason == "MOVE").Count();
var family_count = retirementResigns.Where(x => x.Reason == "FAMILY").Count();
var education_count = retirementResigns.Where(x => x.Reason == "EDUCATION").Count();
var other_count = retirementResigns.Where(x => x.Reason == "OTHER").Count();
//ถึงแก่กรรม
var rd_count = _context.RetirementDeceaseds
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.profileType.Trim().ToUpper() == "OFFICER" &&
x.rootId.Contains(org.rootId))
.Count();
//ให้ออก
var ro_count = _context.RetirementOuts
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.Status.Trim().ToUpper() == "DONE" &&
x.profileType.Trim().ToUpper() == "OFFICER" &&
x.rootOldId.Contains(org.rootId))
.Count();
//ปลดออก
var dl_cm19_count = _contextDiscipline.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.Status.Trim().ToUpper() == "DONE" &&
x.profileType.Trim().ToUpper() == "OFFICER" &&
x.CommandTypeId == Guid.Parse("ef8db4d7-1472-4c1d-b73f-9114e618a96f") &&
x.rootId.Contains(org.rootId))
.Count();
//ไล่ออก
var dl_cm20_count = _contextDiscipline.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x =>
x.CreatedAt.Date >= startDate &&
x.CreatedAt.Date <= endDate &&
x.Status.Trim().ToUpper() == "DONE" &&
x.profileType.Trim().ToUpper() == "OFFICER" &&
x.CommandTypeId == Guid.Parse("d9dee5c3-b75a-4927-9ce2-51e2233cf20b") &&
x.rootId.Contains(org.rootId))
.Count();
data2.Add(new
{
no = no,
rootName = org.name,
rt_count,
career_count,
move_count,
family_count,
education_count,
other_count,
rd_count,
ro_count,
dl_cm19_count,
dl_cm20_count,
total = (rt_count + career_count + move_count + family_count + education_count + other_count + rd_count + ro_count + dl_cm19_count + dl_cm20_count)
});
no++;
}
}
data = new
{
template = "reportRetirement02All",
reportName = "xlsx-report",
data = ""
data = new
{
date = $"ตั้งแต่วันที่ {startDate.Value.Date.ToThaiShortDate().ToThaiNumber()} ถึง {endDate.Value.Date.ToThaiShortDate().ToThaiNumber()}",
dateCurrent = $"ณ วันที่ {DateTime.Now.Date.ToThaiShortDate().ToThaiNumber()}",
data1,
data1Count = new
{
rt_count = data1.Where(x => x.rt_count > 0).Sum(x => x.rt_count),
career_count = data1.Where(x => x.career_count > 0).Sum(x => x.career_count),
move_count = data1.Where(x => x.move_count > 0).Sum(x => x.move_count),
family_count = data1.Where(x => x.family_count > 0).Sum(x => x.family_count),
education_count = data1.Where(x => x.education_count > 0).Sum(x => x.education_count),
other_count = data1.Where(x => x.other_count > 0).Sum(x => x.other_count),
rd_count = data1.Where(x => x.rd_count > 0).Sum(x => x.rd_count),
ro_count = data1.Where(x => x.ro_count > 0).Sum(x => x.ro_count),
dl_cm19_count = data1.Where(x => x.dl_cm19_count > 0).Sum(x => x.dl_cm19_count),
dl_cm20_count = data1.Where(x => x.dl_cm20_count > 0).Sum(x => x.dl_cm20_count),
total = data1.Where(x => x.total > 0).Sum(x => x.total)
},
data2,
data2Count = new
{
rt_count = data2.Where(x => x.rt_count > 0).Sum(x => x.rt_count),
career_count = data2.Where(x => x.career_count > 0).Sum(x => x.career_count),
move_count = data2.Where(x => x.move_count > 0).Sum(x => x.move_count),
family_count = data2.Where(x => x.family_count > 0).Sum(x => x.family_count),
education_count = data2.Where(x => x.education_count > 0).Sum(x => x.education_count),
other_count = data2.Where(x => x.other_count > 0).Sum(x => x.other_count),
rd_count = data2.Where(x => x.rd_count > 0).Sum(x => x.rd_count),
ro_count = data2.Where(x => x.ro_count > 0).Sum(x => x.ro_count),
dl_cm19_count = data2.Where(x => x.dl_cm19_count > 0).Sum(x => x.dl_cm19_count),
dl_cm20_count = data2.Where(x => x.dl_cm20_count > 0).Sum(x => x.dl_cm20_count),
total = data2.Where(x => x.total > 0).Sum(x => x.total)
},
sum = new
{
rt_count = data1.Where(x => x.rt_count > 0).Sum(x => x.rt_count) + data2.Where(x => x.rt_count > 0).Sum(x => x.rt_count),
career_count = data1.Where(x => x.career_count > 0).Sum(x => x.career_count) + data2.Where(x => x.career_count > 0).Sum(x => x.career_count),
move_count = data1.Where(x => x.move_count > 0).Sum(x => x.move_count) + data2.Where(x => x.move_count > 0).Sum(x => x.move_count),
family_count = data1.Where(x => x.family_count > 0).Sum(x => x.family_count) + data2.Where(x => x.family_count > 0).Sum(x => x.family_count),
education_count = data1.Where(x => x.education_count > 0).Sum(x => x.education_count) + data2.Where(x => x.education_count > 0).Sum(x => x.education_count),
other_count = data1.Where(x => x.other_count > 0).Sum(x => x.other_count) + data2.Where(x => x.other_count > 0).Sum(x => x.other_count),
rd_count = data1.Where(x => x.rd_count > 0).Sum(x => x.rd_count) + data2.Where(x => x.rd_count > 0).Sum(x => x.rd_count),
ro_count = data1.Where(x => x.ro_count > 0).Sum(x => x.ro_count) + data2.Where(x => x.ro_count > 0).Sum(x => x.ro_count),
dl_cm19_count = data1.Where(x => x.dl_cm19_count > 0).Sum(x => x.dl_cm19_count) + data2.Where(x => x.dl_cm19_count > 0).Sum(x => x.dl_cm19_count),
dl_cm20_count = data1.Where(x => x.dl_cm20_count > 0).Sum(x => x.dl_cm20_count) + data2.Where(x => x.dl_cm20_count > 0).Sum(x => x.dl_cm20_count),
total = data1.Where(x => x.total > 0).Sum(x => x.total) + data2.Where(x => x.total > 0).Sum(x => x.total)
}
}
};
return Success(data);
}
}

View file

@ -103,6 +103,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
.Select(p => new
{
p.Id,
p.profileType,
p.citizenId,
p.profileId,
p.prefix,
@ -126,7 +127,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.IsActive,
})
.ToListAsync();
return Success(retirementDeceaseds);
return Success(retirementDeceaseds);
}
/// <summary>
@ -147,6 +148,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
{
p.Id,
p.profileId,
p.profileType,
p.prefix,
p.firstName,
p.lastName,
@ -184,6 +186,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
data.prefix,
data.firstName,
data.lastName,
data.profileType,
data.root,
data.rootShortName,
data.child1,
@ -236,6 +239,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
{
// Profile = profile,
Number = req.Number,
profileType = req.profileType.Trim().ToUpper(),
Date = req.Date,
Location = req.Location,
Reason = req.Reason,
@ -247,65 +251,129 @@ namespace BMA.EHR.Retirement.Service.Controllers
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
};
var apiUrl = $"{_configuration["API"]}/org/profile/profileid/position/{req.ProfileId}";
using (var client = new HttpClient())
if (req.profileType.Trim().ToUpper() == "OFFICER")
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<Requests.OrgRequest>(_result);
if (org == null || org.result == null)
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
retirementDeceased.profileId = org.result.profileId;
retirementDeceased.prefix = org.result.prefix;
retirementDeceased.firstName = org.result.firstName;
retirementDeceased.lastName = org.result.lastName;
retirementDeceased.citizenId = org.result.citizenId;
retirementDeceased.root = org.result.root;
retirementDeceased.rootId = org.result.rootId;
retirementDeceased.rootShortName = org.result.rootShortName;
retirementDeceased.child1 = org.result.child1;
retirementDeceased.child1Id = org.result.child1Id;
retirementDeceased.child1ShortName = org.result.child1ShortName;
retirementDeceased.child2 = org.result.child2;
retirementDeceased.child2Id = org.result.child2Id;
retirementDeceased.child2ShortName = org.result.child2ShortName;
retirementDeceased.child3 = org.result.child3;
retirementDeceased.child3Id = org.result.child3Id;
retirementDeceased.child3ShortName = org.result.child3ShortName;
retirementDeceased.child4 = org.result.child4;
retirementDeceased.child4Id = org.result.child4Id;
retirementDeceased.child4ShortName = org.result.child4ShortName;
retirementDeceased.posMasterNo = org.result.posMasterNo;
retirementDeceased.position = org.result.position;
retirementDeceased.posTypeId = org.result.posTypeId;
retirementDeceased.posTypeName = org.result.posTypeName;
retirementDeceased.posLevelId = org.result.posLevelId;
retirementDeceased.posLevelName = org.result.posLevelName;
}
await _context.RetirementDeceaseds.AddAsync(retirementDeceased);
//await _context.SaveChangesAsync();
var _baseAPI = _configuration["API"];
var _apiUrl = $"{_baseAPI}/org/profile/leave/{req.ProfileId}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Post, _apiUrl);
var _res = await client.PostAsJsonAsync(_apiUrl, new
var apiUrl = $"{_configuration["API"]}/org/profile/profileid/position/{req.ProfileId}";
using (var client = new HttpClient())
{
isLeave = true,
leaveReason = "ถึงแก่กรรม",
dateLeave = req.Date,
});
var _result = await _res.Content.ReadAsStringAsync();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<Requests.OrgRequest>(_result);
if (org == null || org.result == null)
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
retirementDeceased.profileId = org.result.profileId;
retirementDeceased.prefix = org.result.prefix;
retirementDeceased.firstName = org.result.firstName;
retirementDeceased.lastName = org.result.lastName;
retirementDeceased.citizenId = org.result.citizenId;
retirementDeceased.root = org.result.root;
retirementDeceased.rootId = org.result.rootId;
retirementDeceased.rootShortName = org.result.rootShortName;
retirementDeceased.child1 = org.result.child1;
retirementDeceased.child1Id = org.result.child1Id;
retirementDeceased.child1ShortName = org.result.child1ShortName;
retirementDeceased.child2 = org.result.child2;
retirementDeceased.child2Id = org.result.child2Id;
retirementDeceased.child2ShortName = org.result.child2ShortName;
retirementDeceased.child3 = org.result.child3;
retirementDeceased.child3Id = org.result.child3Id;
retirementDeceased.child3ShortName = org.result.child3ShortName;
retirementDeceased.child4 = org.result.child4;
retirementDeceased.child4Id = org.result.child4Id;
retirementDeceased.child4ShortName = org.result.child4ShortName;
retirementDeceased.posMasterNo = org.result.posMasterNo;
retirementDeceased.position = org.result.position;
retirementDeceased.posTypeId = org.result.posTypeId;
retirementDeceased.posTypeName = $"{org.result.posTypeShortName} {org.result.posTypeName}";
retirementDeceased.posLevelId = org.result.posLevelId;
retirementDeceased.posLevelName = org.result.posLevelName;
}
await _context.RetirementDeceaseds.AddAsync(retirementDeceased);
var _baseAPI = _configuration["API"];
var _apiUrl = $"{_baseAPI}/org/profile/leave/{req.ProfileId}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Post, _apiUrl);
var _res = await client.PostAsJsonAsync(_apiUrl, new
{
isLeave = true,
leaveReason = "ถึงแก่กรรม",
dateLeave = req.Date,
});
var _result = await _res.Content.ReadAsStringAsync();
}
}
else
{
var apiUrl = $"{_configuration["API"]}/org/profile-employee/profileid/position/{req.ProfileId}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<Requests.OrgRequest>(_result);
if (org == null || org.result == null)
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
retirementDeceased.profileId = org.result.profileId;
retirementDeceased.prefix = org.result.prefix;
retirementDeceased.firstName = org.result.firstName;
retirementDeceased.lastName = org.result.lastName;
retirementDeceased.citizenId = org.result.citizenId;
retirementDeceased.root = org.result.root;
retirementDeceased.rootId = org.result.rootId;
retirementDeceased.rootShortName = org.result.rootShortName;
retirementDeceased.child1 = org.result.child1;
retirementDeceased.child1Id = org.result.child1Id;
retirementDeceased.child1ShortName = org.result.child1ShortName;
retirementDeceased.child2 = org.result.child2;
retirementDeceased.child2Id = org.result.child2Id;
retirementDeceased.child2ShortName = org.result.child2ShortName;
retirementDeceased.child3 = org.result.child3;
retirementDeceased.child3Id = org.result.child3Id;
retirementDeceased.child3ShortName = org.result.child3ShortName;
retirementDeceased.child4 = org.result.child4;
retirementDeceased.child4Id = org.result.child4Id;
retirementDeceased.child4ShortName = org.result.child4ShortName;
retirementDeceased.posMasterNo = org.result.posMasterNo;
retirementDeceased.position = org.result.position;
retirementDeceased.posTypeId = org.result.posTypeId;
retirementDeceased.posTypeName = org.result.posTypeName;
retirementDeceased.posLevelId = org.result.posLevelId;
retirementDeceased.posLevelName = org.result.posLevelName;
}
await _context.RetirementDeceaseds.AddAsync(retirementDeceased);
var _baseAPI = _configuration["API"];
var _apiUrl = $"{_baseAPI}/org/profile-employee/leave/{req.ProfileId}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Post, _apiUrl);
var _res = await client.PostAsJsonAsync(_apiUrl, new
{
isLeave = true,
leaveReason = "ถึงแก่กรรม",
dateLeave = req.Date,
});
var _result = await _res.Content.ReadAsStringAsync();
}
}
var _doc = new Domain.Models.Documents.Document();
@ -320,56 +388,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
if (_doc != null)
retirementDeceased.Document = _doc;
}
// await _context.ProfileSalaries.AddAsync(new ProfileSalary
// {
// Date = req.Date,
// SalaryRef = req.Number,
// CommandNo = "-",
// SalaryClass = "-",
// PosNoEmployee = "-",
// CommandTypeName = "-",
// SalaryStatus = "DEATH",
// Profile = profile,
// CreatedFullName = FullName ?? "System Administrator",
// CreatedUserId = UserId ?? "",
// CreatedAt = DateTime.Now,
// LastUpdateFullName = FullName ?? "System Administrator",
// LastUpdateUserId = UserId ?? "",
// LastUpdatedAt = DateTime.Now,
// });
// if (_doc != null)
// {
// await _context.ProfilePapers.AddAsync(new ProfilePaper
// {
// Detail = "ถึงแก่กรรม",
// CategoryName = "DEATH",
// Document = _doc,
// Profile = profile,
// CreatedFullName = FullName ?? "System Administrator",
// CreatedUserId = UserId ?? "",
// CreatedAt = DateTime.Now,
// LastUpdateFullName = FullName ?? "System Administrator",
// LastUpdateUserId = UserId ?? "",
// LastUpdatedAt = DateTime.Now,
// });
// }
// var orgPos = await _context.ProfilePositions
// .Include(x => x.Profile)
// .ThenInclude(x => x!.Prefix)
// .Include(x => x.OrganizationPosition)
// .ThenInclude(x => x!.Organization)
// .ThenInclude(x => x!.OrganizationOrganization)
// .Include(x => x.OrganizationPosition)
// .ThenInclude(x => x!.PositionMaster)
// .ThenInclude(x => x!.PositionPath)
// .Where(x => x.OrganizationPosition!.IsDirector! == true)
// .Where(x => x.OrganizationPosition!.Organization!.Id == profile.OcId)
// .FirstOrDefaultAsync();
// if (orgPos != null)
// {
// if (orgPos.Profile != null)
// {
retirementDeceased.RetirementDeceasedNotis.Add(new RetirementDeceasedNoti
{
CitizenId = retirementDeceased.citizenId == null ? "" : retirementDeceased.citizenId,
@ -389,8 +408,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
});
// }
// }
await _context.SaveChangesAsync();
return Success();
@ -552,32 +569,63 @@ namespace BMA.EHR.Retirement.Service.Controllers
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
};
var apiUrl = $"{_configuration["API"]}/org/profile/profileid/position/{item.ProfileId}";
using (var client = new HttpClient())
if (retirementDeceased.profileType.Trim().ToUpper() == "OFFICER")
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var apiUrl = $"{_configuration["API"]}/org/profile/profileid/position/{item.ProfileId}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<Requests.OrgRequest>(_result);
var org = JsonConvert.DeserializeObject<Requests.OrgRequest>(_result);
if (org == null || org.result == null)
continue;
if (org == null || org.result == null)
continue;
retirementDeceasedNoti.Prefix = org.result.prefix == null ? "" : org.result.prefix;
retirementDeceasedNoti.FirstName = org.result.firstName == null ? "" : org.result.firstName;
retirementDeceasedNoti.LastName = org.result.lastName == null ? "" : org.result.lastName;
retirementDeceasedNoti.CitizenId = org.result.citizenId == null ? "" : org.result.citizenId;
retirementDeceasedNoti.PositionName = org.result.position == null ? "" : org.result.position;
retirementDeceasedNoti.OrganizationName = (org.result.child4 == null ? "" : org.result.child4 + "/") +
(org.result.child3 == null ? "" : org.result.child3 + "/") +
(org.result.child2 == null ? "" : org.result.child2 + "/") +
(org.result.child1 == null ? "" : org.result.child1 + "/") +
(org.result.root == null ? "" : org.result.root);
retirementDeceased.RetirementDeceasedNotis.Add(retirementDeceasedNoti);
retirementDeceasedNoti.Prefix = org.result.prefix == null ? "" : org.result.prefix;
retirementDeceasedNoti.FirstName = org.result.firstName == null ? "" : org.result.firstName;
retirementDeceasedNoti.LastName = org.result.lastName == null ? "" : org.result.lastName;
retirementDeceasedNoti.CitizenId = org.result.citizenId == null ? "" : org.result.citizenId;
retirementDeceasedNoti.PositionName = org.result.position == null ? "" : org.result.position;
retirementDeceasedNoti.OrganizationName = (org.result.child4 == null ? "" : org.result.child4 + "/") +
(org.result.child3 == null ? "" : org.result.child3 + "/") +
(org.result.child2 == null ? "" : org.result.child2 + "/") +
(org.result.child1 == null ? "" : org.result.child1 + "/") +
(org.result.root == null ? "" : org.result.root);
retirementDeceased.RetirementDeceasedNotis.Add(retirementDeceasedNoti);
}
}
else
{
var apiUrl = $"{_configuration["API"]}/org/profile-employee/profileid/position/{item.ProfileId}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<Requests.OrgRequest>(_result);
if (org == null || org.result == null)
continue;
retirementDeceasedNoti.Prefix = org.result.prefix == null ? "" : org.result.prefix;
retirementDeceasedNoti.FirstName = org.result.firstName == null ? "" : org.result.firstName;
retirementDeceasedNoti.LastName = org.result.lastName == null ? "" : org.result.lastName;
retirementDeceasedNoti.CitizenId = org.result.citizenId == null ? "" : org.result.citizenId;
retirementDeceasedNoti.PositionName = org.result.position == null ? "" : org.result.position;
retirementDeceasedNoti.OrganizationName = (org.result.child4 == null ? "" : org.result.child4 + "/") +
(org.result.child3 == null ? "" : org.result.child3 + "/") +
(org.result.child2 == null ? "" : org.result.child2 + "/") +
(org.result.child1 == null ? "" : org.result.child1 + "/") +
(org.result.root == null ? "" : org.result.root);
retirementDeceased.RetirementDeceasedNotis.Add(retirementDeceasedNoti);
}
}
await _context.SaveChangesAsync();

View file

@ -103,7 +103,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
var retirementOthers = await _context.RetirementOthers.AsQueryable()
.OrderByDescending(x => x.CreatedAt)
.Where(x => rootId == "" ? true : (child1Id == "" ? x.rootOldId == rootId : (child2Id == "" ? x.child1OldId == child1Id : (child3Id == "" ? x.child2OldId == child2Id : (child4Id == "" ? x.child3OldId == child3Id : x.child4OldId == child4Id)))))
// .Where(x => rootId == "" ? true : (child1Id == "" ? x.rootOldId == rootId : (child2Id == "" ? x.child1OldId == child1Id : (child3Id == "" ? x.child2OldId == child2Id : (child4Id == "" ? x.child3OldId == child3Id : x.child4OldId == child4Id)))))
.Select(p => new
{
p.Id,
@ -721,7 +721,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -742,7 +743,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
CommandExcecuteDate = _null,
RemarkHorizontal = _null,
RemarkVertical = _null,
});
});
}
}
return Success(result);
@ -793,6 +794,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
leaveReason = _null,
dateLeave = _null,
isGovernment = true,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];
@ -927,7 +930,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -999,7 +1003,9 @@ namespace BMA.EHR.Retirement.Service.Controllers
isLeave = false,
leaveReason = _null,
dateLeave = _null,
isGovernment = true
isGovernment = true,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];

View file

@ -103,10 +103,11 @@ namespace BMA.EHR.Retirement.Service.Controllers
var retirementOuts = await _context.RetirementOuts.AsQueryable()
.OrderByDescending(x => x.CreatedAt)
.Where(x => rootId == "" ? true : (child1Id == "" ? x.rootOldId == rootId : (child2Id == "" ? x.child1OldId == child1Id : (child3Id == "" ? x.child2OldId == child2Id : (child4Id == "" ? x.child3OldId == child3Id : x.child4OldId == child4Id)))))
// .Where(x => rootId == "" ? true : (child1Id == "" ? x.rootOldId == rootId : (child2Id == "" ? x.child1OldId == child1Id : (child3Id == "" ? x.child2OldId == child2Id : (child4Id == "" ? x.child3OldId == child3Id : x.child4OldId == child4Id)))))
.Select(p => new
{
p.Id,
p.profileType,
p.citizenId,
p.profileId,
p.prefix,
@ -178,6 +179,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
.Select(p => new
{
p.Id,
p.profileType,
p.profileId,
p.prefix,
p.firstName,
@ -258,27 +260,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
[HttpPost()]
public async Task<ActionResult<ResponseObject>> Post([FromForm] RetirementAddProfileRequest req)
{
// var profile = await _context.Profiles
// .Include(x => x.PositionLevel)
// .Include(x => x.PositionType)
// .Include(x => x.PosNo)
// .Include(x => x.Salaries)
// .Include(x => x.Position)
// .FirstOrDefaultAsync(x => x.Id == req.Id);
// if (profile == null)
// return Error(GlobalMessages.DataNotFound, 404);
var retirementOut = new RetirementOut
{
// Profile = profile,
// Organization = Request.Form.ContainsKey("Organization") ? Request.Form["Organization"] : "",
// Reason = Request.Form.ContainsKey("Reason") ? Request.Form["Reason"] : "",
// // Date = req.Date,
// AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
// PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
// PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
// PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
// OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
Status = "WAITTING",
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
@ -287,57 +270,115 @@ namespace BMA.EHR.Retirement.Service.Controllers
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
};
var apiUrl = $"{_configuration["API"]}/org/profile/profileid/position/{req.Id}";
using (var client = new HttpClient())
if (req.profileType.Trim().ToUpper() == "OFFICER")
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var apiUrl = $"{_configuration["API"]}/org/profile/profileid/position/{req.Id}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
if (org == null || org.result == null)
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
if (org == null || org.result == null)
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
retirementOut.profileId = org.result.profileId;
retirementOut.prefix = org.result.prefix;
retirementOut.firstName = org.result.firstName;
retirementOut.lastName = org.result.lastName;
retirementOut.citizenId = org.result.citizenId;
retirementOut.rootOld = org.result.root;
retirementOut.rootOldId = org.result.rootId;
retirementOut.rootShortNameOld = org.result.rootShortName;
retirementOut.child1Old = org.result.child1;
retirementOut.child1OldId = org.result.child1Id;
retirementOut.child1ShortNameOld = org.result.child1ShortName;
retirementOut.child2Old = org.result.child2;
retirementOut.child2OldId = org.result.child2Id;
retirementOut.child2ShortNameOld = org.result.child2ShortName;
retirementOut.child3Old = org.result.child3;
retirementOut.child3OldId = org.result.child3Id;
retirementOut.child3ShortNameOld = org.result.child3ShortName;
retirementOut.child4Old = org.result.child4;
retirementOut.child4OldId = org.result.child4Id;
retirementOut.child4ShortNameOld = org.result.child4ShortName;
retirementOut.posMasterNoOld = org.result.posMasterNo;
retirementOut.posTypeOldId = org.result.posTypeId;
retirementOut.posTypeNameOld = org.result.posTypeName;
retirementOut.posLevelOldId = org.result.posLevelId;
retirementOut.posLevelNameOld = org.result.posLevelName;
retirementOut.profileId = org.result.profileId;
retirementOut.prefix = org.result.prefix;
retirementOut.firstName = org.result.firstName;
retirementOut.lastName = org.result.lastName;
retirementOut.citizenId = org.result.citizenId;
retirementOut.rootOld = org.result.root;
retirementOut.rootOldId = org.result.rootId;
retirementOut.rootShortNameOld = org.result.rootShortName;
retirementOut.child1Old = org.result.child1;
retirementOut.child1OldId = org.result.child1Id;
retirementOut.child1ShortNameOld = org.result.child1ShortName;
retirementOut.child2Old = org.result.child2;
retirementOut.child2OldId = org.result.child2Id;
retirementOut.child2ShortNameOld = org.result.child2ShortName;
retirementOut.child3Old = org.result.child3;
retirementOut.child3OldId = org.result.child3Id;
retirementOut.child3ShortNameOld = org.result.child3ShortName;
retirementOut.child4Old = org.result.child4;
retirementOut.child4OldId = org.result.child4Id;
retirementOut.child4ShortNameOld = org.result.child4ShortName;
retirementOut.posMasterNoOld = org.result.posMasterNo;
retirementOut.posTypeOldId = org.result.posTypeId;
retirementOut.posTypeNameOld = org.result.posTypeName;
retirementOut.posLevelOldId = org.result.posLevelId;
retirementOut.posLevelNameOld = org.result.posLevelName;
retirementOut.PositionOld = org.result.position;
retirementOut.PositionLevelOld = org.result.posLevelName;
retirementOut.PositionTypeOld = org.result.posTypeName;
retirementOut.PositionNumberOld = org.result.nodeShortName + org.result.posMasterNo;
retirementOut.OrganizationOld = (org.result.child4 == null ? "" : org.result.child4 + "/") +
(org.result.child3 == null ? "" : org.result.child3 + "/") +
(org.result.child2 == null ? "" : org.result.child2 + "/") +
(org.result.child1 == null ? "" : org.result.child1 + "/") +
(org.result.root == null ? "" : org.result.root);
retirementOut.OrganizationPositionOld = org.result.position + "/" + retirementOut.OrganizationOld;
retirementOut.AmountOld = org.result.salary;
retirementOut.PositionOld = org.result.position;
retirementOut.PositionLevelOld = org.result.posLevelName;
retirementOut.PositionTypeOld = org.result.posTypeName;
retirementOut.PositionNumberOld = org.result.nodeShortName + org.result.posMasterNo;
retirementOut.OrganizationOld = (org.result.child4 == null ? "" : org.result.child4 + "/") +
(org.result.child3 == null ? "" : org.result.child3 + "/") +
(org.result.child2 == null ? "" : org.result.child2 + "/") +
(org.result.child1 == null ? "" : org.result.child1 + "/") +
(org.result.root == null ? "" : org.result.root);
retirementOut.OrganizationPositionOld = org.result.position + "/" + retirementOut.OrganizationOld;
retirementOut.AmountOld = org.result.salary;
}
}
else
{
var apiUrl = $"{_configuration["API"]}/org/profile-employee/profileid/position/{req.Id}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
if (org == null || org.result == null)
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
retirementOut.profileId = org.result.profileId;
retirementOut.prefix = org.result.prefix;
retirementOut.firstName = org.result.firstName;
retirementOut.lastName = org.result.lastName;
retirementOut.citizenId = org.result.citizenId;
retirementOut.rootOld = org.result.root;
retirementOut.rootOldId = org.result.rootId;
retirementOut.rootShortNameOld = org.result.rootShortName;
retirementOut.child1Old = org.result.child1;
retirementOut.child1OldId = org.result.child1Id;
retirementOut.child1ShortNameOld = org.result.child1ShortName;
retirementOut.child2Old = org.result.child2;
retirementOut.child2OldId = org.result.child2Id;
retirementOut.child2ShortNameOld = org.result.child2ShortName;
retirementOut.child3Old = org.result.child3;
retirementOut.child3OldId = org.result.child3Id;
retirementOut.child3ShortNameOld = org.result.child3ShortName;
retirementOut.child4Old = org.result.child4;
retirementOut.child4OldId = org.result.child4Id;
retirementOut.child4ShortNameOld = org.result.child4ShortName;
retirementOut.posMasterNoOld = org.result.posMasterNo;
retirementOut.posTypeOldId = org.result.posTypeId;
retirementOut.posTypeNameOld = org.result.posTypeName;
retirementOut.posLevelOldId = org.result.posLevelId;
retirementOut.posLevelNameOld = org.result.posLevelName;
retirementOut.PositionOld = org.result.position;
retirementOut.PositionLevelOld = org.result.posLevelName;
retirementOut.PositionTypeOld = org.result.posTypeName;
retirementOut.PositionNumberOld = org.result.nodeShortName + org.result.posMasterNo;
retirementOut.OrganizationOld = (org.result.child4 == null ? "" : org.result.child4 + "/") +
(org.result.child3 == null ? "" : org.result.child3 + "/") +
(org.result.child2 == null ? "" : org.result.child2 + "/") +
(org.result.child1 == null ? "" : org.result.child1 + "/") +
(org.result.root == null ? "" : org.result.root);
retirementOut.OrganizationPositionOld = org.result.position + "/" + retirementOut.OrganizationOld;
retirementOut.AmountOld = org.result.salary;
}
}
await _context.RetirementOuts.AddAsync(retirementOut);
await _context.SaveChangesAsync();
@ -533,6 +574,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
date = r.commandAffectDate,
amount = r.amount,
commandId = r.commandId,
amountSpecial = r.amountSpecial,
positionSalaryAmount = r.positionSalaryAmount,
mouthSalaryAmount = r.mouthSalaryAmount,
posNo = p.PositionNumberOld,
@ -547,11 +589,20 @@ namespace BMA.EHR.Retirement.Service.Controllers
isLeave = true,
leaveReason = "ให้ออกจากราชการ",
dateLeave = r.commandAffectDate,
isGovernment = false
isGovernment = false,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];
var apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-leave";
if (data.Count > 0)
{
if (data[0].profileType == "EMPLOYEE")
{
apiUrlOrg = $"{baseAPIOrg}/org/command/excexute/salary-employee-leave";
}
}
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));

View file

@ -149,6 +149,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.SendDate,
p.ActiveDate,
p.Reason,
p.ReasonResign,
p.Remark,
p.ApproveReason,
p.RejectReason,
@ -243,6 +244,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.SendDate,
p.ActiveDate,
p.Reason,
p.ReasonResign,
p.Remark,
p.Status,
salary = p.AmountOld,
@ -366,6 +368,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.SendDate,
p.ActiveDate,
p.Reason,
p.ReasonResign,
p.Remark,
p.Status,
salary = p.AmountOld,
@ -458,6 +461,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
data.SendDate,
data.ActiveDate,
data.Reason,
data.ReasonResign,
data.Remark,
data.Status,
data.salary,
@ -873,30 +877,27 @@ namespace BMA.EHR.Retirement.Service.Controllers
[HttpPost()]
public async Task<ActionResult<ResponseObject>> Post([FromForm] RetirementResignRequest req)
{
// var profile = await _context.Profiles
// .Include(x => x.PositionLevel)
// .Include(x => x.PositionType)
// .Include(x => x.PosNo)
// .Include(x => x.Salaries)
// .Include(x => x.Position)
// .Include(x => x.Prefix)
// .FirstOrDefaultAsync(x => x.KeycloakId == Guid.Parse(UserId));
// if (profile == null)
// return Error(GlobalMessages.DataNotFound, 404);
var Remark = req.Remark;
if (req.Reason != null)
{
switch (req.Reason.Trim().ToUpper())
{
case "CAREER": Remark = $"ประกอบอาชีพอื่น" + (req.Remark == null || req.Remark == "" ? $"{req.Remark}" : ""); break;
case "MOVE": Remark = $"รับราชการสังกัดอื่น" + (req.Remark == null || req.Remark == "" ? $"{req.Remark}" : ""); break;
case "FAMILY": Remark = $"ดูแลบิดามารดา" + (req.Remark == null || req.Remark == "" ? $"{req.Remark}" : ""); break;
case "EDUCATION": Remark = $"ศึกษาต่อ" + (req.Remark == null || req.Remark == "" ? $"{req.Remark}" : ""); break;
case "OTHER": Remark = $"อื่น ๆ" + (req.Remark == null || req.Remark == "" ? $"{req.Remark}" : ""); break;
}
}
var retirementResign = new RetirementResign
{
// Profile = profile,
Location = req.Location,
SendDate = DateTime.Now,
ActiveDate = req.ActiveDate,
Reason = req.Reason,
ReasonResign = Remark,
Remark = req.Remark,
// AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
// PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
// PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
// PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
// OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
Status = "WAITTING",
IsActive = true,
CreatedFullName = FullName ?? "System Administrator",
@ -946,7 +947,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
retirementResign.posTypeNameOld = org.result.posTypeName;
retirementResign.posLevelOldId = org.result.posLevelId;
retirementResign.posLevelNameOld = org.result.posLevelName;
retirementResign.AmountOld = org.result.salary;
retirementResign.PositionOld = org.result.position;
retirementResign.PositionLevelOld = org.result.posLevelName;
retirementResign.PositionTypeOld = org.result.posTypeName;
@ -1028,8 +1029,9 @@ namespace BMA.EHR.Retirement.Service.Controllers
updated.Location = req.Location;
updated.ActiveDate = req.ActiveDate;
updated.Reason = req.Reason;
// updated.Reason = req.Reason;
updated.Remark = req.Remark;
updated.ReasonResign = req.Reason;
updated.OrganizationPositionOld = req.OrganizationPositionOld;
updated.RemarkHorizontal = req.RemarkHorizontal;
updated.PositionTypeOld = req.PositionTypeOld;
@ -1180,7 +1182,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
Location = updated.Location,
SendDate = updated.SendDate,
ActiveDate = updated.ActiveDate,
Reason = updated.Reason,
Reason = updated.ReasonResign,
Remark = updated.Remark,
OrganizationPositionOld = updated.OrganizationPositionOld,
PositionTypeOld = updated.PositionTypeOld,
@ -2394,7 +2396,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -2444,6 +2447,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
date = r.commandAffectDate,
amount = r.amount,
commandId = r.commandId,
amountSpecial = r.amountSpecial,
positionSalaryAmount = r.positionSalaryAmount,
mouthSalaryAmount = r.mouthSalaryAmount,
posNo = p.PositionNumberOld,
@ -2459,6 +2463,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
isGovernment = false,
leaveReason = "ออกจากราชการ",
dateLeave = r.commandAffectDate,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];
@ -2577,7 +2583,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -2629,6 +2636,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
date = r.commandAffectDate,
amount = r.amount,
commandId = r.commandId,
amountSpecial = r.amountSpecial,
positionSalaryAmount = r.positionSalaryAmount,
mouthSalaryAmount = r.mouthSalaryAmount,
posNo = p.PositionNumberOld,
@ -2643,6 +2651,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
isLeave = false,
leaveReason = _null,
dateLeave = _null,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];

View file

@ -93,6 +93,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.SendDate,
p.ActiveDate,
p.Reason,
p.ReasonResign,
p.Remark,
p.ApproveReason,
p.RejectReason,
@ -187,6 +188,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.SendDate,
p.ActiveDate,
p.Reason,
p.ReasonResign,
p.Remark,
p.Status,
salary = p.AmountOld,
@ -309,6 +311,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.SendDate,
p.ActiveDate,
p.Reason,
p.ReasonResign,
p.Remark,
p.Status,
salary = p.AmountOld,
@ -401,6 +404,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
data.SendDate,
data.ActiveDate,
data.Reason,
data.ReasonResign,
data.Remark,
data.Status,
data.salary,
@ -816,30 +820,26 @@ namespace BMA.EHR.Retirement.Service.Controllers
[HttpPost()]
public async Task<ActionResult<ResponseObject>> Post([FromForm] RetirementResignEmployeeRequest req)
{
// var profile = await _context.Profiles
// .Include(x => x.PositionLevel)
// .Include(x => x.PositionType)
// .Include(x => x.PosNo)
// .Include(x => x.Salaries)
// .Include(x => x.Position)
// .Include(x => x.Prefix)
// .FirstOrDefaultAsync(x => x.KeycloakId == Guid.Parse(UserId));
// if (profile == null)
// return Error(GlobalMessages.DataNotFound, 404);
var Remark = req.Remark;
if (req.Reason != null)
{
switch (req.Reason.Trim().ToUpper())
{
case "CAREER": Remark = $"ประกอบอาชีพอื่น" + (req.Remark == null || req.Remark == "" ? $"{req.Remark}" : ""); break;
case "MOVE": Remark = $"รับราชการสังกัดอื่น" + (req.Remark == null || req.Remark == "" ? $"{req.Remark}" : ""); break;
case "FAMILY": Remark = $"ดูแลบิดามารดา" + (req.Remark == null || req.Remark == "" ? $"{req.Remark}" : ""); break;
case "EDUCATION": Remark = $"ศึกษาต่อ" + (req.Remark == null || req.Remark == "" ? $"{req.Remark}" : ""); break;
case "OTHER": Remark = $"อื่น ๆ" + (req.Remark == null || req.Remark == "" ? $"{req.Remark}" : ""); break;
}
}
var retirementResignEmployee = new RetirementResignEmployee
{
// Profile = profile,
Location = req.Location,
SendDate = DateTime.Now,
ActiveDate = req.ActiveDate,
Reason = req.Reason,
ReasonResign = Remark,
Remark = req.Remark,
// AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
// PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
// PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
// PositionNumberOld = profile.PosNo == null ? null : profile.PosNo.Name,
// OrganizationPositionOld = profile.Position == null ? profile.Oc : $"{profile.Position.Name}-{profile.Oc}",
Status = "WAITTING",
IsActive = true,
CreatedFullName = FullName ?? "System Administrator",
@ -889,7 +889,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
retirementResignEmployee.posTypeNameOld = org.result.posTypeName;
retirementResignEmployee.posLevelOldId = org.result.posLevelId;
retirementResignEmployee.posLevelNameOld = org.result.posLevelName;
retirementResignEmployee.AmountOld = org.result.salary;
retirementResignEmployee.PositionOld = org.result.position;
retirementResignEmployee.PositionLevelOld = org.result.posLevelName;
retirementResignEmployee.PositionTypeOld = org.result.posTypeName;
@ -971,8 +971,9 @@ namespace BMA.EHR.Retirement.Service.Controllers
updated.Location = req.Location;
updated.ActiveDate = req.ActiveDate;
updated.Reason = req.Reason;
// updated.Reason = req.Reason;
updated.Remark = req.Remark;
updated.ReasonResign = req.Reason;
updated.OrganizationPositionOld = req.OrganizationPositionOld;
updated.RemarkHorizontal = req.RemarkHorizontal;
updated.PositionTypeOld = req.PositionTypeOld;
@ -1123,7 +1124,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
Location = updated.Location,
SendDate = updated.SendDate,
ActiveDate = updated.ActiveDate,
Reason = updated.Reason,
Reason = updated.ReasonResign,
Remark = updated.Remark,
OrganizationPositionOld = updated.OrganizationPositionOld,
PositionTypeOld = updated.PositionTypeOld,
@ -2337,7 +2338,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -2387,6 +2389,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
date = r.commandAffectDate,
amount = r.amount,
commandId = r.commandId,
amountSpecial = r.amountSpecial,
positionSalaryAmount = r.positionSalaryAmount,
mouthSalaryAmount = r.mouthSalaryAmount,
posNo = p.PositionNumberOld,
@ -2402,6 +2405,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
isGovernment = false,
leaveReason = "ออกจากราชการ",
dateLeave = r.commandAffectDate,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];
@ -2520,7 +2525,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
{
result.Add(r);
string? _null = null;
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "") {
if (r.RemarkHorizontal != null && r.RemarkHorizontal != "")
{
result.Add(new
{
No = _null,
@ -2572,6 +2578,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
date = r.commandAffectDate,
amount = r.amount,
commandId = r.commandId,
amountSpecial = r.amountSpecial,
positionSalaryAmount = r.positionSalaryAmount,
mouthSalaryAmount = r.mouthSalaryAmount,
posNo = p.PositionNumberOld,
@ -2586,6 +2593,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
isLeave = false,
leaveReason = _null,
dateLeave = _null,
refCommandCode = r.refCommandCode,
refCommandName = r.refCommandName,
}).ToList();
var baseAPIOrg = _configuration["API"];

View file

@ -101,6 +101,11 @@ var builder = WebApplication.CreateBuilder(args);
var defaultConnection = builder.Configuration.GetConnectionString("DefaultConnection");
builder.Services.AddDbContext<ApplicationDBContext>(options =>
options.UseMySql(defaultConnection, ServerVersion.AutoDetect(defaultConnection)));
// Register DisciplineDbContext
var disciplineConnection = builder.Configuration.GetConnectionString("DisciplineConnection");
builder.Services.AddDbContext<DisciplineDbContext>(options =>
options.UseMySql(disciplineConnection, ServerVersion.AutoDetect(disciplineConnection)));
builder.Services.AddHealthChecks();
// Add Hangfire services.
builder.Services.AddHangfire(configuration => configuration

View file

@ -0,0 +1,24 @@
using BMA.EHR.Domain.Models.MetaData;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Retirement.Service.Requests
{
public class NodeAllRequest
{
public NodeAllResult result { get; set; } = new();
}
public class NodeAllResult
{
public List<NodeAllRequestData> isRootTrue { get; set; } = new();
public List<NodeAllRequestData> isRootFalse { get; set; } = new();
}
public class NodeAllRequestData
{
public string? name { get; set; }
public string? rootId { get; set; }
public string? child1Id { get; set; }
public string? child2Id { get; set; }
public string? child3Id { get; set; }
public string? child4Id { get; set; }
}
}

View file

@ -38,6 +38,7 @@ namespace BMA.EHR.Retirement.Service.Requests
public string? posTypeName { get; set; }
public int? posTypeRank { get; set; }
public string? posLevelId { get; set; }
public string? posTypeShortName { get; set; }
public string? posLevelName { get; set; }
public int? posLevelRank { get; set; }
public string? posExecutiveId { get; set; }

View file

@ -19,5 +19,7 @@ namespace BMA.EHR.Retirement.Service.Requests
public double? amountSpecial { get; set; }
public double? positionSalaryAmount { get; set; }
public double? mouthSalaryAmount { get; set; }
public string? refCommandCode { get; set; }
public string? refCommandName { get; set; }
}
}

View file

@ -6,5 +6,6 @@ namespace BMA.EHR.Retirement.Service.Requests
public class RetirementAddProfileRequest
{
public Guid Id { get; set; }
public string profileType { get; set; }
}
}

View file

@ -11,5 +11,6 @@ namespace BMA.EHR.Retirement.Service.Requests
public string? Location { get; set; }
public string? Reason { get; set; }
public string ProfileId { get; set; }
public string profileType { get; set; }
}
}

View file

@ -10,6 +10,7 @@ namespace BMA.EHR.Retirement.Service.Requests
public DateTime? ActiveDate { get; set; }
public string? Reason { get; set; }
public string? Remark { get; set; }
public string? ReasonResign { get; set; }
public string? OrganizationPositionOld { get; set; }
public string? PositionTypeOld { get; set; }
public string? PositionLevelOld { get; set; }

View file

@ -10,6 +10,7 @@ namespace BMA.EHR.Retirement.Service.Requests
public DateTime? ActiveDate { get; set; }
public string? Reason { get; set; }
public string? Remark { get; set; }
public string? ReasonResign { get; set; }
public string? OrganizationPositionOld { get; set; }
public string? PositionTypeOld { get; set; }
public string? PositionLevelOld { get; set; }

View file

@ -15,7 +15,8 @@
"ConnectionStrings": {
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
// "DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
"DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
"DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
"DisciplineConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_discipline_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
},
"Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",