Browse Source

预约更改

master
wxd 1 year ago
parent
commit
9cbfec52d8
  1. 125
      src/Shentun.Peis.Application/ThirdBookings/ThirdBookingAppService.cs
  2. 20
      src/Shentun.Peis.Domain/ThirdBookings/ThirdBooking.cs

125
src/Shentun.Peis.Application/ThirdBookings/ThirdBookingAppService.cs

@ -1,9 +1,11 @@
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using Shentun.Peis.Enums; using Shentun.Peis.Enums;
using Shentun.Peis.Models; using Shentun.Peis.Models;
using Shentun.Peis.PlugIns.Sms; using Shentun.Peis.PlugIns.Sms;
using SqlSugar;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -25,13 +27,16 @@ namespace Shentun.Peis.ThirdBookings
{ {
private readonly IRepository<ThirdBooking, Guid> _thirdBookingRepository; private readonly IRepository<ThirdBooking, Guid> _thirdBookingRepository;
private readonly IRepository<ThirdInterface, Guid> _thirdInterfaceRepository; private readonly IRepository<ThirdInterface, Guid> _thirdInterfaceRepository;
private readonly IRepository<CustomerOrg, Guid> _customerOrgRepository;
public ThirdBookingAppService( public ThirdBookingAppService(
IRepository<ThirdBooking, Guid> thirdBookingRepository, IRepository<ThirdBooking, Guid> thirdBookingRepository,
IRepository<ThirdInterface, Guid> thirdInterfaceRepository)
IRepository<ThirdInterface, Guid> thirdInterfaceRepository,
IRepository<CustomerOrg, Guid> customerOrgRepository)
{ {
_thirdBookingRepository = thirdBookingRepository; _thirdBookingRepository = thirdBookingRepository;
_thirdInterfaceRepository = thirdInterfaceRepository; _thirdInterfaceRepository = thirdInterfaceRepository;
_customerOrgRepository = customerOrgRepository;
} }
@ -63,12 +68,14 @@ namespace Shentun.Peis.ThirdBookings
{ {
customerOrgRegisterId = Guid.Parse(customerOrgRegisterIdPara); customerOrgRegisterId = Guid.Parse(customerOrgRegisterIdPara);
customerOrgId = Guid.Parse(customerOrgIdPara); customerOrgId = Guid.Parse(customerOrgIdPara);
} }
} }
else else
{ {
throw new UserFriendlyException("请开启第三方预约"); throw new UserFriendlyException("请开启第三方预约");
} }
var query = await _thirdBookingRepository.GetQueryableAsync(); var query = await _thirdBookingRepository.GetQueryableAsync();
if (!string.IsNullOrWhiteSpace(input.StartDate) && !string.IsNullOrWhiteSpace(input.StartDate)) if (!string.IsNullOrWhiteSpace(input.StartDate) && !string.IsNullOrWhiteSpace(input.StartDate))
{ {
@ -85,7 +92,9 @@ namespace Shentun.Peis.ThirdBookings
query = query.Where(m => m.MedicalStatus == input.MedicalStatus); query = query.Where(m => m.MedicalStatus == input.MedicalStatus);
} }
var entListDto = query.Select(s => new GetThirdBookingListDto
var customerOrgList = await _customerOrgRepository.GetListAsync();
var entListDto = query.ToList().Select(s => new GetThirdBookingListDto
{ {
ThirdBookingId = s.Id, ThirdBookingId = s.Id,
Age = s.Age, Age = s.Age,
@ -96,7 +105,7 @@ namespace Shentun.Peis.ThirdBookings
PatientName = s.PatientName, PatientName = s.PatientName,
Phone = s.Phone, Phone = s.Phone,
SexId = GetSexId(s.SexName), SexId = GetSexId(s.SexName),
CustomerOrgId = customerOrgId,
CustomerOrgId = GetCustomerOrgId(customerOrgList, customerOrgId, s.ChildCompanyName, s.DepartmentName),
CustomerOrgRegisterId = customerOrgRegisterId, CustomerOrgRegisterId = customerOrgRegisterId,
}).ToList(); }).ToList();
@ -105,6 +114,84 @@ namespace Shentun.Peis.ThirdBookings
} }
///// <summary>
///// 体检预约接口
///// </summary>
///// <param name="input"></param>
///// <returns></returns>
//[HttpPost]
//public async Task CreateBookingMedicalByExcelAsync(PublicRequestDto input)
//{
// string inputStr = DataHelper.GetInputDecrypt(input.DATA, input.SIGN);
// if (!string.IsNullOrWhiteSpace(inputStr))
// {
// var inputPara = JsonConvert.DeserializeObject<CreateBookingMedicalInputDto>(inputStr);
// if (inputPara != null)
// {
// string peisAdminId = _configuration.GetSection("PeisAdminId").Value;
// string sourceChannel = "1"; //1 正式环境 0 测试环境
// if (!string.IsNullOrWhiteSpace(_configuration.GetSection("SourceChannel").Value))
// {
// sourceChannel = _configuration.GetSection("SourceChannel").Value;
// }
// Guid id = Guid.NewGuid();
// int isExe = await _peisDb.Ado.ExecuteCommandAsync("INSERT INTO public.third_booking(id,patient_name,customer_org_group_id,third_medical_center_id," +
// "id_type,id_no, sex_name, age, booking_date, phone, child_company_name, department_name, marital_status_name,concurrency_stamp," +
// " creation_time, creator_id, last_modification_time, last_modifier_id, medical_status,icode,source_channel) " +
// "VALUES (@id,@patient_name,@customer_org_group_id,@third_medical_center_id," +
// "@id_type,@id_no,@sex_name,@age,@booking_date,@phone,@child_company_name,@department_name,@marital_status_name,@concurrency_stamp," +
// "@creation_time,@creator_id,@last_modification_time,@last_modifier_id,@medical_status,@icode,@source_channel) ;",
// new List<SugarParameter>() {
// new SugarParameter("id",id),
// new SugarParameter("patient_name",inputPara.name),
// new SugarParameter("customer_org_group_id",inputPara.exampackagecode),
// new SugarParameter("third_medical_center_id",inputPara.examcenterid),
// new SugarParameter("id_type",inputPara.idtype),
// new SugarParameter("id_no",inputPara.idno),
// new SugarParameter("sex_name",inputPara.sex),
// new SugarParameter("age",inputPara.age),
// new SugarParameter("booking_date",Convert.ToDateTime(inputPara.bookingdata)),
// new SugarParameter("phone",inputPara.phone),
// new SugarParameter("child_company_name",""),
// new SugarParameter("department_name",""),
// new SugarParameter("marital_status_name",""),
// new SugarParameter("concurrency_stamp",Guid.NewGuid().ToString("N")),
// new SugarParameter("creation_time",DateTime.Now),
// new SugarParameter("creator_id",Guid.Parse(peisAdminId)),
// new SugarParameter("last_modification_time",DateTime.Now),
// new SugarParameter("last_modifier_id",Guid.Parse(peisAdminId)),
// new SugarParameter("medical_status",'0'),
// new SugarParameter("icode",input.ICODE),
// new SugarParameter("source_channel",sourceChannel)
// });
// if (isExe > 0)
// {
// var resultDto = new CreateBookingMedicalDto
// {
// error = "0",
// error_msg = "成功",
// data = new CreateBookingMedicalDetailDto { bookingid = id.ToString() }
// };
// result = DataHelper.GetResultEncrypt(JsonConvert.SerializeObject(resultDto), input.ICODE);
// }
// }
// }
// return result;
//}
/// <summary> /// <summary>
/// 转换性别 /// 转换性别
@ -124,6 +211,36 @@ namespace Shentun.Peis.ThirdBookings
return SexId; return SexId;
} }
/// <summary>
/// 获取部门ID
/// </summary>
/// <param name="customerOrgList"></param>
/// <param name="topCustomerOrgId">一级单位ID 集团ID</param>
/// <param name="childCompanyName">子公司名称 预约填的</param>
/// <param name="departmentName">部门名称 部门</param>
/// <returns></returns>
private static Guid? GetCustomerOrgId(List<CustomerOrg> customerOrgList, Guid? topCustomerOrgId, string childCompanyName, string departmentName)
{
if (topCustomerOrgId != null)
{
if (!string.IsNullOrWhiteSpace(childCompanyName))
{
var childCompanyEnt = customerOrgList.FirstOrDefault(f => f.ParentId == topCustomerOrgId && f.DisplayName == childCompanyName);
if (childCompanyEnt != null)
{
topCustomerOrgId = childCompanyEnt.Id;
if (!string.IsNullOrWhiteSpace(departmentName))
{
var departmentNameEnt = customerOrgList.FirstOrDefault(f => f.ParentId == topCustomerOrgId && f.DisplayName == departmentName);
if (departmentNameEnt != null)
{
topCustomerOrgId = departmentNameEnt.Id;
}
}
}
}
}
return topCustomerOrgId;
}
} }
} }

20
src/Shentun.Peis.Domain/ThirdBookings/ThirdBooking.cs

@ -94,11 +94,25 @@ namespace Shentun.Peis.Models
public string DepartmentName { get; set; } public string DepartmentName { get; set; }
/// <summary> /// <summary>
/// 婚姻状况
/// 岗位
/// </summary>
[StringLength(100)]
[Column("position_name")]
public string PositionName { get; set; }
/// <summary>
/// 是否在职 0:在职,1:退休
/// </summary>
[StringLength(1)]
[Column("emp_status")]
public string EmpStatus { get; set; }
/// <summary>
///婚姻状况 0:未婚、1:已婚
/// </summary> /// </summary>
[StringLength(20)] [StringLength(20)]
[Column("marital_status_name")]
public string MaritalStatusName { get; set; }
[Column("marital_status")]
public string MaritalStatus { get; set; }
/// <summary> /// <summary>
/// 体检状态 0未开始 1已登记 2已完成体检 3已推送报告 /// 体检状态 0未开始 1已登记 2已完成体检 3已推送报告

Loading…
Cancel
Save