15 changed files with 16717 additions and 15 deletions
-
5src/Shentun.Peis.Application.Contracts/CustomerOrgs/CreateCustomerOrgDto.cs
-
11src/Shentun.Peis.Application.Contracts/CustomerOrgs/CustomerOrgDto.cs
-
11src/Shentun.Peis.Application.Contracts/CustomerOrgs/GetMedicalTypeIdByCustomerOrgIdDto.cs
-
6src/Shentun.Peis.Application.Contracts/CustomerOrgs/UpdateCustomerOrgDto.cs
-
81src/Shentun.Peis.Application/CCTJExportDatas/CCTJExportDataAppService.cs
-
55src/Shentun.Peis.Application/CCTJExportDatas/CCTJLMPAppService.cs
-
31src/Shentun.Peis.Application/CustomerOrgs/CustomerOrgAppService.cs
-
4src/Shentun.Peis.DbMigrator/appsettings.json
-
6src/Shentun.Peis.Domain/CustomerOrgs/CustomerOrg.cs
-
4src/Shentun.Peis.Domain/CustomerOrgs/CustomerOrgManager.cs
-
87src/Shentun.Peis.Domain/StringConvertGuidHelper.cs
-
2src/Shentun.Peis.EntityFrameworkCore/DbMapping/CustomerOrgs/CustomerOrgDbMapping.cs
-
16391src/Shentun.Peis.EntityFrameworkCore/Migrations/20251119074708_update_customer_org_add_medical_type_id.Designer.cs
-
27src/Shentun.Peis.EntityFrameworkCore/Migrations/20251119074708_update_customer_org_add_medical_type_id.cs
-
9src/Shentun.Peis.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs
@ -0,0 +1,11 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Shentun.Peis.CustomerOrgs |
||||
|
{ |
||||
|
public class GetMedicalTypeIdByCustomerOrgIdDto |
||||
|
{ |
||||
|
public Guid? MedicalTypeId { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,87 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Security.Cryptography; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Shentun.Peis |
||||
|
{ |
||||
|
public class StringConvertGuidHelper |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 生成RFC 4122版本5 UUID(基于SHA1的命名空间UUID)- 推荐使用
|
||||
|
/// </summary>
|
||||
|
public static Guid GenerateVersion5UUID(string name, Guid namespaceId) |
||||
|
{ |
||||
|
// 将命名空间Guid和名称转换为字节数组
|
||||
|
byte[] namespaceBytes = namespaceId.ToByteArray(); |
||||
|
SwapByteOrder(namespaceBytes); // RFC标准要求字节序转换
|
||||
|
|
||||
|
byte[] nameBytes = Encoding.UTF8.GetBytes(name); |
||||
|
|
||||
|
byte[] combinedBytes = new byte[namespaceBytes.Length + nameBytes.Length]; |
||||
|
Buffer.BlockCopy(namespaceBytes, 0, combinedBytes, 0, namespaceBytes.Length); |
||||
|
Buffer.BlockCopy(nameBytes, 0, combinedBytes, namespaceBytes.Length, nameBytes.Length); |
||||
|
|
||||
|
using (SHA1 sha1 = SHA1.Create()) |
||||
|
{ |
||||
|
byte[] hash = sha1.ComputeHash(combinedBytes); |
||||
|
|
||||
|
// 取前16个字节
|
||||
|
byte[] guidBytes = new byte[16]; |
||||
|
Array.Copy(hash, 0, guidBytes, 0, 16); |
||||
|
|
||||
|
// 设置版本号: 0101 (版本5)
|
||||
|
guidBytes[6] = (byte)((guidBytes[6] & 0x0F) | 0x50); |
||||
|
// 设置变体: 10xx (RFC变体)
|
||||
|
guidBytes[8] = (byte)((guidBytes[8] & 0x3F) | 0x80); |
||||
|
|
||||
|
SwapByteOrder(guidBytes); // 转换回Guid的字节序
|
||||
|
|
||||
|
return new Guid(guidBytes); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生成URL的版本5 UUID
|
||||
|
/// </summary>
|
||||
|
public static Guid GenerateURLUUID(string url) |
||||
|
{ |
||||
|
return GenerateVersion5UUID(url, URLNamespace); |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 生成DNS的版本5 UUID
|
||||
|
/// </summary>
|
||||
|
public static Guid GenerateDNSUUID(string domain) |
||||
|
{ |
||||
|
return GenerateVersion5UUID(domain, DNSNamespace); |
||||
|
} |
||||
|
|
||||
|
private static void SwapByteOrder(byte[] guid) |
||||
|
{ |
||||
|
// 交换前4字节
|
||||
|
SwapBytes(guid, 0, 3); |
||||
|
SwapBytes(guid, 1, 2); |
||||
|
|
||||
|
// 交换5-6字节
|
||||
|
SwapBytes(guid, 4, 5); |
||||
|
// 交换7-8字节
|
||||
|
SwapBytes(guid, 6, 7); |
||||
|
} |
||||
|
|
||||
|
private static void SwapBytes(byte[] array, int index1, int index2) |
||||
|
{ |
||||
|
byte temp = array[index1]; |
||||
|
array[index1] = array[index2]; |
||||
|
array[index2] = temp; |
||||
|
} |
||||
|
|
||||
|
// 预定义的命名空间UUID (RFC 4122)
|
||||
|
public static readonly Guid DNSNamespace = new Guid("6ba7b810-9dad-11d1-80b4-00c04fd430c8"); |
||||
|
public static readonly Guid URLNamespace = new Guid("6ba7b811-9dad-11d1-80b4-00c04fd430c8"); |
||||
|
public static readonly Guid OIDNamespace = new Guid("6ba7b812-9dad-11d1-80b4-00c04fd430c8"); |
||||
|
public static readonly Guid X500Namespace = new Guid("6ba7b814-9dad-11d1-80b4-00c04fd430c8"); |
||||
|
} |
||||
|
} |
||||
16391
src/Shentun.Peis.EntityFrameworkCore/Migrations/20251119074708_update_customer_org_add_medical_type_id.Designer.cs
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,27 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
#nullable disable |
||||
|
|
||||
|
namespace Shentun.Peis.Migrations |
||||
|
{ |
||||
|
public partial class update_customer_org_add_medical_type_id : Migration |
||||
|
{ |
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.AddColumn<Guid>( |
||||
|
name: "medical_type_id", |
||||
|
table: "customer_org", |
||||
|
type: "uuid", |
||||
|
nullable: true, |
||||
|
comment: "体检类别id"); |
||||
|
} |
||||
|
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "medical_type_id", |
||||
|
table: "customer_org"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue