瀏覽代碼

Rx wizard - single edit moe with delete && ee

Vijayakrishnan 3 年之前
父節點
當前提交
564ffd6532
共有 1 個文件被更改,包括 149 次插入155 次删除
  1. 149 155
      resources/views/app/patient/medications-center.blade.php

+ 149 - 155
resources/views/app/patient/medications-center.blade.php

@@ -36,7 +36,6 @@ $medications = $points;
                 <th class="border-bottom-0 text-secondary">Frequency</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">Delete</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>
@@ -53,7 +52,7 @@ $medications = $points;
             @endif
             <?php $prevRowRemoved = $medication->is_removed; ?>
             <?php $rel = $medication->relevanceToNote($note); ?>
-            <tr class="{{$medication->is_removed ? 'on-hover-opaque' : ''}}">
+            <tr class="{{$medication->is_removed ? '' : ''}}">
                 <td class="text-center">
                     <a href="#" class="toggle-relevance"
                        data-relevant="{{$rel ? '1' : '0'}}"
@@ -102,13 +101,14 @@ $medications = $points;
                     @endif
                 </td>
                 <td>
-                    @if($medication->added_in_note_id === $note->id)
-                        <div moe wide>
-                            <a start show href="#" title="Edit">Edit</a>
-                            <form url="/api/visitPoint/updateTopLevel" class="mcp-theme-1 frm-edit-medication">
-                                <input type="hidden" name="uid" value="<?= $medication->uid ?>">
-                                <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
-                                <p class="mb-2"><b>Update Medication</b></p>
+                    <div moe wide>
+                        <a start show href="#" title="Edit">Edit</a>
+                        <form url="/api/visitPoint/updateTopLevel" class="mcp-theme-1 frm-edit-medication">
+                            <input type="hidden" name="uid" value="<?= $medication->uid ?>">
+                            <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">
 
@@ -117,13 +117,8 @@ $medications = $points;
                                 <input type="hidden" data-name="routedDosageFormMedId" value="{{@$medication->data->routedDosageFormMedId}}">
                                 <input type="hidden" data-name="gcnSeqno" value="{{@$medication->data->gcnSeqno}}">
 
-                                <input type="hidden" name="additionReasonCategory" value="{{@$medication->addition_reason_category}}">
-                                <input type="hidden" name="isRemoved" value="{{@$medication->is_removed}}">
-                                <input type="hidden" name="removalReasonCategory" value="{{@$medication->removal_reason_category}}">
-                                <input type="hidden" name="isRemovedDueToEntryError" value="{{@$medication->is_removed_due_to_entry_error}}">
-
                                 <div class="mb-2">
-                                    <label class="text-sm text-secondary mb-1">Drug</label>
+                                    <label class="text-sm mb-1">Drug</label>
                                     <input type="text" class="form-control form-control-sm min-width-unset prescription-medication"
                                            data-name="name"
                                            value="{{@$medication->data->name}}"
@@ -131,161 +126,122 @@ $medications = $points;
                                            stag-suggest-ep="/fdb-med-suggest-v2/json">
                                 </div>
 
-                                <div class="mb-2">
-                                    <label class="text-sm text-secondary mb-1">Frequency</label>
-                                    <input type="text" class="form-control form-control-sm min-width-unset"
-                                           data-option-list="frequency-options" data-field="frequency"
-                                           value="{{@$medication->data->frequency}}"
-                                           data-name="frequency">
-                                    <div id="frequency-options" class="data-option-list">
-                                        <div>Once a day</div>
-                                        <div>Twice a day</div>
+                                <div class="row mb-2">
+                                    <div class="col-4 pr-0">
+                                        <label class="text-sm mb-1">Frequency</label>
+                                        <input type="text" class="form-control form-control-sm min-width-unset"
+                                               data-option-list="frequency-options" data-field="frequency"
+                                               value="{{@$medication->data->frequency}}"
+                                               data-name="frequency">
+                                        <div id="frequency-options" class="data-option-list">
+                                            <div>Once a day</div>
+                                            <div>Twice a day</div>
+                                        </div>
+                                    </div>
+                                    <div class="col-4 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-4">
+                                        <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 text-secondary mb-0">Historic / Preexisting / New</label>
-                                    <select class="form-control form-control-sm additionReasonCategory_ui" name="additionReasonCategory_ui" required>
+                                    <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">
+                                    <p class="mb-1 font-weight-bold">
+                                    {{ @$medication->data->name }} / {{ @$medication->data->frequency }}
+                                    </p>
+                                    <div class="text-secondary text-sm">Clinical details cannot be modified since the medication was added prior to this visit.</div>
+                                </div>
+
+                            @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="HISTORIC" {{$medication->addition_reason_category === 'ON_INTAKE' && $medication->is_removed ? 'selected' : ''}}>Historic</option>
-                                        <option value="PRE_EXISTING" {{$medication->addition_reason_category === 'ON_INTAKE' && !$medication->is_removed ? 'selected' : ''}}>Preexisting</option>
-                                        <option value="NEW" {{$medication->addition_reason_category === 'DURING_VISIT' ? 'selected' : ''}}>New (Prescribed during this visit)</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>
 
