Przeglądaj źródła

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

= 3 lat temu
rodzic
commit
7df4eb66c0
56 zmienionych plików z 439 dodań i 178 usunięć
  1. 2 5
      app/Http/Controllers/AppointmentController.php
  2. 1 1
      app/Http/Controllers/FDBPGController.php
  3. 5 0
      app/Http/Controllers/NoteController.php
  4. 14 3
      app/Http/Controllers/PatientController.php
  5. 1 1
      app/Models/Client.php
  6. 1 0
      app/Models/Pro.php
  7. 1 1
      config/app.php
  8. 3 0
      public/css/style.css
  9. 26 2
      public/js/stag-popup.js
  10. 0 0
      public/js/yemi.js
  11. 2 2
      resources/views/app/generic-bills/inline.blade.php
  12. 24 16
      resources/views/app/mcp/dashboard/notifications.blade.php
  13. 1 1
      resources/views/app/patient/accounts.blade.php
  14. 53 0
      resources/views/app/patient/appointment-calendar.blade.php
  15. 1 1
      resources/views/app/patient/claims-resolver.blade.php
  16. 0 3
      resources/views/app/patient/dashboard.blade.php
  17. 1 1
      resources/views/app/patient/documents.blade.php
  18. 1 1
      resources/views/app/patient/history.blade.php
  19. 1 1
      resources/views/app/patient/incoming-reports.blade.php
  20. 1 1
      resources/views/app/patient/mcp-requests.blade.php
  21. 1 1
      resources/views/app/patient/measurement-confirmation-numbers.blade.php
  22. 1 1
      resources/views/app/patient/memos.blade.php
  23. 5 5
      resources/views/app/patient/note/ccm-agreement.blade.php
  24. 2 2
      resources/views/app/patient/note/dashboard.blade.php
  25. 49 37
      resources/views/app/patient/note/rhs-sidebar.blade.php
  26. 1 1
      resources/views/app/patient/note/rm-setup.blade.php
  27. 5 5
      resources/views/app/patient/note/rpm-agreement.blade.php
  28. 1 1
      resources/views/app/patient/partials/appointments.blade.php
  29. 1 1
      resources/views/app/patient/point-based-partials/allergies.blade.php
  30. 1 1
      resources/views/app/patient/point-based-partials/care-team.blade.php
  31. 1 1
      resources/views/app/patient/point-based-partials/dx.blade.php
  32. 1 1
      resources/views/app/patient/point-based-partials/rx.blade.php
  33. 1 1
      resources/views/app/patient/prescriptions/list.blade.php
  34. 42 7
      resources/views/app/patient/problems-center.blade.php
  35. 1 1
      resources/views/app/patient/pros.blade.php
  36. 1 1
      resources/views/app/patient/rm-setup.blade.php
  37. 16 2
      resources/views/app/patient/segment-templates/_custom_items/edit.blade.php
  38. 18 1
      resources/views/app/patient/segment-templates/_custom_items/script.blade.php
  39. 31 0
      resources/views/app/patient/segment-templates/chief_complaint/generate.blade.php
  40. 2 0
      resources/views/app/patient/segment-templates/chief_complaint/summary.blade.php
  41. 1 1
      resources/views/app/patient/segment-templates/history_family/edit.blade.php
  42. 23 10
      resources/views/app/patient/segment-templates/history_social/edit.blade.php
  43. 23 10
      resources/views/app/patient/segment-templates/history_surgical/edit.blade.php
  44. 23 8
      resources/views/app/patient/segment-templates/past_medical_history/edit.blade.php
  45. 6 7
      resources/views/app/patient/segment-templates/ros/edit.blade.php
  46. 2 2
      resources/views/app/patient/segment-templates/vitals/edit.blade.php
  47. 1 1
      resources/views/app/patient/settings.blade.php
  48. 1 1
      resources/views/app/patient/shipments.blade.php
  49. 1 1
      resources/views/app/patient/sms-numbers.blade.php
  50. 1 1
      resources/views/app/patient/sms-reminders.blade.php
  51. 1 1
      resources/views/app/patient/sms.blade.php
  52. 1 1
      resources/views/app/patient/supply-orders.blade.php
  53. 7 0
      resources/views/app/patient/wizard-partials/common-script.blade.php
  54. 3 0
      resources/views/layouts/patient.blade.php
  55. 1 0
      routes/web.php
  56. 24 24
      yemi.js

+ 2 - 5
app/Http/Controllers/AppointmentController.php

@@ -29,10 +29,7 @@ class AppointmentController extends Controller
         }
 
         if(empty($request->get('proIds'))) {
-            $proIds = [];
-            if($performerPro && $performerPro->pro_type !== 'ADMIN') {
-                $proIds = [$performerPro->id];
-            }
+            $proIds = [$performerPro->id];
         }
         else {
             $proIds = explode(',', $request->get('proIds'));
@@ -63,7 +60,7 @@ class AppointmentController extends Controller
                 ->where(function ($query) use ($proIds, $clientId) {
                     $query
                         ->whereIn('pro_id', $proIds)
-                        ->orWhere('client_id', '=', $clientId)
+                        ->orWhere('client_id', $clientId)
                         ->orWhereRaw('client_id IN (SELECT shadow_client_id FROM pro WHERE id IN (' . implode(',', $proIds) . '))');
                 });
             $appointments = $appointments->get();

+ 1 - 1
app/Http/Controllers/FDBPGController.php

@@ -94,7 +94,7 @@ FROM rmiid1_med r_med
          JOIN rmirmid1_routed_med r_route ON r_dosage_form.routed_med_id = r_route.routed_med_id
 WHERE r_med.med_status_cd = '0'
   AND r_med.med_medid_desc ILIKE :term
-ORDER BY r_route.med_routed_med_id_desc, r_med.med_medid_desc",
+ORDER BY REPLACE(r_med.med_medid_desc, '-', 'x')",
             ['term' => $term . '%']
         );
         return json_encode([

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

@@ -336,6 +336,11 @@ class NoteController extends Controller
         }
     }
 
+    public function generateCC(Request $request, Note $note) {
+        $client = $note->client;
+        return view('app.patient.segment-templates.chief_complaint.generate', compact('note', 'client'));
+    }
+
     public function segmentSummary(Request $request, Segment $segment) {
         return '<div class="mrv-content border-top px-3 pt-2 mt-3">' . @$segment->summary_html . '</div>';
     }

+ 14 - 3
app/Http/Controllers/PatientController.php

@@ -423,7 +423,19 @@ class PatientController extends Controller
             $pros = Pro::whereIn('id', $accessibleProIds)->get();
         }
 
-        return view('app.patient.appointment-calendar', compact('pros',  'patient', 'currentAppointment'));
+        $dateLastWeek = date_sub(date_create(), date_interval_create_from_date_string("14 days"));
+        $dateLastWeek = date_format($dateLastWeek, "Y-m-d");
+        $appointments = Appointment::where('client_id', $patient->id)
+            ->orderBy('raw_date', 'desc')->orderBy('raw_start_time', 'desc')
+            ->where('raw_date', '>=', $dateLastWeek)
+            ->get();
+        $appointmentProIDs = $appointments->map(function($_item) {
+            return $_item->pro_id;
+        });
+        $appointmentPros = Pro::whereIn('id', $appointmentProIDs)->get();
+
+        return view('app.patient.appointment-calendar',
+            compact('pros', 'patient', 'currentAppointment', 'appointments', 'appointmentPros'));
     }
 
     public function programs(Request $request, Client $patient, $filter = '') {
@@ -542,12 +554,11 @@ class PatientController extends Controller
 
     public function appointments(Request $request, Client $patient, $forPro = 'all', $status = 'all') {
         $pros = $this->pros;
-        $appointments = $patient->appointmentsForProByStatus('all', 'ALL');
+        $appointments = $patient->appointmentsForProByStatus($forPro, strtoupper($status));
         $appointmentProIDs = $appointments->map(function($_item) {
             return $_item->pro_id;
         });
         $appointmentPros = Pro::whereIn('id', $appointmentProIDs)->get();
-        $appointments = $patient->appointmentsForProByStatus($forPro, strtoupper($status));
         return view('app.patient.appointments',
             compact('patient', 'pros', 'appointments', 'appointmentPros', 'forPro', 'status'));
     }

+ 1 - 1
app/Models/Client.php

@@ -338,7 +338,7 @@ class Client extends Model
         if($status !== 'ALL') {
             $appointments = $appointments->where('status', $status);
         }
-        $appointments = $appointments->orderBy('start_time', 'desc');
+        $appointments = $appointments->orderBy('raw_date', 'desc')->orderBy('raw_start_time', 'desc');
         return $appointments->get();
     }
 

+ 1 - 0
app/Models/Pro.php

@@ -155,6 +155,7 @@ class Pro extends Model
     public function canvasCustomItems($_key) {
         return ClientCanvasDataCustomItem::where('key', $_key)
             ->where('pro_id', $this->id)
+            ->where('is_removed', false)
             ->orderBy('label')
             ->get();
     }

+ 1 - 1
config/app.php

@@ -65,7 +65,7 @@ return [
 
     'hrm2_url' => env('HRM2_URL'),
 
-    'asset_version' => 31,
+    'asset_version' => 32,
 
     'temp_dir' => env('TEMP_DIR'),
 

+ 3 - 0
public/css/style.css

@@ -1540,6 +1540,9 @@ table.table-edit-sheet .ql-editor[contenteditable] {
 .w-30 {
     width: 30%;
 }
+.w-33 {
+    width: 33%;
+}
 .w-35 {
     width: 35%;
 }

+ 26 - 2
public/js/stag-popup.js

@@ -157,7 +157,7 @@ function isDynamicStagPopupPresent() {
     if(popup.is('.dynamic-popup')) return true;
     return false;
 }
-function refreshDynamicStagPopup(_url = false) {
+function refreshDynamicStagPopup(_url = false, _target = null) {
     if(!stagPopupsQueue.length) return false;
     let popup = stagPopupsQueue[stagPopupsQueue.length - 1];
     if(popup.is('.dynamic-popup')) {
@@ -169,7 +169,31 @@ function refreshDynamicStagPopup(_url = false) {
         let url = popup.attr('stag-popup-key'),
             initer = popup.attr('mc-initer');
         $.get(url, (_data) => {
-            popup.find('.stag-popup-content-inner').html(_data);
+            if(_target) {
+                _data = '<div>' + _data + '</div>';
+                _target = _target.split(',').map(_x => $.trim(_x));
+                for (let i = 0; i < _target.length; i++) {
+                    let t = _target[i];
+                    let targetElement = $(t).first();
+                    if(targetElement.length) {
+                        let sourceElement = $(_data).find(t).first();
+                        if (sourceElement && sourceElement.length) {
+                            targetElement.html(sourceElement.html());
+                            initFastLoad(targetElement);
+                            console.log('Replaced ' + t);
+                        }
+                        else {
+                            console.warn(t + ' not found in returned content');
+                        }
+                    }
+                    else {
+                        console.warn(t + ' not found in existing content');
+                    }
+                }
+            }
+            else {
+                popup.find('.stag-popup-content-inner').html(_data);
+            }
             convertContentLinksForInPopupNavigation(popup);
             if(initer) runMCInitializer(initer);
             runMCInitializer('pro-suggest');

Plik diff jest za duży
+ 0 - 0
public/js/yemi.js


+ 2 - 2
resources/views/app/generic-bills/inline.blade.php

@@ -16,14 +16,14 @@ $genericBills = genericBills($pro, @$patient, @$entityType, @$entityUid);
 
 @if(!count($genericBills))
     <div class="{{@$class ? $class : ''}} d-flex align-items-center">
-        <p class="font-weight-bold mb-0 font-size-16">No {{@$label ? $label : 'Admin.'}} Bills</p>
+        <p class="font-weight-bold mb-0">No {{@$label ? $label : 'Admin.'}} Bills</p>
         <span class="mx-2 text-secondary">|</span>
         @include('app.generic-bills.create_generic-bill')
     </div>
 @else
     <div class="{{@$class ? $class : ''}}">
         <div class="d-flex align-items-center mb-2">
-            <p class="font-weight-bold font-size-16 m-0">{{@$label ? $label : 'Admin.'}} Bills</p>
+            <p class="font-weight-bold m-0">{{@$label ? $label : 'Admin.'}} Bills</p>
             @if(!@$noCreate)
                 <span class="mx-2 text-secondary">|</span>
                 @include('app.generic-bills.create_generic-bill')

+ 24 - 16
resources/views/app/mcp/dashboard/notifications.blade.php

@@ -13,16 +13,20 @@
 @if(count($apptsPending['status']))
     <b class="text-secondary my-2 d-block">Appointment Status Changes</b>
     @foreach($apptsPending['status'] as $appt)
-        <div class="d-flex mb-1">
-            <div>
-                <a href="/patients/view/{{$appt->client->uid}}"><b>{{$appt->client->displayName()}}</b></a>
-                <span class="ml-2">{{friendlier_date_time($appt->start_time)}}</span>
-                <span class="ml-2">{{$appt->status}}</span>
-                @if($appt->status_memo)
-                    <div class="text-secondary text-sm">{{$appt->status_memo}} This is a status memo</div>
-                @endif
+        <div class="d-flex mb-1 border-bottom border-light">
+            <div class="flex-grow-1 d-inline-flex align-items-baseline">
+                <div>
+                    <a class="d-block" href="/patients/view/{{$appt->client->uid}}"><b>{{$appt->client->displayName()}}</b></a>
+                    <span class="d-block text-sm">{{friendlier_date_time($appt->start_time)}}</span>
+                </div>
+                <div class="ml-auto mr-3 text-right">
+                    <span class="font-weight-bold text-secondary">{{$appt->status}}</span>
+                    @if($appt->status_memo)
+                        <div class="text-secondary text-sm">{{$appt->status_memo}} This is a status memo</div>
+                    @endif
+                </div>
             </div>
-            <div moe relative class="ml-auto">
+            <div moe relative class="">
                 <form show url="/api/appointment/acknowledgeStatusAsAppointmentPro">
                     <input type="hidden" name="uid" value="{{$appt->uid}}">
                     <input type="hidden" name="currentStatus" value="{{$appt->status}}">
@@ -33,7 +37,7 @@
                     <input type="hidden" name="currentRawStartTime" value="{{$appt->raw_start_time}}">
                     <input type="hidden" name="currentRawEndTime" value="{{$appt->raw_end_time}}">
                     <input type="hidden" name="currentTimezone" value="{{$appt->timezone}}">
-                    <button submit class="bg-transparent border-0 p-0 text-primary">Acknowledge</button>
+                    <button submit class="bg-transparent border-0 p-0 text-primary">Ack.</button>
                 </form>
             </div>
         </div>
@@ -42,14 +46,18 @@
 @if(count($apptsPending['decision']))
     <b class="text-secondary my-2 d-block">Appointment Confirmation Changes</b>
     @foreach($apptsPending['decision'] as $appt)
-        <div class="d-flex mb-1">
-            <a href="/patients/view/{{$appt->client->uid}}"><b>{{$appt->client->displayName()}}</b></a>
-            <span class="ml-2">{{friendlier_date_time($appt->start_time)}}</span>
-            <span class="ml-2">{{$appt->latestConfirmationDecision->decision_enum}}</span>
-            <div moe relative class="ml-auto">
+        <div class="d-flex mb-1 border-bottom border-light">
+            <div class="flex-grow-1 d-inline-flex align-items-baseline">
+                <div>
+                    <a class="d-block" href="/patients/view/{{$appt->client->uid}}"><b>{{$appt->client->displayName()}}</b></a>
+                    <span class="d-block text-sm">{{friendlier_date_time($appt->start_time)}}</span>
+                </div>
+                <span class="ml-auto mr-3 font-weight-bold text-secondary">{{$appt->latestConfirmationDecision->decision_enum}}</span>
+            </div>
+            <div moe relative class="">
                 <form show url="/api/appointment/acknowledgeDecisionAsAppointmentPro">
                     <input type="hidden" name="uid" value="{{$appt->uid}}">
-                    <button submit class="bg-transparent border-0 p-0 text-primary">Acknowledge</button>
+                    <button submit class="bg-transparent border-0 p-0 text-primary">Ack.</button>
                 </form>
             </div>
         </div>

+ 1 - 1
resources/views/app/patient/accounts.blade.php

@@ -2,7 +2,7 @@
 @section('inner-content')
     <div class="">
         <div class="d-flex align-items-end pb-3">
-            <h4 class="font-weight-bold m-0 font-size-16">
+            <h4 class="font-weight-bold m-0">
                 <i class="fa fa-link"></i>
                 Linked Accounts
             </h4>

+ 53 - 0
resources/views/app/patient/appointment-calendar.blade.php

@@ -61,6 +61,59 @@
     }
     ?>
 
+    {{-- appts list --}}
+    <div class="">
+        <div class="d-flex align-items-end pb-3">
+            <h4 class="font-weight-bold m-0 font-size-16">{{ $patient->displayName() }}'s Appointments</h4>
+        </div>
+        <table class="table table-striped table-sm table-bordered mb-4">
+            @if($appointments && count($appointments))
+                <thead class="bg-light">
+                <tr>
+                    <th class="text-secondary border-bottom-0">Date & Time</th>
+                    <th class="text-secondary border-bottom-0">Pro</th>
+                    <th class="text-secondary border-bottom-0">Title</th>
+                    <th class="text-secondary border-bottom-0">Description</th>
+                    <th class="text-secondary border-bottom-0">Status</th>
+                    <th class="text-secondary border-bottom-0">Confirmation</th>
+                </tr>
+                </thead>
+                <tbody>
+                @foreach($appointments as $appointment)
+                    <tr>
+                        <td>
+                            <a href="/patients/view/{{$patient->uid}}/calendar/{{$appointment->uid}}" class="text-nowrap">
+                                {{friendlier_date_time($appointment->raw_date . ' ' . $appointment->raw_start_time)}}
+                            </a>
+                        </td>
+                        <td>{{ $appointment->pro->displayName() }}</pre></td>
+                        <td>{{ $appointment->title }}</td>
+                        <td>{{ $appointment->description }}</td>
+                        <td>
+                            {{ $appointment->status }}
+                            @if($appointment->status_memo)
+                                <hr>
+                                {{$appointment->status_memo}}
+                            @endif
+                        </td>
+                        <td>
+                            @if($appointment->status !== 'CANCELLED' && $appointment->status !== 'COMPLETED')
+                                @include('app.patient.partials.appointment-confirmation')
+                            @endif
+                        </td>
+                    </tr>
+                @endforeach
+                </tbody>
+            @else
+                <tbody>
+                <tr>
+                    <td class="text-secondary p-3">No recent or upcoming appointments</td>
+                </tr>
+                </tbody>
+            @endif
+        </table>
+    </div>
+
     <div id="calendarApp">
         <div class="d-flex align-items-center mb-2">
             <h4 class="font-weight-bold m-0 font-size-16">

+ 1 - 1
resources/views/app/patient/claims-resolver.blade.php

@@ -54,7 +54,7 @@
     }
     ?>
     <div id="claims-resolver">
-    <h4 class="font-weight-bold m-0 font-size-16 mb-3">Claims Resolver</h4>
+    <h4 class="font-weight-bold m-0 mb-3">Claims Resolver</h4>
     <h2><strong>Numbers:</strong></h2>
     <table class="table table-sm table-striped">
         <tr>

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

@@ -68,9 +68,6 @@
                 <!-- meds - point -->
                 @include('app.patient.point-based-partials.rx')
 
-                <!-- supplements - point -->
-                @include('app.patient.point-based-partials.supplements')
-
                 {{-- devices --}}
                 <?php
                 $availableDevices = count($devices);

+ 1 - 1
resources/views/app/patient/documents.blade.php

@@ -2,7 +2,7 @@
 @section('inner-content')
     <div>
         <div class="d-flex align-items-center pb-2">
-            <h4 class="font-weight-bold m-0 font-size-16">Documents</h4>
+            <h4 class="font-weight-bold m-0">Documents</h4>
             <span class="mx-2 text-secondary">|</span>
             <div moe>
                 <a start show class="">Upload</a>

+ 1 - 1
resources/views/app/patient/history.blade.php

@@ -1,7 +1,7 @@
 @extends ('layouts.patient')
 <?php $isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_create($patient->created_at))->invert === 1); ?>
 @section('inner-content')
-    <h6 class="my-0 font-weight-bold font-size-16">History</h6>
+    <h6 class="my-0 font-weight-bold">History</h6>
     @include('app.patient.point-based-partials.pmhx')
     @include('app.patient.point-based-partials.shx')
     @include('app.patient.point-based-partials.fhx')

+ 1 - 1
resources/views/app/patient/incoming-reports.blade.php

@@ -2,7 +2,7 @@
 @section('inner-content')
     <div id="incoming-reports">
         <div class="d-flex align-items-center pb-2">
-            <h4 class="font-weight-bold m-0 font-size-16">Incoming Reports</h4>
+            <h4 class="font-weight-bold m-0">Incoming Reports</h4>
             <span class="mx-2 text-secondary">|</span>
             <div moe>
                 <a start show class="">Upload</a>

+ 1 - 1
resources/views/app/patient/mcp-requests.blade.php

@@ -4,7 +4,7 @@
 <div id="client-settings-container">
     <div class="row">
         <div class="col-md-12">
-            <h4 class="font-weight-bold m-0 font-size-16 mb-3">MCP Requests</h4>
+            <h4 class="font-weight-bold m-0 mb-3">MCP Requests</h4>
             <div class="table-responsive border border-bottom-0">
                 <table class="table table-sm table-striped table-bordered m-0">
                     <thead class="bg-light">

+ 1 - 1
resources/views/app/patient/measurement-confirmation-numbers.blade.php

@@ -5,7 +5,7 @@
     <div id="simpleSMSReminderComponent">
         <div class="pt-2 d-flex align-items-start">
             <h6 class="my-0 d-flex align-items-center w-100">
-                <span class="font-weight-bold font-size-16">Measurement Confirmation Numbers</span>
+                <span class="font-weight-bold">Measurement Confirmation Numbers</span>
                 <span class="mx-2 text-secondary">|</span>
                 <div moe>
                     <a start show class="py-0 mb-3">Add</a>

+ 1 - 1
resources/views/app/patient/memos.blade.php

@@ -2,7 +2,7 @@
 @section('inner-content')
     <div class="">
         <div class="d-flex align-items-start pb-2">
-            <h4 class="font-weight-bold m-0 font-size-16">Client Memos</h4>
+            <h4 class="font-weight-bold m-0">Client Memos</h4>
         </div>
         <div moe class="w-50 p-2 border mb-3">
             <form url="/api/clientMemo/create" show>

+ 5 - 5
resources/views/app/patient/note/ccm-agreement.blade.php

@@ -13,7 +13,7 @@
 
     <?php $patient = $note->client; ?>
 
-    <div class="border rounded p-3 mb-3 max-width-500px">
+    <div class="border rounded p-3 mb-3 max-width-500px" id="ccm-agreement-reasons-{{$note->id}}">
         <p><b>CCM Reasons @if(!$patient->cmReasons || count($patient->cmReasons) < 2)(2 reasons required)@else <i class="fa fa-check text-success ml-1"></i> @endif</b></p>
         <div class="min-width-300px">
             @if(!$patient->cmReasons || !count($patient->cmReasons))
@@ -26,7 +26,7 @@
                             <span class="max-width-200px mr-3">{{$reason->description}}</span>
                             <div moe relative class="ml-auto">
                                 <a start show><i class="fa fa-pencil-alt"></i></a>
-                                <form url="/api/clientCmRmReason/updateBasic" class="mcp-theme-1" right>
+                                <form url="/api/clientCmRmReason/updateBasic" class="mcp-theme-1" right target="#ccm-agreement-reasons-{{$note->id}}">
                                     <input type="hidden" name="uid" value="{{$reason->uid}}">
                                     <div class="mb-2">
                                         <label class="text-sm mb-1 text-secondary">Code *</label>
@@ -48,7 +48,7 @@
                             </div>
                             <div moe relative class="ml-2">
                                 <a start show><i class="fa fa-trash-alt text-danger on-hover-opaque"></i></a>
-                                <form url="/api/clientCmRmReason/remove" class="mcp-theme-1" right>
+                                <form url="/api/clientCmRmReason/remove" class="mcp-theme-1" right target="#ccm-agreement-reasons-{{$note->id}}">
                                     <input type="hidden" name="uid" value="{{$reason->uid}}">
                                     <p>Remove this CM reason?</p>
                                     <div>
@@ -65,7 +65,7 @@
                 <div class="d-flex align-items-baseline">
                     <div moe>
                         <a start show>+ Add From Dx</a>
-                        <form url="/api/clientCmRmReason/create" class="mcp-theme-1">
+                        <form url="/api/clientCmRmReason/create" class="mcp-theme-1" target="#ccm-agreement-reasons-{{$note->id}}">
                             <input type="hidden" name="clientUid" value="{{$patient->uid}}">
                             <input type="hidden" name="cmOrRm" value="CM">
                             <input type="hidden" name="code" value="">
@@ -91,7 +91,7 @@
                     <span class="mx-2 text-secondary text-sm">|</span>
                     <div moe>
                         <a start show>+ Add</a>
-                        <form url="/api/clientCmRmReason/create" class="mcp-theme-1">
+                        <form url="/api/clientCmRmReason/create" class="mcp-theme-1" target="#ccm-agreement-reasons-{{$note->id}}">
                             <input type="hidden" name="clientUid" value="{{$patient->uid}}">
                             <input type="hidden" name="cmOrRm" value="CM">
                             <div class="mb-2">

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

@@ -587,7 +587,7 @@
                                     <a native target="_blank"
                                        class="screen-only ml-3"
                                        open-in-stag-popup
-                                       popup-style="medium"
+                                       popup-style="medium overflow-visible"
                                        mc-initer="ccm-agreement-{{$note->id}}"
                                        title="Consent To Chronic Care Management Services"
                                        href="/note/ccm-agreement/{{$note->uid}}?popupmode=1">
@@ -2488,7 +2488,7 @@
                                  class="c-pointer d-inline-flex align-items-center careteam-center-trigger px-2 py-1"
                                  open-in-stag-popup
                                  mc-initer="careteam-center-{{$note->id}}"
-                                 title="Careteam Center"
+                                 title="Care Team Center"
                                  popup-style="medium-large overflow-visible"
                                  href="/careteam-center/{{$patient->uid}}/{{$note->uid}}">
                                 <i class="fa fa-bolt mr-1"></i>

+ 49 - 37
resources/views/app/patient/note/rhs-sidebar.blade.php

@@ -19,10 +19,10 @@
             <i class="fa fa-bolt text-primary ml-1"></i>
         </div>
         @if($tracker && @($tracker->data->no_known_drug_allergies))
-            <div class="text-secondary mb-2"><span>-</span></div>
+            <div class="text-secondary mb-2"><span>No Known Drug Allergies</span></div>
         @endif
         @if($tracker && @($tracker->data->no_known_allergies_of_any_type))
-            <div class="text-secondary mb-2"><span>-</span></div>
+            <div class="text-secondary mb-2"><span>No Known Allergies of Any Type</span></div>
         @endif
         @if(!$tracker || !@($tracker->data->no_known_allergies_of_any_type))
             @if($allergies && count($allergies))
@@ -109,44 +109,56 @@
             <span class="px-1 text-secondary">-</span>
         @endif
     </div>
-    <div id="note-prescriptions" class="p-2 border-bottom c-pointer on-hover-aliceblue" data-non-segment-target="Prescriptions">
-    <div class="font-weight-bold mb-2">
-        ERx &amp; Orders
+    <div id="active-careteam" class="p-2 border-bottom c-pointer on-hover-aliceblue"
+         open-in-stag-popup
+         mc-initer="careteam-center-{{$note->id}}"
+         title="Care Team Center"
+         popup-style="medium-large overflow-visible"
+         href="/careteam-center/{{$patient->uid}}/{{$note->uid}}">
+        <div class="font-weight-bold">
+            Care Team
+            <i class="fa fa-external-link-alt text-primary ml-1"></i>
+        </div>
     </div>
-    @if($prescriptions && count($prescriptions))
-        @foreach($prescriptions as $prescription)
-            <div class="d-flex align-items-baseline px-1">
-                <span class="mr-2 text-secondary text-sm font-weight-bold">{{$prescription->erx_category}}</span>
-                <?php $parsed = json_decode($prescription->clinical_detail_json) ?>
-                <span class="flex-grow-1">
-                    <?php
-                    switch($prescription->erx_category) {
-                        case 'DRUG':
-                            if(@$parsed && @$parsed->items) {
-                                foreach ($parsed->items as $item) {
-                                    echo '<div>' . $item->medication . '</div>';
+    <div id="note-prescriptions" class="p-2 border-bottom c-pointer on-hover-aliceblue" data-non-segment-target="Prescriptions">
+        <div class="font-weight-bold mb-2">
+            ERx &amp; Orders
+        </div>
+        @if($prescriptions && count($prescriptions))
+            @foreach($prescriptions as $prescription)
+                <div class="d-flex align-items-baseline px-1">
+                    <span class="mr-2 text-secondary text-sm font-weight-bold">{{$prescription->erx_category}}</span>
+                    <?php $parsed = json_decode($prescription->clinical_detail_json) ?>
+                    <span class="flex-grow-1">
+                        <?php
+                        switch($prescription->erx_category) {
+                            case 'DRUG':
+                                if(@$parsed && @$parsed->items) {
+                                    foreach ($parsed->items as $item) {
+                                        echo '<div>' . $item->medication . '</div>';
+                                    }
                                 }
-                            }
-                            break;
-                        case 'LAB':
-                        case 'IMAGING':
-                            if(@$parsed && @$parsed->items) {
-                                foreach ($parsed->items as $item) {
-                                    if(@$item->tests) {
-                                        foreach ($item->tests as $test) {
-                                            echo '<div>' . $test->desc . '</div>';
+                                break;
+                            case 'LAB':
+                            case 'IMAGING':
+                                if(@$parsed && @$parsed->items) {
+                                    foreach ($parsed->items as $item) {
+                                        if(@$item->tests) {
+                                            foreach ($item->tests as $test) {
+                                                echo '<div>' . $test->desc . '</div>';
+                                            }
                                         }
                                     }
                                 }
-                            }
-                            break;
-                    }
-                    ?>
-                </span>
-            </div>
-        @endforeach
-    @else
-        <span class="px-1 text-secondary">-</span>
-    @endif
-</div>
+                                break;
+                        }
+                        ?>
+                    </span>
+                </div>
+            @endforeach
+        @else
+            <span class="px-1 text-secondary">-</span>
+        @endif
+    </div>
+
 </div>

+ 1 - 1
resources/views/app/patient/note/rm-setup.blade.php

@@ -72,7 +72,7 @@
                         <a native target="_blank"
                            class="screen-only ml-2"
                            open-in-stag-popup
-                           popup-style="medium"
+                           popup-style="medium overflow-visible"
                            mc-initer="rpm-agreement-{{$note->id}}"
                            title="Leadership Health Remote Patient Monitoring Consent Form"
                            href="/note/rpm-agreement/{{$note->uid}}?popupmode=1">

+ 5 - 5
resources/views/app/patient/note/rpm-agreement.blade.php

@@ -42,7 +42,7 @@
 
     <?php $patient = $note->client; ?>
 
-    <div class="border rounded p-3 mb-3 max-width-500px">
+    <div class="border rounded p-3 mb-3 max-width-500px" id="rpm-agreement-reasons-{{$note->id}}">
         <p><b>RPM Reasons</b></p>
         <div class="max-width-500px">
             @if(!$patient->rmReasons || !count($patient->rmReasons))
@@ -55,7 +55,7 @@
                             <span class="max-width-200px mr-3">{{$reason->description}}</span>
                             <div moe relative class="ml-auto">
                                 <a start show><i class="fa fa-pencil-alt"></i></a>
-                                <form url="/api/clientCmRmReason/updateBasic" class="mcp-theme-1" right>
+                                <form url="/api/clientCmRmReason/updateBasic" class="mcp-theme-1" right target="#rpm-agreement-reasons-{{$note->id}}">
                                     <input type="hidden" name="uid" value="{{$reason->uid}}">
                                     <div class="mb-2">
                                         <label class="text-sm mb-1 text-secondary">Code *</label>
@@ -77,7 +77,7 @@
                             </div>
                             <div moe relative class="ml-2">
                                 <a start show><i class="fa fa-trash-alt text-danger on-hover-opaque"></i></a>
-                                <form url="/api/clientCmRmReason/remove" class="mcp-theme-1" right>
+                                <form url="/api/clientCmRmReason/remove" class="mcp-theme-1" right target="#rpm-agreement-reasons-{{$note->id}}">
                                     <input type="hidden" name="uid" value="{{$reason->uid}}">
                                     <p>Remove this RM reason?</p>
                                     <div>
@@ -93,7 +93,7 @@
             <div class="d-flex align-items-baseline">
                 <div moe>
                     <a start show>+ Add From Dx</a>
-                    <form url="/api/clientCmRmReason/create" class="mcp-theme-1">
+                    <form url="/api/clientCmRmReason/create" class="mcp-theme-1" target="#rpm-agreement-reasons-{{$note->id}}">
                         <input type="hidden" name="clientUid" value="{{$patient->uid}}">
                         <input type="hidden" name="cmOrRm" value="RM">
                         <input type="hidden" name="code" value="">
@@ -119,7 +119,7 @@
                 <span class="mx-2 text-secondary text-sm">|</span>
                 <div moe>
                     <a start show>+ Add New</a>
-                    <form url="/api/clientCmRmReason/create" class="mcp-theme-1">
+                    <form url="/api/clientCmRmReason/create" class="mcp-theme-1" target="#rpm-agreement-reasons-{{$note->id}}">
                         <input type="hidden" name="clientUid" value="{{$patient->uid}}">
                         <input type="hidden" name="cmOrRm" value="RM">
                         <div class="mb-2">

+ 1 - 1
resources/views/app/patient/partials/appointments.blade.php

@@ -1,6 +1,6 @@
 <div class="mt-0 pb-1">
     <div class="d-flex align-items-center mb-2 pt-2">
-        <h6 class="my-0 font-weight-bold font-size-16">Appointments</h6>
+        <h6 class="my-0 font-weight-bold">Appointments</h6>
         <span class="mx-2 text-secondary">|</span>
         <a href="/patients/view/{{$patient->uid}}/calendar">Calendar</a>
     </div>

+ 1 - 1
resources/views/app/patient/point-based-partials/allergies.blade.php

@@ -3,7 +3,7 @@ $allergies = \App\Models\Point::getPointsOfCategory($patient, "ALLERGY");
 ?>
 <div class="pt-2 mt-2">
     <div class="d-flex align-items-center pb-2">
-        <h6 class="my-0 font-weight-bold font-size-16">Allergies</h6>
+        <h6 class="my-0 font-weight-bold">Allergies</h6>
         @if($isOldClient)
             <div class="px-2 font-weight-bold alert alert-info text-sm my-0 ml-2 py-1">New</div>
         @endif

+ 1 - 1
resources/views/app/patient/point-based-partials/care-team.blade.php

@@ -3,7 +3,7 @@ $careTeamMembers = \App\Models\Point::getPointsOfCategory($patient, "CARE_TEAM_M
 ?>
 <div class="pt-2 mt-2">
     <div class="d-flex align-items-center pb-2">
-        <h6 class="my-0 font-weight-bold font-size-16">Care Team</h6>
+        <h6 class="my-0 font-weight-bold">Care Team</h6>
         @if($isOldClient)
             <div class="px-2 font-weight-bold alert alert-info text-sm my-0 ml-2 py-1">New</div>
         @endif

+ 1 - 1
resources/views/app/patient/point-based-partials/dx.blade.php

@@ -3,7 +3,7 @@ $problems = \App\Models\Point::getPointsOfCategory($patient, "PROBLEM");
 ?>
 <div class="pt-2">
     <div class="d-flex align-items-center pb-2">
-        <h6 class="my-0 font-weight-bold font-size-16">Current Problems / Focus Areas</h6>
+        <h6 class="my-0 font-weight-bold">Current Problems / Focus Areas</h6>
         @if($isOldClient)
             <div class="px-2 font-weight-bold alert alert-info text-sm my-0 ml-2 py-1">New</div>
         @endif

+ 1 - 1
resources/views/app/patient/point-based-partials/rx.blade.php

@@ -3,7 +3,7 @@ $medications = \App\Models\Point::getPointsOfCategory($patient, "MEDICATION");
 ?>
 <div class="pt-2 mt-2">
     <div class="d-flex align-items-center pb-2">
-        <h6 class="my-0 font-weight-bold font-size-16">Current Medications</h6>
+        <h6 class="my-0 font-weight-bold">Current Medications</h6>
         @if($isOldClient)
             <div class="px-2 font-weight-bold alert alert-info text-sm my-0 ml-2 py-1">New</div>
         @endif

+ 1 - 1
resources/views/app/patient/prescriptions/list.blade.php

@@ -103,7 +103,7 @@
         <div v-if="currentPrescription" class="border-top border-right border-bottom align-self-stretch p-3 flex-grow-1 min-width-50">
             <div class="d-flex align-items-center">
                 <h3 class="font-size-16 m-0">
-                    <b class="mr-1 font-size-16">@{{ currentPrescription.erx_category }}: @{{ currentPrescription.created_at_friendly_short }}</b>
+                    <b class="mr-1 font-size-16">@{{ currentPrescription.erx_category }} ERx <span class="ml-2">@{{ currentPrescription.created_at_friendly_short }}</span></b>
                 </h3>
                 <a class="ml-auto" href="#" v-on:click.prevent="currentPrescription=null">
                     <i class="fa fa-times-circle on-hover-opaque"></i>

+ 42 - 7
resources/views/app/patient/problems-center.blade.php

@@ -30,7 +30,26 @@ function isFavoriteProblem($_problem, $_favorites) {
             <span class="mx-2 text-secondary">|</span>
             <a href="#" class="regenerate-cc">Regenerate with relevant problems</a>
         </div>
-        <textarea rows="3" readonly class="cc-readonly form-control form-control-sm mb-0 bg-light"><?= $ccSegment && @$ccSegment->summary_html ? trim(strip_tags($ccSegment->summary_html)) : '' ?></textarea>
+
+        <?php
+        $segment = $note->getSegmentByInternalName('chief_complaint');
+        $ccPoint = Point::where('added_in_segment_id', $segment->id)->where('category', 'CHIEF_COMPLAINT')->orderBy('id', 'DESC')->first();
+        $parsed = null;
+        if ($ccPoint && !!@$ccPoint->data) {
+            $parsed = json_decode($ccPoint->data);
+        }
+        ?>
+        <div visit-moe class="d-block">
+            <form show="" url="/api/visitPoint/upsertNoteSingleton" class="mcp-theme-1" id="frm-cc-regenerate">
+                <input type="hidden" name="segmentUid" value="{{$segment->uid}}">
+                <input type="hidden" name="category" value="CHIEF_COMPLAINT">
+                <input type="hidden" name="data" value="">
+                <div note-rte slim-rte
+                     class="form-group mb-2 border-left border-right rte-holder cc-generated"
+                     data-field-name="free_text"
+                ><?= $parsed && @$parsed->free_text ? $parsed->free_text : '' ?></div>
+            </form>
+        </div>
 
         <hr class="m-neg-3 my-3">
         @endif
@@ -362,13 +381,10 @@ function isFavoriteProblem($_problem, $_favorites) {
                     showMask();
 
                     // refresh the cc
-                    $.post('/api/visit/updateSegmentHtml', {
-                        segmentUid: '{{$ccSegment->uid}}'
-                    }, _data => {
+                    $.get('/note/generate-cc/{{$note->uid}}', _data => {
                         if(!hasResponseError(_data)) {
-                            parentSegment.find('.cc-readonly').val(
-                                $.trim($('<div/>').html(_data.data.summaryHtml).text())
-                            );
+                            let quillInstance = $('#frm-cc-regenerate').find('.cc-generated').first().data('quillInstance');
+                            quillInstance.root.innerHTML = $.trim($('<div/>').html(_data.data).text());
                         }
                     }, 'json')
                     .then(function() {
@@ -397,6 +413,25 @@ function isFavoriteProblem($_problem, $_favorites) {
                     $(this).closest('.on-click-menu').find('[menu]').hide();
                     return false;
                 });
+
+            setTimeout(() => {
+                // custom buttons on title bar
+                $('.button-container').remove();
+                let buttonContainer = $('<div/>').addClass('button-container ml-4 mr-auto');
+                let titleElem = $('#problems-center-{{$note->id}}').closest('.stag-popup').find('.stag-popup-title>span');
+                titleElem.next().removeClass('ml-auto');
+                titleElem.parent().addClass('align-items-center');
+
+                $('<div class="d-inline-flex align-self-stretch align-items-center">' +
+                    '<span class="autosave-indicator saving text-sm text-secondary">Saving changes &hellip;</span>' +
+                    '<span class="autosave-indicator saved text-sm text-secondary">' +
+                    '<i class="fa fa-check"></i>' +
+                    ' Saved' +
+                    '</span>' +
+                    '</div>').appendTo(buttonContainer);
+
+                buttonContainer.insertAfter(titleElem);
+            }, 1000); // HACK - don't autosave the init-time induced 'change' events
         }
         addMCInitializer('problems-center-{{$note->id}}', init, '#problems-center-{{$note->id}}');
     }).call(window);

+ 1 - 1
resources/views/app/patient/pros.blade.php

@@ -2,7 +2,7 @@
 @section('inner-content')
     <div class="">
         <div class="d-flex align-items-center pb-2">
-            <h4 class="font-weight-bold m-0 font-size-16">Pros With Access</h4>
+            <h4 class="font-weight-bold m-0">Pros With Access</h4>
         </div>
         <table class="table table-striped table-sm table-bordered mb-0">
             @php $prosWithAccess = $patient->prosWithAccess(); @endphp

+ 1 - 1
resources/views/app/patient/rm-setup.blade.php

@@ -2,7 +2,7 @@
 
 @section('inner-content')
 
-    <h4 class="font-weight-bold mb-3 font-size-16" id="rm-setup">RM Setup</h4>
+    <h4 class="font-weight-bold mb-3" id="rm-setup">RM Setup</h4>
 
     @include('app.patient.partials.rm-setup')
 

+ 16 - 2
resources/views/app/patient/segment-templates/_custom_items/edit.blade.php

@@ -21,13 +21,13 @@
             </div>
         </div>
         <div class="row custom-items-container">
-            <div class="col-4" v-for="item in customFields" v-if="!item.other">
+            <div class="col-4" v-for="(item, itemIndex) in customFields" v-if="!item.other">
                 <label class="d-flex align-items-start mb-1">
                     <input type="checkbox" class="mx-0 mt-1"
                            v-model="item.value">
                     <div class="ml-2 pr-3">
                         <div>
-                            <span class="mr-2 custom-item">@{{ item.label }}</span>
+                            <span class="mr-1 custom-item">@{{ item.label }}</span>
                             <div moe relative no-mask v-show="item.value" >
                                 <a href="#" start show>
                                     <i class="fa-comment" :class="item.comments ? 'fas' : 'far'"></i>
@@ -41,6 +41,20 @@
                                     </div>
                                 </div>
                             </div>
+                            <div moe relative no-mask class="ml-1">
+                                <a href="#" start show>
+                                    <i class="fa fa-trash-alt text-danger on-hover-opaque"></i>
+                                </a>
+                                <div custom-item-form url="/nop">
+                                    <p class="mb-2 text-nowrap">
+                                        Remove this custom item?
+                                    </p>
+                                    <div class="">
+                                        <button type="button" class="btn btn-sm btn-danger" v-on:click.prevent="removeCustomItem(item, itemIndex)" cancel>Yes</button>
+                                        <button type="button" class="btn btn-sm btn-default border" cancel>No</button>
+                                    </div>
+                                </div>
+                            </div>
                         </div>
                         <span v-show="item.value && item.comments"
                               v-html="item.comments"

+ 18 - 1
resources/views/app/patient/segment-templates/_custom_items/script.blade.php

@@ -40,6 +40,11 @@ saveCustomItem: function(_label) {
                 label: _label,
                 value: '',
                 comments: '',
+                uid: _data.data
+            });
+            Vue.nextTick(() => {
+                $('[data-segment-template-name="<?= !!@$segment ? $segment->segmentTemplate->internal_name : $segmentInternalName ?>"]').find('[moe][initialized]').removeAttr('initialized');
+                initMoes();
             });
         }
         else {
@@ -52,4 +57,16 @@ cancelCustomItem: function() {
     hideMoeFormMask();
     $('[custom-item-form]').hide();
     return false;
-},
+},
+removeCustomItem: function(_item, _index) {
+    _item.value = false;
+    $('[custom-item-form]').hide();
+    $.post('/api/clientCanvasCustomItem/remove', {uid: _item.uid}, _data => {
+        if(!hasResponseError(_data)) {
+            this.customFields.splice(_index, 1);
+            Vue.nextTick(() => {
+                $('[data-segment-template-name="<?= !!@$segment ? $segment->segmentTemplate->internal_name : $segmentInternalName ?>"]').find('textarea').first().trigger('input')
+            });
+        }
+    });
+}

+ 31 - 0
resources/views/app/patient/segment-templates/chief_complaint/generate.blade.php

@@ -0,0 +1,31 @@
+<?php
+list($problemPoints, $counts) = \App\Models\Point::getPointsOfCategoryExtended($client, 'PROBLEM', $note);
+$problemNames = [];
+foreach ($problemPoints as $problemPoint) {
+    if($problemPoint->relevanceToNote($note)) {
+        $problemNames[] = $problemPoint->data->name;
+    }
+}
+$problems = '';
+for($i = 0; $i < count($problemNames); $i++) {
+    if($i > 0) {
+        if($i === count($problemNames) - 1) {
+            $problems .= " and ";
+        }
+        else {
+            $problems .= ", ";
+        }
+    }
+    $problems .= $problemNames[$i];
+}
+$defaultCC = "Patient {$client->name_first} {$client->name_last} " .
+    "is a {$client->age_in_years} year old" .
+    ($client->sex ? ($client->sex === 'F' ? ' female' : ($client->sex === 'M' ? ' male' : ' ' . $client->sex)) : '') .
+    ($problems ? " with a history of {$problems}" : "") .
+    ($note->new_or_fu_or_na === 'NEW' ? ' presenting for establishing care' : ' presenting for follow-up') .
+    ".";
+echo json_encode([
+    "success" => true,
+    "data" => $defaultCC
+]);
+?>

+ 2 - 0
resources/views/app/patient/segment-templates/chief_complaint/summary.blade.php

@@ -10,6 +10,7 @@ if ($point && !!@$point->data) {
 }
 
 if(!$parsed || !@$parsed->free_text) {
+    /*
     list($problemPoints, $counts) = Point::getPointsOfCategoryExtended($patient, 'PROBLEM', $note);
     $problemNames = [];
     foreach ($problemPoints as $problemPoint) {
@@ -38,6 +39,7 @@ if(!$parsed || !@$parsed->free_text) {
     $parsed = json_decode(json_encode([
         "free_text" => $defaultCC
     ]));
+    */
 }
 ?>
 <div>

+ 1 - 1
resources/views/app/patient/segment-templates/history_family/edit.blade.php

@@ -66,7 +66,7 @@ if(!$contentData) {
                 <div class="border border-secondary rounded mb-2 p-2">
                     <label class="my-0 d-flex align-items-center">
                         <input type="checkbox" class="my-0 mr-2" v-model="unknown" name="unknown">
-                        <span>-</span>
+                        <span>Family history is unknown/unavailable</span>
                     </label>
                 </div>
 

+ 23 - 10
resources/views/app/patient/segment-templates/history_social/edit.blade.php

@@ -28,9 +28,9 @@ $fields = [
 ];
 
 $customFields = $pro->canvasCustomItems('sochx');
-$customFields = array_map(function($_item) {
+/*$customFields = array_map(function($_item) {
     return $_item['label'];
-}, $customFields->toArray());
+}, $customFields->toArray());*/
 
 if(!$customFields) $customFields = [];
 
@@ -54,9 +54,7 @@ for ($i = 0; $i < count($fields); $i++) {
         }
     }
 }
-
 ?>
-
 <hr class="hide-outside-popup mt-3 mb-0">
 <div class="p-3 mcp-theme-1">
     <div {{!!$segment ? 'visit-moe' : 'moe'}} close-on-save close-on-cancel class="d-block">
@@ -157,21 +155,36 @@ for ($i = 0; $i < count($fields); $i++) {
                 model.customFields = [];
             }
             for (let i = 0; i < myCustomFields.length; i++) {
-                let found = model.customFields.filter(function(_item) {
-                    return _item.label === myCustomFields[i];
-                }).length;
-                if(!found) {
+                let foundAt = -1;
+                for (let j = 0; j < model.customFields.length; j++) {
+                    if(model.customFields[j].label === myCustomFields[i].label) {
+                        foundAt = j;
+                        break;
+                    }
+                }
+                if(foundAt === -1) {
                     model.customFields.push({
-                        label: myCustomFields[i],
+                        label: myCustomFields[i].label,
                         value: '',
                         comments: '',
+                        uid: myCustomFields[i].uid
                     })
                 }
+                else {
+                    model.customFields[foundAt].uid = myCustomFields[i].uid;
+                }
             }
 
             // if not own AND not active - remove from model.customFields
             for (let i = model.customFields.length - 1; i >= 0 ; i--) {
-                if(myCustomFields.indexOf(model.customFields[i].label) === -1) {
+                let foundAt = -1;
+                for (let j = 0; j < myCustomFields.length; j++) {
+                    if(model.customFields[i].label === myCustomFields[j].label) {
+                        foundAt = j;
+                        break;
+                    }
+                }
+                if(foundAt === -1) {
                     if(!!model.customFields[i].value) {
                         model.customFields[i].other = true;
                     }

+ 23 - 10
resources/views/app/patient/segment-templates/history_surgical/edit.blade.php

@@ -25,9 +25,9 @@ $fields = [
 ];
 
 $customFields = $pro->canvasCustomItems('pshx');
-$customFields = array_map(function($_item) {
+/*$customFields = array_map(function($_item) {
     return $_item['label'];
-}, $customFields->toArray());
+}, $customFields->toArray());*/
 
 if(!$customFields) $customFields = [];
 
@@ -51,9 +51,7 @@ for ($i = 0; $i < count($fields); $i++) {
         }
     }
 }
-
 ?>
-
 <hr class="hide-outside-popup mt-3 mb-0">
 <div class="p-3 mcp-theme-1">
     <div {{!!$segment ? 'visit-moe' : 'moe'}} close-on-save close-on-cancel class="d-block">
@@ -157,21 +155,36 @@ for ($i = 0; $i < count($fields); $i++) {
                 model.customFields = [];
             }
             for (let i = 0; i < myCustomFields.length; i++) {
-                let found = model.customFields.filter(function(_item) {
-                    return _item.label === myCustomFields[i];
-                }).length;
-                if(!found) {
+                let foundAt = -1;
+                for (let j = 0; j < model.customFields.length; j++) {
+                    if(model.customFields[j].label === myCustomFields[i].label) {
+                        foundAt = j;
+                        break;
+                    }
+                }
+                if(foundAt === -1) {
                     model.customFields.push({
-                        label: myCustomFields[i],
+                        label: myCustomFields[i].label,
                         value: '',
                         comments: '',
+                        uid: myCustomFields[i].uid
                     })
                 }
+                else {
+                    model.customFields[foundAt].uid = myCustomFields[i].uid;
+                }
             }
 
             // if not own AND not active - remove from model.customFields
             for (let i = model.customFields.length - 1; i >= 0 ; i--) {
-                if(myCustomFields.indexOf(model.customFields[i].label) === -1) {
+                let foundAt = -1;
+                for (let j = 0; j < myCustomFields.length; j++) {
+                    if(model.customFields[i].label === myCustomFields[j].label) {
+                        foundAt = j;
+                        break;
+                    }
+                }
+                if(foundAt === -1) {
                     if(!!model.customFields[i].value) {
                         model.customFields[i].other = true;
                     }

+ 23 - 8
resources/views/app/patient/segment-templates/past_medical_history/edit.blade.php

@@ -37,9 +37,9 @@ $fields = [
 ];
 
 $customFields = $pro->canvasCustomItems('pmhx');
-$customFields = array_map(function($_item) {
+/*$customFields = array_map(function($_item) {
     return $_item['label'];
-}, $customFields->toArray());
+}, $customFields->toArray());*/
 
 if(!$customFields) $customFields = [];
 
@@ -195,21 +195,36 @@ for ($i = 0; $i < count($fields); $i++) {
                 model.customFields = [];
             }
             for (let i = 0; i < myCustomFields.length; i++) {
-                let found = model.customFields.filter(function(_item) {
-                    return _item.label === myCustomFields[i];
-                }).length;
-                if(!found) {
+                let foundAt = -1;
+                for (let j = 0; j < model.customFields.length; j++) {
+                    if(model.customFields[j].label === myCustomFields[i].label) {
+                        foundAt = j;
+                        break;
+                    }
+                }
+                if(foundAt === -1) {
                     model.customFields.push({
-                        label: myCustomFields[i],
+                        label: myCustomFields[i].label,
                         value: '',
                         comments: '',
+                        uid: myCustomFields[i].uid
                     })
                 }
+                else {
+                    model.customFields[foundAt].uid = myCustomFields[i].uid;
+                }
             }
 
             // if not own AND not active - remove from model.customFields
             for (let i = model.customFields.length - 1; i >= 0 ; i--) {
-                if(myCustomFields.indexOf(model.customFields[i].label) === -1) {
+                let foundAt = -1;
+                for (let j = 0; j < myCustomFields.length; j++) {
+                    if(model.customFields[i].label === myCustomFields[j].label) {
+                        foundAt = j;
+                        break;
+                    }
+                }
+                if(foundAt === -1) {
                     if(!!model.customFields[i].value) {
                         model.customFields[i].other = true;
                     }

+ 6 - 7
resources/views/app/patient/segment-templates/ros/edit.blade.php

@@ -58,9 +58,8 @@ $fields = [
             "Itching",
             "Running nose",
             "Sneezing",
-            "Watery eyes"]
-    ],
-    [
+            "Watery eyes"],
+
         "Cardiovascular" => [
             "Chest pain / pressure at rest",
             "Chest pain / pressure with excursion",
@@ -78,6 +77,8 @@ $fields = [
             "Sweating",
             "Swelling"],
 
+    ],
+    [
         "Respiratory" => [
             "Cough – dry",
             "Cough – wet",
@@ -102,8 +103,7 @@ $fields = [
             "Rectal pain",
             "Stool – black tarry",
             "Stool – bloody"],
-    ],
-    [
+
         "Genitourinary" => [
             "Blood in urine",
             "Discharge",
@@ -144,7 +144,6 @@ $fields = [
             "Track marks",
             "Ulcer",
             "Wound"],
-
     ],
     [
         "Neurological" => [
@@ -242,7 +241,7 @@ for ($i = 0; $i < count($fields); $i++) {
                 </div>
                 <div class="d-flex align-items-start flex-wrap custom-items-container">
                     @for ($i = 0; $i < count($fields); $i++)
-                        <div class="w-25">
+                        <div class="w-33">
                             @foreach($fields[$i] as $head => $values)
                                 <div class="font-weight-bold mb-2">{{ $head }}</div>
                                 <div class="d-flex flex-nowrap align-items-center mb-1">

+ 2 - 2
resources/views/app/patient/segment-templates/vitals/edit.blade.php

@@ -166,11 +166,11 @@ $copyTriggerAdded = [];
                                 <div class="d-flex align-items-center bg-white">
                                     <input type="text" class="form-control form-control-sm min-width-unset w-auto-input width-30px border-0 edit"
                                            heightFeetInput
-                                           value="{{feetFromInches($contentData['heightInInches'])}}">
+                                           value="{{feetFromInches($contentData['heightInInches']) ?: ''}}">
                                     <span class="pl-1 pr-2 text-secondary bg-white">ft.</span>
                                     <input type="text" class="form-control form-control-sm min-width-unset w-auto-input width-30px border-0 edit"
                                            heightInchesInput
-                                           value="{{inchesAfterFeetFromInches($contentData['heightInInches'])}}">
+                                           value="{{inchesAfterFeetFromInches($contentData['heightInInches']) ?: ''}}">
                                     <span class="pl-1 text-secondary bg-white">in.</span>
                                     <input type="hidden" data-name="heightInInches" value="{{$contentData['heightInInches']}}">
                                 </div>

+ 1 - 1
resources/views/app/patient/settings.blade.php

@@ -3,7 +3,7 @@
 @section('inner-content')
 
     <div id="client-settings-container">
-    <h4 class="font-weight-bold m-0 mb-3 font-size-16">Settings</h4>
+    <h4 class="font-weight-bold m-0 mb-3">Settings</h4>
         <div class="row">
             <div class="col-6">
 

+ 1 - 1
resources/views/app/patient/shipments.blade.php

@@ -2,7 +2,7 @@
 @section('inner-content')
     <div class="">
         <div class="d-flex align-items-center mb-3">
-            <h4 class="font-weight-bold m-0 font-size-16">Shipments</h4>
+            <h4 class="font-weight-bold m-0">Shipments</h4>
             <span class="mx-2 text-secondary">|</span>
             <div moe>
                 <a start show href="#">Add</a>

+ 1 - 1
resources/views/app/patient/sms-numbers.blade.php

@@ -2,7 +2,7 @@
 @section('inner-content')
     <div>
         <div class="d-flex align-items-center pb-2">
-            <h4 class="font-weight-bold m-0 font-size-16">SMS Numbers</h4>
+            <h4 class="font-weight-bold m-0">SMS Numbers</h4>
             <span class="mx-2 text-secondary">|</span>
             <div moe relative>
                 <a start show class="">+ Add New</a>

+ 1 - 1
resources/views/app/patient/sms-reminders.blade.php

@@ -5,7 +5,7 @@
     <div id="simpleSMSReminderComponent">
         <div class="pt-2 d-flex align-items-start">
             <h6 class="my-0 d-flex align-items-center w-100">
-                <span class="font-weight-bold font-size-16">SMS Reminders</span>
+                <span class="font-weight-bold">SMS Reminders</span>
                 <span class="mx-2 text-secondary">|</span>
                 <div moe>
                     <a start show class="py-0 mb-3">Add</a>

+ 1 - 1
resources/views/app/patient/sms.blade.php

@@ -2,7 +2,7 @@
 @section('inner-content')
     <div class="">
         <div class="d-flex align-items-center pb-2">
-            <h4 class="font-weight-bold m-0 font-size-16">SMS Messages</h4>
+            <h4 class="font-weight-bold m-0">SMS Messages</h4>
             <span class="mx-2 text-secondary">|</span>
             <div moe>
                 <a start show class="">Send SMS</a>

+ 1 - 1
resources/views/app/patient/supply-orders.blade.php

@@ -2,7 +2,7 @@
 @section('inner-content')
     <div class="" id="patient-supply-orders">
         <div class="d-flex align-items-baseline mb-3">
-            <div class="font-weight-bold m-0 font-size-16">Supply Orders</div>
+            <div class="font-weight-bold m-0">Supply Orders</div>
             @if($pro->pro_type === 'ADMIN' || request()->input('note-uid'))
                 <span class="mx-2 text-secondary">|</span>
                 <div moe large>

+ 7 - 0
resources/views/app/patient/wizard-partials/common-script.blade.php

@@ -121,6 +121,8 @@ function __initRTEs(_collection) {
             .attr('data-editor-id', editorID)
             .attr('with-shortcuts', 1);
 
+        $(el).data('quillInstance', quill);
+
         // set value initially
         if(!noteRTE.is('[ignore-changes]')) {
             onTextChange();
@@ -754,4 +756,9 @@ $(document).on('rich-text-input.auto-save-rich-text-input', '[if-edit-mode] [vis
     }
 });
 
+$(document).off('rich-text-input.auto-save-rich-text-input', '#frm-cc-regenerate [note-rte]');
+$(document).on('rich-text-input.auto-save-rich-text-input', '#frm-cc-regenerate [note-rte]', function () {
+    debouncedLifestyleSaver(this);
+});
+
 initStagSuggest();

+ 3 - 0
resources/views/layouts/patient.blade.php

@@ -6,6 +6,7 @@
 $trimLayout = true;
 $routeName = request()->route()->getName();
 $isVisitNote = ($routeName === 'patients.view.notes.view.dashboard' && @$note && !!$note->visitTemplate);
+$isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_create($patient->created_at))->invert === 1);
 ?>
 <style media="screen">
 	.pt-name {
@@ -147,6 +148,7 @@ $isVisitNote = ($routeName === 'patients.view.notes.view.dashboard' && @$note &&
 							</ul>
 							*/ ?>
 						</li>
+						@if($isOldClient)
 						<li class="nav-item">
 							<a class="nav-link {{ strpos($routeName, 'patients.view.patient-tickets') === 0 ? 'active' : '' }}"
 							   href="{{ route('patients.view.patient-tickets', ['patient' => $patient]) }}" title="Deprecated">ERx / Orders
@@ -175,6 +177,7 @@ $isVisitNote = ($routeName === 'patients.view.notes.view.dashboard' && @$note &&
 								</li>
 							</ul>
 						</li>
+						@endif
 						<li class="nav-item">
 							<a class="nav-link {{ strpos($routeName, 'patients.view.supply-orders') === 0 ? 'active' : '' }}"
 							   href="{{ route('patients.view.supply-orders', ['patient' => $patient]) }}">Supply Orders</a>

+ 1 - 0
routes/web.php

@@ -456,6 +456,7 @@ Route::middleware('pro.auth')->group(function () {
     Route::get('/point/review-log/{point}', 'NoteController@reviewLog')->name('point-review-log');
     Route::get('/point/plan-log/{point}', 'NoteController@planLog')->name('point-plan-log');
     Route::get('/note/pdf/{note}', 'NoteController@downloadAsPdf')->name('note-pdf');
+    Route::get('/note/generate-cc/{note}', 'NoteController@generateCC')->name('note-generate-cc');
     Route::get('/note/ccm-agreement/{note}', 'NoteController@ccmAgreement')->name('ccm-agreement');
     Route::get('/note/rpm-agreement/{note}', 'NoteController@rpmAgreement')->name('rpm-agreement');
     Route::get('/segment-summary/{segment}', 'NoteController@segmentSummary')->name('segment-summary');

+ 24 - 24
yemi.js

@@ -76,17 +76,17 @@ var doAjax = function (url, data, pre, post, onSuccess, onFailure, suppressError
         showMask();
     }
     jQuery.ajax(url, {
-            dataType: 'json',
-            data: data,
-            type: 'POST',
-            beforeSend: function () {
-                if (pre) {
-                    pre();
-                }
+        dataType: 'json',
+        data: data,
+        type: 'POST',
+        beforeSend: function () {
+            if (pre) {
+                pre();
             }
-        })
+        }
+    })
         .done(function (response, b) {
-			console.log(response);
+            console.log(response);
             var success = response.success;
             if (success) {
                 if (onSuccess) {
@@ -242,14 +242,14 @@ $(function () {
                         width: 500,
                         modal: true,
                         buttons: [{
-                                text: 'Use suggestion',
-                                click: function () {
-                                    for (var prop in a) {
-                                        $(a[prop]).val(suggestion[prop]);
-                                    }
-                                    $(this).dialog('close');
+                            text: 'Use suggestion',
+                            click: function () {
+                                for (var prop in a) {
+                                    $(a[prop]).val(suggestion[prop]);
                                 }
-                            },
+                                $(this).dialog('close');
+                            }
+                        },
                             {
                                 text: 'Keep original',
                                 click: function () {
@@ -267,14 +267,14 @@ $(function () {
                         width: 500,
                         modal: true,
                         buttons: [{
-                                text: 'Erase address fields',
-                                click: function () {
-                                    for (var prop in a) {
-                                        $(a[prop]).val('');
-                                    }
-                                    $(this).dialog('close');
+                            text: 'Erase address fields',
+                            click: function () {
+                                for (var prop in a) {
+                                    $(a[prop]).val('');
                                 }
-                            },
+                                $(this).dialog('close');
+                            }
+                        },
                             {
                                 text: 'Keep original',
                                 click: function () {
@@ -520,7 +520,7 @@ var initMoes = function() {
                                     targetUrl = redir.replace('[data]', data);
                                 }
                             }
-                            refreshDynamicStagPopup(targetUrl);
+                            refreshDynamicStagPopup(targetUrl, target);
                         } else if (redir) {
                             if (redir == "back") {
                                 window.top.history.back();

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików