|
@@ -6,6 +6,7 @@ use App\Models\AppSession;
|
|
use App\Models\BillingReport;
|
|
use App\Models\BillingReport;
|
|
use App\Models\CareMonth;
|
|
use App\Models\CareMonth;
|
|
use App\Models\ClaimEDI;
|
|
use App\Models\ClaimEDI;
|
|
|
|
+use App\Models\Company;
|
|
use App\Models\Handout;
|
|
use App\Models\Handout;
|
|
use App\Models\MBClaim;
|
|
use App\Models\MBClaim;
|
|
use App\Models\Measurement;
|
|
use App\Models\Measurement;
|
|
@@ -79,8 +80,46 @@ class PracticeManagementController extends Controller
|
|
|
|
|
|
public function financialTransactions(Request $request)
|
|
public function financialTransactions(Request $request)
|
|
{
|
|
{
|
|
- $transactions = ProTransaction::where('pro_id', $this->performer()->pro->id)->orderBy('created_at', 'desc')->get();
|
|
|
|
- return view('app.practice-management.financial-transactions', compact('transactions'));
|
|
|
|
|
|
+ $pro = $this->performer()->pro;
|
|
|
|
+ $transactions = null;
|
|
|
|
+ if($pro->pro_type === 'ADMIN') {
|
|
|
|
+ $transactions = ProTransaction::whereNotNull('id');
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ $transactions = ProTransaction::where('pro_id', $pro->id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $filter = $request->input('p');
|
|
|
|
+ if ($filter) {
|
|
|
|
+ $filterPro = Pro::where('uid', $filter)->first();
|
|
|
|
+ if($filterPro) {
|
|
|
|
+ $transactions = $transactions->where('pro_id', '=', $filterPro->id);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $filter = $request->input('t');
|
|
|
|
+ if ($filter) {
|
|
|
|
+ $transactions = $transactions->where('plus_or_minus', '=', $filter);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $filter = $request->input('c');
|
|
|
|
+ if ($filter) {
|
|
|
|
+ $transactions = $transactions->where('company_id', '=', $filter);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $filter = $request->input('bs');
|
|
|
|
+ if ($filter) {
|
|
|
|
+ $transactions = $transactions->where('created_at', '>=', $filter);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $filter = $request->input('be');
|
|
|
|
+ if ($filter) {
|
|
|
|
+ $transactions = $transactions->where('created_at', '<=', $filter);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $transactions = $transactions->orderBy('created_at', 'desc')->paginate();
|
|
|
|
+ $companies = Company::where('is_active', true)->orderBy('name')->get();
|
|
|
|
+ return view('app.practice-management.financial-transactions', compact('transactions', 'companies'));
|
|
}
|
|
}
|
|
|
|
|
|
public function pendingBillsToSign(Request $request)
|
|
public function pendingBillsToSign(Request $request)
|
|
@@ -198,6 +237,21 @@ class PracticeManagementController extends Controller
|
|
|
|
|
|
// more cases can be added as needed
|
|
// more cases can be added as needed
|
|
default:
|
|
default:
|
|
|
|
+ $query = $query
|
|
|
|
+ ->where(function ($q) use ($proID) {
|
|
|
|
+ $q->where(function ($q2) use ($proID) {
|
|
|
|
+ $q2->where('hcp_pro_id', $proID);
|
|
|
|
+ })
|
|
|
|
+ ->orWhere(function ($q2) use ($proID) {
|
|
|
|
+ $q2->where('cm_pro_id', $proID);
|
|
|
|
+ })
|
|
|
|
+ ->orWhere(function ($q2) use ($proID) {
|
|
|
|
+ $q2->where('rme_pro_id', $proID);
|
|
|
|
+ })
|
|
|
|
+ ->orWhere(function ($q2) use ($proID) {
|
|
|
|
+ $q2->where('rmm_pro_id', $proID);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
$bills = $query->orderBy('created_at', 'desc')->get();
|
|
$bills = $query->orderBy('created_at', 'desc')->get();
|
|
@@ -510,21 +564,19 @@ class PracticeManagementController extends Controller
|
|
$proUid = $proUid ? $proUid : $request->get('pro-uid');
|
|
$proUid = $proUid ? $proUid : $request->get('pro-uid');
|
|
$performerPro = $this->performer->pro;
|
|
$performerPro = $this->performer->pro;
|
|
$targetPro = null;
|
|
$targetPro = null;
|
|
- $allPros = [];
|
|
|
|
$expectedForHcp = null;
|
|
$expectedForHcp = null;
|
|
if ($performerPro->pro_type == 'ADMIN') {
|
|
if ($performerPro->pro_type == 'ADMIN') {
|
|
- $allPros = Pro::all();
|
|
|
|
$targetPro = Pro::where('uid', $proUid)->first();
|
|
$targetPro = Pro::where('uid', $proUid)->first();
|
|
} else {
|
|
} else {
|
|
$targetPro = $performerPro;
|
|
$targetPro = $performerPro;
|
|
}
|
|
}
|
|
$clients = [];
|
|
$clients = [];
|
|
if ($targetPro) {
|
|
if ($targetPro) {
|
|
- $clients = Client::where('mcp_pro_id', $targetPro->id)->orderBy('created_at', 'desc')->paginate(100);
|
|
|
|
|
|
+ $clients = Client::where('mcp_pro_id', $targetPro->id)->orderBy('created_at', 'desc')->paginate(20);
|
|
} else {
|
|
} else {
|
|
- $clients = Client::orderBy('created_at', 'desc')->paginate(100);
|
|
|
|
|
|
+ $clients = Client::orderBy('created_at', 'desc')->paginate(20);
|
|
}
|
|
}
|
|
- return view('app.practice-management.cellular-device-manager', compact('clients', 'allPros', 'targetPro', 'proUid'));
|
|
|
|
|
|
+ return view('app.practice-management.cellular-device-manager', compact('clients', 'targetPro', 'proUid'));
|
|
}
|
|
}
|
|
|
|
|
|
public function treatmentServiceUtil(Request $request)
|
|
public function treatmentServiceUtil(Request $request)
|
|
@@ -558,6 +610,9 @@ class PracticeManagementController extends Controller
|
|
if ($targetPro) {
|
|
if ($targetPro) {
|
|
$bills = $bills->where('hcp_pro_id', $targetPro->id);
|
|
$bills = $bills->where('hcp_pro_id', $targetPro->id);
|
|
}
|
|
}
|
|
|
|
+ if($request->input('c')) {
|
|
|
|
+ $bills = $bills->whereRaw('(SELECT company_id from company_pro where id = hcp_company_pro_id) = ' . $request->input('c'));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else if($request->input('t') === 'na') {
|
|
else if($request->input('t') === 'na') {
|
|
$bills = $bills
|
|
$bills = $bills
|
|
@@ -566,6 +621,9 @@ class PracticeManagementController extends Controller
|
|
if ($targetPro) {
|
|
if ($targetPro) {
|
|
$bills = $bills->where('generic_pro_id', $targetPro->id);
|
|
$bills = $bills->where('generic_pro_id', $targetPro->id);
|
|
}
|
|
}
|
|
|
|
+ if($request->input('c')) {
|
|
|
|
+ $bills = $bills->whereRaw('(SELECT company_id from company_pro where id = generic_company_pro_id) = ' . $request->input('c'));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
$filter = $request->input('f');
|
|
$filter = $request->input('f');
|
|
@@ -588,13 +646,24 @@ class PracticeManagementController extends Controller
|
|
$bills = $bills->where('balance_post_date', '<=', $filter);
|
|
$bills = $bills->where('balance_post_date', '<=', $filter);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ $filter = $request->input('s');
|
|
|
|
+ if ($filter) {
|
|
|
|
+ $bills = $bills->where('code', '=', $filter);
|
|
|
|
+ }
|
|
|
|
+
|
|
$bills = $bills->orderBy('effective_date', 'desc')->paginate();
|
|
$bills = $bills->orderBy('effective_date', 'desc')->paginate();
|
|
|
|
|
|
|
|
+ $companies = Company::where('is_active', true)->orderBy('name')->get();
|
|
|
|
+
|
|
|
|
+ $codes = DB::select(DB::raw("SELECT code, count(*) as count FROM bill WHERE is_cancelled IS FALSE GROUP BY code ORDER BY code"));
|
|
|
|
+
|
|
$viewData = [
|
|
$viewData = [
|
|
'bills' => $bills,
|
|
'bills' => $bills,
|
|
'targetPro' => $targetPro,
|
|
'targetPro' => $targetPro,
|
|
'performerPro' => $performerPro,
|
|
'performerPro' => $performerPro,
|
|
- 'proUid' => $proUid
|
|
|
|
|
|
+ 'proUid' => $proUid,
|
|
|
|
+ 'companies' => $companies,
|
|
|
|
+ 'codes' => $codes
|
|
];
|
|
];
|
|
return view('app.practice-management.processing-bill-matrix', $viewData);
|
|
return view('app.practice-management.processing-bill-matrix', $viewData);
|
|
}
|
|
}
|
|
@@ -1284,6 +1353,7 @@ SELECT claim.uid AS uid,
|
|
note.uid AS note_uid,
|
|
note.uid AS note_uid,
|
|
note.method,
|
|
note.method,
|
|
note.new_or_fu_or_na,
|
|
note.new_or_fu_or_na,
|
|
|
|
+ care_month.uid AS care_month_uid,
|
|
-- claim.status_updated_at,
|
|
-- claim.status_updated_at,
|
|
(DATE(claim.status_updated_at) || ' ' ||
|
|
(DATE(claim.status_updated_at) || ' ' ||
|
|
LPAD(EXTRACT(hour FROM claim.status_updated_at)::text, 2, '0') || ':' ||
|
|
LPAD(EXTRACT(hour FROM claim.status_updated_at)::text, 2, '0') || ':' ||
|
|
@@ -1295,6 +1365,7 @@ FROM claim
|
|
join client on claim.client_id = client.id
|
|
join client on claim.client_id = client.id
|
|
join pro cp on claim.pro_id = cp.id
|
|
join pro cp on claim.pro_id = cp.id
|
|
left join note on claim.note_id = note.id
|
|
left join note on claim.note_id = note.id
|
|
|
|
+ left join care_month on claim.cm_id = care_month.id
|
|
left join app_session on claim.status_updated_by_session_id = app_session.id
|
|
left join app_session on claim.status_updated_by_session_id = app_session.id
|
|
left join pro sp on app_session.pro_id = sp.id
|
|
left join pro sp on app_session.pro_id = sp.id
|
|
--WHERE claim.status IS NULL OR claim.status = 'NEW'
|
|
--WHERE claim.status IS NULL OR claim.status = 'NEW'
|
|
@@ -1318,6 +1389,57 @@ ORDER BY claim.created_at ASC
|
|
return view('app.practice-management.process-claims', compact('claims', 'status'));
|
|
return view('app.practice-management.process-claims', compact('claims', 'status'));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public function rmLaunchAndClean(Request $request) {
|
|
|
|
+
|
|
|
|
+ $keyNumbers = [];
|
|
|
|
+
|
|
|
|
+ $keyNumbers['careMonthsEligibleForBillGeneration_RM30_HCP_PLUS_NONHCP40'] = CareMonth::where('is_bill_closed', false)
|
|
|
|
+ ->whereNotNull('company_pro_id')
|
|
|
|
+ ->whereNotNull('company_pro_payer_id')
|
|
|
|
+ ->whereNotNull('company_location_id')
|
|
|
|
+ ->whereRaw('(SELECT count(id) FROM care_month_cm_rm_reason WHERE care_month_id = care_month.id) > 0')
|
|
|
|
+ ->where('rm_total_time_in_seconds_by_mcp', '>=', 1800)
|
|
|
|
+ ->where('rm_total_time_in_seconds', '>=', 4200) // at 4200 (70 minutes, it becomes eligible for plus40)
|
|
|
|
+ ->count();
|
|
|
|
+
|
|
|
|
+ $keyNumbers['careMonthsEligibleForBillGeneration_RM30_HCP_PLUS_NONHCP20'] = CareMonth::where('is_bill_closed', false)
|
|
|
|
+ ->whereNotNull('company_pro_id')
|
|
|
|
+ ->whereNotNull('company_pro_payer_id')
|
|
|
|
+ ->whereNotNull('company_location_id')
|
|
|
|
+ ->whereRaw('(SELECT count(id) FROM care_month_cm_rm_reason WHERE care_month_id = care_month.id) > 0')
|
|
|
|
+ ->where('rm_total_time_in_seconds_by_mcp', '>=', 1800)
|
|
|
|
+ ->where('rm_total_time_in_seconds', '<', 4200)
|
|
|
|
+ ->where('rm_total_time_in_seconds', '>=', 3000) // at 3000 (50 minutes, it becomes eligible for plus20)
|
|
|
|
+ ->count();
|
|
|
|
+
|
|
|
|
+ $keyNumbers['careMonthsEligibleForBillGeneration_RM30_HCP'] = CareMonth::where('is_bill_closed', false)
|
|
|
|
+ ->whereNotNull('company_pro_id')
|
|
|
|
+ ->whereNotNull('company_pro_payer_id')
|
|
|
|
+ ->whereNotNull('company_location_id')
|
|
|
|
+ ->whereRaw('(SELECT count(id) FROM care_month_cm_rm_reason WHERE care_month_id = care_month.id) > 0')
|
|
|
|
+ ->where('rm_total_time_in_seconds_by_mcp', '>=', 1800)
|
|
|
|
+ ->where('rm_total_time_in_seconds', '<', 3000)
|
|
|
|
+ ->count();
|
|
|
|
+
|
|
|
|
+ $keyNumbers['careMonthsWithoutCompanyProInfo'] = CareMonth::where('is_bill_closed', false)
|
|
|
|
+ ->where(function ($q) {
|
|
|
|
+ $q->whereNull('company_pro_id')
|
|
|
|
+ ->orWhereNull('company_pro_payer_id')
|
|
|
|
+ ->orWhereNull('company_location_id');
|
|
|
|
+ })
|
|
|
|
+ ->count();
|
|
|
|
+
|
|
|
|
+ /*$keyNumbers['careMonthsWithoutRMReasons'] = CareMonth::where('is_bill_closed', false)
|
|
|
|
+ ->whereRaw('(SELECT count(id) FROM care_month_cm_rm_reason WHERE care_month_id = care_month.id) = 0')
|
|
|
|
+ ->count();*/
|
|
|
|
+
|
|
|
|
+ $keyNumbers['careMonthsUnder30RMMinutes'] = CareMonth::where('is_bill_closed', false)
|
|
|
|
+ ->where('rm_total_time_in_seconds', '<', 1800)
|
|
|
|
+ ->count();
|
|
|
|
+
|
|
|
|
+ return view('app.practice-management.rm-launch-and-clean', compact('keyNumbers'));
|
|
|
|
+ }
|
|
|
|
+
|
|
public function processNotes(Request $request) {
|
|
public function processNotes(Request $request) {
|
|
|
|
|
|
$mode = $request->input('mode') ? $request->input('mode') : '1';
|
|
$mode = $request->input('mode') ? $request->input('mode') : '1';
|