4 changed files with 284 additions and 0 deletions
-
127src/Shentun.ColumnReferencePlugIns/SyncAsbitemPrice/AsbitemForSyncAsbitem.cs
-
17src/Shentun.ColumnReferencePlugIns/SyncAsbitemPrice/AsbitemFromSyncAsbitemInterface.cs
-
84src/Shentun.ColumnReferencePlugIns/SyncAsbitemPrice/SyncAsbitemPricePlugInsBase.cs
-
56src/Shentun.ColumnReferencePlugIns/SyncAsbitemPrice/SyncAsbitemPricePlugInsDbBase.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; } |
||||
|
} |
||||
|
} |
||||
@ -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; } |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -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
|
||||
|
";
|
||||
|
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; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,56 @@ |
|||||
|
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 interfaceAsbitemId = await GetColumnReferenceInterfaceCodeValuesAsync(AsbitemColumnReferenceId, asbItem.Id.ToString()); |
||||
|
string sql; |
||||
|
sql = InterfaceSql + " where " + InterfaceSqlKeyColumn + " = '" + interfaceAsbitemId + "'"; |
||||
|
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); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue