14 changed files with 423 additions and 56 deletions
-
19ThirdPlugIns/Shentun.Peis.PlugIns.Gem/LisResultImportPlugInsGem.cs
-
31src/Shentun.ColumnReferencePlugIns/ColumnReferencePlugInsDbBase.cs
-
22src/Shentun.ColumnReferencePlugIns/LisRequestForResultImportPlugIns.cs
-
4src/Shentun.ColumnReferencePlugIns/LisRequestPlugInsBase.cs
-
68src/Shentun.ColumnReferencePlugIns/LisResult.cs
-
48src/Shentun.ColumnReferencePlugIns/LisResultImportPlugInsBase.cs
-
41src/Shentun.ColumnReferencePlugIns/LisResultImportPlugInsDbBase.cs
-
14src/Shentun.ColumnReferencePlugIns/LisResultImportPlugInsInput.cs
-
12src/Shentun.ColumnReferencePlugIns/LisResultImportPlugInsOut.cs
-
42src/Shentun.ColumnReferencePlugIns/PlugInsBase.cs
-
114src/Shentun.Peis.Application/ImportLisResults/ImportLisResultAppService.cs
-
6src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs
-
38src/Shentun.Peis.Domain/CacheService.cs
-
16test/Shentun.Peis.Application.Tests/PatientRegisterAppServiceTest.cs
@ -0,0 +1,19 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Shentun.Peis.PlugIns.Gem |
||||
|
{ |
||||
|
public class LisResultImportPlugInsGem : LisResultImportPlugInsBase |
||||
|
{ |
||||
|
public LisResultImportPlugInsGem(string parmValue) : base(parmValue) |
||||
|
{ |
||||
|
} |
||||
|
public override Task<LisResultImportPlugInsOut> ImportResult(LisResultImportPlugInsInput input) |
||||
|
{ |
||||
|
return base.ImportResult(input); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,22 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Shentun.Peis.PlugIns |
||||
|
{ |
||||
|
public class LisRequestForResultImportPlugIns |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// LisRequest的ID
|
||||
|
/// </summary>
|
||||
|
public Guid LisRequestId { get; set; } |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 检验申请单号
|
||||
|
/// </summary>
|
||||
|
public string LisRequestNo { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,68 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Shentun.Peis.PlugIns |
||||
|
{ |
||||
|
public class LisResult |
||||
|
{ |
||||
|
public string LisRequestNo { get; set; } |
||||
|
/// 项目编号
|
||||
|
/// </summary>
|
||||
|
public string ItemId { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 项目名称
|
||||
|
/// </summary>
|
||||
|
public string ItemName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 结果
|
||||
|
/// </summary>
|
||||
|
public string? Result { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 单位
|
||||
|
/// </summary>
|
||||
|
|
||||
|
public string? Unit { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 参考范围
|
||||
|
/// </summary>
|
||||
|
|
||||
|
public string? ReferenceRangeValue { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 危急值范围
|
||||
|
/// </summary>
|
||||
|
|
||||
|
public string? CriticalRangeValue { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 危急值
|
||||
|
/// </summary>
|
||||
|
|
||||
|
public string? CriticalValue { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 报告单状态
|
||||
|
/// </summary>
|
||||
|
|
||||
|
public string? ResultStatusId { get; set; } = "01";//01-正常
|
||||
|
/// <summary>
|
||||
|
/// 报告单提示
|
||||
|
/// </summary>
|
||||
|
public string ReportPrompt { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 检查医生
|
||||
|
/// </summary>
|
||||
|
|
||||
|
public string? CheckDoctorName { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 检查日期
|
||||
|
/// </summary>
|
||||
|
|
||||
|
public DateTime? CheckDate { get; set; } |
||||
|
|
||||
|
public Guid ExecOrganizationUnitId { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,48 @@ |
|||||
|
using Dapper; |
||||
|
using Npgsql; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Data.Common; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Shentun.Peis.PlugIns |
||||
|
{ |
||||
|
public class LisResultImportPlugInsBase : ThirdPlugInsBase |
||||
|
{ |
||||
|
protected Guid ItemColumnReferenceId; |
||||
|
public LisResultImportPlugInsBase(string parmValue) : base(parmValue) |
||||
|
{ |
||||
|
var itemColumnReferenceIdStr = InterfaceConfig.GetSection("Interface").GetSection("ItemColumnReferenceId").Value; |
||||
|
if (!string.IsNullOrWhiteSpace(itemColumnReferenceIdStr)) |
||||
|
{ |
||||
|
ItemColumnReferenceId = new Guid(itemColumnReferenceIdStr); |
||||
|
} |
||||
|
} |
||||
|
public virtual async Task<LisResultImportPlugInsOut> ImportResult(LisResultImportPlugInsInput input) |
||||
|
{ |
||||
|
var result = new LisResultImportPlugInsOut(); |
||||
|
return result; |
||||
|
} |
||||
|
|
||||
|
public async Task<List<LisRequestForResultImportPlugIns>> GetLisRequestForResultImportPlugInssAsync(Guid patientRegisterId) |
||||
|
{ |
||||
|
using (DbConnection conn = new NpgsqlConnection(AppConnctionStr)) |
||||
|
{ |
||||
|
string sql; |
||||
|
sql = @"
|
||||
|
SELECT lis_request.id , |
||||
|
lis_request.lis_request_no |
||||
|
from patient_register |
||||
|
JOIN register_check on patient_register.id = register_check.patient_register_id |
||||
|
JOIN register_check_asbitem on register_check.id = register_check_asbitem.register_check_id |
||||
|
JOIN lis_request on register_check_asbitem.lis_request_id = lis_request.id |
||||
|
where patient_register.id = @PatientRegisterId |
||||
|
";
|
||||
|
var lisRequestForResultImportPlugInss = (await conn.QueryAsync<LisRequestForResultImportPlugIns>(sql)).ToList(); |
||||
|
return lisRequestForResultImportPlugInss; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,41 @@ |
|||||
|
using Dapper; |
||||
|
using Microsoft.Data.SqlClient; |
||||
|
using Npgsql; |
||||
|
using Oracle.ManagedDataAccess.Client; |
||||
|
using Shentun.Utilities; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Data.Common; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Shentun.Peis.PlugIns |
||||
|
{ |
||||
|
public class LisResultImportPlugInsDbBase : LisResultImportPlugInsBase |
||||
|
{ |
||||
|
|
||||
|
public LisResultImportPlugInsDbBase(string parmValue) : base(parmValue) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
public override async Task<LisResultImportPlugInsOut> ImportResult(LisResultImportPlugInsInput input) |
||||
|
{ |
||||
|
var lisRequests = await GetLisRequestForResultImportPlugInssAsync(input.PatientRegisterId); |
||||
|
using (DbConnection conn = CreateInterfaceDbConnect()) |
||||
|
{ |
||||
|
var list = (await conn.QueryAsync<LisResult>(InterfaceSql)).ToList(); |
||||
|
//设置结果,生成小结
|
||||
|
foreach (var item in list) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
return new LisResultImportPlugInsOut(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Shentun.Peis.PlugIns |
||||
|
{ |
||||
|
public class LisResultImportPlugInsInput |
||||
|
{ |
||||
|
public Guid PatientRegisterId { get; set; } |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Shentun.Peis.PlugIns |
||||
|
{ |
||||
|
public class LisResultImportPlugInsOut |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,114 @@ |
|||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using Microsoft.Extensions.Configuration; |
||||
|
using Shentun.Peis.Models; |
||||
|
using Shentun.Peis.PlugIns; |
||||
|
using Shentun.Peis.RegisterCheckItems; |
||||
|
using Shentun.Peis.RegisterChecks; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
using Volo.Abp.Domain.Repositories; |
||||
|
using Volo.Abp.Guids; |
||||
|
using Volo.Abp.Identity; |
||||
|
using Volo.Abp.Users; |
||||
|
|
||||
|
namespace Shentun.Peis.ImportLisResults |
||||
|
{ |
||||
|
public class ImportLisResultAppService : ApplicationService |
||||
|
{ |
||||
|
private readonly IRepository<RegisterCheckItem> _registerCheckItemRepository; |
||||
|
private readonly IRepository<PatientRegister, Guid> _patientRegisterRepository; |
||||
|
private readonly IRepository<ReferenceRange, Guid> _referenceRangeRepository; |
||||
|
private readonly IRepository<RegisterCheck, Guid> _registerCheckRepository; |
||||
|
private readonly IRepository<RegisterCheckAsbitem, Guid> _registerCheckAsbitemRepository; |
||||
|
private readonly IRepository<LisRequest, Guid> _lisRequestRepository; |
||||
|
private readonly IRepository<RegisterCheckSummary, Guid> _registerCheckSummaryRepository; |
||||
|
private readonly IRepository<RegisterCheckSuggestion, Guid> _registerCheckSuggestionRepository; |
||||
|
private readonly IRepository<IdentityUser, Guid> _userRepository; |
||||
|
private readonly RegisterCheckManager _registerCheckManager; |
||||
|
private readonly RegisterCheckItemManager _registerCheckItemManager; |
||||
|
private readonly CacheService _cacheService; |
||||
|
private readonly IGuidGenerator _guidGenerator; |
||||
|
private readonly IConfiguration _configuration; |
||||
|
private readonly ICurrentUser _currentUser; |
||||
|
private readonly IRepository<UserItemType> _userItemTypeRepository; |
||||
|
private readonly IRepository<Asbitem, Guid> _asbitemRepository; |
||||
|
|
||||
|
public ImportLisResultAppService(IRepository<RegisterCheck, Guid> registerCheckRepository, |
||||
|
IRepository<RegisterCheckItem> registerCheckItemRepository, |
||||
|
IRepository<PatientRegister, Guid> patientRegisterRepository, |
||||
|
IRepository<ReferenceRange, Guid> referenceRangeRepository, |
||||
|
IRepository<RegisterCheckSummary, Guid> registerCheckSummaryRepository, |
||||
|
IRepository<RegisterCheckSuggestion, Guid> registerCheckSuggestionRepository, |
||||
|
IRepository<IdentityUser, Guid> userRepository, |
||||
|
RegisterCheckManager registerCheckManager, |
||||
|
RegisterCheckItemManager registerCheckItemManager, |
||||
|
CacheService cacheService, |
||||
|
IGuidGenerator guidGenerator, |
||||
|
IConfiguration configuration, |
||||
|
ICurrentUser currentUser, |
||||
|
IRepository<UserItemType> userItemTypeRepository, |
||||
|
IRepository<Asbitem, Guid> asbitemRepository, |
||||
|
IRepository<RegisterCheckAsbitem, Guid> registerCheckAsbitemRepository, |
||||
|
IRepository<LisRequest, Guid> lisRequestRepository) |
||||
|
{ |
||||
|
_registerCheckRepository = registerCheckRepository; |
||||
|
_userRepository = userRepository; |
||||
|
_registerCheckManager = registerCheckManager; |
||||
|
_patientRegisterRepository = patientRegisterRepository; |
||||
|
_referenceRangeRepository = referenceRangeRepository; |
||||
|
_registerCheckItemRepository = registerCheckItemRepository; |
||||
|
_registerCheckSummaryRepository = registerCheckSummaryRepository; |
||||
|
_registerCheckSuggestionRepository = registerCheckSuggestionRepository; |
||||
|
_registerCheckItemManager = registerCheckItemManager; |
||||
|
_cacheService = cacheService; |
||||
|
_guidGenerator = guidGenerator; |
||||
|
_configuration = configuration; |
||||
|
_currentUser = currentUser; |
||||
|
_userItemTypeRepository = userItemTypeRepository; |
||||
|
_asbitemRepository = asbitemRepository; |
||||
|
_registerCheckAsbitemRepository = registerCheckAsbitemRepository; |
||||
|
_lisRequestRepository = lisRequestRepository; |
||||
|
} |
||||
|
[HttpGet("api/app/ImportLisResult/ImportResult")] |
||||
|
public async Task ImportResultAsync(List<LisResult> input) |
||||
|
{ |
||||
|
//设置结果
|
||||
|
|
||||
|
var list = (from registerCheck in await _registerCheckRepository.GetQueryableAsync() |
||||
|
join registerCheckAsbitem in await _registerCheckAsbitemRepository.GetQueryableAsync() |
||||
|
on registerCheck.Id equals registerCheckAsbitem.RegisterCheckId |
||||
|
join registerCheckItem in await _registerCheckItemRepository.GetQueryableAsync() |
||||
|
on registerCheck.Id equals registerCheckItem.RegisterCheckId |
||||
|
join lisRequest in await _lisRequestRepository.GetQueryableAsync() |
||||
|
on registerCheckAsbitem.LisRequestId equals lisRequest.Id |
||||
|
where input.Select(o => o.LisRequestNo).ToList().Contains(lisRequest.LisRequestNo) |
||||
|
select new |
||||
|
{ |
||||
|
registerCheck, |
||||
|
registerCheckAsbitem, |
||||
|
registerCheckItem, |
||||
|
lisRequest, |
||||
|
}).ToList(); |
||||
|
|
||||
|
var lisRequestNos = input.Select(o => o.LisRequestNo).Distinct().ToList(); |
||||
|
foreach(var inputItem in input) |
||||
|
{ |
||||
|
var lisRequestItem = list.Where(o=>o.lisRequest.LisRequestNo == inputItem.LisRequestNo |
||||
|
&& o.registerCheckItem.ItemId == new Guid(inputItem.ItemId)).FirstOrDefault(); |
||||
|
if(lisRequestItem == null) |
||||
|
{ |
||||
|
continue; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
//生成小结
|
||||
|
//保存小结
|
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue