Kaynağa Gözat

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

= 4 yıl önce
ebeveyn
işleme
679398712b

+ 55 - 0
.env-example

@@ -0,0 +1,55 @@
+APP_NAME=Stag
+APP_ENV=local
+APP_KEY=base64:1yKRgeLWTeEXTfh51vXtJaf6GJaRUn4NHzdlOdyDpRY=
+APP_DEBUG=true
+APP_URL=http://localhost
+
+LOG_CHANNEL=stack
+
+DB_CONNECTION=pgsql
+DB_HOST=127.0.0.1
+DB_PORT=5432
+DB_DATABASE=stag2
+DB_USERNAME=postgres
+DB_PASSWORD=pass
+
+BROADCAST_DRIVER=log
+CACHE_DRIVER=file
+QUEUE_CONNECTION=sync
+SESSION_DRIVER=file
+SESSION_LIFETIME=120
+
+REDIS_HOST=127.0.0.1
+REDIS_PASSWORD=null
+REDIS_PORT=6379
+
+MAIL_MAILER=smtp
+MAIL_HOST=smtp.mailtrap.io
+MAIL_PORT=2525
+MAIL_USERNAME=null
+MAIL_PASSWORD=null
+MAIL_ENCRYPTION=null
+MAIL_FROM_ADDRESS=null
+MAIL_FROM_NAME="${APP_NAME}"
+
+AWS_ACCESS_KEY_ID=
+AWS_SECRET_ACCESS_KEY=
+AWS_DEFAULT_REGION=us-east-1
+AWS_BUCKET=
+
+PUSHER_APP_ID=
+PUSHER_APP_KEY=
+PUSHER_APP_SECRET=
+PUSHER_APP_CLUSTER=mt1
+
+MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
+MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
+
+BACKEND_URL="http://localhost:8080/api"
+ADMIN_PORTAL_URL="http://localhost:3000"
+
+AUTH_URL="http://localhost:3002"
+
+BACKEND_WS_URL=http://localhost:8080/ws
+AGORA_APPID=9d04292b03524927a8fe9d937a448d85
+AGORA_MODE=screen

+ 4 - 0
app/Http/Controllers/PracticeManagementController.php

@@ -988,6 +988,10 @@ class PracticeManagementController extends Controller
             }
         }
 
+        $patientsQuery->whereRaw('(SELECT COUNT(*) FROM note where note.client_id = client.id) > 0');
+
+        $patientsQuery->orderBy('notes_without_claiming_closed', 'DESC');
+
         $patients = $patientsQuery->paginate(50);
 
         $data = [

+ 1 - 1
config/app.php

@@ -63,7 +63,7 @@ return [
 
     'hrm2_url' => env('HRM2_URL'),
 
-    'asset_version' => 2,
+    'asset_version' => 3,
 
     /*
     |--------------------------------------------------------------------------

+ 22 - 0
public/css/style.css

@@ -1708,4 +1708,26 @@ form.non-interactive .form-content * {
 }
 .training-event .patient-avatar {
     border-color: #0d59af7d !important;
+}
+
+
+/* print-note */
+@media print {
+    .stag-content #sidebarMenu {
+        display: none !important;
+    }
+    .stag-content .main-row {
+        padding-left: 0 !important;
+    }
+    .stag-content [moe] {
+        display: none !important;
+    }
+    .stag-content .screen-only {
+        display: none !important;
+    }
+}
+@media screen {
+    .stag-content .print-only {
+        display: none !important;
+    }
 }

+ 64 - 23
resources/views/app/patient/canvas-sections/dx/form.blade.php

@@ -12,8 +12,11 @@ if(!$contentData || !isset($contentData['items']) || !count($contentData['items'
                 "title" => "",
                 "icd" => "",
                 "coa" => "Chronic",
-                "detail" => "",
+                "previous_hpi" => "",
+                "detail" => "", // actually HPI (name retained to avoid breakage)
+                "previous_plan" => "",
                 "plan" => "",
+                "note_uid" => "",
             ]
         ]
     ];
@@ -68,7 +71,7 @@ $formID = rand(0, 100000);
             </th>
             <th class="px-2 text-secondary border-bottom-0 w-35">
                 <div class="d-flex align-items-center font-weight-normal">
-                    <span>Title</span>
+                    <span class="font-weight-bold">Title</span>
                     <div class="hide-if-dashboard ml-auto">
                         <div v-if="favorites && favorites.length" class="d-inline-flex2">
                             <div moe relative>
@@ -112,7 +115,7 @@ $formID = rand(0, 100000);
                            v-on:change="includeChanged()">
                 </label>
             </td>
-            <td>
+            <td @if(@$note) v-show="inclusion[index]" @endif>
                 <input type="text" :data-index="index"
                        class="form-control form-control-sm font-weight-bold font-size-14"
                        data-field="title" placeholder="Title" v-model="item.title" autofocus required>
@@ -126,27 +129,28 @@ $formID = rand(0, 100000);
                         <option value="Acute">Acute</option>
                     </select>
                 </div>
-                <textarea type="text" class="form-control form-control-sm" v-model="item.detail" placeholder="Detail"></textarea>
-            </td>
-            {{--<td>
-                <input type="text" :data-index="index"
-                       class="form-control form-control-sm canvas-dx-title"
-                       data-field="icd" placeholder="ICD" v-model="item.icd">
-                <select v-model="item.coa" class="form-control form-control-sm pl-1" required>
-                    <option value="">-- select --</option>
-                    <option value="Chronic" selected>Chronic</option>
-                    <option value="Acute">Acute</option>
-                </select>
+                <div class="px-2 py-1 bg-white border-bottom text-secondary" v-if="item.previous_hpi">
+                    <b><i class="fa fa-clock mr-1 text-sm"></i>Previous HPI: </b><br>
+                    <div v-html="item.previous_hpi"></div>
+                </div>
+                <a v-if="item.previous_hpi" href="#"
+                   v-on:click.prevent="item.detail = item.previous_hpi"
+                   class="d-block py-1 px-2 border-bottom">Copy from previous</a>
+                <textarea type="text" class="form-control form-control-sm" v-model="item.detail" placeholder="Updated HPI *"></textarea>
             </td>
-            <td><textarea type="text" class="form-control form-control-sm"
-                          dx-rte :data-index="index" data-field="detail"
-                          v-model="item.detail"></textarea>
-            </td>--}}
-            <td><textarea type="text" class="form-control form-control-sm"
+            <td @if(@$note) v-show="inclusion[index]" @endif>
+                <div class="px-2 py-1 bg-white border-bottom text-secondary" v-if="item.previous_plan">
+                    <b><i class="fa fa-clock mr-1 text-sm"></i>Previous Plan: </b><br>
+                    <div v-html="item.previous_plan"></div>
+                </div>
+                <a v-if="item.previous_plan" href="#"
+                   v-on:click="copyPreviousPlan(item, index, $event)"
+                   class="d-block py-1 px-2 border-bottom">Copy from previous</a>
+                <textarea type="text" class="form-control form-control-sm"
                           dx-rte :data-index="index" data-field="plan"
                           v-model="item.plan"></textarea>
             </td>
-            <td class="px-2 text-nowrap">
+            <td @if(@$note) v-show="inclusion[index]" @endif class="px-2 text-nowrap">
                 <a href="#"
                    v-if="!isFavorite(item)" v-on:click.prevent="addToFavorites(item)"
                    class="mt-1 d-inline-block mr-1 text-secondary on-hover-opaque"
@@ -164,6 +168,11 @@ $formID = rand(0, 100000);
                     <i class="fa fa-trash-alt"></i>
                 </a>
             </td>
+            @if(@$note)
+            <td v-show="!inclusion[index]" colspan="3" class="align-middle pl-2">
+                <span v-html="item.title"></span>
+            </td>
+            @endif
         </tr>
         </tbody>
     </table>
@@ -186,19 +195,43 @@ $formID = rand(0, 100000);
         for (let i = 0; i < favorites.length; i++) {
             favorites[i].data = JSON.parse(favorites[i].data);
         }
+
+        let saved = <?= json_encode($contentData['items']) ?>;
+        // if FU, copy hpi into previous_hpi for each item, and empty out hpi
+        @if(@$note && $note->new_or_fu_or_na === 'FU')
+        for (let i = 0; i < saved.length; i++) {
+            if(saved[i].note_uid !== '{{$note->uid}}') {
+                if(saved[i].detail) saved[i].previous_hpi = saved[i].detail;
+                if(saved[i].plan) saved[i].previous_plan = saved[i].plan;
+                saved[i].detail = '';
+                saved[i].plan = '';
+                saved[i].note_uid = '{{$note->uid}}';
+            }
+        }
+        @endif
+
         function init() {
             window.clientDXApp = new Vue({
                 el: '#dxSection',
                 data: {
                     includeAll: false,
-                    items: <?= json_encode($contentData['items']) ?>,
+                    items: saved,
                     inclusion: [],
                     favorites: favorites,
                 },
                 mounted: function() {
                     this.inclusion = [];
                     for (let i = 0; i < this.items.length; i++) {
-                        this.inclusion[i] = this.items[i].included;
+                        @if(@$note && $note->new_or_fu_or_na === 'FU')
+                            if(this.items[i].note_uid !== '{{$note->uid}}') {
+                                this.inclusion[i] = this.items[i].included = false;
+                            }
+                            else {
+                                this.inclusion[i] = this.items[i].included;
+                            }
+                        @else
+                            this.inclusion[i] = this.items[i].included;
+                        @endif
                     }
                     this.initRTE();
                     this.initTitleAutoSuggest();
@@ -225,6 +258,13 @@ $formID = rand(0, 100000);
                     }
                 },
                 methods: {
+                    copyPreviousPlan: function(item, index, trigger) {
+                        item.plan = item.previous_plan;
+                        Vue.nextTick(() => {
+                            $(trigger.currentTarget).closest('td').find('.ql-editor').html(item.plan);
+                        });
+                        return false;
+                    },
                     includeAllChanged: function() {
                         for (let i = 0; i < this.items.length; i++) {
                             this.inclusion[i] = this.includeAll; // NOTE: this does not trigger a watch event
@@ -302,6 +342,8 @@ $formID = rand(0, 100000);
 
                             var toolbar = $(qe.container).prev('.ql-toolbar');
 
+                            toolbar.append('<b class="float-left text-secondary ml-1 mr-2 pt-1">Updated Plan *</b>');
+
                             // add button for new shortcut
                             var newSCButton = $('<button type="button" tabindex="-1" ' +
                                 'class="btn bg-white btn-sm btn-default text-primary w-auto px-2 border py-0 ' +
@@ -314,7 +356,6 @@ $formID = rand(0, 100000);
                                 'text-sm show-templates">Templates</button>');
                             templatesButton.attr('data-editor-id', editorID);
                             toolbar.append(templatesButton);
-                            // $(this).closest('tr').find('.assessment-detail-template').appendTo(templatesButton);
 
                             qe.on('text-change', function() {
                                 // ti.val(qe.root.innerHTML);

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

@@ -29,7 +29,7 @@ if(count($contentData['items'])) {
             $detailPlain = trim(strip_tags($detailPlain));
             if(!empty($detailPlain)):
             ?>
-                <div class="text-secondary font-weight-bold">Detail</div>
+                <div class="text-secondary font-weight-bold">HPI</div>
                 <div class="ml-2"><?= $detailPlain ?></div>
             <?php endif; ?>
             <?php

+ 147 - 58
resources/views/app/patient/note/dashboard.blade.php

@@ -36,15 +36,18 @@
     @endif
     --}}
 
-    <div id="note-single-header" class="pt-2 pb-3 d-flex align-items-start">
-        <h6 class="my-0 text-secondary d-flex align-items-start w-100">
+    <div id="note-single-header" class="pt-2 pb-3 d-flex align-items-start screen-only">
+        <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">
                 <i class="fa fa-chevron-left"></i>
             </a>
-            <div class="mr-auto">
+            <div class="mr-auto d-inline-flex align-items-center">
                 <span class="text-dark font-weight-bold">Note
                     <span class="text-secondary font-weight-normal">{{ $note->is_cancelled ? '(CANCELLED)' : '' }}</span>
                 </span>
+                @if($pro->pro_type === 'ADMIN')
+                    <a href="#" class="print-note ml-3 btn btn-sm btn-primary text-white font-weight-bold invisible"><i class="fa fa-print"></i> Print</a>
+                @endif
             </div>
             @if($patient->has_mcp_done_onboarding_visit !== 'YES')
                 <div class="ml-auto">
@@ -399,22 +402,22 @@
                     <div class="">
                         <div class="d-flex align-items-center mb-2">
                             <p class="font-weight-bold text-secondary m-0 font-size-14">ERx/Orders Summary</p>
-                            <span class="mx-2 text-secondary">|</span>
+                            <span class="mx-2 text-secondary screen-only">|</span>
                             <a href="/patients/view/{{$patient->uid}}/tickets/erx/create?popupmode=1&note-uid={{$note->uid}}"
                                native target="_blank"
-                               class="ticket-popup-trigger note-dashboard-action d-block text-nowrap">
+                               class="ticket-popup-trigger note-dashboard-action d-block text-nowrap screen-only">
                                 + ERx
                             </a>
-                            <span class="mx-2 text-secondary">|</span>
+                            <span class="mx-2 text-secondary screen-only">|</span>
                             <a href="/patients/view/{{$patient->uid}}/tickets/lab/create?popupmode=1&note-uid={{$note->uid}}"
                                native target="_blank"
-                               class="ticket-popup-trigger note-dashboard-action d-block text-nowrap">
+                               class="ticket-popup-trigger note-dashboard-action d-block text-nowrap screen-only">
                                 + Lab
                             </a>
-                            <span class="mx-2 text-secondary">|</span>
+                            <span class="mx-2 text-secondary screen-only">|</span>
                             <a href="/patients/view/{{$patient->uid}}/tickets/imaging/create?popupmode=1&note-uid={{$note->uid}}"
                                native target="_blank"
-                               class="ticket-popup-trigger note-dashboard-action d-block text-nowrap">
+                               class="ticket-popup-trigger note-dashboard-action d-block text-nowrap screen-only">
                                 + Imaging
                             </a>
                         </div>
@@ -660,8 +663,9 @@
                     <div class="">
                         <div class="d-flex align-items-center mb-2">
                             <p class="font-weight-bold text-secondary m-0 font-size-14">Supply Orders Summary</p>
-                            <span class="mx-2 text-secondary">|</span>
+                            <span class="mx-2 text-secondary screen-only">|</span>
                             <a native target="_blank"
+                               class="screen-only"
                                open-in-stag-popup
                                update-parent
                                mc-initer="patient-supply-orders"
@@ -796,7 +800,7 @@
                     </div>
                 </div>
                 @if($pro->pro_type === 'ADMIN')
-                <div class="p-3 border-bottom">
+                <div class="p-3 border-bottom screen-only">
                     <div>
                         <h2 class="font-weight-bold text-secondary">Bills & Claims Summary</h2>
                         <div class="d-flex justify-content-center align-items-start">
@@ -922,7 +926,7 @@
                 @endif
 
                 @if($note->method === 'IN_CLINIC' || $pro->pro_type === 'ADMIN')
-                <div class="p-3 border-bottom">
+                <div class="p-3 border-bottom screen-only">
                     <div class="ml-auto d-inline-flex align-items-center">
 
                         <span class="text-secondary font-weight-bold">Pro:&nbsp;</span>
@@ -1013,12 +1017,14 @@
                 @endif
 
                 {{-- bills --}}
-                @if($pro->pro_type === 'ADMIN' || ($note->hcpPro && $pro->id === $note->hcpPro->id))
+                @if($pro->pro_type === 'ADMIN' || ($note->hcpPro && $pro->id === $note->hcpPro->id) || ($note->allyPro && $pro->id === $note->allyPro->id))
                 @if($note->bills->count())
                     <div class="p-3 border-bottom">
                         <div class="d-flex align-items-center mb-2">
                             <p class="font-weight-bold text-secondary font-size-13 m-0">Bills</p>
-                            @include('app/patient/note/_create-bill')
+                            @if($pro->pro_type === 'ADMIN' || ($note->hcpPro && $pro->id === $note->hcpPro->id))
+                                @include('app/patient/note/_create-bill')
+                            @endif
                         </div>
 
                         @if($pro->pro_type === 'ADMIN')
@@ -1030,12 +1036,12 @@
                                 <th class="border-bottom-0">Service</th>
                                 <th class="border-bottom-0">Billable</th>
                                 <th class="border-bottom-0">HCP</th>
-                                <th class="border-bottom-0">Total</th>
+                                <th class="border-bottom-0 screen-only">Total</th>
                                 <th class="border-bottom-0">Sign</th>
-                                <th class="border-bottom-0">Bal Post Date</th>
+                                <th class="border-bottom-0 screen-only">Bal Post Date</th>
                                 <th class="border-bottom-0">Verification</th>
                                 <th class="border-bottom-0">Cancellation</th>
-                                <th class="border-bottom-0">Payment</th>
+                                <th class="border-bottom-0 screen-only">Payment</th>
                             </tr>
                             </thead>
                             <tbody>
@@ -1087,17 +1093,17 @@
                                     </td>
                                     <td class="">
                                         <div class="text-nowrap font-weight-bold text-secondary">{{ $bill->hcp->displayName() }} (HCP)</div>
-                                        <div class="text-nowrap mt-1">
+                                        <div class="text-nowrap mt-1 screen-only">
                                             <span class="text-secondary">Paid: </span>
                                             <span>{{ $bill->has_hcp_been_paid ? 'Yes' : 'No' }}</span>
                                         </div>
                                         @if(!$bill->has_hcp_been_paid)
-                                            <div class="text-nowrap mt-1">
+                                            <div class="text-nowrap mt-1 screen-only">
                                                 <span class="text-secondary">Expected: </span>
                                                 <span class="font-weight-bold">${{ $bill->hcp_expected_payment_amount }}</span>
                                             </div>
                                         @else
-                                            <div class="text-nowrap mt-1">
+                                            <div class="text-nowrap mt-1 screen-only">
                                                 <span class="text-secondary">Amount: </span>
                                                 <span class="font-weight-bold">${{ $bill->hcp_payment_amount }}</span>
                                             </div>
@@ -1105,17 +1111,17 @@
                                         @if($bill->ally)
                                             <hr>
                                             <div class="text-nowrap font-weight-bold text-secondary">{{ $bill->ally->displayName() }} (NA)</div>
-                                            <div class="text-nowrap mt-1">
+                                            <div class="text-nowrap mt-1 screen-only">
                                                 <span class="text-secondary">Paid: </span>
                                                 <span>{{ $bill->has_na_been_paid ? 'Yes' : 'No' }}</span>
                                             </div>
                                             @if(!$bill->has_na_been_paid)
-                                                <div class="text-nowrap mt-1">
+                                                <div class="text-nowrap mt-1 screen-only">
                                                     <span class="text-secondary">Expected: </span>
                                                     <span class="font-weight-bold">${{ $bill->na_expected_payment_amount }}</span>
                                                 </div>
                                             @else
-                                                <div class="text-nowrap mt-1">
+                                                <div class="text-nowrap mt-1 screen-only">
                                                     <span class="text-secondary">Amount: </span>
                                                     <span class="font-weight-bold">${{ $bill->na_payment_amount }}</span>
                                                 </div>
@@ -1123,7 +1129,7 @@
                                         @endif
 
                                     </td>
-                                    <td class="pr-3">
+                                    <td class="pr-3 screen-only">
                                         @if($bill->has_hcp_been_paid)
                                             <span class="text-secondary">Paid. </span>
                                             <span class="font-weight-bold">${{ friendly_money($bill->total_paid) }}</span>
@@ -1177,7 +1183,7 @@
                                             @endif
                                         @endif
                                     </td>
-                                    <td>
+                                    <td class="screen-only">
                                         @if(!$bill->is_cancelled)
                                             <span class="d-block" moe>
                                                 <a class="" href="" show start>
@@ -1305,37 +1311,67 @@
                                         @endif
 
                                     </td>
-                                    <td> <!-- submit payment -->
+                                    <td class="screen-only"> <!-- submit payment -->
                                         <div class="my-1">
-                                            @if(!$bill->is_cancelled && !$bill->has_hcp_been_paid)
-                                                <span class="d-block" moe relative="">
-                                                    <a class="font-weight-bold" href="" show start>Submit Payment For HCP</a>
-                                                    <form url="/api/bill/payHcpAmount" right>
-                                                        <input type="hidden" name="uid" value="{{$bill->uid}}">
-                                                        <p>Submit Payment</p>
-                                                        <div class="mb-0">
-                                                            <input type="text" class="text form-control form-control-sm" name="hcpPaymentAmount" value="{{$bill->hcp_expected_payment_amount}}" placeholder="amount"><br>
-                                                            <button class="btn btn-success btn-sm" submit>Submit</button>
-                                                            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                            @if(!$bill->is_cancelled && !$bill->has_hcp_been_paid )
+                                                @if(+$bill->hcp_expected_payment_amount && $bill->is_signed_by_hcp)
+                                                    <span class="d-block" moe relative="">
+                                                        <a class="font-weight-bold" href="" show start>Submit Payment For HCP</a>
+                                                        <form url="/api/bill/payHcpAmount" right>
+                                                            <input type="hidden" name="uid" value="{{$bill->uid}}">
+                                                            <p>Submit Payment</p>
+                                                            <div class="mb-0">
+                                                                <input type="text" class="text form-control form-control-sm" name="hcpPaymentAmount" value="{{$bill->hcp_expected_payment_amount}}" placeholder="amount"><br>
+                                                                <button class="btn btn-success btn-sm" submit>Submit</button>
+                                                                <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                            </div>
+                                                        </form>
+                                                    </span>
+                                                @else
+                                                    @if(!+$bill->hcp_expected_payment_amount)
+                                                        <div class="mb-1 text-danger">
+                                                            <i class="fa fa-exclamation-triangle"></i>
+                                                            HCP expected amount is invalid
                                                         </div>
-                                                    </form>
-                                                </span>
+                                                    @endif
+                                                    @if(!$bill->is_signed_by_hcp)
+                                                        <div class="mb-1 text-danger">
+                                                            <i class="fa fa-exclamation-triangle"></i>
+                                                            HCP has not signed the bill
+                                                        </div>
+                                                    @endif
+                                                @endif
                                             @endif
                                         </div>
                                         <div class="my-1">
                                             @if(!$bill->is_cancelled && !$bill->has_na_been_paid && $bill->ally)
-                                                <span class="d-block" moe relative="">
-                                                    <a class="font-weight-bold" href="" show start>Submit Payment For NA</a>
-                                                    <form url="/api/bill/payNaAmount" right>
-                                                        <input type="hidden" name="uid" value="{{$bill->uid}}">
-                                                        <p>Submit Payment For NA</p>
-                                                        <div class="mb-0">
-                                                            <input type="text" class="text form-control form-control-sm" name="naPaymentAmount" value="{{$bill->na_expected_payment_amount}}" placeholder="amount"><br>
-                                                            <button class="btn btn-success btn-sm" submit>Submit</button>
-                                                            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                @if(+$bill->na_expected_payment_amount && $bill->is_signed_by_na)
+                                                    <span class="d-block" moe relative="">
+                                                        <a class="font-weight-bold" href="" show start>Submit Payment For NA</a>
+                                                        <form url="/api/bill/payNaAmount" right>
+                                                            <input type="hidden" name="uid" value="{{$bill->uid}}">
+                                                            <p>Submit Payment For NA</p>
+                                                            <div class="mb-0">
+                                                                <input type="text" class="text form-control form-control-sm" name="naPaymentAmount" value="{{$bill->na_expected_payment_amount}}" placeholder="amount"><br>
+                                                                <button class="btn btn-success btn-sm" submit>Submit</button>
+                                                                <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                            </div>
+                                                        </form>
+                                                    </span>
+                                                @else
+                                                    @if(!+$bill->na_expected_payment_amount)
+                                                        <div class="mb-1 text-danger">
+                                                            <i class="fa fa-exclamation-triangle"></i>
+                                                            NA expected amount is invalid
                                                         </div>
-                                                    </form>
-                                                </span>
+                                                    @endif
+                                                    @if(!$bill->is_signed_by_na)
+                                                        <div class="mb-1 text-danger">
+                                                            <i class="fa fa-exclamation-triangle"></i>
+                                                            NA has not signed the bill
+                                                        </div>
+                                                    @endif
+                                                @endif
                                             @endif
                                         </div>
                                     </td>
@@ -1348,6 +1384,9 @@
                             <thead class="bg-light">
                             <tr>
                                 <th class="border-bottom-0 pl-3">HCP</th>
+                                @if($note->ally_pro_id === $pro->id)
+                                    <th class="border-bottom-0 pl-3">NA</th>
+                                @endif
                                 <th class="border-bottom-0 w-25 pl-3">Service</th>
                                 {{--<th class="border-bottom-0 w-25 pl-2">Reason</th>--}}
                                 <th class="border-bottom-0 pl-3">Billable</th>
@@ -1359,6 +1398,9 @@
                             @foreach ($note->bills as $bill)
                                 <tr>
                                     <td class="pl-3">{{ $bill->hcp->displayName() }}</td>
+                                    @if($note->ally_pro_id === $pro->id)
+                                        <td class="pl-3">{{ $note->allyPro->displayName() }}</td>
+                                    @endif
                                     <td class="pl-3 {{ $bill->is_cancelled ? 'text-secondary' : '' }}">{{$bill->code}}</td>
                                     {{--<td class="pl-2">
                                         {{ $bill->reason1 }}
@@ -1388,10 +1430,18 @@
                                         @endif
                                     </td>
                                     <td class="pl-2">
-                                        @if($bill->has_hcp_been_paid)
-                                            <span class="text-dark">Processed:</span><span class="font-weight-bold text-success ml-2">${{ $bill->hcp_payment_amount }}</span>
-                                        @else
-                                            <span class="text-dark">Expected:</span><span class="font-weight-bold text-dark ml-2">{{ $bill->hcp_expected_payment_amount ? '$' . $bill->hcp_expected_payment_amount : '-' }}</span>
+                                        @if($bill->hcp_pro_id === $pro->id)
+                                            @if($bill->has_hcp_been_paid)
+                                                <span class="text-dark">Processed:</span><span class="font-weight-bold text-success ml-2">${{ $bill->hcp_payment_amount }}</span>
+                                            @else
+                                                <span class="text-dark">Expected:</span><span class="font-weight-bold text-dark ml-2">{{ $bill->hcp_expected_payment_amount ? '$' . $bill->hcp_expected_payment_amount : '-' }}</span>
+                                            @endif
+                                        @elseif($bill->na_pro_id === $pro->id)
+                                            @if($bill->has_na_been_paid)
+                                                <span class="text-dark">Processed:</span><span class="font-weight-bold text-success ml-2">${{ $bill->na_payment_amount }}</span>
+                                            @else
+                                                <span class="text-dark">Expected:</span><span class="font-weight-bold text-dark ml-2">{{ $bill->na_expected_payment_amount ? '$' . $bill->na_expected_payment_amount : '-' }}</span>
+                                            @endif
                                         @endif
                                     </td>
                                     <td>
@@ -1406,7 +1456,7 @@
                                                     <span moe
                                                           class="d-block {{ $bill->hcp_pro_id !== $pro->id ? 'moe-disabled' : '' }}"
                                                           title="{{ $bill->hcp_pro_id !== $pro->id ? 'Only the bill\'s HCP can sign' : '' }}">
-                                                        <a class="" href="" show start>Sign</a>
+                                                        <a class="" href="" show start>Sign as HCP</a>
                                                         <form url="/api/bill/signAsHcp">
                                                             <input type="hidden" name="uid" value="{{$bill->uid}}">
                                                             <p>Sign this bill as HCP?</p>
@@ -1417,6 +1467,29 @@
                                                         </form>
                                                     </span>
                                                 @endif
+                                                @if($bill->na_pro_id === $pro->id)
+                                                    <span class="mx-2 text-secondary">|</span>
+                                                    @if($bill->is_signed_by_na)
+                                                        <span class="d-block text-secondary">
+                                                            <i class="fa fa-check"></i>
+                                                            NA Signed
+                                                        </span>
+                                                    @else
+                                                        <span moe
+                                                              class="d-block {{ $bill->na_pro_id !== $pro->id ? 'moe-disabled' : '' }}"
+                                                              title="{{ $bill->hcp_pro_id !== $pro->id ? 'Only the bill\'s NA can sign' : '' }}">
+                                                            <a class="" href="" show start>Sign as NA</a>
+                                                            <form url="/api/bill/signAsNa">
+                                                                <input type="hidden" name="uid" value="{{$bill->uid}}">
+                                                                <p>Sign this bill as NA?</p>
+                                                                <div class="mb-0">
+                                                                    <button class="btn btn-success btn-sm" submit>Sign</button>
+                                                                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                                </div>
+                                                            </form>
+                                                        </span>
+                                                    @endif
+                                                @endif
                                             @endif
                                             @if(!$bill->has_hcp_been_paid && $pro->pro_type === 'ADMIN')
                                                 <span class="mx-2 text-secondary">|</span>
@@ -1433,6 +1506,20 @@
                                                     </form>
                                                 </span>
                                             @endif
+                                            @if(!$bill->has_na_been_paid && $bill->ally && $pro->pro_type === 'ADMIN')
+                                                <span class="d-block" moe relative="">
+                                                    <a class="font-weight-bold" href="" show start>Submit Payment For NA</a>
+                                                    <form url="/api/bill/payNaAmount" right>
+                                                        <input type="hidden" name="uid" value="{{$bill->uid}}">
+                                                        <p>Submit Payment For NA</p>
+                                                        <div class="mb-0">
+                                                            <input type="text" class="text form-control form-control-sm" name="naPaymentAmount" value="{{$bill->na_expected_payment_amount}}" placeholder="amount"><br>
+                                                            <button class="btn btn-success btn-sm" submit>Submit</button>
+                                                            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                        </div>
+                                                    </form>
+                                                </span>
+                                            @endif
                                             @if($bill->is_cancelled)
                                                 <span class="mx-2 text-secondary">|</span>
                                                 <span class="d-block text-secondary">
@@ -1472,7 +1559,7 @@
                 {{-- claims --}}
                 @if($pro->pro_type === 'ADMIN')
                 @if($note->claims->count())
-                    <div class="p-3">
+                    <div class="screen-only p-3">
                         <div class="d-flex align-items-center mb-2">
                             <p class="font-weight-bold text-secondary m-0">Claims</p>
                             @include('app/patient/note/_create-claim')
@@ -1833,7 +1920,7 @@
                         </table>
                     </div>
                 @else
-                    <div class="my-3 px-3 d-flex">
+                    <div class="screen-only my-3 px-3 d-flex">
                         <p class="font-weight-bold mb-0 text-secondary">No claims in this note</p>
                         @include('app/patient/note/_create-claim')
                     </div>
@@ -1841,7 +1928,7 @@
                 @endif
 
 
-                <div class="border-top p-3">
+                <div class="border-top p-3 screen-only">
                     @if($note->addendums->count())
                         <div class="">
                             <div class="d-flex align-items-center mb-2">
@@ -1903,7 +1990,9 @@
                     @endif
                 </div>
 
-                @include('app/patient/note/_cancel-signed-note')
+                <div class="screen-only">
+                    @include('app/patient/note/_cancel-signed-note')
+                </div>
 
 
             </div>

+ 9 - 0
resources/views/app/patient/note/dashboard_script.blade.php

@@ -5,6 +5,15 @@
 
             function init() {
 
+                // print note
+                $(document)
+                    .off('click.print', '.print-note')
+                    .on('click.print', '.print-note', () => {
+                        window.print();
+                        return false;
+                    });
+                $('.print-note').removeClass('invisible');
+
                 $('.note-method-select').change(function() {
                     let form = $(this).closest('form');
                     if(this.value === 'IN_CLINIC') {

+ 39 - 1
resources/views/app/patient/note/section_script.blade.php

@@ -113,7 +113,45 @@
                     dataToPost['guest_access_code'] = '{{$guestAccessCode}}';
                 @endif
                 $.post("/process_form_submit", dataToPost, function(resp) {
-                    handleSubmitResponse(resp,_section, summaryContainer)
+                    handleSubmitResponse(resp,_section, summaryContainer);
+
+                    // if "dx", refresh "cc" if it exists in the note
+                    if(_section.attr('data-section-template-name') === 'dx') {
+                        let ccSection = $('[data-section-template-name="cc"]').first();
+                        if(ccSection.length) {
+                            let ccSectionUid = ccSection.attr('data-section-uid');
+                            let items = JSON.parse(value);
+                            if(items && items.items) {
+                                items = items.items
+                                    .filter((_x) => {
+                                        return !!_x.included;
+                                    })
+                                    .map((_x) => {
+                                        return _x.title;
+                                    });
+                            }
+                            let itemsText = '';
+                            if(items.length > 1) {
+                                let lastItem = items[items.length - 1];
+                                items.splice(items.length - 1, 1);
+                                itemsText = items.join(', ') + ' and ' + lastItem;
+                            }
+                            else {
+                                itemsText = items[0];
+                            }
+                            if(!!itemsText && !!ccSectionUid) {
+                                let ccValue = 'Patient {{$patient->name_first . ' ' . $patient->name_last}} ' +
+                                    'is a {{$patient->age_in_years}} year old {{$patient->sex}} with a history of ' +
+                                    itemsText + ' ' +
+                                    '{{ @$note ? (@$note->new_or_fu_or_na === 'NEW' ? 'presenting for establishing care' : 'presenting for follow-up') : '' }}';
+                                let para = $('<p/>').text(ccValue)[0].outerHTML;
+                                ccSection.find('[name="data"]').first().val(JSON.stringify({value: para}));
+                                ccSection.find('.ql-editor').html(para);
+                                ccSection.find('[btn-save-form]').click();
+                            }
+                        }
+                    }
+
                 }, 'json');
             }
         }

+ 8 - 6
resources/views/layouts/patient.blade.php

@@ -279,7 +279,7 @@
                                     </div>
                                 @endif
                                 <div class=hbox>
-                                    <div class="mr-1 patient-presence-indicator thumbnail {{$online}}"
+                                    <div class="screen-only mr-1 patient-presence-indicator thumbnail {{$online}}"
                                          data-patient-uid="{{$patient->uid}}"
                                          style="background-image:<?=$thumbnail?>"><?=$initials?></div>
                                     {{--<div>
@@ -395,6 +395,7 @@
                                                 @endif
                                             </div>
                                         </div>
+                                        <div class="screen-only">
                                         <div class=separators>
                                             <div>Joined <?=$memberSince?></div>
                                             <div><label>MCP:</label> {{$mcpName}}
@@ -609,6 +610,7 @@
                                                 @endif
                                             @endif
                                         </div>
+                                        </div>
                                     </section>
                                     {{--<section>
                                         <div>
@@ -666,7 +668,7 @@
                                             <label class="ml-2">RM:</label> {{ $patient->is_enrolled_in_rm === 'YES' ? 'Yes' : 'No' }}
                                         </div>
                                     </section>--}}
-                                    <section class="vbox mt-2 align-self-start ml-4">
+                                    <section class="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>
@@ -769,7 +771,7 @@
                                         </span>
                                         </div>
                                     </section>
-                                    <section class="vbox mt-2 align-self-start ml-1">
+                                    <section class="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>
@@ -903,11 +905,11 @@
                                                 {{$patient->phone_home}}
                                             </li>
                                         @endif
-                                        <li>
+                                        <li class="{{empty($confirmedEmail) || $confirmedEmail === '-' ? 'screen-only' : ''}}">
                                             <span class="aligned-icon"><i class="fa fa-envelope" aria-hidden="true"></i></span>
                                             {{$confirmedEmail}}
                                         </li>
-                                        <li>
+                                        <li class="screen-only">
                                             <span class="aligned-icon text-primary">
                                                 <i class="fa fa-link" aria-hidden="true"></i>
                                             </span>
@@ -923,7 +925,7 @@
                         </div> <!-- z -->
                     </div>
                     @if($pro->pro_type === 'ADMIN')
-                        <div class="card-header py-2 d-flex align-items-center mcp-theme-1 bg-aliceblue">
+                        <div class="screen-only card-header py-2 d-flex align-items-center mcp-theme-1 bg-aliceblue">
                             <b class="">Tags ({{count($patient->clientTags)}}):</b>
                             @foreach($patient->clientTags as $tag)
                                 <div class="d-inline-flex align-items-center ml-2 py-1 px-2 rounded bg-aliceblue text-info">