9 changed files with 193 additions and 3 deletions
-
22ThirdPlugIns/Shentun.Peis.PlugIns.Gem/PacsImportResultPlugInsGem.cs
-
6src/Shentun.ColumnReferencePlugIns/LisResultImportPlugInsBase.cs
-
12src/Shentun.ColumnReferencePlugIns/PacsImportResultPlugIns.cs
-
102src/Shentun.ColumnReferencePlugIns/PacsImportResultPlugInsBase.cs
-
13src/Shentun.ColumnReferencePlugIns/PacsImportResultPlugInsInput.cs
-
12src/Shentun.ColumnReferencePlugIns/PacsImportResultPlugInsOut.cs
-
14src/Shentun.ColumnReferencePlugIns/PacsRequestForResultImportPlugIns.cs
-
12src/Shentun.ColumnReferencePlugIns/PlugInsBase.cs
-
3src/Shentun.Peis.Domain.Shared/Enums/ThirdInterfaceTypeFlag.cs
@ -0,0 +1,22 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Shentun.Peis.PlugIns.Gem |
|||
{ |
|||
public class PacsImportResultPlugInsGem : PacsImportResultPlugInsBase |
|||
{ |
|||
public PacsImportResultPlugInsGem(string parmValue) : base(parmValue) |
|||
{ |
|||
} |
|||
|
|||
public override Task<PacsImportResultPlugInsOut> ImportResultAsync(PacsImportResultPlugInsInput input) |
|||
{ |
|||
|
|||
|
|||
return base.ImportResultAsync(input); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Shentun.Peis.PlugIns |
|||
{ |
|||
internal class PacsImportResultPlugIns |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,102 @@ |
|||
using Dapper; |
|||
using Npgsql; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Data.Common; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Shentun.Peis.PlugIns |
|||
{ |
|||
public class PacsImportResultPlugInsBase : ThirdPlugInsBase |
|||
{ |
|||
public PacsImportResultPlugInsBase(string parmValue) : base(parmValue) |
|||
{ |
|||
} |
|||
|
|||
public virtual async Task<PacsImportResultPlugInsOut> ImportResultAsync(PacsImportResultPlugInsInput input) |
|||
{ |
|||
var result = new PacsImportResultPlugInsOut(); |
|||
return result; |
|||
} |
|||
public async Task<List<PacsRequestForResultImportPlugIns>> GetLisRequestForResultImportPlugInssAsync(Guid patientRegisterId) |
|||
{ |
|||
using (DbConnection conn = new NpgsqlConnection(AppConnctionStr)) |
|||
{ |
|||
string sql; |
|||
sql = @"
|
|||
SELECT distinct register_check.id , |
|||
register_check.check_request_no |
|||
from patient_register |
|||
JOIN register_check on patient_register.id = register_check.patient_register_id |
|||
JOIN register_check_asbitem on register_check.id = register_check_asbitem.register_check_id |
|||
JOIN asbitem on register_check_asbitem.asbitem_id = asbitem.id |
|||
JOIN item_type on asbitem.item_type_id = item_type.id |
|||
where patient_register.id = @PatientRegisterId and |
|||
item_type.is_check_request = 'Y' |
|||
";
|
|||
var pacsRequestForResultImportPlugInss = (await conn.QueryAsync<PacsRequestForResultImportPlugIns>(sql, |
|||
new { PatientRegisterId = patientRegisterId })).ToList(); |
|||
return pacsRequestForResultImportPlugInss; |
|||
} |
|||
} |
|||
|
|||
|
|||
public async Task<List<PatientRegisterForLisRequest>> GetRequestPatientRegisters(int days) |
|||
{ |
|||
using (DbConnection conn = new NpgsqlConnection(AppConnctionStr)) |
|||
{ |
|||
string sql; |
|||
var startDate = DateTime.Now.Date.AddDays(-days); |
|||
sql = @" SELECT distinct register_check.patient_register_id
|
|||
from patient_register |
|||
JOIN register_check on patient_register.id = register_check.patient_register_id |
|||
JOIN register_check_asbitem on register_check.id = register_check_asbitem.register_check_id |
|||
JOIN asbitem on register_check_asbitem.asbitem_id = asbitem.id |
|||
JOIN item_type on asbitem.item_type_id = item_type.id |
|||
where item_type.is_check_request = 'Y' and |
|||
patient_register.medical_start_date >@StartDate and |
|||
register_check.creation_time >@StartDate |
|||
ORDER BY register_check.patient_register_id |
|||
";
|
|||
var patientRegisterForLisRequests = (await conn.QueryAsync<PatientRegisterForLisRequest>(sql, |
|||
new { StartDate = startDate })).ToList(); |
|||
|
|||
return patientRegisterForLisRequests; |
|||
} |
|||
|
|||
} |
|||
|
|||
public override Task DoWork() |
|||
{ |
|||
var queryDaysStr = InterfaceConfig.GetSection("Interface").GetSection("Scheduler").GetSection("QueryDays").Value; |
|||
if (string.IsNullOrWhiteSpace(queryDaysStr)) |
|||
{ |
|||
queryDaysStr = "1"; |
|||
} |
|||
if (!int.TryParse(queryDaysStr, out int days)) |
|||
{ |
|||
days = 1; |
|||
} |
|||
var patientRegisters = GetRequestPatientRegisters(days).Result; |
|||
|
|||
foreach (var patientRegister in patientRegisters) |
|||
{ |
|||
try |
|||
{ |
|||
var result = ImportResultAsync(new PacsImportResultPlugInsInput() |
|||
{ |
|||
PatientRegisterId = patientRegister.PatientRegisterId, |
|||
}).Result; |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
|
|||
} |
|||
|
|||
} |
|||
return Task.CompletedTask; |
|||
} |
|||
} |
|||
} |
|||
@ -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 PacsImportResultPlugInsInput |
|||
{ |
|||
public Guid PatientRegisterId { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Shentun.Peis.PlugIns |
|||
{ |
|||
public class PacsImportResultPlugInsOut |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Shentun.Peis.PlugIns |
|||
{ |
|||
public class PacsRequestForResultImportPlugIns |
|||
{ |
|||
public Guid RegisterCheckId { get; set; } |
|||
public string CheckRequestNo { get; set;} |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue