diff --git a/src/Shentun.Peis.Application.Contracts/CommonTables/CommonTableListInputDto.cs b/src/Shentun.Peis.Application.Contracts/CommonTables/CommonTableListInputDto.cs new file mode 100644 index 0000000..6106098 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/CommonTables/CommonTableListInputDto.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.CommonTables +{ + public class CommonTableListInputDto + { + public string CommonTableTypeId { get; set; } + + public string KeyWord { get; set;} + + } +} diff --git a/src/Shentun.Peis.Application.Contracts/ImportLisResults/ImportResultExcelByLisRequestNoInputDto.cs b/src/Shentun.Peis.Application.Contracts/ImportLisResults/ImportResultExcelByLisRequestNoInputDto.cs new file mode 100644 index 0000000..3f884a4 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/ImportLisResults/ImportResultExcelByLisRequestNoInputDto.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.ImportLisResults +{ + public class ImportResultExcelByLisRequestNoInputDto + { + /// + /// 条码类型 (0-人员条码,1-项目条码) + /// + public char BarcodeMode { get; set; } = '1'; + + /// + /// 条码号 + /// + public string BarCode { get; set; } + + /// + /// 标本号 + /// + public string SampleNo { get; set; } + + /// + /// 仪器通道 暂无用 + /// + public string DeviceChannel { get; set; } + + /// + /// 明细结果 + /// + public List Details { get; set; } + } + + public class ImportResultExcelByLisRequestNoInputDetailDto + { + /// + /// 检查时间 + /// + public string CheckDate { get; set; } + + /// + /// 项目名字 对照后的名称 + /// + public string ItemName { get; set; } + + /// + /// 项目结果 + /// + public string ItemResult { get; set; } + + /// + /// 检查医生 + /// + public string CheckDoctorName { get; set; } + } +} diff --git a/src/Shentun.Peis.Application/CommonTables/CommonTableAppService.cs b/src/Shentun.Peis.Application/CommonTables/CommonTableAppService.cs index 77bb3ea..1f697dd 100644 --- a/src/Shentun.Peis.Application/CommonTables/CommonTableAppService.cs +++ b/src/Shentun.Peis.Application/CommonTables/CommonTableAppService.cs @@ -27,7 +27,7 @@ namespace Shentun.Peis.CommonTables private readonly CommonTableManager _commonTableManager; private readonly CacheService _cacheService; - public CommonTableAppService( + public CommonTableAppService( IRepository commonTableTypeRepository, CommonTableManager commonTableManager, CacheService cacheService, @@ -56,15 +56,22 @@ namespace Shentun.Peis.CommonTables /// - /// 获取列表 + /// 获取列表 可根据条件检索 /// /// [HttpPost("api/app/CommonTable/GetList")] - public async Task> GetListAsync() + public async Task> GetListAsync(CommonTableListInputDto input) { - var entlist = await _commonTableRepository.GetQueryableAsync(); + var query = await _commonTableRepository.GetQueryableAsync(); - var entdto = entlist.Select(s => new CommonTableDto + if (!string.IsNullOrWhiteSpace(input.CommonTableTypeId)) + query = query.Where(m => m.CommonTableTypeId == input.CommonTableTypeId); + + if (!string.IsNullOrWhiteSpace(input.KeyWord)) + query = query.Where(m => m.DataCode.Contains(input.KeyWord) || m.DisplayName.Contains(input.KeyWord) || m.SimpleCode.Contains(input.KeyWord)); + + + var entdto = query.Select(s => new CommonTableDto { CreationTime = s.CreationTime, CreatorId = s.CreatorId, diff --git a/src/Shentun.Peis.Application/ImportLisResults/ImportLisResultAppService.cs b/src/Shentun.Peis.Application/ImportLisResults/ImportLisResultAppService.cs index 372f634..11846af 100644 --- a/src/Shentun.Peis.Application/ImportLisResults/ImportLisResultAppService.cs +++ b/src/Shentun.Peis.Application/ImportLisResults/ImportLisResultAppService.cs @@ -437,6 +437,7 @@ namespace Shentun.Peis.ImportLisResults } + #region 蓝豚lis结果导入 /// /// 根据lis检验单号导入结果 /// @@ -469,7 +470,7 @@ namespace Shentun.Peis.ImportLisResults { throw new UserFriendlyException($"项目编号:{item.ItemId}没有对照"); } - + foreach (var codeValue in codeValues) { @@ -495,7 +496,7 @@ namespace Shentun.Peis.ImportLisResults inputDtoList.Add(inputDto); } - + } var lisRequestNoPrintMode = await _sysParmValueManager.GetSysParmValueAsync(Guid.Empty, "lis_request_no_print_mode"); @@ -674,5 +675,71 @@ namespace Shentun.Peis.ImportLisResults } } + #endregion + + #region 批量导入lis结果 需要单独对照 + + /// + /// 按excel批量导入检验结果 + /// + /// + /// + /// + [HttpPost("api/app/ImportLisResult/ImportResultExcelByLisRequestNo")] + public async Task ImportResultExcelByLisRequestNoAsync(ImportResultExcelByLisRequestNoInputDto input) + { + List inputDtoList = new List(); + + //对照主表Id + var columnReferenceId = await _sysParmValueManager.GetSysParmValueAsync(Guid.Empty, "import_file_lis_result"); + if (string.IsNullOrWhiteSpace(columnReferenceId)) + throw new UserFriendlyException("未找到对照主表Id,请到系统参数配置"); + foreach (var item in input.Details) + { + var codeValues = await _columnReferenceCodeManager.GetColumnReferenCodeValueAsync(Guid.Parse(columnReferenceId), item.ItemName); + if (!codeValues.Any()) + { + throw new UserFriendlyException($"项目名称:{item.ItemName}没有对照"); + } + + + foreach (var codeValue in codeValues) + { + Guid itemId = Guid.Parse(codeValue); + var inputDto = new CreateImportLisResultDto + { + CheckDate = string.IsNullOrWhiteSpace(item.CheckDate) ? null : Convert.ToDateTime(item.CheckDate), + CheckDoctorName = item.CheckDoctorName, + CriticalRangeValue = "", + CriticalValue = "", + ExecOrganizationUnitId = Guid.Empty, + ItemId = itemId, + ItemName = item.ItemName, + LisRequestNo = input.BarCode, + ReferenceRangeValue = "", + ReportPrompt = "", + ResultStatusId = null, + Result = item.ItemResult, + Unit = "", + LisAuditorDoctorName = "", + LisSampleNo = input.SampleNo + }; + inputDtoList.Add(inputDto); + } + + + } + + if (input.BarcodeMode == '0') + { + await ImportResultByPatientRegisterNoAsync(inputDtoList); + } + else if (input.BarcodeMode == '1') + { + await ImportResultAsync(inputDtoList); + } + } + + #endregion } } diff --git a/src/Shentun.Peis.Application/TransToWebPeis/TransToWebPeisAppService.cs b/src/Shentun.Peis.Application/TransToWebPeis/TransToWebPeisAppService.cs index 3b33c12..0993790 100644 --- a/src/Shentun.Peis.Application/TransToWebPeis/TransToWebPeisAppService.cs +++ b/src/Shentun.Peis.Application/TransToWebPeis/TransToWebPeisAppService.cs @@ -966,8 +966,13 @@ namespace Shentun.Peis.TransToWebPeis #endregion } - short newMedicalTimes = (short)((short)(await WebDb.Ado.GetScalarAsync($"select max(medical_times) from patient_register where patient_id='{patientRegisterEnt.PatientId}'")) + 1); + short newMedicalTimes = 1; + var maxMedicalTimes = await WebDb.Ado.GetStringAsync($"select max(medical_times) from patient_register where patient_id='{patientRegisterEnt.PatientId}'"); + if (!string.IsNullOrWhiteSpace(maxMedicalTimes)) + { + newMedicalTimes = (short)(Convert.ToInt16(maxMedicalTimes) + 1); + } diff --git a/src/Shentun.Peis.Domain/CommonTables/CommonTableManager.cs b/src/Shentun.Peis.Domain/CommonTables/CommonTableManager.cs index 81afff3..ddf7579 100644 --- a/src/Shentun.Peis.Domain/CommonTables/CommonTableManager.cs +++ b/src/Shentun.Peis.Domain/CommonTables/CommonTableManager.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; using Volo.Abp; using Volo.Abp.Domain.Services; +using Org.BouncyCastle.Crypto.Modes.Gcm; namespace Shentun.Peis.CommonTables { @@ -118,5 +119,7 @@ namespace Shentun.Peis.CommonTables { await EntityHelper.UpdateSortManyCommonAsync(_commonTableRepository, input); } + + } }