บันทึกไฟล์หนังสือเวียน

This commit is contained in:
Kittapath 2023-09-14 00:10:03 +07:00
parent 60dc1025a9
commit d00a8bbc4c
7 changed files with 16373 additions and 5 deletions

View file

@ -250,7 +250,8 @@ namespace BMA.EHR.Application.Repositories.Reports
.Where(x => x.Id == id) .Where(x => x.Id == id)
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
if (data != null) if (data != null)
data.Document = file; data.DocumentForward = file;
await _dbContext.SaveChangesAsync();
} }
#endregion #endregion

View file

@ -12,6 +12,8 @@ namespace BMA.EHR.Domain.Models.Retirement
{ {
[Comment("ใบมรณบัตร")] [Comment("ใบมรณบัตร")]
public Document? Document { get; set; } public Document? Document { get; set; }
[Comment("หนังสือเวียน")]
public Document? DocumentForward { get; set; }
[Comment("เลขที่ใบมรณบัตร")] [Comment("เลขที่ใบมรณบัตร")]
public string? Number { get; set; } = string.Empty; public string? Number { get; set; } = string.Empty;
[Comment("วันที่เสียชีวิต")] [Comment("วันที่เสียชีวิต")]

View file

@ -0,0 +1,50 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableretirementperiodaddDocumentforward : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "DocumentForwardId",
table: "RetirementDeceaseds",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.CreateIndex(
name: "IX_RetirementDeceaseds_DocumentForwardId",
table: "RetirementDeceaseds",
column: "DocumentForwardId");
migrationBuilder.AddForeignKey(
name: "FK_RetirementDeceaseds_Documents_DocumentForwardId",
table: "RetirementDeceaseds",
column: "DocumentForwardId",
principalTable: "Documents",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_RetirementDeceaseds_Documents_DocumentForwardId",
table: "RetirementDeceaseds");
migrationBuilder.DropIndex(
name: "IX_RetirementDeceaseds_DocumentForwardId",
table: "RetirementDeceaseds");
migrationBuilder.DropColumn(
name: "DocumentForwardId",
table: "RetirementDeceaseds");
}
}
}

View file

@ -12717,6 +12717,9 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("datetime(6)") .HasColumnType("datetime(6)")
.HasComment("วันที่เสียชีวิต"); .HasComment("วันที่เสียชีวิต");
b.Property<Guid?>("DocumentForwardId")
.HasColumnType("char(36)");
b.Property<Guid?>("DocumentId") b.Property<Guid?>("DocumentId")
.HasColumnType("char(36)"); .HasColumnType("char(36)");
@ -12760,6 +12763,8 @@ namespace BMA.EHR.Infrastructure.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("DocumentForwardId");
b.HasIndex("DocumentId"); b.HasIndex("DocumentId");
b.HasIndex("ProfileId"); b.HasIndex("ProfileId");
@ -15749,6 +15754,10 @@ namespace BMA.EHR.Infrastructure.Migrations
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementDeceased", b => modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementDeceased", b =>
{ {
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "DocumentForward")
.WithMany()
.HasForeignKey("DocumentForwardId");
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document") b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "Document")
.WithMany() .WithMany()
.HasForeignKey("DocumentId"); .HasForeignKey("DocumentId");
@ -15761,6 +15770,8 @@ namespace BMA.EHR.Infrastructure.Migrations
b.Navigation("Document"); b.Navigation("Document");
b.Navigation("DocumentForward");
b.Navigation("Profile"); b.Navigation("Profile");
}); });

View file

@ -538,12 +538,12 @@ namespace BMA.EHR.Retirement.Service.Controllers
.ToListAsync(); .ToListAsync();
var retirementDeceased = await _context.RetirementDeceaseds.AsQueryable() var retirementDeceased = await _context.RetirementDeceaseds.AsQueryable()
.Include(x => x.Document) .Include(x => x.DocumentForward)
.Where(x => x.Id == id) .Where(x => x.Id == id)
.FirstOrDefaultAsync(); .FirstOrDefaultAsync();
if (retirementDeceased == null) if (retirementDeceased == null)
return Error(GlobalMessages.RetirementDeceasedNotFound, 404); return Error(GlobalMessages.RetirementDeceasedNotFound, 404);
if (retirementDeceased.Document == null) if (retirementDeceased.DocumentForward == null)
return Error(GlobalMessages.NoFileToUpload, 404); return Error(GlobalMessages.NoFileToUpload, 404);
// create command payload // create command payload
@ -551,7 +551,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
payload_attach.Add(new PayloadAttachment payload_attach.Add(new PayloadAttachment
{ {
name = "หนังสือเวียนถึงแก่กรรม", name = "หนังสือเวียนถึงแก่กรรม",
url = $"{_configuration["API"]}/order/download/attachment/{retirementDeceased.Document.Id}" url = $"{_configuration["API"]}/order/download/attachment/{retirementDeceased.DocumentForward.Id}"
}); });
var payload = new CommandPayload() var payload = new CommandPayload()

View file

@ -32,5 +32,6 @@
"SecretKey": "P@ssw0rd", "SecretKey": "P@ssw0rd",
"BucketName": "bma-recruit" "BucketName": "bma-recruit"
}, },
"Protocol": "HTTPS" "Protocol": "HTTPS",
"API": "https://bma-ehr.frappet.synology.me/api/v1"
} }