Browse Source

修改人员照片地址、增加年月日

总检体检结论
bjmzak
wxd 2 years ago
parent
commit
37c6356cb0
  1. 7
      src/Shentun.Peis.Application.Contracts/PatientRegisters/UpdatePatientRegisterSummarySuggestionDto.cs
  2. 61
      src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs
  3. 2
      src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs
  4. 2
      src/Shentun.Peis.Domain/ImageHelper.cs
  5. 42
      src/Shentun.Peis.Domain/PatientRegisters/PatientRegisterManager.cs

7
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
/// </summary>
public DateTime? SummaryDate { get; set; }
/// <summary>
/// 体检结论ID
/// </summary>
[Required(ErrorMessage ="体检结论不能为空")]
public Guid MedicalConclusionId { get; set; }
public List<UpdateSumSummaryDto> SumSummarys { get; set; }
public List<UpdateSumSuggestionDto> SumSuggestions { get; set; }

61
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
/// 处理异常 人员登记 异常后更新状态
/// </summary>
/// <returns></returns>
[RemoteService(false)]
public async Task HandPatientRegisterStatus()
{
List<string> updateIds = new List<string>();
@ -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
/// <summary>
/// 迁移人员图片数据
/// </summary>
/// <returns></returns>
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;

2
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;

2
src/Shentun.Peis.Domain/ImageHelper.cs

@ -100,7 +100,7 @@ namespace Shentun.Peis
/// <summary>
/// 将Base64字符串转换为图片并保存到本地
/// 将Byte[]转换为图片并保存到本地
/// </summary>
/// <param name="base64Str">base64字符串</param>
/// <param name="savePath">图片保存地址,如:/Content/Images/10000</param>

42
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);
}

Loading…
Cancel
Save