Browse Source

Merge branch 'dev-mc-visit' into dev-vj

Vijayakrishnan 3 years ago
parent
commit
977cdbb4cc
60 changed files with 694 additions and 46 deletions
  1. 4 0
      app/Models/Segment.php
  2. 6 6
      resources/views/app/patient/coverage-status.blade.php
  3. 50 0
      resources/views/app/patient/note/custom-visit-with-layout.blade.php
  4. 104 0
      resources/views/app/patient/note/custom-visit.blade.php
  5. 29 8
      resources/views/app/patient/note/dashboard.blade.php
  6. 4 0
      resources/views/app/patient/note/segment/leaf.php
  7. 36 0
      resources/views/app/patient/note/visit-template-ui-layouts/_mc_default_visit.blade.php
  8. 7 7
      resources/views/app/patient/prescriptions/list.blade.php
  9. 1 0
      resources/views/app/patient/segment-templates/mc_assessment_free_text/edit.blade.php
  10. 1 0
      resources/views/app/patient/segment-templates/mc_assessment_free_text/summary.blade.php
  11. 1 0
      resources/views/app/patient/segment-templates/mc_assessment_system_allergies/edit.blade.php
  12. 1 0
      resources/views/app/patient/segment-templates/mc_assessment_system_allergies/summary.blade.php
  13. 1 0
      resources/views/app/patient/segment-templates/mc_assessment_system_problems/edit.blade.php
  14. 1 0
      resources/views/app/patient/segment-templates/mc_assessment_system_problems/summary.blade.php
  15. 1 0
      resources/views/app/patient/segment-templates/mc_cc/edit.blade.php
  16. 1 0
      resources/views/app/patient/segment-templates/mc_cc/summary.blade.php
  17. 1 0
      resources/views/app/patient/segment-templates/mc_covid/edit.blade.php
  18. 1 0
      resources/views/app/patient/segment-templates/mc_covid/summary.blade.php
  19. 1 0
      resources/views/app/patient/segment-templates/mc_objective/edit.blade.php
  20. 1 0
      resources/views/app/patient/segment-templates/mc_objective/summary.blade.php
  21. 1 0
      resources/views/app/patient/segment-templates/mc_plan_free_text/edit.blade.php
  22. 1 0
      resources/views/app/patient/segment-templates/mc_plan_free_text/summary.blade.php
  23. 1 0
      resources/views/app/patient/segment-templates/mc_plan_system_allergies/edit.blade.php
  24. 1 0
      resources/views/app/patient/segment-templates/mc_plan_system_allergies/summary.blade.php
  25. 1 0
      resources/views/app/patient/segment-templates/mc_plan_system_care_team/edit.blade.php
  26. 1 0
      resources/views/app/patient/segment-templates/mc_plan_system_care_team/summary.blade.php
  27. 1 0
      resources/views/app/patient/segment-templates/mc_plan_system_goals/edit.blade.php
  28. 1 0
      resources/views/app/patient/segment-templates/mc_plan_system_goals/summary.blade.php
  29. 1 0
      resources/views/app/patient/segment-templates/mc_plan_system_medications/edit.blade.php
  30. 1 0
      resources/views/app/patient/segment-templates/mc_plan_system_medications/summary.blade.php
  31. 1 0
      resources/views/app/patient/segment-templates/mc_plan_system_problems/edit.blade.php
  32. 1 0
      resources/views/app/patient/segment-templates/mc_plan_system_problems/summary.blade.php
  33. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_allergies/edit.blade.php
  34. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_allergies/summary.blade.php
  35. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_care_team/edit.blade.php
  36. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_care_team/summary.blade.php
  37. 4 0
      resources/views/app/patient/segment-templates/mc_subjective_free_text/edit.blade.php
  38. 3 0
      resources/views/app/patient/segment-templates/mc_subjective_free_text/summary.blade.php
  39. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_goals/edit.blade.php
  40. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_goals/summary.blade.php
  41. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_history_family/edit.blade.php
  42. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_history_family/summary.blade.php
  43. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_history_screenings/edit.blade.php
  44. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_history_screenings/summary.blade.php
  45. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_history_social/edit.blade.php
  46. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_history_social/summary.blade.php
  47. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_lifestyle/edit.blade.php
  48. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_lifestyle/summary.blade.php
  49. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_medications/edit.blade.php
  50. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_medications/summary.blade.php
  51. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_past_medical_hx/edit.blade.php
  52. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_past_medical_hx/summary.blade.php
  53. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_problems/edit.blade.php
  54. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_problems/summary.blade.php
  55. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_ros/edit.blade.php
  56. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_ros/summary.blade.php
  57. 233 0
      resources/views/app/patient/segment-templates/mc_vitals/edit.blade.php
  58. 85 0
      resources/views/app/patient/segment-templates/mc_vitals/summary.blade.php
  59. 21 25
      resources/views/app/patient/sms.blade.php
  60. 62 0
      storage/visit-template-ui-configs/mc_default_visit.json

+ 4 - 0
app/Models/Segment.php

@@ -19,4 +19,8 @@ class Segment extends Model
     public function client() {
         return $this->hasOne(Client::class, 'id', 'client_id');
     }
+
+    public function shortName(){
+        return trim(array_reverse(explode('>', $this->display_title))[0]);
+    }
 }

+ 6 - 6
resources/views/app/patient/coverage-status.blade.php

@@ -22,14 +22,14 @@
             @endif
           </td>
         </tr>
-        @if($coverage->auto_medicare_is_partbactive == 'YES')
+        @if($coverage->auto_medicare_is_partbactive == 'YES' && $performer->pro->pro_type == 'ADMIN')
         <tr>
           <td class="font-weight-bold">Part B Deductible</td>
-          <td>{{$coverage->auto_medicare_mpb_deductible ?? '-'}}</td>
+          <td>{{number_format($coverage->auto_medicare_mpb_deductible, 2, '.',',') ?? '-'}}</td>
         </tr>
         <tr>
           <td class="font-weight-bold">Part B Remaining</td>
-          <td>{{$coverage->auto_medicare_mpb_remaining ?? '-'}}</td>
+          <td>{{number_format($coverage->auto_medicare_mpb_remaining,2, '.',',') ?? '-'}}</td>
         </tr>
         @endif
       </table>
@@ -50,14 +50,14 @@
             @endif
           </td>
         </tr>
-        @if($coverage->auto_medicare_is_partbactive)
+        @if($coverage->auto_medicare_is_partbactive && $performer->pro->pro_type == 'ADMIN')
         <tr>
           <td class="font-weight-bold">Part B Deductible</td>
-          <td>{{$coverage->auto_medicare_mpb_deductible ?? '-'}}</td>
+          <td>{{number_format($coverage->auto_medicare_mpb_deductible,2,'.',',') ?? '-'}}</td>
         </tr>
         <tr>
           <td class="font-weight-bold">Part B Remaining</td>
-          <td>{{$coverage->auto_medicare_mpb_remaining ?? '-'}}</td>
+          <td>{{number_format($coverage->auto_medicare_mpb_remaining, 2, '.',',') ?? '-'}}</td>
         </tr>
         @endif
       </table>

+ 50 - 0
resources/views/app/patient/note/custom-visit-with-layout.blade.php

@@ -0,0 +1,50 @@
+<?php
+    $segmentMap = [];
+    foreach($note->segments as $segment):
+        $segmentMap[$segment->segmentTemplate->internal_name] = $segment;
+    endforeach;
+
+    function renderVisitTemplateNode($node, $segMap) {
+        if(is_array($node)){
+            renderVisitTemplateGroup($node, $segMap);
+        }else{
+            renderNoteTemplateLeaf($node, $segMap);
+        }
+    }
+
+    function renderVisitTemplateGroup($node, $segMap){
+        ?>
+        <table class="table table-sm table-bordered table-striped">
+            <tr>
+                <td>{{$node['heading']}}</td>
+                <td>
+                   <?php foreach($node['children'] as $child): ?>
+                        <div>
+                            <?php renderVisitTemplateNode($child, $segMap); ?>
+                        </div>
+                    <?php endforeach; ?>
+                </td>
+            </tr>
+        </table>
+        <?php
+    }
+
+    function renderNoteTemplateLeaf($leaf, $segMap){
+        $segment = $segMap[$leaf];
+         include('app/patient/note/segment/leaf.php');
+         //echo($segment->summary_html);
+    }
+?>
+<div class="row">
+    <div class="col-md-9">
+        <?php
+            foreach($visitTemplateUiConfig as $node) renderVisitTemplateNode($node, $segmentMap);
+        ?>
+    </div>
+    <div class="col-md-3">
+        wizards here
+    </div>
+</div>
+<div class="segments-list" id="note-segments-list">
+</div>
+@include('app.patient.note.segment_script')

+ 104 - 0
resources/views/app/patient/note/custom-visit.blade.php

@@ -0,0 +1,104 @@
+<?php
+    $segmentMap = [];
+    foreach($note->segments as $segment):
+        $segmentMap[$segment->segmentTemplate->internal_name] = $segment;
+    endforeach;
+
+    function renderVisitTemplateNode($note, $node, $pos, $segMap) {
+        if(is_array($node)){
+            renderVisitTemplateGroup($note, $node, $pos, $segMap);
+        }else{
+            renderNoteTemplateLeaf($note, $node, $pos, $segMap);
+        }
+    }
+
+    function renderVisitTemplateGroup($note, $node, $pos, $segMap){
+        ?>
+        <div class="vt-group vt-pos-<?= $pos ?>">
+            <div class="vt-heading">{{$node['heading']}}</div>
+            <div class="vt-children">
+                <?php foreach($node['children'] as $child): ?>
+                <div class="vt-child">
+                    <?php renderVisitTemplateNode($note, $child, $pos + 1, $segMap); ?>
+                </div>
+                <?php endforeach; ?>
+            </div>
+        </div>
+        <?php
+    }
+
+    function renderNoteTemplateLeaf($note, $leaf, $pos, $segMap){
+        $segment = $segMap[$leaf];
+        $leafPhpPath = resource_path('views') . '/app/patient/note/segment/leaf.php';
+        include($leafPhpPath);
+    }
+    $len = count($visitTemplateUiConfig);
+    $firsthalf = array_slice($visitTemplateUiConfig, 0, $len / 2 + 1);
+    $secondhalf = array_slice($visitTemplateUiConfig, $len / 2 + 1);
+
+?>
+<style>
+    .vt-group {
+    }
+    .vt-heading {
+      font-family: Verdana, sans-serif;
+      font-size: 12px;
+      font-weight: bold;
+      margin-bottom: 5px;
+    }
+    .vt-children {
+        margin-left: 20px;
+    }
+    .vt-child {
+
+    }
+    .vt-leaf {
+      margin-bottom: 12px;
+    }
+    .vt-leaf .vt-leaf-name {
+      font-family: Verdana, sans-serif;
+      font-size: 12px;
+      font-weight: bold;
+    }
+    .vt-leaf .vt-leaf-summary {
+        margin-left: 10px;
+    }
+    .vt-group.vt-pos-0 > .vt-heading {
+        text-decoration: underline;
+    }
+    .vt-leaf.vt-pos-0 > .vt-leaf-name {
+        text-decoration: underline;
+    }
+    .vt-group.vt-pos-1 > .vt-heading {
+        /* font-size: 1.4em; */
+    }
+    .vt-leaf.vt-pos-1 > .vt-leaf-name {
+        /* font-size: 1.4em; */
+    }
+
+</style>
+<div>
+    <div class="row p-3">
+        <div class="col-md-8">
+            <div class="row segments-list" id="note-segments-list">
+                <div class="col-md-6 ">
+                    <?php
+                    foreach($firsthalf as $node) renderVisitTemplateNode($note, $node, 0, $segmentMap);
+                    ?>
+                </div>
+                <div class="col-md-6">
+                    <?php
+                    foreach($secondhalf as $node) renderVisitTemplateNode($note, $node, 0, $segmentMap);
+                    ?>
+                    <div class="p-2 border-bottom screen-only" data-non-segment-section="Prescriptions">
+                      @include('app.patient.prescriptions.list', compact('patient', 'note'))
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="col-md-4 border-left">
+            wizards here
+        </div>
+    </div>
+</div>
+@include('app.patient.note.segment_script')

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

@@ -21,8 +21,20 @@
 
     // is based on visit template
     $isVisitTemplateBased = !!$note->visitTemplate;
-    ?>
 
+    $uiConfigsPath = $isVisitTemplateBased ? storage_path("visit-template-ui-configs/{$note->visitTemplate->internal_name}.json") : null;
+    $doesVisitTemplateUiConfigExist = $uiConfigsPath && file_exists($uiConfigsPath);
+    $visitTemplateUiConfig = $doesVisitTemplateUiConfigExist ? json_decode(file_get_contents($uiConfigsPath), true) : null;
+
+    $visitLayoutPath = "app.patient.note.visit-template-ui-layouts.{$note->visitTemplate->internal_name}";
+    $doesVisitTemplateLayoutExist = $isVisitTemplateBased && \Illuminate\Support\Facades\View::exists($visitLayoutPath);
+
+    $segmentMap = [];
+    foreach($note->segments as $segment):
+        $segmentMap[$segment->segmentTemplate->internal_name] = $segment;
+    endforeach;
+
+    ?>
     <div id="note-single-header" class="pb-3 d-flex align-items-start screen-only zero-height">
         <h6 class="my-0 text-secondary d-flex align-items-center w-100">
             <a href="/patients/view/{{ $patient->uid }}/notes" class="small text-decoration-none mr-3">
@@ -441,7 +453,7 @@
         </div>
         <div class="card-body p-0">
             <div class="note-container">
-                @if($isVisitTemplateBased)
+                @if($isVisitTemplateBased && !$doesVisitTemplateUiConfigExist)
                 <div class="note-lhs-tree pb-4" id="note-lhs-tree">
                     <?php
                     $previousHeading = null;
@@ -588,8 +600,12 @@
                         $latestSectionTS = 0;
                         ?>
                         <div class="{{ $note->is_signed_by_hcp ? 'note-signed-by-hcp' : '' }}">
-                            @if($isVisitTemplateBased)
+                            @if($isVisitTemplateBased && $doesVisitTemplateLayoutExist)
+                                @include($visitLayoutPath)
+                            @elseif($isVisitTemplateBased && !$doesVisitTemplateUiConfigExist)
                                 @include('app.patient.note.note-segment-list')
+                            @elseif($isVisitTemplateBased && $doesVisitTemplateUiConfigExist)
+                                @include('app.patient.note.custom-visit')
                             @else
                                 @include('app.patient.note.note-section-list')
                             @endif
@@ -599,9 +615,14 @@
 
                 <span class="d-none latest-section-ts">{{ $latestSectionTS }}</span>
 
-                <div class="p-3 border-bottom screen-only" data-non-segment-section="Prescriptions">
+
+                  @if($isVisitTemplateBased && $doesVisitTemplateUiConfigExist)
+
+                  @else
+                  <div class="p-2 border-bottom screen-only" data-non-segment-section="Prescriptions">
                     @include('app.patient.prescriptions.list', compact('patient', 'note'))
-                </div>
+                  </div>
+                  @endif
 
                 <div class="p-3 border-bottom screen-only" data-non-segment-section="CM Setup">
                     <div class="d-flex align-items-center mb-3">
@@ -649,7 +670,7 @@
                             @endif
                         </div>
                     </div>
-                    
+
                 </div>
 
                 <div class="p-3 border-bottom screen-only" data-non-segment-section="RM Setup">
@@ -1159,7 +1180,7 @@
                             @include('app/patient/note/_create-bill')
                         @endif
                     </div>
-                    
+
                     @if($pro->pro_type === 'ADMIN')
                                 <table class="table table-sm tabe-striped mb-0 table-bordered">
                         <thead class="bg-light">
@@ -1260,7 +1281,7 @@
                                         @endif
                                     @endif
 
-                                    @if($pro->pro_type === 'ADMIN')                                    
+                                    @if($pro->pro_type === 'ADMIN')
                                         <b>{{$bill->hcpCompanyPro && $bill->hcpCompanyPro->company ? $bill->hcpCompanyPro->pro->displayName() . ' / ' . $bill->hcpCompanyPro->company->name : '-'}}</b>
                                         <div moe class="ml-1">
                                             <a class="text-primary" href="" show start>Swap HCP Company Pro</a>

+ 4 - 0
resources/views/app/patient/note/segment/leaf.php

@@ -0,0 +1,4 @@
+<div class="vt-leaf vt-pos-<?= $pos ?> note-section visit-segment <?= $note->is_signed_by_hcp ? '' : 'edit-trigger' ?>">
+    <div class="vt-leaf-name"><?= $segment->shortName() ?>:</div>
+    <div class="vt-leaf-summary"><?= $segment->summary_html ?></div>
+</div>

+ 36 - 0
resources/views/app/patient/note/visit-template-ui-layouts/_mc_default_visit.blade.php

@@ -0,0 +1,36 @@
+
+Vitals | Chief Complaint
+COVID-19
+Subjective
+    Free Text [E]
+    System
+        Goals (INTAKE)
+        Allergies (INTAKE)  [W]
+Medications (INTAKE)
+Past Medical Hx [E]
+Problems (INTAKE) [W]
+Review of Systems [E]
+History
+Family Hx [E]
+Social Hx [E]
+Screenings Hx [E]
+Lifestyle [E]
+Care Team (INTAKE) [W]
+Objective [E]
+Assessment
+Free Text [E]
+System
+Problems Relevant to Note [W]
+Allergies Relevant to Note [W]
+Plan
+Free Text [E]
+System Changes
+Problem-Specific Plan [W]
+Allergy-Specific Plan [W]
+Medications [W]
+Goals [W]
+Care Team [W]
+
+<?php
+// dump($segmentMap)
+?>

+ 7 - 7
resources/views/app/patient/prescriptions/list.blade.php

@@ -3,27 +3,27 @@
         <h6 class="my-0 font-weight-bold text-secondary font-size-14">ERx &amp; Orders</h6>
         @if(!request()->input('erx_category') || request()->input('erx_category') === 'DRUG')
             <span class="mx-2 text-secondary on-hover-opaque">|</span>
-            <a href="#" v-on:click.prevent="newERx('DRUG')">+ Drug</a>
+            <a href="#" v-on:click.prevent="newERx('DRUG')">Drug</a>
         @endif
         @if(!request()->input('erx_category') || request()->input('erx_category') === 'LAB')
             <span class="mx-2 text-secondary on-hover-opaque">|</span>
-            <a href="#" v-on:click.prevent="newERx('LAB')">+ Lab</a>
+            <a href="#" v-on:click.prevent="newERx('LAB')">Lab</a>
         @endif
         @if(!request()->input('erx_category') || request()->input('erx_category') === 'IMAGING')
             <span class="mx-2 text-secondary on-hover-opaque">|</span>
-            <a href="#" v-on:click.prevent="newERx('IMAGING')">+ Imaging</a>
+            <a href="#" v-on:click.prevent="newERx('IMAGING')">Imaging</a>
         @endif
         @if(!request()->input('erx_category') || request()->input('erx_category') === 'REFERRAL')
             <span class="mx-2 text-secondary on-hover-opaque">|</span>
-            <a href="#" v-on:click.prevent="newERx('REFERRAL')">+ Referral</a>
+            <a href="#" v-on:click.prevent="newERx('REFERRAL')">Referral</a>
         @endif
         @if(!request()->input('erx_category') || request()->input('erx_category') === 'SUPPLY')
             <span class="mx-2 text-secondary on-hover-opaque">|</span>
-            <a href="#" v-on:click.prevent="newERx('SUPPLY')">+ Supply</a>
+            <a href="#" v-on:click.prevent="newERx('SUPPLY')">Supply</a>
         @endif
         @if(!request()->input('erx_category') || request()->input('erx_category') === 'OTHER')
             <span class="mx-2 text-secondary on-hover-opaque">|</span>
