Browse Source

增加出生日期转换

master
wxd 1 year ago
parent
commit
00fbfb3b05
  1. 5
      src/Shentun.Pacs.Application.Contracts/Devices/CreateDeviceDto.cs
  2. 6
      src/Shentun.Pacs.Application.Contracts/Devices/DeviceDto.cs
  3. 5
      src/Shentun.Pacs.Application.Contracts/Devices/UpdateDeviceDto.cs
  4. 5
      src/Shentun.Pacs.Application.Contracts/PacsBusiness/GetPatientRegisterPacsCheckDto.cs
  5. 5
      src/Shentun.Pacs.Application.Contracts/PacsBusiness/ImportPeisCheckDataByCheckRequestNoInputDto.cs
  6. 5
      src/Shentun.Pacs.Application/Devices/DeviceAppService.cs
  7. 145
      src/Shentun.Pacs.Application/PacsBusiness/PacsBusinessAppService.cs
  8. 7
      src/Shentun.Pacs.Domain/Devices/Device.cs
  9. 8
      src/Shentun.Pacs.Domain/Devices/DeviceManager.cs
  10. 5
      src/Shentun.Pacs.EntityFrameworkCore/DbMapping/Devices/DeviceDbMapping.cs
  11. 16293
      src/Shentun.Pacs.EntityFrameworkCore/Migrations/20241224090148_update_device_add_encoding_flag.Designer.cs
  12. 28
      src/Shentun.Pacs.EntityFrameworkCore/Migrations/20241224090148_update_device_add_encoding_flag.cs
  13. 10
      src/Shentun.Pacs.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs
  14. 1
      src/Shentun.Utilities/LanguageConverter.cs

5
src/Shentun.Pacs.Application.Contracts/Devices/CreateDeviceDto.cs

@ -36,6 +36,11 @@ namespace Shentun.Pacs.Devices
/// </summary>
public char DeviceImageType { get; set; }
/// <summary>
/// 设备支持的语言编码(0-中文 1-英文) 默认中文
/// </summary>
public char EncodingFlag { get; set; } = '0';
}
}

6
src/Shentun.Pacs.Application.Contracts/Devices/DeviceDto.cs

@ -49,5 +49,11 @@ namespace Shentun.Pacs.Devices
/// 仪器图片类型 (0-仪器图片 1-报告图片)
/// </summary>
public char DeviceImageType { get; set; }
/// <summary>
/// 设备支持的语言编码(0-中文 1-英文) 默认中文
/// </summary>
public char EncodingFlag { get; set; }
}
}

5
src/Shentun.Pacs.Application.Contracts/Devices/UpdateDeviceDto.cs

@ -40,5 +40,10 @@ namespace Shentun.Pacs.Devices
/// 仪器图片类型 (0-仪器图片 1-报告图片)
/// </summary>
public char DeviceImageType { get; set; }
/// <summary>
/// 设备支持的语言编码(0-中文 1-英文) 默认中文
/// </summary>
public char EncodingFlag { get; set; } = '0';
}
}

5
src/Shentun.Pacs.Application.Contracts/PacsBusiness/GetPatientRegisterPacsCheckDto.cs

@ -40,5 +40,10 @@ namespace Shentun.Pacs.PacsBusiness
/// 项目检查状态 0(为未检), 1(已检), 2(弃检)
/// </summary>
public char CompleteFlag { get; set; }
/// <summary>
/// 项目描述
/// </summary>
public string PacsDesc { get; set; }
}
}

5
src/Shentun.Pacs.Application.Contracts/PacsBusiness/ImportPeisCheckDataByCheckRequestNoInputDto.cs

@ -20,5 +20,10 @@ namespace Shentun.Pacs.PacsBusiness
/// 预检Aet
/// </summary>
public string ScheduledAet { get; set; }
/// <summary>
/// 条码模式(0-人员条码 1-检查条码) 默认0-人员条码
/// </summary>
public char BarcodeMode { get; set; } = '0';
}
}

5
src/Shentun.Pacs.Application/Devices/DeviceAppService.cs

@ -86,7 +86,8 @@ namespace Shentun.Pacs.Devices
CreatorName = _cacheService.GetSurnameAsync(s.CreatorId).GetAwaiter().GetResult(),
LastModifierName = _cacheService.GetSurnameAsync(s.LastModifierId).GetAwaiter().GetResult(),
DeviceCode = s.DeviceCode,
DeviceImageType = s.DeviceImageType
DeviceImageType = s.DeviceImageType,
EncodingFlag = s.EncodingFlag
}).OrderBy(o => o.DisplayOrder).ToList();
return entdto;
@ -115,7 +116,7 @@ namespace Shentun.Pacs.Devices
return new GetDeviceImageTypeByDeviceCodeDto
{
DeviceImageType = deviceEnt.DeviceImageType
DeviceImageType = deviceEnt.DeviceImageType
};
}

145
src/Shentun.Pacs.Application/PacsBusiness/PacsBusinessAppService.cs

@ -34,6 +34,7 @@ using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Uow;
using Volo.Abp.Users;
@ -388,6 +389,8 @@ namespace Shentun.Pacs.PacsBusiness
join registerCheckAsbitem in await _registerCheckAsbitemRepository.GetQueryableAsync() on registerCheck.Id equals registerCheckAsbitem.RegisterCheckId
join asbitem in await _asbitemRepository.GetQueryableAsync() on registerCheckAsbitem.AsbitemId equals asbitem.Id
join itemType in await _itemTypeRepository.GetQueryableAsync() on asbitem.ItemTypeId equals itemType.Id
join device in await _deviceRepository.GetQueryableAsync() on patientRegister.DeviceId equals device.Id into deviceTemp
from deviceHaveEmpty in deviceTemp.DefaultIfEmpty()
orderby registerCheck.PacsCheckDate descending
select new
{
@ -396,6 +399,8 @@ namespace Shentun.Pacs.PacsBusiness
checkRequestNo = registerCheck.CheckRequestNo,
registerCheckCompleteFlag = registerCheck.CompleteFlag,
asbitemName = asbitem.DisplayName,
asbitemShortName = !string.IsNullOrWhiteSpace(asbitem.ShortName) ? asbitem.ShortName : asbitem.DisplayName,
endAsbitemShortName = !string.IsNullOrWhiteSpace(asbitem.EnglishShortName) ? asbitem.EnglishShortName : asbitem.DisplayName,
asbitemId = registerCheckAsbitem.AsbitemId,
isPacsCheck = registerCheck.IsPacsCheck,
pacsCheckDate = registerCheck.PacsCheckDate,
@ -403,7 +408,9 @@ namespace Shentun.Pacs.PacsBusiness
registerCheckCreationTime = registerCheck.CreationTime,
registerCheckId = registerCheck.Id,
checkTypeFlag = itemType.CheckTypeFlag,
deviceId = patientRegister.DeviceId
deviceId = patientRegister.DeviceId,
encodingFlag = deviceHaveEmpty == null ? '0' : deviceHaveEmpty.EncodingFlag,
isFilmRelease = asbitem.IsFilmRelease
};
if (!string.IsNullOrWhiteSpace(input.PatientName))
@ -501,18 +508,54 @@ namespace Shentun.Pacs.PacsBusiness
int totalCount = checkRequestNoGroup.Count();
List<GetPatientRegisterPacsCheckDto> entListDto = new List<GetPatientRegisterPacsCheckDto>();
var entListGroup = checkRequestNoGroup.Skip(input.SkipCount * input.MaxResultCount).Take(input.MaxResultCount);
var entListDto = checkRequestNoGroup.Skip(input.SkipCount * input.MaxResultCount).Take(input.MaxResultCount)
.Select(s => new GetPatientRegisterPacsCheckDto
foreach (var item in entListGroup)
{
var fisrtItem = item.FirstOrDefault();
string pacsDesc = "";
if (fisrtItem.encodingFlag == '0')
{
string examDescription = string.Join(",", item.Select(ss => ss.asbitemShortName).Distinct());
if (item.Where(m => m.isFilmRelease == 'N').Count() > 0)
{
examDescription += ",不出片";
}
if (examDescription.Length > 64)
{
examDescription = examDescription.Substring(0, 64);
}
pacsDesc = examDescription;
}
else
{
CheckRequestNo = s.FirstOrDefault().checkRequestNo,
AsbitemName = s.FirstOrDefault().asbitemName,
PatientName = s.FirstOrDefault().patientName,
PacsCheckDate = DataHelper.ConversionDateToString(s.FirstOrDefault().pacsCheckDate),
PacsUploadDate = DataHelper.ConversionDateToString(s.FirstOrDefault().pacsUploadDate),
RegisterCheckId = s.Key,
CompleteFlag = s.FirstOrDefault().registerCheckCompleteFlag
}).ToList();
string examEngDescription = string.Join(",", item.Select(ss => ss.isFilmRelease == 'N' ? ss.endAsbitemShortName + "(BU)" : ss.endAsbitemShortName).Distinct());
if (examEngDescription.Length > 64)
{
examEngDescription = examEngDescription.Substring(0, 64);
}
pacsDesc = examEngDescription;
}
entListDto.Add(new GetPatientRegisterPacsCheckDto
{
CheckRequestNo = fisrtItem.checkRequestNo,
AsbitemName = fisrtItem.asbitemName,
PatientName = fisrtItem.patientName,
PacsCheckDate = DataHelper.ConversionDateToString(fisrtItem.pacsCheckDate),
PacsUploadDate = DataHelper.ConversionDateToString(fisrtItem.pacsUploadDate),
RegisterCheckId = item.Key,
CompleteFlag = fisrtItem.registerCheckCompleteFlag,
PacsDesc = pacsDesc
});
}
return new PagedResultDto<GetPatientRegisterPacsCheckDto>(totalCount, entListDto);
@ -1134,7 +1177,7 @@ namespace Shentun.Pacs.PacsBusiness
if (string.IsNullOrWhiteSpace(input.CheckRequestNo))
{
throw new UserFriendlyException("检查条码不能为空");
throw new UserFriendlyException("条码不能为空");
}
if (string.IsNullOrWhiteSpace(input.DeviceId))
@ -1182,13 +1225,30 @@ namespace Shentun.Pacs.PacsBusiness
});
string registerAsbitemSql = "";
if (input.BarcodeMode == '0')
{
registerAsbitemSql = "select a.name as patient_name,a.sex_id,a.mobile_telephone,a.telephone," +
"a.age,a.id_card_no,a.marital_status_id,a.complete_flag," +
"b.patient_register_id,b.print_barcode_no,b.asbitem_id,b.price,b.standard_price,b.charge_flag,b.payment_mode " +
"from patient_register as a left join register_asbitem as b on a.patient_register_id=b.patient_register_id " +
" left join asbitem as c on b.asbitem_id=c.asbitem_id " +
$" where a.barcode_no='{input.CheckRequestNo}' and c.device_type_id='{oldDeviceTypeId}' ";
}
else
{
var oldRegisterAsbitemList = await oldDb.Ado.GetDataTableAsync("select a.name as patient_name,a.sex_id,a.mobile_telephone,a.telephone," +
registerAsbitemSql = "select a.name as patient_name,a.sex_id,a.mobile_telephone,a.telephone," +
"a.age,a.id_card_no,a.marital_status_id,a.complete_flag," +
"b.patient_register_id,b.print_barcode_no,b.asbitem_id,b.price,b.standard_price,b.charge_flag,b.payment_mode " +
"from patient_register as a left join register_asbitem as b on a.patient_register_id=b.patient_register_id " +
" left join asbitem as c on b.asbitem_id=c.asbitem_id " +
$" where b.print_barcode_no='{input.CheckRequestNo}' and c.device_type_id='{oldDeviceTypeId}' ");
$" where b.print_barcode_no='{input.CheckRequestNo}' and c.device_type_id='{oldDeviceTypeId}' ";
}
var oldRegisterAsbitemList = await oldDb.Ado.GetDataTableAsync(registerAsbitemSql);
if (oldRegisterAsbitemList.Rows.Count > 0)
{
@ -1246,6 +1306,33 @@ namespace Shentun.Pacs.PacsBusiness
patientQuery = patientQuery.Where(m => m.IdNo == idNo);
}
#region 出生日期转换
DateTime? newBirthDate = null;
try
{
string birthDate = row["birth_date"].ToString();
if (!string.IsNullOrWhiteSpace(birthDate))
{
newBirthDate = Convert.ToDateTime(birthDate);
}
else if (!string.IsNullOrWhiteSpace(idNo))
{
newBirthDate = ConvertExtr.ToBirthDateByIdNo(idNo);
}
else if (age != null)
{
newBirthDate = ConvertExtr.ToBirthDateByAge(age.Value);
}
}
catch (Exception ex)
{
}
#endregion
//档案
var patientEnt = await patientQuery.FirstOrDefaultAsync();
@ -1253,7 +1340,7 @@ namespace Shentun.Pacs.PacsBusiness
{
patientEnt = new Patient(GuidGenerator.Create())
{
BirthDate = null,
BirthDate = newBirthDate,
BirthPlaceId = null,
DisplayName = patientName,
Email = null,
@ -1421,7 +1508,7 @@ namespace Shentun.Pacs.PacsBusiness
#endregion
}
}
}
#endregion
entDto = await _patientRegisterAppService.GetPatientRegisterOrNo(tempPatientRegisterId);
@ -1535,22 +1622,22 @@ namespace Shentun.Pacs.PacsBusiness
foreach (var item in registerCheckPictureList)
{
string pacsDeviceId = registerCheckFirst.patientRegister.DeviceId.ToString();
//string pacsDeviceId = registerCheckFirst.patientRegister.DeviceId.ToString();
Guid deviceColumnReferenId = Guid.Parse(_configuration.GetValue<string>("OldPeis:DeviceColumnReferenId", Guid.Empty.ToString()));
//Guid deviceColumnReferenId = Guid.Parse(_configuration.GetValue<string>("OldPeis:DeviceColumnReferenId", Guid.Empty.ToString()));
var deviceCodeValues = await _columnReferenceCodeManager.GetInterfaceCodeValueAsync(deviceColumnReferenId, pacsDeviceId);
if (!deviceCodeValues.Any())
{
throw new UserFriendlyException($"Pacs仪器id:{pacsDeviceId}没有对照");
}
//var deviceCodeValues = await _columnReferenceCodeManager.GetInterfaceCodeValueAsync(deviceColumnReferenId, pacsDeviceId);
//if (!deviceCodeValues.Any())
//{
// throw new UserFriendlyException($"Pacs仪器id:{pacsDeviceId}没有对照");
//}
if (deviceCodeValues.Count() > 1)
{
throw new UserFriendlyException($"Pacs仪器id:{pacsDeviceId}有多个pacs项目进行了对照");
}
//if (deviceCodeValues.Count() > 1)
//{
// throw new UserFriendlyException($"Pacs仪器id:{pacsDeviceId}有多个pacs项目进行了对照");
//}
string deviceId = deviceCodeValues.First(); //pacs系统组合项目id
//string deviceId = deviceCodeValues.First(); //pacs系统组合项目id
string pictureFilename = $"{shareAddress}{item.PictureFilename.Replace(pacsRequestPath, "/").Replace("//", "/").Replace("/", @"\")}";
@ -1562,7 +1649,7 @@ namespace Shentun.Pacs.PacsBusiness
new List<SugarParameter>() {
new SugarParameter("patient_register_id",registerCheckFirst.registerCheckAsbitem.OldPatientRegisterId),
new SugarParameter("asbitem_id",registerCheckFirst.registerCheckAsbitem.OldAsbitemId),
new SugarParameter("device_id",deviceId),
new SugarParameter("device_id",null),
new SugarParameter("picture_filename",pictureFilename),
new SugarParameter("print_flag",'Y'),
new SugarParameter("local_store_flag",'Y'),

7
src/Shentun.Pacs.Domain/Devices/Device.cs

@ -80,6 +80,13 @@ namespace Shentun.Pacs.Models
[MaxLength(1)]
public char DeviceImageType { get; set; }
/// <summary>
/// 设备支持的语言编码(0-中文 1-英文) 默认中文
/// </summary>
[Column("encoding_flag")]
[MaxLength(1)]
public char EncodingFlag { get; set; }
[Column("concurrency_stamp")]
public string ConcurrencyStamp { get; set; }

8
src/Shentun.Pacs.Domain/Devices/DeviceManager.cs

@ -57,7 +57,8 @@ namespace Shentun.Pacs.Devices
DeviceTypeId = entity.DeviceTypeId,
DisplayOrder = await EntityHelper.CreateMaxDisplayOrder(_deviceRepository),
DeviceImageType = entity.DeviceImageType,
DeviceCode = entity.DeviceCode
DeviceCode = entity.DeviceCode,
EncodingFlag = entity.EncodingFlag
};
}
@ -94,6 +95,7 @@ namespace Shentun.Pacs.Devices
targetEntity.AeTitle = sourceEntity.AeTitle;
targetEntity.DeviceImageType = sourceEntity.DeviceImageType;
targetEntity.DeviceCode = sourceEntity.DeviceCode;
targetEntity.EncodingFlag = sourceEntity.EncodingFlag;
}
@ -159,6 +161,10 @@ namespace Shentun.Pacs.Devices
{
throw new ArgumentException($"设备协议只能为0,1");
}
if (entity.EncodingFlag != '0' && entity.EncodingFlag != '1')
{
throw new ArgumentException($"设备支持的语言编码只能为0,1");
}
}

5
src/Shentun.Pacs.EntityFrameworkCore/DbMapping/Devices/DeviceDbMapping.cs

@ -22,8 +22,9 @@ namespace Shentun.Pacs.DbMapping
entity.Property(t => t.DeviceProtocolFlag).HasComment("设备协议");
entity.Property(t => t.AeTitle).HasComment("DICOM设备AETitle");
entity.Property(t => t.DeviceCode).HasComment("设备编码");
entity.Property(t => t.DeviceImageType).HasComment("仪器图片类型").HasDefaultValueSql("'0'"); ;
entity.Property(t => t.DeviceImageType).HasComment("仪器图片类型").HasDefaultValueSql("'0'");
entity.Property(t => t.EncodingFlag).HasComment("设备支持的语言编码(0-中文 1-英文) 默认中文").HasDefaultValueSql("'0'");
entity.ConfigureByConvention();
}
}

16293
src/Shentun.Pacs.EntityFrameworkCore/Migrations/20241224090148_update_device_add_encoding_flag.Designer.cs
File diff suppressed because it is too large
View File

28
src/Shentun.Pacs.EntityFrameworkCore/Migrations/20241224090148_update_device_add_encoding_flag.cs

@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Shentun.Pacs.Migrations
{
public partial class update_device_add_encoding_flag : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<char>(
name: "encoding_flag",
table: "device",
type: "character(1)",
maxLength: 1,
nullable: false,
defaultValueSql: "'0'",
comment: "设备支持的语言编码(0-中文 1-英文) 默认中文");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "encoding_flag",
table: "device");
}
}
}

10
src/Shentun.Pacs.EntityFrameworkCore/Migrations/PeisDbContextModelSnapshot.cs

@ -3577,6 +3577,14 @@ namespace Shentun.Pacs.Migrations
.HasColumnType("integer")
.HasColumnName("display_order");
b.Property<char>("EncodingFlag")
.ValueGeneratedOnAdd()
.HasMaxLength(1)
.HasColumnType("character(1)")
.HasColumnName("encoding_flag")
.HasDefaultValueSql("'0'")
.HasComment("设备支持的语言编码(0-中文 1-英文) 默认中文");
b.Property<DateTime?>("LastModificationTime")
.IsRequired()
.HasColumnType("timestamp without time zone")
@ -12944,7 +12952,7 @@ namespace Shentun.Pacs.Migrations
.HasColumnName("method_name");
b.Property<string>("Parameters")
.HasMaxLength(50000)
.HasMaxLength(2000)
.HasColumnType("text")
.HasColumnName("parameters");

1
src/Shentun.Utilities/LanguageConverter.cs

@ -150,6 +150,7 @@ namespace Shentun.Utilities
/// <returns></returns>
public static string GetPYAllName(string strChinese)
{
//var sss = strChinese.ToArray();
string pinyin = string.Join(" ", strChinese.ToArray().Select(c => Pinyin.GetPinyin(c)));
return pinyin.ToUpper();
}

Loading…
Cancel
Save