Skip to content
Snippets Groups Projects
Commit 64bb208e authored by Matthew Williams's avatar Matthew Williams
Browse files

Merge branch 'UC92v2' of https://gitlab.engr.illinois.edu/htmoss2/cs427fa20team22 into UC92v2

parents 73bc4dbd 892553bf
No related branches found
No related tags found
1 merge request!16Remove unnecessary imports, standardize others
Showing
with 1460 additions and 292 deletions
<%@taglib prefix="itrust" uri="/WEB-INF/tags.tld"%>
<%@page errorPage="/auth/exceptionHandler.jsp"%>
<%@page import="edu.ncsu.csc.itrust.dao.DAOFactory"%>
<%@page import="edu.ncsu.csc.itrust.beans.PatientBean"%>
<%@page import="edu.ncsu.csc.itrust.action.EditPatientAction"%>
<%@page import="edu.ncsu.csc.itrust.BeanBuilder"%>
<%@page import="edu.ncsu.csc.itrust.enums.Ethnicity"%>
<%@page import="edu.ncsu.csc.itrust.enums.BloodType"%>
<%@page import="edu.ncsu.csc.itrust.exception.FormValidationException"%>
<%@page import="edu.ncsu.csc.itrust.enums.Gender"%>
<%@page import="edu.ncsu.csc.itrust.beans.DiagnosisBean"%>
<%@include file="/global.jsp"%>
<%
pageTitle = "iTrust - Activate a Pre-Registered Patient";
%>
<%@include file="/header.jsp"%>
<itrust:patientNav thisTitle="Deactivate" />
<%
/* Require a Patient ID first */
String pidString = (String) session.getAttribute("pid");
if (pidString == null || pidString.equals("") || 1 > pidString.length()) {
out.println("pidstring is null");
response.sendRedirect("/iTrust/auth/getPatientID.jsp?forward=hcp-uap/deactivatePatient.jsp");
return;
}
/* If the patient id doesn't check out, then kick 'em out to the exception handler */
EditPatientAction action = new EditPatientAction(prodDAO, loggedInMID.longValue(), pidString);
/* Now take care of updating information */
PatientBean p;
if (request.getParameter("formIsFilled") != null && request.getParameter("formIsFilled").equals("true") &&
request.getParameter("understand") != null && request.getParameter("understand").equals("I UNDERSTAND")) {
try {
action.activate();
long patientMID = action.getPatient().getMID();
loggingAction.logEvent(TransactionType.REREGISTERED_PATIENT_ACTIVATE, loggedInMID.longValue(),
Long.valueOf((String)session.getAttribute("pid")).longValue(), "");
%>
<a href="/iTrust/auth/hcp-uap/viewPreRegisteredPatientList.jsp" style="text-decoration: none;">
<input type=button value="Go Back to Pre-Registered Patient List" onClick="location='/iTrust/auth/hcp-uap/viewPreRegisteredPatientList.jsp';">
</a>
<br /><br /><br /><br /><br />
<div align=center>
<span class="iTrustMessage">Patient Successfully Activated! You can </span>
<a href="editPHR.jsp" style="text-decoration: none;">
<input type=button value="Edit Patient" onClick="location='editPHR.jsp';">
</a>
</div>
<br /><br /><br /><br /><br />
<%
} catch (Exception e) {
%>
<br />
<div align=center>
<span class="iTrustError"><%=StringEscapeUtils.escapeHtml(e.getMessage()) %></span>
</div>
<br />
<%
}
} else {
p = action.getPatient();
if (request.getParameter("formIsFilled") != null && request.getParameter("formIsFilled").equals("true") &&
(request.getParameter("understand") == null || !request.getParameter("understand").equals("I UNDERSTAND"))) {
%>
<br />
<div align=center>
<span class="iTrustError">You must type "I UNDERSTAND" in the textbox.</span>
</div>
<br />
<%
}
%>
<form id="activateForm" action="activatePatient.jsp" method="post">
<input type="hidden" name="formIsFilled" value="true"><br />
<table cellspacing=0 align=center cellpadding=0>
<tr>
<td valign=top>
<table class="fTable" align=center style="width: 350px;">
<tr>
<th colspan="4">Activate Patient</th>
</tr>
<tr>
<td class="subHeaderVertical">First Name:</td>
<td><%= StringEscapeUtils.escapeHtml("" + (p.getFirstName())) %></td>
<td class="subHeaderVertical">Last Name:</td>
<td><%= StringEscapeUtils.escapeHtml("" + (p.getLastName())) %></td>
</tr>
<tr>
<td colspan="4">Are you absolutely sure you want to ACTIVATE this
patient? If you are sure, type "I UNDERSTAND" into the box below
and click the button</td>
</tr>
<tr>
<td colspan="4"><div align="center"><input name="understand" type="text"></div></td>
</tr>
</table>
</td>
</tr>
</table>
<br />
<div align=center>
<input type="submit" name="action"
style="font-size: 16pt; font-weight: bold;" value="Activate Patient"><br /><br />
</div>
</form>
<% } %>
<br />
<br />
<itrust:patientNav thisTitle="Activate" />
<%@include file="/footer.jsp"%>
<%@taglib prefix="itrust" uri="/WEB-INF/tags.tld"%>
<%@page errorPage="/auth/exceptionHandler.jsp"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Date"%>
<%@page import="java.util.List"%>
<%@page import="java.text.DateFormat"%>
<%@page import="edu.ncsu.csc.itrust.dao.DAOFactory"%>
<%@page import="edu.ncsu.csc.itrust.beans.PatientBean"%>
<%@page import="edu.ncsu.csc.itrust.action.EditPatientAction"%>
<%@page import="edu.ncsu.csc.itrust.BeanBuilder"%>
<%@page import="edu.ncsu.csc.itrust.enums.Ethnicity"%>
<%@page import="edu.ncsu.csc.itrust.enums.BloodType"%>
<%@page import="edu.ncsu.csc.itrust.exception.FormValidationException"%>
<%@page import="edu.ncsu.csc.itrust.enums.Gender"%>
<%@page import="edu.ncsu.csc.itrust.beans.DiagnosisBean"%>
<%@include file="/global.jsp"%>
<%
pageTitle = "iTrust - Deactivate Preregistered Patient";
%>
<%@include file="/header.jsp"%>
<itrust:patientNav thisTitle="Deactivate" />
<%
String patientString = "";
if (request.getParameter("patient") != null) {
patientString = request.getParameter("patient");
}
String pidString;
long pid = 0;
if (!patientString.equals("")) {
int patientIndex = Integer.parseInt(patientString);
List<PatientBean> patients = (List<PatientBean>) session.getAttribute("patients"); // pass through html
pid = patients.get(patientIndex).getMID();
pidString = "" + pid;
session.removeAttribute("patients");
session.setAttribute("pid", pidString);
}
else {
if (session.getAttribute("pid") == null) {
pid = 0;
pidString = "";
} else {
pid = (long) Long.parseLong((String) session.getAttribute("pid"));
pidString = ""+pid;
}
}
/* Require a Patient ID first */
if (pidString == null || pidString.equals("") || 1 > pidString.length()) {
out.println("pidstring is null");
response.sendRedirect("/iTrust/auth/getPatientID.jsp?forward=hcp-uap/deactivatePatient.jsp");
return;
}
/* If the patient id doesn't check out, then kick 'em out to the exception handler */
EditPatientAction action = new EditPatientAction(prodDAO, loggedInMID.longValue(), pidString);
/* Now take care of updating information */
PatientBean p;
if (request.getParameter("formIsFilled") != null && request.getParameter("formIsFilled").equals("true") &&
request.getParameter("understand") != null && request.getParameter("understand").equals("I UNDERSTAND")) {
try {
action.deactivate();
loggingAction.logEvent(TransactionType.PREREGISTERED_PATIENT_DEACTIVATE, loggedInMID.longValue(), Long.valueOf((String)session.getAttribute("pid")).longValue(), "");
session.removeAttribute("pid");
%>
<br />
<div align=center>
<span class="iTrustMessage">Patient Successfully Deactivated</span>
</div>
<br />
<%
} catch (Exception e) {
%>
<br />
<div align=center>
<span class="iTrustError"><%=StringEscapeUtils.escapeHtml(e.getMessage()) %></span>
</div>
<br />
<%
}
} else {
p = action.getPatient();
if (request.getParameter("formIsFilled") != null && request.getParameter("formIsFilled").equals("true") &&
(request.getParameter("understand") == null || !request.getParameter("understand").equals("I UNDERSTAND"))) {
%>
<br />
<div align=center>
<span class="iTrustError">You must type "I UNDERSTAND" in the textbox.</span>
</div>
<br />
<%
}
%>
<form id="deactivateForm" action="deactivatePrePatient.jsp" method="post">
<input type="hidden" name="formIsFilled" value="true"><br />
<table cellspacing=0 align=center cellpadding=0>
<tr>
<td valign=top>
<table class="fTable" align=center style="width: 350px;">
<tr>
<th colspan="4">Deactivate Patient</th>
</tr>
<tr>
<td class="subHeaderVertical">First Name:</td>
<td><%= StringEscapeUtils.escapeHtml("" + (p.getFirstName())) %></td>
<td class="subHeaderVertical">Last Name:</td>
<td><%= StringEscapeUtils.escapeHtml("" + (p.getLastName())) %></td>
</tr>
<tr>
<td colspan="4">Are you absolutely sure you want to deactivate this
patient? This operation can only be undone by an administrator. If
you are sure, type "I UNDERSTAND" into the box below and click the
button</td>
</tr>
<tr>
<td colspan="4"><div align="center"><input name="understand" type="text"></div></td>
</tr>
</table>
</td>
</tr>
</table>
<br />
<div align=center>
<input type="submit" name="action"
style="font-size: 16pt; font-weight: bold;" value="Deactivate Patient"><br /><br />
</div>
</form>
<% } %>
<br />
<br />
<itrust:patientNav thisTitle="Deactivate" />
<%@include file="/footer.jsp"%>
<%@taglib uri="/WEB-INF/tags.tld" prefix="itrust" %>
<%@page errorPage="/auth/exceptionHandler.jsp" %>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Date"%>
<%@page import="java.util.List"%>
<%@page import="java.text.DateFormat"%>
<%@page import="edu.ncsu.csc.itrust.action.EditPHRAction"%>
<%@page import="edu.ncsu.csc.itrust.dao.DAOFactory"%>
<%@page import="edu.ncsu.csc.itrust.beans.PatientBean"%>
<%@page import="edu.ncsu.csc.itrust.beans.AllergyBean"%>
<%@page import="edu.ncsu.csc.itrust.beans.FamilyMemberBean"%>
<%@page import="edu.ncsu.csc.itrust.beans.HealthRecord"%>
<%@page import="edu.ncsu.csc.itrust.beans.MedicationBean"%>
<%@page import="edu.ncsu.csc.itrust.beans.OfficeVisitBean"%>
<%@page import="edu.ncsu.csc.itrust.beans.ProcedureBean"%>
<%@page import="edu.ncsu.csc.itrust.risk.RiskChecker"%>
<%@page import="edu.ncsu.csc.itrust.beans.PersonnelBean"%>
<%@page import="edu.ncsu.csc.itrust.dao.mysql.PersonnelDAO"%>
<%@page import="edu.ncsu.csc.itrust.dao.mysql.PatientDAO"%>
<%@page import="edu.ncsu.csc.itrust.enums.TransactionType"%>
<%@include file="/global.jsp" %>
<%
pageTitle = "iTrust - View Pre-Registered Patients Info";
%>
<%@include file="/header.jsp" %>
<%
PatientDAO patientDAO = new PatientDAO(prodDAO);
PersonnelDAO personnelDAO = new PersonnelDAO(prodDAO);
PersonnelBean personnelb = personnelDAO.getPersonnel(loggedInMID.longValue());
DateFormat df = DateFormat.getDateInstance();
String switchString = "";
if (request.getParameter("switch") != null) {
switchString = request.getParameter("switch");
}
String relativeString = "";
if (request.getParameter("relative") != null) {
relativeString = request.getParameter("relative");
}
String patientString = "";
if (request.getParameter("patient") != null) {
patientString = request.getParameter("patient");
}
String pidString;
long pid = 0;
if (switchString.equals("true")) pidString = "";
else if (!relativeString.equals("")) {
int relativeIndex = Integer.parseInt(relativeString);
List<PatientBean> relatives = (List<PatientBean>) session.getAttribute("relatives");
pid = relatives.get(relativeIndex).getMID();
pidString = "" + pid;
session.removeAttribute("relatives");
session.setAttribute("pid", pidString);
}
else if (!patientString.equals("")) {
int patientIndex = Integer.parseInt(patientString);
List<PatientBean> patients = (List<PatientBean>) session.getAttribute("patients");
pid = patients.get(patientIndex).getMID();
pidString = "" + pid;
session.removeAttribute("patients");
session.setAttribute("pid", pidString);
}
else {
if (session.getAttribute("pid") == null) {
pid = 0;
pidString = "";
} else {
pid = (long) Long.parseLong((String) session.getAttribute("pid"));
pidString = ""+pid;
}
}
if (pidString == null || 1 > pidString.length()) {
response.sendRedirect("../getPatientID.jsp?forward=hcp-uap/editPHR.jsp");
return;
}
loggingAction.logEvent(TransactionType.PATIENT_HEALTH_INFORMATION_VIEW, loggedInMID.longValue(), pid, "");
EditPHRAction action = new EditPHRAction(prodDAO,loggedInMID.longValue(), pidString);
pid = action.getPid();
String confirm = "";
if(request.getParameter("addA") != null)
{
try{
confirm = action.updateAllergies(pid,request.getParameter("description"));
loggingAction.logEvent(TransactionType.PATIENT_HEALTH_INFORMATION_EDIT, loggedInMID.longValue(), pid, "");
} catch(Exception e)
{
confirm = e.getMessage();
}
}
PatientBean patient = action.getPatient();
List<HealthRecord> records = action.getAllHealthRecords();
HealthRecord mostRecent = records.size() > 0 ? records.get(0) : null;
List<OfficeVisitBean> officeVisits = action.getAllOfficeVisits();
List<FamilyMemberBean> family = action.getFamily();
%>
<%@page import="edu.ncsu.csc.itrust.exception.NoHealthRecordsException"%>
<script type="text/javascript">
function showRisks(){
document.getElementById("risks").style.display="inline";
document.getElementById("riskButton").style.display="none";
}
</script>
<% if (!"".equals(confirm)) {%>
<span class="iTrustError"><%= StringEscapeUtils.escapeHtml("" + (confirm)) %></span><br />
<% } %>
<br />
<a href="/iTrust/auth/hcp-uap/viewPreRegisteredPatientList.jsp" style="text-decoration: none;">
<input type=button value="Go Back to Pre-Registered Patient List" onClick="location='/iTrust/auth/hcp-uap/viewPreRegisteredPatientList.jsp';">
</a>
<br /><br />
<td>
<a href="activatePatient.jsp" style="text-decoration: none;">
<input type=button value="Activate" >
</a>
</td>
<div align=center>
<div style="margin-right: 10px;">
<table class="fTable" align="center">
<tr>
<th colspan="2">Patient Information</th>
</tr>
<tr>
<td class="subHeaderVertical">Name:</td>
<td ><%= StringEscapeUtils.escapeHtml("" + (patient.getFullName())) %></td>
</tr>
<tr>
<td class="subHeaderVertical">Address:</td>
<td > <%= StringEscapeUtils.escapeHtml("" + (patient.getStreetAddress1())) %><br />
<%="".equals(patient.getStreetAddress2()) ? "" : patient.getStreetAddress2() + "<br />"%>
<%= StringEscapeUtils.escapeHtml("" + (patient.getStreetAddress3())) %><br />
</td>
</tr>
<tr>
<td class="subHeaderVertical">Phone:</td>
<td ><%= StringEscapeUtils.escapeHtml("" + (patient.getPhone())) %></td>
</tr>
<tr>
<td class="subHeaderVertical" >Email:</td>
<td ><%= StringEscapeUtils.escapeHtml("" + (patient.getEmail())) %></td>
</tr>
<tr>
<th colspan="2">Insurance Information</th>
</tr>
<tr>
<td class="subHeaderVertical" >Provider Name:</td>
<td ><%= StringEscapeUtils.escapeHtml("" + (patient.getIcName())) %></td>
</tr>
<tr>
<td class="subHeaderVertical">Address:</td>
<td > <%= StringEscapeUtils.escapeHtml("" + (patient.getIcAddress1())) %><br />
<%="".equals(patient.getIcAddress2()) ? "" : patient.getIcAddress2() + "<br />"%>
<%= StringEscapeUtils.escapeHtml("" + (patient.getIcAddress3())) %><br />
</td>
</tr>
<tr>
<td class="subHeaderVertical">Phone:</td>
<td ><%= StringEscapeUtils.escapeHtml("" + (patient.getIcPhone())) %></td>
</tr>
</table>
<br />
</div>
<div style="margin-right: 10px;">
<table class="fTable" align="center">
<tr>
<th colspan="2">Basic Health Records</th>
</tr>
<% if (null == mostRecent) { %>
<tr><td colspan=2>No basic health records are on file for this patient</td></tr>
<% } else {%>
<tr>
<td class="subHeaderVertical">Height:</td>
<td ><%= StringEscapeUtils.escapeHtml("" + (mostRecent.getHeight())) %>in.</td>
</tr>
<tr>
<td class="subHeaderVertical">Weight:</td>
<td ><%= StringEscapeUtils.escapeHtml("" + (mostRecent.getWeight())) %>lbs.</td>
</tr>
<tr>
<td class="subHeaderVertical">Smoker?:</td>
<td ><%= StringEscapeUtils.escapeHtml("" + (mostRecent.getSmokingStatus()) + " - " + (mostRecent.getSmokingStatusDesc())) %></td>
</tr>
<% } //closing for "there is a most recent record for this patient" %>
</table>
<br />
</div>
</div>
<br />
<br />
<%@include file="/footer.jsp" %>
<%@taglib uri="/WEB-INF/tags.tld" prefix="itrust"%>
<%@page errorPage="/auth/exceptionHandler.jsp"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="edu.ncsu.csc.itrust.beans.PatientBean"%>
<%@page import="edu.ncsu.csc.itrust.beans.PatientVisitBean"%>
<%@page import="edu.ncsu.csc.itrust.action.ViewPreRegisteredPatientListAction"%>
<%@include file="/global.jsp" %>
<%
pageTitle = "iTrust - View All Pre-Registered Patients";
%>
<%@include file="/header.jsp" %>
<%
ViewPreRegisteredPatientListAction action = new ViewPreRegisteredPatientListAction(prodDAO, loggedInMID.longValue());
List<PatientBean> PreRegisteredPatientList = action.getPreRegisteredPatients();
loggingAction.logEvent(TransactionType.PATIENT_LIST_VIEW, loggedInMID, 0, "");
%>
<script src="/iTrust/DataTables/media/js/jquery.dataTables.min.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery.fn.dataTableExt.oSort['lname-asc'] = function(x,y) {
var a = x.split(" ");
var b = y.split(" ");
return ((a[1] < b[1]) ? -1 : ((a[1] > b[1]) ? 1 : 0));
};
jQuery.fn.dataTableExt.oSort['lname-desc'] = function(x,y) {
var a = x.split(" ");
var b = y.split(" ");
return ((a[1] < b[1]) ? 1 : ((a[1] > b[1]) ? -1 : 0));
};
</script>
<script type="text/javascript">
$(document).ready(function() {
$("#patientList").dataTable( {
"aaColumns": [ [2,'dsc'] ],
"aoColumns": [ { "sType": "lname" }, null, null],
"bStateSave": true,
"sPaginationType": "full_numbers"
});
});
</script>
<style type="text/css" title="currentStyle">
@import "/iTrust/DataTables/media/css/demo_table.css";
</style>
<br />
<h2>Pre-Registered Patients</h2>
<form action="viewReport.jsp" method="post" name="myform">
<table class="display fTable" id="patientList" align="center">
<thead>
<tr class="">
<th>Deactivate</th>
<th>Name</th>
<th>Address</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<%
List<PatientBean> patientsList = new ArrayList<PatientBean>();
int index = 0;
for (PatientBean bean : PreRegisteredPatientList) {
patientsList.add(bean);
String idName = "row" + index;
String editButtonName = "button" + index;
%>
<tr>
<td>
<a href="deactivatePrePatient.jsp?patient=<%= StringEscapeUtils.escapeHtml("" + (index)) %>" style="text-decoration: none;">
<input type=button value="Deactivate" class="deactivate">
</a>
</td>
<td >
<a href="viewPreRegisteredPatientInfo.jsp?patient=<%= StringEscapeUtils.escapeHtml("" + (index)) %>" id=<%=editButtonName%>>
<%= StringEscapeUtils.escapeHtml("" + (bean.getFullName())) %>
</a>
</td>
<td ><%= StringEscapeUtils.escapeHtml("" + (bean.getStreetAddress1() +" " +bean.getStreetAddress2() +" " +bean.getCity() +" " +bean.getState()) +" " +bean.getZip()) %></td>
<td >
<%= StringEscapeUtils.escapeHtml("" + (bean.getEmail())) %>
</td>
</tr>
<%
index ++;
}
session.setAttribute("patients", patientsList);
%>
</tbody>
</table>
</form>
<script type="text/javascript">
$('.deactivate').on('click', function() {
$(this).closest('tr').hide();
});
</script>
<br />
<br />
<%@include file="/footer.jsp" %>
......@@ -2,29 +2,29 @@
<div class="panel-heading" anim-type="collapse" anim-target="#info-menu">
<h2 class="panel-title">Patient Info</h2>
</div>
<div class="panel-body" id="info-menu">
<ul class="nav nav-sidebar">
<li><a href="/iTrust/auth/hcp-uap/viewPatientOfficeVisitHistory.jsp">All Patients</a>
<li><a href="/iTrust/auth/hcp-uap/viewPreRegisteredPatientList.jsp">View Pre-Registered Patients</a>
<li><a href="/iTrust/auth/hcp-uap/viewPatientOfficeVisitHistory.jsp">All Patients</a>
<li><a href="/iTrust/auth/hcp-uap/viewBasicHealth.jsp">Basic Health Information</a>
<li><a href="/iTrust/auth/hcp-uap/editPatient.jsp">Patient Information</a>
<li><a href="/iTrust/auth/hcp-uap/editPHR.jsp">PHR Information</a>
<li><a href="/iTrust/auth/hcp/editRepresentatives.jsp">Representatives</a>
<li><a href="/iTrust/auth/hcp-uap/viewImmunizations.jsp">Immunization Report</a>
<li><a href="/iTrust/auth/hcp-er/emergencyReport.jsp">Emergency Patient Report</a>
<li><a href="/iTrust/auth/hcp-uap/viewMyReportRequests.jsp">My Report Requests</a>
<li><a href="/iTrust/auth/hcp-uap/viewRecordsReleases.jsp">Records Release Requests</a>
<li><a href="/iTrust/auth/hcp-uap/chronicDiseaseRisks.jsp">Chronic Disease Risks</a>
<li><a href="/iTrust/auth/hcp-er/emergencyReport.jsp">Emergency Patient Report</a>
<li><a href="/iTrust/auth/hcp-uap/viewMyReportRequests.jsp">My Report Requests</a>
<li><a href="/iTrust/auth/hcp-uap/viewRecordsReleases.jsp">Records Release Requests</a>
<li><a href="/iTrust/auth/hcp-uap/chronicDiseaseRisks.jsp">Chronic Disease Risks</a>
<li><a href="/iTrust/auth/hcp-pha/viewDiagnosisStatistics.jsp">Diagnosis Trends</a>
<li><a href="/iTrust/auth/hcp/groupReport.jsp">Group Report</a>
<li><a href="/iTrust/auth/hcp/changeDependency.jsp">Patient Dependency</a>
<!--<li><a href="/iTrust/auth/hcp-uap/deactivatePatient.jsp">Deactivate Patient</a> -->
<li><a href="/iTrust/auth/hcp-uap/deactivatePatient.jsp">Deactivate Patient</a>
<li><a href="/iTrust/auth/hcp/auditPage.jsp">Audit Patients</a>
<li><a href="/iTrust/auth/hcp-nutritionist/viewFoodDiaries.jsp">Patient Food Diaries</a>
<li><a href="/iTrust/auth/hcp-nutritionist/macronutrients.jsp">Patient Macronutrient Intake</a>
<li><a href="/iTrust/auth/hcp-fitness/viewExerciseDiaries.jsp">Patient Exercise Diaries</a>
<li><a href="/iTrust/auth/hcp/viewSleepDiaries.jsp">Patient Sleep Diaries</a>
<li><a href="/iTrust/auth/hcp/causeOfDeathTrendsReport.jsp">Cause-Of-Death Trends Report</a>
</ul>
</div>
</div>
......@@ -38,7 +38,7 @@
<li><a href="/iTrust/auth/hcp/scheduleAppt.jsp">Schedule Appointment</a>
<li><a href="/iTrust/auth/hcp/viewMyAppts.jsp">View My Appointments</a>
<li><a href="/iTrust/auth/hcp/viewMyApptRequests.jsp">Appointment Requests</a>
<li><a href="/iTrust/auth/hcp/calendar.jsp">Appointment Calendar</a>
<li><a href="/iTrust/auth/hcp/calendar.jsp">Appointment Calendar</a>
</ul>
</div>
</div>
......@@ -49,11 +49,11 @@
</div>
<div class="panel-body" id="ov-menu">
<ul class="nav nav-sidebar">
<li><a href="/iTrust/auth/hcp-uap/documentOfficeVisit.jsp">Document Office Visit</a>
<li><a href="/iTrust/auth/hcp/visitReminders.jsp">Office Visit Reminders</a>
<li><a href="/iTrust/auth/hcp/LabProcHCP.jsp">Laboratory Procedures</a>
<li><a href="/iTrust/auth/hcp-uap/viewSentReferrals.jsp">Sent Referrals</a>
<li><a href="/iTrust/auth/hcp-uap/viewReceivedReferrals.jsp">Received Referrals</a>
<li><a href="/iTrust/auth/hcp-uap/documentOfficeVisit.jsp">Document Office Visit</a>
<li><a href="/iTrust/auth/hcp/visitReminders.jsp">Office Visit Reminders</a>
<li><a href="/iTrust/auth/hcp/LabProcHCP.jsp">Laboratory Procedures</a>
<li><a href="/iTrust/auth/hcp-uap/viewSentReferrals.jsp">Sent Referrals</a>
<li><a href="/iTrust/auth/hcp-uap/viewReceivedReferrals.jsp">Received Referrals</a>
</ul>
</div>
</div>
......@@ -91,9 +91,9 @@
</div>
<div class="panel-body" id="add-menu">
<ul class="nav nav-sidebar">
<li><a href="/iTrust/auth/hcp-uap/addPatient.jsp">Patient</a></li>
<li><a href="/iTrust/auth/hcp-uap/uploadPatientFile.jsp">Upload Patient File</a></li>
<li><a href="/iTrust/auth/hcp/addUAP.jsp">UAP</a></li>
<li><a href="/iTrust/auth/hcp-uap/addPatient.jsp">Patient</a></li>
<li><a href="/iTrust/auth/hcp-uap/uploadPatientFile.jsp">Upload Patient File</a></li>
<li><a href="/iTrust/auth/hcp/addUAP.jsp">UAP</a></li>
</ul>
</div>
</div>
......@@ -104,7 +104,7 @@
</div>
<div class="panel-body" id="pi-menu">
<ul class="nav nav-sidebar">
<li><a href="/iTrust/auth/staff/editMyDemographics.jsp">My Demographics</a>
<li><a href="/iTrust/auth/staff/editMyDemographics.jsp">My Demographics</a>
</ul>
</div>
</div>
......@@ -150,9 +150,9 @@
</div>
<div class="panel-body" id="other-menu">
<ul class="nav nav-sidebar">
<li><a href="/iTrust/auth/staff/linkToResources.jsp">Edit Diagnoses URLs</a>
<li><a href="/iTrust/auth/hcp/manageWards.jsp">Manage Wards</a>
<li><a href="/iTrust/auth/staff/editPersonnel.jsp">UAPs</a>
<li><a href="/iTrust/auth/staff/linkToResources.jsp">Edit Diagnoses URLs</a>
<li><a href="/iTrust/auth/hcp/manageWards.jsp">Manage Wards</a>
<li><a href="/iTrust/auth/staff/editPersonnel.jsp">UAPs</a>
<li><a href="/iTrust/auth/surveyResults.jsp">Satisfaction Survey Results</a>
<li><a href="/iTrust/auth/hcp/viewPrescriptionRenewalNeeds.jsp">Potential Prescription-Renewals</a>
</ul>
......
......@@ -4,7 +4,7 @@ CREATE TABLE users(
Password VARCHAR(200),
Salt VARCHAR(200) DEFAULT '',
openID VARCHAR(200),
Role enum('patient','admin','hcp','uap','er','tester','pha', 'lt', 'preRegisteredPatient') NOT NULL DEFAULT 'admin',
Role enum('patient','admin','hcp','uap','er','tester','pha', 'lt', 'preRegisteredPatient', 'deactivatedPatient') NOT NULL DEFAULT 'admin',
sQuestion VARCHAR(100) DEFAULT '',
sAnswer VARCHAR(30) DEFAULT '',
isDependent tinyint(1) unsigned NOT NULL default '0',
......@@ -239,12 +239,12 @@ CREATE TABLE resetpasswordfailures(
) ENGINE=MyISAM;
CREATE TABLE icdcodes (
Code decimal(5,2) NOT NULL,
Description TEXT NOT NULL,
Chronic enum('no','yes') NOT NULL default 'no',
Ophthalmology enum('no','yes') NOT NULL default 'no',
URL varchar(512) NOT NULL default '',
PRIMARY KEY (Code)
Code decimal(5,2) NOT NULL,
Description TEXT NOT NULL,
Chronic enum('no','yes') NOT NULL default 'no',
Ophthalmology enum('no','yes') NOT NULL default 'no',
URL varchar(512) NOT NULL default '',
PRIMARY KEY (Code)
) ENGINE=MyISAM;
CREATE TABLE cptcodes(
......@@ -401,7 +401,7 @@ CREATE TABLE ovprocedure(
) ENGINE=MyISAM;
CREATE TABLE ovmedication (
ID INT(10) auto_increment primary key,
ID INT(10) auto_increment primary key,
VisitID INT( 10 ) unsigned NOT NULL COMMENT 'ID of the Office Visit',
NDCode VARCHAR( 9 ) NOT NULL COMMENT 'NDCode for the medication',
StartDate DATE,
......@@ -419,10 +419,10 @@ CREATE TABLE ovreactionoverride (
) ENGINE=MyISAM;
CREATE TABLE ovdiagnosis (
ID INT(10) auto_increment primary key,
ID INT(10) auto_increment primary key,
VisitID INT( 10 ) unsigned NOT NULL COMMENT 'ID of the Office Visit',
ICDCode DECIMAL( 5, 2 ) NOT NULL COMMENT 'Code for the Diagnosis',
URL VARCHAR(512) COMMENT 'URL for information'
URL VARCHAR(512) COMMENT 'URL for information'
) ENGINE=MyISAM;
CREATE TABLE globalvariables (
......@@ -443,13 +443,13 @@ CREATE TABLE fakeemail(
CREATE TABLE reportrequests (
ID INT(10) auto_increment primary key,
RequesterMID BIGINT unsigned,
PatientMID BIGINT unsigned,
ApproverMID BIGINT unsigned,
RequestedDate datetime,
ApprovedDate datetime,
ViewedDate datetime,
Status varchar(30),
RequesterMID BIGINT unsigned,
PatientMID BIGINT unsigned,
ApproverMID BIGINT unsigned,
RequestedDate datetime,
ApprovedDate datetime,
ViewedDate datetime,
Status varchar(30),
Comment TEXT
) ENGINE=MyISAM;
......@@ -458,7 +458,7 @@ CREATE TABLE ovsurvey (
SurveyDate datetime not null COMMENT 'Date the survey was completed',
WaitingRoomMinutes int(3) COMMENT 'How many minutes did you wait in the waiting room?',
ExamRoomMinutes int(3) COMMENT 'How many minutes did you wait in the examination room before seeing your physician?',
VisitSatisfaction int(1) COMMENT 'How satisfied were you with your office visit?',
VisitSatisfaction int(1) COMMENT 'How satisfied were you with your office visit?',
TreatmentSatisfaction int(1) COMMENT 'How satisfied were you with the treatment or information you received?'
) ENGINE=MyISAM;
......@@ -579,12 +579,12 @@ CREATE TABLE profilephotos (
) ENGINE=MyISAM;
CREATE TABLE patientspecificinstructions (
id BIGINT unsigned AUTO_INCREMENT primary key,
VisitID BIGINT unsigned,
Modified TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
Name VARCHAR(100),
URL VARCHAR(250),
Comment VARCHAR(500)
id BIGINT unsigned AUTO_INCREMENT primary key,
VisitID BIGINT unsigned,
Modified TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
Name VARCHAR(100),
URL VARCHAR(250),
Comment VARCHAR(500)
) ENGINE=MyISAM;
CREATE TABLE referralmessage(
......@@ -707,32 +707,32 @@ CREATE TABLE requiredprocedures(
attribute VARCHAR(30) NOT NULL,
ageMax BIGINT unsigned default NULL
)ENGINE=innoDB;
CREATE TABLE reviews(
mid BIGINT UNSIGNED NOT NULL,
pid BIGINT UNSIGNED NOT NULL,
reviewdate DATETIME NOT NULL,
descriptivereview VARCHAR(500),
rating INT UNSIGNED NOT NULL,
title VARCHAR(200)
mid BIGINT UNSIGNED NOT NULL,
pid BIGINT UNSIGNED NOT NULL,
reviewdate DATETIME NOT NULL,
descriptivereview VARCHAR(500),
rating INT UNSIGNED NOT NULL,
title VARCHAR(200)
)ENGINE=innoDB;
CREATE TABLE IF NOT EXISTS obstetricsconditions (
`cid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`mid` BIGINT NOT NULL,
`condition` VARCHAR(64) NOT NULL,
PRIMARY KEY (`cid`),
UNIQUE INDEX `cid_UNIQUE` (`cid` ASC)
`cid` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`mid` BIGINT NOT NULL,
`condition` VARCHAR(64) NOT NULL,
PRIMARY KEY (`cid`),
UNIQUE INDEX `cid_UNIQUE` (`cid` ASC)
)ENGINE=innoDB;
CREATE TABLE IF NOT EXISTS zipcodes (
`zip` varchar(5) NOT NULL default '',
`state` char(2) NOT NULL default '',
`latitude` varchar(10) NOT NULL default '',
`longitude` varchar(10) NOT NULL default '',
`city` varchar(50) default NULL,
`full_state` varchar(50) default NULL,
PRIMARY KEY `zip` (`zip`)
`zip` varchar(5) NOT NULL default '',
`state` char(2) NOT NULL default '',
`latitude` varchar(10) NOT NULL default '',
`longitude` varchar(10) NOT NULL default '',
`city` varchar(50) default NULL,
`full_state` varchar(50) default NULL,
PRIMARY KEY `zip` (`zip`)
) ENGINE=innoDB;
CREATE TABLE IF NOT EXISTS foodEntry (
......@@ -795,8 +795,8 @@ CREATE TABLE IF NOT EXISTS designatedNutritionist(
) ENGINE=MyISAM;
CREATE TABLE IF NOT EXISTS opdiagnosis(
ID INT(10) auto_increment primary key,
ID INT(10) auto_increment primary key,
VisitID INT( 10 ) unsigned NOT NULL COMMENT 'ID of the Ophthalmology Visit',
ICDCode DECIMAL( 5, 2 ) NOT NULL COMMENT 'Code for the Diagnosis',
URL VARCHAR(512) COMMENT 'URL for information'
URL VARCHAR(512) COMMENT 'URL for information'
) ENGINE=MyISAM;
/*Inserting dependent Brittany Franco*/
INSERT INTO patients
(MID,
lastName,
firstName,
email,
address1,
address2,
city,
state,
phone,
dateofbirth,
Gender)
VALUES
(92,
'Franco',
'Brittany',
'brfranco@gmail.com',
'1333 Who Cares Road',
'Suite 102',
'Raleigh',
'NC',
'919-971-0000',
'2006-10-25',
'Female')
ON DUPLICATE KEY UPDATE MID = MID;
INSERT INTO users(MID, password, role, sQuestion, sAnswer, isDependent)
VALUES (92, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'preRegisteredPatient', 'what is your favorite color?', 'blue', 0)
ON DUPLICATE KEY UPDATE MID = MID;
......@@ -93,10 +93,10 @@ public class EditPatientAction extends PatientBaseAction {
}
email.setFrom("no-reply@itrust.com");
email.setToList(toAddrs); // patient and personal representative
email.setSubject(String.format("Patient Information Updated"));
email.setBody("Dear " + pb.getFullName() + ",\n\tYour patient record information has been updated. " +
"Please login to iTrust to see who has viewed your records.");
email.setToList(toAddrs); // patient and personal representative
email.setSubject(String.format("Patient Information Updated"));
email.setBody("Dear " + pb.getFullName() + ",\n\tYour patient record information has been updated. " +
"Please login to iTrust to see who has viewed your records.");
return email;
}
......@@ -111,6 +111,7 @@ public class EditPatientAction extends PatientBaseAction {
patientDAO.editPatient(p, loggedInMID);
patientDAO.removeAllRepresented(pid);
patientDAO.removeAllRepresentee(pid);
patientDAO.deactivatePatient(pid);
}
/**
......@@ -122,6 +123,7 @@ public class EditPatientAction extends PatientBaseAction {
p.setMID(pid);
p.setDateOfDeactivationStr(null);
patientDAO.editPatient(p, loggedInMID);
patientDAO.ConvertPreRegisteredPatientsToPatient(this.getPid());
}
public boolean hasHistory() throws DBException {
......
package edu.ncsu.csc.itrust.action;
import java.text.SimpleDateFormat;
//import java.util.Date;
import java.util.ArrayList;
import java.util.List;
import edu.ncsu.csc.itrust.EmailUtil;
......@@ -142,7 +141,7 @@ public class EditPrescriptionsAction extends EditOfficeVisitBaseAction {
return "Allergy: " + bean.getDescription() + ". First Found: " +
new SimpleDateFormat("MM/dd/yyyy").format(bean.getFirstFound());
}
/**
* Checks to see if the given prescription has an interaction with any
* other previously prescribed prescriptions.
......@@ -329,13 +328,13 @@ public class EditPrescriptionsAction extends EditOfficeVisitBaseAction {
buf.append("\n");
}
String message = "Health care professional " + hcp.getFullName() + " has prescribed " +
pres.getMedication().getDescription() + ". However, the following warning(s) were found:" +
pres.getMedication().getDescription() + ". However, the following warning(s) were found:" +
buf.toString();
email.setFrom("no-reply@itrust.com");
email.setToList(toAddrs); // patient and personal representative
email.setSubject(String.format("Prescription warning"));
email.setBody(message);
email.setToList(toAddrs); // patient and personal representative
email.setSubject(String.format("Prescription warning"));
email.setBody(message);
return email;
}
}
......@@ -80,12 +80,12 @@ public class ResetPasswordAction {
*/
public String checkRole(long mid, String role) throws ITrustException {
try {
if (("patient".equals(role) && patientDAO.getRole(mid, role).equals("patient"))
|| ("hcp".equals(role) && patientDAO.getRole(mid, role).equals("hcp"))
|| ("uap".equals(role) && patientDAO.getRole(mid, role).equals("uap"))
|| ("pha".equals(role) && patientDAO.getRole(mid, role).equals("pha"))
|| ("er".equals(role) && patientDAO.getRole(mid, role).equals("er"))
|| ("lt".equals(role) && patientDAO.getRole(mid, role).equals("lt")))
if (("patient".equals(role) && patientDAO.getRole(mid).equals("patient"))
|| ("hcp".equals(role) && patientDAO.getRole(mid).equals("hcp"))
|| ("uap".equals(role) && patientDAO.getRole(mid).equals("uap"))
|| ("pha".equals(role) && patientDAO.getRole(mid).equals("pha"))
|| ("er".equals(role) && patientDAO.getRole(mid).equals("er"))
|| ("lt".equals(role) && patientDAO.getRole(mid).equals("lt")))
return role;
else
return null;
......
package edu.ncsu.csc.itrust.action;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import edu.ncsu.csc.itrust.beans.OfficeVisitBean;
import edu.ncsu.csc.itrust.beans.PatientBean;
import edu.ncsu.csc.itrust.beans.PatientVisitBean;
import edu.ncsu.csc.itrust.beans.PersonnelBean;
import edu.ncsu.csc.itrust.dao.DAOFactory;
import edu.ncsu.csc.itrust.dao.mysql.OfficeVisitDAO;
import edu.ncsu.csc.itrust.dao.mysql.PatientDAO;
import edu.ncsu.csc.itrust.dao.mysql.PersonnelDAO;
import edu.ncsu.csc.itrust.exception.DBException;
import edu.ncsu.csc.itrust.exception.ITrustException;
/**
*
* Action class for viewPreRegisteredPatientList.jsp
*
*/
public class ViewPreRegisteredPatientListAction {
private long loggedInMID;
private PatientDAO patientDAO;
private PersonnelDAO personnelDAO;
private ArrayList<PatientBean> PreRegisteredPatients;
/**
* Set up defaults
* @param factory The DAOFactory used to create the DAOs used in this action.
* @param loggedInMID The MID of the person viewing the office visits.
*/
public ViewPreRegisteredPatientListAction(DAOFactory factory, long loggedInMID) {
this.loggedInMID = loggedInMID;
this.personnelDAO = factory.getPersonnelDAO();
this.patientDAO = factory.getPatientDAO();
PreRegisteredPatients = new ArrayList<PatientBean>();
}
/**
* Identify all the PreRegistered Patients from Patients Table using Users Table Role="PreRegistered", and add them to a list.
*
* @throws ITrustException
*/
public List<PatientBean> getPreRegisteredPatients() throws ITrustException {
try {
List<PatientBean> plist = patientDAO.getAllPreRegisteredPatients();
for(PatientBean pb : plist) {
PreRegisteredPatients.add(pb);
}
return PreRegisteredPatients;
}
catch (DBException dbe) {
throw new ITrustException(dbe.getMessage());
}
}
}
\ No newline at end of file
......@@ -99,19 +99,17 @@ 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, String role) throws ITrustException, DBException {
public String getRole(long mid) throws ITrustException, DBException {
Connection conn = null;
PreparedStatement ps = null;
try {
conn = factory.getConnection();
ps = conn.prepareStatement("SELECT role FROM users WHERE MID=? AND Role=?");
ps = conn.prepareStatement("SELECT role FROM users WHERE MID=?");
ps.setLong(1, mid);
ps.setString(2, role);
ResultSet rs;
rs = ps.executeQuery();
if (rs.next()) {
......@@ -145,9 +143,12 @@ public class PatientDAO {
conn = factory.getConnection();
ps = conn.prepareStatement("INSERT INTO patients(MID) VALUES(NULL)");
ps.executeUpdate();
long a = DBUtil.getLastInsert(conn);
ps.close();
return a;
} catch (SQLException e) {
throw new DBException(e);
......@@ -222,10 +223,10 @@ public class PatientDAO {
} finally {
DBUtil.closeConnection(conn, ps);
}
}
public boolean isEmailInUse(String email) throws DBException {
Connection conn = null;
}
public boolean isEmailInUse(String email) throws DBException {
Connection conn = null;
PreparedStatement ps = null;
boolean emailInUse = false;
try {
......@@ -244,7 +245,7 @@ public class PatientDAO {
DBUtil.closeConnection(conn, ps);
}
return emailInUse;
}
}
public void addHistory(long pid, long hcpid) throws DBException {
Connection conn = null;
......@@ -708,7 +709,7 @@ public class PatientDAO {
/**
* Removes all dependencies participated by the patient passed in the parameter
*
* @param representerMID the mid for the patient to remove all representees for
* @param representeeMID the mid for the patient to remove all representees for
* @throws DBException
*/
public void removeAllRepresentee(long representeeMID) throws DBException {
......@@ -761,7 +762,7 @@ public class PatientDAO {
DBUtil.closeConnection(conn, ps);
}
}
/**
* Return a list of all procedures for a given patient
*
......@@ -921,7 +922,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
......@@ -931,7 +932,7 @@ public class PatientDAO {
PreparedStatement ps = null;
try {
conn = factory.getConnection();
ps = conn.prepareStatement("SELECT * FROM patients ");
ps = conn.prepareStatement("SELECT * FROM patients, users where patients.MID = users.MID and users.Role='patient' ");
ResultSet rs = ps.executeQuery();
List<PatientBean> loadlist = patientLoader.loadList(rs);
rs.close();
......@@ -945,6 +946,83 @@ public class PatientDAO {
}
}
/**
* Lists every Pre-Registered patient in the database.
*
* @return A java.util.List of PatientBeans representing the Pre-Registered patients.
* @throws DBException
*/
public List<PatientBean> getAllPreRegisteredPatients() throws DBException {
Connection conn = null;
PreparedStatement ps = null;
try {
conn = factory.getConnection();
ps = conn.prepareStatement("SELECT * FROM patients, users where patients.MID = users.MID and users.Role='PreRegisteredPatient' and patients.DateOfDeactivation IS NULL");
ResultSet rs = ps.executeQuery();
List<PatientBean> loadlist = patientLoader.loadList(rs);
rs.close();
ps.close();
return loadlist;
} catch (SQLException e) {
throw new DBException(e);
} finally {
DBUtil.closeConnection(conn, ps);
}
}
/**
* Convert a Pre-Registered patient to a regular patient upon HCP approval.
* by change "role" column in "users" table.
*
* @param mid
* @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);
}
}
/**
* Convert a patient of any type to a deactivated patient, which should not
* be able to be seen anymore.
*
* @param mid
* @throws DBException
*/
public void deactivatePatient(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, "deactivatedPatient");
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
* have the logged in HCP as a DHCP and whose medications are going to
......@@ -1224,6 +1302,4 @@ public class PatientDAO {
DBUtil.closeConnection(conn, ps);
}
}
}
This diff is collapsed.
package edu.ncsu.csc.itrust.selenium;
import java.util.concurrent.TimeUnit;
import edu.ncsu.csc.itrust.enums.TransactionType;
import org.junit.*;
import org.openqa.selenium.*;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
public class ActivatePatientTest extends iTrustSeleniumTest {
private WebDriver driver;
private StringBuffer verificationErrors = new StringBuffer();
@Before
public void setUp() throws Exception {
super.setUp();
gen.standardData();
gen.patient92();
driver = new HtmlUnitDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testActivatePreregisteredPatient() throws Exception {
HtmlUnitDriver driver = (HtmlUnitDriver)login("9000000000", "pw");
// Make sure we were able to log in
assertEquals("iTrust - HCP Home", driver.getTitle());
driver.findElement(By.cssSelector("h2.panel-title")).click();
driver.findElement(By.linkText("View Pre-Registered Patients")).click();
String text = driver.findElement(By.cssSelector("table.fTable")).getText();
// Make sure the preregistered patients show up in the preregistered patients list
assertTrue("Text not found!", text.contains("Brittany Franco"));
assertTrue("Text not found!", text.contains("1333 Who Cares Road Suite 102"));
assertTrue("Text not found!", text.contains("Raleigh NC"));
assertTrue("Text not found!", text.contains("brfranco@gmail.com"));
// Ensure we can click on the patient and see more details
driver.findElement(By.linkText("Brittany Franco")).click();
text = driver.findElement(By.cssSelector("table.fTable")).getText();
assertTrue("Text not found!", text.contains("Phone:919-971-0000"));
assertTrue("Text not found!", text.contains("Email:brfranco@gmail.com"));
assertTrue("Text not found!", text.contains("Address: 1333 Who Cares Road"));
// Activate the preregistered patient
driver.findElement(By.linkText("Activate")).click();
text = driver.findElement(By.cssSelector("table.fTable")).getText();
assertTrue("Text not found!", text.contains("type \"I UNDERSTAND\" into the box below and click the button"));
driver.findElement(By.name("understand")).sendKeys("I UNDERSTAND");
driver.findElement(By.name("action")).click();
assertLogged(TransactionType.REREGISTERED_PATIENT_ACTIVATE, 9000000000L, 92L, "");
// Ensure the patient gets the fully activated screen
text = driver.findElement(By.cssSelector("span.iTrustMessage")).getText();
assertTrue("Text not found!", text.contains("Patient Successfully Activated!"));
}
@After
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
}
}
package edu.ncsu.csc.itrust.selenium;
import java.util.concurrent.TimeUnit;
import edu.ncsu.csc.itrust.enums.TransactionType;
import org.junit.*;
import org.openqa.selenium.*;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import com.gargoylesoftware.htmlunit.WebClient;
public class DeactivatePatientTest extends iTrustSeleniumTest {
private WebDriver driver;
private StringBuffer verificationErrors = new StringBuffer();
@Before
public void setUp() throws Exception {
super.setUp();
gen.standardData();
gen.patient92();
driver = new HtmlUnitDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testDeactivatePatients() throws Exception {
HtmlUnitDriver driver = (HtmlUnitDriver)login("9000000000", "pw");
// Make sure we were able to log in
assertEquals("iTrust - HCP Home", driver.getTitle());
driver.findElement(By.cssSelector("h2.panel-title")).click();
driver.findElement(By.linkText("View Pre-Registered Patients")).click();
driver.findElement(By.cssSelector("input.deactivate")).click();
// Deactivate the specified patient
driver.findElement(By.name("understand")).sendKeys("I UNDERSTAND");
driver.findElement(By.name("action")).click();
assertLogged(TransactionType.PREREGISTERED_PATIENT_DEACTIVATE, 9000000000L, 92L, "");
driver.findElement(By.cssSelector("h2.panel-title")).click();
driver.findElement(By.linkText("View Pre-Registered Patients")).click();
String text = driver.findElement(By.cssSelector("table.fTable")).getText();
// Ensure the deactivated patient is no longer in the preregistered patients list
assertFalse("Text found, but shouldn't be!", text.contains("Brittany Franco"));
assertFalse("Text found, but shouldn't be!", text.contains("1333 Who Cares Road Suite 102"));
assertFalse("Text found, but shouldn't be!", text.contains("Raleigh NC"));
assertFalse("Text found, but shouldn't be!", text.contains("brfranco@gmail.com"));
}
@Test
public void testLoginAfterPatientDeactivated() throws Exception {
HtmlUnitDriver driver = (HtmlUnitDriver)login("9000000000", "pw");
// Make sure we were able to log in
assertEquals("iTrust - HCP Home", driver.getTitle());
driver.findElement(By.cssSelector("h2.panel-title")).click();
driver.findElement(By.linkText("View Pre-Registered Patients")).click();
driver.findElement(By.cssSelector("input.deactivate")).click();
// Deactivate the specified patient
driver.findElement(By.name("understand")).sendKeys("I UNDERSTAND");
driver.findElement(By.name("action")).click();
assertLogged(TransactionType.PREREGISTERED_PATIENT_DEACTIVATE, 9000000000L, 92L, "");
driver.findElement(By.cssSelector("h2.panel-title")).click();
driver.findElement(By.linkText("View Pre-Registered Patients")).click();
String text = driver.findElement(By.cssSelector("table.fTable")).getText();
// Make sure deactivated patient doesn't show up in preregistered list
assertFalse("Text found, but shouldn't be!", text.contains("Brittany Franco"));
assertFalse("Text found, but shouldn't be!", text.contains("1333 Who Cares Road Suite 102"));
assertFalse("Text found, but shouldn't be!", text.contains("Raleigh NC"));
assertFalse("Text found, but shouldn't be!", text.contains("brfranco@gmail.com"));
// Test if the deactivated patient can log in
HtmlUnitDriver patientDriver = (HtmlUnitDriver)login("92", "pw");
assertEquals("Server Rebooted", patientDriver.getTitle());
text = patientDriver.findElement(By.xpath("//body")).getText();
assertTrue("Text not found!", text.contains("Authorization Error!"));
assertTrue("Text not found!", text.contains("You are not allowed to access this page"));
assertTrue("Text not found!", text.contains("Log back in."));
}
@After
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
}
}
package edu.ncsu.csc.itrust.selenium;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import org.openqa.selenium.*;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
public class ViewAllPreregisteredPatientsTest extends iTrustSeleniumTest {
private WebDriver driver;
private StringBuffer verificationErrors = new StringBuffer();
@Before
public void setUp() throws Exception {
super.setUp();
gen.standardData();
gen.patient92();
driver = new HtmlUnitDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testViewAllPreregisteredPatients() throws Exception {
// This logs us into iTrust and returns the HtmlUnitDriver for use in
// this case
HtmlUnitDriver driver = (HtmlUnitDriver)login("9000000000", "pw");
// Make sure we were able to log in
assertEquals("iTrust - HCP Home", driver.getTitle());
driver.findElement(By.cssSelector("h2.panel-title")).click();
driver.findElement(By.linkText("View Pre-Registered Patients")).click();
String text = driver.findElement(By.cssSelector("table.fTable")).getText();
// Make sure the preregistered patients are shown in the list
assertTrue("Text not found!", text.contains("Brittany Franco"));
assertTrue("Text not found!", text.contains("1333 Who Cares Road Suite 102"));
assertTrue("Text not found!", text.contains("Raleigh NC"));
assertTrue("Text not found!", text.contains("brfranco@gmail.com"));
}
@After
public void tearDown() throws Exception {
driver.quit();
String verificationErrorString = verificationErrors.toString();
if (!"".equals(verificationErrorString)) {
fail(verificationErrorString);
}
}
}
package edu.ncsu.csc.itrust.unit.action;
import edu.ncsu.csc.itrust.action.EditPatientAction;
import edu.ncsu.csc.itrust.dao.mysql.PatientDAO;
import edu.ncsu.csc.itrust.unit.datagenerators.TestDataGenerator;
import edu.ncsu.csc.itrust.unit.testutils.TestDAOFactory;
import junit.framework.TestCase;
public class ActivatePatientActionTest extends TestCase {
private TestDataGenerator gen = new TestDataGenerator();
private PatientDAO patientDAO = TestDAOFactory.getTestInstance().getPatientDAO();
@Override
protected void setUp() throws Exception {
gen.clearAllTables();
gen.patient92();
gen.patient4();
}
public void testActivateAlreadyActivated() throws Exception {
long pid = 4;
assertEquals("patient", patientDAO.getRole(pid));
EditPatientAction action = new EditPatientAction(TestDAOFactory.getTestInstance(), pid, Long.toString(pid));
action.activate();
assertEquals("patient", patientDAO.getRole(pid));
assertEquals("", patientDAO.getPatient(pid).getDateOfDeactivationStr());
}
public void testActivatePreregisteredPatient() throws Exception {
long pid = 92;
assertEquals("preRegisteredPatient", patientDAO.getRole(pid));
EditPatientAction action = new EditPatientAction(TestDAOFactory.getTestInstance(), pid, Long.toString(pid));
action.activate();
assertEquals("patient", patientDAO.getRole(pid));
assertEquals("", patientDAO.getPatient(pid).getDateOfDeactivationStr());
}
}
package edu.ncsu.csc.itrust.unit.action;
import edu.ncsu.csc.itrust.action.EditPatientAction;
import edu.ncsu.csc.itrust.dao.mysql.PatientDAO;
import edu.ncsu.csc.itrust.unit.datagenerators.TestDataGenerator;
import edu.ncsu.csc.itrust.unit.testutils.TestDAOFactory;
import junit.framework.TestCase;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class DeactivatePatientActionTest extends TestCase {
private TestDataGenerator gen = new TestDataGenerator();
private PatientDAO patientDAO = TestDAOFactory.getTestInstance().getPatientDAO();
@Override
protected void setUp() throws Exception {
gen.clearAllTables();
gen.patient92();
gen.patient4();
}
public void testDeactivateActivatedPatient() throws Exception {
long pid = 4;
assertEquals("patient", patientDAO.getRole(pid));
EditPatientAction action = new EditPatientAction(TestDAOFactory.getTestInstance(), pid, Long.toString(pid));
action.deactivate();
assertEquals("deactivatedPatient", patientDAO.getRole(pid));
assertEquals(new SimpleDateFormat("MM/dd/yyyy").format(Calendar.getInstance().getTime()), patientDAO.getPatient(pid).getDateOfDeactivationStr());
}
public void testDeactivatePreregisteredPatient() throws Exception {
long pid = 92;
assertEquals("preRegisteredPatient", patientDAO.getRole(pid));
EditPatientAction action = new EditPatientAction(TestDAOFactory.getTestInstance(), pid, Long.toString(pid));
action.deactivate();
assertEquals("deactivatedPatient", patientDAO.getRole(pid));
assertEquals(new SimpleDateFormat("MM/dd/yyyy").format(Calendar.getInstance().getTime()), patientDAO.getPatient(pid).getDateOfDeactivationStr());
}
}
package edu.ncsu.csc.itrust.unit.action;
import junit.framework.TestCase;
import edu.ncsu.csc.itrust.action.ViewPreRegisteredPatientListAction;
import edu.ncsu.csc.itrust.beans.PatientBean;
import edu.ncsu.csc.itrust.dao.DAOFactory;
import edu.ncsu.csc.itrust.unit.datagenerators.TestDataGenerator;
import edu.ncsu.csc.itrust.unit.testutils.TestDAOFactory;
import java.util.List;
public class ViewPreRegisteredPatientListActionTest extends TestCase {
private DAOFactory factory = TestDAOFactory.getTestInstance();
private ViewPreRegisteredPatientListAction action;
private TestDataGenerator gen;
@Override
protected void setUp() throws Exception {
gen = new TestDataGenerator();
gen.clearAllTables();
}
public void testViewPatients() throws Exception {
long hcpMID = 900000000;
action = new ViewPreRegisteredPatientListAction(factory, hcpMID);
List<PatientBean> pb = action.getPreRegisteredPatients();
assertEquals(0, pb.size());
pb = action.getPreRegisteredPatients();
assertEquals(0, pb.size());
}
public void testNoPersonnel() throws Exception {
long hcpMID = 900000000;
action = new ViewPreRegisteredPatientListAction(factory, hcpMID);
List<PatientBean> pb = action.getPreRegisteredPatients();
for (PatientBean p : pb) {
if (p.getMID() == 90000000) {
fail("This id should not exist in the list");
}
}
return;
}
}
package edu.ncsu.csc.itrust.unit.dao.patient;
import junit.framework.TestCase;
import edu.ncsu.csc.itrust.dao.mysql.PatientDAO;
import edu.ncsu.csc.itrust.unit.datagenerators.TestDataGenerator;
import edu.ncsu.csc.itrust.unit.testutils.TestDAOFactory;
import edu.ncsu.csc.itrust.action.EditPatientAction;
public class ActivatePatientTest extends TestCase {
private TestDataGenerator gen = new TestDataGenerator();
private PatientDAO patientDAO = TestDAOFactory.getTestInstance().getPatientDAO();
@Override
protected void setUp() throws Exception {
gen.clearAllTables();
gen.patient92();
gen.patient4();
}
public void testActivateNewPatient() throws Exception {
long pid = 92;
assertEquals("preRegisteredPatient", patientDAO.getRole(pid));
patientDAO.ConvertPreRegisteredPatientsToPatient(pid);
assertEquals("patient", patientDAO.getRole(pid));
}
public void testActivateActionPatient() throws Exception {
long pid = 92;
assertEquals("preRegisteredPatient", patientDAO.getRole(pid));
EditPatientAction action = new EditPatientAction(TestDAOFactory.getTestInstance(), pid, Long.toString(pid));
action.activate();
assertEquals("patient", patientDAO.getRole(pid));
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment