|
@@ -1 +1,308 @@
|
|
-<h1>Edit for past_medical_history</h1>
|
|
|
|
|
|
+<?php
|
|
|
|
+use App\Models\Client;
|
|
|
|
+use App\Models\Note;
|
|
|
|
+use App\Models\Point;
|
|
|
|
+use App\Models\Pro;
|
|
|
|
+/** @var Client $patient */
|
|
|
|
+/** @var Note $note */
|
|
|
|
+/** @var Point $point */
|
|
|
|
+/** @var Pro $pro */
|
|
|
|
+
|
|
|
|
+$fields = [
|
|
|
|
+ [
|
|
|
|
+ "Head" => ["Trauma"],
|
|
|
|
+ "Eyes" => ["Blindness", "Cataracts", "Glaucoma", "Wears glasses/contacts"],
|
|
|
|
+ "Ears" => ["Hearing aids"],
|
|
|
|
+ "Nose/Sinuses" => ["Allergic Rhinitis", "Sinus infections"],
|
|
|
|
+ "Mouth/Throat/Teeth" => ["Dentures"],
|
|
|
|
+ "Cardiovascular" => ["Aneurysm", "Angina", "DVT", "Dysrhythmia", "HTN", "Murmur", "Myocardial infarction", "Other heart disease"],
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ "Respiratory" => ["Asthma", "Bronchitis", "COPD - Bronchitis/Emphysema", "Pleuritis", "Pneumonia"],
|
|
|
|
+ "Gastrointestinal" => ["Cirrhosis", "GERD", "Gallbladder disease", "Heartburn", "Hemorrhoids", "Hepatitis", "Hiatal hernia", "Jaundice", "Ulcer"],
|
|
|
|
+ "Genitourinary" => ["Hernia", "Incontinence", "Nephrolithiasis", "Other kidney disease", "STDs", "UTI(s)"],
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ "Musculoskeletal" => ["Arthritis", "Gout", "M/S injury"],
|
|
|
|
+ "Skin" => ["Dermatitis", "Mole(s)", "Other skin condition(s)", "Psoriasis"],
|
|
|
|
+ "Neurological" => ["Epilepsy", "Seizures", "Severe headaches, migraines", "Stroke", "TIA"],
|
|
|
|
+ "Psychiatric" => ["Bipolar disorder", "Depression", "Hallucinations, delusions", "Suicidal ideation", "Suicide attempts"],
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ "Endocrine" => ["Goiter", "Hyperlipidemia", "Hypothyroidism", "Thyroid disease", "Thyroiditis", "Type I DM", "Type II DM"],
|
|
|
|
+ "Heme/Onc" => ["Anemia", "Cancer"],
|
|
|
|
+ "Infectious" => ["HIV", "STDs", "Tuberculosis (dz)", "Tuberculosis (exposure)"],
|
|
|
|
+ ]
|
|
|
|
+];
|
|
|
|
+
|
|
|
|
+$customFields = $pro->canvasCustomItems('pmhx');
|
|
|
|
+$customFields = array_map(function($_item) {
|
|
|
|
+ return $_item['label'];
|
|
|
|
+}, $customFields->toArray());
|
|
|
|
+
|
|
|
|
+if(!$customFields) {
|
|
|
|
+ $customFields = [];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+$point = Point::getGlobalSingletonOfCategory($patient, 'PAST_MEDICAL_HISTORY', true);
|
|
|
|
+
|
|
|
|
+$contentData = $parsed = false;
|
|
|
|
+
|
|
|
|
+if ($point && @$point->data) {
|
|
|
|
+ $contentData = $parsed = $point->data;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+if(!$contentData) {
|
|
|
|
+ $contentData = [
|
|
|
|
+ "bloodType" => "",
|
|
|
|
+ "bloodRH" => "",
|
|
|
|
+ "common" => [],
|
|
|
|
+ "custom" => [],
|
|
|
|
+ "comments" => "",
|
|
|
|
+ ];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+for ($i = 0; $i < count($fields); $i++) {
|
|
|
|
+ foreach($fields[$i] as $head => $values) {
|
|
|
|
+ for($k = 0; $k < count($values); $k++) {
|
|
|
|
+ $fName = $head . '_' . sanitize_field_name($values[$k]);
|
|
|
|
+ if(!isset($contentData["common"][$fName])) $contentData["common"][$fName] = null;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+?>
|
|
|
|
+<div class="p-3 border-top mt-3 mcp-theme-1">
|
|
|
|
+ <div visit-moe close-on-save close-on-cancel class="d-block">
|
|
|
|
+ <form show url="/api/visitPoint/upsertGlobalSingleton" class="mcp-theme-1">
|
|
|
|
+ <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
|
|
|
|
+ <input type="hidden" name="category" value="PAST_MEDICAL_HISTORY">
|
|
|
|
+ <input type="hidden" name="data">
|
|
|
|
+
|
|
|
|
+ <div id="edit-univ_history_past_medical-container">
|
|
|
|
+
|
|
|
|
+ <div class="mb-3 d-flex align-items-start">
|
|
|
|
+ <div class="width-100px mr-3">
|
|
|
|
+ <label class="text-secondary mb-1">Blood Type</label>
|
|
|
|
+ <select class="form-control form-control-sm width-100px" v-model="data.bloodType">
|
|
|
|
+ <option value=""> -- select -- </option>
|
|
|
|
+ <option value="A">A</option>
|
|
|
|
+ <option value="AB">AB</option>
|
|
|
|
+ <option value="B">B</option>
|
|
|
|
+ <option value="O">O</option>
|
|
|
|
+ </select>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="width-100px mr-3">
|
|
|
|
+ <label class="text-secondary mb-1">RH</label>
|
|
|
|
+ <select class="form-control form-control-sm width-100px" v-model="data.bloodRH">
|
|
|
|
+ <option value=""> -- select -- </option>
|
|
|
|
+ <option value="+ve">+ve</option>
|
|
|
|
+ <option value="-ve">-ve</option>
|
|
|
|
+ </select>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="row">
|
|
|
|
+ @for ($i = 0; $i < count($fields); $i++)
|
|
|
|
+ <div class="col-md-3">
|
|
|
|
+ @foreach($fields[$i] as $head => $values)
|
|
|
|
+ <div class="font-weight-bold mb-2">{{ $head }}</div>
|
|
|
|
+ <div class="mb-3">
|
|
|
|
+ @for($k = 0; $k < count($values); $k++)
|
|
|
|
+ <?php $fName = $head . '_' . sanitize_field_name($values[$k]); ?>
|
|
|
|
+ <label class="d-flex align-items-start mb-1">
|
|
|
|
+ <input type="checkbox" name="{{ $fName }}" class="m-0"
|
|
|
|
+ v-model="data.common['{{$fName}}']">
|
|
|
|
+ <div class="ml-2">
|
|
|
|
+ <div>
|
|
|
|
+ <span class="mr-2">{{ $values[$k] }}</span>
|
|
|
|
+ <div moe no-mask>
|
|
|
|
+ <a href="#" start show>
|
|
|
|
+ <i v-show="data.common['{{$fName}}']" class="fa-comment" :class="data.common['{{$fName}}__comments'] ? 'fas' : 'far'"></i>
|
|
|
|
+ </a>
|
|
|
|
+ <div url="/nop">
|
|
|
|
+ <div class="mb-2">
|
|
|
|
+ <textarea class="form-control form-control-sm ns-custom-comment min-width-200px"
|
|
|
|
+ v-model="data.common['{{$fName}}__comments']"></textarea>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="">
|
|
|
|
+ <button type="button" class="btn btn-sm btn-primary" cancel>Close
|
|
|
|
+ </button>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <span v-show="data.common['{{$fName}}'] && data.common['{{$fName}}__comments']"
|
|
|
|
+ v-html="data.common['{{$fName}}__comments']"
|
|
|
|
+ class="text-sm text-secondary">
|
|
|
|
+ </span>
|
|
|
|
+ </div>
|
|
|
|
+ </label>
|
|
|
|
+ @endfor
|
|
|
|
+ </div>
|
|
|
|
+ @endforeach
|
|
|
|
+ </div>
|
|
|
|
+ @endfor
|
|
|
|
+ </div>
|
|
|
|
+ <div class="row border-top pt-3">
|
|
|
|
+ <div class="col-12">
|
|
|
|
+ <div class="d-flex align-items-center mb-2">
|
|
|
|
+ <span class="font-weight-bold">Custom Items</span>
|
|
|
|
+ <span class="mx-2 text-secondary">|</span>
|
|
|
|
+ <div moe>
|
|
|
|
+ <a href="#" start show>Add</a>
|
|
|
|
+ <div custom-item-form url="/api/sectionTemplateCustomItem/create">
|
|
|
|
+ <div class="mb-2">
|
|
|
|
+ <input type="text" placeholder="Label"
|
|
|
|
+ v-model="data.newCustomItemLabel"
|
|
|
|
+ class="form-control form-control-sm label_new_custom_item">
|
|
|
|
+ </div>
|
|
|
|
+ <div>
|
|
|
|
+ <button type="button" class="btn btn-sm btn-primary mr-1"
|
|
|
|
+ v-on:click.prevent="saveCustomItem(data.newCustomItemLabel)">Submit</button>
|
|
|
|
+ <button type="button" class="btn btn-sm btn-default border"
|
|
|
|
+ v-on:click.prevent="cancelCustomItem()">Cancel</button>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ {{-- custom items --}}
|
|
|
|
+ <div class="d-flex align-items-start flex-wrap custom-items-container">
|
|
|
|
+ <div class="w-25" v-for="item in data.customFields">
|
|
|
|
+
|
|
|
|
+ <label class="d-flex align-items-start mb-1">
|
|
|
|
+ <input type="checkbox" class="m-0"
|
|
|
|
+ v-model="item.value">
|
|
|
|
+ <div class="ml-2">
|
|
|
|
+ <div>
|
|
|
|
+ <span class="mr-2">@{{ item.label }}</span>
|
|
|
|
+ <div moe no-mask>
|
|
|
|
+ <a href="#" start show>
|
|
|
|
+ <i v-show="item.value" class="fa-comment" :class="item.comments ? 'fas' : 'far'"></i>
|
|
|
|
+ </a>
|
|
|
|
+ <div url="/nop">
|
|
|
|
+ <div class="mb-2">
|
|
|
|
+ <textarea class="form-control form-control-sm ns-custom-comment min-width-200px" v-model="item.comments"></textarea>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="">
|
|
|
|
+ <button type="button" class="btn btn-sm btn-primary" cancel>Close</button>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <span v-show="item.value && item.comments"
|
|
|
|
+ v-html="item.comments"
|
|
|
|
+ class="text-sm text-secondary">
|
|
|
|
+ </span>
|
|
|
|
+ </div>
|
|
|
|
+ </label>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <hr class="m-neg-4">
|
|
|
|
+ <div class="mb-2">
|
|
|
|
+ <textarea class="form-control form-control-sm" v-model="data.comments">{!! $parsed && @$parsed->content ? @$parsed->content : '' !!}</textarea>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ <div>
|
|
|
|
+ <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
|
|
|
|
+ <button cancel class="btn btn-sm btn-default border">Cancel</button>
|
|
|
|
+ </div>
|
|
|
|
+ </form>
|
|
|
|
+ </div>
|
|
|
|
+</div>
|
|
|
|
+<script>
|
|
|
|
+ (function() {
|
|
|
|
+ window.segmentInitializers.<?= $segment->segmentTemplate->internal_name ?> = function() {
|
|
|
|
+ // any JS can come here
|
|
|
|
+ // will be run on page-load as well as whenever this segment is refreshed
|
|
|
|
+
|
|
|
|
+ let model = <?= $contentData ? json_encode($contentData) : '{}' ?>;
|
|
|
|
+ model.newCustomItemLabel = '';
|
|
|
|
+ let customFields = <?= json_encode($customFields) ?>;
|
|
|
|
+ if(!customFields) {
|
|
|
|
+ customFields = [];
|
|
|
|
+ }
|
|
|
|
+ model.customFields = [];
|
|
|
|
+ for (let i = 0; i < customFields.length; i++) {
|
|
|
|
+ let found = model.customFields.filter(function(_item) {
|
|
|
|
+ return _item.label === customFields[i];
|
|
|
|
+ }).length;
|
|
|
|
+ if(!found) {
|
|
|
|
+ model.customFields.push({
|
|
|
|
+ label: customFields[i],
|
|
|
|
+ value: '',
|
|
|
|
+ comments: '',
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ console.log(model);
|
|
|
|
+
|
|
|
|
+ new Vue({
|
|
|
|
+ el: '#edit-univ_history_past_medical-container',
|
|
|
|
+ delimiters: ["@{{","}}"],
|
|
|
|
+ data: {
|
|
|
|
+ data: model,
|
|
|
|
+ },
|
|
|
|
+ mounted: function() {
|
|
|
|
+ $('#edit-univ_history_past_medical-container [moe][initialized]').removeAttr('initialized');
|
|
|
|
+ initMoes();
|
|
|
|
+ },
|
|
|
|
+ watch: {
|
|
|
|
+ $data: {
|
|
|
|
+ handler: function(val, oldVal) {
|
|
|
|
+ let parent = $('#edit-univ_history_past_medical-container').closest('form');
|
|
|
|
+ parent.find('[name="data"]').val(JSON.stringify(this.data));
|
|
|
|
+ },
|
|
|
|
+ deep: true
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ saveCustomItem: function(_label) {
|
|
|
|
+ if(!_label) return false;
|
|
|
|
+ showMask();
|
|
|
|
+ let self = this;
|
|
|
|
+ $.post('/api/clientCanvasCustomItem/create', {
|
|
|
|
+ proUid: '{{ $pro->uid }}',
|
|
|
|
+ key: 'pmhx',
|
|
|
|
+ label: _label
|
|
|
|
+ }, function(_data) {
|
|
|
|
+ hideMask();
|
|
|
|
+ if(_data && _data.success) {
|
|
|
|
+ self.appendCustomItem(_label);
|
|
|
|
+ hideMoeFormMask();
|
|
|
|
+ $('[custom-item-form]').hide();
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ toastr.error(_data.message);
|
|
|
|
+ }
|
|
|
|
+ }, 'json')
|
|
|
|
+ return false;
|
|
|
|
+ },
|
|
|
|
+ cancelCustomItem: function() {
|
|
|
|
+ hideMoeFormMask();
|
|
|
|
+ $('div[moe]').hide();
|
|
|
|
+ return false;
|
|
|
|
+ },
|
|
|
|
+ appendCustomItem: function(_name) {
|
|
|
|
+ this.customFields.push({
|
|
|
|
+ label: _name,
|
|
|
|
+ value: '',
|
|
|
|
+ comments: '',
|
|
|
|
+ });
|
|
|
|
+ Vue.nextTick(function() {
|
|
|
|
+ $('.custom-items-container [moe][initialized]').removeAttr('initialized');
|
|
|
|
+ initMoes();
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ };
|
|
|
|
+ })();
|
|
|
|
+</script>
|