|
|
|
@ -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'), |
|
|
|
|