wxd 2 years ago
parent
commit
b8d494ae05
  1. 952
      src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs
  2. 85
      src/Shentun.Peis.Domain/ImageHelper.cs
  3. 2
      src/Shentun.Peis.Domain/RegisterCheckSummarys/RegisterCheckSummary.cs
  4. 2
      src/Shentun.Peis.Domain/SumSuggestionContents/SumSuggestionContent.cs
  5. 2
      src/Shentun.Peis.Domain/SumSummaryContents/SumSummaryContent.cs
  6. 13788
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20240423075634_init20240423.Designer.cs
  7. 139
      src/Shentun.Peis.EntityFrameworkCore/Migrations/20240423075634_init20240423.cs
  8. 14
      src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs
  9. 50
      test/Shentun.Peis.Application.Tests/BaseDataHandleTest.cs
  10. 4
      test/Shentun.Peis.EntityFrameworkCore.Tests/EntityFrameworkCore/PeisEntityFrameworkCoreTestModule.cs

952
src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs
File diff suppressed because it is too large
View File

85
src/Shentun.Peis.Domain/ImageHelper.cs

@ -99,6 +99,87 @@ namespace Shentun.Peis
/// <summary>
/// 将Base64字符串转换为图片并保存到本地
/// </summary>
/// <param name="base64Str">base64字符串</param>
/// <param name="savePath">图片保存地址,如:/Content/Images/10000</param>
/// <returns></returns>
public static string ByteToImage(byte[] photo, string savePath)
{
var ret = "";
try
{
MemoryStream ms = new MemoryStream(photo);
Bitmap bitmap = new Bitmap(ms);
ms.Close();
if (bitmap != null)
{
string ImageSuffix = "";
if (ImageFormat.Png.Guid == bitmap.RawFormat.Guid)
{
ImageSuffix = ".png";
}
else if (ImageFormat.Gif.Guid == bitmap.RawFormat.Guid)
{
ImageSuffix = ".gif";
}
else
{
ImageSuffix = ".jpg";
}
savePath = savePath + ImageSuffix;
//创建文件夹
var folderPath = savePath.Substring(0, savePath.LastIndexOf('/'));
if (!Directory.Exists(folderPath))
{
Directory.CreateDirectory(folderPath);
}
//图片后缀格式
var suffix = savePath.Substring(savePath.LastIndexOf('.') + 1, savePath.Length - savePath.LastIndexOf('.') - 1).ToLower();
var suffixName = suffix == "png" ? ImageFormat.Png :
suffix == "jpg" || suffix == "jpeg" ? ImageFormat.Jpeg :
suffix == "bmp" ? ImageFormat.Bmp :
suffix == "gif" ? ImageFormat.Gif : ImageFormat.Jpeg;
//这里复制一份对图像进行保存,否则会出现“GDI+ 中发生一般性错误”的错误提示
var bmpNew = new Bitmap(bitmap);
// bmpNew.Save(_hostingEnvironment.ContentRootPath + savePath, suffixName);
var s1 = Directory.GetCurrentDirectory();
string saveurl = Path.Combine(s1, savePath);
bmpNew.Save(saveurl, suffixName);
bmpNew.Dispose();
bitmap.Dispose();
ret = savePath;
}
else
{
ret = "";
}
}
catch (Exception ex)
{
ret = "";
}
return ret;
}
/// <summary>
/// 将Base64字符串转换为图片并保存到服务器
/// </summary>
@ -234,8 +315,8 @@ namespace Shentun.Peis
throw new UserFriendlyException("请上传jpg、png、gif格式的图片");
}
savePath = AbsolutePath + "\\" + PatientRegisterId + "\\" + RegisterCheckId + "\\" + ImageName + ImageSuffix;
hostPath = "/CheckPictureImg/" + PatientRegisterId + "/" + RegisterCheckId + "/" + ImageName + ImageSuffix;

2
src/Shentun.Peis.Domain/RegisterCheckSummarys/RegisterCheckSummary.cs

