PatientController.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Models\Appointment;
  4. use App\Models\BDTDevice;
  5. use App\Models\CareMonth;
  6. use App\Models\Client;
  7. use App\Models\ClientBDTDevice;
  8. use App\Models\ClientInfoLine;
  9. use App\Models\ClientProAccess;
  10. use App\Models\Erx;
  11. use App\Models\Facility;
  12. use App\Models\Handout;
  13. use App\Models\IncomingReport;
  14. use App\Models\MBClaim;
  15. use App\Models\MBPayer;
  16. use App\Models\Note;
  17. use App\Models\NoteTemplate;
  18. use App\Models\Pro;
  19. use App\Models\Product;
  20. use App\Models\ProProAccess;
  21. use App\Models\SectionTemplate;
  22. use App\Models\Shipment;
  23. use App\Models\SupplyOrder;
  24. use App\Models\Ticket;
  25. use Illuminate\Http\Request;
  26. use Illuminate\Support\Facades\DB;
  27. use Illuminate\Support\Facades\File;
  28. use App\Models\Measurement;
  29. use Illuminate\Support\Facades\Http;
  30. use PDF;
  31. class PatientController extends Controller
  32. {
  33. public function claimsResolver(Request $request, Client $patient)
  34. {
  35. $notes = $patient->notesAscending;
  36. $hcpSignedNotesCount = 0;
  37. foreach($notes as $note){
  38. if($note->is_signed_by_hcp){
  39. $hcpSignedNotesCount += 1;
  40. }
  41. }
  42. $data = [
  43. 'dog' => 'bark',
  44. 'patient' => $patient,
  45. 'hcpSignedNotesCount' => $hcpSignedNotesCount
  46. ];
  47. return view('app.patient.claims-resolver', $data);
  48. }
  49. public function dashboard(Request $request, Client $patient )
  50. {
  51. $mcpPros = Pro::where('is_enrolled_as_mcp', true)->get();
  52. $facilities = []; // Facility::where('is_active', true)->get();
  53. // get assigned devices
  54. $assignedDeviceIDs = DB::select(DB::raw("SELECT device_id from client_bdt_device where is_active = true"));
  55. $assignedDeviceIDs = array_map(function($_x) {
  56. return $_x->device_id;
  57. }, $assignedDeviceIDs);
  58. // get all except assigned ones
  59. $devices = BDTDevice::where('is_active', true)
  60. ->whereNotIn('id', $assignedDeviceIDs)
  61. ->orderBy('imei', 'asc')
  62. ->get();
  63. $assignedDeviceIDs = null;
  64. unset($assignedDeviceIDs);
  65. $dxInfoLines = ClientInfoLine::where('client_id', $patient->id)
  66. ->where('category', 'dx')
  67. ->where('is_removed', false)
  68. ->orderBy('content_text', 'asc')
  69. ->get();
  70. return view('app.patient.dashboard',
  71. compact('patient', 'facilities', 'devices', 'dxInfoLines'));
  72. }
  73. public function canvasMigrate(Request $request, Client $patient )
  74. {
  75. $mcpPros = Pro::where('is_enrolled_as_mcp', true)->get();
  76. $facilities = []; // Facility::where('is_active', true)->get();
  77. // get assigned devices
  78. $assignedDeviceIDs = DB::select(DB::raw("SELECT device_id from client_bdt_device where is_active = true"));
  79. $assignedDeviceIDs = array_map(function($_x) {
  80. return $_x->device_id;
  81. }, $assignedDeviceIDs);
  82. // get all except assigned ones
  83. $devices = BDTDevice::where('is_active', true)
  84. ->whereNotIn('id', $assignedDeviceIDs)
  85. ->orderBy('imei', 'asc')
  86. ->get();
  87. $assignedDeviceIDs = null;
  88. unset($assignedDeviceIDs);
  89. $dxInfoLines = ClientInfoLine::where('client_id', $patient->id)
  90. ->where('category', 'dx')
  91. ->where('is_removed', false)
  92. ->orderBy('content_text', 'asc')
  93. ->get();
  94. return view('app.patient.canvas-migrate',
  95. compact('patient', 'facilities', 'devices', 'dxInfoLines'));
  96. }
  97. public function canvas(Request $request, Client $patient){
  98. return view('app.patient.canvas_dump', compact('patient'));
  99. }
  100. public function actionItems(Request $request, Client $patient )
  101. {
  102. $facilities = []; // Facility::where('is_active', true)->get();
  103. return view('app.patient.action-items', compact('patient', 'facilities'));
  104. }
  105. public function actionItemsErx(Request $request, Client $patient, $filter = 'open')
  106. {
  107. $allPros = Pro::all();
  108. $facilities = []; // Facility::where('is_active', true)->get();
  109. return view('app.patient.action-items-erx', compact('patient', 'facilities', 'filter', 'allPros'));
  110. }
  111. public function actionItemsLab(Request $request, Client $patient, $filter = 'open')
  112. {
  113. $allPros = Pro::all();
  114. $facilities = []; // Facility::where('is_active', true)->get();
  115. return view('app.patient.action-items-lab', compact('patient', 'facilities', 'filter', 'allPros'));
  116. }
  117. public function actionItemsImaging(Request $request, Client $patient, $filter = 'open')
  118. {
  119. $allPros = Pro::all();
  120. $facilities = []; // Facility::where('is_active', true)->get();
  121. return view('app.patient.action-items-imaging', compact('patient', 'facilities', 'filter', 'allPros'));
  122. }
  123. public function actionItemsEquipment(Request $request, Client $patient, $filter = 'open')
  124. {
  125. $allPros = Pro::all();
  126. $facilities = []; // Facility::where('is_active', true)->get();
  127. return view('app.patient.action-items-equipment', compact('patient', 'facilities', 'filter', 'allPros'));
  128. }
  129. public function actionItemsOther(Request $request, Client $patient, $filter = 'open')
  130. {
  131. $allPros = Pro::all();
  132. $facilities = []; // Facility::where('is_active', true)->get();
  133. return view('app.patient.action-items-other', compact('patient', 'facilities', 'filter', 'allPros'));
  134. }
  135. public function actionItemsErxSingle(Request $request, Client $patient, Ticket $ticket) {
  136. $allPros = Pro::all();
  137. $facilities = []; // Facility::where('is_active', true)->get();
  138. return view('app.patient.action-items-erx-single', compact('patient', 'facilities', 'allPros', 'ticket'));
  139. }
  140. public function actionItemsLabSingle(Request $request, Client $patient, Ticket $ticket) {
  141. $allPros = Pro::all();
  142. $facilities = []; // Facility::where('is_active', true)->get();
  143. return view('app.patient.action-items-lab-single', compact('patient', 'facilities', 'allPros', 'ticket'));
  144. }
  145. public function actionItemsImagingSingle(Request $request, Client $patient, Ticket $ticket) {
  146. $allPros = Pro::all();
  147. $facilities = []; // Facility::where('is_active', true)->get();
  148. return view('app.patient.action-items-imaging-single', compact('patient', 'facilities', 'allPros', 'ticket'));
  149. }
  150. public function actionItemsEquipmentSingle(Request $request, Client $patient, Ticket $ticket) {
  151. $allPros = Pro::all();
  152. $facilities = []; // Facility::where('is_active', true)->get();
  153. return view('app.patient.action-items-equipment-single', compact('patient', 'facilities', 'allPros', 'ticket'));
  154. }
  155. public function actionItemsOtherSingle(Request $request, Client $patient, Ticket $ticket) {
  156. $allPros = Pro::all();
  157. $facilities = []; // Facility::where('is_active', true)->get();
  158. return view('app.patient.action-items-other-single', compact('patient', 'facilities', 'allPros', 'ticket'));
  159. }
  160. public function intake(Request $request, Client $patient )
  161. {
  162. $files = File::allFiles(resource_path('views/app/intake-templates'));
  163. $templates = [];
  164. foreach ($files as $file) {
  165. $templates[] = str_replace(".blade.php", "", $file->getFilename());
  166. }
  167. return view('app.patient.intake', compact('patient', 'templates'));
  168. }
  169. public function carePlan(Request $request, Client $patient )
  170. {
  171. return view('app.patient.care-plan', compact('patient'));
  172. }
  173. public function medications(Request $request, Client $patient )
  174. {
  175. $infoLines = ClientInfoLine::where('client_id', $patient->id)
  176. ->where('category', 'rx')
  177. ->where('is_removed', false)
  178. ->orderBy('content_text', 'asc')
  179. ->get();
  180. return view('app.patient.medications', compact('patient', 'infoLines'));
  181. }
  182. public function dxAndFocusAreas(Request $request, Client $patient )
  183. {
  184. $dxInfoLines = ClientInfoLine::where('client_id', $patient->id)
  185. ->where('category', 'dx')
  186. ->where('is_removed', false)
  187. ->orderBy('content_text', 'asc')
  188. ->get();
  189. return view('app.patient.dx-and-focus-areas', compact('patient', 'dxInfoLines'));
  190. }
  191. public function careTeam(Request $request, Client $patient )
  192. {
  193. $infoLines = ClientInfoLine::where('client_id', $patient->id)
  194. ->where('category', 'care_team')
  195. ->where('is_removed', false)
  196. ->get();
  197. return view('app.patient.care-team', compact('patient', 'infoLines'));
  198. }
  199. public function devices(Request $request, Client $patient )
  200. {
  201. // get assigned devices
  202. $assignedDeviceIDs = DB::select(DB::raw("SELECT device_id from client_bdt_device where is_active = true"));
  203. $assignedDeviceIDs = array_map(function($_x) {
  204. return $_x->device_id;
  205. }, $assignedDeviceIDs);
  206. // get all except assigned ones
  207. $devices = BDTDevice::where('is_active', true)
  208. ->whereNotIn('id', $assignedDeviceIDs)
  209. ->orderBy('imei', 'asc')
  210. ->get();
  211. $assignedDeviceIDs = null;
  212. unset($assignedDeviceIDs);
  213. return view('app.patient.devices', compact('patient', 'devices'));
  214. }
  215. public function measurements(Request $request, Client $patient )
  216. {
  217. $measurements = Measurement::where('client_id', $patient->id)->where('is_active', true)->orderByRaw('ts DESC NULLS LAST')->paginate(30);
  218. return view('app.patient.measurements', compact('patient', 'measurements'));
  219. }
  220. public function labsAndStudies(Request $request, Client $patient )
  221. {
  222. return view('app.patient.labs-and-studies', compact('patient'));
  223. }
  224. public function history(Request $request, Client $patient )
  225. {
  226. $infoLines = ClientInfoLine::where('client_id', $patient->id)
  227. ->where('category', 'LIKE', 'history_%')
  228. ->where('is_removed', false)
  229. ->get();
  230. return view('app.patient.history', compact('patient', 'infoLines'));
  231. }
  232. public function memos(Request $request, Client $patient )
  233. {
  234. return view('app.patient.memos', compact('patient'));
  235. }
  236. public function memosThread(Request $request, Client $patient )
  237. {
  238. return view('app.patient.memos-thread', compact('patient'));
  239. }
  240. public function messagesThread(Request $request, Client $patient )
  241. {
  242. return view('app.patient.messages-thread', compact('patient'));
  243. }
  244. public function sms(Request $request, Client $patient )
  245. {
  246. return view('app.patient.sms', compact('patient'));
  247. }
  248. public function smsNumbers(Request $request, Client $patient )
  249. {
  250. return view('app.patient.sms-numbers', compact('patient'));
  251. }
  252. public function immunizations(Request $request, Client $patient )
  253. {
  254. return view('app.patient.immunizations', compact('patient'));
  255. }
  256. public function allergies(Request $request, Client $patient )
  257. {
  258. $infoLines = ClientInfoLine::where('client_id', $patient->id)
  259. ->where('category', 'allergy')
  260. ->where('is_removed', false)
  261. ->get();
  262. return view('app.patient.allergies', compact('patient', 'infoLines'));
  263. }
  264. public function notes(Request $request, Client $patient, $filter = 'active')
  265. {
  266. $pros = $this->pros;
  267. return view('app.patient.notes', compact('patient','pros', 'filter'));
  268. }
  269. public function genericBills(Request $request, Client $patient)
  270. {
  271. return view('app.patient.generic-bills', compact('patient'));
  272. }
  273. public function rmSetup(Request $request, Client $patient)
  274. {
  275. return view('app.patient.rm-setup', compact('patient'));
  276. }
  277. public function handouts(Request $request, Client $patient )
  278. {
  279. $handouts = Handout::where('is_active', true)->get();
  280. return view('app.patient.handouts', compact('patient', 'handouts'));
  281. }
  282. public function settings(Request $request, Client $patient )
  283. {
  284. return view('app.patient.settings', compact('patient'));
  285. }
  286. public function smsReminders(Request $request, Client $patient )
  287. {
  288. return view('app.patient.sms-reminders', compact('patient'));
  289. }
  290. public function measurementConfirmationNumbers(Request $request, Client $patient )
  291. {
  292. return view('app.patient.measurement-confirmation-numbers', compact('patient'));
  293. }
  294. public function pros(Request $request, Client $patient )
  295. {
  296. return view('app.patient.pros', compact('patient'));
  297. }
  298. public function proChanges(Request $request, Client $patient )
  299. {
  300. return view('app.patient.client-pro-changes', compact('patient'));
  301. }
  302. public function account(Request $request, Client $patient )
  303. {
  304. return view('app.patient.account', compact('patient'));
  305. }
  306. public function careChecklist(Request $request, Client $patient )
  307. {
  308. return view('app.patient.care-checklist', compact('patient'));
  309. }
  310. public function documents(Request $request, Client $patient )
  311. {
  312. return view('app.patient.documents', compact('patient'));
  313. }
  314. public function incomingReports(Request $request, Client $patient, IncomingReport $currentReport = null)
  315. {
  316. return view('app.patient.incoming-reports', compact('patient', 'currentReport'));
  317. }
  318. public function education(Request $request, Client $patient )
  319. {
  320. return view('app.patient.education', compact('patient'));
  321. }
  322. public function messaging(Request $request, Client $patient )
  323. {
  324. return view('app.patient.messaging', compact('patient'));
  325. }
  326. public function duplicate(Request $request, Client $patient )
  327. {
  328. return view('app.patient.duplicate', compact('patient'));
  329. }
  330. public function careMonths(Request $request, Client $patient )
  331. {
  332. $careMonths = CareMonth::where('client_id', $patient->id)->orderBy('start_date', 'desc')->get();
  333. $notes = Note::where('is_cancelled', false)->get();
  334. return view('app.patient.care-months', compact('patient', 'careMonths', 'notes'));
  335. }
  336. public function presence(Request $request, Client $patient )
  337. {
  338. return json_encode([
  339. "online" => $patient->is_online
  340. ]);
  341. }
  342. public function embedSection(Request $request, Client $patient, $section, $selectable) {
  343. return view('app.patient.partials.' . $section, compact('patient', 'selectable'));
  344. }
  345. public function calendar(Request $request, Client $patient, Appointment $currentAppointment) {
  346. $pros = [];
  347. if($this->pro && $this->pro->pro_type != 'ADMIN') {
  348. $accessiblePros = ProProAccess::where('owner_pro_id', $this->pro->id)->get();
  349. $accessibleProIds = [];
  350. foreach($accessiblePros as $accessiblePro){
  351. $accessibleProIds[] = $accessiblePro->accessible_pro_id;
  352. }
  353. $accessibleProIds[] = $this->pro->id;
  354. // for dna, add pros accessible via pro teams
  355. if($this->performer->pro->isDefaultNA()) {
  356. $teams = $this->performer->pro->teamsWhereAssistant;
  357. foreach ($teams as $team) {
  358. if(!in_array($team->mcp_pro_id, $accessibleProIds)) {
  359. $accessibleProIds[] = $team->mcp_pro_id;
  360. }
  361. }
  362. }
  363. $pros = Pro::whereIn('id', $accessibleProIds)->get();
  364. }
  365. $dateLastWeek = date_sub(date_create(), date_interval_create_from_date_string("14 days"));
  366. $dateLastWeek = date_format($dateLastWeek, "Y-m-d");
  367. $appointments = Appointment::where('client_id', $patient->id)
  368. ->orderBy('raw_date', 'desc')->orderBy('raw_start_time', 'desc')
  369. ->where('raw_date', '>=', $dateLastWeek)
  370. ->get();
  371. $appointmentProIDs = $appointments->map(function($_item) {
  372. return $_item->pro_id;
  373. });
  374. $appointmentPros = Pro::whereIn('id', $appointmentProIDs)->get();
  375. return view('app.patient.appointment-calendar',
  376. compact('pros', 'patient', 'currentAppointment', 'appointments', 'appointmentPros'));
  377. }
  378. public function programs(Request $request, Client $patient, $filter = '') {
  379. $pros = $this->pros;
  380. return view('app.patient.programs', compact('patient', 'pros', 'filter'));
  381. }
  382. public function flowsheets(Request $request, Client $patient, $filter = '') {
  383. $pros = $this->pros;
  384. return view('app.patient.flowsheets', compact('patient', 'pros', 'filter'));
  385. }
  386. public function vitalsSettings(Request $request, Client $patient) {
  387. return view('app.patient.vitals-settings', compact('patient'));
  388. }
  389. public function vitalsGraph(Request $request, Client $patient, $filter = '') {
  390. $pros = $this->pros;
  391. return view('app.patient.vitals-graph', compact('patient', 'pros', 'filter'));
  392. }
  393. public function tickets(Request $request, Client $patient, $type = '', String $currentTicket = '') {
  394. $pros = $this->pros;
  395. $allPros = Pro::all();
  396. $qlTicket = $currentTicket;
  397. if(!!$currentTicket) {
  398. $qlTicket = Ticket::where('uid', $currentTicket)->first();
  399. if($qlTicket) {
  400. $currentTicket = $qlTicket;
  401. }
  402. }
  403. return view('app.patient.tickets', compact('patient', 'pros', 'allPros', 'type', 'currentTicket'));
  404. }
  405. public function prescriptions(Request $request, Client $patient, String $type = '', String $currentErx = '') {
  406. if(!!$currentErx) {
  407. $currentErx = Erx::where('uid', $currentErx)->first();
  408. }
  409. $note = $patient->coreNote;
  410. return view('app.patient.prescriptions.index', compact('patient', 'type', 'currentErx', 'note'));
  411. }
  412. public function prescriptionsPopup(Request $request, Client $patient, String $type = '', String $currentErx = '') {
  413. if(!!$currentErx) {
  414. $currentErx = Erx::where('uid', $currentErx)->first();
  415. }
  416. $note = null;
  417. if($request->input('noteUid')) {
  418. $note = Note::where('uid', $request->input('noteUid'))->first();
  419. }
  420. return view('app.patient.prescriptions-popup.list-popup', compact('patient', 'type', 'currentErx', 'note'));
  421. }
  422. public function prescriptionsList(Request $request, Client $patient, String $type = '', String $currentErx = '') {
  423. if(!!$currentErx) {
  424. $currentErx = Erx::where('uid', $currentErx)->first();
  425. }
  426. $note = null;
  427. if($request->input('noteUid')) {
  428. $note = Note::where('uid', $request->input('noteUid'))->first();
  429. }
  430. return view('app.patient.prescriptions.list', compact('patient', 'type', 'currentErx', 'note'));
  431. }
  432. public function downloadPrescriptionAsPdf(Request $request, Erx $prescription){
  433. if($request->input('html')) {
  434. return view('app.patient.prescriptions.pdf.pdf-preview', compact('prescription'));
  435. }
  436. else {
  437. $pdf = PDF::loadView('app.patient.prescriptions.pdf.pdf-preview', compact('prescription'));
  438. return $pdf->download($prescription->created_at .'_' . 'erx.pdf');
  439. }
  440. }
  441. public function transmitPrescription(Request $request, Erx $prescription){
  442. // re-generate pdf with cover sheet as first page and save it to FS
  443. $filePath = config('app.temp_dir') . "/{$prescription->uid}.pdf";
  444. $pdf = PDF::loadView('app.patient.prescriptions.pdf.pdf-preview-with-cover-sheet', compact('prescription'));
  445. $pdf->save($filePath);
  446. // send it along with the rest of the params to /api/erx/transmit [multi-part POST]
  447. $url = config('stag.backendUrl') . '/erx/transmit';
  448. $params = [
  449. "uid" => $request->input('uid'),
  450. "toWho" => $request->input('toWho'),
  451. "toEmail" => $request->input('toEmail'),
  452. "toFaxNumber" => $request->input('toFaxNumber'),
  453. "toFaxNumberAttentionLine" => $request->input('toFaxNumberAttentionLine'),
  454. "toFaxNumberCoverSheetMemo" => $request->input('toFaxNumberCoverSheetMemo'),
  455. ];
  456. if($request->input('copyToPatient')) {
  457. $params["copyToPatientFaxNumber"] = $request->input('copyToPatientFaxNumber');
  458. $params["copyToPatientEmail"] = $request->input('copyToPatientEmail');
  459. }
  460. $pdf = fopen($filePath, 'r');
  461. $response = Http
  462. ::attach('pdfSystemFile', $filePath, "{$prescription->uid}.pdf")
  463. ->withHeaders(['sessionKey' => $request->cookie('sessionKey')])
  464. ->post($url, $params)
  465. ->json();
  466. return $response;
  467. }
  468. public function supplyOrders(Request $request, Client $patient, SupplyOrder $supplyOrder = null)
  469. {
  470. $products = Product::where('is_active', true)->orderBy('created_at', 'desc')->get();
  471. return view('app.patient.supply-orders', compact('patient', 'supplyOrder', 'products'));
  472. }
  473. public function shipments(Request $request, Client $patient, Shipment $shipment = null)
  474. {
  475. return view('app.patient.shipments', compact('patient', 'shipment'));
  476. }
  477. public function appointments(Request $request, Client $patient, $forPro = 'all', $status = 'all') {
  478. $pros = $this->pros;
  479. $appointments = $patient->appointmentsForProByStatus($forPro, strtoupper($status));
  480. $appointmentProIDs = $appointments->map(function($_item) {
  481. return $_item->pro_id;
  482. });
  483. $appointmentPros = Pro::whereIn('id', $appointmentProIDs)->get();
  484. return view('app.patient.appointments',
  485. compact('patient', 'pros', 'appointments', 'appointmentPros', 'forPro', 'status'));
  486. }
  487. public function mcpRequests(Request $request, Client $patient) {
  488. return view('app.patient.mcp-requests', compact('patient'));
  489. }
  490. public function eligibleRefreshes(Request $request, Client $patient) {
  491. return view('app.patient.eligible-refreshes', compact('patient'));
  492. }
  493. public function insuranceCoverage(Request $request, Client $patient) {
  494. $mbPayers = MBPayer::all();
  495. return view('app.patient.insurance-coverage', compact('patient', 'mbPayers'));
  496. }
  497. public function clientPrimaryCoverages(Request $request, Client $patient) {
  498. $mbPayers = MBPayer::all();
  499. return view('app.patient.client-primary-coverages', compact('patient', 'mbPayers'));
  500. }
  501. public function primaryCoverage(Request $request, Client $patient) {
  502. $mbPayers = MBPayer::all();
  503. return view('app.patient.primary-coverage', compact('patient', 'mbPayers'));
  504. }
  505. public function primaryCoverageForm(Request $request, Client $patient) {
  506. $mbPayers = MBPayer::all();
  507. return view('app.patient.primary-coverage-form', compact('patient', 'mbPayers'));
  508. }
  509. public function primaryCoverageManualDeterminationModal(Request $request, Client $patient) {
  510. if($patient->latestClientPrimaryCoverage->plan_type === 'MEDICARE'){
  511. return view('app.patient.primary-coverage-manual-determination-medicare-modal', compact('patient'));
  512. }
  513. if($patient->latestClientPrimaryCoverage->plan_type === 'MEDICAID'){
  514. return view('app.patient.primary-coverage-manual-determination-medicaid-modal', compact('patient'));
  515. }
  516. if($patient->latestClientPrimaryCoverage->plan_type === 'COMMERCIAL'){
  517. return view('app.patient.primary-coverage-manual-determination-commercial-modal', compact('patient'));
  518. }
  519. return "Plan Type is missing!";
  520. }
  521. public function mbClaim(Request $request, MBClaim $mbClaim) {
  522. return view('app.patient.mb-claim-single', compact('mbClaim'));
  523. }
  524. public function accounts(Request $request, Client $patient) {
  525. return view('app.patient.accounts', compact('patient'));
  526. }
  527. public function careMonthMatrix(Request $request, CareMonth $careMonth) {
  528. return view('app.patient.care-month.matrix', [
  529. 'patient' => $careMonth->patient,
  530. 'careMonth' => $careMonth,
  531. ]);
  532. }
  533. public function clientProAccess(Request $request, Client $patient) {
  534. $rows = ClientProAccess::where('client_id', $patient->id)->get();
  535. return view('app.patient.client-pro-access', compact('patient', 'rows'));
  536. }
  537. }