You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
707 lines
28 KiB
707 lines
28 KiB
using Dapper;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Newtonsoft.Json;
|
|
using Npgsql;
|
|
using NPOI.SS.Formula.Functions;
|
|
using ServiceReferenceDianLisResult;
|
|
using ServiceReferenceYinHai;
|
|
using Shentun.Peis.ChargeRequests;
|
|
using Shentun.Peis.Enums;
|
|
using Shentun.Peis.ImportLisResults;
|
|
using Shentun.Peis.LisRequests;
|
|
using Shentun.Peis.PlugIns.ChargeRequests;
|
|
using Shentun.Peis.PlugIns.Extensions.ChargeRequests.YinHai;
|
|
using Shentun.Peis.PlugIns.Extensions.ChargeRequests.YinHai.FeeBacks;
|
|
using Shentun.Peis.PlugIns.Extensions.ChargeRequests.YinHai.His;
|
|
using Shentun.Peis.PlugIns.Extensions.ImportLisResults.Dian;
|
|
using Shentun.Peis.PlugIns.Extensions.LisRequests.YinHai.Dto;
|
|
using Shentun.Peis.PlugIns.ImportLisResults;
|
|
using Shentun.Peis.PlugIns.LisRequests;
|
|
using Shentun.Peis.PlugIns.PatientRegisters;
|
|
using Shentun.Peis.PrintReports;
|
|
using Shentun.Peis.RegisterCheckPictures;
|
|
using Shentun.Peis.ThirdInterfaces;
|
|
using Shentun.Utilities;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data.Common;
|
|
using System.Linq;
|
|
using System.ServiceModel;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Xml;
|
|
|
|
namespace Shentun.Peis.PlugIns.Extensions.LisRequests.YinHai
|
|
{
|
|
|
|
public class LisRequestPlugInsYinHai
|
|
{
|
|
|
|
protected IConfiguration? AppConfig;
|
|
private readonly string AppConnctionStr;
|
|
private readonly IConfiguration? InterfaceConfig;
|
|
private readonly ThirdInterfaceDto? _thirdInterfaceDto;
|
|
private readonly PluginLogger _logger; // 添加日志实例
|
|
|
|
static LisRequestPlugInsYinHai()
|
|
{
|
|
Dapper.DefaultTypeMap.MatchNamesWithUnderscores = true;
|
|
|
|
}
|
|
|
|
public LisRequestPlugInsYinHai(Guid thirdInterfaceId)
|
|
{
|
|
_logger = new PluginLogger();
|
|
AppConfig = new ConfigurationBuilder()
|
|
.SetBasePath(DirectoryHelper.GetAppDirectory()) // 设置基础路径为当前目录
|
|
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
|
.Build();
|
|
AppConnctionStr = AppConfig.GetSection("ConnectionStrings")
|
|
.GetSection("Default").Value;
|
|
|
|
|
|
using (DbConnection conn = new NpgsqlConnection(AppConnctionStr))
|
|
{
|
|
string sql;
|
|
sql = @"
|
|
SELECT *
|
|
from third_interface
|
|
where id =@ThirdInterfaceId
|
|
";
|
|
_thirdInterfaceDto = (conn.Query<ThirdInterfaceDto>(sql,
|
|
new { ThirdInterfaceId = thirdInterfaceId })).Single();
|
|
|
|
|
|
}
|
|
|
|
var configurationBuilder = new ConfigurationBuilder()
|
|
.AddJsonStream(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(_thirdInterfaceDto.ParmValue)));
|
|
InterfaceConfig = configurationBuilder.Build();
|
|
}
|
|
public LisRequestPlugInsYinHai(string parmValue)
|
|
{
|
|
_logger = new PluginLogger();
|
|
AppConfig = new ConfigurationBuilder()
|
|
.SetBasePath(DirectoryHelper.GetAppDirectory()) // 设置基础路径为当前目录
|
|
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
|
.Build();
|
|
AppConnctionStr = AppConfig.GetSection("ConnectionStrings")
|
|
.GetSection("Default").Value;
|
|
|
|
var configurationBuilder = new ConfigurationBuilder()
|
|
.AddJsonStream(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(parmValue)));
|
|
InterfaceConfig = configurationBuilder.Build();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 发送Lis申请
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
/// <exception cref="Exception"></exception>
|
|
public async Task<LisRequestPlugInsOut> SendRequestAsync(LisRequestPlugInsInput input)
|
|
{
|
|
_logger.Log("银海发送Lis申请", $"Lis申请Id:{input.LisRequestId}");
|
|
|
|
try
|
|
{
|
|
//建立人员档案
|
|
var patientRegisterForPlugIns = await GetPatientRegisterAsync(input.LisRequestId);
|
|
var lisRequestForPlugIns = await GetLisRequestForPlugInsAsync(input.LisRequestId);
|
|
if (lisRequestForPlugIns == null)
|
|
{
|
|
throw new Exception("没有申请单信息");
|
|
}
|
|
if (!lisRequestForPlugIns.Asbitems.Any())
|
|
{
|
|
throw new Exception("申请单没有组合项目信息");
|
|
}
|
|
if (patientRegisterForPlugIns.BirthDate == null)
|
|
{
|
|
throw new Exception("出生日期不能为空");
|
|
}
|
|
|
|
|
|
var endpointAddress = InterfaceConfig.GetValue("Interface:EndpointAddress", "");
|
|
if (string.IsNullOrWhiteSpace(endpointAddress))
|
|
{
|
|
throw new Exception("接口地址不能为空");
|
|
}
|
|
|
|
|
|
|
|
|
|
string actionName = "request_call";
|
|
string codeName = "lis_server";
|
|
|
|
|
|
using (var client = new WebServiceClient(new BasicHttpBinding(),
|
|
new EndpointAddress(endpointAddress)))
|
|
{
|
|
//// 添加消息拦截器行为
|
|
//var behavior = new SoapEndpointBehavior();
|
|
//client.Endpoint.EndpointBehaviors.Add(behavior);
|
|
|
|
var request = new LisRequestCallDto();
|
|
#region head
|
|
string requestId = new Random().Next(100000, 999999).ToString();
|
|
string timestamp = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
request.Head = new LisRequestCallHeadDto
|
|
{
|
|
Action = actionName,
|
|
Code = codeName,
|
|
ObjectSystem = "lis",
|
|
RequestId = requestId,
|
|
Sign = "",
|
|
SourceSystem = "peis",
|
|
Timestamp = timestamp,
|
|
Version = "1"
|
|
};
|
|
|
|
string headString = $"version={request.Head.Version}×tamp={request.Head.Timestamp}&request_id={request.Head.RequestId}&source_system={request.Head.SourceSystem}&object_system={request.Head.ObjectSystem}&action={request.Head.Action}";
|
|
string sign = Convert.ToBase64String(Encoding.UTF8.GetBytes(headString));
|
|
request.Head.Sign = sign;
|
|
#endregion
|
|
|
|
var orgCode = InterfaceConfig.GetValue("Interface:OrgCode", "");
|
|
var orgName = InterfaceConfig.GetValue("Interface:OrgName", "");
|
|
var systemSource = InterfaceConfig.GetValue("Interface:SystemSource", "");
|
|
var billingDeptCode = InterfaceConfig.GetValue("Interface:BillingDeptCode", "");
|
|
var billingDeptName = InterfaceConfig.GetValue("Interface:BillingDeptName", "");
|
|
|
|
var commonTableTypeId = InterfaceConfig.GetValue("Interface:CommonTableTypeId", "");
|
|
var execDoctorUser = InterfaceConfig.GetValue("Interface:ExecDoctorUser", "");
|
|
|
|
var createUser = await GetUserInfo(patientRegisterForPlugIns.CreatorId);
|
|
|
|
var dataDetails = new List<LisRequestCallBodyDataDetailDto>();
|
|
var dataRequest = new LisRequestCallBodyDataRequestDto
|
|
{
|
|
Age = patientRegisterForPlugIns.Age?.ToString() ?? "0",
|
|
AgeUnit = "岁",
|
|
RequestNo = lisRequestForPlugIns.LisRequestNo,
|
|
PatientType = "4",
|
|
OrgCode = orgCode,
|
|
OrgName = orgName,
|
|
SystemSource = "04.01",
|
|
VisitId = patientRegisterForPlugIns.PatientRegisterNo,
|
|
VisitNo = patientRegisterForPlugIns.PatientRegisterNo,
|
|
PatientId = patientRegisterForPlugIns.PatientNo,
|
|
PatientNo = patientRegisterForPlugIns.PatientNo,
|
|
IsBaby = "0",
|
|
PatientName = patientRegisterForPlugIns.PatientName,
|
|
GenderCode = ConvertSex(patientRegisterForPlugIns.SexId),
|
|
IdCard = patientRegisterForPlugIns.IdNo,
|
|
RequestCode = createUser.UserName,
|
|
Requester = createUser.Surname,
|
|
RequestDeptCode = billingDeptCode,
|
|
RequestDeptName = billingDeptName,
|
|
Birthday = patientRegisterForPlugIns.BirthDate?.ToString("yyyy-MM-dd") ?? "",
|
|
IsEmergency = "0",
|
|
SumCost = lisRequestForPlugIns.Asbitems.Any() ? lisRequestForPlugIns.Asbitems.Sum(s => s.Standards).ToString() : "0",
|
|
PayFlag = "0",
|
|
SpecimenBarNo = lisRequestForPlugIns.LisRequestNo,
|
|
CancelFlag = "0",
|
|
ExecFlag = "0",
|
|
GcFlag = "0",
|
|
AppointmentFlag = "0"
|
|
};
|
|
|
|
|
|
#region 对照关系
|
|
|
|
var yinHaiAsbitemCommonTableList = await GetCommonTableByTypeId(commonTableTypeId);
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
foreach (var item in lisRequestForPlugIns.Asbitems)
|
|
{
|
|
var dzFirst = yinHaiAsbitemCommonTableList.FirstOrDefault(f => f.DisplayName == item.AsbitemId.ToString());
|
|
|
|
if (dzFirst == null)
|
|
{
|
|
throw new Exception($"项目【{item.AsbitemName},Id:{item.AsbitemId}】没有对照");
|
|
}
|
|
|
|
|
|
dataDetails.Add(new LisRequestCallBodyDataDetailDto
|
|
{
|
|
RequestNo = lisRequestForPlugIns.LisRequestNo,
|
|
PatientType = "4",
|
|
ItemSerialNo = $"{lisRequestForPlugIns.LisRequestNo}{dzFirst.ThirdCode}",
|
|
OrgCode = orgCode,
|
|
OrgName = orgName,
|
|
SystemSource = systemSource,
|
|
PatientId = patientRegisterForPlugIns.PatientNo,
|
|
VisitId = patientRegisterForPlugIns.PatientRegisterNo,
|
|
OrderId = "-",
|
|
ItemId = item.AsbitemId.ToString(),
|
|
ItemCode = dzFirst.ThirdCode,
|
|
ItemName = item.AsbitemName,
|
|
Cost = item.Standards.ToString(),
|
|
ExecFlag = "0",
|
|
CancelFlag = "0",
|
|
IsEmergency = "0"
|
|
});
|
|
|
|
}
|
|
|
|
var requestBody = new LisRequestCallBodyDto
|
|
{
|
|
Data = new LisRequestCallBodyDataDto
|
|
{
|
|
Request = dataRequest,
|
|
RequestDetails = new LisRequestCallBodyDataDetailsDto
|
|
{
|
|
Details = dataDetails
|
|
}
|
|
}
|
|
};
|
|
|
|
request.Body = requestBody;
|
|
|
|
|
|
var requestXml = XmlHelper.SerializeToXmlEmpty(request);
|
|
|
|
|
|
var resultP = await client.callBussinessAsync(requestXml);
|
|
|
|
|
|
|
|
if (resultP.data.status_code == "1")
|
|
{
|
|
//成功 更新lis申请表 执行状态
|
|
await UpdateLisRequestExecFlag(lisRequestForPlugIns.LisRequestNo, '1');
|
|
|
|
}
|
|
|
|
var returnValue = JsonConvert.SerializeObject(resultP.data, Newtonsoft.Json.Formatting.Indented);
|
|
|
|
_logger.Log("银海发送Lis申请", $"发送结果:{returnValue}");
|
|
|
|
var yinHaiSendInterfaceLogDto = new YinHaiSendInterfaceLogDto
|
|
{
|
|
LogName = "发送Lis申请",
|
|
ExecDoctorUser = Guid.Parse(execDoctorUser),
|
|
InterfaceName = $"{codeName}_{actionName}",
|
|
ParaValue = requestXml,
|
|
RequestNo = dataRequest.RequestNo,
|
|
ReturnParaValue = returnValue
|
|
};
|
|
|
|
await AddSendLog(yinHaiSendInterfaceLogDto);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
// Console.WriteLine(ex.Message);
|
|
_logger.Log("银海发送Lis申请", ex, $"发送Lis申请异常");
|
|
}
|
|
|
|
|
|
|
|
return new LisRequestPlugInsOut();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 取消Lis申请
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
/// <exception cref="Exception"></exception>
|
|
public async Task<LisRequestPlugInsOut> CancelRequestAsync(LisRequestPlugInsInput input)
|
|
{
|
|
_logger.Log("银海取消Lis申请", $"Lis申请Id:{input.LisRequestId}");
|
|
try
|
|
{
|
|
var patientRegisterForPlugIns = await GetPatientRegisterAsync(input.LisRequestId);
|
|
var lisRequestForPlugIns = await GetLisRequestForPlugInsAsync(input.LisRequestId);
|
|
if (lisRequestForPlugIns == null)
|
|
{
|
|
throw new Exception("没有申请单信息");
|
|
}
|
|
|
|
var endpointAddress = InterfaceConfig.GetValue("Interface:EndpointAddress", "");
|
|
if (string.IsNullOrWhiteSpace(endpointAddress))
|
|
{
|
|
throw new Exception("接口地址不能为空");
|
|
}
|
|
|
|
|
|
|
|
string actionName = "request_cancel";
|
|
string codeName = "lis_server";
|
|
|
|
using (var client = new WebServiceClient(new BasicHttpBinding(),
|
|
new EndpointAddress(endpointAddress)))
|
|
{
|
|
var request = new LisRequestCancelDto();
|
|
#region head
|
|
string requestId = new Random().Next(100000, 999999).ToString();
|
|
string timestamp = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
request.Head = new LisRequestCancelHeadDto
|
|
{
|
|
Action = actionName,
|
|
Code = codeName,
|
|
ObjectSystem = "lis",
|
|
RequestId = requestId,
|
|
Sign = "",
|
|
SourceSystem = "peis",
|
|
Timestamp = timestamp,
|
|
Version = "1"
|
|
};
|
|
|
|
string headString = $"version={request.Head.Version}×tamp={request.Head.Timestamp}&request_id={request.Head.RequestId}&source_system={request.Head.SourceSystem}&object_system={request.Head.ObjectSystem}&action={request.Head.Action}";
|
|
string sign = Convert.ToBase64String(Encoding.UTF8.GetBytes(headString));
|
|
request.Head.Sign = sign;
|
|
#endregion
|
|
|
|
|
|
var orgCode = InterfaceConfig.GetValue("Interface:OrgCode", "");
|
|
var systemSource = InterfaceConfig.GetValue("Interface:SystemSource", "");
|
|
|
|
var execDoctorUser = InterfaceConfig.GetValue("Interface:ExecDoctorUser", "");
|
|
var commonTableTypeId = InterfaceConfig.GetValue("Interface:CommonTableTypeId", "");
|
|
|
|
|
|
var dataDetails = new List<LisRequestCancelBodyDataDetailDto>();
|
|
var dataRequest = new LisRequestCancelBodyDataRequestDto
|
|
{
|
|
OrgCode = orgCode,
|
|
SystemSource = systemSource,
|
|
CancelFlag = "1",
|
|
PatientType = "4",
|
|
RequestNo = lisRequestForPlugIns.LisRequestNo
|
|
};
|
|
|
|
#region 对照关系
|
|
|
|
var yinHaiAsbitemCommonTableList = await GetCommonTableByTypeId(commonTableTypeId);
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
foreach (var item in lisRequestForPlugIns.Asbitems)
|
|
{
|
|
var dzFirst = yinHaiAsbitemCommonTableList.FirstOrDefault(f => f.DisplayName == item.AsbitemId.ToString());
|
|
|
|
if (dzFirst == null)
|
|
{
|
|
throw new Exception($"项目【{item.AsbitemName},Id:{item.AsbitemId}】没有对照");
|
|
}
|
|
|
|
|
|
dataDetails.Add(new LisRequestCancelBodyDataDetailDto
|
|
{
|
|
RequestNo = lisRequestForPlugIns.LisRequestNo,
|
|
PatientType = "4",
|
|
ItemSerialNo = $"{lisRequestForPlugIns.LisRequestNo}{dzFirst.ThirdCode}",
|
|
OrgCode = orgCode,
|
|
SystemSource = systemSource,
|
|
CancelFlag = "1"
|
|
});
|
|
|
|
}
|
|
|
|
var requestBody = new LisRequestCancelBodyDto
|
|
{
|
|
Data = new LisRequestCancelBodyDataDto
|
|
{
|
|
Request = dataRequest,
|
|
RequestDetails = new LisRequestCancelBodyDataDetailsDto
|
|
{
|
|
Details = dataDetails
|
|
}
|
|
}
|
|
};
|
|
|
|
request.Body = requestBody;
|
|
|
|
var requestXml = XmlHelper.SerializeToXmlEmpty(request);
|
|
|
|
|
|
var resultP = await client.callBussinessAsync(requestXml);
|
|
|
|
if (resultP.data.status_code == "1")
|
|
{
|
|
//成功 更新lis申请表 执行状态
|
|
await UpdateLisRequestExecFlag(lisRequestForPlugIns.LisRequestNo, '0');
|
|
|
|
}
|
|
|
|
var returnValue = JsonConvert.SerializeObject(resultP.data, Newtonsoft.Json.Formatting.Indented);
|
|
|
|
_logger.Log("银海取消Lis申请", $"发送结果:{returnValue}");
|
|
|
|
var yinHaiSendInterfaceLogDto = new YinHaiSendInterfaceLogDto
|
|
{
|
|
LogName = "取消Lis申请",
|
|
ExecDoctorUser = Guid.Parse(execDoctorUser),
|
|
InterfaceName = $"{codeName}_{actionName}",
|
|
ParaValue = requestXml,
|
|
RequestNo = lisRequestForPlugIns.LisRequestNo,
|
|
ReturnParaValue = returnValue
|
|
};
|
|
|
|
await AddSendLog(yinHaiSendInterfaceLogDto);
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//Console.WriteLine(ex.Message);
|
|
_logger.Log("银海取消Lis申请", ex, $"发送取消Lis申请异常");
|
|
}
|
|
|
|
|
|
return new LisRequestPlugInsOut();
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 更新Lis申请表的执行状态,标记用于是否发送
|
|
/// </summary>
|
|
/// <param name="lisRequestNo"></param>
|
|
/// <returns></returns>
|
|
private async Task UpdateLisRequestExecFlag(string lisRequestNo, char execFlag)
|
|
{
|
|
using (DbConnection conn = new NpgsqlConnection(AppConnctionStr))
|
|
{
|
|
string sql;
|
|
sql = @"update lis_request set exec_flag=@execFlag
|
|
WHERE lis_request_no =@lisRequestNo
|
|
";
|
|
await conn.ExecuteAsync(sql,
|
|
new { execFlag = execFlag, lisRequestNo = lisRequestNo });
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取用户信息
|
|
/// </summary>
|
|
/// <param name="lisRequestId"></param>
|
|
/// <returns></returns>
|
|
private async Task<PatientRegisterForPlugIns> GetPatientRegisterAsync(Guid lisRequestId)
|
|
{
|
|
using (DbConnection conn = new NpgsqlConnection(AppConnctionStr))
|
|
{
|
|
string sql;
|
|
sql = @"select DISTINCT patient.id as patient_id,
|
|
patient_register.id as patient_register_id,
|
|
patient_register.patient_register_no,
|
|
patient.patient_no ,
|
|
patient_register.his_patient_id,
|
|
patient_register.medical_center_id,
|
|
patient_register.patient_name,
|
|
patient_register.sex_id,
|
|
patient_register.marital_status_id,
|
|
patient_register.birth_date,
|
|
patient_register.age,
|
|
patient_register.creator_id,
|
|
patient.nation_id,
|
|
patient.id_no,
|
|
patient.email,
|
|
patient.telephone,
|
|
patient.mobile_telephone,
|
|
patient.address from lis_request
|
|
left join register_check_asbitem on lis_request.id=register_check_asbitem.lis_request_id
|
|
left join register_check on register_check_asbitem.register_check_id=register_check.id
|
|
left join patient_register on register_check.patient_register_id=patient_register.id
|
|
left join patient on patient_register.patient_id=patient.id
|
|
where lis_request.id=@lisRequestId
|
|
";
|
|
var patientRegisterForPlugIns = (await conn.QueryAsync<PatientRegisterForPlugIns>(sql,
|
|
new { lisRequestId = lisRequestId })).SingleOrDefault();
|
|
return patientRegisterForPlugIns;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取申请单信息
|
|
/// </summary>
|
|
/// <param name="lisRequestId"></param>
|
|
/// <returns></returns>
|
|
private async Task<LisRequestForPlugIns> GetLisRequestForPlugInsAsync(Guid lisRequestId)
|
|
{
|
|
using (DbConnection conn = new NpgsqlConnection(AppConnctionStr))
|
|
{
|
|
string sql;
|
|
sql = @"SELECT DISTINCT lis_request.id as lis_request_id,
|
|
lis_request.lis_request_no ,
|
|
lis_request.is_print ,
|
|
abp_users.name ,
|
|
lis_request.sampling_time,
|
|
lis_request.is_sign_in,
|
|
lis_request.sign_in_order,
|
|
lis_request.sign_in_person,
|
|
lis_request.sign_in_time,
|
|
sample_type.id as sample_type_id,
|
|
sample_type.display_name as sample_type_name,
|
|
sample_container.display_name as sample_container_name
|
|
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 lis_request on register_check_asbitem.lis_request_id = lis_request.id
|
|
left JOIN abp_users on lis_request.sampler_id = abp_users.id
|
|
JOIN sample_container ON lis_request.sample_container_id = sample_container.id
|
|
join sample_type on lis_request.sample_type_id = sample_type.id
|
|
where lis_request.id =@LisRequestId and
|
|
patient_register.complete_flag <> '3' and
|
|
register_check.complete_flag <> '1'
|
|
";
|
|
var lisRequestForPlugIns = (await conn.QueryAsync<LisRequestForPlugIns>(sql,
|
|
new { LisRequestId = lisRequestId })).SingleOrDefault();
|
|
if (lisRequestForPlugIns == null)
|
|
{
|
|
return null;
|
|
}
|
|
sql = @"
|
|
SELECT register_check_asbitem.asbitem_id,
|
|
asbitem.display_name as asbitem_name,
|
|
register_check_asbitem.amount * register_check_asbitem.standard_price as standards
|
|
from register_check
|
|
JOIN register_check_asbitem on register_check.id = register_check_asbitem.register_check_id
|
|
JOIN lis_request on register_check_asbitem.lis_request_id = lis_request.id
|
|
JOIN asbitem on register_check_asbitem.asbitem_id = asbitem.id
|
|
where
|
|
lis_request.id=@LisRequestId
|
|
";
|
|
|
|
lisRequestForPlugIns.Asbitems = (await conn.QueryAsync<LisRequestAsbitemForPlugIns>(sql,
|
|
new { LisRequestId = lisRequestId })).ToList();
|
|
|
|
return lisRequestForPlugIns;
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取收费用户
|
|
/// </summary>
|
|
/// <param name="UserId"></param>
|
|
/// <returns></returns>
|
|
private async Task<ChargeUserDto> GetUserInfo(Guid UserId)
|
|
{
|
|
using (DbConnection conn = new NpgsqlConnection(AppConnctionStr))
|
|
{
|
|
string sql;
|
|
sql = @"select user_name,surname from abp_users
|
|
WHERE id =@UserId
|
|
";
|
|
var chargeUser = (await conn.QueryAsync<ChargeUserDto>(sql,
|
|
new { UserId = UserId })).SingleOrDefault();
|
|
if (chargeUser == null)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
|
|
return chargeUser;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取对照数据
|
|
/// </summary>
|
|
/// <param name="commonTableTypeId"></param>
|
|
/// <returns></returns>
|
|
private async Task<List<YinHaiAsbitemCommonTableDto>> GetCommonTableByTypeId(string commonTableTypeId)
|
|
{
|
|
var thirdCode = InterfaceConfig.GetValue("Interface:ThirdCode", "");
|
|
|
|
|
|
using (DbConnection conn = new NpgsqlConnection(AppConnctionStr))
|
|
{
|
|
string sql;
|
|
sql = $@"select display_name,{thirdCode} as thirdCode from common_table where common_table_type_id='{commonTableTypeId}' ";
|
|
var yinHaiAsbitemCommonTableList = (await conn.QueryAsync<YinHaiAsbitemCommonTableDto>(sql)).ToList();
|
|
|
|
return yinHaiAsbitemCommonTableList;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加日志
|
|
/// </summary>
|
|
/// <param name="input"></param>
|
|
/// <returns></returns>
|
|
private async Task AddSendLog(YinHaiSendInterfaceLogDto input)
|
|
{
|
|
using (DbConnection conn = new NpgsqlConnection(AppConnctionStr))
|
|
{
|
|
string sql;
|
|
sql = $@" insert into interface_send_log (id,request_no,interface_name,para_value,return_para_value,concurrency_stamp,
|
|
creation_time,creator_id,last_modification_time,last_modifier_id) values
|
|
(@id,@request_no,@interface_name,@para_value,@return_para_value,@concurrency_stamp,
|
|
@creation_time,@creator_id,@last_modification_time,@last_modifier_id)
|
|
";
|
|
await conn.ExecuteAsync(sql,
|
|
new
|
|
{
|
|
id = Guid.NewGuid(),
|
|
request_no = input.RequestNo,
|
|
interface_name = input.InterfaceName,
|
|
para_value = input.ParaValue,
|
|
return_para_value = input.ReturnParaValue,
|
|
concurrency_stamp = Guid.NewGuid().ToString("N"),
|
|
creation_time = DateTime.Now,
|
|
creator_id = input.ExecDoctorUser,
|
|
last_modification_time = DateTime.Now,
|
|
last_modifier_id = input.ExecDoctorUser
|
|
});
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 转换性别
|
|
/// </summary>
|
|
/// <param name="sexId"></param>
|
|
/// <returns></returns>
|
|
private string ConvertSex(char sexId)
|
|
{
|
|
string msg = "";
|
|
switch (sexId)
|
|
{
|
|
case 'M':
|
|
msg = "1";
|
|
break;
|
|
case 'F':
|
|
msg = "2";
|
|
break;
|
|
case 'U':
|
|
msg = "0";
|
|
break;
|
|
default:
|
|
msg = "9";
|
|
break;
|
|
}
|
|
return msg;
|
|
}
|
|
|
|
#region 解析xml
|
|
|
|
|
|
private string GetNodeValue(XmlNode parent, string nodeName)
|
|
{
|
|
var node = parent.SelectSingleNode(nodeName);
|
|
return node?.InnerText ?? "";
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
}
|