|
@@ -35,12 +35,12 @@ $medications = $points;
|
|
|
<th class="border-bottom-0 text-secondary text-center width-30px">Rel.</th>
|
|
|
@endif
|
|
|
<th class="border-bottom-0 text-secondary">Name</th>
|
|
|
- <th class="border-bottom-0 text-secondary w-25">Directions</th>
|
|
|
+ <th class="border-bottom-0 text-secondary w-25">Plan</th>
|
|
|
<th class="border-bottom-0 text-secondary">Active?</th>
|
|
|
<th class="border-bottom-0 text-secondary">Edit</th>
|
|
|
<th class="border-bottom-0 text-secondary">Started</th>
|
|
|
<th class="border-bottom-0 text-secondary">Ended</th>
|
|
|
- <th class="border-bottom-0 text-secondary w-25">Last Review</th>
|
|
|
+ <th class="border-bottom-0 text-secondary w-25">Review</th>
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<?php $prevRowRemoved = -1; ?>
|
|
@@ -146,9 +146,9 @@ $medications = $points;
|
|
|
<input type="hidden" name="noteUid" value="<?= $note->uid ?>">
|
|
|
<p class="mb-2"><b>Update Medication</b></p>
|
|
|
|
|
|
- @if($medication->added_in_note_id === $note->id)
|
|
|
+ <input type="hidden" name="data" value='{{json_encode($medication->data)}}'>
|
|
|
|
|
|
- <input type="hidden" name="data">
|
|
|
+ @if($medication->added_in_note_id === $note->id)
|
|
|
|
|
|
<input type="hidden" data-name="medId" value="{{@$medication->data->medId}}">
|
|
|
<input type="hidden" data-name="routedMedId" value="{{@$medication->data->routedMedId}}">
|
|
@@ -164,28 +164,6 @@ $medications = $points;
|
|
|
stag-suggest-ep="/fdb-med-suggest-v2/json">
|
|
|
</div>
|
|
|
|
|
|
- <div class="row mb-2">
|
|
|
- <div class="col-6 pr-0">
|
|
|
- <label class="text-sm mb-0">Start Date</label>
|
|
|
- <input type="date"
|
|
|
- data-name="start_date"
|
|
|
- value="{{@$medication->data->start_date}}"
|
|
|
- class="form-control form-control-sm min-width-unset">
|
|
|
- </div>
|
|
|
- <div class="col-6">
|
|
|
- <label class="text-sm mb-0">Prescribed By</label>
|
|
|
- <input type="text"
|
|
|
- data-name="prescriber"
|
|
|
- value="{{@$medication->data->prescriber}}"
|
|
|
- class="form-control form-control-sm min-width-unset">
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <!--<div class="mb-2">
|
|
|
- <label class="text-sm mb-1">Description</label>
|
|
|
- <textarea rows="1" data-name="description" class="form-control form-control-sm">{{@$medication->data->description}}</textarea>
|
|
|
- </div>-->
|
|
|
-
|
|
|
@else
|
|
|
|
|
|
<div class="mb-2 bg-light p-2 border">
|
|
@@ -201,70 +179,7 @@ $medications = $points;
|
|
|
|
|
|
@endif
|
|
|
|
|
|
- <hr class="my-3">
|
|
|
-
|
|
|
- <div class="row mb-2">
|
|
|
- <div class="col-4 pr-0">
|
|
|
- <label class="text-sm mb-0">When Added</label>
|
|
|
- <select class="form-control form-control-sm min-width-unset" name="additionReasonCategory" required>
|
|
|
- <option value="">-- select --</option>
|
|
|
- <option value="ON_INTAKE" {{$medication->addition_reason_category === 'ON_INTAKE' ? 'selected' : ''}}>On Intake</option>
|
|
|
- <option value="DURING_VISIT" {{$medication->addition_reason_category === 'DURING_VISIT' ? 'selected' : ''}}>During Visit</option>
|
|
|
- </select>
|
|
|
- </div>
|
|
|
- <div class="col-8">
|
|
|
- <label class="text-sm mb-0 min-width-unset">Addition Memo</label>
|
|
|
- <input type="text"
|
|
|
- name="additionReasonMemo"
|
|
|
- value="{{$medication->addition_reason_memo}}"
|
|
|
- class="form-control form-control-sm min-width-unset">
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <hr class="my-3">
|
|
|
-
|
|
|
- <div class="row mb-2">
|
|
|
- <div class="col-6 pr-0">
|
|
|
- <label class="text-sm mb-0 min-width-unset">Is medication active?</label>
|
|
|
- <select class="form-control form-control-sm min-width-unset" name="isRemoved" required>
|
|
|
- <option value="">-- select --</option>
|
|
|
- <option value="0" {{!$medication->is_removed ? 'selected' : ''}}>Yes</option>
|
|
|
- <option value="1" {{$medication->is_removed ? 'selected' : ''}}>No</option>
|
|
|
- </select>
|
|
|
- </div>
|
|
|
- <div class="col-6 is_removed_ui_1" style="display: none">
|
|
|
- <label class="text-sm mb-0 min-width-unset">Is entry error?</label>
|
|
|
- <select class="form-control form-control-sm min-width-unset" name="isRemovedDueToEntryError">
|
|
|
- <option value="1" {{$medication->is_removed_due_to_entry_error ? 'selected' : ''}}>Yes</option>
|
|
|
- <option value="0" {{!$medication->is_removed_due_to_entry_error ? 'selected' : ''}}>No</option>
|
|
|
- </select>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="row mb-2 is_removed_ui_2" style="display: none">
|
|
|
- <div class="col-4 pr-0">
|
|
|
- <label class="text-sm mb-0 min-width-unset">When Removed</label>
|
|
|
- <select class="form-control form-control-sm min-width-unset" name="removalReasonCategory">
|
|
|
- <option value="">-- select --</option>
|
|
|
- <option value="ON_INTAKE" {{$medication->removal_reason_category === 'ON_INTAKE' ? 'selected' : ''}}>On Intake</option>
|
|
|
- <option value="DURING_VISIT" {{$medication->removal_reason_category === 'DURING_VISIT' ? 'selected' : ''}}>During Visit</option>
|
|
|
- </select>
|
|
|
- </div>
|
|
|
- <div class="col-4 pr-0">
|
|
|
- <label class="text-sm mb-0 min-width-unset">End Date</label>
|
|
|
- <input type="date"
|
|
|
- name="removalEffectiveDate"
|
|
|
- value="{{$medication->removal_effective_date ? $medication->removal_effective_date : ''}}"
|
|
|
- class="form-control form-control-sm min-width-unset">
|
|
|
- </div>
|
|
|
- <div class="col-4">
|
|
|
- <label class="text-sm mb-0 min-width-unset">Removal By/Memo</label>
|
|
|
- <input type="text"
|
|
|
- name="removalReasonMemo"
|
|
|
- value="{{$medication->removal_reason_memo}}"
|
|
|
- class="form-control form-control-sm min-width-unset">
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ @include('app.patient.wizard-partials.common-fields', ['label' => 'medication', 'point' => $medication])
|
|
|
|
|
|
<div class="mt-3 pt-2 d-flex align-items-center border-top">
|
|
|
<button type="submit" class="btn-save-medication btn btn-sm btn-primary mr-2">Save</button>
|
|
@@ -329,11 +244,13 @@ $medications = $points;
|
|
|
<input type="hidden" data-name="routedDosageFormMedId">
|
|
|
<input type="hidden" data-name="gcnSeqno">
|
|
|
|
|
|
+ <input type="hidden" name="isRemovedDueToEntryError" value="0">
|
|
|
+
|
|
|
<div class="row">
|
|
|
<div class="col-7">
|
|
|
<p class="mb-2"><b>Add Medication</b></p>
|
|
|
<div class="mb-2">
|
|
|
- <label class="text-sm mb-0">Name</label>
|
|
|
+ <label class="mb-0">Name</label>
|
|
|
<input type="text"
|
|
|
data-name="name"
|
|
|
class="form-control form-control-sm"
|
|
@@ -342,88 +259,10 @@ $medications = $points;
|
|
|
stag-suggest-ep="/fdb-med-suggest-v2/json"
|
|
|
required>
|
|
|
</div>
|
|
|
- <div class="row mb-2">
|
|
|
- <div class="col-6 pr-0">
|
|
|
- <label class="text-sm mb-0">Start Date</label>
|
|
|
- <input type="date"
|
|
|
- data-name="start_date"
|
|
|
- class="form-control form-control-sm min-width-unset">
|
|
|
- </div>
|
|
|
- <div class="col-6">
|
|
|
- <label class="text-sm mb-0">Prescribed By</label>
|
|
|
- <input type="text"
|
|
|
- data-name="prescriber"
|
|
|
- class="form-control form-control-sm min-width-unset">
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <!--<div class="mb-2">
|
|
|
- <label class="text-sm mb-1">Description</label>
|
|
|
- <textarea rows="1" data-name="description" class="form-control form-control-sm"></textarea>
|
|
|
- </div>-->
|
|
|
-
|
|
|
- @if($patient->core_note_id !== $note->id)
|
|
|
- <div class="mb-2">
|
|
|
- <label class="text-sm mb-1">Directions</label>
|
|
|
- <div note-rte
|
|
|
- class="form-group mb-2 border-left border-right rte-holder bg-white"
|
|
|
- data-field-name="value"></div>
|
|
|
- </div>
|
|
|
- @endif
|
|
|
|
|
|
- <hr class="my-3">
|
|
|
+ <?php $point = null; ?>
|
|
|
+ @include('app.patient.wizard-partials.common-fields', ['label' => 'medication'])
|
|
|
|
|
|
- <div class="row mb-2">
|
|
|
- <div class="col-4 pr-0">
|
|
|
- <label class="text-sm mb-0">When Added</label>
|
|
|
- <select class="form-control form-control-sm min-width-unset" name="additionReasonCategory" required>
|
|
|
- <option value="">-- select --</option>
|
|
|
- <option value="ON_INTAKE">On Intake</option>
|
|
|
- <option value="DURING_VISIT">During Visit</option>
|
|
|
- </select>
|
|
|
- </div>
|
|
|
- <div class="col-8">
|
|
|
- <label class="text-sm mb-0 min-width-unset">Addition Memo</label>
|
|
|
- <input type="text"
|
|
|
- name="additionReasonMemo"
|
|
|
- class="form-control form-control-sm min-width-unset">
|
|
|
- </div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <hr class="my-3">
|
|
|
-
|
|
|
- <div class="row mb-2">
|
|
|
- <div class="col-6 pr-0">
|
|
|
- <label class="text-sm mb-0 min-width-unset">Is medication active?</label>
|
|
|
- <select class="form-control form-control-sm min-width-unset" name="isRemoved" required>
|
|
|
- <option value="0" selected>Yes</option>
|
|
|
- <option value="1">No</option>
|
|
|
- </select>
|
|
|
- </div>
|
|
|
- <input type="hidden" name="isRemovedDueToEntryError" value="0">
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="row mb-2 is_removed_ui_2" style="display: none">
|
|
|
- <div class="col-4 pr-0">
|
|
|
- <label class="text-sm mb-0 min-width-unset">When Removed</label>
|
|
|
- <select class="form-control form-control-sm min-width-unset" name="removalReasonCategory">
|
|
|
- <option value="">-- select --</option>
|
|
|
- <option value="ON_INTAKE">On Intake</option>
|
|
|
- <option value="DURING_VISIT">During Visit</option>
|
|
|
- </select>
|
|
|
- </div>
|
|
|
- <div class="col-4 pr-0">
|
|
|
- <label class="text-sm mb-0 min-width-unset">End Date</label>
|
|
|
- <input type="date"
|
|
|
- name="removalEffectiveDate"
|
|
|
- class="form-control form-control-sm min-width-unset">
|
|
|
- </div>
|
|
|
- <div class="col-4">
|
|
|
- <label class="text-sm mb-0 min-width-unset">Removal By/Memo</label>
|
|
|
- <input type="text"
|
|
|
- name="removalReasonMemo"
|
|
|
- class="form-control form-control-sm min-width-unset">
|
|
|
- </div>
|
|
|
- </div>
|
|
|
</div>
|
|
|
<div class="col-5 border-left">
|
|
|
<div class="fdb-rx-vigilance max-height-400px overflow-auto">
|
|
@@ -484,7 +323,21 @@ $medications = $points;
|
|
|
if(!pElem.length) {
|
|
|
pElem = $(el).closest('form');
|
|
|
}
|
|
|
- pElem.find('input[name=data]').val(dataValue);
|
|
|
+ let v = pElem.find('input[name=data]').val();
|
|
|
+ if(!!v) {
|
|
|
+ try {
|
|
|
+ v = JSON.parse(v);
|
|
|
+ v[fieldName] = content;
|
|
|
+ v = JSON.stringify(v);
|
|
|
+ }
|
|
|
+ catch (e) {
|
|
|
+ v = JSON.stringify(dataObject);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ v = JSON.stringify(dataObject);
|
|
|
+ }
|
|
|
+ pElem.find('input[name=data]').val(v);
|
|
|
};
|
|
|
|
|
|
quill.on('text-change', onTextChange);
|
|
@@ -524,232 +377,7 @@ $medications = $points;
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
- parentSegment.find('.additionReasonCategory_ui')
|
|
|
- .off('change')
|
|
|
- .on('change', function() {
|
|
|
-
|
|
|
- let form = $(this).closest('form');
|
|
|
-
|
|
|
- // additionReasonCategory
|
|
|
- // isRemoved
|
|
|
- // removalReasonCategory
|
|
|
- form.find('[name="isRemovedDueToEntryError"]').val('0');
|
|
|
-
|
|
|
- form.find('.start_date_ui').hide();
|
|
|
- form.find('.prescriber_ui').hide();
|
|
|
- form.find('.removalEffectiveDate_ui').hide();
|
|
|
- form.find('.removalReasonMemo_ui').hide();
|
|
|
-
|
|
|
- if(this.value === 'HISTORIC') {
|
|
|
- form.find('[name="additionReasonCategory"]').val('ON_INTAKE');
|
|
|
- form.find('[name="isRemoved"]').val('1');
|
|
|
- form.find('.start_date_ui').show();
|
|
|
- form.find('.prescriber_ui').show();
|
|
|
- form.find('.removalEffectiveDate_ui').show();
|
|
|
- form.find('.removalReasonMemo_ui').show();
|
|
|
- }
|
|
|
- else if(this.value === 'PRE_EXISTING') {
|
|
|
- form.find('[name="additionReasonCategory"]').val('ON_INTAKE');
|
|
|
- form.find('[name="isRemoved"]').val('0');
|
|
|
- form.find('.start_date_ui').show();
|
|
|
- form.find('.prescriber_ui').show();
|
|
|
- }
|
|
|
- else if(this.value === 'NEW') {
|
|
|
- form.find('[name="additionReasonCategory"]').val('DURING_VISIT');
|
|
|
- form.find('[name="isRemoved"]').val('0');
|
|
|
- form.find('.start_date_ui').show().find('input').val('{{date('Y-m-d')}}');
|
|
|
- form.find('.prescriber_ui').show().find('input').val('{{$note->hcpPro->displayName()}}');
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
-
|
|
|
- parentSegment.find('[name="isRemoved"], [name="isRemovedDueToEntryError"]')
|
|
|
- .off('change')
|
|
|
- .on('change', function () {
|
|
|
- let form = $(this).closest('form');
|
|
|
-
|
|
|
- form.find('.is_removed_ui_1').hide();
|
|
|
- if(form.find('[name="isRemoved"]').val() === '1') {
|
|
|
- form.find('.is_removed_ui_1').show();
|
|
|
- }
|
|
|
-
|
|
|
- form.find('.is_removed_ui_2').hide();
|
|
|
- if(form.find('[name="isRemoved"]').val() === '1' && form.find('[name="isRemovedDueToEntryError"]').val() !== '1') {
|
|
|
- form.find('.is_removed_ui_2').show();
|
|
|
- }
|
|
|
- return false;
|
|
|
- });
|
|
|
-
|
|
|
- parentSegment.find('#frm-add-medication')
|
|
|
- .off('submit')
|
|
|
- .on('submit', function () {
|
|
|
-
|
|
|
- let form = $(this);
|
|
|
-
|
|
|
- if (!form[0].checkValidity()) {
|
|
|
- form[0].reportValidity();
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- // add [data-name] values to payload
|
|
|
- let dataField = form.find('[name="data"]').first();
|
|
|
- let parsed = null;
|
|
|
- if(dataField.val()) {
|
|
|
- parsed = JSON.parse(dataField.val());
|
|
|
- }
|
|
|
-
|
|
|
- @if($patient->core_note_id !== $note->id)
|
|
|
- // store plan content
|
|
|
- let planContent = parsed.value ? parsed.value : '';
|
|
|
- if(!$.trim($('<div/>').html(planContent).text())) {
|
|
|
- toastr.error('Directions cannot be empty');
|
|
|
- return false;
|
|
|
- }
|
|
|
- if(parsed.value) delete parsed.value;
|
|
|
- @endif
|
|
|
-
|
|
|
- form.find('[data-name]').each(function() {
|
|
|
- if(!parsed) parsed = {};
|
|
|
-
|
|
|
- let keys = $(this).attr('data-name').split('->');
|
|
|
- let currentNode = parsed;
|
|
|
- for (let i = 0; i < keys.length; i++) {
|
|
|
- if(i !== keys.length - 1) {
|
|
|
- if(typeof currentNode[keys[i]] === 'undefined') {
|
|
|
- currentNode[keys[i]] = {};
|
|
|
- }
|
|
|
- currentNode = currentNode[keys[i]];
|
|
|
- }
|
|
|
- else {
|
|
|
- if($(this).is(':checkbox')) {
|
|
|
- currentNode[keys[i]] = $(this).prop('checked');
|
|
|
- }
|
|
|
- else {
|
|
|
- currentNode[keys[i]] = $(this).val();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
- if(parsed) {
|
|
|
- dataField.val(JSON.stringify(parsed));
|
|
|
- }
|
|
|
-
|
|
|
- $.post(form.attr('action'), form.serialize(), _data => {
|
|
|
- if(!hasResponseError(_data)) {
|
|
|
-
|
|
|
- hideMask();
|
|
|
-
|
|
|
- // save child plan
|
|
|
- @if($patient->core_note_id !== $note->id)
|
|
|
- debugger
|
|
|
- $.post('/api/visitPoint/upsertChildPlan', {
|
|
|
- uid: _data.data,
|
|
|
- segmentUid: '{{$note->getSegmentByInternalName('plan_medications')->uid}}',
|
|
|
- data: JSON.stringify({value: planContent})
|
|
|
- }, _data => {
|
|
|
- if(!hasResponseError(_data)) {
|
|
|
- refreshDynamicStagPopup();
|
|
|
- }
|
|
|
- }, 'json');
|
|
|
- @else
|
|
|
- refreshDynamicStagPopup();
|
|
|
- @endif
|
|
|
-
|
|
|
- $('.visit-segment[data-segment-template-name="intake_medications"]').find('.refresh-segment').trigger('click');
|
|
|
- }
|
|
|
- }, 'json');
|
|
|
- return false;
|
|
|
- });
|
|
|
-
|
|
|
- parentSegment.find('.frm-edit-medication')
|
|
|
- .off('submit')
|
|
|
- .on('submit', function () {
|
|
|
-
|
|
|
- let form = $(this);
|
|
|
-
|
|
|
- if (!form[0].checkValidity()) {
|
|
|
- form[0].reportValidity();
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- // add [data-name] values to payload
|
|
|
- let dataField = form.find('[name="data"]').first();
|
|
|
- let parsed = null;
|
|
|
- if(dataField.val()) {
|
|
|
- parsed = JSON.parse(dataField.val());
|
|
|
- }
|
|
|
- form.find('[data-name]').each(function() {
|
|
|
- if(!parsed) parsed = {};
|
|
|
-
|
|
|
- let keys = $(this).attr('data-name').split('->');
|
|
|
- let currentNode = parsed;
|
|
|
- for (let i = 0; i < keys.length; i++) {
|
|
|
- if(i !== keys.length - 1) {
|
|
|
- if(typeof currentNode[keys[i]] === 'undefined') {
|
|
|
- currentNode[keys[i]] = {};
|
|
|
- }
|
|
|
- currentNode = currentNode[keys[i]];
|
|
|
- }
|
|
|
- else {
|
|
|
- if($(this).is(':checkbox')) {
|
|
|
- currentNode[keys[i]] = $(this).prop('checked');
|
|
|
- }
|
|
|
- else {
|
|
|
- currentNode[keys[i]] = $(this).val();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
- if(parsed) {
|
|
|
- dataField.val(JSON.stringify(parsed));
|
|
|
- }
|
|
|
-
|
|
|
- $.post(form.attr('url'), form.serialize(), _data => {
|
|
|
- if(!hasResponseError(_data)) {
|
|
|
- hideMask();
|
|
|
- refreshDynamicStagPopup();
|
|
|
- $('.visit-segment[data-segment-template-name="intake_medications"]').find('.refresh-segment').trigger('click');
|
|
|
- }
|
|
|
- }, 'json');
|
|
|
- return false;
|
|
|
- });
|
|
|
-
|
|
|
- parentSegment.find('.toggle-relevance')
|
|
|
- .off('click.toggle-relevance')
|
|
|
- .on('click.toggle-relevance', function () {
|
|
|
- if(+$(this).attr('data-relevant') === 0) {
|
|
|
- $.post('/api/visitPoint/markPointRelevantToNote', {
|
|
|
- noteUid: '{{$note->uid}}',
|
|
|
- pointUid: $(this).attr('data-point-uid')
|
|
|
- }, _data => {
|
|
|
- if(!hasResponseError(_data)) {
|
|
|
- refreshDynamicStagPopup();
|
|
|
- }
|
|
|
- }, 'json');
|
|
|
- }
|
|
|
- else {
|
|
|
- if($(this).attr('data-rel-uid')) {
|
|
|
- $.post('/api/visitPoint/undoMarkPointRelevantToNote', {
|
|
|
- uid: $(this).attr('data-rel-uid')
|
|
|
- }, _data => {
|
|
|
- if(!hasResponseError(_data)) {
|
|
|
- refreshDynamicStagPopup();
|
|
|
- }
|
|
|
- }, 'json');
|
|
|
- }
|
|
|
- else {
|
|
|
- console.log('Error - missing rel uid');
|
|
|
- }
|
|
|
- }
|
|
|
- return false;
|
|
|
- });
|
|
|
-
|
|
|
- initStagSuggest();
|
|
|
-
|
|
|
- parentSegment.find('.additionReasonCategory_ui').trigger('change');
|
|
|
- parentSegment.find('[name="isRemoved"]').trigger('change');
|
|
|
+ @include('app.patient.wizard-partials.common-script', ['label' => 'medication', 'point' => $medication])
|
|
|
|
|
|
// custom buttons on title bar
|
|
|
$('.button-container').remove();
|