Merge branch 'develop' into working

This commit is contained in:
Suphonchai Phoonsawat 2024-06-20 13:39:52 +07:00
commit 18aa77b3ad
15 changed files with 20164 additions and 1615 deletions

View file

@ -1,4 +1,6 @@
using BMA.EHR.Application.Common.Interfaces;
using System.Net.Http.Headers;
using BMA.EHR.Application.Common.Interfaces;
using BMA.EHR.Application.Responses;
using BMA.EHR.Application.Responses.Reports;
using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Models.Commands.Core;
@ -9,6 +11,8 @@ using BMA.EHR.Domain.Models.Retirement;
using BMA.EHR.Domain.Shared;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
namespace BMA.EHR.Application.Repositories.Commands
{
@ -20,6 +24,7 @@ namespace BMA.EHR.Application.Repositories.Commands
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly OrganizationCommonRepository _organizationCommonRepository;
private readonly UserProfileRepository _userProfileRepository;
private readonly IConfiguration _configuration;
#endregion
@ -28,12 +33,14 @@ namespace BMA.EHR.Application.Repositories.Commands
public CommandReportRepository(IApplicationDBContext dbContext,
IHttpContextAccessor httpContextAccessor,
OrganizationCommonRepository organizationCommonRepository,
IConfiguration configuration,
UserProfileRepository userProfileRepository) : base(dbContext, httpContextAccessor)
{
_dbContext = dbContext;
_httpContextAccessor = httpContextAccessor;
_organizationCommonRepository = organizationCommonRepository;
_userProfileRepository = userProfileRepository;
_configuration = configuration;
}
#endregion
@ -1029,39 +1036,39 @@ namespace BMA.EHR.Application.Repositories.Commands
}
var report_data = (from r in raw_data
join p in _dbContext.Set<OrganizationEmployeeProfile>()
.Include(x => x.Profile)
.ThenInclude(x => x.Position)
.Include(x => x.Profile)
.ThenInclude(x => x.PositionLevel)
.Include(x => x.Profile)
.ThenInclude(x => x.PositionType)
.Include(x => x.Profile)
.ThenInclude(x => x.PosNo)
.Include(x => x.OrgEmployee)
.ThenInclude(x => x.OrganizationAgency)
.ThenInclude(x => x.OrganizationOrganization)
//.Include(x => x.OrgEmployee)
//.ThenInclude(x => x.PosNo)
.Include(x => x.OrgEmployee)
.ThenInclude(x => x.PositionEmployeePosition)
.Include(x => x.OrgEmployee)
.ThenInclude(x => x.OrganizationPositionEmployeeLevels)
.ThenInclude(x => x.PositionEmployeeLevel)
on r.RefPlacementProfileId equals p.Id
// join p in _dbContext.Set<OrganizationEmployeeProfile>()
// .Include(x => x.Profile)
// .ThenInclude(x => x.Position)
// .Include(x => x.Profile)
// .ThenInclude(x => x.PositionLevel)
// .Include(x => x.Profile)
// .ThenInclude(x => x.PositionType)
// .Include(x => x.Profile)
// .ThenInclude(x => x.PosNo)
// .Include(x => x.OrgEmployee)
// .ThenInclude(x => x.OrganizationAgency)
// .ThenInclude(x => x.OrganizationOrganization)
// //.Include(x => x.OrgEmployee)
// //.ThenInclude(x => x.PosNo)
// .Include(x => x.OrgEmployee)
// .ThenInclude(x => x.PositionEmployeePosition)
// .Include(x => x.OrgEmployee)
// .ThenInclude(x => x.OrganizationPositionEmployeeLevels)
// .ThenInclude(x => x.PositionEmployeeLevel)
// on r.RefPlacementProfileId equals p.Id
orderby r.Sequence
select new CommandType21Response
{
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Organization = p.OrgEmployee == null || p.OrgEmployee!.OrganizationAgency == null || p.OrgEmployee!.OrganizationAgency!.OrganizationOrganization == null ? "" : p.OrgEmployee!.OrganizationAgency!.OrganizationOrganization!.Name,
PositionName = p.OrgEmployee == null || p.OrgEmployee.PositionEmployeePosition == null ? "" : p.OrgEmployee.PositionEmployeePosition.Name.ToThaiNumber(),
PositionLevel = p.OrgEmployee == null || p.OrgEmployee.OrganizationPositionEmployeeLevels == null ? "" : p.OrgEmployee.OrganizationPositionEmployeeLevels.First().PositionEmployeeLevel.Name.ToThaiNumber(),
PositionType = p.Profile.PositionType == null ? "" : p.Profile.PositionType.Name.ToThaiNumber(),
PositionNumber = p.OrgEmployee.PosNo == null ? "" : p.OrgEmployee.PosNo.ToThaiNumber(),
Organization = r.Organization == null ? "" : r.Organization.ToThaiNumber(),
PositionName = r.PositionName == null ? "" : r.PositionName.ToThaiNumber(),
PositionLevel = r.PositionLevel == null ? "" : r.PositionLevel.ToThaiNumber(),
PositionType = r.PositionType == null ? "" : r.PositionType.ToThaiNumber(),
PositionNumber = r.PositionNumber == null ? "" : r.PositionNumber.ToThaiNumber(),
Salary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
RetireDate = p.Profile.BirthDate.CalculateRetireDate().ToThaiFullDate3().ToThaiNumber(),
RetireDate = r.BirthDate == null ? "" : r.BirthDate.Value.CalculateRetireDate().ToThaiFullDate3().ToThaiNumber(),
CommandYear = r.Command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber()
})
.ToList();
@ -1274,7 +1281,7 @@ namespace BMA.EHR.Application.Repositories.Commands
}
}
public async Task<CommandType23Response?> GetCommandType25AttachmentAsync(Guid id)
public async Task<CommandType23Response?> GetCommandType25AttachmentAsync(Guid id, string token)
{
try
{
@ -1286,23 +1293,33 @@ namespace BMA.EHR.Application.Repositories.Commands
{
throw new Exception(GlobalMessages.CommandNotFound);
}
var report_data = (from r in raw_data
join pf in _dbContext.Set<Profile>()
.Include(x => x.Position)
.Include(x => x.PosNo)
.Include(x => x.Salaries)
on r.CitizenId equals pf.CitizenId
orderby r.Sequence
select new CommandType23Response
{
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Positionname = pf.Position == null ? "" : pf.Position.Name,
Positionno = pf.PosNo == null ? "" : pf.PosNo.Name,
Organizationname = pf.Oc == null ? "" : pf.Oc.Replace("/", " "),
Salary = pf.Salaries == null || pf.Salaries.Count == 0 || pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount == null ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
}).FirstOrDefault();
foreach (var d in raw_data)
{
var apiUrl = $"{_configuration["API"]}discipline/result/report/find/{d.RefDisciplineId}/{d.RefPlacementProfileId}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
return report_data;
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
if (org == null || org.result == null)
continue;
var receiver = new CommandType23Response
{
fullName = $"{org.result.prefix}{org.result.firstName} {org.result.lastName}",
positionname = org.result.position,
positionno = org.result.posNo,
organizationname = org.result.organization,
salary = org.result.salary == null ? null : org.result.salary.Value.ToNumericNoDecimalText().ToString(),
};
return receiver;
}
}
return null;
}
catch
{

File diff suppressed because it is too large Load diff

View file

@ -43,5 +43,7 @@ namespace BMA.EHR.Application.Responses
public string? posExecutiveId { get; set; }
public string? posExecutiveName { get; set; }
public string? posNo { get; set; }
public string? organization { get; set; }
public double? salary { get; set; }
}
}

View file

@ -16,5 +16,13 @@
public string lastName { get; set; } = string.Empty;
public string? profileId { get; set; } = string.Empty;
// public Guid? commandId { get; set; } = Guid.Empty;
public DateTime? birthDate { get; set; }
public string? organization { get; set; }
public string? positionName { get; set; }
public string? positionLevel { get; set; }
public string? positionType { get; set; }
public string? positionNumber { get; set; }
}
}

View file

@ -2,10 +2,10 @@
{
public class CommandType23Response
{
public string? FullName { get; set; } = string.Empty;
public string? Positionname { get; set; } = string.Empty;
public string? Positionno { get; set; } = string.Empty;
public string? Organizationname { get; set; } = string.Empty;
public string? Salary { get; set; } = string.Empty;
public string? fullName { get; set; } = string.Empty;
public string? positionname { get; set; } = string.Empty;
public string? positionno { get; set; } = string.Empty;
public string? organizationname { get; set; } = string.Empty;
public string? salary { get; set; } = string.Empty;
}
}

View file

@ -4571,7 +4571,13 @@ namespace BMA.EHR.Command.Service.Controllers
IdCard = r.CitizenId,
Name = $"{r.Prefix}{r.FirstName} {r.LastName}",
SelectStatus = r.RefPlacementProfileId == null ? false : (existed.FirstOrDefault(x => x.RefPlacementProfileId!.Value == r.RefPlacementProfileId!.Value) != null),
Education = "" // ยังหาไม่เจอว่าอยุ่ field ไหน
Education = "", // ยังหาไม่เจอว่าอยุ่ field ไหน
Organization = r.Organization == null ? null : r.Organization,
PositionName = r.PositionName == null ? null : r.PositionName,
PositionLevel = r.PositionLevel == null ? null : r.PositionLevel,
PositionType = r.PositionType == null ? null : r.PositionType,
PositionNumber = r.PositionNumber == null ? null : r.PositionNumber,
BirthDate = r.BirthDate == null ? null : r.BirthDate,
}).ToList();
// ให้ Update Salary เฉพาะของ Command 01-04

