Forráskód Böngészése

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

Josh 3 éve
szülő
commit
668be74a7a
64 módosított fájl, 830 hozzáadás és 93 törlés
  1. 32 5
      app/Http/Controllers/McpController.php
  2. 4 0
      app/Models/Segment.php
  3. 10 6
      resources/views/app/mcp/client_messages.blade.php
  4. 29 14
      resources/views/app/mcp/client_messages_filters.blade.php
  5. 24 7
      resources/views/app/mcp/supply_orders.blade.php
  6. 38 14
      resources/views/app/mcp/supply_orders_filters.blade.php
  7. 50 0
      resources/views/app/patient/note/custom-visit-with-layout.blade.php
  8. 104 0
      resources/views/app/patient/note/custom-visit.blade.php
  9. 29 8
      resources/views/app/patient/note/dashboard.blade.php
  10. 4 0
      resources/views/app/patient/note/segment/leaf.php
  11. 36 0
      resources/views/app/patient/note/visit-template-ui-layouts/_mc_default_visit.blade.php
  12. 7 7
      resources/views/app/patient/prescriptions/list.blade.php
  13. 1 0
      resources/views/app/patient/segment-templates/mc_assessment_free_text/edit.blade.php
  14. 1 0
      resources/views/app/patient/segment-templates/mc_assessment_free_text/summary.blade.php
  15. 1 0
      resources/views/app/patient/segment-templates/mc_assessment_system_allergies/edit.blade.php
  16. 1 0
      resources/views/app/patient/segment-templates/mc_assessment_system_allergies/summary.blade.php
  17. 1 0
      resources/views/app/patient/segment-templates/mc_assessment_system_problems/edit.blade.php
  18. 1 0
      resources/views/app/patient/segment-templates/mc_assessment_system_problems/summary.blade.php
  19. 1 0
      resources/views/app/patient/segment-templates/mc_cc/edit.blade.php
  20. 1 0
      resources/views/app/patient/segment-templates/mc_cc/summary.blade.php
  21. 1 0
      resources/views/app/patient/segment-templates/mc_covid/edit.blade.php
  22. 1 0
      resources/views/app/patient/segment-templates/mc_covid/summary.blade.php
  23. 1 0
      resources/views/app/patient/segment-templates/mc_objective/edit.blade.php
  24. 1 0
      resources/views/app/patient/segment-templates/mc_objective/summary.blade.php
  25. 1 0
      resources/views/app/patient/segment-templates/mc_plan_free_text/edit.blade.php
  26. 1 0
      resources/views/app/patient/segment-templates/mc_plan_free_text/summary.blade.php
  27. 1 0
      resources/views/app/patient/segment-templates/mc_plan_system_allergies/edit.blade.php
  28. 1 0
      resources/views/app/patient/segment-templates/mc_plan_system_allergies/summary.blade.php
  29. 1 0
      resources/views/app/patient/segment-templates/mc_plan_system_care_team/edit.blade.php
  30. 1 0
      resources/views/app/patient/segment-templates/mc_plan_system_care_team/summary.blade.php
  31. 1 0
      resources/views/app/patient/segment-templates/mc_plan_system_goals/edit.blade.php
  32. 1 0
      resources/views/app/patient/segment-templates/mc_plan_system_goals/summary.blade.php
  33. 1 0
      resources/views/app/patient/segment-templates/mc_plan_system_medications/edit.blade.php
  34. 1 0
      resources/views/app/patient/segment-templates/mc_plan_system_medications/summary.blade.php
  35. 1 0
      resources/views/app/patient/segment-templates/mc_plan_system_problems/edit.blade.php
  36. 1 0
      resources/views/app/patient/segment-templates/mc_plan_system_problems/summary.blade.php
  37. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_allergies/edit.blade.php
  38. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_allergies/summary.blade.php
  39. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_care_team/edit.blade.php
  40. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_care_team/summary.blade.php
  41. 4 0
      resources/views/app/patient/segment-templates/mc_subjective_free_text/edit.blade.php
  42. 3 0
      resources/views/app/patient/segment-templates/mc_subjective_free_text/summary.blade.php
  43. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_goals/edit.blade.php
  44. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_goals/summary.blade.php
  45. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_history_family/edit.blade.php
  46. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_history_family/summary.blade.php
  47. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_history_screenings/edit.blade.php
  48. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_history_screenings/summary.blade.php
  49. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_history_social/edit.blade.php
  50. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_history_social/summary.blade.php
  51. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_lifestyle/edit.blade.php
  52. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_lifestyle/summary.blade.php
  53. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_medications/edit.blade.php
  54. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_medications/summary.blade.php
  55. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_past_medical_hx/edit.blade.php
  56. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_past_medical_hx/summary.blade.php
  57. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_problems/edit.blade.php
  58. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_problems/summary.blade.php
  59. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_ros/edit.blade.php
  60. 1 0
      resources/views/app/patient/segment-templates/mc_subjective_ros/summary.blade.php
  61. 233 0
      resources/views/app/patient/segment-templates/mc_vitals/edit.blade.php
  62. 85 0
      resources/views/app/patient/segment-templates/mc_vitals/summary.blade.php
  63. 30 32
      resources/views/layouts/patient.blade.php
  64. 62 0
      storage/visit-template-ui-configs/mc_default_visit.json

+ 32 - 5
app/Http/Controllers/McpController.php

@@ -172,14 +172,41 @@ class McpController extends Controller
 
     public function supply_orders(Request $request)
     {
-        $supplyOrders = SupplyOrder::paginate(5);
-        return view('app.mcp.supply_orders', compact('supplyOrders'));
+        $filters = $request->all();
+        $supplyOrders = SupplyOrder::select('supply_order.*')->where('supply_order.signed_by_pro_id', $this->performer->pro->id);
+        $this->filterMultiQuery($request, $supplyOrders, 'created_at', 'date_category', 'date_value_1', 'date_value_2');
+        $status = $request->get('status');
+        
+        if($status){
+            if($status == 'CLEARED_FOR_SHIPMENT'){
+                $supplyOrders = $supplyOrders->where('is_cleared_for_shipment', true);
+            }elseif($status == 'NOT_CLEARED_FOR_SHIPMENT'){
+                $supplyOrders = $supplyOrders->where('is_cleared_for_shipment', false);
+            }elseif($status == 'CANCELLED'){
+                $supplyOrders = $supplyOrders->where('is_cancelled', true);
+            }else{
+             $supplyOrders = $supplyOrders->join('shipment', 'shipment.id', '=', 'supply_order.shipment_id')->where('shipment.status', $status);   
+            }
+            
+        }
+        $supplyOrders = $supplyOrders->orderBy('created_at', 'DESC')->paginate(20);
+        return view('app.mcp.supply_orders', compact('supplyOrders', 'filters'));
     }
 
     public function client_messages(Request $request)
-    {
-        $clientMessages = ClientSMS::paginate(5);
-        return view('app.mcp.client_messages', compact('clientMessages'));
+    {      
+        $filters = $request->all();
+
+        $clientMessages = ClientSMS::select('client_sms.*')
+        ->join('client', 'client.id', '=', 'client_sms.client_id')
+        ->where('client.mcp_pro_id', $this->performer->pro->id);
+
+        $this->filterMultiQuery($request, $clientMessages, 'client_sms.created_at', 'date_category', 'date_value_1', 'date_value_2');
+        $this->filterSimpleQuery($request, $clientMessages, 'sms_status', 'sms_status');
+
+        $clientMessages = $clientMessages->orderBy('client_sms.created_at', 'DESC');
+        $clientMessages = $clientMessages->paginate(20);
+        return view('app.mcp.client_messages', compact('clientMessages', 'filters'));
     }
 
     public function new_patients_awaiting_visit(Request $request){

+ 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]);
+    }
 }

+ 10 - 6
resources/views/app/mcp/client_messages.blade.php

@@ -19,8 +19,10 @@
                 <thead class="bg-light">
                     <tr>
                         <th class="px-3 border-0">Date</th>
+                        <th class="px-3 border-0">Folder</th>
                         <th class="px-3 border-0">To</th>
                         <th class="px-3 border-0">From</th>
+                        <th class="px-3 border-0">Client</th>
                         <th class="px-3 border-0">Message</th>
                         <th class="px-3 border-0">Status</th>
                     </tr>
@@ -28,17 +30,19 @@
                 <tbody>
                     @foreach($clientMessages as $clientMessage)
                     <tr>
