Compare commits
7 commits
leave-dev1
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8425c62c6b | ||
|
|
fe40df025f | ||
|
|
9c9576692a | ||
|
|
122f02ac97 | ||
|
|
bea7960ea7 | ||
|
|
2743edf82f | ||
|
|
dcbb845c0e |
16 changed files with 4259 additions and 17 deletions
|
|
@ -22,6 +22,10 @@
|
||||||
|
|
||||||
public Guid RootId { get; set; }
|
public Guid RootId { get; set; }
|
||||||
public Guid? RootDnaId { get; set; }
|
public Guid? RootDnaId { get; set; }
|
||||||
|
public Guid? Child1DnaId { get; set; }
|
||||||
|
public Guid? Child2DnaId { get; set; }
|
||||||
|
public Guid? Child3DnaId { get; set; }
|
||||||
|
public Guid? Child4DnaId { get; set; }
|
||||||
|
|
||||||
public string? Root { get; set; } = string.Empty;
|
public string? Root { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -125,14 +125,74 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
||||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// กรองสิทธิ์
|
||||||
|
string role = jsonData["result"]?.ToString() ?? "";
|
||||||
|
var profileAdmin = await _userProfileRepository.GetUserOCAll(Guid.Parse(UserId!), token.Replace("Bearer ", ""));
|
||||||
|
var node = profileAdmin?.Node;
|
||||||
|
string? nodeIdStr = null;
|
||||||
|
if (role == "NORMAL" || role == "CHILD")
|
||||||
|
{
|
||||||
|
nodeIdStr = node == 4 ? profileAdmin?.Child4DnaId
|
||||||
|
: node == 3 ? profileAdmin?.Child3DnaId
|
||||||
|
: node == 2 ? profileAdmin?.Child2DnaId
|
||||||
|
: node == 1 ? profileAdmin?.Child1DnaId
|
||||||
|
: node == 0 ? profileAdmin?.RootDnaId
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
else if (role == "BROTHER")
|
||||||
|
{
|
||||||
|
nodeIdStr = node == 4 ? profileAdmin?.Child3DnaId
|
||||||
|
: node == 3 ? profileAdmin?.Child2DnaId
|
||||||
|
: node == 2 ? profileAdmin?.Child1DnaId
|
||||||
|
: (node == 1 || node == 0) ? profileAdmin?.RootDnaId
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
else if (role == "ROOT")
|
||||||
|
{
|
||||||
|
nodeIdStr = profileAdmin?.RootDnaId;
|
||||||
|
}
|
||||||
|
Guid? nodeId = Guid.TryParse(nodeIdStr, out var ng) ? ng : (Guid?)null;
|
||||||
|
|
||||||
var page = req.page <= 0 ? 1 : req.page;
|
var page = req.page <= 0 ? 1 : req.page;
|
||||||
var pageSize = req.pageSize <= 0 ? 25 : req.pageSize;
|
var pageSize = req.pageSize <= 0 ? 25 : req.pageSize;
|
||||||
var keyword = string.IsNullOrEmpty(req.keyword) ? string.Empty : req.keyword;
|
var keyword = string.IsNullOrEmpty(req.keyword) ? string.Empty : req.keyword;
|
||||||
var status = string.IsNullOrEmpty(req.status) ? string.Empty : req.status;
|
var status = string.IsNullOrEmpty(req.status) ? string.Empty : req.status;
|
||||||
|
|
||||||
var data_search = (from x in _context.DisciplineComplaints
|
var data_search = (from x in _context.DisciplineComplaints
|
||||||
where x.Title.Contains(keyword) ||
|
where
|
||||||
(x.Appellant == null ? false : x.Appellant.Contains(keyword))
|
(
|
||||||
|
x.Title.Contains(keyword) ||
|
||||||
|
(x.Appellant == null ? false : x.Appellant.Contains(keyword))
|
||||||
|
)
|
||||||
|
&&
|
||||||
|
(
|
||||||
|
role == "OWNER" ? true :
|
||||||
|
role == "ROOT" ? x.RootDnaId == nodeId :
|
||||||
|
role == "CHILD" ? (
|
||||||
|
node == 4 ? x.Child4DnaId == nodeId :
|
||||||
|
node == 3 ? x.Child3DnaId == nodeId :
|
||||||
|
node == 2 ? x.Child2DnaId == nodeId :
|
||||||
|
node == 1 ? x.Child1DnaId == nodeId :
|
||||||
|
node == 0 ? x.RootDnaId == nodeId :
|
||||||
|
true
|
||||||
|
) :
|
||||||
|
role == "BROTHER" ? (
|
||||||
|
node == 4 ? x.Child3DnaId == nodeId :
|
||||||
|
node == 3 ? x.Child2DnaId == nodeId :
|
||||||
|
node == 2 ? x.Child1DnaId == nodeId :
|
||||||
|
(node == 1 || node == 0) ? x.RootDnaId == nodeId :
|
||||||
|
true
|
||||||
|
) :
|
||||||
|
role == "NORMAL" ? (
|
||||||
|
node == 0 ? x.RootDnaId == nodeId && x.Child1DnaId == null :
|
||||||
|
node == 1 ? x.Child1DnaId == nodeId && x.Child2DnaId == null :
|
||||||
|
node == 2 ? x.Child2DnaId == nodeId && x.Child3DnaId == null :
|
||||||
|
node == 3 ? x.Child3DnaId == nodeId && x.Child4DnaId == null :
|
||||||
|
node == 4 ? x.Child4DnaId == nodeId :
|
||||||
|
true
|
||||||
|
) :
|
||||||
|
true
|
||||||
|
)
|
||||||
select x).ToList();
|
select x).ToList();
|
||||||
|
|
||||||
if (status.Trim().ToUpper() != "ALL")
|
if (status.Trim().ToUpper() != "ALL")
|
||||||
|
|
@ -466,6 +526,10 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
||||||
Description = req.description,
|
Description = req.description,
|
||||||
DateReceived = req.dateReceived,
|
DateReceived = req.dateReceived,
|
||||||
RootDnaId = profile.RootDnaId,
|
RootDnaId = profile.RootDnaId,
|
||||||
|
Child1DnaId = profile.Child1DnaId,
|
||||||
|
Child2DnaId = profile.Child2DnaId,
|
||||||
|
Child3DnaId = profile.Child3DnaId,
|
||||||
|
Child4DnaId = profile.Child4DnaId,
|
||||||
LevelConsideration = req.levelConsideration == null ? null : req.levelConsideration.Trim().ToUpper(),
|
LevelConsideration = req.levelConsideration == null ? null : req.levelConsideration.Trim().ToUpper(),
|
||||||
DateConsideration = req.dateConsideration,
|
DateConsideration = req.dateConsideration,
|
||||||
OffenseDetails = req.offenseDetails == null ? null : req.offenseDetails.Trim().ToUpper(),
|
OffenseDetails = req.offenseDetails == null ? null : req.offenseDetails.Trim().ToUpper(),
|
||||||
|
|
@ -739,6 +803,10 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
|
||||||
RespondentType = data.RespondentType.Trim().ToUpper(),
|
RespondentType = data.RespondentType.Trim().ToUpper(),
|
||||||
Organization = data.Organization,
|
Organization = data.Organization,
|
||||||
RootDnaId = data.RootDnaId,
|
RootDnaId = data.RootDnaId,
|
||||||
|
Child1DnaId = data.Child1DnaId,
|
||||||
|
Child2DnaId = data.Child2DnaId,
|
||||||
|
Child3DnaId = data.Child3DnaId,
|
||||||
|
Child4DnaId = data.Child4DnaId,
|
||||||
ConsideredAgency = data.ConsideredAgency,
|
ConsideredAgency = data.ConsideredAgency,
|
||||||
OrganizationId = data.OrganizationId,
|
OrganizationId = data.OrganizationId,
|
||||||
ConsideredAgencyId = data.ConsideredAgencyId,
|
ConsideredAgencyId = data.ConsideredAgencyId,
|
||||||
|
|
|
||||||
|
|
@ -30,12 +30,14 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
private readonly NotificationRepository _repositoryNoti;
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
private readonly PermissionRepository _permission;
|
private readonly PermissionRepository _permission;
|
||||||
|
private readonly UserProfileRepository _userProfileRepository;
|
||||||
|
|
||||||
public DisciplineDisciplinaryController(DisciplineDbContext context,
|
public DisciplineDisciplinaryController(DisciplineDbContext context,
|
||||||
MinIODisciplineService documentService,
|
MinIODisciplineService documentService,
|
||||||
NotificationRepository repositoryNoti,
|
NotificationRepository repositoryNoti,
|
||||||
IHttpContextAccessor httpContextAccessor,
|
IHttpContextAccessor httpContextAccessor,
|
||||||
PermissionRepository permission)
|
PermissionRepository permission,
|
||||||
|
UserProfileRepository userProfileRepository)
|
||||||
{
|
{
|
||||||
// _repository = repository;
|
// _repository = repository;
|
||||||
_context = context;
|
_context = context;
|
||||||
|
|
@ -43,6 +45,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
_repositoryNoti = repositoryNoti;
|
_repositoryNoti = repositoryNoti;
|
||||||
_permission = permission;
|
_permission = permission;
|
||||||
|
_userProfileRepository = userProfileRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region " Properties "
|
#region " Properties "
|
||||||
|
|
@ -50,6 +53,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
||||||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||||
|
|
||||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||||
|
private string? token => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
@ -118,15 +122,75 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
|
||||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// กรองสิทธิ์
|
||||||
|
string role = jsonData["result"]?.ToString() ?? "";
|
||||||
|
var profileAdmin = await _userProfileRepository.GetUserOCAll(Guid.Parse(UserId!), token.Replace("Bearer ", ""));
|
||||||
|
var node = profileAdmin?.Node;
|
||||||
|
string? nodeIdStr = null;
|
||||||
|
if (role == "NORMAL" || role == "CHILD")
|
||||||
|
{
|
||||||
|
nodeIdStr = node == 4 ? profileAdmin?.Child4DnaId
|
||||||
|
: node == 3 ? profileAdmin?.Child3DnaId
|
||||||
|
: node == 2 ? profileAdmin?.Child2DnaId
|
||||||
|
: node == 1 ? profileAdmin?.Child1DnaId
|
||||||
|
: node == 0 ? profileAdmin?.RootDnaId
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
else if (role == "BROTHER")
|
||||||
|
{
|
||||||
|
nodeIdStr = node == 4 ? profileAdmin?.Child3DnaId
|
||||||
|
: node == 3 ? profileAdmin?.Child2DnaId
|
||||||
|
: node == 2 ? profileAdmin?.Child1DnaId
|
||||||
|
: (node == 1 || node == 0) ? profileAdmin?.RootDnaId
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
else if (role == "ROOT")
|
||||||
|
{
|
||||||
|
nodeIdStr = profileAdmin?.RootDnaId;
|
||||||
|
}
|
||||||
|
Guid? nodeId = Guid.TryParse(nodeIdStr, out var ng) ? ng : (Guid?)null;
|
||||||
|
|
||||||
var page = req.page <= 0 ? 1 : req.page;
|
var page = req.page <= 0 ? 1 : req.page;
|
||||||
var pageSize = req.pageSize <= 0 ? 25 : req.pageSize;
|
var pageSize = req.pageSize <= 0 ? 25 : req.pageSize;
|
||||||
var keyword = string.IsNullOrEmpty(req.keyword) ? string.Empty : req.keyword;
|
var keyword = string.IsNullOrEmpty(req.keyword) ? string.Empty : req.keyword;
|
||||||
var status = string.IsNullOrEmpty(req.status) ? string.Empty : req.status;
|
var status = string.IsNullOrEmpty(req.status) ? string.Empty : req.status;
|
||||||
|
|
||||||
var data_search = (from x in _context.DisciplineDisciplinarys
|
var data_search = (from x in _context.DisciplineDisciplinarys
|
||||||
where x.Title.Contains(keyword) ||
|
where
|
||||||
x.DisciplinaryFaultLevel.Contains(keyword) ||
|
(
|
||||||
x.DisciplinaryCaseFault.Contains(keyword)
|
x.Title.Contains(keyword) ||
|
||||||
|
x.DisciplinaryFaultLevel.Contains(keyword) ||
|
||||||
|
x.DisciplinaryCaseFault.Contains(keyword)
|
||||||
|
)
|
||||||
|
&&
|
||||||
|
(
|
||||||
|
role == "OWNER" ? true :
|
||||||
|
role == "ROOT" ? x.RootDnaId == nodeId :
|
||||||
|
role == "CHILD" ? (
|
||||||
|
node == 4 ? x.Child4DnaId == nodeId :
|
||||||
|
node == 3 ? x.Child3DnaId == nodeId :
|
||||||
|
node == 2 ? x.Child2DnaId == nodeId :
|
||||||
|
node == 1 ? x.Child1DnaId == nodeId :
|
||||||
|
node == 0 ? x.RootDnaId == nodeId :
|
||||||
|
true
|
||||||
|
) :
|
||||||
|
role == "BROTHER" ? (
|
||||||
|
node == 4 ? x.Child3DnaId == nodeId :
|
||||||
|
node == 3 ? x.Child2DnaId == nodeId :
|
||||||
|
node == 2 ? x.Child1DnaId == nodeId :
|
||||||
|
(node == 1 || node == 0) ? x.RootDnaId == nodeId :
|
||||||
|
true
|
||||||
|
) :
|
||||||
|
role == "NORMAL" ? (
|
||||||
|
node == 0 ? x.RootDnaId == nodeId && x.Child1DnaId == null :
|
||||||
|
node == 1 ? x.Child1DnaId == nodeId && x.Child2DnaId == null :
|
||||||
|
node == 2 ? x.Child2DnaId == nodeId && x.Child3DnaId == null :
|
||||||
|
node == 3 ? x.Child3DnaId == nodeId && x.Child4DnaId == null :
|
||||||
|
node == 4 ? x.Child4DnaId == nodeId :
|
||||||
|
true
|
||||||
|
) :
|
||||||
|
true
|
||||||
|
)
|
||||||
select x).ToList();
|
select x).ToList();
|
||||||
if (status.Trim().ToUpper() != "ALL")
|
if (status.Trim().ToUpper() != "ALL")
|
||||||
data_search = data_search.Where(x => x.Status.Contains(status.Trim().ToUpper())).ToList();
|
data_search = data_search.Where(x => x.Status.Contains(status.Trim().ToUpper())).ToList();
|
||||||
|
|
|
||||||
|
|
@ -32,13 +32,15 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
||||||
private readonly NotificationRepository _repositoryNoti;
|
private readonly NotificationRepository _repositoryNoti;
|
||||||
private readonly PermissionRepository _permission;
|
private readonly PermissionRepository _permission;
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
|
private readonly UserProfileRepository _userProfileRepository;
|
||||||
|
|
||||||
public DisciplineInvestigateController(DisciplineDbContext context,
|
public DisciplineInvestigateController(DisciplineDbContext context,
|
||||||
MinIODisciplineService documentService,
|
MinIODisciplineService documentService,
|
||||||
NotificationRepository repositoryNoti,
|
NotificationRepository repositoryNoti,
|
||||||
IHttpContextAccessor httpContextAccessor,
|
IHttpContextAccessor httpContextAccessor,
|
||||||
IConfiguration configuration,
|
IConfiguration configuration,
|
||||||
PermissionRepository permission)
|
PermissionRepository permission,
|
||||||
|
UserProfileRepository userProfileRepository)
|
||||||
{
|
{
|
||||||
// _repository = repository;
|
// _repository = repository;
|
||||||
_context = context;
|
_context = context;
|
||||||
|
|
@ -47,6 +49,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
||||||
_repositoryNoti = repositoryNoti;
|
_repositoryNoti = repositoryNoti;
|
||||||
_permission = permission;
|
_permission = permission;
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
|
_userProfileRepository = userProfileRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region " Properties "
|
#region " Properties "
|
||||||
|
|
@ -117,6 +120,35 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
||||||
{
|
{
|
||||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// กรองสิทธิ์
|
||||||
|
string role = jsonData["result"]?.ToString() ?? "";
|
||||||
|
var profileAdmin = await _userProfileRepository.GetUserOCAll(Guid.Parse(UserId!), token.Replace("Bearer ", ""));
|
||||||
|
var node = profileAdmin?.Node;
|
||||||
|
string? nodeIdStr = null;
|
||||||
|
if (role == "NORMAL" || role == "CHILD")
|
||||||
|
{
|
||||||
|
nodeIdStr = node == 4 ? profileAdmin?.Child4DnaId
|
||||||
|
: node == 3 ? profileAdmin?.Child3DnaId
|
||||||
|
: node == 2 ? profileAdmin?.Child2DnaId
|
||||||
|
: node == 1 ? profileAdmin?.Child1DnaId
|
||||||
|
: node == 0 ? profileAdmin?.RootDnaId
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
else if (role == "BROTHER")
|
||||||
|
{
|
||||||
|
nodeIdStr = node == 4 ? profileAdmin?.Child3DnaId
|
||||||
|
: node == 3 ? profileAdmin?.Child2DnaId
|
||||||
|
: node == 2 ? profileAdmin?.Child1DnaId
|
||||||
|
: (node == 1 || node == 0) ? profileAdmin?.RootDnaId
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
else if (role == "ROOT")
|
||||||
|
{
|
||||||
|
nodeIdStr = profileAdmin?.RootDnaId;
|
||||||
|
}
|
||||||
|
Guid? nodeId = Guid.TryParse(nodeIdStr, out var ng) ? ng : (Guid?)null;
|
||||||
|
|
||||||
var page = req.page <= 0 ? 1 : req.page;
|
var page = req.page <= 0 ? 1 : req.page;
|
||||||
var pageSize = req.pageSize <= 0 ? 25 : req.pageSize;
|
var pageSize = req.pageSize <= 0 ? 25 : req.pageSize;
|
||||||
var keyword = string.IsNullOrEmpty(req.keyword) ? string.Empty : req.keyword;
|
var keyword = string.IsNullOrEmpty(req.keyword) ? string.Empty : req.keyword;
|
||||||
|
|
@ -124,6 +156,35 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
||||||
|
|
||||||
var data_search = (from x in _context.DisciplineInvestigates
|
var data_search = (from x in _context.DisciplineInvestigates
|
||||||
where x.Title.Contains(keyword)
|
where x.Title.Contains(keyword)
|
||||||
|
&&
|
||||||
|
(
|
||||||
|
role == "OWNER" ? true :
|
||||||
|
role == "ROOT" ? x.RootDnaId == nodeId :
|
||||||
|
role == "CHILD" ? (
|
||||||
|
node == 4 ? x.Child4DnaId == nodeId :
|
||||||
|
node == 3 ? x.Child3DnaId == nodeId :
|
||||||
|
node == 2 ? x.Child2DnaId == nodeId :
|
||||||
|
node == 1 ? x.Child1DnaId == nodeId :
|
||||||
|
node == 0 ? x.RootDnaId == nodeId :
|
||||||
|
true
|
||||||
|
) :
|
||||||
|
role == "BROTHER" ? (
|
||||||
|
node == 4 ? x.Child3DnaId == nodeId :
|
||||||
|
node == 3 ? x.Child2DnaId == nodeId :
|
||||||
|
node == 2 ? x.Child1DnaId == nodeId :
|
||||||
|
(node == 1 || node == 0) ? x.RootDnaId == nodeId :
|
||||||
|
true
|
||||||
|
) :
|
||||||
|
role == "NORMAL" ? (
|
||||||
|
node == 0 ? x.RootDnaId == nodeId && x.Child1DnaId == null :
|
||||||
|
node == 1 ? x.Child1DnaId == nodeId && x.Child2DnaId == null :
|
||||||
|
node == 2 ? x.Child2DnaId == nodeId && x.Child3DnaId == null :
|
||||||
|
node == 3 ? x.Child3DnaId == nodeId && x.Child4DnaId == null :
|
||||||
|
node == 4 ? x.Child4DnaId == nodeId :
|
||||||
|
true
|
||||||
|
) :
|
||||||
|
true
|
||||||
|
)
|
||||||
select x).ToList();
|
select x).ToList();
|
||||||
if (status.Trim().ToUpper() != "ALL")
|
if (status.Trim().ToUpper() != "ALL")
|
||||||
data_search = data_search.Where(x => x.Status.Contains(status.Trim().ToUpper())).ToList();
|
data_search = data_search.Where(x => x.Status.Contains(status.Trim().ToUpper())).ToList();
|
||||||
|
|
@ -828,6 +889,10 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
|
||||||
RespondentType = data.RespondentType.Trim().ToUpper(),
|
RespondentType = data.RespondentType.Trim().ToUpper(),
|
||||||
Organization = data.Organization,
|
Organization = data.Organization,
|
||||||
RootDnaId = data.RootDnaId,
|
RootDnaId = data.RootDnaId,
|
||||||
|
Child1DnaId = data.Child1DnaId,
|
||||||
|
Child2DnaId = data.Child2DnaId,
|
||||||
|
Child3DnaId = data.Child3DnaId,
|
||||||
|
Child4DnaId = data.Child4DnaId,
|
||||||
ConsideredAgency = data.ConsideredAgency,
|
ConsideredAgency = data.ConsideredAgency,
|
||||||
OrganizationId = data.OrganizationId,
|
OrganizationId = data.OrganizationId,
|
||||||
ConsideredAgencyId = data.ConsideredAgencyId,
|
ConsideredAgencyId = data.ConsideredAgencyId,
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,14 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
||||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
private readonly PermissionRepository _permission;
|
private readonly PermissionRepository _permission;
|
||||||
|
private readonly UserProfileRepository _userProfileRepository;
|
||||||
|
|
||||||
public DisciplineResultController(DisciplineDbContext context,
|
public DisciplineResultController(DisciplineDbContext context,
|
||||||
MinIODisciplineService documentService,
|
MinIODisciplineService documentService,
|
||||||
IHttpContextAccessor httpContextAccessor,
|
IHttpContextAccessor httpContextAccessor,
|
||||||
IConfiguration configuration,
|
IConfiguration configuration,
|
||||||
PermissionRepository permission)
|
PermissionRepository permission,
|
||||||
|
UserProfileRepository userProfileRepository)
|
||||||
{
|
{
|
||||||
// _repository = repository;
|
// _repository = repository;
|
||||||
_context = context;
|
_context = context;
|
||||||
|
|
@ -47,6 +49,7 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
_permission = permission;
|
_permission = permission;
|
||||||
|
_userProfileRepository = userProfileRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region " Properties "
|
#region " Properties "
|
||||||
|
|
@ -138,6 +141,34 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
||||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// กรองสิทธิ์
|
||||||
|
string role = jsonData["result"]?.ToString() ?? "";
|
||||||
|
var profileAdmin = await _userProfileRepository.GetUserOCAll(Guid.Parse(UserId!), token.Replace("Bearer ", ""));
|
||||||
|
var node = profileAdmin?.Node;
|
||||||
|
string? nodeIdStr = null;
|
||||||
|
if (role == "NORMAL" || role == "CHILD")
|
||||||
|
{
|
||||||
|
nodeIdStr = node == 4 ? profileAdmin?.Child4DnaId
|
||||||
|
: node == 3 ? profileAdmin?.Child3DnaId
|
||||||
|
: node == 2 ? profileAdmin?.Child2DnaId
|
||||||
|
: node == 1 ? profileAdmin?.Child1DnaId
|
||||||
|
: node == 0 ? profileAdmin?.RootDnaId
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
else if (role == "BROTHER")
|
||||||
|
{
|
||||||
|
nodeIdStr = node == 4 ? profileAdmin?.Child3DnaId
|
||||||
|
: node == 3 ? profileAdmin?.Child2DnaId
|
||||||
|
: node == 2 ? profileAdmin?.Child1DnaId
|
||||||
|
: (node == 1 || node == 0) ? profileAdmin?.RootDnaId
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
else if (role == "ROOT")
|
||||||
|
{
|
||||||
|
nodeIdStr = profileAdmin?.RootDnaId;
|
||||||
|
}
|
||||||
|
Guid? nodeId = Guid.TryParse(nodeIdStr, out var ng) ? ng : (Guid?)null;
|
||||||
|
|
||||||
var page = req.page <= 0 ? 1 : req.page;
|
var page = req.page <= 0 ? 1 : req.page;
|
||||||
var pageSize = req.pageSize <= 0 ? 25 : req.pageSize;
|
var pageSize = req.pageSize <= 0 ? 25 : req.pageSize;
|
||||||
var keyword = string.IsNullOrEmpty(req.keyword) ? string.Empty : req.keyword;
|
var keyword = string.IsNullOrEmpty(req.keyword) ? string.Empty : req.keyword;
|
||||||
|
|
@ -150,6 +181,34 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
|
||||||
(x.ResultTitleType == null ? false : x.ResultTitleType.Contains(keyword)) ||
|
(x.ResultTitleType == null ? false : x.ResultTitleType.Contains(keyword)) ||
|
||||||
(x.ResultYear == null ? false : (x.ResultYear + 543).ToString().Contains(keyword)))
|
(x.ResultYear == null ? false : (x.ResultYear + 543).ToString().Contains(keyword)))
|
||||||
.Where(x => x.Status.Contains("DONE") || x.Status.Contains("REPORT"))
|
.Where(x => x.Status.Contains("DONE") || x.Status.Contains("REPORT"))
|
||||||
|
.Where(x =>
|
||||||
|
role == "OWNER" ? true :
|
||||||
|
role == "ROOT" ? x.RootDnaId == nodeId :
|
||||||
|
role == "CHILD" ? (
|
||||||
|
node == 4 ? x.Child4DnaId == nodeId :
|
||||||
|
node == 3 ? x.Child3DnaId == nodeId :
|
||||||
|
node == 2 ? x.Child2DnaId == nodeId :
|
||||||
|
node == 1 ? x.Child1DnaId == nodeId :
|
||||||
|
node == 0 ? x.RootDnaId == nodeId :
|
||||||
|
true
|
||||||
|
) :
|
||||||
|
role == "BROTHER" ? (
|
||||||
|
node == 4 ? x.Child3DnaId == nodeId :
|
||||||
|
node == 3 ? x.Child2DnaId == nodeId :
|
||||||
|
node == 2 ? x.Child1DnaId == nodeId :
|
||||||
|
(node == 1 || node == 0) ? x.RootDnaId == nodeId :
|
||||||
|
true
|
||||||
|
) :
|
||||||
|
role == "NORMAL" ? (
|
||||||
|
node == 0 ? x.RootDnaId == nodeId && x.Child1DnaId == null :
|
||||||
|
node == 1 ? x.Child1DnaId == nodeId && x.Child2DnaId == null :
|
||||||
|
node == 2 ? x.Child2DnaId == nodeId && x.Child3DnaId == null :
|
||||||
|
node == 3 ? x.Child3DnaId == nodeId && x.Child4DnaId == null :
|
||||||
|
node == 4 ? x.Child4DnaId == nodeId :
|
||||||
|
true
|
||||||
|
) :
|
||||||
|
true
|
||||||
|
)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
if (status.Trim().ToUpper() != "ALL")
|
if (status.Trim().ToUpper() != "ALL")
|
||||||
data_search = data_search.Where(x => x.Status.Contains(status.Trim().ToUpper())).ToList();
|
data_search = data_search.Where(x => x.Status.Contains(status.Trim().ToUpper())).ToList();
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ var builder = WebApplication.CreateBuilder(args);
|
||||||
DashboardJobListLimit = 50000,
|
DashboardJobListLimit = 50000,
|
||||||
TransactionTimeout = TimeSpan.FromMinutes(1),
|
TransactionTimeout = TimeSpan.FromMinutes(1),
|
||||||
InvisibilityTimeout = TimeSpan.FromHours(3),
|
InvisibilityTimeout = TimeSpan.FromHours(3),
|
||||||
TablesPrefix = "Hangfire"
|
TablesPrefix = "Hangfire_Discipline"
|
||||||
})));
|
})));
|
||||||
builder.Services.AddHangfireServer();
|
builder.Services.AddHangfireServer();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,14 @@ namespace BMA.EHR.Domain.Models.Discipline
|
||||||
|
|
||||||
[Comment("RootDnaId")]
|
[Comment("RootDnaId")]
|
||||||
public Guid? RootDnaId { get; set; }
|
public Guid? RootDnaId { get; set; }
|
||||||
|
[Comment("Child1DnaId")]
|
||||||
|
public Guid? Child1DnaId { get; set; }
|
||||||
|
[Comment("Child2DnaId")]
|
||||||
|
public Guid? Child2DnaId { get; set; }
|
||||||
|
[Comment("Child3DnaId")]
|
||||||
|
public Guid? Child3DnaId { get; set; }
|
||||||
|
[Comment("Child4DnaId")]
|
||||||
|
public Guid? Child4DnaId { get; set; }
|
||||||
public virtual List<DisciplineComplaint_Profile> DisciplineComplaint_Profiles { get; set; } = new List<DisciplineComplaint_Profile>();
|
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<DisciplineComplaint_Doc> DisciplineComplaint_Docs { get; set; } = new List<DisciplineComplaint_Doc>();
|
||||||
public virtual List<DisciplineInvestigate> DisciplineInvestigates { get; set; } = new List<DisciplineInvestigate>();
|
public virtual List<DisciplineInvestigate> DisciplineInvestigates { get; set; } = new List<DisciplineInvestigate>();
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,14 @@ namespace BMA.EHR.Domain.Models.Discipline
|
||||||
|
|
||||||
[Comment("RootDnaId")]
|
[Comment("RootDnaId")]
|
||||||
public Guid? RootDnaId { get; set; }
|
public Guid? RootDnaId { get; set; }
|
||||||
|
[Comment("Child1DnaId")]
|
||||||
|
public Guid? Child1DnaId { get; set; }
|
||||||
|
[Comment("Child2DnaId")]
|
||||||
|
public Guid? Child2DnaId { get; set; }
|
||||||
|
[Comment("Child3DnaId")]
|
||||||
|
public Guid? Child3DnaId { get; set; }
|
||||||
|
[Comment("Child4DnaId")]
|
||||||
|
public Guid? Child4DnaId { get; set; }
|
||||||
|
|
||||||
public DisciplineInvestigate DisciplineInvestigate { get; set; }
|
public DisciplineInvestigate DisciplineInvestigate { get; set; }
|
||||||
public virtual List<DisciplineDisciplinary_ProfileComplaintInvestigate> DisciplineDisciplinary_ProfileComplaintInvestigates { get; set; } = new List<DisciplineDisciplinary_ProfileComplaintInvestigate>();
|
public virtual List<DisciplineDisciplinary_ProfileComplaintInvestigate> DisciplineDisciplinary_ProfileComplaintInvestigates { get; set; } = new List<DisciplineDisciplinary_ProfileComplaintInvestigate>();
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,14 @@ namespace BMA.EHR.Domain.Models.Discipline
|
||||||
|
|
||||||
[Comment("RootDnaId")]
|
[Comment("RootDnaId")]
|
||||||
public Guid? RootDnaId { get; set; }
|
public Guid? RootDnaId { get; set; }
|
||||||
|
[Comment("Child1DnaId")]
|
||||||
|
public Guid? Child1DnaId { get; set; }
|
||||||
|
[Comment("Child2DnaId")]
|
||||||
|
public Guid? Child2DnaId { get; set; }
|
||||||
|
[Comment("Child3DnaId")]
|
||||||
|
public Guid? Child3DnaId { get; set; }
|
||||||
|
[Comment("Child4DnaId")]
|
||||||
|
public Guid? Child4DnaId { get; set; }
|
||||||
public DisciplineComplaint DisciplineComplaint { get; set; }
|
public DisciplineComplaint DisciplineComplaint { get; set; }
|
||||||
public virtual List<DisciplineInvestigate_ProfileComplaint> DisciplineInvestigate_ProfileComplaints { get; set; } = new List<DisciplineInvestigate_ProfileComplaint>();
|
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>();
|
public virtual List<DisciplineInvestigate_DocComplaint> DisciplineInvestigate_DocComplaints { get; set; } = new List<DisciplineInvestigate_DocComplaint>();
|
||||||
|
|
|
||||||
3723
BMA.EHR.Infrastructure/Migrations/DisciplineDb/20260717041310_AddChildDnaIdsToDiscipline.Designer.cs
generated
Normal file
3723
BMA.EHR.Infrastructure/Migrations/DisciplineDb/20260717041310_AddChildDnaIdsToDiscipline.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,163 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class AddChildDnaIdsToDiscipline : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "Child1DnaId",
|
||||||
|
table: "DisciplineInvestigates",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
comment: "Child1DnaId",
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "Child2DnaId",
|
||||||
|
table: "DisciplineInvestigates",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
comment: "Child2DnaId",
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "Child3DnaId",
|
||||||
|
table: "DisciplineInvestigates",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
comment: "Child3DnaId",
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "Child4DnaId",
|
||||||
|
table: "DisciplineInvestigates",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
comment: "Child4DnaId",
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "Child1DnaId",
|
||||||
|
table: "DisciplineDisciplinarys",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
comment: "Child1DnaId",
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "Child2DnaId",
|
||||||
|
table: "DisciplineDisciplinarys",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
comment: "Child2DnaId",
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "Child3DnaId",
|
||||||
|
table: "DisciplineDisciplinarys",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
comment: "Child3DnaId",
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "Child4DnaId",
|
||||||
|
table: "DisciplineDisciplinarys",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
comment: "Child4DnaId",
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "Child1DnaId",
|
||||||
|
table: "DisciplineComplaints",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
comment: "Child1DnaId",
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "Child2DnaId",
|
||||||
|
table: "DisciplineComplaints",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
comment: "Child2DnaId",
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "Child3DnaId",
|
||||||
|
table: "DisciplineComplaints",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
comment: "Child3DnaId",
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<Guid>(
|
||||||
|
name: "Child4DnaId",
|
||||||
|
table: "DisciplineComplaints",
|
||||||
|
type: "char(36)",
|
||||||
|
nullable: true,
|
||||||
|
comment: "Child4DnaId",
|
||||||
|
collation: "ascii_general_ci");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Child1DnaId",
|
||||||
|
table: "DisciplineInvestigates");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Child2DnaId",
|
||||||
|
table: "DisciplineInvestigates");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Child3DnaId",
|
||||||
|
table: "DisciplineInvestigates");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Child4DnaId",
|
||||||
|
table: "DisciplineInvestigates");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Child1DnaId",
|
||||||
|
table: "DisciplineDisciplinarys");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Child2DnaId",
|
||||||
|
table: "DisciplineDisciplinarys");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Child3DnaId",
|
||||||
|
table: "DisciplineDisciplinarys");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Child4DnaId",
|
||||||
|
table: "DisciplineDisciplinarys");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Child1DnaId",
|
||||||
|
table: "DisciplineComplaints");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Child2DnaId",
|
||||||
|
table: "DisciplineComplaints");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Child3DnaId",
|
||||||
|
table: "DisciplineComplaints");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Child4DnaId",
|
||||||
|
table: "DisciplineComplaints");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -32,6 +32,22 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
||||||
.HasColumnType("longtext")
|
.HasColumnType("longtext")
|
||||||
.HasComment("ผู้ร้องเรียน");
|
.HasComment("ผู้ร้องเรียน");
|
||||||
|
|
||||||
|
b.Property<Guid?>("Child1DnaId")
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasComment("Child1DnaId");
|
||||||
|
|
||||||
|
b.Property<Guid?>("Child2DnaId")
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasComment("Child2DnaId");
|
||||||
|
|
||||||
|
b.Property<Guid?>("Child3DnaId")
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasComment("Child3DnaId");
|
||||||
|
|
||||||
|
b.Property<Guid?>("Child4DnaId")
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasComment("Child4DnaId");
|
||||||
|
|
||||||
b.Property<string>("ComplaintFrom")
|
b.Property<string>("ComplaintFrom")
|
||||||
.HasColumnType("longtext")
|
.HasColumnType("longtext")
|
||||||
.HasComment("รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)");
|
.HasComment("รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)");
|
||||||
|
|
@ -864,6 +880,22 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
||||||
.HasColumnType("longtext")
|
.HasColumnType("longtext")
|
||||||
.HasComment("ผู้ร้องเรียน");
|
.HasComment("ผู้ร้องเรียน");
|
||||||
|
|
||||||
|
b.Property<Guid?>("Child1DnaId")
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasComment("Child1DnaId");
|
||||||
|
|
||||||
|
b.Property<Guid?>("Child2DnaId")
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasComment("Child2DnaId");
|
||||||
|
|
||||||
|
b.Property<Guid?>("Child3DnaId")
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasComment("Child3DnaId");
|
||||||
|
|
||||||
|
b.Property<Guid?>("Child4DnaId")
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasComment("Child4DnaId");
|
||||||
|
|
||||||
b.Property<string>("ComplaintFrom")
|
b.Property<string>("ComplaintFrom")
|
||||||
.HasColumnType("longtext")
|
.HasColumnType("longtext")
|
||||||
.HasComment("รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)");
|
.HasComment("รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)");
|
||||||
|
|
@ -2087,6 +2119,22 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
||||||
.HasColumnType("longtext")
|
.HasColumnType("longtext")
|
||||||
.HasComment("ผู้ร้องเรียน");
|
.HasComment("ผู้ร้องเรียน");
|
||||||
|
|
||||||
|
b.Property<Guid?>("Child1DnaId")
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasComment("Child1DnaId");
|
||||||
|
|
||||||
|
b.Property<Guid?>("Child2DnaId")
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasComment("Child2DnaId");
|
||||||
|
|
||||||
|
b.Property<Guid?>("Child3DnaId")
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasComment("Child3DnaId");
|
||||||
|
|
||||||
|
b.Property<Guid?>("Child4DnaId")
|
||||||
|
.HasColumnType("char(36)")
|
||||||
|
.HasComment("Child4DnaId");
|
||||||
|
|
||||||
b.Property<string>("ComplaintFrom")
|
b.Property<string>("ComplaintFrom")
|
||||||
.HasColumnType("longtext")
|
.HasColumnType("longtext")
|
||||||
.HasComment("รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)");
|
.HasComment("รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)");
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ using RabbitMQ.Client.Events;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Reflection.Metadata.Ecma335;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
@ -779,6 +780,16 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// var get current status
|
||||||
|
var task = await _checkInJobStatusRepository.GetByTaskIdAsync(job.TaskId);
|
||||||
|
|
||||||
|
// return if stask status != "PENDING"
|
||||||
|
if (task is not null)
|
||||||
|
{
|
||||||
|
if (task.Status != "PENDING")
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// อ่านข้อมูลเดิมจาก AdditionalData
|
// อ่านข้อมูลเดิมจาก AdditionalData
|
||||||
if (string.IsNullOrEmpty(job.AdditionalData))
|
if (string.IsNullOrEmpty(job.AdditionalData))
|
||||||
{
|
{
|
||||||
|
|
@ -1075,6 +1086,9 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// อัปเดตสถานะเป็น PROCESSING
|
// อัปเดตสถานะเป็น PROCESSING
|
||||||
if (taskId != Guid.Empty)
|
if (taskId != Guid.Empty)
|
||||||
{
|
{
|
||||||
|
|
@ -2744,7 +2758,9 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
|
|
||||||
if (old != null)
|
if (old != null)
|
||||||
{
|
{
|
||||||
return Error(new Exception("ไม่สามารถทำรายการได้ เนื่องจากมีการกำหนดรอบการทำงานในวันที่นี้ไว้แล้ว"), StatusCodes.Status400BadRequest);
|
// ลบของเก่าออกเพื่อใส่ของใหม่
|
||||||
|
await _userDutyTimeRepository.DeleteAsync(old);
|
||||||
|
//return Error(new Exception("ไม่สามารถทำรายการได้ เนื่องจากมีการกำหนดรอบการทำงานในวันที่นี้ไว้แล้ว"), StatusCodes.Status400BadRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
var data = new UserDutyTime
|
var data = new UserDutyTime
|
||||||
|
|
@ -2801,8 +2817,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
|
|
||||||
if (old != null)
|
if (old != null)
|
||||||
{
|
{
|
||||||
continue; // move to next item if already exist, not return error
|
// ลบของเก่าออก เพื่อที่จะใส่รายการใหม่
|
||||||
//return Error(new Exception($"กำหนดรอบลงเวลาของ {req.FirstName} {req.LastName} ผิดพลาด เนื่องจากมีการกำหนดรอบการทำงานในวันที่นี้ไว้แล้ว"), StatusCodes.Status400BadRequest);
|
await _userDutyTimeRepository.DeleteAsync(old);
|
||||||
}
|
}
|
||||||
|
|
||||||
var data = new UserDutyTime
|
var data = new UserDutyTime
|
||||||
|
|
@ -3057,7 +3073,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
||||||
|
|
||||||
if (old != null)
|
if (old != null)
|
||||||
{
|
{
|
||||||
return Error(new Exception("ไม่สามารถทำรายการได้ เนื่องจากมีการกำหนดรอบการทำงานในวันที่นี้ไว้แล้ว"), StatusCodes.Status400BadRequest);
|
await _userDutyTimeRepository.DeleteAsync(old);
|
||||||
|
//return Error(new Exception("ไม่สามารถทำรายการได้ เนื่องจากมีการกำหนดรอบการทำงานในวันที่นี้ไว้แล้ว"), StatusCodes.Status400BadRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
var data = new UserDutyTime
|
var data = new UserDutyTime
|
||||||
|
|
|
||||||
|
|
@ -11,15 +11,22 @@ public class NotificationService
|
||||||
private readonly ILogger<NotificationService> _logger;
|
private readonly ILogger<NotificationService> _logger;
|
||||||
private readonly IConfiguration _configuration;
|
private readonly IConfiguration _configuration;
|
||||||
|
|
||||||
private const string NotifyEndpoint = "https://hrmsbkk.case-collection.com/api/v1/org/through-socket/notify-from-token";
|
private string _notifyEndpoint;
|
||||||
|
|
||||||
public NotificationService(IHttpClientFactory httpClientFactory, ILogger<NotificationService> logger, IConfiguration configuration)
|
public NotificationService(IHttpClientFactory httpClientFactory, ILogger<NotificationService> logger, IConfiguration configuration)
|
||||||
{
|
{
|
||||||
_httpClientFactory = httpClientFactory;
|
_httpClientFactory = httpClientFactory;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
|
_notifyEndpoint = $"{_configuration["API"]}/org/through-socket/notify-from-token";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// SendNotificationAsync
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="token"></param>
|
||||||
|
/// <param name="error"></param>
|
||||||
|
/// <param name="message"></param>
|
||||||
public async Task SendNotificationAsync(string? token, bool error, string message)
|
public async Task SendNotificationAsync(string? token, bool error, string message)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(token))
|
if (string.IsNullOrEmpty(token))
|
||||||
|
|
@ -42,7 +49,7 @@ public class NotificationService
|
||||||
var json = JsonConvert.SerializeObject(payload);
|
var json = JsonConvert.SerializeObject(payload);
|
||||||
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
var content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||||
|
|
||||||
var response = await client.PostAsync(NotifyEndpoint, content);
|
var response = await client.PostAsync(_notifyEndpoint, content);
|
||||||
|
|
||||||
if (!response.IsSuccessStatusCode)
|
if (!response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ var builder = WebApplication.CreateBuilder(args);
|
||||||
PrepareSchemaIfNecessary = true,
|
PrepareSchemaIfNecessary = true,
|
||||||
DashboardJobListLimit = 50000,
|
DashboardJobListLimit = 50000,
|
||||||
TransactionTimeout = TimeSpan.FromMinutes(1),
|
TransactionTimeout = TimeSpan.FromMinutes(1),
|
||||||
TablesPrefix = "Hangfire"
|
TablesPrefix = "Hangfire_Placement"
|
||||||
})));
|
})));
|
||||||
builder.Services.AddHangfireServer();
|
builder.Services.AddHangfireServer();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ var builder = WebApplication.CreateBuilder(args);
|
||||||
DashboardJobListLimit = 50000,
|
DashboardJobListLimit = 50000,
|
||||||
TransactionTimeout = TimeSpan.FromMinutes(1),
|
TransactionTimeout = TimeSpan.FromMinutes(1),
|
||||||
InvisibilityTimeout = TimeSpan.FromHours(3),
|
InvisibilityTimeout = TimeSpan.FromHours(3),
|
||||||
TablesPrefix = "Hangfire"
|
TablesPrefix = "Hangfire_Retirement"
|
||||||
})));
|
})));
|
||||||
builder.Services.AddHealthChecks();
|
builder.Services.AddHealthChecks();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue