diff --git a/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs b/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs
index 8ec3c74..f3712f6 100644
--- a/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs
+++ b/src/Shentun.Peis.Application/DataMigrations/BaseDataHandleAppService.cs
@@ -63,10 +63,10 @@ namespace Shentun.Peis.DataMigrations
IsAutoCloseConnection = true
});
-
+ //修改时间用
private readonly SqlSugarClient PgNWDb = new SqlSugarClient(new ConnectionConfig()
{
- ConnectionString = "Host=10.1.12.140;Port=5432;Database=ShentunPeis;User ID=postgres;Password=st123;",
+ ConnectionString = "Host=10.1.12.140;Port=5432;Database=ShentunPeis0503;User ID=postgres;Password=st123;",
DbType = SqlSugar.DbType.PostgreSQL,
IsAutoCloseConnection = true
});
@@ -2086,6 +2086,7 @@ namespace Shentun.Peis.DataMigrations
/// 迁移单位体检次数数据 无字典
///
///
+ [RemoteService(false)]
public async Task TransferCustomerOrgRegisterData()
{
var count = await _customerOrgRegisterRepository.GetCountAsync();
@@ -2134,6 +2135,7 @@ namespace Shentun.Peis.DataMigrations
/// 迁移单位分组
///
///
+ [RemoteService(false)]
public async Task TransferCustomerOrgGroupData()
{
var count = await _customerOrgGroupRepository.GetCountAsync();
@@ -2208,430 +2210,294 @@ namespace Shentun.Peis.DataMigrations
#region 人员登记
+
+
///
- /// 迁移档案数据
+ /// 迁移人员登记数据
///
///
- public async Task TransferPatientData()
+ public async Task TransferPatientRegisterData()
{
+ string nextKeyValue = Db.Ado.GetString("select keyvalue from tb_export_key where tablename='patient_register' ");
+ var oldPatientRegisterList = await Db.Ado.GetDataTableAsync($"select top 1000 * from patient_register where patient_register_id>'{nextKeyValue}' order by patient_register_id asc");
- List dataList = new List();
-
-
-
- var oldPatientList = await Db.Ado.GetDataTableAsync("select top 500 patient_id,nation_id,address," +
- "birth_date,name,email,id_card_no,marital_status_id,mobile_telephone,patient_password,postalcode,telephone,sex_id " +
- "from patient_register where is_hand is null order by patient_register_id asc");
-
- List tempPatientNos = new List();
-
- if (oldPatientList.Rows.Count > 0)
+ if (oldPatientRegisterList.Rows.Count > 0)
{
- List fieldComparisons = new List();
- List fieldComparisonList = await _fieldComparisonRepository.GetListAsync(m => m.TableName == "nation");
+ await Db.Ado.ExecuteCommandAsync($"update tb_export_key set starttime=getdate() where tablename='patient_register' ");
- foreach (DataRow row in oldPatientList.Rows)
- {
+ List fieldComparisonList = await _fieldComparisonRepository.GetListAsync();
+ var userList = await _identityUserRepository.GetListAsync();
+ List customerOrgRegisterList = await _customerOrgRegisterRepository.GetListAsync();
- if (!tempPatientNos.Contains(row["patient_id"].ToString()))
+ foreach (DataRow row in oldPatientRegisterList.Rows)
+ {
+ using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true))
{
- string nationId = null;
- if (!string.IsNullOrWhiteSpace(row["nation_id"].ToString()))
- {
- nationId = fieldComparisonList.Where(m => m.OldKeyValue == row["nation_id"].ToString()).FirstOrDefault().NewKeyValue;
- }
+ //档案ID
+ Guid patientId = Guid.Empty;
- Guid PatientId = GuidGenerator.Create(); //档案ID
+ #region 处理档案,未找到档案就生成
- var data = new Patient(PatientId)
+ var patientEnt = await _patientRepository.FirstOrDefaultAsync(m => m.PatientNo == row["patient_id"].ToString());
+ if (patientEnt == null)
{
- Address = row["address"].ToString(),
- BirthDate = string.IsNullOrEmpty(row["birth_date"].ToString()) ? null : Convert.ToDateTime(row["birth_date"].ToString()),
- BirthPlaceId = null,
- DisplayName = row["name"].ToString(),
- Email = row["email"].ToString(),
- IdNo = row["id_card_no"].ToString(),
- MaritalStatusId = Convert.ToChar(row["marital_status_id"].ToString()),
- MedicalCenterId = defaultMedicalCenterId,
- MobileTelephone = row["mobile_telephone"].ToString(),
- NationId = nationId,
- PatientNo = row["patient_id"].ToString(),
- PatientPassword = row["patient_password"].ToString(),
- PostalCode = row["postalcode"].ToString(),
- SexId = ConvertSex(row["sex_id"].ToString()),
- SimpleCode = LanguageConverter.GetPYSimpleCode(row["name"].ToString()),
- Telephone = row["telephone"].ToString()
- };
-
- dataList.Add(data);
-
- fieldComparisons.Add(new FieldComparison
- {
- FieldName = "id",
- NewKeyValue = PatientId.ToString(),
- OldKeyValue = row["patient_id"].ToString(),
- TableName = "patient"
- });
-
- #region 增加标识
- veryPatientNo.Add(row["patient_id"].ToString(), row["patient_id"].ToString());
- #endregion
- }
-
- tempPatientNos.Add(row["patient_id"].ToString());
- }
-
- if (dataList.Any())
- await _patientRepository.InsertManyAsync(dataList);
- if (fieldComparisons.Any())
- await _fieldComparisonRepository.InsertManyAsync(fieldComparisons);
-
-
- #region 修改状态
-
- Thread.Sleep(100);
-
- await Db.Ado.ExecuteCommandAsync("update patient_register set is_hand='Y' where patient_id in (@ids) ", new { ids = tempPatientNos });
+ string nationId = null;
+ if (!string.IsNullOrWhiteSpace(row["nation_id"].ToString()))
+ {
+ nationId = (await _fieldComparisonRepository.GetQueryableAsync()).Where(m => m.TableName == "nation" && m.OldKeyValue == row["nation_id"].ToString()).FirstOrDefault().NewKeyValue;
+ }
- #endregion
- _logger.LogInformation($"当前时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")},迁移数据{dataList.Count}");
+ Guid autoPatientId = GuidGenerator.Create(); //档案ID
- return true;
- }
- else
- {
- return false;
- }
+ var dataPatient = new Patient(autoPatientId)
+ {
+ Address = row["address"].ToString(),
+ BirthDate = string.IsNullOrEmpty(row["birth_date"].ToString()) ? null : Convert.ToDateTime(row["birth_date"].ToString()),
+ BirthPlaceId = null,
+ DisplayName = row["name"].ToString(),
+ Email = row["email"].ToString(),
+ IdNo = row["id_card_no"].ToString(),
+ MaritalStatusId = Convert.ToChar(row["marital_status_id"].ToString()),
+ MedicalCenterId = defaultMedicalCenterId,
+ MobileTelephone = row["mobile_telephone"].ToString(),
+ NationId = nationId,
+ PatientNo = row["patient_id"].ToString(),
+ PatientPassword = row["patient_password"].ToString(),
+ PostalCode = row["postalcode"].ToString(),
+ SexId = ConvertSex(row["sex_id"].ToString()),
+ SimpleCode = LanguageConverter.GetPYSimpleCode(row["name"].ToString()),
+ Telephone = row["telephone"].ToString()
+ };
- }
+ await _patientRepository.InsertAsync(dataPatient, true);
+ patientId = autoPatientId;
+ }
+ else
+ {
+ patientId = patientEnt.Id;
+ }
- ///
- /// 迁移人员登记数据
- ///
- ///
- public async Task TransferPatientRegisterData()
- {
- List dataList = new List();
- var oldPatientRegisterList = await Db.Ado.GetDataTableAsync("select top 1000 * from patient_register where is_dj is null order by patient_register_id asc");
+ #endregion
- List tempPatientRegisterIds = new List();
- if (oldPatientRegisterList.Rows.Count > 0)
- {
- List fieldComparisons = new List();
- List fieldComparisonList = await _fieldComparisonRepository.GetListAsync();
- var userList = await _identityUserRepository.GetListAsync();
- List customerOrgRegisterList = await _customerOrgRegisterRepository.GetListAsync();
- foreach (DataRow row in oldPatientRegisterList.Rows)
- {
- Guid patientRegisterId = GuidGenerator.Create(); //生成登记ID
+ Guid patientRegisterId = GuidGenerator.Create(); //生成登记ID
- #region 转换审核医生ID
- Guid? AuditDoctorId = null;
- if (!string.IsNullOrWhiteSpace(row["audit_doctor"].ToString()))
- {
- var userEnt = userList.Where(m => m.UserName == row["audit_doctor"].ToString().Trim()).FirstOrDefault();
- if (userEnt != null)
+ #region 转换审核医生ID
+ Guid? AuditDoctorId = null;
+ if (!string.IsNullOrWhiteSpace(row["audit_doctor"].ToString()))
{
- AuditDoctorId = userEnt.Id;
+ var userEnt = userList.Where(m => m.UserName == row["audit_doctor"].ToString().Trim()).FirstOrDefault();
+ if (userEnt != null)
+ {
+ AuditDoctorId = userEnt.Id;
+ }
}
- }
- #endregion
+ #endregion
- #region 转换单位分组ID
- Guid? customerOrgGroupId = null;
- if (!string.IsNullOrWhiteSpace(row["org_group_id"].ToString()))
- {
- var customerOrgGroupEnt = fieldComparisonList.Where(m => m.TableName == "customer_org_group" && m.OldKeyValue == row["org_group_id"].ToString()).FirstOrDefault();
- if (customerOrgGroupEnt != null)
+ #region 转换单位分组ID
+ Guid? customerOrgGroupId = null;
+ if (!string.IsNullOrWhiteSpace(row["org_group_id"].ToString()))
{
- customerOrgGroupId = Guid.Parse(customerOrgGroupEnt.NewKeyValue);
+ var customerOrgGroupEnt = fieldComparisonList.Where(m => m.TableName == "customer_org_group" && m.OldKeyValue == row["org_group_id"].ToString()).FirstOrDefault();
+ if (customerOrgGroupEnt != null)
+ {
+ customerOrgGroupId = Guid.Parse(customerOrgGroupEnt.NewKeyValue);
+ }
}
- }
- #endregion
+ #endregion
- #region 转换单位ID 部门
- Guid customerOrgId = Guid.Parse(fieldComparisonList.Where(m => m.TableName == "customer_org" && m.OldKeyValue == row["org_id"].ToString()).FirstOrDefault().NewKeyValue);
- #endregion
+ #region 转换单位ID 部门
+ Guid customerOrgId = Guid.Parse(fieldComparisonList.Where(m => m.TableName == "customer_org" && m.OldKeyValue == row["org_id"].ToString()).FirstOrDefault().NewKeyValue);
+ #endregion
- #region 转换单位体检次数ID 没有增加默认值
- Guid customerOrgRegisterId = GuidFlag.PersonCustomerOrgRegisterId;
- if (row["org_id"].ToString() != "00000")
- {
- Guid topCustomerOrgId = Guid.Parse(fieldComparisonList.Where(m => m.TableName == "customer_org" && m.OldKeyValue == row["org_id"].ToString().Substring(0, 5)).FirstOrDefault().NewKeyValue);
- var customerOrgRegisterEnt = customerOrgRegisterList.Where(m => m.CustomerOrgId == topCustomerOrgId
- && m.MedicalTimes == (short)Convert.ToInt32(row["org_medical_times"].ToString())).FirstOrDefault();
- if (customerOrgRegisterEnt != null)
+ #region 转换单位体检次数ID 没有增加默认值
+ Guid customerOrgRegisterId = GuidFlag.PersonCustomerOrgRegisterId;
+ if (row["org_id"].ToString() != "00000")
{
- customerOrgRegisterId = customerOrgRegisterEnt.Id;
+ Guid topCustomerOrgId = Guid.Parse(fieldComparisonList.Where(m => m.TableName == "customer_org" && m.OldKeyValue == row["org_id"].ToString().Substring(0, 5)).FirstOrDefault().NewKeyValue);
+ var customerOrgRegisterEnt = customerOrgRegisterList.Where(m => m.CustomerOrgId == topCustomerOrgId
+ && m.MedicalTimes == (short)Convert.ToInt32(row["org_medical_times"].ToString())).FirstOrDefault();
+ if (customerOrgRegisterEnt != null)
+ {
+ customerOrgRegisterId = customerOrgRegisterEnt.Id;
+ }
}
- }
- #endregion
- #region 转换体检结论ID
- Guid? medicalConclusionId = null;
- if (!string.IsNullOrWhiteSpace(row["medical_conclusion_id"].ToString()))
- {
- var medicalConclusionEnt = fieldComparisonList.Where(m => m.TableName == "medical_conclusion"
- && m.OldKeyValue == row["medical_conclusion_id"].ToString()).FirstOrDefault();
- if (medicalConclusionEnt != null)
+ #endregion
+
+ #region 转换体检结论ID
+ Guid? medicalConclusionId = null;
+ if (!string.IsNullOrWhiteSpace(row["medical_conclusion_id"].ToString()))
{
- medicalConclusionId = Guid.Parse(medicalConclusionEnt.NewKeyValue);
+ var medicalConclusionEnt = fieldComparisonList.Where(m => m.TableName == "medical_conclusion"
+ && m.OldKeyValue == row["medical_conclusion_id"].ToString()).FirstOrDefault();
+ if (medicalConclusionEnt != null)
+ {
+ medicalConclusionId = Guid.Parse(medicalConclusionEnt.NewKeyValue);
+ }
}
- }
- #endregion
+ #endregion
- #region 转换套餐ID
- Guid? medicalPackageId = null;
- if (!string.IsNullOrWhiteSpace(row["medical_package_id"].ToString()))
- {
- var medicalPackageEnt = fieldComparisonList.Where(m => m.TableName == "medical_package" && m.OldKeyValue == row["medical_package_id"].ToString()).FirstOrDefault();
- if (medicalPackageEnt != null)
+ #region 转换套餐ID
+ Guid? medicalPackageId = null;
+ if (!string.IsNullOrWhiteSpace(row["medical_package_id"].ToString()))
{
- medicalPackageId = Guid.Parse(medicalPackageEnt.NewKeyValue);
+ var medicalPackageEnt = fieldComparisonList.Where(m => m.TableName == "medical_package" && m.OldKeyValue == row["medical_package_id"].ToString()).FirstOrDefault();
+ if (medicalPackageEnt != null)
+ {
+ medicalPackageId = Guid.Parse(medicalPackageEnt.NewKeyValue);
+ }
}
- }
- #endregion
+ #endregion
- #region 转换体检类别ID
- Guid? medicalTypeId = null;
- if (!string.IsNullOrWhiteSpace(row["medical_type_id"].ToString()))
- {
- var medicalTypeEnt = fieldComparisonList.Where(m => m.TableName == "medical_type" && m.OldKeyValue == row["medical_type_id"].ToString()).FirstOrDefault();
- if (medicalTypeEnt != null)
+ #region 转换体检类别ID
+ Guid? medicalTypeId = null;
+ if (!string.IsNullOrWhiteSpace(row["medical_type_id"].ToString()))
{
- medicalTypeId = Guid.Parse(medicalTypeEnt.NewKeyValue);
+ var medicalTypeEnt = fieldComparisonList.Where(m => m.TableName == "medical_type" && m.OldKeyValue == row["medical_type_id"].ToString()).FirstOrDefault();
+ if (medicalTypeEnt != null)
+ {
+ medicalTypeId = Guid.Parse(medicalTypeEnt.NewKeyValue);
+ }
}
- }
- #endregion
+ #endregion
- #region 获取档案ID
- Guid patientId = Guid.Parse(fieldComparisonList.Where(m => m.TableName == "patient" && m.OldKeyValue == row["patient_id"].ToString()).FirstOrDefault().NewKeyValue);
- #endregion
- #region 转换人员类别ID
- Guid? personnelTypeId = null;
- if (!string.IsNullOrWhiteSpace(row["personnel_type_id"].ToString()))
- {
- var personnelTypeEnt = fieldComparisonList.Where(m => m.TableName == "personnel_type" && m.OldKeyValue == row["personnel_type_id"].ToString()).FirstOrDefault();
- if (personnelTypeEnt != null)
+
+ #region 转换人员类别ID
+ Guid? personnelTypeId = null;
+ if (!string.IsNullOrWhiteSpace(row["personnel_type_id"].ToString()))
{
- personnelTypeId = Guid.Parse(personnelTypeEnt.NewKeyValue);
+ var personnelTypeEnt = fieldComparisonList.Where(m => m.TableName == "personnel_type" && m.OldKeyValue == row["personnel_type_id"].ToString()).FirstOrDefault();
+ if (personnelTypeEnt != null)
+ {
+ personnelTypeId = Guid.Parse(personnelTypeEnt.NewKeyValue);
+ }
}
- }
- #endregion
+ #endregion
- #region 转换总检医生ID
- Guid? summaryDoctorId = null;
- if (!string.IsNullOrWhiteSpace(row["summary_doctor"].ToString()))
- {
- var userEnt = userList.Where(m => m.UserName == row["summary_doctor"].ToString().Trim()).FirstOrDefault();
- if (userEnt != null)
+ #region 转换总检医生ID
+ Guid? summaryDoctorId = null;
+ if (!string.IsNullOrWhiteSpace(row["summary_doctor"].ToString()))
{
- summaryDoctorId = userEnt.Id;
+ var userEnt = userList.Where(m => m.UserName == row["summary_doctor"].ToString().Trim()).FirstOrDefault();
+ if (userEnt != null)
+ {
+ summaryDoctorId = userEnt.Id;
+ }
}
- }
- #endregion
-
-
- #region 上传图片,获取地址
-
- string photo = "";
- if (!string.IsNullOrEmpty(row["photograph"].ToString()))
- {
- photo = UpLoadImg(patientRegisterId, Convert.ToDateTime(row["register_date"].ToString()), (byte[])row["photograph"]);
- }
-
- #endregion
-
- var data = new PatientRegister(patientRegisterId)
- {
- BirthDate = string.IsNullOrEmpty(row["birth_date"].ToString()) ? null : Convert.ToDateTime(row["birth_date"].ToString()),
- MaritalStatusId = Convert.ToChar(row["marital_status_id"].ToString()),
- MedicalCenterId = defaultMedicalCenterId,
- SexId = ConvertSex(row["sex_id"].ToString()),
- Age = string.IsNullOrWhiteSpace(row["age"].ToString()) ? null : Convert.ToInt16(row["age"].ToString()),
- AuditDate = string.IsNullOrWhiteSpace(row["audit_date"].ToString()) ? null : Convert.ToDateTime(row["audit_date"].ToString()),
- AuditDoctorId = AuditDoctorId,
- CompleteFlag = Convert.ToChar(row["complete_flag"].ToString()),
- CustomerOrgGroupId = customerOrgGroupId,
- CustomerOrgId = customerOrgId,
- CustomerOrgRegisterId = customerOrgRegisterId,
- GuidePrintTimes = string.IsNullOrWhiteSpace(row["instruct_print_times"].ToString()) ? (short)0 : Convert.ToInt16(row["instruct_print_times"].ToString()),
- InterposeMeasure = null,
- IsAudit = string.IsNullOrWhiteSpace(row["audit_flag"].ToString()) ? 'N' : Convert.ToChar(row["audit_flag"].ToString()),
- IsLock = string.IsNullOrWhiteSpace(row["lock_flag"].ToString()) ? 'N' : Convert.ToChar(row["lock_flag"].ToString()),
- IsMedicalStart = string.IsNullOrWhiteSpace(row["medical_start_flag"].ToString()) ? 'N' : Convert.ToChar(row["medical_start_flag"].ToString()),
- IsNameHide = string.IsNullOrWhiteSpace(row["name_encrypt_flag"].ToString()) ? 'N' : Convert.ToChar(row["name_encrypt_flag"].ToString()),
- IsPhoneFollow = 'N',
- IsRecoverGuide = string.IsNullOrWhiteSpace(row["recover_form_flag"].ToString()) ? 'N' : Convert.ToChar(row["recover_form_flag"].ToString()),
- IsUpload = string.IsNullOrWhiteSpace(row["upload_flag"].ToString()) ? 'N' : Convert.ToChar(row["upload_flag"].ToString()),
- IsVip = string.IsNullOrWhiteSpace(row["vip_flag"].ToString()) ? 'N' : Convert.ToChar(row["vip_flag"].ToString()),
- JobCardNo = row["job_card_no"].ToString(),
- JobPost = row["job_post"].ToString(),
- JobTitle = row["job_title"].ToString(),
- MedicalCardNo = row["medical_card_no"].ToString(),
- MedicalConclusionId = medicalConclusionId,
- MedicalPackageId = medicalPackageId,
- MedicalStartDate = string.IsNullOrEmpty(row["medical_start_date"].ToString()) ? null : Convert.ToDateTime(row["medical_start_date"].ToString()),
- MedicalTimes = Convert.ToInt16(row["medical_times"].ToString()),
- MedicalTypeId = medicalTypeId,
- PatientId = patientId,
- PatientName = row["name"].ToString(),
- PatientRegisterNo = row["barcode_no"].ToString(),
- PersonnelTypeId = personnelTypeId,
- Photo = photo,
- Remark = row["remark"].ToString(),
- ReportPrintTimes = Convert.ToInt16(row["report_print_times"].ToString()),
- Salesman = row["salesman"].ToString(),
- SexHormoneTermId = null,
- SummaryDate = string.IsNullOrEmpty(row["summary_date"].ToString()) ? null : Convert.ToDateTime(row["summary_date"].ToString()),
- SummaryDoctorId = summaryDoctorId,
- ThirdInfo = row["third_info"].ToString(),
- };
-
- //图片、
- dataList.Add(data);
-
- fieldComparisons.Add(new FieldComparison
- {
- FieldName = "id",
- NewKeyValue = patientRegisterId.ToString(),
- OldKeyValue = row["patient_register_id"].ToString(),
- TableName = "patient_register"
- });
-
-
- tempPatientRegisterIds.Add(row["patient_register_id"].ToString());
- }
-
- if (dataList.Any())
- await _patientRegisterRepository.InsertManyAsync(dataList);
- if (fieldComparisons.Any())
- await _fieldComparisonRepository.InsertManyAsync(fieldComparisons);
-
-
- #region 修改状态
-
- Thread.Sleep(100);
-
- await Db.Ado.ExecuteCommandAsync("update patient_register set is_dj='Y' where patient_register_id in (@ids) ", new { ids = tempPatientRegisterIds });
-
- #endregion
- _logger.LogInformation($"当前时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")},迁移数据{dataList.Count}");
-
- return true;
- }
- else
- {
- return false;
- }
- }
-
-
- ///
- /// 处理人员登记 登记医生跟登记时间
- ///
- ///
- public async Task HandPatientRegisterDoctor()
- {
- var oldPatientRegisterList = await Db.Ado.GetDataTableAsync("select patient_register_id,register_doctor,register_date,audit_doctor,summary_doctor from patient_register where is_doctor is null ");
- if (oldPatientRegisterList.Rows.Count > 0)
- {
- var userList = await _identityUserRepository.GetListAsync();
- List fieldComparisonList = await _fieldComparisonRepository.GetListAsync(m => m.TableName == "patient_register");
-
+ #endregion
- StringBuilder sb = new StringBuilder();
- foreach (DataRow row in oldPatientRegisterList.Rows)
- {
- Guid patientRegisterId = Guid.Parse(fieldComparisonList.Where(m => m.OldKeyValue == row["patient_register_id"].ToString()).FirstOrDefault().NewKeyValue);
- // Guid registerDoctorId = userList.Where(m => m.UserName == row["register_doctor"].ToString().Trim()).FirstOrDefault().Id;
- Guid registerDoctorId = Guid.Parse("3a11fe49-5719-0e9e-dd44-0c4aff0900b0");
- var registerDoctorEnt = userList.Where(m => m.UserName == row["register_doctor"].ToString().Trim()).FirstOrDefault();
- if (registerDoctorEnt != null)
- {
- registerDoctorId = registerDoctorEnt.Id;
- }
+ #region 上传图片,获取地址
- #region 转换审核医生ID
- Guid? auditDoctorId = null;
- if (!string.IsNullOrWhiteSpace(row["audit_doctor"].ToString()))
- {
- var userEnt = userList.Where(m => m.UserName == row["audit_doctor"].ToString().Trim()).FirstOrDefault();
- if (userEnt != null)
+ string photo = "";
+ if (!string.IsNullOrEmpty(row["photograph"].ToString()))
{
- auditDoctorId = userEnt.Id;
+ photo = UpLoadImg(patientRegisterId, Convert.ToDateTime(row["register_date"].ToString()), (byte[])row["photograph"]);
}
- }
- #endregion
- #region 转换总检医生ID
- Guid? summaryDoctorId = null;
- if (!string.IsNullOrWhiteSpace(row["summary_doctor"].ToString()))
- {
- var userEnt = userList.Where(m => m.UserName == row["summary_doctor"].ToString().Trim()).FirstOrDefault();
- if (userEnt != null)
+ #endregion
+
+ var data = new PatientRegister(patientRegisterId)
{
- summaryDoctorId = userEnt.Id;
- }
- }
- #endregion
+ BirthDate = string.IsNullOrEmpty(row["birth_date"].ToString()) ? null : Convert.ToDateTime(row["birth_date"].ToString()),
+ MaritalStatusId = Convert.ToChar(row["marital_status_id"].ToString()),
+ MedicalCenterId = defaultMedicalCenterId,
+ SexId = ConvertSex(row["sex_id"].ToString()),
+ Age = string.IsNullOrWhiteSpace(row["age"].ToString()) ? null : Convert.ToInt16(row["age"].ToString()),
+ AuditDate = string.IsNullOrWhiteSpace(row["audit_date"].ToString()) ? null : Convert.ToDateTime(row["audit_date"].ToString()),
+ AuditDoctorId = AuditDoctorId,
+ CompleteFlag = Convert.ToChar(row["complete_flag"].ToString()),
+ CustomerOrgGroupId = customerOrgGroupId,
+ CustomerOrgId = customerOrgId,
+ CustomerOrgRegisterId = customerOrgRegisterId,
+ GuidePrintTimes = string.IsNullOrWhiteSpace(row["instruct_print_times"].ToString()) ? (short)0 : Convert.ToInt16(row["instruct_print_times"].ToString()),
+ InterposeMeasure = null,
+ IsAudit = string.IsNullOrWhiteSpace(row["audit_flag"].ToString()) ? 'N' : Convert.ToChar(row["audit_flag"].ToString()),
+ IsLock = string.IsNullOrWhiteSpace(row["lock_flag"].ToString()) ? 'N' : Convert.ToChar(row["lock_flag"].ToString()),
+ IsMedicalStart = string.IsNullOrWhiteSpace(row["medical_start_flag"].ToString()) ? 'N' : Convert.ToChar(row["medical_start_flag"].ToString()),
+ IsNameHide = string.IsNullOrWhiteSpace(row["name_encrypt_flag"].ToString()) ? 'N' : Convert.ToChar(row["name_encrypt_flag"].ToString()),
+ IsPhoneFollow = 'N',
+ IsRecoverGuide = string.IsNullOrWhiteSpace(row["recover_form_flag"].ToString()) ? 'N' : Convert.ToChar(row["recover_form_flag"].ToString()),
+ IsUpload = string.IsNullOrWhiteSpace(row["upload_flag"].ToString()) ? 'N' : Convert.ToChar(row["upload_flag"].ToString()),
+ IsVip = string.IsNullOrWhiteSpace(row["vip_flag"].ToString()) ? 'N' : Convert.ToChar(row["vip_flag"].ToString()),
+ JobCardNo = row["job_card_no"].ToString(),
+ JobPost = row["job_post"].ToString(),
+ JobTitle = row["job_title"].ToString(),
+ MedicalCardNo = row["medical_card_no"].ToString(),
+ MedicalConclusionId = medicalConclusionId,
+ MedicalPackageId = medicalPackageId,
+ MedicalStartDate = string.IsNullOrEmpty(row["medical_start_date"].ToString()) ? null : Convert.ToDateTime(row["medical_start_date"].ToString()),
+ MedicalTimes = Convert.ToInt16(row["medical_times"].ToString()),
+ MedicalTypeId = medicalTypeId,
+ PatientId = patientId,
+ PatientName = row["name"].ToString(),
+ PatientRegisterNo = row["barcode_no"].ToString(),
+ PersonnelTypeId = personnelTypeId,
+ Photo = photo,
+ Remark = row["remark"].ToString(),
+ ReportPrintTimes = Convert.ToInt16(row["report_print_times"].ToString()),
+ Salesman = row["salesman"].ToString(),
+ SexHormoneTermId = null,
+ SummaryDate = string.IsNullOrEmpty(row["summary_date"].ToString()) ? null : Convert.ToDateTime(row["summary_date"].ToString()),
+ SummaryDoctorId = summaryDoctorId,
+ ThirdInfo = row["third_info"].ToString(),
+ };
+ await _patientRegisterRepository.InsertAsync(data);
- string sql_update = $"update patient_register set creator_id='{registerDoctorId}',creation_time='{Convert.ToDateTime(row["register_date"]).ToString("yyyy-MM-dd HH:mm:ss")}'";
- if (auditDoctorId != null)
- {
- sql_update += $",audit_doctor_id='{auditDoctorId}'";
- }
- if (summaryDoctorId != null)
- {
- sql_update += $",summary_doctor_id='{summaryDoctorId}'";
- }
+ var fieldComparison = new FieldComparison
+ {
+ FieldName = "id",
+ NewKeyValue = patientRegisterId.ToString(),
+ OldKeyValue = row["patient_register_id"].ToString(),
+ TableName = "patient_register"
+ };
- sql_update += $" where id='{patientRegisterId}' ";
+ await _fieldComparisonRepository.InsertAsync(fieldComparison);
- await PgNWDb.Ado.ExecuteCommandAsync(sql_update);
- string sql_update_status = $"update patient_register set is_doctor='Y' where patient_register_id='{row["patient_register_id"].ToString()}' ";
- await Db.Ado.ExecuteCommandAsync(sql_update_status);
+ await Db.Ado.ExecuteCommandAsync($"update tb_export_key set keyvalue='{row["patient_register_id"].ToString()}',addtime=getdate(),handlecount+=1 where tablename='patient_register' ");
+ await uow.CompleteAsync();
+ }
}
- return true;
+ _logger.LogInformation($"人员数据处理{oldPatientRegisterList.Rows.Count}条");
+
+ await TransferPatientRegisterData();
}
else
{
- return false;
+ _logger.LogInformation("人员数据已处理完");
}
- }
+ }
///
/// 迁移检查单 组合项目 查询register_asbitem
///
///
- public async Task TransferRegisterCheckData(int handcount)
+ public async Task TransferRegisterCheckData()
{
- string nextKeyValue = Db.Ado.GetString("select keyvalue from tb_export_key where tablename='patient_register'");
+ //记录patient_register Id
+ string nextKeyValue = Db.Ado.GetString("select keyvalue from tb_export_key where tablename='register_check'");
var patientRegisterList = (await _patientRegisterRepository.GetQueryableAsync()).OrderBy(o => o.Id)
- .Where(m => string.Compare(m.Id.ToString(), nextKeyValue) > 0).Take(handcount).ToList();
+ .Where(m => string.Compare(m.Id.ToString(), nextKeyValue) > 0).Take(1000).ToList();
if (patientRegisterList.Any())
{
var userList = await _identityUserRepository.GetListAsync();
-
-
foreach (var item in patientRegisterList)
{
using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true))
@@ -2649,7 +2515,6 @@ namespace Shentun.Peis.DataMigrations
if (oldRegisterAsbitemList.Rows.Count > 0)
{
-
foreach (DataRow row in oldRegisterAsbitemList.Rows)
{
#region 转换审核医生ID
@@ -2728,7 +2593,6 @@ namespace Shentun.Peis.DataMigrations
registerCheckAsbitemInsert.Add(dataRegisterAsbitem);
}
-
}
@@ -2740,13 +2604,17 @@ namespace Shentun.Peis.DataMigrations
await uow.CompleteAsync();
- await Db.Ado.ExecuteCommandAsync($"update tb_export_key set keyvalue='{item.Id}',addtime=getdate(),handlecount+=1 where tablename='patient_register' ");
+ await Db.Ado.ExecuteCommandAsync($"update tb_export_key set keyvalue='{item.Id}',addtime=getdate(),handlecount+=1 where tablename='register_check' ");
}
}
+ await TransferRegisterCheckData();
-
+ }
+ else
+ {
+ _logger.LogInformation("检查单、登记组合项目已处理完");
}
}
@@ -2757,11 +2625,11 @@ namespace Shentun.Peis.DataMigrations
///
public async Task TransferRegisterCheckItemData()
{
-
- string nextKeyValue = Db.Ado.GetString("select keyvalue from tb_export_key where tablename='register_check_asbitem'");
+ //记录register_check_asbitem Id
+ string nextKeyValue = Db.Ado.GetString("select keyvalue from tb_export_key where tablename='register_check_item'");
var registerCheckAsbitemList = (await _registerCheckAsbitemRepository.GetQueryableAsync()).OrderBy(o => o.Id)
- .Where(m => string.Compare(m.Id.ToString(), nextKeyValue) > 0).ToList();
+ .Where(m => string.Compare(m.Id.ToString(), nextKeyValue) > 0).Take(1000).ToList();
if (registerCheckAsbitemList.Any())
@@ -2770,7 +2638,6 @@ namespace Shentun.Peis.DataMigrations
foreach (var item in registerCheckAsbitemList)
{
-
using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true))
{
List registerCheckItemInsert = new List();
@@ -2826,12 +2693,15 @@ namespace Shentun.Peis.DataMigrations
await uow.CompleteAsync();
- await Db.Ado.ExecuteCommandAsync($"update tb_export_key set keyvalue='{item.Id}',addtime=getdate(),handlecount+=1 where tablename='register_check_asbitem' ");
+ await Db.Ado.ExecuteCommandAsync($"update tb_export_key set keyvalue='{item.Id}',addtime=getdate(),handlecount+=1 where tablename='register_check_item' ");
}
}
-
-
+ await TransferRegisterCheckItemData();
+ }
+ else
+ {
+ _logger.LogInformation("明细项目已处理完");
}
}
@@ -2843,7 +2713,7 @@ namespace Shentun.Peis.DataMigrations
///
public async Task TransferRegisterCheckSummaryData()
{
-
+ //记录register_check id
string nextKeyValue = Db.Ado.GetString("select keyvalue from tb_export_key where tablename='register_check_summary'");
var registerCheckAsbitemList = (from registerCheckQuery in await _registerCheckRepository.GetQueryableAsync()
@@ -2894,8 +2764,11 @@ namespace Shentun.Peis.DataMigrations
}
}
-
-
+ await TransferRegisterCheckSummaryData();
+ }
+ else
+ {
+ _logger.LogInformation("医生小结已处理完");
}
}
@@ -2904,19 +2777,17 @@ namespace Shentun.Peis.DataMigrations
/// 迁移总检综述 查询patient_register
///
///
- public async Task TransferSumSummaryData(int handcount)
+ public async Task TransferSumSummaryData()
{
string nextKeyValue = Db.Ado.GetString("select keyvalue from tb_export_key where tablename='sum_summary'");
var patientRegisterList = (await _patientRegisterRepository.GetQueryableAsync()).OrderBy(o => o.Id)
- .Where(m => string.Compare(m.Id.ToString(), nextKeyValue) > 0).Take(handcount).ToList();
+ .Where(m => string.Compare(m.Id.ToString(), nextKeyValue) > 0).Take(1000).ToList();
if (patientRegisterList.Any())
{
-
-
foreach (var item in patientRegisterList)
{
@@ -2962,8 +2833,11 @@ namespace Shentun.Peis.DataMigrations
}
}
-
-
+ await TransferSumSummaryData();
+ }
+ else
+ {
+ _logger.LogInformation("总检综述已处理完");
}
}
@@ -2972,20 +2846,17 @@ namespace Shentun.Peis.DataMigrations
/// 迁移总检建议 查询patient_register
///
///
- public async Task TransferSumSuggestionData(int handcount)
+ public async Task TransferSumSuggestionData()
{
string nextKeyValue = Db.Ado.GetString("select keyvalue from tb_export_key where tablename='sum_suggestion'");
var patientRegisterList = (await _patientRegisterRepository.GetQueryableAsync()).OrderBy(o => o.Id)
- .Where(m => string.Compare(m.Id.ToString(), nextKeyValue) > 0).Take(handcount).ToList();
+ .Where(m => string.Compare(m.Id.ToString(), nextKeyValue) > 0).Take(1000).ToList();
if (patientRegisterList.Any())
{
-
foreach (var item in patientRegisterList)
{
-
-
using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true))
{
#region 转换成老系统PatientRegisterId
@@ -3029,8 +2900,11 @@ namespace Shentun.Peis.DataMigrations
}
}
-
-
+ await TransferSumSuggestionData();
+ }
+ else
+ {
+ _logger.LogInformation("总检建议已处理完");
}
}
@@ -3040,21 +2914,19 @@ namespace Shentun.Peis.DataMigrations
/// 迁移总症诊断 查询summary_diagnosis
///
///
- public async Task TransferSumDiagnosisData(int handcount)
+ public async Task TransferSumDiagnosisData()
{
string nextKeyValue = Db.Ado.GetString("select keyvalue from tb_export_key where tablename='sum_diagnosis'");
var patientRegisterList = (await _patientRegisterRepository.GetQueryableAsync()).OrderBy(o => o.Id)
- .Where(m => string.Compare(m.Id.ToString(), nextKeyValue) > 0).Take(handcount).ToList();
+ .Where(m => string.Compare(m.Id.ToString(), nextKeyValue) > 0).Take(1000).ToList();
if (patientRegisterList.Any())
{
foreach (var item in patientRegisterList)
{
-
-
using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true))
{
#region 转换成老系统PatientRegisterId
@@ -3106,69 +2978,62 @@ namespace Shentun.Peis.DataMigrations
}
}
-
-
+ await TransferSumDiagnosisData();
+ }
+ else
+ {
+ _logger.LogInformation("总症诊断已处理完");
}
}
+
///
- /// 处理人员体检次数
+ /// 爆改人员登记创建日期跟创建者
///
///
- public async Task TransferPersonPhohoData(int handcount)
+ public async Task HandPatientRegisterDoctor()
{
- string nextKeyValue = Db.Ado.GetString("select keyvalue from tb_export_key where tablename='patient_register_customer_org_register'");
- var patientRegisterList = (await _patientRegisterRepository.GetQueryableAsync()).OrderBy(o => o.Id)
- .Where(m => m.CustomerOrgRegisterId == GuidFlag.PersonCustomerOrgRegisterId && m.CustomerOrgId != GuidFlag.PersonCustomerOrgId
- && string.Compare(m.Id.ToString(), nextKeyValue) > 0).Take(handcount).ToList();
+ string nextKeyValue = Db.Ado.GetString("select keyvalue from tb_export_key where tablename='hand_patient_register'");
- if (patientRegisterList.Any())
+ var oldPatientRegisterList = await Db.Ado.GetDataTableAsync("select top 1000 patient_register_id,register_doctor,register_date from patient_register where patient_register_id>'{nextKeyValue}' order by patient_register_id asc ");
+ if (oldPatientRegisterList.Rows.Count > 0)
{
- List customerOrgRegisterList = await _customerOrgRegisterRepository.GetListAsync();
-
- foreach (var item in patientRegisterList)
- {
+ var userList = await _identityUserRepository.GetListAsync();
+ List fieldComparisonList = await _fieldComparisonRepository.GetListAsync(m => m.TableName == "patient_register");
- 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 oldPatientRegisterEnt = Db.Ado.GetDataTable($"select org_medical_times,org_id from patient_register where patient_register_id='{oldPatientRegisterId}'");
+ StringBuilder sb = new StringBuilder();
- string oldTopCustomerOrgId = oldPatientRegisterEnt.Rows[0][1].ToString().Substring(0, 5);
+ foreach (DataRow row in oldPatientRegisterList.Rows)
+ {
+ Guid patientRegisterId = Guid.Parse(fieldComparisonList.Where(m => m.OldKeyValue == row["patient_register_id"].ToString()).FirstOrDefault().NewKeyValue);
- //一级单位ID
- Guid customerOrgId = Guid.Parse((await _fieldComparisonRepository.GetQueryableAsync())
- .Where(m => m.TableName == "customer_org" && m.OldKeyValue == oldTopCustomerOrgId).FirstOrDefault().NewKeyValue);
- short orgMedicalTimes = Convert.ToInt16(oldPatientRegisterEnt.Rows[0][0].ToString());
+ Guid registerDoctorId = Guid.Parse("3a11fe49-5719-0e9e-dd44-0c4aff0900b0");
+ var registerDoctorEnt = userList.Where(m => m.UserName == row["register_doctor"].ToString().Trim()).FirstOrDefault();
+ if (registerDoctorEnt != null)
+ {
+ registerDoctorId = registerDoctorEnt.Id;
+ }
- #region 转换单位体检次数ID 没有增加默认值
- Guid customerOrgRegisterId = GuidFlag.PersonCustomerOrgRegisterId;
- var customerOrgRegisterEnt = customerOrgRegisterList.Where(m => m.CustomerOrgId == customerOrgId
- && m.MedicalTimes == orgMedicalTimes).FirstOrDefault();
- if (customerOrgRegisterEnt != null)
- {
- customerOrgRegisterId = customerOrgRegisterEnt.Id;
- item.CustomerOrgRegisterId = customerOrgRegisterId;
- await _patientRegisterRepository.UpdateAsync(item);
- }
+ string sql_update = $"update patient_register set creator_id='{registerDoctorId}',creation_time='{Convert.ToDateTime(row["register_date"]).ToString("yyyy-MM-dd HH:mm:ss")}'";
- #endregion
+ sql_update += $" where id='{patientRegisterId}' ";
+ await PgNWDb.Ado.ExecuteCommandAsync(sql_update);
- await uow.CompleteAsync();
+ await Db.Ado.ExecuteCommandAsync($"update tb_export_key set keyvalue='{row["patient_register_id"].ToString()}',addtime=getdate(),handlecount+=1 where tablename='hand_patient_register' ");
- await Db.Ado.ExecuteCommandAsync($"update tb_export_key set keyvalue='{item.Id}',addtime=getdate(),handlecount+=1 where tablename='patient_register_customer_org_register' ");
- }
}
+
+ await HandPatientRegisterDoctor();
+ }
+ else
+ {
+ _logger.LogInformation("爆改人员登记创建日期跟创建者已处理完");
}
}
@@ -3176,6 +3041,164 @@ namespace Shentun.Peis.DataMigrations
#endregion
#region 暂时不用
+ /////
+ ///// 处理人员体检次数
+ /////
+ /////
+ //public async Task TransferPersonPhohoData(int handcount)
+ //{
+ // string nextKeyValue = Db.Ado.GetString("select keyvalue from tb_export_key where tablename='patient_register_customer_org_register'");
+
+ // var patientRegisterList = (await _patientRegisterRepository.GetQueryableAsync()).OrderBy(o => o.Id)
+ // .Where(m => m.CustomerOrgRegisterId == GuidFlag.PersonCustomerOrgRegisterId && m.CustomerOrgId != GuidFlag.PersonCustomerOrgId
+ // && string.Compare(m.Id.ToString(), nextKeyValue) > 0).Take(handcount).ToList();
+
+ // if (patientRegisterList.Any())
+ // {
+ // List customerOrgRegisterList = await _customerOrgRegisterRepository.GetListAsync();
+
+ // 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 oldPatientRegisterEnt = Db.Ado.GetDataTable($"select org_medical_times,org_id from patient_register where patient_register_id='{oldPatientRegisterId}'");
+
+ // string oldTopCustomerOrgId = oldPatientRegisterEnt.Rows[0][1].ToString().Substring(0, 5);
+
+ // //一级单位ID
+ // Guid customerOrgId = Guid.Parse((await _fieldComparisonRepository.GetQueryableAsync())
+ // .Where(m => m.TableName == "customer_org" && m.OldKeyValue == oldTopCustomerOrgId).FirstOrDefault().NewKeyValue);
+ // short orgMedicalTimes = Convert.ToInt16(oldPatientRegisterEnt.Rows[0][0].ToString());
+
+ // #region 转换单位体检次数ID 没有增加默认值
+ // Guid customerOrgRegisterId = GuidFlag.PersonCustomerOrgRegisterId;
+
+ // var customerOrgRegisterEnt = customerOrgRegisterList.Where(m => m.CustomerOrgId == customerOrgId
+ // && m.MedicalTimes == orgMedicalTimes).FirstOrDefault();
+ // if (customerOrgRegisterEnt != null)
+ // {
+ // customerOrgRegisterId = customerOrgRegisterEnt.Id;
+
+ // item.CustomerOrgRegisterId = customerOrgRegisterId;
+ // 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_customer_org_register' ");
+ // }
+ // }
+ // }
+ //}
+
+ /////
+ ///// 迁移档案数据
+ /////
+ /////
+ //public async Task TransferPatientData()
+ //{
+
+
+ // List dataList = new List();
+
+
+
+
+ // var oldPatientList = await Db.Ado.GetDataTableAsync("select top 500 patient_id,nation_id,address," +
+ // "birth_date,name,email,id_card_no,marital_status_id,mobile_telephone,patient_password,postalcode,telephone,sex_id " +
+ // "from patient_register where is_hand is null order by patient_register_id asc");
+
+ // List tempPatientNos = new List();
+
+ // if (oldPatientList.Rows.Count > 0)
+ // {
+ // List fieldComparisons = new List();
+ // List fieldComparisonList = await _fieldComparisonRepository.GetListAsync(m => m.TableName == "nation");
+
+ // foreach (DataRow row in oldPatientList.Rows)
+ // {
+
+ // if (!tempPatientNos.Contains(row["patient_id"].ToString()))
+ // {
+ // string nationId = null;
+ // if (!string.IsNullOrWhiteSpace(row["nation_id"].ToString()))
+ // {
+
+ // nationId = fieldComparisonList.Where(m => m.OldKeyValue == row["nation_id"].ToString()).FirstOrDefault().NewKeyValue;
+ // }
+
+ // Guid PatientId = GuidGenerator.Create(); //档案ID
+
+ // var data = new Patient(PatientId)
+ // {
+ // Address = row["address"].ToString(),
+ // BirthDate = string.IsNullOrEmpty(row["birth_date"].ToString()) ? null : Convert.ToDateTime(row["birth_date"].ToString()),
+ // BirthPlaceId = null,
+ // DisplayName = row["name"].ToString(),
+ // Email = row["email"].ToString(),
+ // IdNo = row["id_card_no"].ToString(),
+ // MaritalStatusId = Convert.ToChar(row["marital_status_id"].ToString()),
+ // MedicalCenterId = defaultMedicalCenterId,
+ // MobileTelephone = row["mobile_telephone"].ToString(),
+ // NationId = nationId,
+ // PatientNo = row["patient_id"].ToString(),
+ // PatientPassword = row["patient_password"].ToString(),
+ // PostalCode = row["postalcode"].ToString(),
+ // SexId = ConvertSex(row["sex_id"].ToString()),
+ // SimpleCode = LanguageConverter.GetPYSimpleCode(row["name"].ToString()),
+ // Telephone = row["telephone"].ToString()
+ // };
+
+ // dataList.Add(data);
+
+ // fieldComparisons.Add(new FieldComparison
+ // {
+ // FieldName = "id",
+ // NewKeyValue = PatientId.ToString(),
+ // OldKeyValue = row["patient_id"].ToString(),
+ // TableName = "patient"
+ // });
+
+ // #region 增加标识
+ // veryPatientNo.Add(row["patient_id"].ToString(), row["patient_id"].ToString());
+ // #endregion
+ // }
+
+ // tempPatientNos.Add(row["patient_id"].ToString());
+ // }
+
+ // if (dataList.Any())
+ // await _patientRepository.InsertManyAsync(dataList);
+ // if (fieldComparisons.Any())
+ // await _fieldComparisonRepository.InsertManyAsync(fieldComparisons);
+
+
+ // #region 修改状态
+
+ // Thread.Sleep(100);
+
+ // await Db.Ado.ExecuteCommandAsync("update patient_register set is_hand='Y' where patient_id in (@ids) ", new { ids = tempPatientNos });
+
+ // #endregion
+ // _logger.LogInformation($"当前时间:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")},迁移数据{dataList.Count}");
+
+
+ // }
+
+
+ //}
+
/////
///// 迁移后台用户数据
diff --git a/test/Shentun.Peis.Application.Tests/BaseDataHandleTest.cs b/test/Shentun.Peis.Application.Tests/BaseDataHandleTest.cs
index e94dabd..e9f0241 100644
--- a/test/Shentun.Peis.Application.Tests/BaseDataHandleTest.cs
+++ b/test/Shentun.Peis.Application.Tests/BaseDataHandleTest.cs
@@ -28,79 +28,79 @@ namespace Shentun.Peis
_appService = GetRequiredService();
}
- [Fact]
- public async Task TransferPatientData()
- {
+ //[Fact]
+ //public async Task TransferPatientData()
+ //{
- for (int i = 0; i < 500; i++)
- {
- using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
- {
- var IsHand = await _appService.TransferPatientData();
+ // for (int i = 0; i < 500; i++)
+ // {
+ // using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
+ // {
+ // var IsHand = await _appService.TransferPatientData();
- await unitOfWork.CompleteAsync();
+ // await unitOfWork.CompleteAsync();
- _output.WriteLine($"处理{(i + 1) * 1000}");
+ // _output.WriteLine($"处理{(i + 1) * 1000}");
- if (!IsHand)
- {
- break;
- }
- }
- }
+ // if (!IsHand)
+ // {
+ // break;
+ // }
+ // }
+ // }
- }
+ //}
- [Fact]
- public async Task TransferPatientRegisterData()
- {
+ //[Fact]
+ //public async Task TransferPatientRegisterData()
+ //{
- for (int i = 0; i < 3000; i++)
- {
- using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
- {
- var IsHand = await _appService.TransferPatientRegisterData();
+ // for (int i = 0; i < 3000; i++)
+ // {
+ // using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
+ // {
+ // var IsHand = await _appService.TransferPatientRegisterData();
- await unitOfWork.CompleteAsync();
+ // await unitOfWork.CompleteAsync();
- _output.WriteLine($"处理{(i + 1) * 1000}");
+ // _output.WriteLine($"处理{(i + 1) * 1000}");
- if (!IsHand)
- {
- break;
- }
- }
- }
+ // if (!IsHand)
+ // {
+ // break;
+ // }
+ // }
+ // }
- }
+ //}
- [Fact]
- public async Task HandPatientRegisterDoctor()
- {
+ //[Fact]
+ //public async Task HandPatientRegisterDoctor()
+ //{
- for (int i = 0; i < 3000; i++)
- {
- using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
- {
- var IsHand = await _appService.HandPatientRegisterDoctor();
+ // for (int i = 0; i < 3000; i++)
+ // {
+ // using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
+ // {
+ // var IsHand = await _appService.HandPatientRegisterDoctor();
- await unitOfWork.CompleteAsync();
+ // await unitOfWork.CompleteAsync();
- _output.WriteLine($"处理{(i + 1) * 1000}");
+ // _output.WriteLine($"处理{(i + 1) * 1000}");
- if (!IsHand)
- {
- break;
- }
- }
- }
+ // if (!IsHand)
+ // {
+ // break;
+ // }
+ // }
+ // }
- }
+ //}
}
}