View file

@ -18,8 +18,16 @@
public double SalaryAmount { get; set; } = 0;
public double PositionSalaryAmount { get; set; } = 0;
public double PositionSalaryAmount { get; set; } = 0;
public double MonthSalaryAmount { get; set; } = 0;
public string? Organization { get; set; }
public string? PositionName { get; set; }
public string? PositionLevel { get; set; }
public string? PositionType { get; set; }
public string? PositionNumber { get; set; }
public DateTime? BirthDate { get; set; }
}
}

View file

@ -559,5 +559,47 @@ 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>
[HttpGet("report/find/{periodId:guid}/{personId:guid}")]
public async Task<ActionResult<ResponseObject>> GetPersonReportFind(Guid periodId, Guid personId)
{
var data1 = await _context.DisciplineComplaint_Profiles
.Where(x => x.Id == periodId)
.Where(x => x.PersonId == personId.ToString())
.FirstOrDefaultAsync();
if (data1 == null)
{
var data2 = await _context.DisciplineInvestigate_ProfileComplaints
.Where(x => x.Id == periodId)
.Where(x => x.PersonId == personId.ToString())
.FirstOrDefaultAsync();
if (data2 == null)
{
var data3 = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => x.Id == periodId)
.Where(x => x.PersonId == personId.ToString())
.FirstOrDefaultAsync();
if (data3 == null)
{
var data4 = await _context.DisciplineReport_Profiles
.Where(x => x.Id == periodId)
.Where(x => x.PersonId == personId.ToString())
.FirstOrDefaultAsync();
return Success(data4);
}
return Success(data3);
}
return Success(data2);
}
return Success(data1);
}
}
}

View file

@ -47,5 +47,19 @@ namespace BMA.EHR.Domain.Models.Commands.Core
[Comment("เงินค่าตอบแทนรายเดือน")]
public double? MouthSalaryAmount { get; set; }
[MaxLength(40), Comment("วันเกิด")]
public DateTime? BirthDate { get; set; }
[Comment("ชื่อหน่วยงาน root")]
public string? Organization { get; set; }
[Comment("ตำแหน่ง")]
public string? PositionName { get; set; }
[Comment("ระดับ")]
public string? PositionLevel { get; set; }
[Comment("ประเภท")]
public string? PositionType { get; set; }
[Comment("เลขที่ตำแหน่ง")]
public string? PositionNumber { get; set; }
}
}

View file

