Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
149 changes: 27 additions & 122 deletions src/main/webapp/oscarRx/ListDrugs.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/oscar-tag.tld" prefix="oscar" %>
<%@ taglib uri="/WEB-INF/security.tld" prefix="security" %>
<%@ taglib uri="https://www.owasp.org/index.php/OWASP_Java_Encoder_Project" prefix="e" %>
<%@ page import="ca.openosp.OscarProperties,ca.openosp.openo.log.*" %>
<%@page import="ca.openosp.openo.casemgmt.service.CaseManagementManager,
ca.openosp.openo.casemgmt.model.CaseManagementNoteLink,
Expand Down Expand Up @@ -83,107 +84,35 @@



<style>
/* Container for the drug-maintenance-switch */
.drug-maintenance-switch {
top: -2px;
position: relative;
width: 34px;
height: 16px;
}

/* Hide the default checkbox */
.drug-maintenance-switch-input {
display: none;
}

/* Style the switch track */
.drug-maintenance-switch-label {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #dfdfdf;
cursor: pointer;
transition: background-color 0.3s;
border-radius: 5%;
}

/* Style the toggle knob, default label to blank if unchecked */
.drug-maintenance-switch-label::after {
text-align: center;
content: '';
font-size: xx-small;
font-stretch: extra-expanded;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 2px;
left: 2px;
width: 12px;
height: 12px;
background-color: #FFFFFFAF;
border-radius: 50%;
transition: transform 0.3s, content 0.3s, width 0.3s, height 0.3s, border-radius 0.3s;
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
}

/* Change Label to LT (long term) when checked */
.drug-maintenance-switch-input:checked + .drug-maintenance-switch-label::after {
content: 'LT'; /* Change label when checked */
transform: translateX(14px);
border-radius: 5%;
width: 16px;
height: 12px;
color: white;
background-color: #1e7e34AF;
}

/* Disabled State Styling */
.drug-maintenance-switch-input:disabled + .drug-maintenance-switch-label {
background-color: #e0e0e0;
cursor: not-allowed;
}

/* Disabled State: Handle appearance */
.drug-maintenance-switch-input:disabled:checked + .drug-maintenance-switch-label::after {
background-color: #1e7e349F;
transform: translateX(14px);
content: 'LT';
width: 16px;
height: 12px;
border-radius: 5%;
}

.list-drugs td:nth-child(5) {
word-break: break-word;
white-space: normal;
}


</style>

<%
LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request);
SecurityManager securityManager = new SecurityManager();
PartialDateDao partialDateDao = SpringUtils.getBean(PartialDateDao.class);

boolean showall = false;
if (request.getParameter("show") != null) {
if (request.getParameter("show").equals("all")) {
showall = true;
}
}

CodingSystemManager codingSystemManager = SpringUtils.getBean(CodingSystemManager.class);

boolean integratorEnabled = loggedInInfo.getCurrentFacility().isIntegratorEnabled();
String annotation_display = CaseManagementNoteLink.DISP_PRESCRIP;

// The legend in SearchDrug3.jsp can load this page multiple times into #drugProfile —
// once as a replacement (e.g. "Long Term Meds") and one or more times as appended
// sections (e.g. "Acute", "Inactive", "External"). Each request passes a "heading"
// param that labels the section and is used to give its table a unique DOM id so that
// each section can be independently initialised as its own DataTable instance.
String heading = request.getParameter("heading");

// Remove spaces so the heading is safe to embed directly in an HTML element id.
String headingSuffix = (heading != null) ? heading.replaceAll("\\s+", "") : "";
String tableId = "Drug_table" + headingSuffix;
request.setAttribute("sectionHeading", heading);
request.setAttribute("drugTableId", tableId);
%>
<c:if test="${not empty sectionHeading}">
<h4 style="margin-bottom:1px;margin-top:10px;font-size:16px"><e:forHtml value="${sectionHeading}"/></h4>
</c:if>
<div class="drugProfileText" style="">
<table class="table table-condensed list-drugs" id="Drug_table">
<table class="table table-condensed list-drugs" id="<e:forHtmlAttribute value="${drugTableId}"/>">
<thead>
<tr>
<th>Entered Date</th>
Expand Down Expand Up @@ -216,11 +145,7 @@
List<Drug> prescriptDrugs = null;
CaseManagementManager caseManagementManager = SpringUtils.getBean(CaseManagementManager.class);

