-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdemo.js
106 lines (91 loc) · 2.73 KB
/
demo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
const {
orderString,
submitOrders,
makeCclRequest,
openPatientTab,
openOrganizerTab,
launchClinicalNote,
launchPowerForm,
launchPowerNote,
} = require('./dist/');
/************************************************
* Create and submit new orders to PowerChart
************************************************/
// Functional ulities
// ------------------
const orderStr1 = orderString('copy existing', { orderId: 12345 });
const orderStr2 = orderString('new order', {
newOrderOpts: {
synonymId: 1343,
origination: 'prescription',
},
});
const orderStr3 = orderString('new order', {
newOrderOpts: {
synonymId: 3428,
orderSentenceId: 3,
nomenclatureIds: [14, 15, 16],
interactionCheck: 'on sign',
},
});
submitOrders(123, 456, [orderStr1, orderStr2, orderStr3]);
/********************************************************
* Make a CCL request to the server and retrieve the data
********************************************************/
let result = undefined;
makeCclRequest({
prg: 'MP_GET_ORDER_LIST',
params: [
{ type: 'number', param: 12345 },
{ type: 'string', param: 'joe' },
],
})
.then(data => (result = data))
.catch(console.error)
.finally(() => console.log(result));
/********************************************************
* Alternative example, where the parameter types are inferred
********************************************************/
let altResult = undefined;
makeCclRequest({
prg: 'MP_GET_ORDER_LIST',
params: [12345, 'joe'],
})
.then(data => (altResult = data))
.catch(console.error)
.finally(() => console.log(altResult));
/********************************************************
* Open a specific tab in a patients chart
********************************************************/
openPatientTab(12345, 54321, 'Notes');
/********************************************************
* Open a specific organizer level tab
********************************************************/
openOrganizerTab('Message Center');
/****************************************************
* Launch a Clinical Note
***************************************************/
launchClinicalNote({
patientId: 12345,
encounterId: 54321,
eventIds: [123, 456, 789],
windowTitle: 'My Note',
viewOptionFlags: ['buttons', 'view-only'],
});
/****************************************************
* Launch a PowerForm
***************************************************/
launchPowerForm({
personId: 12345,
encounterId: 54321,
target: 'new form search',
});
/****************************************************
* Launch a PowerNote
***************************************************/
launchPowerNote({
personId: 12345,
encounterId: 54321,
target: 'new',
targetId: 'CKI!HAIR LOSS',
});