Browse Source

青藏公司

bjmzak
DESKTOP-G961P6V\Zhh 1 year ago
parent
commit
af91a522f0
  1. 6
      ThirdPlugIns/Shentun.Peis.PlugIns.Gem/ImportPacsResultPlugInsGem.cs
  2. 169
      ThirdPlugIns/Shentun.Peis.PlugIns.Gem/ImportPatientRegisterPlugInsGem.cs
  3. 17
      ThirdPlugIns/Shentun.Peis.PlugIns.Gem/QztlImportDataEntity.cs
  4. 140
      ThirdPlugIns/Shentun.Peis.PlugIns.Gem/QztlPatientRegisterFromInterface.cs
  5. 49
      ThirdPlugIns/Shentun.Peis.PlugIns.Gem/test/Shentun.Peis.PlugIns.Gem.Test/ImportPatientRegisterPlugInsGemTest.cs
  6. 12
      ThirdPlugIns/Shentun.Peis.PlugIns.Gem/test/Shentun.Peis.PlugIns.Gem.Test/appsettings.json
  7. 18
      src/Shentun.ColumnReferencePlugIns/CustomerOrgForPlugIns.cs
  8. 20
      src/Shentun.ColumnReferencePlugIns/ImportPatientRegisterPlugInsBase.cs

6
ThirdPlugIns/Shentun.Peis.PlugIns.Gem/ImportPacsResultPlugInsGem.cs

@ -39,6 +39,10 @@ namespace Shentun.Peis.PlugIns.Gem
pageNo = 1, pageNo = 1,
pageSize = 20 pageSize = 20
}; };
//if(interfaceInpu.tjNum == "2405112185")
//{
// ;
//}
var apiResult = await CallInterfaceServiceAsync<ImportPacsResultInterfaceInput, var apiResult = await CallInterfaceServiceAsync<ImportPacsResultInterfaceInput,
ImportPacsResultInterfaceOut>(interfaceInpu); ImportPacsResultInterfaceOut>(interfaceInpu);
if(!apiResult.data.Any()) if(!apiResult.data.Any())
@ -73,7 +77,7 @@ namespace Shentun.Peis.PlugIns.Gem
} }
}; };
var callResult = await CallAppServiceAsync<CreateImportPacsResultDto, object>("api/app/ImportLisResult/ImportResult", createImportPacsResultDto);
var callResult = await CallAppServiceAsync<CreateImportPacsResultDto, object>("api/app/ImportPacsResult/ImportResult", createImportPacsResultDto);
} }
var result = new ImportPacsResultPlugInsOut(); var result = new ImportPacsResultPlugInsOut();

169
ThirdPlugIns/Shentun.Peis.PlugIns.Gem/ImportPatientRegisterPlugInsGem.cs

