รายงานลัญชี 1-2-3 และรายงาน กพ7
This commit is contained in:
parent
1dc973cc73
commit
a15f2a1081
16 changed files with 1893 additions and 585 deletions
|
|
@ -1,11 +1,342 @@
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using BMA.EHR.Profile.Service.Controllers;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using Telerik.Reporting.Processing;
|
||||
using Telerik.Reporting;
|
||||
using BMA.EHR.Report.Service.Responses;
|
||||
using BMA.EHR.Report.Service.Data;
|
||||
using BMA.EHR.Report.Service.Services;
|
||||
|
||||
namespace BMA.EHR.Report.Service.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[Route("api/v{version:apiVersion}/report/organization")]
|
||||
[ApiVersion("1.0")]
|
||||
[ApiController]
|
||||
public class OrganizationReportController : ControllerBase
|
||||
[Produces("application/json")]
|
||||
//[Authorize]
|
||||
[SwaggerTag("รายงานระบบโครงสร้าง")]
|
||||
public class OrganizationReportController : BaseController
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly EHRDbContext _context;
|
||||
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly string space = "ㅤ";
|
||||
private readonly OrganizationReportService _organizationReportService;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public OrganizationReportController(EHRDbContext context,
|
||||
IWebHostEnvironment hostingEnvironment,
|
||||
IConfiguration configuration,
|
||||
OrganizationReportService organizationReportService)
|
||||
{
|
||||
this._context = context;
|
||||
this._hostingEnvironment = hostingEnvironment;
|
||||
this._configuration = configuration;
|
||||
this._organizationReportService = organizationReportService;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
/// <summary>
|
||||
/// รายงานบัญชี 1
|
||||
/// </summary>
|
||||
/// <param name="id">รหัสสำนัก</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อแสดงรายงานสำเร็จ</response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
|
||||
[HttpGet("account1/{id:length(36)}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult<ResponseObject>> GetAccount1Report(Guid id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = await _organizationReportService.GetReport1Query(id);
|
||||
var result_data = new List<Account1ResultItem>();
|
||||
|
||||
foreach (var d in data)
|
||||
{
|
||||
result_data.Add(new Account1ResultItem
|
||||
{
|
||||
Id = d.Id,
|
||||
RootOcId = d.RootOcId,
|
||||
RootOcName = d.RootOcName,
|
||||
OcFullName = d.OcFullName.Replace($"\r\n{d.OcName}", string.Empty),
|
||||
OcId = d.OcId,
|
||||
OcName = d.OcName,
|
||||
ShortName = d.ShortName,
|
||||
PositionNumber = d.PositionNumber,
|
||||
PositionNumberInt = Convert.ToInt32(d.PositionNumber.Replace(d.ShortName, string.Empty)),
|
||||
PositionName = d.PositionName,
|
||||
PositionSide = d.PositionSide,
|
||||
PositionExecutive = d.PositionExecutive,
|
||||
PositionExecutiveSide = d.PositionExecutiveSide,
|
||||
OcOrder = d.OcOrder,
|
||||
PositionLevel = d.PositionLevel,
|
||||
Remark = d.Remark,
|
||||
PositionType = d.PositionType,
|
||||
});
|
||||
}
|
||||
|
||||
var items = result_data.OrderBy(x => x.OcOrder).ThenBy(x => x.PositionNumberInt).ToList();
|
||||
|
||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Organization", $"rptAccount1.trdp");
|
||||
ReportPackager reportPackager = new ReportPackager();
|
||||
Telerik.Reporting.Report report = null;
|
||||
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||
{
|
||||
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||
}
|
||||
|
||||
report.DataSource = items;
|
||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||
|
||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||
{
|
||||
ReportDocument = report
|
||||
};
|
||||
|
||||
|
||||
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
|
||||
|
||||
var first_record = items.FirstOrDefault();
|
||||
|
||||
var content = result.DocumentBytes;
|
||||
return File(content, "application/pdf", $"รายงานบัญชี1_{first_record.RootOcName}_.pdf");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// รายงานบัญชี 2
|
||||
/// </summary>
|
||||
/// <param name="id">รหัสสำนัก</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อแสดงรายงานสำเร็จ</response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
|
||||
[HttpGet("account2/{id:length(36)}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult<ResponseObject>> GetAccount2Report(Guid id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = await _organizationReportService.GetReport2Query(id);
|
||||
var result_data = new List<Account2ResultItem>();
|
||||
foreach (var d in data)
|
||||
{
|
||||
result_data.Add(new Account2ResultItem
|
||||
{
|
||||
Id = d.Id,
|
||||
RootOcId = d.RootOcId,
|
||||
RootOcName = d.RootOcName,
|
||||
OcFullName = d.OcFullName.Replace($"\r\n{d.OcName}", string.Empty),
|
||||
OcId = d.OcId,
|
||||
OcName = d.OcName,
|
||||
ShortName = d.ShortName,
|
||||
PositionNumber = d.PositionNumber,
|
||||
PositionNumberInt = d.PositionNumber == "" ? 0 : Convert.ToInt32(d.PositionNumber.Split(".").Last()),
|
||||
PositionName = d.PositionName,
|
||||
PositionSide = d.PositionSide,
|
||||
PositionExecutive = d.PositionExecutive,
|
||||
PositionExecutiveSide = d.PositionExecutiveSide,
|
||||
OcOrder = d.OcOrder,
|
||||
PositionLevel = d.PositionLevel,
|
||||
Remark = d.Remark,
|
||||
PositionType = d.PositionType,
|
||||
|
||||
OcIdNew = d.OcIdNew,
|
||||
OcFullNameNew = d.OcFullNameNew.Replace($"\r\n{d.OcNameNew}", string.Empty),
|
||||
OcNameNew = d.OcNameNew,
|
||||
ShortNameNew = d.ShortNameNew,
|
||||
PositionNumberNew = d.PositionNumberNew,
|
||||
PositionNumberIntNew = d.PositionNumberNew == "" ? 0 : Convert.ToInt32(d.PositionNumberNew.Split(".").Last()),
|
||||
PositionLevelNew = d.PositionLevelNew,
|
||||
PositionNameNew = d.PositionNameNew,
|
||||
PositionSideNew = d.PositionSideNew,
|
||||
PositionExecutiveNew = d.PositionExecutiveNew,
|
||||
PositionExecutiveSideNew = d.PositionExecutiveSideNew,
|
||||
PositionTypeNew = d.PositionTypeNew,
|
||||
|
||||
Prefix = d.Prefix,
|
||||
FirstName = d.FirstName,
|
||||
LastName = d.LastName,
|
||||
Degree = d.Degree,
|
||||
|
||||
Salary = d.Salary,
|
||||
SalaryPosition = d.SalaryPosition,
|
||||
FullName = $"{d.Prefix}{d.FirstName} {d.LastName}".Trim()
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
var items = result_data.OrderBy(x => x.OcOrder).ThenBy(x => x.PositionNumberInt).ToList();
|
||||
|
||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Organization", $"rptAccount2.trdp");
|
||||
ReportPackager reportPackager = new ReportPackager();
|
||||
Telerik.Reporting.Report report = null;
|
||||
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||
{
|
||||
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||
}
|
||||
|
||||
report.DataSource = items;
|
||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||
|
||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||
{
|
||||
ReportDocument = report
|
||||
};
|
||||
|
||||
|
||||
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
|
||||
|
||||
var first_record = items.FirstOrDefault();
|
||||
|
||||
var content = result.DocumentBytes;
|
||||
return File(content, "application/pdf", $"รายงานบัญชี2_{first_record.RootOcName}_.pdf");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
// <summary>
|
||||
/// รายงานบัญชี 3
|
||||
/// </summary>
|
||||
/// <param name="id">รหัสสำนัก</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อแสดงรายงานสำเร็จ</response>
|
||||
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
|
||||
[HttpGet("account3/{id:length(36)}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
[AllowAnonymous]
|
||||
public async Task<ActionResult<ResponseObject>> GetAccount3Report(Guid id)
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = await _organizationReportService.GetReport2Query(id);
|
||||
var result_data = new List<Account2ResultItem>();
|
||||
foreach (var d in data)
|
||||
{
|
||||
result_data.Add(new Account2ResultItem
|
||||
{
|
||||
Id = d.Id,
|
||||
RootOcId = d.RootOcId,
|
||||
RootOcName = d.RootOcName,
|
||||
OcFullName = d.OcFullName.Replace($"\r\n{d.OcName}", string.Empty),
|
||||
OcId = d.OcId,
|
||||
OcName = d.OcName,
|
||||
ShortName = d.ShortName,
|
||||
PositionNumber = d.PositionNumber,
|
||||
PositionNumberInt =d.PositionNumber == "" ? 0 : Convert.ToInt32(d.PositionNumber.Split(".").Last()),
|
||||
PositionName = d.PositionName,
|
||||
PositionSide = d.PositionSide,
|
||||
PositionExecutive = d.PositionExecutive,
|
||||
PositionExecutiveSide = d.PositionExecutiveSide,
|
||||
OcOrder = d.OcOrder,
|
||||
PositionLevel = d.PositionLevel,
|
||||
Remark = d.Remark,
|
||||
PositionType = d.PositionType,
|
||||
|
||||
OcIdNew = d.OcIdNew,
|
||||
OcFullNameNew = d.OcFullNameNew.Replace($"\r\n{d.OcNameNew}", string.Empty),
|
||||
OcNameNew = d.OcNameNew,
|
||||
ShortNameNew = d.ShortNameNew,
|
||||
PositionNumberNew = d.PositionNumberNew,
|
||||
PositionNumberIntNew = d.PositionNumberNew == "" ? 0 : Convert.ToInt32(d.PositionNumberNew.Split(".").Last()),
|
||||
PositionLevelNew = d.PositionLevelNew,
|
||||
PositionNameNew = d.PositionNameNew,
|
||||
PositionSideNew = d.PositionSideNew,
|
||||
PositionExecutiveNew = d.PositionExecutiveNew,
|
||||
PositionExecutiveSideNew = d.PositionExecutiveSideNew,
|
||||
PositionTypeNew = d.PositionTypeNew,
|
||||
|
||||
Prefix = d.Prefix,
|
||||
FirstName = d.FirstName,
|
||||
LastName = d.LastName,
|
||||
Degree = d.Degree,
|
||||
|
||||
Salary = d.Salary,
|
||||
SalaryPosition = d.SalaryPosition,
|
||||
FullName = $"{d.Prefix}{d.FirstName} {d.LastName}".Trim()
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
var items = result_data.OrderBy(x => x.OcOrder).ThenBy(x => x.PositionNumberInt).ToList();
|
||||
|
||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Organization", $"rptAccount3.trdp");
|
||||
ReportPackager reportPackager = new ReportPackager();
|
||||
Telerik.Reporting.Report report = null;
|
||||
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||
{
|
||||
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||
}
|
||||
|
||||
report.DataSource = items;
|
||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||
|
||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||
{
|
||||
ReportDocument = report
|
||||
};
|
||||
|
||||
|
||||
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
|
||||
|
||||
var first_record = items.FirstOrDefault();
|
||||
|
||||
var content = result.DocumentBytes;
|
||||
return File(content, "application/pdf", $"รายงานบัญชี3_{first_record.RootOcName}_.pdf");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.MetaData.Service.Models;
|
||||
using BMA.EHR.Organization.Service.Models.Report2;
|
||||
using BMA.EHR.Profile.Service.Models;
|
||||
using BMA.EHR.Profile.Service.Models.HR;
|
||||
using BMA.EHR.Recruit.Service.Models.Documents;
|
||||
|
|
@ -221,5 +222,9 @@ namespace BMA.EHR.Report.Service.Data
|
|||
public DbSet<ProfileAvatarHistory> ProfileAvatarHistories { get; set; }
|
||||
|
||||
public DbSet<ProfilePosition> ProfilePositions { get; set; }
|
||||
|
||||
public DbSet<Report2> Report2s { get; set; }
|
||||
public DbSet<Report2History> Report2Histories { get; set; }
|
||||
public DbSet<Report2DetailHistory> Report2DetailHistories { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
53
Models/Report2/Report2.cs
Normal file
53
Models/Report2/Report2.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using BMA.EHR.MetaData.Service.Models;
|
||||
|
||||
namespace BMA.EHR.Organization.Service.Models.Report2
|
||||
{
|
||||
public class Report2 : EntityBase
|
||||
{
|
||||
[Comment("รหัสส่วนราชการ")]
|
||||
public Guid? OrganizationShortNameId { get; set; }
|
||||
public string? OrganizationShortName { get; set; }
|
||||
public string? GovernmentCode { get; set; }
|
||||
|
||||
[Comment("ชื่อหน่วยงาน")]
|
||||
public Guid? OrganizationOrganizationId { get; set; }
|
||||
public string? OrganizationOrganization { get; set; }
|
||||
|
||||
[Comment("ตำแหน่งเลขที่")]
|
||||
public Guid? PositionNumId { get; set; }
|
||||
public string? PositionNum { get; set; }
|
||||
|
||||
[Comment("ประเภทตำแหน่ง")]
|
||||
public Guid? PositionTypeId { get; set; }
|
||||
public string? PositionType { get; set; }
|
||||
|
||||
[Comment("ตำแหน่งทางการบริหาร")]
|
||||
public Guid? PositionExecutiveId { get; set; }
|
||||
public string? PositionExecutive { get; set; }
|
||||
|
||||
[Comment("ด้านทางบริหาร")]
|
||||
public Guid? PositionExecutiveSideId { get; set; }
|
||||
public string? PositionExecutiveSide { get; set; }
|
||||
|
||||
[Comment("ตำแหน่งในสายงาน")]
|
||||
public Guid? PositionPathId { get; set; }
|
||||
public string? PositionPath { get; set; }
|
||||
|
||||
[Comment("ด้าน/สาขา")]
|
||||
public Guid? PositionPathSideId { get; set; }
|
||||
public string? PositionPathSide { get; set; }
|
||||
|
||||
[Comment("ระดับตำแหน่ง")]
|
||||
public Guid? PositionLevelId { get; set; }
|
||||
public string? PositionLevel { get; set; }
|
||||
|
||||
[Comment("สถานะการเปลี่ยนแปลง")]
|
||||
public string? Status { get; set; }
|
||||
|
||||
[Comment("สังกัดที่ถือครอง")]
|
||||
public Guid? ProfilePositionId { get; set; }
|
||||
}
|
||||
}
|
||||
12
Models/Report2/Report2DetailHistory.cs
Normal file
12
Models/Report2/Report2DetailHistory.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using BMA.EHR.MetaData.Service.Models;
|
||||
|
||||
namespace BMA.EHR.Organization.Service.Models.Report2
|
||||
{
|
||||
public class Report2DetailHistory : EntityBase
|
||||
{
|
||||
public string? Detail { get; set; }
|
||||
}
|
||||
}
|
||||
102
Models/Report2/Report2History.cs
Normal file
102
Models/Report2/Report2History.cs
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using BMA.EHR.MetaData.Service.Models;
|
||||
|
||||
namespace BMA.EHR.Organization.Service.Models.Report2
|
||||
{
|
||||
public class Report2History : EntityBase
|
||||
{
|
||||
[Comment("ชื่อ-สกุล")]
|
||||
public string? FullName { get; set; }
|
||||
[Comment("คุณวุฒิ")]
|
||||
public string? Education { get; set; }
|
||||
[Comment("เงินเดือน")]
|
||||
public double? Salary { get; set; }
|
||||
[Comment("เงินประจำตำแหน่ง")]
|
||||
public double? SalaryPosition { get; set; }
|
||||
[Comment("เงินตอบแทนรายเดือน")]
|
||||
public double? SalaryMonth { get; set; }
|
||||
|
||||
[Comment("รหัสส่วนราชการ กำหนดเดิม")]
|
||||
public Guid? OldOrganizationShortNameId { get; set; }
|
||||
public string? OldOrganizationShortName { get; set; }
|
||||
public string? OldGovernmentCode { get; set; }
|
||||
|
||||
[Comment("ชื่อหน่วยงาน กำหนดเดิม")]
|
||||
public Guid? OldOrganizationOrganizationId { get; set; }
|
||||
public string? OldOrganizationOrganization { get; set; }
|
||||
|
||||
[Comment("ตำแหน่งเลขที่ กำหนดเดิม")]
|
||||
public Guid? OldPositionNumId { get; set; }
|
||||
public string? OldPositionNum { get; set; }
|
||||
|
||||
[Comment("ประเภทตำแหน่ง กำหนดเดิม")]
|
||||
public Guid? OldPositionTypeId { get; set; }
|
||||
public string? OldPositionType { get; set; }
|
||||
|
||||
[Comment("ตำแหน่งทางการบริหาร กำหนดเดิม")]
|
||||
public Guid? OldPositionExecutiveId { get; set; }
|
||||
public string? OldPositionExecutive { get; set; }
|
||||
|
||||
[Comment("ด้านทางบริหาร กำหนดเดิม")]
|
||||
public Guid? OldPositionExecutiveSideId { get; set; }
|
||||
public string? OldPositionExecutiveSide { get; set; }
|
||||
|
||||
[Comment("ตำแหน่งในสายงาน กำหนดเดิม")]
|
||||
public Guid? OldPositionPathId { get; set; }
|
||||
public string? OldPositionPath { get; set; }
|
||||
|
||||
[Comment("ด้าน/สาขา กำหนดเดิม")]
|
||||
public Guid? OldPositionPathSideId { get; set; }
|
||||
public string? OldPositionPathSide { get; set; }
|
||||
|
||||
[Comment("ระดับตำแหน่ง กำหนดเดิม")]
|
||||
public Guid? OldPositionLevelId { get; set; }
|
||||
public string? OldPositionLevel { get; set; }
|
||||
|
||||
[Comment("รหัสส่วนราชการ กำหนดใหม่")]
|
||||
public Guid? NewOrganizationShortNameId { get; set; }
|
||||
public string? NewOrganizationShortName { get; set; }
|
||||
public string? NewGovernmentCode { get; set; }
|
||||
|
||||
[Comment("ชื่อหน่วยงาน กำหนดใหม่")]
|
||||
public Guid? NewOrganizationOrganizationId { get; set; }
|
||||
public string? NewOrganizationOrganization { get; set; }
|
||||
|
||||
[Comment("ตำแหน่งเลขที่ กำหนดใหม่")]
|
||||
public Guid? NewPositionNumId { get; set; }
|
||||
public string? NewPositionNum { get; set; }
|
||||
|
||||
[Comment("ประเภทตำแหน่ง กำหนดใหม่")]
|
||||
public Guid? NewPositionTypeId { get; set; }
|
||||
public string? NewPositionType { get; set; }
|
||||
|
||||
[Comment("ตำแหน่งทางการบริหาร กำหนดใหม่")]
|
||||
public Guid? NewPositionExecutiveId { get; set; }
|
||||
public string? NewPositionExecutive { get; set; }
|
||||
|
||||
[Comment("ด้านทางบริหาร กำหนดใหม่")]
|
||||
public Guid? NewPositionExecutiveSideId { get; set; }
|
||||
public string? NewPositionExecutiveSide { get; set; }
|
||||
|
||||
[Comment("ตำแหน่งในสายงาน กำหนดใหม่")]
|
||||
public Guid? NewPositionPathId { get; set; }
|
||||
public string? NewPositionPath { get; set; }
|
||||
|
||||
[Comment("ด้าน/สาขา กำหนดใหม่")]
|
||||
public Guid? NewPositionPathSideId { get; set; }
|
||||
public string? NewPositionPathSide { get; set; }
|
||||
|
||||
[Comment("ระดับตำแหน่ง กำหนดใหม่")]
|
||||
public Guid? NewPositionLevelId { get; set; }
|
||||
public string? NewPositionLevel { get; set; }
|
||||
|
||||
[Comment("สถานะการเปลี่ยนแปลง")]
|
||||
public string? Status { get; set; }
|
||||
|
||||
[Comment("สังกัดที่ถือครอง")]
|
||||
public Guid? ProfilePositionId { get; set; }
|
||||
public Report2DetailHistory? Report2DetailHistory { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ using BMA.EHR.Report.Service;
|
|||
using Microsoft.AspNetCore.Mvc.ApiExplorer;
|
||||
using BMA.EHR.Recruit.Service.Services;
|
||||
using BMA.EHR.Profile.Service.Services;
|
||||
using BMA.EHR.Report.Service.Services;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
var issuer = builder.Configuration["Jwt:Issuer"];
|
||||
|
|
@ -95,7 +96,8 @@ builder.Services.AddCors(options => options.AddDefaultPolicy(builder =>
|
|||
// Register Service
|
||||
builder.Services.AddTransient<RecruitService>();
|
||||
builder.Services.AddTransient<ProfileService>();
|
||||
builder.Services.AddTransient<MinIOService>();
|
||||
builder.Services.AddTransient<MinIOService>();
|
||||
builder.Services.AddTransient<OrganizationReportService>();
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddControllers(options =>
|
||||
|
|
|
|||
Binary file not shown.
BIN
Report/Organization/rptAccount2.trdp
Normal file
BIN
Report/Organization/rptAccount2.trdp
Normal file
Binary file not shown.
BIN
Report/Organization/rptAccount3.trdp
Normal file
BIN
Report/Organization/rptAccount3.trdp
Normal file
Binary file not shown.
Binary file not shown.
BIN
Report/Profile/rptKP7_Page1.trdp
Normal file
BIN
Report/Profile/rptKP7_Page1.trdp
Normal file
Binary file not shown.
BIN
Report/Profile/rptKP7_Page2.trdp
Normal file
BIN
Report/Profile/rptKP7_Page2.trdp
Normal file
Binary file not shown.
404
Services/OrganizationReportService.cs
Normal file
404
Services/OrganizationReportService.cs
Normal file
|
|
@ -0,0 +1,404 @@
|
|||
using Amazon.Internal;
|
||||
using BMA.EHR.Extensions;
|
||||
using BMA.EHR.Profile.Service.Services;
|
||||
using BMA.EHR.Report.Service.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace BMA.EHR.Report.Service.Services
|
||||
{
|
||||
public class OrganizationReportService
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly EHRDbContext _context;
|
||||
private readonly EHRDbContext _applicationDbContext;
|
||||
private readonly ProfileService _profileService;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destructor "
|
||||
|
||||
public OrganizationReportService(EHRDbContext context,
|
||||
EHRDbContext applicationDbContext,
|
||||
ProfileService profileService)
|
||||
{
|
||||
_context = context;
|
||||
_applicationDbContext = applicationDbContext;
|
||||
_profileService = profileService;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
#region " Report Query "
|
||||
|
||||
public async Task<List<Account1ResultItem>> GetReport1Query(Guid ocId)
|
||||
{
|
||||
var ocIdList = _profileService.GetAllIdByRoot(ocId);
|
||||
var RootOcName = _profileService.GetOrganizationNameFullPath(ocId, false, false);
|
||||
|
||||
var organizationPositions = await _context.OrganizationPositions.ToListAsync();
|
||||
var positionMasters = await _context.PositionMasters.ToListAsync();
|
||||
var organizations = await _context.Organizations.ToListAsync();
|
||||
var organizationOrganizations = await _applicationDbContext.OrganizationOrganizations.ToListAsync();
|
||||
var organizationShortNames = await _applicationDbContext.OrganizationShortNames.ToListAsync();
|
||||
var positionNumbers = await _context.PositionNumbers.ToListAsync();
|
||||
var executivePositions = await _applicationDbContext.PositionExecutives.ToListAsync();
|
||||
var executivePositionSide = await _applicationDbContext.PositionExecutiveSides.ToListAsync();
|
||||
var positionPaths = await _applicationDbContext.PositionPaths.ToListAsync();
|
||||
var positionPathSides = await _applicationDbContext.PositionPathSides.ToListAsync();
|
||||
var positionTypes = await _applicationDbContext.PositionTypes.ToListAsync();
|
||||
|
||||
var data = (from op in organizationPositions
|
||||
join pm in positionMasters on op.PositionMasterId equals pm.Id
|
||||
join oc in organizations on op.OrganizationId equals oc.Id
|
||||
join oc_n in organizationOrganizations on oc.OrganizationOrganizationId equals oc_n.Id
|
||||
join sn in organizationShortNames on oc.OrganizationShortNameId equals sn.Id
|
||||
join pn in positionNumbers on op.PositionNumberId equals pn.Id
|
||||
join pp in positionPaths on pm.PositionPathId equals pp.Id
|
||||
join pps in positionPathSides on pm.PositionPathSideId equals pps.Id into pp_pps_join
|
||||
from pp_pps in pp_pps_join.DefaultIfEmpty()
|
||||
join ex_p in executivePositions on pm.PositionExecutiveId equals ex_p.Id into pm_exp_join
|
||||
from pm_exp in pm_exp_join.DefaultIfEmpty()
|
||||
join ex_p_s in executivePositionSide on pm.PositionExecutiveSideId equals ex_p_s.Id into pm_exp_s_join
|
||||
from pm_exp_s in pm_exp_s_join.DefaultIfEmpty()
|
||||
join pt in positionTypes on pm.PositionTypeId equals pt.Id
|
||||
where ocIdList.Contains((Guid)op.OrganizationId)
|
||||
select new Account1ResultItem
|
||||
{
|
||||
Id = op.Id,
|
||||
RootOcId = ocId,
|
||||
RootOcName = RootOcName,
|
||||
OcId = op.OrganizationId.Value,
|
||||
OcFullName = _profileService.FindOCFullPathWithNewLine(op.OrganizationId.Value, false, suppress: RootOcName),
|
||||
OcName = _profileService.GetOrganizationName(op.OrganizationId.Value),
|
||||
ShortName = sn.Name,
|
||||
PositionNumber = pn.Name,
|
||||
PositionLevel = _profileService.GetPositionLevel(pm.Id),
|
||||
PositionName = pp.Name,
|
||||
PositionSide = pp_pps == null ? "" : $"({pp_pps.Name})",
|
||||
PositionExecutive = pm_exp == null ? "" : pm_exp.Name,
|
||||
PositionExecutiveSide = pm_exp_s == null ? "" : $"({pm_exp_s.Name})",
|
||||
Remark = op.PositionUserNote,
|
||||
OcOrder = oc.OrganizationOrder.Value,
|
||||
PositionType = pt.Name
|
||||
}).ToList();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<List<Account2ResultItem>> GetReport2Query(Guid ocId)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
var ocIdList = _profileService.GetAllIdByRoot(ocId);
|
||||
var RootOcName = _profileService.GetOrganizationNameFullPath(ocId, false, false);
|
||||
|
||||
var organizationPositions = await _context.OrganizationPositions.ToListAsync();
|
||||
var positionMasters = await _context.PositionMasters.ToListAsync();
|
||||
var organizations = await _context.Organizations.ToListAsync();
|
||||
var organizationOrganizations = await _applicationDbContext.OrganizationOrganizations.ToListAsync();
|
||||
var organizationShortNames = await _applicationDbContext.OrganizationShortNames.ToListAsync();
|
||||
var positionNumbers = await _context.PositionNumbers.ToListAsync();
|
||||
var executivePositions = await _applicationDbContext.PositionExecutives.ToListAsync();
|
||||
var executivePositionSide = await _applicationDbContext.PositionExecutiveSides.ToListAsync();
|
||||
var positionPaths = await _applicationDbContext.PositionPaths.ToListAsync();
|
||||
var positionPathSides = await _applicationDbContext.PositionPathSides.ToListAsync();
|
||||
var positionTypes = await _applicationDbContext.PositionTypes.ToListAsync();
|
||||
var profilePositions = await _context.ProfilePositions.ToListAsync();
|
||||
var prefixes = await _context.Prefixes.ToListAsync();
|
||||
var profiles = await _context.Profiles.ToListAsync();
|
||||
var report2 = await _context.Report2s.ToListAsync();
|
||||
|
||||
var profile_data = (from p in _context.Profiles
|
||||
join pf in _context.Prefixes on p.PrefixId equals pf.Id
|
||||
select new
|
||||
{
|
||||
p.Id,
|
||||
p.CitizenId,
|
||||
Prefix = pf.Name,
|
||||
p.FirstName,
|
||||
p.LastName,
|
||||
p.PositionLine,
|
||||
p.Position,
|
||||
p.PositionPathSide,
|
||||
p.PositionType,
|
||||
p.PositionLevel,
|
||||
p.PositionExecutive,
|
||||
p.PositionExecutiveSide,
|
||||
p.PosNo,
|
||||
p.OrganizationShortName,
|
||||
Degree = p.Educations == null || p.Educations.Count == 0 ? "" : $"{p.Educations.OrderBy(x => x.StartDate).Last().Degree}\r\n({p.Educations.OrderBy(x => x.StartDate).Last().Field})",
|
||||
Salary = p.Salaries == null || p.Salaries.Count == 0 ? 0 : p.Salaries.OrderBy(x => x.Date).Last().Amount,
|
||||
SalaryPosition = p.Salaries == null || p.Salaries.Count == 0 ? 0 : p.Salaries.OrderBy(x => x.Date).Last().PositionSalaryAmount,
|
||||
|
||||
}).ToList();
|
||||
|
||||
|
||||
var report2_data = (from org_pos in _context.OrganizationPositions.ToList()
|
||||
join ppos in _context.ProfilePositions.ToList() on org_pos.Id equals ppos.OrganizationPositionId
|
||||
join pf in profile_data.ToList() on ppos.ProfileId equals pf.Id
|
||||
join r_raw in _context.Report2s.ToList() on ppos.Id equals r_raw.ProfilePositionId into r_join
|
||||
from r in r_join.DefaultIfEmpty()
|
||||
select new
|
||||
{
|
||||
//Id = r.Id,
|
||||
ProfilePositionId = ppos.Id,
|
||||
CitizenId = pf.CitizenId,
|
||||
Prefix = pf.Prefix,
|
||||
FirstName = pf.FirstName,
|
||||
LastName = pf.LastName,
|
||||
OrganizationName = r == null ? "" : r.OrganizationOrganization,
|
||||
ShortName = r == null ? pf.OrganizationShortName : r.OrganizationShortName,
|
||||
PositionNumber = r == null ? pf.PosNo : r.PositionNum,
|
||||
PositionPath = r == null ? pf.Position : r.PositionPath,
|
||||
PositionPathSide = r == null ? pf.PositionPathSide : r.PositionPathSide,
|
||||
PositionType = r == null ? pf.PositionType : r.PositionType,
|
||||
PositionLevel = r == null ? pf.PositionLevel : r.PositionLevel,
|
||||
PositionExecutive = r == null ? pf.PositionExecutive : r.PositionExecutive,
|
||||
PositionExecutiveSide = r == null ? pf.PositionExecutiveSide : r.PositionExecutiveSide,
|
||||
OcId = org_pos.Id,
|
||||
OrganizationPositionId = ppos.OrganizationPositionId,
|
||||
Degree = pf.Degree,
|
||||
Salary = pf.Salary,
|
||||
SalaryPosition = pf.SalaryPosition,
|
||||
}).ToList();
|
||||
|
||||
//var report2_data = (from r in _context.Report2s.ToList()
|
||||
// join ppos in _context.ProfilePositions.ToList() on r.ProfilePositionId equals ppos.Id
|
||||
// join org_pos in _context.OrganizationPositions.ToList() on ppos.OrganizationPositionId equals org_pos.Id
|
||||
// join pf in profile_data.ToList() on ppos.ProfileId equals pf.Id
|
||||
// select new
|
||||
// {
|
||||
// Id = r.Id,
|
||||
// ProfilePositionId = r.ProfilePositionId,
|
||||
// CitizenId = pf.CitizenId,
|
||||
// Prefix = pf.Prefix,
|
||||
// FirstName = pf.FirstName,
|
||||
// LastName = pf.LastName,
|
||||
// OrganizationName = r.OrganizationOrganization,
|
||||
// ShortName = r.OrganizationShortName,
|
||||
// PositionNumber = r.PositionNum,
|
||||
// PositionPath = r.PositionPath,
|
||||
// PositionPathSide = r.PositionPathSide,
|
||||
// PositionType = r.PositionType,
|
||||
// PositionLevel = r.PositionLevel,
|
||||
// PositionExecutive = r.PositionExecutive,
|
||||
// PositionExecutiveSide = r.PositionExecutiveSide,
|
||||
// OcId = org_pos.Id,
|
||||
// OrganizationPositionId = ppos.OrganizationPositionId,
|
||||
// Degree = pf.Degree,
|
||||
// Salary = pf.Salary,
|
||||
// SalaryPosition = pf.SalaryPosition,
|
||||
// }).ToList();
|
||||
|
||||
|
||||
|
||||
var data = (from op in organizationPositions
|
||||
join pm in positionMasters on op.PositionMasterId equals pm.Id
|
||||
join oc in organizations on op.OrganizationId equals oc.Id
|
||||
join oc_n in organizationOrganizations on oc.OrganizationOrganizationId equals oc_n.Id
|
||||
join sn in organizationShortNames on oc.OrganizationShortNameId equals sn.Id
|
||||
join pn in positionNumbers on op.PositionNumberId equals pn.Id
|
||||
join pp in positionPaths on pm.PositionPathId equals pp.Id
|
||||
join pps in positionPathSides on pm.PositionPathSideId equals pps.Id into pp_pps_join
|
||||
from pp_pps in pp_pps_join.DefaultIfEmpty()
|
||||
join ex_p in executivePositions on pm.PositionExecutiveId equals ex_p.Id into pm_exp_join
|
||||
from pm_exp in pm_exp_join.DefaultIfEmpty()
|
||||
join ex_p_s in executivePositionSide on pm.PositionExecutiveSideId equals ex_p_s.Id into pm_exp_s_join
|
||||
from pm_exp_s in pm_exp_s_join.DefaultIfEmpty()
|
||||
join pt in positionTypes on pm.PositionTypeId equals pt.Id
|
||||
join rp2 in report2_data.ToList() on op.Id equals rp2.OrganizationPositionId into rp2_join
|
||||
from rp2_dt in rp2_join.DefaultIfEmpty()
|
||||
|
||||
where ocIdList.Contains((Guid)op.OrganizationId)
|
||||
select new Account2ResultItem
|
||||
{
|
||||
Id = op.Id,
|
||||
RootOcId = ocId,
|
||||
RootOcName = RootOcName,
|
||||
OcId = op.OrganizationId.Value,
|
||||
OcFullName = _profileService.FindOCFullPathWithNewLine(op.OrganizationId.Value, false, suppress: RootOcName),
|
||||
OcName = _profileService.GetOrganizationName(op.OrganizationId.Value),
|
||||
ShortName = sn.Name,
|
||||
PositionNumber = pn.Name,
|
||||
PositionLevel = rp2_dt == null ? _profileService.GetPositionLevel(pm.Id) : rp2_dt.PositionLevel,
|
||||
|
||||
PositionName = pp.Name,
|
||||
PositionSide = pp_pps == null ? "" : $"({pp_pps.Name})",
|
||||
PositionExecutive = pm_exp == null ? "" : pm_exp.Name,
|
||||
PositionExecutiveSide = pm_exp_s == null ? "" : $"({pm_exp_s.Name})",
|
||||
Remark = op.PositionUserNote,
|
||||
OcOrder = oc.OrganizationOrder.Value,
|
||||
PositionType = pt.Name,
|
||||
|
||||
|
||||
OcIdNew = rp2_dt == null ? op.OrganizationId.Value : rp2_dt.OcId,
|
||||
OcFullNameNew = _profileService.FindOCFullPathWithNewLine(op.OrganizationId.Value, false, suppress: RootOcName),
|
||||
OcNameNew = rp2_dt == null ? _profileService.GetOrganizationName(op.OrganizationId.Value) : _profileService.GetOrganizationName(rp2_dt.OcId),
|
||||
ShortNameNew = rp2_dt == null ? "" : rp2_dt.ShortName,
|
||||
PositionNumberNew = rp2_dt == null ? "" : rp2_dt.PositionNumber,
|
||||
PositionLevelNew = rp2_dt == null ? "" : rp2_dt.PositionLevel,
|
||||
PositionNameNew = rp2_dt == null ? "" : rp2_dt.PositionPath,
|
||||
PositionSideNew = rp2_dt == null ? "" : rp2_dt.PositionPathSide,
|
||||
PositionExecutiveNew = rp2_dt == null ? "" : rp2_dt.PositionExecutive,
|
||||
PositionExecutiveSideNew = rp2_dt == null ? "" : rp2_dt.PositionExecutiveSide,
|
||||
PositionTypeNew = rp2_dt == null ? "" : rp2_dt.PositionType,
|
||||
|
||||
Prefix = rp2_dt == null ? "" : rp2_dt.Prefix,
|
||||
FirstName = rp2_dt == null ? "" : rp2_dt.FirstName,
|
||||
LastName = rp2_dt == null ? "" : rp2_dt.LastName,
|
||||
Degree = rp2_dt == null ? "" : rp2_dt.Degree,
|
||||
|
||||
Salary = rp2_dt == null ? 0 : (int)rp2_dt.Salary.Value,
|
||||
SalaryPosition = rp2_dt == null ? 0 : (int)rp2_dt.SalaryPosition.Value,
|
||||
|
||||
|
||||
}).ToList();
|
||||
|
||||
return data;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class Account1ResultItem
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public Guid RootOcId { get; set; }
|
||||
|
||||
public string RootOcName { get; set; } = string.Empty;
|
||||
|
||||
public Guid OcId { get; set; }
|
||||
|
||||
public string OcFullName { get; set; } = string.Empty;
|
||||
|
||||
public string OcName { get; set; } = string.Empty;
|
||||
|
||||
public string ShortName { get; set; } = string.Empty;
|
||||
|
||||
public string PositionNumber { get; set; } = string.Empty;
|
||||
|
||||
public string PositionName { get; set; } = string.Empty;
|
||||
|
||||
public string PositionSide { get; set; } = string.Empty;
|
||||
|
||||
public string PositionLevel { get; set; } = string.Empty;
|
||||
|
||||
public string PositionExecutive { get; set; } = string.Empty;
|
||||
|
||||
public string PositionExecutiveSide { get; set; } = string.Empty;
|
||||
|
||||
public string Remark { get; set; } = string.Empty;
|
||||
|
||||
public int OcOrder { get; set; } = 0;
|
||||
|
||||
public int PositionNumberInt { get; set; } = 0;
|
||||
|
||||
public string PositionType { get; set; } = string.Empty;
|
||||
}
|
||||
|
||||
public class Account2ResultItem
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public Guid RootOcId { get; set; }
|
||||
|
||||
public string RootOcName { get; set; } = string.Empty;
|
||||
|
||||
public Guid OcId { get; set; }
|
||||
|
||||
public string OcFullName { get; set; } = string.Empty;
|
||||
|
||||
public string OcName { get; set; } = string.Empty;
|
||||
|
||||
public string ShortName { get; set; } = string.Empty;
|
||||
|
||||
public string PositionNumber { get; set; } = string.Empty;
|
||||
|
||||
public string PositionName { get; set; } = string.Empty;
|
||||
|
||||
public string PositionSide { get; set; } = string.Empty;
|
||||
|
||||
public string PositionLevel { get; set; } = string.Empty;
|
||||
|
||||
public string PositionExecutive { get; set; } = string.Empty;
|
||||
|
||||
public string PositionExecutiveSide { get; set; } = string.Empty;
|
||||
|
||||
public string Remark { get; set; } = string.Empty;
|
||||
|
||||
public int OcOrder { get; set; } = 0;
|
||||
|
||||
public int PositionNumberInt { get; set; } = 0;
|
||||
|
||||
public string PositionType { get; set; } = string.Empty;
|
||||
|
||||
// new
|
||||
public Guid RootOcIdNew { get; set; }
|
||||
|
||||
public string RootOcNameNew { get; set; } = string.Empty;
|
||||
|
||||
public Guid OcIdNew { get; set; }
|
||||
|
||||
public string OcFullNameNew { get; set; } = string.Empty;
|
||||
|
||||
public string OcNameNew { get; set; } = string.Empty;
|
||||
|
||||
public string ShortNameNew { get; set; } = string.Empty;
|
||||
|
||||
public string PositionNumberNew { get; set; } = string.Empty;
|
||||
|
||||
public string PositionNameNew { get; set; } = string.Empty;
|
||||
|
||||
public string PositionSideNew { get; set; } = string.Empty;
|
||||
|
||||
public string PositionLevelNew { get; set; } = string.Empty;
|
||||
|
||||
public string PositionExecutiveNew { get; set; } = string.Empty;
|
||||
|
||||
public string PositionExecutiveSideNew { get; set; } = string.Empty;
|
||||
|
||||
public int PositionNumberIntNew { get; set; } = 0;
|
||||
|
||||
public string PositionTypeNew { get; set; } = string.Empty;
|
||||
|
||||
// name
|
||||
public string Prefix { get; set; } = string.Empty;
|
||||
|
||||
public string FirstName { get; set; } = string.Empty;
|
||||
|
||||
public string LastName { get; set; } = string.Empty;
|
||||
|
||||
public string Degree { get; set; } = string.Empty;
|
||||
|
||||
public int Salary { get; set; } = 0;
|
||||
|
||||
public int SalaryPosition { get; set; } = 0;
|
||||
|
||||
public string FullName { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class OrganizationItem
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
public int Order { get; set; } = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
using BMA.EHR.Profile.Service.Models;
|
||||
using Amazon.S3.Model.Internal.MarshallTransformations;
|
||||
using BMA.EHR.Profile.Service.Models;
|
||||
using BMA.EHR.Report.Service.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Text.RegularExpressions;
|
||||
|
|
@ -115,6 +116,33 @@ namespace BMA.EHR.Profile.Service.Services
|
|||
}
|
||||
}
|
||||
|
||||
public string GetOrganizationName(Guid id)
|
||||
{
|
||||
try
|
||||
{
|
||||
var organizations = _context.Organizations.ToList();
|
||||
var organizationOrganizations = _context.OrganizationOrganizations.ToList();
|
||||
|
||||
|
||||
var oc = (from o in organizations
|
||||
join oc_name in organizationOrganizations on o.OrganizationOrganizationId equals oc_name.Id
|
||||
select new
|
||||
{
|
||||
Id = o.Id,
|
||||
Name = oc_name.Name,
|
||||
//o.IsActive,
|
||||
o.ParentId,
|
||||
IsRoot = o.ParentId == null
|
||||
}).FirstOrDefault(x => x.Id == id);
|
||||
|
||||
return oc == null ? "" : oc.Name;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public string GetOrganizationNameFullPath(Guid id, bool showRoot = false, bool descending = false)
|
||||
{
|
||||
try
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
"ConnectionStrings": {
|
||||
"MongoConnection": "mongodb://admin:adminVM123@127.0.0.1:27017",
|
||||
"RecruitConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_recruit;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
"EHRConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
"EHRConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
"ExamConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||
},
|
||||
"Jwt": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue