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
ae0270e2
Commit
ae0270e2
authored
4 years ago
by
mjw11
Browse files
Options
Downloads
Patches
Plain Diff
Add activate and deactivate patient functions
parent
734f5abb
No related branches found
Branches containing commit
No related tags found
1 merge request
!22
Merge UC92 into Master
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
iTrust/src/edu/ncsu/csc/itrust/dao/mysql/PatientDAO.java
+58
-0
58 additions, 0 deletions
iTrust/src/edu/ncsu/csc/itrust/dao/mysql/PatientDAO.java
with
58 additions
and
0 deletions
iTrust/src/edu/ncsu/csc/itrust/dao/mysql/PatientDAO.java
+
58
−
0
View file @
ae0270e2
...
...
@@ -98,6 +98,64 @@ public class PatientDAO {
}
}
/**
* Sets that a patient is registered
*
* @param mid The MID of the patient in question.
* @return A boolean representing if the transaction completed successfully
* @throws ITrustException
* @throws DBException
*/
public
boolean
activatePreregisteredPatient
(
long
mid
)
{
Connection
conn
=
null
;
PreparedStatement
ps
=
null
;
try
{
conn
=
factory
.
getConnection
();
ps
=
conn
.
prepareStatement
(
"UPDATE PATIENTS SET registered = ? WHERE mid = ?"
);
ps
.
setByte
(
1
,
1
);
ps
.
setLong
(
2
,
mid
);
ps
.
executeUpdate
();
ps
.
close
();
return
true
;
}
catch
(
SQLException
e
)
{
throw
new
DBException
(
e
);
}
finally
{
DBUtil
.
closeConnection
(
conn
,
ps
);
}
}
/**
* Sets that a patient is not registered
*
* @param mid The MID of the patient in question.
* @return A boolean representing if the transaction completed successfully
* @throws ITrustException
* @throws DBException
*/
public
boolean
deactivatePreregisteredPatient
(
long
mid
)
{
Connection
conn
=
null
;
PreparedStatement
ps
=
null
;
try
{
conn
=
factory
.
getConnection
();
ps
=
conn
.
prepareStatement
(
"UPDATE PATIENTS SET DateofDeactivation = ?, registered = ? WHERE mid = ?"
);
Date
date
=
new
Date
(
Calendar
.
getInstance
().
getTime
().
getTime
());
ps
.
setDate
(
1
,
date
);
ps
.
setByte
(
2
,
0
);
ps
.
setLong
(
3
,
mid
);
ps
.
executeUpdate
();
ps
.
close
();
return
true
;
}
catch
(
SQLException
e
)
{
throw
new
DBException
(
e
);
}
finally
{
DBUtil
.
closeConnection
(
conn
,
ps
);
}
}
/**
* Returns the name for the given MID
*
...
...
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