test dumb

This commit is contained in:
Kittapath 2024-06-19 14:50:38 +07:00
parent 8e967a1fa8
commit 27fd503d9e
8 changed files with 342 additions and 77 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
@ -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
{

View file

@ -12125,5 +12125,157 @@ namespace BMA.EHR.Application.Repositories.Commands
throw;
}
}
/// <summary>
/// </summary>
/// <returns></returns>
private async Task DumpDB(string token = "")
{
try
{
var profiles = await _dbContext.Set<Profile>().ToListAsync();
// create new profile
foreach (var recv in profiles)
{
/*ข้อมูล Profile ใหม่*/
var apiUrl = $"{_configuration["API"]}/org/profile/all";
var profileId = string.Empty;
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
var _res = await client.PostAsJsonAsync(apiUrl, new
{
rank = string.Empty,
prefix = placementProfile.Prefix == null ? string.Empty : placementProfile.Prefix,
firstName = placementProfile.Firstname == null ? string.Empty : placementProfile.Firstname,
lastName = placementProfile.Lastname == null ? string.Empty : placementProfile.Lastname,
citizenId = placementProfile.CitizenId == null ? string.Empty : placementProfile.CitizenId,
position = placementProfile.positionName == null ? string.Empty : placementProfile.positionName,
posLevelId = placementProfile.posLevelId == null ? string.Empty : placementProfile.posLevelId,
posTypeId = placementProfile.posTypeId == null ? string.Empty : placementProfile.posTypeId,
email = placementProfile.Email == null ? string.Empty : placementProfile.Email,
phone = placementProfile.MobilePhone == null ? string.Empty : placementProfile.MobilePhone,
keycloak = string.Empty,
isProbation = false,
isLeave = false,
dateRetire = (DateTime?)null,
dateAppoint = placementProfile.RecruitDate == null ? (DateTime?)null : placementProfile.RecruitDate,
dateStart = (DateTime?)null,
govAgeAbsent = 0,
govAgePlus = 0,
birthDate = placementProfile.DateOfBirth == null ? (DateTime?)null : placementProfile.DateOfBirth,
reasonSameDate = (DateTime?)null,
ethnicity = placementProfile.Race == null ? string.Empty : placementProfile.Race,
telephoneNumber = placementProfile.Telephone == null ? string.Empty : placementProfile.Telephone,
nationality = placementProfile.Nationality == null ? string.Empty : placementProfile.Nationality,
gender = placementProfile.Gender == null ? string.Empty : placementProfile.Gender,
relationship = placementProfile.Relationship == null ? string.Empty : placementProfile.Relationship,
religion = placementProfile.Religion == null ? string.Empty : placementProfile.Religion,
bloodGroup = string.Empty,
registrationAddress = placementProfile.RegistAddress == null ? string.Empty : placementProfile.RegistAddress,
registrationProvinceId = (String?)null,
registrationDistrictId = (String?)null,
registrationSubDistrictId = (String?)null,
registrationZipCode = placementProfile.RegistZipCode == null ? string.Empty : placementProfile.RegistZipCode,
currentAddress = placementProfile.CurrentAddress == null ? string.Empty : placementProfile.CurrentAddress,
currentProvinceId = (String?)null,
currentDistrictId = (String?)null,
currentSubDistrictId = (String?)null,
currentZipCode = placementProfile.CurrentZipCode == null ? string.Empty : placementProfile.CurrentZipCode,
});
var _result = await _res.Content.ReadAsStringAsync();
profileId = JsonConvert.DeserializeObject<PlacementProfileId>(_result).result;
}
if (recv.Educations != null)
{
var apiUrlEdu = $"{_configuration["API"]}/org/profile/educations";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
foreach (var edu in recv.Educations)
{
var _res = await client.PostAsJsonAsync(apiUrlEdu, new
{
profileId = profileId,
country = edu.Country == null ? string.Empty : edu.Country,
degree = edu.Degree == null ? string.Empty : edu.Degree,
duration = edu.Duration == null ? string.Empty : edu.Duration,
durationYear = edu.DurationYear == null ? 0 : edu.DurationYear,
field = edu.Field == null ? string.Empty : edu.Field,
finishDate = edu.FinishDate == null ? (DateTime?)null : edu.FinishDate,
fundName = edu.FundName == null ? string.Empty : edu.FundName,
gpa = edu.Gpa == null ? string.Empty : edu.Gpa,
institute = edu.Institute == null ? string.Empty : edu.Institute,
other = edu.Other == null ? string.Empty : edu.Other,
startDate = edu.StartDate == null ? (DateTime?)null : edu.StartDate,
endDate = edu.EndDate == null ? (DateTime?)null : edu.EndDate,
educationLevel = edu.EducationLevel == null ? string.Empty : edu.EducationLevel.Name,
educationLevelId = string.Empty,
positionPath = edu.PositionPath == null ? null : edu.PositionPath,
positionPathId = string.Empty,
isDate = edu.IsDate,
isEducation = edu.IsEducation,
note = string.Empty,
});
var _result = await _res.Content.ReadAsStringAsync();
}
}
}
if (placementProfile.PlacementCertificates != null)
{
var apiUrlCer = $"{_configuration["API"]}/org/profile/certificate";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
foreach (var cer in placementProfile.PlacementCertificates)
{
var _res = await client.PostAsJsonAsync(apiUrlCer, new
{
profileId = profileId,
expireDate = cer.ExpireDate == null ? (DateTime?)null : cer.ExpireDate,
issueDate = cer.IssueDate == null ? (DateTime?)null : cer.IssueDate,
certificateNo = cer.CertificateNo == null ? string.Empty : cer.CertificateNo,
certificateType = cer.CertificateType == null ? string.Empty : cer.CertificateType,
issuer = cer.Issuer == null ? string.Empty : cer.Issuer,
});
var _result = await _res.Content.ReadAsStringAsync();
}
}
}
var apiUrlSalary = $"{_configuration["API"]}/org/profile/salary";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _res = await client.PostAsJsonAsync(apiUrlSalary, new
{
profileId = profileId,
date = command.CommandAffectDate == null ? (DateTime?)null : command.CommandAffectDate,
amount = recv.Amount == null ? null : recv.Amount,
positionSalaryAmount = placementProfile.PositionSalaryAmount == null ? null : placementProfile.PositionSalaryAmount,
mouthSalaryAmount = placementProfile.MouthSalaryAmount == null ? null : placementProfile.MouthSalaryAmount,
posNo = placementProfile.PosNumber == null ? string.Empty : placementProfile.PosNumber.ToString(),
position = placementProfile.positionName == null ? string.Empty : placementProfile.positionName,
positionLine = string.Empty,
positionPathSide = string.Empty,
positionExecutive = string.Empty,
positionType = placementProfile.posTypeName == null ? string.Empty : placementProfile.posTypeName,
positionLevel = placementProfile.PositionLevel == null ? string.Empty : placementProfile.PositionLevel.Name,
refCommandNo = string.Empty,
templateDoc = string.Empty,
});
var _result = await _res.Content.ReadAsStringAsync();
}
placementProfile.PlacementStatus = "CONTAIN";
await _dbContext.SaveChangesAsync();
}
}
catch
{
throw;
}
}
}
}

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

@ -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

@ -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

@ -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();
}