From 26c19ab37923d8618d3c4d5b69fa219299947840 Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Wed, 8 May 2024 23:51:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Diagnosises/SimpleDiagnosisDto.cs | 23 ++++++ .../ItemTypes/CreateItemTypeDto.cs | 5 ++ .../ItemTypes/ItemTypeDto.cs | 6 ++ .../ItemTypes/UpdateItemTypeDto.cs | 5 ++ .../BaseDataHandleAppService.cs | 82 ++++++++++++------- .../Diagnosises/DiagnosisAppService.cs | 28 ++++++- .../ItemResultTemplateAppService.cs | 6 +- src/Shentun.Peis.Domain/ItemTypes/ItemType.cs | 3 + .../ItemTypes/ItemTypeManager.cs | 5 +- .../PatientRegisterGuideReportDto.cs | 7 ++ .../PatientRegisterGuideReportRepository.cs | 12 +-- 11 files changed, 140 insertions(+), 42 deletions(-) create mode 100644 src/Shentun.Peis.Application.Contracts/Diagnosises/SimpleDiagnosisDto.cs diff --git a/src/Shentun.Peis.Application.Contracts/Diagnosises/SimpleDiagnosisDto.cs b/src/Shentun.Peis.Application.Contracts/Diagnosises/SimpleDiagnosisDto.cs new file mode 100644 index 0000000..e02683c --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/Diagnosises/SimpleDiagnosisDto.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.Diagnosises +{ + public class SimpleDiagnosisDto + { + + /// + /// id + /// + public Guid Id { get; set; } + + /// + /// 名称 + /// + public string DisplayName { get; set; } + + public string SimpleCode { get; set; } + + } +} diff --git a/src/Shentun.Peis.Application.Contracts/ItemTypes/CreateItemTypeDto.cs b/src/Shentun.Peis.Application.Contracts/ItemTypes/CreateItemTypeDto.cs index b167e4d..4116624 100644 --- a/src/Shentun.Peis.Application.Contracts/ItemTypes/CreateItemTypeDto.cs +++ b/src/Shentun.Peis.Application.Contracts/ItemTypes/CreateItemTypeDto.cs @@ -39,5 +39,10 @@ namespace Shentun.Peis.ItemTypes /// public char IsWrap { get; set; } + /// + /// 是否支持检查申请 + /// + public char IsCheckRequest { get; set; } + } } diff --git a/src/Shentun.Peis.Application.Contracts/ItemTypes/ItemTypeDto.cs b/src/Shentun.Peis.Application.Contracts/ItemTypes/ItemTypeDto.cs index 4c5d700..9315db7 100644 --- a/src/Shentun.Peis.Application.Contracts/ItemTypes/ItemTypeDto.cs +++ b/src/Shentun.Peis.Application.Contracts/ItemTypes/ItemTypeDto.cs @@ -42,5 +42,11 @@ namespace Shentun.Peis.ItemTypes /// 项目结果行模式 (Y 可以换行 N 不可换行 ) /// public char IsWrap { get; set; } + + + /// + /// 是否支持检查申请 + /// + public char IsCheckRequest { get; set; } } } \ No newline at end of file diff --git a/src/Shentun.Peis.Application.Contracts/ItemTypes/UpdateItemTypeDto.cs b/src/Shentun.Peis.Application.Contracts/ItemTypes/UpdateItemTypeDto.cs index 37617f4..85b5f6c 100644 --- a/src/Shentun.Peis.Application.Contracts/ItemTypes/UpdateItemTypeDto.cs +++ b/src/Shentun.Peis.Application.Contracts/ItemTypes/UpdateItemTypeDto.cs @@ -35,5 +35,10 @@ namespace Shentun.Peis.ItemTypes /// public char IsWrap { get; set; } + /// + /// 是否支持检查申请 + /// + public char IsCheckRequest { get; set; } + } } \ No newline at end of file diff --git a/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs b/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs index d281da3..7d1f5e5 100644 --- a/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs +++ b/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs @@ -50,43 +50,41 @@ namespace Shentun.Peis.DataMigrations private readonly SqlSugarClient Db = new SqlSugarClient(new ConnectionConfig() { - // ConnectionString = "Data Source=.;Initial Catalog=mypeis;User ID=sa;Password=123;Encrypt=false;", - ConnectionString = "server=.;uid=sa;pwd=123;database=mypeis0501;Encrypt=false;", + ConnectionString = "server=.;uid=sa;pwd=123;database=mypeis;Encrypt=false;", DbType = SqlSugar.DbType.SqlServer, IsAutoCloseConnection = true }); - private readonly SqlSugarClient PgDb = new SqlSugarClient(new ConnectionConfig() - { - ConnectionString = "Host=140.143.162.39;Port=5432;Database=ShentunPeis070703;User ID=postgres;Password=shentun123;", - DbType = SqlSugar.DbType.PostgreSQL, - IsAutoCloseConnection = true - }); + //private readonly SqlSugarClient PgDb = new SqlSugarClient(new ConnectionConfig() + //{ + // ConnectionString = "Host=140.143.162.39;Port=5432;Database=ShentunPeis070703;User ID=postgres;Password=shentun123;", + // DbType = SqlSugar.DbType.PostgreSQL, + // IsAutoCloseConnection = true + //}); //修改时间用 private readonly SqlSugarClient PgNWDb = new SqlSugarClient(new ConnectionConfig() { - ConnectionString = "Host=10.1.12.140;Port=5432;Database=ShentunPeis0503;User ID=postgres;Password=st123;", + ConnectionString = "Host=10.1.12.140;Port=5432;Database=ShentunPeis0508;User ID=postgres;Password=st123;", DbType = SqlSugar.DbType.PostgreSQL, IsAutoCloseConnection = true }); - ////默认指引类别ID - //private readonly Guid defaultGuidTypeId = Guid.Parse("3a120284-df18-7b36-4b12-0423a7d5c1c6"); - ////默认体检报告类别ID - //private readonly Guid defaultMedicalReportTypeId = Guid.Parse("3a120285-65dd-e7da-c923-6b503ab9e1d9"); + //默认指引类别ID private readonly char defaultGuidTypeId = '0'; //默认体检报告类别ID private readonly char defaultMedicalReportTypeId = '0'; //默认体检中心 private readonly Guid defaultMedicalCenterId = Guid.Parse("0de5b78a-731d-4f80-b262-655ebbf04581"); + //默认体检结论类别 private readonly string defaultMedicalConclusionType = "01"; - private readonly Guid defaultSampleContainerId = Guid.Parse("3a1230dc-90fc-1bbc-dbd4-da9de6f2a67d"); + //默认容器ID + private readonly Guid defaultSampleContainerId = Guid.Parse("3a126a07-eb42-a369-99e4-114a2629d714"); //默认单位性质ID - private readonly Guid defaultOrgTypeId = Guid.Parse("3a11fe4e-7dd3-b379-43b9-5be586097abe"); + private readonly Guid defaultOrgTypeId = Guid.Parse("3a126a08-9607-fe40-e5da-6daa01712468"); private readonly IRepository _deviceTypeRepository; private readonly IRepository _itemTypeRepository; @@ -140,6 +138,7 @@ namespace Shentun.Peis.DataMigrations private readonly IRepository _sysParmRepository; private readonly IRepository _sysParmValueRepository; private readonly IRepository _collectItemTypeRepository; + private readonly IRepository _patientRegisterExterRepository; private Dictionary veryPatientNo = new Dictionary(); @@ -195,7 +194,8 @@ namespace Shentun.Peis.DataMigrations IRepository sysParmTypeRepository, IRepository sysParmRepository, IRepository sysParmValueRepository, - IRepository collectItemTypeRepository) + IRepository collectItemTypeRepository, + IRepository patientRegisterExterRepository) { _deviceTypeRepository = deviceTypeRepository; _itemTypeRepository = itemTypeRepository; @@ -249,6 +249,7 @@ namespace Shentun.Peis.DataMigrations _sysParmRepository = sysParmRepository; _sysParmValueRepository = sysParmValueRepository; _collectItemTypeRepository = collectItemTypeRepository; + _patientRegisterExterRepository = patientRegisterExterRepository; } @@ -870,7 +871,7 @@ namespace Shentun.Peis.DataMigrations if (count == 0) { - var oldItemList = await Db.Ado.GetDataTableAsync("select * from item "); + var oldItemList = await Db.Ado.GetDataTableAsync("select a.* from item as a left join department as b on a.department_id=b.department_id order by b.display_order,a.display_order"); if (oldItemList.Rows.Count > 0) { @@ -980,6 +981,7 @@ namespace Shentun.Peis.DataMigrations AgeUpperLimit = 200, CriticalRangeValue = "", ItemId = itemId, + ForSexId = ForSexFlag.All, LowerDiagnosisId = null, ReferenceRangeTypeFlag = ItemReferenceRangeTypeFlag.Character, UpperDiagnosisId = null, @@ -1028,7 +1030,7 @@ namespace Shentun.Peis.DataMigrations if (count == 0) { - var oldAsbitemList = await Db.Ado.GetDataTableAsync("select * from asbitem "); + var oldAsbitemList = await Db.Ado.GetDataTableAsync("select a.* from asbitem as a left join department as b on a.department_id=b.department_id order by b.display_order,a.display_order "); if (oldAsbitemList.Rows.Count > 0) { foreach (DataRow row in oldAsbitemList.Rows) @@ -1204,7 +1206,7 @@ namespace Shentun.Peis.DataMigrations if (count == 0) { - var oldMedicalPackageList = await Db.Ado.GetDataTableAsync("select * from medical_package "); + var oldMedicalPackageList = await Db.Ado.GetDataTableAsync("select * from medical_package order by display_order"); if (oldMedicalPackageList.Rows.Count > 0) { foreach (DataRow row in oldMedicalPackageList.Rows) @@ -1309,7 +1311,7 @@ namespace Shentun.Peis.DataMigrations if (count == 0) { - var oldDiagnosisList = await Db.Ado.GetDataTableAsync("select * from diagnosis "); + var oldDiagnosisList = await Db.Ado.GetDataTableAsync("select a.* from diagnosis as a left join department as b on a.department_id=b.department_id order by b.display_order,a.display_order "); if (oldDiagnosisList.Rows.Count > 0) { foreach (DataRow row in oldDiagnosisList.Rows) @@ -1427,7 +1429,7 @@ namespace Shentun.Peis.DataMigrations if (count == 0) { - var oldSuggestionList = await Db.Ado.GetDataTableAsync("select * from suggestion "); + var oldSuggestionList = await Db.Ado.GetDataTableAsync("select * from suggestion order by display_order,suggestion_id "); if (oldSuggestionList.Rows.Count > 0) { @@ -1483,7 +1485,7 @@ namespace Shentun.Peis.DataMigrations var count = await _itemResultTemplateRepository.GetCountAsync(); if (count == 0) { - var oldItemResultTemplateList = await Db.Ado.GetDataTableAsync("select * from item_result_template "); + var oldItemResultTemplateList = await Db.Ado.GetDataTableAsync("select * from item_result_template order by display_order,item_result_template_id "); if (oldItemResultTemplateList.Rows.Count > 0) { foreach (DataRow row in oldItemResultTemplateList.Rows) @@ -1552,7 +1554,7 @@ namespace Shentun.Peis.DataMigrations var count = await _ItemResultMatchRepository.GetCountAsync(); if (count == 0) { - var oldItemResultMatchList = await Db.Ado.GetDataTableAsync("select * from item_result_match "); + var oldItemResultMatchList = await Db.Ado.GetDataTableAsync("select * from item_result_match order by display_order,item_result_match_id "); if (oldItemResultMatchList.Rows.Count > 0) { foreach (DataRow row in oldItemResultMatchList.Rows) @@ -1620,7 +1622,7 @@ namespace Shentun.Peis.DataMigrations if (count == 0) { - var oldReferenceRangeList = await Db.Ado.GetDataTableAsync("select * from reference_range "); + var oldReferenceRangeList = await Db.Ado.GetDataTableAsync("select * from reference_range order by reference_range_id "); if (oldReferenceRangeList.Rows.Count > 0) { foreach (DataRow row in oldReferenceRangeList.Rows) @@ -1694,7 +1696,7 @@ namespace Shentun.Peis.DataMigrations } if (defaultSampleTypeId != Guid.Empty) { - var oldSampleGroupList = await Db.Ado.GetDataTableAsync("select * from vessels_type order by display_order asc"); + var oldSampleGroupList = await Db.Ado.GetDataTableAsync("select * from vessels_type order by display_order"); if (oldSampleGroupList.Rows.Count > 0) { foreach (DataRow row in oldSampleGroupList.Rows) @@ -2096,7 +2098,7 @@ namespace Shentun.Peis.DataMigrations var count = await _customerOrgRegisterRepository.GetCountAsync(); if (count == 0) { - var oldCustomerOrgRegisterList = await Db.Ado.GetDataTableAsync("select * from org_medical_register"); + var oldCustomerOrgRegisterList = await Db.Ado.GetDataTableAsync("select * from org_medical_register order by org_medical_times"); if (oldCustomerOrgRegisterList.Rows.Count > 0) { List fieldComparisonList = await _fieldComparisonRepository.GetListAsync(m => m.TableName == "customer_org"); @@ -2507,6 +2509,31 @@ namespace Shentun.Peis.DataMigrations await _patientRegisterRepository.InsertAsync(data); + + #region 人员登记扩展 + + var patientRegisterExterData = new PatientRegisterExter + { + IsQztlImport = Convert.ToChar(row["is_qztl_import"].ToString()), + PatientRegisterId = patientRegisterId, + Planuserid = row["planuserid"].ToString(), + QztlIsCw = Convert.ToChar(row["qztl_is_cw"].ToString()), + QztlIsCy = Convert.ToChar(row["qztl_is_cy"].ToString()), + QztlIsFj = Convert.ToChar(row["qztl_is_fj"].ToString()), + QztlIsGt = Convert.ToChar(row["qztl_is_gt"].ToString()), + QztlIsMain = Convert.ToChar(row["qztl_is_main"].ToString()), + QztlIsWh = Convert.ToChar(row["qztl_is_wh"].ToString()), + QztlType = string.IsNullOrEmpty(row["qztl_type"].ToString()) ? null : Convert.ToChar(row["qztl_type"].ToString()), + Remark2 = row["remark2"].ToString(), + Remark3 = row["remark3"].ToString(), + Remark4 = row["remark4"].ToString(), + UploadQztlFlag = Convert.ToChar(row["upload_qztl_flag"].ToString()) + }; + + await _patientRegisterExterRepository.InsertAsync(patientRegisterExterData); + + #endregion + var fieldComparison = new FieldComparison { FieldName = "id", @@ -2538,9 +2565,6 @@ namespace Shentun.Peis.DataMigrations - - - /// /// 迁移检查单 组合项目 查询register_asbitem /// diff --git a/src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs b/src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs index b98ed3d..9e47b6c 100644 --- a/src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs +++ b/src/Shentun.Peis.Application/Diagnosises/DiagnosisAppService.cs @@ -38,16 +38,19 @@ namespace Shentun.Peis.Diagnosises private readonly IRepository _suggestionRepository; private readonly IRepository _userRepository; private readonly DiagnosisManager _manager; + private readonly CacheService _cacheService; public DiagnosisAppService( IRepository repository, IRepository suggestionRepository, IRepository userRepository, - DiagnosisManager manager) + DiagnosisManager manager, + CacheService cacheService) : base(repository) { this._suggestionRepository = suggestionRepository; this._userRepository = userRepository; _manager = manager; + _cacheService = cacheService; } /// /// 获取通过主键 @@ -192,6 +195,25 @@ namespace Shentun.Peis.Diagnosises } + /// + /// 获取诊断列表 + /// + /// + [HttpPost("api/app/Diagnosis/GetSimpleList")] + public async Task> GetSimpleListAsync() + { + var diagnosisList = await Repository.GetListAsync(); + var entlist = diagnosisList.Select(s => new SimpleDiagnosisDto + { + + DisplayName = s.DisplayName, + Id = s.Id, + SimpleCode = s.SimpleCode + }).ToList(); + + return entlist; + } + /// /// 获取诊断列表,加诊断建议 @@ -217,8 +239,8 @@ namespace Shentun.Peis.Diagnosises a.IsSummaryTemplate, a.DisplayOrder }, - ab - }; + ab + }; var entlist = query.GroupBy(g => g.a.Id).Select(s => new SimpleDiagnosisWithSuggestionsDto { diff --git a/src/Shentun.Peis.Application/ItemResultTemplates/ItemResultTemplateAppService.cs b/src/Shentun.Peis.Application/ItemResultTemplates/ItemResultTemplateAppService.cs index b84b844..f41e68f 100644 --- a/src/Shentun.Peis.Application/ItemResultTemplates/ItemResultTemplateAppService.cs +++ b/src/Shentun.Peis.Application/ItemResultTemplates/ItemResultTemplateAppService.cs @@ -115,7 +115,7 @@ namespace Shentun.Peis.ItemResultTemplates { var entlist = await Repository.GetQueryableAsync(); - + var entdto = entlist.Select(s => new ItemResultTemplateDto { @@ -169,8 +169,8 @@ namespace Shentun.Peis.ItemResultTemplates IsResultIntoSummary = s.IsResultIntoSummary, DisplayOrder = s.DisplayOrder, IsNameIntoSummary = s.IsNameIntoSummary, - CreatorName = EntityHelper.GetSurnameNoSql(userList, s.CreatorId), - LastModifierName = EntityHelper.GetSurnameNoSql(userList, s.LastModifierId) + CreatorName = _cacheService.GetSurnameAsync(s.CreatorId).Result, + LastModifierName = _cacheService.GetSurnameAsync(s.LastModifierId).Result }).ToList(); return entdto; diff --git a/src/Shentun.Peis.Domain/ItemTypes/ItemType.cs b/src/Shentun.Peis.Domain/ItemTypes/ItemType.cs index eba3a83..c5cff39 100644 --- a/src/Shentun.Peis.Domain/ItemTypes/ItemType.cs +++ b/src/Shentun.Peis.Domain/ItemTypes/ItemType.cs @@ -92,6 +92,9 @@ namespace Shentun.Peis.Models [Column("is_wrap")] public char IsWrap { get; set; } + /// + /// 是否支持检查申请 + /// [Column("is_check_request")] public char IsCheckRequest { get; set; } diff --git a/src/Shentun.Peis.Domain/ItemTypes/ItemTypeManager.cs b/src/Shentun.Peis.Domain/ItemTypes/ItemTypeManager.cs index eceebb6..9e29c3e 100644 --- a/src/Shentun.Peis.Domain/ItemTypes/ItemTypeManager.cs +++ b/src/Shentun.Peis.Domain/ItemTypes/ItemTypeManager.cs @@ -61,7 +61,8 @@ namespace Shentun.Peis.ItemTypes MedicalReportTypeId = entity.MedicalReportTypeId, ParentId = entity.ParentId, PathCode = await CreatePathCode(entity.ParentId), - IsWrap = entity.IsWrap + IsWrap = entity.IsWrap, + IsCheckRequest = entity.IsCheckRequest }; } /// @@ -87,6 +88,7 @@ namespace Shentun.Peis.ItemTypes targetEntity.IsMergeAsbitem = sourceEntity.IsMergeAsbitem; targetEntity.MedicalReportTypeId = sourceEntity.MedicalReportTypeId; targetEntity.IsWrap = sourceEntity.IsWrap; + targetEntity.IsCheckRequest = sourceEntity.IsCheckRequest; if (!string.IsNullOrEmpty(sourceEntity.PathCode) && sourceEntity.PathCode != targetEntity.PathCode) { throw new ArgumentException($"路径编码不支持修改"); @@ -113,6 +115,7 @@ namespace Shentun.Peis.ItemTypes } DataHelper.CheckCharIsYOrN(entity.IsMergeAsbitem, "是否合并组合项目"); DataHelper.CheckCharIsYOrN(entity.IsWrap, "项目结果行模式"); + DataHelper.CheckCharIsYOrN(entity.IsCheckRequest, "是否支持检查申请"); } diff --git a/src/Shentun.Peis.Domain/PrintReports/PatientRegisterGuideReportDto.cs b/src/Shentun.Peis.Domain/PrintReports/PatientRegisterGuideReportDto.cs index 6687622..8722a04 100644 --- a/src/Shentun.Peis.Domain/PrintReports/PatientRegisterGuideReportDto.cs +++ b/src/Shentun.Peis.Domain/PrintReports/PatientRegisterGuideReportDto.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; @@ -116,6 +117,12 @@ namespace Shentun.Peis.PrintReports /// public string OrganizationUnitName { get; set; } + + /// + /// HisID + /// + public string HisPatientId { get; set; } = null!; + #region 底部系统配置参数 /// diff --git a/src/Shentun.Peis.EntityFrameworkCore/PrintReports/PatientRegisterGuideReportRepository.cs b/src/Shentun.Peis.EntityFrameworkCore/PrintReports/PatientRegisterGuideReportRepository.cs index 3513d84..e94be0f 100644 --- a/src/Shentun.Peis.EntityFrameworkCore/PrintReports/PatientRegisterGuideReportRepository.cs +++ b/src/Shentun.Peis.EntityFrameworkCore/PrintReports/PatientRegisterGuideReportRepository.cs @@ -69,7 +69,7 @@ namespace Shentun.Peis.PrintReports var dbContext = await GetDbContextAsync(); - var customerOrgList =await _customerOrgRepository.GetListAsync(); + var customerOrgList = await _customerOrgRepository.GetListAsync(); var query = from a in dbContext.PatientRegisters join b in dbContext.Sexes on a.SexId equals b.Id @@ -88,9 +88,9 @@ namespace Shentun.Peis.PrintReports Age = a.Age, PatientRegisterId = a.Id, CustomerOrgGroupName = ac.DisplayName, - CustomerOrgName = EntityHelper.GetCustomerOrgParentNameNoSql(customerOrgList,a.CustomerOrgId), - CustomerOrgShortName = EntityHelper.GetCustomerOrgParentShortNameNoSql(customerOrgList,a.CustomerOrgId), - DepartmentName = EntityHelper.GetCustomerOrgNameNoSql(customerOrgList,a.CustomerOrgId), + CustomerOrgName = EntityHelper.GetCustomerOrgParentNameNoSql(customerOrgList, a.CustomerOrgId), + CustomerOrgShortName = EntityHelper.GetCustomerOrgParentShortNameNoSql(customerOrgList, a.CustomerOrgId), + DepartmentName = EntityHelper.GetCustomerOrgNameNoSql(customerOrgList, a.CustomerOrgId), IdNo = e.IdNo, JobCardNo = a.JobCardNo, MedicalCardNo = a.MedicalCardNo, @@ -173,8 +173,8 @@ namespace Shentun.Peis.PrintReports MedicalStartDate = Convert.ToDateTime(a.MedicalStartDate.ToString()).ToString("yyyy-MM-dd"), OrganizationUnitId = a.MedicalCenterId, OrganizationUnitName = ag.DisplayName, - Detail = PatientRegisterGuideAsbitem(a.Id, OrOrganizationUnitId, a.SexId) - + Detail = PatientRegisterGuideAsbitem(a.Id, OrOrganizationUnitId, a.SexId), + HisPatientId = a.HisPatientId }; return query.FirstOrDefault();