public class DBConnect
extends java.lang.Object
Constructor and Description |
---|
DBConnect()
Creates a PatientConnect instance and connect to the database.
|
Modifier and Type | Method and Description |
---|---|
int |
createPatientRecord(Patient p)
Inserts a patient record into Patients table.
|
java.sql.Connection |
getConnection()
Gets a new database connection.
|
Doctor |
getDoctorRecord(java.lang.String username)
Obtains the doctor's record from the database.
|
java.util.ArrayList<Patient> |
getPatient(java.lang.String fname,
java.lang.String lname)
Looks up patients by both first name and last name.
|
int |
sendPrescription(Prescription rx)
Creates a new Prescription record (row) in the database.
|
int |
updatePatientRecord(Patient oldRecord,
Patient newRecord)
Updates a patient record.
|
boolean |
userAuthentication(java.lang.String username,
java.lang.String password)
Checsk whether the credential entered by user is correct or not.
|
public DBConnect()
public java.sql.Connection getConnection() throws java.sql.SQLException
java.sql.SQLException
public java.util.ArrayList<Patient> getPatient(java.lang.String fname, java.lang.String lname)
fname
- First name.lname
- Last name.public int createPatientRecord(Patient p)
p
- Patient to be inserted.public int updatePatientRecord(Patient oldRecord, Patient newRecord)
oldRecord
- Old record of the patient.newRecord
- New record of the patient.public int sendPrescription(Prescription rx)
rx
- Prescription to be added to the database.public boolean userAuthentication(java.lang.String username, java.lang.String password)
username
- password
- public Doctor getDoctorRecord(java.lang.String username)
username
- Username of the doctor.