|
@@ -29,9 +29,9 @@ $medications = Point::getIntakePointsOfCategory($patient, 'MEDICATION', $note);
|
|
|
<div class="d-flex align-items-baseline">
|
|
|
<div class="<?= $medication->is_removed ? 'strike-through' : '' ?>">
|
|
|
<b><?= !!@($medication->data->name) ? @($medication->data->name) : '-' ?></b>
|
|
|
- <?= !!@($medication->data->dose) ? '/ ' . @($medication->data->dose) : '' ?>
|
|
|
<?= !!@($medication->data->route) ? '/ ' . @($medication->data->route) : '' ?>
|
|
|
- <?= !!@($medication->data->frequency) ? '/ ' . @($medication->data->frequency) : '' ?>
|
|
|
+ <?= !!@($medication->data->dose) ? '/ ' . @($medication->data->dose) : '' ?>
|
|
|
+ <?= !!@($medication->data->strength) ? '/ ' . @($medication->data->strength) : '' ?>
|
|
|
</div>
|
|
|
|
|
|
<!-- common actions -->
|
|
@@ -61,30 +61,49 @@ $medications = Point::getIntakePointsOfCategory($patient, 'MEDICATION', $note);
|
|
|
</table>
|
|
|
</div>
|
|
|
|
|
|
- <div visit-moe class="mt-1">
|
|
|
+ <div visit-moe large class="mt-1">
|
|
|
<a href="#" start show class="btn btn-sm btn btn-outline-primary">+ Add medication patient is ALREADY taking, prior to this visit</a>
|
|
|
<form url="/api/visitPoint/addTopLevelOnIntake" class="mcp-theme-1">
|
|
|
<input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
|
|
|
<input type="hidden" name="category" value="MEDICATION">
|
|
|
<input type="hidden" name="data">
|
|
|
|
|
|
+ <input type="hidden" data-name="medNameId">
|
|
|
+ <input type="hidden" data-name="route">
|
|
|
+ <input type="hidden" data-name="dose">
|
|
|
+ <input type="hidden" data-name="strength">
|
|
|
+ <input type="hidden" data-name="medId">
|
|
|
+
|
|
|
<p class="mb-2"><b>Add Medication (on intake)</b></p>
|
|
|
|
|
|
<div class="mb-2">
|
|
|
<label class="text-sm text-secondary mb-1">Name</label>
|
|
|
- <input type="text" data-name="name" class="form-control form-control-sm">
|
|
|
+ <input type="text"
|
|
|
+ data-name="name"
|
|
|
+ class="form-control form-control-sm"
|
|
|
+ stag-suggest
|
|
|
+ stag-suggest-ep="/fdb-med-suggest/json">
|
|
|
</div>
|
|
|
<div class="mb-2">
|
|
|
- <label class="text-sm text-secondary mb-1">Dose</label>
|
|
|
- <input type="text" data-name="dose" class="form-control form-control-sm">
|
|
|
+ <label class="text-sm text-secondary mb-1">Route</label>
|
|
|
+ <select data-name="routedMedId"
|
|
|
+ class="form-control form-control-sm"
|
|
|
+ disabled>
|
|
|
+ </select>
|
|
|
</div>
|
|
|
<div class="mb-2">
|
|
|
- <label class="text-sm text-secondary mb-1">Route</label>
|
|
|
- <input type="text" data-name="route" class="form-control form-control-sm">
|
|
|
+ <label class="text-sm text-secondary mb-1">Dosage</label>
|
|
|
+ <select data-name="routedDosageFormMedId"
|
|
|
+ class="form-control form-control-sm"
|
|
|
+ disabled>
|
|
|
+ </select>
|
|
|
</div>
|
|
|
<div class="mb-2">
|
|
|
- <label class="text-sm text-secondary mb-1">Frequency</label>
|
|
|
- <input type="text" data-name="frequency" class="form-control form-control-sm">
|
|
|
+ <label class="text-sm text-secondary mb-1">Strength</label>
|
|
|
+ <select data-name="gcnSeqno"
|
|
|
+ class="form-control form-control-sm"
|
|
|
+ disabled>
|
|
|
+ </select>
|
|
|
</div>
|
|
|
<div class="mb-2">
|
|
|
<label class="text-sm text-secondary mb-1">Description</label>
|
|
@@ -99,3 +118,97 @@ $medications = Point::getIntakePointsOfCategory($patient, 'MEDICATION', $note);
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
+
|
|
|
+<script>
|
|
|
+ window.segmentInitializers.<?= $segment->segmentTemplate->internal_name ?> = function() {
|
|
|
+ // any JS can come here
|
|
|
+ // will be run on page-load as well as whenever this segment is refreshed
|
|
|
+
|
|
|
+ $('input[stag-suggest][data-name="name"]')
|
|
|
+ .off('stag-suggest-selected')
|
|
|
+ .on('stag-suggest-selected', (_e, _input, _data) => {
|
|
|
+
|
|
|
+ // _input is the textbox
|
|
|
+ // _data is {med_name_id: "50567", text: "Children's Tylenol"}
|
|
|
+
|
|
|
+ let medNameID = _data.med_name_id;
|
|
|
+ $('input[data-name="medNameId"]').val(medNameID);
|
|
|
+
|
|
|
+ let routeSelect = $('[data-name="routedMedId"]').empty().prop('disabled', true);
|
|
|
+ let dosageSelect = $('[data-name="routedDosageFormMedId"]').empty().prop('disabled', true);
|
|
|
+ let strengthSelect = $('[data-name="gcnSeqno"]').empty().prop('disabled', true);
|
|
|
+
|
|
|
+ $.get('/fdb-routed-meds?med-name-id=' + medNameID, _data => {
|
|
|
+ routeSelect
|
|
|
+ .empty()
|
|
|
+ .append('<option value="">-- select --</option>');
|
|
|
+ for (let i = 0; i < _data.length; i++) {
|
|
|
+ routeSelect.append('<option value="' + _data[i].routed_med_id + '">' + _data[i].med_routed_med_id_desc + '</option>')
|
|
|
+ }
|
|
|
+ routeSelect.prop('disabled', false);
|
|
|
+ if(_data.length === 1) {
|
|
|
+ routeSelect.val(_data[0].routed_med_id).trigger('change');
|
|
|
+ }
|
|
|
+ }, 'json');
|
|
|
+ });
|
|
|
+
|
|
|
+ // on route selection
|
|
|
+ $(document).off('change', '[data-name="routedMedId"]');
|
|
|
+ $(document).on('change', '[data-name="routedMedId"]', function () {
|
|
|
+
|
|
|
+ // clear
|
|
|
+ let dosageSelect = $('[data-name="routedDosageFormMedId"]').empty().prop('disabled', true);
|
|
|
+ let strengthSelect = $('[data-name="gcnSeqno"]').empty().prop('disabled', true);
|
|
|
+ let routedMedID = $(this).val();
|
|
|
+ $('input[data-name="route"]').val($(this).find('option:selected').text());
|
|
|
+
|
|
|
+ $.get('/fdb-routed-dosages?routed-med-id=' + routedMedID, _data => {
|
|
|
+ dosageSelect
|
|
|
+ .empty()
|
|
|
+ .append('<option value="">-- select --</option>');
|
|
|
+ for (let i = 0; i < _data.length; i++) {
|
|
|
+ dosageSelect.append('<option value="' + _data[i].routed_dosage_form_med_id + '">' + _data[i].med_routed_df_med_id_desc + '</option>')
|
|
|
+ }
|
|
|
+ dosageSelect.prop('disabled', false);
|
|
|
+ if(_data.length === 1) {
|
|
|
+ dosageSelect.val(_data[0].routed_dosage_form_med_id).trigger('change');
|
|
|
+ }
|
|
|
+ }, 'json');
|
|
|
+ });
|
|
|
+
|
|
|
+ // on dosage selection
|
|
|
+ $(document).off('change', '[data-name="routedDosageFormMedId"]');
|
|
|
+ $(document).on('change', '[data-name="routedDosageFormMedId"]', function () {
|
|
|
+
|
|
|
+ // clear
|
|
|
+ let strengthSelect = $('[data-name="gcnSeqno"]').empty().prop('disabled', true);
|
|
|
+ let dosageFormMedID = $(this).val();
|
|
|
+ $('input[data-name="dose"]').val($(this).find('option:selected').text());
|
|
|
+
|
|
|
+ $.get('/fdb-meds?dosage-form-med-id=' + dosageFormMedID, _data => {
|
|
|
+ strengthSelect
|
|
|
+ .empty()
|
|
|
+ .append('<option value="">-- select --</option>');
|
|
|
+ for (let i = 0; i < _data.length; i++) {
|
|
|
+ strengthSelect.append('<option data-medid="' + _data[i].medid + '" value="' + _data[i].gcn_seqno + '">' + _data[i].med_medid_desc + '</option>')
|
|
|
+ }
|
|
|
+ strengthSelect.prop('disabled', false);
|
|
|
+ if(_data.length === 1) {
|
|
|
+ strengthSelect.val(_data[0].gcn_seqno).trigger('change');
|
|
|
+ $('input[data-name="description"]').focus();
|
|
|
+ }
|
|
|
+ }, 'json');
|
|
|
+ });
|
|
|
+
|
|
|
+ // on strength (medid) selection
|
|
|
+ $(document).off('change', '[data-name="gcnSeqno"]');
|
|
|
+ $(document).on('change', '[data-name="gcnSeqno"]', function () {
|
|
|
+
|
|
|
+ $('input[data-name="medId"]').val($(this).find('option:selected').attr('data-medid'));
|
|
|
+ $('input[data-name="strength"]').val($(this).find('option:selected').text());
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ };
|
|
|
+</script>
|
|
|
+
|