Files
streamline-emr/docker/streamline-src/Modules/Patients/Resources/views/allergies/header_fin.blade.php
T
alec.turner a424394109 Build modified streamline images
The official image from streamline does not currently work for the arm64
platform. As a temporary measure, the source code and docker build scripts
have been lifted from the official images and are used to build locally.

Some additional modifications are made to reduce overall image size, these
are documented in docker/README.md
2024-03-10 16:17:50 -07:00

395 lines
20 KiB
PHP
Executable File

@if (session()->has('patient_id') || session()->has('patients_id'))
@endif
@push('scripts')
<script src="{{ asset('js/allergies/scripts.js') }}"></script>
@endpush
@push('styles')
<style type="text/css">
/* Important part used by allergies */
.allergy-modal-dialog{
overflow-y: initial !important
}
.allergy-modal-body{
height: 250px;
overflow-y: auto;
}
@media (min-width: 768px) {
.allergy-modal-dialog {
width: 90%;
max-width:1200px;
}
}
</style>
@endpush
@php
$known_patient_allergies = \Streamline\Models\Allergy::where('patient_id' , $patient->id)->orderBy('created_at','desc')->take(2)->get();
$known_patient_alerts = \Streamline\Models\Alert::where('patient_id' , $patient->id)->orderBy('created_at','desc')->take(2)->get();
$categories = \Streamline\Models\PatientCategory::pluck("name", "id");
$drug_categories_array = DB::table('drug_categories')->pluck('name', 'id');
$drug_categories = \Streamline\Models\DrugCategory::orderBy('name', 'asc')->get();
@endphp
<div class="row">
<div class="col-sm-4">
<div class="modal fade" id="modal-allergies" tabindex="-1" role="dialog" aria-labelledby="modal-allergiesLabel1">
<div class="modal-dialog modal-lg allergy-modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modal-allergiesLabel1">{{ __('allergies.add_allergies_patient') }}</h4>
</div>
<div class="modal-body allergy-modal-body">
<div class="container-fluid">
<div class="row">
<div class="col-md-4">
<h5>{{ __('allergies.currently_known') }}</h5>
<div id="known_allergies" style="background-color: #e4e7ea">
<ul class="row">
@php $allergic_drugs_ids_array = []; @endphp
@if(count($known_patient_allergies) > 0 )
@foreach($known_patient_allergies as $allergy)
@php
$allergic_drugs_ids_array = explode(',' , $allergy->names);
@endphp
@for($i=0 ; $i < count($allergic_drugs_ids_array) ; $i++)
{{-- @if($i == 0 || $i == 1 || $i == 2)--}}
<li>
{{ isset($drug_categories_array[$allergic_drugs_ids_array[$i]]) ? $drug_categories_array[$allergic_drugs_ids_array[$i]] : 'N/A' }}
</li>
{{-- @endif--}}
@endfor
@endforeach
@endif
</ul>
</div>
</div>
</div>
<div class="row">
<form>
<h5>{{ __('allergies.allergic_reactions') }}</h5>
@foreach($drug_categories->chunk(9) as $chunk)
@foreach($chunk as $drug_category)
<div class="col-md-4">
<!-- if it is a known allergy then check the checkbox -->
@if(in_array($drug_category->id,$allergic_drugs_ids_array))
<input class='patient_allergies' name='allergies[]' type='checkbox' checked="true" value='{{ $drug_category->id }}'/> {{ $drug_category->name }}
@else
<input class='patient_allergies' name='allergies[]' type='checkbox' value='{{ $drug_category->id }}'/> {{ $drug_category->name }}
@endif
<br/>
</div>
@endforeach
@endforeach
<!-- <hr> -->
<input type="hidden" id="allergy_patient_id" name="allergy_patient_id" value="<?php echo $patient->id; ?>">
<!-- <button type="button" id="submit_allergies" class="btn btn-success btn-sm">Submit Allergies</button>
<div class="separator bottom"></div>
<form> -->
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" id="submit_allergies" class="btn btn-success btn-sm">{{ __('allergies.submit_allergies') }}</button>
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">{{ __('allergies.close') }}</button>
</form>
</div>
</div>
</div>
</div>
<div class="panel" style="border-radius: 5px; height: 155px;">
<div class="panel-body">
<div class="row">
<div class="col-sm-6 text-left">
<span style="line-height: 10px; font-size: 14px; margin-top: -10px; margin-right: -10px;">
<strong>{{ __('allergies.allergies') }}</strong> <label class="label label-danger" style="color: white; background-color: red">({{ $allergic_drugs_ids_array?count($allergic_drugs_ids_array):"0"}})</label>
</span>
</div>
<div class="col-sm-6 text-right">
<div class="button-box">
<button type="button" class="btn btn-success btn-rounded btn-sm" data-toggle="modal"
data-target="#modal-allergies" style="line-height: 10px; font-size: 11px; margin-right: -10px;">
{{ __('allergies.add') }} <i class="fa fa-plus-circle"></i>
</button>
</div>
</div>
</div>
<br/>
<div class="row">
<div class="col-sm-12">
@if(count($allergic_drugs_ids_array) > 0)
@php $count = (count($allergic_drugs_ids_array) > 2) ? 2 : count($allergic_drugs_ids_array); @endphp
@for($i=0 ; $i < $count ; $i++)
<label class="label label-danger" style="margin: 5px;">
{{ isset($drug_categories_array[$allergic_drugs_ids_array[$i]]) ? $drug_categories_array[$allergic_drugs_ids_array[$i]] : "" }}
</label>
@endfor
<br/>
{!! count($allergic_drugs_ids_array) > 2 ? '<br/><a href="/allergies"><label class="label label-info pull-right"><i class="fa fa-eye"></i> view all</label></a>' : '' !!}
@else
<div class="label label-danger">{{ __('allergies.no_allergy_added') }}</div>
@endif
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="panel" style="border-radius: 5px; height: 155px;">
<div class="panel-body">
<div class="row">
<div class="col-sm-6 text-left">
<span style="line-height: 10px; font-size: 14px; margin-top: -10px; margin-right: -10px;">
<strong>{{ __('allergies.alerts') }}</strong> <label class="label label-info" style="color: white; background-color: red;">({{ $known_patient_alerts?count($known_patient_alerts):""}})</label>
</span>
</div>
<div class="col-sm-6 text-right">
<div class="button-box">
<button type="button" class="btn btn-success btn-rounded btn-sm" data-toggle="modal" data-target="#modal-alerts"
style="line-height: 10px; font-size: 11px; margin-right: -10px;">
{{ __('allergies.add') }} <i class="fa fa-plus-circle"></i>
</button>
</div>
</div>
</div>
<div class="modal fade" id="modal-alerts" tabindex="-1" role="dialog" aria-labelledby="modal-alertsLabel1">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="modal-alertsLabel1">{{ __('allergies.alerts_for_patient') }}</h4>
</div>
<div class="modal-body">
<form>
<input type="hidden" id="alert_patient_id" name="alert_patient_id" value="{{ $patient->id }}">
<div class="control-group">
<label for="alerts">{{ __('allergies.enter_alert') }}</label>
<div class="controls">
<textarea name="alerts" id="alerts" maxlength="150" class="form-control col-sm-12"></textarea>
</div>
</div><br>
<input type="submit" id="submit_alerts" class = "btn btn-success btn-sm" value="{{ __('allergies.submit_alert') }}" />
<div class="separator bottom"></div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal">{{ __('allergies.close') }}</button>
</div>
</div>
</div>
</div>
<br/>
<div class="row">
<div class="col-sm-12">
@if(isset($known_patient_alerts) && count($known_patient_alerts) > 0)
@foreach($known_patient_alerts as $alert)
<label class="label label-danger" style="margin: 5px;">
{{ $alert->alerts }}
</label>
@endforeach
@else
<div class="label label-sm label-danger btn-rounded">{{ __('allergies.no_recorded_alerts') }}</div>
@endif
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-4">
<div class="panel" style="border-radius: 5px; height: 155px;">
<div class="panel-body">
<div class="row">
<div class="col-sm-6 text-left">
<span style="line-height: 10px; font-size: 14px; margin-top: -10px; margin-right: -10px;">
<strong>{{ __('allergies.documents') }}</strong> <label class="label label-info" style="color: white; background-color: red;">({{ $documents?count($documents):""}})</label>
</span>
</div>
<div class="col-sm-6 text-right">
<div class="button-box">
<a type="button" class="btn btn-success btn-rounded btn-sm" href="{{ route('patient_documents.index') }}"
style="line-height: 10px; font-size: 11px; margin-top: -10px; margin-right: -10px;">
{{ __('allergies.add') }} <i class="fa fa-plus-circle"></i>
</a>
</div>
</div>
</div>
<br/>
<div class="row">
<div class="col-sm-12">
@if(count($documents) > 0)
<label class="label label-danger" style="margin: 5px;">{{ count($documents) }} {{ __('allergies.documents_attached') }}.</label>
<br/>
<br/>
<a href="#" onclick="go()" style="font: blue; cursor: pointer; font-weight: bold;">
<label class="label label-info pull-right"><i class="fa fa-eye"></i> {{ __('allergies.view_all') }}</label>
</a>
@else
<div class="label label-danger">{{ __('allergies.no_document_added') }}</div>
@endif
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal-success-save1" tabindex="-1" role="dialog" aria-labelledby="modal-successLabel1">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-body">
{{ __('allergies.allergies_for_patient') }}<br>
<div class="control-group" style="vertical-align: center;">
<div class="controls">
<button type="button" class="btn btn-success" data-dismiss="modal">{{ __('allergies.ok') }}</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modal-success-save2" tabindex="-1" role="dialog" aria-labelledby="modal-successLabel1">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
<div class="modal-body">
{{ __('allergies.alerts_for_patient') }}<br>
<div class="control-group" style="vertical-align: center;">
<div class="controls">
<button type="button" class="btn btn-success" data-dismiss="modal">{{ __('allergies.ok') }}</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="all_allergies_modal" tabindex="-1" role="dialog" aria-labelledby="modal-successLabel1">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<ul class="row">
@php
$allergy_count = count($allergic_drugs_ids_array);
@endphp
@for($i=0 ; $i < $allergy_count ; $i++)
<li class="col-sm-3">
<small>{{ isset($drug_categories_array[$allergic_drugs_ids_array[$i]]) ? $drug_categories_array[$allergic_drugs_ids_array[$i]] : "" }}</small>
</li>
@endfor
</ul>
</div>
</div>
<div class="modal-footer">
<div class="control-group" style="vertical-align: center;">
<div class="controls">
<button type="button" class="btn btn-success" data-dismiss="modal">{{ __('allergies.ok') }}</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@push('scripts')
<script type="text/javascript">
$('#submit_allergies').click(function(e) {
e.preventDefault();
$('#modal-allergies').modal('hide');
var patient_allergies = new Array();
//loop thru the checked allergies and push them into an array
$('input[name="allergies[]"]:checked').each(function() {
patient_allergies.push(this.value);
});
var allergy_patient_id = $('#allergy_patient_id').val();
$.ajax({
type: 'POST',
url: '/store_patient_allergies',
data: {patient_allergies:patient_allergies, allergy_patient_id:allergy_patient_id},
cache: false,
success: function (response) {
//display success notification modal
$('#modal-success-save1').modal('show');
var allergic_drugs_ids_array = {!! json_encode($allergic_drugs_ids_array) !!};
var drug_categories_array = {!! json_encode($drug_categories_array) !!}
var listElements = "";
for(var i=0 ; i < patient_allergies.length ; i++){
listElements += "<li>"+drug_categories_array[patient_allergies[i]]+"</li>";
}
$('#allergies_drugs_list').html(listElements);//list theh checked items after selecting
$('#known_allergies').html(listElements);
$('input[name="allergies[]"]').each(function() {//loop through allergies and recheck values
if(jQuery.inArray(this.value, patient_allergies) !== -1){
$(this).prop('checked', true);
} else {
$(this).prop('checked', false);
}
});
}
});
});
/* submit alert */
$('#submit_alerts').click(function(e) {
e.preventDefault();
$('#modal-alerts').modal('hide');
var alertListElements = "";
var alert_patient_id = $('#alert_patient_id').val();
var patient_alerts = $('#alerts').val();
alertListElements += "<small><li>"+ patient_alerts +"</li></small>";
$.ajax({
type: 'POST',
url: '/store_patient_alerts',
data: {patient_alerts:patient_alerts, alert_patient_id:alert_patient_id},
cache: false,
success: function (response) {
//display success notification modal
$('#modal-success-save2').modal('show');
var known_patient_alerts = {!! json_encode($known_patient_alerts) !!};
for(var alert in known_patient_alerts){
var patient_alert_object = known_patient_alerts[alert];
for (var key in patient_alert_object) {
if (patient_alert_object.hasOwnProperty(key)) {
if (key === "alerts") {
alertListElements += "<small><li>"+ patient_alert_object[key] +"</li></small>";
}
}
}
}
console.log(alertListElements);
$('#known_alerts_list').html(alertListElements);
}
});
});
</script>
@endpush