|
@@ -4,6 +4,10 @@
|
|
|
/** @var \App\Models\Pro $pro */
|
|
|
/** @var \App\Models\Note $note */
|
|
|
|
|
|
+use App\Models\Page;
|
|
|
+
|
|
|
+$page = Page::where('client_id', $patient->id)->where('category', 'CANVAS')->where('key', 'lifestyle_rx_review')->first();
|
|
|
+
|
|
|
if(!@$hcpPro) {
|
|
|
if(@$note) {
|
|
|
$hcpPro = $note->hcpPro;
|
|
@@ -13,134 +17,139 @@ if(!@$hcpPro) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-$canvasData = [];
|
|
|
-if ($patient->canvas_data) {
|
|
|
- $canvasData = json_decode($patient->canvas_data, true);
|
|
|
- if(!isset($canvasData["lifestyle_rx_review"])) $canvasData["lifestyle_rx_review"] = [];
|
|
|
- if(!isset($canvasData["lifestyle_rx_review"][$hcpPro->id])) {
|
|
|
- $canvasData["lifestyle_rx_review"][$hcpPro->id] = [
|
|
|
- 'physical_activity' => [
|
|
|
- 'type' => '',
|
|
|
- 'frequency' => '',
|
|
|
- 'time' => '',
|
|
|
- 'intensity' => '',
|
|
|
- 'enjoyment' => '',
|
|
|
+$contentData = [];
|
|
|
+if($Page){
|
|
|
+ $contentData = json_decode($page->data, true);
|
|
|
+}else{
|
|
|
+ if ($patient->canvas_data) {
|
|
|
+ $canvasData = json_decode($patient->canvas_data, true);
|
|
|
+ if(!isset($canvasData["lifestyle_rx_review"])) $canvasData["lifestyle_rx_review"] = [];
|
|
|
+ $contentData = $canvasData["lifestyle_rx_review"];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+if(!isset($contentData[$hcpPro->id])) {
|
|
|
+ $canvasData["lifestyle_rx_review"][$hcpPro->id] = [
|
|
|
+ 'physical_activity' => [
|
|
|
+ 'type' => '',
|
|
|
+ 'frequency' => '',
|
|
|
+ 'time' => '',
|
|
|
+ 'intensity' => '',
|
|
|
+ 'enjoyment' => '',
|
|
|
+ ],
|
|
|
+ 'barriers' => '', // free text
|
|
|
+ 'assessment' => '', // Inactive, Insufficiently Active, Active, Highly Active
|
|
|
+ 'adherence' => [
|
|
|
+ 'seated' => [
|
|
|
+ 'active' => false,
|
|
|
+ 'memo' => '',
|
|
|
+ 'adherence' => '',
|
|
|
+ 'adherence_memo' => '',
|
|
|
+ ],
|
|
|
+ 'arm' => [
|
|
|
+ 'active' => false,
|
|
|
+ 'memo' => '',
|
|
|
+ 'adherence' => '',
|
|
|
+ 'adherence_memo' => '',
|
|
|
],
|
|
|
- 'barriers' => '', // free text
|
|
|
- 'assessment' => '', // Inactive, Insufficiently Active, Active, Highly Active
|
|
|
- 'adherence' => [
|
|
|
- 'seated' => [
|
|
|
+ 'aquatic' => [
|
|
|
+ 'active' => false,
|
|
|
+ 'memo' => '',
|
|
|
+ 'adherence' => '',
|
|
|
+ 'adherence_memo' => '',
|
|
|
+ ],
|
|
|
+ 'aerobic' => [
|
|
|
+ 'active' => false,
|
|
|
+ 'walk' => [
|
|
|
'active' => false,
|
|
|
+ 'days_per_week' => '',
|
|
|
+ 'minutes_per_day' => '',
|
|
|
+ 'intensity' => '', // Light, Moderate, Vigorous
|
|
|
'memo' => '',
|
|
|
'adherence' => '',
|
|
|
'adherence_memo' => '',
|
|
|
],
|
|
|
- 'arm' => [
|
|
|
+ 'jog' => [
|
|
|
'active' => false,
|
|
|
+ 'days_per_week' => '',
|
|
|
+ 'minutes_per_day' => '',
|
|
|
+ 'intensity' => '', // Light, Moderate, Vigorous
|
|
|
'memo' => '',
|
|
|
'adherence' => '',
|
|
|
'adherence_memo' => '',
|
|
|
],
|
|
|
- 'aquatic' => [
|
|
|
+ 'elliptical' => [
|
|
|
'active' => false,
|
|
|
+ 'days_per_week' => '',
|
|
|
+ 'minutes_per_day' => '',
|
|
|
+ 'intensity' => '', // Light, Moderate, Vigorous
|
|
|
'memo' => '',
|
|
|
'adherence' => '',
|
|
|
'adherence_memo' => '',
|
|
|
],
|
|
|
- 'aerobic' => [
|
|
|
+ 'swim' => [
|
|
|
'active' => false,
|
|
|
- 'walk' => [
|
|
|
- 'active' => false,
|
|
|
- 'days_per_week' => '',
|
|
|
- 'minutes_per_day' => '',
|
|
|
- 'intensity' => '', // Light, Moderate, Vigorous
|
|
|
- 'memo' => '',
|
|
|
- 'adherence' => '',
|
|
|
- 'adherence_memo' => '',
|
|
|
- ],
|
|
|
- 'jog' => [
|
|
|
- 'active' => false,
|
|
|
- 'days_per_week' => '',
|
|
|
- 'minutes_per_day' => '',
|
|
|
- 'intensity' => '', // Light, Moderate, Vigorous
|
|
|
- 'memo' => '',
|
|
|
- 'adherence' => '',
|
|
|
- 'adherence_memo' => '',
|
|
|
- ],
|
|
|
- 'elliptical' => [
|
|
|
- 'active' => false,
|
|
|
- 'days_per_week' => '',
|
|
|
- 'minutes_per_day' => '',
|
|
|
- 'intensity' => '', // Light, Moderate, Vigorous
|
|
|
- 'memo' => '',
|
|
|
- 'adherence' => '',
|
|
|
- 'adherence_memo' => '',
|
|
|
- ],
|
|
|
- 'swim' => [
|
|
|
- 'active' => false,
|
|
|
- 'days_per_week' => '',
|
|
|
- 'minutes_per_day' => '',
|
|
|
- 'intensity' => '', // Light, Moderate, Vigorous
|
|
|
- 'memo' => '',
|
|
|
- 'adherence' => '',
|
|
|
- 'adherence_memo' => '',
|
|
|
- ],
|
|
|
- 'bike' => [
|
|
|
- 'active' => false,
|
|
|
+ 'days_per_week' => '',
|
|
|
+ 'minutes_per_day' => '',
|
|
|
+ 'intensity' => '', // Light, Moderate, Vigorous
|
|
|
+ 'memo' => '',
|
|
|
+ 'adherence' => '',
|
|
|
+ 'adherence_memo' => '',
|
|
|
+ ],
|
|
|
+ 'bike' => [
|
|
|
+ 'active' => false,
|
|
|
+ 'days_per_week' => '',
|
|
|
+ 'minutes_per_day' => '',
|
|
|
+ 'intensity' => '', // Light, Moderate, Vigorous
|
|
|
+ 'memo' => '',
|
|
|
+ 'adherence' => '',
|
|
|
+ 'adherence_memo' => '',
|
|
|
+ ],
|
|
|
+ ],
|
|
|
+ 'strength' => [
|
|
|
+ 'active' => false,
|
|
|
+ 'exercises' => [
|
|
|
+ [
|
|
|
+ 'name' => '',
|
|
|
'days_per_week' => '',
|
|
|
- 'minutes_per_day' => '',
|
|
|
+ 'reps' => '',
|
|
|
'intensity' => '', // Light, Moderate, Vigorous
|
|
|
'memo' => '',
|
|
|
'adherence' => '',
|
|
|
'adherence_memo' => '',
|
|
|
- ],
|
|
|
- ],
|
|
|
- 'strength' => [
|
|
|
- 'active' => false,
|
|
|
- 'exercises' => [
|
|
|
- [
|
|
|
- 'name' => '',
|
|
|
- 'days_per_week' => '',
|
|
|
- 'reps' => '',
|
|
|
- 'intensity' => '', // Light, Moderate, Vigorous
|
|
|
- 'memo' => '',
|
|
|
- 'adherence' => '',
|
|
|
- 'adherence_memo' => '',
|
|
|
- ]
|
|
|
- ]
|
|
|
- ],
|
|
|
- 'neat' => [
|
|
|
- 'active' => false,
|
|
|
- 'recommendations' => [
|
|
|
- 'park_farther' => false,
|
|
|
- 'park_farther_adherence' => '',
|
|
|
- 'park_farther_adherence_memo' => '',
|
|
|
- 'steps_instead_of_elevator' => false,
|
|
|
- 'steps_instead_of_elevator_adherence' => '',
|
|
|
- 'steps_instead_of_elevator_adherence_memo' => '',
|
|
|
- 'stand_instead_of_sit' => false,
|
|
|
- 'stand_instead_of_sit_adherence' => '',
|
|
|
- 'stand_instead_of_sit_adherence_memo' => '',
|
|
|
- 'steps_goal_per_day' => '',
|
|
|
- 'steps_goal_per_day_adherence' => '',
|
|
|
- 'steps_goal_per_day_adherence_memo' => '',
|
|
|
- 'other' => '',
|
|
|
- 'other_adherence' => '',
|
|
|
- 'other_adherence_memo' => '',
|
|
|
]
|
|
|
]
|
|
|
+ ],
|
|
|
+ 'neat' => [
|
|
|
+ 'active' => false,
|
|
|
+ 'recommendations' => [
|
|
|
+ 'park_farther' => false,
|
|
|
+ 'park_farther_adherence' => '',
|
|
|
+ 'park_farther_adherence_memo' => '',
|
|
|
+ 'steps_instead_of_elevator' => false,
|
|
|
+ 'steps_instead_of_elevator_adherence' => '',
|
|
|
+ 'steps_instead_of_elevator_adherence_memo' => '',
|
|
|
+ 'stand_instead_of_sit' => false,
|
|
|
+ 'stand_instead_of_sit_adherence' => '',
|
|
|
+ 'stand_instead_of_sit_adherence_memo' => '',
|
|
|
+ 'steps_goal_per_day' => '',
|
|
|
+ 'steps_goal_per_day_adherence' => '',
|
|
|
+ 'steps_goal_per_day_adherence_memo' => '',
|
|
|
+ 'other' => '',
|
|
|
+ 'other_adherence' => '',
|
|
|
+ 'other_adherence_memo' => '',
|
|
|
+ ]
|
|
|
]
|
|
|
- ];
|
|
|
- }
|
|
|
-
|
|
|
- // if lifestyle_rx_update available, prefill with that
|
|
|
- if (isset($canvasData["lifestyle_rx_update"]) &&
|
|
|
- isset($canvasData["lifestyle_rx_update"][$hcpPro->id]) &&
|
|
|
- isset($canvasData["lifestyle_rx_update"][$hcpPro->id]['prescription'])) {
|
|
|
- $canvasData["lifestyle_rx_review"][$hcpPro->id]['adherence'] = $canvasData["lifestyle_rx_update"][$hcpPro->id]['prescription'];
|
|
|
- }
|
|
|
-
|
|
|
- $canvasData = $canvasData['lifestyle_rx_review'][$hcpPro->id];
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+}
|
|
|
|
|
|
+// if lifestyle_rx_update available, prefill with that
|
|
|
+if (isset($contentData) &&
|
|
|
+ isset($$contentData[$hcpPro->id]) &&
|
|
|
+ isset($$contentData[$hcpPro->id]['prescription'])) {
|
|
|
+ $contentData[$hcpPro->id]['adherence'] =$contentData[$hcpPro->id]['prescription'];
|
|
|
}
|
|
|
-$contentData = $canvasData;
|
|
|
+
|
|
|
+$contentData = $contentData[$hcpPro->id];
|