@ -27,7 +27,7 @@ namespace Shentun.Peis.Models
/// 综述
/// </summary>
[Column("summary")]
[StringLength(500)]
[StringLength(2000)]
public string Summary { get; set; } = null!;
/// <summary>
/// 顺序

2
src/Shentun.Peis.Domain/SumSuggestionContents/SumSuggestionContent.cs

@ -31,7 +31,7 @@ namespace Shentun.Peis.Models
/// 建议内容
/// </summary>
[Column("suggestion_content")]
[StringLength(100)]
[StringLength(10000)]
public string SuggestionContent { get; set; } = null!;
[Column("display_order")]
public int DisplayOrder { get; set; }

2
src/Shentun.Peis.Domain/SumSummaryContents/SumSummaryContent.cs

@ -27,7 +27,7 @@ namespace Shentun.Peis.Models
/// 建议内容
/// </summary>
[Column("summary_content")]
[StringLength(100)]
[StringLength(3000)]
public string SummaryContent { get; set; } = null!;
[Column("display_order")]
public int DisplayOrder { get; set; }

13788
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240423075634_init20240423.Designer.cs
File diff suppressed because it is too large
View File

139
src/Shentun.Peis.EntityFrameworkCore/Migrations/20240423075634_init20240423.cs

@ -0,0 +1,139 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Shentun.Peis.Migrations
{
public partial class init20240423 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "summary_content",
table: "sum_summary_content",
type: "character varying(3000)",
maxLength: 3000,
nullable: false,
comment: "建议内容",
oldClrType: typeof(string),
oldType: "character varying(100)",
oldMaxLength: 100,
oldComment: "建议内容");
migrationBuilder.AlterColumn<string>(
name: "suggestion_content",
table: "sum_suggestion_content",
type: "character varying(10000)",
maxLength: 10000,
nullable: false,
comment: "建议内容",
oldClrType: typeof(string),
oldType: "character varying(100)",
oldMaxLength: 100,
oldComment: "建议内容");
migrationBuilder.AlterColumn<string>(
name: "report_prompt",
table: "result_status",
type: "character varying(8)",
maxLength: 8,
nullable: true,
comment: "报告单提示",
oldClrType: typeof(string),
oldType: "character varying(8)",
oldMaxLength: 8,
oldComment: "报告单提示");
migrationBuilder.AlterColumn<string>(
name: "data_input_prompt",
table: "result_status",
type: "character varying(8)",
maxLength: 8,
nullable: true,
comment: "数据录入提示",
oldClrType: typeof(string),
oldType: "character varying(8)",
oldMaxLength: 8,
oldComment: "数据录入提示");
migrationBuilder.AlterColumn<string>(
name: "summary",
table: "register_check_summary",
type: "character varying(2000)",
maxLength: 2000,
nullable: false,
comment: "综述",
oldClrType: typeof(string),
oldType: "character varying(500)",
oldMaxLength: 500,
oldComment: "综述");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "summary_content",
table: "sum_summary_content",
type: "character varying(100)",
maxLength: 100,
nullable: false,
comment: "建议内容",
oldClrType: typeof(string),
oldType: "character varying(3000)",
oldMaxLength: 3000,
oldComment: "建议内容");
migrationBuilder.AlterColumn<string>(
name: "suggestion_content",
table: "sum_suggestion_content",
type: "character varying(100)",
maxLength: 100,
nullable: false,
comment: "建议内容",
oldClrType: typeof(string),
oldType: "character varying(10000)",
oldMaxLength: 10000,
oldComment: "建议内容");
migrationBuilder.AlterColumn<string>(
name: "report_prompt",
table: "result_status",
type: "character varying(8)",
maxLength: 8,
nullable: false,
defaultValue: "",
comment: "报告单提示",
oldClrType: typeof(string),
oldType: "character varying(8)",
oldMaxLength: 8,
oldNullable: true,
oldComment: "报告单提示");
migrationBuilder.AlterColumn<string>(
name: "data_input_prompt",
table: "result_status",
type: "character varying(8)",
maxLength: 8,
nullable: false,
defaultValue: "",
comment: "数据录入提示",
oldClrType: typeof(string),
oldType: "character varying(8)",
oldMaxLength: 8,
oldNullable: true,
oldComment: "数据录入提示");
migrationBuilder.AlterColumn<string>(
name: "summary",
table: "register_check_summary",
type: "character varying(500)",
maxLength: 500,
nullable: false,
comment: "综述",
oldClrType: typeof(string),
oldType: "character varying(2000)",
oldMaxLength: 2000,
oldComment: "综述");
}
}
}

