From 37c6356cb04886f3de71829182bc73ea9db7facd Mon Sep 17 00:00:00 2001
From: wxd <123@qq.com>
Date: Wed, 24 Apr 2024 00:08:52 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=BA=E5=91=98=E7=85=A7?=
=?UTF-8?q?=E7=89=87=E5=9C=B0=E5=9D=80=E3=80=81=E5=A2=9E=E5=8A=A0=E5=B9=B4?=
=?UTF-8?q?=E6=9C=88=E6=97=A5=20=E6=80=BB=E6=A3=80=E4=BD=93=E6=A3=80?=
=?UTF-8?q?=E7=BB=93=E8=AE=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...datePatientRegisterSummarySuggestionDto.cs | 7 +++
.../BaseDataHandleAppService.cs | 61 +++++++++++++++++--
.../PatientRegisterAppService.cs | 2 +-
src/Shentun.Peis.Domain/ImageHelper.cs | 2 +-
.../PatientRegisterManager.cs | 42 +++++++------
5 files changed, 86 insertions(+), 28 deletions(-)
diff --git a/src/Shentun.Peis.Application.Contracts/PatientRegisters/UpdatePatientRegisterSummarySuggestionDto.cs b/src/Shentun.Peis.Application.Contracts/PatientRegisters/UpdatePatientRegisterSummarySuggestionDto.cs
index 7eb7ad8..aed97cd 100644
--- a/src/Shentun.Peis.Application.Contracts/PatientRegisters/UpdatePatientRegisterSummarySuggestionDto.cs
+++ b/src/Shentun.Peis.Application.Contracts/PatientRegisters/UpdatePatientRegisterSummarySuggestionDto.cs
@@ -2,6 +2,7 @@
using Shentun.Peis.SumSummaryContents;
using System;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
using System.Text;
namespace Shentun.Peis.PatientRegisters
@@ -22,6 +23,12 @@ namespace Shentun.Peis.PatientRegisters
///
public DateTime? SummaryDate { get; set; }
+ ///
+ /// 体检结论ID
+ ///
+ [Required(ErrorMessage ="体检结论不能为空")]
+ public Guid MedicalConclusionId { get; set; }
+
public List SumSummarys { get; set; }
public List SumSuggestions { get; set; }
diff --git a/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs b/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs
index b4a36bf..f0a7c8f 100644
--- a/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs
+++ b/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs
@@ -2030,7 +2030,7 @@ namespace Shentun.Peis.DataMigrations
string photo = "";
if (!string.IsNullOrEmpty(row["photograph"].ToString()))
{
- photo = UpLoadImg(patientRegisterId, (byte[])row["photograph"]);
+ photo = UpLoadImg(patientRegisterId, DateTime.Now, (byte[])row["photograph"]);
}
#endregion
@@ -2071,7 +2071,7 @@ namespace Shentun.Peis.DataMigrations
PatientName = row["name"].ToString(),
PatientRegisterNo = row["barcode_no"].ToString(),
PersonnelTypeId = personnelTypeId,
- Photo = "",
+ Photo = photo,
Remark = row["remark"].ToString(),
ReportPrintTimes = Convert.ToInt16(row["report_print_times"].ToString()),
Salesman = row["salesman"].ToString(),
@@ -2124,6 +2124,7 @@ namespace Shentun.Peis.DataMigrations
/// 处理异常 人员登记 异常后更新状态
///
///
+ [RemoteService(false)]
public async Task HandPatientRegisterStatus()
{
List updateIds = new List();
@@ -2240,7 +2241,7 @@ namespace Shentun.Peis.DataMigrations
var patientRegisterList = (await _patientRegisterRepository.GetQueryableAsync()).OrderBy(o => o.Id)
.Where(m => string.Compare(m.Id.ToString(), nextKeyValue) > 0).Take(handcount).ToList();
-
+
if (patientRegisterList.Any())
{
var userList = await _identityUserRepository.GetListAsync();
@@ -2712,7 +2713,7 @@ namespace Shentun.Peis.DataMigrations
}
}
-
+
await Db.Ado.ExecuteCommandAsync($"update tb_export_key set keyvalue='{item.Id}',addtime=getdate(),handlecount+=1 where tablename='sum_diagnosis' ");
}
}
@@ -2724,6 +2725,54 @@ namespace Shentun.Peis.DataMigrations
+ ///
+ /// 迁移人员图片数据
+ ///
+ ///
+ public async Task TransferPersonPhohoData(int handcount)
+ {
+ string nextKeyValue = Db.Ado.GetString("select keyvalue from tb_export_key where tablename='patient_register_photo'");
+
+ var patientRegisterList = (await _patientRegisterRepository.GetQueryableAsync()).OrderBy(o => o.Id)
+ .Where(m => string.Compare(m.Id.ToString(), nextKeyValue) > 0).Take(handcount).ToList();
+
+ if (patientRegisterList.Any())
+ {
+
+ foreach (var item in patientRegisterList)
+ {
+
+ using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true))
+ {
+ #region 转换成老系统PatientRegisterId
+ string oldPatientRegisterId = (await _fieldComparisonRepository.GetQueryableAsync())
+ .Where(m => m.TableName == "patient_register" && m.NewKeyValue == item.Id.ToString()).FirstOrDefault().OldKeyValue;
+ #endregion
+
+ var photograph = await Db.Ado.GetScalarAsync($"select photograph from patient_register where patient_register_id='{oldPatientRegisterId}' ");
+
+ #region 上传图片,获取地址
+
+ if (photograph != null && !string.IsNullOrEmpty(photograph.ToString()))
+ {
+ string photo = UpLoadImg(item.Id, item.CreationTime, (byte[])photograph);
+
+ item.Photo = photo;
+
+ await _patientRegisterRepository.UpdateAsync(item);
+
+ }
+
+ #endregion
+
+ await uow.CompleteAsync();
+
+ await Db.Ado.ExecuteCommandAsync($"update tb_export_key set keyvalue='{item.Id}',addtime=getdate(),handlecount+=1 where tablename='patient_register_photo' ");
+ }
+ }
+ }
+ }
+
#endregion
@@ -2798,9 +2847,9 @@ namespace Shentun.Peis.DataMigrations
}
}
- private string UpLoadImg(Guid PatientRegisterId, byte[] Photo)
+ private string UpLoadImg(Guid PatientRegisterId, DateTime time, byte[] Photo)
{
- string imgurl = "UpLoad/" + PatientRegisterId;
+ string imgurl = $"UpLoad/{time.Year}/{time.Month}/{time.Day}/" + PatientRegisterId;
var isupload = ImageHelper.ByteToImage(Photo, imgurl);
if (!string.IsNullOrEmpty(isupload))
return isupload;
diff --git a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs
index da692aa..77c18e9 100644
--- a/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs
+++ b/src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs
@@ -1267,7 +1267,7 @@ namespace Shentun.Peis.PatientRegisters
{
//_logger.LogInformation(input.Photo);
- string imgurl = "UpLoad/" + input.PatientRegisterId;
+ string imgurl = $"UpLoad/{DateTime.Now.Year}/{DateTime.Now.Month}/{DateTime.Now.Day}/{input.PatientRegisterId}";
var isupload = ImageHelper.Base64StrToImage(input.Photo, imgurl);
if (!string.IsNullOrEmpty(isupload))
return isupload;
diff --git a/src/Shentun.Peis.Domain/ImageHelper.cs b/src/Shentun.Peis.Domain/ImageHelper.cs
index 85ecb49..640416a 100644
--- a/src/Shentun.Peis.Domain/ImageHelper.cs
+++ b/src/Shentun.Peis.Domain/ImageHelper.cs
@@ -100,7 +100,7 @@ namespace Shentun.Peis
///
- /// 将Base64字符串转换为图片并保存到本地
+ /// 将Byte[]转换为图片并保存到本地
///
/// base64字符串
/// 图片保存地址,如:/Content/Images/10000
diff --git a/src/Shentun.Peis.Domain/PatientRegisters/PatientRegisterManager.cs b/src/Shentun.Peis.Domain/PatientRegisters/PatientRegisterManager.cs
index 438491e..cc55521 100644
--- a/src/Shentun.Peis.Domain/PatientRegisters/PatientRegisterManager.cs
+++ b/src/Shentun.Peis.Domain/PatientRegisters/PatientRegisterManager.cs
@@ -276,9 +276,9 @@ namespace Shentun.Peis.PatientRegisters
entity.IsVip = 'N';
}
DataHelper.CheckCharIsYOrN(entity.IsVip, "VIP标志");
-
+
DataHelper.CheckCharIsYOrN(entity.IsNameHide, "姓名隐藏");
-
+
if (entity.CompleteFlag == default(char))
{
@@ -369,7 +369,7 @@ namespace Shentun.Peis.PatientRegisters
throw new UserFriendlyException("年龄不能小于等于0");
}
-
+
if (entity.CustomerOrgGroupId != Guid.Empty && entity.CustomerOrgGroupId != null)
{
@@ -407,7 +407,7 @@ namespace Shentun.Peis.PatientRegisters
}
}
-
+
if (entity.SexHormoneTermId != Guid.Empty && entity.SexHormoneTermId != null)
{
@@ -427,9 +427,9 @@ namespace Shentun.Peis.PatientRegisters
{
throw new UserFriendlyException("客户单位ID不存在");
}
- if(customerOrg.Id == GuidFlag.PersonCustomerOrgId)
+ if (customerOrg.Id == GuidFlag.PersonCustomerOrgId)
{
- if(entity.CustomerOrgGroupId != Guid.Empty && entity.CustomerOrgGroupId != null)
+ if (entity.CustomerOrgGroupId != Guid.Empty && entity.CustomerOrgGroupId != null)
{
throw new UserFriendlyException("个人体检不能选单位分组");
}
@@ -484,7 +484,7 @@ namespace Shentun.Peis.PatientRegisters
PatientRegister targetEntity
)
{
-
+
DataHelper.CheckStringIsNull(sourceEntity.PatientName, "姓名");
DataHelper.CheckGuidIsDefaultValue(sourceEntity.MedicalCenterId, "单位ID");
DataHelper.CheckGuidIsDefaultValue(sourceEntity.CustomerOrgId, "客户单位ID");
@@ -524,11 +524,11 @@ namespace Shentun.Peis.PatientRegisters
- if (sourceEntity.CustomerOrgGroupId != targetEntity.CustomerOrgGroupId &&
+ if (sourceEntity.CustomerOrgGroupId != targetEntity.CustomerOrgGroupId &&
sourceEntity.CustomerOrgGroupId != Guid.Empty && sourceEntity.CustomerOrgGroupId != null)
{
if ((await _customerOrgGroupRepository.GetQueryableAsync()).
- Where(o =>o.CustomerOrgRegisterId == sourceEntity.CustomerOrgRegisterId &&
+ Where(o => o.CustomerOrgRegisterId == sourceEntity.CustomerOrgRegisterId &&
o.Id == sourceEntity.CustomerOrgGroupId).Count() == 0)
{
throw new UserFriendlyException("单位分组ID不存在");
@@ -660,7 +660,7 @@ namespace Shentun.Peis.PatientRegisters
{
if (sourceEntity.Age != null && sourceEntity.Age > 0)
{
- sourceEntity.BirthDate =ConvertExtr.ToBirthDateByAge((short)sourceEntity.Age);
+ sourceEntity.BirthDate = ConvertExtr.ToBirthDateByAge((short)sourceEntity.Age);
}
}
@@ -668,9 +668,9 @@ namespace Shentun.Peis.PatientRegisters
{
throw new UserFriendlyException("人员信息姓名和性别和原来的信息都不一致,禁止修改");
}
-
- //targetEntity.AuditDate = sourceEntity.AuditDate;
- //targetEntity.AuditDoctor = sourceEntity.AuditDoctor;
+
+ //targetEntity.AuditDate = sourceEntity.AuditDate;
+ //targetEntity.AuditDoctor = sourceEntity.AuditDoctor;
targetEntity.BirthDate = sourceEntity.BirthDate;
targetEntity.Age = sourceEntity.Age;
targetEntity.CompleteFlag = sourceEntity.CompleteFlag;
@@ -727,22 +727,22 @@ namespace Shentun.Peis.PatientRegisters
}
- public async Task SetCustomerOrgGroupId(PatientRegister patientRegister,Guid customerOrgGroupId)
+ public async Task SetCustomerOrgGroupId(PatientRegister patientRegister, Guid customerOrgGroupId)
{
var customerOrgGroup = await _customerOrgGroupRepository.GetAsync(customerOrgGroupId);
- if((customerOrgGroup.ForSexId == ForSexFlag.Male && patientRegister.SexId != SexFlag.Male && patientRegister.SexId != SexFlag.UnKnown)
- || (customerOrgGroup.ForSexId == ForSexFlag.Female && patientRegister.SexId != SexFlag.Female && patientRegister.SexId != SexFlag.UnKnown))
+ if ((customerOrgGroup.ForSexId == ForSexFlag.Male && patientRegister.SexId != SexFlag.Male && patientRegister.SexId != SexFlag.UnKnown)
+ || (customerOrgGroup.ForSexId == ForSexFlag.Female && patientRegister.SexId != SexFlag.Female && patientRegister.SexId != SexFlag.UnKnown))
{
throw new UserFriendlyException("分组和人员性别不一致");
}
if ((customerOrgGroup.MaritalStatusId == MaritalStatusFlag.UnMarried && patientRegister.MaritalStatusId != MaritalStatusFlag.UnMarried && patientRegister.MaritalStatusId != MaritalStatusFlag.UnKnown)
- || (customerOrgGroup.MaritalStatusId == MaritalStatusFlag.Married && patientRegister.MaritalStatusId == MaritalStatusFlag.UnMarried ))
+ || (customerOrgGroup.MaritalStatusId == MaritalStatusFlag.Married && patientRegister.MaritalStatusId == MaritalStatusFlag.UnMarried))
{
throw new UserFriendlyException("分组和人员婚姻状况不一致");
}
- if(patientRegister.Age < customerOrgGroup.AgeLowerLimit)
+ if (patientRegister.Age < customerOrgGroup.AgeLowerLimit)
{
throw new UserFriendlyException("年龄不能小于分组年龄下限");
}
@@ -1257,7 +1257,7 @@ namespace Shentun.Peis.PatientRegisters
{
throw new UserFriendlyException("已加锁,不能删除");
}
-
+
var patientRegisterQueryable = (from a in await _repository.GetQueryableAsync()
join b in await _registerAsbitemRepository.GetQueryableAsync() on a.Id equals b.PatientRegisterId
join c in await _registerCheckRepository.GetQueryableAsync() on b.RegisterCheckId equals c.Id
@@ -1364,7 +1364,7 @@ namespace Shentun.Peis.PatientRegisters
else
entity.AuditDate = entitydto.AuditDate;
}
-
+
entity.IsAudit = entitydto.IsAudit;
return await _repository.UpdateAsync(entity);
@@ -1401,6 +1401,8 @@ namespace Shentun.Peis.PatientRegisters
entity.CompleteFlag = PatientRegisterCompleteFlag.SumCheck;
+ entity.MedicalConclusionId = entitydto.MedicalConclusionId;
+
return await _repository.UpdateAsync(entity);
}