WCF医院管理系统技术解析(三)体检登记(二)
体检登记中的新增历史病人(需要注意的是:该病人不经过挂号和处方,只是到医院进行体检)与医院中的前台登记病人不同。
对于这种情况:我的思路是:该病人先到医院进行登记体检,然后设置好体检的项目,再到前台进行收费,最后拿着收费单到体检执行处,执行体检处将体检的结果以纸质形式返回给病人。
进入【体检中心】→【体检登记】,按下面界面中的“新增客人”
2.9.8(图16)
在新增病人的窗体中有病人的基本资料填写、附件资料(病人图片的加载)、病员病史和账户流水等信息,界面如下:
2.9.8(图17)
从界面上用到的控件有:
|
控件 |
说明
从工具箱中找到对应的控件,拖动到界面,右键属性可以设置控件的一些属性样式和事件。如显示的文本,命名是规范
|
|
文本框 (TextBox) | |
|
下拉框 (ComBobox) | |
|
数据表格 (DataGridView) | |
|
按钮(Button) | |
|
标签 (Label) | |
|
容器(Panel) | |
|
选项卡(TabContral) |
功能实现
第一步:数据库
1.表与关系:
2.9.8(图18)
2.9.8(图19)
表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) |
|
联系手机 |
|
|
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)) |
有效否 |
该新增病人的界面中涉及的基本资料填写的控件数据绑定有各个下拉框的绑定界面图如下:
2.9.8(图20)
各个下拉框即上图2.9.8(图20)的绑定数据库:
--绑定性别
IF @Type = 'FRM_TiJianDengJi_Insert_cbo_AS_SexID'
BEGIN
SELECT RTRIM(AttributeDetailsID) AS AttributeDetailsID, RTRIM(AttributeDetailsName) AS AttributeDetailsName
FROM BT_AttributeDetailsTable
WHERE AttributeSetID = 2
END
--绑定婚姻状态
IF @Type = 'FRM_TiJianDengJi_Insert_cbo_AS_MaritalStatusID'
BEGIN
SELECT RTRIM(AttributeDetailsID) AS AttributeDetailsID, RTRIM(AttributeDetailsName) AS AttributeDetailsName
FROM BT_AttributeDetailsTable
WHERE AttributeSetID = 20
END
--绑定参保类别
IF @Type = 'FRM_TiJianDengJi_Insert_cbo_AS_InsuredTypeID'
BEGIN
SELECT RTRIM(AttributeDetailsID) AS AttributeDetailsID, RTRIM(AttributeDetailsName) AS AttributeDetailsName
FROM BT_AttributeDetailsTable
WHERE AttributeSetID = 21
END
--绑定挂号类别
IF @Type = 'FRM_TiJianDengJi_Insert_cbo_RegisterCategoryID'
BEGIN
SELECT RTRIM(RegisterCategoryID) AS RegisterCategoryID, RTRIM(RegisterCategoryName) AS RegisterCategoryName
FROM BT_RegisterCategoryTable
END
--绑定会员类别
IF @Type = 'FRM_TiJianDengJi_Insert_cbo_MemberTypeID'
BEGIN
SELECT RTRIM(MemberCategoryID) AS MemberCategoryID,RTRIM( MemberCategoryName) AS MemberCategoryName
FROM BT_MemberCategoryTable
END
--查询病人类别
IF @Type = 'FRM_TiJianDengJi_Insert_cbo_PatientCategoryID'
BEGIN
SELECT RTRIM(PatientCategoryID) AS PatientCategoryID, RTRIM(CategoryName) AS CategoryName
FROM BT_PatientCategoryTable
END
--查询员工
IF @Type = 'FRM_TiJianDengJi_Insert_LastDoctor_StaffID'
BEGIN
SELECT RTRIM( StaffID) AS StaffID, RTRIM(StaffName) AS StaffName
FROM BT_StaffTable
END
BLL中与之对应的方法有:
DALPublic.DALMethod myDALMethod = new DALPublic.DALMethod();
//绑定性别
[OperationContract]
public DataSet FRM_TiJianDengJi_Insert_cbo_AS_SexID()
{
SqlParameter[] mySqlParameters = {
new SqlParameter("@Type",SqlDbType .Char ),
};
mySqlParameters[0].Value = "FRM_TiJianDengJi_Insert_cbo_AS_SexID";
DataTable dt = myDALMethod.QueryDataTable("TiJianZhongXin_TiJianDengJi_Patient_Main", mySqlParameters);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
//绑定婚姻状态
[OperationContract]
public DataSet FRM_TiJianDengJi_Insert_cbo_AS_MaritalStatusID()
{
SqlParameter[] mySqlParameters = {
new SqlParameter("@Type",SqlDbType .Char ),
};
mySqlParameters[0].Value = "FRM_TiJianDengJi_Insert_cbo_AS_MaritalStatusID";
DataTable dt = myDALMethod.QueryDataTable("TiJianZhongXin_TiJianDengJi_Patient_Main", mySqlParameters);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
//绑定参保类别
[OperationContract]
public DataSet FRM_TiJianDengJi_Insert_cbo_AS_InsuredTypeID()
{
SqlParameter[] mySqlParameters = {
new SqlParameter("@Type",SqlDbType .Char ),
};
mySqlParameters[0].Value = "FRM_TiJianDengJi_Insert_cbo_AS_InsuredTypeID";
DataTable dt = myDALMethod.QueryDataTable("TiJianZhongXin_TiJianDengJi_Patient_Main", mySqlParameters);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
//绑定挂号类别
[OperationContract]
public DataSet FRM_TiJianDengJi_Insert_cbo_RegisterCategoryID()
{
SqlParameter[] mySqlParameters = {
new SqlParameter("@Type",SqlDbType .Char ),
};
mySqlParameters[0].Value = "FRM_TiJianDengJi_Insert_cbo_RegisterCategoryID";
DataTable dt = myDALMethod.QueryDataTable("TiJianZhongXin_TiJianDengJi_Patient_Main", mySqlParameters);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
//绑定会员类别
[OperationContract]
public DataSet FRM_TiJianDengJi_Insert_cbo_MemberTypeID()
{
SqlParameter[] mySqlParameters = {
new SqlParameter("@Type",SqlDbType .Char ),
};
mySqlParameters[0].Value = "FRM_TiJianDengJi_Insert_cbo_MemberTypeID";
DataTable dt = myDALMethod.QueryDataTable("TiJianZhongXin_TiJianDengJi_Patient_Main", mySqlParameters);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
//查询病人类别
[OperationContract]
public DataSet FRM_TiJianDengJi_Insert_cbo_PatientCategoryID()
{
SqlParameter[] mySqlParameters = {
new SqlParameter("@Type",SqlDbType .Char ),
};
mySqlParameters[0].Value = "FRM_TiJianDengJi_Insert_cbo_PatientCategoryID";
DataTable dt = myDALMethod.QueryDataTable("TiJianZhongXin_TiJianDengJi_Patient_Main", mySqlParameters);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
//查询员工
[OperationContract]
public DataSet FRM_TiJianDengJi_Insert_LastDoctor_StaffID()
{
SqlParameter[] mySqlParameters = {
new SqlParameter("@Type",SqlDbType .Char ),
};
mySqlParameters[0].Value = "FRM_TiJianDengJi_Insert_LastDoctor_StaffID";
DataTable dt = myDALMethod.QueryDataTable("TiJianZhongXin_TiJianDengJi_Patient_Main", mySqlParameters);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}UIL中涉及中绑定图2.9.8(图20)的代码:
BLL医院管理系统.TiJianZhongXin.FRM_TiJianDengJi_Patient_Main.FRM_TiJianDengJi_Patient_MainClient myFRM_TiJianDengJi_Patient_MainClient
= new BLL医院管理系统.TiJianZhongXin.FRM_TiJianDengJi_Patient_Main.FRM_TiJianDengJi_Patient_MainClient();
//绑定性别
cbo_AS_SexID.DataSource = myFRM_TiJianDengJi_Patient_MainClient.FRM_TiJianDengJi_Insert_cbo_AS_SexID().Tables[0];
cbo_AS_SexID.DisplayMember = "AttributeDetailsName";
cbo_AS_SexID.ValueMember = "AttributeDetailsID";
cbo_AS_SexID.SelectedValue = -1;
//绑定婚姻状态
cbo_AS_MaritalStatusID.DataSource = myFRM_TiJianDengJi_Patient_MainClient.FRM_TiJianDengJi_Insert_cbo_AS_MaritalStatusID().Tables[0];
cbo_AS_MaritalStatusID.DisplayMember = "AttributeDetailsName";
cbo_AS_MaritalStatusID.ValueMember = "AttributeDetailsID";
//绑定参保类别
cbo_AS_InsuredTypeID.DataSource = myFRM_TiJianDengJi_Patient_MainClient.FRM_TiJianDengJi_Insert_cbo_AS_InsuredTypeID().Tables[0];
cbo_AS_InsuredTypeID.DisplayMember = "AttributeDetailsName";
cbo_AS_InsuredTypeID.ValueMember = "AttributeDetailsID";
//绑定挂号类别
cbo_RegisterCategoryID.DataSource = myFRM_TiJianDengJi_Patient_MainClient.FRM_TiJianDengJi_Insert_cbo_RegisterCategoryID().Tables[0];
cbo_RegisterCategoryID.DisplayMember = "RegisterCategoryName";
cbo_RegisterCategoryID.ValueMember = "RegisterCategoryID";
//绑定会员类别
cbo_MemberTypeID.DataSource = myFRM_TiJianDengJi_Patient_MainClient.FRM_TiJianDengJi_Insert_cbo_MemberTypeID().Tables[0];
cbo_MemberTypeID.DisplayMember = "MemberCategoryName";
cbo_MemberTypeID.ValueMember = "MemberCategoryID";
//查询病人类别
cbo_PatientCategoryID.DataSource = myFRM_TiJianDengJi_Patient_MainClient.FRM_TiJianDengJi_Insert_cbo_PatientCategoryID().Tables[0];
cbo_PatientCategoryID.DisplayMember = "CategoryName";
cbo_PatientCategoryID.ValueMember = "PatientCategoryID";
//查询员工
cbo_LastDoctor_StaffID.DataSource = myFRM_TiJianDengJi_Patient_MainClient.FRM_TiJianDengJi_Insert_LastDoctor_StaffID().Tables[0];
cbo_LastDoctor_StaffID.DisplayMember = "StaffName";
cbo_LastDoctor_StaffID.ValueMember = "StaffID";
在输入病人姓名的时候,有检则是否为历史病人,是历史病人就根据病人姓名显示出来,选择对应的体检历史病人绑定数据。同时,历史病人的病员病历以及账户流水就会显示出来,不是历史病人的就进行新增病人的操作,但病员病历和账户流水都为空。
如在病人名称中的本文框中输入“张“ ,会提示”张”姓的病人其 界面效果为:
2.9.8(图21)
数据库代码为:
根据病人姓名查询某病人的信息
IF @Type = 'FRM_TiJianBingRen_Insert_SelectBingRen'
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
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
WHERE BT_PatientTable.PatientName LIKE '%'+ RTRIM(LTRIM(@PatientName)) + '%'
ENDBLL中涉及的方法有:
#region 根据病人姓名查询一个病人的信息
[OperationContract]
public DataSet FRM_TiJianBingRen_Insert_SelectBingRen(string strPatientName)//获取界面中输入的病人姓名
{
SqlParameter[] mySqlParameters = {
new SqlParameter("@Type",SqlDbType .Char ),
new SqlParameter ("@PatientName",SqlDbType.Char),//根据界面中输入的病人姓名进行查询数据库
};
mySqlParameters[0].Value = "FRM_TiJianBingRen_Insert_SelectBingRen";
mySqlParameters[1].Value = strPatientName;
DataTable dt = myDALMethod.QueryDataTable("TiJianZhongXin_TiJianDengJi_Patient_Main", mySqlParameters);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
#endregionUIL中涉及的代码有:
第一步:点击文本框,右键属性
第二步:在文本框中的属性事件中找到TextChanged的事件,点击进入
2.9.8(图22)
#region 病人姓名和拼音简码
private void txt_PatientName_TextChanged(object sender, EventArgs e)
{
txt_AlphabeticBrevityCode.Text = GetChineseSpell(txt_PatientName.Text.Trim());//调用拼音简码的方法
//把病人姓名中的文本框中的值传值到数据库查找相应的历史病人信息存放进表格中
DataTable dtPatientName = myFRM_TiJianDengJi_Patient_MainClient.FRM_TiJianBingRen_Insert_SelectBingRen(txt_PatientName.T<span style="white-space:pre"> </span>ext.Trim()).Tables[0];
dgv_SelecctAllPatient.DataSource = dtPatientName;//把表格中的赋值给dgv
pnl_Patient.Visible = true;//容器可见
}设为登记病人为历史病人,那么会根据病人ID把以往病人的各种看病情况显示出来:
界面效果图为:
2.9.8(图23)
数据库中涉及到的储存过程有:
--把查询到的病人信息绑定到对应的控件中
IF @Type = 'FRM_TiJianBingRen_Main_Load_SelectPatientOnPatientIDForKongJian'
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.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.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
WHERE BT_PatientTable.PatientID = @PatientID
ENDBLL中的涉及的方法有:
#region 把查询到的病人信息绑定到对应的控件中
[OperationContract]
public DataSet FRM_TiJianBingRen_Main_Load_SelectPatientOnPatientIDForKongJian(int intPatientID)///获取界面中的病人ID
{
SqlParameter[] mySqlParameters = {
new SqlParameter("@Type",SqlDbType .Char ),
new SqlParameter ("@PatientID",SqlDbType.Char),//把界面中的病人ID传值到数据库,查询病人信息
};
mySqlParameters[0].Value = "FRM_TiJianBingRen_Main_Load_SelectPatientOnPatientIDForKongJian";
mySqlParameters[1].Value = intPatientID;
DataTable dt = myDALMethod.QueryDataTable("TiJianZhongXin_TiJianDengJi_Patient_Main", mySqlParameters);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
#endregion
UIL中涉及到的代码有:
//dgv中的单击事件
private void dgv_SelecctAllPatient_CellClick(object sender, DataGridViewCellEventArgs e)
{
intPatienID = Convert.ToInt32(dgv_SelecctAllPatient.CurrentRow.Cells["PatientID"].Value.ToString().Trim());
//根据病人ID把查询到的病人信息绑定到对应的控件中
DataTable dtPatient = myFRM_TiJianDengJi_Patient_MainClient.FRM_TiJianBingRen_Main_Load_SelectPatientOnPatientIDForKongJian(intPatienID).Tables[0];
if (dtPatient.Rows.Count > 0)
{
//把查询到的病人信息绑定到对应的控件中
txt_PatientCardNumber.Text = dtPatient.Rows[0]["PatientCardNumber"].ToString().Trim();
txt_PatientName.Text = dtPatient.Rows[0]["PatientName"].ToString().Trim();
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();
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();
历史病人的附加资料中的图片效果图为:
2.9.8(图24)
该过程涉及到的数据库中的储存过程有:
--把查询到的病人信息绑定到对应的控件中
IF @Type = 'FRM_TiJianBingRen_Main_Load_SelectPatientOnPatientIDForKongJian'
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.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.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
WHERE BT_PatientTable.PatientID = @PatientID
END
BLL中涉及的方法:
#region 把查询到的病人信息绑定到对应的控件中
[OperationContract]
public DataSet FRM_TiJianBingRen_Main_Load_SelectPatientOnPatientIDForKongJian(int intPatientID)//获取界面中的病人ID
{
SqlParameter[] mySqlParameters = {
new SqlParameter("@Type",SqlDbType .Char ),
new SqlParameter ("@PatientID",SqlDbType.Char),//把界面中的病人ID传值到数据库,查询病人信息
};
mySqlParameters[0].Value = "FRM_TiJianBingRen_Main_Load_SelectPatientOnPatientIDForKongJian";
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 查询图片
[OperationContract]
public byte[][] FRM_TiJianDengJi_Update_SelectTuPian(string strLuJing)//获取界面中的图片文件名
{
return WenJianLiuZhuanHuanLuJing(strLuJing);//调用方法
}
#endregion
路径转换文件流:
#region 路径转换文件流
private byte[][] WenJianLiuZhuanHuanLuJing(string strLuJing)//用字符串把UIL中的参数存放起来
{
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];//把图片的路径转换为文件流
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中涉及到的代码有:
声明全局变量:
Boolean blnNotInsert = false;
byte[][] myTuPianByte; int intPatientID = 0;
窗体加载事件中有:
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;
blnNotInsert = true;
自定义方法加载图片:
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;//设置另一张图片在的高度在上一张的高度下面
}
本文详细介绍了WCF医院管理系统中的体检登记模块,包括新增历史病人的流程、使用到的控件及其属性设置,以及如何通过病人姓名查询并显示历史病人的信息。
2097

被折叠的 条评论
为什么被折叠?



