Merge branch 'develop' into work

This commit is contained in:
Kittapath 2023-09-15 00:10:18 +07:00
commit b3c6b5a147
14 changed files with 106 additions and 79 deletions

View file

@ -162,7 +162,7 @@ namespace BMA.EHR.Application.Repositories.Reports
{ {
No = string.IsNullOrEmpty(evaluate_assign.data.evaluate.no.ToString()) ? string.Empty : evaluate_assign.data.evaluate.no.ToString().ToThaiNumber(), No = string.IsNullOrEmpty(evaluate_assign.data.evaluate.no.ToString()) ? string.Empty : evaluate_assign.data.evaluate.no.ToString().ToThaiNumber(),
EvaluateDateStart = string.IsNullOrEmpty(evaluate_assign.data.evaluate.date_start.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(), EvaluateDateStart = string.IsNullOrEmpty(evaluate_assign.data.evaluate.date_start.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(),
EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.data.evaluate.date_start.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(), EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.data.evaluate.date_finish.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.evaluate.date_finish.ToThaiFullDate().ToString().ToThaiNumber(),
Name = string.IsNullOrEmpty(evaluate_assign.data.experimentee.name) ? string.Empty : evaluate_assign.data.experimentee.name, Name = string.IsNullOrEmpty(evaluate_assign.data.experimentee.name) ? string.Empty : evaluate_assign.data.experimentee.name,
Position = string.IsNullOrEmpty(evaluate_assign.data.experimentee.Position) ? string.Empty : evaluate_assign.data.experimentee.Position, Position = string.IsNullOrEmpty(evaluate_assign.data.experimentee.Position) ? string.Empty : evaluate_assign.data.experimentee.Position,
Department = string.IsNullOrEmpty(evaluate_assign.data.experimentee.Department) ? string.Empty : evaluate_assign.data.experimentee.Department, Department = string.IsNullOrEmpty(evaluate_assign.data.experimentee.Department) ? string.Empty : evaluate_assign.data.experimentee.Department,
@ -206,7 +206,7 @@ namespace BMA.EHR.Application.Repositories.Reports
{ {
No = string.IsNullOrEmpty(evaluate_assign.data.evaluate.no.ToString()) ? string.Empty : evaluate_assign.data.evaluate.no.ToString().ToThaiNumber(), No = string.IsNullOrEmpty(evaluate_assign.data.evaluate.no.ToString()) ? string.Empty : evaluate_assign.data.evaluate.no.ToString().ToThaiNumber(),
EvaluateDateStart = string.IsNullOrEmpty(evaluate_assign.data.evaluate.date_start.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(), EvaluateDateStart = string.IsNullOrEmpty(evaluate_assign.data.evaluate.date_start.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(),
EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.data.evaluate.date_start.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(), EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.data.evaluate.date_finish.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.evaluate.date_finish.ToThaiFullDate().ToString().ToThaiNumber(),
Name = string.IsNullOrEmpty(evaluate_assign.data.experimentee.name) ? string.Empty : evaluate_assign.data.experimentee.name, Name = string.IsNullOrEmpty(evaluate_assign.data.experimentee.name) ? string.Empty : evaluate_assign.data.experimentee.name,
Position = string.IsNullOrEmpty(evaluate_assign.data.experimentee.Position) ? string.Empty : evaluate_assign.data.experimentee.Position, Position = string.IsNullOrEmpty(evaluate_assign.data.experimentee.Position) ? string.Empty : evaluate_assign.data.experimentee.Position,
Department = string.IsNullOrEmpty(evaluate_assign.data.experimentee.Department) ? string.Empty : evaluate_assign.data.experimentee.Department, Department = string.IsNullOrEmpty(evaluate_assign.data.experimentee.Department) ? string.Empty : evaluate_assign.data.experimentee.Department,

View file

@ -1,12 +1,15 @@
using System.Reflection.Metadata; using System.Reflection.Metadata;
using BMA.EHR.Application.Common.Interfaces; using BMA.EHR.Application.Common.Interfaces;
using BMA.EHR.Application.Responses;
using BMA.EHR.Domain.Extensions; using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Models.HR;
using BMA.EHR.Domain.Models.Organizations; using BMA.EHR.Domain.Models.Organizations;
using BMA.EHR.Domain.Models.Retirement; using BMA.EHR.Domain.Models.Retirement;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
namespace BMA.EHR.Application.Repositories.Reports namespace BMA.EHR.Application.Repositories.Reports
{ {
@ -70,64 +73,73 @@ namespace BMA.EHR.Application.Repositories.Reports
if (retireHistorys == null) if (retireHistorys == null)
return null; return null;
var profile_retireHistory = await _dbContext.Set<RetirementProfile>() //var profile_retireHistory = await _dbContext.Set<RetirementProfile>()
.Where(x => x.RetirementPeriod == retire) // .Where(x => x.RetirementPeriod == retire)
.OrderBy(x => x.Order) // .OrderBy(x => x.Order)
.Select(x => new // .Select(x => new
{ // {
order = x.Order, // order = x.Order,
id = x.Id, // id = x.Id,
reason = x.Reason, // reason = x.Reason,
remove = x.Remove, // remove = x.Remove,
profileId = x.Profile.Id, // profileId = x.Profile.Id,
citizenId = x.Profile.CitizenId, // citizenId = x.Profile.CitizenId,
prefix = x.Profile.Prefix == null ? null : x.Profile.Prefix.Name, // prefix = x.Profile.Prefix == null ? string.Empty : x.Profile.Prefix.Name,
fullName = $"{x.Profile.FirstName} {x.Profile.LastName}", // fullName = $"{x.Profile.FirstName} {x.Profile.LastName}",
organizationOrganization = x.Profile.OrganizationOrganization, // organizationOrganization = x.Profile.OrganizationOrganization,
oc = x.Profile.Oc, // oc = x.Profile.Oc,
position = x.Profile.Position == null ? null : x.Profile.Position.Name, // position = x.Profile.Position == null ? string.Empty : x.Profile.Position.Name,
positionType = x.Profile.PositionType == null ? null : x.Profile.PositionType.Name, // positionType = x.Profile.PositionType == null ? string.Empty : x.Profile.PositionType.Name,
positionExecutive = x.Profile.PositionExecutive, // positionExecutive = x.Profile.PositionExecutive,
posNo = x.Profile.PosNo == null ? null : x.Profile.PosNo.Name, // posNo = x.Profile.PosNo == null ? string.Empty : x.Profile.PosNo.Name,
positionEmployeePosition = x.Profile.PositionEmployeePosition, // positionEmployeePosition = x.Profile.PositionEmployeePosition,
positionEmployeeLevel = x.Profile.PositionEmployeeLevel, // positionEmployeeLevel = x.Profile.PositionEmployeeLevel,
positionEmployeeGroup = x.Profile.PositionEmployeeGroup, // positionEmployeeGroup = x.Profile.PositionEmployeeGroup,
posNoEmployee = x.Profile.PosNoEmployee, // posNoEmployee = x.Profile.PosNoEmployee,
}) // })
.ToListAsync(); // .ToListAsync();
return new { retireHistorys.Id, retireHistorys.CreatedAt, Year = retireHistorys.Year.ToThaiYear().ToString().ToThaiNumber(), retireHistorys.Round, retireHistorys.Type, retireHistorys.TypeReport, Total = retireHistorys.Total.ToString().ToThaiNumber(), profile = profile_retireHistory };
//return new { retireHistorys.Detail, retireHistorys.Id, retireHistorys.CreatedAt, Year = retireHistorys.Year.ToThaiYear().ToString().ToThaiNumber(), retireHistorys.Round, retireHistorys.Type, retireHistorys.TypeReport, Total = retireHistorys.Total.ToString().ToThaiNumber(), profile = profile_retireHistory };
using (var client = new HttpClient())
{
var url = await _documentService.ImagesPathByName($"{retireHistorys.ProfileFile}.json");
var responseTask = client.GetAsync(url);
var results = responseTask.Result;
var json = results.Content.ReadAsStringAsync().Result;
List<ProfileJsonRequest> profiles = JsonConvert.DeserializeObject<List<ProfileJsonRequest>>(json);
profiles = profiles.OrderBy(x => x.order).ToList();
return new { retireHistorys.Detail, retireHistorys.Id, retireHistorys.CreatedAt, Year = retireHistorys.Year.ToThaiYear().ToString().ToThaiNumber(), retireHistorys.Round, retireHistorys.Type, retireHistorys.TypeReport, Total = retireHistorys.Total.ToString().ToThaiNumber(), profile = profiles};
}
} }
else else
{ {
var profile_retire = await _dbContext.Set<RetirementProfile>() var profile_retire = await _dbContext.Set<RetirementProfile>()
.Where(x => x.RetirementPeriod == retire) .Where(x => x.RetirementPeriod == retire)
.OrderBy(x => x.Order) .OrderBy(x => x.Order)
.Select(x => new .Select(x => new
{ {
order = x.Order, order = x.Order,
id = x.Id, id = x.Id,
reason = x.Reason, reason = x.Reason,
remove = x.Remove, remove = x.Remove,
profileId = x.Profile.Id, profileId = x.Profile.Id,
citizenId = x.Profile.CitizenId, citizenId = x.Profile.CitizenId,
prefix = x.Profile.Prefix == null ? null : x.Profile.Prefix.Name, prefix = x.Profile.Prefix == null ? string.Empty : x.Profile.Prefix.Name,
fullName = $"{x.Profile.FirstName} {x.Profile.LastName}", fullName = $"{x.Profile.FirstName} {x.Profile.LastName}",
organizationOrganization = x.Profile.OrganizationOrganization, organizationOrganization = x.Profile.OrganizationOrganization,
oc = x.Profile.Oc, oc = x.Profile.Oc,
position = x.Profile.Position == null ? null : x.Profile.Position.Name, position = x.Profile.Position == null ? string.Empty : x.Profile.Position.Name,
positionType = x.Profile.PositionType == null ? null : x.Profile.PositionType.Name, positionType = x.Profile.PositionType == null ? string.Empty : x.Profile.PositionType.Name,
positionExecutive = x.Profile.PositionExecutive, positionExecutive = x.Profile.PositionExecutive,
posNo = x.Profile.PosNo == null ? null : x.Profile.PosNo.Name, posNo = x.Profile.PosNo == null ? string.Empty : x.Profile.PosNo.Name,
positionEmployeePosition = x.Profile.PositionEmployeePosition, positionEmployeePosition = x.Profile.PositionEmployeePosition,
positionEmployeeLevel = x.Profile.PositionEmployeeLevel, positionEmployeeLevel = x.Profile.PositionEmployeeLevel,
positionEmployeeGroup = x.Profile.PositionEmployeeGroup, positionEmployeeGroup = x.Profile.PositionEmployeeGroup,
posNoEmployee = x.Profile.PosNoEmployee, posNoEmployee = x.Profile.PosNoEmployee,
}) })
.ToListAsync(); .ToListAsync();
return new { retire.Id, retire.CreatedAt, Year = retire.Year.ToThaiYear().ToString().ToThaiNumber(), retire.Round, retire.Type, retire.TypeReport, Total = profile_retire.Count.ToString().ToThaiNumber(), profile = profile_retire }; return new { retire.Detail, retire.Id, retire.CreatedAt, Year = retire.Year.ToThaiYear().ToString().ToThaiNumber(), retire.Round, retire.Type, retire.TypeReport, Total = profile_retire.Count.ToString().ToThaiNumber(), profile = profile_retire };
} }
} }
#endregion #endregion

View file

@ -126,6 +126,7 @@ namespace BMA.EHR.Application.Responses
public int develop_other_training_percent { get; set; } public int develop_other_training_percent { get; set; }
public int develop_total_percent { get; set; } public int develop_total_percent { get; set; }
public int develop_result { get; set; } public int develop_result { get; set; }
public int evaluate_result { get; set; }
public DateTime createdAt { get; set; } public DateTime createdAt { get; set; }
public DateTime updatedAt { get; set; } public DateTime updatedAt { get; set; }
} }

View file

@ -0,0 +1,24 @@
namespace BMA.EHR.Application.Responses
{
public class ProfileJsonRequest
{
public int order { get; set; }
public Guid id { get; set; }
public string reason { get; set; }
public string remove { get; set; }
public Guid profileId { get; set; }
public string? citizenId { get; set; }
public string? prefix { get; set; }
public string? fullName { get; set; }
public string? organizationOrganization { get; set; }
public string? oc { get; set; }
public string? position { get; set; }
public string? positionType { get; set; }
public string? positionExecutive { get; set; }
public string? posNo { get; set; }
public string? positionEmployeePosition { get; set; }
public string? positionEmployeeLevel { get; set; }
public string? positionEmployeeGroup { get; set; }
public string? posNoEmployee { get; set; }
}
}

View file

@ -1,22 +1,10 @@
using BMA.EHR.Domain.Common; using BMA.EHR.Domain.Common;
using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Shared;
using BMA.EHR.Application.Repositories.Reports; using BMA.EHR.Application.Repositories.Reports;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.Annotations;
using DocumentFormat.OpenXml.Drawing;
using Telerik.Reporting; using Telerik.Reporting;
using Telerik.Reporting.Processing; using Telerik.Reporting.Processing;
using System.IO;
using Newtonsoft.Json;
using BMA.EHR.Application.Responses;
using static BMA.EHR.Application.Responses.EvaluateRecordAssignResponse;
using static BMA.EHR.Application.Responses.ProbationAssignResponse;
using DocumentFormat.OpenXml.Drawing.Charts;
using DocumentFormat.OpenXml.Bibliography;
using DocumentFormat.OpenXml.Wordprocessing;
namespace BMA.EHR.Report.Service.Controllers namespace BMA.EHR.Report.Service.Controllers
{ {
@ -819,7 +807,7 @@ namespace BMA.EHR.Report.Service.Controllers
Check_Moral2Level2 = moral2.col2, Check_Moral2Level2 = moral2.col2,
Check_Moral2Level3 = moral2.col3, Check_Moral2Level3 = moral2.col3,
Check_Moral2Level4 = moral2.col4, Check_Moral2Level4 = moral2.col4,
Check_Moral2Level5 = moral2.col4, Check_Moral2Level5 = moral2.col5,
Check_Moral3Level1 = moral3.col1, Check_Moral3Level1 = moral3.col1,
Check_Moral3Level2 = moral3.col2, Check_Moral3Level2 = moral3.col2,
Check_Moral3Level3 = moral3.col3, Check_Moral3Level3 = moral3.col3,
@ -1033,7 +1021,7 @@ namespace BMA.EHR.Report.Service.Controllers
Check_Moral2Level2 = moral2.col2, Check_Moral2Level2 = moral2.col2,
Check_Moral2Level3 = moral2.col3, Check_Moral2Level3 = moral2.col3,
Check_Moral2Level4 = moral2.col4, Check_Moral2Level4 = moral2.col4,
Check_Moral2Level5 = moral2.col4, Check_Moral2Level5 = moral2.col5,
Check_Moral3Level1 = moral3.col1, Check_Moral3Level1 = moral3.col1,
Check_Moral3Level2 = moral3.col2, Check_Moral3Level2 = moral3.col2,
Check_Moral3Level3 = moral3.col3, Check_Moral3Level3 = moral3.col3,
@ -1091,6 +1079,7 @@ namespace BMA.EHR.Report.Service.Controllers
develop_other_training_percent = evaluate.develop_other_training_percent, develop_other_training_percent = evaluate.develop_other_training_percent,
develop_total_percent = evaluate.develop_total_percent, develop_total_percent = evaluate.develop_total_percent,
develop_result = evaluate.develop_result, develop_result = evaluate.develop_result,
evaluate_result = evaluate.evaluate_result,
}); });
var tblEvaluateAssign1 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table2"]; var tblEvaluateAssign1 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table2"];
@ -1101,7 +1090,7 @@ namespace BMA.EHR.Report.Service.Controllers
tblEvaluateAssign3.DataSource = _Evaluate; tblEvaluateAssign3.DataSource = _Evaluate;
var tblEvaluateAssign4 = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["table3"]; var tblEvaluateAssign4 = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["table3"];
tblEvaluateAssign4.DataSource = _Evaluate; tblEvaluateAssign4.DataSource = _Evaluate;
report2.DataSource = _Evaluate;
var reportBook = new ReportBook(); var reportBook = new ReportBook();
reportBook.Reports.Add(report); reportBook.Reports.Add(report);
reportBook.Reports.Add(report2); reportBook.Reports.Add(report2);

View file

@ -42,14 +42,10 @@ namespace BMA.EHR.Report.Service.Controllers
public async Task<ActionResult<ResponseObject>> GetProfileRetirement([FromRoute] Guid Id, string exportType = "pdf") public async Task<ActionResult<ResponseObject>> GetProfileRetirement([FromRoute] Guid Id, string exportType = "pdf")
{ {
var retire = await _service.GetProfileRetirementdAsync(Id); var retire = await _service.GetProfileRetirementdAsync(Id);
if (retire == null) if (retire != null)
{ {
return NotFound(); var reportfile = string.Empty;
} var returnfile = string.Empty;
else
{
var reportfile = "";
var returnfile = "";
exportType = exportType.Trim(); exportType = exportType.Trim();
switch (retire.GetType().GetProperty("Type").GetValue(retire)) switch (retire.GetType().GetProperty("Type").GetValue(retire))
{ {
@ -89,9 +85,10 @@ namespace BMA.EHR.Report.Service.Controllers
{ {
report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream); report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream);
} }
//Add Parameter report.DataSource = retire;
report.ReportParameters["Year"].Value = retire.GetType().GetProperty("Year").GetValue(retire); ////Add Parameter
report.ReportParameters["Total"].Value = retire.GetType().GetProperty("Total").GetValue(retire); //report.ReportParameters["Year"].Value = retire.GetType().GetProperty("Year").GetValue(retire);
//report.ReportParameters["Total"].Value = retire.GetType().GetProperty("Total").GetValue(retire);
var _profileList = new List<dynamic>(); var _profileList = new List<dynamic>();
@ -123,6 +120,10 @@ namespace BMA.EHR.Report.Service.Controllers
var content = result.DocumentBytes; var content = result.DocumentBytes;
return File(content, $"application/{exportType}", returnfile); return File(content, $"application/{exportType}", returnfile);
} }
else
{
return NotFound();
}
} }
#endregion #endregion
} }

View file

@ -26,10 +26,10 @@
} }
}, },
"MinIO": { "MinIO": {
"Endpoint": "https://s3.frappet.com/", "Endpoint": "https://s3cluster.frappet.com/",
"AccessKey": "frappet", "AccessKey": "frappet",
"SecretKey": "P@ssw0rd", "SecretKey": "FPTadmin2357",
"BucketName": "bma-recruit" "BucketName": "bma-ehr-fpt"
}, },
"Protocol": "HTTPS", "Protocol": "HTTPS",
"telerikReporting": { "telerikReporting": {