123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327 |
- @extends ('layouts/template')
- @section('content')
- <?php
- $showProgramsColumn = false;
- foreach($patients as $patient) {
- if(count($patient->clientPrograms)) {
- if($pro->pro_type === 'ADMIN') {
- $showProgramsColumn = true;
- break;
- }
- else {
- foreach($patient->clientPrograms as $clientProgram) {
- if(in_array($pro->id, [$clientProgram->mcp_pro_id, $clientProgram->manager_pro_id])) {
- $showProgramsColumn = true;
- break;
- }
- }
- if($showProgramsColumn) break;
- }
- }
- }
- ?>
- <div class="p-3 mcp-theme-1" id="patients-list">
- <div class="card">
- <div class="card-header px-3 py-2 d-flex align-items-center">
- <strong class="mr-4">
- <i class="fas fa-user"></i>
- Patients
- </strong>
- <div class="ml-auto d-flex align-items-center search-form">
- <form action="" method="get" class="mr-2" id="patients-search">
- <input type="text" name="q" value="{{request()->input('q')}}" class="form-control form-control-sm"
- placeholder="Name / Email / Tags">
- </form>
- <select class="ml-auto max-width-300px form-control form-control-sm"
- id="patients-filter">
- <option value="" {{ $filter === '' ? 'selected' : '' }}>All patients</option>
- <option value="not-yet-seen" {{ $filter === 'not-yet-seen' ? 'selected' : '' }}>Patients I have not seen yet</option>
- <option value="having-birthday-today" {{ $filter === 'having-birthday-today' ? 'selected' : '' }}>Patients having birthday today</option>
- </select>
- </div>
- </div>
- <div class="card-body p-0">
- <table class="table table-sm table-bordered p-0 m-0">
- <thead class="bg-light">
- <tr>
- @if($pro->pro_type === 'ADMIN')
- <th class="border-0"></th>
- @endif
- <th class="px-3 border-0">Chart #</th>
- <th class="border-0">Patient</th>
- @if($pro->isDefaultNA() || $pro->pro_type === 'ADMIN')
- <th class="border-0">Source</th>
- @endif
- <th class="border-0 px-1">OB</th>
- <th class="border-0">Signed<br>Notes</th>
- <th class="border-0">CM<br>Setup</th>
- <th class="border-0">Created At</th>
- <th class="border-0">Address</th>
- @if($showProgramsColumn)
- <th class="border-0">Program(s)</th>@endif
- <th class="border-0">MCN</th>
- <th class="border-0">PCP</th>
- <th class="border-0"><span class="text-nowrap">Recent Notes</span><br>(overall)</th>
- <th class="border-0"><span class="text-nowrap">Recent Notes</span><br>(me)</th>
- <th class="border-0">Appointments</th>
- <th class="border-0">Account</th>
- <th class="border-0">Tags</th>
- </tr>
- </thead>
- <tbody>
- @foreach($patients as $patient)
- <tr>
- @if($pro->pro_type === 'ADMIN')
- <td>{{$loop->index + 1}}</td>
- @endif
- <td class="px-3">
- <a href="{{route('patients.view.dashboard', $patient)}}">
- {{$patient->chart_number}}
- </a>
- </td>
- <td>
- {{$patient->displayName()}}
- <div>{{ friendly_date_time($patient->dob, false) }}{{ $patient->sex === 'M' ? ', Male' : ($patient->sex === ', F' ? 'Female' : '') }}</div>
- </td>
- @if($pro->isDefaultNA() || $pro->pro_type === 'ADMIN')
- <td>
- @if($patient->has_system_source)
- @if($patient->system_source_category === 'PRO_TEAM' && $patient->systemSourceProTeam)
- <div class="text-nowrap">Via team profile</div>
- <a native target="_blank" href="{{config('app.stagfe6_url')}}/{{$patient->systemSourceProTeam->slug}}">{{$patient->systemSourceProTeam->slug}}</a>
- @elseif($patient->system_source_category === 'PRO' && $patient->systemSourcePro)
- <div class="text-nowrap">Via pro profile</div>
- <a native target="_blank" href="{{config('app.stagfe6_url')}}/{{$patient->systemSourcePro->slug}}">{{$patient->systemSourcePro->slug}}</a>
- @endif
- @endif
- </td>
- @endif
- <td class="px-1">
- @if($patient->has_mcp_done_onboarding_visit !== 'YES')
- <span title="MCP Onboarding Visit Pending"><i class="fa fa-exclamation-triangle"></i></span>
- @else
- <i class="fa fa-check text-secondary on-hover-opaque"></i>
- @endif
- </td>
- <td>
- <?php $numSignedNotes = $patient->numSignedNotes(); ?>
- <span class="{{$numSignedNotes && $patient->has_mcp_done_onboarding_visit !== 'YES' ? 'font-weight-bold text-warning-mellow' : 'text-secondary'}}">
- {{$numSignedNotes ? $numSignedNotes :'-'}}
- </span>
- </td>
- <td>
- @if($patient->has_cm_setup_been_performed && $patient->cmSetupNote)
- <i class="fa fa-check text-secondary on-hover-opaque"></i>
- <br>
- <a href="{{route('patients.view.notes.view.dashboard', ['patient' => $patient, 'note' => $patient->cmSetupNote])}}">Note</a>
- @else
- -
- @endif
- </td>
- <td>
- {{ friendly_date_time_short_with_tz($patient->created_at, true, 'EASTERN') }}
- <hr>
- @if($pro->pro_type === 'ADMIN')
- {{ $patient->initiative }}
- @endif
- </td>
- <td>
- <?php
- $addressParts = [];
- if (!!$patient->mailing_address_line1) $addressParts[] = $patient->mailing_address_line1;
- if (!!$patient->mailing_address_line2) $addressParts[] = $patient->mailing_address_line2;
- $addressParts = implode(", ", $addressParts) . "<br/>";
- $addressPart2 = [];
- if (!!$patient->mailing_address_city) $addressPart2[] = $patient->mailing_address_city;
- if (!!$patient->mailing_address_state) $addressPart2[] = $patient->mailing_address_state;
- $addressParts .= implode(", ", $addressPart2);
- echo $addressParts;
- ?>
- </td>
- @if($showProgramsColumn)
- <td>
- <?php $programNumber = 0; ?>
- @foreach($patient->clientPrograms as $clientProgram)
- <?php
- if($pro->pro_type === 'ADMIN' ||
- in_array($pro->id, [$clientProgram->mcp_pro_id, $clientProgram->manager_pro_id])
- ) {
- // $program = $clientProgram->program;
- $programNumber++;
- ?>
- <div class="mb-1 text-nowrap">
- {{ $programNumber }}. {{ $clientProgram->title }}
- @if($clientProgram->has_mcp_done_onboarding_visit !== 'YES')
- <span title="Onboarding Pending" class="ml-1"><i class="fa fa-exclamation-triangle"></i></span>
- @else
- <span title="Onboarding Complete" class="ml-1 text-secondary"><i class="fa fa-check"></i></span>
- @endif
- </div>
- <?php } ?>
- @endforeach
- </td>
- @endif
- <td>
- @include('app.patient.coverage_column_renderer', ['patient'=>$patient])
- </td>
- <td>
- {{ $patient->mcp ? $patient->mcp->displayName() : '-' }}
- </td>
- <td class="p-0">
- <?php $allNotes = $patient->recentNotes(); ?>
- <table class="table table-sm table-condensed table-bordered m-0 width-200px">
- <tbody>
- @foreach($allNotes as $note)
- <tr>
- <td>
- <a href="{{route('patients.view.notes.view.dashboard', ['patient' => $patient, 'note' => $note])}}"><b class="text-nowrap">{{friendlier_date($note->effective_dateest)}}</b></a>
- <br>
- <span class="text-nowrap">{{$note->hcpPro->displayName()}}</span>
- </td>
- <td>{{$note->new_or_fu_or_na}}</td>
- </tr>
- @endforeach
- </tbody>
- </table>
- </td>
- <td class="py-0 pl-2">
- <?php $myNotes = $patient->recentNotes($pro); ?>
- <table class="table table-sm table-condensed table-bordered m-0 width-200px">
- <tbody>
- @foreach($myNotes as $note)
- <tr>
- <td>
- <a href="{{route('patients.view.notes.view.dashboard', ['patient' => $patient, 'note' => $note])}}"><b class="text-nowrap">{{friendlier_date($note->effective_dateest)}}</b></a>
- </td>
- <td>{{$note->new_or_fu_or_na}}</td>
- </tr>
- @endforeach
- </tbody>
- </table>
- </td>
- <td>
- <table class="table table-sm border-0 my-0">
- <tbody>
- <?php $numAppts = 0; ?>
- @foreach($patient->upcomingAppointments as $appointment)
- @if($appointment->status !== 'CANCELLED' && $appointment->status !== 'ABANDONED')
- <tr>
- <td class="text-black p-0 border-0">
- <div class="pb-0">
- {{ friendly_date_time($appointment->start_time, false) }}, {{ friendly_time($appointment->raw_start_time) }}
- <span class="d-inline-block text-secondary text-sm">({{ $appointment->timezone }})</span>
- <br>
- <b class="mr-1">{{$appointment->pro->displayName()}}</b>
- <span class="text-secondary text-sm">({{ $appointment->status }})</span>
- </div>
- </td>
- </tr>
- <?php $numAppts++; ?>
- @endif
- @endforeach
- @if(!$numAppts)
- <tr>
- <td class="text-secondary p-0 border-0">
- No upcoming appointments
- </td>
- </tr>
- @endif
- </tbody>
- </table>
- </td>
- <td>
- @if($patient->linkedAccounts && count($patient->linkedAccounts))
- <span class="font-weight-bold text-info"><i class="fa fa-check"></i></span>
- @else
- <span class="text-secondary">-</span>
- @endif
- </td>
- <td>
- @if($patient->tags)
- <?php
- $tags = explode("|", $patient->tags);
- $tags = array_filter($tags, function($_x) {
- return !empty($_x);
- });
- $tags = implode(", ", $tags);
- ?>
- {{ $tags }}
- @endif
- </td>
- </tr>
- @endforeach
- </tbody>
- </table>
- <div class="ml-2 mt-2">
- {{$patients->links()}}
- </div>
- </div>
- </div>
- </div>
- <script>
- (function() {
- function init() {
- function submit() {
- let url = '/patients' +
- ($('#patients-filter').val() ? '/' + $('#patients-filter').val() : '') +
- ($('#patients-search input').val() ? '?q=' + encodeURIComponent($('#patients-search input').val()) : '');
- fastLoad(url);
- return false;
- }
- $('#patients-search').off('submit').on('submit', submit);
- $('#patients-filter').off('change').on('change', submit);
- @if($pro->id === 1 || $pro->id === 16)
- patientAcquisitionChart();
- @endif
- }
- @if($pro->pro_type === 'ADMIN')
- <?php
- $dates = [];
- $acquisitions = [];
- for ($i = count($patientAcquisitionData) - 1; $i >= 0; $i--) {
- $dates[] = $patientAcquisitionData[$i]->date;
- $acquisitions[] = $patientAcquisitionData[$i]->count;
- }
- ?>
- function patientAcquisitionChart() {
- var chart = c3.generate({
- bindto: '#patientAcquisitionChart',
- data: {
- x: 'x',
- // xFormat: '%Y%m%d', // 'xFormat' can be used as custom format of 'x'
- columns: [
- ['x', <?= implode(", ", array_map(function($_x) { return "'" . $_x . "'"; }, $dates)) ?>],
- ['New Patients', <?= implode(", ", array_map(function($_x) { return "'" . $_x . "'"; }, $acquisitions)) ?>],
- ]
- },
- axis: {
- x: {
- type: 'timeseries',
- tick: {
- format: '%Y-%m-%d',
- multiline: true,
- fit: true,
- rotate: -45
- },
- },
- }
- });
- }
- @endif
- addMCInitializer('patients-list', init, '#patients-list');
- }).call(window);
- </script>
- @endsection
|