瀏覽代碼

Canvas Rx - edit mode strength autocomplete fix

Vijayakrishnan 4 年之前
父節點
當前提交
9af6b84417
共有 1 個文件被更改,包括 13 次插入0 次删除
  1. 13 0
      resources/views/app/patient/canvas-sections/rx/form.blade.php

+ 13 - 0
resources/views/app/patient/canvas-sections/rx/form.blade.php

@@ -274,6 +274,19 @@ $formID = rand(0, 100000);
                             });
                             $(elem).attr('ac-initialized', 1);
                             $(strengthElem).attr('ac-initialized', 1);
+
+                            // if medication already filled, fetch and set strenths autocomplete
+                            if($.trim($(this).val()) !== '') {
+                                $.get('https://clinicaltables.nlm.nih.gov/api/rxterms/v3/search?' +
+                                    'terms=' + encodeURIComponent($.trim($(this).val())) +
+                                    '&maxList=1' +
+                                    '&ef=STRENGTHS_AND_FORMS', _data => {
+                                    console.log('ALIX', _data);
+                                    if(_data && _data.length >= 1 && _data[2].STRENGTHS_AND_FORMS && _data[2].STRENGTHS_AND_FORMS[0]) {
+                                        strengthElem.autocomp.setListAndField(_data[2].STRENGTHS_AND_FORMS[0], '', true);
+                                    }
+                                }, 'json');
+                            }
                         });
                     },
                     isFavorite: function(_item) {