@ -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 > ( ) ;
@ -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 ;