浏览代码

lifestyle_rx_update => hidden "data" field

Vijayakrishnan 4 年之前
父节点
当前提交
ceeb91f7ca

+ 0 - 22
resources/views/app/patient/canvas-sections/lifestyle_rx_update/default.php

@@ -20,27 +20,5 @@ if ($patient->canvas_data) {
     if (isset($canvasData["lifestyle_rx_update"])) {
         $canvasData = $canvasData["lifestyle_rx_update"];
     }
-
-    // if lifestyle_rx_review available, prefill with that
-    /*if (isset($canvasData["next_fu"]) && isset($canvasData["next_fu"][$sectionPro])) {
-        $nextFU = $canvasData["next_fu"][$sectionPro];
-        if(isset($nextFU['list']) && count($nextFU['list'])) {
-            if(!isset($canvasData[$sectionPro])) {
-                $canvasData[$sectionPro] = [];
-            }
-            $prefillData = array_map(function($_x) {
-                if(!isset($_x['icd'])) $_x['icd'] = '';
-                if(!isset($_x['memo'])) $_x['memo'] = '';
-                $_x['hpi'] = [
-                    'free_text' => ''
-                ];
-                return $_x;
-            }, $nextFU['list']);
-            $canvasData[$sectionPro]['current_cch'] = [
-                'list' => $prefillData
-            ];
-        }
-    }*/
-
 }
 $contentData = $canvasData;

+ 66 - 18
resources/views/app/patient/canvas-sections/lifestyle_rx_update/form.blade.php

@@ -15,27 +15,24 @@ if(!@$sectionPro) {
 if(!$contentData) $contentData = [];
 if(!isset($contentData[$sectionPro->uid])) {
     $contentData[$sectionPro->uid] = [
-        'physical_activity' => [
-            'type' => '',
-            'frequency' => '',
-            'time' => '',
-            'intensity' => '',
-            'enjoyment' => '',
-        ],
-        'barriers' => '',   // free text
-        'assessment' => '', // Inactive, Insufficiently Active, Active, Highly Active
         'prescription' => [
             'seated' => [
                 'active' => false,
-                'memo' => ''
+                'memo' => '',
+                'adherence' => '',
+                'adherence_memo' => '',
             ],
             'arm' => [
                 'active' => false,
-                'memo' => ''
+                'memo' => '',
+                'adherence' => '',
+                'adherence_memo' => '',
             ],
             'aquatic' => [
                 'active' => false,
-                'memo' => ''
+                'memo' => '',
+                'adherence' => '',
+                'adherence_memo' => '',
             ],
             'aerobic' => [
                 'active' => false,
@@ -44,35 +41,45 @@ if(!isset($contentData[$sectionPro->uid])) {
                     'days_per_week' => '',
                     'minutes_per_day' => '',
                     'intensity' => '', // Light, Moderate, Vigorous
-                    'memo' => ''
+                    'memo' => '',
+                    'adherence' => '',
+                    'adherence_memo' => '',
                 ],
                 'jog' => [
                     'active' => false,
                     'days_per_week' => '',
                     'minutes_per_day' => '',
                     'intensity' => '', // Light, Moderate, Vigorous
-                    'memo' => ''
+                    'memo' => '',
+                    'adherence' => '',
+                    'adherence_memo' => '',
                 ],
                 'elliptical' => [
                     'active' => false,
                     'days_per_week' => '',
                     'minutes_per_day' => '',
                     'intensity' => '', // Light, Moderate, Vigorous
-                    'memo' => ''
+                    'memo' => '',
+                    'adherence' => '',
+                    'adherence_memo' => '',
                 ],
                 'swim' => [
                     'active' => false,
                     'days_per_week' => '',
                     'minutes_per_day' => '',
                     'intensity' => '', // Light, Moderate, Vigorous
-                    'memo' => ''
+                    'memo' => '',
+                    'adherence' => '',
+                    'adherence_memo' => '',
                 ],
                 'bike' => [
                     'active' => false,
                     'days_per_week' => '',
                     'minutes_per_day' => '',
                     'intensity' => '', // Light, Moderate, Vigorous
-                    'memo' => ''
+                    'memo' => '',
+                    'adherence' => '',
+                    'adherence_memo' => '',
                 ],
             ],
             'strength' => [
@@ -84,6 +91,8 @@ if(!isset($contentData[$sectionPro->uid])) {
                         'reps' => '',
                         'intensity' => '', // Light, Moderate, Vigorous
                         'memo' => '',
+                        'adherence' => '',
+                        'adherence_memo' => '',
                     ]
                 ]
             ],
@@ -91,10 +100,20 @@ if(!isset($contentData[$sectionPro->uid])) {
                 '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' => '',
                 ]
             ]
         ]
@@ -105,6 +124,9 @@ $formID = rand(0, 100000);
 ?>
 
 <div id="pauSection_{{$formID}}">
+
+    <input type="hidden" name="data" value="{{json_encode($contentData)}}">
+
     <h3 class="stag-popup-title mb-3 border-bottom pb-1 hide-if-note pt-1 pb-2">
         <span>Lifestyle Rx Update</span>
         <a href="#" onclick="return closeStagPopup()"
@@ -411,7 +433,33 @@ $formID = rand(0, 100000);
                     }
                 },
                 methods: {
-
+                    addItem: function() {
+                        this.data['{{$sectionPro->uid}}']['current_cch']['list'].push({
+                            "category": '',
+                            "name": '',
+                            "icd": '',
+                            "memo": '',
+                            "hpi": {
+                                "free_text": ''
+                            },
+                        });
+                    },
+                    removeItem: function(_index) {
+                        this.data['{{$sectionPro->uid}}']['current_cch']['list'].splice(_index, 1);
+                    },
+                    cleanArray: function(_source) {
+                        let plItems = [], plObject = {};
+                        for (let x=0; x<_source.length; x++) {
+                            plObject = {};
+                            for (let y in _source[x]) {
+                                if(_source[x].hasOwnProperty(y)) {
+                                    plObject[y] = _source[x][y];
+                                }
+                            }
+                            plItems.push(plObject);
+                        }
+                        return plItems;
+                    },
                 }
             });
         }