Browse Source

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

总检体检结论
bjmzak
wxd 2 years ago
parent
commit
37c6356cb0
  1. 7
      src/Shentun.Peis.Application.Contracts/PatientRegisters/UpdatePatientRegisterSummarySuggestionDto.cs
  2. 57
      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. 18
      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 Shentun.Peis.SumSummaryContents;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text; using System.Text;
namespace Shentun.Peis.PatientRegisters namespace Shentun.Peis.PatientRegisters
@ -22,6 +23,12 @@ namespace Shentun.Peis.PatientRegisters
/// </summary> /// </summary>
public DateTime? SummaryDate { get; set; } public DateTime? SummaryDate { get; set; }
/// <summary>
/// 体检结论ID
/// </summary>
[Required(ErrorMessage ="体检结论不能为空")]
public Guid MedicalConclusionId { get; set; }
public List<UpdateSumSummaryDto> SumSummarys { get; set; } public List<UpdateSumSummaryDto> SumSummarys { get; set; }
public List<UpdateSumSuggestionDto> SumSuggestions { get; set; } public List<UpdateSumSuggestionDto> SumSuggestions { get; set; }

57
src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs

@ -2030,7 +2030,7 @@ namespace Shentun.Peis.DataMigrations
string photo = ""; string photo = "";
if (!string.IsNullOrEmpty(row["photograph"].ToString())) if (!string.IsNullOrEmpty(row["photograph"].ToString()))
{ {
photo = UpLoadImg(patientRegisterId, (byte[])row["photograph"]);
photo = UpLoadImg(patientRegisterId, DateTime.Now, (byte[])row["photograph"]);
} }
#endregion #endregion
@ -2071,7 +2071,7 @@ namespace Shentun.Peis.DataMigrations
PatientName = row["name"].ToString(), PatientName = row["name"].ToString(),
PatientRegisterNo = row["barcode_no"].ToString(), PatientRegisterNo = row["barcode_no"].ToString(),
PersonnelTypeId = personnelTypeId, PersonnelTypeId = personnelTypeId,
Photo = "",
Photo = photo,
Remark = row["remark"].ToString(), Remark = row["remark"].ToString(),
ReportPrintTimes = Convert.ToInt16(row["report_print_times"].ToString()), ReportPrintTimes = Convert.ToInt16(row["report_print_times"].ToString()),
Salesman = row["salesman"].ToString(), Salesman = row["salesman"].ToString(),
@ -2124,6 +2124,7 @@ namespace Shentun.Peis.DataMigrations
/// 处理异常 人员登记 异常后更新状态 /// 处理异常 人员登记 异常后更新状态
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[RemoteService(false)]
public async Task HandPatientRegisterStatus() public async Task HandPatientRegisterStatus()
{ {
List<string> updateIds = new List<string>(); List<string> updateIds = new List<string>();
@ -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 #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); var isupload = ImageHelper.ByteToImage(Photo, imgurl);
if (!string.IsNullOrEmpty(isupload)) if (!string.IsNullOrEmpty(isupload))
return isupload; return isupload;

2
src/Shentun.Peis.Application/PatientRegisters/PatientRegisterAppService.cs

@ -1267,7 +1267,7 @@ namespace Shentun.Peis.PatientRegisters
{ {
//_logger.LogInformation(input.Photo); //_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); var isupload = ImageHelper.Base64StrToImage(input.Photo, imgurl);
if (!string.IsNullOrEmpty(isupload)) if (!string.IsNullOrEmpty(isupload))
return isupload; return isupload;

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

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

18
src/Shentun.Peis.Domain/PatientRegisters/PatientRegisterManager.cs

@ -427,9 +427,9 @@ namespace Shentun.Peis.PatientRegisters
{ {
throw new UserFriendlyException("客户单位ID不存在"); 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("个人体检不能选单位分组"); throw new UserFriendlyException("个人体检不能选单位分组");
} }
@ -528,7 +528,7 @@ namespace Shentun.Peis.PatientRegisters
sourceEntity.CustomerOrgGroupId != Guid.Empty && sourceEntity.CustomerOrgGroupId != null) sourceEntity.CustomerOrgGroupId != Guid.Empty && sourceEntity.CustomerOrgGroupId != null)
{ {
if ((await _customerOrgGroupRepository.GetQueryableAsync()). if ((await _customerOrgGroupRepository.GetQueryableAsync()).
Where(o =>o.CustomerOrgRegisterId == sourceEntity.CustomerOrgRegisterId &&
Where(o => o.CustomerOrgRegisterId == sourceEntity.CustomerOrgRegisterId &&
o.Id == sourceEntity.CustomerOrgGroupId).Count() == 0) o.Id == sourceEntity.CustomerOrgGroupId).Count() == 0)
{ {
throw new UserFriendlyException("单位分组ID不存在"); throw new UserFriendlyException("单位分组ID不存在");
@ -660,7 +660,7 @@ namespace Shentun.Peis.PatientRegisters
{ {
if (sourceEntity.Age != null && sourceEntity.Age > 0) if (sourceEntity.Age != null && sourceEntity.Age > 0)
{ {
sourceEntity.BirthDate =ConvertExtr.ToBirthDateByAge((short)sourceEntity.Age);
sourceEntity.BirthDate = ConvertExtr.ToBirthDateByAge((short)sourceEntity.Age);
} }
} }
@ -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); var customerOrgGroup = await _customerOrgGroupRepository.GetAsync(customerOrgGroupId);
if((customerOrgGroup.ForSexId == ForSexFlag.Male && patientRegister.SexId != SexFlag.Male && 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)) || (customerOrgGroup.ForSexId == ForSexFlag.Female && patientRegister.SexId != SexFlag.Female && patientRegister.SexId != SexFlag.UnKnown))
{ {
throw new UserFriendlyException("分组和人员性别不一致"); throw new UserFriendlyException("分组和人员性别不一致");
} }
if ((customerOrgGroup.MaritalStatusId == MaritalStatusFlag.UnMarried && patientRegister.MaritalStatusId != MaritalStatusFlag.UnMarried && patientRegister.MaritalStatusId != MaritalStatusFlag.UnKnown) 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("分组和人员婚姻状况不一致"); throw new UserFriendlyException("分组和人员婚姻状况不一致");
} }
if(patientRegister.Age < customerOrgGroup.AgeLowerLimit)
if (patientRegister.Age < customerOrgGroup.AgeLowerLimit)
{ {
throw new UserFriendlyException("年龄不能小于分组年龄下限"); throw new UserFriendlyException("年龄不能小于分组年龄下限");
} }
@ -1401,6 +1401,8 @@ namespace Shentun.Peis.PatientRegisters
entity.CompleteFlag = PatientRegisterCompleteFlag.SumCheck; entity.CompleteFlag = PatientRegisterCompleteFlag.SumCheck;
entity.MedicalConclusionId = entitydto.MedicalConclusionId;
return await _repository.UpdateAsync(entity); return await _repository.UpdateAsync(entity);
} }

Loading…
Cancel
Save