5 Commits

Author SHA1 Message Date
DESKTOP-G961P6V\Zhh 36611787aa Merge branch 'master' of http://140.143.162.39:3000/shentun/peis 2 years ago
DESKTOP-G961P6V\Zhh 9424461a61 同步组合项目 2 years ago
DESKTOP-G961P6V\Zhh 93fac3c7e1 同步组合项目价格 2 years ago
DESKTOP-G961P6V\Zhh 08f9a85007 Merge branch 'master' of http://140.143.162.39:3000/shentun/peis 2 years ago
DESKTOP-G961P6V\Zhh 49b2967752 收费价格同步 2 years ago
  1. 2
      ThirdPlugIns/Shentun.Peis.PlugIns.Gem/ChargeRequests/Hzcy/ChargeRequestPlugInsHzcy.cs
  2. 2
      src/Shentun.ColumnReferencePlugIns/ChargeRequests/ChargeRequestPlugInsBase.cs
  3. 4
      src/Shentun.ColumnReferencePlugIns/ImportLisResults/ImportLisResultPlugInsBase.cs
  4. 4
      src/Shentun.ColumnReferencePlugIns/ImportPacsResults/ImportPacsResultPlugInsBase.cs
  5. 127
      src/Shentun.ColumnReferencePlugIns/SyncAsbitemPrice/AsbitemForSyncAsbitem.cs
  6. 17
      src/Shentun.ColumnReferencePlugIns/SyncAsbitemPrice/AsbitemFromSyncAsbitemInterface.cs
  7. 84
      src/Shentun.ColumnReferencePlugIns/SyncAsbitemPrice/SyncAsbitemPricePlugInsBase.cs
  8. 72
      src/Shentun.ColumnReferencePlugIns/SyncAsbitemPrice/SyncAsbitemPricePlugInsDbBase.cs
  9. 3
      src/Shentun.Peis.Domain.Shared/Enums/ThirdInterfaceTypeFlag.cs
  10. 5
      src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs
  11. 99
      src/Shentun.Peis.HttpApi.Host/Schedulers/SyncAsbitemPriceInterfaceWorker.cs
  12. 2
      test/Shentun.Peis.ColumnReference.Tests/ImportPacsResultPlugInsTest.cs
  13. 48
      test/Shentun.Peis.ColumnReference.Tests/SyncAsbitemPricePlugInsTest.cs

2
ThirdPlugIns/Shentun.Peis.PlugIns.Gem/ChargeRequests/Hzcy/ChargeRequestPlugInsHzcy.cs

@ -247,7 +247,7 @@ namespace Shentun.Peis.PlugIns.Extensions.ChargeRequests.Hzcy
{
days = 1;
}
var chargeRequests = GetRequests(days).Result;
var chargeRequests = GetRequestsAsync(days).Result;
foreach (var chargeRequest in chargeRequests)
{

2
src/Shentun.ColumnReferencePlugIns/ChargeRequests/ChargeRequestPlugInsBase.cs

@ -111,7 +111,7 @@ where patient.id = patient_register.patient_id and
}
}
public async Task<List<ChargeRequestForPlugIns>> GetRequests(int days)
public async Task<List<ChargeRequestForPlugIns>> GetRequestsAsync(int days)
{
using (DbConnection conn = new NpgsqlConnection(AppConnctionStr))
{

4
src/Shentun.ColumnReferencePlugIns/ImportLisResults/ImportLisResultPlugInsBase.cs

@ -53,7 +53,7 @@ namespace Shentun.Peis.PlugIns.ImportLisResults
}
}
public async Task<List<PatientRegisterForLisRequest>> GetRequestPatientRegisters(int days)
public async Task<List<PatientRegisterForLisRequest>> GetRequestPatientRegistersAsync(int days)
{
using (DbConnection conn = new NpgsqlConnection(AppConnctionStr))
{
@ -91,7 +91,7 @@ ORDER BY register_check.patient_register_id
{
days = 1;
}
var patientRegisters = GetRequestPatientRegisters(days).Result;
var patientRegisters = GetRequestPatientRegistersAsync(days).Result;
foreach (var patientRegister in patientRegisters)
{

4
src/Shentun.ColumnReferencePlugIns/ImportPacsResults/ImportPacsResultPlugInsBase.cs

@ -54,7 +54,7 @@ where patient_register.id = @PatientRegisterId and
}
public async Task<List<PatientRegisterForLisRequest>> GetRequestPatientRegisters(int days)
public async Task<List<PatientRegisterForLisRequest>> GetRequestPatientRegistersAsync(int days)
{
using (DbConnection conn = new NpgsqlConnection(AppConnctionStr))
{
@ -95,7 +95,7 @@ ORDER BY register_check.patient_register_id
{
days = 1;
}
var patientRegisters = GetRequestPatientRegisters(days).Result;
var patientRegisters = GetRequestPatientRegistersAsync(days).Result;
foreach (var patientRegister in patientRegisters)
{

127
src/Shentun.ColumnReferencePlugIns/SyncAsbitemPrice/AsbitemForSyncAsbitem.cs

@ -0,0 +1,127 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shentun.Peis.PlugIns.SyncAsbitemPrice
{
public class AsbitemForSyncAsbitem
{
public Guid Id { get; set; }
/// <summary>
/// 名称
/// </summary>
public string DisplayName { get; set; }
/// <summary>
/// 简称
/// </summary>
public string ShortName { get; set; }
/// <summary>
/// 适用性别,M-男,F-女,A-全部
/// </summary>
public char ForSexId { get; set; }
/// <summary>
/// 婚姻状况
/// </summary>
public char MaritalStatusId { get; set; }
/// <summary>
/// 项目类别
/// </summary>
public Guid ItemTypeId { get; set; }
/// <summary>
/// 价格
/// </summary>
public decimal Price { get; set; }
/// <summary>
/// 仪器类别
/// </summary>
public Guid? DeviceTypeId { get; set; }
///// <summary>
///// 发票类别
///// </summary>
//public Guid InvoiceItemTypeId { get; set; }
/// <summary>
/// 项目结果合并
/// </summary>
public char IsItemResultMerger { get; set; }
/// <summary>
/// 餐前项目
/// </summary>
public char IsBeforeEat { get; set; }
/// <summary>
/// 临床意义
/// </summary>
public string ClinicalMeaning { get; set; }
/// <summary>
/// 默认结果
/// </summary>
public string DefaultResult { get; set; }
/// <summary>
/// 候诊时间
/// </summary>
public decimal QueueTime { get; set; }
/// <summary>
/// 启用诊断函数
/// </summary>
public char IsDiagnosisFunction { get; set; }
/// <summary>
/// 诊断函数
/// </summary>
public string DiagnosisFunction { get; set; }
/// <summary>
/// 诊断函数处理完毕后继续处理
/// </summary>
public char IsContinueProcess { get; set; }
/// <summary>
/// 体检报告图片旋转90°
/// </summary>
public char IsPictureRotate { get; set; }
/// <summary>
/// 是检查项目
/// </summary>
public char IsCheck { get; set; }
/// <summary>
/// 是启用
/// </summary>
public char IsActive { get; set; }
public string SimpleCode { get; set; }
public int DisplayOrder { get; set; }
public string ConcurrencyStamp { get; set; }
}
}

17
src/Shentun.ColumnReferencePlugIns/SyncAsbitemPrice/AsbitemFromSyncAsbitemInterface.cs

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shentun.Peis.PlugIns.SyncAsbitemPrice
{
public class AsbitemFromSyncAsbitemInterface
{
public string AsbitemId { get; set; }
public string AsbitemName { get; set; }
public decimal? Price { get; set; }
}
}

84
src/Shentun.ColumnReferencePlugIns/SyncAsbitemPrice/SyncAsbitemPricePlugInsBase.cs

@ -0,0 +1,84 @@
using Dapper;
using Npgsql;
using Shentun.Peis.Asbitems;
using Shentun.Peis.Enums;
using Shentun.Peis.PlugIns.ChargeRequests;
using Shentun.Peis.PlugIns.LisRequests;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shentun.Peis.PlugIns.SyncAsbitemPrice
{
public class SyncAsbitemPricePlugInsBase : ThirdPlugInsBase
{
public SyncAsbitemPricePlugInsBase(Guid thirdInterfaceId) : base(thirdInterfaceId)
{
}
public virtual async Task SyncAsbitemPriceAsync()
{
}
public async Task<List<AsbitemForSyncAsbitem>> GetAsbitemsAsync()
{
using (DbConnection conn = new NpgsqlConnection(AppConnctionStr))
{
string sql;
sql = @" select * from asbitem where is_active = 'Y'
";
var asbitems = (await conn.QueryAsync<AsbitemForSyncAsbitem>(sql
)).ToList();
return asbitems;
}
}
public async Task UpdateAsbitemPriceAsync(AsbitemForSyncAsbitem asbitem)
{
using (DbConnection conn = new NpgsqlConnection(AppConnctionStr))
{
await conn.OpenAsync();
using (var trans = await conn.BeginTransactionAsync())
{
try
{
string sql;
sql = @" update asbitem set price = @Price" +
@" where id = @AsbitemId and concurrency_stamp = @ConcurrencyStamp
";
await conn.ExecuteAsync(sql,
new
{
asbitem.Price,
asbitem.Id,
asbitem.ConcurrencyStamp
}, trans);
await trans.CommitAsync();
}
catch (Exception ex)
{
await trans.RollbackAsync();
throw ex;
}
}
}
}
public override Task DoWork()
{
SyncAsbitemPriceAsync().Wait();
return Task.CompletedTask;
}
}
}

72
src/Shentun.ColumnReferencePlugIns/SyncAsbitemPrice/SyncAsbitemPricePlugInsDbBase.cs

@ -0,0 +1,72 @@
using Dapper;
using Npgsql;
using Org.BouncyCastle.Asn1.Ocsp;
using Shentun.Peis.Asbitems;
using Shentun.Peis.PlugIns.ImportLisResults;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
namespace Shentun.Peis.PlugIns.SyncAsbitemPrice
{
public class SyncAsbitemPricePlugInsDbBase : SyncAsbitemPricePlugInsBase
{
public SyncAsbitemPricePlugInsDbBase(Guid thirdInterfaceId) : base(thirdInterfaceId)
{
}
public override async Task SyncAsbitemPriceAsync()
{
if (AsbitemColumnReferenceId == null || AsbitemColumnReferenceId == Guid.Empty)
{
throw new Exception("没有设置组合项目编码对照");
}
var asbitems = await GetAsbitemsAsync();
using (DbConnection conn = CreateInterfaceDbConnect())
{
foreach (var asbItem in asbitems)
{
var columnReferenceInterfaceCodeValues = await GetColumnReferenceInterfaceCodeValuesAsync(AsbitemColumnReferenceId, asbItem.Id.ToString());
if(columnReferenceInterfaceCodeValues == null || !columnReferenceInterfaceCodeValues.Any())
{
continue;
}
string sql;
sql = InterfaceSql + " where " + InterfaceSqlKeyColumn + " = '" + columnReferenceInterfaceCodeValues[0].InterfaceCodeValue + "'";
var interfaceAsbitems = (await conn.QueryAsync<AsbitemFromSyncAsbitemInterface>(sql)).ToList();
if (interfaceAsbitems == null || !interfaceAsbitems.Any())
{
continue;
}
var interfaceAsbitem = interfaceAsbitems.First();
if(interfaceAsbitem.Price == null || interfaceAsbitem.Price < 0)
{
continue;
}
asbItem.Price = (decimal)interfaceAsbitem.Price;
await UpdateAsbitemPriceAsync(asbItem);
}
}
}
public async Task<List<AsbitemFromSyncAsbitemInterface>> GetInterfaceAsbitems()
{
using (DbConnection conn = CreateInterfaceDbConnect())
{
string sql;
sql = InterfaceSql;
var interfaceAsbitems = (await conn.QueryAsync<AsbitemFromSyncAsbitemInterface>(sql)).ToList();
return interfaceAsbitems;
}
}
}
}

3
src/Shentun.Peis.Domain.Shared/Enums/ThirdInterfaceTypeFlag.cs

@ -32,5 +32,8 @@ namespace Shentun.Peis.Enums
[Description("心电图")]
public const string Electrocardiogram = "08";
[Description("同步组合项目价格")]
public const string SyncAsbitemPrice = "09";
}
}

5
src/Shentun.Peis.HttpApi.Host/PeisHttpApiHostModule.cs

@ -662,6 +662,11 @@ public class PeisHttpApiHostModule : AbpModule
//心电图
RecurringJob.AddOrUpdate<IImportElectrocardiogramResultInterfaceWorker>(thirdInterfaceDto.DisplayName, o => o.DoWork(thirdInterfaceDto.Id), corn, TimeZoneInfo.Local);
}
else if (thirdInterfaceDto.ThirdInterfaceType == "09")
{
//同步组合项目价格
RecurringJob.AddOrUpdate<ISyncAsbitemPriceInterfaceWorker>(thirdInterfaceDto.DisplayName, o => o.DoWork(thirdInterfaceDto.Id), corn, TimeZoneInfo.Local);
}
}
}

99
src/Shentun.Peis.HttpApi.Host/Schedulers/SyncAsbitemPriceInterfaceWorker.cs

@ -0,0 +1,99 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Shentun.Peis.ThirdInterfaces;
using Shentun.Utilities;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Shentun.Peis.Schedulers
{
public interface ISyncAsbitemPriceInterfaceWorker
{
public void DoWork(Guid interfaceId);
public void DoWork();
}
public class SyncAsbitemPriceInterfaceWorker : ThirdInterfaceWorkerBase, ISyncAsbitemPriceInterfaceWorker
{
private static long i;
private static bool _isRunning = false;
private static readonly object lockObject = new object();
private readonly IConfiguration _configuration;
public SyncAsbitemPriceInterfaceWorker(IConfiguration configuration)
{
_configuration = configuration;
}
public virtual void DoWork(Guid interfaceId)
{
if (_isRunning) return;
//lock (lockObject)
//{
_isRunning = true;
try
{
var backJobTypeIds = _configuration.GetSection("BackJobTypeId").Value;
//Logger.LogInformation("Executed" + GetType().Name + "..!");
var appServiceHelper = new AppServiceHelper();
//appServiceHelper.Login();
var thirdInterfaceDtos = appServiceHelper.CallAppService<object, List<ThirdInterfaceDto>>("api/app/ThirdInterface/GetList", null);
var thirdInterfaceDto = thirdInterfaceDtos.Where(o => o.Id == interfaceId).FirstOrDefault();
if (thirdInterfaceDto == null)
{
_isRunning = false;
return;
}
if (!backJobTypeIds.Contains(thirdInterfaceDto.ThirdInterfaceType))
{
_isRunning = false;
return;
}
if (thirdInterfaceDto.IsActive != 'Y')
{
_isRunning = false;
return;
}
var parmValue = thirdInterfaceDto.ParmValue;
if (!string.IsNullOrWhiteSpace(parmValue))
{
var configurationBuilder = new ConfigurationBuilder()
.AddJsonStream(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(parmValue)));
var interfaceConfig = configurationBuilder.Build();
var isActive = interfaceConfig.GetSection("Interface").GetSection("Scheduler")
.GetSection("IsActive").Value;
if (isActive != "Y")
{
_isRunning = false;
return;
}
var assemblyName = interfaceConfig.GetSection("Interface").GetSection("AssemblyName").Value;
var className = interfaceConfig.GetSection("Interface").GetSection("ClassName").Value;
var funName = "DoWork";
object[] classConstructorArg = new object[] { thirdInterfaceDto.Id };
ReflectionHelper.Invoke(assemblyName, className, classConstructorArg, funName);
}
}
catch (Exception ex)
{
_isRunning = false;
Logger.LogError("Executed " + GetType().Name + " Error" + ex.Message);
}
_isRunning = false;
return;
//}
}
public void DoWork()
{
throw new NotImplementedException();
}
}
}

2
test/Shentun.Peis.ColumnReference.Tests/ImportPacsResultPlugInsTest.cs

@ -25,7 +25,7 @@ namespace Shentun.Peis.PlugIns.Tests
configParm = File.ReadAllText(filePath);
var input = new ImportPacsResultPlugInsBase(configParm);
var list = await input.GetRequestPatientRegisters(
var list = await input.GetRequestPatientRegistersAsync(
30);
foreach(var item in list )
{

48
test/Shentun.Peis.ColumnReference.Tests/SyncAsbitemPricePlugInsTest.cs

@ -0,0 +1,48 @@
using Shentun.Peis.PlugIns.ImportLisResults;
using Shentun.Peis.PlugIns.SyncAsbitemPrice;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit.Abstractions;
namespace Shentun.Peis.PlugIns.Tests
{
public class SyncAsbitemPricePlugInsTest
{
private readonly ITestOutputHelper _output;
public SyncAsbitemPricePlugInsTest(ITestOutputHelper testOutputHelper)
{
_output = testOutputHelper;
}
[Fact]
public async Task DoWorkAsync()
{
var input = new SyncAsbitemPricePlugInsDbBase(new Guid("8742ccb6-ab93-4e4d-aad9-873b69fafd8c"));
await input.DoWork();
}
[Fact]
public async Task GetInterfaceAsbitems()
{
var input = new SyncAsbitemPricePlugInsDbBase(new Guid("8742ccb6-ab93-4e4d-aad9-873b69fafd8c"));
var list = await input.GetInterfaceAsbitems();
foreach (var item in list)
{
_output.WriteLine(item.AsbitemId + "," + item.AsbitemName + "," + item.Price.ToString());
}
}
}
}
Loading…
Cancel
Save