-                        <td>{{ $clientMessage->created_at }}</td>
-                        <td>{{$clientMessage->to}}</td>
-                        <td>{{$clientMessage->from}}</td>
-                        <td><?= nl2br($clientMessage->body) ?></td>                        
-                        <td>{{-- status --}} - </td>
+                        <td>{{ friendlier_date_time($clientMessage->created_at) }}</td>
+                        <td>{{ $clientMessage->incoming_or_outgoing }}</td>
+                        <td>{{$clientMessage->to_number}}</td>
+                        <td>{{$clientMessage->from_number}}</td>
+                        <td>{{ $clientMessage->client->displayName() }}</td>
+                        <td style="width:300px;"><?= nl2br($clientMessage->body) ?></td>                        
+                        <td>{{ $clientMessage->sms_status }} </td>
                     </tr>
                     @endforeach
 
                     @if(count($clientMessages) === 0)
                     <tr>
-                        <td colspan="5">No records found!</td>
+                        <td colspan="7">No records found!</td>
                     </tr>
                     @endif
                 </tbody>

+ 29 - 14
resources/views/app/mcp/client_messages_filters.blade.php

@@ -25,17 +25,17 @@
 	<div v-if="filters.date_category" class="col-md-2">
 		<div class="form-group">
 			<label>&nbsp;</label>
-			<input name="date_value_1" value="{{ $date_value_1 ?? '' }}" type="date" class="form-control input-sm" :placeholder="(filters.date_category === 'BETWEEN' || filters.date_category === 'NOT_BETWEEN') ? 'From' : 'Date'" />
+			<input name="date_value_1" v-model="filters.date_value_1" type="date" class="form-control input-sm" :placeholder="(filters.date_category === 'BETWEEN' || filters.date_category === 'NOT_BETWEEN') ? 'From' : 'Date'" />
 		</div>
 	</div>
 	<div v-if="filters.date_category && (filters.date_category === 'BETWEEN' || filters.date_category === 'NOT_BETWEEN')" class="col-md-2">
 		<div class="form-group">
 			<label>&nbsp;</label>
-			<input name="date_value_2" value="{{ $date_value_2 ?? '' }}" type="date" class="form-control input-sm" placeholder="To" />
+			<input name="date_value_2" v-model="filters.date_value_2" type="date" class="form-control input-sm" placeholder="To" />
 		</div>
 	</div>
 	<!-- TO OR FROM ME -->
-	<div class="col-md-2">
+	<!-- <div class="col-md-2">
 		<div class="form-group">
 			<label>To or From Me:</label>
 			<select name="to_or_from_me" class="form-control input-sm" v-model="filters.to_or_from_me">
@@ -44,14 +44,14 @@
 				<option value="FROM_ME">From Me</option>
 			</select>
 		</div>
-	</div>
+	</div> -->
 	<!-- STATUS -->
 	<div class="col-md-2">
 		<div class="form-group">
 			<label>Status:</label>
-			<select name="status" class="form-control input-sm" v-model="filters.status">
-				<option value="ALL">All</option>
-				<option value="AWAITING_REPLY">AWaiting Reply</option>
+			<select name="sms_status" class="form-control input-sm" v-model="filters.sms_status">
+				<option value="">All</option>
+				<option value="received">Received</option>
 			</select>
 		</div>
 	</div>
@@ -59,12 +59,27 @@
 	<div class="col-md-2">
 		<div class="form-group d-flex">
 			<label>&nbsp;</label>
-			<button type="submit" class="btn btn-primary btn-sm mr-2 mw-100px">Apply Filters</button>
-			<a href="{{ route('mcp.patients') }}" class="btn btn-danger btn-sm text-white mw-100px">Clear Filters</a>
+			<button type="submit" v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2 mw-100px">Apply Filters</button>
+			<a v-on:click.prevent="fastLoad('{{route('mcp.client_messages')}}')" href="#" class="btn btn-danger btn-sm text-white mw-100px">Clear Filters</a>
 		</div>
 	</div>
 </form>
 
