Bläddra i källkod

Merge branch 'master' of rav.triplestart.com:jmudaka/stagfe2

root 3 år sedan
förälder
incheckning
c0a2c4d4fd

+ 45 - 1
resources/views/app/patient/note/partials/resolve-content.blade.php

@@ -337,7 +337,7 @@
                             </form>
                         </div>
                     </div>
-                    @include('app.patient.note.rhs-sidebar')
+                    @include('app.patient.note.rhs-sidebar-nrc')
                 </div>
             </div>
         </div>
@@ -444,6 +444,50 @@
                     $(this).closest('.on-hover-content').find('[menu]').hide();
                     return false;
                 });
+            parentSegment.find('.dx-data')
+                .off('click.quick-add-icd')
+                .on('click.quick-add-icd', function () {
+                    let code = $.trim($(this).find('.dx-data-code').text()),
+                        description = $.trim($(this).find('.dx-data-description').text()),
+                        table = $(this).closest('.card-body').find('.nrc-icds').find('table').first(),
+                        tr = null;
+                    table.find('tbody>tr').each(function() {
+                        if($.trim($(this).find('[icd-autocomplete-code]').first().val()) === '') {
+                            tr = $(this);
+                            return false;
+                        }
+                    });
+                    if(tr) {
+                        tr.find('[icd-autocomplete-code]').val(code);
+                        tr.find('[icd-autocomplete-description]').val(description);
+                    }
+                    return false;
+                });
+            parentSegment.find('.dx-add-all')
+                .off('click.quick-add-icd')
+                .on('click.quick-add-icd', function () {
+                    let table = $(this).closest('.card-body').find('.nrc-icds').find('table').first();
+                    table.find('[icd-autocomplete-code], [icd-autocomplete-description]').val('');
+                    $(this).closest('.dx-items').find('.dx-data').each(function() {
+                        let code = $.trim($(this).find('.dx-data-code').text()),
+                            description = $.trim($(this).find('.dx-data-description').text()),
+                            tr = null;
+                        table.find('tbody>tr').each(function() {
+                            if($.trim($(this).find('[icd-autocomplete-code]').first().val()) === '') {
+                                tr = $(this);
+                                return false;
+                            }
+                        });
+                        if(tr) {
+                            tr.find('[icd-autocomplete-code]').val(code);
+                            tr.find('[icd-autocomplete-description]').val(description);
+                        }
+                    });
+                    if($(this).is('[save]')) {
+                        $(this).closest('.card-body').find('.nrc-icds').find('button[submit]').trigger('click');
+                    }
+                    return false;
+                });
         }
         addMCInitializer('note-resolve-{{$note->uid}}', init, '#note-resolve-{{$note->uid}}');
         addMCHook('onICDUpdate-{{$note->uid}}', function() {

+ 204 - 0
resources/views/app/patient/note/rhs-sidebar-nrc.blade.php

@@ -0,0 +1,204 @@
+<div class="note-rhs-sidebar screen-only" id="note-rhs-sidebar">
+
+    <?php
+    $cmStartDate = date('Y-m-01', strtotime($note->effective_dateest));
+    $careMonth = \App\Models\CareMonth::where('client_id', $patient->id)->where('start_date', $cmStartDate)->first();
+    ?>
+    <div id="recent-measurements"
+         class="p-2 border-bottom  ">
+        <div class="font-weight-bold">
+            Recent Measurements
+        </div>
+        <?php
+        $date = date('Y-m-d');
+        $end = strtotime($date);
+        $start = date_sub(date_create($date), date_interval_create_from_date_string("12 days"))->getTimestamp();
+        $start *= 1000;
+        $end *= 1000;
+        $recentMeasurements = \App\Models\Measurement
+            ::where('client_id', $patient->id)
+            ->whereRaw("(is_removed IS NULL OR is_removed = FALSE)")
+            ->whereNotNull('ts')
+            ->whereRaw("(is_cellular_zero IS NULL OR is_cellular_zero = FALSE)")
+            ->whereRaw("(label = 'BP' OR label = 'Wt. (lbs.)')")
+            ->where('ts', '>=', $start)
+            ->where('ts', '<=', $end)
+            ->orderBy('ts', 'desc')
+            ->skip(0)
+            ->take(10)
+            ->get();
+        ?>
+        @if($recentMeasurements && count($recentMeasurements))
+            <div class="pt-2">
+                @foreach($recentMeasurements as $m)
+                    @if($m->label === 'BP')
+                        <div class="text-sm text-nowrap">BP: {{round($m->sbp_mm_hg)}}/{{round($m->dbp_mm_hg)}} ({{date('m/d/Y', $m->ts/1000)}})</div>
+                    @elseif($m->label === 'Wt. (lbs.)')
+                        <div class="text-sm text-nowrap">Wt: {{round($m->value, 1)}} ({{date('m/d/Y', $m->ts/1000)}})</div>
+                    @endif
+                @endforeach
+            </div>
+        @endif
+    </div>
+
+    <?php
+    $allergies = \App\Models\Point::getPointsOfCategory($patient, "ALLERGY");
+    $medications = \App\Models\Point::getPointsOfCategory($patient, "MEDICATION");
+    $supplements = \App\Models\Point::getPointsOfCategory($patient, "SUPPLEMENT");
+    $problems = \App\Models\Point::getPointsOfCategory($patient, "PROBLEM");
+    $goals = \App\Models\Point::getPointsOfCategory($patient, "GOAL");
+    $prescriptions = $patient->prescriptionsCreatedInNote($note);
+    $tracker = \App\Models\Point::getGlobalSingletonOfCategory($patient, 'NO_KNOWN_TRACKER');
+    ?>
+    <div id="active-allergies"
+         class="p-2 border-bottom  ">
+        <div class="font-weight-bold mb-2">
+            Allergies
+            <i class="fa fa-bolt text-primary ml-1"></i>
+        </div>
+        @if($tracker && @($tracker->data->no_known_drug_allergies))
+            <div class="text-secondary mb-2"><span>No Known Drug Allergies</span></div>
+        @endif
+        @if($tracker && @($tracker->data->no_known_allergies_of_any_type))
+            <div class="text-secondary mb-2"><span>No Known Allergies of Any Type</span></div>
+        @endif
+        @if(!$tracker || !@($tracker->data->no_known_allergies_of_any_type))
+            @if($allergies && count($allergies))
+                @foreach($allergies as $allergy)
+                    <?php $rel = $allergy->relevanceToNote($note); ?>
+                    <div class="d-inline-flex align-items-baseline px-1 {{$rel ? 'bg-warning-mellow' : ''}}">
+                        <span class="mr-1">•</span>
+                        <span>{{$allergy->data->name}}</span>
+                    </div>
+                @endforeach
+            @else
+                <span class="px-1 text-secondary">-</span>
+            @endif
+        @endif
+    </div>
+    <div id="active-medications"
+         class="p-2 border-bottom  ">
+        <div class="font-weight-bold mb-2">
+            Medications
+            <i class="fa fa-bolt text-primary ml-1"></i>
+        </div>
+        @if($tracker && @($tracker->data->no_known_medications))
+            <div class="text-secondary mb-2"><span>-</span></div>
+        @endif
+        @if(!$tracker || !@($tracker->data->no_known_medications))
+            @if($medications && count($medications))
+                @foreach($medications as $medication)
+                    <?php $rel = $medication->relevanceToNote($note); ?>
+                    <div class="d-inline-flex align-items-baseline px-1 {{$rel ? 'bg-warning-mellow' : ''}}">
+                        <span class="mr-1">•</span>
+                        <span>{{$medication->data->name}}
+                        <?php
+                        if($medication->lastChildReview) {
+                            $review = json_decode($medication->lastChildReview->data);
+                            if(isset($review->value) && isset($review->experience)) {
+                                ?>
+                                <span class="text-dark text-sm ml-1">({{$review->value}})</span>
+                                <?php
+                            }
+                        }
+                        ?>
+                        </span>
+                    </div>
+                @endforeach
+            @else
+                <span class="px-1 text-secondary">-</span>
+            @endif
+        @endif
+    </div>
+    <div id="active-problems"
+         class="p-2 border-bottom  ">
+        <div class="font-weight-bold mb-2">
+            Problems
+            <i class="fa fa-bolt text-primary ml-1"></i>
+        </div>
+        @if($problems && count($problems))
+            <div class="dx-items">
+                @foreach($problems as $problem)
+                    <?php $rel = $problem->relevanceToNote($note); ?>
+                    <div class="d-inline-flex align-items-baseline px-1 {{$rel ? 'bg-warning-mellow' : ''}}">
+                        <span class="mr-1">•</span>
+                        <span class="dx-data font-underline c-pointer on-hover-aliceblue">
+                            <span class="dx-data-description">{{$problem->data->name}}</span>
+                            <span class="dx-data-code">{{$problem->data->icd}}</span>
+                        </span>
+                    </div>
+                @endforeach
+                <div class="d-flex align-items-center">
+                    <button class="btn btn-sm btn-primary mt-2 dx-add-all text-sm">Apply</button>
+                    <button class="btn btn-sm btn-primary mt-2 dx-add-all text-sm ml-2" save>Apply &amp; Save</button>
+                </div>
+            </div>
+        @else
+            <span class="px-1 text-secondary">-</span>
+        @endif
+    </div>
+    <div id="active-goals"
+         class="p-2 border-bottom  ">
+        <div class="font-weight-bold mb-2">
+            Goals
+            <i class="fa fa-bolt text-primary ml-1"></i>
+        </div>
+        @if($goals && count($goals))
+            @foreach($goals as $goal)
+                <?php $rel = $goal->relevanceToNote($note); ?>
+                <div class="d-inline-flex align-items-baseline px-1 {{$rel ? 'bg-warning-mellow' : ''}}">
+                    <span class="mr-1">•</span>
+                    <span>{{$goal->data->goal}}</span>
+                </div>
+            @endforeach
+        @else
+            <span class="px-1 text-secondary">-</span>
+        @endif
+    </div>
+    <div id="active-careteam"
+         class="p-2 border-bottom  ">
+        <div class="font-weight-bold">
+            Care Team
+            <i class="fa fa-external-link-alt text-primary ml-1"></i>
+        </div>
+    </div>
+    <div id="note-prescriptions" class="p-2 border-bottom  ">
+        <div class="font-weight-bold">
+            ERx &amp; Orders
+        </div>
+        @if($prescriptions && count($prescriptions))
+            @foreach($prescriptions as $prescription)
+                <div class="d-flex align-items-baseline px-1 pt-2">
+                    <span class="mr-2 text-secondary text-sm font-weight-bold">{{$prescription->erx_category}}</span>
+                    <?php $parsed = json_decode($prescription->clinical_detail_json) ?>
+                    <span class="flex-grow-1">
+                        <?php
+                        switch($prescription->erx_category) {
+                            case 'DRUG':
+                                if(@$parsed && @$parsed->items) {
+                                    foreach ($parsed->items as $item) {
+                                        echo '<div>' . $item->medication . '</div>';
+                                    }
+                                }
+                                break;
+                            case 'LAB':
+                            case 'IMAGING':
+                                if(@$parsed && @$parsed->items) {
+                                    foreach ($parsed->items as $item) {
+                                        if(@$item->tests) {
+                                            foreach ($item->tests as $test) {
+                                                echo '<div>' . $test->desc . '</div>';
+                                            }
+                                        }
+                                    }
+                                }
+                                break;
+                        }
+                        ?>
+                    </span>
+                </div>
+            @endforeach
+        @endif
+    </div>
+
+</div>