@ -0,0 +1,91 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableCommandReceiveraddPosition : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "BirthDate",
table: "CommandReceivers",
type: "datetime(6)",
maxLength: 40,
nullable: true,
comment: "วันเกิด");
migrationBuilder.AddColumn<string>(
name: "Organization",
table: "CommandReceivers",
type: "longtext",
nullable: true,
comment: "ชื่อหน่วยงาน root")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "PositionLevel",
table: "CommandReceivers",
type: "longtext",
nullable: true,
comment: "ระดับ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "PositionName",
table: "CommandReceivers",
type: "longtext",
nullable: true,
comment: "ตำแหน่ง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "PositionNumber",
table: "CommandReceivers",
type: "longtext",
nullable: true,
comment: "เลขที่ตำแหน่ง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "PositionType",
table: "CommandReceivers",
type: "longtext",
nullable: true,
comment: "ประเภท")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "BirthDate",
table: "CommandReceivers");
migrationBuilder.DropColumn(
name: "Organization",
table: "CommandReceivers");
migrationBuilder.DropColumn(
name: "PositionLevel",
table: "CommandReceivers");
migrationBuilder.DropColumn(
name: "PositionName",
table: "CommandReceivers");
migrationBuilder.DropColumn(
name: "PositionNumber",
table: "CommandReceivers");
migrationBuilder.DropColumn(
name: "PositionType",
table: "CommandReceivers");
}
}
}

View file

@ -508,6 +508,11 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("double")
.HasComment("เงินเดือน");
b.Property<DateTime?>("BirthDate")
.HasMaxLength(40)
.HasColumnType("datetime(6)")
.HasComment("วันเกิด");
b.Property<string>("CitizenId")
.IsRequired()
.HasMaxLength(13)
@ -582,10 +587,30 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("double")
.HasComment("เงินค่าตอบแทนรายเดือน");
b.Property<string>("Organization")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน root");
b.Property<string>("PositionLevel")
.HasColumnType("longtext")
.HasComment("ระดับ");
b.Property<string>("PositionName")
.HasColumnType("longtext")
.HasComment("ตำแหน่ง");
b.Property<string>("PositionNumber")
.HasColumnType("longtext")
.HasComment("เลขที่ตำแหน่ง");
b.Property<double?>("PositionSalaryAmount")
.HasColumnType("double")
.HasComment("เงินประจำตำแหน่ง");
b.Property<string>("PositionType")
.HasColumnType("longtext")
.HasComment("ประเภท");
b.Property<string>("Prefix")
.IsRequired()
.HasMaxLength(50)

View file

