浏览代码

Client DB - disallow "Manage" if patient has 1 or more visit notes

Vijayakrishnan 3 年之前
父节点
当前提交
9384f91dd8

+ 7 - 0
app/Models/Client.php

@@ -837,4 +837,11 @@ ORDER BY m.ts DESC
     public function coreNote(){
         return $this->hasOne(Note::class, 'id', 'core_note_id');
     }
+
+    public function nonCoreVisitNotes() {
+        return $this->hasMany(Note::class, 'client_id', 'id')
+            ->where('id', '<>', $this->core_note_id)
+            ->whereNotNull('visit_template_id')
+            ->orderBy('created_at', 'desc');
+    }
 }

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

@@ -27,6 +27,9 @@
         <?php $vitalLabels = ['Ht. (in.)','Wt. (lbs.)','Temp. (F)','Pulse','Resp.','Pulse Ox.','SBP','DBP','Smoking Status', 'BMI']; ?>
         <?php $isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_create($patient->created_at))->invert === 1); ?>
 
+        <?php $nonCoreVisitNotes = $patient->nonCoreVisitNotes; ?>
+        <?php $disallowPointEdits = $nonCoreVisitNotes && count($nonCoreVisitNotes); ?>
+
 	    <div class="row client-single-dashboard">
             <div class="col-6">
 

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

@@ -2,12 +2,13 @@
 $allergies = \App\Models\Point::getPointsOfCategory($patient, "ALLERGY");
 ?>
 <div class="pt-2 mt-2">
-    <div class="d-flex align-items-center pb-2">
+    <div class="d-flex align-items-baseline pb-2">
         <h6 class="my-0 font-weight-bold text-secondary">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
         @if($patient->coreNote)
+            @if(!@$disallowPointEdits)
             <a native target="_blank"
                class="c-pointer d-inline-flex align-items-center ml-3 text-decoration-none"
                open-in-stag-popup
@@ -19,6 +20,9 @@ $allergies = \App\Models\Point::getPointsOfCategory($patient, "ALLERGY");
                 <i class="fa fa-bolt mr-1"></i>
                 <span>Manage</span>
             </a>
+            @else
+                <span class="text-secondary text-sm ml-3">Editable from within notes.</span>
+            @endif
         @endif
     </div>
     <div class="bg-light border p-2 mb-3 point-content">

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

@@ -8,6 +8,7 @@ $careTeamMembers = \App\Models\Point::getPointsOfCategory($patient, "CARE_TEAM_M
             <div class="px-2 font-weight-bold alert alert-info text-sm my-0 ml-2 py-1">New</div>
         @endif
         @if($patient->coreNote)
+            @if(!@$disallowPointEdits)
             <a native target="_blank"
                class="c-pointer d-inline-flex align-items-center ml-3 text-decoration-none"
                open-in-stag-popup
@@ -19,6 +20,9 @@ $careTeamMembers = \App\Models\Point::getPointsOfCategory($patient, "CARE_TEAM_M
                 <i class="fa fa-bolt mr-1"></i>
                 <span>Manage</span>
             </a>
+            @else
+                <span class="text-secondary text-sm ml-3">Editable from within notes.</span>
+            @endif
         @endif
     </div>
     <div class="bg-light border p-2 mb-3 point-content">

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

@@ -8,6 +8,7 @@ $problems = \App\Models\Point::getPointsOfCategory($patient, "PROBLEM");
             <div class="px-2 font-weight-bold alert alert-info text-sm my-0 ml-2 py-1">New</div>
         @endif
         @if($patient->coreNote)
+            @if(!@$disallowPointEdits)
             <a native target="_blank"
                class="c-pointer d-inline-flex align-items-center ml-3 text-decoration-none"
                open-in-stag-popup
@@ -19,6 +20,9 @@ $problems = \App\Models\Point::getPointsOfCategory($patient, "PROBLEM");
                 <i class="fa fa-bolt mr-1"></i>
                 <span>Manage</span>
             </a>
+            @else
+                <span class="text-secondary text-sm ml-3">Editable from within notes.</span>
+            @endif
         @endif
     </div>
     <div class="bg-light border p-2 mb-3 point-content">

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

@@ -8,6 +8,7 @@ $medications = \App\Models\Point::getPointsOfCategory($patient, "MEDICATION");
             <div class="px-2 font-weight-bold alert alert-info text-sm my-0 ml-2 py-1">New</div>
         @endif
         @if($patient->coreNote)
+            @if(!@$disallowPointEdits)
             <a native target="_blank"
                class="c-pointer d-inline-flex align-items-center ml-3 text-decoration-none"
                open-in-stag-popup
@@ -19,6 +20,9 @@ $medications = \App\Models\Point::getPointsOfCategory($patient, "MEDICATION");
                 <i class="fa fa-bolt mr-1"></i>
                 <span>Manage</span>
             </a>
+            @else
+                <span class="text-secondary text-sm ml-3">Editable from within notes.</span>
+            @endif
         @endif
     </div>
     <div class="bg-light border p-2 mb-3 point-content">