Jelajahi Sumber

fixed dna report

Josh 3 tahun lalu
induk
melakukan
3f434ae5b3
1 mengubah file dengan 4 tambahan dan 0 penghapusan
  1. 4 0
      app/Models/Pro.php

+ 4 - 0
app/Models/Pro.php

@@ -465,10 +465,14 @@ WHERE mcp_pro_id = :pro_id
         return $this->get_patients_overdue_for_visit_for_dna_query()->count();
     }
 
+    
+
     function get_patients_without_remote_measurement_in_48_hours_count_as_mcp() {
+        return DB::select("SELECT COUNT(*) as count FROM client WHERE ((most_recent_cellular_measurement_at+ interval '48 hour')::timestamp < NOW() OR most_recent_cellular_measurement_id IS NULL) AND client.mcp_pro_id = :mcp_pro_id AND is_active IS TRUE", ['mcp_pro_id'=>$this->id])[0]->count; 
     }
 
     function get_patients_without_remote_measurement_in_48_hours_count_as_dna() {
+        return DB::select("SELECT COUNT(*) as count FROM client WHERE ((most_recent_cellular_measurement_at+ interval '48 hour')::timestamp < NOW() OR most_recent_cellular_measurement_id IS NULL) AND client.default_na_pro_id = :default_na_pro_id AND is_active IS TRUE", ['default_na_pro_id'=>$this->id])[0]->count; 
     }
 
     function get_cancelled_appointments_pending_acknowledgement_count_as_mcp_query() {