From 2f69ca121528a8d7e262f2d50d42ad565890d09a Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Fri, 13 Mar 2026 16:06:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=B7=E8=B1=9A=E4=BA=91=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ThirdPushs/Hty/PushHtyDataInputDto.cs | 16 +++++++++ .../Hty/PushPeisResultPlugInsHty.cs | 34 +++++++++++++------ .../ThirdPartyPublicInterfaceAppService.cs | 12 +++++++ 3 files changed, 52 insertions(+), 10 deletions(-) diff --git a/ThirdPlugIns/Shentun.Peis.PlugIns.Gem/ThirdPushs/Hty/PushHtyDataInputDto.cs b/ThirdPlugIns/Shentun.Peis.PlugIns.Gem/ThirdPushs/Hty/PushHtyDataInputDto.cs index 140d26d7..9b6b95cc 100644 --- a/ThirdPlugIns/Shentun.Peis.PlugIns.Gem/ThirdPushs/Hty/PushHtyDataInputDto.cs +++ b/ThirdPlugIns/Shentun.Peis.PlugIns.Gem/ThirdPushs/Hty/PushHtyDataInputDto.cs @@ -53,6 +53,22 @@ namespace Shentun.Peis.PlugIns.Extensions.ThirdPushs.Hty /// /// public string MEDICALCODE { get; set; } + + /// + /// + /// + public string MOBILE { get; set; } + + /// + /// + /// + public string TEL { get; set; } + + /// + /// + /// + public string ADDRESS { get; set; } + } diff --git a/ThirdPlugIns/Shentun.Peis.PlugIns.Gem/ThirdPushs/Hty/PushPeisResultPlugInsHty.cs b/ThirdPlugIns/Shentun.Peis.PlugIns.Gem/ThirdPushs/Hty/PushPeisResultPlugInsHty.cs index e1cfa3a2..53e1be3e 100644 --- a/ThirdPlugIns/Shentun.Peis.PlugIns.Gem/ThirdPushs/Hty/PushPeisResultPlugInsHty.cs +++ b/ThirdPlugIns/Shentun.Peis.PlugIns.Gem/ThirdPushs/Hty/PushPeisResultPlugInsHty.cs @@ -71,13 +71,13 @@ namespace Shentun.Peis.PlugIns.Extensions.ThirdPushs.Hty using (DbConnection conn = new NpgsqlConnection(AppConnctionStr)) { - var sql_patient = $@" select b.patient_no,b.id_no,b.birth_date,a.medical_times,b.sex_id,a.patient_name, + var sql_patient = $@" select b.patient_no,b.id_no,b.birth_date,a.medical_times,b.sex_id,a.patient_name,b.address,b.mobile_telephone,b.telephone, a.medical_start_date,a.patient_register_no,a.complete_flag from patient_register as a left join patient as b on a.patient_id=b.id where a.id=@patient_register_id "; - var patientRegisterSqlEntity = (await conn.QueryFirstAsync(sql_patient, - new { patient_register_id = patientRegisterId })); + var patientRegisterSqlEntity = await conn.QueryFirstAsync(sql_patient, + new { patient_register_id = patientRegisterId }); if (patientRegisterSqlEntity != null) { @@ -86,24 +86,38 @@ namespace Shentun.Peis.PlugIns.Extensions.ThirdPushs.Hty throw new UserFriendlyException("人员为总检"); } + + #region 单位信息 + + string sql_cusomter = @"select c.display_name from patient_register as a + left join customer_org_register as b on a.customer_org_register_id=b.id + left join customer_org as c on b.customer_org_id=c.id where a.id=@patient_register_id "; + + var customerOrgName = conn.QuerySingleOrDefault(sql_cusomter, new { patient_register_id = patientRegisterId }); + + #endregion + var pushRequest = new PushHtyDataInputDto(); pushRequest.info = new PushHtyDataInputPatientDto { USERID = patientRegisterSqlEntity.patient_no.ToString(), - CERTNO = patientRegisterSqlEntity.id_no.ToString(), - BIRTHDATE = !string.IsNullOrWhiteSpace(patientRegisterSqlEntity.birth_date.ToString()) ? Convert.ToDateTime(patientRegisterSqlEntity.birth_date).ToString("yyyy-MM-dd") : "", + CERTNO = patientRegisterSqlEntity.id_no?.ToString() ?? "", + BIRTHDATE = !string.IsNullOrWhiteSpace(patientRegisterSqlEntity.birth_date?.ToString()) ? Convert.ToDateTime(patientRegisterSqlEntity.birth_date).ToString("yyyy-MM-dd") : "", USERTIMES = patientRegisterSqlEntity.medical_times.ToString(), GENDER = ConertSex(patientRegisterSqlEntity.sex_id.ToString()), NAME = patientRegisterSqlEntity.patient_name.ToString(), MEDICALDATE = Convert.ToDateTime(patientRegisterSqlEntity.medical_start_date).ToString("yyyy-MM-dd HH:mm:ss"), MEDICALCODE = patientRegisterSqlEntity.patient_register_no.ToString(), - RORGNAME = "" + RORGNAME = customerOrgName, + ADDRESS = patientRegisterSqlEntity.address?.ToString() ?? "", + MOBILE = patientRegisterSqlEntity.mobile_telephone?.ToString() ?? "", + TEL = patientRegisterSqlEntity.telephone?.ToString() ?? "", }; //查看项目 var sql_item = $@" select c.display_name as item_name,b.* from register_check as a left join register_check_item as b on a.id=b.register_check_id - left join item as c on b.item_id=c.id where a.patient_register_id=@patient_register_id "; + left join item as c on b.item_id=c.id where a.complete_flag='1' and a.patient_register_id=@patient_register_id "; var registerItemSqlEntity = await conn.QueryAsync(sql_item, new { patient_register_id = patientRegisterId }); @@ -132,11 +146,11 @@ namespace Shentun.Peis.PlugIns.Extensions.ThirdPushs.Hty { var constr = new pushHtyDataItemDto { - dicValue = itemRow.reference_range_value, + dicValue = itemRow.reference_range_value?.ToString() ?? "", ordinary = 1, - p_value = itemRow.result, + p_value = itemRow.result?.ToString() ?? "", sysCode = itemCode.interface_code_value, - unit = itemRow.unit + unit = itemRow.unit?.ToString() ?? "" }; var dcIndex = contents.Count + 1; diff --git a/src/Shentun.Peis.Application/ThirdPartyPublicInterfaces/ThirdPartyPublicInterfaceAppService.cs b/src/Shentun.Peis.Application/ThirdPartyPublicInterfaces/ThirdPartyPublicInterfaceAppService.cs index b67e560a..bbe9e50d 100644 --- a/src/Shentun.Peis.Application/ThirdPartyPublicInterfaces/ThirdPartyPublicInterfaceAppService.cs +++ b/src/Shentun.Peis.Application/ThirdPartyPublicInterfaces/ThirdPartyPublicInterfaceAppService.cs @@ -538,6 +538,13 @@ namespace Shentun.Peis.ThirdPartyPublicInterfaces var queryFirst = query.FirstOrDefault(); + + if (queryFirst == null) + { + throw new UserFriendlyException("条码不正确"); + } + + result.Age = queryFirst.age == null ? (short)0 : queryFirst.age.Value; result.IdNo = queryFirst.idNo; string sexName = "未知"; @@ -584,6 +591,11 @@ namespace Shentun.Peis.ThirdPartyPublicInterfaces var queryFirst = query.FirstOrDefault(); + if (queryFirst == null) + { + throw new UserFriendlyException("条码不正确"); + } + result.Age = queryFirst.age == null ? (short)0 : queryFirst.age.Value; result.IdNo = queryFirst.idNo; string sexName = "未知";