Эх сурвалжийг харах

Programs context entity change updates

Vijayakrishnan 4 жил өмнө
parent
commit
834fcae085

+ 1 - 2
app/Http/Controllers/PatientController.php

@@ -28,14 +28,13 @@ class PatientController extends Controller
             $matching = ClientBDTDevice::where('device_id', $record->id)->get();
             return count($matching) === 0;
         });
-        $programs = Program::where('is_active', true)->orderBy('title', 'asc')->get();
         $dxInfoLines = ClientInfoLine::where('client_id', $patient->id)
             ->where('category', 'dx')
             ->where('is_removed', false)
             ->orderBy('content_text', 'asc')
             ->get();
         return view('app.patient.dashboard',
-            compact('patient', 'facilities', 'devices', 'dxInfoLines', 'programs'));
+            compact('patient', 'facilities', 'devices', 'dxInfoLines'));
     }
 
     public function actionItems(Request $request, Client $patient )

+ 0 - 3
app/Models/ClientProgram.php

@@ -16,7 +16,4 @@ class ClientProgram extends Model
         return $this->hasOne(Pro::class, 'id', 'manager_pro_id');
     }
 
-    public function program() {
-        return $this->hasOne(Program::class, 'id', 'program_id');
-    }
 }

+ 1 - 2
app/Models/Pro.php

@@ -336,8 +336,7 @@ class Pro extends Model
 
         if(count($clientPrograms)) {
             foreach ($clientPrograms as $clientProgram) {
-                $program = $clientProgram->program;
-                if(strpos(strtolower($program->measurements), '|' . strtolower($measurement->label) . '|') !== FALSE) {
+                if(strpos(strtolower($clientProgram->measurement_labels), '|' . strtolower($measurement->label) . '|') !== FALSE) {
                     $allowed = true;
                     break;
                 }

+ 0 - 11
app/Models/Program.php

@@ -1,11 +0,0 @@
-<?php
-
-namespace App\Models;
-
-# use Illuminate\Database\Eloquent\Model;
-
-class Program extends Model
-{
-    protected $table = "program";
-
-}

+ 21 - 4
resources/views/app/patient/partials/device-measurements.blade.php

@@ -9,7 +9,23 @@
     </div>
     <table class="table table-sm border-0 my-0 mx-2">
         <tbody>
-        @foreach($patient->deviceMeasurements as $measurement)
+        <?php
+        $validCount = 0;
+        foreach($patient->deviceMeasurements as $measurement) {
+            $displayMeasurement = true;
+            if($measurement->measurement->device_category === 'WEIGHT') {
+                if(round(($measurement->measurement->value_weight / 1000)*2.20462, 1) <= 0) {
+                    $displayMeasurement = false;
+                }
+            }
+            else if($measurement->measurement->device_category === 'BP') {
+                if(floatval($measurement->measurement->systolic_bp_in_mm_hg) <= 0 || floatval($measurement->measurement->diastolic_bp_in_mm_hg) <= 0) {
+                    $displayMeasurement = false;
+                }
+            }
+            if($displayMeasurement) {
+                $validCount++;
+            ?>
             <tr>
                 <td class="text-black p-0 border-0">
                     <div class="pb-1 d-flex align-items-center">
@@ -47,14 +63,15 @@
                     </div>
                 </td>
             </tr>
-        @endforeach
-        @if(!$patient->deviceMeasurements || count($patient->deviceMeasurements) === 0)
+        <?php }
+        }
+        if(!$validCount) { ?>
             <tr>
                 <td class="text-secondary p-0 border-0">
                     No measurements
                 </td>
             </tr>
-        @endif
+        <?php } ?>
         </tbody>
     </table>
 </div>

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

@@ -86,7 +86,7 @@
                                                 <select autofocus class="form-control form-control-sm" name="clientProgramUid" required>
                                                     <option value="">-- select --</option>
                                                     @foreach($matchingClientPrograms as $clientProgram)
-                                                        <option value="{{$clientProgram->uid}}">{{$clientProgram->program->title}}</option>
+                                                        <option value="{{$clientProgram->uid}}">{{$clientProgram->title}}</option>
                                                     @endforeach
                                                 </select>
                                             </div>

+ 3 - 3
resources/views/app/patient/partials/programs.blade.php

@@ -1,7 +1,7 @@
 <div class="mt-0 pb-1">
     <div class="d-flex align-items-center mb-1 pt-2 pb-1 border-top">
         <h6 class="my-0 font-weight-bold text-secondary">Programs</h6>
-        <span class="mx-2 text-secondary on-hover-opaque">|</span>
+        {{--<span class="mx-2 text-secondary on-hover-opaque">|</span>
         <div moe>
             <a start show class="py-0 font-weight-normal">Add</a>
             <form url="/api/clientProgram/create">
@@ -19,13 +19,13 @@
                     <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
                 </div>
             </form>
-        </div>
+        </div>--}}
     </div>
     <table class="table table-bordered table-sm table-striped m-0">
         <tbody>
         <?php $programNumber = 1; ?>
         @foreach($patient->clientPrograms as $clientProgram)
-            <?php $program = $clientProgram->program; ?>
+            <?php $program = $clientProgram; ?>
             <tr>
                 <td class="text-black p-2">
                     <div class="d-flex align-items-center">

+ 2 - 2
resources/views/app/patients.blade.php

@@ -76,11 +76,11 @@
                                     if($pro->pro_type === 'ADMIN' ||
                                         in_array($pro->id, [$clientProgram->mcp_pro_id, $clientProgram->manager_pro_id])
                                     ) {
-                                        $program = $clientProgram->program;
+                                        // $program = $clientProgram->program;
                                         $programNumber++;
                                 ?>
                                 <div class="mb-1 text-nowrap">
-                                    {{ $programNumber }}. {{ $program->title }}
+                                    {{ $programNumber }}. {{ $clientProgram->title }}
                                     @if($clientProgram->has_mcp_done_onboarding_visit !== 'YES')
                                         <span title="Onboarding Pending" class="ml-1"><i class="fa fa-exclamation-triangle"></i></span>
                                     @else