@ -0,0 +1,169 @@
using Dapper;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json;
using Npgsql;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
namespace Shentun.Peis.PlugIns.Gem
{
public class ImportPatientRegisterPlugInsGem : ImportPatientRegisterPlugInsBase
{
private Guid _importCustomerOrgId;
private string _hospitalId;
private string _aesKEY;
private string _year;
public ImportPatientRegisterPlugInsGem(string parmValue) : base(parmValue)
{
}
public override async Task ImportAsync()
{
await InitAsync();
var qztlPatientRegisterFromInterface = await CallInterfaceServiceAsync();
if (qztlPatientRegisterFromInterface == null || !qztlPatientRegisterFromInterface.plans.Any())
{
return;
}
foreach(var patient in qztlPatientRegisterFromInterface.plans)
{
}
}
public async Task InitAsync()
{
var customerOrgIdStr = InterfaceConfig.GetSection("Interface").GetSection("单位编号").Value;
_hospitalId = InterfaceConfig.GetSection("Interface").GetSection("HospitalId").Value;
_aesKEY = InterfaceConfig.GetSection("Interface").GetSection("aesKEY").Value;
if (string.IsNullOrWhiteSpace(customerOrgIdStr))
{
return;
}
if (!Guid.TryParse(customerOrgIdStr, out _importCustomerOrgId))
{
throw new Exception("单位编号不正确");
}
if (string.IsNullOrWhiteSpace(_hospitalId))
{
throw new Exception("HospitalId参数不能为空");
}
if (string.IsNullOrWhiteSpace(_aesKEY))
{
throw new Exception("_aesKEY参数不能为空");
}
using (DbConnection conn = new NpgsqlConnection(AppConnctionStr))
{
string sql;
sql = @"
SELECT id as customer_org_id,
display_name as customer_org_name,
parent_id ,
path_code
from
customer_org
where id = @CustomerOrgId
";
var customerOrgForPlugInss = (await conn.QueryAsync<CustomerOrgForPlugIns>(sql,
new { CustomerOrgId = _importCustomerOrgId })).FirstOrDefault();
if (customerOrgForPlugInss == null)
{
throw new Exception("单位编号不正确,找不到单位");
}
var year = customerOrgForPlugInss.CustomerOrgName.Substring(
customerOrgForPlugInss.CustomerOrgName.Length - 5
, 4);
if (!int.TryParse(year, out var yearNumber))
{
throw new Exception("单位名称必须是以2000年这样的格式结尾");
}
if (yearNumber < 2024 || yearNumber > 2050)
{
throw new Exception("单位名称年限范围必须在2024-2050之间");
}
_year = year;
}
}
public async Task<QztlPatientRegisterFromInterface?> CallInterfaceServiceAsync()
{
string baseAddress = InterfaceWebApiUrl;
string ary = "HospitalId=" + _hospitalId + (Char)38 + "year=" + _year + (Char)38 + "AesKey=" + _aesKEY;
baseAddress = baseAddress + ary;
using (var httpClientHandler = new HttpClientHandler())
{
using (var httpClient = new HttpClient(httpClientHandler))
{
httpClient.BaseAddress = new Uri(baseAddress);
httpClient.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/x-www-form-urlencoded"));//设置accept标头,告诉JSON是可接受的响应类型
//httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _accesToken);
IsoDateTimeConverter timeFormat = new IsoDateTimeConverter();
timeFormat.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
//var sendData = JsonConvert.SerializeObject(data, Newtonsoft.Json.Formatting.Indented, timeFormat);
using (HttpContent httpContent = new StringContent(""))
{
httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
HttpResponseMessage response = await httpClient.GetAsync("");
string result;
if (!response.IsSuccessStatusCode)
{
result = response.Content.ReadAsStringAsync().Result;
throw new Exception("http通信错误:" + response.StatusCode + ",结果:" + result);
}
result = await response.Content.ReadAsStringAsync();
result = result.Replace(":\"[{", ":[{").Replace("}]\"", "}]").Replace("\\", "");
QztlPatientRegisterFromInterface? resultDto = JsonConvert.DeserializeObject<QztlPatientRegisterFromInterface>(result);
if (resultDto != null)
{
if (resultDto.status != 0)
{
throw new Exception($"调用WebApi失败,返回错误,消息:" + resultDto.status + resultDto.errorMsg);
}
//插入数据库中备份
using (DbConnection conn = new NpgsqlConnection(AppConnctionStr))
{
string sql;
var qztlImportDataEntity = new QztlImportDataEntity()
{
Id = Guid.NewGuid(),
Data = result,
DataType = '0',
IsComplete = 'Y',
CreationTime = DateTime.Now,
};
sql = @"insert into qztl_import_data(id, data, data_type, is_complete,creation_time)
values(@Id, @Data, @DataType, @IsComplete,@CreationTime)";
conn.Execute(sql, qztlImportDataEntity);
}
return (QztlPatientRegisterFromInterface)resultDto;
}
return null;
}
}
}
}
}
}

17
ThirdPlugIns/Shentun.Peis.PlugIns.Gem/QztlImportDataEntity.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.Gem
{
public class QztlImportDataEntity
{
public Guid Id { get; set; }
public string Data { get; set; }
public char DataType { get; set; }
public char IsComplete { get; set; }
public DateTime CreationTime { get; set; }
}
}

140
ThirdPlugIns/Shentun.Peis.PlugIns.Gem/QztlPatientRegisterFromInterface.cs

@ -0,0 +1,140 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shentun.Peis.PlugIns.Gem
{
public class QztlPatientRegisterFromInterface
{
public int status { get; set; }
public string errorMsg { get; set; }
public int size { get; set; }
public List<string> delIds { get; set; } = new List<string>();
public List<QztlPatientRegisterFromInterfacePlan> plans { get; set; } = new List<QztlPatientRegisterFromInterfacePlan>();
}
public class QztlPatientRegisterFromInterfacePlan
{
/// <summary>
///
/// </summary>
public string gradeJsV { get; set; }
/// <summary>
/// 体检年份 int
/// </summary>
public int year { get; set; }
/// <summary>
/// 2024年全员体检
/// </summary>
public string planName { get; set; }
/// <summary>
/// 体检批次
/// </summary>
public string tjpcV { get; set; }
/// <summary>
/// 体检阶段 int
/// </summary>
public int tjJieduan { get; set; }
/// <summary>
/// 年龄 int
/// </summary>
public int age { get; set; }
/// <summary>
/// 身份证号
/// </summary>
public string cardId { get; set; }
/// <summary>
/// 本次体检唯一ID号,long
/// </summary>
public long id { get; set; }
/// <summary>
/// 职称
/// </summary>
public string gradeZwV { get; set; }
/// <summary>
/// 高原体检,int
/// </summary>
public int ifGy { get; set; }
/// <summary>
/// 健康体检
/// </summary>
public int ifJk { get; set; }
/// <summary>
/// 普速体检
/// </summary>
public int ifCw { get; set; }
/// <summary>
/// 从业
/// </summary>
public int ifCy { get; set; }
/// <summary>
/// 复检
/// </summary>
public int ifFj { get; set; }
/// <summary>
/// 高铁
/// </summary>
public int ifGt { get; set; }
/// <summary>
/// 行车体检
/// </summary>
public int ifMain { get; set; }
/// <summary>
/// 危害体检
/// </summary>
public int ifWh { get; set; }
/// <summary>
/// 手机号
/// </summary>
public string mobile { get; set; }
/// <summary>
/// 单位 int
/// </summary>
public long orgId { get; set; }
/// <summary>
/// 单位名
/// </summary>
public string orgName { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string personName { get; set; }
/// <summary>
/// 性别,int
/// </summary>
public int sex { get; set; }
/// <summary>
///
/// </summary>
public int wedding { get; set; }
/// <summary>
/// 干部
/// </summary>
public string workTypeV { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remark { get; set; }
/// <summary>
/// 职务
/// </summary>
public string tjTab1 { get; set; }
/// <summary>
/// 体检备注
/// </summary>
public string tjOpinion { get; set; }
/// <summary>
/// 复检备注
/// </summary>
public string fjOpinion { get; set; }
/// <summary>
/// int
/// </summary>
public int altitude { get; set; }
/// <summary>
/// DateTime
/// </summary>
public DateTime beginTime { get; set; }
}
}

49
ThirdPlugIns/Shentun.Peis.PlugIns.Gem/test/Shentun.Peis.PlugIns.Gem.Test/ImportPatientRegisterPlugInsGemTest.cs
File diff suppressed because it is too large
View File

12
ThirdPlugIns/Shentun.Peis.PlugIns.Gem/test/Shentun.Peis.PlugIns.Gem.Test/appsettings.json

@ -1,8 +1,10 @@
{ {
"App": { "App": {
"SelfUrl": "http://localhost:9530",
"ClientUrl": "http://localhost:9530",
"SelfUrl": "http://10.1.12.140:9529",
"ClientUrl": "http://10.1.12.140:9529",
//"SelfUrl": "http://localhost:9530",
//"ClientUrl": "http://localhost:9530",
"CorsOrigins": "https://*.Peis.com,http://localhost:4200,http://localhost:9530,http://192.168.1.108:9530,http://localhost:8080,http://localhost:8081", "CorsOrigins": "https://*.Peis.com,http://localhost:4200,http://localhost:9530,http://192.168.1.108:9530,http://localhost:8080,http://localhost:8081",
"RedirectAllowedUrls": "http://localhost:9530", "RedirectAllowedUrls": "http://localhost:9530",
"Sql": "select id::varchar as Code ,display_name as DisplayName ,simple_code as SimpleCode ,display_order as DisplayOrder from asbitem", "Sql": "select id::varchar as Code ,display_name as DisplayName ,simple_code as SimpleCode ,display_order as DisplayOrder from asbitem",
@ -17,7 +19,11 @@
"Sql": "select ZHID as Code ,ZHMC as DisplayName from PORTAL56_LIS.vi_tj_testitemgroup", "Sql": "select ZHID as Code ,ZHMC as DisplayName from PORTAL56_LIS.vi_tj_testitemgroup",
"ColumnNames": "编码,名称", "ColumnNames": "编码,名称",
"EndpointAddress": "http://10.1.12.140:8082/gemse-tj/services/bstj.bstjHttpSoap11Endpoint", "EndpointAddress": "http://10.1.12.140:8082/gemse-tj/services/bstj.bstjHttpSoap11Endpoint",
"WebApiUrl": "http://10.1.13.18:8380/ris/findReportList",
//"WebApiUrl": "http://10.1.13.18:8380/ris/findReportList",
"单位编号": "3a126b36-831f-aa9f-ddfe-a82f660fc485",
"WebApiUrl": "http://62.156.10.237:8005/health/values/GetPlan?",
"aesKEY": "Vwso4P4vBkKw0AODd1LwqgL6vIW8np8m",
"HospitalId": "3",
"Scheduler": { "Scheduler": {
"IsActive": "Y", "IsActive": "Y",
"Corn": "*/5 * * * * *", "Corn": "*/5 * * * * *",

18
src/Shentun.ColumnReferencePlugIns/CustomerOrgForPlugIns.cs

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shentun.Peis.PlugIns
{
public class CustomerOrgForPlugIns
{
public Guid CustomerOrgId { get; set; }
public string CustomerOrgName { get; set; }
public Guid ParentId { get; set; }
public string PathCode { get; set; }
}
}

20
src/Shentun.ColumnReferencePlugIns/ImportPatientRegisterPlugInsBase.cs

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shentun.Peis.PlugIns
{
public class ImportPatientRegisterPlugInsBase : ThirdPlugInsBase
{
public ImportPatientRegisterPlugInsBase(string parmValue) : base(parmValue)
{
}
public virtual async Task ImportAsync()
{
return ;
}
}
}
Loading…
Cancel
Save