实现挂号管理窗体功能代码分析(三)

来源:互联网 发布:iphone2333软件 编辑:程序博客网 时间:2024/05/01 20:17

第三步:实现挂号管理窗体功能代码分析(三)

1、绑定所有下拉框代码

(1)、数据库存储过程:

--查询会员类型IF(@Type='FRM_GuaHaoGuanLi_Load_ChaXunHuiYuanLeiXing')BEGINSELECTLTRIM(RTRIM(MemberCategoryID))ASMemberCategoryID,LTRIM(RTRIM(MemberCategoryName))ASMemberCategoryNameFROMBT_MemberCategoryTableEND--查询婚姻情况IF(@Type='FRM_GuaHaoGuanLi_Load_ChaXunHunYinQingKuang')BEGINSELECTLTRIM(RTRIM(AttributeDetailsID))ASAttributeDetailsID,LTRIM(RTRIM(AttributeDetailsName))ASAttributeDetailsNameFROMBT_AttributeDetailsTableWHEREBT_AttributeDetailsTable.AttributeSetID=20END--查询参保类型IF(@Type='FRM_GuaHaoGuanLi_Load_ChaXunCanBaoLeiXing')BEGINSELECTLTRIM(RTRIM(AttributeDetailsID))ASAttributeDetailsID,LTRIM(RTRIM(AttributeDetailsName))ASAttributeDetailsNameFROMBT_AttributeDetailsTableWHEREBT_AttributeDetailsTable.AttributeSetID=21END--查询性别IF(@Type='FRM_GuaHaoGuanLi_Load_ChaXunXingBie')BEGINSELECTLTRIM(RTRIM(AttributeDetailsID))ASAttributeDetailsID,LTRIM(RTRIM(AttributeDetailsName))ASAttributeDetailsNameFROMBT_AttributeDetailsTableWHEREBT_AttributeDetailsTable.AttributeSetID=2END--查询病人类别IF(@Type='FRM_GuaHaoGuanLi_Load_ChaXunBingRenLeiBie')BEGINSELECTLTRIM(RTRIM(PatientCategoryID))ASPatientCategoryID,LTRIM(RTRIM(CategoryName))ASCategoryNameFROMBT_PatientCategoryTableEND--查询收费方式IF(@Type='FRM_GuaHaoGuanLi_Load_ChaXunShouFeiFangShi')BEGINSELECTLTRIM(RTRIM(AttributeDetailsID))ASAttributeDetailsID,LTRIM(RTRIM(AttributeDetailsName))ASAttributeDetailsNameFROMBT_AttributeDetailsTableWHEREBT_AttributeDetailsTable.AttributeSetID=17END--查询撰写医生IF(@Type='FRM_GuaHaoGuanLi_Load_ChaXunZhuanXieYiSheng')BEGINSELECTLTRIM(RTRIM(StaffID))ASStaffID,LTRIM(RTRIM(StaffName))ASStaffNameFROMBT_StaffTableWHEREBT_StaffTable.AS_StaffPositionID=21END--查询撰写科室IF(@Type='FRM_GuaHaoGuanLi_Load_ChaXunKeShi')BEGINSELECTLTRIM(RTRIM(TechnicalOfficesID))ASTechnicalOfficesID,LTRIM(RTRIM(TechnicalOfficesName))ASTechnicalOfficesNameFROMBT_TechnicalOfficesTableEND--查询挂号类型IF(@Type='FRM_GuaHaoGuanLi_Load_ChaXunGuaHaoLeiXing')BEGINSELECTLTRIM(RTRIM(RegisterCategoryID))ASRegisterCategoryID,LTRIM(RTRIM(RegisterCategoryName))ASRegisterCategoryNameFROMBT_RegisterCategoryTableEND--查询操作员IF(@Type='FRM_GuaHaoGuanLi_Load_ChaXunCaoZuoYuan')BEGINSELECTLTRIM(RTRIM(StaffID))ASStaffID,LTRIM(RTRIM(StaffName))ASStaffNameFROMBT_StaffTableWHEREBT_StaffTable.AS_StaffPositionID=24END--查询班次IF(@Type='FRM_GuaHaoGuanLi_Load_ChaXunBanCi')BEGINSELECTLTRIM(RTRIM(ClassesID))ASClassesID,LTRIM(RTRIM(ClassesName))ASClassesNameFROMBT_ClassesTableEND


 

