diff --git a/PEIS/Entity/BasePatient.cs b/PEIS/Entity/BasePatient.cs index 11eb5cf..8cc0091 100644 --- a/PEIS/Entity/BasePatient.cs +++ b/PEIS/Entity/BasePatient.cs @@ -110,9 +110,10 @@ namespace PEIS.Entity return true; } - public virtual bool Exits() + public virtual BasePatient Exits() { - return DAOHelp.GetDataBySQL($@"Select id FROM Base_Patient WHERE CardNo = '{this.CardNo}'").Count > 0; + var _list = DAOHelp.GetDataBySQL($@"Select id FROM Base_Patient WHERE Name='{this.Name}' AND CardNo = '{this.CardNo}' AND Sex = '{this.Sex}'"); + return _list.Count > 0 ? _list[0] : null ; } } diff --git a/PEIS/View/Base/PatientImportForm.Designer.cs b/PEIS/View/Base/PatientImportForm.Designer.cs index adf0993..bf1fdd3 100644 --- a/PEIS/View/Base/PatientImportForm.Designer.cs +++ b/PEIS/View/Base/PatientImportForm.Designer.cs @@ -65,6 +65,16 @@ this.DgcError = new DevExpress.XtraGrid.GridControl(); this.DgvError = new DevExpress.XtraGrid.Views.Grid.GridView(); this.colNo = new DevExpress.XtraGrid.Columns.GridColumn(); + this.gridColumn7 = new DevExpress.XtraGrid.Columns.GridColumn(); + this.gridColumn8 = new DevExpress.XtraGrid.Columns.GridColumn(); + this.gridColumn14 = new DevExpress.XtraGrid.Columns.GridColumn(); + this.gridColumn15 = new DevExpress.XtraGrid.Columns.GridColumn(); + this.gridColumn16 = new DevExpress.XtraGrid.Columns.GridColumn(); + this.gridColumn17 = new DevExpress.XtraGrid.Columns.GridColumn(); + this.gridColumn19 = new DevExpress.XtraGrid.Columns.GridColumn(); + this.gridColumn21 = new DevExpress.XtraGrid.Columns.GridColumn(); + this.gridColumn27 = new DevExpress.XtraGrid.Columns.GridColumn(); + this.gridColumn37 = new DevExpress.XtraGrid.Columns.GridColumn(); this.repositoryItemComboBox1 = new DevExpress.XtraEditors.Repository.RepositoryItemComboBox(); this.repositoryItemComboBox2 = new DevExpress.XtraEditors.Repository.RepositoryItemComboBox(); this.repositoryItemComboBox3 = new DevExpress.XtraEditors.Repository.RepositoryItemComboBox(); @@ -81,16 +91,6 @@ this.gridColumn36 = new DevExpress.XtraGrid.Columns.GridColumn(); this.panel2 = new System.Windows.Forms.Panel(); this.label1 = new System.Windows.Forms.Label(); - this.gridColumn7 = new DevExpress.XtraGrid.Columns.GridColumn(); - this.gridColumn8 = new DevExpress.XtraGrid.Columns.GridColumn(); - this.gridColumn14 = new DevExpress.XtraGrid.Columns.GridColumn(); - this.gridColumn15 = new DevExpress.XtraGrid.Columns.GridColumn(); - this.gridColumn16 = new DevExpress.XtraGrid.Columns.GridColumn(); - this.gridColumn17 = new DevExpress.XtraGrid.Columns.GridColumn(); - this.gridColumn19 = new DevExpress.XtraGrid.Columns.GridColumn(); - this.gridColumn21 = new DevExpress.XtraGrid.Columns.GridColumn(); - this.gridColumn27 = new DevExpress.XtraGrid.Columns.GridColumn(); - this.gridColumn37 = new DevExpress.XtraGrid.Columns.GridColumn(); this.panel1.SuspendLayout(); this.OpsPatient.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); @@ -120,7 +120,7 @@ this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(1184, 50); + this.panel1.Size = new System.Drawing.Size(1327, 50); this.panel1.TabIndex = 0; // // OpsPatient @@ -136,7 +136,7 @@ this.OpsPatient.Location = new System.Drawing.Point(0, 0); this.OpsPatient.Name = "OpsPatient"; this.OpsPatient.Padding = new System.Windows.Forms.Padding(6, 0, 0, 0); - this.OpsPatient.Size = new System.Drawing.Size(1184, 50); + this.OpsPatient.Size = new System.Drawing.Size(1327, 50); this.OpsPatient.TabIndex = 3; this.OpsPatient.Text = "menuStrip1"; // @@ -208,8 +208,8 @@ // this.splitContainer1.Panel2.Controls.Add(this.DgcError); this.splitContainer1.Panel2.Controls.Add(this.panel2); - this.splitContainer1.Size = new System.Drawing.Size(1184, 587); - this.splitContainer1.SplitterDistance = 394; + this.splitContainer1.Size = new System.Drawing.Size(1327, 738); + this.splitContainer1.SplitterDistance = 495; this.splitContainer1.TabIndex = 1; // // DgcPatient @@ -224,7 +224,7 @@ this.RiCmbEducation, this.RiCmbMarriage, this.RiDgvPatient}); - this.DgcPatient.Size = new System.Drawing.Size(1184, 394); + this.DgcPatient.Size = new System.Drawing.Size(1327, 495); this.DgcPatient.TabIndex = 130; this.DgcPatient.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { this.DgvPatient}); @@ -540,7 +540,7 @@ this.repositoryItemComboBox2, this.repositoryItemComboBox3, this.repositoryItemGridLookUpEdit1}); - this.DgcError.Size = new System.Drawing.Size(1184, 154); + this.DgcError.Size = new System.Drawing.Size(1327, 204); this.DgcError.TabIndex = 132; this.DgcError.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] { this.DgvError}); @@ -587,6 +587,86 @@ this.colNo.Visible = true; this.colNo.VisibleIndex = 0; // + // gridColumn7 + // + this.gridColumn7.Caption = "A"; + this.gridColumn7.FieldName = "ColumnA"; + this.gridColumn7.Name = "gridColumn7"; + this.gridColumn7.Visible = true; + this.gridColumn7.VisibleIndex = 1; + // + // gridColumn8 + // + this.gridColumn8.Caption = "B"; + this.gridColumn8.FieldName = "ColumnB"; + this.gridColumn8.Name = "gridColumn8"; + this.gridColumn8.Visible = true; + this.gridColumn8.VisibleIndex = 2; + // + // gridColumn14 + // + this.gridColumn14.Caption = "C"; + this.gridColumn14.FieldName = "ColumnC"; + this.gridColumn14.Name = "gridColumn14"; + this.gridColumn14.Visible = true; + this.gridColumn14.VisibleIndex = 3; + // + // gridColumn15 + // + this.gridColumn15.Caption = "D"; + this.gridColumn15.FieldName = "ColumnD"; + this.gridColumn15.Name = "gridColumn15"; + this.gridColumn15.Visible = true; + this.gridColumn15.VisibleIndex = 4; + // + // gridColumn16 + // + this.gridColumn16.Caption = "E"; + this.gridColumn16.FieldName = "ColumnE"; + this.gridColumn16.Name = "gridColumn16"; + this.gridColumn16.Visible = true; + this.gridColumn16.VisibleIndex = 5; + // + // gridColumn17 + // + this.gridColumn17.Caption = "F"; + this.gridColumn17.FieldName = "ColumnF"; + this.gridColumn17.Name = "gridColumn17"; + this.gridColumn17.Visible = true; + this.gridColumn17.VisibleIndex = 6; + // + // gridColumn19 + // + this.gridColumn19.Caption = "G"; + this.gridColumn19.FieldName = "ColumnG"; + this.gridColumn19.Name = "gridColumn19"; + this.gridColumn19.Visible = true; + this.gridColumn19.VisibleIndex = 7; + // + // gridColumn21 + // + this.gridColumn21.Caption = "H"; + this.gridColumn21.FieldName = "ColumnH"; + this.gridColumn21.Name = "gridColumn21"; + this.gridColumn21.Visible = true; + this.gridColumn21.VisibleIndex = 8; + // + // gridColumn27 + // + this.gridColumn27.Caption = "I"; + this.gridColumn27.FieldName = "ColumnI"; + this.gridColumn27.Name = "gridColumn27"; + this.gridColumn27.Visible = true; + this.gridColumn27.VisibleIndex = 9; + // + // gridColumn37 + // + this.gridColumn37.Caption = "J"; + this.gridColumn37.FieldName = "ColumnJ"; + this.gridColumn37.Name = "gridColumn37"; + this.gridColumn37.Visible = true; + this.gridColumn37.VisibleIndex = 10; + // // repositoryItemComboBox1 // this.repositoryItemComboBox1.AutoHeight = false; @@ -739,7 +819,7 @@ this.panel2.Dock = System.Windows.Forms.DockStyle.Top; this.panel2.Location = new System.Drawing.Point(0, 0); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(1184, 35); + this.panel2.Size = new System.Drawing.Size(1327, 35); this.panel2.TabIndex = 131; // // label1 @@ -750,100 +830,21 @@ this.label1.Margin = new System.Windows.Forms.Padding(0); this.label1.Name = "label1"; this.label1.Padding = new System.Windows.Forms.Padding(8, 0, 8, 0); - this.label1.Size = new System.Drawing.Size(1184, 35); + this.label1.Size = new System.Drawing.Size(1327, 35); this.label1.TabIndex = 0; this.label1.Text = "导入失败列表:"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // - // gridColumn7 - // - this.gridColumn7.Caption = "A"; - this.gridColumn7.FieldName = "ColumnA"; - this.gridColumn7.Name = "gridColumn7"; - this.gridColumn7.Visible = true; - this.gridColumn7.VisibleIndex = 1; - // - // gridColumn8 - // - this.gridColumn8.Caption = "B"; - this.gridColumn8.FieldName = "ColumnB"; - this.gridColumn8.Name = "gridColumn8"; - this.gridColumn8.Visible = true; - this.gridColumn8.VisibleIndex = 2; - // - // gridColumn14 - // - this.gridColumn14.Caption = "C"; - this.gridColumn14.FieldName = "ColumnC"; - this.gridColumn14.Name = "gridColumn14"; - this.gridColumn14.Visible = true; - this.gridColumn14.VisibleIndex = 3; - // - // gridColumn15 - // - this.gridColumn15.Caption = "D"; - this.gridColumn15.FieldName = "ColumnD"; - this.gridColumn15.Name = "gridColumn15"; - this.gridColumn15.Visible = true; - this.gridColumn15.VisibleIndex = 4; - // - // gridColumn16 - // - this.gridColumn16.Caption = "E"; - this.gridColumn16.FieldName = "ColumnE"; - this.gridColumn16.Name = "gridColumn16"; - this.gridColumn16.Visible = true; - this.gridColumn16.VisibleIndex = 5; - // - // gridColumn17 - // - this.gridColumn17.Caption = "F"; - this.gridColumn17.FieldName = "ColumnF"; - this.gridColumn17.Name = "gridColumn17"; - this.gridColumn17.Visible = true; - this.gridColumn17.VisibleIndex = 6; - // - // gridColumn19 - // - this.gridColumn19.Caption = "G"; - this.gridColumn19.FieldName = "ColumnG"; - this.gridColumn19.Name = "gridColumn19"; - this.gridColumn19.Visible = true; - this.gridColumn19.VisibleIndex = 7; - // - // gridColumn21 - // - this.gridColumn21.Caption = "H"; - this.gridColumn21.FieldName = "ColumnH"; - this.gridColumn21.Name = "gridColumn21"; - this.gridColumn21.Visible = true; - this.gridColumn21.VisibleIndex = 8; - // - // gridColumn27 - // - this.gridColumn27.Caption = "I"; - this.gridColumn27.FieldName = "ColumnI"; - this.gridColumn27.Name = "gridColumn27"; - this.gridColumn27.Visible = true; - this.gridColumn27.VisibleIndex = 9; - // - // gridColumn37 - // - this.gridColumn37.Caption = "J"; - this.gridColumn37.FieldName = "ColumnJ"; - this.gridColumn37.Name = "gridColumn37"; - this.gridColumn37.Visible = true; - this.gridColumn37.VisibleIndex = 10; - // // PatientImportForm // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1184, 637); + this.ClientSize = new System.Drawing.Size(1327, 788); this.Controls.Add(this.splitContainer1); this.Controls.Add(this.panel1); this.MainMenuStrip = this.OpsPatient; this.Name = "PatientImportForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "团体成员导入"; this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); diff --git a/PEIS/View/Base/PatientImportForm.cs b/PEIS/View/Base/PatientImportForm.cs index 6ef40f9..fbb6725 100644 --- a/PEIS/View/Base/PatientImportForm.cs +++ b/PEIS/View/Base/PatientImportForm.cs @@ -89,6 +89,7 @@ namespace PEIS.View.Base int succeedCount = 0; var errorList = new List(); + var updateList = new List(); _lstPatient = new List(); var createTime = DateTime.Now; foreach (var item in _patients) @@ -99,7 +100,8 @@ namespace PEIS.View.Base basePatient.CreateTime = createTime; basePatient.Creator = Global.currentUser.Name; basePatient.CreatorCode = Global.currentUser.Code; - if (!basePatient.Exits()) + var sysBasePatient = basePatient.Exits(); + if (sysBasePatient == null) { if (!basePatient.Save()) { @@ -108,16 +110,57 @@ namespace PEIS.View.Base continue; } } + else + { + BasePatient newBase = new BasePatient() + { + ID = sysBasePatient.ID, + Name = basePatient.Name, + Sex = basePatient.Sex, + CardType = basePatient.CardType, + CardNo = basePatient.CardNo, + Nation = basePatient.Nation, + Marriage = basePatient.Marriage, + Address1 = basePatient.Address1, + Tel1 = basePatient.Tel1, + Description = basePatient.Description, + CreateTime = DateTime.Now, + Creator = Global.currentUser.Name, + CreatorCode = Global.currentUser.Code + + }; + + var uSql = $@"UPDATE Base_Patient + SET NAME = '{basePatient.Name}', + Sex = '{basePatient.Sex}', + CardType = '{basePatient.CardType}', + CardNo = '{basePatient.CardNo}', + Nation = '{basePatient.Nation}', + Marriage = '{basePatient.Marriage}', + Address1 = '{basePatient.Address1}', + Tel1 = '{basePatient.Tel1}', + Description = '{basePatient.Description}', + CreateTime = '{DateTime.Now}', + Creator = '{Global.currentUser.Name}', + CreatorCode = '{Global.currentUser.Code}' + WHERE ID = {sysBasePatient.ID} "; + if (!(DAOHelp.ExecuteSql(uSql) > 0)) + { + item.ImportErrorInfo = "信息更新失败"; + errorList.Add(new ExcelRowModel(item)); + continue; + } + } var sql = $@"SELECT ID,Name,Sex,CardNo, CardType, Birthday, Education, Nation, Tel1, Tel2,Marriage,Address1 -FROM Base_Patient WHERE Name='{basePatient.Name}' AND CardNo = '{basePatient.CardNo}' "; +FROM Base_Patient WHERE Name='{basePatient.Name}' AND CardNo = '{basePatient.CardNo}' AND Sex = '{basePatient.Sex}' "; var add = (DAOHelp.GetDataBySQL(sql).FirstOrDefault()); if (add == null) { - item.Description = "导入名单中的姓名和证件号与基础信息中不匹配!"; + item.Description = "导入名单中的姓名、证件号或性别与基础信息中不匹配!"; errorList.Add(new ExcelRowModel(item)); continue; } diff --git a/PEIS/View/Base/PatientImportForm.resx b/PEIS/View/Base/PatientImportForm.resx index 2cb9f76..f8fa9b2 100644 --- a/PEIS/View/Base/PatientImportForm.resx +++ b/PEIS/View/Base/PatientImportForm.resx @@ -120,6 +120,9 @@ 17, 17 + + 17, 17 + diff --git a/PEIS/View/Enrollment/NewEnrollmentOrgForm.cs b/PEIS/View/Enrollment/NewEnrollmentOrgForm.cs index 3cda046..22a76f9 100644 --- a/PEIS/View/Enrollment/NewEnrollmentOrgForm.cs +++ b/PEIS/View/Enrollment/NewEnrollmentOrgForm.cs @@ -1,9 +1,11 @@ using LIS.Model; +using NPinyin; using PEIS.Base; using PEIS.Entity; using PEIS.Utils; using PEIS.View.Base; using System; +using System.Text; using System.Windows.Forms; namespace PEIS.View.Enrollment @@ -60,6 +62,7 @@ namespace PEIS.View.Enrollment enrollmentOrg.ExamDate = DtpExamDate.Value; enrollmentOrg.Name = TxtName.Text.Trim(); enrollmentOrg.OID = _org.ID; + enrollmentOrg.SpellCode = Pinyin.GetInitials(TxtName.Text.Trim(), Encoding.UTF8).ToLower(); enrollmentOrg.Save(); Close(); }