Browse Source

青藏铁路

bjmzak
DESKTOP-G961P6V\Zhh 2 years ago
parent
commit
e6f8da2e0c
  1. 126
      ThirdPlugIns/Shentun.Peis.PlugIns.Gem/PatientRegisters/Qztl/ImportPatientRegisterPlugInsQztl.cs
  2. 6
      ThirdPlugIns/Shentun.Peis.PlugIns.Gem/test/Shentun.Peis.PlugIns.Gem.Test/ImportPatientRegisterPlugInsHzcyTest.cs
  3. 4
      src/Shentun.ColumnReferencePlugIns/PatientRegisters/ImportPatientRegisterPlugInsBase.cs
  4. 2
      src/Shentun.Peis.Application.Contracts/CustomerOrgRegisters/CustomerOrgRegisterIdInputDto.cs
  5. 1
      src/Shentun.Peis.Application/Asbitems/AsbitemAppService.cs
  6. 1
      src/Shentun.Peis.Application/CustomerOrgGroups/CustomerOrgGroupAppService.cs
  7. 11
      src/Shentun.Peis.Application/CustomerOrgRegisters/CustomerOrgRegisterAppService.cs
  8. 8
      src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs

126
ThirdPlugIns/Shentun.Peis.PlugIns.Gem/PatientRegisters/Qztl/ImportPatientRegisterPlugInsQztl.cs