if (showall) {
prescriptDrugs = caseManagementManager.getPrescriptions(loggedInInfo, patient.getDemographicNo(), showall);
} else {
prescriptDrugs = caseManagementManager.getCurrentPrescriptions(patient.getDemographicNo());
}
prescriptDrugs = caseManagementManager.getPrescriptions(loggedInInfo, patient.getDemographicNo(), true);
Comment thread
D3V41 marked this conversation as resolved.

DrugReasonDao drugReasonDao = SpringUtils.getBean(DrugReasonDao.class);

Expand Down Expand Up @@ -252,29 +177,6 @@
isPrevAnnotation = true;
}

// if (request.getParameter("status") != null) { //TODO: Redo this in a better way
// String stat = request.getParameter("status");
// if (stat.equals("active") && !prescriptDrug.isLongTerm() && !prescriptDrug.isCurrent()) {
// continue;
// } else if (stat.equals("inactive") && prescriptDrug.isCurrent()) {
// continue;
// }
// }
// if (request.getParameter("longTermOnly") != null && request.getParameter("longTermOnly").equals("true")) {
// if (!prescriptDrug.isLongTerm()) {
// continue;
// }
// }
//
// if (request.getParameter("longTermOnly") != null && request.getParameter("longTermOnly").equals("acute")) {
// if (prescriptDrug.isLongTerm()) {
// continue;
// }
// }
// if (request.getParameter("drugLocation") != null && request.getParameter("drugLocation").equals("external")) {
// if (!prescriptDrug.isExternal())
// continue;
// }
//add all long term med drugIds to an array.
styleColor = getClassColour(prescriptDrug, now, month);
String specialText = prescriptDrug.getSpecial();
Expand All @@ -284,7 +186,10 @@

boolean startDateUnknown = prescriptDrug.getStartDateUnknown();
%>
<tr>
<tr data-is-archived="<%= prescriptDrug.isArchived() %>"
data-is-longterm="<%= prescriptDrug.isLongTerm() %>"
data-is-current="<%= prescriptDrug.isCurrent() %>"
data-is-external="<%= prescriptDrug.isExternal() %>">

<td><a id="createDate_<%=prescriptIdInt%>" <%=styleColor%> href="<%= request.getContextPath() %>/oscarRx/StaticScript2.jsp?regionalIdentifier=<%=Encode.forUriComponent(prescriptDrug.getRegionalIdentifier())%>&amp;cn=<%=Encode.forUriComponent(prescriptDrug.getCustomName())%>&amp;bn=<%=Encode.forUriComponent(bn)%>&amp;atc=<%=Encode.forUriComponent(prescriptDrug.getAtc())%>"><%=DateToString(prescriptDrug.getCreateDate())%></a></td>
<td>
Expand Down Expand Up @@ -507,16 +412,15 @@

<script type="text/javascript">

drugListTable = jQuery("#Drug_table").dataTable({
// cache the datatable state to persist through page refreshes
window.drugListTableConfig = window.drugListTableConfig || {
bStateSave: true,
fnStateSave: function (oSettings, oData) {
localStorage.setItem('drugListTable', JSON.stringify(oData));
},
fnStateLoad: function () {
return JSON.parse(localStorage.getItem('drugListTable'));
},
"searching": true,
searching: true,
// "aLengthMenu": [[25, 50, 75, -1], [25, 50, 75, "All"]],
// "iDisplayLength": 50,
columns: [
Expand Down Expand Up @@ -561,7 +465,8 @@

// order: [[4, 'desc']]

})
};
drugListTable = jQuery('#${e:forJavaScript(drugTableId)}').dataTable(window.drugListTableConfig);
</script>
<%!

Expand Down
Loading
Loading