diff --git a/src/Shentun.Peis.Application.Contracts/ThirdBookings/CreateBookingMedicalByExcelInputDto.cs b/src/Shentun.Peis.Application.Contracts/ThirdBookings/CreateBookingMedicalByExcelInputDto.cs new file mode 100644 index 0000000..4d36d1c --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/ThirdBookings/CreateBookingMedicalByExcelInputDto.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; +using System.Text; + +namespace Shentun.Peis.ThirdBookings +{ + public class CreateBookingMedicalByExcelInputDto + { + /// + /// 姓名 + /// + public string PatientName { get; set; } + + /// + /// 单位分组ID + /// + public string CustomerOrgGroupId { get; set; } + + /// + /// 第三方体检中心Id + /// + public string ThirdMedicalCenterId { get; set; } + + + /// + /// 身份证 + /// + public string IdNo { get; set; } + + /// + /// 性别 + /// + public string SexName { get; set; } + + /// + /// 年龄 + /// + public short Age { get; set; } + + /// + /// 预约日期 yyyy-MM-dd + /// + public string BookingDate { get; set; } + + /// + /// 电话 + /// + public string Phone { get; set; } + + /// + /// 分公司 + /// + public string ChildCompanyName { get; set; } + + /// + /// 部门 + /// + public string DepartmentName { get; set; } + + /// + /// 岗位 + /// + public string PositionName { get; set; } + + /// + /// 是否在职 0:在职,1:退休 + /// + public string EmpStatus { get; set; } + + /// + ///婚姻状况 0:未婚、1:已婚 + /// + public string MaritalStatus { get; set; } + + + } +} diff --git a/src/Shentun.Peis.Application.Contracts/ThirdBookings/GetThirdBookingListDto.cs b/src/Shentun.Peis.Application.Contracts/ThirdBookings/GetThirdBookingListDto.cs index d969c37..b2cc3a7 100644 --- a/src/Shentun.Peis.Application.Contracts/ThirdBookings/GetThirdBookingListDto.cs +++ b/src/Shentun.Peis.Application.Contracts/ThirdBookings/GetThirdBookingListDto.cs @@ -58,15 +58,15 @@ namespace Shentun.Peis.ThirdBookings /// public string Phone { get; set; } - ///// - ///// 分公司 - ///// - //public string ChildCompanyName { get; set; } + /// + /// 分公司 + /// + public string ChildCompanyName { get; set; } - ///// - ///// 部门 - ///// - //public string DepartmentName { get; set; } + /// + /// 部门 + /// + public string DepartmentName { get; set; } ///// ///// 婚姻状况 diff --git a/src/Shentun.Peis.Application/ThirdBookingPushs/ThirdBookingPushAppService.cs b/src/Shentun.Peis.Application/ThirdBookingPushs/ThirdBookingPushAppService.cs index 2a0a732..6f93cd8 100644 --- a/src/Shentun.Peis.Application/ThirdBookingPushs/ThirdBookingPushAppService.cs +++ b/src/Shentun.Peis.Application/ThirdBookingPushs/ThirdBookingPushAppService.cs @@ -113,7 +113,7 @@ namespace Shentun.Peis.ThirdBookingPushs IDTYPE = thirdBookingEnt.IdType, MOBILE = thirdBookingEnt.Phone, NAME = patientRegisterEnt.PatientName, - SOURCE = "BjGJ", + SOURCE = "BJGJ", YEAR = medicalYear }; @@ -201,7 +201,7 @@ namespace Shentun.Peis.ThirdBookingPushs IDTYPE = thirdBookingEnt.IdType, MOBILE = thirdBookingEnt.Phone, NAME = patientRegisterEnt.PatientName, - SOURCE = "BjGJ", + SOURCE = "BJGJ", YEAR = medicalYear, AGE = patientRegisterEnt.Age == null ? (short)0 : patientRegisterEnt.Age.Value, BIRTHDAY = patientRegisterEnt.BirthDate != null ? patientRegisterEnt.BirthDate.Value.ToString("yyyy-MM-dd") : "", diff --git a/src/Shentun.Peis.Application/ThirdBookings/ThirdBookingAppService.cs b/src/Shentun.Peis.Application/ThirdBookings/ThirdBookingAppService.cs index 326be4a..a621c42 100644 --- a/src/Shentun.Peis.Application/ThirdBookings/ThirdBookingAppService.cs +++ b/src/Shentun.Peis.Application/ThirdBookings/ThirdBookingAppService.cs @@ -105,6 +105,8 @@ namespace Shentun.Peis.ThirdBookings PatientName = s.PatientName, Phone = s.Phone, SexId = GetSexId(s.SexName), + ChildCompanyName = s.ChildCompanyName, + DepartmentName = s.DepartmentName, CustomerOrgId = GetCustomerOrgId(customerOrgList, customerOrgId, s.ChildCompanyName, s.DepartmentName), CustomerOrgRegisterId = customerOrgRegisterId, }).ToList(); @@ -114,83 +116,44 @@ namespace Shentun.Peis.ThirdBookings } - ///// - ///// 体检预约接口 - ///// - ///// - ///// - //[HttpPost] - //public async Task CreateBookingMedicalByExcelAsync(PublicRequestDto input) - //{ - - // string inputStr = DataHelper.GetInputDecrypt(input.DATA, input.SIGN); - // if (!string.IsNullOrWhiteSpace(inputStr)) - // { - // var inputPara = JsonConvert.DeserializeObject(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() { - // 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; - //} + /// + /// 导入体检预约 + /// + /// + /// + [HttpPost("api/app/ThirdBooking/CreateBookingMedicalByExcel")] + public async Task CreateBookingMedicalByExcelAsync(CreateBookingMedicalByExcelInputDto input) + { + if (string.IsNullOrWhiteSpace(input.PatientName)) + throw new UserFriendlyException("名字不能为空"); + + if (string.IsNullOrWhiteSpace(input.BookingDate)) + throw new UserFriendlyException("日期不能为空"); + + var thirdBookingEnt = new ThirdBooking(GuidGenerator.Create()) + { + Age = input.Age, + BookingDate = Convert.ToDateTime(input.BookingDate), + ChildCompanyName = input.ChildCompanyName, + CustomerOrgGroupId = input.CustomerOrgGroupId, + DepartmentName = input.DepartmentName, + EmpStatus = input.EmpStatus, + ICode = "", + IdNo = input.IdNo, + IdType = "0", + MaritalStatus = input.MaritalStatus, + MedicalStatus = '0', + PatientName = input.PatientName, + Phone = input.Phone, + PositionName = input.PositionName, + SexName = input.SexName, + SourceChannel = "1", + ThirdMedicalCenterId = input.ThirdMedicalCenterId + }; + + await _thirdBookingRepository.InsertAsync(thirdBookingEnt); + + } /// diff --git a/src/Shentun.Peis.Domain/ThirdBookings/ThirdBooking.cs b/src/Shentun.Peis.Domain/ThirdBookings/ThirdBooking.cs index 87a3d68..5a4569e 100644 --- a/src/Shentun.Peis.Domain/ThirdBookings/ThirdBooking.cs +++ b/src/Shentun.Peis.Domain/ThirdBookings/ThirdBooking.cs @@ -11,13 +11,19 @@ using Org.BouncyCastle.Crypto.Tls; namespace Shentun.Peis.Models { - + /// /// 第三方预约人员记录 /// [Table("third_booking")] public class ThirdBooking : AuditedEntity, IHasConcurrencyStamp { + public ThirdBooking() { } + + public ThirdBooking(Guid id) : base(id) + { + } + /// /// 姓名 ///