Ver código fonte

Problems wizard (wip)

Vijayakrishnan 3 anos atrás
pai
commit
f29ca8ad07
1 arquivos alterados com 98 adições e 47 exclusões
  1. 98 47
      resources/views/app/patient/problems-center.blade.php

+ 98 - 47
resources/views/app/patient/problems-center.blade.php

@@ -89,6 +89,11 @@ $problems = $points;
                                 <input type="hidden" data-name="dxid" value="{{@$problem->data->dxid}}">
                                 <input type="hidden" data-name="icd-type" value="{{@$problem->data->{'icd-type'} }}">
 
+                                <input type="hidden" name="additionReasonCategory" value="{{@$problem->addition_reason_category}}">
+                                <input type="hidden" name="isRemoved" value="{{@$problem->is_removed}}">
+                                <input type="hidden" name="removalReasonCategory" value="{{@$problem->removal_reason_category}}">
+                                <input type="hidden" name="isRemovedDueToEntryError" value="{{@$problem->is_removed_due_to_entry_error}}">
+
                                 <div class="mb-2">
                                     <label class="text-sm text-secondary mb-1">Problem</label>
                                     <input type="text" class="form-control form-control-sm min-width-unset"
@@ -107,14 +112,44 @@ $problems = $points;
                                 </div>
 
                                 <div class="mb-2">
-                                    <label class="text-sm text-secondary mb-1">Existing / New</label>
-                                    <select class="form-control form-control-sm" name="additionReasonCategory" required>
+                                    <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>
                                         <option value="">-- select --</option>
-                                        <option value="ON_INTAKE" {{$problem->addition_reason_category === 'ON_INTAKE' ? 'selected' : ''}}>Existing (Patient was already on this)</option>
-                                        <option value="DURING_VISIT" {{$problem->addition_reason_category === 'DURING_VISIT' ? 'selected' : ''}}>New (Prescribed during this visit)</option>
+                                        <option value="HISTORIC" {{$problem->addition_reason_category === 'ON_INTAKE' && $problem->is_removed ? 'selected' : ''}}>Historic</option>
+                                        <option value="PRE_EXISTING" {{$problem->addition_reason_category === 'ON_INTAKE' && !$problem->is_removed ? 'selected' : ''}}>Preexisting</option>
+                                        <option value="NEW" {{$problem->addition_reason_category === 'DURING_VISIT' ? 'selected' : ''}}>New (Found during this visit)</option>
                                     </select>
                                 </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>
+                                <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 Memo</label>
+                                            <input type="text"
+                                                   name="removalReasonMemo"
+                                                   class="form-control form-control-sm min-width-unset">
+                                        </div>
+                                    </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">{{@$problem->data->description}}</textarea>
@@ -149,7 +184,7 @@ $problems = $points;
                     @else
                         @if(!$problem->is_removed)
                             <div moe>
-                                <a start show href="#" title="Discontinue">Delete</a>
+                                <a start show href="#" title="Discontinue">Discontinue</a>
                                 <form url="/api/visitPoint/updateTopLevel" class="mcp-theme-1">
                                     <input type="hidden" name="uid" value="<?= $problem->uid ?>">
                                     <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
@@ -157,7 +192,7 @@ $problems = $points;
                                     <input type="hidden" name="isRemovedDueToEntryError" value="0">
                                     <p class="mb-2"><b>Delete this problem?</b></p>
                                     <div class="mb-2">
-                                        <label class="text-sm text-secondary mb-1">Already inactive / Mark inactive now</label>
+                                        <label class="text-sm text-secondary mb-1">Already inactive?</label>
                                         <select class="form-control form-control-sm" name="removalReasonCategory" required>
                                             <option value="">-- select --</option>
                                             <option value="ON_INTAKE">Already inactive (before this visit)</option>
@@ -194,7 +229,22 @@ $problems = $points;
                     @endif
                 </td>
                 <td>
-                    <!-- todo include custom review for problem -->
+                    <div class="d-flex align-items-start">
+                        <div class="flex-grow-1">
+                            <?php
+                            $point = $problem;
+                            include resource_path('views/app/patient/segment-templates/_child_review/last-review.php');
+                            ?>
+                        </div>
+                        <a class="px-2 view-review-log"
+                           native target="_blank"
+                           open-in-stag-popup
+                           popup-style="stag-popup-md"
+                           title="Review log<?= !!@($problem->data->name) ? ' for ' . @($problem->data->name) : '' ?>"
+                           href="/point/review-log/<?= $problem->uid ?>?popupmode=1">
+                            <i class="fa fa-history"></i>
+                        </a>
+                    </div>
                 </td>
                 <td>
                     <div class="d-flex align-items-start">
@@ -248,7 +298,7 @@ $problems = $points;
                                            required>
                                 </div>
                                 <div class="col-4">
-                                    <label class="text-sm text-secondary mb-0">ICD</label>
+                                    <label class="text-sm text-secondary mb-1">ICD</label>
                                     <select data-name="icd"
                                             class="form-control form-control-sm"
                                             disabled>
@@ -285,7 +335,7 @@ $problems = $points;
                                 </div>
                                 <div class="w-25 pl-2">
                                     <div class="removalReasonMemo_ui" style="display: none">