-            <a href="#" v-on:click.prevent="newERx('OTHER')">+ Other</a>
+            <a href="#" v-on:click.prevent="newERx('OTHER')">Other</a>
         @endif
     </div>
     <div class="d-flex align-items-start bg-white">
@@ -1452,4 +1452,4 @@ GROUP BY erx_category");
         }
         addMCInitializer('prescriptions-{{$patient->id}}', init, '#prescriptions-{{$patient->id}}')
     }).call(window);
-</script>
+</script>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_assessment_free_text/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_assessment_free_text/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_assessment_system_allergies/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_assessment_system_allergies/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_assessment_system_problems/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_assessment_system_problems/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_cc/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_cc/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_covid/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_covid/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_objective/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_objective/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_plan_free_text/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_plan_free_text/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_plan_system_allergies/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_plan_system_allergies/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_plan_system_care_team/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_plan_system_care_team/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_plan_system_goals/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_plan_system_goals/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_plan_system_medications/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_plan_system_medications/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_plan_system_problems/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_plan_system_problems/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_allergies/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_allergies/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_care_team/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_care_team/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 4 - 0
resources/views/app/patient/segment-templates/mc_subjective_free_text/edit.blade.php

@@ -0,0 +1,4 @@
+<?php
+$category = 'SUBJECTIVE_GENERAL';
+$endPoint = 'upsertNoteSingleton';
+include resource_path('views/app/patient/segment-templates/_simple_text_segment/edit.php');

+ 3 - 0
resources/views/app/patient/segment-templates/mc_subjective_free_text/summary.blade.php

@@ -0,0 +1,3 @@
+<?php
+$category = 'SUBJECTIVE_GENERAL';
+include resource_path('views/app/patient/segment-templates/_simple_text_segment/summary.php');

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_goals/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_goals/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_history_family/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_history_family/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_history_screenings/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_history_screenings/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_history_social/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_history_social/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_lifestyle/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_lifestyle/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_medications/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_medications/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_past_medical_hx/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_past_medical_hx/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_problems/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_problems/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_ros/edit.blade.php

@@ -0,0 +1 @@
+<h1>edit</h1>

+ 1 - 0
resources/views/app/patient/segment-templates/mc_subjective_ros/summary.blade.php

@@ -0,0 +1 @@
+<h1>summary</h1>

+ 233 - 0
resources/views/app/patient/segment-templates/mc_vitals/edit.blade.php

@@ -0,0 +1,233 @@
+<?php
+
+use App\Models\Point;
+
+$category = 'VITALS';
+$endPoint = 'upsertNoteSingleton';
+
+$vitalLabels = [
+    "heightInInches" => "Ht. (in.)",
+    "weightPounds" => "Wt. (lbs.)",
+    "bmi" => "BMI (kg/m²)",
+    "temperatureF" => "Temp. (F)",
+    "systolicBP" => "SBP",
+    "diastolicBP" => "DBP",
+    "pulseRatePerMinute" => "Pulse",
+    "respirationRatePerMinute" => "Resp.",
+    "pulseOx" => "Pulse Ox.",
+    "smokingStatus" => "Smoking Status",
+];
+
+$point = Point::where('added_in_segment_id', $segment->id)->where('category', $category)->orderBy('id', 'DESC')->first();
+$contentData = null;
+if (!!@$point->data) {
+    $contentData = json_decode($point->data, true);
+}
+
+if(!$contentData) {
+    $contentData = [
+        "date" => $note->effective_dateest,
+        "heightInInches" => '',
+        "weightPounds" => '',
+        "bmi" => '',
+        "temperatureF" => '',
+        "systolicBP" => '',
+        "diastolicBP" => '',
+        "pulseRatePerMinute" => '',
+        "respirationRatePerMinute" => '',
+        "pulseOx" => '',
+        "smokingStatus" => '',
+    ];
+}else {
+    if(!isset($contentData['date'])) $contentData['date'] = $note->effective_dateest;
+    foreach ($vitalLabels as $k => $v) {
+        if (!isset($contentData[$k]) || is_array($contentData[$k])) {
+            $contentData[$k] = '';
+        }
+    }
+}
+
+$previousVitals = Point::where('client_id', $patient->id)
+    ->where('added_in_segment_id', '<>', $segment->id)
+    ->where('category', $category)
+    ->orderBy('id', 'DESC')
+    ->limit(4)
+    ->get();
+
+// convert to new format
+$previousData = [];
+$previousDataAssoc = [];
+foreach ($previousVitals as $p) {
+    if (!!@$p->data) {
+        $parsedP = json_decode($p->data, true);
+        $newFormat = [];
+        foreach ($vitalLabels as $k => $v) {
+            if (isset($parsedP[$k]) && is_array($parsedP[$k]) && isset($parsedP[$k]['value'])) {
+                $newFormat[$k] = $parsedP[$k]['value'];
+            }
+            else if(isset($parsedP[$k]) && !is_array($parsedP[$k])) {
+                $newFormat[$k] = $parsedP[$k];
+            }
+            else {
+                $newFormat[$k] = '';
+            }
+        }
+        $newFormat['date'] = $p->note->effective_dateest;
+        $previousData[] = $newFormat;
+        $previousDataAssoc[$newFormat['date']] = $newFormat; // for easy iter to cols
+    }
+}
+
+$copyTriggerAdded = [];
+
+?>
+<div visit-moe close-on-save close-on-cancel class="d-block">
+    <form show url="/api/visitPoint/<?= $endPoint ?>" class="mcp-theme-1">
+        <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
+        <input type="hidden" name="category" value="<?= $category ?>">
+        <input type="hidden" name="data" value="{{json_encode($contentData)}}">
+
+        <table class="table table-sm table-bordered mb-2 table-edit-sheet">
+            <thead>
+            <tr class="bg-light">
+                <th class="px-2 text-secondary border-bottom-0 w-25">Vital</th>
+                <th class="px-2 text-secondary border-bottom-0 w-25">{{friendly_date($contentData['date'])}}</th>
+                @if(!$previousData || !count($previousData))
+                    <th class="px-2 text-secondary border-bottom-0">Previous</th>
+                @else
+                    @foreach($previousData as $pDay)
+                        <th class="px-2 text-secondary border-bottom-0 on-hover-opaque position-relative">
+                            {{friendly_date($pDay['date'])}}
+                        </th>
+                    @endforeach
+                @endif
+            </tr>
+            </thead>
+            <tbody>
+                @foreach($vitalLabels as $k => $v)
+                    @if($k !== 'diastolicBP')
+                    <tr>
+                        <td>
+                            <input type="text" tabindex="-1"
+                                   class="form-control form-control-sm events-none border-0"
+                                   value="{{ $k === 'systolicBP' ? 'Blood Pressure' : $v }}" readonly>
+                        </td>
+                        <td class="position-relative">
+                            @if($k === "bmi")
+                                <div class="d-flex align-items-stretch">
+                                    <input type="text" readonly bmi
+                                           class="form-control form-control-sm vitals-title border-bottom-0 border-top-0 border-left-0 border-right width-70px"
+                                           data-name="bmi" value="{{$contentData['bmi']}}">
+                                    <div class="flex-grow-1 py-1 m-0 px-2 font-weight-bold bg-light">
+                                        @if(isset($contentData['bmi']) && $contentData['bmi'] != "" )
+                                            <?php $bmi = $contentData['bmi']; ?>
+                                            @if($bmi < 18.5)
+                                                <span class="text-sm text-warning-mellow" v-if="+bmi < 18.5">Underweight</span>
+                                            @endif
+                                            @if($bmi >= 18.5 && $bmi < 25)
+                                                <span class="text-sm text-success" v-if="+bmi >= 18.5 && +bmi < 25">Healthy Weight</span>
+                                            @endif
+                                            @if($bmi >= 25 && $bmi > 30)
+                                                <span class="text-sm text-warning-mellow" v-if="+bmi >= 25 && +bmi < 30">Overweight</span>
+                                            @endif
+                                            @if($bmi >= 30)
+                                                <span class="text-sm text-warning-mellow" v-if="+bmi >= 30">Obese</span>
+                                            @endif
+                                        @endif
+                                    </div>
+                                </div>
+                            @elseif($k === "smokingStatus")
+                                <input type="text"
+                                       class="form-control form-control-sm border-0"
+                                       data-name="smokingStatus"
+                                       placeholder="{{$v}}"
+                                       data-option-list="smokingStatus" value="{{$contentData['smokingStatus']}}">
+                                <div id="smoking-status-options" class="data-option-list">
+                                    <div>Current every day smoker</div>
+                                    <div>Former some day smoker</div>
+                                    <div>Former smoker</div>
+                                    <div>Never smoker</div>
+                                    <div>Smoker, current status unknown</div>
+                                    <div>Unknown if ever smoked</div>
+                                    <div>Heavy tobacco smoker</div>
+                                    <div>Light tobacco smoker</div>
+                                </div>
+                            @elseif($k === 'systolicBP')
+                                <div class="d-flex align-items-center bg-white">
+                                    <input type="text" class="form-control form-control-sm min-width-unset w-auto-input width-70px border-0 edit"
+                                           data-name="systolicBP" systolicBP
+                                           value="{{$contentData['systolicBP']}}" placeholder="Systolic">
+                                    <span class="px-2 text-secondary bg-white">/</span>
+                                    <input type="text" class="form-control form-control-sm min-width-unset w-auto-input width-70px border-0 edit"
+                                           data-name="diastolicBP" diastolicBP
+                                           value="{{$contentData['diastolicBP']}}" placeholder="Diastolic">
+                                </div>
+                            @else
+                                <input type="text"
+                                       class="form-control form-control-sm border-0" data-name="{{$k}}" {{$k}}
+                                       value="{{$contentData[$k]}}"
+                                       placeholder="{{$v}}"
+                                       @if($k == 'heightInInches' || $k == 'weightPounds') refresh-bmi @endif>
+                            @endif
+                        </td>
+                        @if(!$previousData || !count($previousData))
+                            <td class="bg-light"></td>
+                        @else
+                            @foreach($previousData as $pDay)
+                                <td class="bg-light {{!isset($copyTriggerAdded[$k]) ? 'px-2' : 'px-2'}} py-1 text-secondary position-relative">
+                                    @if($k === 'systolicBP')
+                                        {{ @$previousDataAssoc[$pDay['date']]['systolicBP'] ?: '-' }}/{{ @$previousDataAssoc[$pDay['date']]['diastolicBP'] ?: '-' }}
+                                    @else
+                                        {{$previousDataAssoc[$pDay['date']][$k] ?: '-' }}
+                                    @endif
+                                    @if(!isset($copyTriggerAdded[$k]) && $k !== "bmi")
+                                        <a href="#" title="Copy to this note" class="vitals-copy-trigger"><i class="fa fa-chevron-circle-left font-size-14"></i></a>
+                                    @endif
+                                </td>
+                                <?php $copyTriggerAdded[$k] = true ?>
+                            @endforeach
+                        @endif
+                    </tr>
+                    @endif
+                @endforeach
+            </tbody>
+        </table>
+        <div>
+            <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+            <button cancel class="btn btn-sm btn-default border">Cancel</button>
+        </div>
+    </form>
+</div>
+<script>
+    window.segmentInitializers.<?= $segment->segmentTemplate->internal_name ?> = function () {
+        let parentSegment = $('[data-segment-template-name="<?= $segment->segmentTemplate->internal_name ?>"] ');
+
+        parentSegment.find('[refresh-bmi]').off('change input');
+        parentSegment.find('[refresh-bmi]').on('change input', function () {
+            var height = parseInt(parentSegment.find('[heightInInches]').val());
+            var weight = parseInt(parentSegment.find('[weightPounds]').val());
+            var bmi = Math.round((weight / (height * height)) * 703.06957964)
+            parentSegment.find('[bmi]').val(bmi);
+            parentSegment.find('[bmi-date]').val(parentSegment.find('[weight-date]').val());
+        });
+
+        parentSegment.find('.vitals-copy-trigger').off('click.copy-vital');
+        parentSegment.find('.vitals-copy-trigger').on('click.copy-vital', function () {
+            let td = $(this).closest('td'), value = $.trim(td.text());
+            if(value.indexOf('/') === -1) {
+                td.prev().find('input').val(value).trigger('change');
+            }
+            else {
+                let parts = value.split('/');
+                if(parts.length >= 1 && parts[0] !== '-') {
+                    td.prev().find('input:eq(0)').val(parts[0]).trigger('change');
+                }
+                if(parts.length >= 2 && parts[1] !== '-') {
+                    td.prev().find('input:eq(1)').val(parts[1]).trigger('change');
+                }
+            }
+            return false;
+        });
+
+    };
+</script>

