Merge branch 'develop' into working

This commit is contained in:
Suphonchai Phoonsawat 2025-04-21 17:20:17 +07:00
commit cd54079a47
31 changed files with 27955 additions and 181 deletions

View file

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

View file

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

View file

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

View file

@ -756,7 +756,7 @@ namespace BMA.EHR.Application.Repositories
}
}
public GetUserOCIdDto? GetUserOC(Guid keycloakId, string? accessToken)
public async Task<GetUserOCIdDto?> GetUserOC(Guid keycloakId, string? accessToken)
{
try
{
@ -767,15 +767,11 @@ namespace BMA.EHR.Application.Repositories
var apiResult = GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
if (apiResult.Result != null)
{
var raw = JsonConvert.DeserializeObject<GetUserOCIdDto>(apiResult.Result);
var raw = JsonConvert.DeserializeObject<GetUserOCIdResultDto>(apiResult.Result);
return raw;
//if (raw == null || raw.RootId == null)
// return Guid.Empty;
//return raw.RootId;
if (raw != null)
return raw.Result;
}
return null;
}
catch

View file

@ -4,26 +4,27 @@
{
public Guid ProfileId { get; set; }
public string Prefix { get; set; } = string.Empty;
public string? Prefix { get; set; } = string.Empty;
public string Rank { get; set; } = string.Empty;
public string? Rank { get; set; } = string.Empty;
public string Avatar { get; set; } = string.Empty;
public string? Avatar { get; set; } = string.Empty;
public string FirstName { get; set; } = string.Empty;
public string? FirstName { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty;
public string? LastName { get; set; } = string.Empty;
public string CitizenId { get; set; } = string.Empty;
public string? CitizenId { get; set; } = string.Empty;
public DateTime BirthDate { get; set; } = DateTime.MinValue;
public DateTime? BirthDate { get; set; } = DateTime.MinValue;
public string Position { get; set; } = string.Empty;
public string? Position { get; set; } = string.Empty;
public Guid RootId { get; set; }
public Guid? RootDnaId { get; set; }
public string Root { get; set; } = string.Empty;
public string? Root { get; set; } = string.Empty;
public string RootShortName { get; set; } = string.Empty;
public string? RootShortName { get; set; } = string.Empty;
}
}

View file

@ -33,12 +33,14 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
private readonly NotificationRepository _repositoryNoti;
private readonly PermissionRepository _permission;
private readonly IConfiguration _configuration;
private readonly UserProfileRepository _userProfileRepository;
public DisciplineComplaintController(DisciplineDbContext context,
MinIODisciplineService documentService,
NotificationRepository repositoryNoti,
IHttpContextAccessor httpContextAccessor,
IConfiguration configuration,
UserProfileRepository userProfileRepository,
PermissionRepository permission)
{
// _repository = repository;
@ -48,6 +50,7 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
_repositoryNoti = repositoryNoti;
_permission = permission;
_configuration = configuration;
_userProfileRepository = userProfileRepository;
}
#region " Properties "
@ -299,6 +302,11 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
var profile = await _userProfileRepository.GetUserOC(userId, token.Replace("Bearer ", ""));
if (profile == null)
return Error(GlobalMessages.DataNotFound);
var disciplineComplaint = new Domain.Models.Discipline.DisciplineComplaint
{
RespondentType = req.respondentType.Trim().ToUpper(),
@ -310,6 +318,7 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
Title = req.title,
Description = req.description,
DateReceived = req.dateReceived,
RootDnaId = profile.RootDnaId,
LevelConsideration = req.levelConsideration == null ? null : req.levelConsideration.Trim().ToUpper(),
DateConsideration = req.dateConsideration,
OffenseDetails = req.offenseDetails == null ? null : req.offenseDetails.Trim().ToUpper(),
@ -582,6 +591,7 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
{
RespondentType = data.RespondentType.Trim().ToUpper(),
Organization = data.Organization,
RootDnaId = data.RootDnaId,
ConsideredAgency = data.ConsideredAgency,
OrganizationId = data.OrganizationId,
ConsideredAgencyId = data.ConsideredAgencyId,

View file

@ -29,10 +29,12 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
private readonly MinIOService _documentService;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly PermissionRepository _permission;
private readonly UserProfileRepository _userProfileRepository;
public DisciplineDirectorController(DisciplineDbContext context,
MinIOService documentService,
IHttpContextAccessor httpContextAccessor,
UserProfileRepository userProfileRepository,
PermissionRepository permission)
{
// _repository = repository;
@ -40,6 +42,7 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
_documentService = documentService;
_httpContextAccessor = httpContextAccessor;
_permission = permission;
_userProfileRepository = userProfileRepository;
}
#region " Properties "
@ -47,6 +50,7 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
private string? token => _httpContextAccessor.HttpContext.Request.Headers["Authorization"];
#endregion
@ -279,7 +283,13 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
if (director == null)
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
var profile = await _userProfileRepository.GetUserOC(userId, token.Replace("Bearer ", ""));
if (profile == null)
return Error(GlobalMessages.DataNotFound);
var data = await _context.DisciplineInvestigates
.Where(x => x.RootDnaId == profile.RootDnaId || x.RootDnaId == null)
.Where(x => x.DisciplineInvestigate_Directors
.Where(x => x.DisciplineDirector == director)
.FirstOrDefault() != null
@ -316,7 +326,13 @@ namespace BMA.EHR.DisciplineDirector.Service.Controllers
if (director == null)
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(userId, token.Replace("Bearer ", ""));
if (profile == null)
return Error(GlobalMessages.DataNotFound);
var data = await _context.DisciplineDisciplinarys
.Where(x => x.RootDnaId == profile.RootDnaId || x.RootDnaId == null)
.Where(x => x.DisciplineDisciplinary_DirectorInvestigates
.Where(x => x.DisciplineDirector == director)
.FirstOrDefault() != null

View file

@ -1561,7 +1561,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
foreach (var item in req.Id)
foreach (var item in req.id)
{
var uppdated = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.FirstOrDefaultAsync(x => x.Id == item);

View file

@ -366,6 +366,9 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
posLevelName = p.posLevelName,
IsSend = p.IsReport,
DocumentReject = p.DocumentReject,
disciplineRejectDoc = new List<dynamic>(),
RemarkReject = p.RemarkReject,
IsDisciplinary = p.IsDisciplinary,
profileType = p.profileType,
CreatedAt = p.CreatedAt,
@ -403,6 +406,23 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
};
disciplineInvestigateRelevantDocs.Add(_doc);
}
var persons = new List<dynamic>();
foreach (var doc in _data.Persons)
{
if (doc.DocumentReject != null)
{
var _doc = new
{
doc.DocumentReject.Id,
doc.DocumentReject.FileName,
PathName = await _documentService.ImagesPath(doc.DocumentReject.Id)
};
doc.disciplineRejectDoc.Add(_doc);
}
persons.Add(doc);
}
var data = new
{
_data.Id,
@ -421,7 +441,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
_data.Result,
_data.Director,
_data.RespondentType,
_data.Persons,
persons,
_data.Organization,
_data.OrganizationId,
disciplineInvestigateDocs,
@ -660,6 +680,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
{
RespondentType = data.RespondentType.Trim().ToUpper(),
Organization = data.Organization,
RootDnaId = data.RootDnaId,
ConsideredAgency = data.ConsideredAgency,
OrganizationId = data.OrganizationId,
ConsideredAgencyId = data.ConsideredAgencyId,
@ -1165,20 +1186,35 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("report")]
// [HttpPut("report/{commandTypeId:length(36)}")]
public async Task<ActionResult<ResponseObject>> PostToReport([FromBody] DisciplineProfileRequest req)
public async Task<ActionResult<ResponseObject>> PostToReport([FromForm] DisciplineProfileRequest req)
{
foreach (var item in req.Id)
foreach (var item in req.id)
{
var uppdated = await _context.DisciplineInvestigate_ProfileComplaints
.FirstOrDefaultAsync(x => x.Id == item);
if (uppdated == null)
continue;
// uppdated.CommandTypeId = commandTypeId;
uppdated.IsReport = "REPORT";
uppdated.IsReport = "DONE";
uppdated.RemarkReject = req.remark;
uppdated.LastUpdateFullName = FullName ?? "System Administrator";
uppdated.LastUpdateUserId = UserId ?? "";
uppdated.LastUpdatedAt = DateTime.Now;
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
{
foreach (var file in Request.Form.Files)
{
var fileExtension = Path.GetExtension(file.FileName);
var doc = await _documentService.UploadFileAsync(file, file.FileName);
var _doc = await _context.Documents.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == doc.Id);
if (_doc != null)
{
uppdated.DocumentReject = _doc;
}
}
}
}
await _context.SaveChangesAsync();

View file

@ -89,21 +89,149 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
// profile = profile.Where(x => x.PositionType == req.posType || x.PositionLevel == req.posLevel).ToList();
//}
var data_search = await _context.DisciplineDisciplinarys
.Include(x => x.DisciplineDisciplinary_ProfileComplaintInvestigates)
var data_search1 = await _context.DisciplineComplaints
.Include(x => x.DisciplineComplaint_Profiles)
.Where(x => req.status.Trim().ToUpper() == "ALL" ? true : (x.Status != null && x.Status.Contains(req.status.Trim().ToUpper())))
.Where(x => req.offenseDetail.Trim().ToUpper() == "ALL" ? true : (x.OffenseDetails != null && x.OffenseDetails.Contains(req.status.Trim().ToUpper())))
// .Where(x => req.disciplinaryFaultLevel.Trim().ToUpper() == "ALL" ? true : (x.DisciplinaryFaultLevel != null && x.DisciplinaryFaultLevel.Contains(req.status.Trim().ToUpper())))
.OrderByDescending(x => x.CreatedAt)
.ToListAsync();
if (req.status.Trim().ToUpper() != "ALL")
data_search = data_search.Where(x => x.Status != null && x.Status.Contains(req.status.Trim().ToUpper())).ToList();
var mapData1 = data_search1
.SelectMany((d) => d.DisciplineComplaint_Profiles.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 = "",
Child4Id = profile.child4DnaId,
Child4 = profile.child4,
Child3Id = profile.child3DnaId,
Child3 = profile.child3,
Child2Id = profile.child2DnaId,
Child2 = profile.child2,
Child1Id = profile.child1DnaId,
Child1 = profile.child1,
RootId = profile.rootDnaId,
Root = profile.root,
PosType = profile.posTypeName,
PosLevel = profile.posLevelName
}))
.Where(x => req.node == 4 ? x.Child4Id == req.nodeId : (req.node == 3 ? x.Child3Id == req.nodeId : (req.node == 2 ? x.Child2Id == req.nodeId : (req.node == 1 ? x.Child1Id == req.nodeId : (req.node == 0 ? x.RootId == req.nodeId : (req.node == null ? true : true))))))
.Where(x => jsonData["result"] == "OWNER" || jsonData["result"] == "CHILD" ? true : (req.node == 0 ? x.Child1Id == null : (req.node == 1 ? x.Child2Id == null : (req.node == 2 ? x.Child3Id == null : (req.node == 3 ? x.Child4Id == null : true)))))
.Where(x => string.IsNullOrEmpty(req.posType) || x.PosType == req.posType)
.Where(x => string.IsNullOrEmpty(req.posLevel) || x.PosLevel == req.posLevel)
.OrderByDescending(x => x.CreatedAt)
.ToList();
var groupedResult1 = mapData1
.GroupBy(x => x.fullName)
.Select(g => new
{
one = g.Count(), // Count of records per fullName
two = 0,
three = 0,
g.Where(x => x.fullName != null || x.fullName != "").FirstOrDefault()?.fullName,
g.Where(x => x.citizenId != null || x.citizenId != "").FirstOrDefault()?.citizenId,
g.Where(x => x.position != null || x.position != "").FirstOrDefault()?.position,
g.Where(x => x.posLevel != null || x.posLevel != "").FirstOrDefault()?.posLevel,
oc = (g.Where(x => x.Child4 != null || x.Child4 != "").FirstOrDefault()?.Child4 == null ? "" : g.Where(x => x.Child4 != null || x.Child4 != "").FirstOrDefault()?.Child4 + "\n") +
(g.Where(x => x.Child3 != null || x.Child3 != "").FirstOrDefault()?.Child3 == null ? "" : g.Where(x => x.Child3 != null || x.Child3 != "").FirstOrDefault()?.Child3 + "\n") +
(g.Where(x => x.Child2 != null || x.Child2 != "").FirstOrDefault()?.Child2 == null ? "" : g.Where(x => x.Child2 != null || x.Child2 != "").FirstOrDefault()?.Child2 + "\n") +
(g.Where(x => x.Child1 != null || x.Child1 != "").FirstOrDefault()?.Child1 == null ? "" : g.Where(x => x.Child1 != null || x.Child1 != "").FirstOrDefault()?.Child1 + "\n") +
(g.Where(x => x.Root != null || x.Root != "").FirstOrDefault()?.Root == null ? "" : g.Where(x => x.Root != null || x.Root != "").FirstOrDefault()?.Root),
g.Where(x => x.offense != null || x.offense != "").FirstOrDefault()?.offense,
g.Where(x => x.faultLevel != null || x.faultLevel != "").FirstOrDefault()?.faultLevel,
})
.ToList();
if (req.offenseDetail.Trim().ToUpper() != "ALL")
data_search = data_search.Where(x => x.OffenseDetails != null && x.OffenseDetails.Contains(req.status.Trim().ToUpper())).ToList();
var data_search2 = await _context.DisciplineInvestigates
.Include(x => x.DisciplineInvestigate_ProfileComplaints)
.Where(x => req.status.Trim().ToUpper() == "ALL" ? true : (x.Status != null && x.Status.Contains(req.status.Trim().ToUpper())))
.Where(x => req.offenseDetail.Trim().ToUpper() == "ALL" ? true : (x.OffenseDetails != null && x.OffenseDetails.Contains(req.status.Trim().ToUpper())))
// .Where(x => req.disciplinaryFaultLevel.Trim().ToUpper() == "ALL" ? true : (x.DisciplinaryFaultLevel != null && x.DisciplinaryFaultLevel.Contains(req.status.Trim().ToUpper())))
.OrderByDescending(x => x.CreatedAt)
.ToListAsync();
if (req.disciplinaryFaultLevel.Trim().ToUpper() != "ALL")
data_search = data_search.Where(x => x.DisciplinaryFaultLevel != null && x.DisciplinaryFaultLevel.Contains(req.status.Trim().ToUpper())).ToList();
var mapData2 = data_search2
.SelectMany((d) => d.DisciplineInvestigate_ProfileComplaints.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 = "",
Child4Id = profile.child4DnaId,
Child4 = profile.child4,
Child3Id = profile.child3DnaId,
Child3 = profile.child3,
Child2Id = profile.child2DnaId,
Child2 = profile.child2,
Child1Id = profile.child1DnaId,
Child1 = profile.child1,
RootId = profile.rootDnaId,
Root = profile.root,
PosType = profile.posTypeName,
PosLevel = profile.posLevelName
}))
.Where(x => req.node == 4 ? x.Child4Id == req.nodeId : (req.node == 3 ? x.Child3Id == req.nodeId : (req.node == 2 ? x.Child2Id == req.nodeId : (req.node == 1 ? x.Child1Id == req.nodeId : (req.node == 0 ? x.RootId == req.nodeId : (req.node == null ? true : true))))))
.Where(x => jsonData["result"] == "OWNER" || jsonData["result"] == "CHILD" ? true : (req.node == 0 ? x.Child1Id == null : (req.node == 1 ? x.Child2Id == null : (req.node == 2 ? x.Child3Id == null : (req.node == 3 ? x.Child4Id == null : true)))))
.Where(x => string.IsNullOrEmpty(req.posType) || x.PosType == req.posType)
.Where(x => string.IsNullOrEmpty(req.posLevel) || x.PosLevel == req.posLevel)
.OrderByDescending(x => x.CreatedAt)
.ToList();
var groupedResult2 = mapData2
.GroupBy(x => x.fullName)
.Select(g => new
{
one = 0,
two = g.Count(), // Count of records per fullName
three = 0,
g.Where(x => x.fullName != null || x.fullName != "").FirstOrDefault()?.fullName,
g.Where(x => x.citizenId != null || x.citizenId != "").FirstOrDefault()?.citizenId,
g.Where(x => x.position != null || x.position != "").FirstOrDefault()?.position,
g.Where(x => x.posLevel != null || x.posLevel != "").FirstOrDefault()?.posLevel,
oc = (g.Where(x => x.Child4 != null || x.Child4 != "").FirstOrDefault()?.Child4 == null ? "" : g.Where(x => x.Child4 != null || x.Child4 != "").FirstOrDefault()?.Child4 + "\n") +
(g.Where(x => x.Child3 != null || x.Child3 != "").FirstOrDefault()?.Child3 == null ? "" : g.Where(x => x.Child3 != null || x.Child3 != "").FirstOrDefault()?.Child3 + "\n") +
(g.Where(x => x.Child2 != null || x.Child2 != "").FirstOrDefault()?.Child2 == null ? "" : g.Where(x => x.Child2 != null || x.Child2 != "").FirstOrDefault()?.Child2 + "\n") +
(g.Where(x => x.Child1 != null || x.Child1 != "").FirstOrDefault()?.Child1 == null ? "" : g.Where(x => x.Child1 != null || x.Child1 != "").FirstOrDefault()?.Child1 + "\n") +
(g.Where(x => x.Root != null || x.Root != "").FirstOrDefault()?.Root == null ? "" : g.Where(x => x.Root != null || x.Root != "").FirstOrDefault()?.Root),
g.Where(x => x.offense != null || x.offense != "").FirstOrDefault()?.offense,
g.Where(x => x.faultLevel != null || x.faultLevel != "").FirstOrDefault()?.faultLevel,
})
.ToList();
var mapData = data_search
var data_search3 = await _context.DisciplineDisciplinarys
.Include(x => x.DisciplineDisciplinary_ProfileComplaintInvestigates)
.Where(x => req.status.Trim().ToUpper() == "ALL" ? true : (x.Status != null && x.Status.Contains(req.status.Trim().ToUpper())))
.Where(x => req.offenseDetail.Trim().ToUpper() == "ALL" ? true : (x.OffenseDetails != null && x.OffenseDetails.Contains(req.status.Trim().ToUpper())))
.Where(x => req.disciplinaryFaultLevel.Trim().ToUpper() == "ALL" ? true : (x.DisciplinaryFaultLevel != null && x.DisciplinaryFaultLevel.Contains(req.status.Trim().ToUpper())))
.OrderByDescending(x => x.CreatedAt)
.ToListAsync();
var mapData3 = data_search3
.SelectMany((d) => d.DisciplineDisciplinary_ProfileComplaintInvestigates.Select((profile) => new
{
fullName = $"{profile.Prefix}{profile.FirstName} {profile.LastName}",
@ -122,31 +250,68 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
: ""
: "",
faultLevel = d.DisciplinaryFaultLevel,
Child4Id = profile.child4Id,
Child4Id = profile.child4DnaId,
Child4 = profile.child4,
Child3Id = profile.child3Id,
Child3Id = profile.child3DnaId,
Child3 = profile.child3,
Child2Id = profile.child2Id,
Child2Id = profile.child2DnaId,
Child2 = profile.child2,
Child1Id = profile.child1Id,
Child1Id = profile.child1DnaId,
Child1 = profile.child1,
RootId = profile.rootId,
RootId = profile.rootDnaId,
Root = profile.root,
PosType = profile.posTypeName,
PosLevel = profile.posLevelName
}))
//.Where(x =>
// x.citizenId != null && profile.Any(p => p.CitizenId == x.citizenId))
.Where(x => req.node == 4 ? x.Child4Id == req.nodeId : (req.node == 3 ? x.Child3Id == req.nodeId : (req.node == 2 ? x.Child2Id == req.nodeId : (req.node == 1 ? x.Child1Id == req.nodeId : (req.node == 0 ? x.RootId == req.nodeId : (req.node == null ? true : true))))))
.Where(x => jsonData["result"] == "OWNER" || jsonData["result"] == "CHILD" ? true : (req.node == 0 ? x.Child1Id == null : (req.node == 1 ? x.Child2Id == null : (req.node == 2 ? x.Child3Id == null : (req.node == 3 ? x.Child4Id == null : true)))))
.Where(x => string.IsNullOrEmpty(req.posType) || x.PosType == req.posType)
.Where(x => string.IsNullOrEmpty(req.posLevel) || x.PosLevel == req.posLevel)
.Where(x => req.node == 4 ? x.Child4Id == req.nodeId : (req.node == 3 ? x.Child3Id == req.nodeId : (req.node == 2 ? x.Child2Id == req.nodeId : (req.node == 1 ? x.Child1Id == req.nodeId : (req.node == 0 ? x.RootId == req.nodeId : (req.node == null ? true : true))))))
.Where(x => jsonData["result"] == "OWNER" || jsonData["result"] == "CHILD" ? true : (req.node == 0 ? x.Child1Id == null : (req.node == 1 ? x.Child2Id == null : (req.node == 2 ? x.Child3Id == null : (req.node == 3 ? x.Child4Id == null : true)))))
.Where(x => string.IsNullOrEmpty(req.posType) || x.PosType == req.posType)
.Where(x => string.IsNullOrEmpty(req.posLevel) || x.PosLevel == req.posLevel)
.OrderByDescending(x => x.CreatedAt)
.ToList();
var groupedResult3 = mapData3
.GroupBy(x => x.fullName)
.Select(g => new
{
one = 0,
two = 0,
three = g.Count(), // Count of records per fullName
g.Where(x => x.fullName != null || x.fullName != "").FirstOrDefault()?.fullName,
g.Where(x => x.citizenId != null || x.citizenId != "").FirstOrDefault()?.citizenId,
g.Where(x => x.position != null || x.position != "").FirstOrDefault()?.position,
g.Where(x => x.posLevel != null || x.posLevel != "").FirstOrDefault()?.posLevel,
oc = (g.Where(x => x.Child4 != null || x.Child4 != "").FirstOrDefault()?.Child4 == null ? "" : g.Where(x => x.Child4 != null || x.Child4 != "").FirstOrDefault()?.Child4 + "\n") +
(g.Where(x => x.Child3 != null || x.Child3 != "").FirstOrDefault()?.Child3 == null ? "" : g.Where(x => x.Child3 != null || x.Child3 != "").FirstOrDefault()?.Child3 + "\n") +
(g.Where(x => x.Child2 != null || x.Child2 != "").FirstOrDefault()?.Child2 == null ? "" : g.Where(x => x.Child2 != null || x.Child2 != "").FirstOrDefault()?.Child2 + "\n") +
(g.Where(x => x.Child1 != null || x.Child1 != "").FirstOrDefault()?.Child1 == null ? "" : g.Where(x => x.Child1 != null || x.Child1 != "").FirstOrDefault()?.Child1 + "\n") +
(g.Where(x => x.Root != null || x.Root != "").FirstOrDefault()?.Root == null ? "" : g.Where(x => x.Root != null || x.Root != "").FirstOrDefault()?.Root),
g.Where(x => x.offense != null || x.offense != "").FirstOrDefault()?.offense,
g.Where(x => x.faultLevel != null || x.faultLevel != "").FirstOrDefault()?.faultLevel,
})
.ToList();
var resultSum = groupedResult1.Concat(groupedResult2).Concat(groupedResult3).ToArray();
var groupedResult = resultSum
.GroupBy(x => x.fullName)
.Select(g => new
{
// g.Where(x => x.no != null || x.no != "").FirstOrDefault()?.no,
g.Where(x => x.fullName != null || x.fullName != "").FirstOrDefault()?.fullName,
g.Where(x => x.citizenId != null || x.citizenId != "").FirstOrDefault()?.citizenId,
g.Where(x => x.position != null || x.position != "").FirstOrDefault()?.position,
g.Where(x => x.posLevel != null || x.posLevel != "").FirstOrDefault()?.posLevel,
g.Where(x => x.oc != null || x.oc != "").FirstOrDefault()?.oc,
g.Where(x => x.offense != null || x.offense != "").FirstOrDefault()?.offense,
g.Where(x => x.faultLevel != null || x.faultLevel != "").FirstOrDefault()?.faultLevel,
one = g.Sum(x => x.one), // Replace `score` with actual field name
two = g.Sum(x => x.two), // Replace `score` with actual field name
three = g.Sum(x => x.three), // Replace `score` with actual field name
})
.OrderBy(x => x.citizenId)
.ToList();
var resultMap = new List<dynamic>();
var count = 1;
var employees = new List<dynamic>();
foreach (var p in mapData)
foreach (var p in groupedResult)
{
var emp = new
{
@ -155,21 +320,16 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
citizenId = p.citizenId,
position = p.position,
posLevel = p.posLevel,
oc = (p.Child4 == null ? "" : p.Child4 + "\n") +
(p.Child3 == null ? "" : p.Child3 + "\n") +
(p.Child2 == null ? "" : p.Child2 + "\n") +
(p.Child1 == null ? "" : p.Child1 + "\n") +
(p.Root == null ? "" : p.Root),
oc = p.oc,
offense = p.offense,
faultLevel = p.faultLevel,
one = 0,
two = 0,
three = 0,
one = p.one,
two = p.two,
three = p.three,
};
employees.Add(emp);
resultMap.Add(emp);
count++;
}
var result = new
{
template = "reportDiscipline",
@ -178,7 +338,7 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
{
year = (req.year + 543).ToString().ToThaiNumber(),
dateCurrent = $"ณ วันที่ {DateTime.Now.Date.ToThaiShortDate().ToThaiNumber()}",
data = employees
data = resultMap
}
};
return Success(result);

View file

@ -194,6 +194,8 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
Status = p.Status,
StatusDiscard = p.StatusDiscard,
profileType = p.profileType,
Remark = p.Remark,
Offense = p.Offense,
CreatedAt = p.CreatedAt
}),//รายการข้อมูลบุคลผู้ถูกสืบสวน
Organization = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
@ -840,7 +842,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
orgChild2 = p.child2,
orgChild3 = p.child3,
orgChild4 = p.child4,
posNo = p.posMasterNo,
posNo = p.posMasterNo != null ? p.posMasterNo.ToString() : null,
posNoAbb = p.child4ShortName != null ? p.child4ShortName : (p.child3ShortName != null ? p.child3ShortName : (p.child2ShortName != null ? p.child2ShortName : (p.child1ShortName != null ? p.child1ShortName : (p.child4ShortName != null ? p.child4ShortName : "")))),
}).ToList();
@ -976,7 +978,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
orgChild2 = p.child2,
orgChild3 = p.child3,
orgChild4 = p.child4,
posNo = p.posMasterNo,
posNo = p.posMasterNo != null ? p.posMasterNo.ToString() : null,
posNoAbb = p.child4ShortName != null ? p.child4ShortName : (p.child3ShortName != null ? p.child3ShortName : (p.child2ShortName != null ? p.child2ShortName : (p.child1ShortName != null ? p.child1ShortName : (p.child4ShortName != null ? p.child4ShortName : "")))),
}).ToList();
@ -1190,7 +1192,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
orgChild2 = p.child2,
orgChild3 = p.child3,
orgChild4 = p.child4,
posNo = p.posMasterNo,
posNo = p.posMasterNo != null ? p.posMasterNo.ToString() : null,
posNoAbb = p.child4ShortName != null ? p.child4ShortName : (p.child3ShortName != null ? p.child3ShortName : (p.child2ShortName != null ? p.child2ShortName : (p.child1ShortName != null ? p.child1ShortName : (p.child4ShortName != null ? p.child4ShortName : "")))),
}).ToList();
@ -1315,7 +1317,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
orgChild2 = p.child2,
orgChild3 = p.child3,
orgChild4 = p.child4,
posNo = p.posMasterNo,
posNo = p.posMasterNo != null ? p.posMasterNo.ToString() : null,
posNoAbb = p.child4ShortName != null ? p.child4ShortName : (p.child3ShortName != null ? p.child3ShortName : (p.child2ShortName != null ? p.child2ShortName : (p.child1ShortName != null ? p.child1ShortName : (p.child4ShortName != null ? p.child4ShortName : "")))),
}).ToList();
@ -1438,7 +1440,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
orgChild2 = p.child2,
orgChild3 = p.child3,
orgChild4 = p.child4,
posNo = p.posMasterNo,
posNo = p.posMasterNo != null ? p.posMasterNo.ToString() : null,
posNoAbb = p.child4ShortName != null ? p.child4ShortName : (p.child3ShortName != null ? p.child3ShortName : (p.child2ShortName != null ? p.child2ShortName : (p.child1ShortName != null ? p.child1ShortName : (p.child4ShortName != null ? p.child4ShortName : "")))),
}).ToList();
@ -1561,7 +1563,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
orgChild2 = p.child2,
orgChild3 = p.child3,
orgChild4 = p.child4,
posNo = p.posMasterNo,
posNo = p.posMasterNo != null ? p.posMasterNo.ToString() : null,
posNoAbb = p.child4ShortName != null ? p.child4ShortName : (p.child3ShortName != null ? p.child3ShortName : (p.child2ShortName != null ? p.child2ShortName : (p.child1ShortName != null ? p.child1ShortName : (p.child4ShortName != null ? p.child4ShortName : "")))),
}).ToList();
@ -1684,7 +1686,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
orgChild2 = p.child2,
orgChild3 = p.child3,
orgChild4 = p.child4,
posNo = p.posMasterNo,
posNo = p.posMasterNo != null ? p.posMasterNo.ToString() : null,
posNoAbb = p.child4ShortName != null ? p.child4ShortName : (p.child3ShortName != null ? p.child3ShortName : (p.child2ShortName != null ? p.child2ShortName : (p.child1ShortName != null ? p.child1ShortName : (p.child4ShortName != null ? p.child4ShortName : "")))),
}).ToList();
@ -1807,7 +1809,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
orgChild2 = p.child2,
orgChild3 = p.child3,
orgChild4 = p.child4,
posNo = p.posMasterNo,
posNo = p.posMasterNo != null ? p.posMasterNo.ToString() : null,
posNoAbb = p.child4ShortName != null ? p.child4ShortName : (p.child3ShortName != null ? p.child3ShortName : (p.child2ShortName != null ? p.child2ShortName : (p.child1ShortName != null ? p.child1ShortName : (p.child4ShortName != null ? p.child4ShortName : "")))),
}).ToList();
@ -1930,7 +1932,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
orgChild2 = p.child2,
orgChild3 = p.child3,
orgChild4 = p.child4,
posNo = p.posMasterNo,
posNo = p.posMasterNo != null ? p.posMasterNo.ToString() : null,
posNoAbb = p.child4ShortName != null ? p.child4ShortName : (p.child3ShortName != null ? p.child3ShortName : (p.child2ShortName != null ? p.child2ShortName : (p.child1ShortName != null ? p.child1ShortName : (p.child4ShortName != null ? p.child4ShortName : "")))),
}).ToList();
@ -2069,7 +2071,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
orgChild2 = p.child2,
orgChild3 = p.child3,
orgChild4 = p.child4,
posNo = p.posMasterNo,
posNo = p.posMasterNo != null ? p.posMasterNo.ToString() : null,
posNoAbb = p.child4ShortName != null ? p.child4ShortName : (p.child3ShortName != null ? p.child3ShortName : (p.child2ShortName != null ? p.child2ShortName : (p.child1ShortName != null ? p.child1ShortName : (p.child4ShortName != null ? p.child4ShortName : "")))),
}).ToList();
@ -2141,5 +2143,35 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
return Success();
}
/// <summary>
/// แก้ไขฐานความผิดรายบุคคล
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("summary/{id:guid}")]
public async Task<ActionResult<ResponseObject>> UpdateSummaryDisciplineResult([FromBody] DisciplineResultSummaryRequest req, Guid id)
{
var getPermission = await _permission.GetPermissionAPIAsync("UPDATE", "SYS_DISCIPLINE_RESULT");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates.Where(x => x.Id == id).FirstOrDefaultAsync();
if (data == null)
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
data.Remark = req.remark;
data.Offense = req.offense;
data.LastUpdateFullName = FullName ?? "System Administrator";
data.LastUpdateUserId = UserId ?? "";
data.LastUpdatedAt = DateTime.Now;
await _context.SaveChangesAsync();
return Success(data.Id);
}
}
}

