Browse Source

预约

bjmzak
DESKTOP-G961P6V\Zhh 2 years ago
parent
commit
61dc39925d
  1. 18
      src/Shentun.ColumnReferencePlugIns/WebAppointPlugInsBase.cs
  2. 48
      src/Shentun.ColumnReferencePlugIns/WebAppointWebPeisPlugIns.cs
  3. 4
      src/Shentun.Peis.Application.Contracts/AppointPatientRegisters/AppointPatientRegisterDto.cs
  4. 13
      src/Shentun.Peis.Application.Contracts/AppointPatientRegisters/AppointPatientRegisterIdInputDto.cs
  5. 63
      src/Shentun.Peis.Application.Contracts/AppointRegisterAsbitems/AppointRegisterAsbitemDto.cs
  6. 11
      src/Shentun.Peis.Application.Contracts/ThirdInterfaces/ThirdInterfaceTypeInputDto.cs
  7. 43
      src/Shentun.Peis.Application/AppointPatientRegisters/AppointPatientRegisterAppService.cs
  8. 27
      src/Shentun.Peis.Application/ThirdInterfaces/ThirdInterfaceAppService.cs
  9. 2
      src/Shentun.Peis.Domain/PatientRegisters/PatientRegister.cs
  10. 2
      src/Shentun.Peis.Domain/ThirdInterfaces/ThirdInterfaceManager.cs
  11. 2
      src/Shentun.Peis.EntityFrameworkCore/DbMapping/PatientRegisters/PatientRegisterDbMapping.cs
  12. 25
      test/Shentun.Peis.ColumnReference.Tests/WebAppointWebPeisPlugInsTest.cs

18
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<List<AppointPatientRegisterDto>> GetListByFilterAsync(AppointPatientRegisterPlugInsInputDto input)
public virtual async Task<List<AppointPatientRegisterDto>> GetAppointPatientRegisterListByFilterAsync(AppointPatientRegisterPlugInsInputDto input)
{
//_thirdInterfaceRepository
return new List<AppointPatientRegisterDto>();
throw new NotImplementedException();
}
public Guid GetMedicalCenterId()
public virtual async Task<List<AppointRegisterAsbitemDto>> 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;
}
}
}

48
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<List<AppointPatientRegisterDto>> GetListByFilterAsync(AppointPatientRegisterPlugInsInputDto input)
public override async Task<List<AppointPatientRegisterDto>> 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<WebAppointPatientRegisterInput, List<AppointPatientRegisterDto>>(_webPeisGetListByFilterUrl,
var appointPatientRegisterDtos = await CallWePeisAppServiceAsync<WebAppointPatientRegisterInput, List<AppointPatientRegisterDto>>(_webPeisGetAppointPatientRegisterListByFilterUrl,
webAppointPatientRegisterInput);
return appointPatientRegisterDtos;
}
public async virtual Task<LoginOutDto> LoginWebPeisAsync()
public override async Task<List<AppointRegisterAsbitemDto>> GetAppointRegisterAsbitemListByIdAsync(AppointPatientRegisterIdInputDto input)
{
var appointRegisterAsbitemDtos = await CallWePeisAppServiceAsync<AppointPatientRegisterIdInputDto,
List<AppointRegisterAsbitemDto>>
(_webPeisGetAppointRegisterAsbitemListByIdUrl, input);
return appointRegisterAsbitemDtos;
}
public async virtual Task<WebApiOutDtoExter<LoginOutDataDto>> 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<LoginOutDto> LoginWebPeisAsync(string userId, string password)
public async Task<WebApiOutDtoExter<LoginOutDataDto>> 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<LoginOutDto>(result);
var restultDto = JsonConvert.DeserializeObject<WebApiOutDtoExter<LoginOutDataDto>>(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<TOut> CallWePeisAppServiceAsync<TInput, TOut>(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();
}
}

4
src/Shentun.Peis.Application.Contracts/AppointPatientRegisters/AppointPatientRegisterDto.cs

@ -13,12 +13,12 @@ namespace Shentun.Peis.AppointPatientRegisters
/// <summary>
/// 预约登记ID
/// </summary>
public Guid AppointPatientRegisterId { get; set; }
public string AppointPatientRegisterId { get; set; }
/// <summary>
/// 人员ID
/// </summary>
public Guid PersonId { get; set; }
public string PersonId { get; set; }
/// <summary>
/// 姓名
/// </summary>

13
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; }
}
}

63
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
{
/// <summary>
/// 主键
/// </summary>
public string AppointRegisterAsbitemId { get; set; }
/// <summary>
/// 组合项目ID
/// </summary>
public Guid AsbitemId { get; set; }
/// <summary>
/// 组合项目名称
/// </summary>
public string AsbitemName { get; set; }
/// <summary>
/// 项目类别ID
/// </summary>
public string ItemTypeId { get; set; }
/// <summary>
/// 项目类别名称
/// </summary>
public string ItemTypeName { get; set; }
/// <summary>
/// 预约主档ID
/// </summary>
public string AppointPatientRegisterId { get; set; }
/// <summary>
/// 标准价格
/// </summary>
public decimal StandardPrice { get; set; }
/// <summary>
/// 收费价格
/// </summary>
public decimal ChargePrice { get; set; }
/// <summary>
/// 支付类别标准
/// </summary>
public char PayTypeFlag { get; set; }
/// <summary>
/// 是否收费
/// </summary>
public char IsCharge { get; set; }
/// <summary>
/// 数量
/// </summary>
public short Amount { get; set; }
public char IsInMedicalPackage { get; set; } = 'N';
/// <summary>
/// 项目类别顺序
/// </summary>
public int ItemTypeDisplayOrder { get; set; }
public int DisplayOrder { get; set; }
}
}

11
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; }
}
}

43
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<ThirdInterface> _thirdInterfaceRepository;
private readonly IRepository<ThirdInterface,Guid> _thirdInterfaceRepository;
public AppointPatientRegisterAppService(IRepository<ThirdInterface> thirdInterfaceRepository)
public AppointPatientRegisterAppService(IRepository<ThirdInterface,Guid> thirdInterfaceRepository)
{
_thirdInterfaceRepository = thirdInterfaceRepository;
}
/// <summary>
/// 获取网上预约数据
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
public async Task<List<AppointPatientRegisterDto>> GetListByFilterAsync(AppointPatientRegisterInputDto input)
{
//_thirdInterfaceRepository
return new List<AppointPatientRegisterDto>();
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<List<AppointPatientRegisterDto>>(assemblyName,
className, [thirdInterface.Id], "GetListByFilterAsync", objects);
return pluginsOut;
}
}

27
src/Shentun.Peis.Application/ThirdInterfaces/ThirdInterfaceAppService.cs

@ -63,6 +63,33 @@ namespace Shentun.Peis.ThirdInterfaces
}).OrderBy(o => o.DisplayOrder).ToList();
}
/// <summary>
/// 获取第三方接口类型
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/ThirdInterface/GetListByThirdInterfaceTypeAsync")]
public async Task<List<ThirdInterfaceDto>> 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();
}
/// <summary>
/// 创建

2
src/Shentun.Peis.Domain/PatientRegisters/PatientRegister.cs

@ -306,7 +306,7 @@ namespace Shentun.Peis.Models
/// </summary>
[Column("appoint_patient_register_id")]
public Guid? AppointPatientRegisterId { get; set; }
public string? AppointPatientRegisterId { get; set; }
[Column("concurrency_stamp")]
public string ConcurrencyStamp { get; set; }

2
src/Shentun.Peis.Domain/ThirdInterfaces/ThirdInterfaceManager.cs

@ -71,8 +71,6 @@ namespace Shentun.Peis.ThirdInterfaces
}
/// <summary>
/// 删除项目时,同步删除项目结果模板( item_result_template)、参考范围(reference_range)、结果匹配(item_result_match)、组合项目包含的项目(asbitem_detail),项目模板明细(ItemTemplateDetail)。
/// </summary>

2
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)

25
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);
}
}

Loading…
Cancel
Save