|
@@ -237,7 +237,8 @@
|
|
|
title="{{friendly_date_time($iPatient->most_recent_cellular_bp_measurement_at)}}">{{friendly_date_est_compact($iPatient->most_recent_cellular_bp_measurement_at)}}</span>
|
|
|
@endif
|
|
|
<span class="mx-1 text-secondary text-sm">|</span>
|
|
|
- <a href="#">All</a>
|
|
|
+ <a href="#" class="btn-bp-popup"
|
|
|
+ data-uid="{{$iPatient->care_month_uid}}">All</a>
|
|
|
</div>
|
|
|
@else
|
|
|
<span class="text-danger opacity-60">Not used yet</span>
|
|
@@ -260,7 +261,7 @@
|
|
|
title="{{friendly_date_time($iPatient->most_recent_cellular_weight_measurement_at)}}">{{friendly_date_est_compact($iPatient->most_recent_cellular_weight_measurement_at)}}</span>
|
|
|
@endif
|
|
|
<span class="mx-1 text-secondary text-sm">|</span>
|
|
|
- <a href="#" class="btn-measurements-popup"
|
|
|
+ <a href="#" class="btn-weight-popup"
|
|
|
data-uid="{{$iPatient->care_month_uid}}">All</a>
|
|
|
</div>
|
|
|
@else
|
|
@@ -431,31 +432,250 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="stag-popup tall overflow-visible dynamic-popup draggable resizable mcp-theme-1"
|
|
|
- stag-popup-key="rpm-manager-measurements-popup">
|
|
|
+ <div class="stag-popup tall draggable resizable mcp-theme-1"
|
|
|
+ stag-popup-key="rpm-manager-bp-popup">
|
|
|
<div class="stag-popup-content p-0">
|
|
|
<h3 class="stag-popup-title mb-0 mt-3 mx-3 pb-0 border-bottom-0">
|
|
|
- <span class="rpm-manager-measurements-popup-title">xxx</span>
|
|
|
+ <span id="rpm-manager-bp-popup-title">xxx</span>
|
|
|
<a href="#" class="ml-auto text-secondary" onclick="return closeStagPopup()">
|
|
|
<i class="fa fa-times-circle"></i>
|
|
|
</a>
|
|
|
</h3>
|
|
|
<div class="stag-popup-content-inner">
|
|
|
- <div class="popup-content-container">
|
|
|
- Hello
|
|
|
+ <div class="popup-content-container px-3">
|
|
|
+ <h3 class="m-0 font-size-16" id="rpm-manager-bp-caremonth"></h3>
|
|
|
+ <div id="rpm-manager-bp-graph"></div>
|
|
|
+ <table class="table table-condensed table-sm table-bordered mt-3 cm-tab" id="rpm-manager-bp-matrix">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th class="text-secondary text-sm">Date</th>
|
|
|
+ <th class="text-secondary text-sm">Time</th>
|
|
|
+ <th class="text-secondary text-sm">Value</th>
|
|
|
+ <th class="text-secondary text-sm">Stamp</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody></tbody>
|
|
|
+ </table>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div class="stag-popup tall draggable resizable mcp-theme-1"
|
|
|
+ stag-popup-key="rpm-manager-weight-popup">
|
|
|
+ <div class="stag-popup-content p-0">
|
|
|
+ <h3 class="stag-popup-title mb-0 mt-3 mx-3 pb-0 border-bottom-0">
|
|
|
+ <span id="rpm-manager-weight-popup-title">xxx</span>
|
|
|
+ <a href="#" class="ml-auto text-secondary" onclick="return closeStagPopup()">
|
|
|
+ <i class="fa fa-times-circle"></i>
|
|
|
+ </a>
|
|
|
+ </h3>
|
|
|
+ <div class="stag-popup-content-inner">
|
|
|
+ <div class="popup-content-container px-3">
|
|
|
+ <h3 class="m-0 font-size-16" id="rpm-manager-weight-caremonth"></h3>
|
|
|
+ <div id="rpm-manager-weight-graph"></div>
|
|
|
+ <table class="table table-condensed table-sm table-bordered mt-3 cm-tab" id="rpm-manager-weight-matrix">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th class="text-secondary text-sm">Date</th>
|
|
|
+ <th class="text-secondary text-sm">Time</th>
|
|
|
+ <th class="text-secondary text-sm">Value</th>
|
|
|
+ <th class="text-secondary text-sm">Stamp</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody></tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div id="stamp-moe-template">
|
|
|
+ <div moe relative>
|
|
|
+ <a href="#" start show>Stamp</a>
|
|
|
+ <form url="/api/measurement/stamp" right class="width-300px">
|
|
|
+ <input type="hidden" name="uid" value="">
|
|
|
+ <p class="mb-1">Stamp this measurement?</p>
|
|
|
+ <div class="mt-2 bg-light border p-2">
|
|
|
+ <div class="mb-1 text-secondary stamp-moe-type"></div>
|
|
|
+ <div class="font-weight-bold mb-1 stamp-moe-value">
|
|
|
+
|
|
|
+ </div>
|
|
|
+ <div class="text-sm stamp-moe-date-time">
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="mb-2">
|
|
|
+ <label class="mb-1 text-secondary text-sm">Memo</label>
|
|
|
+ <textarea class="form-control form-control-sm" name="memo"></textarea>
|
|
|
+ </div>
|
|
|
+ <div class="form-group m-0">
|
|
|
+ <button submit class="btn btn-primary btn-sm mr-2">Submit</button>
|
|
|
+ <button cancel class="btn btn-default border btn-sm mr-2">Cancel</button>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<script>
|
|
|
+ <?php
|
|
|
+ $careMonths = [];
|
|
|
+ foreach ($patients as $iPatient) {
|
|
|
+ if(!!$iPatient->entries_json) {
|
|
|
+ $iPatient->entries_json = json_decode($iPatient->entries_json);
|
|
|
+ }
|
|
|
+ if(!!$iPatient->measurements_json) {
|
|
|
+ $iPatient->measurements_json = json_decode($iPatient->measurements_json);
|
|
|
+ }
|
|
|
+ if(!!$iPatient->measurements_bp_json) {
|
|
|
+ $iPatient->measurements_bp_json = json_decode($iPatient->measurements_bp_json);
|
|
|
+ for ($i = 0; $i < count($iPatient->measurements_bp_json); $i++) {
|
|
|
+ $timestampInSec = floor($iPatient->measurements_bp_json[$i]->ts / 1000);
|
|
|
+ $iPatient->measurements_bp_json[$i]->date_display = friendly_date_time_short_with_tz_from_timestamp($timestampInSec, 'EASTERN', '-', 'm/d/y');
|
|
|
+ $iPatient->measurements_bp_json[$i]->time_display = friendly_date_time_short_with_tz_from_timestamp($timestampInSec, 'EASTERN', '-', 'h:i A') . ' EST';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!!$iPatient->measurements_weight_json) {
|
|
|
+ $iPatient->measurements_weight_json = json_decode($iPatient->measurements_weight_json);
|
|
|
+ for ($i = 0; $i < count($iPatient->measurements_weight_json); $i++) {
|
|
|
+ $timestampInSec = floor($iPatient->measurements_weight_json[$i]->ts / 1000);
|
|
|
+ $iPatient->measurements_weight_json[$i]->date_display = friendly_date_time_short_with_tz_from_timestamp($timestampInSec, 'EASTERN', '-', 'm/d/y');
|
|
|
+ $iPatient->measurements_weight_json[$i]->time_display = friendly_date_time_short_with_tz_from_timestamp($timestampInSec, 'EASTERN', '-', 'h:i A') . ' EST';
|
|
|
+ $iPatient->measurements_weight_json[$i]->numericValue = round($iPatient->measurements_weight_json[$i]->numericValue, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $iPatient->month_display = friendly_month($iPatient->care_month_start_date);
|
|
|
+ $careMonths[$iPatient->care_month_uid] = $iPatient;
|
|
|
+ }
|
|
|
+ ?>
|
|
|
(function () {
|
|
|
|
|
|
+ let careMonths = {!! json_encode($careMonths) !!};
|
|
|
+
|
|
|
function init() {
|
|
|
let parent = $('#practice-rpm-manager');
|
|
|
|
|
|
- // showStagPopup('rpm-manager-measurements-popup');
|
|
|
- // TODO:
|
|
|
+ parent
|
|
|
+ .off('click', '.btn-bp-popup')
|
|
|
+ .on('click', '.btn-bp-popup', function() {
|
|
|
+ prepareMeasurementsPopup($(this).attr('data-uid'), 'bp');
|
|
|
+ showStagPopup('rpm-manager-bp-popup');
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+
|
|
|
+ parent
|
|
|
+ .off('click', '.btn-weight-popup')
|
|
|
+ .on('click', '.btn-weight-popup', function() {
|
|
|
+ prepareMeasurementsPopup($(this).attr('data-uid'), 'weight');
|
|
|
+ showStagPopup('rpm-manager-weight-popup');
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log(careMonths);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ function prepareMeasurementsPopup(_careMonthUid, _type) {
|
|
|
+ let careMonth = careMonths[_careMonthUid],
|
|
|
+ measurements = careMonth['measurements_' + _type + '_json'];
|
|
|
+
|
|
|
+ addMCHook('refresh-' + _careMonthUid + '_' + _type, function () {
|
|
|
+ prepareMeasurementsPopup(_careMonthUid, _type);
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+
|
|
|
+ // misc
|
|
|
+ $('#rpm-manager-' + _type + '-popup-title').text(careMonth.client_name + ' (' + careMonth.dob + ')');
|
|
|
+ $('#rpm-manager-' + _type + '-caremonth').text('Care Month of: ' + careMonth.month_display + ' | ' + (_type === 'bp' ? 'Blood Pressure' : 'Weight'));
|
|
|
+
|
|
|
+ // graph
|
|
|
+
|
|
|
+ // matrix
|
|
|
+ if(!measurements) measurements = [];
|
|
|
+ let table = $('#rpm-manager-' + _type + '-matrix'), tbody = table.find('tbody');
|
|
|
+ tbody.empty();
|
|
|
+ for (let i = 0; i < measurements.length; i++) {
|
|
|
+ let m = measurements[i];
|
|
|
+
|
|
|
+ // tr
|
|
|
+ let tr = $('<tr/>').attr('data-uid', m.uid);
|
|
|
+
|
|
|
+ // date
|
|
|
+ $('<td/>').text(m.date_display).appendTo(tr);
|
|
|
+
|
|
|
+ // time
|
|
|
+ $('<td/>').text(m.time_display).appendTo(tr);
|
|
|
+
|
|
|
+ // value
|
|
|
+ if(_type === 'bp') {
|
|
|
+ $('<td/>').text(m.sbpMmHg + '/' + m.dbpMmHg + ' mmHg').appendTo(tr);
|
|
|
+ }
|
|
|
+ else if(_type === 'weight') {
|
|
|
+ $('<td/>').text(m.numericValue + ' lbs').appendTo(tr);
|
|
|
+ }
|
|
|
+
|
|
|
+ // stamp
|
|
|
+ // MCPs and RMMs get stamp UI
|
|
|
+ let stamp = '';
|
|
|
+ @if($viewingAs === 'MCP')
|
|
|
+ if(!m.hasBeenStampedByMcp) {
|
|
|
+ stamp = $($('#stamp-moe-template').html());
|
|
|
+ stamp.find('[name="uid"]').val(m.uid);
|
|
|
+ stamp.find('.stamp-moe-type').text(m.bdtDeviceCategory);
|
|
|
+ if(_type === 'bp') {
|
|
|
+ stamp.find('.stamp-moe-value').text(m.sbpMmHg + '/' + m.dbpMmHg + ' mmHg');
|
|
|
+ }
|
|
|
+ else if(_type === 'weight') {
|
|
|
+ stamp.find('.stamp-moe-value').text(m.numericValue + ' lbs');
|
|
|
+ }
|
|
|
+ stamp.find('.stamp-moe-date-time').text(m.date_display + ' ' + m.time_display);
|
|
|
+ stamp.find('form').attr('hook', 'refresh-' + _careMonthUid + '_' + _type);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ stamp = $('<div class="d-flex align-items-baseline text-secondary" />');
|
|
|
+ stamp.append('<i class="fa fa-check" />');
|
|
|
+ stamp.append('<span class="ml-1">Stamped</span>');
|
|
|
+ }
|
|
|
+ @elseif($viewingAs === 'RMM')
|
|
|
+ if(!m.hasBeenStampedByRmm) {
|
|
|
+ stamp = $($('#stamp-moe-template').html());
|
|
|
+ stamp.find('[name="uid"]').val(m.uid);
|
|
|
+ stamp.find('.stamp-moe-type').text(m.bdtDeviceCategory);
|
|
|
+ if(_type === 'bp') {
|
|
|
+ stamp.find('.stamp-moe-value').text(m.sbpMmHg + '/' + m.dbpMmHg + ' mmHg');
|
|
|
+ }
|
|
|
+ else if(_type === 'weight') {
|
|
|
+ stamp.find('.stamp-moe-value').text(m.numericValue + ' lbs');
|
|
|
+ }
|
|
|
+ stamp.find('.stamp-moe-date-time').text(m.date_display + ' ' + m.time_display);
|
|
|
+ stamp.find('form').attr('hook', 'refresh-' + _careMonthUid + '_' + _type);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ stamp = $('<div class="d-flex align-items-baseline text-secondary" />');
|
|
|
+ stamp.append('<i class="fa fa-check" />');
|
|
|
+ stamp.append('<span class="ml-1">Stamped</span>');
|
|
|
+ }
|
|
|
+ @elseif($viewingAs === 'ADMIN')
|
|
|
+ stamp = $('<div class="d-flex align-items-baseline flex-nowrap" />');
|
|
|
+ if(!m.hasBeenStampedByMcp) {
|
|
|
+ stamp.append('<i class="fa fa-circle text-sm opacity-35 text-danger"></i>');
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ stamp.append('<i class="fa fa-circle text-sm opacity-35 text-success"></i>');
|
|
|
+ }
|
|
|
+ stamp.append('<span class="ml-1 mr-2 text-sm">MCP</span>');
|
|
|
+ if(!m.hasBeenStampedByRmm) {
|
|
|
+ stamp.append('<i class="fa fa-circle text-sm opacity-35 text-danger"></i>');
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ stamp.append('<i class="fa fa-circle text-sm opacity-35 text-success"></i>');
|
|
|
+ }
|
|
|
+ stamp.append('<span class="ml-1 text-sm">RMM</span>');
|
|
|
+ @endif
|
|
|
+
|
|
|
+ $('<td/>').append(stamp).appendTo(tr);
|
|
|
+
|
|
|
+ tr.appendTo(tbody);
|
|
|
+ }
|
|
|
+ initMoes();
|
|
|
}
|
|
|
|
|
|
addMCInitializer('practice-rpm-manager', init, '#practice-rpm-manager');
|