WCF医院管理系统技术解析(五)体检登记(四)

WCF医院管理系统技术解析(五)体检登记(四)涉及拼音简码

体检登记中的新增病人(需要注意的是:该病人不经过挂号和处方,只是到医院进行体检)与医院中的前台登记病人不同。

对于这种情况:我的思路是:该病人先到医院进行登记体检,然后设置好体检的项目,再到前台进行收费,最后拿着收费单到体检执行处,执行体检处将体检的结果以纸质形式返回给病人。

体检登记中的新增非历史体检病人

界面效果图如下:


2.9.8(38)

可以新增附加资料支持病人照片的载入界面效果如图:


2.9.8( 39)

数据库中表与关系有:


2.9.8(40)

该界面用到的控件

    控件

          说明

 

 

文本框 (TextBox)

从工具箱中找到对应的控件,可以设置控件的一些属性和事件。如显示的文本,命名是规范

 

下拉框 (ComBobox)

数据表格  (DataGridView)

按钮(Button)

标签 (Label)

容器(Panle)

图像集合(ImageList)

打开文件(OpenFileDialog




1.病人表(BT_PatientTable)

      列名

数据类型

主键/外键

说明

PatientID

int

     主键

病人ID

PatientCardNumber

nchar (50)

 

病人卡号

PatientName

nchar (30)

 

病人名称

RegisterCategoryID

int

    外键

挂号类别 ID

AS_SexID

int

    外键

性别ID

Birthday

datetime

 

出生年月

IDCardNo

nchar (50)

 

身份证号

AS_MaritalStatusID

int

    外键

婚姻情况ID

Profession

nchar (50)

 

所在职业

MemberTypeID

int

    外键

会员类型ID

MedicareCardNumber

nchar (50)

 

医保卡号

AS_InsuredTypeID

int

    外键

参保类型ID

ContactTelephone

nchar (30)

 

联系电话

ContactAddress

nchar (100)

 

联系地址

DrugAllergyHistory

nchar (100)

 

药物过敏史

PatientCategoryID

int

    外键

病人类别ID

Age

nchar (30)

 

年龄

AlphabeticBrevityCode

nchar (20)

 

拼音简码

WubiInCode

nchar (20)

 

五笔简码

ContactMobilePhone

nchar (30)

 

联系手机

Email

nchar (30)

 

电子邮件

Introducer

nchar (30)

 

介绍人员

PersonalTaboo

nchar (70)

 

个人忌讳

HighestReputation

nchar (70)

 

信誉上限

NowIntegral

nchar (50)

 

当前积分

Debt

decimal (18, 2)

 

尚欠金额

ExpenseSum

decimal (18, 2)

 

消费金额

LastTime

datetime

 

上次时间

LastDoctor_StaffID

int

    外键

上次医生

Prescriptions

nchar (50)

 

总处方数

PatientPhotos

char (200)

 

病人照片

WhetherEffective

bit

((1))

有效否

WhetherFromPhysicalExamination

Bit

 

是否体检


2:属性明细表(BT_AttributeDetailsTable)

         列名

数据类型

主键/外键

说明

AttributeDetailsID

int

    主键

属性明细ID

AttributeDetailsID_F

int

    外键

属性明细ID_F

AttributeSetID

int

    外键

属性明细ID

AttributeDetailsName

nchar (30)

 

属性明细名称

Number

nchar (30)

 

编号

RetrievalInCode

nchar (30)

 

检索简码

BuiltInIdentifiers

bit

((0))

内置标识

Remarks

nchar (100)

 

备注

WhetherEffective

bit

((1))

有效否


3.会员类别表 (MemberCategoryTable)

   列名

数据类型

主键/外键

说明

MemberCategoryID

int

    主键

会员类别 ID

MemberCategoryNumber

nchar (30)

 

会员类别编号

MemberCategoryDiscount

numeric (18, 2)

 

会员类别折扣

MemberCategoryName

nchar (30)

 

会员类别名称

Remarks

nchar (150)

 

备注

WhetherEffective

bit

((1))

有效否


表4.员工表(BT_StaffTable)

            列名

数据类型

主键/外键

说明

StaffID

int

       主键

员工ID

TechnicalOfficesID

int

       外键

科室ID

StaffNumber

nchar (20)

 

员工编号

StaffName

nchar (20)

 

员工名称

WhetherOperator

bit

 

操作员否

AlphabeticBrevityCode

nchar (20)

 

拼音简码

WubiInCode

nchar (20)

 

五笔简码

AS_StaffPositionID

int

       外键

员工职务ID

AS_MedicalTitlesID

int

       外键

医务职称ID

AS_WorkingStatusID

int

       外键

工作状态ID

AS_SexID

int

       外键

性别ID

ContactTelephone

nchar (50)

 

联系电话

WhetherBuiltIn

bit

 

内置否

RegisteredSum

decimal (18, 2)

 

挂号金额

AS_IntoTheHobbyID

int

        外键

录入爱好ID

StaffPhotos

char (200)

 

员工照片

Email

nchar (70)

 

电子邮件

IDCardNo

nchar (100)

 

身份证号

ContactAddress

nchar (100)

 

联系地址

Birthday

datetime

 

出生日期

WhetherBirthdayRemind

bit

 

生日提醒否

WorkDate

datetime

 

工作日期

TerminationDate

datetime

 

离职日期

AS_OfficialAcademicCredentialsID

int

        外键

最高学历ID

StudySubject

nchar (70)

 

学习专业

AS_PoliticsStatusID

int

        外键

政治面貌ID

Remarks

nchar (100)

 

员工备注

WhetherEffective

bit

((1))

有效否

数据库中涉及到的储存过程:

--新增病人
	IF @Type = 'FRM_TiJianDengJi_Insert_btn_Save_Click'
	BEGIN
		INSERT INTO BT_PatientTable
                      (PatientCardNumber, PatientName, RegisterCategoryID, AS_SexID, Birthday, IDCardNo, AS_MaritalStatusID, Profession, MemberTypeID, MedicareCardNumber, AS_InsuredTypeID, 
                      ContactTelephone, ContactAddress, DrugAllergyHistory, PatientCategoryID, Age, AlphabeticBrevityCode, WubiInCode, ContactMobilePhone, Email, Introducer, PersonalTaboo, HighestReputation, 
                      NowIntegral, Debt, ExpenseSum, LastTime, LastDoctor_StaffID, Prescriptions,WhetherFromPhysicalExamination)
		VALUES     (@PatientCardNumber, @PatientName, @RegisterCategoryID, @AS_SexID, @Birthday, @IDCardNo, @AS_MaritalStatusID, @Profession, @MemberTypeID, @MedicareCardNumber, @AS_InsuredTypeID, 
                      @ContactTelephone, @ContactAddress, @DrugAllergyHistory, @PatientCategoryID, @Age, @AlphabeticBrevityCode, @WubiInCode, @ContactMobilePhone, @Email, @Introducer, @PersonalTaboo, @HighestReputation, 
                      @NowIntegral, @Debt, @ExpenseSum, @LastTime, @LastDoctor_StaffID, @Prescriptions,0)
        SELECT @@IDENTITY 
	END
添加图片的储存过程:

IF @Type = 'FRM_TiJianDengJi_Insert_btn_SaveImage_Click'--根据病人ID修改病人的图片
	BEGIN
		UPDATE BT_PatientTable
        SET         PatientPhotos = @PatientPhotos
		WHERE PatientID = @PatientID
	END

BLL中涉及到的方法:

 #region 新增病人
        [OperationContract]
        public int FRM_TiJianDengJi_Insert_btn_Save_Click(string strPatientCardNumber, string strPatientName, int intRegisterCategoryID,
        int intAS_SexID, DateTime dtmBirthday, string strIDCardNo, int intAS_MaritalStatusID, string strProfession, int intMemberTypeID, string strMedicareCardNumber, int intAS_InsuredTypeID,
        string strContactTelephone, string strContactAddress, string strDrugAllergyHistory, int intPatientCategoryID, string strAge, string strAlphabeticBrevityCode, string strWubiInCode,
        string strContactMobilePhone, string strEmail, string strIntroducer, string strPersonalTaboo, string strHighestReputation,
       string strNowIntegral, decimal decDebt, decimal decExpenseSum, DateTime dtmLastTime, int intLastDoctor_StaffID, string strPrescriptions)
        {
            SqlParameter[] mySqlParameters = {
                                new SqlParameter ("@Type",SqlDbType .Char ),
                                new SqlParameter ("@PatientCardNumber",SqlDbType .Char ),//从界面获取病人卡号
                                new SqlParameter ("@PatientName",SqlDbType.Char   ),//从界面获取病人姓名
                                new SqlParameter ("@RegisterCategoryID",SqlDbType.Int  ),//从界面获取挂号类别ID  
                                new SqlParameter ("@AS_SexID",SqlDbType.Int  ),//从界面获取病人性别ID
                                new SqlParameter ("@Birthday",SqlDbType.Date  ),//从界面获取病人出生年月
                                new SqlParameter ("@IDCardNo",SqlDbType.Char   ),//从界面获取身份证号
                                new SqlParameter ("@AS_MaritalStatusID",SqlDbType.Int  ),//从界面获取婚姻 情况ID
                                new SqlParameter ("@Profession",SqlDbType .Char ),//从界面获取所在职业
                                new SqlParameter ("@MemberTypeID",SqlDbType.Int  ),//从界面获取病人会员类别ID
                                new SqlParameter ("@MedicareCardNumber",SqlDbType.Char  ),//从界面获取病人医保卡号
                                new SqlParameter ("@AS_InsuredTypeID",SqlDbType.Int  ),//<从界面获取病人参保类型ID
                                new SqlParameter ("@ContactTelephone",SqlDbType.Char  ),//从界面获取病人联系电话
                                new SqlParameter ("@ContactAddress",SqlDbType .Char ),//从界面获取病人地址  
                                new SqlParameter ("@DrugAllergyHistory",SqlDbType.Char   ),//从界面获取病人卡号
                                new SqlParameter ("@PatientCategoryID",SqlDbType.Int  ),//从界面获取病人类别
                                new SqlParameter ("@Age",SqlDbType.Char ),//从界面获取病人年龄 
                            new SqlParameter ("@AlphabeticBrevityCode",SqlDbType .Char  ),//从界面获取病人拼音简码
                                new SqlParameter ("@WubiInCode",SqlDbType.Char ),//从界面获取病人五笔简码
                                new SqlParameter ("@ContactMobilePhone",SqlDbType .Char ),//从界面获取病人手机
                                new SqlParameter ("@Email",SqlDbType .Char  ),//从界面获取病人电子邮箱 
                                new SqlParameter ("@Introducer",SqlDbType .Char ),//从界面获取病人介绍人员
                                new SqlParameter ("@PersonalTaboo",SqlDbType .Char  ),//从界面获取病人个人忌讳
                                new SqlParameter ("@HighestReputation",SqlDbType .Char),//从界面获取病人信誉上限
                                new SqlParameter ("@NowIntegral",SqlDbType.Char ),//从界面获取病人当前职分
                                new SqlParameter ("@Debt",SqlDbType.Decimal   ),//从界面获取病人尚欠金额
                                new SqlParameter ("@ExpenseSum",SqlDbType.Decimal  ),//从界面获取病人消费金额
                                new SqlParameter ("@LastTime",SqlDbType.DateTime   ),//从界面获取病人上次时间
                               new SqlParameter ("@LastDoctor_StaffID",SqlDbType.Int    ),//从界面获取病人上次医生
                                new SqlParameter ("@Prescriptions",SqlDbType.Char ),//从界面获取病人总处方数
                                            };
            mySqlParameters[0].Value = "FRM_TiJianDengJi_Insert_btn_Save_Click";
            mySqlParameters[1].Value = strPatientCardNumber;
            mySqlParameters[2].Value = strPatientName;
            mySqlParameters[3].Value = intRegisterCategoryID;
            mySqlParameters[4].Value = intAS_SexID;
            mySqlParameters[5].Value = dtmBirthday;
            mySqlParameters[6].Value = strIDCardNo;
            mySqlParameters[7].Value = intAS_MaritalStatusID;
            mySqlParameters[8].Value = strProfession;
            mySqlParameters[9].Value = intMemberTypeID;
            mySqlParameters[10].Value = strMedicareCardNumber;
            mySqlParameters[11].Value = intAS_InsuredTypeID;
            mySqlParameters[12].Value = strContactTelephone;
            mySqlParameters[13].Value = strContactAddress;
            mySqlParameters[14].Value = strDrugAllergyHistory;
            mySqlParameters[15].Value = intPatientCategoryID;
            mySqlParameters[16].Value = strAge;
            mySqlParameters[17].Value = strAlphabeticBrevityCode;
            mySqlParameters[18].Value = strWubiInCode;
            mySqlParameters[19].Value = strContactMobilePhone;
            mySqlParameters[20].Value = strEmail;
            mySqlParameters[21].Value = strIntroducer;
            mySqlParameters[22].Value = strPersonalTaboo;
            mySqlParameters[23].Value = strHighestReputation;
            mySqlParameters[24].Value = strNowIntegral;
            mySqlParameters[25].Value = decDebt;
            mySqlParameters[26].Value = decExpenseSum;
            mySqlParameters[27].Value = dtmLastTime;
            mySqlParameters[28].Value = intLastDoctor_StaffID;
            mySqlParameters[29].Value = strPrescriptions;
           DataTable dt = myDALMethod.QueryDataTable("TiJianZhongXin_TiJianDengJi_Patient_Main", mySqlParameters);
            int FanHuiValue = Convert.ToInt32(dt.Rows[0][0]);//获取刚新增的病人ID,用于新增插入图片
            return FanHuiValue;

        }
        #endregion


添加图片的BLL中的方法
//添加病人图片
        [OperationContract]
        public int FRM_TiJianDengJi_Insert_btn_SaveImage_Click(byte[][] byteTuPian, int intPatientID)//获取界面中的病人ID和图片
        {
            string strWenJianName = WenJianLiuZhuanHuanLuJing(byteTuPian);
            SqlParameter[] mySqlParameters = {
                                             new SqlParameter("@Type",SqlDbType .Char ),//
                                             new SqlParameter("@PatientPhotos",SqlDbType .Char ),//获取的病人ID 和图片保存进数据库
                                             new SqlParameter ("@PatientID",SqlDbType .Int ),
                                             };
            mySqlParameters[0].Value = "FRM_TiJianDengJi_Insert_btn_SaveImage_Click";
            mySqlParameters[1].Value = strWenJianName;
            mySqlParameters[2].Value = intPatientID;
            return myDALMethod.UpdateData("TiJianZhongXin_TiJianDengJi_Patient_Main", mySqlParameters);
        }


文件路转换路径:即保存图片的路径:保存图片在WCF医院管理系统中中的服务端如图:‘


region  文件流转换路径
        private string WenJianLiuZhuanHuanLuJing(byte[][] byteTuPian)
        {
            try
            {
                //获取要保存进数据库中的图片的文件名
                string strWenJianQianZui = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() +
                                            DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() +
                                            DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() +
                                            DateTime.Now.Millisecond.ToString();
                string strWenJianName = "";
                for (int i = 0; i < byteTuPian.Length; i++)//遍历二进制的数组的数组
                {
                    string strRiQiWenJian = strWenJianQianZui + i.ToString() + ".png";//为文件名添加后缀
                    string strBaoCunLuJing = System.AppDomain.CurrentDomain.BaseDirectory;
                    strBaoCunLuJing = strBaoCunLuJing + "image\\" + strRiQiWenJian;//图片的保存路径
                    FileInfo fi = new System.IO.FileInfo(strBaoCunLuJing);
                    FileStream fs;
                    fs = fi.OpenWrite();
                    fs.Write(byteTuPian[i], 0, byteTuPian[i].Length);
                    fs.Close();
                    strWenJianName += strRiQiWenJian + ";";
                }
                return strWenJianName;
            }
            catch
            {
                return null;
            }
        }
        #endregion


UIL中涉及到的代码:

新建体检病人中的保存按钮

private void btn_Save_Click(object sender, EventArgs e)
        {
            if (blnNotInsert == false)
            {
                if (txt_PatientName.Text == "")
                {
                    MessageBox.Show("请输入病人姓名!");
                }
                else
                {
<span style="white-space:pre">		</span>   //获取最大病人的最大单据数
                    int intMaxMember = myFRM_TiJianDengJi_Patient_MainClient.FRM_TiJianDengJi_Insert_txt_PatientCardNumber();
                    string strNowTime = "";
 <span style="white-space:pre">		</span>   //用三目运算符获取当前的时间
                    strNowTime = "BK" + DateTime.Now.Year.ToString() +
                        (DateTime.Now.Month > 9 ? DateTime.Now.Month.ToString() : "0" + DateTime.Now.Month.ToString()) +
                        (DateTime.Now.Day > 9 ? DateTime.Now.Day.ToString() : "0" + DateTime.Now.Day.ToString());
                    string strMaxMember = intMaxMember.ToString();
                    for (int i = strMaxMember.Length; i < 4; i++)//遍历循环最大单号的长度是否为4位数
                    {
                        strMaxMember = "0" + strMaxMember;//如果不是就添加0
                    }
                     //获取每一个新增病人中的值
                    string strPatientCardNumber = strNowTime + strMaxMember;
                    string strPatientName = txt_PatientName.Text.ToString().Trim();
                    int intRegisterCategoryID = Convert.ToInt32(cbo_RegisterCategoryID.SelectedValue);
                    int intAS_SexID = Convert.ToInt32(cbo_AS_SexID.SelectedValue);
                    DateTime dtmBirthday = Convert.ToDateTime(txt_Birthday.Text.ToString().Trim());
                    string strIDCardNo = txt_IDCardNo.Text.ToString().Trim();
                    int intAS_MaritalStatusID = Convert.ToInt32(cbo_AS_MaritalStatusID.SelectedValue);
                    string strProfession = txt_Profession.Text.ToString().Trim();
                    int intMemberTypeID = Convert.ToInt32(cbo_MemberTypeID.SelectedValue);
                    string strMedicareCardNumber = txt__MedicareCardNumber.Text.ToString().Trim();
                    int intAS_InsuredTypeID = Convert.ToInt32(cbo_AS_InsuredTypeID.SelectedValue);
                    string strContactTelephone = txt_ContactMobilePhone.Text.ToString().Trim();
                    string strContactAddress = txt_ContactAddress.Text.ToString().Trim();
                    string strDrugAllergyHistory = txt_DrugAllergyHistory.Text.ToString().Trim();
                    int intPatientCategoryID = Convert.ToInt32(cbo_PatientCategoryID.SelectedValue);
                    string strAge = txt_Age.Text.ToString().Trim();
                    string strAlphabeticBrevityCode = txt_AlphabeticBrevityCode.Text.ToString().Trim();
                    string strWubiInCode = txt_WubiInCode.Text.ToString().Trim();
                    string strContactMobilePhone = txt_ContactMobilePhone.Text.ToString().Trim();
                    string strEmail = txt_Email.Text.ToString().Trim();
                    string strIntroducer = txt_Introducer.Text.ToString().Trim();
                    string strPersonalTaboo = txt_PersonalTaboo.Text.ToString().Trim();
                    string strHighestReputation = txt_HighestReputation.Text.ToString().Trim();
                    string strNowIntegral = txt_NowIntegral.Text.ToString().Trim();
                    decimal decDebt = Convert.ToDecimal(txt_Debt.Text.ToString().Trim());
                    decimal decExpenseSum = Convert.ToDecimal(txt_ExpenseSum.Text.ToString().Trim());
                    DateTime dtmLastTime = Convert.ToDateTime(dtp_LastTime.Text.ToString().Trim());
                    int intLastDoctor_StaffID = Convert.ToInt32(cbo_LastDoctor_StaffID.SelectedValue);
                    string strPrescriptions = txt_Prescriptions.Text.ToString().Trim();
        	//进行添加病人进入数据库中的操作
                    intPatientID = myFRM_TiJianDengJi_Patient_MainClient.FRM_TiJianDengJi_Insert_btn_Save_Click(strPatientCardNumber, strPatientName, intRegisterCategoryID, intAS_SexID, dtmBirthday, strIDCardNo, intAS_MaritalStatusID, strProfession, intMemberTypeID, strMedicareCardNumber, intAS_InsuredTypeID,strContactTelephone, strContactAddress, strDrugAllergyHistory, intPatientCategoryID, strAge, strAlphabeticBrevityCode, strWubiInCode, strContactMobilePhone, strEmail, strIntroducer, strPersonalTaboo, strHighestReputation,strNowIntegral, decDebt, decExpenseSum, dtmLastTime, intLastDoctor_StaffID, strPrescriptions);
                    if (intPatientID > 0)
                    {
                        MessageBox.Show("新增病人成功!");
       				  QingKongKongJian();//调用方法清空各个控件中的值
                    }
                    else
                    {
                        MessageBox.Show("新增病人失败");
                    }
                }
            }


UIL中清空新增病人界面中的代码:自定义方法进行清空新增病人的各个控件
void QingKongKongJian()
        {
            txt_PatientCardNumber.Text = "";
            txt_PatientName.Text = "";
            cbo_RegisterCategoryID.SelectedValue = 0;
            cbo_AS_SexID.SelectedValue = 0;
            txt_Birthday.Text = "";
            txt_IDCardNo.Text = "";
            cbo_AS_MaritalStatusID.SelectedValue = 0;
            txt_Profession.Text = "";
            cbo_MemberTypeID.SelectedValue = 0;
            txt__MedicareCardNumber.Text = "";
            cbo_AS_InsuredTypeID.SelectedValue = 0;
            txt_ContactMobilePhone.Text = "";
            txt_ContactAddress.Text = "";
            txt_DrugAllergyHistory.Text = "";
            cbo_PatientCategoryID.SelectedValue = 0;
            txt_Age.Text = "";
            txt_AlphabeticBrevityCode.Text = "";
            txt_WubiInCode.Text = "";
            txt_ContactMobilePhone.Text = "";
            txt_Email.Text = "";
            txt_Introducer.Text = "";
            txt_PersonalTaboo.Text = "";
            txt_HighestReputation.Text = "";
            txt_NowIntegral.Text = "";
            txt_Debt.Text = "";
            txt_ExpenseSum.Text = "";
            txt_ContactTelephone.Text = "";
            dtp_LastTime.Text = DateTime.Now.ToShortDateString();//获取当前日期
            cbo_LastDoctor_StaffID.SelectedValue = 0;
            txt_Prescriptions.Text = "";
        }

添加图片:点击附加资料中的保存图片按钮如下图

2.9.8(图41)

其中的UIL中的代码有:

#region 添加图片
        private void btn_SaveImage_Click(object sender, EventArgs e)
        {
            if (intPatientID > 0)//判断是否存在有病人ID
            {
                byte[][] bytWenJian = new byte[lstBytes.Count][];
                for (int i = 0; i < lstBytes.Count; i++)
                {
                    bytWenJian[i] = lstBytes[i];
                }
                if (myFRM_TiJianDengJi_Patient_MainClient.FRM_TiJianDengJi_Insert_btn_SaveImage_Click(bytWenJian, intPatientID) > 0)
                {
                    MessageBox.Show("图片保存成功!");
                }
                else
                {
                    MessageBox.Show("图片保存失败!");
                }
            }
        }
        #endregion

添加图片前,先获取需要添加的图片:即点击附件资料中的载入图片按钮


2.9.8(图42)

UIL中的代码:

List<string> lisWenJianMing = new List<string>();//声明一个list列表,数据类型为字符串
        List<byte[]> lstBytes = new List<byte[]>();//声明一个list列表,数据类型为byte[]数组
        int intTuPianWenZhiY = 0;//图片高度坐标
        private void btn_GoDownInHistory_Click(object sender, EventArgs e)
        {
          
            ofdWenJian.Multiselect = true;//多选图片
            if (ofdWenJian.ShowDialog() == DialogResult.OK)
            {
                pnl_Image.Controls.Clear();//清空图片
                intTuPianWenZhiY = 0;//初始化图片坐标
                for (int i = 0; i < ofdWenJian.FileNames.Length; i++)
                {
                    txtLuJing.Text += ofdWenJian.FileNames[i] + ";";
                    using (Stream sm = new FileStream(ofdWenJian.FileNames[i], FileMode.Open, FileAccess.ReadWrite, FileShare.None))//运行方法体后,消毁对象
                    {
                        int Length = (int)sm.Length; //二进制文件长度
                        byte[] bytes = new byte[Length];  //二进制文件存放的二进制数组
                        sm.Read(bytes, 0, Length); //内存流读取
                        sm.Close(); //关闭内存流
                        lstBytes.Add(bytes);  将数据保存到数据库中
                        XianShiTuPian(bytes);
                    }
                }
            }
        }
 void XianShiTuPian(byte[] mybyte)
        {
           
            MemoryStream stmBLOBData = new MemoryStream(mybyte);//实例化一个内存流的对象
            PictureBox myPictureBox = new PictureBox();//实例化一个PictureBox
            Image myImage = Image.FromStream(stmBLOBData);
            myPictureBox.Size = pnl_Image.Size;//实例化的PictureBox的大小就是上传图片的大小
            myPictureBox.Location = new Point(0, intTuPianWenZhiY);//图片的位置
            myPictureBox.BackgroundImage = myImage;
            myPictureBox.BackgroundImageLayout = ImageLayout.Zoom;//设置图片在容器中的中央
            this.pnl_Image.Controls.Add(myPictureBox);//将图片加载在pnl_Image容器中
            intTuPianWenZhiY += myPictureBox.Size.Height;//设置另一张图片在的高度在上一张的高度下面
        }

在体检登记中的新增病人界面输入中,病人卡号是自动生成的:如图:


2.9.8(图43)

数据库中涉及到的储存过程有:

--修改病人卡号
    IF @Type = 'FRM_TiJianDengJi_Insert_txt_PatientCardNumber'
    BEGIN
		UPDATE PW_TheLargestNumberStatisticalTable 
		SET PatientCardMaximumNumber = PatientCardMaximumNumber+1
		SELECT PatientCardMaximumNumber
		FROM PW_TheLargestNumberStatisticalTable
END

BLL中涉及的代码有:

/修改病人卡号
        [OperationContract]
        public int FRM_TiJianDengJi_Insert_txt_PatientCardNumber()
        {
            SqlParameter[] mySqlParameters = {
                                             new SqlParameter("@Type",SqlDbType .Char ),
                                             };
            mySqlParameters[0].Value = "FRM_TiJianDengJi_Insert_txt_PatientCardNumber";
            DataTable dt = myDALMethod.QueryDataTable("TiJianZhongXin_TiJianDengJi_Patient_Main", mySqlParameters);
            int i = Convert.ToInt32(dt.Rows[0]["PatientCardMaximumNumber"]);
            return i;
        }

UIL中涉及到的代码:在保存中的按钮写,防止不保存的单号会生成,只有在保存的过程中,单号才自动生成

 //获取病人的最大单号数
        int intMaxMember = myFRM_TiJianDengJi_Patient_MainClient.FRM_TiJianDengJi_Insert_txt_PatientCardNumber();
                    string strNowTime = "";
                    //三木运算符判断病人卡号
                    strNowTime = "BK" + DateTime.Now.Year.ToString() +  //获取当前年份
                        //获取月份,判断月份是否>9月,如果小于<9月,就在月份前加上“0”,否则不加“0”,同理日期号也是
                        (DateTime.Now.Month > 9 ? DateTime.Now.Month.ToString() : "0" + DateTime.Now.Month.ToString()) +
                        (DateTime.Now.Day > 9 ? DateTime.Now.Day.ToString() : "0" + DateTime.Now.Day.ToString());
                    string strMaxMember = intMaxMember.ToString();//将获取的最大单号转化为字符串
                    for (int i = strMaxMember.Length; i < 4; i++)//循环判断字符串长度,小于4就加上“0”,否则跳出循环
                    {
                        strMaxMember = "0" + strMaxMember;
                    }
                    string strPatientCardNumber = strNowTime + strMaxMember;//把时间和单号并接起来


体检登记中的新增病人界面输入中,拼音简码是由病人姓名自动设置的:如图:

 


2.9.8(图44)

数据库和BLL中并不涉及到具体的储存过程和方法:

UIL中涉及到的代码有:

 #region 病人姓名和拼音简码
        private void txt_PatientName_TextChanged(object sender, EventArgs e)
        {
            txt_AlphabeticBrevityCode.Text = GetChineseSpell(txt_PatientName.Text.Trim());//拼音简码
<span style="white-space:pre">	</span>}

 static public string GetChineseSpell(string strText)//声明一个方法获取病人姓名中输入的姓名转换为拼音码
        {
            int len = strText.Length;
            string myStr = "";
            for (int i = 0; i < len; i++)
            {
                myStr += getSpell(strText.Substring(i, 1));//调用生成拼音码的方法
            }
            return myStr;
        }

        static public string getSpell(string cnChar)
        {
            byte[] arrCN = Encoding.Default.GetBytes(cnChar);
            if (arrCN.Length > 1)
            {
                int area = (short)arrCN[0];
                int pos = (short)arrCN[1];
                int code = (area << 8) + pos;
                int[] areacode = { 45217, 45253, 45761, 46318, 46826, 47010, 
                                   47297,47614, 48119, 48119, 49062, 49324, 
                                   49896, 50371,50614, 50622, 50906, 51387, 
                                   51446, 52218, 52698, 52698, 52698, 52980, 
                                   53689, 54481 };
                for (int i = 0; i < 26; i++)
                {
                    int max = 55290;
                    if (i != 25) max = areacode[i + 1];
                    if (areacode[i] <= code && code < max)
                    {
                        return Encoding.Default.GetString(new byte[] { (byte)(65 + i) });
                    }
                }
                return "*";
            }
            else return cnChar;
        }
        #endregion


点击保存后,再点击体检登记病人,可以查看全部体检登记中的病人信息


2.9.8(图45)

查看体检登记中的病人信息


2.9.8(图46)

如果发现病人信息中有错误的地方可以对病人信息进行必要的修改:点击修改病人弹出如下窗口:


2.9.8(图47)

该过程涉及到的储存过程有:

- 查询某一个病人的信息
	IF @Type = 'FRM_TiJianBingRen_Main_Load_SelectPatientOnPatientID'
	BEGIN
		SELECT     LTRIM(RTRIM(BT_PatientTable.PatientCardNumber)) AS PatientCardNumber, LTRIM(RTRIM(BT_PatientTable.PatientName)) AS PatientName, LTRIM(RTRIM(BT_PatientTable.AS_SexID)) AS AS_SexID,
                       LTRIM(RTRIM(BT_AttributeDetailsTable_1.AttributeDetailsName)) AS Sex, LTRIM(RTRIM(BT_PatientTable.AS_MaritalStatusID)) AS AS_MaritalStatusID, 
                      LTRIM(RTRIM(BT_AttributeDetailsTable_2.AttributeDetailsName)) AS MaritalStatus, LTRIM(RTRIM(BT_PatientTable.Profession)) AS Profession, LTRIM(RTRIM(BT_PatientTable.Age)) AS Age, 
                      LTRIM(RTRIM(BT_PatientTable.AS_InsuredTypeID)) AS AS_InsuredTypeID, LTRIM(RTRIM(BT_AttributeDetailsTable_3.AttributeDetailsName)) AS InsuredType, 
                      LTRIM(RTRIM(BT_PatientTable.MemberTypeID)) AS MemberTypeID, LTRIM(RTRIM(BT_MemberCategoryTable.MemberCategoryName)) AS MemberCategoryName, 
                      LTRIM(RTRIM(BT_PatientTable.ContactTelephone)) AS ContactTelephone, LTRIM(RTRIM(BT_PatientTable.ContactAddress)) AS ContactAddress, LTRIM(RTRIM(BT_PatientTable.PersonalTaboo)) 
                      AS PersonalTaboo, LTRIM(RTRIM(BT_PatientTable.DrugAllergyHistory)) AS DrugAllergyHistory, LTRIM(RTRIM(BT_PatientTable.PatientID)) AS PatientID, 
                      RTRIM(BT_MemberCategoryTable.MemberCategoryDiscount) AS MemberCategoryDiscount, BT_PatientTable.RegisterCategoryID, BT_RegisterCategoryTable.RegisterCategoryName, 
                      BT_PatientTable.Birthday, BT_PatientTable.IDCardNo,  BT_PatientTable.MedicareCardNumber, BT_PatientTable.PatientCategoryID,
                       BT_PatientTable.AlphabeticBrevityCode, BT_PatientTable.WubiInCode, BT_PatientTable.ContactMobilePhone, BT_PatientTable.Email, BT_PatientTable.Introducer,  BT_PatientTable.HighestReputation, 
                      BT_PatientTable.NowIntegral, BT_PatientTable.Debt, BT_PatientTable.ExpenseSum, BT_PatientTable.LastTime, BT_PatientTable.LastDoctor_StaffID, BT_PatientTable.Prescriptions, 
                      BT_PatientTable.PatientPhotos
		FROM         BT_PatientTable INNER JOIN
                      BT_AttributeDetailsTable AS BT_AttributeDetailsTable_1 ON BT_PatientTable.AS_SexID = BT_AttributeDetailsTable_1.AttributeDetailsID INNER JOIN
                      BT_AttributeDetailsTable AS BT_AttributeDetailsTable_2 ON BT_PatientTable.AS_MaritalStatusID = BT_AttributeDetailsTable_2.AttributeDetailsID INNER JOIN
                      BT_AttributeDetailsTable AS BT_AttributeDetailsTable_3 ON BT_PatientTable.AS_InsuredTypeID = BT_AttributeDetailsTable_3.AttributeDetailsID INNER JOIN
                      BT_MemberCategoryTable ON BT_PatientTable.MemberTypeID = BT_MemberCategoryTable.MemberCategoryID INNER JOIN
                      BT_RegisterCategoryTable ON BT_PatientTable.RegisterCategoryID = BT_RegisterCategoryTable.RegisterCategoryID   
                      WHERE     BT_PatientTable.WhetherFromPhysicalExamination = 0 AND BT_PatientTable.PatientID = @PatientID
	END

BLL中涉及到的方法有:

#region 查找某一个病人的信息
        [OperationContract]
        public DataSet FRM_TiJianBingRen_Main_Load_SelectPatientOnPatientID(int intPatientID)
        {
            SqlParameter[] mySqlParameters = {
                                             new SqlParameter("@Type",SqlDbType .Char ),
                                             new SqlParameter ("@PatientID",SqlDbType .Int ),
                                             };
            mySqlParameters[0].Value = "FRM_TiJianBingRen_Main_Load_SelectPatientOnPatientID";
            mySqlParameters[1].Value = intPatientID;
            DataTable dt = myDALMethod.QueryDataTable("TiJianZhongXin_TiJianDengJi_Patient_Main", mySqlParameters);
            DataSet ds = new DataSet();
            ds.Tables.Add(dt);
            return ds;
        }
        #endregion

BLL中查找图片:

#region  查询图片
        [OperationContract]
        public byte[][] FRM_TiJianDengJi_Update_SelectTuPian(string strLuJing)
        {
            return WenJianLiuZhuanHuanLuJing(strLuJing);
        }
        #endregion

BLL中路径转换文件流:

#region  路径转换文件流
        private byte[][] WenJianLiuZhuanHuanLuJing(string strLuJing)
        {
            try
            {
                string[] strLuJingZu = strLuJing.Split(';');//声明一个字符串数组把获取的图片名字用‘;’拆分字符
                byte[][] lstBytes = new byte[strLuJingZu.Length - 1][];//声明一个二进制数组
                for (int i = 0; i < strLuJingZu.Length; i++)//遍历数组长度
                {
                    if (strLuJingZu[i] != "")//如果数组成员中的路径不为空
                    {
                        string strBaoCunLuJing = System.AppDomain.CurrentDomain.BaseDirectory;
                        strLuJingZu[i] = strBaoCunLuJing + "image\\" + strLuJingZu[i];//把图片保存进image中的文件夹中
                        using (Stream sm = new FileStream(strLuJingZu[i], FileMode.Open, FileAccess.ReadWrite, FileShare.None))//运行方法体后,消毁对象    
                        {
                            int Length = (int)sm.Length;//二进制文件长度
                            byte[] bytes = new byte[Length];//二进制文件存放的二进制数组
                            sm.Read(bytes, 0, Length);//内存流读取
                            sm.Close();//关闭内存流
                            lstBytes[i] = bytes;将数据保存到数据库中
                        }
                    }
                }
                return lstBytes;
            }
            catch
            {
                return null;
            }
        }
        #endregion



UIL中涉及到的代码:

体检登记中修改病人窗Load中的加载事件:

 //根据病人ID查找需要修改的病人信息
            DataTable dtPatient = myFRM_TiJianDengJi_Patient_MainClient.FRM_TiJianBingRen_Main_Load_SelectPatientOnPatientID(intPatientID).Tables[0];
            //把病人的信息对应第赋值给相应的控件
            txt_PatientCardNumber.Text = dtPatient.Rows[0]["PatientCardNumber"].ToString().Trim();
            txt_PatientName.Text = dtPatient.Rows[0]["PatientName"].ToString().Trim();
            cbo_RegisterCategoryID.SelectedValue = Convert .ToInt32 (dtPatient.Rows[0]["RegisterCategoryID"]);
            cbo_AS_SexID.SelectedValue = Convert .ToInt32 (dtPatient.Rows[0]["AS_SexID"]);
            txt_Birthday.Text = dtPatient.Rows[0]["Birthday"].ToString().Trim();
            txt_IDCardNo.Text  = dtPatient.Rows[0]["IDCardNo"].ToString().Trim();
            cbo_AS_MaritalStatusID.SelectedValue = Convert .ToInt32 (dtPatient.Rows[0]["AS_MaritalStatusID"]);
            txt_Profession.Text = dtPatient.Rows[0]["Profession"].ToString().Trim();
            cbo_MemberTypeID.SelectedValue  = Convert .ToInt32 (dtPatient.Rows[0]["MemberTypeID"]);
            txt__MedicareCardNumber.Text  = dtPatient.Rows[0]["MedicareCardNumber"].ToString().Trim();
            cbo_AS_InsuredTypeID.SelectedValue  = Convert .ToInt32 (dtPatient.Rows[0]["AS_InsuredTypeID"]);
            txt_ContactMobilePhone.Text = dtPatient.Rows[0]["ContactMobilePhone"].ToString().Trim();
            txt_ContactAddress.Text = dtPatient.Rows[0]["ContactAddress"].ToString().Trim();
            txt_DrugAllergyHistory.Text = dtPatient.Rows[0]["DrugAllergyHistory"].ToString().Trim();
            cbo_PatientCategoryID.SelectedValue = Convert .ToInt32 (dtPatient.Rows[0]["PatientCategoryID"]);
            txt_Age.Text  = dtPatient.Rows[0]["Age"].ToString().Trim();
            txt_AlphabeticBrevityCode.Text = dtPatient.Rows[0]["AlphabeticBrevityCode"].ToString().Trim();
            txt_WubiInCode.Text = dtPatient.Rows[0]["WubiInCode"].ToString().Trim();
            txt_ContactMobilePhone.Text = dtPatient.Rows[0]["ContactMobilePhone"].ToString().Trim();
            txt_Email.Text = dtPatient.Rows[0]["Email"].ToString().Trim();
            txt_Introducer.Text = dtPatient.Rows[0]["Introducer"].ToString().Trim();
            txt_PersonalTaboo.Text =dtPatient.Rows[0]["PersonalTaboo"].ToString().Trim();
            txt_HighestReputation.Text = dtPatient.Rows[0]["HighestReputation"].ToString().Trim();
            txt_NowIntegral.Text =dtPatient.Rows[0]["NowIntegral"].ToString().Trim();
            txt_Debt.Text =dtPatient.Rows[0]["Debt"].ToString().Trim();
            txt_ExpenseSum.Text =dtPatient.Rows[0]["ExpenseSum"].ToString().Trim();
            dtp_LastTime.Text =dtPatient.Rows[0]["LastTime"].ToString().Trim();
            cbo_LastDoctor_StaffID.SelectedValue = Convert .ToInt32 (dtPatient.Rows[0]["LastDoctor_StaffID"]);
            txt_Prescriptions.Text =dtPatient.Rows[0]["Prescriptions"].ToString().Trim();
            txtLuJing.Text = dtPatient.Rows[0]["PatientPhotos"].ToString().Trim();
            txt_ContactTelephone.Text = dtPatient.Rows[0]["ContactTelephone"].ToString().Trim();
            string strLuJing = dtPatient.Rows[0]["PatientPhotos"].ToString().Trim();//获取图片的文件名
            //根据路径查找病人的文件流,并且存放在二进制数组中
            myTuPianByte = myFRM_TiJianDengJi_Patient_MainClient.FRM_TiJianDengJi_Update_SelectTuPian(strLuJing);
            pnl_Image.AutoScroll = true;//获取图片中的进度条
            for (int i = 0; i < myTuPianByte.Length; i++)//遍历二进制数组的长度
            {
                XianShiTuPian(myTuPianByte[i]);//定义方法加载图片
            }
            intTuPianWenZhiY = 0;//图片的第一张图标
其中的intTuPianWeiZhiY = 0 意思是:病人的第一张图片中的坐标为Panle中的顶端坐标 如图:



void XianShiTuPian(byte[] mybyte)
        {
            MemoryStream stmBLOBData = new MemoryStream(mybyte);//实例化一个内存流的对象
            PictureBox myPictureBox = new PictureBox();//实例化一个PictureBox
            Image myImage = Image.FromStream(stmBLOBData);
            myPictureBox.Size = pnl_Image.Size;//实例化的PictureBox的大小就是上传图片的大小
            myPictureBox.Location = new Point(0, intTuPianWenZhiY);//图片的位置
            myPictureBox.BackgroundImage = myImage;
            myPictureBox.BackgroundImageLayout = ImageLayout.Zoom;//设置图片在容器中的中央
            this.pnl_Image.Controls.Add(myPictureBox);//将图片加载在pnl_Image容器中
            intTuPianWenZhiY += myPictureBox.Size.Height;//设置另一张图片在的高度在上一张的高度下面
        }
上面代码中的

intTuPianWenZhiY += myPictureBox.Size.Height;//设置另一张图片在的高度在上一张的高度下面

意思是:下一张的图片中的坐标并接前一张图片中的坐标中的高度:如下图

 

输入需要的修信息,点击保存(附加资料中的图片也可以进行修改(把原来的图片路径进行删除,插入新的路径))


2.9.8(图48)

会在主界面中可能看到病人的修改过的信息如下图:


2.9.8(图49)

该过程数据库涉及到的储存过程有:

--修改病人
	IF @Type = 'FRM_TiJianDengJi_Update_btn_Save_Click'
	BEGIN
		UPDATE    BT_PatientTable
		SET              PatientCardNumber =@PatientCardNumber, PatientName =@PatientName, RegisterCategoryID =@RegisterCategoryID, AS_SexID =@AS_SexID, Birthday =@Birthday, IDCardNo =@IDCardNo, AS_MaritalStatusID =@AS_MaritalStatusID,
				 Profession =@Profession, MemberTypeID =@MemberTypeID, MedicareCardNumber =@MedicareCardNumber, AS_InsuredTypeID =@AS_InsuredTypeID, ContactTelephone =@ContactTelephone, ContactAddress =@ContactAddress, 
				 DrugAllergyHistory =@DrugAllergyHistory, PatientCategoryID =@PatientCategoryID, Age =@Age, AlphabeticBrevityCode =@AlphabeticBrevityCode, WubiInCode =@WubiInCode, ContactMobilePhone =@ContactMobilePhone, 
				  Email =@Email, Introducer =@Introducer,  PersonalTaboo =@PersonalTaboo, HighestReputation =@HighestReputation, NowIntegral =@NowIntegral, Debt =@Debt, ExpenseSum =@ExpenseSum, LastTime =@LastTime, 
				  LastDoctor_StaffID =@LastDoctor_StaffID, Prescriptions =@Prescriptions, PatientPhotos =@PatientPhotos
		where   BT_PatientTable.PatientID = @PatientID
	END
修改病人图片:
-- 查询某一个病人的信息
	IF @Type = 'FRM_TiJianBingRen_Main_Load_SelectPatientOnPatientID'
	BEGIN
		SELECT     LTRIM(RTRIM(BT_PatientTable.PatientCardNumber)) AS PatientCardNumber, LTRIM(RTRIM(BT_PatientTable.PatientName)) AS PatientName, LTRIM(RTRIM(BT_PatientTable.AS_SexID)) AS AS_SexID,
                       LTRIM(RTRIM(BT_AttributeDetailsTable_1.AttributeDetailsName)) AS Sex, LTRIM(RTRIM(BT_PatientTable.AS_MaritalStatusID)) AS AS_MaritalStatusID, 
                      LTRIM(RTRIM(BT_AttributeDetailsTable_2.AttributeDetailsName)) AS MaritalStatus, LTRIM(RTRIM(BT_PatientTable.Profession)) AS Profession, LTRIM(RTRIM(BT_PatientTable.Age)) AS Age, 
                      LTRIM(RTRIM(BT_PatientTable.AS_InsuredTypeID)) AS AS_InsuredTypeID, LTRIM(RTRIM(BT_AttributeDetailsTable_3.AttributeDetailsName)) AS InsuredType, 
                      LTRIM(RTRIM(BT_PatientTable.MemberTypeID)) AS MemberTypeID, LTRIM(RTRIM(BT_MemberCategoryTable.MemberCategoryName)) AS MemberCategoryName, 
                      LTRIM(RTRIM(BT_PatientTable.ContactTelephone)) AS ContactTelephone, LTRIM(RTRIM(BT_PatientTable.ContactAddress)) AS ContactAddress, LTRIM(RTRIM(BT_PatientTable.PersonalTaboo)) 
                      AS PersonalTaboo, LTRIM(RTRIM(BT_PatientTable.DrugAllergyHistory)) AS DrugAllergyHistory, LTRIM(RTRIM(BT_PatientTable.PatientID)) AS PatientID, 
                      RTRIM(BT_MemberCategoryTable.MemberCategoryDiscount) AS MemberCategoryDiscount, BT_PatientTable.RegisterCategoryID, BT_RegisterCategoryTable.RegisterCategoryName, 
                      BT_PatientTable.Birthday, BT_PatientTable.IDCardNo,  BT_PatientTable.MedicareCardNumber, BT_PatientTable.PatientCategoryID,
                       BT_PatientTable.AlphabeticBrevityCode, BT_PatientTable.WubiInCode, BT_PatientTable.ContactMobilePhone, BT_PatientTable.Email, BT_PatientTable.Introducer,  BT_PatientTable.HighestReputation, 
                      BT_PatientTable.NowIntegral, BT_PatientTable.Debt, BT_PatientTable.ExpenseSum, BT_PatientTable.LastTime, BT_PatientTable.LastDoctor_StaffID, BT_PatientTable.Prescriptions, 
                      BT_PatientTable.PatientPhotos
		FROM         BT_PatientTable INNER JOIN
                      BT_AttributeDetailsTable AS BT_AttributeDetailsTable_1 ON BT_PatientTable.AS_SexID = BT_AttributeDetailsTable_1.AttributeDetailsID INNER JOIN
                      BT_AttributeDetailsTable AS BT_AttributeDetailsTable_2 ON BT_PatientTable.AS_MaritalStatusID = BT_AttributeDetailsTable_2.AttributeDetailsID INNER JOIN
                      BT_AttributeDetailsTable AS BT_AttributeDetailsTable_3 ON BT_PatientTable.AS_InsuredTypeID = BT_AttributeDetailsTable_3.AttributeDetailsID INNER JOIN
                      BT_MemberCategoryTable ON BT_PatientTable.MemberTypeID = BT_MemberCategoryTable.MemberCategoryID INNER JOIN
                      BT_RegisterCategoryTable ON BT_PatientTable.RegisterCategoryID = BT_RegisterCategoryTable.RegisterCategoryID   
                      WHERE     BT_PatientTable.WhetherFromPhysicalExamination = 0 AND BT_PatientTable.PatientID = @PatientID
	END

BLL中涉及到的方法:

 #region 修改病人
        [OperationContract]
        public int FRM_TiJianDengJi_Update_btn_Save_Click(string strPatientCardNumber, string strPatientName, int intRegisterCategoryID, int intAS_SexID, DateTime dtmBirthday, string strIDCardNo, int intAS_MaritalStatusID, string strProfession, int intMemberTypeID, string strMedicareCardNumber, int intAS_InsuredTypeID, string strContactTelephone, string strContactAddress, string strDrugAllergyHistory, int intPatientCategoryID, string strAge, string strAlphabeticBrevityCode, string strWubiInCode,string strContactMobilePhone, string strEmail, string strIntroducer, string strPersonalTaboo, string strHighestReputation, string strNowIntegral, decimal decDebt, decimal decExpenseSum, DateTime dtmLastTime, int intLastDoctor_StaffID, string strPrescriptions, byte[][] byteTuPian, int intPatientID)
        {
            #region 删除原来的照片
            //调用FRM_TiJianBingRen_Main_Load_SelectPatientOnPatientID方法把图片查询出来,并且删除原来的图片
            string strTuPian = FRM_TiJianBingRen_Main_Load_SelectPatientOnPatientID(intPatientID).Tables[0].Rows[0]["PatientPhotos"].ToString().Trim();
            string[] stWenJianZu = strTuPian.Split(';');//声明字符串数组,根据“;”中的字符字拆分
            for (int i = 0; i < stWenJianZu.Length; i++)//遍历数组中的长度
            {
                string strBaoCunLuJing = System.AppDomain.CurrentDomain.BaseDirectory;//获取项目路径
                stWenJianZu[i] = strBaoCunLuJing + "image\\" + stWenJianZu[i];//获取项目路径stWenJianZu[i]

                if (File.Exists(stWenJianZu[i]))
                {
                    //如果存在则删除
                    File.Delete(stWenJianZu[i]);
                }
            }
            #endregion
            string strWenJianName = WenJianLiuZhuanHuanLuJing(byteTuPian);
            SqlParameter[] mySqlParameters = {
                            new SqlParameter ("@Type",SqlDbType .Char ),
                            new SqlParameter ("@PatientCardNumber",SqlDbType .Char ),//获取界面中传入的病人卡号
                            new SqlParameter ("@PatientName",SqlDbType.Char   ),//获取界面中传入的病人姓名
                            new SqlParameter ("@RegisterCategoryID",SqlDbType.Int  ),//获取界面中传入的挂号类别ID
                            new SqlParameter ("@AS_SexID",SqlDbType.Int  ),//获取界面中传入的病人性别ID
                            new SqlParameter ("@Birthday",SqlDbType.Date  ),//获取界面中传入的病人出生年月
                            new SqlParameter ("@IDCardNo",SqlDbType.Char   ),//获取界面中传入的病人身份证
                           new SqlParameter ("@AS_MaritalStatusID",SqlDbType.Int),//获取界面中传入的病人婚姻状态ID
                            new SqlParameter ("@Profession",SqlDbType .Char ),//获取界面中传入的病人所在职业
                            new SqlParameter ("@MemberTypeID",SqlDbType.Int  ),//获取界面中传入的病人会员类别ID
                            new SqlParameter ("@MedicareCardNumber",SqlDbType.Char),//获取界面中传入的病人医保卡号
                            new SqlParameter ("@AS_InsuredTypeID",SqlDbType.Int ),//获取界面中传入的病人参保类型ID
                            new SqlParameter ("@ContactTelephone",SqlDbType.Char ),//获取界面中传入的病人联系电话
                            new SqlParameter ("@ContactAddress",SqlDbType .Char ),//获取界面中传入的病人联系地址
                          new SqlParameter ("@DrugAllergyHistory",SqlDbType.Char),//获取界面中传入的病人药物过敏史
                            new SqlParameter ("@PatientCategoryID",SqlDbType.Int  ),//获取界面中传入的病人类别ID
                            new SqlParameter ("@Age",SqlDbType.Char ),//获取界面中传入的病人年龄
                         new SqlParameter ("@AlphabeticBrevityCode",SqlDbType.Char),//获取界面中传入的病人拼音简码
                            new SqlParameter ("@WubiInCode",SqlDbType.Char ),//获取界面中传入的病人五笔简码
                            new SqlParameter ("@ContactMobilePhone",SqlDbType.Char),//获取界面中传入的病人联系手机
                            new SqlParameter ("@Email",SqlDbType .Char  ),//获取界面中传入的病人电子邮件
                            new SqlParameter ("@Introducer",SqlDbType .Char ),//获取界面中传入的病人介绍人员
                            new SqlParameter ("@PersonalTaboo",SqlDbType .Char  ),//获取界面中传入的病人个人忌讳
                            new SqlParameter ("@HighestReputation",SqlDbType .Char),//获取界面中传入的病人信誉上限
                            new SqlParameter ("@NowIntegral",SqlDbType.Char ),//获取界面中传入的病人当前职分
                            new SqlParameter ("@Debt",SqlDbType.Decimal   ),//获取界面中传入的病人尚欠金额
                            new SqlParameter ("@ExpenseSum",SqlDbType.Decimal  ),//获取界面中传入的病人消费金额 
                            new SqlParameter ("@LastTime",SqlDbType.DateTime   ),//获取界面中传入的病人上次时间
                            new SqlParameter ("@LastDoctor_StaffID",SqlDbType.Int    ),//获取界面中传入的上次医生
                            new SqlParameter ("@Prescriptions",SqlDbType.Char ),//获取界面中传入的病人总处方数
                            new SqlParameter ("@PatientPhotos",SqlDbType.Char),//获取界面中传入的病人图片
                            new SqlParameter ("@PatientID",SqlDbType .Int ),//获取界面中传入的病人ID
                                            };
            mySqlParameters[0].Value = "FRM_TiJianDengJi_Update_btn_Save_Click";
            mySqlParameters[1].Value = strPatientCardNumber;
            mySqlParameters[2].Value = strPatientName;
            mySqlParameters[3].Value = intRegisterCategoryID;
            mySqlParameters[4].Value = intAS_SexID;
            mySqlParameters[5].Value = dtmBirthday;
            mySqlParameters[6].Value = strIDCardNo;
            mySqlParameters[7].Value = intAS_MaritalStatusID;
            mySqlParameters[8].Value = strProfession;
            mySqlParameters[9].Value = intMemberTypeID;
            mySqlParameters[10].Value = strMedicareCardNumber;
            mySqlParameters[11].Value = intAS_InsuredTypeID;
            mySqlParameters[12].Value = strContactTelephone;
            mySqlParameters[13].Value = strContactAddress;
            mySqlParameters[14].Value = strDrugAllergyHistory;
            mySqlParameters[15].Value = intPatientCategoryID;
            mySqlParameters[16].Value = strAge;
            mySqlParameters[17].Value = strAlphabeticBrevityCode;
            mySqlParameters[18].Value = strWubiInCode;
            mySqlParameters[19].Value = strContactMobilePhone;
            mySqlParameters[20].Value = strEmail;
            mySqlParameters[21].Value = strIntroducer;
            mySqlParameters[22].Value = strPersonalTaboo;
            mySqlParameters[23].Value = strHighestReputation;
            mySqlParameters[24].Value = strNowIntegral;
            mySqlParameters[25].Value = decDebt;
            mySqlParameters[26].Value = decExpenseSum;
            mySqlParameters[27].Value = dtmLastTime;
            mySqlParameters[28].Value = intLastDoctor_StaffID;
            mySqlParameters[29].Value = strPrescriptions;
            mySqlParameters[30].Value = strWenJianName;
            mySqlParameters[31].Value = intPatientID;
            return myDALMethod.UpdateData("TiJianZhongXin_TiJianDengJi_Patient_Main", mySqlParameters);
        }
        #endregion


BLL中查找数据库中图片的文件名:

#region 查找某一个病人的信息
        [OperationContract]
     public DataSet FRM_TiJianBingRen_Main_Load_SelectPatientOnPatientID(int intPatientID)//根据病人ID查找病人信息
        {
            SqlParameter[] mySqlParameters = {
                                             new SqlParameter("@Type",SqlDbType .Char ),
                                             new SqlParameter ("@PatientID",SqlDbType .Int ),
                                             };
            mySqlParameters[0].Value = "FRM_TiJianBingRen_Main_Load_SelectPatientOnPatientID";
            mySqlParameters[1].Value = intPatientID;
            DataTable dt = myDALMethod.QueryDataTable("TiJianZhongXin_TiJianDengJi_Patient_Main", mySqlParameters);
            DataSet ds = new DataSet();
            ds.Tables.Add(dt);
            return ds;
        }
        #endregion

插入新增文件名:

 #region  文件流转换路径
        private string WenJianLiuZhuanHuanLuJing(byte[][] byteTuPian)
        {
            try
            {
                string strWenJianQianZui = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() +
                                            DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() +
                                            DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() +
                                            DateTime.Now.Millisecond.ToString();//获取图片的文件名
                string strWenJianName = "";
                for (int i = 0; i < byteTuPian.Length; i++)//遍历二进制的数组的长度
                {
                    string strRiQiWenJian = strWenJianQianZui + i.ToString() + ".png";//在并接文件名且在后面加上.png中的后缀
                    string strBaoCunLuJing = System.AppDomain.CurrentDomain.BaseDirectory;

                    strBaoCunLuJing = strBaoCunLuJing + "image\\" + strRiQiWenJian;//从文件夹中提取图片
                    FileInfo fi = new System.IO.FileInfo(strBaoCunLuJing);
                    FileStream fs;
                    fs = fi.OpenWrite();
                    fs.Write(byteTuPian[i], 0, byteTuPian[i].Length);
                    fs.Close();
                    strWenJianName += strRiQiWenJian + ";";
                }
                return strWenJianName;
            }
            catch
            {
                return null;
            }
        }
        #endregion



UIL中病人资料中保存按钮:

private void btn_Save_Click(object sender, EventArgs e)
        {
            if (blnUpdate == true)
            {
                if (txt_PatientName.Text == "")
                {
                    MessageBox.Show("请输入病人姓名!");
                }
                else
                {
                    string strPatientCardNumber = txt_PatientCardNumber.Text.ToString().Trim();
                    string strPatientName = txt_PatientName.Text.ToString().Trim();
                    int intRegisterCategoryID = Convert.ToInt32(cbo_RegisterCategoryID.SelectedValue);
                    int intAS_SexID = Convert.ToInt32(cbo_AS_SexID.SelectedValue);
                    DateTime dtmBirthday = Convert.ToDateTime(txt_Birthday.Text.ToString().Trim());
                    string strIDCardNo = txt_IDCardNo.Text.ToString().Trim();
                    int intAS_MaritalStatusID = Convert.ToInt32(cbo_AS_MaritalStatusID.SelectedValue);
                    string strProfession = txt_Profession.Text.ToString().Trim();
                    int intMemberTypeID = Convert.ToInt32(cbo_MemberTypeID.SelectedValue);
                    string strMedicareCardNumber = txt__MedicareCardNumber.Text.ToString().Trim();
                    int intAS_InsuredTypeID = Convert.ToInt32(cbo_AS_InsuredTypeID.SelectedValue);
                    string strContactTelephone = txt_ContactMobilePhone.Text.ToString().Trim();
                    string strContactAddress = txt_ContactAddress.Text.ToString().Trim();
                    string strDrugAllergyHistory = txt_DrugAllergyHistory.Text.ToString().Trim();
                    int intPatientCategoryID = Convert.ToInt32(cbo_PatientCategoryID.SelectedValue);
                    string strAge = txt_Age.Text.ToString().Trim();
                    string strAlphabeticBrevityCode = txt_AlphabeticBrevityCode.Text.ToString().Trim();
                    string strWubiInCode = txt_WubiInCode.Text.ToString().Trim();
                    string strContactMobilePhone = txt_ContactMobilePhone.Text.ToString().Trim();
                    string strEmail = txt_Email.Text.ToString().Trim();
                    string strIntroducer = txt_Introducer.Text.ToString().Trim();
                    string strPersonalTaboo = txt_PersonalTaboo.Text.ToString().Trim();
                    string strHighestReputation = txt_HighestReputation.Text.ToString().Trim();
                    string strNowIntegral = txt_NowIntegral.Text.ToString().Trim();
                    decimal decDebt = Convert.ToDecimal(txt_Debt.Text.ToString().Trim());
                    decimal decExpenseSum = Convert.ToDecimal(txt_ExpenseSum.Text.ToString().Trim());
                    DateTime dtmLastTime = Convert.ToDateTime(dtp_LastTime.Text.ToString().Trim());
                    int intLastDoctor_StaffID = Convert.ToInt32(cbo_LastDoctor_StaffID.SelectedValue);
                    string strPrescriptions = txt_Prescriptions.Text.ToString().Trim();

                    intPatientID = myFRM_TiJianDengJi_Patient_MainClient.FRM_TiJianDengJi_Update_btn_Save_Click(strPatientCardNumber, strPatientName, intRegisterCategoryID,intAS_SexID, dtmBirthday, strIDCardNo, intAS_MaritalStatusID, strProfession, intMemberTypeID, strMedicareCardNumber, intAS_InsuredTypeID, strContactTelephone, strContactAddress, strDrugAllergyHistory, intPatientCategoryID, strAge, strAlphabeticBrevityCode, strWubiInCode, strContactMobilePhone, strEmail, strIntroducer, strPersonalTaboo, strHighestReputation, strNowIntegral, decDebt, decExpenseSum, dtmLastTime, intLastDoctor_StaffID, strPrescriptions, myTuPianByte, intPatientID);
                    if (intPatientID > 0)
                    {
                        MessageBox.Show("修改成功!");
   	  <span style="white-space:pre">		</span>QingKongKongJian();//清空各个病人信息中的控件
                    }
                    else
                    {
                        MessageBox.Show("修改失败");
                    }
                }
            }

清空控件:

void QingKongKongJian()<span style="font-size: 14px; font-family: Arial, Helvetica, sans-serif;">//清空各个病人信息中的控件</span>

        {
            txt_PatientCardNumber.Text = "";
            txt_PatientName.Text = "";
            cbo_RegisterCategoryID.SelectedValue = 0;
            cbo_AS_SexID.SelectedValue = 0;
            txt_Birthday.Text = "";
            txt_IDCardNo.Text = "";
            cbo_AS_MaritalStatusID.SelectedValue = 0;
            txt_Profession.Text = "";
            cbo_MemberTypeID.SelectedValue = 0;
            txt__MedicareCardNumber.Text = "";
            cbo_AS_InsuredTypeID.SelectedValue = 0;
            txt_ContactMobilePhone.Text = "";
            txt_ContactAddress.Text = "";
            txt_DrugAllergyHistory.Text = "";
            cbo_PatientCategoryID.SelectedValue = 0;
            txt_Age.Text = "";
            txt_AlphabeticBrevityCode.Text = "";
            txt_WubiInCode.Text = "";
            txt_ContactMobilePhone.Text = "";
            txt_Email.Text = "";
            txt_Introducer.Text = "";
            txt_PersonalTaboo.Text = "";
            txt_HighestReputation.Text = "";
            txt_NowIntegral.Text = "";
            txt_Debt.Text = "";
            txt_ExpenseSum.Text = "";
            txt_ContactTelephone.Text = "";
            dtp_LastTime.Text = DateTime.Now.ToShortDateString();
            cbo_LastDoctor_StaffID.SelectedValue = 0;
            txt_Prescriptions.Text = "";
        }

注意:次文章只供学习,不要用于商业用途,否则后果自负
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值