McpController.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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\Erx;
  10. use App\Models\Facility;
  11. use App\Models\Handout;
  12. use App\Models\IncomingReport;
  13. use App\Models\MBClaim;
  14. use App\Models\MBPayer;
  15. use App\Models\Note;
  16. use App\Models\NoteTemplate;
  17. use App\Models\Pro;
  18. use App\Models\Product;
  19. use App\Models\ProProAccess;
  20. use App\Models\SectionTemplate;
  21. use App\Models\Shipment;
  22. use App\Models\SupplyOrder;
  23. use App\Models\Ticket;
  24. use Illuminate\Http\Request;
  25. use Illuminate\Support\Facades\DB;
  26. use Illuminate\Support\Facades\File;
  27. use App\Models\Bill;
  28. use App\Models\ClientSMS;
  29. use Illuminate\Support\Facades\Http;
  30. use PDF;
  31. class McpController extends Controller
  32. {
  33. public function patients(Request $request)
  34. {
  35. $patients = Client::whereNull('shadow_pro_id')
  36. ->where('mcp_pro_id', $this->performer->pro->id)
  37. ->orderBy('created_at', 'DESC')
  38. ->get();
  39. return view('app.mcp.patients', compact('patients'));
  40. }
  41. public function notes(Request $request)
  42. {
  43. $notes = Note::paginate(5);
  44. // SELECT * FROM note WHERE client_id IN (SELECT id FROM client WHERE mcp_pro_id = :me.id);
  45. return view('app.mcp.notes', compact('notes'));
  46. }
  47. public function appointments(Request $request)
  48. {
  49. $appointments = Appointment::paginate(5);
  50. return view('app.mcp.appointments', compact('appointments'));
  51. }
  52. public function bills(Request $request)
  53. {
  54. $bills = Bill::paginate(5);
  55. return view('app.mcp.bills', compact('bills'));
  56. }
  57. public function erx_and_orders(Request $request)
  58. {
  59. $erxAndOrders = Erx::paginate(5);
  60. return view('app.mcp.erx_and_orders', compact('erxAndOrders'));
  61. }
  62. public function reports(Request $request)
  63. {
  64. $data = [];
  65. return view('app.mcp.reports', $data);
  66. }
  67. public function supply_orders(Request $request)
  68. {
  69. $supplyOrders = SupplyOrder::paginate(5);
  70. return view('app.mcp.supply_orders', compact('supplyOrders'));
  71. }
  72. public function client_messages(Request $request)
  73. {
  74. $clientMessages = ClientSMS::paginate(5);
  75. return view('app.mcp.client_messages', compact('clientMessages'));
  76. }
  77. public function new_patients_awaiting_visit(Request $request){
  78. $data = [
  79. 'records' => Client::where('mcp_pro_id', $this->performer->pro->id)
  80. ->where('has_mcp_done_onboarding_visit', '!=', 'YES')
  81. ->orderBy('created_at')
  82. ->get()
  83. ];
  84. return view('app.mcp.new_patients_awaiting_visit', $data);
  85. }
  86. public function notes_pending_signature(Request $request){
  87. $data = [
  88. 'records' => Note::where('hcp_pro_id', $this->performer->pro->id)
  89. ->where('is_cancelled', '<>', true)
  90. ->where('is_signed_by_hcp', '<>', true)
  91. ->orderBy('created_at')
  92. ->get()
  93. ];
  94. return view('app.mcp.notes_pending_signature', $data);
  95. }
  96. public function notes_pending_billing(Request $request){
  97. $data = [
  98. 'records' => Note::where('hcp_pro_id', $this->performer->pro->id)
  99. ->where('is_cancelled', '<>', true)
  100. ->where('is_signed_by_hcp', true)
  101. ->where('is_billing_marked_done', '<>', true)
  102. ->orderBy('created_at')
  103. ->get()
  104. ];
  105. return view('app.mcp.notes_pending_billing', $data);
  106. }
  107. public function reports_pending_signature(Request $request){
  108. $data = [
  109. 'records' => IncomingReport::where('hcp_pro_id', $this->performer->pro->id)
  110. ->where('has_hcp_pro_signed', '<>', true)
  111. ->where('is_entry_error', '<>', true)
  112. ->orderBy('created_at')
  113. ->get()
  114. ];
  115. return view('app.mcp.reports_pending_signature', $data);
  116. }
  117. public function patients_without_appointments(Request $request){
  118. $data = [];
  119. return view('app.mcp.patients_without_appointments', $data);
  120. }
  121. public function patients_overdue_for_visit(Request $request){
  122. $data = [];
  123. return view('app.mcp.patients_overdue_for_visit', $data);
  124. }
  125. public function cancelled_appointments_pending_review(Request $request){
  126. $data = [];
  127. return view('app.mcp.cancelled_appointments_pending_review', $data);
  128. }
  129. public function cancelled_bills_pending_review(Request $request){
  130. $data = [
  131. 'records' => Bill::where('hcp_pro_id', $this->performer->pro->id)
  132. ->where('bill_service_type', 'NOTE')
  133. ->where('is_cancelled', true)
  134. ->where('is_cancellation_acknowledged', '<>', true)
  135. ->orderBy('created_at')
  136. ->get()
  137. ];
  138. return view('app.mcp.cancelled_bills_pending_review', $data);
  139. }
  140. public function cancelled_supply_orders_pending_review(Request $request){
  141. $data = [
  142. 'records' => SupplyOrder::where('signed_by_pro_id', $this->performer->pro->id)
  143. ->where('is_cancelled', true)
  144. ->where('is_cancellation_acknowledged', '<>', true)
  145. ->orderBy('created_at')
  146. ->get()
  147. ];
  148. return view('app.mcp.cancelled_supply_orders_pending_review', $data);
  149. }
  150. public function erx_and_orders_pending_signature(Request $request){
  151. $data = [
  152. 'records' => Erx::where('hcp_pro_id', $this->performer->pro->id)
  153. ->where('pro_declared_status', '<>', 'CANCELLED')
  154. ->where('has_hcp_pro_signed', '<>', true)
  155. ->orderBy('created_at')
  156. ->get()
  157. ];
  158. return view('app.mcp.erx_and_orders_pending_signature', $data);
  159. }
  160. public function supply_orders_pending_signature(Request $request){
  161. $data = [
  162. 'records' => SupplyOrder::where('created_by_pro_id', $this->performer->pro->id)
  163. ->whereNull('signed_by_pro_id')
  164. ->where('is_cancelled', '<>', true)
  165. ->orderBy('created_at')
  166. ->get()
  167. ];
  168. return view('app.mcp.supply_orders_pending_signature', $data);
  169. }
  170. }