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) |
|
聯繫手機 |
|
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) |
|
員工照片 |
|
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
//添加病人圖片
[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("新增病人失敗");
}
}
}
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)
會在主界面中可能看到病人的修改過的信息如下圖:
該過程數據庫涉及到的儲存過程有:
--修改病人
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 = "";
}
注意:次文章只供學習,不要用於商業用途,否則後果自負