@ -36,6 +36,7 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl
private CustomerOrgRegisterDto _customerOrgRegisterDto; private CustomerOrgRegisterDto _customerOrgRegisterDto;
private List<PersonnelTypeDto> _personnelTypes; private List<PersonnelTypeDto> _personnelTypes;
private List<CustomerOrgGroupDto> _customerOrgGroupDtos; private List<CustomerOrgGroupDto> _customerOrgGroupDtos;
private Guid _customerOrgRegisterId;
private string _answerWebApiUrl; private string _answerWebApiUrl;
public ImportPatientRegisterPlugInsQztl(Guid thirdInterfaceId) : base(thirdInterfaceId) public ImportPatientRegisterPlugInsQztl(Guid thirdInterfaceId) : base(thirdInterfaceId)
@ -48,54 +49,71 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl
} }
public override async Task ImportAsync()
public override async Task<List<string>> ImportAsync(Guid customerOrgRegisterId)
{ {
_customerOrgRegisterId = customerOrgRegisterId;
if(_customerOrgRegisterId == Guid.Empty)
{
throw new Exception("customerOrgRegisterId参数不能为空");
}
await LoginAsync(); await LoginAsync();
await InitAsync(); await InitAsync();
var errorList = new List<string>();
var qztlPatientRegisterFromInterface = await CallInterfaceServiceAsync(); var qztlPatientRegisterFromInterface = await CallInterfaceServiceAsync();
if (qztlPatientRegisterFromInterface == null) if (qztlPatientRegisterFromInterface == null)
{ {
return;
return errorList;
} }
//删除人员 //删除人员
if(qztlPatientRegisterFromInterface.delIds != null)
if (qztlPatientRegisterFromInterface.delIds != null)
{ {
foreach (var deleteUserId in qztlPatientRegisterFromInterface.delIds) foreach (var deleteUserId in qztlPatientRegisterFromInterface.delIds)
{ {
var patientRegister = await GetPatientRegisterByPlanUserId(deleteUserId);
if (patientRegister == null)
var error = deleteUserId;
try
{ {
continue;
var patientRegister = await GetPatientRegisterByPlanUserId(deleteUserId);
if (patientRegister == null)
{
continue;
}
if (patientRegister.CompleteFlag != PatientRegisterCompleteFlag.PreRegistration &&
patientRegister.CompleteFlag != PatientRegisterCompleteFlag.Registration)
{
//已检人员不允许删除
continue;
}
var patientRegisterInputDto = new PatientRegisterIdInputDto()
{
PatientRegisterId = patientRegister.PatientRegisterId
};
await CallAppServiceAsync<PatientRegisterIdInputDto, object>(
"api/app/PatientRegister/DeleteById", patientRegisterInputDto);
//发送答复通知
var succesIds = new List<string>();
var deleteIds = new List<string>();
deleteIds.Add(deleteUserId);
await AnswerOk(succesIds, deleteIds);
} }
if (patientRegister.CompleteFlag != PatientRegisterCompleteFlag.PreRegistration &&
patientRegister.CompleteFlag != PatientRegisterCompleteFlag.Registration)
catch (Exception ex)
{ {
//已检人员不允许删除
errorList.Add(error + ex.Message);
continue; continue;
} }
var patientRegisterInputDto = new PatientRegisterIdInputDto()
{
PatientRegisterId = patientRegister.PatientRegisterId
};
await CallAppServiceAsync<PatientRegisterIdInputDto, object>(
"api/app/PatientRegister/DeleteById", patientRegisterInputDto);
//发送答复通知
var succesIds = new List<string>();
var deleteIds = new List<string>();
deleteIds.Add(deleteUserId);
await AnswerOk(succesIds, deleteIds);
} }
} }
if (qztlPatientRegisterFromInterface.plans == null) if (qztlPatientRegisterFromInterface.plans == null)
{ {
return;
return errorList;
} }
//设置导入人员信息 //设置导入人员信息
foreach (var patient in qztlPatientRegisterFromInterface.plans) foreach (var patient in qztlPatientRegisterFromInterface.plans)
{ {
var error = $"姓名:{patient.personName},身份证:{patient.cardId}";
try try
{ {
//婚姻状况 //婚姻状况
@ -177,7 +195,7 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl
_customerOrgGroupDtos = await CallAppServiceAsync<Guid, List<CustomerOrgGroupDto>>( _customerOrgGroupDtos = await CallAppServiceAsync<Guid, List<CustomerOrgGroupDto>>(
"api/app/customer-org-group/in-customer-org-id/" + _importCustomerOrgId.ToString() "api/app/customer-org-group/in-customer-org-id/" + _importCustomerOrgId.ToString()
, Guid.Empty, "get"); , Guid.Empty, "get");
customerOrgGroupDto = _customerOrgGroupDtos.Where(o => o.DisplayName == "复检").FirstOrDefault();
customerOrgGroupDto = _customerOrgGroupDtos.Where(o => o.DisplayName == "复检").FirstOrDefault();
if (customerOrgGroupDto == null) if (customerOrgGroupDto == null)
{ {
throw new Exception("没有复检这个分组"); throw new Exception("没有复检这个分组");
@ -237,7 +255,7 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl
IsNoPlanUserIdComplete = true; IsNoPlanUserIdComplete = true;
} }
//已经登记了该PlanUserId的不再登记 //已经登记了该PlanUserId的不再登记
if(!string.IsNullOrWhiteSpace(patintRegister.Planuserid) && patintRegister.Planuserid == patient.id.ToString())
if (!string.IsNullOrWhiteSpace(patintRegister.Planuserid) && patintRegister.Planuserid == patient.id.ToString())
{ {
await AnswerOk(succesIds, deleteIds); await AnswerOk(succesIds, deleteIds);
IsNoPlanUserIdComplete = true; IsNoPlanUserIdComplete = true;
@ -346,24 +364,32 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl
catch (Exception ex) catch (Exception ex)
{ {
if (ex.Message.Contains("人员信息姓名和性别和原来的信息都不一致") ||
ex.Message.Contains("身份证号解析出的性别与填入的性别不一致"))
{
continue;
}
else
{
throw ex;
}
errorList.Add(error + ",错误信息:"+ex.Message);
continue;
//throw new Exception(error + ex.Message);
//if (ex.Message.Contains("人员信息姓名和性别和原来的信息都不一致") ||
// ex.Message.Contains("身份证号解析出的性别与填入的性别不一致"))
//{
// continue;
//}
//else
//{
// throw ex;
//}
} }
} }
return errorList;
} }
public async Task InitAsync() public async Task InitAsync()
{ {
if (_customerOrgRegisterId == Guid.Empty)
{
throw new Exception("customerOrgRegisterId参数不能为空");
}
var customerOrgIdStr = InterfaceConfig.GetSection("Interface").GetSection("单位编号").Value; var customerOrgIdStr = InterfaceConfig.GetSection("Interface").GetSection("单位编号").Value;
_hospitalId = InterfaceConfig.GetSection("Interface").GetSection("HospitalId").Value; _hospitalId = InterfaceConfig.GetSection("Interface").GetSection("HospitalId").Value;
_aesKEY = InterfaceConfig.GetSection("Interface").GetSection("aesKEY").Value; _aesKEY = InterfaceConfig.GetSection("Interface").GetSection("aesKEY").Value;
@ -372,6 +398,7 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl
{ {
return; return;
} }
if (!Guid.TryParse(customerOrgIdStr, out _importCustomerOrgId)) if (!Guid.TryParse(customerOrgIdStr, out _importCustomerOrgId))
{ {
throw new Exception("单位编号不正确"); throw new Exception("单位编号不正确");
@ -388,20 +415,20 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl
{ {
string sql; string sql;
sql = @" sql = @"
SELECT id as customer_org_id,
display_name as customer_org_name,
parent_id ,
path_code
from
customer_org
where id = @CustomerOrgId
SELECT customer_org.id as customer_org_id,
customer_org.display_name as customer_org_name,
customer_org.parent_id as parent_id,
customer_org.path_code as path_code
from customer_org ,customer_org_register
where customer_org.id = customer_org_register.customer_org_id and
customer_org_register.id = @CustomerOrgRegisterId
"; ";
var customerOrgForPlugInss = (await conn.QueryAsync<CustomerOrgForPlugIns>(sql, var customerOrgForPlugInss = (await conn.QueryAsync<CustomerOrgForPlugIns>(sql,
new { CustomerOrgId = _importCustomerOrgId })).FirstOrDefault();
new { CustomerOrgRegisterId = _customerOrgRegisterId })).FirstOrDefault();
if (customerOrgForPlugInss == null) if (customerOrgForPlugInss == null)
{ {
throw new Exception("单位编号不正确,找不到单位");
throw new Exception("单位登记次数不正确,找不到单位");
} }
var year = customerOrgForPlugInss.CustomerOrgName.Substring( var year = customerOrgForPlugInss.CustomerOrgName.Substring(
@ -417,6 +444,7 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl
} }
_year = year; _year = year;
_importCustomerOrgId = customerOrgForPlugInss.CustomerOrgId;
} }
//加载单位信息 //加载单位信息
_customerOrgDto = await CallAppServiceAsync<CustomerOrgIdInputDto, CustomerOrgDto>( _customerOrgDto = await CallAppServiceAsync<CustomerOrgIdInputDto, CustomerOrgDto>(
@ -425,10 +453,10 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl
CustomerOrgId = _importCustomerOrgId, CustomerOrgId = _importCustomerOrgId,
}); });
//加载单位登记信息 //加载单位登记信息
_customerOrgRegisterDto = await CallAppServiceAsync<CustomerOrgIdInputDto, CustomerOrgRegisterDto>(
"api/app/CustomerOrgRegister/GetLastCustomerOrgRegisterByCustomerOrgId", new CustomerOrgIdInputDto()
_customerOrgRegisterDto = await CallAppServiceAsync<CustomerOrgRegisterIdInputDto, CustomerOrgRegisterDto>(
"api/app/CustomerOrgRegister/GetById", new CustomerOrgRegisterIdInputDto()
{ {
CustomerOrgId = _importCustomerOrgId,
CustomerOrgRegisterId = _customerOrgRegisterId,
}); });
//加载人员类别列表 //加载人员类别列表
_personnelTypes = await CallAppServiceAsync<string, List<PersonnelTypeDto>>("api/app/PersonnelType/GetAll", ""); _personnelTypes = await CallAppServiceAsync<string, List<PersonnelTypeDto>>("api/app/PersonnelType/GetAll", "");
@ -454,7 +482,7 @@ namespace Shentun.Peis.PlugIns.Extensions.PatientRegisters.Qztl
} }
public async Task<PatientRegisterQztl> GetPatientRegisterByPlanUserId(string planUserId) public async Task<PatientRegisterQztl> GetPatientRegisterByPlanUserId(string planUserId)
{ {
if(string.IsNullOrWhiteSpace(planUserId))
if (string.IsNullOrWhiteSpace(planUserId))
{ {
throw new Exception("planUserId不能为空"); throw new Exception("planUserId不能为空");
} }

6
ThirdPlugIns/Shentun.Peis.PlugIns.Gem/test/Shentun.Peis.PlugIns.Gem.Test/ImportPatientRegisterPlugInsHzcyTest.cs

@ -27,7 +27,11 @@ namespace Shentun.Peis.PlugIns.Extensions.Test
configParm = File.ReadAllText(filePath); configParm = File.ReadAllText(filePath);
var input = new ImportPatientRegisterPlugInsQztl(new Guid("7f2b453c-e45c-44bf-ba6b-9ef192a3cf88")); var input = new ImportPatientRegisterPlugInsQztl(new Guid("7f2b453c-e45c-44bf-ba6b-9ef192a3cf88"));
await input.ImportAsync();
var errorList = await input.ImportAsync(new Guid("3a126b36-b71a-e626-e8be-17d47216f927"));
foreach ( var item in errorList )
{
_output.WriteLine(item);
}
} }

4
src/Shentun.ColumnReferencePlugIns/PatientRegisters/ImportPatientRegisterPlugInsBase.cs

@ -16,9 +16,9 @@ namespace Shentun.Peis.PlugIns.PatientRegisters
{ {
} }
public virtual async Task ImportAsync()
public virtual async Task<List<string>> ImportAsync(Guid customerOrgRegisterId)
{ {
return;
throw new NotImplementedException();
} }
} }
} }

