From 9cbfec52d8ff8263129b542d1a7e16a199930670 Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Mon, 28 Oct 2024 16:26:01 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E7=BA=A6=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ThirdBookings/ThirdBookingAppService.cs | 125 +++++++++++++++++- .../ThirdBookings/ThirdBooking.cs | 20 ++- 2 files changed, 138 insertions(+), 7 deletions(-) diff --git a/src/Shentun.Peis.Application/ThirdBookings/ThirdBookingAppService.cs b/src/Shentun.Peis.Application/ThirdBookings/ThirdBookingAppService.cs index 59d10a9..326be4a 100644 --- a/src/Shentun.Peis.Application/ThirdBookings/ThirdBookingAppService.cs +++ b/src/Shentun.Peis.Application/ThirdBookings/ThirdBookingAppService.cs @@ -1,9 +1,11 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; +using Newtonsoft.Json; using Shentun.Peis.Enums; using Shentun.Peis.Models; using Shentun.Peis.PlugIns.Sms; +using SqlSugar; using System; using System.Collections.Generic; using System.IO; @@ -25,13 +27,16 @@ namespace Shentun.Peis.ThirdBookings { private readonly IRepository _thirdBookingRepository; private readonly IRepository _thirdInterfaceRepository; + private readonly IRepository _customerOrgRepository; public ThirdBookingAppService( IRepository thirdBookingRepository, - IRepository thirdInterfaceRepository) + IRepository thirdInterfaceRepository, + IRepository customerOrgRepository) { _thirdBookingRepository = thirdBookingRepository; _thirdInterfaceRepository = thirdInterfaceRepository; + _customerOrgRepository = customerOrgRepository; } @@ -63,12 +68,14 @@ namespace Shentun.Peis.ThirdBookings { customerOrgRegisterId = Guid.Parse(customerOrgRegisterIdPara); customerOrgId = Guid.Parse(customerOrgIdPara); + } } else { throw new UserFriendlyException("请开启第三方预约"); } + var query = await _thirdBookingRepository.GetQueryableAsync(); 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); } - var entListDto = query.Select(s => new GetThirdBookingListDto + var customerOrgList = await _customerOrgRepository.GetListAsync(); + + var entListDto = query.ToList().Select(s => new GetThirdBookingListDto { ThirdBookingId = s.Id, Age = s.Age, @@ -96,7 +105,7 @@ namespace Shentun.Peis.ThirdBookings PatientName = s.PatientName, Phone = s.Phone, SexId = GetSexId(s.SexName), - CustomerOrgId = customerOrgId, + CustomerOrgId = GetCustomerOrgId(customerOrgList, customerOrgId, s.ChildCompanyName, s.DepartmentName), CustomerOrgRegisterId = customerOrgRegisterId, }).ToList(); @@ -105,6 +114,84 @@ 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; + //} + /// /// 转换性别 @@ -124,6 +211,36 @@ namespace Shentun.Peis.ThirdBookings return SexId; } - + /// + /// 获取部门ID + /// + /// + /// 一级单位ID 集团ID + /// 子公司名称 预约填的 + /// 部门名称 部门 + /// + private static Guid? GetCustomerOrgId(List 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; + } } } diff --git a/src/Shentun.Peis.Domain/ThirdBookings/ThirdBooking.cs b/src/Shentun.Peis.Domain/ThirdBookings/ThirdBooking.cs index c83c52e..74830ad 100644 --- a/src/Shentun.Peis.Domain/ThirdBookings/ThirdBooking.cs +++ b/src/Shentun.Peis.Domain/ThirdBookings/ThirdBooking.cs @@ -94,11 +94,25 @@ namespace Shentun.Peis.Models public string DepartmentName { get; set; } /// - /// 婚姻状况 + /// 岗位 + /// + [StringLength(100)] + [Column("position_name")] + public string PositionName { get; set; } + + /// + /// 是否在职 0:在职,1:退休 + /// + [StringLength(1)] + [Column("emp_status")] + public string EmpStatus { get; set; } + + /// + ///婚姻状况 0:未婚、1:已婚 /// [StringLength(20)] - [Column("marital_status_name")] - public string MaritalStatusName { get; set; } + [Column("marital_status")] + public string MaritalStatus { get; set; } /// /// 体检状态 0未开始 1已登记 2已完成体检 3已推送报告