-                                <div class="d-flex align-items-start">
-                                    <div class="w-50 mb-2">
-                                        <div class="start_date_ui" style="display: none">
-                                            <label class="text-sm text-secondary mb-0">Start Date</label>
-                                            <input type="date"
-                                                   data-name="start_date"
-                                                   class="form-control form-control-sm min-width-unset">
-                                        </div>
-                                    </div>
-                                    <div class="w-50 pl-2 mb-2">
-                                        <div class="prescriber_ui" style="display: none">
-                                            <label class="text-sm text-secondary mb-0">Prescribed By</label>
-                                            <input type="text"
-                                                   data-name="prescriber"
-                                                   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="d-flex align-items-start">
-                                    <div class="w-50 mb-2">
-                                        <div class="removalEffectiveDate_ui" style="display: none">
-                                            <label class="text-sm text-secondary mb-0">End Date</label>
-                                            <input type="date"
-                                                   name="removalEffectiveDate"
-                                                   class="form-control form-control-sm min-width-unset">
-                                        </div>
-                                    </div>
-                                    <div class="w-50 pl-2 mb-2">
-                                        <div class="removalReasonMemo_ui" style="display: none">
-                                            <label class="text-sm text-secondary mb-0">Removal By/Memo</label>
-                                            <input type="text"
-                                                   name="removalReasonMemo"
-                                                   class="form-control form-control-sm min-width-unset">
-                                        </div>
-                                    </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="mb-2">
-                                    <label class="text-sm text-secondary mb-1">Description</label>
-                                    <textarea rows="1" data-name="description" class="form-control form-control-sm">{{@$medication->data->description}}</textarea>
+                            <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>
-                                    <button type="submit" class="btn-save-medication btn btn-sm btn-primary mr-2">Save</button>
-                                    <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                <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>
-                            </form>
-                        </div>
-                    @endif
-                </td>
-                <td>
-                    @if($medication->added_in_note_id === $note->id)
-                        <div moe class="d-block">
-                            <a start show href="#" title="Delete">Delete</a>
-                            <form url="/api/visitPoint/updateTopLevel" class="mcp-theme-1">
-                                <input type="hidden" name="uid" value="<?= $medication->uid ?>">
-                                <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
-                                <input type="hidden" name="isRemoved" value="1">
-                                <input type="hidden" name="isRemovedDueToEntryError" value="1">
-                                <input type="hidden" name="removalReasonMemo" value="Entry Error">
-                                <input type="hidden" name="removalEffectiveDate" value="<?= date('Y-m-d') ?>">
-                                <p class="mb-2"><b>Delete this medication?</b></p>
-                                <div>
-                                    <button submit class="btn btn-sm btn-danger mr-2">Delete</button>
-                                    <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                <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>
-                            </form>
-                        </div>
-                        @if(!$medication->is_removed)
-                            <div moe class="d-block">
-                                <a start show href="#" title="Discontinue">Discontinue</a>
-                                <form url="/api/visitPoint/updateTopLevel" class="mcp-theme-1">
-                                    <input type="hidden" name="uid" value="<?= $medication->uid ?>">
-                                    <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
-                                    <input type="hidden" name="isRemoved" value="1">
-                                    <input type="hidden" name="isRemovedDueToEntryError" value="0">
-                                    <input type="hidden" name="removalReasonCategory" value="DURING_VISIT">
-                                    <p class="mb-2"><b>Stop this medication?</b></p>
-                                    <div class="mb-2">
-                                        <label class="text-sm text-secondary mb-1">Removal Reason</label>
-                                        <textarea name="removalReasonMemo" class="form-control form-control-sm" rows="2"></textarea>
-                                    </div>
-                                    <div class="mb-2">
-                                        <label class="text-sm text-secondary mb-1">Removal Effective Date</label>
-                                        <input type="date" name="removalEffectiveDate"
-                                               value="<?= date('Y-m-d') ?>"
-                                               max="<?= date('Y-m-d') ?>"
-                                               class="form-control form-control-sm">
-                                    </div>
-                                    <div>
-                                        <button submit class="btn btn-sm btn-danger mr-2">Stop</button>
-                                        <button cancel class="btn btn-sm btn-default border">Cancel</button>
-                                    </div>
-                                </form>
                             </div>
