瀏覽代碼

fixed coverate column renderer

= 3 年之前
父節點
當前提交
eb354cbd24
共有 2 個文件被更改,包括 21 次插入8 次删除
  1. 9 7
      resources/views/app/patient/coverage_column_renderer.blade.php
  2. 12 1
      spec/rpt-queries.sql

+ 9 - 7
resources/views/app/patient/coverage_column_renderer.blade.php

@@ -36,13 +36,15 @@
         <small class="ml-2 text-muted">(No insurance)</small>
     @endif
 </div>
-@if($coverage && $coverage->plan_type === 'MEDICARE')
-    @if(@$patient->mpb_remaining !== null)
-        <small class="text-muted d-block ml-3">Deductible: {{format_number(@$patient->mpb_remaining)}} </small>
+@if($coverage)
+    @if($coverage && $coverage->plan_type === 'MEDICARE')
+        @if(@$patient->mpb_remaining !== null)
+            <small class="text-muted d-block ml-3">Deductible: {{format_number(@$patient->mpb_remaining)}} </small>
+        @endif
     @endif
-@endif
-@if($coverage->plan_type === 'COMMERCIAL')
-    @if(@$coverage->deductible_amount !== null)
-        <small class="text-muted d-block ml-3">Deductible: {{format_number(@$coverage->deductible_amount)}} </small>
+    @if($coverage->plan_type === 'COMMERCIAL')
+        @if(@$coverage->deductible_amount !== null)
+            <small class="text-muted d-block ml-3">Deductible: {{format_number(@$coverage->deductible_amount)}} </small>
+        @endif
     @endif
 @endif

+ 12 - 1
spec/rpt-queries.sql

@@ -94,4 +94,15 @@ group by mcp_pro_id
 -- DATE | MCP | COUNT
 
 UPDATE note SET visit_number = ((SELECT COUNT(*)
- FROM note n WHERE n.id < note.id AND n.client_id = note.client_id AND n.is_cancelled IS NOT TRUE AND n.is_core_note IS FALSE) + 1) WHERE is_cancelled IS NOT TRUE;
+ FROM note n WHERE n.id < note.id AND n.client_id = note.client_id AND n.is_cancelled IS NOT TRUE AND n.is_core_note IS FALSE) + 1) WHERE is_cancelled IS NOT TRUE;
+
+COPY (
+  SELECT 
+    name_first,
+    name_last,
+    next_mcp_appointment_date, 
+    (SELECT data FROM point WHERE category = 'CHIEF_COMPLAINT' AND point.client_id = client.id ORDER BY point.created_at DESC LIMIT 1) AS latest_chief_complaint,
+    client_engagement_status_category as status
+  FROM client 
+  WHERE shadow_pro_id IS NULL
+) TO '/tmp/client_appts.csv' CSV HEADER;