14
src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs

@ -7981,8 +7981,8 @@ namespace Shentun.Peis.Migrations
b.Property<string>("Summary")
.IsRequired()
.HasMaxLength(500)
.HasColumnType("character varying(500)")
.HasMaxLength(2000)
.HasColumnType("character varying(2000)")
.HasColumnName("summary")
.HasComment("综述");
@ -8307,7 +8307,6 @@ namespace Shentun.Peis.Migrations
.HasComment("数据录入字体颜色");
b.Property<string>("DataInputPrompt")
.IsRequired()
.HasMaxLength(8)
.HasColumnType("character varying(8)")
.HasColumnName("data_input_prompt")
@ -8349,7 +8348,6 @@ namespace Shentun.Peis.Migrations
.HasComment("报告单字体颜色");
b.Property<string>("ReportPrompt")
.IsRequired()
.HasMaxLength(8)
.HasColumnType("character varying(8)")
.HasColumnName("report_prompt")
@ -9488,8 +9486,8 @@ namespace Shentun.Peis.Migrations
b.Property<string>("SuggestionContent")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasMaxLength(10000)
.HasColumnType("character varying(10000)")
.HasColumnName("suggestion_content")
.HasComment("建议内容");
@ -9623,8 +9621,8 @@ namespace Shentun.Peis.Migrations
b.Property<string>("SummaryContent")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)")
.HasMaxLength(3000)
.HasColumnType("character varying(3000)")
.HasColumnName("summary_content")
.HasComment("建议内容");

50
test/Shentun.Peis.Application.Tests/BaseDataHandleTest.cs

@ -32,7 +32,7 @@ namespace Shentun.Peis
public async Task TransferPatientData()
{
for (int i = 0; i < 1000; i++)
for (int i = 0; i < 500; i++)
{
using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
{
@ -54,5 +54,53 @@ namespace Shentun.Peis
}
[Fact]
public async Task TransferPatientRegisterData()
{
for (int i = 0; i < 3000; i++)
{
using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
{
var IsHand = await _appService.TransferPatientRegisterData();
await unitOfWork.CompleteAsync();
_output.WriteLine($"处理{(i + 1) * 1000}");
if (!IsHand)
{
break;
}
}
}
}
[Fact]
public async Task HandPatientRegisterDoctor()
{
for (int i = 0; i < 3000; i++)
{
using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
{
var IsHand = await _appService.HandPatientRegisterDoctor();
await unitOfWork.CompleteAsync();
_output.WriteLine($"处理{(i + 1) * 1000}");
if (!IsHand)
{
break;
}
}
}
}
}
}

4
test/Shentun.Peis.EntityFrameworkCore.Tests/EntityFrameworkCore/PeisEntityFrameworkCoreTestModule.cs

@ -40,8 +40,8 @@ public class PeisEntityFrameworkCoreTestModule : AbpModule
}
private void ConfigurePostGress(IServiceCollection services)
{
string connectStr = "Host=140.143.162.39;Port=5432;Database=ShentunPeis070703;User ID=postgres;Password=shentun123";
//string connectStr = "Host=10.1.12.140;Port=5432;Database=ShentunPeis;User ID=postgres;Password=st123;";
//string connectStr = "Host=140.143.162.39;Port=5432;Database=ShentunPeis070703;User ID=postgres;Password=shentun123";
string connectStr = "Host=10.1.12.140;Port=5432;Database=ShentunPeis;User ID=postgres;Password=st123;";
services.Configure<AbpDbContextOptions>(options =>
{

Loading…
Cancel
Save