+ 85 - 0
resources/views/app/patient/segment-templates/mc_vitals/summary.blade.php

@@ -0,0 +1,85 @@
+<?php
+
+use App\Models\Point;
+
+$category = 'VITALS';
+$endPoint = 'upsertNoteSingleton';
+
+$vitalLabels = [
+    "heightInInches" => "Ht. (in.)",
+    "weightPounds" => "Wt. (lbs.)",
+    "bmi" => "BMI (kg/m²)",
+    "temperatureF" => "Temp. (F)",
+    "systolicBP" => "SBP",
+    "diastolicBP" => "DBP",
+    "pulseRatePerMinute" => "Pulse",
+    "respirationRatePerMinute" => "Resp.",
+    "pulseOx" => "Pulse Ox.",
+    "smokingStatus" => "Smoking Status",
+];
+
+$point = Point::where('added_in_segment_id', $segment->id)->where('category', $category)->orderBy('id', 'DESC')->first();
+$contentData = null;
+if (!!@$point->data) {
+    $contentData = json_decode($point->data, true);
+}
+
+if(!$contentData) {
+    $contentData = [
+        "date" => $note->effective_dateest,
+        "heightInInches" => '',
+        "weightPounds" => '',
+        "bmi" => '',
+        "temperatureF" => '',
+        "systolicBP" => '',
+        "diastolicBP" => '',
+        "pulseRatePerMinute" => '',
+        "respirationRatePerMinute" => '',
+        "pulseOx" => '',
+        "smokingStatus" => '',
+    ];
+}else {
+    if(!isset($contentData['date'])) $contentData['date'] = $note->effective_dateest;
+    foreach ($vitalLabels as $k => $v) {
+        if (!isset($contentData[$k]) || is_array($contentData[$k])) {
+            $contentData[$k] = '';
+        }
+    }
+}
+?>
+
+<div class="mb-2">Effective Date: <b>{{friendly_date($contentData['date'])}}</b></div>
+@foreach ($vitalLabels as $k => $v)
+<div class="d-flex vital-item align-items-center">
+        <span class="content-html text-nowrap">
+            <?php $vital = @$contentData[$k]; ?>
+                @if($k === 'systolicBP')
+                    <span>Blood Pressure:</span>
+                    <b>{{ @$contentData['systolicBP'] ?: '-' }}/{{ @$contentData['diastolicBP'] ?: '-' }}</b>
+                @elseif($k === 'diastolicBP') <!--ignore-->
+
+                @else
+                    <span>{{$v}}:</span>
+                    <b>{{ !empty($vital) ? $vital : '-' }}</b>
+                @endif
+            @if($k === 'bmi' && !empty($vital))
+                <?php $bmi = floatval($vital); ?>
+                <span class="ml-2 py-1 m-0 font-weight-bold">
+                     @if($bmi < 18.5)
+                        <span class="text-sm text-warning-mellow">(Underweight)</span>
+                     @endif
+                    @if($bmi >= 18.5 && $bmi < 25)
+                        <span class="text-sm text-success">(Healthy Weight)</span>
+                    @endif
+                    @if($bmi >= 25 && $bmi < 30)
+                        <span class="text-sm text-warning-mellow">(Overweight)</span>
+                    @endif
+                    @if($bmi >= 30)
+                        <span class="text-sm text-warning-mellow">(Obese)</span>
+                    @endif
+                </span>
+            @endif
+        </span>
+</div>
+@endforeach
+

