|
|
|
@ -1,24 +1,23 @@ |
|
|
|
using Microsoft.Extensions.Configuration; |
|
|
|
using Newtonsoft.Json.Converters; |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Http; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Microsoft.Extensions.Configuration; |
|
|
|
using Microsoft.Net.Http.Headers; |
|
|
|
using Newtonsoft.Json; |
|
|
|
using NPOI.HPSF; |
|
|
|
using NPOI.SS.Formula.Functions; |
|
|
|
using Shentun.Peis.Enums; |
|
|
|
using Shentun.Peis.Models; |
|
|
|
using Shentun.Peis.PatientRegisters; |
|
|
|
using Shentun.Peis.PlugIns.Sms; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.IO; |
|
|
|
using System.Linq; |
|
|
|
using System.Net.Http.Headers; |
|
|
|
using System.Net.Http; |
|
|
|
using System.Text; |
|
|
|
using System.Net.Http.Headers; |
|
|
|
using System.Security.Policy; |
|
|
|
using System.Threading.Channels; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Volo.Abp.Application.Services; |
|
|
|
using Volo.Abp.Domain.Repositories; |
|
|
|
using Microsoft.AspNetCore.Authorization; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using NPOI.POIFS.Crypt.Dsig; |
|
|
|
using NPOI.SS.Formula.Functions; |
|
|
|
|
|
|
|
namespace Shentun.Peis.ThirdBookingPushs |
|
|
|
{ |
|
|
|
@ -69,6 +68,7 @@ namespace Shentun.Peis.ThirdBookingPushs |
|
|
|
var privateKey = interfaceConfig.GetSection("Interface").GetSection("MinZhongPrivateKey").Value; |
|
|
|
var medicalYear = interfaceConfig.GetSection("Interface").GetSection("MedicalYear").Value; |
|
|
|
var isActive = interfaceConfig.GetSection("Interface").GetSection("IsActive").Value; |
|
|
|
var iCode = interfaceConfig.GetSection("Interface").GetSection("ICODE").Value; |
|
|
|
if (!string.IsNullOrWhiteSpace(isActive) |
|
|
|
&& isActive == "Y") |
|
|
|
{ |
|
|
|
@ -79,44 +79,50 @@ namespace Shentun.Peis.ThirdBookingPushs |
|
|
|
&& !string.IsNullOrWhiteSpace(patientRegisterEnt.ThirdBookingId)) |
|
|
|
{ |
|
|
|
var thirdBookingEnt = await _thirdBookingRepository.FirstOrDefaultAsync(f => f.Id == Guid.Parse(patientRegisterEnt.ThirdBookingId)); |
|
|
|
string iCode = thirdBookingEnt.ICode; |
|
|
|
if (thirdBookingEnt.MedicalStatus == '0') |
|
|
|
if (thirdBookingEnt != null) |
|
|
|
{ |
|
|
|
|
|
|
|
var customerOrgGroupEnt = await _customerOrgGroupRepository.GetAsync(g => g.Id == Guid.Parse(thirdBookingEnt.CustomerOrgGroupId)); |
|
|
|
|
|
|
|
var pushRegisterInput = new PushRegisterInputDto |
|
|
|
if (!string.IsNullOrWhiteSpace(thirdBookingEnt.ICode)) |
|
|
|
{ |
|
|
|
BOOKINGDATE = thirdBookingEnt.BookingDate.ToString("yyyy-MM-dd"), |
|
|
|
BOOKINGDATEDESC = "", |
|
|
|
BOOKINGID = patientRegisterEnt.ThirdBookingId, |
|
|
|
BOOKINGTIME = thirdBookingEnt.BookingDate.ToString("HH:mm:ss"), |
|
|
|
BOOKINGTYPE = "1", |
|
|
|
BOOKINGTYPEELSEDESC = "", |
|
|
|
CONFIRMORG = "MINZ", |
|
|
|
CONFIRMORGCENTERDESC = "民众", |
|
|
|
CONFIRMTIME = patientRegisterEnt.CreationTime.ToString("yyyy-MM-dd HH:mm:ss"), |
|
|
|
CONFIRMTYPE = "1", |
|
|
|
EXAMPACKAGECODE = thirdBookingEnt.CustomerOrgGroupId, |
|
|
|
EXAMPACKAGEDESC = customerOrgGroupEnt.DisplayName, |
|
|
|
IDNO = thirdBookingEnt.IdNo, |
|
|
|
IDTYPE = thirdBookingEnt.IdType, |
|
|
|
MOBILE = thirdBookingEnt.Phone, |
|
|
|
NAME = patientRegisterEnt.PatientName, |
|
|
|
SOURCE = "BjGJ", |
|
|
|
YEAR = medicalYear |
|
|
|
}; |
|
|
|
|
|
|
|
var inputPara = GetEncryptData(JsonConvert.SerializeObject(pushRegisterInput), iCode, publicKey, privateKey); |
|
|
|
|
|
|
|
var resultPara = await CallBookingAppServiceAsync<EncryDataRequstDto, EncryDataResultDto>(baseApiAddress, registerApiAddress, inputPara, "application/json;charset=utf-8"); |
|
|
|
if (resultPara.FLAG) |
|
|
|
iCode = thirdBookingEnt.ICode; |
|
|
|
} |
|
|
|
if (thirdBookingEnt.MedicalStatus == '0') |
|
|
|
{ |
|
|
|
var decryptDataPara = GetDecryptData<DecryptBaseDto>(resultPara, publicKey, privateKey); |
|
|
|
if (decryptDataPara.STATUS == 0) |
|
|
|
|
|
|
|
var customerOrgGroupEnt = await _customerOrgGroupRepository.GetAsync(g => g.Id == Guid.Parse(thirdBookingEnt.CustomerOrgGroupId)); |
|
|
|
|
|
|
|
var pushRegisterInput = new PushRegisterInputDto |
|
|
|
{ |
|
|
|
BOOKINGDATE = thirdBookingEnt.BookingDate.ToString("yyyy-MM-dd"), |
|
|
|
BOOKINGDATEDESC = "", |
|
|
|
BOOKINGID = patientRegisterEnt.ThirdBookingId, |
|
|
|
BOOKINGTIME = thirdBookingEnt.BookingDate.ToString("HH:mm:ss"), |
|
|
|
BOOKINGTYPE = "1", |
|
|
|
BOOKINGTYPEELSEDESC = "", |
|
|
|
CONFIRMORG = "MINZ", |
|
|
|
CONFIRMORGCENTERDESC = "民众", |
|
|
|
CONFIRMTIME = patientRegisterEnt.CreationTime.ToString("yyyy-MM-dd HH:mm:ss"), |
|
|
|
CONFIRMTYPE = "1", |
|
|
|
EXAMPACKAGECODE = thirdBookingEnt.CustomerOrgGroupId, |
|
|
|
EXAMPACKAGEDESC = customerOrgGroupEnt.DisplayName, |
|
|
|
IDNO = thirdBookingEnt.IdNo, |
|
|
|
IDTYPE = thirdBookingEnt.IdType, |
|
|
|
MOBILE = thirdBookingEnt.Phone, |
|
|
|
NAME = patientRegisterEnt.PatientName, |
|
|
|
SOURCE = "BjGJ", |
|
|
|
YEAR = medicalYear |
|
|
|
}; |
|
|
|
|
|
|
|
var inputPara = GetEncryptData(JsonConvert.SerializeObject(pushRegisterInput), iCode, publicKey, privateKey); |
|
|
|
|
|
|
|
var resultPara = await CallBookingAppServiceAsync<EncryDataRequstDto, EncryDataResultDto>(baseApiAddress, registerApiAddress, inputPara, "application/json"); |
|
|
|
if (resultPara.FLAG) |
|
|
|
{ |
|
|
|
thirdBookingEnt.MedicalStatus = '1'; |
|
|
|
await _thirdBookingRepository.UpdateAsync(thirdBookingEnt); |
|
|
|
var decryptDataPara = GetDecryptData<DecryptBaseDto>(resultPara, publicKey, privateKey); |
|
|
|
if (decryptDataPara.STATUS == 0) |
|
|
|
{ |
|
|
|
thirdBookingEnt.MedicalStatus = '1'; |
|
|
|
await _thirdBookingRepository.UpdateAsync(thirdBookingEnt); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -149,6 +155,7 @@ namespace Shentun.Peis.ThirdBookingPushs |
|
|
|
var privateKey = interfaceConfig.GetSection("Interface").GetSection("MinZhongPrivateKey").Value; |
|
|
|
var isActive = interfaceConfig.GetSection("Interface").GetSection("IsActive").Value; |
|
|
|
var medicalYear = interfaceConfig.GetSection("Interface").GetSection("MedicalYear").Value; |
|
|
|
var iCode = interfaceConfig.GetSection("Interface").GetSection("ICODE").Value; |
|
|
|
if (!string.IsNullOrWhiteSpace(isActive) |
|
|
|
&& isActive == "Y") |
|
|
|
{ |
|
|
|
@ -160,50 +167,57 @@ namespace Shentun.Peis.ThirdBookingPushs |
|
|
|
&& !string.IsNullOrWhiteSpace(patientRegisterEnt.ThirdBookingId)) |
|
|
|
{ |
|
|
|
var thirdBookingEnt = await _thirdBookingRepository.FirstOrDefaultAsync(f => f.Id == Guid.Parse(patientRegisterEnt.ThirdBookingId)); |
|
|
|
string iCode = thirdBookingEnt.ICode; |
|
|
|
if (thirdBookingEnt.MedicalStatus == '1') |
|
|
|
if (thirdBookingEnt != null) |
|
|
|
{ |
|
|
|
var customerOrgGroupEnt = await _customerOrgGroupRepository.GetAsync(g => g.Id == Guid.Parse(thirdBookingEnt.CustomerOrgGroupId)); |
|
|
|
|
|
|
|
var pushCompletePhysicalInput = new PushCompletePhysicalInputDto |
|
|
|
if (!string.IsNullOrWhiteSpace(thirdBookingEnt.ICode)) |
|
|
|
{ |
|
|
|
BOOKINGDATE = thirdBookingEnt.BookingDate.ToString("yyyy-MM-dd"), |
|
|
|
BOOKINGDATEDESC = "", |
|
|
|
BOOKINGID = patientRegisterEnt.ThirdBookingId, |
|
|
|
BOOKINGTIME = thirdBookingEnt.BookingDate.ToString("HH:mm:ss"), |
|
|
|
BOOKINGTYPE = "1", |
|
|
|
BOOKINGTYPEELSEDESC = "", |
|
|
|
CONFIRMORG = "MINZ", |
|
|
|
CONFIRMORGCENTERDESC = "民众", |
|
|
|
CONFIRMTIME = patientRegisterEnt.CreationTime.ToString("yyyy-MM-dd HH:mm:ss"), |
|
|
|
CONFIRMTYPE = "1", |
|
|
|
EXAMPACKAGECODE = thirdBookingEnt.CustomerOrgGroupId, |
|
|
|
EXAMPACKAGEDESC = customerOrgGroupEnt.DisplayName, |
|
|
|
IDNO = thirdBookingEnt.IdNo, |
|
|
|
IDTYPE = thirdBookingEnt.IdType, |
|
|
|
MOBILE = thirdBookingEnt.Phone, |
|
|
|
NAME = patientRegisterEnt.PatientName, |
|
|
|
SOURCE = "BjGJ", |
|
|
|
YEAR = medicalYear, |
|
|
|
AGE = patientRegisterEnt.Age == null ? (short)0 : patientRegisterEnt.Age.Value, |
|
|
|
BIRTHDAY = patientRegisterEnt.BirthDate != null ? patientRegisterEnt.BirthDate.Value.ToString("yyyy-MM-dd") : "", |
|
|
|
EXAMBEGINTIME = patientRegisterEnt.MedicalStartDate != null ? patientRegisterEnt.MedicalStartDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", |
|
|
|
EXAMCOMPLETETIME = patientRegisterEnt.SummaryDate != null ? patientRegisterEnt.SummaryDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", |
|
|
|
EXAMID = patientRegisterEnt.Id.ToString(), |
|
|
|
GENDER = GetSexId(patientRegisterEnt.SexId) |
|
|
|
}; |
|
|
|
|
|
|
|
var inputPara = GetEncryptData(JsonConvert.SerializeObject(pushCompletePhysicalInput), iCode, publicKey, privateKey); |
|
|
|
|
|
|
|
var resultPara = await CallBookingAppServiceAsync<EncryDataRequstDto, EncryDataResultDto>(baseApiAddress, completeApiAddress, inputPara, "application/json;charset=utf-8"); |
|
|
|
|
|
|
|
if (resultPara.FLAG) |
|
|
|
iCode = thirdBookingEnt.ICode; |
|
|
|
} |
|
|
|
|
|
|
|
if (thirdBookingEnt.MedicalStatus == '1') |
|
|
|
{ |
|
|
|
var decryptDataPara = GetDecryptData<DecryptBaseDto>(resultPara, publicKey, privateKey); |
|
|
|
if (decryptDataPara.STATUS == 0) |
|
|
|
var customerOrgGroupEnt = await _customerOrgGroupRepository.GetAsync(g => g.Id == Guid.Parse(thirdBookingEnt.CustomerOrgGroupId)); |
|
|
|
|
|
|
|
var pushCompletePhysicalInput = new PushCompletePhysicalInputDto |
|
|
|
{ |
|
|
|
thirdBookingEnt.MedicalStatus = '2'; |
|
|
|
await _thirdBookingRepository.UpdateAsync(thirdBookingEnt); |
|
|
|
BOOKINGDATE = thirdBookingEnt.BookingDate.ToString("yyyy-MM-dd"), |
|
|
|
BOOKINGDATEDESC = "", |
|
|
|
BOOKINGID = patientRegisterEnt.ThirdBookingId, |
|
|
|
BOOKINGTIME = thirdBookingEnt.BookingDate.ToString("HH:mm:ss"), |
|
|
|
BOOKINGTYPE = "1", |
|
|
|
BOOKINGTYPEELSEDESC = "", |
|
|
|
CONFIRMORG = "MINZ", |
|
|
|
CONFIRMORGCENTERDESC = "民众", |
|
|
|
CONFIRMTIME = patientRegisterEnt.CreationTime.ToString("yyyy-MM-dd HH:mm:ss"), |
|
|
|
CONFIRMTYPE = "1", |
|
|
|
EXAMPACKAGECODE = thirdBookingEnt.CustomerOrgGroupId, |
|
|
|
EXAMPACKAGEDESC = customerOrgGroupEnt.DisplayName, |
|
|
|
IDNO = thirdBookingEnt.IdNo, |
|
|
|
IDTYPE = thirdBookingEnt.IdType, |
|
|
|
MOBILE = thirdBookingEnt.Phone, |
|
|
|
NAME = patientRegisterEnt.PatientName, |
|
|
|
SOURCE = "BjGJ", |
|
|
|
YEAR = medicalYear, |
|
|
|
AGE = patientRegisterEnt.Age == null ? (short)0 : patientRegisterEnt.Age.Value, |
|
|
|
BIRTHDAY = patientRegisterEnt.BirthDate != null ? patientRegisterEnt.BirthDate.Value.ToString("yyyy-MM-dd") : "", |
|
|
|
EXAMBEGINTIME = patientRegisterEnt.MedicalStartDate != null ? patientRegisterEnt.MedicalStartDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", |
|
|
|
EXAMCOMPLETETIME = patientRegisterEnt.SummaryDate != null ? patientRegisterEnt.SummaryDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", |
|
|
|
EXAMID = patientRegisterEnt.Id.ToString(), |
|
|
|
GENDER = GetSexId(patientRegisterEnt.SexId) |
|
|
|
}; |
|
|
|
|
|
|
|
var inputPara = GetEncryptData(JsonConvert.SerializeObject(pushCompletePhysicalInput), iCode, publicKey, privateKey); |
|
|
|
|
|
|
|
var resultPara = await CallBookingAppServiceAsync<EncryDataRequstDto, EncryDataResultDto>(baseApiAddress, completeApiAddress, inputPara, "application/json"); |
|
|
|
|
|
|
|
if (resultPara.FLAG) |
|
|
|
{ |
|
|
|
var decryptDataPara = GetDecryptData<DecryptBaseDto>(resultPara, publicKey, privateKey); |
|
|
|
if (decryptDataPara.STATUS == 0) |
|
|
|
{ |
|
|
|
thirdBookingEnt.MedicalStatus = '2'; |
|
|
|
await _thirdBookingRepository.UpdateAsync(thirdBookingEnt); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -237,6 +251,7 @@ namespace Shentun.Peis.ThirdBookingPushs |
|
|
|
var aesKey = interfaceConfig.GetSection("Interface").GetSection("AesKey").Value; |
|
|
|
var isActive = interfaceConfig.GetSection("Interface").GetSection("IsActive").Value; |
|
|
|
var medicalYear = interfaceConfig.GetSection("Interface").GetSection("MedicalYear").Value; |
|
|
|
var iCode = interfaceConfig.GetSection("Interface").GetSection("ICODE").Value; |
|
|
|
if (!string.IsNullOrWhiteSpace(isActive) |
|
|
|
&& isActive == "Y") |
|
|
|
{ |
|
|
|
@ -248,81 +263,89 @@ namespace Shentun.Peis.ThirdBookingPushs |
|
|
|
&& patientRegisterEnt.CompleteFlag == PatientRegisterCompleteFlag.SumCheck) |
|
|
|
{ |
|
|
|
var thirdBookingEnt = await _thirdBookingRepository.FirstOrDefaultAsync(f => f.Id == Guid.Parse(patientRegisterEnt.ThirdBookingId)); |
|
|
|
string iCode = thirdBookingEnt.ICode; |
|
|
|
if (thirdBookingEnt.MedicalStatus == '2') |
|
|
|
if (thirdBookingEnt != null) |
|
|
|
{ |
|
|
|
var customerOrgGroupEnt = await _customerOrgGroupRepository.GetAsync(g => g.Id == Guid.Parse(thirdBookingEnt.CustomerOrgGroupId)); |
|
|
|
if (!string.IsNullOrWhiteSpace(thirdBookingEnt.ICode)) |
|
|
|
{ |
|
|
|
iCode = thirdBookingEnt.ICode; |
|
|
|
} |
|
|
|
if (thirdBookingEnt.MedicalStatus == '2') |
|
|
|
{ |
|
|
|
var customerOrgGroupEnt = await _customerOrgGroupRepository.GetAsync(g => g.Id == Guid.Parse(thirdBookingEnt.CustomerOrgGroupId)); |
|
|
|
|
|
|
|
|
|
|
|
#region 上传文件
|
|
|
|
byte[] filebytes = Convert.FromBase64String(input.ReportBase64); |
|
|
|
string fileDataEncrypt = AesHelper.AESEncrypt(filebytes, aesKey); |
|
|
|
string fileSign = AesHelper.GetMD5Hash(fileDataEncrypt); |
|
|
|
var fileInputParm = new EncryDataRequstDto |
|
|
|
{ |
|
|
|
DATA = fileDataEncrypt, |
|
|
|
SIGN = fileSign, |
|
|
|
ICODE = thirdBookingEnt.ICode |
|
|
|
}; |
|
|
|
#region 上传文件
|
|
|
|
byte[] filebytes = Convert.FromBase64String(input.ReportBase64); //字节数组
|
|
|
|
byte[] fileDataEncrypt = AesHelper.AESEncrypt(filebytes, aesKey); |
|
|
|
string fileSign = AesHelper.GetMD5Hash2(fileDataEncrypt); |
|
|
|
|
|
|
|
var fileResultEncry = await CallBookingAppServiceAsync<EncryDataRequstDto, EncryDataResultDto>(baseApiAddress, completeApiAddress, fileInputParm, "multipart/form-data"); |
|
|
|
|
|
|
|
|
|
|
|
if (fileResultEncry.FLAG) |
|
|
|
{ |
|
|
|
//验签
|
|
|
|
if (fileResultEncry.SIGN == AesHelper.GetMD5Hash(fileResultEncry.DATA)) |
|
|
|
var fileInputParm = new EncryDataRequstDto |
|
|
|
{ |
|
|
|
//解密
|
|
|
|
string fileResultStr = AesHelper.AESDecrypt(fileResultEncry.DATA, aesKey); //报文ID
|
|
|
|
SIGN = fileSign, |
|
|
|
ICODE = thirdBookingEnt.ICode |
|
|
|
}; |
|
|
|
|
|
|
|
var fileResultEncry = await CallBookingFileAppServiceAsync<EncryDataResultDto>(baseApiAddress, completeApiAddress, fileInputParm, fileDataEncrypt, "006429_民众测试.pdf"); |
|
|
|
|
|
|
|
#region 上传报告
|
|
|
|
|
|
|
|
var pushMedicalReportInput = new PushMedicalReportInputDto |
|
|
|
{ |
|
|
|
EXAMPACKAGECODE = thirdBookingEnt.CustomerOrgGroupId, |
|
|
|
IDNO = thirdBookingEnt.IdNo, |
|
|
|
IDTYPE = thirdBookingEnt.IdType, |
|
|
|
NAME = patientRegisterEnt.PatientName, |
|
|
|
SOURCE = "BjGJ", |
|
|
|
YEAR = medicalYear, |
|
|
|
BUSINESSID = patientRegisterEnt.Id.ToString(), |
|
|
|
JSONBASE64 = "", |
|
|
|
ORGCODE = "MINZ", |
|
|
|
PDFBASE64 = "", |
|
|
|
PDFFILEID = fileResultStr, |
|
|
|
PUSHTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var pushMedicalReportInputEncrypt = GetEncryptData(JsonConvert.SerializeObject(pushMedicalReportInput), iCode, publicKey, privateKey); |
|
|
|
|
|
|
|
var reportResultPara = await CallBookingAppServiceAsync<EncryDataRequstDto, EncryDataResultDto>(baseApiAddress, completeApiAddress, pushMedicalReportInputEncrypt, "application/json;charset=utf-8"); |
|
|
|
|
|
|
|
if (reportResultPara.FLAG) |
|
|
|
if (fileResultEncry.FLAG) |
|
|
|
{ |
|
|
|
//验签
|
|
|
|
if (fileResultEncry.SIGN == AesHelper.GetMD5Hash(fileResultEncry.DATA)) |
|
|
|
{ |
|
|
|
var decryptDataPara = GetDecryptData<PushReportDecryptDto>(reportResultPara, publicKey, privateKey); |
|
|
|
if (decryptDataPara.FLAG == true) |
|
|
|
//解密
|
|
|
|
string fileResultStr = AesHelper.AESDecrypt(fileResultEncry.DATA, aesKey); //报文ID
|
|
|
|
|
|
|
|
|
|
|
|
#region 上传报告
|
|
|
|
|
|
|
|
var pushMedicalReportInput = new PushMedicalReportInputDto |
|
|
|
{ |
|
|
|
thirdBookingEnt.MedicalStatus = '3'; |
|
|
|
await _thirdBookingRepository.UpdateAsync(thirdBookingEnt); |
|
|
|
EXAMPACKAGECODE = thirdBookingEnt.CustomerOrgGroupId, |
|
|
|
IDNO = thirdBookingEnt.IdNo, |
|
|
|
IDTYPE = thirdBookingEnt.IdType, |
|
|
|
NAME = patientRegisterEnt.PatientName, |
|
|
|
SOURCE = "BjGJ", |
|
|
|
YEAR = medicalYear, |
|
|
|
BUSINESSID = patientRegisterEnt.Id.ToString(), |
|
|
|
JSONBASE64 = "", |
|
|
|
ORGCODE = "MINZ", |
|
|
|
PDFBASE64 = "", |
|
|
|
PDFFILEID = fileResultStr, |
|
|
|
PUSHTIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var pushMedicalReportInputEncrypt = GetEncryptData(JsonConvert.SerializeObject(pushMedicalReportInput), iCode, publicKey, privateKey); |
|
|
|
|
|
|
|
var reportResultPara = await CallBookingAppServiceAsync<EncryDataRequstDto, EncryDataResultDto>(baseApiAddress, completeApiAddress, pushMedicalReportInputEncrypt, "application/json;charset=utf-8"); |
|
|
|
|
|
|
|
if (reportResultPara.FLAG) |
|
|
|
{ |
|
|
|
var decryptDataPara = GetDecryptData<PushReportDecryptDto>(reportResultPara, publicKey, privateKey); |
|
|
|
if (decryptDataPara.FLAG == true) |
|
|
|
{ |
|
|
|
thirdBookingEnt.MedicalStatus = '3'; |
|
|
|
await _thirdBookingRepository.UpdateAsync(thirdBookingEnt); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -359,7 +382,11 @@ namespace Shentun.Peis.ThirdBookingPushs |
|
|
|
var sendData = JsonConvert.SerializeObject(data); |
|
|
|
using (HttpContent httpContent = new StringContent(sendData)) |
|
|
|
{ |
|
|
|
httpContent.Headers.ContentType = new MediaTypeHeaderValue(contentType); |
|
|
|
var mediaTypeHeaderValue = new System.Net.Http.Headers.MediaTypeHeaderValue(contentType); |
|
|
|
mediaTypeHeaderValue.CharSet = "utf-8"; |
|
|
|
|
|
|
|
httpContent.Headers.ContentType = mediaTypeHeaderValue; |
|
|
|
|
|
|
|
HttpResponseMessage response = null; |
|
|
|
if (method == "post") |
|
|
|
{ |
|
|
|
@ -389,6 +416,85 @@ namespace Shentun.Peis.ThirdBookingPushs |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 发起请求 上传文件
|
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TOut"></typeparam>
|
|
|
|
/// <param name="baseApiAddress"></param>
|
|
|
|
/// <param name="url"></param>
|
|
|
|
/// <param name="data"></param>
|
|
|
|
/// <param name="fileBytes"></param>
|
|
|
|
/// <param name="fileName"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
private async Task<TOut> CallBookingFileAppServiceAsync<TOut>(string baseApiAddress, string url, EncryDataRequstDto data, byte[] fileBytes, string fileName) |
|
|
|
{ |
|
|
|
using (var httpClientHandler = new HttpClientHandler()) |
|
|
|
{ |
|
|
|
using (var httpClient = new HttpClient(httpClientHandler)) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
httpClient.Timeout = TimeSpan.FromMilliseconds(600000); |
|
|
|
|
|
|
|
httpClient.BaseAddress = new Uri(baseApiAddress); |
|
|
|
|
|
|
|
httpClient.DefaultRequestHeaders.Accept.Add( |
|
|
|
new MediaTypeWithQualityHeaderValue("application/json"));//设置accept标头,告诉JSON是可接受的响应类型
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using (MultipartFormDataContent multipartContent = new MultipartFormDataContent()) |
|
|
|
{ |
|
|
|
// 添加文本字段
|
|
|
|
var icode = new StringContent(data.ICODE); |
|
|
|
icode.Headers.ContentDisposition= new System.Net.Http.Headers.ContentDispositionHeaderValue("form-data") |
|
|
|
{ |
|
|
|
Name = "ICODE" |
|
|
|
}; |
|
|
|
var sign = new StringContent(data.SIGN); |
|
|
|
icode.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("form-data") |
|
|
|
{ |
|
|
|
Name = "SIGN" |
|
|
|
}; |
|
|
|
|
|
|
|
//multipartContent.Add(new StringContent(data.ICODE), "ICODE");
|
|
|
|
//multipartContent.Add(new StringContent(data.SIGN), "SIGN");
|
|
|
|
// 添加文件
|
|
|
|
ByteArrayContent fileContent = new ByteArrayContent(fileBytes); |
|
|
|
fileContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream"); |
|
|
|
multipartContent.Add(fileContent, "DATA", fileName); |
|
|
|
|
|
|
|
multipartContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("multipart/form-data"); |
|
|
|
|
|
|
|
HttpResponseMessage response = null; |
|
|
|
|
|
|
|
response = await httpClient.PostAsync(url, multipartContent); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string result; |
|
|
|
if (!response.IsSuccessStatusCode) |
|
|
|
{ |
|
|
|
result = response.Content.ReadAsStringAsync().Result; |
|
|
|
//throw new Exception("http通信错误:" + response.StatusCode + ",结果:" + result);
|
|
|
|
} |
|
|
|
result = await response.Content.ReadAsStringAsync(); |
|
|
|
|
|
|
|
var resultDto = JsonConvert.DeserializeObject<TOut>(result); |
|
|
|
|
|
|
|
return resultDto; |
|
|
|
} |
|
|
|
|
|
|
|
//// 创建MultipartFormDataContent实例
|
|
|
|
//MultipartFormDataContent multipartContent = new MultipartFormDataContent();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 生成请求密文数据
|
|
|
|
/// </summary>
|
|
|
|
|