PatientController.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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. ->orderBy('content_text', 'asc')
  44. ->get();
  45. return view('app.patient.medications', compact('patient', 'infoLines'));
  46. }
  47. public function dxAndFocusAreas(Request $request, Client $patient )
  48. {
  49. $infoLines = ClientInfoLine::where('client_id', $patient->id)
  50. ->where('category', 'dx')
  51. ->where('is_removed', false)
  52. ->get();
  53. return view('app.patient.dx-and-focus-areas', compact('patient', 'infoLines'));
  54. }
  55. public function careTeam(Request $request, Client $patient )
  56. {
  57. $infoLines = ClientInfoLine::where('client_id', $patient->id)
  58. ->where('category', 'care_team')
  59. ->where('is_removed', false)
  60. ->get();
  61. return view('app.patient.care-team', compact('patient', 'infoLines'));
  62. }
  63. public function measurements(Request $request, Client $patient )
  64. {
  65. return view('app.patient.measurements', compact('patient'));
  66. }
  67. public function labsAndStudies(Request $request, Client $patient )
  68. {
  69. return view('app.patient.labs-and-studies', compact('patient'));
  70. }
  71. public function history(Request $request, Client $patient )
  72. {
  73. $infoLines = ClientInfoLine::where('client_id', $patient->id)
  74. ->where('category', 'LIKE', 'history_%')
  75. ->where('is_removed', false)
  76. ->get();
  77. return view('app.patient.history', compact('patient', 'infoLines'));
  78. }
  79. public function memos(Request $request, Client $patient )
  80. {
  81. return view('app.patient.memos', compact('patient'));
  82. }
  83. public function sms(Request $request, Client $patient )
  84. {
  85. return view('app.patient.sms', compact('patient'));
  86. }
  87. public function smsNumbers(Request $request, Client $patient )
  88. {
  89. return view('app.patient.sms-numbers', compact('patient'));
  90. }
  91. public function immunizations(Request $request, Client $patient )
  92. {
  93. return view('app.patient.immunizations', compact('patient'));
  94. }
  95. public function allergies(Request $request, Client $patient )
  96. {
  97. $infoLines = ClientInfoLine::where('client_id', $patient->id)
  98. ->where('category', 'allergy')
  99. ->where('is_removed', false)
  100. ->get();
  101. return view('app.patient.allergies', compact('patient', 'infoLines'));
  102. }
  103. public function notes(Request $request, Client $patient )
  104. {
  105. $pros = Pro::all();
  106. return view('app.patient.notes', compact('patient','pros'));
  107. }
  108. public function flowSheets(Request $request, Client $patient )
  109. {
  110. return view('app.patient.flowsheets', compact('patient'));
  111. }
  112. public function demographics(Request $request, Client $patient )
  113. {
  114. return view('app.patient.demographics', compact('patient'));
  115. }
  116. public function account(Request $request, Client $patient )
  117. {
  118. return view('app.patient.account', compact('patient'));
  119. }
  120. public function careChecklist(Request $request, Client $patient )
  121. {
  122. return view('app.patient.care-checklist', compact('patient'));
  123. }
  124. public function documents(Request $request, Client $patient )
  125. {
  126. return view('app.patient.documents', compact('patient'));
  127. }
  128. public function education(Request $request, Client $patient )
  129. {
  130. return view('app.patient.education', compact('patient'));
  131. }
  132. public function messaging(Request $request, Client $patient )
  133. {
  134. return view('app.patient.messaging', compact('patient'));
  135. }
  136. public function duplicate(Request $request, Client $patient )
  137. {
  138. return view('app.patient.duplicate', compact('patient'));
  139. }
  140. public function careMonths(Request $request, Client $patient )
  141. {
  142. $careMonths = CareMonth::where('client_id', $patient->id)->orderBy('start_date', 'desc')->get();
  143. return view('app.patient.care-months', compact('patient', 'careMonths'));
  144. }
  145. public function presence(Request $request, Client $patient )
  146. {
  147. return json_encode([
  148. "online" => $patient->is_online
  149. ]);
  150. }
  151. public function embedSection(Request $request, Client $patient, $section, $selectable) {
  152. return view('app.patient.partials.' . $section, compact('patient', 'selectable'));
  153. }
  154. }