(2)、逻辑层代码:

DALPublic.DALMethod myDALMethod = new DALPublic.DALMethod();        [OperationContract]        #region 查询会员类型publicDataSet FRM_GuaHaoGuanLi_Load_ChaXunHuiYuanLeiXing()        {SqlParameter[] SQLCMDpas ={newSqlParameter ("@Type",SqlDbType.Char),                                              };            SQLCMDpas[0].Value = "FRM_GuaHaoGuanLi_Load_ChaXunHuiYuanLeiXing";DataTable myDataTable = myDALMethod.QueryDataTable("GuaHaoShouFei_FRM_GuaHaoGuanLi", SQLCMDpas);DataSet myDataSet = newDataSet();            myDataSet.Tables.Add(myDataTable);return myDataSet;        }        #endregion        [OperationContract]        #region 查询婚姻情况?publicDataSet FRM_GuaHaoGuanLi_Load_ChaXunHunYinQingKuang()        {SqlParameter[] SQLCMDpas ={newSqlParameter ("@Type",SqlDbType.Char),                                              };            SQLCMDpas[0].Value = "FRM_GuaHaoGuanLi_Load_ChaXunHunYinQingKuang";DataTable myDataTable = myDALMethod.QueryDataTable("GuaHaoShouFei_FRM_GuaHaoGuanLi", SQLCMDpas);DataSet myDataSet = newDataSet();            myDataSet.Tables.Add(myDataTable);return myDataSet;        }        #endregion        [OperationContract]        #region 查询参保类型publicDataSet FRM_GuaHaoGuanLi_Load_ChaXunCanBaoLeiXing()        {SqlParameter[] SQLCMDpas ={newSqlParameter ("@Type",SqlDbType.Char),                                              };            SQLCMDpas[0].Value = "FRM_GuaHaoGuanLi_Load_ChaXunCanBaoLeiXing";DataTable myDataTable = myDALMethod.QueryDataTable("GuaHaoShouFei_FRM_GuaHaoGuanLi", SQLCMDpas);DataSet myDataSet = newDataSet();            myDataSet.Tables.Add(myDataTable);return myDataSet;        }        #endregion        [OperationContract]        #region 查询性别publicDataSet FRM_GuaHaoGuanLi_Load_ChaXunXingBie()        {SqlParameter[] SQLCMDpas ={newSqlParameter ("@Type",SqlDbType.Char),                                              };            SQLCMDpas[0].Value = "FRM_GuaHaoGuanLi_Load_ChaXunXingBie";DataTable myDataTable = myDALMethod.QueryDataTable("GuaHaoShouFei_FRM_GuaHaoGuanLi", SQLCMDpas);DataSet myDataSet = newDataSet();            myDataSet.Tables.Add(myDataTable);return myDataSet;        }        #endregion        [OperationContract]        #region 查询病人类别publicDataSet FRM_GuaHaoGuanLi_Load_ChaXunBingRenLeiBie()        {SqlParameter[] SQLCMDpas ={newSqlParameter ("@Type",SqlDbType.Char),                                              };            SQLCMDpas[0].Value = "FRM_GuaHaoGuanLi_Load_ChaXunBingRenLeiBie";DataTable myDataTable = myDALMethod.QueryDataTable("GuaHaoShouFei_FRM_GuaHaoGuanLi", SQLCMDpas);DataSet myDataSet = newDataSet();            myDataSet.Tables.Add(myDataTable);return myDataSet;        }        #endregion        [OperationContract]        #region 查询收费方式publicDataSet FRM_GuaHaoGuanLi_Load_ChaXunShouFeiFangShi()        {SqlParameter[] SQLCMDpas ={newSqlParameter ("@Type",SqlDbType.Char),                                              };            SQLCMDpas[0].Value = "FRM_GuaHaoGuanLi_Load_ChaXunShouFeiFangShi";DataTable myDataTable = myDALMethod.QueryDataTable("GuaHaoShouFei_FRM_GuaHaoGuanLi", SQLCMDpas);DataSet myDataSet = newDataSet();            myDataSet.Tables.Add(myDataTable);return myDataSet;        }        #endregion        [OperationContract]        #region 查询医生publicDataSet FRM_GuaHaoGuanLi_Load_ChaXunZhuanXieYiSheng()        {SqlParameter[] SQLCMDpas ={newSqlParameter ("@Type",SqlDbType.Char),                                              };            SQLCMDpas[0].Value = "FRM_GuaHaoGuanLi_Load_ChaXunZhuanXieYiSheng";DataTable myDataTable = myDALMethod.QueryDataTable("GuaHaoShouFei_FRM_GuaHaoGuanLi", SQLCMDpas);DataSet myDataSet = newDataSet();            myDataSet.Tables.Add(myDataTable);return myDataSet;        }        #endregion        [OperationContract]        #region 查询科室publicDataSet FRM_GuaHaoGuanLi_Load_ChaXunKeShi()        {SqlParameter[] SQLCMDpas ={newSqlParameter ("@Type",SqlDbType.Char),                                              };            SQLCMDpas[0].Value = "FRM_GuaHaoGuanLi_Load_ChaXunKeShi";DataTable myDataTable = myDALMethod.QueryDataTable("GuaHaoShouFei_FRM_GuaHaoGuanLi", SQLCMDpas);DataSet myDataSet = newDataSet();            myDataSet.Tables.Add(myDataTable);return myDataSet;        }        #endregion        [OperationContract]        #region 查询挂号类型publicDataSet FRM_GuaHaoGuanLi_Load_ChaXunGuaHaoLeiXing()        {SqlParameter[] SQLCMDpas ={newSqlParameter ("@Type",SqlDbType.Char),                                              };            SQLCMDpas[0].Value = "FRM_GuaHaoGuanLi_Load_ChaXunGuaHaoLeiXing";DataTable myDataTable = myDALMethod.QueryDataTable("GuaHaoShouFei_FRM_GuaHaoGuanLi", SQLCMDpas);DataSet myDataSet = newDataSet();            myDataSet.Tables.Add(myDataTable);return myDataSet;        }        #endregion        [OperationContract]        #region 查询操作员publicDataSet FRM_GuaHaoGuanLi_Load_ChaXunCaoZuoYuan()        {SqlParameter[] SQLCMDpas ={newSqlParameter ("@Type",SqlDbType.Char),                                              };            SQLCMDpas[0].Value = "FRM_GuaHaoGuanLi_Load_ChaXunCaoZuoYuan";DataTable myDataTable = myDALMethod.QueryDataTable("GuaHaoShouFei_FRM_GuaHaoGuanLi", SQLCMDpas);DataSet myDataSet = newDataSet();            myDataSet.Tables.Add(myDataTable);return myDataSet;        }        #endregion        [OperationContract]        #region 查询班次publicDataSet FRM_GuaHaoGuanLi_Load_ChaXunBanCi()        {SqlParameter[] SQLCMDpas ={newSqlParameter ("@Type",SqlDbType.Char),                                              };            SQLCMDpas[0].Value = "FRM_GuaHaoGuanLi_Load_ChaXunBanCi";DataTable myDataTable = myDALMethod.QueryDataTable("GuaHaoShouFei_FRM_GuaHaoGuanLi", SQLCMDpas);DataSet myDataSet = newDataSet();            myDataSet.Tables.Add(myDataTable);return myDataSet;        }        #endregion


 

(3)、界面层代码:

绑定下拉框的公共方法:

publicclassPublicStaticMothd    {        #region 设置下拉框publicstaticComboBox SetZhiXiaLaKuang(ComboBox cbo下拉框, System.Data.DataTable dt数据表 ,string str列ID, string str列名)        {try            {                cbo下拉框.DataSource = dt数据表;                cbo下拉框.DisplayMember = str列名;                cbo下拉框.ValueMember = str列ID;return cbo下拉框;            }catch (Exception exc)            {MessageBox.Show(exc.ToString());returnnull;            }        }        #endregion}


 

绑定下拉框方法:

 

#region Load事件privatevoid FRM_GuaHaoGuanLi_Load(object sender, EventArgs e)        {            ChaXunGuaHaoXinXi();//查询全部的挂号单信息            dgvRegister.ClearSelection();            #region 绑定下拉框DataTable dtMaritalStatus = myFRM_GuaHaoGuanLiClient.FRM_GuaHaoGuanLi_Load_ChaXunHunYinQingKuang().Tables[0];            cboMaritalStatus = PublicStaticMothd.SetZhiXiaLaKuang(cboMaritalStatus, dtMaritalStatus, "AttributeDetailsID", "AttributeDetailsName");//绑定婚姻情况的下拉框数据DataTable dtInsuredType = myFRM_GuaHaoGuanLiClient.FRM_GuaHaoGuanLi_Load_ChaXunCanBaoLeiXing().Tables[0];            cboInsuredType = PublicStaticMothd.SetZhiXiaLaKuang(cboInsuredType, dtInsuredType, "AttributeDetailsID", "AttributeDetailsName");//绑定参保类型的下拉框数据DataTable dtSex = myFRM_GuaHaoGuanLiClient.FRM_GuaHaoGuanLi_Load_ChaXunXingBie().Tables[0];            cboSex = PublicStaticMothd.SetZhiXiaLaKuang(cboSex, dtSex, "AttributeDetailsID", "AttributeDetailsName");//绑悒定性别纄的下拉框数簓据DataTable dtPatientCategory  = myFRM_GuaHaoGuanLiClient.FRM_GuaHaoGuanLi_Load_ChaXunBingRenLeiBie().Tables[0];            cboPatientCategory = PublicStaticMothd.SetZhiXiaLaKuang(cboPatientCategory, dtPatientCategory, "PatientCategoryID", "CategoryName");//绑悒定病人类别的下拉框数簓据DataTable dtSettleAccountsWay = myFRM_GuaHaoGuanLiClient.FRM_GuaHaoGuanLi_Load_ChaXunShouFeiFangShi().Tables[0];            cboSettleAccountsWay = PublicStaticMothd.SetZhiXiaLaKuang(cboSettleAccountsWay, dtSettleAccountsWay, "AttributeDetailsID", "AttributeDetailsName");  //绑悒定收费方式的下拉框数据DataTable dtMemberType = myFRM_GuaHaoGuanLiClient.FRM_GuaHaoGuanLi_Load_ChaXunHuiYuanLeiXing().Tables[0];            cboMemberType = PublicStaticMothd.SetZhiXiaLaKuang(cboMemberType, dtMemberType, "MemberCategoryID", "MemberCategoryName"); //绑悒定会员类型DataTable dtDoctorStaff = myFRM_GuaHaoGuanLiClient.FRM_GuaHaoGuanLi_Load_ChaXunZhuanXieYiSheng().Tables[0];            cboDoctorStaff = PublicStaticMothd.SetZhiXiaLaKuang(cboDoctorStaff, dtDoctorStaff, "StaffID", "StaffName");//绑定医生DataTable dtTechnicalOffices = myFRM_GuaHaoGuanLiClient.FRM_GuaHaoGuanLi_Load_ChaXunKeShi().Tables[0];            cboTechnicalOffices = PublicStaticMothd.SetZhiXiaLaKuang(cboTechnicalOffices, dtTechnicalOffices, "TechnicalOfficesID", "TechnicalOfficesName",true);//绑悒定科室DataTable dtRegisterCategory = myFRM_GuaHaoGuanLiClient.FRM_GuaHaoGuanLi_Load_ChaXunGuaHaoLeiXing().Tables[0];            cboRegisterCategory = PublicStaticMothd.SetZhiXiaLaKuang(cboRegisterCategory, dtRegisterCategory, "RegisterCategoryID", "RegisterCategoryName");//绑定挂号类型DataTable dtRegisterOperator = myFRM_GuaHaoGuanLiClient.FRM_GuaHaoGuanLi_Load_ChaXunCaoZuoYuan().Tables[0];            cboRegisterOperator = PublicStaticMothd.SetZhiXiaLaKuang(cboRegisterOperator, dtRegisterOperator, "StaffID", "StaffName");//绑悒定操作员DataTable dtClasses = myFRM_GuaHaoGuanLiClient.FRM_GuaHaoGuanLi_Load_ChaXunBanCi().Tables[0];            cboClasses = PublicStaticMothd.SetZhiXiaLaKuang(cboClasses, dtClasses, "ClassesID", "ClassesName");//绑定操作员#endregion


 

2、自动生成最大单据号和保存病人信息代码

(1)、数据库存储过程:

--病人卡号最大单据数IF(@Type='btnSave_Click_ChaXunBingRenKaHao')BEGINBEGINTRANUPDATEPW_TheLargestNumberStatisticalTableSETPatientCardMaximumNumber=PatientCardMaximumNumber+1SELECTPatientCardMaximumNumberFROMPW_TheLargestNumberStatisticalTableCOMMITTRANEND--新增病人信息IF(@Type='btnBaoCunBingRenXinXi_Click_XinZengBingRenXinXi')BEGINBEGINTRANINSERTBT_PatientTable(PatientCardNumber,PatientName,AS_SexID,AS_MaritalStatusID,Profession,MemberTypeID,MedicareCardNumber,AS_InsuredTypeID,ContactTelephone,ContactAddress,DrugAllergyHistory,PatientCategoryID,Age,Birthday,PersonalTaboo)VALUES  (@PatientCardNumber,@PatientName,@AS_SexID,@AS_MaritalStatusID,@Profession,@MemberTypeID,@MedicareCardNumber,@AS_InsuredTypeID,@ContactTelephone,@ContactAddress,@DrugAllergyHistory,@PatientCategoryID,@Age,@Birthday,@PersonalTaboo)SELECT@@IDENTITYCOMMITTRANEND


 

(2)、逻辑层代码:

[OperationContract]        #region 修改并查询挂号单号最大单据数publicDataSet btnCancel_Click_ChaXunBingRenKaHao()        {SqlParameter[] SQLCMDpas ={newSqlParameter ("@Type",SqlDbType.Char),                                              };            SQLCMDpas[0].Value = "btnCancel_Click_ChaXunBingRenKaHao";DataTable myDataTable = myDALMethod.QueryDataTable("GuaHaoShouFei_FRM_GuaHaoGuanLi", SQLCMDpas);DataSet myDataSet = newDataSet();            myDataSet.Tables.Add(myDataTable);return myDataSet;        }        #endregion[OperationContract]        #region 新增病人信息publicDataSet btnBaoCunBingRenXinXi_Click_XinZengBingRenXinXi(string strPatientCardNumber, string strPatientName, int intAS_SexID, int intAS_MaritalStatusID, string strProfession,int intMemberTypeID, string strMedicareCardNumber, int intAS_InsuredTypeID, string strContactTelephone, string strContactAddress, string strDrugAllergyHistory,int intPatientCategoryID, string strAge, DateTime dtmBirthday, string strPersonalTaboo)        {SqlParameter[] SQLCMDpas ={newSqlParameter ("@Type",SqlDbType.Char),newSqlParameter ("@PatientCardNumber",SqlDbType.Char),newSqlParameter ("@PatientName",SqlDbType.Char),newSqlParameter ("@AS_SexID",SqlDbType.Int),newSqlParameter ("@AS_MaritalStatusID",SqlDbType.Int),newSqlParameter ("@Profession",SqlDbType.Char),newSqlParameter ("@MemberTypeID",SqlDbType.Int),newSqlParameter ("@MedicareCardNumber",SqlDbType.Char),newSqlParameter ("@AS_InsuredTypeID",SqlDbType.Int),newSqlParameter ("@ContactTelephone",SqlDbType.Char),newSqlParameter ("@ContactAddress",SqlDbType.Char),newSqlParameter ("@DrugAllergyHistory",SqlDbType.Char),newSqlParameter ("@PatientCategoryID",SqlDbType.Int),  newSqlParameter ("@Age",SqlDbType.Char),newSqlParameter ("@Birthday",SqlDbType.DateTime),newSqlParameter ("@PersonalTaboo",SqlDbType.Char),                                      };            SQLCMDpas[0].Value = "btnBaoCunBingRenXinXi_Click_XinZengBingRenXinXi";            SQLCMDpas[1].Value = strPatientCardNumber;            SQLCMDpas[2].Value = strPatientName;            SQLCMDpas[3].Value = intAS_SexID;            SQLCMDpas[4].Value = intAS_MaritalStatusID;            SQLCMDpas[5].Value = strProfession;            SQLCMDpas[6].Value = intMemberTypeID;            SQLCMDpas[7].Value = strMedicareCardNumber;            SQLCMDpas[8].Value = intAS_InsuredTypeID;            SQLCMDpas[9].Value = strContactTelephone;            SQLCMDpas[10].Value = strContactAddress;            SQLCMDpas[11].Value = strDrugAllergyHistory;            SQLCMDpas[12].Value = intPatientCategoryID;            SQLCMDpas[13].Value = strAge;            SQLCMDpas[14].Value = dtmBirthday;            SQLCMDpas[15].Value = strPersonalTaboo;          DataTable myDataTable = myDALMethod.QueryDataTable("GuaHaoShouFei_FRM_GuaHaoGuanLi", SQLCMDpas);DataSet myDataSet = newDataSet();            myDataSet.Tables.Add(myDataTable);return myDataSet;        }        #endregion


 

(3)、界面层代码:

#region 根据单据数、日期生成病人卡号publicstring GenerateReceipts() //生成单据数        {DataTable dt=myFRM_GuaHaoGuanLiClient.btnSave_Click_ChaXunBingRenKaHao().Tables[0];            strReceipts = dt.Rows[0]["PatientCardMaximumNumber"].ToString();           switch (strReceipts.Length)            { case 1:                    strReceipts ="000"+strReceipts ;break ;case 2:                    strReceipts ="00"+strReceipts ;break ;case 3:                    strReceipts ="0"+strReceipts ;break ;case 4:                    strReceipts = "" + strReceipts;break;default:break;            }DateTime dtmNow = DateTime.Now;string strYear = dtmNow.Year.ToString().Trim();string strMonth = dtmNow.Month.ToString().Trim();            strMonth =(strMonth.Length ==1? "0"+strMonth:strMonth);string strDay=dtmNow.Day.ToString().Trim();            strDay =(strDay.Length ==1?"0"+strDay :strDay );return"BK" + strYear + strMonth + strDay + strReceipts;        }        #endregion #region 挂号privatevoid btnRegister_Click(object sender, EventArgs e)        {            #region 保存病人信息if (txtPatientName.Text != ""&& cboSex.SelectedValue.ToString() != ""&& cboMaritalStatus.SelectedValue.ToString() != ""&& txtProfession.Text != ""&& cboMemberType.SelectedValue.ToString() != ""&& txtMedicareCardNumber.Text != ""&& cboInsuredType.SelectedValue.ToString() != ""&& txtContactTelephone.Text != ""&& txtContactAddress.Text != ""&& txtDrugAllergyHistory.Text != ""&& cboPatientCategory.SelectedValue.ToString() != ""&& txtAge.Text != ""&& dtpBirthday.Text != ""&& txtPersonalTaboo.Text != "")            {if (SwitchTwo == true)                {                    txtPatientCardNumber.Text = GenerateReceipts();//自动生成病人卡号string strPatientCardNumber = txtPatientCardNumber.Text;string strPatientName = txtPatientName.Text.ToString().Trim();int intAS_SexID = Convert.ToInt32(cboSex.SelectedValue);int intAS_MaritalStatusID = Convert.ToInt32(cboMaritalStatus.SelectedValue);string strProfession = txtProfession.Text.ToString().Trim();int intMemberTypeID = Convert.ToInt32(cboMemberType.SelectedValue);//string strMedicareCardNumber = txtMedicareCardNumber.Text.ToString().Trim();int intAS_InsuredTypeID = Convert.ToInt32(cboInsuredType.SelectedValue);string strContactTelephone = txtContactTelephone.Text.ToString().Trim();string strContactAddress = txtContactAddress.Text.ToString().Trim();string strDrugAllergyHistory = txtDrugAllergyHistory.Text.ToString().Trim();int intPatientCategoryID = Convert.ToInt32(cboPatientCategory.SelectedValue);string strAge = txtAge.Text.ToString().Trim();DateTime dtmBirthday = Convert.ToDateTime(dtpBirthday.Value);string strPersonalTaboo = txtPersonalTaboo.Text.ToString().Trim();                   DataTable dtRegister = myFRM_GuaHaoGuanLiClient.btnBaoCunBingRenXinXi_Click_XinZengBingRenXinXi(strPatientCardNumber, strPatientName, intAS_SexID,                        intAS_MaritalStatusID, strProfession, intMemberTypeID, strMedicareCardNumber, intAS_InsuredTypeID, strContactTelephone, strContactAddress,                        strDrugAllergyHistory, intPatientCategoryID, strAge, dtmBirthday, strPersonalTaboo).Tables[0];                    intPatientID = Convert.ToInt32(dtRegister.Rows[0][0].ToString());                    SwitchTwo = false;                                   }                           }else            {MessageBox.Show("对不起,您的数据没有填写完整无法保存!");            }            #endregion}


 

3、进行挂号的代码

1)、数据库存储过程:

 

--新增挂号信息IF(@Type='btnGuaHao_Click_XinZengGuaHao')BEGININSERTPW_RegisterTable(RegisterNumber,PatientID,RegisterSum,TechnicalOfficesID,Doctor_StaffID,RegisterRemarks,AS_SettleAccountsWayID,WhetherEffective,RegisterTime,AS_RegisterStatusID,RegisterOperator_StaffID,ClassesID,RegisterCategoryID)VALUES         (@RegisterNumber,@PatientID,@RegisterSum,@TechnicalOfficesID,@Doctor_StaffID,@RegisterRemarks,@AS_SettleAccountsWayID, 0,@RegisterTime, 356,@RegisterOperator_StaffID,@ClassesID,@RegisterCategoryID)END


 

(2)、逻辑层代码:

[OperationContract]        #region 新增挂号信息publicint btnGuaHao_Click_XinZengGuaHao(string strRegisterNumber, int intPatientID, decimal decRegisterSum, int intTechnicalOfficesID,int intDoctor_StaffID, string strRegisterRemarks, int intAS_SettleAccountsWayID, DateTime dtmRegisterTime, int intRegisterOperator_StaffID            , int intClassesID, int intRegisterCategoryID)        {SqlParameter[] SQLCMDpas ={newSqlParameter ("@Type",SqlDbType.Char),newSqlParameter ("@RegisterNumber",SqlDbType.Char),                                          newSqlParameter ("@PatientID",SqlDbType.Int),newSqlParameter ("@RegisterSum",SqlDbType.Decimal),newSqlParameter ("@TechnicalOfficesID",SqlDbType.Int),newSqlParameter ("@Doctor_StaffID",SqlDbType.Int),newSqlParameter ("@RegisterRemarks",SqlDbType.Char),newSqlParameter ("@AS_SettleAccountsWayID",SqlDbType.Int),newSqlParameter ("@RegisterTime",SqlDbType.DateTime),newSqlParameter ("@RegisterOperator_StaffID",SqlDbType.Int),newSqlParameter ("@ClassesID",SqlDbType.Int),newSqlParameter ("@RegisterCategoryID",SqlDbType.Int),                                      };            SQLCMDpas[0].Value = "btnGuaHao_Click_XinZengGuaHao";            SQLCMDpas[1].Value = strRegisterNumber;            SQLCMDpas[2].Value = intPatientID;            SQLCMDpas[3].Value = decRegisterSum;            SQLCMDpas[4].Value = intTechnicalOfficesID;            SQLCMDpas[5].Value = intDoctor_StaffID;            SQLCMDpas[6].Value = strRegisterRemarks;            SQLCMDpas[7].Value = intAS_SettleAccountsWayID;            SQLCMDpas[8].Value = dtmRegisterTime;            SQLCMDpas[9].Value = intRegisterOperator_StaffID;            SQLCMDpas[10].Value = intClassesID;            SQLCMDpas[11].Value = intRegisterCategoryID;int count = myDALMethod.UpdateData("GuaHaoShouFei_FRM_GuaHaoGuanLi", SQLCMDpas);return count;        }        #endregion


(3)、界面层代码:

 #region 保存挂号信息if (txtRegisterSum.Text != ""&& cboDoctorStaff.Text != ""&& cboTechnicalOffices.Text != ""&& cboSettleAccountsWay.Text != ""&& txtRegisterRemarks.Text != "")  //判断是否存在空数据            {string strRegisterNumber = GenerateReceipts().Replace("BK", "GD");//自动生成挂号单号                txtRegisterNumber.Text = strRegisterNumber;decimal decRegisterSum = Convert.ToDecimal(txtRegisterSum.Text.ToString());int intTechnicalOfficesID = Convert.ToInt32(cboTechnicalOffices.SelectedValue);int intDoctor_StaffID = Convert.ToInt32(cboDoctorStaff.SelectedValue);string strRegisterRemarks = txtRegisterRemarks.Text.ToString();int intAS_SettleAccountsWayID = Convert.ToInt32(cboSettleAccountsWay.SelectedValue);DateTime Day = DateTime.Now;    //声明一个类型为DateTime的变量 DateTime dtmRegisterTime = DateTime.Now;int intRegisterOperator_StaffID = Convert.ToInt32(cboRegisterOperator.SelectedValue);int intClassesID = Convert.ToInt32(cboClasses.SelectedValue);int intRegisterCategoryID = Convert.ToInt32(cboRegisterCategory.SelectedValue);int COUNT= myFRM_GuaHaoGuanLiClient.btnGuaHao_Click_XinZengGuaHao(strRegisterNumber, intPatientID, decRegisterSum, intTechnicalOfficesID,                    intDoctor_StaffID, strRegisterRemarks, intAS_SettleAccountsWayID,dtmRegisterTime,intRegisterOperator_StaffID,intClassesID,intRegisterCategoryID);//新增挂号信息if (intPatientID > 0 && COUNT>0)//判断病人信息和挂号信息是否新增成功               {MessageBox.Show("您的病人资料已保存!+ "新增的挂号单:" + strRegisterNumber);                    ChaXunGuaHaoXinXi();//刷新界面                              }                #region 清空病人信息                txtPatientCardNumber.Text = "";//清空病人卡号                cboMaritalStatus.SelectedValue = "";//清空婚姻情况                txtProfession.Text = "";//清空所在职业                txtMedicareCardNumber.Text = "";//清空医保卡号                txtContactTelephone.Text = "";//清空联系电话                txtContactAddress.Text = "";//清空联系地址                cboPatientCategory.SelectedValue = "";//清空病人类别                txtAge.Text = "";//清空年龄                txtPatientName.Text = "";//清空病人名称                cboSex.SelectedValue = "";//清空性别                cboMemberType.SelectedValue = "";//清空会员类型                cboInsuredType.SelectedValue = "";//清空参保类型                txtPersonalTaboo.Text = "";//清空个人忌讳                txtDrugAllergyHistory.Text = "";//清空药物过敏史                #endregion                #region 清空挂号信息                txtRegisterNumber.Text = "";//清空挂号单号                txtRegisterSum.Text = "";//清空挂号金额                cboTechnicalOffices.SelectedValue = "";//清空选择科室                cboDoctorStaff.SelectedValue = "";//清空选择医生                cboSettleAccountsWay.SelectedValue = "";//清空                txtRegisterRemarks.Text = "";//清空                cboSettleAccountsWay.SelectedValue = "";//清空结账方式                cboRegisterOperator.SelectedValue = "";//清空操作员                cboClasses.SelectedValue = "";//清空班次                #endregion            }else            {MessageBox.Show("抱歉,挂号数据不完整无法挂号");            }            #endregion

仅供学习,禁止用于商业用途。

1 0
原创粉丝点击