2
src/Shentun.Peis.Application.Contracts/CustomerOrgGroups/CustomerOrgRegisterIdInputDto.cs → src/Shentun.Peis.Application.Contracts/CustomerOrgRegisters/CustomerOrgRegisterIdInputDto.cs

@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Shentun.Peis.CustomerOrgGroups
namespace Shentun.Peis.CustomerOrgRegisters
{ {
public class CustomerOrgRegisterIdInputDto public class CustomerOrgRegisterIdInputDto
{ {

1
src/Shentun.Peis.Application/Asbitems/AsbitemAppService.cs

@ -124,6 +124,7 @@ namespace Shentun.Peis.Asbitems
DisplayName = s.a.DisplayName, DisplayName = s.a.DisplayName,
DisplayOrder = s.a.DisplayOrder, DisplayOrder = s.a.DisplayOrder,
ForSexId = s.a.ForSexId, ForSexId = s.a.ForSexId,
MaritalStatusId = s.a.MaritalStatusId,
Id = s.a.Id, Id = s.a.Id,
CollectItemTypeId = s.a.CollectItemTypeId, CollectItemTypeId = s.a.CollectItemTypeId,
//InvoiceItemTypeId = s.a.InvoiceItemTypeId, //InvoiceItemTypeId = s.a.InvoiceItemTypeId,

1
src/Shentun.Peis.Application/CustomerOrgGroups/CustomerOrgGroupAppService.cs

@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Shentun.Peis.CustomerOrgGroupDetails; using Shentun.Peis.CustomerOrgGroupDetails;
using Shentun.Peis.CustomerOrgGroups; using Shentun.Peis.CustomerOrgGroups;
using Shentun.Peis.CustomerOrgRegisters;
using Shentun.Peis.CustomerOrgs; using Shentun.Peis.CustomerOrgs;
using Shentun.Peis.HelperDto; using Shentun.Peis.HelperDto;
using Shentun.Peis.Models; using Shentun.Peis.Models;

11
src/Shentun.Peis.Application/CustomerOrgRegisters/CustomerOrgRegisterAppService.cs

@ -63,6 +63,17 @@ namespace Shentun.Peis.CustomerOrgRegisters
{ {
return await base.GetAsync(id); return await base.GetAsync(id);
} }
/// <summary>
/// 获取通过主键
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("api/app/CustomerOrgRegister/GetById")]
public async Task<CustomerOrgRegisterDto> GetByIdAsync(CustomerOrgRegisterIdInputDto input)
{
return await base.GetAsync(input.CustomerOrgRegisterId);
}
/// <summary> /// <summary>
/// 获取列表 团检体检登记 遗弃 /// 获取列表 团检体检登记 遗弃
/// </summary> /// </summary>

8
src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs

@ -2517,6 +2517,14 @@ namespace Shentun.Peis.PatientRegisters
await CurrentUnitOfWork.SaveChangesAsync(); await CurrentUnitOfWork.SaveChangesAsync();
} }
[HttpPost("api/app/patientregister/CreatePatientRegisterFromCustomerOrgInterface")]
public async Task CreatePatientRegisterFromCustomerOrgInterfaceAsync(CustomerOrgRegisterIdInputDto input)
{
if (input == null)
{
throw new UserFriendlyException("input参数不能为空");
}
}
[HttpPost("api/app/patientregister/GetSameNamePatient")] [HttpPost("api/app/patientregister/GetSameNamePatient")]
public async Task<List<GetSameNamePatientDto>> GetSameNamePatientAsync(GetSameNamePatientInputDto getSameNamePatientInputDto) public async Task<List<GetSameNamePatientDto>> GetSameNamePatientAsync(GetSameNamePatientInputDto getSameNamePatientInputDto)
{ {

Loading…
Cancel
Save