|
|
|
@ -3,18 +3,23 @@ using Microsoft.AspNetCore.Http; |
|
|
|
using Microsoft.AspNetCore.Http.Internal; |
|
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
using Microsoft.Extensions.Configuration; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using Microsoft.Net.Http.Headers; |
|
|
|
using Newtonsoft.Json; |
|
|
|
using NPOI.HPSF; |
|
|
|
using NPOI.OpenXmlFormats.Vml; |
|
|
|
using NPOI.SS.Formula.Functions; |
|
|
|
using NPOI.Util; |
|
|
|
using Shentun.Peis.CustomerOrgRegisters; |
|
|
|
using Shentun.Peis.Enums; |
|
|
|
using Shentun.Peis.Models; |
|
|
|
using Shentun.Peis.PatientRegisters; |
|
|
|
using Shentun.Peis.TransToWebPeis; |
|
|
|
using Spire.Pdf.Exporting.XPS.Schema; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.IO; |
|
|
|
using System.Linq; |
|
|
|
using System.Net.Http; |
|
|
|
using System.Net.Http.Headers; |
|
|
|
using System.Net.Mime; |
|
|
|
@ -41,17 +46,22 @@ namespace Shentun.Peis.ThirdBookingPushs |
|
|
|
private readonly IRepository<PatientRegister, Guid> _patientRegisterRepository; |
|
|
|
private readonly IRepository<ThirdBooking, Guid> _thirdBookingRepository; |
|
|
|
private readonly IRepository<CustomerOrgGroup, Guid> _customerOrgGroupRepository; |
|
|
|
private readonly IRepository<Patient, Guid> _patientRepository; |
|
|
|
private readonly ILogger<ThirdBookingPushAppService> _logger; |
|
|
|
public ThirdBookingPushAppService( |
|
|
|
IRepository<ThirdInterface, Guid> thirdInterfaceRepository, |
|
|
|
IRepository<PatientRegister, Guid> patientRegisterRepository, |
|
|
|
IRepository<ThirdBooking, Guid> thirdBookingRepository, |
|
|
|
IRepository<CustomerOrgGroup, Guid> customerOrgGroupRepository |
|
|
|
) |
|
|
|
IRepository<CustomerOrgGroup, Guid> customerOrgGroupRepository, |
|
|
|
IRepository<Patient, Guid> patientRepository, |
|
|
|
ILogger<ThirdBookingPushAppService> logger) |
|
|
|
{ |
|
|
|
_thirdInterfaceRepository = thirdInterfaceRepository; |
|
|
|
_patientRegisterRepository = patientRegisterRepository; |
|
|
|
_thirdBookingRepository = thirdBookingRepository; |
|
|
|
_customerOrgGroupRepository = customerOrgGroupRepository; |
|
|
|
_patientRepository = patientRepository; |
|
|
|
_logger = logger; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -105,12 +115,12 @@ namespace Shentun.Peis.ThirdBookingPushs |
|
|
|
BOOKINGDATEDESC = "", |
|
|
|
BOOKINGID = patientRegisterEnt.ThirdBookingId, |
|
|
|
BOOKINGTIME = thirdBookingEnt.BookingDate.ToString("HH:mm:ss"), |
|
|
|
BOOKINGTYPE = "1", |
|
|
|
BOOKINGTYPE = thirdBookingEnt.BookingType, |
|
|
|
BOOKINGTYPEELSEDESC = "", |
|
|
|
CONFIRMORG = "MINZ", |
|
|
|
CONFIRMORGCENTERDESC = "民众", |
|
|
|
CONFIRMTIME = patientRegisterEnt.CreationTime.ToString("yyyy-MM-dd HH:mm:ss"), |
|
|
|
CONFIRMTYPE = "1", |
|
|
|
CONFIRMTYPE = thirdBookingEnt.ConfirmType, |
|
|
|
EXAMPACKAGECODE = thirdBookingEnt.CustomerOrgGroupId, |
|
|
|
EXAMPACKAGEDESC = customerOrgGroupEnt.DisplayName, |
|
|
|
IDNO = thirdBookingEnt.IdNo, |
|
|
|
@ -202,12 +212,12 @@ namespace Shentun.Peis.ThirdBookingPushs |
|
|
|
BOOKINGDATEDESC = "", |
|
|
|
BOOKINGID = patientRegisterEnt.ThirdBookingId, |
|
|
|
BOOKINGTIME = thirdBookingEnt.BookingDate.ToString("HH:mm:ss"), |
|
|
|
BOOKINGTYPE = "1", |
|
|
|
BOOKINGTYPE = thirdBookingEnt.BookingType, |
|
|
|
BOOKINGTYPEELSEDESC = "", |
|
|
|
CONFIRMORG = "MINZ", |
|
|
|
CONFIRMORGCENTERDESC = "民众", |
|
|
|
CONFIRMTIME = patientRegisterEnt.CreationTime.ToString("yyyy-MM-dd HH:mm:ss"), |
|
|
|
CONFIRMTYPE = "1", |
|
|
|
CONFIRMTYPE = thirdBookingEnt.ConfirmType, |
|
|
|
EXAMPACKAGECODE = thirdBookingEnt.CustomerOrgGroupId, |
|
|
|
EXAMPACKAGEDESC = customerOrgGroupEnt.DisplayName, |
|
|
|
IDNO = thirdBookingEnt.IdNo, |
|
|
|
@ -234,7 +244,7 @@ namespace Shentun.Peis.ThirdBookingPushs |
|
|
|
if (decryptDataPara.STATUS == 0) |
|
|
|
{ |
|
|
|
thirdBookingEnt.MedicalStatus = '2'; |
|
|
|
await _thirdBookingRepository.UpdateAsync(thirdBookingEnt); |
|
|
|
await _thirdBookingRepository.UpdateAsync(thirdBookingEnt, true); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
@ -354,7 +364,7 @@ namespace Shentun.Peis.ThirdBookingPushs |
|
|
|
if (decryptDataPara.FLAG == true) |
|
|
|
{ |
|
|
|
thirdBookingEnt.MedicalStatus = '3'; |
|
|
|
await _thirdBookingRepository.UpdateAsync(thirdBookingEnt); |
|
|
|
await _thirdBookingRepository.UpdateAsync(thirdBookingEnt, true); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
@ -573,5 +583,121 @@ namespace Shentun.Peis.ThirdBookingPushs |
|
|
|
return SexName; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 同步人工导入的预约Id,绑定到登记的人身上
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("api/app/ThirdBookingPush/SyncThirdBookingToPatientRegister")] |
|
|
|
public async Task SyncThirdBookingToPatientRegisterAsync(CustomerOrgRegisterIdInputDto input) |
|
|
|
{ |
|
|
|
var patientRegisterList = (from patientRegister in await _patientRegisterRepository.GetQueryableAsync() |
|
|
|
join patient in await _patientRepository.GetQueryableAsync() on patientRegister.PatientId equals patient.Id |
|
|
|
where patientRegister.CustomerOrgRegisterId == input.CustomerOrgRegisterId |
|
|
|
&& string.IsNullOrWhiteSpace(patientRegister.ThirdBookingId) |
|
|
|
select new |
|
|
|
{ |
|
|
|
patientRegister, |
|
|
|
patient.IdNo |
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
var thirdBookingList = await _thirdBookingRepository.GetListAsync(m => m.MedicalStatus == '0'); |
|
|
|
|
|
|
|
foreach (var item in patientRegisterList) |
|
|
|
{ |
|
|
|
var thirdBookingEnt = thirdBookingList.FirstOrDefault(f => f.PatientName == item.patientRegister.PatientName && f.IdNo == item.IdNo); |
|
|
|
if (thirdBookingEnt != null) |
|
|
|
{ |
|
|
|
item.patientRegister.ThirdBookingId = thirdBookingEnt.Id.ToString(); |
|
|
|
await _patientRegisterRepository.UpdateAsync(item.patientRegister); |
|
|
|
_logger.LogInformation($"-----同步预约到登记成功,姓名:{item.patientRegister.PatientName},身份证号:{item.IdNo},登记ID为:{item.patientRegister.Id},预约ID为:{thirdBookingEnt.Id}"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 临时手动推送确认登记 到人寿
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("api/app/ThirdBookingPush/PushMedicalRegister")] |
|
|
|
public async Task PushMedicalRegisterAsync(CustomerOrgRegisterIdInputDto input) |
|
|
|
{ |
|
|
|
var patientRegisterList = (from patientRegister in await _patientRegisterRepository.GetQueryableAsync() |
|
|
|
join patient in await _patientRepository.GetQueryableAsync() on patientRegister.PatientId equals patient.Id |
|
|
|
join thirdBooking in await _thirdBookingRepository.GetQueryableAsync() on patientRegister.ThirdBookingId equals thirdBooking.Id.ToString() |
|
|
|
where patientRegister.CustomerOrgRegisterId == input.CustomerOrgRegisterId |
|
|
|
&& thirdBooking.MedicalStatus == '0' |
|
|
|
select new |
|
|
|
{ |
|
|
|
patientRegister, |
|
|
|
thirdBooking |
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in patientRegisterList) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
//推送到店登记
|
|
|
|
await PushRegisterAsync(new PatientRegisterIdInputDto |
|
|
|
{ |
|
|
|
PatientRegisterId = item.patientRegister.Id |
|
|
|
}); |
|
|
|
} |
|
|
|
catch (Exception ex) { |
|
|
|
_logger.LogInformation($"-----推送到店登记异常:{ex.Message}"); |
|
|
|
} |
|
|
|
|
|
|
|
_logger.LogInformation($"-----推送到店登记成功,姓名:{item.patientRegister.PatientName},登记ID为:{item.patientRegister.Id}"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 临时手动推送体检完成 到人寿
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="input"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
[HttpPost("api/app/ThirdBookingPush/PushMedicalComplate")] |
|
|
|
public async Task PushMedicalComplateAsync(CustomerOrgRegisterIdInputDto input) |
|
|
|
{ |
|
|
|
var patientRegisterList = (from patientRegister in await _patientRegisterRepository.GetQueryableAsync() |
|
|
|
join patient in await _patientRepository.GetQueryableAsync() on patientRegister.PatientId equals patient.Id |
|
|
|
join thirdBooking in await _thirdBookingRepository.GetQueryableAsync() on patientRegister.ThirdBookingId equals thirdBooking.Id.ToString() |
|
|
|
where patientRegister.CustomerOrgRegisterId == input.CustomerOrgRegisterId |
|
|
|
&& thirdBooking.MedicalStatus == '1' |
|
|
|
select new |
|
|
|
{ |
|
|
|
patientRegister, |
|
|
|
thirdBooking |
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in patientRegisterList) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
//推送体检完成
|
|
|
|
await PushCompletePhysicalAsync(new PatientRegisterIdInputDto |
|
|
|
{ |
|
|
|
PatientRegisterId = item.patientRegister.Id |
|
|
|
}); |
|
|
|
} |
|
|
|
catch(Exception ex) { |
|
|
|
_logger.LogInformation($"-----推送体检完成异常:{ex.Message}"); |
|
|
|
} |
|
|
|
|
|
|
|
_logger.LogInformation($"-----推送体检完成成功,姓名:{item.patientRegister.PatientName},,登记ID为:{item.patientRegister.Id}"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |