소스 검색

Note sections cc_hpi and next_fu

Vijayakrishnan 4 년 전
부모
커밋
91c92272da

+ 7 - 0
app/Http/Controllers/NoteController.php

@@ -86,6 +86,13 @@ class NoteController extends Controller
 
         if ($sectionTemplate->is_canvas) {
             if (file_exists(resource_path('views/app/patient/canvas-sections/' . $sectionTemplate->internal_name . '/default.php'))) {
+
+                // for canvas section where we have pro mapped data, use sectionProUid
+                $sectionPro = null;
+                if(\request()->input('sectionProUid')) {
+                    $sectionPro = Pro::where('uid', \request()->input('sectionProUid'))->first();
+                }
+
                 // default should simply assign to $contentData
                 include(resource_path('views/app/patient/canvas-sections/' . $sectionTemplate->internal_name . '/default.php'));
 

+ 24 - 18
resources/views/app/patient/canvas-sections/cc_hpi/form.blade.php

@@ -1,10 +1,22 @@
 <?php
-/** @var \App\Models\Pro $ccPro */
+/** @var \App\Models\Pro $sectionPro */
+/** @var \App\Models\Pro $pro */
+/** @var \App\Models\Note $note */
+
+if(!@$sectionPro) {
+    if(@$note) {
+        $sectionPro = $note->hcpPro;
+    }
+    else {
+        $sectionPro = $pro; // should never get here
+    }
+}
+
 if(!$contentData) $contentData = [];
-if( !isset($contentData[$ccPro->uid]) ||
-    !isset($contentData[$ccPro->uid]['current_cch']) ||
-    !count($contentData[$ccPro->uid]['current_cch']['list'])) {
-    $contentData[$ccPro->uid] = [
+if( !isset($contentData[$sectionPro->uid]) ||
+    !isset($contentData[$sectionPro->uid]['current_cch']) ||
+    !count($contentData[$sectionPro->uid]['current_cch']['list'])) {
+    $contentData[$sectionPro->uid] = [
         "current_cch" => [
             "list" => [
                 [
@@ -17,12 +29,6 @@ if( !isset($contentData[$ccPro->uid]) ||
                     ],
                 ]
             ]
-        ],
-        "next_fu" => [
-            "date" => null
-        ],
-        "next_cc" => [
-            "list" => []
         ]
     ];
 }
@@ -56,11 +62,11 @@ $formID = rand(0, 100000);
             <th class="px-2 text-secondary border-bottom-0">Title</th>
             <th class="px-2 text-secondary border-bottom-0">ICD</th>
             <th class="px-2 text-secondary border-bottom-0 w-35">Memo</th>
-            <th v-if="data['{{$ccPro->uid}}']['current_cch']['list'].length > 1" class="px-2 text-secondary border-bottom-0"></th>
+            <th v-if="data['{{$sectionPro->uid}}']['current_cch']['list'].length > 1" class="px-2 text-secondary border-bottom-0"></th>
         </tr>
         </thead>
         <tbody>
-        <tr v-for="(item, index) in data['{{$ccPro->uid}}']['current_cch']['list']">
+        <tr v-for="(item, index) in data['{{$sectionPro->uid}}']['current_cch']['list']">
             <td class="px-2 pt-2 text-center text-sm font-weight-bold">@{{ index + 1 }}</td>
             <td>
                 <select class="form-control form-control-sm" v-model="item.category" required>
@@ -85,7 +91,7 @@ $formID = rand(0, 100000);
                        class="form-control form-control-sm"
                        v-model="item.memo">
             </td>
-            <td v-if="data['{{$ccPro->uid}}']['current_cch']['list'].length > 1" class="px-2 text-nowrap">
+            <td v-if="data['{{$sectionPro->uid}}']['current_cch']['list'].length > 1" class="px-2 text-nowrap">
                 <a href="#" v-on:click.prevent="removeItem(index)"
                    class="on-hover-opaque text-danger mt-1 d-inline-block">
                     <i class="fa fa-trash-alt"></i>
@@ -95,7 +101,7 @@ $formID = rand(0, 100000);
         </tbody>
     </table>
 
-    <p class="font-weight-bold mb-2">HPI</p>
+    <p class="font-weight-bold mt-3 mb-2">HPI</p>
 
     <table class="table table-sm table-bordered mb-2 table-edit-sheet">
         <thead>
@@ -105,7 +111,7 @@ $formID = rand(0, 100000);
         </tr>
         </thead>
         <tbody>
-        <tr v-for="(item, index) in data['{{$ccPro->uid}}']['current_cch']['list']">
+        <tr v-for="(item, index) in data['{{$sectionPro->uid}}']['current_cch']['list']">
             <td class="align-middle px-2">
                 @{{ item.category }}@{{ item.name ? ' / ' + item.name : '' }}@{{ item.icd ? ' / ' + item.icd : '' }}
             </td>
@@ -141,7 +147,7 @@ $formID = rand(0, 100000);
                 },
                 methods: {
                     addItem: function() {
-                        this.data['{{$ccPro->uid}}']['current_cch']['list'].push({
+                        this.data['{{$sectionPro->uid}}']['current_cch']['list'].push({
                             "category": '',
                             "name": '',
                             "icd": '',
@@ -152,7 +158,7 @@ $formID = rand(0, 100000);
                         });
                     },
                     removeItem: function(_index) {
-                        this.data['{{$ccPro->uid}}']['current_cch']['list'].splice(_index, 1);
+                        this.data['{{$sectionPro->uid}}']['current_cch']['list'].splice(_index, 1);
                     },
                     cleanArray: function(_source) {
                         let plItems = [], plObject = {};

+ 16 - 2
resources/views/app/patient/canvas-sections/cc_hpi/summary.php

@@ -1,5 +1,18 @@
 <?php
 
+/** @var \App\Models\Pro $sectionPro */
+/** @var \App\Models\Pro $pro */
+/** @var \App\Models\Note $note */
+
+if(!@$sectionPro) {
+    if(@$note) {
+        $sectionPro = $note->hcpPro;
+    }
+    else {
+        $sectionPro = $pro; // should never get here
+    }
+}
+
 $contentData = false;
 if ($patient->canvas_data) {
     $canvasData = json_decode($patient->canvas_data, true);
@@ -8,13 +21,14 @@ if ($patient->canvas_data) {
     }
 }
 
-if($contentData === false || !isset($contentData[$pro->uid])) {
+if($contentData === false || !isset($contentData[$sectionPro->uid])) {
     ?>
     <div class="text-secondary">No data in this section yet</div>
     <?php
 }
 else {
-    print_r($contentData[$pro->uid]);
+    print_r($contentData[$sectionPro->uid]);
+    // echo "Hello";
 }
 
 /*

+ 10 - 0
resources/views/app/patient/canvas-sections/next_fu/default.php

@@ -0,0 +1,10 @@
+<?php
+
+$canvasData = [];
+if ($patient->canvas_data) {
+    $canvasData = json_decode($patient->canvas_data, true);
+    if (isset($canvasData["next_fu"])) {
+        $canvasData = $canvasData["next_fu"];
+    }
+}
+$contentData = $canvasData;

+ 167 - 0
resources/views/app/patient/canvas-sections/next_fu/form.blade.php

@@ -0,0 +1,167 @@
+<?php
+/** @var \App\Models\Pro $sectionPro */
+/** @var \App\Models\Pro $pro */
+
+if(!@$sectionPro) {
+    $sectionPro = $pro;
+}
+
+if(!$contentData) $contentData = [];
+if(!isset($contentData[$sectionPro->uid])) {
+    $contentData[$sectionPro->uid] = [
+        "next_fu" => [
+            "active" => true,
+            "date" => null
+        ],
+        "next_cc" => [
+            "list" => [
+                [
+                    "category" => 'follow-up',
+                    "name" => 'Follow Up on Plan & Progress, Safety Monitoring',
+                ]
+            ]
+        ]
+    ];
+}
+
+$formID = rand(0, 100000);
+?>
+
+<div id="next_fuSection_{{$formID}}">
+    <h3 class="stag-popup-title mb-2 border-bottom pb-1 hide-if-note pt-1 pb-2">
+        <span>Follow-up Appointment</span>
+        <a href="#" onclick="return closeStagPopup()"
+           class="ml-auto text-secondary">
+            <i class="fa fa-times-circle"></i>
+        </a>
+    </h3>
+
+    <input type="hidden" name="data" value="{{json_encode($contentData)}}">
+
+    <div class="border p-3 my-3 bg-aliceblue">
+
+        <p class="font-weight-bold mb-0">
+            <label class="m-0 d-flex align-items-center">
+                <span class="mr-2">Follow-up Appointment</span>
+                <input type="checkbox" v-model="data['{{$sectionPro->uid}}']['next_fu']['active']">
+            </label>
+        </p>
+
+        <label v-if="data['{{$sectionPro->uid}}']['next_fu']['active']" class="mt-3 d-flex align-items-center">
+            <span class="mr-2">Follow Up Date</span>
+            <input type="date" v-model="data['{{$sectionPro->uid}}']['next_fu']['date']">
+            <a v-if="data['{{$sectionPro->uid}}']['next_fu']['active'] && !!data['{{$sectionPro->uid}}']['next_fu']['date']" native target="_blank" href="{{route('patients.view.calendar', ['patient' => $patient])}}" class="ml-3">
+                <i class="fa fa-calendar-alt"></i>
+                Patient Calendar
+            </a>
+        </label>
+
+        <div v-if="data['{{$sectionPro->uid}}']['next_fu']['active']" class="mt-3">
+        <div class="mb-2">
+            <span class="font-weight-bold">Next CC</span>
+            <a href="#" class="ml-3"
+               v-on:click.prevent="addNextCCItem()"
+            >+ Add</a>
+        </div>
+        <table class="table table-sm table-bordered mb-0 table-edit-sheet">
+            <thead>
+            <tr class="bg-light">
+                <th class="px-2 text-secondary border-bottom-0 width-30px text-center">#</th>
+                <th class="px-2 text-secondary border-bottom-0">Category</th>
+                <th class="px-2 text-secondary border-bottom-0">Title</th>
+                <th class="px-2 text-secondary border-bottom-0">ICD</th>
+                <th class="px-2 text-secondary border-bottom-0 w-35">Memo</th>
+                <th v-if="data['{{$sectionPro->uid}}']['next_cc']['list'].length > 1" class="px-2 text-secondary border-bottom-0"></th>
+            </tr>
+            </thead>
+            <tbody>
+            <tr v-for="(item, index) in data['{{$sectionPro->uid}}']['next_cc']['list']">
+                <td class="px-2 pt-2 text-center text-sm font-weight-bold">@{{ index + 1 }}</td>
+                <td>
+                    <select class="form-control form-control-sm" v-model="item.category" required>
+                        <option value="dx">Dx</option>
+                        <option value="symptom">Symptom</option>
+                        <option value="goal">Goal</option>
+                        <option value="follow-up">Follow-Up</option>
+                    </select>
+                </td>
+                <td>
+                    <input type="text" :data-index="index"
+                           class="form-control form-control-sm"
+                           v-model="item.name" required>
+                </td>
+                <td>
+                    <input type="text" :data-index="index"
+                           class="form-control form-control-sm"
+                           v-model="item.icd">
+                </td>
+                <td>
+                    <input type="text" :data-index="index"
+                           class="form-control form-control-sm"
+                           v-model="item.memo">
+                </td>
+                <td v-if="data['{{$sectionPro->uid}}']['next_cc']['list'].length > 1" class="px-2 text-nowrap">
+                    <a href="#" v-on:click.prevent="removeNextCCItem(index)"
+                       class="on-hover-opaque text-danger mt-1 d-inline-block">
+                        <i class="fa fa-trash-alt"></i>
+                    </a>
+                </td>
+            </tr>
+            </tbody>
+        </table>
+    </div>
+
+    </div>
+
+</div>
+<script>
+    (function() {
+        function init() {
+            window.clientNextFUApp_{{$formID}} = new Vue({
+                el: '#next_fuSection_{{$formID}}',
+                data: {
+                    data: <?= json_encode($contentData) ?>,
+                },
+                mounted: function() {
+                    $('#next_fuSection_{{$formID}} [moe][initialized]').removeAttr('initialized');
+                    initMoes();
+                },
+                watch: {
+                    $data: {
+                        handler: function(val, oldVal) {
+                            $(this.$el).closest('#next_fuSection_{{$formID}}').find('[name="data"]').val(JSON.stringify(this.data));
+                        },
+                        deep: true
+                    }
+                },
+                methods: {
+                    addNextCCItem: function() {
+                        this.data['{{$sectionPro->uid}}']['next_cc']['list'].push({
+                            "category": '',
+                            "name": '',
+                            "icd": '',
+                            "memo": '',
+                        });
+                    },
+                    removeNextCCItem: function(_index) {
+                        this.data['{{$sectionPro->uid}}']['next_cc']['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;
+                    },
+                }
+            });
+        }
+        addMCInitializer('client-next_fu{{$formID}}', init, '#next_fuSection_{{$formID}}');
+    })();
+</script>

+ 50 - 0
resources/views/app/patient/canvas-sections/next_fu/summary.php

@@ -0,0 +1,50 @@
+<?php
+
+$contentData = false;
+if ($patient->canvas_data) {
+    $canvasData = json_decode($patient->canvas_data, true);
+    if(isset($canvasData["next_fu"])) {
+        $contentData = $canvasData["next_fu"];
+    }
+}
+
+if($contentData === false || !isset($contentData[$sectionPro->uid])) {
+    ?>
+    <div class="text-secondary">No data in this section yet</div>
+    <?php
+}
+else {
+    print_r($contentData[$sectionPro->uid]);
+    // echo "Hello";
+}
+
+/*
+if(count($contentData['items'])) {
+    for ($i = 0; $i < count($contentData['items']); $i++) {
+        $item = $contentData['items'][$i];
+?>
+        <div class="mb-2">
+            <div class="">
+                <?php if(isset($item["title"]) && !empty($item["title"])): ?>
+                    <b><?= $item["title"] ?></b>
+                <?php endif; ?>
+                <?= !!$item["strength"] ? '/&nbsp;' . $item["strength"] : '' ?>
+                <?= !!$item["frequency"] ? '/&nbsp;' . $item["frequency"] : '' ?>
+            </div>
+            <?php
+            $detailPlain = isset($item["detail"]) ? $item["detail"] : '';
+            $detailPlain = trim(strip_tags($detailPlain));
+            if(!empty($detailPlain)):
+            ?>
+                <div class="text-secondary"><?= $detailPlain ?></div>
+            <?php endif; ?>
+        </div>
+<?php
+    }
+}
+else {
+    ?>
+    <div class="text-secondary">Nothing here yet!</div>
+    <?php
+}*/
+?>

+ 0 - 12
resources/views/app/patient/dashboard.blade.php

@@ -32,18 +32,6 @@
                 {{-- appointments --}}
                 @include('app/patient/partials/appointments')
 
-                {{-- cc & hpi --}}
-                <div class="pt-2 mt-2 border-top">
-                    <div class="d-flex align-items-center pb-2">
-                        <h6 class="my-0 font-weight-bold text-secondary">CC & HPI</h6>
-                        <span class="mx-2 text-secondary">|</span>
-                        @include('app.patient.canvas-sections.canvas-editor-modal', ['key' => 'cc_hpi', 'ccPro' => $pro])
-                    </div>
-                    <div class="bg-light border p-2 mb-3">
-                        @include('app.patient.canvas-sections.cc_hpi.summary')
-                    </div>
-                </div>
-
                 {{-- canvas based allergies --}}
                 <div class="pt-2 mt-2 border-top">
                     <div class="d-flex align-items-center pb-2">