Browse Source

Template updates in subjective

Vijayakrishnan Krishnan 4 years ago
parent
commit
81fad3b5cb

+ 5 - 3
resources/views/app/patient/note/dashboard.blade.php

@@ -699,13 +699,15 @@
             function generateOutputForNode(_node) {
                 let template = (_node.attr('prefix') ? _node.attr('prefix') : '') + _node.attr('template'),
                     value = template;
-                if(value.indexOf('{text}') !== -1) {
+                let hasChildText = !!_node.find('>.note-template-children>textarea,>.note-template-children>input[type="number"],>.note-template-children>input[type="date"]').length;
+                let hasChildren = !!_node.find('>.note-template-children>.note-template-item').length;
+                if(hasChildText) {
                     value = value.replace('{text}',
                         _node
                             .find('>.note-template-children')
                                 .find('>textarea,>input[type="number"],>input[type="date"]').first().val());
                 }
-                else if(value.indexOf('{children}') !== -1) {
+                else if(hasChildren) {
                     let values = [];
                     _node.find('>.note-template-children>.note-template-item.selected').each(function() {
                         values.push(generateOutputForNode($(this)));
@@ -722,7 +724,7 @@
                             }
                         }
                     }
-                    value = value.replace('{children}', ' ' + combined);
+                    value = value.replace('{children}', ' ' + combined).replace('{text}', ' ' + combined);
                 }
                 return value;
             }

+ 2 - 2
storage/templates/subjective/constipation.json

@@ -188,7 +188,7 @@
                 },
                 {
                     "text": "Severity scale (0-10)",
-                    "template": "out of 10 on pain scale",
+                    "template": "{children} out of 10 on pain scale",
                     "children": [
                         {
                             "text": "0 (no pain)",
@@ -1139,4 +1139,4 @@
             ]
         }
     ]
-}
+}

+ 2 - 2
storage/templates/subjective/gerd.json

@@ -260,7 +260,7 @@
                 },
                 {
                     "text": "Severity scale (0-10)",
-                    "template": "out of 10 on pain scale",
+                    "template": "{children} out of 10 on pain scale",
                     "children": [
                         {
                             "text": "0 (no pain)",
@@ -1093,4 +1093,4 @@
             ]
         }
     ]
-}
+}

+ 2 - 2
storage/templates/subjective/headache.json

@@ -495,7 +495,7 @@
                 },
                 {
                     "text": "Severity scale (0-10)",
-                    "template": "out of 10",
+                    "template": "{children} out of 10",
                     "children": [
                         {
                             "text": "0 (no pain)",
@@ -2439,4 +2439,4 @@
             ]
         }
     ]
-}
+}

+ 2 - 2
storage/templates/subjective/migraine.json

@@ -495,7 +495,7 @@
                 },
                 {
                     "text": "Severity scale (0-10)",
-                    "template": "out of 10",
+                    "template": "{children} out of 10",
                     "children": [
                         {
                             "text": "0 (no pain)",
@@ -2403,4 +2403,4 @@
             ]
         }
     ]
-}
+}

+ 2 - 2
storage/templates/subjective/otitis-externa.json

@@ -116,7 +116,7 @@
                 },
                 {
                     "text": "severity scale (0-10)",
-                    "template": "out of 10",
+                    "template": "{children} out of 10",
                     "children": [
                         {
                             "text": "0 (no pain)",
@@ -627,4 +627,4 @@
             ]
         }
     ]
-}
+}

+ 2 - 2
storage/templates/subjective/otitis-media-acute.json

@@ -117,7 +117,7 @@
                 },
                 {
                     "text": "severity scale (0-10)",
-                    "template": "out of 10",
+                    "template": "{children} out of 10",
                     "children": [
                         {
                             "text": "0 (no pain)",
@@ -804,4 +804,4 @@
             ]
         }
     ]
-}
+}