public override int Save(object sender, object neuObject)
        {
            if (inpatientNo == null || inpatientNo == "")
            {
                MessageBox.Show("请选择患者");
                return(0);
            }
            Neusoft.HISFC.Management.HealthRecord.Diagnose diagNose = new Neusoft.HISFC.Management.HealthRecord.Diagnose();
            Neusoft.NFC.Management.Transaction             trans    = new Neusoft.NFC.Management.Transaction(diagNose.Connection);
            trans.BeginTransaction();
            diagNose.SetTrans(trans.Trans);
            this.fpEnter1.StopCellEditing();
            ArrayList list = this.GetChangeInfo();

            if (list.Count == 0)
            {
                trans.RollBack();
                MessageBox.Show("没有可保存的信息");
                return(0);
            }
            if (ValueState(list) == -1)
            {
                trans.RollBack();
                return(-1);
            }


            #region  除
            if (diagNose.DeleteDiagnoseAll(this.inpatientNo, frmType) < 0)
            {
                trans.RollBack();
                MessageBox.Show("保存诊断信息失败" + diagNose.Err);
                return(-1);
            }
            #endregion
            #region 更新 增加
            foreach (Neusoft.HISFC.Object.HealthRecord.Diagnose obj in list)
            {
                if (diagNose.InsertDiagnose(obj) < 0)
                {
                    trans.RollBack();
                    MessageBox.Show("保存失败 " + diagNose.Err);
                }
            }
            #endregion
            this.fpEnterSaveChanges();
            trans.Commit();
            ClearInfo();
            LoadInfo(inpatientNo);
            MessageBox.Show("保存成功");

            return(base.Save(sender, neuObject));
        }
        /// <summary>
        /// 设置列下拉列表

        /// </summary>
        private void initList()
        {
            try
            {
                Neusoft.HISFC.Management.HealthRecord.Diagnose da  = new Neusoft.HISFC.Management.HealthRecord.Diagnose();
                Neusoft.HISFC.Management.Manager.Constant      con = new Neusoft.HISFC.Management.Manager.Constant();
                this.fpEnter1.SelectNone = true;
                //获取出院诊断类别诊断
                //				diagnoseType = da.GetDiagnoseList();
                diagnoseType = Neusoft.HISFC.Object.HealthRecord.DiagnoseType.SpellList();
                diagnoseTypeHelper.ArrayObject = diagnoseType;
                this.fpEnter1.SetColumnList(this.fpEnter1_Sheet1, 0, diagnoseType);

                //分期列表
                PeriorList = con.GetList(Neusoft.HISFC.Object.Base.EnumConstant.DIAGPERIOD);
                this.fpEnter1.SetColumnList(this.fpEnter1_Sheet1, 7, PeriorList);
                PeriorListHelper.ArrayObject = PeriorList;
                //手术操作类型
                OperList = con.GetList(Neusoft.HISFC.Object.Base.EnumConstant.OPERATIONTYPE);
                this.fpEnter1.SetColumnList(this.fpEnter1_Sheet1, 4, OperList);
                OperListHelper.ArrayObject = OperList;

                //分级列表
                LeveList = con.GetList(Neusoft.HISFC.Object.Base.EnumConstant.DIAGLEVEL);
                this.fpEnter1.SetColumnList(this.fpEnter1_Sheet1, 8, LeveList);
                LeveListHelper.ArrayObject = LeveList;

                //出院情况列表
                diagOutStateList = con.GetList(Neusoft.HISFC.Object.Base.EnumConstant.ZG);
                this.fpEnter1.SetColumnList(this.fpEnter1_Sheet1, 3, diagOutStateList);
                diagOutStateListHelper.ArrayObject = diagOutStateList;

                this.fpEnter1.SetWidthAndHeight(200, 200);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        /// <summary>
        /// 根据输入的住院号/门诊号 查询诊断信息
        /// </summary>
        /// <param name="patientInfo"></param>
        /// <param name="Type"></param>
        /// <returns>-1 出错 0 传入的病人信息为空,不作处理,1 不允许有病案,2病案已经封存,不允许医生修改和查阅 3 查询有数据 4查询没有数据  </returns>
        public int LoadInfo(string InpatientNO) //Neusoft.HISFC.Object.RADT.PatientInfo patientInfo, Neusoft.HISFC.Object.HealthRecord.EnumServer.frmTypes Type)
        {
            try
            {
                if (this.fpEnter1_Sheet1.RowCount > 0)
                {
                    this.fpEnter1_Sheet1.Rows.Remove(0, this.fpEnter1_Sheet1.RowCount);
                }
                if (InpatientNO == null || InpatientNO == "")
                {
                    //没有该病人的信息
                    MessageBox.Show("请选择病人");
                    return(0);
                }
                this.inpatientNo = InpatientNO;
                Neusoft.HISFC.Object.RADT.PatientInfo             patient  = new Neusoft.HISFC.Object.RADT.PatientInfo();
                Neusoft.HISFC.Integrate.RADT                      pa       = new Neusoft.HISFC.Integrate.RADT();// Neusoft.HISFC.Management.RADT.InPatient();
                Neusoft.HISFC.Integrate.Registration.Registration register = new Neusoft.HISFC.Integrate.Registration.Registration();
                //从住院主表中查旬
                patient = pa.GetPatientInfoByPatientNO(InpatientNO);
                if (patient == null)
                {
                    Neusoft.HISFC.Object.Registration.Register obj = register.GetByClinic(InpatientNO);
                    if (obj == null)
                    {
                        MessageBox.Show("查询病人信息出错");
                        return(-1);
                    }
                    patient           = new Neusoft.HISFC.Object.RADT.PatientInfo();
                    patient.ID        = obj.ID;
                    patient.CaseState = "1";
                }

                if (patient.CaseState == "0")
                {
                    //不允许有病案
                    return(1);
                }
                //定义业务层的类

                Neusoft.HISFC.Management.HealthRecord.Diagnose diag = new Neusoft.HISFC.Management.HealthRecord.Diagnose();
                diagList = new ArrayList();

                if (frmType == Neusoft.HISFC.Object.HealthRecord.EnumServer.frmTypes.DOC) // 医生站录入病历

                {
                    #region  医生站录入病历


                    //目前允许有病历 并且目前没有录入病历  或者标志位位空(默认是允许录入病历)
                    // 医生站录入病例


                    if (patient.CaseState == null || patient.CaseState == "1" || patient.CaseState == "2")
                    {
                        //从医生站录入的信息中查询
                        diagList = diag.QueryCaseDiagnose(patient.ID, "%", Neusoft.HISFC.Object.HealthRecord.EnumServer.frmTypes.DOC);
                    }
                    else
                    {
                        // 病案已经封存已经不允许医生修改和查阅
                        return(2);
                    }

                    #endregion
                }
                else if (frmType == Neusoft.HISFC.Object.HealthRecord.EnumServer.frmTypes.CAS)//病案室录入病历

                {
                    #region 病案室录入病历

                    //目前允许有病历 并且目前没有录入病历  或者标志位位空(默认是允许录入病历)
                    if (patient.CaseState == null || patient.CaseState == "1" || patient.CaseState == "2")
                    {
                        //医生站已经录入病案

                        diagList = diag.QueryCaseDiagnose(patient.ID, "%", Neusoft.HISFC.Object.HealthRecord.EnumServer.frmTypes.DOC);
                    }
                    else if (patient.CaseState == "3")
                    {
                        //病案室已经录入病案

                        diagList = diag.QueryCaseDiagnose(patient.ID, "%", Neusoft.HISFC.Object.HealthRecord.EnumServer.frmTypes.CAS);
                    }
                    else if (patient.CaseState == "4")
                    {
                        //病案已经封存 不允许修改。

                        diagList = diag.QueryCaseDiagnose(patient.ID, "%", Neusoft.HISFC.Object.HealthRecord.EnumServer.frmTypes.CAS);
                        this.fpEnter1_Sheet1.OperationMode = FarPoint.Win.Spread.OperationMode.ReadOnly;
                    }

                    #endregion
                }
                else
                {
                    //没有传入参数 不作任何处理
                }

                if (diagList != null)
                {
                    //查询有数据

                    AddInfoToFP(diagList);
                    return(3);
                }
                else
                {//查询没有数据
                    return(4);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(-1);
            }
        }
        /// <summary>
        /// 获取修改过的信息
        /// </summary>
        /// <returns></returns>
        private ArrayList GetChangeInfo()
        {
            ArrayList list = new ArrayList();

            try
            {
                Neusoft.HISFC.Management.HealthRecord.Diagnose dia  = new Neusoft.HISFC.Management.HealthRecord.Diagnose();
                Neusoft.HISFC.Object.HealthRecord.Diagnose     info = null;
                for (int i = 0; i < this.fpEnter1_Sheet1.RowCount; i++)
                {
                    info = new Neusoft.HISFC.Object.HealthRecord.Diagnose();
                    info.DiagInfo.Patient.ID = inpatientNo;
                    //诊断类别
                    info.DiagInfo.DiagType.ID = diagnoseTypeHelper.GetID(this.fpEnter1_Sheet1.Cells[i, (int)Cols.diagType].Text);
                    info.DiagInfo.ICD10.ID    = fpEnter1_Sheet1.Cells[i, (int)Cols.ICDCode].Text;//2
                    //if (info.DiagInfo.DiagType.ID == "1") //将主诊断设置成
                    //{

                    //}
                    //else
                    //{
                    //    info.DiagInfo.IsMain = false;
                    //}
                    info.DiagInfo.ICD10.Name = fpEnter1_Sheet1.Cells[i, (int)Cols.ICDName].Text;
                    //if (row["出院情况"] != DBNull.Value)
                    //{
                    info.DiagOutState = diagOutStateListHelper.GetID(fpEnter1_Sheet1.Cells[i, (int)Cols.outState].Text); //3
                    //}
                    //if (row["有无手术"] != DBNull.Value)
                    //{
                    info.OperationFlag = OperListHelper.GetID(fpEnter1_Sheet1.Cells[i, (int)Cols.Operation].Text);
                    //}

                    //if ()//5
                    //{
                    info.Is30Disease = Neusoft.NFC.Function.NConvert.ToInt32(ConvertBool(fpEnter1_Sheet1.Cells[i, (int)Cols.disease].Value)).ToString();
                    //}
                    //else
                    //{
                    //    info.Is30Disease = "0";
                    //}
                    //if (ConvertBool(row["病理符合"]))//6
                    //{
                    info.CLPA = Neusoft.NFC.Function.NConvert.ToInt32(ConvertBool(fpEnter1_Sheet1.Cells[i, (int)Cols.clpa].Value)).ToString();
                    //}
                    //else
                    //{
                    //info.CLPA = "0";
                    //}
                    //if (row["分级"] != DBNull.Value)
                    //{
                    info.LevelCode = LeveListHelper.GetID(fpEnter1_Sheet1.Cells[i, (int)Cols.levelCode].Text); //7
                    //}
                    //if (row["分期"] != DBNull.Value)
                    //{
                    info.PeriorCode = PeriorListHelper.GetID(fpEnter1_Sheet1.Cells[i, (int)Cols.perionCode].Text);//8
                    //}
                    //if (ConvertBool(row["是否疑诊"]))//9
                    //{
                    info.DubDiagFlag     = Neusoft.NFC.Function.NConvert.ToInt32(ConvertBool(fpEnter1_Sheet1.Cells[i, (int)Cols.dubdiag].Value)).ToString();;
                    info.DiagInfo.IsMain = ConvertBool(fpEnter1_Sheet1.Cells[i, (int)Cols.mainDiag].Value);
                    //}
                    //else
                    //{
                    //    info.DubDiagFlag = "0";
                    //}
                    info.DiagInfo.HappenNo = i;
                    info.DiagInfo.DiagDate = Neusoft.NFC.Function.NConvert.ToDateTime(fpEnter1_Sheet1.Cells[i, (int)Cols.diagTime].Text); //11
                    info.Pvisit.InTime     = Neusoft.NFC.Function.NConvert.ToDateTime(fpEnter1_Sheet1.Cells[i, (int)Cols.inTime].Text);   //12
                    info.Pvisit.OutTime    = Neusoft.NFC.Function.NConvert.ToDateTime(fpEnter1_Sheet1.Cells[i, (int)Cols.outTime].Text);  //13
                    if (frmType == Neusoft.HISFC.Object.HealthRecord.EnumServer.frmTypes.DOC)
                    {
                        info.OperType = "1";
                    }
                    else if (frmType == Neusoft.HISFC.Object.HealthRecord.EnumServer.frmTypes.CAS)
                    {
                        info.OperType = "2";
                    }

                    if (fpEnter1_Sheet1.Cells[i, 0].Tag != null)
                    {
                        Neusoft.HISFC.Object.HealthRecord.Diagnose obj = (Neusoft.HISFC.Object.HealthRecord.Diagnose)fpEnter1_Sheet1.Cells[i, 0].Tag;
                        info.DiagInfo.Doctor = obj.DiagInfo.Doctor;
                    }
                    else
                    {
                        info.DiagInfo.Doctor.ID   = dia.Operator.ID;
                        info.DiagInfo.Doctor.Name = dia.Operator.Name;
                    }
                    list.Add(info);
                }
                return(list);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(null);
            }
        }