0% found this document useful (0 votes)
29 views6 pages

Patient Management VB Code Example

The document contains code for a Patient class in VB.NET, which includes properties for patient details and methods for admitting and discharging patients. It also includes webform code for adding a new patient and discharging an existing patient, handling user input and displaying relevant messages. The code ensures that the date of birth is valid and that patients can be admitted with a generated bed ID and discharge date upon discharge.

Uploaded by

Bilal Coupole
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views6 pages

Patient Management VB Code Example

The document contains code for a Patient class in VB.NET, which includes properties for patient details and methods for admitting and discharging patients. It also includes webform code for adding a new patient and discharging an existing patient, handling user input and displaying relevant messages. The code ensures that the date of birth is valid and that patients can be admitted with a generated bed ID and discharge date upon discharge.

Uploaded by

Bilal Coupole
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

code.

txt
' Here is the code from the [Link] class
module:

Imports [Link]

Public Class Patient


Private account_no_val As String
Private lastname_val As String
Private firstname_val As String
Private middlename_val As String
Private dob_val As Date
Private bedid_val As Integer
Private admitdate_val As Date
Private dischargedate_val As Date

Public Property AcctNo() As String


Get
Return account_no_val
End Get
Set(ByVal value As String)
account_no_val = value
End Set
End Property
Public Property LastName() As String
Get
Return lastname_val
End Get
Set(ByVal value As String)
lastname_val = value
End Set
End Property
Public Property FirstName() As String
Get
Page 1
[Link]
Return firstname_val
End Get
Set(ByVal value As String)
firstname_val = value
End Set
End Property
Public Property MiddleName() As String
Get
Return Middlename_val
End Get
Set(ByVal value As String)
Middlename_val = value
End Set
End Property
Public Property DOB() As Date
Get
Return dob_val
End Get
Set(ByVal value As Date)
If value < [Link] Then
dob_val = value
End If
End Set
End Property
Public ReadOnly Property BedID() As
Integer
Get
Return bedid_val
End Get
End Property
Public ReadOnly Property AdmitDate() As
Date
Get
Return admitdate_val
Page 2
[Link]
End Get
End Property
Public Property DischargeDate() As Date
Get
Return dischargedate_val
End Get
Set(ByVal value As Date)
dischargedate_val = value
End Set
End Property
Public Sub Admit()
Dim random_instance = New Random
bedid_val = Int(random_instance.next)
admitdate_val = Today
End Sub
Public Sub Discharge()
If [Link]() <= Today Then
[Link] = Today
End If
End Sub
End Class

' Here is the code from the [Link]


webform code file:

Protected Sub btnAdd_Click(ByVal sender As


Object, ByVal e As [Link]) Handles
[Link]
Dim is_it_a_date As DateTime
Dim aPatient As New Patient

[Link] = [Link]
[Link] = [Link]
[Link] = [Link]
Page 3
[Link]
[Link] = [Link]
Try
is_it_a_date =
[Link]([Link])
Catch ex As Exception
[Link] = "Your entry
does not appear to be a valid date."
[Link] = True
[Link] = [Link]
End Try
If is_it_a_date > Today Then
[Link] = " A date of
birth should be before today."
[Link] = True
[Link] = [Link]
End If
[Link] =
[Link]([Link])
[Link]()
[Link] = "A new patient is
being created with an account number of " &
[Link] _
& ", whose name is " &
[Link] & " " & [Link]
& " " & [Link] _
& ", and who was born " & [Link]
& ". The patient is being admitted today, " &
[Link] _
& " into bed #" & [Link] & "."
Session("Patient") = aPatient
End Sub

Protected Sub Page_Load(ByVal sender As


Object, ByVal e As [Link]) Handles
Page 4
[Link]
[Link]
If Not IsPostBack Then
[Link] = "3489052332"
[Link] = "Porky"
[Link] = "Pernicious"
[Link] = "Pigg"
[Link] = "11/08/1925"
End If
End Sub

' Here is the code from the


[Link] webform code file:

Protected Sub btnDischarge_Click(ByVal


sender As Object, ByVal e As [Link])
Handles [Link]
Dim aPatient As New Patient
aPatient = Session("Patient")
[Link]()
[Link] = "The current patient "
& [Link] & " " &
[Link] & " " & [Link]
_
& " was born " & [Link] & ".
This patient, with an account number of " &
[Link] _
& "was admitted on " &
[Link] & " into bed #" &
[Link] & ". The patient record will
now show a " _
& "discharge date of " &
[Link] & "."
Page 5
[Link]
End Sub

Page 6

You might also like