McpController.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522
  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\Measurement;
  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 App\Models\Bill;
  29. use App\Models\ClientSMS;
  30. use App\Models\AccountInvite;
  31. use App\Models\ClientMemo;
  32. use Illuminate\Support\Facades\Http;
  33. use PDF;
  34. class McpController extends Controller
  35. {
  36. public function patients(Request $request)
  37. {
  38. $filters = $request->all();
  39. $patients = Client::whereNull('shadow_pro_id');
  40. //TODO: implement in admin controller
  41. if($this->performer->pro->pro_type != 'ADMIN'){
  42. $patients->where('mcp_pro_id', $this->performer->pro->id);
  43. }
  44. // filters
  45. /*
  46. array:18 [▼
  47. "age_category" => "LESS_THAN"
  48. "age_value_1" => "34"
  49. "age_value_2" => null
  50. "sex" => "M"
  51. "bmi_category" => "BETWEEN"
  52. "bmi_value_1" => "20"
  53. "bmi_value_2" => "25"
  54. "last_visit_category" => "LESS_THAN"
  55. "last_visit_value_1" => "2021-10-14"
  56. "last_visit_value_2" => null
  57. "next_appointment_category" => "LESS_THAN"
  58. "next_appointment_value_1" => "2021-10-15"
  59. "status" => "ACTIVE"
  60. "last_weighed_in_category" => "EXACTLY"
  61. "last_weighed_in_value_1" => "2021-10-07"
  62. "last_bp_category" => "BETWEEN"
  63. "last_bp_value_1" => "2021-10-01"
  64. "last_bp_value_2" => "2021-10-31"
  65. ]
  66. */
  67. if ($request->input('name')) {
  68. $name = trim($request->input('name'));
  69. if ($name) {
  70. $patients = $patients->where(function ($q) use ($name) {
  71. $q->where('name_first', 'ILIKE', '%' . $name . '%')
  72. ->orWhere('name_last', 'ILIKE', '%' . $name . '%');
  73. });
  74. }
  75. }
  76. if ($request->input('home_address_state')) {
  77. if($request->input('home_address_state') == 'NONE'){
  78. $patients = $patients->whereNull('mailing_address_state');
  79. }else if($request->input('home_address_state') == 'NOT_MD'){
  80. $patients = $patients->where('mailing_address_state', '<>' , 'MD');
  81. }else{
  82. $patients = $patients->where('mailing_address_state', '=' , $request->input('home_address_state'));
  83. }
  84. }
  85. $this->filterMultiQuery($request, $patients, 'age_in_years', 'age_category', 'age_value_1', 'age_value_2', false);
  86. $this->filterSimpleQuery($request, $patients, 'sex', 'sex');
  87. $this->filterMultiQuery($request, $patients, 'usual_bmi_max', 'bmi_category', 'bmi_value_1', 'bmi_value_2', false);
  88. $this->filterMultiQuery($request, $patients, 'most_recent_weight_at', 'last_weighed_in_category', 'last_weighed_in_value_1', 'last_weighed_in_value_2');
  89. $this->filterMultiQuery($request, $patients, 'most_recent_bp_at', 'last_bp_category', 'last_bp_value_1', 'last_bp_value_2');
  90. $this->filterMultiQuery($request, $patients, 'most_recent_completed_mcp_note_date', 'last_visit_category', 'last_visit_value_1', 'last_visit_value_2');
  91. switch($request->input('status')) {
  92. case 'ACTIVE':
  93. $patients->where('is_active', true)->where('has_mcp_done_onboarding_visit', true);
  94. break;
  95. case 'AWAITING_VISIT':
  96. $patients->where('is_active', true)->where('has_mcp_done_onboarding_visit', false);
  97. break;
  98. case 'INACTIVE':
  99. $patients->where('is_active', '<>', true);
  100. break;
  101. }
  102. $initiative = $request->input('initiative');
  103. if($initiative){
  104. $wildCardedInitiative = '%'.$initiative.'%';
  105. $patients->where('initiative', 'ilike', $wildCardedInitiative);
  106. }
  107. $include_test_records = $request->input('include_test_records');
  108. if(!$include_test_records){
  109. $patients = $patients->where(function ($q) {
  110. $q->whereNull('client_engagement_status_category')
  111. ->orWhere('client_engagement_status_category', '<>', 'DUMMY');
  112. });
  113. }
  114. if ($request->input('next_appointment_category')) {
  115. if($request->input('next_appointment_category') == 'NONE'){
  116. $patients = $patients->whereNull('next_mcp_appointment_id');
  117. }else{
  118. $self = $this;
  119. $patients = $patients->whereHas('nextMcpAppointment', function($pQry) use ($request, $self){
  120. return $self->filterMultiQuery($request, $pQry, 'raw_date', 'next_appointment_category', 'next_appointment_value_1', 'next_appointment_value_2');
  121. });
  122. }
  123. }
  124. if ($request->input('chart_number')) {
  125. $patients = $patients->where('chart_number', 'ILIKE' , '%'.$request->input('chart_number').'%');
  126. }
  127. $sortBy = $request->input('sort_by') ?: 'name_first';
  128. $sortDir = $request->input('sort_dir') ?: 'ASC';
  129. $patients = $patients->orderByRaw("$sortBy $sortDir NULLS LAST");
  130. $patients = $patients->orderBy('created_at', 'DESC')->paginate(50);
  131. return view('app.mcp.patients', compact('patients', 'filters'));
  132. }
  133. public function notes(Request $request)
  134. {
  135. $filters = $request->all();
  136. $notes = Note::query();
  137. $notes = $notes->where('hcp_pro_id', $this->performer->pro->id);
  138. $this->filterMultiQuery($request, $notes, 'effective_time', 'date_category', 'date_value_1', 'date_value_2');
  139. $this->filterSimpleQuery($request, $notes, 'new_or_fu_or_na', 'new_or_fu_or_na');
  140. $notes = $notes->orderBy('created_at', 'DESC')->paginate(20);
  141. return view('app.mcp.notes', compact('notes','filters'));
  142. }
  143. public function appointments(Request $request)
  144. {
  145. $filters = $request->all();
  146. $appointments = Appointment::where('pro_id', $this->performer->pro->id);
  147. $this->filterMultiQuery($request, $appointments, 'raw_date', 'date_category', 'date_value_1', 'date_value_2');
  148. $this->filterSimpleQuery($request, $appointments, 'status', 'status');
  149. $appointments = $appointments->orderBy('end_time', 'DESC')->paginate(20);
  150. return view('app.mcp.appointments', compact('appointments', 'filters'));
  151. }
  152. public function bills(Request $request)
  153. {
  154. $filters = $request->all();
  155. $bills = Bill::where('hcp_pro_id', $this->performer->pro->id);
  156. $this->filterMultiQuery($request, $bills, 'created_at', 'date_category', 'date_value_1', 'date_value_2');
  157. $status = $request->get('status');
  158. if($status){
  159. if($status == 'CANCELLED') $bills = $bills->where('is_cancelled', true);
  160. if($status == 'NOT_CANCELLED') $bills = $bills->where('is_cancelled', false);
  161. }
  162. $bills = $bills->orderBy('created_at', 'DESC')->paginate(20);
  163. return view('app.mcp.bills', compact('bills', 'filters'));
  164. }
  165. public function clients_bdt_devices(Request $request){
  166. $filters = $request->all();
  167. $devices = ClientBDTDevice::select('client_bdt_device.*')
  168. ->join('client', 'client.id', '=', 'client_bdt_device.client_id')
  169. ->where('client.mcp_pro_id', $this->performer->pro->id);
  170. $this->filterMultiQuery($request, $devices, 'client_bdt_device.created_at', 'date_category', 'date_value_1', 'date_value_2');
  171. $status = $request->get('status');
  172. if($status){
  173. if($status === 'ACTIVE') $devices = $devices->where('client_bdt_device.is_active', true);
  174. if($status === 'DEACTIVATED') $devices = $devices->where('client_bdt_device.is_active', false);
  175. }
  176. $devices = $devices->orderBy('created_at', 'DESC')->paginate(20);
  177. return view('app.mcp.clients_bdt_devices', compact('devices', 'filters'));
  178. }
  179. public function memos(Request $request){
  180. $filters = $request->all();
  181. $memos = ClientMemo::select('client_memo.*')
  182. ->join('client', 'client.id', '=', 'client_memo.client_id')
  183. ->where('client.mcp_pro_id', $this->performer->pro->id);
  184. $this->filterMultiQuery($request, $memos, 'client_memo.created_at', 'date_category', 'date_value_1', 'date_value_2');
  185. $this->filterSimpleQuery($request, $memos, 'category', 'category');
  186. $memos = $memos->orderBy('created_at', 'DESC')->paginate(20);
  187. return view('app.mcp.memos', compact('memos', 'filters'));
  188. }
  189. public function erx_and_orders(Request $request)
  190. {
  191. $filters = $request->all();
  192. $erxAndOrders = Erx::query();
  193. $erxAndOrders = $erxAndOrders->where('hcp_pro_id', $this->performer->pro->id);
  194. $this->filterMultiQuery($request, $erxAndOrders, 'created_at', 'date_category', 'date_value_1', 'date_value_2');
  195. $this->filterSimpleQuery($request, $erxAndOrders, 'pro_declared_status', 'status');
  196. $erxAndOrders = $erxAndOrders->orderBy('created_at', 'DESC')->paginate(20);
  197. return view('app.mcp.erx_and_orders', compact('erxAndOrders', 'filters'));
  198. }
  199. public function reports(Request $request)
  200. {
  201. $filters = $request->all();
  202. $reports = IncomingReport::where('hcp_pro_id', $this->performer->pro->id);
  203. $this->filterMultiQuery($request, $reports, 'report_date', 'date_category', 'date_value_1', 'date_value_2');
  204. $status = $request->get('status');
  205. if($status){
  206. if($status == 'SIGNED') $reports = $reports->where('has_hcp_pro_signed', true);
  207. if($status == 'NOT_SIGNED') $reports = $reports->where('has_hcp_pro_signed', false);
  208. }
  209. $reports = $reports->orderBy('created_at', 'DESC')->paginate(20);
  210. return view('app.mcp.reports', compact('reports', 'filters'));
  211. }
  212. public function supply_orders(Request $request)
  213. {
  214. $filters = $request->all();
  215. $supplyOrders = SupplyOrder::select('supply_order.*')->where('supply_order.signed_by_pro_id', $this->performer->pro->id);
  216. $this->filterMultiQuery($request, $supplyOrders, 'created_at', 'date_category', 'date_value_1', 'date_value_2');
  217. $status = $request->get('status');
  218. if($status){
  219. if($status == 'CLEARED_FOR_SHIPMENT'){
  220. $supplyOrders = $supplyOrders->where('is_cleared_for_shipment', true);
  221. }elseif($status == 'NOT_CLEARED_FOR_SHIPMENT'){
  222. $supplyOrders = $supplyOrders->where('is_cleared_for_shipment', false);
  223. }elseif($status == 'CANCELLED'){
  224. $supplyOrders = $supplyOrders->where('is_cancelled', true);
  225. }else{
  226. $supplyOrders = $supplyOrders->join('shipment', 'shipment.id', '=', 'supply_order.shipment_id')->where('shipment.status', $status);
  227. }
  228. }
  229. $supplyOrders = $supplyOrders->orderBy('created_at', 'DESC')->paginate(20);
  230. return view('app.mcp.supply_orders', compact('supplyOrders', 'filters'));
  231. }
  232. public function client_messages(Request $request)
  233. {
  234. $filters = $request->all();
  235. $clientMessages = ClientSMS::select('client_sms.*')
  236. ->join('client', 'client.id', '=', 'client_sms.client_id')
  237. ->where('client.mcp_pro_id', $this->performer->pro->id);
  238. $this->filterMultiQuery($request, $clientMessages, 'client_sms.created_at', 'date_category', 'date_value_1', 'date_value_2');
  239. $this->filterSimpleQuery($request, $clientMessages, 'sms_status', 'sms_status');
  240. $clientMessages = $clientMessages->orderBy('client_sms.created_at', 'DESC');
  241. $clientMessages = $clientMessages->paginate(20);
  242. return view('app.mcp.client_messages', compact('clientMessages', 'filters'));
  243. }
  244. public function patients_accounts_invites(Request $request){
  245. $filters = $request->all();
  246. $accountInvites = AccountInvite::select('account_invite.*')
  247. ->join('client', 'client.id', '=', 'account_invite.for_client_id');
  248. $accountInvites = $accountInvites->where('client.mcp_pro_id', $this->performer->pro->id);
  249. $this->filterMultiQuery($request, $accountInvites, 'account_invite.created_at', 'date_category', 'date_value_1', 'date_value_2');
  250. $this->filterSimpleQuery($request, $accountInvites, 'account_invite.status', 'status');
  251. $accountInvites = $accountInvites->orderBy('created_at', 'DESC')->paginate(20);
  252. return view('app.mcp.patients-accounts-invites', compact('accountInvites', 'filters'));
  253. }
  254. public function new_patients_awaiting_visit(Request $request){
  255. $data = [
  256. 'records' => Client::where('mcp_pro_id', $this->performer->pro->id)
  257. ->where('has_mcp_done_onboarding_visit', '!=', 'YES')
  258. ->orderBy('created_at')
  259. ->get()
  260. ];
  261. return view('app.mcp.new_patients_awaiting_visit', $data);
  262. }
  263. public function notes_pending_signature(Request $request){
  264. $data = [
  265. 'records' => Note::where('hcp_pro_id', $this->performer->pro->id)
  266. ->where('is_cancelled', '<>', true)
  267. ->where('is_signed_by_hcp', '<>', true)
  268. ->where('is_core_note', false)
  269. ->orderBy('created_at')
  270. ->get()
  271. ];
  272. return view('app.mcp.notes_pending_signature', $data);
  273. }
  274. public function notes_pending_summary_suggestion(Request $request){
  275. $pro = $this->performer->pro;
  276. $data = [
  277. 'records' => $pro->get_notes_pending_summary_suggestion_as_mcp()
  278. ];
  279. return view('app.mcp.notes_pending_summary_suggestion', $data);
  280. }
  281. public function notes_rejected_summary_suggestion(Request $request){
  282. $pro = $this->performer->pro;
  283. $data = [
  284. 'records' => $pro->get_notes_rejected_summary_suggestion_as_mcp()
  285. ];
  286. return view('app.mcp.notes_rejected_summary_suggestion', $data);
  287. }
  288. public function notes_pending_billing(Request $request){
  289. $data = [
  290. 'records' => Note::where('hcp_pro_id', $this->performer->pro->id)
  291. ->where('is_cancelled', '<>', true)
  292. ->where('is_signed_by_hcp', true)
  293. ->where('is_billing_marked_done', '<>', true)
  294. ->orderBy('created_at')
  295. ->get()
  296. ];
  297. return view('app.mcp.notes_pending_billing', $data);
  298. }
  299. public function bills_pending_signature(Request $request){
  300. $data = [
  301. 'records' => Bill::where('bill_service_type', '<>', 'CARE_MONTH')->where(function ($query) {
  302. $query->where('hcp_pro_id', $this->performer->pro->id)->where('is_signed_by_hcp', false)->where('is_cancelled', false);
  303. })
  304. ->orWhere(function ($query) {
  305. $query->where('cm_pro_id', $this->performer->pro->id)->where('is_signed_by_cm', false)->where('is_cancelled', false);
  306. })->orWhere(function ($query) {
  307. $query->where('rme_pro_id', $this->performer->pro->id)->where('is_signed_by_rme', false)->where('is_cancelled', false);
  308. })->orWhere(function ($query) {
  309. $query->where('rmm_pro_id', $this->performer->pro->id)->where('is_signed_by_rmm', false)->where('is_cancelled', false);
  310. })->orWhere(function ($query) {
  311. $query->where('generic_pro_id', $this->performer->pro->id)->where('is_signed_by_generic_pro', false)->where('is_cancelled', false);
  312. })
  313. ->orderBy('created_at', 'DESC')
  314. ->get()
  315. ];
  316. return view('app.mcp.bills_pending_signature', $data);
  317. }
  318. public function reports_pending_signature(Request $request){
  319. $data = [
  320. 'records' => IncomingReport::where('hcp_pro_id', $this->performer->pro->id)
  321. ->where('has_hcp_pro_signed', '<>', true)
  322. ->where('is_entry_error', '<>', true)
  323. ->orderBy('created_at')
  324. ->get()
  325. ];
  326. return view('app.mcp.reports_pending_signature', $data);
  327. }
  328. public function patients_without_appointments(Request $request){
  329. $patients = $this->performer->pro->get_patients_without_appointment_query()->paginate(20);
  330. return view('app.mcp.patients_without_appointments', compact('patients'));
  331. }
  332. public function patients_overdue_for_visit(Request $request){
  333. $patients = $this->performer->pro->get_patients_overdue_for_visit_query()->paginate(20);
  334. return view('app.mcp.patients_overdue_for_visit', compact('patients'));
  335. }
  336. public function cancelled_appointments_pending_review(Request $request){
  337. $data = [];
  338. return view('app.mcp.cancelled_appointments_pending_review', $data);
  339. }
  340. public function cancelled_bills_pending_review(Request $request){
  341. $data = [
  342. 'records' => Bill::where('hcp_pro_id', $this->performer->pro->id)
  343. ->where('bill_service_type', 'NOTE')
  344. ->where('is_cancelled', true)
  345. ->where('is_cancellation_acknowledged', '<>', true)
  346. ->orderBy('created_at')
  347. ->get()
  348. ];
  349. return view('app.mcp.cancelled_bills_pending_review', $data);
  350. }
  351. public function cancelled_supply_orders_pending_review(Request $request){
  352. $data = [
  353. 'records' => SupplyOrder::where('signed_by_pro_id', $this->performer->pro->id)
  354. ->where('is_cancelled', true)
  355. ->where('is_cancellation_acknowledged', '<>', true)
  356. ->orderBy('created_at')
  357. ->get()
  358. ];
  359. return view('app.mcp.cancelled_supply_orders_pending_review', $data);
  360. }
  361. public function erx_and_orders_pending_signature(Request $request){
  362. $data = [
  363. 'records' => Erx::where('hcp_pro_id', $this->performer->pro->id)
  364. ->where('pro_declared_status', '<>', 'CANCELLED')
  365. ->where('has_hcp_pro_signed', '<>', true)
  366. ->orderBy('created_at')
  367. ->get()
  368. ];
  369. return view('app.mcp.erx_and_orders_pending_signature', $data);
  370. }
  371. public function supply_orders_pending_signature(Request $request){
  372. $data = [
  373. 'records' => SupplyOrder::where('created_by_pro_id', $this->performer->pro->id)
  374. ->whereNull('signed_by_pro_id')
  375. ->where('is_cancelled', '<>', true)
  376. ->orderBy('created_at')
  377. ->get()
  378. ];
  379. return view('app.mcp.supply_orders_pending_signature', $data);
  380. }
  381. public function supply_orders_awaiting_shipment(Request $request){
  382. $data = [
  383. 'records' => SupplyOrder::where('created_by_pro_id', $this->performer->pro->id)
  384. ->where('is_signed_by_pro', true)
  385. ->where('is_cleared_for_shipment', true)
  386. ->whereNull('shipment_id')
  387. ->orderBy('created_at')
  388. ->get()
  389. ];
  390. return view('app.mcp.supply_orders_awaiting_shipment', $data);
  391. }
  392. public function unsigned_incoming_reports(Request $request){
  393. $data = [
  394. 'records' => IncomingReport::where('hcp_pro_id', $this->performer->pro->id)
  395. ->whereRaw('(has_hcp_pro_signed IS NULL OR has_hcp_pro_signed = FALSE)')
  396. ->orderBy('created_at', 'desc')
  397. ->get()
  398. ];
  399. return view('app.mcp.unsigned_incoming_reports', $data);
  400. }
  401. public function patients_awaiting_rpm_interaction(Request $request) {
  402. $cmStartDate = date('Y-m-01');
  403. $query = "
  404. SELECT
  405. client.uid as client_uid,
  406. care_month.uid as care_month_uid,
  407. (client.name_first || ' ' || client.name_last) as client_name,
  408. client.age_in_years,
  409. client.sex,
  410. care_month.start_date,
  411. care_month.number_of_days_with_remote_measurements
  412. FROM
  413. client join care_month on client.id = care_month.client_id
  414. WHERE
  415. care_month.start_date = '{$cmStartDate}'
  416. AND client.is_enrolled_in_rm = 'YES'
  417. AND care_month.has_mcp_interacted_with_client_about_rm IS NOT TRUE
  418. AND care_month.mcp_pro_id = {$this->performer->pro->id}
  419. AND (client.client_engagement_status_category IS NULL OR client.client_engagement_status_category != 'DUMMY')
  420. AND client.name_first NOT ILIKE '%test%'
  421. AND client.name_last NOT ILIKE '%test%'
  422. ORDER BY care_month.number_of_days_with_remote_measurements DESC NULLS LAST
  423. ";
  424. $data = [
  425. 'records' => DB::select($query)
  426. ];
  427. return view('app.mcp.patients_awaiting_rpm_interaction', $data);
  428. }
  429. public function measurements_pending_stamping(Request $request){
  430. $data = [
  431. 'records' => CareMonth::where('mcp_pro_id', $this->performer->pro->id)
  432. ->where('rm_num_measurements_not_stamped_by_mcp', '>', 0)
  433. ->whereNotNull('rm_num_measurements_not_stamped_by_mcp')
  434. ->orderBy('created_at', 'DESC')
  435. ->paginate(15)
  436. ];
  437. return view('app.mcp.measurements_pending_stamping', $data);
  438. }
  439. public function measurements_pending_stamping_in_care_month(Request $request) {
  440. $patient = Client::where('uid', $request->input('patientUid'))->first();
  441. $careMonth = CareMonth::where('uid', $request->input('careMonthUid'))->first();
  442. return view('app.mcp.measurements_pending_stamping_in_care_month', compact('patient', 'careMonth'));
  443. }
  444. public function measurements_mass_stamping(Request $request){
  445. $careMonthsWithMeasurementsPendingStamping = CareMonth::select('id')
  446. ->where('mcp_pro_id', $this->performer->pro->id)
  447. ->where('rm_num_measurements_not_stamped_by_mcp', '>', 0)
  448. ->whereNotNull('rm_num_measurements_not_stamped_by_mcp')
  449. ->orderBy('created_at', 'DESC')
  450. ->get()
  451. ->map(function($_x) {
  452. return $_x->id;
  453. })
  454. ->toArray();
  455. $measurementsPendingStamping = Measurement::whereIn('care_month_id', $careMonthsWithMeasurementsPendingStamping)
  456. ->orderBy('created_at', 'DESC')
  457. ->whereNotNull('ts')
  458. ->whereNotIn('label', ['SBP', 'DBP'])
  459. ->where('is_cellular_zero', '<>', true)
  460. ->where('is_active', true)
  461. ->where('has_been_stamped_by_mcp', false)
  462. ->whereNotNull('client_bdt_measurement_id')
  463. ->paginate(500);
  464. return view('app.mcp.measurements_mass_stamping', compact('measurementsPendingStamping'));
  465. }
  466. }