@ -50,43 +50,41 @@ namespace Shentun.Peis.DataMigrations
private readonly SqlSugarClient Db = new SqlSugarClient ( new ConnectionConfig ( )
{
// ConnectionString = "Data Source=.;Initial Catalog=mypeis;User ID=sa;Password=123;Encrypt=false;",
ConnectionString = "server=.;uid=sa;pwd=123;database=mypeis0501;Encrypt=false;" ,
ConnectionString = "server=.;uid=sa;pwd=123;database=mypeis;Encrypt=false;" ,
DbType = SqlSugar . DbType . SqlServer ,
IsAutoCloseConnection = true
} ) ;
private readonly SqlSugarClient PgDb = new SqlSugarClient ( new ConnectionConfig ( )
{
ConnectionString = "Host=140.143.162.39;Port=5432;Database=ShentunPeis070703;User ID=postgres;Password=shentun123;" ,
DbType = SqlSugar . DbType . PostgreSQL ,
IsAutoCloseConnection = true
} ) ;
//private readonly SqlSugarClient PgDb = new SqlSugarClient(new ConnectionConfig()
//{
// ConnectionString = "Host=140.143.162.39;Port=5432;Database=ShentunPeis070703;User ID=postgres;Password=shentun123;",
// DbType = SqlSugar.DbType.PostgreSQL,
// IsAutoCloseConnection = true
//});
//修改时间用
private readonly SqlSugarClient PgNWDb = new SqlSugarClient ( new ConnectionConfig ( )
{
ConnectionString = "Host=10.1.12.140;Port=5432;Database=ShentunPeis0503 ;User ID=postgres;Password=st123;" ,
ConnectionString = "Host=10.1.12.140;Port=5432;Database=ShentunPeis0508 ;User ID=postgres;Password=st123;" ,
DbType = SqlSugar . DbType . PostgreSQL ,
IsAutoCloseConnection = true
} ) ;
////默认指引类别ID
//private readonly Guid defaultGuidTypeId = Guid.Parse("3a120284-df18-7b36-4b12-0423a7d5c1c6");
////默认体检报告类别ID
//private readonly Guid defaultMedicalReportTypeId = Guid.Parse("3a120285-65dd-e7da-c923-6b503ab9e1d9");
//默认指引类别ID
private readonly char defaultGuidTypeId = '0' ;
//默认体检报告类别ID
private readonly char defaultMedicalReportTypeId = '0' ;
//默认体检中心
private readonly Guid defaultMedicalCenterId = Guid . Parse ( "0de5b78a-731d-4f80-b262-655ebbf04581" ) ;
//默认体检结论类别
private readonly string defaultMedicalConclusionType = "01" ;
private readonly Guid defaultSampleContainerId = Guid . Parse ( "3a1230dc-90fc-1bbc-dbd4-da9de6f2a67d" ) ;
//默认容器ID
private readonly Guid defaultSampleContainerId = Guid . Parse ( "3a126a07-eb42-a369-99e4-114a2629d714" ) ;
//默认单位性质ID
private readonly Guid defaultOrgTypeId = Guid . Parse ( "3a11fe4e-7dd3-b379-43b9-5be586097abe " ) ;
private readonly Guid defaultOrgTypeId = Guid . Parse ( "3a126a08-9607-fe40-e5da-6daa01712468 " ) ;
private readonly IRepository < DeviceType , Guid > _deviceTypeRepository ;
private readonly IRepository < ItemType , Guid > _itemTypeRepository ;
@ -140,6 +138,7 @@ namespace Shentun.Peis.DataMigrations
private readonly IRepository < SysParm > _sysParmRepository ;
private readonly IRepository < SysParmValue > _sysParmValueRepository ;
private readonly IRepository < CollectItemType , Guid > _collectItemTypeRepository ;
private readonly IRepository < PatientRegisterExter > _patientRegisterExterRepository ;
private Dictionary < string , string > veryPatientNo = new Dictionary < string , string > ( ) ;
@ -195,7 +194,8 @@ namespace Shentun.Peis.DataMigrations
IRepository < SysParmType > sysParmTypeRepository ,
IRepository < SysParm > sysParmRepository ,
IRepository < SysParmValue > sysParmValueRepository ,
IRepository < CollectItemType , Guid > collectItemTypeRepository )
IRepository < CollectItemType , Guid > collectItemTypeRepository ,
IRepository < PatientRegisterExter > patientRegisterExterRepository )
{
_deviceTypeRepository = deviceTypeRepository ;
_itemTypeRepository = itemTypeRepository ;
@ -249,6 +249,7 @@ namespace Shentun.Peis.DataMigrations
_sysParmRepository = sysParmRepository ;
_sysParmValueRepository = sysParmValueRepository ;
_collectItemTypeRepository = collectItemTypeRepository ;
_patientRegisterExterRepository = patientRegisterExterRepository ;
}
@ -870,7 +871,7 @@ namespace Shentun.Peis.DataMigrations
if ( count = = 0 )
{
var oldItemList = await Db . Ado . GetDataTableAsync ( "select * from item " ) ;
var oldItemList = await Db . Ado . GetDataTableAsync ( "select a.* from item as a left join department as b on a.department_id=b.department_id order by b.display_order,a.display_order " ) ;
if ( oldItemList . Rows . Count > 0 )
{
@ -980,6 +981,7 @@ namespace Shentun.Peis.DataMigrations
AgeUpperLimit = 2 0 0 ,
CriticalRangeValue = "" ,
ItemId = itemId ,
ForSexId = ForSexFlag . All ,
LowerDiagnosisId = null ,
ReferenceRangeTypeFlag = ItemReferenceRangeTypeFlag . Character ,
UpperDiagnosisId = null ,
@ -1028,7 +1030,7 @@ namespace Shentun.Peis.DataMigrations
if ( count = = 0 )
{
var oldAsbitemList = await Db . Ado . GetDataTableAsync ( "select * from asbitem " ) ;
var oldAsbitemList = await Db . Ado . GetDataTableAsync ( "select a.* from asbitem as a left join department as b on a.department_id=b.department_id order by b.display_order,a.display_order " ) ;
if ( oldAsbitemList . Rows . Count > 0 )
{
foreach ( DataRow row in oldAsbitemList . Rows )
@ -1204,7 +1206,7 @@ namespace Shentun.Peis.DataMigrations
if ( count = = 0 )
{
var oldMedicalPackageList = await Db . Ado . GetDataTableAsync ( "select * from medical_package " ) ;
var oldMedicalPackageList = await Db . Ado . GetDataTableAsync ( "select * from medical_package order by display_order " ) ;
if ( oldMedicalPackageList . Rows . Count > 0 )
{
foreach ( DataRow row in oldMedicalPackageList . Rows )
@ -1309,7 +1311,7 @@ namespace Shentun.Peis.DataMigrations
if ( count = = 0 )
{
var oldDiagnosisList = await Db . Ado . GetDataTableAsync ( "select * from diagnosis " ) ;
var oldDiagnosisList = await Db . Ado . GetDataTableAsync ( "select a.* from diagnosis as a left join department as b on a.department_id=b.department_id order by b.display_order,a.display_order " ) ;
if ( oldDiagnosisList . Rows . Count > 0 )
{
foreach ( DataRow row in oldDiagnosisList . Rows )
@ -1427,7 +1429,7 @@ namespace Shentun.Peis.DataMigrations
if ( count = = 0 )
{
var oldSuggestionList = await Db . Ado . GetDataTableAsync ( "select * from suggestion " ) ;
var oldSuggestionList = await Db . Ado . GetDataTableAsync ( "select * from suggestion order by display_order,suggestion_id " ) ;
if ( oldSuggestionList . Rows . Count > 0 )
{
@ -1483,7 +1485,7 @@ namespace Shentun.Peis.DataMigrations
var count = await _itemResultTemplateRepository . GetCountAsync ( ) ;
if ( count = = 0 )
{
var oldItemResultTemplateList = await Db . Ado . GetDataTableAsync ( "select * from item_result_template " ) ;
var oldItemResultTemplateList = await Db . Ado . GetDataTableAsync ( "select * from item_result_template order by display_order,item_result_template_id " ) ;
if ( oldItemResultTemplateList . Rows . Count > 0 )
{
foreach ( DataRow row in oldItemResultTemplateList . Rows )
@ -1552,7 +1554,7 @@ namespace Shentun.Peis.DataMigrations
var count = await _ItemResultMatchRepository . GetCountAsync ( ) ;
if ( count = = 0 )
{
var oldItemResultMatchList = await Db . Ado . GetDataTableAsync ( "select * from item_result_match " ) ;
var oldItemResultMatchList = await Db . Ado . GetDataTableAsync ( "select * from item_result_match order by display_order,item_result_match_id " ) ;
if ( oldItemResultMatchList . Rows . Count > 0 )
{
foreach ( DataRow row in oldItemResultMatchList . Rows )
@ -1620,7 +1622,7 @@ namespace Shentun.Peis.DataMigrations
if ( count = = 0 )
{
var oldReferenceRangeList = await Db . Ado . GetDataTableAsync ( "select * from reference_range " ) ;
var oldReferenceRangeList = await Db . Ado . GetDataTableAsync ( "select * from reference_range order by reference_range_id " ) ;
if ( oldReferenceRangeList . Rows . Count > 0 )
{
foreach ( DataRow row in oldReferenceRangeList . Rows )
@ -1694,7 +1696,7 @@ namespace Shentun.Peis.DataMigrations
}
if ( defaultSampleTypeId ! = Guid . Empty )
{
var oldSampleGroupList = await Db . Ado . GetDataTableAsync ( "select * from vessels_type order by display_order asc " ) ;
var oldSampleGroupList = await Db . Ado . GetDataTableAsync ( "select * from vessels_type order by display_order" ) ;
if ( oldSampleGroupList . Rows . Count > 0 )
{
foreach ( DataRow row in oldSampleGroupList . Rows )
@ -2096,7 +2098,7 @@ namespace Shentun.Peis.DataMigrations
var count = await _customerOrgRegisterRepository . GetCountAsync ( ) ;
if ( count = = 0 )
{
var oldCustomerOrgRegisterList = await Db . Ado . GetDataTableAsync ( "select * from org_medical_register" ) ;
var oldCustomerOrgRegisterList = await Db . Ado . GetDataTableAsync ( "select * from org_medical_register order by org_medical_times " ) ;
if ( oldCustomerOrgRegisterList . Rows . Count > 0 )
{
List < FieldComparison > fieldComparisonList = await _fieldComparisonRepository . GetListAsync ( m = > m . TableName = = "customer_org" ) ;
@ -2507,6 +2509,31 @@ namespace Shentun.Peis.DataMigrations
await _patientRegisterRepository . InsertAsync ( data ) ;
#region 人员登记扩展
var patientRegisterExterData = new PatientRegisterExter
{
IsQztlImport = Convert . ToChar ( row [ "is_qztl_import" ] . ToString ( ) ) ,
PatientRegisterId = patientRegisterId ,
Planuserid = row [ "planuserid" ] . ToString ( ) ,
QztlIsCw = Convert . ToChar ( row [ "qztl_is_cw" ] . ToString ( ) ) ,
QztlIsCy = Convert . ToChar ( row [ "qztl_is_cy" ] . ToString ( ) ) ,
QztlIsFj = Convert . ToChar ( row [ "qztl_is_fj" ] . ToString ( ) ) ,
QztlIsGt = Convert . ToChar ( row [ "qztl_is_gt" ] . ToString ( ) ) ,
QztlIsMain = Convert . ToChar ( row [ "qztl_is_main" ] . ToString ( ) ) ,
QztlIsWh = Convert . ToChar ( row [ "qztl_is_wh" ] . ToString ( ) ) ,
QztlType = string . IsNullOrEmpty ( row [ "qztl_type" ] . ToString ( ) ) ? null : Convert . ToChar ( row [ "qztl_type" ] . ToString ( ) ) ,
Remark2 = row [ "remark2" ] . ToString ( ) ,
Remark3 = row [ "remark3" ] . ToString ( ) ,
Remark4 = row [ "remark4" ] . ToString ( ) ,
UploadQztlFlag = Convert . ToChar ( row [ "upload_qztl_flag" ] . ToString ( ) )
} ;
await _patientRegisterExterRepository . InsertAsync ( patientRegisterExterData ) ;
#endregion
var fieldComparison = new FieldComparison
{
FieldName = "id" ,
@ -2538,9 +2565,6 @@ namespace Shentun.Peis.DataMigrations
/// <summary>
/// 迁移检查单 组合项目 查询register_asbitem
/// </summary>