PatientController.php 24 KB

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