This commit is contained in:
parent
864c348531
commit
c89ecf8cda
11 changed files with 3729 additions and 18 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -674,6 +674,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,
|
||||
|
|
|
|||
|
|
@ -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>();
|
||||
|
|
|
|||
|
|
@ -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>();
|
||||
|
|
|
|||
|
|
@ -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>();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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")
|
||||
|
|
@ -2149,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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue