|
@@ -50,6 +50,181 @@ use App\Models\VisitTemplateSegmentTemplate;
|
|
|
class PracticeManagementController extends Controller
|
|
|
{
|
|
|
|
|
|
+/**
|
|
|
+practice-managment.myTickets
|
|
|
+practice-management.myTextShortcuts
|
|
|
+practice-management.myFavorites
|
|
|
+practice-management.proAvailability
|
|
|
+practice-management.proCalendar
|
|
|
+practice-management.tickets
|
|
|
+practice-management.handouts
|
|
|
+ */
|
|
|
+
|
|
|
+
|
|
|
+public function myTickets(Request $request, $filter = 'open')
|
|
|
+{
|
|
|
+ $performer = $this->performer();
|
|
|
+ $myTickets = Ticket::where(function ($q) use ($performer) {
|
|
|
+ $q->where('assigned_pro_id', $performer->pro_id)
|
|
|
+ ->orWhere('manager_pro_id', $performer->pro_id)
|
|
|
+ ->orWhere('ordering_pro_id', $performer->pro_id)
|
|
|
+ ->orWhere('initiating_pro_id', $performer->pro_id);
|
|
|
+ });
|
|
|
+ if ($filter === 'open') {
|
|
|
+ $myTickets = $myTickets->where('is_open', true);
|
|
|
+ } else if ($filter === 'closed') {
|
|
|
+ $myTickets = $myTickets->where('is_open', false);
|
|
|
+ }
|
|
|
+ $myTickets = $myTickets->orderBy('created_at', 'desc')->get();
|
|
|
+ return view('app.practice-management.my-tickets', compact('myTickets', 'filter'));
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+public function myTextShortcuts(Request $request)
|
|
|
+{
|
|
|
+
|
|
|
+ $personalShortcuts = DB::table('pro_text_shortcut')
|
|
|
+ ->leftJoin('pro', 'pro_text_shortcut.pro_id', '=', 'pro.id')
|
|
|
+ ->select(
|
|
|
+ 'pro_text_shortcut.uid',
|
|
|
+ 'pro_text_shortcut.shortcut',
|
|
|
+ 'pro_text_shortcut.text',
|
|
|
+ 'pro.name_first',
|
|
|
+ 'pro.name_last'
|
|
|
+ )
|
|
|
+ ->where('pro_text_shortcut.is_removed', false);
|
|
|
+
|
|
|
+ if($this->performer()->pro->pro_type !== 'ADMIN') {
|
|
|
+ $personalShortcuts = $personalShortcuts->where('pro_id', $this->performer()->pro_id);
|
|
|
+ }
|
|
|
+
|
|
|
+ $personalShortcuts = $personalShortcuts
|
|
|
+ ->orderBy('pro.name_last')
|
|
|
+ ->orderBy('pro.name_first')
|
|
|
+ ->orderBy('pro_text_shortcut.shortcut')
|
|
|
+ ->get();
|
|
|
+
|
|
|
+ $globalTextShortcuts = DB::table('pro_text_shortcut')
|
|
|
+ ->select(
|
|
|
+ 'pro_text_shortcut.uid',
|
|
|
+ 'pro_text_shortcut.shortcut',
|
|
|
+ 'pro_text_shortcut.text'
|
|
|
+ )
|
|
|
+ ->whereNull('pro_id')
|
|
|
+ ->where('pro_text_shortcut.is_removed', false)
|
|
|
+ ->orderBy('pro_text_shortcut.shortcut')
|
|
|
+ ->get();
|
|
|
+
|
|
|
+ return view('app.practice-management.my-text-shortcuts', compact('personalShortcuts', 'globalTextShortcuts'));
|
|
|
+}
|
|
|
+
|
|
|
+public function myFavorites(Request $request, $filter = 'all')
|
|
|
+{
|
|
|
+ $performer = $this->performer();
|
|
|
+ $myFavorites = ProFavorite::where('pro_id', $performer->pro_id)->where('is_removed', false);
|
|
|
+ if ($filter !== 'all') {
|
|
|
+ $myFavorites = $myFavorites->where('category', $filter);
|
|
|
+ }
|
|
|
+ $myFavorites = $myFavorites
|
|
|
+ ->whereIn('category', ['allergy', 'medication', 'problem'])
|
|
|
+ ->orderBy('category', 'asc')
|
|
|
+ ->orderBy('position_index', 'asc')
|
|
|
+ ->get();
|
|
|
+ return view('app.practice-management.my-favorites', compact('myFavorites', 'filter'));
|
|
|
+}
|
|
|
+
|
|
|
+public function proAvailability(Request $request, $proUid = null)
|
|
|
+{
|
|
|
+ $performer = $this->performer();
|
|
|
+ $pro = $performer->pro;
|
|
|
+
|
|
|
+ if ($proUid) {
|
|
|
+ $pro = Pro::where('uid', $proUid)->first();
|
|
|
+ }
|
|
|
+
|
|
|
+ if ($request->get('pro_uid')) {
|
|
|
+ $proUid = $request->get('pro_uid');
|
|
|
+ $pro = Pro::where('uid', $proUid)->first();
|
|
|
+ }
|
|
|
+
|
|
|
+ $selectedProUid = $pro->uid;
|
|
|
+
|
|
|
+ $pros = $this->pros;
|
|
|
+
|
|
|
+ $generalAvailabilitiesList = ProGeneralAvailability::where('pro_id', $pro->id)->where('is_cancelled', false)->orderBy('created_at', 'asc')->get();
|
|
|
+ $generalAvailabilities = [
|
|
|
+ 'MONDAY' => [],
|
|
|
+ 'TUESDAY' => [],
|
|
|
+ 'WEDNESDAY' => [],
|
|
|
+ 'THURSDAY' => [],
|
|
|
+ 'FRIDAY' => [],
|
|
|
+ 'SATURDAY' => [],
|
|
|
+ 'SUNDAY' => [],
|
|
|
+ ];
|
|
|
+ foreach ($generalAvailabilitiesList as $ga) {
|
|
|
+ if ($ga->day_of_week == 'MONDAY') {
|
|
|
+ $generalAvailabilities['MONDAY'][] = $ga;
|
|
|
+ }
|
|
|
+ if ($ga->day_of_week == 'TUESDAY') {
|
|
|
+ $generalAvailabilities['TUESDAY'][] = $ga;
|
|
|
+ }
|
|
|
+ if ($ga->day_of_week == 'WEDNESDAY') {
|
|
|
+ $generalAvailabilities['WEDNESDAY'][] = $ga;
|
|
|
+ }
|
|
|
+ if ($ga->day_of_week == 'THURSDAY') {
|
|
|
+ $generalAvailabilities['THURSDAY'][] = $ga;
|
|
|
+ }
|
|
|
+ if ($ga->day_of_week == 'FRIDAY') {
|
|
|
+ $generalAvailabilities['FRIDAY'][] = $ga;
|
|
|
+ }
|
|
|
+ if ($ga->day_of_week == 'SATURDAY') {
|
|
|
+ $generalAvailabilities['SATURDAY'][] = $ga;
|
|
|
+ }
|
|
|
+ if ($ga->day_of_week == 'SUNDAY') {
|
|
|
+ $generalAvailabilities['SUNDAY'][] = $ga;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $specificAvailabilities = ProSpecificAvailability::where('pro_id', $pro->id)->where('is_cancelled', false)->orderBy('start_time')->get();
|
|
|
+ $specificUnavailabilities = ProSpecificUnavailability::where('pro_id', $pro->id)->where('is_cancelled', false)->orderBy('start_time', 'asc')->get();
|
|
|
+
|
|
|
+ //events for the calendar
|
|
|
+ $startDate = date('Y-m-d', strtotime("sunday -1 week"));
|
|
|
+ $endDateTime = new DateTime($startDate);
|
|
|
+ $endDateTime->modify('+6 day');
|
|
|
+ $endDate = $endDateTime->format("Y-m-d");
|
|
|
+
|
|
|
+ $eventsData = $pro->getAvailabilityEvents($startDate, $endDate);
|
|
|
+ $events = json_encode($eventsData);
|
|
|
+
|
|
|
+ return view(
|
|
|
+ 'app.practice-management.pro-availability',
|
|
|
+ compact(
|
|
|
+ 'pros',
|
|
|
+ 'generalAvailabilities',
|
|
|
+ 'specificAvailabilities',
|
|
|
+ 'specificUnavailabilities',
|
|
|
+ 'events',
|
|
|
+ 'selectedProUid'
|
|
|
+ )
|
|
|
+ );
|
|
|
+}
|
|
|
+
|
|
|
+public function tickets(Request $request, $proUid = null)
|
|
|
+{
|
|
|
+ $tickets = Ticket::orderBy('created_at', 'desc')->paginate();
|
|
|
+ return view('app.practice-management.tickets', compact('tickets'));
|
|
|
+}
|
|
|
+
|
|
|
+public function handouts(Request $request) {
|
|
|
+ $handouts = Handout::orderBy('display_name')->get();
|
|
|
+ return view('app.practice-management.handouts', compact('handouts'));
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+/**************************************************************************/
|
|
|
+
|
|
|
public function rpmMatrix(Request $request)
|
|
|
{
|
|
|
$proID = $this->performer()->pro->id;
|
|
@@ -123,10 +298,6 @@ class PracticeManagementController extends Controller
|
|
|
return view('app.practice-management.billing-report', compact('rows', 'claimStatuses'));
|
|
|
}
|
|
|
|
|
|
- public function dashboard(Request $request)
|
|
|
- {
|
|
|
- return view('app.practice-management.dashboard');
|
|
|
- }
|
|
|
|
|
|
public function rates(Request $request, $selectedProUid = 'all')
|
|
|
{
|
|
@@ -375,77 +546,10 @@ class PracticeManagementController extends Controller
|
|
|
return view('app.practice-management.unacknowledged-cancelled-bills', compact('bills'));
|
|
|
}
|
|
|
|
|
|
- public function myTickets(Request $request, $filter = 'open')
|
|
|
- {
|
|
|
- $performer = $this->performer();
|
|
|
- $myTickets = Ticket::where(function ($q) use ($performer) {
|
|
|
- $q->where('assigned_pro_id', $performer->pro_id)
|
|
|
- ->orWhere('manager_pro_id', $performer->pro_id)
|
|
|
- ->orWhere('ordering_pro_id', $performer->pro_id)
|
|
|
- ->orWhere('initiating_pro_id', $performer->pro_id);
|
|
|
- });
|
|
|
- if ($filter === 'open') {
|
|
|
- $myTickets = $myTickets->where('is_open', true);
|
|
|
- } else if ($filter === 'closed') {
|
|
|
- $myTickets = $myTickets->where('is_open', false);
|
|
|
- }
|
|
|
- $myTickets = $myTickets->orderBy('created_at', 'desc')->get();
|
|
|
- return view('app.practice-management.my-tickets', compact('myTickets', 'filter'));
|
|
|
- }
|
|
|
-
|
|
|
- public function myTextShortcuts(Request $request)
|
|
|
- {
|
|
|
-
|
|
|
- $personalShortcuts = DB::table('pro_text_shortcut')
|
|
|
- ->leftJoin('pro', 'pro_text_shortcut.pro_id', '=', 'pro.id')
|
|
|
- ->select(
|
|
|
- 'pro_text_shortcut.uid',
|
|
|
- 'pro_text_shortcut.shortcut',
|
|
|
- 'pro_text_shortcut.text',
|
|
|
- 'pro.name_first',
|
|
|
- 'pro.name_last'
|
|
|
- )
|
|
|
- ->where('pro_text_shortcut.is_removed', false);
|
|
|
+
|
|
|
|
|
|
- if($this->performer()->pro->pro_type !== 'ADMIN') {
|
|
|
- $personalShortcuts = $personalShortcuts->where('pro_id', $this->performer()->pro_id);
|
|
|
- }
|
|
|
-
|
|
|
- $personalShortcuts = $personalShortcuts
|
|
|
- ->orderBy('pro.name_last')
|
|
|
- ->orderBy('pro.name_first')
|
|
|
- ->orderBy('pro_text_shortcut.shortcut')
|
|
|
- ->get();
|
|
|
-
|
|
|
- $globalTextShortcuts = DB::table('pro_text_shortcut')
|
|
|
- ->select(
|
|
|
- 'pro_text_shortcut.uid',
|
|
|
- 'pro_text_shortcut.shortcut',
|
|
|
- 'pro_text_shortcut.text'
|
|
|
- )
|
|
|
- ->whereNull('pro_id')
|
|
|
- ->where('pro_text_shortcut.is_removed', false)
|
|
|
- ->orderBy('pro_text_shortcut.shortcut')
|
|
|
- ->get();
|
|
|
-
|
|
|
- return view('app.practice-management.my-text-shortcuts', compact('personalShortcuts', 'globalTextShortcuts'));
|
|
|
- }
|
|
|
-
|
|
|
- public function myFavorites(Request $request, $filter = 'all')
|
|
|
- {
|
|
|
- $performer = $this->performer();
|
|
|
- $myFavorites = ProFavorite::where('pro_id', $performer->pro_id)->where('is_removed', false);
|
|
|
- if ($filter !== 'all') {
|
|
|
- $myFavorites = $myFavorites->where('category', $filter);
|
|
|
- }
|
|
|
- $myFavorites = $myFavorites
|
|
|
- ->whereIn('category', ['allergy', 'medication', 'problem'])
|
|
|
- ->orderBy('category', 'asc')
|
|
|
- ->orderBy('position_index', 'asc')
|
|
|
- ->get();
|
|
|
- return view('app.practice-management.my-favorites', compact('myFavorites', 'filter'));
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
public function patientsWithoutCoverage(Request $request, $filter = 'all')
|
|
|
{
|
|
|
$performer = $this->performer();
|
|
@@ -485,82 +589,7 @@ class PracticeManagementController extends Controller
|
|
|
return view('app.practice-management.patients-without-coverage', compact('pendingCoverage', 'filter'));
|
|
|
}
|
|
|
|
|
|
- public function proAvailability(Request $request, $proUid = null)
|
|
|
- {
|
|
|
- $performer = $this->performer();
|
|
|
- $pro = $performer->pro;
|
|
|
-
|
|
|
- if ($proUid) {
|
|
|
- $pro = Pro::where('uid', $proUid)->first();
|
|
|
- }
|
|
|
-
|
|
|
- if ($request->get('pro_uid')) {
|
|
|
- $proUid = $request->get('pro_uid');
|
|
|
- $pro = Pro::where('uid', $proUid)->first();
|
|
|
- }
|
|
|
-
|
|
|
- $selectedProUid = $pro->uid;
|
|
|
-
|
|
|
- $pros = $this->pros;
|
|
|
-
|
|
|
- $generalAvailabilitiesList = ProGeneralAvailability::where('pro_id', $pro->id)->where('is_cancelled', false)->orderBy('created_at', 'asc')->get();
|
|
|
- $generalAvailabilities = [
|
|
|
- 'MONDAY' => [],
|
|
|
- 'TUESDAY' => [],
|
|
|
- 'WEDNESDAY' => [],
|
|
|
- 'THURSDAY' => [],
|
|
|
- 'FRIDAY' => [],
|
|
|
- 'SATURDAY' => [],
|
|
|
- 'SUNDAY' => [],
|
|
|
- ];
|
|
|
- foreach ($generalAvailabilitiesList as $ga) {
|
|
|
- if ($ga->day_of_week == 'MONDAY') {
|
|
|
- $generalAvailabilities['MONDAY'][] = $ga;
|
|
|
- }
|
|
|
- if ($ga->day_of_week == 'TUESDAY') {
|
|
|
- $generalAvailabilities['TUESDAY'][] = $ga;
|
|
|
- }
|
|
|
- if ($ga->day_of_week == 'WEDNESDAY') {
|
|
|
- $generalAvailabilities['WEDNESDAY'][] = $ga;
|
|
|
- }
|
|
|
- if ($ga->day_of_week == 'THURSDAY') {
|
|
|
- $generalAvailabilities['THURSDAY'][] = $ga;
|
|
|
- }
|
|
|
- if ($ga->day_of_week == 'FRIDAY') {
|
|
|
- $generalAvailabilities['FRIDAY'][] = $ga;
|
|
|
- }
|
|
|
- if ($ga->day_of_week == 'SATURDAY') {
|
|
|
- $generalAvailabilities['SATURDAY'][] = $ga;
|
|
|
- }
|
|
|
- if ($ga->day_of_week == 'SUNDAY') {
|
|
|
- $generalAvailabilities['SUNDAY'][] = $ga;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- $specificAvailabilities = ProSpecificAvailability::where('pro_id', $pro->id)->where('is_cancelled', false)->orderBy('start_time')->get();
|
|
|
- $specificUnavailabilities = ProSpecificUnavailability::where('pro_id', $pro->id)->where('is_cancelled', false)->orderBy('start_time', 'asc')->get();
|
|
|
-
|
|
|
- //events for the calendar
|
|
|
- $startDate = date('Y-m-d', strtotime("sunday -1 week"));
|
|
|
- $endDateTime = new DateTime($startDate);
|
|
|
- $endDateTime->modify('+6 day');
|
|
|
- $endDate = $endDateTime->format("Y-m-d");
|
|
|
-
|
|
|
- $eventsData = $pro->getAvailabilityEvents($startDate, $endDate);
|
|
|
- $events = json_encode($eventsData);
|
|
|
-
|
|
|
- return view(
|
|
|
- 'app.practice-management.pro-availability',
|
|
|
- compact(
|
|
|
- 'pros',
|
|
|
- 'generalAvailabilities',
|
|
|
- 'specificAvailabilities',
|
|
|
- 'specificUnavailabilities',
|
|
|
- 'events',
|
|
|
- 'selectedProUid'
|
|
|
- )
|
|
|
- );
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
public function loadAvailability(Request $request, $proUid)
|
|
|
{
|
|
@@ -1360,11 +1389,7 @@ ORDER BY ts DESC
|
|
|
return $pdf->download('pdf_file.pdf');
|
|
|
}
|
|
|
|
|
|
- public function tickets(Request $request, $proUid = null)
|
|
|
- {
|
|
|
- $tickets = Ticket::orderBy('created_at', 'desc')->paginate();
|
|
|
- return view('app.practice-management.tickets', compact('tickets'));
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
public function supplyOrders(Request $request)
|
|
|
{
|
|
@@ -2203,11 +2228,6 @@ ORDER BY claim.created_at DESC
|
|
|
$packs = Pack::whereIn('id', $ids)->get();
|
|
|
}
|
|
|
|
|
|
- public function handouts(Request $request) {
|
|
|
- $handouts = Handout::orderBy('display_name')->get();
|
|
|
- return view('app.practice-management.handouts', compact('handouts'));
|
|
|
- }
|
|
|
-
|
|
|
private function callJava($request, $endPoint, $data)
|
|
|
{
|
|
|
$url = config('stag.backendUrl') . $endPoint;
|