@ -9,6 +9,7 @@ using Newtonsoft.Json;
using Swashbuckle.AspNetCore.Annotations;
using Telerik.Reporting;
using Telerik.Reporting.Processing;
using System.Net.Http.Headers;
namespace BMA.EHR.Report.Service.Controllers
{
@ -1906,7 +1907,7 @@ namespace BMA.EHR.Report.Service.Controllers
#region " C-PM-19 "
private async Task<dynamic> GenerateCommandReportType19_Cover(Guid commandId, string exportType)
private async Task<dynamic> GenerateCommandReportType19_Cover(Guid commandId, string exportType, string token)
{
try
{
@ -1948,7 +1949,7 @@ namespace BMA.EHR.Report.Service.Controllers
throw new Exception(GlobalMessages.CommandNotFound);
}
var raw_data_profile = await _commandReportRepository.GetCommandType25AttachmentAsync(commandId);
var raw_data_profile = await _commandReportRepository.GetCommandType25AttachmentAsync(commandId, token);
var command = new
{
@ -1972,11 +1973,11 @@ namespace BMA.EHR.Report.Service.Controllers
RefRaw = raw_data.RefRaw == null ? "" : raw_data.RefRaw.ToThaiNumber(),
Result = raw_data.Result == null ? "" : raw_data.Result.ToThaiNumber(),
Fullname = raw_data_profile == null ? "" : raw_data_profile.FullName,
Positionname = raw_data_profile == null ? "" : raw_data_profile.Positionname,
Positionno = raw_data_profile == null || raw_data_profile.Positionno == null ? "" : raw_data_profile.Positionno.ToThaiNumber(),
Organizationname = raw_data_profile == null || raw_data_profile.Organizationname == null ? "" : raw_data_profile.Organizationname.ToThaiNumber(),
Salary = raw_data_profile == null || raw_data_profile.Salary == null ? "" : raw_data_profile.Salary.ToThaiNumber(),
Fullname = raw_data_profile == null ? "" : raw_data_profile.fullName,
Positionname = raw_data_profile == null ? "" : raw_data_profile.positionname,
Positionno = raw_data_profile == null ? "" : raw_data_profile.positionno.ToThaiNumber(),
Organizationname = raw_data_profile == null ? "" : raw_data_profile.organizationname.ToThaiNumber(),
Salary = raw_data_profile == null ? "" : raw_data_profile.salary.ToThaiNumber(),
OrderDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
SignatoryBy = raw_data.AuthorizedUserFullName,
@ -1999,7 +2000,7 @@ namespace BMA.EHR.Report.Service.Controllers
#region " C-PM-20 "
private async Task<dynamic> GenerateCommandReportType20_Cover(Guid commandId, string exportType)
private async Task<dynamic> GenerateCommandReportType20_Cover(Guid commandId, string exportType, string token)
{
try
{
@ -2041,7 +2042,7 @@ namespace BMA.EHR.Report.Service.Controllers
throw new Exception(GlobalMessages.CommandNotFound);
}
var raw_data_profile = await _commandReportRepository.GetCommandType25AttachmentAsync(commandId);
var raw_data_profile = await _commandReportRepository.GetCommandType25AttachmentAsync(commandId, token);
var command = new
{
@ -2065,11 +2066,11 @@ namespace BMA.EHR.Report.Service.Controllers
RefRaw = raw_data.RefRaw == null ? "" : raw_data.RefRaw.ToThaiNumber(),
Result = raw_data.Result == null ? "" : raw_data.Result.ToThaiNumber(),
Fullname = raw_data_profile == null ? "" : raw_data_profile.FullName,
Positionname = raw_data_profile == null ? "" : raw_data_profile.Positionname,
Positionno = raw_data_profile == null || raw_data_profile.Positionno == null ? "" : raw_data_profile.Positionno.ToThaiNumber(),
Organizationname = raw_data_profile == null || raw_data_profile.Organizationname == null ? "" : raw_data_profile.Organizationname.ToThaiNumber(),
Salary = raw_data_profile == null || raw_data_profile.Salary == null ? "" : raw_data_profile.Salary.ToThaiNumber(),
Fullname = raw_data_profile == null ? "" : raw_data_profile.fullName,
Positionname = raw_data_profile == null ? "" : raw_data_profile.positionname,
Positionno = raw_data_profile == null ? "" : raw_data_profile.positionno.ToThaiNumber(),
Organizationname = raw_data_profile == null ? "" : raw_data_profile.organizationname.ToThaiNumber(),
Salary = raw_data_profile == null ? "" : raw_data_profile.salary.ToThaiNumber(),
OrderDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
SignatoryBy = raw_data.AuthorizedUserFullName,
@ -2484,7 +2485,7 @@ namespace BMA.EHR.Report.Service.Controllers
#region " C-PM-25 "
private async Task<dynamic> GenerateCommandReportType25_Cover(Guid commandId, string exportType)
private async Task<dynamic> GenerateCommandReportType25_Cover(Guid commandId, string exportType, string token)
{
try
{
@ -2494,7 +2495,7 @@ namespace BMA.EHR.Report.Service.Controllers
throw new Exception(GlobalMessages.CommandNotFound);
}
var raw_data_profile = await _commandReportRepository.GetCommandType25AttachmentAsync(commandId);
var raw_data_profile = await _commandReportRepository.GetCommandType25AttachmentAsync(commandId, token);
var command = new
{
@ -2520,11 +2521,11 @@ namespace BMA.EHR.Report.Service.Controllers
RefRaw = raw_data.RefRaw == null ? "" : raw_data.RefRaw.ToThaiNumber(),
Result = raw_data.Result == null ? "" : raw_data.Result.ToThaiNumber(),
Fullname = raw_data_profile == null ? "" : raw_data_profile.FullName,
Positionname = raw_data_profile == null ? "" : raw_data_profile.Positionname,
Positionno = raw_data_profile == null || raw_data_profile.Positionno == null ? "" : raw_data_profile.Positionno.ToThaiNumber(),
Organizationname = raw_data_profile == null || raw_data_profile.Organizationname == null ? "" : raw_data_profile.Organizationname.ToThaiNumber(),
Salary = raw_data_profile == null || raw_data_profile.Salary == null ? "" : raw_data_profile.Salary.ToThaiNumber(),
Fullname = raw_data_profile == null ? "" : raw_data_profile.fullName,
Positionname = raw_data_profile == null ? "" : raw_data_profile.positionname,
Positionno = raw_data_profile == null ? "" : raw_data_profile.positionno.ToThaiNumber(),
Organizationname = raw_data_profile == null ? "" : raw_data_profile.organizationname.ToThaiNumber(),
Salary = raw_data_profile == null ? "" : raw_data_profile.salary.ToThaiNumber(),
OrderDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
SignatoryBy = raw_data.AuthorizedUserFullName,
@ -3905,11 +3906,10 @@ namespace BMA.EHR.Report.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("c-pm-19/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType19CoverReport(Guid id, string exportType = "pdf")
public async Task<ActionResult<ResponseObject>> GetCommandType19CoverReport([FromHeader] string authorization, Guid id, string exportType = "pdf")
{
try
{
@ -3924,7 +3924,13 @@ namespace BMA.EHR.Report.Service.Controllers
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType19_Cover(id, exportType);
var token = string.Empty;
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
{
var scheme = headerValue.Scheme;
token = headerValue.Parameter;
}
var contentData = await GenerateCommandReportType19_Cover(id, exportType, token);
var data = new
{
template = "DP6_005",
@ -3964,11 +3970,10 @@ namespace BMA.EHR.Report.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("c-pm-20/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType20CoverReport(Guid id, string exportType = "pdf")
public async Task<ActionResult<ResponseObject>> GetCommandType20CoverReport([FromHeader] string authorization, Guid id, string exportType = "pdf")
{
try
{
@ -3983,7 +3988,13 @@ namespace BMA.EHR.Report.Service.Controllers
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType20_Cover(id, exportType);
var token = string.Empty;
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
{
var scheme = headerValue.Scheme;
token = headerValue.Parameter;
}
var contentData = await GenerateCommandReportType20_Cover(id, exportType, token);
var data = new
{
template = "DP6_008",
@ -4273,11 +4284,10 @@ namespace BMA.EHR.Report.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("c-pm-25/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType25CoverReport(Guid id, string exportType = "pdf")
public async Task<ActionResult<ResponseObject>> GetCommandType25CoverReport([FromHeader] string authorization, Guid id, string exportType = "pdf")
{
try
{
@ -4292,7 +4302,13 @@ namespace BMA.EHR.Report.Service.Controllers
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
var token = string.Empty;
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
{
var scheme = headerValue.Scheme;
token = headerValue.Parameter;
}
var contentData = await GenerateCommandReportType25_Cover(id, exportType, token);
var data = new
{
template = "DP6_006",
@ -4330,11 +4346,10 @@ namespace BMA.EHR.Report.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("c-pm-26/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType26CoverReport(Guid id, string exportType = "pdf")
public async Task<ActionResult<ResponseObject>> GetCommandType26CoverReport([FromHeader] string authorization, Guid id, string exportType = "pdf")
{
try
{
@ -4349,7 +4364,13 @@ namespace BMA.EHR.Report.Service.Controllers
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
var token = string.Empty;
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
{
var scheme = headerValue.Scheme;
token = headerValue.Parameter;
}
var contentData = await GenerateCommandReportType25_Cover(id, exportType, token);
var data = new
{
template = "DP6_006",
@ -4387,11 +4408,10 @@ namespace BMA.EHR.Report.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("c-pm-27/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType27CoverReport(Guid id, string exportType = "pdf")
public async Task<ActionResult<ResponseObject>> GetCommandType27CoverReport([FromHeader] string authorization, Guid id, string exportType = "pdf")
{
try
{
@ -4406,7 +4426,13 @@ namespace BMA.EHR.Report.Service.Controllers
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
var token = string.Empty;
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
{
var scheme = headerValue.Scheme;
token = headerValue.Parameter;
}
var contentData = await GenerateCommandReportType25_Cover(id, exportType, token);
var data = new
{
template = "DP6_006",
@ -4444,11 +4470,10 @@ namespace BMA.EHR.Report.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("c-pm-28/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType28CoverReport(Guid id, string exportType = "pdf")
public async Task<ActionResult<ResponseObject>> GetCommandType28CoverReport([FromHeader] string authorization, Guid id, string exportType = "pdf")
{
try
{
@ -4463,7 +4488,13 @@ namespace BMA.EHR.Report.Service.Controllers
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
var token = string.Empty;
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
{
var scheme = headerValue.Scheme;
token = headerValue.Parameter;
}
var contentData = await GenerateCommandReportType25_Cover(id, exportType, token);
var data = new
{
template = "DP6_004",
@ -4501,11 +4532,10 @@ namespace BMA.EHR.Report.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("c-pm-29/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType29CoverReport(Guid id, string exportType = "pdf")
public async Task<ActionResult<ResponseObject>> GetCommandType29CoverReport([FromHeader] string authorization, Guid id, string exportType = "pdf")
{
try
{
@ -4520,7 +4550,13 @@ namespace BMA.EHR.Report.Service.Controllers
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
var token = string.Empty;
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
{
var scheme = headerValue.Scheme;
token = headerValue.Parameter;
}
var contentData = await GenerateCommandReportType25_Cover(id, exportType, token);
var data = new
{
template = "DP6_007",
@ -4558,11 +4594,10 @@ namespace BMA.EHR.Report.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("c-pm-30/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType30CoverReport(Guid id, string exportType = "pdf")
public async Task<ActionResult<ResponseObject>> GetCommandType30CoverReport([FromHeader] string authorization, Guid id, string exportType = "pdf")
{
try
{
@ -4577,7 +4612,13 @@ namespace BMA.EHR.Report.Service.Controllers
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
var token = string.Empty;
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
{
var scheme = headerValue.Scheme;
token = headerValue.Parameter;
}
var contentData = await GenerateCommandReportType25_Cover(id, exportType, token);
var data = new
{
template = "DP6_002",
@ -4615,11 +4656,10 @@ namespace BMA.EHR.Report.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("c-pm-31/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType31CoverReport(Guid id, string exportType = "pdf")
public async Task<ActionResult<ResponseObject>> GetCommandType31CoverReport([FromHeader] string authorization, Guid id, string exportType = "pdf")
{
try
{
@ -4634,7 +4674,13 @@ namespace BMA.EHR.Report.Service.Controllers
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
var token = string.Empty;
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
{
var scheme = headerValue.Scheme;
token = headerValue.Parameter;
}
var contentData = await GenerateCommandReportType25_Cover(id, exportType, token);
var data = new
{
template = "DP6_001",
@ -4672,11 +4718,10 @@ namespace BMA.EHR.Report.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("c-pm-32/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType32CoverReport(Guid id, string exportType = "pdf")
public async Task<ActionResult<ResponseObject>> GetCommandType32CoverReport([FromHeader] string authorization, Guid id, string exportType = "pdf")
{
try
{
@ -4691,7 +4736,13 @@ namespace BMA.EHR.Report.Service.Controllers
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType25_Cover(id, exportType);
var token = string.Empty;
if (AuthenticationHeaderValue.TryParse(authorization, out var headerValue))
{
var scheme = headerValue.Scheme;
token = headerValue.Parameter;
}
var contentData = await GenerateCommandReportType25_Cover(id, exportType, token);
var data = new
{
template = "DP6_003",

View file

@ -56,5 +56,6 @@
}
]
},
"APIPROBATION": "https://bma-ehr.frappet.synology.me/api/v1/probation/"
"APIPROBATION": "https://bma-ehr.frappet.synology.me/api/v1/probation/",
"API": "https://bma-ehr.frappet.synology.me/api/v1/"
}

View file

@ -322,7 +322,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
await _context.SaveChangesAsync();
var _baseAPI = _configuration["API"];
var _apiUrl = $"{_baseAPI}/org/profile/leave/{req.ProfileId}";
var _apiUrl = $"{_baseAPI}org/profile/leave/{req.ProfileId}";
using (var client = new HttpClient())
{
@ -332,7 +332,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
{
isLeave = true,
leaveReason = "ถึงแก่กรรม",
leaveDate = req.Date,
dateLeave = req.Date,
});
var _result = await _res.Content.ReadAsStringAsync();
}