|
@@ -371,6 +371,15 @@ class Pro extends Model
|
|
|
return $favorites;
|
|
|
}
|
|
|
|
|
|
+ function get_patients_count_as_admin() {
|
|
|
+ $query = Client::whereNull('shadow_pro_id');
|
|
|
+ return $query->where('is_active', true)
|
|
|
+ ->where(function ($q) {
|
|
|
+ $q->whereNull('client_engagement_status_category')
|
|
|
+ ->orWhere('client_engagement_status_category', '<>', 'DUMMY');
|
|
|
+ })->count();
|
|
|
+ }
|
|
|
+
|
|
|
function get_patients_count_as_mcp() {
|
|
|
$query = Client::whereNull('shadow_pro_id');
|
|
|
return $query->where('mcp_pro_id', $this->id)
|
|
@@ -387,6 +396,12 @@ class Pro extends Model
|
|
|
->count();
|
|
|
}
|
|
|
|
|
|
+ function get_new_patients_awaiting_visit_count_as_admin() {
|
|
|
+ $query = Client::whereNull('shadow_pro_id');
|
|
|
+ return $query->where('has_mcp_done_onboarding_visit', '!=', 'YES')
|
|
|
+ ->count();
|
|
|
+ }
|
|
|
+
|
|
|
function get_notes_pending_signature_count_as_mcp() {
|
|
|
return Note::where('hcp_pro_id', $this->id)
|
|
|
->where('is_cancelled', '<>', true)
|
|
@@ -395,6 +410,13 @@ class Pro extends Model
|
|
|
->count();
|
|
|
}
|
|
|
|
|
|
+ function get_notes_pending_signature_count_as_admin() {
|
|
|
+ return Note::where('is_cancelled', '<>', true)
|
|
|
+ ->where('is_core_note', '<>', true)
|
|
|
+ ->where('is_signed_by_hcp', '<>', true)
|
|
|
+ ->count();
|
|
|
+ }
|
|
|
+
|
|
|
function get_notes_pending_summary_suggestion_as_mcp_query(){
|
|
|
$segmentsWithProposedSummarySuggestion = Segment::whereHas('proposedSegmentSummarySuggestion', function($sugQuery){
|
|
|
return $sugQuery->where('status', '=', 'PENDING');
|
|
@@ -493,6 +515,12 @@ class Pro extends Model
|
|
|
->count();
|
|
|
}
|
|
|
|
|
|
+ function get_notes_pending_billing_count_as_admin() {
|
|
|
+ return Note::where('is_cancelled', '<>', true)
|
|
|
+ ->where('is_signed_by_hcp', true)
|
|
|
+ ->where('is_billing_marked_done', '<>', true)
|
|
|
+ ->count();
|
|
|
+ }
|
|
|
|
|
|
function get_measurements_awaiting_review_count_as_mcp() {
|
|
|
$result = DB::select(DB::raw("
|
|
@@ -529,6 +557,12 @@ WHERE mcp_pro_id = :pro_id
|
|
|
->count();
|
|
|
}
|
|
|
|
|
|
+ function get_incoming_reports_pending_signature_count_as_admin() {
|
|
|
+ return IncomingReport::where('has_hcp_pro_signed', '<>', true)
|
|
|
+ ->where('is_entry_error', '<>', true)
|
|
|
+ ->count();
|
|
|
+ }
|
|
|
+
|
|
|
function get_patients_without_appointment_query() {
|
|
|
return Client::where('mcp_pro_id', $this->id)
|
|
|
->whereNull('today_mcp_appointment_date')
|
|
@@ -551,6 +585,15 @@ WHERE mcp_pro_id = :pro_id
|
|
|
return $this->get_patients_without_appointment_query()->count();
|
|
|
}
|
|
|
|
|
|
+ function get_patients_without_appointment_count_as_admin() {
|
|
|
+ return Client::whereNull('shadow_pro_id')
|
|
|
+ ->whereNull('today_mcp_appointment_date')
|
|
|
+ ->where(function($q){
|
|
|
+ $q->whereNull('next_mcp_appointment_id')
|
|
|
+ ->orWhere('next_mcp_appointment_date', '<=', DB::raw('NOW()::DATE'));
|
|
|
+ })->count();
|
|
|
+ }
|
|
|
+
|
|
|
function get_patients_overdue_for_visit_query() {
|
|
|
return Client::where('mcp_pro_id', $this->id)
|
|
|
->where(function($q){
|