+<?php
+$loadedFilters = $filters;
+$allFilterKeys = [
+	'date_category',
+	'date_value_1',
+	'date_value_2',
+	'sms_status'
+];
+for ($i=0; $i < count($allFilterKeys); $i++) {
+	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {
+		$loadedFilters[$allFilterKeys[$i]] = '';
+	}
+}
+?>
+
 <script>
 	(function() {
 		function init() {
@@ -72,13 +87,13 @@
 				el: '#mcp-client-messages-filters',
 				delimiters: ['@{{', '}}'],
 				data: {
-					filters: {
-						date_category: "<?= $date_category ?? '' ?>",
-						to_or_from_me: "<?= $to_or_from_me ?? '' ?>",
-						status: "<?= $status ?? '' ?>"
-					}
+					filters: <?= json_encode($loadedFilters) ?>
 				},
 				methods: {
+					doSubmit: function() {
+						fastLoad('{{ route("mcp.client_messages") }}?' + $('#mcp-client-messages-filters').serialize());
+						return false;
+					},
 					init: function() {
 
 					}

+ 24 - 7
resources/views/app/mcp/supply_orders.blade.php

@@ -22,23 +22,40 @@
                         <th class="px-3 border-0">Patient</th>
                         <th class="px-3 border-0">Product</th>
                         <th class="px-3 border-0">Reason</th>
-                        <th class="px-3 border-0">Status</th>
+                        <th class="px-3 border-0">Is Cancelled</th>
+                        <th class="px-3 border-0">Shipment</th>
                     </tr>
                 </thead>
                 <tbody>
                     @foreach($supplyOrders as $supplyOrder)
                     <tr>
-                        <td>{{-- date --}} -</td>
-                        <td>{{-- patient --}} -</td>
-                        <td>{{-- service --}} - </td>
-                        <td>{{-- amount --}} - </td>
-                        <td>{{-- status --}} - </td>
+                        <td>{{ friendlier_date_time($supplyOrder->created_at)}}</td>
+                        <td>{{ $supplyOrder->client->displayName() }} -</td>
+                        <td>{{ $supplyOrder->product->title }}</td>
+                        <td style="width: 300px;">{{ $supplyOrder->reason }}</td>
+                        <td>{{ $supplyOrder->is_cancelled ? 'Yes' : 'No' }}</td>
+                        <td class="px-2">
+                            @if($supplyOrder->shipment_id)
+                            <i class="fa fa-building"></i>
+                            {{$supplyOrder->shipment->status ? $supplyOrder->shipment->status : 'CREATED'}}
+                            @elseif($supplyOrder->is_cleared_for_shipment)
+                            <span class="text-info">
+                                <i class="fa fa-user-nurse"></i>
+                                Cleared for shipment
+                            </span>
+                            @else
+                            <span class="text-warning-mellow">
+                                <i class="fa fa-user-nurse"></i>
+                                Not cleared for shipment
+                            </span>
+                            @endif
+                        </td>
                     </tr>
                     @endforeach
 
                     @if(count($supplyOrders) === 0)
                     <tr>
-                        <td colspan="5">No records found!</td>
+                        <td colspan="6">No records found!</td>
                     </tr>
                     @endif
                 </tbody>

+ 38 - 14
resources/views/app/mcp/supply_orders_filters.blade.php

@@ -7,7 +7,7 @@
 		min-width: 100px;
 	}
 </style>
-<form id="mcp-supply-orders-filters" method="GET" action="{{ route('mcp.notes') }}" class="row align-items-end" v-cloak>
+<form id="mcp-supply-orders-filters" method="GET" action="{{ route('mcp.supply_orders') }}" class="row align-items-end" v-cloak>
 	<!-- DATE	 -->
 	<div class="col-md-2">
 		<div class="form-group">
@@ -39,12 +39,22 @@
 		<div class="form-group">
 			<label>Status:</label>
 			<select name="status" class="form-control input-sm" v-model="filters.status">
-				<option value="ALL">All</option>
-				<option value="NEW">New</option>
-				<option value="SIGNED">Signed</option>
-				<option value="VERIFIED">Verified</option>
-				<option value="PROCESSED">Processed</option>
-				<option value="CANCELLED">Cancelled</option>
+				<option value="">All</option>
+				<option value="CREATED">NEW</option>
+				<option value="CLEARED_FOR_SHIPMENT">CLEARED FOR SHIPMENT</option>
+				<option value="NOT_CLEARED_FOR_SHIPMENT">NOT CLEARED FOR SHIPMENT</option>
+				<option value="SHIPPED">SHIPPED</option>
+				<option value="DELIVERED">DELIVERED</option>
+				<option value="RETURNED_TO_SENDER">RETURNED TO SENDER</option>
+				<option value="CANCELLED">CANCELLED</option>
+				<option value="PRINTED">PRINTED</option>
+				<option value="BEING_PICKED">BEING PICKED</option>
+				<option value="PICKED">PICKED</option>
+				<option value="BEING_SCANNED">BEING SCANNED</option>
+				<option value="SCANNED">SCANNED</option>
+				<option value="BEING_FULFILLED">BEING FULFILLED</option>
+				<option value="FULFILLED">FULFILLED</option>
+				<option value="DISPATCHED">DISPATCHED</option>
 			</select>
 		</div>
 	</div>
@@ -52,12 +62,25 @@
 	<div class="col-md-2">
 		<div class="form-group d-flex">
 			<label>&nbsp;</label>
-			<button type="submit" class="btn btn-primary btn-sm mr-2 mw-100px">Apply Filters</button>
-			<a href="{{ route('mcp.patients') }}" class="btn btn-danger btn-sm text-white mw-100px">Clear Filters</a>
+			<button type="submit" v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2 mw-100px">Apply Filters</button>
+			<a href="#" v-on:click.prevent="fastLoad('{{route('mcp.supply_orders')}}')" class="btn btn-danger btn-sm text-white mw-100px">Clear Filters</a>
 		</div>
 	</div>
 </form>
-
+<?php
+$loadedFilters = $filters;
+$allFilterKeys = [
+	'date_category',
+	'date_value_1',
+	'date_value_2',
+	'status'
+];
+for ($i=0; $i < count($allFilterKeys); $i++) {
+	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {
+		$loadedFilters[$allFilterKeys[$i]] = '';
+	}
+}
+?>
 <script>
 	(function() {
 		function init() {
@@ -65,12 +88,13 @@
 				el: '#mcp-supply-orders-filters',
 				delimiters: ['@{{', '}}'],
 				data: {
-					filters: {
-						date_category: "<?= $date_category ?? '' ?>",
-						status: "<?= $status ?? '' ?>"
-					}
+					filters: <?= json_encode($loadedFilters) ?>
 				},
 				methods: {
+					doSubmit: function() {
+						fastLoad('{{ route("mcp.supply_orders") }}?' + $('#mcp-supply-orders-filters').serialize());
+						return false;
+					},
 					init: function() {
 
 					}

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

+ 30 - 32
resources/views/layouts/patient.blade.php

@@ -339,10 +339,8 @@ $isVisitNote = ($routeName === 'patients.view.notes.view.dashboard' && @$note &&
 										</a>
 									</div>
 								@endif
-								<div class=hbox>
-									<div class="screen-only mr-1 patient-presence-indicator thumbnail {{$online}}"
-										 data-patient-uid="{{$patient->uid}}"
-										 style="background-image:<?=$thumbnail?>"><?=$initials?></div>
+								<div class="hbox justify-content-between">
+
 									{{--<div>
 										<div @if($patient->is_microphone_available)style="color:green" @else style="color:gray"  @endif>
 											<i class="fa fa-microphone"></i>
@@ -354,6 +352,9 @@ $isVisitNote = ($routeName === 'patients.view.notes.view.dashboard' && @$note &&
 									<section>
 										<div class=hbox>
 											<h4>{{$patientName}}</h4>
+											<div class="screen-only mr-1 patient-presence-indicator thumbnail {{$online}}"
+											data-patient-uid="{{$patient->uid}}"
+											style="background-image:<?=$thumbnail?>"><?=$initials?></div>
 											<i class=chart>[#{{$patient->chart_number}}]</i>
 										</div>
 										<div class=separators>
@@ -515,19 +516,19 @@ $isVisitNote = ($routeName === 'patients.view.notes.view.dashboard' && @$note &&
 														<div class="mb-2">
 															<label class="text-secondary text-sm">Remove Physician Pro</label>
 
-                                                            </div>
-                                                            <div>
-                                                                <button submit class="btn btn-sm btn-primary mr-1">Submit
-                                                                </button>
-                                                                <button cancel class="btn btn-sm btn-default border">
-                                                                    Cancel
-                                                                </button>
-                                                            </div>
-                                                        </form>
-                                                    </div>
-                                                @endif
-                                            @endif
-                                        </div>
+                                          </div>
+                                          <div>
+                                              <button submit class="btn btn-sm btn-primary mr-1">Submit
+                                              </button>
+                                              <button cancel class="btn btn-sm btn-default border">
+                                                  Cancel
+                                              </button>
+                                          </div>
+                                      </form>
+                                  </div>
+                              @endif
+                          @endif
+                      </div>
 											<div>
 												<label>Engagement Status:</label>
 												<b>{{$patient->client_engagement_status_category ? ucwords(strtolower(str_replace('_', ' ', $patient->client_engagement_status_category))) : '-'}}</b>
@@ -621,7 +622,7 @@ $isVisitNote = ($routeName === 'patients.view.notes.view.dashboard' && @$note &&
                                     <section class="hide-inside-popup screen-only vbox mt-2 align-self-start ml-4">
 
                                         <div moe>
-                                            <button start show><i class="fa fa-plus text-sm text-secondary"></i>&nbsp;Note
+                                            <button class="col-2-button" start show><i class="fa fa-plus text-sm text-secondary"></i>&nbsp;Note
                                             </button>
                                             <form url="/api/note/createUsingTemplate"
                                                   redir="/patients/view/{{$patient->uid}}/notes/view/[data]"
@@ -672,7 +673,7 @@ $isVisitNote = ($routeName === 'patients.view.notes.view.dashboard' && @$note &&
                                         </div>
                                         <div>
                                             <div moe relative>
-                                                <button start show><i class="fa fa-plus text-sm text-secondary"></i>&nbsp;SMS
+                                                <button class="col-2-button" start show><i class="fa fa-plus text-sm text-secondary"></i>&nbsp;SMS
                                                 </button>
                                                 <form url="/api/clientSms/createOutgoing" right class="mcp-theme-1">
                                                     <input type="hidden" name="uid" value="{{ $patient->uid }}">
@@ -699,7 +700,7 @@ $isVisitNote = ($routeName === 'patients.view.notes.view.dashboard' && @$note &&
                                         </div>
                                         <div>
                                         <span moe relative class="">
-                                            <button start show title="SMS check-in link to the patient">Send&nbsp;<i
+                                            <button class="col-2-button" start show title="SMS check-in link to the patient">Send&nbsp;<i
                                                     class="on-hover-opaque fa fa-paper-plane text-secondary"></i></button>
                                             <form url="/api/client/sendCheckInTokenViaSmsOrEmail" right
                                                   class="mcp-theme-1">
@@ -725,24 +726,21 @@ $isVisitNote = ($routeName === 'patients.view.notes.view.dashboard' && @$note &&
                                             </form>
                                         </span>
                                         </div>
-                                    </section>
-									
-                                    <section class="hide-inside-popup screen-only vbox mt-2 align-self-start ml-1">
-                                        @if($performer->pro->pro_type == 'ADMIN')
-                                        <div>
-                                            <button class="col-2-button" onclick="return openInRHS('/pro/check-video/{{ $patient->uid }}')">Check Video</button>
-                                        </div>
-                                        @endif
-										<div>
-											<button class="col-2-button" onclick="return openInRHS('/pro/meet/{{ $patient->uid }}')">Join Video</button>
-										</div>
+																				@if($performer->pro->pro_type == 'ADMIN')
+																				<div>
+																					<button class="col-2-button" onclick="return openInRHS('/pro/check-video/{{ $patient->uid }}')">Check Video</button>
+																				</div>
+																				@endif
+																				<div>
+																					<button class="col-2-button" onclick="return openInRHS('/pro/meet/{{ $patient->uid }}')">Join Video</button>
+																				</div>
                                     </section>
 
 									<section class="hide-inside-popup screen-only vbox align-self-start mt-2 mx-2">
 										@include('app.patient.coverage-status')
 									</section>
 
-									<ul class="vbox ml-auto mt-2 align-self-start patient-header-address">
+									<ul class="vbox mt-2 align-self-start patient-header-address">
 										<li class="d-flex align-items-start">
 											<span class="aligned-icon">
 												<i class="fa fa-map-marker-alt" aria-hidden="true"></i>

+ 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"
+                ]
+            }
+        ]
+    }
+]