diff --git a/src/Shentun.ColumnReferencePlugIns/WebAppointPlugInsBase.cs b/src/Shentun.ColumnReferencePlugIns/WebAppointPlugInsBase.cs index 5615ebc..38df6af 100644 --- a/src/Shentun.ColumnReferencePlugIns/WebAppointPlugInsBase.cs +++ b/src/Shentun.ColumnReferencePlugIns/WebAppointPlugInsBase.cs @@ -1,6 +1,7 @@ using Microsoft.Extensions.Configuration; using Npgsql; using Shentun.Peis.AppointPatientRegisters; +using Shentun.Peis.AppointRegisterAsbitems; using System; using System.Collections.Generic; using System.Data.Common; @@ -17,25 +18,16 @@ namespace Shentun.Peis.PlugIns } - public virtual async Task> GetListByFilterAsync(AppointPatientRegisterPlugInsInputDto input) + public virtual async Task> GetAppointPatientRegisterListByFilterAsync(AppointPatientRegisterPlugInsInputDto input) { - //_thirdInterfaceRepository - return new List(); + throw new NotImplementedException(); } - public Guid GetMedicalCenterId() + public virtual async Task> GetAppointRegisterAsbitemListByIdAsync(AppointPatientRegisterIdInputDto input) { - var configurationBuilder = new ConfigurationBuilder() - .AddJsonStream(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(_thirdInterfaceDto.ParmValue))); - InterfaceConfig = configurationBuilder.Build(); + throw new NotImplementedException(); - var medicalCenterIdStr = InterfaceConfig.GetSection("Interface").GetSection("MedicalCenterId").Value; - if(!Guid.TryParse(medicalCenterIdStr ,out var medicalCenterId)) - { - throw new Exception("体检中心ID格式不正确"); - } - return medicalCenterId; } } } diff --git a/src/Shentun.ColumnReferencePlugIns/WebAppointWebPeisPlugIns.cs b/src/Shentun.ColumnReferencePlugIns/WebAppointWebPeisPlugIns.cs index d4fd9c2..637bdc6 100644 --- a/src/Shentun.ColumnReferencePlugIns/WebAppointWebPeisPlugIns.cs +++ b/src/Shentun.ColumnReferencePlugIns/WebAppointWebPeisPlugIns.cs @@ -4,6 +4,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Linq; using Shentun.Peis.AppointPatientRegisters; +using Shentun.Peis.AppointRegisterAsbitems; using System; using System.Collections.Generic; using System.IdentityModel.Tokens.Jwt; @@ -20,21 +21,30 @@ namespace Shentun.Peis.PlugIns private string _webPeisPassword; private string _webPeisBaseAddress; private string _webPeisToken; - private string _webPeisGetListByFilterUrl; + private string _webPeisGetAppointPatientRegisterListByFilterUrl; + private string _webPeisGetAppointRegisterAsbitemListByIdUrl; + private Guid _medicalCenterId; public WebAppointWebPeisPlugIns(Guid thirdInterfaceId) : base(thirdInterfaceId) { var configurationBuilder = new ConfigurationBuilder() .AddJsonStream(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(_thirdInterfaceDto.ParmValue))); InterfaceConfig = configurationBuilder.Build(); + var medicalCenterIdStr = InterfaceConfig.GetSection("Interface").GetSection("MedicalCenterId").Value; + if (!Guid.TryParse(medicalCenterIdStr, out _medicalCenterId)) + { + throw new Exception("体检中心ID格式不正确"); + } _webPeisUser = InterfaceConfig.GetSection("Interface").GetSection("User").Value; _webPeisPassword = InterfaceConfig.GetSection("Interface").GetSection("Password").Value; - _webPeisGetListByFilterUrl = InterfaceConfig.GetSection("Interface").GetSection("GetListByFilterUrl").Value; + _webPeisBaseAddress = InterfaceConfig.GetSection("Interface").GetSection("BaseAddress").Value; + _webPeisGetAppointPatientRegisterListByFilterUrl = InterfaceConfig.GetSection("Interface").GetSection("GetAppointPatientRegisterListByFilterUrl").Value; + _webPeisGetAppointRegisterAsbitemListByIdUrl = InterfaceConfig.GetSection("Interface").GetSection("GetAppointRegisterAsbitemListByIdUrl").Value; } - public override async Task> GetListByFilterAsync(AppointPatientRegisterPlugInsInputDto input) + public override async Task> GetAppointPatientRegisterListByFilterAsync(AppointPatientRegisterPlugInsInputDto input) { - var medicalCenterId = GetMedicalCenterId(); + var medicalCenterId = _medicalCenterId; var webAppointPatientRegisterInput = new WebAppointPatientRegisterInput() { MedicalCenterId = medicalCenterId, @@ -43,12 +53,20 @@ namespace Shentun.Peis.PlugIns AppointStartDate = input.AppointStartDate, AppointStopDate = input.AppointStopDate, }; - var appointPatientRegisterDtos = await CallWePeisAppServiceAsync>(_webPeisGetListByFilterUrl, + var appointPatientRegisterDtos = await CallWePeisAppServiceAsync>(_webPeisGetAppointPatientRegisterListByFilterUrl, webAppointPatientRegisterInput); return appointPatientRegisterDtos; } - public async virtual Task LoginWebPeisAsync() + + public override async Task> GetAppointRegisterAsbitemListByIdAsync(AppointPatientRegisterIdInputDto input) + { + var appointRegisterAsbitemDtos = await CallWePeisAppServiceAsync> + (_webPeisGetAppointRegisterAsbitemListByIdUrl, input); + return appointRegisterAsbitemDtos; + } + public async virtual Task> LoginWebPeisAsync() { if (string.IsNullOrWhiteSpace(_webPeisUser)) { @@ -58,11 +76,11 @@ namespace Shentun.Peis.PlugIns { throw new Exception("WebPeisPassword不能为空"); } - var relult = await LoginAsync(_webPeisUser, _webPeisPassword); + var relult = await LoginWebPeisAsync(_webPeisUser, _webPeisPassword); return relult; } - public async Task LoginWebPeisAsync(string userId, string password) + public async Task> LoginWebPeisAsync(string userId, string password) { if (string.IsNullOrWhiteSpace(userId)) { @@ -98,12 +116,12 @@ namespace Shentun.Peis.PlugIns throw new Exception("http通信错误:" + response.StatusCode + ",结果:" + result); } result = await response.Content.ReadAsStringAsync(); - var restultDto = JsonConvert.DeserializeObject(result); + var restultDto = JsonConvert.DeserializeObject>(result); if (restultDto == null) { throw new Exception("返回结果是空"); } - if (restultDto.Code != "1") + if (restultDto.Code != 1) { throw new Exception($"登录失败{restultDto.Message}"); } @@ -118,10 +136,10 @@ namespace Shentun.Peis.PlugIns public async Task CallWePeisAppServiceAsync(string url, TInput data, string method = "post") { - if (string.IsNullOrWhiteSpace(_webPeisBaseAddress)) - { - throw new Exception("_webPeisBaseAddress不能为空"); - } + //if (string.IsNullOrWhiteSpace(_webPeisBaseAddress)) + //{ + // throw new Exception("_webPeisBaseAddress不能为空"); + //} string baseAddress = _webPeisBaseAddress; await CheckWebPeisLoginAsync(); using (var httpClientHandler = new HttpClientHandler()) @@ -202,7 +220,7 @@ namespace Shentun.Peis.PlugIns } else { - await LoginAsync(); + await LoginWebPeisAsync(); } } diff --git a/src/Shentun.Peis.Application.Contracts/AppointPatientRegisters/AppointPatientRegisterDto.cs b/src/Shentun.Peis.Application.Contracts/AppointPatientRegisters/AppointPatientRegisterDto.cs index a810565..405fedd 100644 --- a/src/Shentun.Peis.Application.Contracts/AppointPatientRegisters/AppointPatientRegisterDto.cs +++ b/src/Shentun.Peis.Application.Contracts/AppointPatientRegisters/AppointPatientRegisterDto.cs @@ -13,12 +13,12 @@ namespace Shentun.Peis.AppointPatientRegisters /// /// 预约登记ID /// - public Guid AppointPatientRegisterId { get; set; } + public string AppointPatientRegisterId { get; set; } /// /// 人员ID /// - public Guid PersonId { get; set; } + public string PersonId { get; set; } /// /// 姓名 /// diff --git a/src/Shentun.Peis.Application.Contracts/AppointPatientRegisters/AppointPatientRegisterIdInputDto.cs b/src/Shentun.Peis.Application.Contracts/AppointPatientRegisters/AppointPatientRegisterIdInputDto.cs new file mode 100644 index 0000000..e0e6c41 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/AppointPatientRegisters/AppointPatientRegisterIdInputDto.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Shentun.Peis.PlugIns +{ + public class AppointPatientRegisterIdInputDto + { + public string AppointPatientRegisterId { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/AppointRegisterAsbitems/AppointRegisterAsbitemDto.cs b/src/Shentun.Peis.Application.Contracts/AppointRegisterAsbitems/AppointRegisterAsbitemDto.cs new file mode 100644 index 0000000..b5d5134 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/AppointRegisterAsbitems/AppointRegisterAsbitemDto.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.AppointRegisterAsbitems +{ + public class AppointRegisterAsbitemDto + { + /// + /// 主键 + /// + public string AppointRegisterAsbitemId { get; set; } + /// + /// 组合项目ID + /// + public Guid AsbitemId { get; set; } + /// + /// 组合项目名称 + /// + public string AsbitemName { get; set; } + /// + /// 项目类别ID + /// + public string ItemTypeId { get; set; } + /// + /// 项目类别名称 + /// + public string ItemTypeName { get; set; } + /// + /// 预约主档ID + /// + public string AppointPatientRegisterId { get; set; } + /// + /// 标准价格 + /// + public decimal StandardPrice { get; set; } + /// + /// 收费价格 + /// + public decimal ChargePrice { get; set; } + /// + /// 支付类别标准 + /// + public char PayTypeFlag { get; set; } + /// + /// 是否收费 + /// + public char IsCharge { get; set; } + /// + /// 数量 + /// + public short Amount { get; set; } + + public char IsInMedicalPackage { get; set; } = 'N'; + /// + /// 项目类别顺序 + /// + + public int ItemTypeDisplayOrder { get; set; } + + public int DisplayOrder { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/ThirdInterfaces/ThirdInterfaceTypeInputDto.cs b/src/Shentun.Peis.Application.Contracts/ThirdInterfaces/ThirdInterfaceTypeInputDto.cs new file mode 100644 index 0000000..771c755 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/ThirdInterfaces/ThirdInterfaceTypeInputDto.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.ThirdInterfaces +{ + public class ThirdInterfaceTypeInputDto + { + public string ThirdInterfaceType { get; set; } + } +} diff --git a/src/Shentun.Peis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs b/src/Shentun.Peis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs index 714f9e9..9f05a52 100644 --- a/src/Shentun.Peis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs +++ b/src/Shentun.Peis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs @@ -1,11 +1,18 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; +using NUglify.JavaScript.Syntax; +using Shentun.Peis.Enums; using Shentun.Peis.Models; +using Shentun.Peis.PlugIns; using System; using System.Collections.Generic; +using System.IO; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; +using Volo.Abp; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Repositories; @@ -15,16 +22,44 @@ namespace Shentun.Peis.AppointPatientRegisters [Authorize] public class AppointPatientRegisterAppService : ApplicationService { - private readonly IRepository _thirdInterfaceRepository; + private readonly IRepository _thirdInterfaceRepository; - public AppointPatientRegisterAppService(IRepository thirdInterfaceRepository) + public AppointPatientRegisterAppService(IRepository thirdInterfaceRepository) { _thirdInterfaceRepository = thirdInterfaceRepository; } + /// + /// 获取网上预约数据 + /// + /// + /// + /// public async Task> GetListByFilterAsync(AppointPatientRegisterInputDto input) { - //_thirdInterfaceRepository - return new List(); + var thirdInterface = await _thirdInterfaceRepository.GetAsync(input.ThirdInterFaceId); + if(thirdInterface.IsActive != 'Y') + { + throw new UserFriendlyException("该接口已禁用"); + } + + var appointPatientRegisterPlugInsInputDto = new AppointPatientRegisterPlugInsInputDto() + { + IdNo = input.IdNo, + MobilePhone = input.MobilePhone, + AppointStartDate = input.AppointStartDate, + AppointStopDate = input.AppointStopDate + }; + object[] objects = [appointPatientRegisterPlugInsInputDto]; + var parmValue = thirdInterface.ParmValue; + var configurationBuilder = new ConfigurationBuilder() + .AddJsonStream(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(parmValue))); + var config = configurationBuilder.Build(); + var assemblyName = config.GetSection("Interface").GetSection("AssemblyName").Value; + var className = config.GetSection("Interface").GetSection("ClassName").Value; + + var pluginsOut = await Utilities.ReflectionHelper.InvokeAsync>(assemblyName, + className, [thirdInterface.Id], "GetListByFilterAsync", objects); + return pluginsOut; } } diff --git a/src/Shentun.Peis.Application/ThirdInterfaces/ThirdInterfaceAppService.cs b/src/Shentun.Peis.Application/ThirdInterfaces/ThirdInterfaceAppService.cs index 0731fbf..e8907dc 100644 --- a/src/Shentun.Peis.Application/ThirdInterfaces/ThirdInterfaceAppService.cs +++ b/src/Shentun.Peis.Application/ThirdInterfaces/ThirdInterfaceAppService.cs @@ -63,6 +63,33 @@ namespace Shentun.Peis.ThirdInterfaces }).OrderBy(o => o.DisplayOrder).ToList(); } + /// + /// 获取第三方接口类型 + /// + /// + /// + [HttpPost("api/app/ThirdInterface/GetListByThirdInterfaceTypeAsync")] + public async Task> GetListByThirdInterfaceTypeAsync(ThirdInterfaceTypeInputDto input) + { + var thirdInterfaceList = (await _thirdInterfaceRepository.GetQueryableAsync() + ).Where(o=>o.ThirdInterfaceType == input.ThirdInterfaceType); + return thirdInterfaceList.Select(s => new ThirdInterfaceDto + { + CreationTime = s.CreationTime, + CreatorId = s.CreatorId, + DisplayName = s.DisplayName, + DisplayOrder = s.DisplayOrder, + Id = s.Id, + IsActive = s.IsActive, + LastModificationTime = s.LastModificationTime, + LastModifierId = s.LastModifierId, + CreatorName = _cacheService.GetSurnameAsync(s.CreatorId).Result, + LastModifierName = _cacheService.GetSurnameAsync(s.LastModifierId).Result, + MedicalCenterId = s.MedicalCenterId, + ParmValue = s.ParmValue, + ThirdInterfaceType = s.ThirdInterfaceType + }).OrderBy(o => o.DisplayOrder).ToList(); + } /// /// 创建 diff --git a/src/Shentun.Peis.Domain/PatientRegisters/PatientRegister.cs b/src/Shentun.Peis.Domain/PatientRegisters/PatientRegister.cs index 17b71bd..7983df1 100644 --- a/src/Shentun.Peis.Domain/PatientRegisters/PatientRegister.cs +++ b/src/Shentun.Peis.Domain/PatientRegisters/PatientRegister.cs @@ -306,7 +306,7 @@ namespace Shentun.Peis.Models /// [Column("appoint_patient_register_id")] - public Guid? AppointPatientRegisterId { get; set; } + public string? AppointPatientRegisterId { get; set; } [Column("concurrency_stamp")] public string ConcurrencyStamp { get; set; } diff --git a/src/Shentun.Peis.Domain/ThirdInterfaces/ThirdInterfaceManager.cs b/src/Shentun.Peis.Domain/ThirdInterfaces/ThirdInterfaceManager.cs index 83f6f80..8d4c63d 100644 --- a/src/Shentun.Peis.Domain/ThirdInterfaces/ThirdInterfaceManager.cs +++ b/src/Shentun.Peis.Domain/ThirdInterfaces/ThirdInterfaceManager.cs @@ -71,8 +71,6 @@ namespace Shentun.Peis.ThirdInterfaces } - - /// /// 删除项目时,同步删除项目结果模板( item_result_template)、参考范围(reference_range)、结果匹配(item_result_match)、组合项目包含的项目(asbitem_detail),项目模板明细(ItemTemplateDetail)。 /// diff --git a/src/Shentun.Peis.EntityFrameworkCore/DbMapping/PatientRegisters/PatientRegisterDbMapping.cs b/src/Shentun.Peis.EntityFrameworkCore/DbMapping/PatientRegisters/PatientRegisterDbMapping.cs index 21ef0fe..07fd5a3 100644 --- a/src/Shentun.Peis.EntityFrameworkCore/DbMapping/PatientRegisters/PatientRegisterDbMapping.cs +++ b/src/Shentun.Peis.EntityFrameworkCore/DbMapping/PatientRegisters/PatientRegisterDbMapping.cs @@ -97,7 +97,7 @@ namespace Shentun.Peis.DbMapping entity.Property(t => t.Remark).HasComment("备注"); entity.Property(t => t.MedicalCenterId).HasComment("体检中心ID").IsRequired(); entity.Property(t => t.CustomerOrgRegisterId).HasComment("客户单位登记ID").HasDefaultValue(Guid.Empty); - entity.Property(t => t.AppointPatientRegisterId).HasComment("预约人员登记ID"); + entity.Property(t => t.AppointPatientRegisterId).HasMaxLength(40).HasComment("预约人员登记ID"); //entity.HasOne(d => d.CustomerOrgRegister) // .WithMany(p => p.PatientRegisters) diff --git a/test/Shentun.Peis.ColumnReference.Tests/WebAppointWebPeisPlugInsTest.cs b/test/Shentun.Peis.ColumnReference.Tests/WebAppointWebPeisPlugInsTest.cs index 4a66a26..72dab7d 100644 --- a/test/Shentun.Peis.ColumnReference.Tests/WebAppointWebPeisPlugInsTest.cs +++ b/test/Shentun.Peis.ColumnReference.Tests/WebAppointWebPeisPlugInsTest.cs @@ -1,4 +1,5 @@ -using System; +using Shentun.Peis.AppointPatientRegisters; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -17,18 +18,34 @@ namespace Shentun.Peis.PlugIns.Tests } [Fact] - public async Task GetListByFilterAsync() + public async Task GetAppointPatientRegisterListByFilterAsync() { var plugIns = new WebAppointWebPeisPlugIns(new Guid("43a9c3a5-8741-4c64-b869-bc304712d88e")); - var items = await plugIns.GetListByFilterAsync(new AppointPatientRegisters.AppointPatientRegisterPlugInsInputDto() + var items = await plugIns.GetAppointPatientRegisterListByFilterAsync(new AppointPatientRegisterPlugInsInputDto() { MobilePhone = "18911254911", AppointStartDate = DateTime.Now.Date.AddDays(-10) }); foreach (var item in items) { - _output.WriteLine(item.PersonName); + _output.WriteLine(item.AppointPatientRegisterId + item.PersonName); + } + + } + + [Fact] + public async Task GetAppointRegisterAsbitemListByIdAsync() + { + + var plugIns = new WebAppointWebPeisPlugIns(new Guid("43a9c3a5-8741-4c64-b869-bc304712d88e")); + var items = await plugIns.GetAppointRegisterAsbitemListByIdAsync(new AppointPatientRegisterIdInputDto() + { + AppointPatientRegisterId = "3a12f181-d6d5-c539-1517-29f4714c7495" + }); + foreach (var item in items) + { + _output.WriteLine(item.AppointRegisterAsbitemId + item.AsbitemName); } }