下面是对医生工作站的一些主体的功能进行描述,和解析说明;
医师对分配好床位的病人进行医嘱录入和处方录入还有一些辅助的检查和对病人的信息修改查看等,功能如下图:
医师点击菜单栏——》护理——》体温单进行对病人的体温录入
录入完成点击保存,保存后可以编辑修改。
医师点击菜单栏——》护理——》过敏药品录入,进行对病人的过敏药品录入,如下图:这部尤为关键,如果病人对某种药品过敏的话,在医生开药的时
候会对病人过敏的药品进行限制
医生对上面的操做好了以后可以进行对病人的处方录入,录入药品时回对病人的过敏药品进行检测,如果病人对某些药品过敏是不能进行此药品的录入的。如下图
录入处方后,医生会对病人属性一些医嘱,就是护士要根据医嘱来对病人进行料理:如下图
除了这些以外,医生站还可以查看病人信息和修改病人资料。
修改资料图如下
从所有界面上可以看到我们这里用到的控件有
控件名称 | 说明 |
日期控件(DateTimePicker) | 控件可以在工具箱直接拖动至窗体,拖至窗体后右击属性可以修改控件的样式和各种属性,还可以编辑事件。 |
下拉框(ComboBox) | |
文本(TextBox) | |
按钮(Button) | |
表格(DataGridView) |
医嘱录入关系图如下图:
病历书写
处方录入
过敏药品录入
表1 医嘱表 ZY_DoctorAdviceList
列名 | 数据类型/主外键 | 说明 |
DoctorAdviceID | int - Identity(主键) | 医嘱ID |
CheckProject | nchar (20) | 检查项目 |
DoctorAdviceContent | nchar (50) | 医嘱内容 |
EntrustNo | bit | 嘱托否 |
ParturitionManufacturers | nchar (50) | 生产厂家 |
ChineseMedicinFuShu | decimal (18) | 中药付数 |
Number | decimal (18) | 数量 |
OnceDose | nchar (20) | 单次剂量 |
Unit | nchar (20) | 单位 |
Specification | nchar (20) | 规格 |
Contents | nchar (10) | 含量 |
UnitPrice | decimal (18, 2) | 单价 |
Money | decimal (18, 2) | 金额 |
UseMethod | nchar (20) | 用法 |
Frequency | decimal (18) | 频率 |
OpenEntrustDate | datetime | 开嘱日期 |
DoctorID | Int(外键) | 开嘱医生ID |
ExecuteNurseID | int(外键) | 执行护士ID |
StopEntrustDate | datetime | 停嘱日期 |
StopEntrustNo | bit | 停嘱否 |
RegisterInhospitalID | int(外键) | 住院登记ID |
SubmitNo | bit | 提交否 |
表 2床位分配表 ZY_BedLocationAllocationList
列名 | 数据类型/主外键 | 说明 |
BedLocationAllocationID | int - Identity(主键) | 床位分配ID |
RegisterInhospitalID | int(外键) | 住院登记ID |
BedLocationID | int(外键) | 床位ID |
EnterResideTime | datetime | 入住时间 |
QuitBedTime | datetime | 退床时间 |
QuitBedNo | bit | 退床否 |
表3过敏药品录入表
列名 | 数据类型 | 说明 |
AllergicMedicineID | int - Identity | 过敏药品ID |
MedicineID | int(外键) | 药品ID |
MedicineName | nchar (20) | 药品名称 |
AllergicReason | nchar (50) | 过敏原因 |
CheckResultID | int(外键) | 药品ID |
RegisterInhospitalID | int(外键) | 住院登记ID |
Encoding | nchar (20) | 编码 |
表4影像表
列名 | 数据类型 | 说明 |
ImageID | int - Identity(主键) | 影像ID |
Date | nchar (20) | 日期 |
FileName | nvarchar (MAX) | 文件名 |
Describe | nvarchar (50) | 描述 |
RegisterInhospitalID | Int(外键) | 住院登记ID |
表5 体温表
列名 | 数据类型 | 说明 |
TemperatureID | int - Identity(主键) | 体温ID |
BillsDate | datetime | 单据日期 |
OperationDate | datetime | 手术日期 |
InHospitalData | decimal (18) | 住院天数 |
Temperature1 | decimal (18, 1) | 体温1 |
Temperature2 | decimal (18, 1) | 体温2 |
Temperature3 | decimal (18, 1) | 体温3 |
Temperature4 | decimal (18, 1) | 体温4 |
Temperature5 | decimal (18, 1) | 体温5 |
Temperature6 | decimal (18, 1) | 体温6 |
Pulse1 | decimal (18, 1) | 脉搏1 |
Pulse2 | decimal (18, 1) | 脉搏2 |
Pulse3 | decimal (18, 1) | 脉搏3 |
Pulse4 | decimal (18, 1) | 脉搏4 |
Pulse5 | decimal (18, 1) | 脉搏5 |
Pulse6 | decimal (18, 1) | 脉搏6 |
Breathe1 | decimal (18) | 呼吸1 |
Breathe2 | decimal (18) | 呼吸2 |
Breathe3 | decimal (18) | 呼吸3 |
Breathe4 | decimal (18) | 呼吸4 |
Breathe5 | decimal (18) | 呼吸5 |
Breathe6 | decimal (18) | 呼吸6 |
DefecateNumber | decimal (18) | 大便次数 |
PeeNumber | decimal (18) | 小便次数 |
EffluentMeasure | decimal (18) | 出水量 |
RuWorterMeasure | decimal (18) | 入水量 |
BloodPressure | decimal (18) | 血压 |
Height | decimal (18, 2) | 身高 |
Weight | decimal (18, 2) | 体重 |
MedicineAllergic | nvarchar (150) | 药物过敏 |
RegisterInhospitalID | Int(外键) | 住院登记ID |
表6:病历表
Primary Key(s): BingLiID
列名 | 数据类型 | 说明 |
BingLiID | int - Identity | 病历ID |
ZhuSu | nchar (50) | 主诉 |
NowIllnessHistory | nchar (50) | 现病史 |
BeforeHistory | nchar (50) | 既往史 |
AllergyHistory | nchar (50) | 过敏史 |
CheckBuild | nchar (50) | 体格检查 |
PreliminaryDiagnosis | nchar (50) | 初步诊断 |
DealwithIdea | nchar (100) | 处理意见 |
BeforeNo | bit | 以往否 |
MenZhenRegisterID | int | 门诊登记ID |
RegisterTime | datetime | 登记时间 |
InHospitalNo | bit | 住院否 |
表7:处方明细表
dbo.MZ_PrescriptionBillsMingXiList
Primary Key(s): PrescriptionBillsMingXiID
列名 | 数据类型 | 说明 |
PrescriptionBillsMingXiID | int - Identity | 处方明细ID |
MedicineID | int | 药品ID |
Number | decimal (18, 2) | 数量 |
PrescriptionBillsID | int | 处方ID |
SendOutMedicineNo | bit | 发药否 |
SkinTestID | int | 皮试ID |
UsageID | int | 用法ID |
UseMedicineFrequencyID | int | 用药频率ID |
AtEveryTurnNumber | decimal (18) | 每次数量 |
AtEveryTurnDoseID | int | 每次剂量ID |
PayMoney | decimal (18, 2) | 自付金额 |
OfficeID | int | 科室ID |
RetreatMedicineNumber | decimal (18) | 退药数量 |
InhospitalNo | bit | 住院否 |
具体实现(一)进入医生工作站的主界面病人资料卡片的实现
private void Frm_ZhuYuanYiShengZhancs_Load(object sender, EventArgs e)
{
//清空后再加载
plSickMap.Controls.Clear();
if (radNoOutHospital.Checked == true && Selecting==false)//如果选择未出院
{
DataTable dtBingRen = myFrm_ZhuYuanYiShengZhanClient.
Frm_ZhuYuanYiShengZhan_SelectBingRenXinXi().Tables[0];
//创建数据集把数据表装进去
DataView dv = new DataView(dtBingRen);
//给数据集条件筛选数据,条件为出院否=0,相当于数据库存储过程中的Where条件
dv.RowFilter = "(LeaveHospitalNo=0 and QuitBedNo=0)";
//把筛选的数据集转化为数据表
dtBingRenXinXi = dv.ToTable();
}
for (int i = 0, leftX = 10, leftY = 80; i < dtBingRenXinXi.Rows.Count; i++)
{
int RowCount = i / 4;
if (i % 4== 0)
{
leftX = 20;
}
else
{
leftX += 200;
}
leftY = RowCount * 180;
Button btnXinXi = new Button();
btnXinXi.Size = new Size(150, 25);//设置控件的大小
btnXinXi.FlatAppearance.BorderSize = 1;//获取用于指示选中状态和鼠标状态的边框外观和颜色。
btnXinXi.BackColor = Color.SkyBlue;//设置控件的背景色。
btnXinXi.TextAlign = System.Drawing.ContentAlignment.TopLeft;//设置文本对齐方式
btnXinXi.FlatStyle = FlatStyle.Flat;//设置按钮控件的平面样式外观。
btnXinXi.Location = new Point(leftX, leftY);//控件的坐标
string XingBie = dtBingRenXinXi.Rows[i]["Sex"].ToString().Trim();
string XingMing = dtBingRenXinXi.Rows[i]["Name"].ToString().Trim();
btnXinXi.Text = XingMing;
//判断病人性别
int QuBie;
//如果为男性
if (XingBie == "男")
{
//QuBie赋值为0
QuBie = 0;
}
else
{
//为女性QuBie赋值为1
QuBie = 1;
}
switch (QuBie)
{
case 0:
//QuBie赋值为0头像为男
btnXinXi.Image = ImgTuiPian.Images["man.gif"];
break;
case 1:
//QuBie赋值为1头像为女
btnXinXi.Image = ImgTuiPian.Images["wife.gif"];
break;
}
PictureBox pbXinXi = new PictureBox();//实例化PictureBox
pbXinXi.Tag = dtBingRenXinXi.Rows[i]["RegisterInhospitalID"].ToString().Trim();
pbXinXi.Size = new Size(150, 150);//设置大小
pbXinXi.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;//指示控件的边框样式
pbXinXi.Location = new Point(leftX, leftY+25);
plSickMap.Controls.Add(btnXinXi);
plSickMap.Controls.Add(pbXinXi);
pbXinXi.MouseClick += new MouseEventHandler(pbXinXi_MouseClick);//鼠标单击事件
pbXinXi.MouseLeave += new EventHandler(pbXinXi_MouseLeave);//鼠标离开事件
pbXinXi.MouseEnter += new EventHandler(pbXinXi_MouseEnter);//鼠标进入事件
pbXinXi.Paint+=new PaintEventHandler(pbXinXi_Paint);//窗体重绘事件
}
}
public void pbXinXi_Paint(object sender, PaintEventArgs e)
{
PictureBox pb = sender as PictureBox;//把触发事件的对象转换为图片对象
Graphics g = e.Graphics;//实例化图片的绘图对象
int tag = Convert.ToInt32(pb.Tag); //获取图片对应的住院ID
foreach (DataRow dt in dtBingRenXinXi.Rows)//遍历全局变量myDataTable住院表
{
if (Convert.ToInt32(dt["RegisterInhospitalID"]) == tag)//如果住院表的住院ID与图片对应的ID相等
{
//给相应变量赋值
string Name = dt["Name"].ToString().Trim();
string ZhuYuanHao = dt["InHospitalNumber"].ToString().Trim();
string XingBie = dt["Sex"].ToString().Trim();
string NianLing = dt["Age"].ToString().Trim();
string ZhuYuangRiQi = dt["EnterHospitalDate"].ToString().Trim();
string YiSheng = dt["DoctorName"].ToString().Trim();
g.DrawString( "住院号:" + ZhuYuanHao+"\n"+"\n"+"姓名:" + Name
+ " " + "性别:" + XingBie + "\n"+"\n" + "年龄:" + NianLing + " "
+ "医生:" + YiSheng + "\n"+"\n" + "住院日期:" + ZhuYuangRiQi,
new Font("宋体", 10, FontStyle.Regular), SystemBrushes.ControlText, new PointF(10, 5));
}
}
}
然后医生对病人进行检查对对过敏药品的录入。次操作直接影响到医生的开药。具体的实现如下:
单击HbsAg,HCV_Ab。HIV—Ab是实现的代码
private void txtCheck_Click(object sender, EventArgs e)
{
//for 循环为了检查表格中是否存在"HIV-Ab"项目
for (int index = 0; index < dgDrugallergicRecord.Rows.Count;index++ )
{
if(Convert.ToString( dgDrugallergicRecord.Rows[index].Cells["MedicineName"].Value.ToString().Trim()) == "HIV-Ab")
{
//如果存在则跳出次方法
return;
}
}
dgDrugallergicRecord.Rows.Add(3);//添加3行
//对应的赋值
dgDrugallergicRecord.Rows[dgDrugallergicRecord.Rows.Count - 1].Cells["MedicineName"].Value = "HIV-Ab";
dgDrugallergicRecord.Rows[dgDrugallergicRecord.Rows.Count - 2].Cells["MedicineName"].Value = "HCV-Ab";
dgDrugallergicRecord.Rows[dgDrugallergicRecord.Rows.Count - 3].Cells["MedicineName"].Value = "HbsAg";
dgDrugallergicRecord.Rows[dgDrugallergicRecord.Rows.Count - 1].Cells["AllergicMedicineID"].Value =0;
dgDrugallergicRecord.Rows[dgDrugallergicRecord.Rows.Count - 2].Cells["AllergicMedicineID"].Value = 0;
dgDrugallergicRecord.Rows[dgDrugallergicRecord.Rows.Count - 3].Cells["AllergicMedicineID"].Value = 0;
}
点击删除时要用到数组记录已经移除的项目ID,移除并不是删除,实际删除要单击保存,避免误操作。删除时的操作代码,
#region 删除功能
int i = 0;//定义一个变量
private void btnShanChu_Click(object sender, EventArgs e)
{
if (dgDrugallergicRecord.Rows.Count > 0)//如果过敏药品表>0
{
ShuZhu[i] = Convert.ToInt32(dgDrugallergicRecord.Rows
[dgDrugallergicRecord.Rows.Count - 1].Cells["AllergicMedicineID"].Value);//用数组记录移除了的ID
dgDrugallergicRecord.Rows.RemoveAt(dgDrugallergicRecord.Rows.Count - 1);//移除行
i++;//变量每一次都加一
}
}
保存过敏记录的实现
第一步:数据库存储过程
if @Type='Frm_ZhuYuanYiShengZhan_InsertGuoMinYaoPing'
begin
insert ZY_AllergicMedicineCheckRecordList ( MedicineID,MedicineName,
AllergicReason, CheckResultID,RegisterInhospitalID,Encoding)
values ( @MedicineID,@MedicineName, @AllergicReason, @CheckResultID,@RegisterInhospitalID,@Encoding)
end
第二步:逻辑层(BLL)代码
[OperationContract]
public int Frm_ZhuYuanYiShengZhan_InsertGuoMinYaoPing(int MedicineID, string MedicineName,string AllergicReason,
int CheckResultID, int RegisterInhospitalID, string Encoding)
{
SqlParameter[] mySqlParameters = {
new SqlParameter ("@Type",SqlDbType .Char),
new SqlParameter ("@MedicineID",SqlDbType.Int),
new SqlParameter ("@MedicineName",SqlDbType.Char),
new SqlParameter ("@AllergicReason",SqlDbType.Char),
new SqlParameter ("@CheckResultID",SqlDbType.Int),
new SqlParameter ("@RegisterInhospitalID",SqlDbType.Int),
new SqlParameter ("@Encoding",SqlDbType.Char),
};
mySqlParameters[0].Value = "Frm_ZhuYuanYiShengZhan_InsertGuoMinYaoPing";
mySqlParameters[1].Value = MedicineID;
mySqlParameters[2].Value = MedicineName;
mySqlParameters[3].Value = AllergicReason;
mySqlParameters[4].Value = CheckResultID;
mySqlParameters[5].Value = RegisterInhospitalID;
mySqlParameters[6].Value = Encoding;
return myDALMethod.UpdateData("住院登记_Frm_ZhuYuanYiShengZhan", mySqlParameters);
}
第三步:界面层(UIL)代码
int Sum;//声明变量
int inCount;//声明变量
int ChengGong;//声明变量
private void btnBaoCun_Click(object sender, EventArgs e)
{
for (int j = 0; j < dgDrugallergicRecord.Rows.Count;j++ )
{
if (Convert.ToInt32(dgDrugallergicRecord.Rows[j].Cells["AllergicMedicineID"].Value) == 0)
{ //循环判断检查ID是否为空
int CheckResultID = Convert.ToInt32(dgDrugallergicRecord.Rows[j].Cells["CheckResult"].Value);
if (CheckResultID ==0)
{
MessageBox.Show("检查结果不能留空!");
//为空则跳出该方法
return;
}
else
{
//否则变量加一
Sum++;
}
}
}
//for循环获取每一行对应的值
for (int i = 0; i < dgDrugallergicRecord.Rows.Count;i++ )
{
if (Convert.ToInt32(dgDrugallergicRecord.Rows[i].Cells["AllergicMedicineID"].Value )==0)
{
int MedicineID =Convert.ToInt32( dgDrugallergicRecord.Rows[i].Cells["MedicineID"].Value);
string MedicineName =Convert.ToString(dgDrugallergicRecord.Rows[i].Cells["MedicineName"].Value);
string AllergicReason =Convert.ToString( dgDrugallergicRecord.Rows[i].Cells["AllergicReason"].Value);
int CheckResultID = Convert.ToInt32(dgDrugallergicRecord.Rows[i].Cells["CheckResult"].Value);
string Encoding = Convert.ToString(dgDrugallergicRecord.Rows[i].Cells["Encoding"].Value);
myFrm_ZhuYuanYiShengZhanClient.Frm_ZhuYuanYiShengZhan_InsertGuoMinYaoPing
(MedicineID, MedicineName, AllergicReason, CheckResultID, PulicStatic.ZhuYuanDengjiID, Encoding);
inCount++;//变量加一
}
}
//for 循环数组删除
for (int k = 0; k < ShuZhu.Length;k++ )
{
ChengGong= myFrm_ZhuYuanYiShengZhanClient.Frm_ZhuYuanYiShengZhan_DeleteGuoMinYaoPing(ShuZhu[k]);
}
if (Sum == inCount || ChengGong>0)
{
MessageBox.Show("保存成功!");
}
}
过敏药物记录以后,医生可对病人进行病历的书写,和处方的录入
处方录入的实现解析代码如下:
如图看到的自付金和总金额的实现
#region 计算总金和自付金
public void JiSuZongJinZiFuJin()
{ //获取单价
decimal DanJia = Convert.ToDecimal(dgvMedicineInformation.CurrentRow.Cells["RetailPrice_J"].Value);
//获取数量
decimal ShuLiang = Convert.ToDecimal(dgvMedicineInformation.CurrentRow.Cells["SumNumber"].Value);
//判断库房数量
if (门诊管理.Frm_MenZhenYiShengGongZuoZhanYaoPin_Insert.decStockNumber > 0)
{ //比较获取的数量和库房数量
if (ShuLiang > 门诊管理.Frm_MenZhenYiShengGongZuoZhanYaoPin_Insert.decStockNumber)
{ //如果数量>库房数则跳出次方法
MessageBox.Show("总数量不能大于该药品的库存数量!");
return;
}
}
//计算当前选择的行的总金额=单价*数量
dgvMedicineInformation.CurrentRow.Cells["SumMoney"].Value =( DanJia * ShuLiang).ToString("0.00");
//获取药品ID
YoPingID = Convert.ToInt32(dgvMedicineInformation.CurrentRow.Cells["MedicineID"].Value);
//查询病人对应的折扣率(根据医疗方式和药品ID)
DataTable dtZheKouLv = myFrm_ZhuYuanJiZhangClient.
Frm_ZhuYuanJiZhang_SelectZheKouLi(PulicStatic.YiLiaoFangShi, YoPingID).Tables[0];
//如果查询的折扣率的表>0
if (dtZheKouLv.Rows.Count > 0)
{
//获取当前行的总金额
decimal ZongJinE = Convert.ToDecimal(dgvMedicineInformation.CurrentRow.Cells["SumMoney"].Value);
//计算自付金额=总金额*折扣率
dgvMedicineInformation.CurrentRow.Cells["PayMoney"].Value =
(ZongJinE * Convert.ToDecimal(dtZheKouLv.Rows[0][0])).ToString("0.00");
}
else
{
//如果该药每有折扣率则自付金额=总金额
decimal ZongJinE = Convert.ToDecimal(dgvMedicineInformation.CurrentRow.Cells["SumMoney"].Value);
dgvMedicineInformation.CurrentRow.Cells["PayMoney"].Value = (ZongJinE).ToString("0.00");
}
JiSuSumMoney();//调用计算每行的累计总金额和自付金方法。
}
#endregion
计算每行的累计总金额和自付金方法。
#region 累计总金和 自付金额
public void JiSuSumMoney()
{
decimal ZongJin = 0;//定义变量总金
decimal ZiFuJi = 0;//定义变量自付金
int i = 0;
//for循环累计总金和 自付金额
for (i = 0; i < dgvMedicineInformation.Rows.Count; i++)
{
ZongJin += Convert.ToDecimal(dgvMedicineInformation.Rows[i].Cells["SumMoney"].Value);
ZiFuJi += Convert.ToDecimal(dgvMedicineInformation.Rows[i].Cells["PayMoney"].Value);
}
//给文本赋值
lblSumMoney.Text = ZongJin.ToString("0.00").Trim();
lblZiFuJin.Text = ZiFuJi.ToString("0.00").Trim();
}
#endregion
处方单药品的保存和库房的修改的实现
第一步:数据库存储过程
if(@Type='Frm_MenZhenYiShengGongZuoZhan_UpdateKuCunShu')
begin
update KC_StockList
set StockNumber=StockNumber-@StockNumber
where KC_StockList.MedicineID=@MedicineID AND KC_StockList.StoreroomID=@StoreroomID
end --库房数的修改
if(@Type='Frm_MenZhenYiShengGongZuoZhan_InsertChuFangDanMingXi')
begin
insert MZ_PrescriptionBillsMingXiList(MedicineID, Number, PrescriptionBillsID,
SendOutMedicineNo, SkinTestID, UsageID, UseMedicineFrequencyID, AtEveryTurnNumber,
AtEveryTurnDoseID, PayMoney,OfficeID,InhospitalNo)
values (@MedicineID, @Number, @PrescriptionBillsID, @SendOutMedicineNo, @SkinTestID,
@UsageID, @UseMedicineFrequencyID, @AtEveryTurnNumber, @AtEveryTurnDoseID,
@PayMoney,@OfficeID,@InhospitalNo)
end --处方的新增
第二步:逻辑层(BLL)代码
[OperationContract]
public int Frm_MenZhenYiShengGongZuoZhan_UpdateKuCunShu(decimal decStockNumber, int intMedicineID,
int intStoreroomID)
{
SqlParameter[] mySqlParameters = {
new SqlParameter ("@Type",SqlDbType .Char),
new SqlParameter ("@StockNumber",SqlDbType.Decimal),
new SqlParameter ("@MedicineID",SqlDbType.Int),
new SqlParameter ("@StoreroomID",SqlDbType.Int),
};
mySqlParameters[0].Value = "Frm_MenZhenYiShengGongZuoZhan_UpdateKuCunShu";
mySqlParameters[1].Value = decStockNumber;
mySqlParameters[2].Value = intMedicineID;
mySqlParameters[3].Value = intStoreroomID;
return myDALMethod.UpdateData("门诊登记_Frm_MenZhenYiShengGongZuoZhan", mySqlParameters);
}
[OperationContract]
public int Frm_MenZhenYiShengGongZuoZhan_InsertChuFangDanMingXi(int intMedicineID,
decimal strNumber, int intPrescriptionBillsID, bool bitSendOutMedicineNo,
int intSkinTestID, int intUsageID, int intUseMedicineFrequencyID,
decimal decAtEveryTurnNumber,int intAtEveryTurnDoseID, decimal decPayMoney,
int intOfficeID,bool InhospitalNo)
{
SqlParameter[] mySqlParameters = {
new SqlParameter ("@Type",SqlDbType .Char),
new SqlParameter ("@MedicineID",SqlDbType.Int),
new SqlParameter ("@Number",SqlDbType.Decimal),
new SqlParameter ("@PrescriptionBillsID",SqlDbType .Int),
new SqlParameter ("@SendOutMedicineNo",SqlDbType.Bit),
new SqlParameter ("@SkinTestID",SqlDbType.Int),
new SqlParameter ("@UsageID",SqlDbType.Int),
new SqlParameter ("@UseMedicineFrequencyID",SqlDbType.Int),
new SqlParameter ("@AtEveryTurnNumber",SqlDbType.Decimal),
new SqlParameter ("@AtEveryTurnDoseID",SqlDbType.Int),
new SqlParameter ("@PayMoney",SqlDbType.Decimal),
new SqlParameter ("@OfficeID",SqlDbType.Int),
new SqlParameter ("@InhospitalNo",SqlDbType.Bit),
};
mySqlParameters[0].Value = "Frm_MenZhenYiShengGongZuoZhan_InsertChuFangDanMingXi";
mySqlParameters[1].Value = intMedicineID;
mySqlParameters[2].Value = strNumber;
mySqlParameters[3].Value = intPrescriptionBillsID;
mySqlParameters[4].Value = bitSendOutMedicineNo;
mySqlParameters[5].Value = intSkinTestID;
mySqlParameters[6].Value = intUsageID;
mySqlParameters[7].Value = intUseMedicineFrequencyID;
mySqlParameters[8].Value = decAtEveryTurnNumber;
mySqlParameters[9].Value = intAtEveryTurnDoseID;
mySqlParameters[10].Value = decPayMoney;
mySqlParameters[11].Value = intOfficeID;
mySqlParameters[12].Value = InhospitalNo;
int i = myDALMethod.UpdateData("门诊登记_Frm_MenZhenYiShengGongZuoZhan", mySqlParameters);
return i;
}
第三步:界面层(UIL)代码
int intMedicineID;
private void btSave_Click(object sender, EventArgs e)
{ //判断是否添加行
if (dgvMedicineInformation.Rows.Count == 0)
{
MessageBox.Show("还没添加药品");
return;
}
//for循环获取每一行的值检查必填的是否为空
for (int K = 0; K < dgvMedicineInformation.Rows.Count; K++)
{
intMedicineID = Convert.ToInt32(dgvMedicineInformation.Rows[K].Cells["MedicineID"].Value);
if (intMedicineID > 0)
{
int intSkinTestID = Convert.ToInt32(dgvMedicineInformation.Rows[K].Cells["SkinTestNo"].Value);
int intUsageID = Convert.ToInt32(dgvMedicineInformation.Rows[K].Cells["Usage"].Value);
int intUseMedicineFrequencyID = Convert.ToInt32(dgvMedicineInformation.Rows[K].Cells["UseMedicineFrequency"].Value);
int intAtEveryTurnDoseID = Convert.ToInt32(dgvMedicineInformation.Rows[K].Cells["AtEveryTurnDose"].Value);
int intOfficeID = Convert.ToInt32(dgvMedicineInformation.Rows[K].Cells["OfficeName"].Value);
if (intSkinTestID == 0 || intUsageID == 0 || intUseMedicineFrequencyID == 0 || intAtEveryTurnDoseID == 0 || intOfficeID == 0) //判断dgvYaoPinXinXi里面的cbo值是否为空
{
MessageBox.Show("请填写完整!");
return;
}
}
}
int J = 0;
decimal decSumNumber = 0;
foreach (DataGridViewRow dgvr in dgvMedicineInformation.Rows)
{
intMedicineID = Convert.ToInt32(dgvr.Cells["MedicineID"].Value);
//区别变量,开始给区别变量赋值为1,目的为了区分那是新增的药品
int TianJiaID = Convert.ToInt32(dgvr.Cells["TianJiaID"].Value);
if ( TianJiaID==1)
{
decimal decNumber = Convert.ToDecimal(dgvr.Cells["SumNumber"].Value);
bool bitSendOutMedicineNo = false;
int SkinTestID = Convert.ToInt32(dgvr.Cells["SkinTestNo"].Value);
int UsageID = Convert.ToInt32(dgvr.Cells["Usage"].Value);
int UseMedicineFrequencyID = Convert.ToInt32(dgvr.Cells["UseMedicineFrequency"].Value);
decimal decAtEveryTurnNumber = Convert.ToDecimal(dgvr.Cells["AtEveryTurnNumber"].Value);
int AtEveryTurnDoseID = Convert.ToInt32(dgvr.Cells["AtEveryTurnDose"].Value);
int OfficeID = Convert.ToInt32(dgvr.Cells["OfficeName"].Value);
decimal decPayMoney = Convert.ToDecimal(dgvr.Cells["SumMoney"].Value);
decSumNumber = Convert.ToDecimal(dgvr.Cells["SumNumber"].Value);
int intStoreroomID = Convert.ToInt32(dgvr.Cells["StoreroomID"].Value);
//修改药品库房数量
myFrm_MenZhenYiShengGongZuoZhanClient.Frm_MenZhenYiShengGongZuoZhan_UpdateKuCunShu
(decSumNumber, intMedicineID, intStoreroomID);
// 新增药品处方
J = myFrm_MenZhenYiShengGongZuoZhanClient.
Frm_MenZhenYiShengGongZuoZhan_InsertChuFangDanMingXi
(intMedicineID, decNumber, PulicStatic.ZhuYuanDengjiID, bitSendOutMedicineNo,
SkinTestID, UsageID, UseMedicineFrequencyID, decAtEveryTurnNumber,
AtEveryTurnDoseID, decPayMoney, OfficeID, true);
}
}
if (J > 0)
{
MessageBox.Show("保存成功!");
}
}
医生对病人录入处方以后进行医嘱的录入,对应的医嘱录入也只是新增的过程,由于前面描述太多的新增,所以不进一步的详细描述了。除此外,还有些简单的操作,如体温单的录入,病人信息的修改,和病人的消费情况的查询,都是简单的新增。
还有,医生可以对病人检查拍的影像进行查阅和管理。
如下图1为影像的新增,图2 为影像的查看
图1
图2
实现代码如下:
1.影像的新增:
第一步:数据库存储过程
if @Type='Frm_YingXiangGuanLi_InsertImg'
begin
Insert ZY_ImageList(Date, FileName, Describe,RegisterInhospitalID)
values (@Date, @FileName, @Describe,@RegisterInhospitalID)
end
第二步:逻辑层(BLL)代码
#region 新增影像
[OperationContract]
public int Frm_YingXiangGuanLi_InsertImg(string Date, byte[][] FileName,
string Describe, int RegisterInhospitalID)
{
string strFileName= FileNameLiu(FileName);
SqlParameter[] mySqlParameters = {
new SqlParameter ("@Type",SqlDbType .Char),
new SqlParameter ("@Date",SqlDbType.Char),
new SqlParameter ("@FileName",SqlDbType .Char),
new SqlParameter ("@Describe",SqlDbType .Char),
new SqlParameter ("@RegisterInhospitalID",SqlDbType .Int),
};
mySqlParameters[0].Value = "Frm_YingXiangGuanLi_InsertImg";
mySqlParameters[1].Value = Date;
mySqlParameters[2].Value = strFileName;
mySqlParameters[3].Value = Describe;
mySqlParameters[4].Value = RegisterInhospitalID;
return myDALMethod.UpdateData("住院登记_Frm_YingXiangGuanLi", mySqlParameters);
}
#endregion
#region 新增时文件流转换
public string FileNameLiu(byte[][] FileLiu)
{
string strWenJanQianZui = 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 FileName = "";
for (int i = 0; i < FileLiu.Length; i++)
{
//生成文件名
string WenJianMing = strWenJanQianZui + ".png";
//获取路径
string WenjianLuJing = System.AppDomain.CurrentDomain.BaseDirectory;
WenjianLuJing = WenjianLuJing + "image\\" + WenJianMing;
FileInfo fi = new System.IO.FileInfo(WenjianLuJing);//创建地址
FileStream fs;//文件流对象
fs = fi.OpenWrite();//文件流写入
fs.Write(FileLiu[i], 0, FileLiu[i].Length);//文件流插入数据
fs.Close();//关闭文件流
FileName = WenJianMing;
}
return FileName;
}
#endregion
第三步:界面层(UIL)代码
添加影像代码:
private void btnInsertImage_Click(object sender, EventArgs e)
{
//lisBytes.Clear();//清空List数组
OpenFileDialog myOpenFileDialog = new OpenFileDialog();//打开文件
myOpenFileDialog.Filter = "*.jpg|*.jpg|*.mp4|*.mp4";//文件格式
myOpenFileDialog.Multiselect = false;//设置是否多选
if (myOpenFileDialog.ShowDialog() == DialogResult.OK)
{
dgImageInformation.Rows.Add(1);
string WenJianMing = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() +
DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() +
DateTime.Now.Minute.ToString()+".png";
//把当前日期转化为0000-00--00的格式
string wenJianRiQi = DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Day.ToString();
dgImageInformation.Rows[dgImageInformation.Rows.Count - 1].Cells["FileName"].Value = WenJianMing;
dgImageInformation.Rows[dgImageInformation.Rows.Count - 1].Cells["Date"].Value = wenJianRiQi;
using (Stream sm = new FileStream(myOpenFileDialog.FileName, FileMode.Open, FileAccess.ReadWrite, FileShare.None))
{ //二进制文件长度
int length = (int)sm.Length;
//二进制文件存放的二进制数组
byte[] bytes = new byte[length];
//内存流读取
sm.Read(bytes, 0, length);
//关闭内存流
sm.Close();
lisBytes.Add(bytes);
MemoryStream stmBLOBData = new MemoryStream(bytes);
}
}
}
保存影像代码:
int j;
private void btnSaveImage_Click(object sender, EventArgs e)
{
//定义二进制数组,长度为1
byte[][] byWenJian = new byte[1][];
//循环新增
for (int i = 0; i < lisBytes.Count; i++)
{
try
{
//对应赋值二进制数组
byWenJian[0] = lisBytes[i];
string WenJianDate = Convert.ToString(dgImageInformation.Rows[i].Cells["Date"].Value);
string MiaoShu = Convert.ToString(dgImageInformation.Rows[i].Cells["Describe"].Value);
j = myFrm_YingXiangGuanLiClient.
Frm_YingXiangGuanLi_InsertImg(WenJianDate, byWenJian, MiaoShu, PulicStatic.ZhuYuanDengjiID);
}
catch { }
}
if (j > 0)
{
MessageBox.Show("新增成功");
Frm_YingXiangGuanLi_Load(null,null);
}
}
2.影像的查看
第一步:数据库存储过程
if @Type='Frm_YingXiangGuanLi_SelectImg'
begin
SELECT ZY_ImageList.*
FROM ZY_ImageList
where RegisterInhospitalID=@RegisterInhospitalID
end--获取影像
if @Type='Frm_YingXiangGuanLi_SelectFileName'
begin
SELECT FileName
FROM ZY_ImageList
where ZY_ImageList.ImageID=@ImageID
end--获取文件名
第二步:逻辑层(BLL)代码
[OperationContract]
public DataSet Frm_YingXiangGuanLi_SelectImg(int RegisterInhospitalID)
{
SqlParameter[] mySqlParameters = {
new SqlParameter ("@Type",SqlDbType .Char),
new SqlParameter ("@RegisterInhospitalID",SqlDbType .Int),
};
mySqlParameters[0].Value = "Frm_YingXiangGuanLi_SelectImg";
mySqlParameters[1].Value = RegisterInhospitalID;
DataTable dt = myDALMethod.QueryDataTable("住院登记_Frm_YingXiangGuanLi", mySqlParameters);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
[OperationContract]
public DataSet Frm_YingXiangGuanLi_SelectFileName(int ImageID)
{
SqlParameter[] mySqlParameters = {
new SqlParameter ("@Type",SqlDbType .Char),
new SqlParameter ("@ImageID",SqlDbType .Int),
};
mySqlParameters[0].Value = "Frm_YingXiangGuanLi_SelectFileName";
mySqlParameters[1].Value = ImageID;
DataTable dt = myDALMethod.QueryDataTable("住院登记_Frm_YingXiangGuanLi", mySqlParameters);
DataSet ds = new DataSet();
ds.Tables.Add(dt);
return ds;
}
#region 查看影像路径转换文件流
private byte[][] WenJianLiuZhuanHuanLuJing(string strLuJing)
{
byte[][] lstbytes = new byte[1][];
if (strLuJing != "")
{
string strBaoCunLuJIng = System.AppDomain.CurrentDomain.BaseDirectory;
strLuJing = strBaoCunLuJIng + "image\\" + strLuJing;
using (Stream sm = new FileStream(strLuJing, FileMode.Open, FileAccess.ReadWrite, FileShare.None))
{
//二进制文件长度
int length = (int)sm.Length;
//二进制文件存放的二进制数组
byte[] bytes = new byte[length];
//内存流读取
sm.Read(bytes, 0, length);
//关闭内存流
sm.Close();
将数据保存到数据库中
lstbytes[0] = bytes;
}
}
return lstbytes;
}
#endregion
第三步:界面层(UIL)代码
byte[][] TuPian;//定义二进制数组
private void Frm_ChaKanYingXiang_Load(object sender, EventArgs e)
{ //查询文件名你
DataTable dt = myFrm_YingXiangGuanLiClient.
Frm_YingXiangGuanLi_SelectFileName(Frm_YingXiangGuanLi.ImageID).Tables[0];
if (dt.Rows.Count > 0)
{
TuPian = myFrm_YingXiangGuanLiClient.Frm_YingXiangGuanLi_UpdateFileName
(dt.Rows[0]["FileName"].ToString().Trim());
MemoryStream stmBLOBData = new MemoryStream(TuPian[0]);
XianShiTuPian(stmBLOBData);
}
else
{
MessageBox.Show("请选择影像");
}
}
void XianShiTuPian(Stream st)
{
//实例化PictureBox
PictureBox myPictureBox = new PictureBox();
//从指定的数据流创建
Image myImage = Image.FromStream(st);
//影像大小
myPictureBox.Size = myImage.Size;
myPictureBox.BackgroundImage = myImage;
//获取或设置在 System.Windows.Forms.ImageLayout 枚举中定义的背景图像布局。
myPictureBox.BackgroundImageLayout = ImageLayout.Zoom;
plImage.Controls.Add(myPictureBox);
}
仅供学习,禁止用于商业用途!