|
|
|
@ -139,42 +139,51 @@ namespace Shentun.Peis.ImportLisResults |
|
|
|
var lisRequestNos = input.Select(o => o.LisRequestNo).Distinct().ToList(); |
|
|
|
var registerChecks = new List<RegisterCheck>(); |
|
|
|
_referenceRanges = _referenceRangeRepository.GetListAsync().Result; |
|
|
|
|
|
|
|
input = input.Where(o => !string.IsNullOrWhiteSpace(o.Result) |
|
|
|
&& !string.IsNullOrWhiteSpace(o.LisRequestNo) |
|
|
|
&& o.ItemId != Guid.Empty).ToList(); |
|
|
|
|
|
|
|
foreach (var inputItem in input) |
|
|
|
{ |
|
|
|
if(string.IsNullOrWhiteSpace(inputItem.CheckDoctorName)) |
|
|
|
if (string.IsNullOrWhiteSpace(inputItem.CheckDoctorName)) |
|
|
|
{ |
|
|
|
throw new UserFriendlyException("检查医生不能为空"); |
|
|
|
} |
|
|
|
var lisRequestItem = list.Where(o => o.lisRequest.LisRequestNo == inputItem.LisRequestNo |
|
|
|
&& o.registerCheckItem.ItemId == inputItem.ItemId).FirstOrDefault(); |
|
|
|
if (lisRequestItem == null) |
|
|
|
var lisRequestItems = list.Where(o => o.lisRequest.LisRequestNo == inputItem.LisRequestNo |
|
|
|
&& o.registerCheckItem.ItemId == inputItem.ItemId).ToList(); |
|
|
|
foreach (var lisRequestItem in lisRequestItems) |
|
|
|
{ |
|
|
|
continue; |
|
|
|
} |
|
|
|
lisRequestItem.registerCheckItem.Result = inputItem.Result; |
|
|
|
//var itemSource = new RegisterCheckItem()
|
|
|
|
//{
|
|
|
|
// Result = inputItem.Result,
|
|
|
|
// ReferenceRangeValue = inputItem.ReferenceRangeValue,
|
|
|
|
// Unit = inputItem.Unit,
|
|
|
|
// CriticalRangeValue = inputItem.CriticalRangeValue
|
|
|
|
//};
|
|
|
|
//修改参考范围
|
|
|
|
await UpdateItemReferenceRangeValueAsync(inputItem.ItemId, lisRequestItem.patientRegister.SexId, |
|
|
|
lisRequestItem.patientRegister.Age, inputItem.ReferenceRangeValue); |
|
|
|
//修改单位
|
|
|
|
await UpdateItemUnitAsync(inputItem.ItemId, inputItem.Unit); |
|
|
|
if (lisRequestItem == null) |
|
|
|
{ |
|
|
|
continue; |
|
|
|
} |
|
|
|
lisRequestItem.registerCheckItem.Result = inputItem.Result; |
|
|
|
//var itemSource = new RegisterCheckItem()
|
|
|
|
//{
|
|
|
|
// Result = inputItem.Result,
|
|
|
|
// ReferenceRangeValue = inputItem.ReferenceRangeValue,
|
|
|
|
// Unit = inputItem.Unit,
|
|
|
|
// CriticalRangeValue = inputItem.CriticalRangeValue
|
|
|
|
//};
|
|
|
|
//修改参考范围
|
|
|
|
await UpdateItemReferenceRangeValueAsync(inputItem.ItemId, lisRequestItem.patientRegister.SexId, |
|
|
|
lisRequestItem.patientRegister.Age, inputItem.ReferenceRangeValue); |
|
|
|
//修改单位
|
|
|
|
await UpdateItemUnitAsync(inputItem.ItemId, inputItem.Unit); |
|
|
|
|
|
|
|
//await _registerCheckItemManager.UpdateRegisterCheckItemAsync(itemSource, lisRequestItem.registerCheckItem);
|
|
|
|
//await _registerCheckItemRepository.UpdateAsync(lisRequestItem.registerCheckItem,true);
|
|
|
|
if (!registerChecks.Where(o => o.Id == lisRequestItem.registerCheck.Id).ToList().Any()) |
|
|
|
{ |
|
|
|
lisRequestItem.registerCheck.CheckDoctorId = inputItem.CheckDoctorName; |
|
|
|
lisRequestItem.registerCheck.CheckDate = inputItem.CheckDate; |
|
|
|
lisRequestItem.registerCheck.ExecOrganizationUnitId = inputItem.ExecOrganizationUnitId; |
|
|
|
registerChecks.Add(lisRequestItem.registerCheck); |
|
|
|
//await _registerCheckItemManager.UpdateRegisterCheckItemAsync(itemSource, lisRequestItem.registerCheckItem);
|
|
|
|
//await _registerCheckItemRepository.UpdateAsync(lisRequestItem.registerCheckItem,true);
|
|
|
|
if (!registerChecks.Where(o => o.Id == lisRequestItem.registerCheck.Id).ToList().Any()) |
|
|
|
{ |
|
|
|
lisRequestItem.registerCheck.CheckDoctorId = inputItem.CheckDoctorName; |
|
|
|
lisRequestItem.registerCheck.CheckDate = inputItem.CheckDate; |
|
|
|
lisRequestItem.registerCheck.ExecOrganizationUnitId = inputItem.ExecOrganizationUnitId; |
|
|
|
registerChecks.Add(lisRequestItem.registerCheck); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|