|
11 | 11 | if (smart.hasOwnProperty('patient')) {
|
12 | 12 | var patient = smart.patient;
|
13 | 13 | var pt = patient.read();
|
| 14 | + |
| 15 | + // var obv = smart.patient.api.fetchAll({ |
| 16 | + // type: 'Observation', |
| 17 | + // query: { |
| 18 | + // code: { |
| 19 | + // $or: ['http://loinc.org|8302-2', 'http://loinc.org|8462-4', |
| 20 | + // 'http://loinc.org|8480-6', 'http://loinc.org|2085-9', |
| 21 | + // 'http://loinc.org|2089-1', 'http://loinc.org|55284-4'] |
| 22 | + // } |
| 23 | + // } |
| 24 | + // }); |
| 25 | + |
14 | 26 | var obv = smart.patient.api.fetchAll({
|
15 |
| - type: 'Observation', |
16 |
| - query: { |
17 |
| - code: { |
18 |
| - $or: ['http://loinc.org|8302-2', 'http://loinc.org|8462-4', |
19 |
| - 'http://loinc.org|8480-6', 'http://loinc.org|2085-9', |
20 |
| - 'http://loinc.org|2089-1', 'http://loinc.org|55284-4'] |
21 |
| - } |
22 |
| - } |
23 |
| - }); |
| 27 | + type: 'Observation', |
| 28 | + query: { |
| 29 | + code: { |
| 30 | + $or: ['http://loinc.org|26478-8', 'http://loinc.org|2345-7'] |
| 31 | + } |
| 32 | + } |
| 33 | + }); |
| 34 | + |
| 35 | + console.log('patient:'); |
| 36 | + console.log(patient) |
24 | 37 |
|
25 | 38 | $.when(pt, obv).fail(onError);
|
26 | 39 |
|
27 | 40 | $.when(pt, obv).done(function(patient, obv) {
|
28 | 41 | var byCodes = smart.byCodes(obv, 'code');
|
| 42 | + console.log("byCodes:"); |
| 43 | + console.log(byCodes('26478-8')); |
| 44 | + console.log(byCodes('2345-7')); |
| 45 | + |
29 | 46 | var gender = patient.gender;
|
30 | 47 |
|
31 | 48 | var fname = '';
|
32 | 49 | var lname = '';
|
33 | 50 |
|
34 | 51 | if (typeof patient.name[0] !== 'undefined') {
|
35 | 52 | fname = patient.name[0].given.join(' ');
|
36 |
| - lname = patient.name[0].family.join(' '); |
| 53 | + lname = patient.name[0].family; |
37 | 54 | }
|
38 | 55 |
|
39 |
| - var height = byCodes('8302-2'); |
40 |
| - var systolicbp = getBloodPressureValue(byCodes('55284-4'),'8480-6'); |
41 |
| - var diastolicbp = getBloodPressureValue(byCodes('55284-4'),'8462-4'); |
42 |
| - var hdl = byCodes('2085-9'); |
43 |
| - var ldl = byCodes('2089-1'); |
| 56 | + // Observations |
| 57 | + lymph = byCodes('26478-8'); |
| 58 | + // Cerner SoF Tutorial Observations |
| 59 | + // var height = byCodes('8302-2'); |
| 60 | + // var systolicbp = getBloodPressureValue(byCodes('55284-4'),'8480-6'); |
| 61 | + // var diastolicbp = getBloodPressureValue(byCodes('55284-4'),'8462-4'); |
| 62 | + // var hdl = byCodes('2085-9'); |
| 63 | + // var ldl = byCodes('2089-1'); |
| 64 | + |
44 | 65 |
|
45 | 66 | var p = defaultPatient();
|
46 | 67 | p.birthdate = patient.birthDate;
|
47 | 68 | p.gender = gender;
|
48 | 69 | p.fname = fname;
|
49 | 70 | p.lname = lname;
|
50 |
| - p.height = getQuantityValueAndUnit(height[0]); |
| 71 | + p.lymph = getQuantityValueAndUnit(lymph[0]); |
51 | 72 |
|
52 |
| - if (typeof systolicbp != 'undefined') { |
53 |
| - p.systolicbp = systolicbp; |
54 |
| - } |
55 | 73 |
|
56 |
| - if (typeof diastolicbp != 'undefined') { |
57 |
| - p.diastolicbp = diastolicbp; |
58 |
| - } |
| 74 | + // Cerner SoF Tutorial Observations |
| 75 | + // p.height = getQuantityValueAndUnit(height[0]); |
59 | 76 |
|
60 |
| - p.hdl = getQuantityValueAndUnit(hdl[0]); |
61 |
| - p.ldl = getQuantityValueAndUnit(ldl[0]); |
| 77 | + // if (typeof systolicbp != 'undefined') { |
| 78 | + // p.systolicbp = systolicbp; |
| 79 | + // } |
62 | 80 |
|
| 81 | + // if (typeof diastolicbp != 'undefined') { |
| 82 | + // p.diastolicbp = diastolicbp; |
| 83 | + // } |
| 84 | + |
| 85 | + // p.hdl = getQuantityValueAndUnit(hdl[0]); |
| 86 | + // p.ldl = getQuantityValueAndUnit(ldl[0]); |
| 87 | + console.log('p:'); |
| 88 | + console.log(p); |
63 | 89 | ret.resolve(p);
|
64 | 90 | });
|
65 | 91 | } else {
|
|
78 | 104 | lname: {value: ''},
|
79 | 105 | gender: {value: ''},
|
80 | 106 | birthdate: {value: ''},
|
81 |
| - height: {value: ''}, |
82 |
| - systolicbp: {value: ''}, |
83 |
| - diastolicbp: {value: ''}, |
84 |
| - ldl: {value: ''}, |
85 |
| - hdl: {value: ''}, |
| 107 | + lymph: {value: ''} |
| 108 | + |
| 109 | + // Cerner SoF Tutorial Observations |
| 110 | + // height: {value: ''}, |
| 111 | + // systolicbp: {value: ''}, |
| 112 | + // diastolicbp: {value: ''}, |
| 113 | + // ldl: {value: ''}, |
| 114 | + // hdl: {value: ''}, |
86 | 115 | };
|
87 | 116 | }
|
88 | 117 |
|
| 118 | + // Helper Function |
| 119 | + |
89 | 120 | function getBloodPressureValue(BPObservations, typeOfPressure) {
|
90 | 121 | var formattedBPObservations = [];
|
91 | 122 | BPObservations.forEach(function(observation){
|
|
121 | 152 | $('#lname').html(p.lname);
|
122 | 153 | $('#gender').html(p.gender);
|
123 | 154 | $('#birthdate').html(p.birthdate);
|
124 |
| - $('#height').html(p.height); |
125 |
| - $('#systolicbp').html(p.systolicbp); |
126 |
| - $('#diastolicbp').html(p.diastolicbp); |
127 |
| - $('#ldl').html(p.ldl); |
128 |
| - $('#hdl').html(p.hdl); |
| 155 | + $('#lymph').html(p.lymph); |
| 156 | + |
| 157 | + // Cerner SoF Tutorial Observations |
| 158 | + |
| 159 | + // $('#height').html(p.height); |
| 160 | + // $('#systolicbp').html(p.systolicbp); |
| 161 | + // $('#diastolicbp').html(p.diastolicbp); |
| 162 | + // $('#ldl').html(p.ldl); |
| 163 | + // $('#hdl').html(p.hdl); |
129 | 164 | };
|
130 | 165 |
|
131 | 166 | })(window);
|
0 commit comments