View file

@ -288,7 +288,7 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
foreach (var item in req.Id)
foreach (var item in req.id)
{
var uppdated = await _context.DisciplineReport_Profiles
.FirstOrDefaultAsync(x => x.Id == item);

View file

@ -0,0 +1,10 @@
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Discipline.Service.Requests
{
public class DisciplineResultSummaryRequest
{
public string? remark { get; set; }
public string? offense { get; set; }
}
}

View file

@ -5,6 +5,8 @@ namespace BMA.EHR.Discipline.Service.Requests
{
public class DisciplineProfileRequest
{
public List<Guid> Id { get; set; }
public List<Guid> id { get; set; }
public FormFile? file { get; set; }
public string? remark { get; set; }
}
}

View file

@ -58,6 +58,9 @@ namespace BMA.EHR.Domain.Models.Discipline
[Comment("version หน่วยงาน")]
public string? activeId { get; set; }
[Comment("RootDnaId")]
public Guid? RootDnaId { get; set; }
public virtual List<DisciplineComplaint_Profile> DisciplineComplaint_Profiles { get; set; } = new List<DisciplineComplaint_Profile>();
public virtual List<DisciplineComplaint_Doc> DisciplineComplaint_Docs { get; set; } = new List<DisciplineComplaint_Doc>();
public virtual List<DisciplineInvestigate> DisciplineInvestigates { get; set; } = new List<DisciplineInvestigate>();

View file

@ -146,6 +146,9 @@ namespace BMA.EHR.Domain.Models.Discipline
[Comment("ระดับโทษความผิดกรณีอื่นๆ")]
public string? DisciplinaryFaultLevelOther { get; set; }
[Comment("RootDnaId")]
public Guid? RootDnaId { get; set; }
public DisciplineInvestigate DisciplineInvestigate { get; set; }
public virtual List<DisciplineDisciplinary_ProfileComplaintInvestigate> DisciplineDisciplinary_ProfileComplaintInvestigates { get; set; } = new List<DisciplineDisciplinary_ProfileComplaintInvestigate>();
public virtual List<DisciplineDisciplinary_DocComplaintInvestigate> DisciplineDisciplinary_DocComplaintInvestigates { get; set; } = new List<DisciplineDisciplinary_DocComplaintInvestigate>();

View file

@ -100,6 +100,10 @@ namespace BMA.EHR.Domain.Models.Discipline
[Comment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)")]
public string? profileType { get; set; }
[Comment("ฐานความผิดรายบุคคลหมายเหตุ")]
public string? Remark { get; set; }
[Comment("ฐานความผิดรายบุคคล")]
public string? Offense { get; set; }
[Required, Comment("Id เรื่องสอบสวน")]
public DisciplineDisciplinary DisciplineDisciplinary { get; set; }

View file

@ -89,6 +89,9 @@ namespace BMA.EHR.Domain.Models.Discipline
[Comment("จำนวนวันที่ต้องการขยาย")]
public int? InvestigationDaysExtend { get; set; }
[Comment("RootDnaId")]
public Guid? RootDnaId { get; set; }
public DisciplineComplaint DisciplineComplaint { get; set; }
public virtual List<DisciplineInvestigate_ProfileComplaint> DisciplineInvestigate_ProfileComplaints { get; set; } = new List<DisciplineInvestigate_ProfileComplaint>();
public virtual List<DisciplineInvestigate_DocComplaint> DisciplineInvestigate_DocComplaints { get; set; } = new List<DisciplineInvestigate_DocComplaint>();

View file

@ -81,6 +81,10 @@ namespace BMA.EHR.Domain.Models.Discipline
public double? Salary { get; set; }
[Comment("ส่งไปยุติเรื่อง")]
public string? IsReport { get; set; } = "NEW";
[Comment("หมายเหตุยุติเรื่อง")]
public string? RemarkReject { get; set; }
[Comment("อ้างอิงรหัสเอกสาร")]
public Document? DocumentReject { get; set; }
[Comment("ส่งไปสอบสวน")]
public bool? IsDisciplinary { get; set; } = false;
[Comment("รายการเก่า")]

View file

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

View file

@ -0,0 +1,86 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
{
/// <inheritdoc />
public partial class update_table_disciplineresult_add_remark : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "DocumentRejectId",
table: "DisciplineInvestigate_ProfileComplaints",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<string>(
name: "RemarkReject",
table: "DisciplineInvestigate_ProfileComplaints",
type: "longtext",
nullable: true,
comment: "หมายเหตุยุติเรื่อง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Offense",
table: "DisciplineDisciplinary_ProfileComplaintInvestigates",
type: "longtext",
nullable: true,
comment: "ฐานความผิดรายบุคคล")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Remark",
table: "DisciplineDisciplinary_ProfileComplaintInvestigates",
type: "longtext",
nullable: true,
comment: "ฐานความผิดรายบุคคลหมายเหตุ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_DisciplineInvestigate_ProfileComplaints_DocumentRejectId",
table: "DisciplineInvestigate_ProfileComplaints",
column: "DocumentRejectId");
migrationBuilder.AddForeignKey(
name: "FK_DisciplineInvestigate_ProfileComplaints_Documents_DocumentRe~",
table: "DisciplineInvestigate_ProfileComplaints",
column: "DocumentRejectId",
principalTable: "Documents",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_DisciplineInvestigate_ProfileComplaints_Documents_DocumentRe~",
table: "DisciplineInvestigate_ProfileComplaints");
migrationBuilder.DropIndex(
name: "IX_DisciplineInvestigate_ProfileComplaints_DocumentRejectId",
table: "DisciplineInvestigate_ProfileComplaints");
migrationBuilder.DropColumn(
name: "DocumentRejectId",
table: "DisciplineInvestigate_ProfileComplaints");
migrationBuilder.DropColumn(
name: "RemarkReject",
table: "DisciplineInvestigate_ProfileComplaints");
migrationBuilder.DropColumn(
name: "Offense",
table: "DisciplineDisciplinary_ProfileComplaintInvestigates");
migrationBuilder.DropColumn(
name: "Remark",
table: "DisciplineDisciplinary_ProfileComplaintInvestigates");
}
}
}