+ 21 - 25
resources/views/app/patient/sms.blade.php

@@ -31,9 +31,7 @@
                 <th class="px-2 text-secondary w-25">From</th>
                 <th class="px-2 text-secondary w-25">To</th>
                 <th class="px-2 text-secondary w-50">Content</th>
-                @if($performer->pro->pro_type == 'ADMIN')
-                    <th></th>
-                @endif
+                <th></th>
             </tr>
             </thead>
             <tbody>
@@ -44,29 +42,27 @@
                     <td class="px-2">{{ $sms->from_number }}</td>
                     <td class="px-2">{{ $sms->to_number }}</td>
                     <td class="px-2">{{ $sms->body }}</td>
-                    @if($performer->pro->pro_type == 'ADMIN')
-                        <td>
-                            <div moe relative>
-                                <a start show class="">Update Is Reply Needed</a>
-                                <form url="/api/clientSms/updateIsReplyNeeded" class="mcp-theme-1" right>
-                                    <input type="hidden" name="uid" value="{{ $sms->uid }}">
-                                    <div class="mb-2">
-                                        <label for="" class="text-sm text-secondary mb-1">Is reply needed?</label>
-                                        <select class="form-control form-control-sm" name="isReplyNeeded" value="{{$patient->cell_number}}">
-                                            <option value="UNKNOWN">--</option>
-                                            <option value="YES">Yes</option>
-                                            <option value="NO">No</option>
-                                        </select>
-                                    </div>
 
-                                    <div class="d-flex align-items-center">
-                                        <button class="btn btn-sm btn-primary mr-2" submit>Send</button>
-                                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                    </div>
-                                </form>
-                            </div>
-                        </td>
-                    @endif
+                    <td>
+                        @if($sms->is_reply_needed)
+                        <div moe relative>
+                            <a start show class="">clear</a>
+                            <form url="/api/clientSms/updateIsReplyNeeded" class="mcp-theme-1" right>
+                                <input type="hidden" name="uid" value="{{ $sms->uid }}">
+                                <input type="hidden" name="isReplyNeeded" value="NO">
+                                <div class="mb-2">
+                                    <label for="" class="text-sm text-secondary mb-1">Are you sure?</label>
+
+                                </div>
+
+                                <div class="d-flex align-items-center">
+                                    <button class="btn btn-sm btn-primary mr-2" submit>Send</button>
+                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                </div>
+                            </form>
+                        </div>
+                        @endif
+                    </td>
                 </tr>
             @endforeach
             </tbody>

+ 62 - 0
storage/visit-template-ui-configs/mc_default_visit.json

@@ -0,0 +1,62 @@
+[
+    "mc_vitals",
+    "mc_cc",
+    "mc_covid",
+    {
+        "heading": "Subjective",
+        "children": [
+            "mc_subjective_free_text",
+            {
+                "heading": "System",
+                "children": [
+                    "mc_subjective_goals",
+                    "mc_subjective_allergies",
+                    "mc_subjective_medications",
+                    "mc_subjective_past_medical_hx",
+                    "mc_subjective_problems",
+                    "mc_subjective_ros",
+                    {
+                        "heading": "History",
+                        "children": [
+                            "mc_subjective_history_family",
+                            "mc_subjective_history_social",
+                            "mc_subjective_history_screenings"
+                        ]
+                    },
+                    "mc_subjective_lifestyle",
+                    "mc_subjective_care_team"
+                ]
+            }
+        ]
+    },
+    "mc_objective",
+    {
+        "heading": "Assessment",
+        "children": [
+            "mc_assessment_free_text",
+            {
+                "heading": "System",
+                "children": [
+                    "mc_assessment_system_problems",
+                    "mc_assessment_system_allergies"
+                ]
+            }
+        ]
+    },
+    {
+        "heading": "Plan",
+        "children": [
+            "mc_plan_free_text",
+            {
+                "heading": "System",
+                "children": [
+                    "mc_plan_system_problems",
+                    "mc_plan_system_allergies",
+                    "mc_plan_system_medications",
+                    "mc_plan_system_goals",
+                    "mc_plan_system_care_team"
+                ]
+            }
+        ]
+    }
+]