PatientController.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Models\CareMonth;
  4. use App\Models\Client;
  5. use App\Models\ClientInfoLine;
  6. use App\Models\Facility;
  7. use App\Models\NoteTemplate;
  8. use App\Models\Pro;
  9. use App\Models\SectionTemplate;
  10. use Illuminate\Http\Request;
  11. use Illuminate\Support\Facades\File;
  12. class PatientController extends Controller
  13. {
  14. public function dashboard(Request $request, Client $patient )
  15. {
  16. $mcpPros = Pro::where('is_enrolled_as_mcp', true)->get();
  17. $facilities = Facility::where('is_active', true)->get();
  18. return view('app.patient.dashboard', compact('patient', 'facilities'));
  19. }
  20. public function actionItems(Request $request, Client $patient )
  21. {
  22. $facilities = Facility::where('is_active', true)->get();
  23. return view('app.patient.action-items', compact('patient', 'facilities'));
  24. }
  25. public function intake(Request $request, Client $patient )
  26. {
  27. $files = File::allFiles(resource_path('views/app/intake-templates'));
  28. $templates = [];
  29. foreach ($files as $file) {
  30. $templates[] = str_replace(".blade.php", "", $file->getFilename());
  31. }
  32. return view('app.patient.intake', compact('patient', 'templates'));
  33. }
  34. public function carePlan(Request $request, Client $patient )
  35. {
  36. return view('app.patient.care-plan', compact('patient'));
  37. }
  38. public function medications(Request $request, Client $patient )
  39. {
  40. $infoLines = ClientInfoLine::where('client_id', $patient->id)
  41. ->where('category', 'rx')
  42. ->where('is_removed', false)
  43. ->get();
  44. return view('app.patient.medications', compact('patient', 'infoLines'));
  45. }
  46. public function dxAndFocusAreas(Request $request, Client $patient )
  47. {
  48. $infoLines = ClientInfoLine::where('client_id', $patient->id)
  49. ->where('category', 'dx')
  50. ->where('is_removed', false)
  51. ->get();
  52. return view('app.patient.dx-and-focus-areas', compact('patient', 'infoLines'));
  53. }
  54. public function careTeam(Request $request, Client $patient )
  55. {
  56. $infoLines = ClientInfoLine::where('client_id', $patient->id)
  57. ->where('category', 'care_team')
  58. ->where('is_removed', false)
  59. ->get();
  60. return view('app.patient.care-team', compact('patient', 'infoLines'));
  61. }
  62. public function measurements(Request $request, Client $patient )
  63. {
  64. return view('app.patient.measurements', compact('patient'));
  65. }
  66. public function labsAndStudies(Request $request, Client $patient )
  67. {
  68. return view('app.patient.labs-and-studies', compact('patient'));
  69. }
  70. public function history(Request $request, Client $patient )
  71. {
  72. $infoLines = ClientInfoLine::where('client_id', $patient->id)
  73. ->where('category', 'LIKE', 'history_%')
  74. ->where('is_removed', false)
  75. ->get();
  76. return view('app.patient.history', compact('patient', 'infoLines'));
  77. }
  78. public function sms(Request $request, Client $patient )
  79. {
  80. return view('app.patient.sms', compact('patient'));
  81. }
  82. public function smsNumbers(Request $request, Client $patient )
  83. {
  84. return view('app.patient.sms-numbers', compact('patient'));
  85. }
  86. public function immunizations(Request $request, Client $patient )
  87. {
  88. return view('app.patient.immunizations', compact('patient'));
  89. }
  90. public function allergies(Request $request, Client $patient )
  91. {
  92. $infoLines = ClientInfoLine::where('client_id', $patient->id)
  93. ->where('category', 'allergy')
  94. ->where('is_removed', false)
  95. ->get();
  96. return view('app.patient.allergies', compact('patient', 'infoLines'));
  97. }
  98. public function notes(Request $request, Client $patient )
  99. {
  100. $pros = Pro::all();
  101. $sectionTemplates = SectionTemplate::all();
  102. return view('app.patient.notes', compact('patient','pros', 'sectionTemplates'));
  103. }
  104. public function flowSheets(Request $request, Client $patient )
  105. {
  106. return view('app.patient.flowsheets', compact('patient'));
  107. }
  108. public function demographics(Request $request, Client $patient )
  109. {
  110. return view('app.patient.demographics', compact('patient'));
  111. }
  112. public function account(Request $request, Client $patient )
  113. {
  114. return view('app.patient.account', compact('patient'));
  115. }
  116. public function careChecklist(Request $request, Client $patient )
  117. {
  118. return view('app.patient.care-checklist', compact('patient'));
  119. }
  120. public function documents(Request $request, Client $patient )
  121. {
  122. return view('app.patient.documents', compact('patient'));
  123. }
  124. public function education(Request $request, Client $patient )
  125. {
  126. return view('app.patient.education', compact('patient'));
  127. }
  128. public function messaging(Request $request, Client $patient )
  129. {
  130. return view('app.patient.messaging', compact('patient'));
  131. }
  132. public function duplicate(Request $request, Client $patient )
  133. {
  134. return view('app.patient.duplicate', compact('patient'));
  135. }
  136. public function careMonths(Request $request, Client $patient )
  137. {
  138. $careMonths = CareMonth::where('client_id', $patient->id)->orderBy('start_date', 'desc')->get();
  139. return view('app.patient.care-months', compact('patient', 'careMonths'));
  140. }
  141. public function presence(Request $request, Client $patient )
  142. {
  143. return json_encode([
  144. "online" => $patient->is_online
  145. ]);
  146. }
  147. public function embedSection(Request $request, Client $patient, $section, $selectable) {
  148. return view('app.patient.partials.' . $section, compact('patient', 'selectable'));
  149. }
  150. }