Browse Source

fixed canvas to save to pages

= 3 years ago
parent
commit
ba9439981e

+ 44 - 7
resources/views/app/patient/canvas-sections/cc_hpi/default.php

@@ -3,6 +3,7 @@
 use App\Models\Page;
 
 $page = Page::where('client_id', $patient->id)->where('category', 'CANVAS')->where('key', 'cc_hpi')->first();
+$nextFuPage = Page::where('client_id', $patient->id)->where('category', 'CANVAS')->where('key', 'next_fu')->first();
 
 
 /** @var \App\Models\Pro $hcpPro */
@@ -23,16 +24,47 @@ $contentData = [];
 
 if($page){
     $contentData = json_decode($page->data, true);
+        
+    if(!isset($contentData[$hcpPro->id])) {
+        $contentData[$hcpPro->id] = [
+            'current_cc' => []
+        ];
+    }
+
+    if($nextFuPage){
+        if (isset($canvasData["next_fu"]) && isset($canvasData["next_fu"][$hcpPro->id])) {
+            $nextFuData = json_decode($page->data, true);
+            $nextFU = $nextFuData[$hcpPro->id];
+            if(isset($nextFU['next_cc']) && isset($nextFU['next_cc']['list']) && count($nextFU['next_cc']['list'])) {
+                $prefillData = array_map(function($_x) {
+                    if(!isset($_x['icd'])) $_x['icd'] = '';
+                    if(!isset($_x['memo'])) $_x['memo'] = '';
+                    $_x['hpi'] = [
+                        'free_text' => ''
+                    ];
+                    return $_x;
+                }, $nextFU['next_cc']['list']);
+                $contentData[$hcpPro->id]['current_cch'] = [
+                    'list' => $prefillData
+                ];
+            }
+        }
+    }
+    $contentData = $contentData[$hcpPro->id];
+    
 }else{
     if ($patient->canvas_data) {
         $canvasData = json_decode($patient->canvas_data, true);
     
         if(!isset($canvasData["cc_hpi"])) $canvasData["cc_hpi"] = [];
+
+
         if(!isset($canvasData["cc_hpi"][$hcpPro->id])) {
-            $canvasData["cc_hpi"][$hcpPro->id] = [];
+            $canvasData["cc_hpi"][$hcpPro->id] = [
+                'current_cc' => []
+            ];
         }
-    
-        // if next_fu->next_cc available, prefill with that
+
         if (isset($canvasData["next_fu"]) && isset($canvasData["next_fu"][$hcpPro->id])) {
     
             $nextFU = $canvasData["next_fu"][$hcpPro->id];
@@ -45,14 +77,19 @@ if($page){
                     ];
                     return $_x;
                 }, $nextFU['next_cc']['list']);
-                $canvasData["cc_hpi"][$hcpPro->id]['current_cch'] = [
+                $contentData[$hcpPro->id]['current_cch'] = [
                     'list' => $prefillData
                 ];
             }
         }
-        $canvasData = $canvasData['cc_hpi'][$hcpPro->id];
-    
+
+        $contentData = $canvasData['cc_hpi'][$hcpPro->id];
+        
     }
-    $contentData = $canvasData;
 }
 
+if(!isset($contentData['current_cc'])){
+    $contentData['current_cc'] = [];
+}
+
+

+ 6 - 0
resources/views/app/patient/canvas-sections/cc_hpi/summary.php

@@ -23,6 +23,12 @@ if(!@$contentData) {
     $contentData = false;
     if($page){
         $contentData = json_decode($page->data, true);
+        if(!isset($contentData[$hcpPro->id])) {
+            $contentData[$hcpPro->id] = [
+                'current_cc' => []
+            ];
+        }
+        $contentData = $contentData[$hcpPro->id];
     }else{
         if ($patient->canvas_data) {
             $canvasData = json_decode($patient->canvas_data, true);

+ 4 - 4
resources/views/app/patient/canvas-sections/lifestyle_rx_review/default.php

@@ -18,7 +18,7 @@ if(!@$hcpPro) {
 }
 
 $contentData = [];
-if($Page){
+if($page){
     $contentData = json_decode($page->data, true);
 }else{
     if ($patient->canvas_data) {
@@ -30,7 +30,7 @@ if($Page){
 
 
 if(!isset($contentData[$hcpPro->id])) {
-    $canvasData["lifestyle_rx_review"][$hcpPro->id] = [
+    $contentData[$hcpPro->id] = [
         'physical_activity' => [
             'type' => '',
             'frequency' => '',
@@ -147,8 +147,8 @@ if(!isset($contentData[$hcpPro->id])) {
 
 // if lifestyle_rx_update available, prefill with that
 if (isset($contentData) &&
-    isset($$contentData[$hcpPro->id]) &&
-    isset($$contentData[$hcpPro->id]['prescription'])) {
+    isset($contentData[$hcpPro->id]) &&
+    isset($contentData[$hcpPro->id]['prescription'])) {
     $contentData[$hcpPro->id]['adherence'] =$contentData[$hcpPro->id]['prescription'];
 }
 

+ 1 - 1
resources/views/app/patient/canvas-sections/lifestyle_rx_review/summary.php

@@ -33,7 +33,7 @@ if(!@$contentData) {
 
     
     if(isset($contentData) && isset($contentData[$hcpPro->id])) {
-        $contentData = $canvasData["lifestyle_rx_review"][$hcpPro->id];
+        $contentData = $contentData[$hcpPro->id];
     }else { // default data structure
         $contentData = [
             'physical_activity' => [

+ 3 - 4
resources/views/app/patient/canvas-sections/lifestyle_rx_update/default.php

@@ -24,12 +24,11 @@ if($page) {
 }else{
     if ($patient->canvas_data) {
         $canvasData = json_decode($patient->canvas_data, true);
+        if(!isset($canvasData["lifestyle_rx_update"])) $canvasData['lifestyle_rx_update'] = [];
         $contentData = $canvasData["lifestyle_rx_update"];
-        if(!isset($canvasData["lifestyle_rx_update"])) $contentData = [];
     }
-    
-    if(!isset($contentData[$hcpPro->id])) $contentData[$hcpPro->id] = [];
-    $contentData = $contentData[$hcpPro->id];
 }
+if(!isset($contentData[$hcpPro->id])) $contentData[$hcpPro->id] = [];
+$contentData = $contentData[$hcpPro->id];
 
 

+ 56 - 1
resources/views/app/patient/canvas-sections/lifestyle_rx_update/summary.php

@@ -26,12 +26,67 @@ if(!@$contentData) {
     }else{
         if ($patient->canvas_data) {
             $canvasData = json_decode($patient->canvas_data, true);
+            if(!isset($canvasData["lifestyle_rx_update"])) $canvasData["lifestyle_rx_update"] = [];
             $contentData = $canvasData["lifestyle_rx_update"];
-            if(!isset($canvasData["lifestyle_rx_update"])) $contentData = [];
         }
     }
     if(!isset($contentData[$hcpPro->id])) $contentData[$hcpPro->id] = [];
     $contentData = $contentData[$hcpPro->id];    
+
+    if(!isset($contentData['prescription'])) $contentData['prescription'] = [];
+    if(!isset($contentData['prescription']['seated'])) $contentData['prescription']['seated'] = [];
+    if(!isset($contentData['prescription']['seated']['memo'])) $contentData['prescription']['seated']['memo'] = "";
+    if(!isset($contentData['prescription']['seated']['active'])) $contentData['prescription']['seated']['active'] = false;
+
+    if(!isset($contentData['prescription']['arm'])) $contentData['prescription']['arm'] = [];
+    if(!isset($contentData['prescription']['arm']['active'])) $contentData['prescription']['arm']['active'] = [];
+    if(!isset($contentData['prescription']['arm']['memo'])) $contentData['prescription']['arm']['memo'] = [];
+    if(!isset($contentData['prescription']['aquatic'])) $contentData['prescription']['aquatic'] = [];
+    if(!isset($contentData['prescription']['aquatic']['active'])) $contentData['prescription']['aquatic']['active'] = [];
+    if(!isset($contentData['prescription']['aquatic']['memo'])) $contentData['prescription']['aquatic']['memo'] = [];
+    if(!isset($contentData['prescription']['aerobic'])) $contentData['prescription']['aerobic'] = [];
+    if(!isset($contentData['prescription']['aerobic']['active'])) $contentData['prescription']['aerobic']['active'] = [];
+    if(!isset($contentData['prescription']['aerobic']['walk']['active'])) $contentData['prescription']['aerobic']['walk']['active'] = [];
+    if(!isset($contentData['prescription']['aerobic']['walk']['days_per_week'])) $contentData['prescription']['aerobic']['walk']['days_per_week'] = [];
+    if(!isset($contentData['prescription']['aerobic']['walk']['minutes_per_day'])) $contentData['prescription']['aerobic']['walk']['minutes_per_day'] = [];
+    if(!isset($contentData['prescription']['aerobic']['walk']['intensity'])) $contentData['prescription']['aerobic']['walk']['intensity'] = [];
+    if(!isset($contentData['prescription']['aerobic']['walk']['memo'])) $contentData['prescription']['aerobic']['walk']['memo'] = [];
+    if(!isset($contentData['prescription']['aerobic']['jog'])) $contentData['prescription']['aerobic']['jog'] = [];
+    if(!isset($contentData['prescription']['aerobic']['jog']['active'])) $contentData['prescription']['aerobic']['jog']['active'] = [];
+    if(!isset($contentData['prescription']['aerobic']['jog']['days_per_week'])) $contentData['prescription']['aerobic']['jog']['days_per_week'] = [];
+    if(!isset($contentData['prescription']['aerobic']['jog']['minutes_per_day'])) $contentData['prescription']['aerobic']['jog']['minutes_per_day'] = [];
+    if(!isset($contentData['prescription']['aerobic']['jog']['intensity'])) $contentData['prescription']['aerobic']['jog']['intensity'] = [];
+    if(!isset($contentData['prescription']['aerobic']['jog']['memo'])) $contentData['prescription']['aerobic']['jog']['memo'] = [];
+    if(!isset($contentData['prescription']['aerobic']['elliptical'])) $contentData['prescription']['aerobic']['elliptical'] = [];
+    if(!isset($contentData['prescription']['aerobic']['elliptical']['active'])) $contentData['prescription']['aerobic']['elliptical']['active'] = [];
+    if(!isset($contentData['prescription']['aerobic']['elliptical']['days_per_week'])) $contentData['prescription']['aerobic']['elliptical']['days_per_week'] = [];
+    if(!isset($contentData['prescription']['aerobic']['elliptical']['minutes_per_day'])) $contentData['prescription']['aerobic']['elliptical']['minutes_per_day'] = [];
+    if(!isset($contentData['prescription']['aerobic']['elliptical']['intensity'])) $contentData['prescription']['aerobic']['elliptical']['intensity'] = [];
+    if(!isset($contentData['prescription']['aerobic']['elliptical']['memo'])) $contentData['prescription']['aerobic']['elliptical']['memo'] = [];
+    if(!isset($contentData['prescription']['aerobic']['swim'])) $contentData['prescription']['aerobic']['swim'] = [];
+    if(!isset($contentData['prescription']['aerobic']['swim']['active'])) $contentData['prescription']['aerobic']['swim']['active'] = [];
+    if(!isset($contentData['prescription']['aerobic']['swim']['days_per_week'])) $contentData['prescription']['aerobic']['swim']['days_per_week'] = [];
+    if(!isset($contentData['prescription']['aerobic']['swim']['minutes_per_day'])) $contentData['prescription']['aerobic']['swim']['minutes_per_day'] = [];
+    if(!isset($contentData['prescription']['aerobic']['swim']['intensity'])) $contentData['prescription']['aerobic']['swim']['intensity'] = [];
+    if(!isset($contentData['prescription']['aerobic']['swim']['memo'])) $contentData['prescription']['aerobic']['swim']['memo'] = [];
+    if(!isset($contentData['prescription']['aerobic']['bike'])) $contentData['prescription']['aerobic']['bike'] = [];
+    if(!isset($contentData['prescription']['aerobic']['bike']['active'])) $contentData['prescription']['aerobic']['bike']['active'] = [];
+    if(!isset($contentData['prescription']['aerobic']['bike']['days_per_week'])) $contentData['prescription']['aerobic']['bike']['days_per_week'] = [];
+    if(!isset($contentData['prescription']['aerobic']['bike']['minutes_per_day'])) $contentData['prescription']['aerobic']['bike']['minutes_per_day'] = [];
+    if(!isset($contentData['prescription']['aerobic']['bike']['intensity'])) $contentData['prescription']['aerobic']['bike']['intensity'] = [];
+    if(!isset($contentData['prescription']['aerobic']['bike']['memo'])) $contentData['prescription']['aerobic']['bike']['memo'] = [];
+    if(!isset($contentData['prescription']['strength'])) $contentData['prescription']['strength'] = [];
+    if(!isset($contentData['prescription']['strength']['active'])) $contentData['prescription']['strength']['active'] = [];
+    if(!isset($contentData['prescription']['strength']['exercises'])) $contentData['prescription']['strength']['exercises'] = [];
+    if(!isset($contentData['prescription']['neat'])) $contentData['prescription']['neat'] = [];
+    if(!isset($contentData['prescription']['neat']['active'])) $contentData['prescription']['neat']['active'] = [];
+    if(!isset($contentData['prescription']['neat']['recommendations'])) $contentData['prescription']['neat']['recommendations'] = [];
+    if(!isset($contentData['prescription']['neat']['recommendations']['park_farther'])) $contentData['prescription']['neat']['recommendations']['park_farther'] = [];
+    if(!isset($contentData['prescription']['neat']['recommendations']['steps_instead_of_elevator'])) $contentData['prescription']['neat']['recommendations']['steps_instead_of_elevator'] = [];
+    if(!isset($contentData['prescription']['neat']['recommendations']['stand_instead_of_sit'])) $contentData['prescription']['neat']['recommendations']['stand_instead_of_sit'] = [];
+    if(!isset($contentData['prescription']['neat']['recommendations']['steps_goal_per_day'])) $contentData['prescription']['neat']['recommendations']['steps_goal_per_day'] = [];
+    if(!isset($contentData['prescription']['neat']['recommendations']['other'])) $contentData['prescription']['neat']['recommendations']['other'] = [];
+
 }
 
 if($contentData === false) {

+ 5 - 1
resources/views/app/patient/canvas-sections/ros/summary.php

@@ -10,7 +10,7 @@ $contentData = [
 $isempty = false;
 
 if($page){
-    $contentData = json_decode($page, true);
+    $contentData = json_decode($page->data, true);
 }else {
     if ($patient->canvas_data) {
         $canvasData = json_decode($patient->canvas_data, true);
@@ -26,6 +26,10 @@ if($page){
     }
 }
 
+if(!isset($contentData['value'])){
+    $contentData['value'] = '';
+}
+
 if($isempty) {
     echo '<span class="text-secondary">No ROS data</span>';
 }else {

+ 2 - 0
spec/note_implementation_spec_june_30_2021.txt

@@ -4,6 +4,8 @@
 		<vue-app>
 		
 			<edit-mode v-if="view == 'edit'"> 
+				
+			</edit-mode>
 			
 			<summary-markup v-if="view == 'summary'" v-model="summaryHtml">