|
@@ -26,69 +26,60 @@ if (!!@$point->data) {
|
|
|
|
|
|
if(!$contentData) {
|
|
|
$contentData = [
|
|
|
- "heightInInches" => [
|
|
|
- "label" => "Ht. (in.)",
|
|
|
- "value" => "",
|
|
|
- "date" => date('Y-m-d'),
|
|
|
- ],
|
|
|
- "weightPounds" => [
|
|
|
- "label" => "Wt. (lbs.)",
|
|
|
- "value" => "",
|
|
|
- "date" => date('Y-m-d'),
|
|
|
- ],
|
|
|
- "temperatureF" => [
|
|
|
- "label" => "Temp. (F)",
|
|
|
- "value" => "",
|
|
|
- "date" => date('Y-m-d'),
|
|
|
- ],
|
|
|
- "systolicBP" => [
|
|
|
- "label" => "SBP",
|
|
|
- "value" => "",
|
|
|
- "date" => date('Y-m-d'),
|
|
|
- ],
|
|
|
- "diastolicBP" => [
|
|
|
- "label" => "DBP",
|
|
|
- "value" => "",
|
|
|
- "date" => date('Y-m-d'),
|
|
|
- ],
|
|
|
- "pulseRatePerMinute" => [
|
|
|
- "label" => "Pulse",
|
|
|
- "value" => "",
|
|
|
- "date" => date('Y-m-d'),
|
|
|
- ],
|
|
|
- "respirationRatePerMinute" => [
|
|
|
- "label" => "Resp.",
|
|
|
- "value" => "",
|
|
|
- "date" => date('Y-m-d'),
|
|
|
- ],
|
|
|
- "pulseOx" => [
|
|
|
- "label" => "Pulse Ox.",
|
|
|
- "value" => "",
|
|
|
- "date" => date('Y-m-d'),
|
|
|
- ],
|
|
|
- "smokingStatus" => [
|
|
|
- "label" => "Smoking Status",
|
|
|
- "value" => "",
|
|
|
- "date" => date('Y-m-d'),
|
|
|
- ],
|
|
|
- "bmi" => [
|
|
|
- "label" => "BMI (kg/m²)",
|
|
|
- "value" => "",
|
|
|
- "date" => date('Y-m-d'),
|
|
|
- ],
|
|
|
+ "date" => $note->effective_dateest,
|
|
|
+ "heightInInches" => '',
|
|
|
+ "weightPounds" => '',
|
|
|
+ "temperatureF" => '',
|
|
|
+ "systolicBP" => '',
|
|
|
+ "diastolicBP" => '',
|
|
|
+ "pulseRatePerMinute" => '',
|
|
|
+ "respirationRatePerMinute" => '',
|
|
|
+ "pulseOx" => '',
|
|
|
+ "smokingStatus" => '',
|
|
|
+ "bmi" => '',
|
|
|
];
|
|
|
}else {
|
|
|
+ if(!isset($contentData['date'])) $contentData['date'] = $note->effective_dateest;
|
|
|
foreach ($vitalLabels as $k => $v) {
|
|
|
- if (!isset($contentData[$k])) {
|
|
|
- $contentData[$k] = [
|
|
|
- "label" => $v,
|
|
|
- "value" => "",
|
|
|
- "date" => date('Y-m-d'),
|
|
|
- ];
|
|
|
+ if (!isset($contentData[$k]) || is_array($contentData[$k])) {
|
|
|
+ $contentData[$k] = '';
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+$previousVitals = Point::where('client_id', $patient->id)
|
|
|
+ ->where('added_in_segment_id', '<>', $segment->id)
|
|
|
+ ->where('category', $category)
|
|
|
+ ->orderBy('id', 'DESC')
|
|
|
+ ->limit(4)
|
|
|
+ ->get();
|
|
|
+
|
|
|
+// convert to new format
|
|
|
+$previousData = [];
|
|
|
+$previousDataAssoc = [];
|
|
|
+foreach ($previousVitals as $p) {
|
|
|
+ if (!!@$p->data) {
|
|
|
+ $parsedP = json_decode($p->data, true);
|
|
|
+ $newFormat = [];
|
|
|
+ foreach ($vitalLabels as $k => $v) {
|
|
|
+ if (isset($parsedP[$k]) && is_array($parsedP[$k]) && isset($parsedP[$k]['value'])) {
|
|
|
+ $newFormat[$k] = $parsedP[$k]['value'];
|
|
|
+ }
|
|
|
+ else if(isset($parsedP[$k]) && !is_array($parsedP[$k])) {
|
|
|
+ $newFormat[$k] = $parsedP[$k];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $newFormat[$k] = '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $newFormat['date'] = $p->note->effective_dateest;
|
|
|
+ $previousData[] = $newFormat;
|
|
|
+ $previousDataAssoc[$newFormat['date']] = $newFormat; // for easy iter to cols
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+$copyTriggerAdded = [];
|
|
|
+
|
|
|
?>
|
|
|
<div visit-moe close-on-save close-on-cancel class="d-block">
|
|
|
<form show url="/api/visitPoint/<?= $endPoint ?>" class="mcp-theme-1">
|
|
@@ -100,8 +91,16 @@ if(!$contentData) {
|
|
|
<thead>
|
|
|
<tr class="bg-light">
|
|
|
<th class="px-2 text-secondary border-bottom-0 w-25">Vital</th>
|
|
|
- <th class="px-2 text-secondary border-bottom-0 w-35">Value</th>
|
|
|
- <th class="px-2 text-secondary border-bottom-0">Date</th>
|
|
|
+ <th class="px-2 text-secondary border-bottom-0 w-25">{{$contentData['date']}}</th>
|
|
|
+ @if(!$previousData || !count($previousData))
|
|
|
+ <th class="px-2 text-secondary border-bottom-0">Previous</th>
|
|
|
+ @else
|
|
|
+ @foreach($previousData as $pDay)
|
|
|
+ <th class="px-2 text-secondary border-bottom-0 on-hover-opaque position-relative">
|
|
|
+ {{$pDay['date']}}
|
|
|
+ </th>
|
|
|
+ @endforeach
|
|
|
+ @endif
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tbody>
|
|
@@ -109,17 +108,17 @@ if(!$contentData) {
|
|
|
<tr>
|
|
|
<td>
|
|
|
<input type="text" tabindex="-1"
|
|
|
- class="form-control form-control-sm events-none"
|
|
|
+ class="form-control form-control-sm events-none border-0"
|
|
|
value="{{ $v }}" readonly>
|
|
|
</td>
|
|
|
<td class="position-relative">
|
|
|
@if($k === "bmi")
|
|
|
<input type="text" readonly bmi
|
|
|
- class="form-control form-control-sm vitals-title"
|
|
|
- data-name="bmi->value" value="{{$contentData['bmi']['value']}}">
|
|
|
- @if(isset($contentData['bmi']['value']) && $contentData['bmi']['value'] != "" )
|
|
|
+ class="form-control form-control-sm vitals-title border-bottom border-top-0 border-left-0 border-right-0"
|
|
|
+ data-name="bmi" value="{{$contentData['bmi']}}">
|
|
|
+ @if(isset($contentData['bmi']) && $contentData['bmi'] != "" )
|
|
|
<p class="py-1 m-0 px-2 font-weight-bold bg-white">
|
|
|
- <?php $bmi = $contentData['bmi']['value']; ?>
|
|
|
+ <?php $bmi = $contentData['bmi']; ?>
|
|
|
@if($bmi < 18.5)
|
|
|
<span class="text-sm text-warning-mellow" v-if="+bmi < 18.5">Underweight</span>
|
|
|
@endif
|
|
@@ -136,24 +135,32 @@ if(!$contentData) {
|
|
|
@endif
|
|
|
@elseif($k === "smokingStatus")
|
|
|
<input type="text"
|
|
|
- class="form-control form-control-sm"
|
|
|
- data-name="smokingStatus->value"
|
|
|
- data-option-list="smokingStatus" value="{{$contentData['smokingStatus']['value']}}">
|
|
|
+ class="form-control form-control-sm border-0"
|
|
|
+ data-name="smokingStatus"
|
|
|
+ data-option-list="smokingStatus" value="{{$contentData['smokingStatus']}}">
|
|
|
<div id="smoking-status-options" class="data-option-list">
|
|
|
<div>Current</div>
|
|
|
<div>Former</div>
|
|
|
<div>Never</div>
|
|
|
</div>
|
|
|
@else
|
|
|
- <input type="text" class="form-control form-control-sm" data-name="{{$k}}->value" {{$k}} value="{{$contentData[$k]['value']}}"
|
|
|
+ <input type="text" class="form-control form-control-sm border-0" data-name="{{$k}}" {{$k}} value="{{$contentData[$k]}}"
|
|
|
@if($k == 'heightInInches' || $k == 'weightPounds') refresh-bmi @endif>
|
|
|
@endif
|
|
|
</td>
|
|
|
- <td>
|
|
|
- <input type="date" @if($k == 'bmi') bmi-date @endif @if($k == 'weightPounds') weight-date refresh-bmi @endif {{ $k === 'bmi' ? 'readonly' : '' }}
|
|
|
- class="form-control form-control-sm vitals-title"
|
|
|
- data-name="{{$k}}->date" value="{{$contentData[$k]['date']}}">
|
|
|
- </td>
|
|
|
+ @if(!$previousData || !count($previousData))
|
|
|
+ <td class="bg-light"></td>
|
|
|
+ @else
|
|
|
+ @foreach($previousData as $pDay)
|
|
|
+ <td class="bg-light {{!isset($copyTriggerAdded[$k]) ? 'pl-4 pr-2' : 'px-2'}} py-1 text-secondary position-relative">
|
|
|
+ {{$previousDataAssoc[$pDay['date']][$k] ?: '-' }}
|
|
|
+ @if(!isset($copyTriggerAdded[$k]) && $k !== "bmi")
|
|
|
+ <a href="#" title="Copy to this note" class="vitals-copy-trigger"><i class="fa fa-chevron-circle-left font-size-14"></i></a>
|
|
|
+ @endif
|
|
|
+ </td>
|
|
|
+ <?php $copyTriggerAdded[$k] = true ?>
|
|
|
+ @endforeach
|
|
|
+ @endif
|
|
|
</tr>
|
|
|
@endforeach
|
|
|
</tbody>
|
|
@@ -165,14 +172,24 @@ if(!$contentData) {
|
|
|
</form>
|
|
|
</div>
|
|
|
<script>
|
|
|
- window.segmentInitializers.<?= $segment->segmentTemplate->internal_name ?> = function() {
|
|
|
- $('[refresh-bmi]').off('change');
|
|
|
- $('[refresh-bmi]').on('change', function(){
|
|
|
- var height = parseInt($('[heightInInches]').val());
|
|
|
- var weight = parseInt($('[weightPounds]').val());
|
|
|
- var bmi = Math.round((weight /(height*height)) * 703.06957964)
|
|
|
- $('[bmi]').val(bmi);
|
|
|
- $('[bmi-date]').val($('[weight-date]').val());
|
|
|
- })
|
|
|
+ window.segmentInitializers.<?= $segment->segmentTemplate->internal_name ?> = function () {
|
|
|
+ let parentSegment = $('[data-segment-template-name="<?= $segment->segmentTemplate->internal_name ?>"] ');
|
|
|
+
|
|
|
+ parentSegment.find('[refresh-bmi]').off('change input');
|
|
|
+ parentSegment.find('[refresh-bmi]').on('change input', function () {
|
|
|
+ var height = parseInt(parentSegment.find('[heightInInches]').val());
|
|
|
+ var weight = parseInt(parentSegment.find('[weightPounds]').val());
|
|
|
+ var bmi = Math.round((weight / (height * height)) * 703.06957964)
|
|
|
+ parentSegment.find('[bmi]').val(bmi);
|
|
|
+ parentSegment.find('[bmi-date]').val(parentSegment.find('[weight-date]').val());
|
|
|
+ });
|
|
|
+
|
|
|
+ parentSegment.find('.vitals-copy-trigger').off('click.copy-vital');
|
|
|
+ parentSegment.find('.vitals-copy-trigger').on('click.copy-vital', function () {
|
|
|
+ let td = $(this).closest('td');
|
|
|
+ td.prev().find('input').val($.trim(td.text())).trigger('change');
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+
|
|
|
};
|
|
|
</script>
|