คำสั่งวินัยบันทึกลงทะเบยีน
This commit is contained in:
parent
6586fe0bab
commit
410db00812
3 changed files with 155 additions and 5 deletions
|
|
@ -2764,7 +2764,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
isProbation = true,
|
||||
isLeave = false,
|
||||
dateRetire = (DateTime?)null,
|
||||
dateAppoint = placementProfile.RecruitDate == null ? (DateTime?)null : placementProfile.RecruitDate,
|
||||
dateAppoint = command.CommandAffectDate == null ? null : command.CommandAffectDate,
|
||||
dateStart = command.CommandAffectDate == null ? null : command.CommandAffectDate,
|
||||
govAgeAbsent = 0,
|
||||
govAgePlus = 0,
|
||||
|
|
@ -5562,6 +5562,10 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
{
|
||||
PersonId = x.RefPlacementProfileId,
|
||||
Id = x.RefDisciplineId,
|
||||
CommandAffectDate = command.CommandAffectDate,
|
||||
CommandNo = command.CommandNo,
|
||||
CommandYear = command.CommandYear.ToInteger().ToThaiYear(),
|
||||
Detail = "คำสั่งลงโทษ ตัดเงินเดือน"
|
||||
});
|
||||
|
||||
var _baseAPI = _configuration["API"];
|
||||
|
|
@ -5710,6 +5714,10 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
{
|
||||
PersonId = x.RefPlacementProfileId,
|
||||
Id = x.RefDisciplineId,
|
||||
CommandAffectDate = command.CommandAffectDate,
|
||||
CommandNo = command.CommandNo,
|
||||
CommandYear = command.CommandYear.ToInteger().ToThaiYear(),
|
||||
Detail = "คำสั่งลงโทษ ตัดเงินเดือน"
|
||||
});
|
||||
|
||||
var _baseAPI = _configuration["API"];
|
||||
|
|
@ -6346,6 +6354,10 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
{
|
||||
PersonId = x.RefPlacementProfileId,
|
||||
Id = x.RefDisciplineId,
|
||||
CommandAffectDate = command.CommandAffectDate,
|
||||
CommandNo = command.CommandNo,
|
||||
CommandYear = command.CommandYear.ToInteger().ToThaiYear(),
|
||||
Detail = "คำสั่งลงโทษ ตัดเงินเดือน"
|
||||
});
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
|
|
@ -6475,6 +6487,10 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
{
|
||||
PersonId = x.RefPlacementProfileId,
|
||||
Id = x.RefDisciplineId,
|
||||
CommandAffectDate = command.CommandAffectDate,
|
||||
CommandNo = command.CommandNo,
|
||||
CommandYear = command.CommandYear.ToInteger().ToThaiYear(),
|
||||
Detail = "คำสั่งลงโทษ ตัดเงินเดือน"
|
||||
});
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
|
|
@ -6605,6 +6621,10 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
{
|
||||
PersonId = x.RefPlacementProfileId,
|
||||
Id = x.RefDisciplineId,
|
||||
CommandAffectDate = command.CommandAffectDate,
|
||||
CommandNo = command.CommandNo,
|
||||
CommandYear = command.CommandYear.ToInteger().ToThaiYear(),
|
||||
Detail = "คำสั่งลงโทษ ตัดเงินเดือน"
|
||||
});
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
|
|
@ -6735,6 +6755,10 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
{
|
||||
PersonId = x.RefPlacementProfileId,
|
||||
Id = x.RefDisciplineId,
|
||||
CommandAffectDate = command.CommandAffectDate,
|
||||
CommandNo = command.CommandNo,
|
||||
CommandYear = command.CommandYear.ToInteger().ToThaiYear(),
|
||||
Detail = "คำสั่งลงโทษ ตัดเงินเดือน"
|
||||
});
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
|
|
@ -6865,6 +6889,10 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
{
|
||||
PersonId = x.RefPlacementProfileId,
|
||||
Id = x.RefDisciplineId,
|
||||
CommandAffectDate = command.CommandAffectDate,
|
||||
CommandNo = command.CommandNo,
|
||||
CommandYear = command.CommandYear.ToInteger().ToThaiYear(),
|
||||
Detail = "คำสั่งลงโทษ ลดขั้นเงินเดือน"
|
||||
});
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
|
|
@ -6995,6 +7023,10 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
{
|
||||
PersonId = x.RefPlacementProfileId,
|
||||
Id = x.RefDisciplineId,
|
||||
CommandAffectDate = command.CommandAffectDate,
|
||||
CommandNo = command.CommandNo,
|
||||
CommandYear = command.CommandYear.ToInteger().ToThaiYear(),
|
||||
Detail = "คำสั่งเพิ่มโทษ"
|
||||
});
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
|
|
@ -7125,6 +7157,10 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
{
|
||||
PersonId = x.RefPlacementProfileId,
|
||||
Id = x.RefDisciplineId,
|
||||
CommandAffectDate = command.CommandAffectDate,
|
||||
CommandNo = command.CommandNo,
|
||||
CommandYear = command.CommandYear.ToInteger().ToThaiYear(),
|
||||
Detail = "คำสั่งงดโทษ"
|
||||
});
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
|
|
@ -7255,6 +7291,10 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
{
|
||||
PersonId = x.RefPlacementProfileId,
|
||||
Id = x.RefDisciplineId,
|
||||
CommandAffectDate = command.CommandAffectDate,
|
||||
CommandNo = command.CommandNo,
|
||||
CommandYear = command.CommandYear.ToInteger().ToThaiYear(),
|
||||
Detail = "คำสั่งยุติเรื่อง"
|
||||
});
|
||||
|
||||
var baseAPI = _configuration["API"];
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ using Microsoft.AspNetCore.Authorization;
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using System.Configuration;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace BMA.EHR.DisciplineResult.Service.Controllers
|
||||
|
|
@ -26,15 +28,18 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
private readonly DisciplineDbContext _context;
|
||||
private readonly MinIODisciplineService _documentService;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
public DisciplineResultController(DisciplineDbContext context,
|
||||
MinIODisciplineService documentService,
|
||||
IHttpContextAccessor httpContextAccessor)
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
// _repository = repository;
|
||||
_context = context;
|
||||
_documentService = documentService;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
#region " Properties "
|
||||
|
|
@ -42,6 +47,7 @@ namespace BMA.EHR.DisciplineResult.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
|
||||
|
||||
|
|
@ -465,6 +471,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
foreach (var d in req.result)
|
||||
{
|
||||
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
|
||||
.Include(x=>x.DisciplineDisciplinary)
|
||||
.Where(x => x.Status == "REPORT")
|
||||
.Where(x => x.Id == d.id)
|
||||
.FirstOrDefaultAsync();
|
||||
|
|
@ -472,6 +479,24 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
{
|
||||
data.Status = "NEW";
|
||||
data.CommandTypeId = null;
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrlDiscipline = $"{baseAPI}org/profile/discipline";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlDiscipline);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlDiscipline, new
|
||||
{
|
||||
profileId = d.personId,
|
||||
date = d.commandAffectDate,
|
||||
detail = data.DisciplineDisciplinary.Title,
|
||||
level = data.DisciplineDisciplinary.DisciplinaryFaultLevel,
|
||||
refCommandDate = "",
|
||||
refCommandNo = $"{d.commandNo}/{d.commandYear}",
|
||||
unStigma = d.detail,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
}
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
|
@ -492,6 +517,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
foreach (var d in req.result)
|
||||
{
|
||||
var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
|
||||
.Include(x => x.DisciplineDisciplinary)
|
||||
.Where(x => x.StatusDiscard == "REPORT")
|
||||
.Where(x => x.Id == d.id)
|
||||
.FirstOrDefaultAsync();
|
||||
|
|
@ -499,6 +525,24 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
{
|
||||
data.StatusDiscard = "NEW";
|
||||
data.CommandTypeDiscardId = null;
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrlDiscipline = $"{baseAPI}org/profile/discipline";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlDiscipline);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlDiscipline, new
|
||||
{
|
||||
profileId = d.personId,
|
||||
date = d.commandAffectDate,
|
||||
detail = data.DisciplineDisciplinary.Title,
|
||||
level = data.DisciplineDisciplinary.DisciplinaryFaultLevel,
|
||||
refCommandDate = "",
|
||||
refCommandNo = $"{d.commandNo}/{d.commandYear}",
|
||||
unStigma = d.detail,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
}
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
|
@ -519,17 +563,58 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
foreach (var d in req.result)
|
||||
{
|
||||
var data1 = await _context.DisciplineInvestigate_ProfileComplaints
|
||||
.Include(x => x.DisciplineInvestigate)
|
||||
.Where(x => x.IsReport == "REPORT")
|
||||
.Where(x => x.Id == d.id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data1 != null)
|
||||
{
|
||||
data1.IsReport = "NEW";
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrlDiscipline = $"{baseAPI}org/profile/discipline";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlDiscipline);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlDiscipline, new
|
||||
{
|
||||
profileId = d.personId,
|
||||
date = d.commandAffectDate,
|
||||
detail = data1.DisciplineInvestigate.Title,
|
||||
level = "",
|
||||
refCommandDate = "",
|
||||
refCommandNo = $"{d.commandNo}/{d.commandYear}",
|
||||
unStigma = d.detail,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
}
|
||||
}
|
||||
var data2 = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
|
||||
.Include(x => x.DisciplineDisciplinary)
|
||||
.Where(x => x.IsReport == "REPORT")
|
||||
.Where(x => x.Id == d.id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data2 != null)
|
||||
data2.IsReport = "NEW";
|
||||
if (data2 != null) {
|
||||
data2.IsReport = "NEW";
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrlDiscipline = $"{baseAPI}org/profile/discipline";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlDiscipline);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlDiscipline, new
|
||||
{
|
||||
profileId = d.personId,
|
||||
date = d.commandAffectDate,
|
||||
detail = data2.DisciplineDisciplinary.Title,
|
||||
level = data2.DisciplineDisciplinary.DisciplinaryFaultLevel,
|
||||
refCommandDate = "",
|
||||
refCommandNo = $"{d.commandNo}/{d.commandYear}",
|
||||
unStigma = d.detail,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
}
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
return Success();
|
||||
|
|
@ -549,11 +634,31 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
|||
foreach (var d in req.result)
|
||||
{
|
||||
var data = await _context.DisciplineReport_Profiles
|
||||
.Include(x => x.DisciplineDisciplinary)
|
||||
.Where(x => x.Status == "REPORT")
|
||||
.Where(x => x.Id == d.id)
|
||||
.FirstOrDefaultAsync();
|
||||
if (data != null)
|
||||
if (data != null) {
|
||||
data.Status = "DONE";
|
||||
var baseAPI = _configuration["API"];
|
||||
var apiUrlDiscipline = $"{baseAPI}org/profile/discipline";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrlDiscipline);
|
||||
var _res = await client.PostAsJsonAsync(apiUrlDiscipline, new
|
||||
{
|
||||
profileId = d.personId,
|
||||
date = d.commandAffectDate,
|
||||
detail = data.DisciplineDisciplinary.Title,
|
||||
level = data.DisciplineDisciplinary.DisciplinaryFaultLevel,
|
||||
refCommandDate = "",
|
||||
refCommandNo = $"{d.commandNo}/{d.commandYear}",
|
||||
unStigma = d.detail,
|
||||
});
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
}
|
||||
}
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
return Success();
|
||||
|
|
|
|||
|
|
@ -13,5 +13,10 @@ namespace BMA.EHR.Discipline.Service.Requests
|
|||
public Guid id { get; set; } = Guid.Empty;
|
||||
public Guid personId { get; set; } = Guid.Empty;
|
||||
public Guid? commandId { get; set; } = Guid.Empty;
|
||||
|
||||
public DateTime? commandAffectDate { get; set; }
|
||||
public string? commandNo { get; set; }
|
||||
public string? commandYear { get; set; }
|
||||
public string? detail { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue