Przeglądaj źródła

added more columns to patients table

= 3 lat temu
rodzic
commit
c70d954841

+ 26 - 0
app/Models/Client.php

@@ -936,5 +936,31 @@ ORDER BY m.ts DESC
         return $this->hasOne(Status::class, 'id', 'client_engagement_status_id');
     }
 
+    public function getDeviceDeliveryStatus($productId){
+        $result =  DB::select("SELECT sh.status FROM shipment sh LEFT JOIN supply_order so ON so.shipment_id = sh.id WHERE so.product_id  = ".$productId." AND so.client_id = ".$this->id." ORDER BY sh.created_at DESC LIMIT 1");
+        if (count($result)){
+            return $result[0]->status; 
+        }
+        return '';
+    }
+
+    // 4 Infra-red Temperature gun 
+    public function temparatureGunDeliveryStatus(){
+       return $this->getDeviceDeliveryStatus(4);
+    }
+
+    // 3 Pulse Oximeter (
+    public function pulseOximeterDeliveryStatus(){
+        return $this->getDeviceDeliveryStatus(3);
+    }
+    // 1 Cellular BP - Standard Arm Cuff (if delivered, then it should show its status as Delivered, Dispatched, In-transit, Returned)
+    public function cellularBPDeliveryStatus(){
+        return $this->getDeviceDeliveryStatus(1);
+    }
+    // 2 Weight scale 
+    public function weightScaleDeliveryStatus(){
+        return $this->getDeviceDeliveryStatus(2);
+    }
+
 
 }

+ 8 - 0
resources/views/app/admin/patients-table-extended.blade.php

@@ -43,6 +43,10 @@
             <th class="border-0">Assigned On</th>
             
 	        <th class="border-0">Email Address</th>
+            <th class="border-0">Temparature Gun Delivery Status</th>
+            <th class="border-0">Pulse Oximeter Delivery Status</th>
+            <th class="border-0">Cellular Bp Delivery Status</th>
+            <th class="border-0">Weight Scale Delivery Status</th>
         </tr>
         </thead>
         <tbody>
@@ -322,6 +326,10 @@
                 <td>{{count($patient->cellularMeasurements)}}</td>
                 <td>{{$patient->getMcpAssignedOn()}}</td>
                 <td>{{$patient->email_address}}</td>
+                <td>{{$patient->temparatureGunDeliveryStatus()}}</td>
+                <td>{{$patient->pulseOximeterDeliveryStatus()}}</td>
+                <td>{{$patient->hasBPDevice()?'DELIVERED':''}}</td>
+                <td>{{$patient->hasWeightScaleDevice()?'DELIVERED':''}}</td>
             </tr>
         @endforeach