-                        @endif
-                    @else
-                        @if(!$medication->is_removed)
-                            <div moe>
-                                <a start show href="#" title="Discontinue">Discontinue</a>
-                                <form url="/api/visitPoint/updateTopLevel" class="mcp-theme-1">
-                                    <input type="hidden" name="uid" value="<?= $medication->uid ?>">
-                                    <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
-                                    <input type="hidden" name="isRemoved" value="1">
-                                    <input type="hidden" name="isRemovedDueToEntryError" value="0">
-                                    <p class="mb-2"><b>Discontinue this medication?</b></p>
-                                    <div class="mb-2">
-                                        <label class="text-sm text-secondary mb-1">Already stopped / Stop now</label>
-                                        <select class="form-control form-control-sm" name="removalReasonCategory" required>
-                                            <option value="">-- select --</option>
-                                            <option value="ON_INTAKE">Already stopped (before this visit)</option>
-                                            <option value="DURING_VISIT">Stop now</option>
-                                        </select>
-                                    </div>
-                                    <div class="mb-2">
-                                        <label class="text-sm text-secondary mb-1">Removal Reason</label>
-                                        <textarea name="removalReasonMemo" class="form-control form-control-sm" rows="2"></textarea>
-                                    </div>
-                                    <div class="mb-2">
-                                        <label class="text-sm text-secondary mb-1">Removal Effective Date</label>
-                                        <input type="date" name="removalEffectiveDate"
-                                               value="<?= date('Y-m-d') ?>"
-                                               max="<?= date('Y-m-d') ?>"
-                                               class="form-control form-control-sm">
-                                    </div>
-                                    <div>
-                                        <button submit class="btn btn-sm btn-danger mr-2">Discontinue</button>
-                                        <button cancel class="btn btn-sm btn-default border">Cancel</button>
-                                    </div>
-                                </form>
+
+                            <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>
+                                <button cancel class="btn btn-sm bg-light btn-default border">Cancel</button>
+                                <!--<button type="button" class="ml-auto btn btn-sm btn-danger btn-mark-as-ee" data-uid="{{$medication->uid}}">Mark as Entry Error</button>-->
                             </div>
-                        @endif
-                    @endif
+                        </form>
+                    </div>
                 </td>
                 <td>
                     <?= !!@($medication->data->start_date) ? @($medication->data->start_date) : '-' ?>
@@ -562,6 +518,43 @@ $medications = $points;
 
                 });
 
+            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('.btn-mark-as-ee')
+                .off('click.btn-mark-as-ee')
+                .on('click.btn-mark-as-ee', function () {
+                    let form = $(this).closest('form');
+                    showMask();
+                    $.post('/api/visitPoint/updateTopLevel', {
+                        uid: $(this).attr('data-uid'),
+                        noteUid: '{{$note->uid}}',
+                        isRemoved: '1',
+                        removalReasonCategory: 'DURING_VISIT',
+                        removalReasonMemo: 'Entry Error',
+                        isRemovedDueToEntryError: '1',
+                    }, _data => {
+                        if(!hasResponseError(_data)) {
+                            refreshDynamicStagPopup();
+                        }
+                    }, 'json').then(function() { hideMask(); });
+                    return false;
+                });*/
+
             parentSegment.find('#frm-add-medication')
                 .off('submit')
                 .on('submit', function () {
@@ -702,7 +695,8 @@ $medications = $points;
 
             initStagSuggest();
 
-            $('.additionReasonCategory_ui').trigger('change');
+            parentSegment.find('.additionReasonCategory_ui').trigger('change');
+            parentSegment.find('[name="isRemoved"]').trigger('change');
 
             // custom buttons on title bar
             $('.button-container').remove();