Переглянути джерело

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

= 3 роки тому
батько
коміт
167855a542

+ 32 - 11
app/Http/Controllers/PracticeManagementController.php

@@ -3664,26 +3664,47 @@ ORDER BY c.name_last, c.name_first
 		n.is_claim_closed IS NOT TRUE AND
             
 	    n.is_cancelled IS NOT TRUE AND 
-            n.created_at::DATE >= '2022-01-01'::DATE AND
             c.client_engagement_status_category <> 'DUMMY' AND
             c.name_first NOT ILIKE '%test%' AND 
             c.name_last NOT ILIKE '%test%' AND
             n.id IN (SELECT note_id FROM bill WHERE code ILIKE '%treatment%' AND bill.is_cancelled IS NOT TRUE AND note_id IS NOT NULL)
-		-- AND	
+		    -- AND	
             -- n.id NOT IN (SELECT note_id FROM claim WHERE note_id IS NOT NULL) AND
-            -- c.is_part_b_primary <> 'YES' 
-	    -- AND
-            -- c.latest_eligible_refresh_at::DATE >= '2022-01-01' AND
-            AND c.mpb_remaining = 0 -- AND
-            -- c.created_at::DATE >= '2022-01-01'::DATE
             ";
         $filters = [];
-        if($request->input('f')) {
-            $filters[] =  "(n.detail_json IS NOT NULL AND ((n.detail_json)::json->'farah_decision')::text = '\"" . $request->input('f') . "\"')";
+
+        if(trim($request->input('f_pb_primary'))) {
+            $v = trim($request->input('f_pb_primary'));
+            if($v === 'yes') {
+                $filters[] = "(c.is_part_b_primary = 'YES')";
+            }
+            else if($v === 'no') {
+                $filters[] = "(c.is_part_b_primary != 'YES')";
+            }
         }
-        if($request->input('s')) {
-            $filters[] =  "(n.detail_json IS NOT NULL AND ((n.detail_json)::json->'shawn_decision')::text = '\"" . $request->input('s') . "\"')";
+        if(trim($request->input('f_deductible_zero'))) {
+            $v = trim($request->input('f_deductible_zero'));
+            if($v === 'yes') {
+                $filters[] = "(c.mpb_remaining = 0)";
+            }
+            else if($v === 'no') {
+                $filters[] = "(c.mpb_remaining > 0)";
+            }
+        }
+        if(trim($request->input('f_note_hcp'))) {
+            $v = trim($request->input('f_note_hcp'));
+            $filters[] = "(n.hcp_pro_id IN (SELECT id FROM pro WHERE uid = '{$v}'))";
         }
+        if(trim($request->input('f_2022_patient'))) {
+            $v = trim($request->input('f_2022_patient'));
+            if($v === 'yes') {
+                $filters[] = "(c.created_at::DATE >= '2022-01-01'::DATE)";
+            }
+            else if($v === 'no') {
+                $filters[] = "(c.created_at::DATE < '2022-01-01'::DATE)";
+            }
+        }
+
         if(count($filters)) {
             $filters = 'AND ' . implode(' AND ',  $filters);
         }

BIN
resources/views/app/patient/note/.dashboard.blade.php.swp


+ 1 - 1
resources/views/app/patient/note/dashboard.blade.php

@@ -738,7 +738,7 @@ use App\Models\Handout;
                                                     {{ $iSupplyOrder->product->title }}
                                                 </td>
                                                 <td class="px-2">{{ $iSupplyOrder->reason }}</td>
-                                                <td class="px-2">{{ friendlier_date($iSupplyOrder->created_at) }} <i class="fas fa-info-circle text-primary" data-toggle="tooltip" data-placement="top" data-html="true" title="Created at: {{ friendlier_date_time($iSupplyOrder->created_at) }} By: {{ $iSupplyOrder->createdByPro->displayName() }}"></i> </td>
+                                                <td class="px-2">{{ friendlier_date($iSupplyOrder->created_at) }} <i class="fas fa-info-circle text-primary" data-toggle="tooltip" data-placement="top" data-html="true" title="Created at: {{ friendlier_date_time($iSupplyOrder->created_at) }} By: {{ $iSupplyOrder->createdByPro ? $iSupplyOrder->createdByPro->displayName() : ''}}"></i> </td>
                                                 <td class="px-2">
                                                     {{ $iSupplyOrder->is_signed_by_pro ? $iSupplyOrder->signedPro->displayName() : '-' }}
                                                     <i class="fas fa-info-circle text-primary" data-toggle="tooltip" data-placement="top" data-html="true" title="Signed at: {{ friendlier_date_time($iSupplyOrder->pro_signed_at) }}"></i>

+ 1 - 1
resources/views/app/patient/note/partials/cpp-bills-claims-container.blade.php

@@ -371,7 +371,7 @@
                                 </span>
                             @else
                                 <div class="text-success font-weight-bold"><i class="fa fa-check"></i> Verified</div>
-                                <div class="text-muted">By: {{@$bill->markedVerifiedBySession->pro->displayName()}} on {{friendly_date_time(@$bill->marked_verified_at)}}</div>
+                                <div class="text-muted">By: {{@$bill->markedVerifiedBySession && @$bill->markedVerifiedBySession->pro ? @$bill->markedVerifiedBySession->pro->displayName() : '-'}} on {{friendly_date_time(@$bill->marked_verified_at)}}</div>
                                 <span class="d-block mt-1" moe>
                                     <a class="" href="" show start>Undo</a>
                                     <form url="/api/bill/undoMarkAsVerified">

+ 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>

+ 56 - 3
resources/views/app/practice-management/notes-resolution-center-v2.blade.php

@@ -9,9 +9,9 @@
 
     <div id="notes-resolution-center" class="px-3 pt-3 mcp-theme-1" v-cloak>
 
-        <div class="d-flex align-items-baseline">
-            <h6 class="font-size-16 font-weight-bold text-secondary mb-3">Notes Resolution Center</h6>
-            <form class="ml-5 d-inline-flex align-items-center" action="{{route('practice-management.notes-resolution-center-v2')}}" method="GET">
+        <div class="d-flex align-items-baseline mb-3">
+            <h6 class="font-size-16 font-weight-bold text-secondary my-0 mr-4">Notes Resolution Center</h6>
+            <!--<form class="ml-5 d-inline-flex align-items-center" action="{{route('practice-management.notes-resolution-center-v2')}}" method="GET">
                 <span class="">Farah:</span>
                 <select name="f" class="form-control form-control-sm min-width-unset max-width-110px ml-2"
                         onchange="fastLoad('{{route('practice-management.notes-resolution-center-v2')}}?' + $(this).closest('form').serialize()); return false;">
@@ -26,6 +26,59 @@
                     <option {{ request()->input('s') === 'green' ? 'selected' : '' }} value="green">Green</option>
                     <option {{ request()->input('s') === 'red' ? 'selected' : '' }} value="red">Red</option>
                 </select>
+            </form>-->
+            <form class="d-inline-flex flex-grow-1 align-items-stretch" onsubmit="return fastLoad('{{route('practice-management.notes-resolution-center-v2')}}?' + $(this).serialize());">
+
+                <div class="d-inline-flex align-items-baseline mr-2">
+                    <label class="text-nowrap mb-0 text-sm mr-1 {{request()->input('f_pb_primary') && request()->input('f_pb_primary') !== 'any' ? 'text-info' : 'text-secondary'}}">PB Primary?</label>
+                    <div class="d-flex align-items-start">
+                        <select name="f_pb_primary" class="mr-2 form-control form-control-sm min-width-unset width-70px pl-0">
+                            <option {{!request()->input('f_pb_primary') || request()->input('f_pb_primary') === 'any' ? 'selected' : ''}} value="any">All</option>
+                            <option {{request()->input('f_pb_primary') === 'yes' ? 'selected' : ''}} value="yes">Yes</option>
+                            <option {{request()->input('f_pb_primary') === 'no' ? 'selected' : ''}} value="no">No</option>
+                        </select>
+                    </div>
+                </div>
+
+                <div class="d-inline-flex align-items-baseline mr-2">
+                    <label class="text-nowrap mb-0 text-sm mr-1 {{request()->input('f_deductible_zero') && request()->input('f_deductible_zero') !== 'any' ? 'text-info' : 'text-secondary'}}">Deductible 0?</label>
+                    <div class="d-flex align-items-start">
+                        <select name="f_deductible_zero" class="mr-2 form-control form-control-sm min-width-unset width-70px pl-0">
+                            <option {{!request()->input('f_deductible_zero') || request()->input('f_deductible_zero') === 'any' ? 'selected' : ''}} value="any">All</option>
+                            <option {{request()->input('f_deductible_zero') === 'yes' ? 'selected' : ''}} value="yes">Yes</option>
+                            <option {{request()->input('f_deductible_zero') === 'no' ? 'selected' : ''}} value="no">No</option>
+                        </select>
+                    </div>
+                </div>
+
+                <div class="d-inline-flex align-items-baseline mr-2">
+                    <label class="text-nowrap mb-0 text-sm mr-1 {{request()->input('f_note_hcp') ? 'text-info' : 'text-secondary'}}">Note HCP:</label>
+                    <select name="f_note_hcp" class="form-control form-control-sm min-width-unset max-width-110px" provider-search provider-type="hcp" data-pro-uid="{{request()->input('f_note_hcp')}}">
+                        <option value="">--select--</option>
+                    </select>
+                </div>
+
+                <div class="d-inline-flex align-items-baseline mr-2">
+                    <label class="text-nowrap mb-0 text-sm mr-1 {{request()->input('f_2022_patient') && request()->input('f_2022_patient') !== 'any' ? 'text-info' : 'text-secondary'}}">2022 Pt.?</label>
+                    <div class="d-flex align-items-start">
+                        <select name="f_2022_patient" class="mr-2 form-control form-control-sm min-width-unset width-70px pl-0">
+                            <option {{!request()->input('f_2022_patient') || request()->input('f_2022_patient') === 'any' ? 'selected' : ''}} value="any">All</option>
+                            <option {{request()->input('f_2022_patient') === 'yes' ? 'selected' : ''}} value="yes">Yes</option>
+                            <option {{request()->input('f_2022_patient') === 'no' ? 'selected' : ''}} value="no">No</option>
+                        </select>
+                    </div>
+                </div>
+
+                <div class="d-flex align-items-start">
+                    <button type="button" class="btn-apply btn btn-sm btn-primary mr-2"
+                            onclick="return fastLoad('{{route('practice-management.notes-resolution-center-v2')}}?' + $(this).closest('form').serialize());">
+                        <i class="fa fa-check"></i>
+                    </button>
+                    <button type="button" class="btn-reset btn btn-sm btn-default bg-white text-secondary border"
+                            onclick="return fastLoad('{{route('practice-management.notes-resolution-center-v2')}}');">
+                        <i class="fa fa-times"></i>
+                    </button>
+                </div>
             </form>
         </div>