Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs427fa20team22
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
htmoss2
cs427fa20team22
Commits
39a5b82d
Commit
39a5b82d
authored
4 years ago
by
xuechen5
Browse files
Options
Downloads
Patches
Plain Diff
SQL: Added Function for Convert Pre-Registered Patient to Patient
parent
038e14cc
No related branches found
No related tags found
2 merge requests
!22
Merge UC92 into Master
,
!15
Merge 5-uc-92-activate-pre-registered-patient-2 into UC92v2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
iTrust/src/edu/ncsu/csc/itrust/dao/mysql/PatientDAO.java
+31
-19
31 additions, 19 deletions
iTrust/src/edu/ncsu/csc/itrust/dao/mysql/PatientDAO.java
with
31 additions
and
19 deletions
iTrust/src/edu/ncsu/csc/itrust/dao/mysql/PatientDAO.java
+
31
−
19
View file @
39a5b82d
...
...
@@ -99,17 +99,19 @@ public class PatientDAO {
* Returns the role of a particular patient - why is this in PatientDAO? It should be in AuthDAO
*
* @param mid The MID of the patient in question.
* @param role A String representing the role of the patient.
* @return A String representing the patient's role.
* @throws ITrustException
* @throws DBException
*/
public
String
getRole
(
long
mid
)
throws
ITrustException
,
DBException
{
public
String
getRole
(
long
mid
,
String
role
)
throws
ITrustException
,
DBException
{
Connection
conn
=
null
;
PreparedStatement
ps
=
null
;
try
{
conn
=
factory
.
getConnection
();
ps
=
conn
.
prepareStatement
(
"SELECT role FROM users WHERE MID=?"
);
ps
=
conn
.
prepareStatement
(
"SELECT role FROM users WHERE MID=?
AND Role=?
"
);
ps
.
setLong
(
1
,
mid
);
ps
.
setString
(
2
,
role
);
ResultSet
rs
;
rs
=
ps
.
executeQuery
();
if
(
rs
.
next
())
{
...
...
@@ -190,22 +192,6 @@ public class PatientDAO {
}
}
public
void
activatePatient
(
long
mid
)
throws
DBException
{
Connection
conn
=
null
;
PreparedStatement
ps
=
null
;
try
{
conn
=
factory
.
getConnection
();
ps
=
conn
.
prepareStatement
(
"UPDATE users SET role=? WHERE MID=?"
);
ps
.
setString
(
1
,
"patient"
);
ps
.
setLong
(
2
,
mid
);
}
catch
(
SQLException
e
)
{
throw
new
DBException
(
e
);
}
finally
{
DBUtil
.
closeConnection
(
conn
,
ps
);
}
}
/**
* Updates a patient's information for the given MID
*
...
...
@@ -241,6 +227,7 @@ public class PatientDAO {
}
}
/*added for UC91 */
public
boolean
isEmailInUse
(
String
email
)
throws
DBException
{
Connection
conn
=
null
;
PreparedStatement
ps
=
null
;
...
...
@@ -938,7 +925,7 @@ public class PatientDAO {
}
/**
* Lists every patient in the database.
* Lists every
Approved
patient in the database.
*
* @return A java.util.List of PatientBeans representing the patients.
* @throws DBException
...
...
@@ -988,6 +975,31 @@ public class PatientDAO {
}
}
/**
* Convert a Pre-Registered patient to a regular patient upon HCP approval.
* by change "role" column in "users" table.
*
* @return void
* @throws DBException
*/
public
void
ConvertPreRegisteredPatientsToPatient
(
long
mid
)
throws
DBException
{
Connection
conn
=
null
;
PreparedStatement
ps
=
null
;
try
{
conn
=
factory
.
getConnection
();
ps
=
conn
.
prepareStatement
(
"UPDATE users SET role=? WHERE MID=?"
);
ps
.
setString
(
1
,
"patient"
);
ps
.
setLong
(
2
,
mid
);
ps
.
executeUpdate
();
ps
.
close
();
}
catch
(
SQLException
e
)
{
throw
new
DBException
(
e
);
}
finally
{
DBUtil
.
closeConnection
(
conn
,
ps
);
}
}
/**
* Return a list of patients with a special-diagnosis-history who
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment