Sau khi gộp các lược đồ quan hệ có cùng khoá ta đựơc các quan hệ:
1. NHÂN VIÊN (Mã NV, Họ tên NV, Chuyên môn)
2. BỆNH NHÂN (Mã BN, Họ tên BN, NS, DC, GT, Số thẻ BHYT)
3. KHOA (Mã khoa, Tên khoa)
4. THUỐC ( Mã thuốc, Tên thuốc, Đơn vị tính, Đơn giá)
5. BỆNH (Mã bệnh, Tên bệnh)
6. ĐỐI TƯỢNG XN/CC (Mã ĐT, Tên ĐT)
7. DỊCH VỤ (Mã DV, Tên DV, Đơn giá)
8. CSYT (Mã CSYT, Tên CSYT)
9. P-G (Số giường, số phòng)
10. P-K (Số phòng, mã khoa)
11. DÒNG KB (Mã NV, Mã BN, Số phòng, NGÀY KHÁM, YC KHÁM, KQ KHÁM)
12. BN-G (Mã BN, Số giường, NGÀY NHẬN, NGÀY TRẢ)
13. XN/CC (Mã NV, Mã BN, Mã ĐT, NGÀY XN/CC, KQ XN/CC)
14. SDDV (Mã BN, Mã DV, NGÀY SDDV, LƯỢNG SDDV)
15. ĐƠN THUỐC (Mã NV, Mã BN, Mã thuốc, NGÀY KÊ ĐƠN, SỐ LƯỢNG, CÁCH DÙNG)
16. BỆNH ÁN ( Mã NV, Mã BN, Mã bệnh, Số phòng, NGÀY VÀO, NGÀY RA, TT BỆNH)
17. CHUYỂN VIỆN (Mã BN, Mã CSYT, NGÀY CHUYỂN)
125 trang |
Chia sẻ: netpro | Lượt xem: 1710 | Lượt tải: 4
Bạn đang xem trước 20 trang tài liệu Đề tài Quản lý bệnh nhân tại bệnh viện mắt Nam Định, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
ordset.Fields("mabenh").Value
Text2.Text = AdodcBenh.Recordset.Fields("tenbenh").Value
End If
End Sub
Private Sub cmdluu_Click()
Connection.OpenData ("benh")
sql = "INSERT INTO benh (mabenh,tenbenh) VALUES ('" & Text1.Text & "','" & Text2.Text & "')"
cn.Execute (sql)
grdbenh.Refresh
Connection.Closedata
AdodcBenh.Refresh
Call sinhma(AdodcBenh, "B", Text1)
Text2.Text = ""
End Sub
Private Sub cmdmoi_Click()
AdodcBenh.Recordset.MoveLast
Call sinhma(AdodcBenh, "B", Text1)
Text2.Locked = False
Text2.Text = ""
cmdluu.Enabled = True
End Sub
Private Sub cmdxoa_Click()
cmdluu.Enabled = True
Dim response As VbMsgBoxResult
response = MsgBox(("B¹n cã muèn xoa b¶n ghi nµy kh«ng?"), vbYesNo + vbCritical, ("Th«ng b¸o"))
If response = vbNo Then
Exit Sub
Else
Connection.OpenData ("benh")
Dim sql As String
sql = "delete * from benh where mabenh= '" & Text1.Text & "'"
cn.Execute (sql)
AdodcBenh.Recordset.MoveNext
HTBenh
grdbenh.Refresh
Connection.Closedata
AdodcBenh.Refresh
End If
Command1(2).Enabled = True
Command1(3).Enabled = True
End Sub
Private Sub Command1_Click(Index As Integer)
Select Case Index
Case 0
cmdluu.Enabled = False
AdodcBenh.Recordset.MoveFirst
Command1(0).Enabled = False
Command1(1).Enabled = False
Command1(2).Enabled = True
Command1(3).Enabled = True
HTBenh
Case 1
cmdluu.Enabled = False
AdodcBenh.RecordSource = ("benh")
AdodcBenh.Recordset.MovePrevious
If AdodcBenh.Recordset.BOF = True Then
Command1(0).Enabled = False
Command1(1).Enabled = False
Command1(2).Enabled = True
Command1(3).Enabled = True
Else
Command1(0).Enabled = True
Command1(1).Enabled = True
Command1(3).Enabled = True
Command1(2).Enabled = True
End If
HTBenh
Case 2
cmdluu.Enabled = fale
AdodcBenh.RecordSource = ("benh")
AdodcBenh.Recordset.MoveNext
If AdodcBenh.Recordset.EOF = True Then
Command1(0).Enabled = True
Command1(1).Enabled = True
Command1(2).Enabled = False
Command1(3).Enabled = False
Else
Command1(0).Enabled = True
Command1(1).Enabled = True
Command1(3).Enabled = True
Command1(2).Enabled = True
End If
HTBenh
Case 3
cmdluu.Enabled = False
AdodcBenh.Recordset.MoveLast
Command1(2).Enabled = False
Command1(3).Enabled = False
Command1(0).Enabled = True
Command1(1).Enabled = True
HTBenh
End Select
End Sub
- Cập nhật thông tin về bệnh án
Cho phép cập nhật các thông tin về bệnh án của bệnh nhân.
Hình 4.5: Giao diện cập nhật bệnh án
Code
Dim kt As Boolean
Private Sub Adodcthuoc_WillMove(ByVal adReason As ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
End Sub
Private Sub cmdtra_Click()
Dim str As String
Connection.OpenData ("benhan1")
nv = cbngayvao.Text & "/" & cbthangvao.Text & "/" & cbnamvao.Text
nr = cbngayra.Text & "/" & cbthangra.Text & "/" & cbnamra.Text
str = "update benhan1 set ngayra = '" & nr & "'where (mabn = '" & cbmabn.Text & "' and manv = '" & cbmanv.Text & "' and sophong = '" & cbmap.Text & "'and mabenh = '" & cbmab.Text & "' and ttbenh = '" & txttt.Text & "')"
cn.Execute (str)
grdbenhan.Refresh
Adodcba.Refresh
Connection.Closedata
Lammoi
End Sub
Private Sub Form_Load()
Call add_ngay(cbngayvao, cbthangvao, cbnamvao)
Call add_ngay(cbngayra, cbthangra, cbnamra)
cmdtra.Visible = False
optcn.Visible = False
anngay
lbn.Visible = False
kt = False
Adodcba.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = E:\nhom3\quanlybenhnhan.mdb;Persist Security Info=False"
Adodcba.RecordSource = "benhan1"
Connection.OpenData ("benhan1")
Adodcba.Refresh
grdbenhan.Refresh
Mo_khoa
End Sub
Private Sub cmdluu_Click(Index As Integer)
Dim str As String
nv = cbngayvao.Text & "/" & cbthangvao.Text & "/" & cbnamvao.Text
nr = cbngayra.Text & "/" & cbthangra.Text & "/" & cbnamra.Text
Connection.OpenData ("benhan1")
If (kt = True) Then
str = "update benhan1 set manv = '" & (cbmanv.Text) & "', mabenh = '" & (cbmab.Text) & "', sophong = '" & (cbmap.Text) & "',ngayvao= '" & nv & "', ngayra = '" & nr & "',ttbenh = '" & (txttt.Text) & "'where (mabn = '" & (cbmabn.Text) & "' and manv = '" & Adodcba.Recordset.Fields("manv") & "' and sophong = '" & Adodcba.Recordset.Fields("sophong") & "'and mabenh = '" & Adodcba.Recordset.Fields("mabenh") & "')"
cn.Execute (str)
cbngayra.Text = ""
cbthangra.Text = ""
cbnamra.Text = ""
setnull
Else
End If
If kt = False Then
If (cbmabn.Text = "") Or (cbmanv.Text = "") Or (cbmab.Text = "") Or (cbmap.Text = "") Or (txttt.Text = "") Then
MsgBox ("NhËp thiÕu th«ng tin. NhËp l¹i.")
Else
sql = "INSERT INTO benhan1 (mabn,manv,mabenh,sophong,ngayvao,ttbenh) VALUES ('" _
& (cbmabn.Text) & "','" & (cbmanv.Text) & "','" & (cbmab.Text) & "','" & (cbmap.Text) & "','" & nv & "', '" & (txttt.Text) & "')"
cn.Execute (sql)
cbngayra.Text = ""
cbthangra.Text = ""
cbnamra.Text = ""
setnull
End If
End If
grdbenhan.Refresh
Adodcba.Refresh
Connection.Closedata
Lammoi
Mo_khoa
cmdluu(1).Enabled = True
cbmabn.Enabled = True
cbngayra.Enabled = False
cbthangra.Enabled = False
cbnamra.Enabled = False
kt = False
cmdvesau(2).Enabled = True
cmdvecuoi(3).Enabled = True
End Sub
Private Sub cmdmoi_Click(Index As Integer)
setnull
Mo_khoa
cmdluu(1).Enabled = True
cbmabn.Enabled = True
cbngayra.Enabled = False
cbthangra.Enabled = False
cbnamra.Enabled = False
cbngayra.Text = "1"
cbthangra.Text = "2"
cbnamra.Text = "1900"
End Sub
Private Sub cmdsua_Click(Index As Integer)
kt = True
Mo_khoa
cmdluu(1).Enabled = True
cbmabn.Enabled = False
cbngayra.Enabled = True
cbthangra.Enabled = True
cbnamra.Enabled = True
End Sub
Private Sub cmdvecuoi_Click(Index As Integer)
cmdluu(1).Enabled = False
Adodcba.Recordset.MoveLast
cmdvecuoi(3).Enabled = False
cmdvesau(2).Enabled = False
cmdvedau(0).Enabled = True
cmdvetruoc(1).Enabled = True
Hienthi
End Sub
Private Sub cmdvedau_Click(Index As Integer)
cmdluu(1).Enabled = False
Adodcba.Recordset.MoveFirst
cmdvedau(0).Enabled = False
cmdvetruoc(1).Enabled = False
cmdvecuoi(3).Enabled = True
cmdvesau(2).Enabled = True
Hienthi
End Sub
Private Sub cmdvesau_Click(Index As Integer)
cmdluu(1).Enabled = False
Adodcba.Recordset.MoveNext
grdbenhan.Refresh
If Adodcba.Recordset.EOF = True Then
cmdvesau(2).Enabled = False
cmdvecuoi(3).Enabled = False
cmdvetruoc(1).Enabled = True
cmdvedau(0).Enabled = True
Else
cmdvesau(2).Enabled = True
cmdvecuoi(3).Enabled = True
cmdvetruoc(1).Enabled = True
cmdvedau(0).Enabled = True
End If
Hienthi
End Sub
Private Sub cmdvetruoc_Click(Index As Integer)
cmdluu(1).Enabled = False
Adodcba.Recordset.MovePrevious
grdbenhan.Refresh
If Adodcba.Recordset.BOF = True Then
cmdvedau(0).Enabled = False
cmdvetruoc(1).Enabled = False
cmdvecuoi(3).Enabled = True
cmdvesau(2).Enabled = True
Else
cmdvedau(0).Enabled = True
cmdvetruoc(1).Enabled = True
cmdvecuoi(3).Enabled = True
cmdvesau(2).Enabled = True
End If
Hienthi
End Sub
Private Sub cmdxoa_Click(Index As Integer)
cmdluu(1).Enabled = True
Dim str As String
Dim response As VbMsgBoxResult
response = MsgBox(("B¹n cã muèn xoa b¶n ghi nµy kh«ng?"), vbYesNo + vbCritical, ("Thoong baso"))
If response = vbNo Then
Exit Sub
Else
Connection.OpenData ("benhan1")
str = "DELETE * FROM benhan1 where ((mabn = '" & (cbmabn.Text) & "') and (manv = '" & cbmanv.Text & "') and (sophong = '" & cbmap.Text & "')and (mabenh = '" & cbmabText & "'))"
cn.Execute (str)
End If
cbngayra.Enabled = False
cbthangra.Enabled = False
cbnamra.Enabled = False
Lammoi
Mo_khoa
End Sub
Private Sub setnull()
cmdluu(1).Enabled = True
cbmabn.Text = ""
cbmanv.Text = ""
cbmab.Text = ""
cbmap.Text = ""
txttt.Text = ""
cbngayvao.Text = "1"
cbthangvao.Text = "1"
cbnamvao.Text = "2009"
End Sub
Private Sub grdbenhan_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
cmdluu(1).Enabled = False
If (Adodcba.Recordset.BOF = False And Adodcba.Recordset.EOF = False) Then
cbmabn.Text = Adodcba.Recordset.Fields("mabn").Value
cbmanv.Text = Adodcba.Recordset.Fields("manv").Value
cbmab.Text = Adodcba.Recordset.Fields("mabenh").Value
cbmap.Text = Adodcba.Recordset.Fields("sophong").Value
txttt.Text = Adodcba.Recordset.Fields("ttbenh").Value
Call layngay(Adodcba.Recordset.Fields("ngayvao"), cbngayvao, cbthangvao, cbnamvao)
If Adodcba.Recordset.Fields("ngayra").Value "" Then
Call layngay(Adodcba.Recordset.Fields("ngayra"), cbngayra, cbthangra, cbnamra)
optcn.Visible = False
lbn.Visible = True
hienngay
cmdtra.Visible = False
Else
optcn.Visible = True
optcn.Value = False
lbn.Visible = False ' an di
anngay
End If
cmdvesau(2).Enabled = True
cmdvecuoi(3).Enabled = True
cmdvedau(0).Enabled = True
cmdvetruoc(1).Enabled = True
If Adodcba.Recordset.BOF Then
cmdvedau(0).Enabled = False
cmdvetruoc(1).Enabled = False
cmdvesau(2).Enabled = True
cmdvecuoi(3).Enabled = True
End If
If Adodcba.Recordset.EOF Then
cmdvesau(2).Enabled = False
cmdvecuoi(3).Enabled = False
cmdvedau(0).Enabled = True
cmdvetruoc(1).Enabled = True
End If
End If
End Sub
Private Sub Hienthi()
cmdluu(1).Enabled = False
If (Adodcba.Recordset.BOF = False And Adodcba.Recordset.EOF = False) Then
cbmabn.Text = Adodcba.Recordset.Fields("mabn").Value
cbmanv.Text = Adodcba.Recordset.Fields("manv").Value
cbmab.Text = Adodcba.Recordset.Fields("mabenh").Value
cbmap.Text = Adodcba.Recordset.Fields("sophong").Value
txttt.Text = Adodcba.Recordset.Fields("ttbenh").Value
Call layngay(Adodcba.Recordset.Fields("ngayvao"), cbngayvao, cbthangvao, cbnamvao)
If Adodcba.Recordset.Fields("ngayra").Value "" Then
Call layngay(Adodcba.Recordset.Fields("ngayra"), cbngayra, cbthangra, cbnamra)
optcn.Visible = False
lbn.Visible = True
hienngay
cmdtra.Visible = False
Else
optcn.Visible = True
optcn.Value = False
lbn.Visible = False
anngay
End If
cmdvesau(2).Enabled = True
cmdvecuoi(3).Enabled = True
cmdvedau(0).Enabled = True
cmdvetruoc(1).Enabled = True
If Adodcba.Recordset.BOF Then
cmdvedau(0).Enabled = False
cmdvetruoc(1).Enabled = False
cmdvesau(2).Enabled = True
cmdvecuoi(3).Enabled = True
End If
If Adodcba.Recordset.EOF Then
cmdvesau(2).Enabled = False
cmdvecuoi(3).Enabled = False
cmdvedau(0).Enabled = True
cmdvetruoc(1).Enabled = True
End If
End If
End Sub
Private Sub Lammoi()
Adodcba.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = E:\nhom3\quanlybenhnhan.mdb;Persist Security Info=False"
Adodcba.RecordSource = "benhan1"
Connection.OpenData ("benhan1")
Adodcba.Refresh
End Sub
Private Sub khoa()
cbmabn.Locked = True
cbmanv.Locked = True
cbmab.Locked = True
cbmap.Locked = True
cbngayvao.Locked = True
cbthangvao.Locked = True
cbnamvao.Locked = True
cbngayra.Locked = True
cbthangra.Locked = True
cbnamra.Locked = True
txttt.Locked = True
End Sub
Private Sub Mo_khoa()
cbmabn.Locked = False
cbmanv.Locked = False
cbmab.Locked = False
cbmap.Locked = False
cbngayvao.Locked = False
cbthangvao.Locked = False
cbnamvao.Locked = False
cbngayra.Locked = False
cbthangra.Locked = False
cbnamra.Locked = False
txttt.Locked = False
End Sub
Private Sub anngay()
cbngayra.Visible = False
cbnamra.Visible = False
cbthangra.Visible = False
End Sub
Private Sub hienngay()
cbngayra.Visible = True
cbnamra.Visible = True
cbthangra.Visible = True
End Sub
Private Sub optcn_Click()
lbn.Visible = True
hienngay
If optcn.Visible = True Then
cmdtra.Visible = True
cbngayra.Locked = False
cbthangra.Locked = False
cbnamra.Locked = False
cbngayra.Enabled = True
cbthangra.Enabled = True
cbnamra.Enabled = True
End If
End Sub
* Tạo giao diện tìm kiếm, thống kê
- Tìm kiếm thông tin bệnh nhân
Cho phép tìm kiếm bệnh nhân theo các tiêu chí: Họ tên, Địa chỉ… Khi tìm thấy bệnh nhân ta có thể xem các thông tin chi tiết của bệnh nhân đó như: Thông tin khám bệnh, thông tin bệnh án, thông tin đơn thuốc, nằm giường, XN/CC…
Hình 4.6: Giao diện tìm kiếm thông tin bệnh nhân
Hình 4.7: Giao diện thống kê bệnh nhân
* Tạo giao diện lập phiếu xét nghiệm
Hình 4.8: Giao diện tạo phiếu xét nghiệm
Code của Form cập nhật và in phiếu xét nghiệm
Dim kt As Boolean
Dim nkd As Date
Dim ktin As Boolean
Private Sub cmdin_Click()
DREP.rsPhieuXN.Open
nxn = cbngayxn.Text & "/" & cbthangxn.Text & "/" & cbnamxn.Text
DREP.rsPhieuXN.Filter = "mabn = '" & dbmabn.Text & "' and madt='" & dbmaxn.Text & "' and manv ='" & dbmanv & "' and ketquaxn= '" & txtkq.Text & "'"
If DREP.rsPhieuXN.RecordCount = 0 Then
MsgBox (" Kh«ng t×m thÊy d÷ liÖu")
DREP.rsPhieuXN.Close
Else
rpkqxn.Show
End If
setnull
cmdin.Enabled = False
Mo_khoa
End Sub
Private Sub cmdsua_Click()
kt = True
cmdluu.Enabled = True
cmdin.Enabled = False
Mo_khoa
dbmabn.Enabled = False
End Sub
Private Sub Form_Load()
Call add_ngay(cbngayxn, cbthangxn, cbnamxn)
cbngayxn.Text = "1"
cbthangxn.Text = "1"
cbnamxn.Text = "2009"
kt = False
ktin = False
cmdin.Enabled = False
AdodcbaConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = E:\nhom3\quanlybenhnhan.mdb;Persist Security Info=False"
Adodcxn.RecordSource = "xncc"
Connection.OpenData ("xncc")
Adodcxn.Refresh
grdxn.Refresh
setnull
Mo_khoa
cmdluu.Enabled = True
End Sub
Private Sub cmdluu_Click()
Dim str As String
nxn = cbngayxn.Text & "/" & cbthangxn.Text & "/" & cbnamxn.Text
Connection.OpenData ("xncc")
If (kt = True) Then
str = "update xncc set manv = '" & (dbmanv.Text) & "', madt= = '" & (dbmaxn.Text) & "', ngayXN = '" & nxn & "',ketquaXN = '" & (txtkq.Text) & "'where (mabn = '" & dbmabn.Text & "' and manv= '" & Adodcxn.Recordset.Fields("manv") & "' and madt = '" & Adodcxn.Recordset.Fields("madt") & "' and ketquaxn = '" & Adodcxn.Recordset.Fields("ketquaxn") & "')"
cn.Execute (str)
kt = False
cmdin.Enabled = True
Else
If dbmabn.Text = "" Then
MsgBox ("B¹n ph¶i nhËp m· bÖnh nh©n")
cmdin.Enabled = False
Else
str = "INSERT INTO xncc(mabn,manv,madt,ngayXN,ketquaXN) VALUES ('" _
& dbmabn.Text & "','" & dbmanv.Text & "','" & dbmaxn.Text & "','" & nxn & "','" & txtkq.Text & "')"
cn.Execute (str)
cmdin.Enabled = True
End If
End If
Connection.Closedata
grdxn.Refresh
'/////////////////////////////////////////////////
Lammoi
Mo_khoa
cmdvecuoi(3).Enabled = True
cmdvesau(2).Enabled = True
dbmabn.Enabled = True
End Sub
Private Sub cmdmoi_Click()
setnull
Mo_khoa
End Sub
Private Sub cmdvecuoi_Click(Index As Integer)
cmdluu.Enabled = False
Adodcxn.Recordset.MoveLast
cmdvecuoi(3).Enabled = False
cmdvesau(2).Enabled = False
cmdvedau(0).Enabled = True
cmdvetruoc(1).Enabled = True
Hienthi
cmdin.Enabled = True
End Sub
Private Sub cmdvedau_Click(Index As Integer)
cmdluu.Enabled = False
Adodcxn.Recordset.MoveFirst
cmdvedau(0).Enabled = False
cmdvetruoc(1).Enabled = False
cmdvecuoi(3).Enabled = True
cmdvesau(2).Enabled = True
Hienthi
cmdin.Enabled = True
End Sub
Private Sub cmdvesau_Click(Index As Integer)
cmdluu.Enabled = False
Adodcxn.Recordset.MoveNext
grdxn.Refresh
If Adodcxn.Recordset.EOF = True Then
cmdvesau(2).Enabled = False
cmdvecuoi(3).Enabled = False
cmdvetruoc(1).Enabled = True
cmdvedau(0).Enabled = True
Else
cmdvesau(2).Enabled = True
cmdvecuoi(3).Enabled = True
cmdvetruoc(1).Enabled = True
cmdvedau(0).Enabled = True
End If
Hienthi
cmdin.Enabled = True
End Sub
Private Sub cmdvetruoc_Click(Index As Integer)
cmdluu.Enabled = False
Adodcxn.Recordset.MovePrevious
grdxn.Refresh
If Adodcxn.Recordset.BOF = True Then
cmdvedau(0).Enabled = False
cmdvetruoc(1).Enabled = False
cmdvecuoi(3).Enabled = True
cmdvesau(2).Enabled = True
Else
cmdvedau(0).Enabled = True
cmdvetruoc(1).Enabled = True
cmdvecuoi(3).Enabled = True
cmdvesau(2).Enabled = True
End If
Hienthi
cmdin.Enabled = True
End Sub
Private Sub cmdxoa_Click()
Dim str As String
Dim response As VbMsgBoxResult
cmdluu.Enabled = True
nxn = cbngayxn.Text & "/" & cbthangxn.Text & "/" & cbnamxn.Text
response = MsgBox(("B¹n cã muèn xo¸ b¶n ghi nµy kh«ng?"), vbYesNo + vbCritical, ("Thoong baso"))
If response = vbNo Then
Exit Sub
Else
Connection.OpenData ("xncc")
str = "DELETE * FROM xncc WHERE mabn = '" & dbmabn.Text & "' and madt='" & dbmaxn.Text & "' and manv ='" & dbmanv & "' and ketquaxn= '" & txtkq.Text & "'" ' and ngayxn = '" & nxn & "' and day(ngayxn)='" & cbngayxn.Text & " and month(ngayxn)='" & cbthangxn.Text & "' and year(ngayxn)='" & cbnamxn.Text & "')"
cn.Execute (str)
End If
setnull
Lammoi
Mo_khoa
End Sub
Private Sub setnull()
cmdluu.Enabled = True
dbmabn.Text = ""
dbmanv.Text = ""
dbmaxn.Text = ""
txtkq.Text = ""
cbngayxn.Text = "1"
cbthangxn.Text = "1"
cbnamxn.Text = "2009"
End Sub
Private Sub grdxn_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
cmdvesau(2).Enabled = True
cmdvecuoi(3).Enabled = True
cmdluu.Enabled = False
If (Adodcxn.Recordset.BOF = False And Adodcxn.Recordset.EOF = False) Then
dbmabn.Text = Adodcxn.Recordset.Fields("mabn").Value
dbmanv.Text = Adodcxn.Recordset.Fields("manv").Value
dbmaxn.Text = Adodcxn.Recordset.Fields("madt").Value
Call layngay(Adodcxn.Recordset.Fields("ngayXN"), cbngayxn, cbthangxn, cbnamxn)
txtkq.Text = Adodcxn.Recordset.Fields("ketquaXN").Value
khoa
cmdvesau(2).Enabled = True
cmdvecuoi(3).Enabled = True
cmdvedau(0).Enabled = True
cmdvetruoc(1).Enabled = True
If Adodcxn.Recordset.BOF Then
cmdvedau(0).Enabled = False
cmdvetruoc(1).Enabled = False
cmdvesau(2).Enabled = True
cmdvecuoi(3).Enabled = True
End If
If Adodcxn.Recordset.EOF Then
cmdvesau(2).Enabled = False
cmdvecuoi(3).Enabled = False
cmdvedau(0).Enabled = True
cmdvetruoc(1).Enabled = True
End If
cmdin.Enabled = True
End If
End Sub
Private Sub Hienthi()
cogt
cmdluu.Enabled = False
cmdsua.Enabled = True
If (Adodcxn.Recordset.BOF = False And Adodcxn.Recordset.EOF = False) Then
dbmabn.Text = Adodcxn.Recordset.Fields("mabn").Value
dbmanv.Text = Adodcxn.Recordset.Fields("manv").Value
dbmaxn.Text = Adodcxn.Recordset.Fields("madt").Value
Call layngay(Adodcxn.Recordset.Fields("ngayXN"), cbngayxn, cbthangxn, cbnamxn)
txtkq.Text = Adodcxn.Recordset.Fields("ketquaXN").Value
khoa
If Adodcxn.Recordset.BOF Then
cmdvedau(0).Enabled = False
cmdvetruoc(1).Enabled = False
End If
If Adodcxn.Recordset.EOF Then
cmdvesau(2).Enabled = False
cmdvecuoi(3).Enabled = False
End If
cmdin.Enabled = True
End If
End Sub
Private Sub Lammoi()
Adodcxn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = E:\nhom3\quanlybenhnhan.mdb;Persist Security Info=False"
Adodcxn.RecordSource = "xncc"
Connection.OpenData ("xncc")
Adodcxn.Refresh
End Sub
Private Sub khoa()
dbmabn.Locked = True
dbmanv.Locked = True
dbmaxn.Locked = True
cbngayxn.Locked = True
cbthangxn.Locked = True
cbnamxn.Locked = True
txtkq.Locked = True
End Sub
Private Sub Mo_khoa()
dbmabn.Locked = False
dbmanv.Locked = False
dbmaxn.Locked = False
cbngayxn.Locked = False
cbthangxn.Locked = False
cbnamxn.Locked = False
txtkq.Locked = False
End Sub
Private Sub cogt()
dbmabn.Enabled = True
dbmanv.Enabled = True
dbmaxn.Enabled = True
txtkq.Enabled = True
cbngayxn.Enabled = True
cbthangxn.Enabled = True
cbnamxn.Enabled = True
End Sub
Private Sub txtmabn_Change()
Dim st As String
If Trim(txtmabn.Text = "") Then
Adodcxn.Refresh
grdxn.Refresh
Else
If Trim(txtmabn.Text) "" Then
If st "" Then
st = st + " and " + "mabn like '" + Trim(txtmabn.Text) + "*'"
Else
st = "mabn like '" + Trim(txtmabn.Text) + "*'"
End If
End If
Adodcxn.Recordset.Filter = st
grdxn.Refresh
End If
Hienthi
cmdin.Enabled = True
End Sub
Thiết kế giao diện cập nhật bệnh nhân nằm giường và in hóa đơn
Code
Dim kt As Boolean
Dim nn As Date
Dim nt As Date
Private Sub cmdin_Click()
DREP.rshoadongiuong.Open
nn = cbngaynhan.Text & "/" & cbthangnhan.Text & "/" & cbnamnhan.Text
nt = cbngaytra.Text & "/" & cbthangtra.Text & "/" & cbnamtra.Text
DREP.rshoadongiuong.Filter = "mabn = '" & dbmabn.Text & "'and sogiuong = '" & dbg.Text & "' and ngaynhan = '" & nn & "' and ngaytra = '" & nt & "'"
RPhoadongiuong.Show
setnull
cmdin.Enabled = False
Mo_khoa
cogt
anngay
cmdtra.Visible = False
lbtra.Visible = False
cmdin.Visible = False
End Sub
'/////CAP NHAT TRA GIUONG
Private Sub cmdtra_Click()
Dim str As String
Connection.OpenData ("BNG")
nt = cbngaytra.Text & "/" & cbthangtra.Text & "/" & cbnamtra.Text
str = "update BNG set ngaytra = '" & nt & "' where (mabn = '" & dbmabn.Text & "'and sogiuong = '" & dbg.Text & "' and day(ngaynhan)='" & cbngaynhan.Text & "' and month(ngaynhan)='" & cbthangnhan.Text & "' and year(ngaynhan)='" & cbnamnhan.Text & "')"
cn.Execute (str)
MsgBox (" CËp nhËt thµnh c«ng")
grdg.Refresh
Adodcg.Refresh
Connection.Closedata
Lammoi
cmdin.Enabled = True
cmdvecuoi(3).Enabled = True
cmdvesau(2).Enabled = True
Mo_khoa
End Sub
Private Sub optcn_Click()
matgt
cbngaytra.Enabled = True
cbthangtra.Enabled = True
cbnamtra.Enabled = True
cbngaynhan.Enabled = False
cbthangnhan.Enabled = False
cbnamnhan.Enabled = False
cbngaytra.Locked = False
cbthangtra.Locked = False
cbnamtra.Locked = False
If optcn.Value = True Then
lbtra.Visible = True
hienngay
cmdtra.Visible = True
cmdin.Visible = True
cmdin.Enabled = False
End If
cbngaytra.Text = "1"
cbthangtra.Text = "1"
cbnamtra.Text = "2009"
End Sub
'//////// TIM KIEM THEO MA BENH NHAN
Private Sub txtmabn_Change()
Dim st As String
If Trim(txtmabn.Text = "") Then
Adodcg.Refresh
grdpg.Refresh
Else
If Trim(txtmabn.Text) "" Then
If st "" Then
st = st + " and " + "mabn like '" + Trim(txtmabn.Text) + "*'"
Else
st = "mabn like '" + Trim(txtmabn.Text) + "*'"
End If
End If
Adodcpg.Recordset.Filter = st
grdpg.Refresh
End If
Hienthi
cmdin.Enabled = True
End Sub
Private Sub cmdsua_Click()
cmdtra.Visible = False
kt = True
cmdluu.Enabled = True
cmdin.Enabled = False
Mo_khoa
dbmabn.Enabled = False
End Sub
Private Sub Form_Load()
optcn.Visible = False
cmdtra.Visible = False
cmdsua.Enabled = False
cmdxoa.Enabled = False
lbtra.Visible = False
anngay
cmdin.Visible = False
Call add_ngay(cbngaynhan, cbthangnhan, cbnamnhan)
Call add_ngay(cbngaytra, cbthangtra, cbnamtra)
cbngaynhan.Text = "1"
cbthangnhan.Text = "1"
cbnamnhan.Text = "2009"
cbngaytra.Text = "1"
cbthangtra.Text = "1"
cbnamtra.Text = "2009"
'////////////
kt = False
cmdin.Enabled = False
Adodcg.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = E:\nhom3\quanlybenhnhan.mdb;Persist Security Info=False"
Adodcg.RecordSource = "BNG"
Connection.OpenData ("BNG")
Adodcg.Refresh
grdg.Refresh
setnull
Mo_khoa
End Sub
'/////////////////////////
Private Sub cmdluu_Click()
Dim str As String
nn = cbngaynhan.Text & "/" & cbthangnhan.Text & "/" & cbnamnhan.Text
nt = cbngaytra.Text & "/" & cbthangtra.Text & "/" & cbnamtra.Text
Connection.OpenData ("BNG")
If (kt = True) Then
str = "update BNG set sogiuong = '" & (dbg.Text) & "', ngaynhan = '" & nn & "', ngaytra ='" & nt & "' where ( mabn = '" _
& dbmabn.Text & "' and sogiuong = '" & Adodcg.Recordset.Fields("sogiuong") & "')"
cn.Execute (str)
kt = False
Else
If dbmabn.Text = "" Then
MsgBox (" B¹n cha nhËp m· bÖnh nh©n. NhËp m·")
Else
str = "INSERT INTO BNG(mabn,sogiuong,ngaynhan) VALUES ('" _
& dbmabn.Text & "','" & dbg.Text & "','" & nn & "')"
cn.Execute (str)
MsgBox (" CËp nhËt thµnh c«ng")
End If
End If
Connection.Closedata
grdg.Refresh
'/////////////////////////////////////////////////
Lammoi
Mo_khoa
cmdtra.Visible = False
optcn.Visible = False
cmdvecuoi(3).Enabled = True
cmdvesau(2).Enabled = True
cmdin.Enabled = True
dbmabn.Enabled = True
End Sub
Private Sub cmdmoi_Click()
cmdtra.Visible = False
setnull
Mo_khoa
optcn.Value = False
optcn.Visible = False
lbtra.Visible = False
anngay
cmdsua.Enabled = False
cmdxoa.Enabled = False
cmdin.Visible = False
End Sub
Private Sub cmdvecuoi_Click(Index As Integer)
cmdluu.Enabled = False
Adodcg.Recordset.MoveLast
cmdvecuoi(3).Enabled = False
cmdvesau(2).Enabled = False
cmdvedau(0).Enabled = True
cmdvetruoc(1).Enabled = True
Hienthi
cmdin.Enabled = True
End Sub
Private Sub cmdvedau_Click(Index As Integer)
cmdluu.Enabled = False
Adodcg.Recordset.MoveFirst
cmdvedau(0).Enabled = False
cmdvetruoc(1).Enabled = False
cmdvecuoi(3).Enabled = True
cmdvesau(2).Enabled = True
Hienthi
cmdin.Enabled = True
End Sub
Private Sub cmdvesau_Click(Index As Inte
Các file đính kèm theo tài liệu này:
- Bao cao nhom3.doc