Browse Source

fixed core note related queries

Josh 3 years ago
parent
commit
9493f2d8d1

+ 14 - 14
app/Http/Controllers/HomeController.php

@@ -216,10 +216,10 @@ class HomeController extends Controller
 
         $pendingNotesToSign = Note
             ::where(function ($query) use ($performerProID) {
-                $query->where('hcp_pro_id', $performerProID)->where('is_signed_by_hcp', false)->where('is_cancelled', false);
+                $query->where('hcp_pro_id', $performerProID)->where('is_signed_by_hcp', false)->where('is_cancelled', false)->where('is_core_note', false);
             })
             ->orWhere(function ($query) use ($performerProID) {
-                $query->where('ally_pro_id', $performerProID)->where('is_signed_by_ally', false)->where('is_cancelled', false);
+                $query->where('ally_pro_id', $performerProID)->where('is_signed_by_ally', false)->where('is_cancelled', false)->where('is_core_note', false);
             })
             ->count();
         $keyNumbers['pendingNotesToSign'] = $pendingNotesToSign;
@@ -227,13 +227,13 @@ class HomeController extends Controller
         // notes pending mcp sign (applicable to dnas only)
         $pendingNotesToSignMCP = Note
             ::where(function ($query) use ($performerProID) {
-                $query->where('ally_pro_id', $performerProID)->where('is_signed_by_hcp', false)->where('is_cancelled', false);
+                $query->where('ally_pro_id', $performerProID)->where('is_signed_by_hcp', false)->where('is_cancelled', false)->where('is_core_note', false);
             })
             ->count();
         $keyNumbers['$pendingNotesToSignMCP'] = $pendingNotesToSignMCP;
 
         $pendingNotesToSignAllySigned = Note::where(function ($query) use ($performerProID) {
-            $query->where('hcp_pro_id', $performerProID)->where('is_signed_by_hcp', false)->where('is_signed_by_ally', true)->where('is_cancelled', false);;
+            $query->where('hcp_pro_id', $performerProID)->where('is_signed_by_hcp', false)->where('is_signed_by_ally', true)->where('is_cancelled', false)->where('is_core_note', false);;
         })->count();
         $keyNumbers['pendingNotesToSignAllySigned'] = $pendingNotesToSignAllySigned;
 
@@ -568,15 +568,15 @@ WHERE cl.shadow_pro_id IS NULL
 
         $queryClients = $this->performer()->pro->getAccessibleClientsQuery();
 
-        $pendingNotesToSign = Note::where('ally_pro_id', $performerProID)->where('is_signed_by_ally', false)->where('is_cancelled', false)->count();
+        $pendingNotesToSign = Note::where('ally_pro_id', $performerProID)->where('is_signed_by_ally', false)->where('is_cancelled', false)->where('is_core_note', false)->count();
         $keyNumbers['pendingNotesToSign'] = $pendingNotesToSign;
 
         // notes pending mcp sign (applicable to dnas only)
-        $pendingNotesToSignMCP = Note::where('ally_pro_id', $performerProID)->where('is_signed_by_hcp', false)->where('is_cancelled', false)->count();
+        $pendingNotesToSignMCP = Note::where('ally_pro_id', $performerProID)->where('is_signed_by_hcp', false)->where('is_cancelled', false)->where('is_core_note', false)->count();
         $keyNumbers['$pendingNotesToSignMCP'] = $pendingNotesToSignMCP;
 
         $pendingNotesToSignAllySigned = Note::where(function ($query) use ($performerProID) {
-            $query->where('hcp_pro_id', $performerProID)->where('is_signed_by_hcp', false)->where('is_signed_by_ally', true)->where('is_cancelled', false);;
+            $query->where('hcp_pro_id', $performerProID)->where('is_signed_by_hcp', false)->where('is_signed_by_ally', true)->where('is_cancelled', false)->where('is_core_note', false);
         })->count();
         $keyNumbers['pendingNotesToSignAllySigned'] = $pendingNotesToSignAllySigned;
 
@@ -895,10 +895,10 @@ WHERE cl.shadow_pro_id IS NULL
 
         $pendingNotesToSign = Note
             ::where(function ($query) use ($performerProID) {
-                $query->where('hcp_pro_id', $performerProID)->where('is_signed_by_hcp', false)->where('is_cancelled', false);
+                $query->where('hcp_pro_id', $performerProID)->where('is_signed_by_hcp', false)->where('is_cancelled', false)->where('is_core_note', false);
             })
             ->orWhere(function ($query) use ($performerProID) {
-                $query->where('ally_pro_id', $performerProID)->where('is_signed_by_ally', false)->where('is_cancelled', false);
+                $query->where('ally_pro_id', $performerProID)->where('is_signed_by_ally', false)->where('is_cancelled', false)->where('is_core_note', false);
             })
             ->count();
         $keyNumbers['pendingNotesToSign'] = $pendingNotesToSign;
@@ -906,13 +906,13 @@ WHERE cl.shadow_pro_id IS NULL
         // notes pending mcp sign (applicable to dnas only)
         $pendingNotesToSignMCP = Note
             ::where(function ($query) use ($performerProID) {
-                $query->where('ally_pro_id', $performerProID)->where('is_signed_by_hcp', false)->where('is_cancelled', false);
+                $query->where('ally_pro_id', $performerProID)->where('is_signed_by_hcp', false)->where('is_cancelled', false)->where('is_core_note', false);
             })
             ->count();
         $keyNumbers['$pendingNotesToSignMCP'] = $pendingNotesToSignMCP;
 
         $pendingNotesToSignAllySigned = Note::where(function ($query) use ($performerProID) {
-            $query->where('hcp_pro_id', $performerProID)->where('is_signed_by_hcp', false)->where('is_signed_by_ally', true)->where('is_cancelled', false);;
+            $query->where('hcp_pro_id', $performerProID)->where('is_signed_by_hcp', false)->where('is_signed_by_ally', true)->where('is_cancelled', false)->where('is_core_note', false);;
         })->count();
         $keyNumbers['pendingNotesToSignAllySigned'] = $pendingNotesToSignAllySigned;
 
@@ -1243,7 +1243,7 @@ WHERE cl.shadow_pro_id IS NULL
     {
         $performer = $this->performer();
         $pro = $performer->pro;
-        
+
         if($pro->is_enrolled_as_mcp){
             return $this->dashboard_MCP($request);
         }elseif($pro->pro_type === 'ADMIN'){
@@ -1607,9 +1607,9 @@ WHERE measurement.label NOT IN ('SBP', 'DBP')
         $whereCondition = implode(" AND ", $whereCondition);
 
         $matches = DB::select(
-            "SELECT (name || ' ' || address_city || ' ' || address_state || ' ' || address_zip) as text, 
+            "SELECT (name || ' ' || address_city || ' ' || address_state || ' ' || address_zip) as text,
        address_line1 as text2,
-       name, address_city as city, address_state as state, address_zip as zip, phone, fax FROM facility 
+       name, address_city as city, address_state as state, address_zip as zip, phone, fax FROM facility
        WHERE {$whereCondition} ORDER BY name", $whereParams);
         return json_encode([
             "success" => true,

+ 1 - 0
app/Http/Controllers/McpController.php

@@ -186,6 +186,7 @@ class McpController extends Controller
             'records' => Note::where('hcp_pro_id', $this->performer->pro->id)
                 ->where('is_cancelled', '<>', true)
                 ->where('is_signed_by_hcp', '<>', true)
+                ->where('is_core_note', false)
                 ->orderBy('created_at')
                 ->get()
         ];

+ 1 - 1
app/Models/Client.php

@@ -93,7 +93,7 @@ class Client extends Model
     public function notes()
     {
         return $this->hasMany(Note::class, 'client_id', 'id')
-            ->where('id', '<>', $this->core_note_id)
+           // ->where('is_core_note', false)
             ->orderBy('effective_dateest', 'desc');
     }
 

+ 1 - 0
app/Models/Pro.php

@@ -343,6 +343,7 @@ class Pro extends Model
     function get_notes_pending_signature_count_as_mcp() {
         return Note::where('hcp_pro_id', $this->id)
             ->where('is_cancelled', '<>', true)
+            ->where('is_core_note', '<>', true)
             ->where('is_signed_by_hcp', '<>', true)
             ->count();
     }

+ 0 - 2
resources/views/app/patient/notes.blade.php

@@ -11,8 +11,6 @@
 
                 <div moe>
                     <a start show class="py-0 mb-3">Add</a>
-
-
                     <form url="/api/note/createUsingTemplate"
                           redir="/patients/view/{{$patient->uid}}/notes/view/[data]"
                           class="mcp-theme-1">