Show indications for restricted/authority benefits
This commit is contained in:
parent
ae8b988e26
commit
200922ec13
@ -22,6 +22,9 @@
|
||||
<title>PBS medicine search</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.2/font/bootstrap-icons.css" integrity="sha256-4RctOgogjPAdwGbwq+rxfwAmSpZhWaafcZR9btzUk18=" crossorigin="anonymous">
|
||||
<style type="text/css">
|
||||
ul { margin-top: 0.5em; margin-bottom: 0 }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-sm navbar-light bg-light d-print-none">
|
||||
@ -84,7 +87,7 @@
|
||||
|
||||
function onClickSearchItem(item) {
|
||||
// Find matching PBS items
|
||||
const stmt = db.prepare('SELECT * FROM pbs_item WHERE LOWER(mp_preferred_term) = ?');
|
||||
let stmt = db.prepare('SELECT * FROM pbs_item WHERE LOWER(mp_preferred_term) = ?');
|
||||
stmt.bind([item.label.toLowerCase()]);
|
||||
const items = execAsObjects(stmt);
|
||||
|
||||
@ -94,9 +97,33 @@
|
||||
const tbody = document.querySelector('#search-results tbody');
|
||||
tbody.innerHTML = '';
|
||||
for (let item of items) {
|
||||
// Get restrictions
|
||||
stmt = db.prepare('SELECT *, (SELECT COUNT(*) FROM pbs_restriction_criteria WHERE pbs_restriction_criteria.restriction_code = pbs_restriction.code) AS num_criteria FROM pbs_restriction LEFT JOIN pbs_item_restriction ON pbs_restriction.code = pbs_item_restriction.restriction_code WHERE pbs_item_restriction.item_code = ?');
|
||||
stmt.bind([item['code']]);
|
||||
const restrictions = execAsObjects(stmt);
|
||||
|
||||
const tr = document.createElement('tr');
|
||||
let td = document.createElement('td'); td.innerHTML = '<a href="https://www.pbs.gov.au/medicine/item/' + item['code'] + '" target="_blank">' + item['code'] + '</a>'; tr.appendChild(td);
|
||||
td = document.createElement('td'); td.innerText = item['mpp_preferred_term']; tr.appendChild(td);
|
||||
|
||||
td = document.createElement('td');
|
||||
let div = document.createElement('div'); div.innerText = item['mpp_preferred_term']; td.appendChild(div);
|
||||
if (restrictions.length > 0) {
|
||||
let ulRestrictions = document.createElement('ul');
|
||||
for (let restriction of restrictions) {
|
||||
let li = document.createElement('li');
|
||||
li.innerHTML = restriction['indication'];
|
||||
if (item['benefit_type'] === 'streamlined') {
|
||||
li.innerHTML += ' (' + restriction['treatment_of'] + ')';
|
||||
}
|
||||
if (restriction['num_criteria'] > 0) {
|
||||
li.innerHTML += ' <span class="text-muted">(' + restriction['num_criteria'] + ' criteria)</span>';
|
||||
}
|
||||
ulRestrictions.appendChild(li);
|
||||
}
|
||||
td.appendChild(ulRestrictions);
|
||||
}
|
||||
tr.appendChild(td);
|
||||
|
||||
td = document.createElement('td'); td.innerText = item['maximum_prescribable_units']; tr.appendChild(td);
|
||||
td = document.createElement('td'); td.innerText = item['number_repeats']; tr.appendChild(td);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user