View file

@ -0,0 +1,55 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
{
/// <inheritdoc />
public partial class update_table_disciplineresult_add_remark1 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "RootDnaId",
table: "DisciplineInvestigates",
type: "char(36)",
nullable: true,
comment: "RootDnaId",
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "RootDnaId",
table: "DisciplineDisciplinarys",
type: "char(36)",
nullable: true,
comment: "RootDnaId",
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "RootDnaId",
table: "DisciplineComplaints",
type: "char(36)",
nullable: true,
comment: "RootDnaId",
collation: "ascii_general_ci");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "RootDnaId",
table: "DisciplineInvestigates");
migrationBuilder.DropColumn(
name: "RootDnaId",
table: "DisciplineDisciplinarys");
migrationBuilder.DropColumn(
name: "RootDnaId",
table: "DisciplineComplaints");
}
}
}

View file

@ -123,6 +123,10 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
.HasColumnType("longtext")
.HasComment("ผลการตรวจสอบ");
b.Property<Guid?>("RootDnaId")
.HasColumnType("char(36)")
.HasComment("RootDnaId");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("longtext")
@ -1030,6 +1034,10 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
.HasColumnType("int")
.HasComment("ปีงบประมาณ");
b.Property<Guid?>("RootDnaId")
.HasColumnType("char(36)")
.HasComment("RootDnaId");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("longtext")
@ -1851,6 +1859,10 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("Offense")
.HasColumnType("longtext")
.HasComment("ฐานความผิดรายบุคคล");
b.Property<string>("Organization")
.HasColumnType("longtext")
.HasComment("สังกัด");
@ -1871,6 +1883,10 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
.HasColumnType("longtext")
.HasComment("คำนำหน้า");
b.Property<string>("Remark")
.HasColumnType("longtext")
.HasComment("ฐานความผิดรายบุคคลหมายเหตุ");
b.Property<double?>("Salary")
.HasColumnType("double")
.HasComment("เงินเดือน");
@ -2141,6 +2157,10 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
.HasColumnType("longtext")
.HasComment("ผลการตรวจสอบเรื่องร้องเรียน");
b.Property<Guid?>("RootDnaId")
.HasColumnType("char(36)")
.HasComment("RootDnaId");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("longtext")
@ -2531,6 +2551,9 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
b.Property<Guid>("DisciplineInvestigateId")
.HasColumnType("char(36)");
b.Property<Guid?>("DocumentRejectId")
.HasColumnType("char(36)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(100)
@ -2594,6 +2617,10 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
.HasColumnType("longtext")
.HasComment("คำนำหน้า");
b.Property<string>("RemarkReject")
.HasColumnType("longtext")
.HasComment("หมายเหตุยุติเรื่อง");
b.Property<double?>("Salary")
.HasColumnType("double")
.HasComment("เงินเดือน");
@ -2706,6 +2733,8 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
b.HasIndex("DisciplineInvestigateId");
b.HasIndex("DocumentRejectId");
b.ToTable("DisciplineInvestigate_ProfileComplaints");
});
@ -3487,7 +3516,13 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BMA.EHR.Domain.Models.Discipline.Document", "DocumentReject")
.WithMany()
.HasForeignKey("DocumentRejectId");
b.Navigation("DisciplineInvestigate");
b.Navigation("DocumentReject");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Discipline.DisciplineReport_Profile", b =>

View file

@ -1792,6 +1792,7 @@ namespace BMA.EHR.Leave.Service.Controllers
sysName = "SYS_LEAVE_LIST",
posLevelName = profile.PosLevel ?? "",
posTypeName = profile.PosType ?? "",
fullName = $"{profile.Prefix}{profile.FirstName} {profile.LastName}"
});
}
}

View file

@ -1610,7 +1610,7 @@ namespace BMA.EHR.Placement.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
// .Where(x => x.PlacementStatus.ToUpper() == "REPORT")
.ToListAsync();
placementProfiles.ForEach(profile => profile.Status = "PREPARE-CONTAIN");
placementProfiles.ForEach(profile => profile.Status = "PENDING");
await _context.SaveChangesAsync();
return Success();
}

View file

@ -589,6 +589,7 @@ namespace BMA.EHR.Placement.Service.Controllers
sysName = "SYS_TRANSFER_REQ",
posLevelName = placementTransfer.posLevelNameOld,
posTypeName = placementTransfer.posTypeNameOld,
fullName = $"{placementTransfer.prefix}{placementTransfer.firstName} {placementTransfer.lastName}"
});
}
await _context.SaveChangesAsync();

View file

@ -348,7 +348,17 @@ namespace BMA.EHR.Retirement.Service.Controllers
LastUpdateUserId = UserId ?? "",
LastUpdatedAt = DateTime.Now,
};
var apiUrl = $"{_configuration["API"]}/org/profile/profileid/position/{req.Id}";
var apiUrl = string.Empty;
if (req.profileType.Trim().ToUpper() == "EMPLOYEE")
{
apiUrl = $"{_configuration["API"]}/org/profile-employee/profileid/position/{req.Id}";
}
else
{
apiUrl = $"{_configuration["API"]}/org/profile/profileid/position/{req.Id}";
}
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));

View file

@ -343,7 +343,6 @@ namespace BMA.EHR.Retirement.Service.Controllers
.FirstOrDefaultAsync();
if (dataMain == null)
return Error(GlobalMessages.RetirementResignNotFound, 404);
if (dataMain.IsCancel != true)
{
var getWorkflow = await _permission.GetPermissionAPIWorkflowAsync(id.ToString(), "SYS_RESIGN");
@ -515,7 +514,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
var getWorkflow = await _permission.GetPermissionAPIWorkflowAsync(id.ToString(), "RETIREMENT_CANCEL");
var createdUserId = await _context.RetirementResignCancels.AsQueryable()
.Where(x => x.CreatedUserId == UserId)
.Where(x => x.Id == id)
.Where(x => x.RetirementResign.Id == id)
.FirstOrDefaultAsync();
if (getWorkflow == false && createdUserId == null)
{
@ -989,6 +988,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
sysName = "SYS_RESIGN",
posLevelName = retirementResign.PositionLevelOld,
posTypeName = retirementResign.PositionTypeOld,
fullName = $"{retirementResign.prefix}{retirementResign.firstName} {retirementResign.lastName}"
});
}
return Success(retirementResign);