Merge branch 'develop' of github.com:Frappet/BMA-EHR-BackEnd into develop
This commit is contained in:
commit
ca90b44c74
2 changed files with 239 additions and 103 deletions
|
|
@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal;
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using OfficeOpenXml.Export.ToDataTable;
|
||||||
using Swashbuckle.AspNetCore.Annotations;
|
using Swashbuckle.AspNetCore.Annotations;
|
||||||
|
|
||||||
namespace BMA.EHR.Insignia.Service.Controllers
|
namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
|
|
@ -437,6 +438,9 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
//var _organization = await _context.Organizations.AsQueryable()
|
//var _organization = await _context.Organizations.AsQueryable()
|
||||||
// .FirstOrDefaultAsync(x => x.Id == insigniaNoteProfile.Profile.OcId);
|
// .FirstOrDefaultAsync(x => x.Id == insigniaNoteProfile.Profile.OcId);
|
||||||
|
|
||||||
|
//TODO : Hardcode OCId
|
||||||
|
if (req.BorrowOrganizationId == null) req.BorrowOrganizationId = Guid.Parse("e8493cd1-d371-402e-add6-566e68d5d1b3");
|
||||||
|
|
||||||
var organization = _userProfileRepository.GetOc(req.BorrowOrganizationId.Value, 0, AccessToken);
|
var organization = _userProfileRepository.GetOc(req.BorrowOrganizationId.Value, 0, AccessToken);
|
||||||
//if (organization == null)
|
//if (organization == null)
|
||||||
// return Error(GlobalMessages.OrganizationNotFound);
|
// return Error(GlobalMessages.OrganizationNotFound);
|
||||||
|
|
@ -548,30 +552,27 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
.FirstOrDefaultAsync(x => x.Id == insigniaTypeId);
|
.FirstOrDefaultAsync(x => x.Id == insigniaTypeId);
|
||||||
if (insigniaType == null)
|
if (insigniaType == null)
|
||||||
return Error(GlobalMessages.InsigniaTypeNotFound);
|
return Error(GlobalMessages.InsigniaTypeNotFound);
|
||||||
var data = await _context.InsigniaManageProfiles.AsQueryable()
|
|
||||||
|
|
||||||
|
var rawData = await _context.InsigniaManageProfiles.AsQueryable()
|
||||||
.Where(x => x.InsigniaNoteProfile.RequestInsignia.InsigniaType == insigniaType)
|
.Where(x => x.InsigniaNoteProfile.RequestInsignia.InsigniaType == insigniaType)
|
||||||
.Where(x => year == 0 ? x.Id != null : x.InsigniaManageOrganiation.InsigniaManage.Year == year)
|
.Where(x => year == 0 ? x.Id != null : x.InsigniaManageOrganiation.InsigniaManage.Year == year)
|
||||||
.OrderByDescending(x => x.CreatedAt)
|
.OrderByDescending(x => x.CreatedAt)
|
||||||
.Select(p => new
|
.Select(p => new
|
||||||
{
|
{
|
||||||
Id = p.Id,
|
Id = p.Id,
|
||||||
|
BorrowOrganization = p.BorrowOrganizationId == null ? null : _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken),
|
||||||
|
ReturnOrganization = p.ReturnOrganizationId == null ? null : _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken),
|
||||||
|
Profile = p.InsigniaNoteProfile.ProfileId == null ? null : _userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken),
|
||||||
|
|
||||||
Status = p.Status,
|
Status = p.Status,
|
||||||
BorrowOrganization = _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken) == null ? null : _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken).Root,
|
|
||||||
BorrowOrganizationId = _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken) == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken).RootId,
|
|
||||||
BorrowDate = p.BorrowDate,
|
BorrowDate = p.BorrowDate,
|
||||||
ReturnDate = p.ReturnDate,
|
ReturnDate = p.ReturnDate,
|
||||||
ReturnOrganization = _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken) == null ? null : _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken).Root,
|
|
||||||
ReturnOrganizationId = _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken) == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken).RootId,
|
|
||||||
ReturnReason = p.ReturnReason,
|
ReturnReason = p.ReturnReason,
|
||||||
LastUpdatedAt = p.LastUpdatedAt,
|
LastUpdatedAt = p.LastUpdatedAt,
|
||||||
CreatedAt = p.CreatedAt,
|
CreatedAt = p.CreatedAt,
|
||||||
|
|
||||||
InsigniaNoteProfileId = p.InsigniaNoteProfile.Id,
|
InsigniaNoteProfileId = p.InsigniaNoteProfile.Id,
|
||||||
Prefix = _userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).Prefix,
|
|
||||||
Position = _userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).Position,
|
|
||||||
_userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).CitizenId,
|
|
||||||
_userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).ProfileType,
|
|
||||||
FullName = $"{_userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).Prefix}{_userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).FirstName} {_userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).LastName}",
|
|
||||||
RequestInsignia = p.InsigniaNoteProfile.RequestInsignia == null ? null : p.InsigniaNoteProfile.RequestInsignia.Name,
|
RequestInsignia = p.InsigniaNoteProfile.RequestInsignia == null ? null : p.InsigniaNoteProfile.RequestInsignia.Name,
|
||||||
RequestInsigniaId = p.InsigniaNoteProfile.RequestInsignia == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.InsigniaNoteProfile.RequestInsignia.Id,
|
RequestInsigniaId = p.InsigniaNoteProfile.RequestInsignia == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.InsigniaNoteProfile.RequestInsignia.Id,
|
||||||
RequestInsigniaShortName = p.InsigniaNoteProfile.RequestInsignia == null ? null : p.InsigniaNoteProfile.RequestInsignia.ShortName,
|
RequestInsigniaShortName = p.InsigniaNoteProfile.RequestInsignia == null ? null : p.InsigniaNoteProfile.RequestInsignia.ShortName,
|
||||||
|
|
@ -592,6 +593,94 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
p.InsigniaNoteProfile.Salary,
|
p.InsigniaNoteProfile.Salary,
|
||||||
})
|
})
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
|
var data = rawData
|
||||||
|
.Select(p => new
|
||||||
|
{
|
||||||
|
p.Id,
|
||||||
|
p.Status,
|
||||||
|
BorrowOrganization = p.BorrowOrganization == null ? "" : p.BorrowOrganization.Root,
|
||||||
|
BorrowOrganizationId = p.BorrowOrganization == null ? Guid.Empty : p.BorrowOrganization.RootId,
|
||||||
|
p.BorrowDate,
|
||||||
|
p.ReturnDate,
|
||||||
|
ReturnOrganization = p.ReturnOrganization == null ? "" : p.ReturnOrganization.Root,
|
||||||
|
ReturnOrganizationId = p.ReturnOrganization == null ? Guid.Empty : p.ReturnOrganization.RootId,
|
||||||
|
p.ReturnReason,
|
||||||
|
p.LastUpdatedAt,
|
||||||
|
p.CreatedAt,
|
||||||
|
p.InsigniaNoteProfileId,
|
||||||
|
CitizenId = p.Profile == null ? "" : p.Profile.CitizenId,
|
||||||
|
Prefix = p.Profile == null ? "" : p.Profile.Prefix,
|
||||||
|
Position = p.Profile == null ? "" : p.Profile.Position,
|
||||||
|
FullName = p.Profile == null ? "" : $"{p.Profile.Prefix}{p.Profile.FirstName} {p.Profile.LastName}",
|
||||||
|
ProfileType = p.Profile == null ? "" : p.Profile.ProfileType,
|
||||||
|
p.RequestInsignia,
|
||||||
|
p.RequestInsigniaId,
|
||||||
|
p.RequestInsigniaShortName,
|
||||||
|
p.DateReceive,
|
||||||
|
p.OrganizationOrganizationSend,
|
||||||
|
p.OrganizationOrganizationReceive,
|
||||||
|
p.InsigniaNoteProfileStatus,
|
||||||
|
p.Issue,
|
||||||
|
p.Date,
|
||||||
|
p.VolumeNo,
|
||||||
|
p.Section,
|
||||||
|
p.Page,
|
||||||
|
p.No,
|
||||||
|
p.DatePayment,
|
||||||
|
p.TypePayment,
|
||||||
|
p.Address,
|
||||||
|
p.Number,
|
||||||
|
p.Salary,
|
||||||
|
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
//var data = await _context.InsigniaManageProfiles.AsQueryable()
|
||||||
|
// .Where(x => x.InsigniaNoteProfile.RequestInsignia.InsigniaType == insigniaType)
|
||||||
|
// .Where(x => year == 0 ? x.Id != null : x.InsigniaManageOrganiation.InsigniaManage.Year == year)
|
||||||
|
// .OrderByDescending(x => x.CreatedAt)
|
||||||
|
// .Select(p => new
|
||||||
|
// {
|
||||||
|
// Id = p.Id,
|
||||||
|
// Status = p.Status,
|
||||||
|
// BorrowOrganization = _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken) == null ? null : _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken).Root,
|
||||||
|
// BorrowOrganizationId = _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken) == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : _userProfileRepository.GetOc(p.BorrowOrganizationId!.Value, 0, AccessToken).RootId,
|
||||||
|
// BorrowDate = p.BorrowDate,
|
||||||
|
// ReturnDate = p.ReturnDate,
|
||||||
|
// ReturnOrganization = _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken) == null ? null : _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken).Root,
|
||||||
|
// ReturnOrganizationId = _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken) == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : _userProfileRepository.GetOc(p.ReturnOrganizationId!.Value, 0, AccessToken).RootId,
|
||||||
|
// ReturnReason = p.ReturnReason,
|
||||||
|
// LastUpdatedAt = p.LastUpdatedAt,
|
||||||
|
// CreatedAt = p.CreatedAt,
|
||||||
|
|
||||||
|
// InsigniaNoteProfileId = p.InsigniaNoteProfile.Id,
|
||||||
|
// Prefix = _userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).Prefix,
|
||||||
|
// Position = _userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).Position,
|
||||||
|
// _userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).CitizenId,
|
||||||
|
// _userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).ProfileType,
|
||||||
|
// FullName = $"{_userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).Prefix}{_userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).FirstName} {_userProfileRepository.GetOfficerProfileById(p.InsigniaNoteProfile.ProfileId.Value, AccessToken).LastName}",
|
||||||
|
// RequestInsignia = p.InsigniaNoteProfile.RequestInsignia == null ? null : p.InsigniaNoteProfile.RequestInsignia.Name,
|
||||||
|
// RequestInsigniaId = p.InsigniaNoteProfile.RequestInsignia == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.InsigniaNoteProfile.RequestInsignia.Id,
|
||||||
|
// RequestInsigniaShortName = p.InsigniaNoteProfile.RequestInsignia == null ? null : p.InsigniaNoteProfile.RequestInsignia.ShortName,
|
||||||
|
// p.InsigniaNoteProfile.DateReceive,
|
||||||
|
// p.InsigniaNoteProfile.OrganizationOrganizationSend,
|
||||||
|
// p.InsigniaNoteProfile.OrganizationOrganizationReceive,
|
||||||
|
// InsigniaNoteProfileStatus = p.InsigniaNoteProfile.Status,
|
||||||
|
// p.InsigniaNoteProfile.Issue,
|
||||||
|
// p.InsigniaNoteProfile.Date,
|
||||||
|
// p.InsigniaNoteProfile.VolumeNo,
|
||||||
|
// p.InsigniaNoteProfile.Section,
|
||||||
|
// p.InsigniaNoteProfile.Page,
|
||||||
|
// p.InsigniaNoteProfile.No,
|
||||||
|
// p.InsigniaNoteProfile.DatePayment,
|
||||||
|
// p.InsigniaNoteProfile.TypePayment,
|
||||||
|
// p.InsigniaNoteProfile.Address,
|
||||||
|
// p.InsigniaNoteProfile.Number,
|
||||||
|
// p.InsigniaNoteProfile.Salary,
|
||||||
|
// })
|
||||||
|
// .ToListAsync();
|
||||||
|
|
||||||
return Success(data);
|
return Success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1392,25 +1392,22 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
.FirstOrDefaultAsync(x => x.Id == req.InsigniaTypeId);
|
.FirstOrDefaultAsync(x => x.Id == req.InsigniaTypeId);
|
||||||
if (insigniaType == null)
|
if (insigniaType == null)
|
||||||
return Error(GlobalMessages.InsigniaTypeNotFound);
|
return Error(GlobalMessages.InsigniaTypeNotFound);
|
||||||
var insigniaNoteProfiles = await _context.InsigniaNoteProfiles
|
|
||||||
|
var rawNoteProfiles = await _context.InsigniaNoteProfiles
|
||||||
.Where(x => x.InsigniaNote == insigniaNote)
|
.Where(x => x.InsigniaNote == insigniaNote)
|
||||||
.Where(x => x.RequestInsignia.InsigniaType == insigniaType)
|
.Where(x => x.RequestInsignia.InsigniaType == insigniaType)
|
||||||
.Where(x => req.InsigniaId == null ? x.RequestInsignia != null : (x.RequestInsignia.Id == req.InsigniaId))
|
.Where(x => req.InsigniaId == null ? x.RequestInsignia != null : (x.RequestInsignia.Id == req.InsigniaId))
|
||||||
.Select(x => new
|
.Select(x => new
|
||||||
{
|
{
|
||||||
Id = x.Id,
|
Id = x.Id,
|
||||||
Prefix = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).Prefix,
|
Profile = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken),
|
||||||
Position = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).Position,
|
OcId = Guid.Parse("e8493cd1-d371-402e-add6-566e68d5d1b3"), // TODO: ต้องมาแก้ไข
|
||||||
ProfileType = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).ProfileType,
|
|
||||||
OcId = Guid.Empty,
|
|
||||||
CitizenId = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).CitizenId,
|
|
||||||
FullName = $"{_userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).Prefix}{_userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).FirstName} {_userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).LastName}",
|
|
||||||
RequestInsignia = x.RequestInsignia.Name,
|
RequestInsignia = x.RequestInsignia.Name,
|
||||||
RequestInsigniaId = x.RequestInsignia.Id,
|
RequestInsigniaId = x.RequestInsignia.Id,
|
||||||
RequestInsigniaShortName = x.RequestInsignia.ShortName,
|
RequestInsigniaShortName = x.RequestInsignia.ShortName,
|
||||||
DateReceive = x.DateReceive,
|
DateReceive = x.DateReceive,
|
||||||
OrganizationOrganizationSend = x.OrganizationOrganizationSend,
|
OrganizationOrganizationSend = _userProfileRepository.GetOc(Guid.Parse("e8493cd1-d371-402e-add6-566e68d5d1b3"), 0, AccessToken).Root, //hardcode
|
||||||
OrganizationOrganizationReceive = x.OrganizationOrganizationReceive,
|
OrganizationOrganizationReceive = _userProfileRepository.GetOc(Guid.Parse("e8493cd1-d371-402e-add6-566e68d5d1b3"), 0, AccessToken).Root, //hardcode
|
||||||
Status = x.Status,
|
Status = x.Status,
|
||||||
Issue = x.Issue,
|
Issue = x.Issue,
|
||||||
Date = x.Date,
|
Date = x.Date,
|
||||||
|
|
@ -1425,11 +1422,89 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
Salary = x.Salary,
|
Salary = x.Salary,
|
||||||
DateReceiveInsignia = x.DateReceiveInsignia,
|
DateReceiveInsignia = x.DateReceiveInsignia,
|
||||||
DocReceiveInsignia = x.DocReceiveInsignia == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.DocReceiveInsignia.Id,
|
DocReceiveInsignia = x.DocReceiveInsignia == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.DocReceiveInsignia.Id,
|
||||||
OrgReceiveInsignia = x.OrgReceiveInsignia == null || x.OrgReceiveInsignia.OrganizationOrganization == null ? "-" : x.OrgReceiveInsignia.OrganizationOrganization.Name,
|
OrgReceiveInsignia = _userProfileRepository.GetOc(Guid.Parse("e8493cd1-d371-402e-add6-566e68d5d1b3"), 0, AccessToken).Root, //hardcode
|
||||||
DateReturnInsignia = x.DateReturnInsignia,
|
DateReturnInsignia = x.DateReturnInsignia,
|
||||||
DocReturnInsignia = x.DocReturnInsignia == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.DocReturnInsignia.Id,
|
DocReturnInsignia = x.DocReturnInsignia == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.DocReturnInsignia.Id,
|
||||||
OrgReturnInsignia = x.OrgReturnInsignia == null || x.OrgReturnInsignia.OrganizationOrganization == null ? "-" : x.OrgReturnInsignia.OrganizationOrganization.Name,
|
OrgReturnInsignia = _userProfileRepository.GetOc(Guid.Parse("e8493cd1-d371-402e-add6-566e68d5d1b3"), 0, AccessToken).Root, //hardcode
|
||||||
}).ToListAsync();
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
var insigniaNoteProfiles = rawNoteProfiles
|
||||||
|
.Select(x => new
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
Prefix = x.Profile == null ? "" : x.Profile.Prefix,
|
||||||
|
Position = x.Profile == null ? "" : x.Profile.Position,
|
||||||
|
ProfileType = x.Profile == null ? "" : x.Profile.ProfileType,
|
||||||
|
x.OcId,
|
||||||
|
CitizenId = x.Profile == null ? "" : x.Profile.CitizenId,
|
||||||
|
FullName = x.Profile == null ? "" : $"{x.Profile.Prefix}{x.Profile.FirstName} {x.Profile.LastName}",
|
||||||
|
RequestInsignia = x.RequestInsignia,
|
||||||
|
RequestInsigniaId = x.RequestInsigniaId,
|
||||||
|
RequestInsigniaShortName = x.RequestInsigniaShortName,
|
||||||
|
DateReceive = x.DateReceive,
|
||||||
|
OrganizationOrganizationSend = x.OrganizationOrganizationSend,
|
||||||
|
OrganizationOrganizationReceive = x.OrganizationOrganizationReceive,
|
||||||
|
Status = x.Status,
|
||||||
|
Issue = x.Issue,
|
||||||
|
Date = x.Date,
|
||||||
|
VolumeNo = x.VolumeNo,
|
||||||
|
Section = x.Section,
|
||||||
|
Page = x.Page,
|
||||||
|
No = x.No,
|
||||||
|
DatePayment = x.DatePayment,
|
||||||
|
TypePayment = x.TypePayment,
|
||||||
|
Address = x.Address,
|
||||||
|
Number = x.Number,
|
||||||
|
Salary = x.Salary,
|
||||||
|
DateReceiveInsignia = x.DateReceiveInsignia,
|
||||||
|
DocReceiveInsignia = x.DocReceiveInsignia,
|
||||||
|
OrgReceiveInsignia = x.OrgReceiveInsignia,
|
||||||
|
DateReturnInsignia = x.DateReturnInsignia,
|
||||||
|
DocReturnInsignia = x.DocReturnInsignia,
|
||||||
|
OrgReturnInsignia = x.OrgReturnInsignia,
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
//var insigniaNoteProfiles = await _context.InsigniaNoteProfiles
|
||||||
|
// .Where(x => x.InsigniaNote == insigniaNote)
|
||||||
|
// .Where(x => x.RequestInsignia.InsigniaType == insigniaType)
|
||||||
|
// .Where(x => req.InsigniaId == null ? x.RequestInsignia != null : (x.RequestInsignia.Id == req.InsigniaId))
|
||||||
|
// .Select(x => new
|
||||||
|
// {
|
||||||
|
// Id = x.Id,
|
||||||
|
// Prefix = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).Prefix,
|
||||||
|
// Position = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).Position,
|
||||||
|
// ProfileType = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).ProfileType,
|
||||||
|
// OcId = Guid.Empty,
|
||||||
|
// CitizenId = _userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).CitizenId,
|
||||||
|
// FullName = $"{_userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).Prefix}{_userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).FirstName} {_userProfileRepository.GetOfficerProfileById(x.ProfileId.Value, AccessToken).LastName}",
|
||||||
|
// RequestInsignia = x.RequestInsignia.Name,
|
||||||
|
// RequestInsigniaId = x.RequestInsignia.Id,
|
||||||
|
// RequestInsigniaShortName = x.RequestInsignia.ShortName,
|
||||||
|
// DateReceive = x.DateReceive,
|
||||||
|
// OrganizationOrganizationSend = x.OrganizationOrganizationSend,
|
||||||
|
// OrganizationOrganizationReceive = x.OrganizationOrganizationReceive,
|
||||||
|
// Status = x.Status,
|
||||||
|
// Issue = x.Issue,
|
||||||
|
// Date = x.Date,
|
||||||
|
// VolumeNo = x.VolumeNo,
|
||||||
|
// Section = x.Section,
|
||||||
|
// Page = x.Page,
|
||||||
|
// No = x.No,
|
||||||
|
// DatePayment = x.DatePayment,
|
||||||
|
// TypePayment = x.TypePayment,
|
||||||
|
// Address = x.Address,
|
||||||
|
// Number = x.Number,
|
||||||
|
// Salary = x.Salary,
|
||||||
|
// DateReceiveInsignia = x.DateReceiveInsignia,
|
||||||
|
// DocReceiveInsignia = x.DocReceiveInsignia == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.DocReceiveInsignia.Id,
|
||||||
|
// OrgReceiveInsignia = x.OrgReceiveInsignia == null || x.OrgReceiveInsignia.OrganizationOrganization == null ? "-" : x.OrgReceiveInsignia.OrganizationOrganization.Name,
|
||||||
|
// DateReturnInsignia = x.DateReturnInsignia,
|
||||||
|
// DocReturnInsignia = x.DocReturnInsignia == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : x.DocReturnInsignia.Id,
|
||||||
|
// OrgReturnInsignia = x.OrgReturnInsignia == null || x.OrgReturnInsignia.OrganizationOrganization == null ? "-" : x.OrgReturnInsignia.OrganizationOrganization.Name,
|
||||||
|
// }).ToListAsync();
|
||||||
|
|
||||||
var _insigniaNoteProfiles = new List<dynamic>();
|
var _insigniaNoteProfiles = new List<dynamic>();
|
||||||
foreach (var insigniaNoteProfile in insigniaNoteProfiles)
|
foreach (var insigniaNoteProfile in insigniaNoteProfiles)
|
||||||
{
|
{
|
||||||
|
|
@ -1447,7 +1522,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
insigniaNoteProfile.RequestInsigniaShortName,
|
insigniaNoteProfile.RequestInsigniaShortName,
|
||||||
insigniaNoteProfile.DateReceive,
|
insigniaNoteProfile.DateReceive,
|
||||||
insigniaNoteProfile.OrganizationOrganizationSend,
|
insigniaNoteProfile.OrganizationOrganizationSend,
|
||||||
OrganizationOrganizationReceive = insigniaNoteProfile.OrganizationOrganizationReceive == null ? (insigniaNoteProfile.OcId == null ? null : FindOCFullPath(insigniaNoteProfile.OcId, true)) : insigniaNoteProfile.OrganizationOrganizationReceive,
|
insigniaNoteProfile.OrganizationOrganizationReceive,
|
||||||
insigniaNoteProfile.Status,
|
insigniaNoteProfile.Status,
|
||||||
insigniaNoteProfile.Issue,
|
insigniaNoteProfile.Issue,
|
||||||
insigniaNoteProfile.Date,
|
insigniaNoteProfile.Date,
|
||||||
|
|
@ -1663,29 +1738,49 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
if (req.DateReceive != null && req.Date != null)
|
if (req.DateReceive != null && req.Date != null)
|
||||||
{
|
{
|
||||||
profileInsignia.Status = "DONE";
|
profileInsignia.Status = "DONE";
|
||||||
await _context.ProfileInsignias.AddAsync(new ProfileInsignia
|
|
||||||
|
var profileInsigniaBody = new PostProfileInsigniaDto
|
||||||
{
|
{
|
||||||
Year = insigniaNote.Year,
|
profileId = profileInsignia.ProfileId.Value,
|
||||||
No = req.No,
|
year = insigniaNote.Year,
|
||||||
Issue = req.VolumeNo,
|
no = profileInsignia.No,
|
||||||
VolumeNo = req.VolumeNo,
|
volumeNo = profileInsignia.VolumeNo,
|
||||||
//Volume = req.Volume,
|
section = profileInsignia.Section,
|
||||||
Section = req.Section,
|
page = profileInsignia.Page,
|
||||||
Page = req.Page,
|
receiveDate = profileInsignia.DateReceive.Value,
|
||||||
DateAnnounce = req.Date,
|
dateAnnounce = profileInsignia.Date.Value,
|
||||||
ReceiveDate = req.DateReceive,
|
insigniaId = profileInsignia.RequestInsignia.Id,
|
||||||
InsigniaType = insignia.InsigniaType == null ? null : insignia.InsigniaType.Name,
|
issue = "",
|
||||||
Insignia = insignia,
|
note = "",
|
||||||
// RefCommandNo = req.RefCommandNo,
|
refCommandDate = null,
|
||||||
// RefCommandDate = req.RefCommandDate,
|
refCommandNo = "",
|
||||||
ProfileId = profile.Id,
|
volume = "",
|
||||||
CreatedFullName = FullName ?? "System Administrator",
|
|
||||||
CreatedUserId = UserId ?? "",
|
};
|
||||||
CreatedAt = DateTime.Now,
|
await _userProfileRepository.PostProfileInsigniaAsync(profileInsigniaBody, AccessToken);
|
||||||
LastUpdateFullName = FullName ?? "System Administrator",
|
//await _context.ProfileInsignias.AddAsync(new ProfileInsignia
|
||||||
LastUpdateUserId = UserId ?? "",
|
//{
|
||||||
LastUpdatedAt = DateTime.Now,
|
// Year = insigniaNote.Year,
|
||||||
});
|
// No = req.No,
|
||||||
|
// Issue = req.VolumeNo,
|
||||||
|
// VolumeNo = req.VolumeNo,
|
||||||
|
// //Volume = req.Volume,
|
||||||
|
// Section = req.Section,
|
||||||
|
// Page = req.Page,
|
||||||
|
// DateAnnounce = req.Date,
|
||||||
|
// ReceiveDate = req.DateReceive,
|
||||||
|
// InsigniaType = insignia.InsigniaType == null ? null : insignia.InsigniaType.Name,
|
||||||
|
// Insignia = insignia,
|
||||||
|
// // RefCommandNo = req.RefCommandNo,
|
||||||
|
// // RefCommandDate = req.RefCommandDate,
|
||||||
|
// ProfileId = profile.Id,
|
||||||
|
// CreatedFullName = FullName ?? "System Administrator",
|
||||||
|
// CreatedUserId = UserId ?? "",
|
||||||
|
// CreatedAt = DateTime.Now,
|
||||||
|
// LastUpdateFullName = FullName ?? "System Administrator",
|
||||||
|
// LastUpdateUserId = UserId ?? "",
|
||||||
|
// LastUpdatedAt = DateTime.Now,
|
||||||
|
//});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1868,36 +1963,6 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
// continue;
|
// continue;
|
||||||
if (profile.Status != "DONE")
|
if (profile.Status != "DONE")
|
||||||
{
|
{
|
||||||
// public class PostProfileInsigniaDto
|
|
||||||
//{
|
|
||||||
// public Guid ProfileId { get; set; }
|
|
||||||
|
|
||||||
// public int Year { get; set; } = 0;
|
|
||||||
|
|
||||||
// public string No { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
// public string Volume { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
// public string Section { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
// public string Page { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
// public DateTime ReceiveDate { get; set; } = DateTime.MinValue;
|
|
||||||
|
|
||||||
// public Guid InsigniaId { get; set; }
|
|
||||||
|
|
||||||
// public DateTime DateAnnounce { get; set; } = DateTime.MinValue;
|
|
||||||
|
|
||||||
// public string Issue { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
// public string VolumeNo { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
// public DateTime? RefCommandDate { get; set; }
|
|
||||||
|
|
||||||
// public string RefCommandNo { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
// public string Note { get; set; } = string.Empty;
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1924,29 +1989,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
};
|
};
|
||||||
await _userProfileRepository.PostProfileInsigniaAsync(profileInsignia, AccessToken);
|
await _userProfileRepository.PostProfileInsigniaAsync(profileInsignia, AccessToken);
|
||||||
|
|
||||||
//await _context.ProfileInsignias.AddAsync(new ProfileInsignia
|
|
||||||
//{
|
|
||||||
// Year = insigniaNote.Year,
|
|
||||||
// No = profile.No,
|
|
||||||
// Issue = profile.VolumeNo,
|
|
||||||
// VolumeNo = profile.VolumeNo,
|
|
||||||
// // Volume = profile.Volume,
|
|
||||||
// Section = profile.Section,
|
|
||||||
// Page = profile.Page,
|
|
||||||
// DateAnnounce = profile.Date,
|
|
||||||
// ReceiveDate = profile.DateReceive,
|
|
||||||
// InsigniaType = profile.RequestInsignia.InsigniaType == null ? null : profile.RequestInsignia.InsigniaType.Name,
|
|
||||||
// Insignia = profile.RequestInsignia,
|
|
||||||
// // RefCommandNo = req.RefCommandNo,
|
|
||||||
// // RefCommandDate = req.RefCommandDate,
|
|
||||||
// ProfileId = profile.ProfileId.Value,
|
|
||||||
// CreatedFullName = FullName ?? "System Administrator",
|
|
||||||
// CreatedUserId = UserId ?? "",
|
|
||||||
// CreatedAt = DateTime.Now,
|
|
||||||
// LastUpdateFullName = FullName ?? "System Administrator",
|
|
||||||
// LastUpdateUserId = UserId ?? "",
|
|
||||||
// LastUpdatedAt = DateTime.Now,
|
|
||||||
//});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await _context.SaveChangesAsync();
|
await _context.SaveChangesAsync();
|
||||||
|
|
@ -2167,6 +2210,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
var items = await ReadExcelImportInvoice(file);
|
var items = await ReadExcelImportInvoice(file);
|
||||||
foreach (var item in items)
|
foreach (var item in items)
|
||||||
{
|
{
|
||||||
|
if (item.CitizanId == null) continue;
|
||||||
var pf = _userProfileRepository.GetOfficerProfileByCitizenId(item.CitizanId, AccessToken);
|
var pf = _userProfileRepository.GetOfficerProfileByCitizenId(item.CitizanId, AccessToken);
|
||||||
var profile = insigniaNote.InsigniaNoteProfiles.FirstOrDefault(x => x.ProfileId == pf.Id);
|
var profile = insigniaNote.InsigniaNoteProfiles.FirstOrDefault(x => x.ProfileId == pf.Id);
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
|
|
@ -2182,7 +2226,10 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
var _insigniaNoteProfiles = new List<dynamic>();
|
var _insigniaNoteProfiles = new List<dynamic>();
|
||||||
foreach (var item in items)
|
foreach (var item in items)
|
||||||
{
|
{
|
||||||
|
if (item.CitizanId == null) continue;
|
||||||
var pf = _userProfileRepository.GetOfficerProfileByCitizenId(item.CitizanId, AccessToken);
|
var pf = _userProfileRepository.GetOfficerProfileByCitizenId(item.CitizanId, AccessToken);
|
||||||
|
|
||||||
|
if (pf == null) continue;
|
||||||
var profile = insigniaNote.InsigniaNoteProfiles.FirstOrDefault(x => x.ProfileId == pf.Id);
|
var profile = insigniaNote.InsigniaNoteProfiles.FirstOrDefault(x => x.ProfileId == pf.Id);
|
||||||
if (profile == null)
|
if (profile == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -2198,11 +2245,11 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
profile.Id,
|
profile.Id,
|
||||||
Prefix = _userProfileRepository.GetOfficerProfileById(profile.Id, AccessToken).Prefix,
|
Prefix = pf.Prefix,
|
||||||
Position = _userProfileRepository.GetOfficerProfileById(profile.Id, AccessToken).Position,
|
Position = pf.Position,
|
||||||
_userProfileRepository.GetOfficerProfileById(profile.Id, AccessToken).CitizenId,
|
pf.CitizenId,
|
||||||
_userProfileRepository.GetOfficerProfileById(profile.Id, AccessToken).ProfileType,
|
pf.ProfileType,
|
||||||
FullName = $"{_userProfileRepository.GetOfficerProfileById(profile.Id, AccessToken).Prefix}{_userProfileRepository.GetOfficerProfileById(profile.Id, AccessToken).FirstName} {_userProfileRepository.GetOfficerProfileById(profile.Id, AccessToken).LastName}",
|
FullName = $"{pf.Prefix}{pf.FirstName} {pf.LastName}",
|
||||||
RequestInsignia = profile.RequestInsignia == null ? null : profile.RequestInsignia.Name,
|
RequestInsignia = profile.RequestInsignia == null ? null : profile.RequestInsignia.Name,
|
||||||
RequestInsigniaId = profile.RequestInsignia == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : profile.RequestInsignia.Id,
|
RequestInsigniaId = profile.RequestInsignia == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : profile.RequestInsignia.Id,
|
||||||
RequestInsigniaShortName = profile.RequestInsignia == null ? null : profile.RequestInsignia.ShortName,
|
RequestInsigniaShortName = profile.RequestInsignia == null ? null : profile.RequestInsignia.ShortName,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue