PatientController.php 24 KB

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