-                                        <label class="text-sm text-secondary mb-0">Removal Memo</label>
+                                        <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">
@@ -310,20 +360,14 @@ $problems = $points;
 <script>
     (function() {
         function init() {
-
             let parentSegment = $('#problems-center-{{$note->id}}');
             parentSegment.find('input[stag-suggest][data-name="name"]')
                 .off('stag-suggest-selected')
                 .on('stag-suggest-selected', (_e, _input, _data) => {
-
                     $(_input).closest('form').find('input[data-name="dxid"]').val(_data.dxid);
-
                     let icdSelect = $(_input).closest('form').find('[data-name="icd"]').empty().prop('disabled', true);
-
                     $.get('/fdb-dx-icds-for-dxid?dxid=' + _data.dxid, _data => {
-                        icdSelect
-                            .empty()
-                            .append('<option value="">-- select --</option>');
+                        icdSelect.empty().append('<option value="">-- select --</option>');
                         for (let i = 0; i < _data.length; i++) {
                             icdSelect.append('<option value="' + _data[i].search_icd_cd + '" data-icd-type="' + _data[i].icd_cd_type + '">' + _data[i].search_icd_cd + ' (' + (_data[i].icd_cd_type === '01' ? 'ICD-9' : 'ICD-10') + ') - ' + _data[i].icd_desc + '</option>')
                         }
@@ -335,7 +379,7 @@ $problems = $points;
                 });
 
             // on route selection
-            parentSegment.find('[data-name="icd"]')
+            parentSegment.find('input[data-name="icd"]')
                 .off('change')
                 .on('change', function () {
                     $(this).closest('form').find('input[data-name="icd-type"]').val($(this).find('option:selected').attr('data-icd-type'));
@@ -343,7 +387,7 @@ $problems = $points;
 
             parentSegment.find('.additionReasonCategory_ui')
                 .off('change')
-                .on('change', function () {
+                .on('change', function() {
 
                     let form = $(this).closest('form');
 
@@ -356,17 +400,19 @@ $problems = $points;
                     form.find('.removalEffectiveDate_ui').hide();
                     form.find('.removalReasonMemo_ui').hide();
 
-                    if (this.value === 'HISTORIC') {
+                    if(this.value === 'HISTORIC') {
                         form.find('[name="additionReasonCategory"]').val('ON_INTAKE');
                         form.find('[name="isRemoved"]').val('1');
-                        form.find('.start_date_ui').show().find('input').val('');
-                        form.find('.removalEffectiveDate_ui').show().find('input').val('');
-                        form.find('.removalReasonMemo_ui').show().find('input').val('');
-                    } else if (this.value === 'PRE_EXISTING') {
+                        form.find('.start_date_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().find('input').val('');
-                    } else if (this.value === 'NEW') {
+                        form.find('.start_date_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')}}');
@@ -388,36 +434,38 @@ $problems = $points;
                     // add [data-name] values to payload
                     let dataField = form.find('[name="data"]').first();
                     let parsed = null;
-                    if (dataField.val()) {
+                    if(dataField.val()) {
                         parsed = JSON.parse(dataField.val());
                     }
-                    form.find('[data-name]').each(function () {
-                        if (!parsed) parsed = {};
+                    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') {
+                            if(i !== keys.length - 1) {
+                                if(typeof currentNode[keys[i]] === 'undefined') {
                                     currentNode[keys[i]] = {};
                                 }
                                 currentNode = currentNode[keys[i]];
-                            } else {
-                                if ($(this).is(':checkbox')) {
+                            }
+                            else {
+                                if($(this).is(':checkbox')) {
                                     currentNode[keys[i]] = $(this).prop('checked');
-                                } else {
+                                }
+                                else {
                                     currentNode[keys[i]] = $(this).val();
                                 }
                             }
                         }
 
                     });
-                    if (parsed) {
+                    if(parsed) {
                         dataField.val(JSON.stringify(parsed));
                     }
 
                     $.post(form.attr('action'), form.serialize(), _data => {
-                        if (!hasResponseError(_data)) {
+                        if(!hasResponseError(_data)) {
                             hideMask();
                             refreshDynamicStagPopup();
                             $('.visit-segment[data-segment-template-name="intake_problems"]').find('.refresh-segment').trigger('click');
@@ -440,36 +488,38 @@ $problems = $points;
                     // add [data-name] values to payload
                     let dataField = form.find('[name="data"]').first();
                     let parsed = null;
-                    if (dataField.val()) {
+                    if(dataField.val()) {
                         parsed = JSON.parse(dataField.val());
                     }
-                    form.find('[data-name]').each(function () {
-                        if (!parsed) parsed = {};
+                    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') {
+                            if(i !== keys.length - 1) {
+                                if(typeof currentNode[keys[i]] === 'undefined') {
                                     currentNode[keys[i]] = {};
                                 }
                                 currentNode = currentNode[keys[i]];
-                            } else {
-                                if ($(this).is(':checkbox')) {
+                            }
+                            else {
+                                if($(this).is(':checkbox')) {
                                     currentNode[keys[i]] = $(this).prop('checked');
-                                } else {
+                                }
+                                else {
                                     currentNode[keys[i]] = $(this).val();
                                 }
                             }
                         }
 
                     });
-                    if (parsed) {
+                    if(parsed) {
                         dataField.val(JSON.stringify(parsed));
                     }
 
                     $.post(form.attr('url'), form.serialize(), _data => {
-                        if (!hasResponseError(_data)) {
+                        if(!hasResponseError(_data)) {
                             hideMask();
                             refreshDynamicStagPopup();
                             $('.visit-segment[data-segment-template-name="intake_problems"]').find('.refresh-segment').trigger('click');
@@ -479,8 +529,9 @@ $problems = $points;
                 });
 
             initStagSuggest();
-        }
 
-        addMCInitializer('problems-center-{{$note->id}}', init, '#problems-center-{{$note->id}}');
+            $('.additionReasonCategory_ui').trigger('change');
+        }
+        addMCInitializer('problems-center-{{$note->id}}', init, '#problems-center-{{$note->id}}')
     }).call(window);
 </script>