fluent-cerner-js 0.2.0-alpha.0 → 0.3.2-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fluent-cerner-js.cjs.development.js +47 -56
- package/dist/fluent-cerner-js.cjs.development.js.map +1 -1
- package/dist/fluent-cerner-js.cjs.production.min.js +1 -1
- package/dist/fluent-cerner-js.cjs.production.min.js.map +1 -1
- package/dist/fluent-cerner-js.esm.js +47 -57
- package/dist/fluent-cerner-js.esm.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/utils/index.d.ts +4 -82
- package/dist/utils/makeCclRequest.d.ts +72 -0
- package/dist/utils/openOrganizerTab.d.ts +11 -0
- package/dist/utils/openPatientTab.d.ts +17 -0
- package/package.json +2 -2
- package/src/index.ts +14 -4
- package/src/utils/index.ts +4 -222
- package/src/utils/makeCclRequest.ts +156 -0
- package/src/utils/openOrganizerTab.ts +23 -0
- package/src/utils/openPatientTab.ts +38 -0
|
@@ -32,21 +32,11 @@ function makeCclRequest(opts) {
|
|
|
32
32
|
var prg = opts.prg,
|
|
33
33
|
excludeMine = opts.excludeMine,
|
|
34
34
|
params = opts.params;
|
|
35
|
-
var paramsList = (
|
|
36
|
-
var type = _ref.type,
|
|
37
|
-
param = _ref.param;
|
|
38
|
-
return type === 'string' ? "'" + param + "'" : param;
|
|
39
|
-
}).join(',');
|
|
35
|
+
var paramsList = processCclRequestParams(params, excludeMine || false);
|
|
40
36
|
return new Promise(function (resolve, reject) {
|
|
41
37
|
try {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return window.XMLCclRequest;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return _dummyXMLCclRequest;
|
|
48
|
-
}();
|
|
49
|
-
|
|
38
|
+
// @ts-ignore - From Powerchart context
|
|
39
|
+
var request = window.XMLCclRequest();
|
|
50
40
|
request.open('GET', "" + prg);
|
|
51
41
|
request.send(paramsList);
|
|
52
42
|
|
|
@@ -75,6 +65,28 @@ function makeCclRequest(opts) {
|
|
|
75
65
|
}
|
|
76
66
|
});
|
|
77
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* A function which processes the CCL request parameters, converting them to a string compatible with an XmlCclRequest.
|
|
70
|
+
* @param params {Array<CclCallParam>} An array of CclCallParam objects, each of which represents
|
|
71
|
+
* @param excludeMine {boolean} Determines whether or not to include the "MINE" parameter as the
|
|
72
|
+
* @returns {string} the XmlCclRequest compatible string.
|
|
73
|
+
*/
|
|
74
|
+
|
|
75
|
+
function processCclRequestParams(params, excludeMine) {
|
|
76
|
+
params = params || [];
|
|
77
|
+
excludeMine = excludeMine || false;
|
|
78
|
+
var updatedParams = excludeMine ? [].concat(params) : [{
|
|
79
|
+
type: 'string',
|
|
80
|
+
param: 'MINE'
|
|
81
|
+
}].concat(params);
|
|
82
|
+
var paramString = updatedParams.map(function (_ref) {
|
|
83
|
+
var type = _ref.type,
|
|
84
|
+
param = _ref.param;
|
|
85
|
+
return type === 'string' ? "'" + param + "'" : param;
|
|
86
|
+
}).join(',');
|
|
87
|
+
return paramString;
|
|
88
|
+
}
|
|
89
|
+
|
|
78
90
|
/**
|
|
79
91
|
* Attempts to open a tab with the name given to the `tab` variable in a
|
|
80
92
|
* patients chart given in the context of a given encounter.
|
|
@@ -91,7 +103,6 @@ function makeCclRequest(opts) {
|
|
|
91
103
|
* attempt to launch the Add Order window so long as Enhanced Navigation is
|
|
92
104
|
* supported by your installation.
|
|
93
105
|
*/
|
|
94
|
-
|
|
95
106
|
function openPatientTab(pid, eid, tab, quickAdd) {
|
|
96
107
|
var args = "/PERSONID=" + pid + " /ENCNTRID=" + eid + " /FIRSTTAB=^" + tab.toUpperCase() + (quickAdd ? '+' : '') + "^";
|
|
97
108
|
|
|
@@ -105,49 +116,28 @@ function openPatientTab(pid, eid, tab, quickAdd) {
|
|
|
105
116
|
}
|
|
106
117
|
}
|
|
107
118
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
abort: function abort() {
|
|
129
|
-
throw new Error('Function not implemented.');
|
|
130
|
-
},
|
|
131
|
-
getAllResponseHeaders: function getAllResponseHeaders() {
|
|
132
|
-
throw new Error('Function not implemented.');
|
|
133
|
-
},
|
|
134
|
-
// @ts-ignore - dummy function
|
|
135
|
-
getResponseHeader: function getResponseHeader(header) {
|
|
136
|
-
throw new Error('Function not implemented.');
|
|
137
|
-
},
|
|
138
|
-
// @ts-ignore - dummy function
|
|
139
|
-
open: function open(method, url, async) {
|
|
140
|
-
throw new Error('Function not implemented.');
|
|
141
|
-
},
|
|
142
|
-
// @ts-ignore - dummy function
|
|
143
|
-
send: function send(data) {
|
|
144
|
-
throw new Error('Function not implemented.');
|
|
145
|
-
},
|
|
146
|
-
// @ts-ignore - dummy function
|
|
147
|
-
setRequestHeader: function setRequestHeader(name, value) {
|
|
148
|
-
throw new Error('Function not implemented.');
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Attempts to open a tab with the name given to the `tab` variable in at the chart organizer
|
|
122
|
+
* level.
|
|
123
|
+
* @param tab The string which represents the tab to open
|
|
124
|
+
* (case insensitive). Navigation will be made to the first
|
|
125
|
+
* upper-level tab in the chart that that matches the `tab` string
|
|
126
|
+
* If no match is found, then sub-tab names will be searched and
|
|
127
|
+
* navigation made to the first sub-tab that matches
|
|
128
|
+
* the `tab` string. If no matches are found, no navigation will occur.
|
|
129
|
+
*/
|
|
130
|
+
function openOrganizerTab(tab) {
|
|
131
|
+
try {
|
|
132
|
+
window.APPLINK(0, 'Powerchart.exe', "/ORGANIZERTAB=^" + tab + "^");
|
|
133
|
+
} catch (e) {
|
|
134
|
+
if (e instanceof ReferenceError) {
|
|
135
|
+
console.warn("We're likely not inside PowerChart. The input given would be: '0, \"Powerchart.exe\", \"/ORGANIZERTAB=^" + tab + "^\"'");
|
|
136
|
+
} else {
|
|
137
|
+
throw e;
|
|
138
|
+
}
|
|
149
139
|
}
|
|
150
|
-
}
|
|
140
|
+
}
|
|
151
141
|
|
|
152
142
|
var MPageOrderEvent = /*#__PURE__*/function () {
|
|
153
143
|
function MPageOrderEvent() {
|
|
@@ -567,5 +557,6 @@ var MPageOrder = /*#__PURE__*/function () {
|
|
|
567
557
|
exports.MPageOrder = MPageOrder;
|
|
568
558
|
exports.MPageOrderEvent = MPageOrderEvent;
|
|
569
559
|
exports.makeCclRequest = makeCclRequest;
|
|
560
|
+
exports.openOrganizerTab = openOrganizerTab;
|
|
570
561
|
exports.openPatientTab = openPatientTab;
|
|
571
562
|
//# sourceMappingURL=fluent-cerner-js.cjs.development.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluent-cerner-js.cjs.development.js","sources":["../src/utils/index.ts","../src/MPageOrderEvent.ts","../src/MPageOrder.ts"],"sourcesContent":["/**\n * A type which represents the input parameter for an `XmlCclRequest`, which is wrapped by `makeCclRequest`.\n * The parameters are passed in a string, and numbers and strings are interpreted within this string by\n * the presence of quotes within quotes (e.g. single within double or vice versa). By strongly typing\n * the CclCallParam we can ensure that the parameters are always passed in a way that properly represents\n * their type.\n * @param {'string'|'number'} type - The type of the parameter.\n * @param {string} param - The string representing the parameters value.\n */\nexport type CclCallParam = {\n type: 'string' | 'number';\n param: string | number;\n};\n\n/**\n * A type which represents the full set of data required to make an XmlCclRequest, which is wrapped\n * by `makeCclRequest`.\n * @param {string} prg - The name of the CCL program to run, e.g. 12_USER_DETAILS.\n * @param {boolean?} excludeMine - Determines whether or not to include the \"MINE\" parameter as the\n * first parameter in the CCL call. This defaults to `false`, and almost all cases will require\n * the \"MINE\" parameter to be included.\n * @param {CclCallParam[]} params - An array of CclCallParam objects, each of which represents\n * a strongly typed parameter.\n */\nexport type CclOpts = {\n prg: string;\n excludeMine?: boolean;\n params: Array<CclCallParam>;\n};\n\n/**\n * A type functioning as a convience wrapper for several status\n * codes, respresented as strings, that are returned by XMLCclRequest.\n */\nexport type XmlCclStatus =\n | 'success'\n | 'method not allowed'\n | 'invalid state'\n | 'non-fatal error'\n | 'memory error'\n | 'internal server exception'\n | 'status refers to unknown error';\n\n/**\n * A type which represents the full set of data returned from an XmlCclRequest and important, formatted\n * metadata to help with debugging and error management. This is a generic type and data will represent\n * the type `T` which is the type or interface which represents the resolved data from the CCL request.\n */\nexport type CclRequestResponse<T> = {\n meta: {\n responseText: string;\n status: number;\n statusText: XmlCclStatus;\n };\n data: T | undefined;\n};\n\nconst statusCodeMap: Map<number, XmlCclStatus> = new Map();\nstatusCodeMap.set(200, 'success');\nstatusCodeMap.set(405, 'method not allowed');\nstatusCodeMap.set(409, 'invalid state');\nstatusCodeMap.set(492, 'non-fatal error');\nstatusCodeMap.set(493, 'memory error');\nstatusCodeMap.set(500, 'internal server exception');\n\n/**\n * A generic wrapper function for `XMLCclRequest` which simplifies it's use. Of note,\n * use of this requires the `head` of the HTML document contain the following\n * `meta` tag: `<META content='XMLCCLREQUEST' name='discern'>` so that it might\n * interface with the appropriate COM object.\n * @param {CclOpts} opts - Required options for the CCL request.\n * @returns a promise of type `CclRequestResponse<T>` where `T` is the type\n * or interface which represents the resolved data from the CCL request. If\n * no data are returned, that is an empty string, from the XMLCclRequest then\n * the `data` field will be set to `undefined`. The objects `meta` field\n * includes `responseText`, `status`, and `statusTest` fields.\n * @resolves the `CclRequestResponse<T>` where `T` is the type\n * or interface which represents the resolved data from the CCL request. If\n * no data are returned, that is an empty string, from the XMLCclRequest then\n * the `data` field will be set to `undefined`. The objects `meta` field\n * includes `responseText`, `status`, and `statusTest` fields.\n * @rejects with an error message if the CCL request fails.\n */\nexport function makeCclRequest<T>(\n opts: CclOpts\n): Promise<CclRequestResponse<T>> {\n const { prg, excludeMine, params } = opts;\n const paramsList =\n (excludeMine ? '' : \"'MINE',\") +\n params\n .map(({ type, param }) => (type === 'string' ? `'${param}'` : param))\n .join(',');\n return new Promise((resolve, reject) => {\n try {\n const request = (function() {\n if (window.XMLCclRequest) {\n return window.XMLCclRequest;\n }\n\n return _dummyXMLCclRequest;\n })();\n\n request.open('GET', `${prg}`);\n request.send(paramsList);\n request.onreadystatechange = function() {\n const data: CclRequestResponse<T> = {\n meta: {\n responseText: request.responseText,\n status: request.status,\n statusText:\n statusCodeMap.get(request.status) ||\n 'status refers to unknown error',\n },\n data:\n request.responseText === ''\n ? undefined\n : JSON.parse(request.responseText),\n };\n if (request.readyState === 4) {\n resolve(data);\n } else {\n reject(\n `error with status ${request.status} and readyState ${\n request.readyState\n } on ${prg} with params ${paramsList} returning response text: ${request.responseText ||\n 'no response text'}`\n );\n }\n };\n } catch (e) {\n if (e instanceof ReferenceError) {\n reject(\n `We're likely not inside PowerChart. We cannot send request: \"${paramsList}\" to \"${prg}\"`\n );\n } else {\n throw e;\n }\n }\n });\n}\n\n/**\n * Attempts to open a tab with the name given to the `tab` variable in a\n * patients chart given in the context of a given encounter.\n * @param pid The patients person id.\n * @param eid The patients encounter id.\n * @param tab The string which represents the tab to open\n * (case insensitive). Navigation will be made to the first\n * upper-level tab in the chart that that matches the `tab` string\n * If no match is found, then sub-tab names will be searched and\n * navigation made to the first sub-tab that matches\n * the `tab` string. If no matches are found, no navigation will occur.\n * @param quickAdd {boolean} - If true, will attempt to open the window\n * in a quick add mode. E.g. if the Orders tab is connected to it will\n * attempt to launch the Add Order window so long as Enhanced Navigation is\n * supported by your installation.\n */\nexport function openPatientTab(\n pid: number,\n eid: number,\n tab: string,\n quickAdd: boolean\n): void {\n const args = `/PERSONID=${pid} /ENCNTRID=${eid} /FIRSTTAB=^${tab.toUpperCase()}${\n quickAdd ? '+' : ''\n }^`;\n\n try {\n window.APPLINK(1, '$APP_APPNAME$', args);\n } catch (e) {\n if (e instanceof ReferenceError) {\n console.warn(\n `We're likely not inside PowerChart. The input given would be: '1, \"$APP_NAME$\", ${args}'`\n );\n } else {\n throw e;\n }\n }\n}\n\nconst _dummyXMLCclRequest: XMLCclRequest = {\n options: {},\n readyState: 0,\n responseText: '',\n status: 0,\n statusText: '',\n sendFlag: false,\n errorFlag: false,\n responseBody: '',\n responseXML: '',\n async: false,\n requestBinding: '',\n requestText: '',\n blobIn: '',\n onreadystatechange: function(): void {\n throw new Error('Function not implemented.');\n },\n onerror: function(): void {\n throw new Error('Function not implemented.');\n },\n abort: function(): void {\n throw new Error('Function not implemented.');\n },\n getAllResponseHeaders: function(): string[] {\n throw new Error('Function not implemented.');\n },\n // @ts-ignore - dummy function\n getResponseHeader: function(header: string): string {\n throw new Error('Function not implemented.');\n },\n // @ts-ignore - dummy function\n open: function(method: string, url: string, async?: boolean): void {\n throw new Error('Function not implemented.');\n },\n // @ts-ignore - dummy function\n send: function(data: string): void {\n throw new Error('Function not implemented.');\n },\n // @ts-ignore - dummy function\n setRequestHeader: function(name: string, value: string): void {\n throw new Error('Function not implemented.');\n },\n};\n","import { MPageOrder } from '.';\n\nclass MPageOrderEvent {\n private _orders: Array<MPageOrder>;\n getOrders = () => this._orders;\n\n private _tabList: { tab: number; tabDisplayFlag: number } = {\n tab: 0,\n tabDisplayFlag: 0,\n };\n getTabList = () => this._tabList;\n\n private _personId: number = 0;\n getPersonId = () => this._personId;\n\n private _encounterId: number = 0;\n getEncounterId = () => this._encounterId;\n\n private _powerPlanFlag: number = 0;\n getPowerPlanFlag = () => this._powerPlanFlag;\n\n private _defaultDisplay: number = 0;\n getDefaultDisplay = () => this._defaultDisplay;\n\n private _silentSignFlag: number = 0;\n getSilentSignFlag = () => this._silentSignFlag;\n\n constructor() {\n this._orders = [];\n this._tabList = { tab: 0, tabDisplayFlag: 0 };\n // Disable PowerPlans by default\n this._powerPlanFlag = 0;\n // Disable PowerOrders by default\n this._tabList.tabDisplayFlag = 0;\n this.customizeOrderListProfile();\n this.launchOrderProfile();\n // Do NOT sign silently by default\n this._silentSignFlag = 0;\n }\n\n forPerson(id: number) {\n this._personId = id;\n return this;\n }\n\n forEncounter(id: number) {\n this._encounterId = id;\n return this;\n }\n\n addOrders(orders: Array<MPageOrder> | MPageOrder) {\n if (!Array.isArray(orders)) {\n orders = [orders];\n }\n this._orders = this._orders.concat(orders);\n return this;\n }\n\n enablePowerPlans() {\n this._powerPlanFlag = 24;\n return this;\n }\n\n customizeOrderListProfile() {\n this._tabList.tab = 2;\n return this;\n }\n\n customizeMedicationListProfile() {\n this._tabList.tab = 3;\n return this;\n }\n\n enablePowerOrders() {\n this._tabList.tabDisplayFlag = 127;\n return this;\n }\n\n launchOrderSearch() {\n this._defaultDisplay = 8;\n return this;\n }\n\n launchOrderProfile() {\n this._defaultDisplay = 16;\n return this;\n }\n\n launchOrdersForSignature() {\n this._defaultDisplay = 32;\n return this;\n }\n\n signSilently() {\n this._silentSignFlag = 1;\n return this;\n }\n\n send() {\n try {\n window.MPAGES_EVENT('ORDERS', this.toString());\n } catch (e) {\n if (e instanceof ReferenceError) {\n console.warn(\n `We're likely not inside PowerChart. The output would be an MPAGES_EVENT: ${this.toString()}`\n );\n } else {\n throw e;\n }\n }\n }\n\n toString(): string {\n const head = `${this._personId}|${this._encounterId}|`;\n let body: string = '';\n this._orders.forEach(order => {\n body += order.toString();\n });\n const tail = `|${this._powerPlanFlag}|{${this._tabList.tab}|${this._tabList.tabDisplayFlag}}|${this._defaultDisplay}|${this._silentSignFlag}`;\n\n return `${head}${body}${tail}`;\n }\n}\n\nexport { MPageOrderEvent };\n","/**\n * Options for a new order\n * @param {boolean} isRxOrder Marks the order order as a prescription. Is mutually exclusive from\n * isSatelliteOrder. Field will be set to false if left undefined; this resolves to 0 when built.\n * @param {boolean} isSatelliteOrder Moarks the order origination as satellite. Is mutually\n * exclusive from isRxOrder. Field will be set to false if left undefined; this resolves to 0 when built.\n * @param {number} orderSentenceId The optional Cerner order_sentence_id to be associated with\n * the new order. Field will be set to 0 if undefined.\n * @param {number} nomenclatureId The optional Cerner nomenclature_id to be associated with the\n * new order. Field will be set to 0 if undefined.\n * @param {boolean} skipInteractionCheckUntilSign Determines cerner sign-time interaction\n * checking. A value of true skips checking for interactions until orders are signed, false\n * will not. Field will be set to false if left undefined; this resolves to 0 when built.\n */\nexport type NewOrderOpts = {\n isRxOrder?: boolean;\n isSatelliteOrder?: boolean;\n orderSentenceId?: number;\n nomenclatureId?: number;\n skipInteractionCheckUntilSign?: boolean;\n};\n\nexport class MPageOrder {\n private _orderAction: string = '';\n getOrderAction = () => this._orderAction;\n\n private _orderId: number = 0;\n getOrderId = () => this._orderId;\n\n private _synonymId: number = 0;\n getSynonymId = () => this._synonymId;\n\n private _orderOrigination: number = 0;\n getOrderOrigination = () => this._orderOrigination;\n\n private _orderSentenceId: number = 0;\n getOrderSentenceId = () => this._orderSentenceId;\n\n private _nomenclatureId: number = 0;\n getNomenclatureId = () => this._nomenclatureId;\n\n private _signTimeInteraction: number = 0;\n getSignTimeInteraction = () => this._signTimeInteraction;\n\n /**\n * Creates a new MPageOrder with the order action 'ACTIVATE', which is the prototype for activating an existing future order.\n *\n * @since 0.1.0\n * @category MPage Events - Orders\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willActivate(orderId: number) {\n this._orderAction = 'ACTIVATE';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CANCEL DC', which is the prototype for canceling and discontinuing an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willCancelDiscontinue(orderId: number) {\n this._orderAction = 'CANCEL DC';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CANCEL REORD', which is the prototype for cancelling and reordering an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willCancelReorder(orderId: number) {\n this._orderAction = 'CANCEL REORD';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CLEAR', which is the prototype for clearing actions of an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willClear(orderId: number) {\n this._orderAction = 'CLEAR';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CONVERT_INPAT', which is the prototype for converting a prescription order into an inpatient order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willConvertInpatient(orderId: number) {\n this._orderAction = 'CONVERT_INPAT';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CONVERT_RX', which is the prototype for converting an inpatient order into a prescription.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willConvertToPrescriptionOrder(orderId: number) {\n this._orderAction = 'CONVERT_RX';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'MODIFY', which is the prototype for modifying an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willModify(orderId: number) {\n this._orderAction = 'MODIFY';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPage Order with order action 'ORDER'.\n *\n * @since 0.1.0\n * @category MPage Events - Orders\n * @param {number} synonymId The Cerner synonym_id to be associated with the new order. Must be set.\n * @param {NewOrderOpts} options required when making a new order\n * @returns {this} Returns itself to continue chaining method calls.\n * default to a normal order type.\n * @throws Error if `isRxOrder` and `isSatelliteOrder` are both set to true. These two are mutually exclusive and setting\n * both creates underfined behavior with respect the order origination field.\n * @example\n * m.willMakeNewOrder(34, true, 13, 42, true).toString() => \"{'ORDER'|34|5|1342|1}\"\n */\n\n willMakeNewOrder(synonymId: number, opts?: NewOrderOpts) {\n const {\n isRxOrder,\n isSatelliteOrder,\n orderSentenceId,\n nomenclatureId,\n skipInteractionCheckUntilSign,\n } = opts || {};\n\n if (isRxOrder && isSatelliteOrder)\n throw new Error('must select either isRxOrder or isSatelliteOrder');\n this._orderAction = 'ORDER';\n this._synonymId = synonymId;\n this._orderSentenceId = orderSentenceId || 0;\n this._nomenclatureId = nomenclatureId || 0;\n this._signTimeInteraction = skipInteractionCheckUntilSign ? 1 : 0;\n this._orderOrigination = isSatelliteOrder ? 5 : isRxOrder ? 1 : 0;\n\n return this;\n }\n\n /**\n * Creates a new MPageOrder with the order action 'RENEW', which is the prototype for reviewing an existing non-prescription order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willRenewNonPrescription(orderId: number) {\n this._orderAction = 'RENEW';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'RENEW_RX', which is the prototype for renewing an existing prescription order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willRenewPrescription(orderId: number) {\n this._orderAction = 'RENEW_RX';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'REPEAT', which is the prototype for copying an order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willCopyExistingOrder(orderId: number) {\n this._orderAction = 'REPEAT';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'RESUME', which is the prototype for resuming a suspended order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willResumeSuspendedOrder(orderId: number) {\n this._orderAction = 'RESUME';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'SUSPEND', which is the prototype for suspending an existing order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willSuspend(orderId: number) {\n this._orderAction = 'SUSPEND';\n this._orderId = orderId;\n return this;\n }\n\n /**\n * Overrides the toString() method for representing the objects internal state as a string.\n *\n * @since 0.1.0\n * @returns {string} string representation of MPageOrder's internal state\n */\n toString(): string {\n return this._orderAction === 'ORDER'\n ? `{${this._orderAction}|${this._synonymId}|${this._orderOrigination}|${this._orderSentenceId}|${this._nomenclatureId}|${this._signTimeInteraction}}`\n : `{${this._orderAction}|${this._orderId}}`;\n }\n}\n"],"names":["statusCodeMap","Map","set","makeCclRequest","opts","prg","excludeMine","params","paramsList","map","type","param","join","Promise","resolve","reject","request","window","XMLCclRequest","_dummyXMLCclRequest","open","send","onreadystatechange","data","meta","responseText","status","statusText","get","undefined","JSON","parse","readyState","e","ReferenceError","openPatientTab","pid","eid","tab","quickAdd","args","toUpperCase","APPLINK","console","warn","options","sendFlag","errorFlag","responseBody","responseXML","async","requestBinding","requestText","blobIn","Error","onerror","abort","getAllResponseHeaders","getResponseHeader","header","method","url","setRequestHeader","name","value","MPageOrderEvent","_orders","tabDisplayFlag","_tabList","_personId","_encounterId","_powerPlanFlag","_defaultDisplay","_silentSignFlag","customizeOrderListProfile","launchOrderProfile","forPerson","id","forEncounter","addOrders","orders","Array","isArray","concat","enablePowerPlans","customizeMedicationListProfile","enablePowerOrders","launchOrderSearch","launchOrdersForSignature","signSilently","MPAGES_EVENT","toString","head","body","forEach","order","tail","MPageOrder","_orderAction","_orderId","_synonymId","_orderOrigination","_orderSentenceId","_nomenclatureId","_signTimeInteraction","willActivate","orderId","willCancelDiscontinue","willCancelReorder","willClear","willConvertInpatient","willConvertToPrescriptionOrder","willModify","willMakeNewOrder","synonymId","isRxOrder","isSatelliteOrder","orderSentenceId","nomenclatureId","skipInteractionCheckUntilSign","willRenewNonPrescription","willRenewPrescription","willCopyExistingOrder","willResumeSuspendedOrder","willSuspend"],"mappings":";;;;AAyDA,I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AKO,YAAL,KAAsB,OAAtB,SACC,KAAKA,YADN,SACsB,KAAKE,UAD3B,SACyC,KAAKC,iBAD9C,SACmE,KAAKC,gBADxE,SAC4F,KAAKC,eADjG,SACoH,KAAKC,oBADzH,eAEC,KAAKN,YAFN,SAEsB,KAAKC,QAF3B,MAAP;AAGD,GAtNH;;AAAA;AAAA;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"fluent-cerner-js.cjs.development.js","sources":["../src/utils/makeCclRequest.ts","../src/utils/openPatientTab.ts","../src/utils/openOrganizerTab.ts","../src/MPageOrderEvent.ts","../src/MPageOrder.ts"],"sourcesContent":["/**\n * A type which represents the input parameter for an `XmlCclRequest`, which is wrapped by `makeCclRequest`.\n * The parameters are passed in a string, and numbers and strings are interpreted within this string by\n * the presence of quotes within quotes (e.g. single within double or vice versa). By strongly typing\n * the CclCallParam we can ensure that the parameters are always passed in a way that properly represents\n * their type.\n * @param {'string'|'number'} type - The type of the parameter.\n * @param {string} param - The string representing the parameters value.\n */\nexport type CclCallParam = {\n type: 'string' | 'number';\n param: string | number;\n};\n\n/**\n * A type which represents the full set of data required to make an XmlCclRequest, which is wrapped\n * by `makeCclRequest`.\n * @param {string} prg - The name of the CCL program to run, e.g. 12_USER_DETAILS.\n * @param {boolean?} excludeMine - Determines whether or not to include the \"MINE\" parameter as the\n * first parameter in the CCL call. This defaults to `false`, and almost all cases will require\n * the \"MINE\" parameter to be included.\n * @param {CclCallParam[]} params - An array of CclCallParam objects, each of which represents\n * a strongly typed parameter.\n */\nexport type CclOpts = {\n prg: string;\n excludeMine?: boolean;\n params: Array<CclCallParam>;\n};\n\n/**\n * A type functioning as a convience wrapper for several status\n * codes, respresented as strings, that are returned by XMLCclRequest.\n */\nexport type XmlCclStatus =\n | 'success'\n | 'method not allowed'\n | 'invalid state'\n | 'non-fatal error'\n | 'memory error'\n | 'internal server exception'\n | 'status refers to unknown error';\n\n/**\n * A type which represents the full set of data returned from an XmlCclRequest and important, formatted\n * metadata to help with debugging and error management. This is a generic type and data will represent\n * the type `T` which is the type or interface which represents the resolved data from the CCL request.\n */\nexport type CclRequestResponse<T> = {\n meta: {\n responseText: string;\n status: number;\n statusText: XmlCclStatus;\n };\n data: T | undefined;\n};\n\nconst statusCodeMap: Map<number, XmlCclStatus> = new Map();\nstatusCodeMap.set(200, 'success');\nstatusCodeMap.set(405, 'method not allowed');\nstatusCodeMap.set(409, 'invalid state');\nstatusCodeMap.set(492, 'non-fatal error');\nstatusCodeMap.set(493, 'memory error');\nstatusCodeMap.set(500, 'internal server exception');\n\n/**\n * A generic wrapper function for `XMLCclRequest` which simplifies it's use. Of note,\n * use of this requires the `head` of the HTML document contain the following\n * `meta` tag: `<META content='XMLCCLREQUEST' name='discern'>` so that it might\n * interface with the appropriate COM object.\n * @param {CclOpts} opts - Required options for the CCL request.\n * @returns a promise of type `CclRequestResponse<T>` where `T` is the type\n * or interface which represents the resolved data from the CCL request. If\n * no data are returned, that is an empty string, from the XMLCclRequest then\n * the `data` field will be set to `undefined`. The objects `meta` field\n * includes `responseText`, `status`, and `statusTest` fields.\n * @resolves the `CclRequestResponse<T>` where `T` is the type\n * or interface which represents the resolved data from the CCL request. If\n * no data are returned, that is an empty string, from the XMLCclRequest then\n * the `data` field will be set to `undefined`. The objects `meta` field\n * includes `responseText`, `status`, and `statusTest` fields.\n * @rejects with an error message if the CCL request fails.\n */\nexport function makeCclRequest<T>(\n opts: CclOpts\n): Promise<CclRequestResponse<T>> {\n const { prg, excludeMine, params } = opts;\n const paramsList = processCclRequestParams(params, excludeMine || false);\n\n return new Promise((resolve, reject) => {\n try {\n // @ts-ignore - From Powerchart context\n const request: XMLCclRequest = window.XMLCclRequest();\n\n request.open('GET', `${prg}`);\n request.send(paramsList);\n request.onreadystatechange = function() {\n const data: CclRequestResponse<T> = {\n meta: {\n responseText: request.responseText,\n status: request.status,\n statusText:\n statusCodeMap.get(request.status) ||\n 'status refers to unknown error',\n },\n data:\n request.responseText === ''\n ? undefined\n : JSON.parse(request.responseText),\n };\n if (request.readyState === 4) {\n resolve(data);\n } else {\n reject(\n `error with status ${request.status} and readyState ${\n request.readyState\n } on ${prg} with params ${paramsList} returning response text: ${request.responseText ||\n 'no response text'}`\n );\n }\n };\n } catch (e) {\n if (e instanceof ReferenceError) {\n reject(\n `We're likely not inside PowerChart. We cannot send request: \"${paramsList}\" to \"${prg}\"`\n );\n } else {\n throw e;\n }\n }\n });\n}\n\n/**\n * A function which processes the CCL request parameters, converting them to a string compatible with an XmlCclRequest.\n * @param params {Array<CclCallParam>} An array of CclCallParam objects, each of which represents\n * @param excludeMine {boolean} Determines whether or not to include the \"MINE\" parameter as the\n * @returns {string} the XmlCclRequest compatible string.\n */\nexport function processCclRequestParams(\n params?: Array<CclCallParam>,\n excludeMine?: boolean\n) {\n params = params || [];\n excludeMine = excludeMine || false;\n\n const updatedParams: Array<CclCallParam> = excludeMine\n ? [...params]\n : [{ type: 'string', param: 'MINE' }, ...params];\n\n const paramString = updatedParams\n .map(({ type, param }) => (type === 'string' ? `'${param}'` : param))\n .join(',');\n\n return paramString;\n}\n","/**\n * Attempts to open a tab with the name given to the `tab` variable in a\n * patients chart given in the context of a given encounter.\n * @param pid The patients person id.\n * @param eid The patients encounter id.\n * @param tab The string which represents the tab to open\n * (case insensitive). Navigation will be made to the first\n * upper-level tab in the chart that that matches the `tab` string\n * If no match is found, then sub-tab names will be searched and\n * navigation made to the first sub-tab that matches\n * the `tab` string. If no matches are found, no navigation will occur.\n * @param quickAdd {boolean} - If true, will attempt to open the window\n * in a quick add mode. E.g. if the Orders tab is connected to it will\n * attempt to launch the Add Order window so long as Enhanced Navigation is\n * supported by your installation.\n */\nexport function openPatientTab(\n pid: number,\n eid: number,\n tab: string,\n quickAdd: boolean\n): void {\n const args = `/PERSONID=${pid} /ENCNTRID=${eid} /FIRSTTAB=^${tab.toUpperCase()}${\n quickAdd ? '+' : ''\n }^`;\n\n try {\n window.APPLINK(1, '$APP_APPNAME$', args);\n } catch (e) {\n if (e instanceof ReferenceError) {\n console.warn(\n `We're likely not inside PowerChart. The input given would be: '1, \"$APP_NAME$\", ${args}'`\n );\n } else {\n throw e;\n }\n }\n}\n","/**\n * Attempts to open a tab with the name given to the `tab` variable in at the chart organizer\n * level.\n * @param tab The string which represents the tab to open\n * (case insensitive). Navigation will be made to the first\n * upper-level tab in the chart that that matches the `tab` string\n * If no match is found, then sub-tab names will be searched and\n * navigation made to the first sub-tab that matches\n * the `tab` string. If no matches are found, no navigation will occur.\n */\nexport function openOrganizerTab(tab: string): void {\n try {\n window.APPLINK(0, 'Powerchart.exe', `/ORGANIZERTAB=^${tab}^`);\n } catch (e) {\n if (e instanceof ReferenceError) {\n console.warn(\n `We're likely not inside PowerChart. The input given would be: '0, \"Powerchart.exe\", \"/ORGANIZERTAB=^${tab}^\"'`\n );\n } else {\n throw e;\n }\n }\n}\n","import { MPageOrder } from '.';\n\nclass MPageOrderEvent {\n private _orders: Array<MPageOrder>;\n getOrders = () => this._orders;\n\n private _tabList: { tab: number; tabDisplayFlag: number } = {\n tab: 0,\n tabDisplayFlag: 0,\n };\n getTabList = () => this._tabList;\n\n private _personId: number = 0;\n getPersonId = () => this._personId;\n\n private _encounterId: number = 0;\n getEncounterId = () => this._encounterId;\n\n private _powerPlanFlag: number = 0;\n getPowerPlanFlag = () => this._powerPlanFlag;\n\n private _defaultDisplay: number = 0;\n getDefaultDisplay = () => this._defaultDisplay;\n\n private _silentSignFlag: number = 0;\n getSilentSignFlag = () => this._silentSignFlag;\n\n constructor() {\n this._orders = [];\n this._tabList = { tab: 0, tabDisplayFlag: 0 };\n // Disable PowerPlans by default\n this._powerPlanFlag = 0;\n // Disable PowerOrders by default\n this._tabList.tabDisplayFlag = 0;\n this.customizeOrderListProfile();\n this.launchOrderProfile();\n // Do NOT sign silently by default\n this._silentSignFlag = 0;\n }\n\n forPerson(id: number) {\n this._personId = id;\n return this;\n }\n\n forEncounter(id: number) {\n this._encounterId = id;\n return this;\n }\n\n addOrders(orders: Array<MPageOrder> | MPageOrder) {\n if (!Array.isArray(orders)) {\n orders = [orders];\n }\n this._orders = this._orders.concat(orders);\n return this;\n }\n\n enablePowerPlans() {\n this._powerPlanFlag = 24;\n return this;\n }\n\n customizeOrderListProfile() {\n this._tabList.tab = 2;\n return this;\n }\n\n customizeMedicationListProfile() {\n this._tabList.tab = 3;\n return this;\n }\n\n enablePowerOrders() {\n this._tabList.tabDisplayFlag = 127;\n return this;\n }\n\n launchOrderSearch() {\n this._defaultDisplay = 8;\n return this;\n }\n\n launchOrderProfile() {\n this._defaultDisplay = 16;\n return this;\n }\n\n launchOrdersForSignature() {\n this._defaultDisplay = 32;\n return this;\n }\n\n signSilently() {\n this._silentSignFlag = 1;\n return this;\n }\n\n send() {\n try {\n window.MPAGES_EVENT('ORDERS', this.toString());\n } catch (e) {\n if (e instanceof ReferenceError) {\n console.warn(\n `We're likely not inside PowerChart. The output would be an MPAGES_EVENT: ${this.toString()}`\n );\n } else {\n throw e;\n }\n }\n }\n\n toString(): string {\n const head = `${this._personId}|${this._encounterId}|`;\n let body: string = '';\n this._orders.forEach(order => {\n body += order.toString();\n });\n const tail = `|${this._powerPlanFlag}|{${this._tabList.tab}|${this._tabList.tabDisplayFlag}}|${this._defaultDisplay}|${this._silentSignFlag}`;\n\n return `${head}${body}${tail}`;\n }\n}\n\nexport { MPageOrderEvent };\n","/**\n * Options for a new order\n * @param {boolean} isRxOrder Marks the order order as a prescription. Is mutually exclusive from\n * isSatelliteOrder. Field will be set to false if left undefined; this resolves to 0 when built.\n * @param {boolean} isSatelliteOrder Moarks the order origination as satellite. Is mutually\n * exclusive from isRxOrder. Field will be set to false if left undefined; this resolves to 0 when built.\n * @param {number} orderSentenceId The optional Cerner order_sentence_id to be associated with\n * the new order. Field will be set to 0 if undefined.\n * @param {number} nomenclatureId The optional Cerner nomenclature_id to be associated with the\n * new order. Field will be set to 0 if undefined.\n * @param {boolean} skipInteractionCheckUntilSign Determines cerner sign-time interaction\n * checking. A value of true skips checking for interactions until orders are signed, false\n * will not. Field will be set to false if left undefined; this resolves to 0 when built.\n */\nexport type NewOrderOpts = {\n isRxOrder?: boolean;\n isSatelliteOrder?: boolean;\n orderSentenceId?: number;\n nomenclatureId?: number;\n skipInteractionCheckUntilSign?: boolean;\n};\n\nexport class MPageOrder {\n private _orderAction: string = '';\n getOrderAction = () => this._orderAction;\n\n private _orderId: number = 0;\n getOrderId = () => this._orderId;\n\n private _synonymId: number = 0;\n getSynonymId = () => this._synonymId;\n\n private _orderOrigination: number = 0;\n getOrderOrigination = () => this._orderOrigination;\n\n private _orderSentenceId: number = 0;\n getOrderSentenceId = () => this._orderSentenceId;\n\n private _nomenclatureId: number = 0;\n getNomenclatureId = () => this._nomenclatureId;\n\n private _signTimeInteraction: number = 0;\n getSignTimeInteraction = () => this._signTimeInteraction;\n\n /**\n * Creates a new MPageOrder with the order action 'ACTIVATE', which is the prototype for activating an existing future order.\n *\n * @since 0.1.0\n * @category MPage Events - Orders\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willActivate(orderId: number) {\n this._orderAction = 'ACTIVATE';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CANCEL DC', which is the prototype for canceling and discontinuing an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willCancelDiscontinue(orderId: number) {\n this._orderAction = 'CANCEL DC';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CANCEL REORD', which is the prototype for cancelling and reordering an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willCancelReorder(orderId: number) {\n this._orderAction = 'CANCEL REORD';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CLEAR', which is the prototype for clearing actions of an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willClear(orderId: number) {\n this._orderAction = 'CLEAR';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CONVERT_INPAT', which is the prototype for converting a prescription order into an inpatient order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willConvertInpatient(orderId: number) {\n this._orderAction = 'CONVERT_INPAT';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CONVERT_RX', which is the prototype for converting an inpatient order into a prescription.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willConvertToPrescriptionOrder(orderId: number) {\n this._orderAction = 'CONVERT_RX';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'MODIFY', which is the prototype for modifying an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willModify(orderId: number) {\n this._orderAction = 'MODIFY';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPage Order with order action 'ORDER'.\n *\n * @since 0.1.0\n * @category MPage Events - Orders\n * @param {number} synonymId The Cerner synonym_id to be associated with the new order. Must be set.\n * @param {NewOrderOpts} options required when making a new order\n * @returns {this} Returns itself to continue chaining method calls.\n * default to a normal order type.\n * @throws Error if `isRxOrder` and `isSatelliteOrder` are both set to true. These two are mutually exclusive and setting\n * both creates underfined behavior with respect the order origination field.\n * @example\n * m.willMakeNewOrder(34, true, 13, 42, true).toString() => \"{'ORDER'|34|5|1342|1}\"\n */\n\n willMakeNewOrder(synonymId: number, opts?: NewOrderOpts) {\n const {\n isRxOrder,\n isSatelliteOrder,\n orderSentenceId,\n nomenclatureId,\n skipInteractionCheckUntilSign,\n } = opts || {};\n\n if (isRxOrder && isSatelliteOrder)\n throw new Error('must select either isRxOrder or isSatelliteOrder');\n this._orderAction = 'ORDER';\n this._synonymId = synonymId;\n this._orderSentenceId = orderSentenceId || 0;\n this._nomenclatureId = nomenclatureId || 0;\n this._signTimeInteraction = skipInteractionCheckUntilSign ? 1 : 0;\n this._orderOrigination = isSatelliteOrder ? 5 : isRxOrder ? 1 : 0;\n\n return this;\n }\n\n /**\n * Creates a new MPageOrder with the order action 'RENEW', which is the prototype for reviewing an existing non-prescription order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willRenewNonPrescription(orderId: number) {\n this._orderAction = 'RENEW';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'RENEW_RX', which is the prototype for renewing an existing prescription order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willRenewPrescription(orderId: number) {\n this._orderAction = 'RENEW_RX';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'REPEAT', which is the prototype for copying an order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willCopyExistingOrder(orderId: number) {\n this._orderAction = 'REPEAT';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'RESUME', which is the prototype for resuming a suspended order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willResumeSuspendedOrder(orderId: number) {\n this._orderAction = 'RESUME';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'SUSPEND', which is the prototype for suspending an existing order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willSuspend(orderId: number) {\n this._orderAction = 'SUSPEND';\n this._orderId = orderId;\n return this;\n }\n\n /**\n * Overrides the toString() method for representing the objects internal state as a string.\n *\n * @since 0.1.0\n * @returns {string} string representation of MPageOrder's internal state\n */\n toString(): string {\n return this._orderAction === 'ORDER'\n ? `{${this._orderAction}|${this._synonymId}|${this._orderOrigination}|${this._orderSentenceId}|${this._nomenclatureId}|${this._signTimeInteraction}}`\n : `{${this._orderAction}|${this._orderId}}`;\n }\n}\n"],"names":["statusCodeMap","Map","set","makeCclRequest","opts","prg","excludeMine","params","paramsList","processCclRequestParams","Promise","resolve","reject","request","window","XMLCclRequest","open","send","onreadystatechange","data","meta","responseText","status","statusText","get","undefined","JSON","parse","readyState","e","ReferenceError","updatedParams","type","param","paramString","map","join","openPatientTab","pid","eid","tab","quickAdd","args","toUpperCase","APPLINK","console","warn","openOrganizerTab","MPageOrderEvent","_orders","tabDisplayFlag","_tabList","_personId","_encounterId","_powerPlanFlag","_defaultDisplay","_silentSignFlag","customizeOrderListProfile","launchOrderProfile","forPerson","id","forEncounter","addOrders","orders","Array","isArray","concat","enablePowerPlans","customizeMedicationListProfile","enablePowerOrders","launchOrderSearch","launchOrdersForSignature","signSilently","MPAGES_EVENT","toString","head","body","forEach","order","tail","MPageOrder","_orderAction","_orderId","_synonymId","_orderOrigination","_orderSentenceId","_nomenclatureId","_signTimeInteraction","willActivate","orderId","willCancelDiscontinue","willCancelReorder","willClear","willConvertInpatient","willConvertToPrescriptionOrder","willModify","willMakeNewOrder","synonymId","isRxOrder","isSatelliteOrder","orderSentenceId","nomenclatureId","skipInteractionCheckUntilSign","Error","willRenewNonPrescription","willRenewPrescription","willCopyExistingOrder","willResumeSuspendedOrder","willSuspend"],"mappings":";;;;AAyDA,IAAMA,aAAa,gBAA8B,IAAIC,GAAJ,EAAjD;AACAD,aAAa,CAACE,GAAd,CAAkB,GAAlB,EAAuB,SAAvB;AACAF,aAAa,CAACE,GAAd,CAAkB,GAAlB,EAAuB,oBAAvB;AACAF,aAAa,CAACE,GAAd,CAAkB,GAAlB,EAAuB,eAAvB;AACAF,aAAa,CAACE,GAAd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G,CAAH,GAAO,CAAhE;IAEA,OAAO,IAAP;;;;;;;;;;;EA5IJ,OAsJEM,wBAtJF,GAsJE,kCAAyBf,OAAzB;IACE,KAAKR,YAAL,GAAoB,OAApB;IACA,KAAKC,QAAL,GAAgBO,OAAhB;IACA,OAAO,IAAP;;;;;;;;;;;EAzJJ,OAkKEgB,qBAlKF,GAkKE,+BAAsBhB,OAAtB;IACE,KAAKR,YAAL,GAAoB,UAApB;IACA,KAAKC,QAAL,GAAgBO,OAAhB;IACA,OAAO,IAAP;;;;;;;;;;;EArKJ,OA8KEiB,qBA9KF,GA8KE,+BAAsBjB,OAAtB;IACE,KAAKR,YAAL,GAAoB,QAApB;IACA,KAAKC,QAAL,GAAgBO,OAAhB;IACA,OAAO,IAAP;;;;;;;;;;;EAjLJ,OA0LEkB,wBA1LF,GA0LE,kCAAyBlB,OAAzB;IACE,KAAKR,YAAL,GAAoB,QAApB;IACA,KAAKC,QAAL,GAAgBO,OAAhB;IACA,OAAO,IAAP;;;;;;;;;;;EA7LJ,OAsMEmB,WAtMF,GAsME,qBAAYnB,OAAZ;IACE,KAAKR,YAAL,GAAoB,SAApB;IACA,KAAKC,QAAL,GAAgBO,OAAhB;IACA,OAAO,IAAP;;;;;;;;;;EAzMJ,OAkNEf,QAlNF,GAkNE;IACE,OAAO,KAAKO,YAAL,KAAsB,OAAtB,SACC,KAAKA,YADN,SACsB,KAAKE,UAD3B,SACyC,KAAKC,iBAD9C,SACmE,KAAKC,gBADxE,SAC4F,KAAKC,eADjG,SACoH,KAAKC,oBADzH,eAEC,KAAKN,YAFN,SAEsB,KAAKC,QAF3B,MAAP;GAnNJ;;EAAA;AAAA;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=new Map;t.set(200,"success"),t.set(405,"method not allowed"),t.set(409,"invalid state"),t.set(492,"non-fatal error"),t.set(493,"memory error"),t.set(500,"internal server exception");var e=
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=new Map;t.set(200,"success"),t.set(405,"method not allowed"),t.set(409,"invalid state"),t.set(492,"non-fatal error"),t.set(493,"memory error"),t.set(500,"internal server exception");var e=function(){function t(){var t=this;this.getOrders=function(){return t._orders},this._tabList={tab:0,tabDisplayFlag:0},this.getTabList=function(){return t._tabList},this._personId=0,this.getPersonId=function(){return t._personId},this._encounterId=0,this.getEncounterId=function(){return t._encounterId},this._powerPlanFlag=0,this.getPowerPlanFlag=function(){return t._powerPlanFlag},this._defaultDisplay=0,this.getDefaultDisplay=function(){return t._defaultDisplay},this._silentSignFlag=0,this.getSilentSignFlag=function(){return t._silentSignFlag},this._orders=[],this._tabList={tab:0,tabDisplayFlag:0},this._powerPlanFlag=0,this._tabList.tabDisplayFlag=0,this.customizeOrderListProfile(),this.launchOrderProfile(),this._silentSignFlag=0}var e=t.prototype;return e.forPerson=function(t){return this._personId=t,this},e.forEncounter=function(t){return this._encounterId=t,this},e.addOrders=function(t){return Array.isArray(t)||(t=[t]),this._orders=this._orders.concat(t),this},e.enablePowerPlans=function(){return this._powerPlanFlag=24,this},e.customizeOrderListProfile=function(){return this._tabList.tab=2,this},e.customizeMedicationListProfile=function(){return this._tabList.tab=3,this},e.enablePowerOrders=function(){return this._tabList.tabDisplayFlag=127,this},e.launchOrderSearch=function(){return this._defaultDisplay=8,this},e.launchOrderProfile=function(){return this._defaultDisplay=16,this},e.launchOrdersForSignature=function(){return this._defaultDisplay=32,this},e.signSilently=function(){return this._silentSignFlag=1,this},e.send=function(){try{window.MPAGES_EVENT("ORDERS",this.toString())}catch(t){if(!(t instanceof ReferenceError))throw t;console.warn("We're likely not inside PowerChart. The output would be an MPAGES_EVENT: "+this.toString())}},e.toString=function(){var t=this._personId+"|"+this._encounterId+"|",e="";return this._orders.forEach((function(t){e+=t.toString()})),""+t+e+"|"+this._powerPlanFlag+"|{"+this._tabList.tab+"|"+this._tabList.tabDisplayFlag+"}|"+this._defaultDisplay+"|"+this._silentSignFlag},t}();exports.MPageOrder=function(){function t(){var t=this;this._orderAction="",this.getOrderAction=function(){return t._orderAction},this._orderId=0,this.getOrderId=function(){return t._orderId},this._synonymId=0,this.getSynonymId=function(){return t._synonymId},this._orderOrigination=0,this.getOrderOrigination=function(){return t._orderOrigination},this._orderSentenceId=0,this.getOrderSentenceId=function(){return t._orderSentenceId},this._nomenclatureId=0,this.getNomenclatureId=function(){return t._nomenclatureId},this._signTimeInteraction=0,this.getSignTimeInteraction=function(){return t._signTimeInteraction}}var e=t.prototype;return e.willActivate=function(t){return this._orderAction="ACTIVATE",this._orderId=t,this},e.willCancelDiscontinue=function(t){return this._orderAction="CANCEL DC",this._orderId=t,this},e.willCancelReorder=function(t){return this._orderAction="CANCEL REORD",this._orderId=t,this},e.willClear=function(t){return this._orderAction="CLEAR",this._orderId=t,this},e.willConvertInpatient=function(t){return this._orderAction="CONVERT_INPAT",this._orderId=t,this},e.willConvertToPrescriptionOrder=function(t){return this._orderAction="CONVERT_RX",this._orderId=t,this},e.willModify=function(t){return this._orderAction="MODIFY",this._orderId=t,this},e.willMakeNewOrder=function(t,e){var r=e||{},n=r.isRxOrder,i=r.isSatelliteOrder,o=r.orderSentenceId,s=r.nomenclatureId,a=r.skipInteractionCheckUntilSign;if(n&&i)throw new Error("must select either isRxOrder or isSatelliteOrder");return this._orderAction="ORDER",this._synonymId=t,this._orderSentenceId=o||0,this._nomenclatureId=s||0,this._signTimeInteraction=a?1:0,this._orderOrigination=i?5:n?1:0,this},e.willRenewNonPrescription=function(t){return this._orderAction="RENEW",this._orderId=t,this},e.willRenewPrescription=function(t){return this._orderAction="RENEW_RX",this._orderId=t,this},e.willCopyExistingOrder=function(t){return this._orderAction="REPEAT",this._orderId=t,this},e.willResumeSuspendedOrder=function(t){return this._orderAction="RESUME",this._orderId=t,this},e.willSuspend=function(t){return this._orderAction="SUSPEND",this._orderId=t,this},e.toString=function(){return"ORDER"===this._orderAction?"{"+this._orderAction+"|"+this._synonymId+"|"+this._orderOrigination+"|"+this._orderSentenceId+"|"+this._nomenclatureId+"|"+this._signTimeInteraction+"}":"{"+this._orderAction+"|"+this._orderId+"}"},t}(),exports.MPageOrderEvent=e,exports.makeCclRequest=function(e){var r,n=e.prg,i=(r=(r=e.params)||[],(e.excludeMine?[].concat(r):[{type:"string",param:"MINE"}].concat(r)).map((function(t){var e=t.param;return"string"===t.type?"'"+e+"'":e})).join(","));return new Promise((function(e,r){try{var o=window.XMLCclRequest();o.open("GET",""+n),o.send(i),o.onreadystatechange=function(){var s={meta:{responseText:o.responseText,status:o.status,statusText:t.get(o.status)||"status refers to unknown error"},data:""===o.responseText?void 0:JSON.parse(o.responseText)};4===o.readyState?e(s):r("error with status "+o.status+" and readyState "+o.readyState+" on "+n+" with params "+i+" returning response text: "+(o.responseText||"no response text"))}}catch(t){if(!(t instanceof ReferenceError))throw t;r("We're likely not inside PowerChart. We cannot send request: \""+i+'" to "'+n+'"')}}))},exports.openOrganizerTab=function(t){try{window.APPLINK(0,"Powerchart.exe","/ORGANIZERTAB=^"+t+"^")}catch(e){if(!(e instanceof ReferenceError))throw e;console.warn('We\'re likely not inside PowerChart. The input given would be: \'0, "Powerchart.exe", "/ORGANIZERTAB=^'+t+"^\"'")}},exports.openPatientTab=function(t,e,r,n){var i="/PERSONID="+t+" /ENCNTRID="+e+" /FIRSTTAB=^"+r.toUpperCase()+(n?"+":"")+"^";try{window.APPLINK(1,"$APP_APPNAME$",i)}catch(t){if(!(t instanceof ReferenceError))throw t;console.warn("We're likely not inside PowerChart. The input given would be: '1, \"$APP_NAME$\", "+i+"'")}};
|
|
2
2
|
//# sourceMappingURL=fluent-cerner-js.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluent-cerner-js.cjs.production.min.js","sources":["../src/utils/index.ts","../src/MPageOrderEvent.ts","../src/MPageOrder.ts"],"sourcesContent":["/**\n * A type which represents the input parameter for an `XmlCclRequest`, which is wrapped by `makeCclRequest`.\n * The parameters are passed in a string, and numbers and strings are interpreted within this string by\n * the presence of quotes within quotes (e.g. single within double or vice versa). By strongly typing\n * the CclCallParam we can ensure that the parameters are always passed in a way that properly represents\n * their type.\n * @param {'string'|'number'} type - The type of the parameter.\n * @param {string} param - The string representing the parameters value.\n */\nexport type CclCallParam = {\n type: 'string' | 'number';\n param: string | number;\n};\n\n/**\n * A type which represents the full set of data required to make an XmlCclRequest, which is wrapped\n * by `makeCclRequest`.\n * @param {string} prg - The name of the CCL program to run, e.g. 12_USER_DETAILS.\n * @param {boolean?} excludeMine - Determines whether or not to include the \"MINE\" parameter as the\n * first parameter in the CCL call. This defaults to `false`, and almost all cases will require\n * the \"MINE\" parameter to be included.\n * @param {CclCallParam[]} params - An array of CclCallParam objects, each of which represents\n * a strongly typed parameter.\n */\nexport type CclOpts = {\n prg: string;\n excludeMine?: boolean;\n params: Array<CclCallParam>;\n};\n\n/**\n * A type functioning as a convience wrapper for several status\n * codes, respresented as strings, that are returned by XMLCclRequest.\n */\nexport type XmlCclStatus =\n | 'success'\n | 'method not allowed'\n | 'invalid state'\n | 'non-fatal error'\n | 'memory error'\n | 'internal server exception'\n | 'status refers to unknown error';\n\n/**\n * A type which represents the full set of data returned from an XmlCclRequest and important, formatted\n * metadata to help with debugging and error management. This is a generic type and data will represent\n * the type `T` which is the type or interface which represents the resolved data from the CCL request.\n */\nexport type CclRequestResponse<T> = {\n meta: {\n responseText: string;\n status: number;\n statusText: XmlCclStatus;\n };\n data: T | undefined;\n};\n\nconst statusCodeMap: Map<number, XmlCclStatus> = new Map();\nstatusCodeMap.set(200, 'success');\nstatusCodeMap.set(405, 'method not allowed');\nstatusCodeMap.set(409, 'invalid state');\nstatusCodeMap.set(492, 'non-fatal error');\nstatusCodeMap.set(493, 'memory error');\nstatusCodeMap.set(500, 'internal server exception');\n\n/**\n * A generic wrapper function for `XMLCclRequest` which simplifies it's use. Of note,\n * use of this requires the `head` of the HTML document contain the following\n * `meta` tag: `<META content='XMLCCLREQUEST' name='discern'>` so that it might\n * interface with the appropriate COM object.\n * @param {CclOpts} opts - Required options for the CCL request.\n * @returns a promise of type `CclRequestResponse<T>` where `T` is the type\n * or interface which represents the resolved data from the CCL request. If\n * no data are returned, that is an empty string, from the XMLCclRequest then\n * the `data` field will be set to `undefined`. The objects `meta` field\n * includes `responseText`, `status`, and `statusTest` fields.\n * @resolves the `CclRequestResponse<T>` where `T` is the type\n * or interface which represents the resolved data from the CCL request. If\n * no data are returned, that is an empty string, from the XMLCclRequest then\n * the `data` field will be set to `undefined`. The objects `meta` field\n * includes `responseText`, `status`, and `statusTest` fields.\n * @rejects with an error message if the CCL request fails.\n */\nexport function makeCclRequest<T>(\n opts: CclOpts\n): Promise<CclRequestResponse<T>> {\n const { prg, excludeMine, params } = opts;\n const paramsList =\n (excludeMine ? '' : \"'MINE',\") +\n params\n .map(({ type, param }) => (type === 'string' ? `'${param}'` : param))\n .join(',');\n return new Promise((resolve, reject) => {\n try {\n const request = (function() {\n if (window.XMLCclRequest) {\n return window.XMLCclRequest;\n }\n\n return _dummyXMLCclRequest;\n })();\n\n request.open('GET', `${prg}`);\n request.send(paramsList);\n request.onreadystatechange = function() {\n const data: CclRequestResponse<T> = {\n meta: {\n responseText: request.responseText,\n status: request.status,\n statusText:\n statusCodeMap.get(request.status) ||\n 'status refers to unknown error',\n },\n data:\n request.responseText === ''\n ? undefined\n : JSON.parse(request.responseText),\n };\n if (request.readyState === 4) {\n resolve(data);\n } else {\n reject(\n `error with status ${request.status} and readyState ${\n request.readyState\n } on ${prg} with params ${paramsList} returning response text: ${request.responseText ||\n 'no response text'}`\n );\n }\n };\n } catch (e) {\n if (e instanceof ReferenceError) {\n reject(\n `We're likely not inside PowerChart. We cannot send request: \"${paramsList}\" to \"${prg}\"`\n );\n } else {\n throw e;\n }\n }\n });\n}\n\n/**\n * Attempts to open a tab with the name given to the `tab` variable in a\n * patients chart given in the context of a given encounter.\n * @param pid The patients person id.\n * @param eid The patients encounter id.\n * @param tab The string which represents the tab to open\n * (case insensitive). Navigation will be made to the first\n * upper-level tab in the chart that that matches the `tab` string\n * If no match is found, then sub-tab names will be searched and\n * navigation made to the first sub-tab that matches\n * the `tab` string. If no matches are found, no navigation will occur.\n * @param quickAdd {boolean} - If true, will attempt to open the window\n * in a quick add mode. E.g. if the Orders tab is connected to it will\n * attempt to launch the Add Order window so long as Enhanced Navigation is\n * supported by your installation.\n */\nexport function openPatientTab(\n pid: number,\n eid: number,\n tab: string,\n quickAdd: boolean\n): void {\n const args = `/PERSONID=${pid} /ENCNTRID=${eid} /FIRSTTAB=^${tab.toUpperCase()}${\n quickAdd ? '+' : ''\n }^`;\n\n try {\n window.APPLINK(1, '$APP_APPNAME$', args);\n } catch (e) {\n if (e instanceof ReferenceError) {\n console.warn(\n `We're likely not inside PowerChart. The input given would be: '1, \"$APP_NAME$\", ${args}'`\n );\n } else {\n throw e;\n }\n }\n}\n\nconst _dummyXMLCclRequest: XMLCclRequest = {\n options: {},\n readyState: 0,\n responseText: '',\n status: 0,\n statusText: '',\n sendFlag: false,\n errorFlag: false,\n responseBody: '',\n responseXML: '',\n async: false,\n requestBinding: '',\n requestText: '',\n blobIn: '',\n onreadystatechange: function(): void {\n throw new Error('Function not implemented.');\n },\n onerror: function(): void {\n throw new Error('Function not implemented.');\n },\n abort: function(): void {\n throw new Error('Function not implemented.');\n },\n getAllResponseHeaders: function(): string[] {\n throw new Error('Function not implemented.');\n },\n // @ts-ignore - dummy function\n getResponseHeader: function(header: string): string {\n throw new Error('Function not implemented.');\n },\n // @ts-ignore - dummy function\n open: function(method: string, url: string, async?: boolean): void {\n throw new Error('Function not implemented.');\n },\n // @ts-ignore - dummy function\n send: function(data: string): void {\n throw new Error('Function not implemented.');\n },\n // @ts-ignore - dummy function\n setRequestHeader: function(name: string, value: string): void {\n throw new Error('Function not implemented.');\n },\n};\n","import { MPageOrder } from '.';\n\nclass MPageOrderEvent {\n private _orders: Array<MPageOrder>;\n getOrders = () => this._orders;\n\n private _tabList: { tab: number; tabDisplayFlag: number } = {\n tab: 0,\n tabDisplayFlag: 0,\n };\n getTabList = () => this._tabList;\n\n private _personId: number = 0;\n getPersonId = () => this._personId;\n\n private _encounterId: number = 0;\n getEncounterId = () => this._encounterId;\n\n private _powerPlanFlag: number = 0;\n getPowerPlanFlag = () => this._powerPlanFlag;\n\n private _defaultDisplay: number = 0;\n getDefaultDisplay = () => this._defaultDisplay;\n\n private _silentSignFlag: number = 0;\n getSilentSignFlag = () => this._silentSignFlag;\n\n constructor() {\n this._orders = [];\n this._tabList = { tab: 0, tabDisplayFlag: 0 };\n // Disable PowerPlans by default\n this._powerPlanFlag = 0;\n // Disable PowerOrders by default\n this._tabList.tabDisplayFlag = 0;\n this.customizeOrderListProfile();\n this.launchOrderProfile();\n // Do NOT sign silently by default\n this._silentSignFlag = 0;\n }\n\n forPerson(id: number) {\n this._personId = id;\n return this;\n }\n\n forEncounter(id: number) {\n this._encounterId = id;\n return this;\n }\n\n addOrders(orders: Array<MPageOrder> | MPageOrder) {\n if (!Array.isArray(orders)) {\n orders = [orders];\n }\n this._orders = this._orders.concat(orders);\n return this;\n }\n\n enablePowerPlans() {\n this._powerPlanFlag = 24;\n return this;\n }\n\n customizeOrderListProfile() {\n this._tabList.tab = 2;\n return this;\n }\n\n customizeMedicationListProfile() {\n this._tabList.tab = 3;\n return this;\n }\n\n enablePowerOrders() {\n this._tabList.tabDisplayFlag = 127;\n return this;\n }\n\n launchOrderSearch() {\n this._defaultDisplay = 8;\n return this;\n }\n\n launchOrderProfile() {\n this._defaultDisplay = 16;\n return this;\n }\n\n launchOrdersForSignature() {\n this._defaultDisplay = 32;\n return this;\n }\n\n signSilently() {\n this._silentSignFlag = 1;\n return this;\n }\n\n send() {\n try {\n window.MPAGES_EVENT('ORDERS', this.toString());\n } catch (e) {\n if (e instanceof ReferenceError) {\n console.warn(\n `We're likely not inside PowerChart. The output would be an MPAGES_EVENT: ${this.toString()}`\n );\n } else {\n throw e;\n }\n }\n }\n\n toString(): string {\n const head = `${this._personId}|${this._encounterId}|`;\n let body: string = '';\n this._orders.forEach(order => {\n body += order.toString();\n });\n const tail = `|${this._powerPlanFlag}|{${this._tabList.tab}|${this._tabList.tabDisplayFlag}}|${this._defaultDisplay}|${this._silentSignFlag}`;\n\n return `${head}${body}${tail}`;\n }\n}\n\nexport { MPageOrderEvent };\n","/**\n * Options for a new order\n * @param {boolean} isRxOrder Marks the order order as a prescription. Is mutually exclusive from\n * isSatelliteOrder. Field will be set to false if left undefined; this resolves to 0 when built.\n * @param {boolean} isSatelliteOrder Moarks the order origination as satellite. Is mutually\n * exclusive from isRxOrder. Field will be set to false if left undefined; this resolves to 0 when built.\n * @param {number} orderSentenceId The optional Cerner order_sentence_id to be associated with\n * the new order. Field will be set to 0 if undefined.\n * @param {number} nomenclatureId The optional Cerner nomenclature_id to be associated with the\n * new order. Field will be set to 0 if undefined.\n * @param {boolean} skipInteractionCheckUntilSign Determines cerner sign-time interaction\n * checking. A value of true skips checking for interactions until orders are signed, false\n * will not. Field will be set to false if left undefined; this resolves to 0 when built.\n */\nexport type NewOrderOpts = {\n isRxOrder?: boolean;\n isSatelliteOrder?: boolean;\n orderSentenceId?: number;\n nomenclatureId?: number;\n skipInteractionCheckUntilSign?: boolean;\n};\n\nexport class MPageOrder {\n private _orderAction: string = '';\n getOrderAction = () => this._orderAction;\n\n private _orderId: number = 0;\n getOrderId = () => this._orderId;\n\n private _synonymId: number = 0;\n getSynonymId = () => this._synonymId;\n\n private _orderOrigination: number = 0;\n getOrderOrigination = () => this._orderOrigination;\n\n private _orderSentenceId: number = 0;\n getOrderSentenceId = () => this._orderSentenceId;\n\n private _nomenclatureId: number = 0;\n getNomenclatureId = () => this._nomenclatureId;\n\n private _signTimeInteraction: number = 0;\n getSignTimeInteraction = () => this._signTimeInteraction;\n\n /**\n * Creates a new MPageOrder with the order action 'ACTIVATE', which is the prototype for activating an existing future order.\n *\n * @since 0.1.0\n * @category MPage Events - Orders\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willActivate(orderId: number) {\n this._orderAction = 'ACTIVATE';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CANCEL DC', which is the prototype for canceling and discontinuing an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willCancelDiscontinue(orderId: number) {\n this._orderAction = 'CANCEL DC';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CANCEL REORD', which is the prototype for cancelling and reordering an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willCancelReorder(orderId: number) {\n this._orderAction = 'CANCEL REORD';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CLEAR', which is the prototype for clearing actions of an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willClear(orderId: number) {\n this._orderAction = 'CLEAR';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CONVERT_INPAT', which is the prototype for converting a prescription order into an inpatient order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willConvertInpatient(orderId: number) {\n this._orderAction = 'CONVERT_INPAT';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CONVERT_RX', which is the prototype for converting an inpatient order into a prescription.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willConvertToPrescriptionOrder(orderId: number) {\n this._orderAction = 'CONVERT_RX';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'MODIFY', which is the prototype for modifying an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willModify(orderId: number) {\n this._orderAction = 'MODIFY';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPage Order with order action 'ORDER'.\n *\n * @since 0.1.0\n * @category MPage Events - Orders\n * @param {number} synonymId The Cerner synonym_id to be associated with the new order. Must be set.\n * @param {NewOrderOpts} options required when making a new order\n * @returns {this} Returns itself to continue chaining method calls.\n * default to a normal order type.\n * @throws Error if `isRxOrder` and `isSatelliteOrder` are both set to true. These two are mutually exclusive and setting\n * both creates underfined behavior with respect the order origination field.\n * @example\n * m.willMakeNewOrder(34, true, 13, 42, true).toString() => \"{'ORDER'|34|5|1342|1}\"\n */\n\n willMakeNewOrder(synonymId: number, opts?: NewOrderOpts) {\n const {\n isRxOrder,\n isSatelliteOrder,\n orderSentenceId,\n nomenclatureId,\n skipInteractionCheckUntilSign,\n } = opts || {};\n\n if (isRxOrder && isSatelliteOrder)\n throw new Error('must select either isRxOrder or isSatelliteOrder');\n this._orderAction = 'ORDER';\n this._synonymId = synonymId;\n this._orderSentenceId = orderSentenceId || 0;\n this._nomenclatureId = nomenclatureId || 0;\n this._signTimeInteraction = skipInteractionCheckUntilSign ? 1 : 0;\n this._orderOrigination = isSatelliteOrder ? 5 : isRxOrder ? 1 : 0;\n\n return this;\n }\n\n /**\n * Creates a new MPageOrder with the order action 'RENEW', which is the prototype for reviewing an existing non-prescription order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willRenewNonPrescription(orderId: number) {\n this._orderAction = 'RENEW';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'RENEW_RX', which is the prototype for renewing an existing prescription order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willRenewPrescription(orderId: number) {\n this._orderAction = 'RENEW_RX';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'REPEAT', which is the prototype for copying an order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willCopyExistingOrder(orderId: number) {\n this._orderAction = 'REPEAT';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'RESUME', which is the prototype for resuming a suspended order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willResumeSuspendedOrder(orderId: number) {\n this._orderAction = 'RESUME';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'SUSPEND', which is the prototype for suspending an existing order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willSuspend(orderId: number) {\n this._orderAction = 'SUSPEND';\n this._orderId = orderId;\n return this;\n }\n\n /**\n * Overrides the toString() method for representing the objects internal state as a string.\n *\n * @since 0.1.0\n * @returns {string} string representation of MPageOrder's internal state\n */\n toString(): string {\n return this._orderAction === 'ORDER'\n ? `{${this._orderAction}|${this._synonymId}|${this._orderOrigination}|${this._orderSentenceId}|${this._nomenclatureId}|${this._signTimeInteraction}}`\n : `{${this._orderAction}|${this._orderId}}`;\n }\n}\n"],"names":["statusCodeMap","Map","set","_dummyXMLCclRequest","options","readyState","responseText","status","statusText","sendFlag","errorFlag","responseBody","responseXML","async","requestBinding","requestText","blobIn","onreadystatechange","Error","onerror","abort","getAllResponseHeaders","getResponseHeader","header","open","method","url","send","data","setRequestHeader","name","value","MPageOrderEvent","_this","_orders","tab","tabDisplayFlag","_tabList","_personId","_encounterId","_powerPlanFlag","_defaultDisplay","_silentSignFlag","customizeOrderListProfile","launchOrderProfile","forPerson","id","this","forEncounter","addOrders","orders","Array","isArray","concat","enablePowerPlans","customizeMedicationListProfile","enablePowerOrders","launchOrderSearch","launchOrdersForSignature","signSilently","window","MPAGES_EVENT","toString","e","ReferenceError","console","warn","head","body","forEach","order","_orderAction","_orderId","_synonymId","_orderOrigination","_orderSentenceId","_nomenclatureId","_signTimeInteraction","willActivate","orderId","willCancelDiscontinue","willCancelReorder","willClear","willConvertInpatient","willConvertToPrescriptionOrder","willModify","willMakeNewOrder","synonymId","opts","isRxOrder","isSatelliteOrder","orderSentenceId","nomenclatureId","skipInteractionCheckUntilSign","willRenewNonPrescription","willRenewPrescription","willCopyExistingOrder","willResumeSuspendedOrder","willSuspend","prg","paramsList","excludeMine","params","map","param","type","join","Promise","resolve","reject","request","XMLCclRequest","meta","get","undefined","JSON","parse","pid","eid","quickAdd","args","toUpperCase","APPLINK"],"mappings":"oEAyDA,IAAMA,EAA2C,IAAIC,IACrDD,EAAcE,IAAI,IAAK,WACvBF,EAAcE,IAAI,IAAK,sBACvBF,EAAcE,IAAI,IAAK,iBACvBF,EAAcE,IAAI,IAAK,mBACvBF,EAAcE,IAAI,IAAK,gBACvBF,EAAcE,IAAI,IAAK,6BAqHvB,IAAMC,EAAqC,CACzCC,QAAS,GACTC,WAAY,EACZC,aAAc,GACdC,OAAQ,EACRC,WAAY,GACZC,UAAU,EACVC,WAAW,EACXC,aAAc,GACdC,YAAa,GACbC,OAAO,EACPC,eAAgB,GAChBC,YAAa,GACbC,OAAQ,GACRC,mBAAoB,iBACZ,IAAIC,MAAM,8BAElBC,QAAS,iBACD,IAAID,MAAM,8BAElBE,MAAO,iBACC,IAAIF,MAAM,8BAElBG,sBAAuB,iBACf,IAAIH,MAAM,8BAGlBI,kBAAmB,SAASC,SACpB,IAAIL,MAAM,8BAGlBM,KAAM,SAASC,EAAgBC,EAAab,SACpC,IAAIK,MAAM,8BAGlBS,KAAM,SAASC,SACP,IAAIV,MAAM,8BAGlBW,iBAAkB,SAASC,EAAcC,SACjC,IAAIb,MAAM,+BC1Ndc,oDAEQ,kBAAMC,EAAKC,uBAEqC,CAC1DC,IAAK,EACLC,eAAgB,mBAEL,kBAA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B,KAAK8B,6BACxH9B,KAAKwB,iBAAgBxB,KAAKyB,6EFvJpCgB,OAEQW,EAA6BX,EAA7BW,IACFC,GAD+BZ,EAAxBa,YAEI,GAAK,WAFeb,EAAXc,OAIrBC,KAAI,gBAASC,IAAAA,YAAsB,aAA5BC,SAA2CD,MAAWA,KAC7DE,KAAK,YACH,IAAIC,SAAQ,SAACC,EAASC,WAEnBC,EACAlD,OAAOmD,cACFnD,OAAOmD,cAGT5G,EAGT2G,EAAQtF,KAAK,SAAU2E,GACvBW,EAAQnF,KAAKyE,GACbU,EAAQ7F,mBAAqB,eACrBW,EAA8B,CAClCoF,KAAM,CACJ1G,aAAcwG,EAAQxG,aACtBC,OAAQuG,EAAQvG,OAChBC,WACER,EAAciH,IAAIH,EAAQvG,SAC1B,kCAEJqB,KAC2B,KAAzBkF,EAAQxG,kBACJ4G,EACAC,KAAKC,MAAMN,EAAQxG,eAEA,IAAvBwG,EAAQzG,WACVuG,EAAQhF,GAERiF,uBACuBC,EAAQvG,0BAC3BuG,EAAQzG,kBACH8F,kBAAmBC,gCAAuCU,EAAQxG,cACvE,sBAIR,MAAOyD,QACHA,aAAaC,sBAKTD,EAJN8C,mEACkET,WAAmBD,4CA0B3FkB,EACAC,EACAnF,EACAoF,OAEMC,eAAoBH,gBAAiBC,iBAAkBnF,EAAIsF,eAC/DF,EAAW,IAAM,YAIjB3D,OAAO8D,QAAQ,EAAG,gBAAiBF,GACnC,MAAOzD,QACHA,aAAaC,sBAKTD,EAJNE,QAAQC,0FAC6EsD"}
|
|
1
|
+
{"version":3,"file":"fluent-cerner-js.cjs.production.min.js","sources":["../src/utils/makeCclRequest.ts","../src/MPageOrderEvent.ts","../src/MPageOrder.ts","../src/utils/openOrganizerTab.ts","../src/utils/openPatientTab.ts"],"sourcesContent":["/**\n * A type which represents the input parameter for an `XmlCclRequest`, which is wrapped by `makeCclRequest`.\n * The parameters are passed in a string, and numbers and strings are interpreted within this string by\n * the presence of quotes within quotes (e.g. single within double or vice versa). By strongly typing\n * the CclCallParam we can ensure that the parameters are always passed in a way that properly represents\n * their type.\n * @param {'string'|'number'} type - The type of the parameter.\n * @param {string} param - The string representing the parameters value.\n */\nexport type CclCallParam = {\n type: 'string' | 'number';\n param: string | number;\n};\n\n/**\n * A type which represents the full set of data required to make an XmlCclRequest, which is wrapped\n * by `makeCclRequest`.\n * @param {string} prg - The name of the CCL program to run, e.g. 12_USER_DETAILS.\n * @param {boolean?} excludeMine - Determines whether or not to include the \"MINE\" parameter as the\n * first parameter in the CCL call. This defaults to `false`, and almost all cases will require\n * the \"MINE\" parameter to be included.\n * @param {CclCallParam[]} params - An array of CclCallParam objects, each of which represents\n * a strongly typed parameter.\n */\nexport type CclOpts = {\n prg: string;\n excludeMine?: boolean;\n params: Array<CclCallParam>;\n};\n\n/**\n * A type functioning as a convience wrapper for several status\n * codes, respresented as strings, that are returned by XMLCclRequest.\n */\nexport type XmlCclStatus =\n | 'success'\n | 'method not allowed'\n | 'invalid state'\n | 'non-fatal error'\n | 'memory error'\n | 'internal server exception'\n | 'status refers to unknown error';\n\n/**\n * A type which represents the full set of data returned from an XmlCclRequest and important, formatted\n * metadata to help with debugging and error management. This is a generic type and data will represent\n * the type `T` which is the type or interface which represents the resolved data from the CCL request.\n */\nexport type CclRequestResponse<T> = {\n meta: {\n responseText: string;\n status: number;\n statusText: XmlCclStatus;\n };\n data: T | undefined;\n};\n\nconst statusCodeMap: Map<number, XmlCclStatus> = new Map();\nstatusCodeMap.set(200, 'success');\nstatusCodeMap.set(405, 'method not allowed');\nstatusCodeMap.set(409, 'invalid state');\nstatusCodeMap.set(492, 'non-fatal error');\nstatusCodeMap.set(493, 'memory error');\nstatusCodeMap.set(500, 'internal server exception');\n\n/**\n * A generic wrapper function for `XMLCclRequest` which simplifies it's use. Of note,\n * use of this requires the `head` of the HTML document contain the following\n * `meta` tag: `<META content='XMLCCLREQUEST' name='discern'>` so that it might\n * interface with the appropriate COM object.\n * @param {CclOpts} opts - Required options for the CCL request.\n * @returns a promise of type `CclRequestResponse<T>` where `T` is the type\n * or interface which represents the resolved data from the CCL request. If\n * no data are returned, that is an empty string, from the XMLCclRequest then\n * the `data` field will be set to `undefined`. The objects `meta` field\n * includes `responseText`, `status`, and `statusTest` fields.\n * @resolves the `CclRequestResponse<T>` where `T` is the type\n * or interface which represents the resolved data from the CCL request. If\n * no data are returned, that is an empty string, from the XMLCclRequest then\n * the `data` field will be set to `undefined`. The objects `meta` field\n * includes `responseText`, `status`, and `statusTest` fields.\n * @rejects with an error message if the CCL request fails.\n */\nexport function makeCclRequest<T>(\n opts: CclOpts\n): Promise<CclRequestResponse<T>> {\n const { prg, excludeMine, params } = opts;\n const paramsList = processCclRequestParams(params, excludeMine || false);\n\n return new Promise((resolve, reject) => {\n try {\n // @ts-ignore - From Powerchart context\n const request: XMLCclRequest = window.XMLCclRequest();\n\n request.open('GET', `${prg}`);\n request.send(paramsList);\n request.onreadystatechange = function() {\n const data: CclRequestResponse<T> = {\n meta: {\n responseText: request.responseText,\n status: request.status,\n statusText:\n statusCodeMap.get(request.status) ||\n 'status refers to unknown error',\n },\n data:\n request.responseText === ''\n ? undefined\n : JSON.parse(request.responseText),\n };\n if (request.readyState === 4) {\n resolve(data);\n } else {\n reject(\n `error with status ${request.status} and readyState ${\n request.readyState\n } on ${prg} with params ${paramsList} returning response text: ${request.responseText ||\n 'no response text'}`\n );\n }\n };\n } catch (e) {\n if (e instanceof ReferenceError) {\n reject(\n `We're likely not inside PowerChart. We cannot send request: \"${paramsList}\" to \"${prg}\"`\n );\n } else {\n throw e;\n }\n }\n });\n}\n\n/**\n * A function which processes the CCL request parameters, converting them to a string compatible with an XmlCclRequest.\n * @param params {Array<CclCallParam>} An array of CclCallParam objects, each of which represents\n * @param excludeMine {boolean} Determines whether or not to include the \"MINE\" parameter as the\n * @returns {string} the XmlCclRequest compatible string.\n */\nexport function processCclRequestParams(\n params?: Array<CclCallParam>,\n excludeMine?: boolean\n) {\n params = params || [];\n excludeMine = excludeMine || false;\n\n const updatedParams: Array<CclCallParam> = excludeMine\n ? [...params]\n : [{ type: 'string', param: 'MINE' }, ...params];\n\n const paramString = updatedParams\n .map(({ type, param }) => (type === 'string' ? `'${param}'` : param))\n .join(',');\n\n return paramString;\n}\n","import { MPageOrder } from '.';\n\nclass MPageOrderEvent {\n private _orders: Array<MPageOrder>;\n getOrders = () => this._orders;\n\n private _tabList: { tab: number; tabDisplayFlag: number } = {\n tab: 0,\n tabDisplayFlag: 0,\n };\n getTabList = () => this._tabList;\n\n private _personId: number = 0;\n getPersonId = () => this._personId;\n\n private _encounterId: number = 0;\n getEncounterId = () => this._encounterId;\n\n private _powerPlanFlag: number = 0;\n getPowerPlanFlag = () => this._powerPlanFlag;\n\n private _defaultDisplay: number = 0;\n getDefaultDisplay = () => this._defaultDisplay;\n\n private _silentSignFlag: number = 0;\n getSilentSignFlag = () => this._silentSignFlag;\n\n constructor() {\n this._orders = [];\n this._tabList = { tab: 0, tabDisplayFlag: 0 };\n // Disable PowerPlans by default\n this._powerPlanFlag = 0;\n // Disable PowerOrders by default\n this._tabList.tabDisplayFlag = 0;\n this.customizeOrderListProfile();\n this.launchOrderProfile();\n // Do NOT sign silently by default\n this._silentSignFlag = 0;\n }\n\n forPerson(id: number) {\n this._personId = id;\n return this;\n }\n\n forEncounter(id: number) {\n this._encounterId = id;\n return this;\n }\n\n addOrders(orders: Array<MPageOrder> | MPageOrder) {\n if (!Array.isArray(orders)) {\n orders = [orders];\n }\n this._orders = this._orders.concat(orders);\n return this;\n }\n\n enablePowerPlans() {\n this._powerPlanFlag = 24;\n return this;\n }\n\n customizeOrderListProfile() {\n this._tabList.tab = 2;\n return this;\n }\n\n customizeMedicationListProfile() {\n this._tabList.tab = 3;\n return this;\n }\n\n enablePowerOrders() {\n this._tabList.tabDisplayFlag = 127;\n return this;\n }\n\n launchOrderSearch() {\n this._defaultDisplay = 8;\n return this;\n }\n\n launchOrderProfile() {\n this._defaultDisplay = 16;\n return this;\n }\n\n launchOrdersForSignature() {\n this._defaultDisplay = 32;\n return this;\n }\n\n signSilently() {\n this._silentSignFlag = 1;\n return this;\n }\n\n send() {\n try {\n window.MPAGES_EVENT('ORDERS', this.toString());\n } catch (e) {\n if (e instanceof ReferenceError) {\n console.warn(\n `We're likely not inside PowerChart. The output would be an MPAGES_EVENT: ${this.toString()}`\n );\n } else {\n throw e;\n }\n }\n }\n\n toString(): string {\n const head = `${this._personId}|${this._encounterId}|`;\n let body: string = '';\n this._orders.forEach(order => {\n body += order.toString();\n });\n const tail = `|${this._powerPlanFlag}|{${this._tabList.tab}|${this._tabList.tabDisplayFlag}}|${this._defaultDisplay}|${this._silentSignFlag}`;\n\n return `${head}${body}${tail}`;\n }\n}\n\nexport { MPageOrderEvent };\n","/**\n * Options for a new order\n * @param {boolean} isRxOrder Marks the order order as a prescription. Is mutually exclusive from\n * isSatelliteOrder. Field will be set to false if left undefined; this resolves to 0 when built.\n * @param {boolean} isSatelliteOrder Moarks the order origination as satellite. Is mutually\n * exclusive from isRxOrder. Field will be set to false if left undefined; this resolves to 0 when built.\n * @param {number} orderSentenceId The optional Cerner order_sentence_id to be associated with\n * the new order. Field will be set to 0 if undefined.\n * @param {number} nomenclatureId The optional Cerner nomenclature_id to be associated with the\n * new order. Field will be set to 0 if undefined.\n * @param {boolean} skipInteractionCheckUntilSign Determines cerner sign-time interaction\n * checking. A value of true skips checking for interactions until orders are signed, false\n * will not. Field will be set to false if left undefined; this resolves to 0 when built.\n */\nexport type NewOrderOpts = {\n isRxOrder?: boolean;\n isSatelliteOrder?: boolean;\n orderSentenceId?: number;\n nomenclatureId?: number;\n skipInteractionCheckUntilSign?: boolean;\n};\n\nexport class MPageOrder {\n private _orderAction: string = '';\n getOrderAction = () => this._orderAction;\n\n private _orderId: number = 0;\n getOrderId = () => this._orderId;\n\n private _synonymId: number = 0;\n getSynonymId = () => this._synonymId;\n\n private _orderOrigination: number = 0;\n getOrderOrigination = () => this._orderOrigination;\n\n private _orderSentenceId: number = 0;\n getOrderSentenceId = () => this._orderSentenceId;\n\n private _nomenclatureId: number = 0;\n getNomenclatureId = () => this._nomenclatureId;\n\n private _signTimeInteraction: number = 0;\n getSignTimeInteraction = () => this._signTimeInteraction;\n\n /**\n * Creates a new MPageOrder with the order action 'ACTIVATE', which is the prototype for activating an existing future order.\n *\n * @since 0.1.0\n * @category MPage Events - Orders\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willActivate(orderId: number) {\n this._orderAction = 'ACTIVATE';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CANCEL DC', which is the prototype for canceling and discontinuing an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willCancelDiscontinue(orderId: number) {\n this._orderAction = 'CANCEL DC';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CANCEL REORD', which is the prototype for cancelling and reordering an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willCancelReorder(orderId: number) {\n this._orderAction = 'CANCEL REORD';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CLEAR', which is the prototype for clearing actions of an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willClear(orderId: number) {\n this._orderAction = 'CLEAR';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CONVERT_INPAT', which is the prototype for converting a prescription order into an inpatient order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willConvertInpatient(orderId: number) {\n this._orderAction = 'CONVERT_INPAT';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'CONVERT_RX', which is the prototype for converting an inpatient order into a prescription.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willConvertToPrescriptionOrder(orderId: number) {\n this._orderAction = 'CONVERT_RX';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'MODIFY', which is the prototype for modifying an existing future order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willModify(orderId: number) {\n this._orderAction = 'MODIFY';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPage Order with order action 'ORDER'.\n *\n * @since 0.1.0\n * @category MPage Events - Orders\n * @param {number} synonymId The Cerner synonym_id to be associated with the new order. Must be set.\n * @param {NewOrderOpts} options required when making a new order\n * @returns {this} Returns itself to continue chaining method calls.\n * default to a normal order type.\n * @throws Error if `isRxOrder` and `isSatelliteOrder` are both set to true. These two are mutually exclusive and setting\n * both creates underfined behavior with respect the order origination field.\n * @example\n * m.willMakeNewOrder(34, true, 13, 42, true).toString() => \"{'ORDER'|34|5|1342|1}\"\n */\n\n willMakeNewOrder(synonymId: number, opts?: NewOrderOpts) {\n const {\n isRxOrder,\n isSatelliteOrder,\n orderSentenceId,\n nomenclatureId,\n skipInteractionCheckUntilSign,\n } = opts || {};\n\n if (isRxOrder && isSatelliteOrder)\n throw new Error('must select either isRxOrder or isSatelliteOrder');\n this._orderAction = 'ORDER';\n this._synonymId = synonymId;\n this._orderSentenceId = orderSentenceId || 0;\n this._nomenclatureId = nomenclatureId || 0;\n this._signTimeInteraction = skipInteractionCheckUntilSign ? 1 : 0;\n this._orderOrigination = isSatelliteOrder ? 5 : isRxOrder ? 1 : 0;\n\n return this;\n }\n\n /**\n * Creates a new MPageOrder with the order action 'RENEW', which is the prototype for reviewing an existing non-prescription order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willRenewNonPrescription(orderId: number) {\n this._orderAction = 'RENEW';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'RENEW_RX', which is the prototype for renewing an existing prescription order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willRenewPrescription(orderId: number) {\n this._orderAction = 'RENEW_RX';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'REPEAT', which is the prototype for copying an order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willCopyExistingOrder(orderId: number) {\n this._orderAction = 'REPEAT';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'RESUME', which is the prototype for resuming a suspended order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willResumeSuspendedOrder(orderId: number) {\n this._orderAction = 'RESUME';\n this._orderId = orderId;\n return this;\n }\n /**\n * Creates a new MPageOrder with the order action 'SUSPEND', which is the prototype for suspending an existing order.\n *\n * @since 0.1.0\n * @param {number} orderId The order id value for the order to activate.\n * @returns {this} Returns itself to continue chaining method calls.\n */\n willSuspend(orderId: number) {\n this._orderAction = 'SUSPEND';\n this._orderId = orderId;\n return this;\n }\n\n /**\n * Overrides the toString() method for representing the objects internal state as a string.\n *\n * @since 0.1.0\n * @returns {string} string representation of MPageOrder's internal state\n */\n toString(): string {\n return this._orderAction === 'ORDER'\n ? `{${this._orderAction}|${this._synonymId}|${this._orderOrigination}|${this._orderSentenceId}|${this._nomenclatureId}|${this._signTimeInteraction}}`\n : `{${this._orderAction}|${this._orderId}}`;\n }\n}\n","/**\n * Attempts to open a tab with the name given to the `tab` variable in at the chart organizer\n * level.\n * @param tab The string which represents the tab to open\n * (case insensitive). Navigation will be made to the first\n * upper-level tab in the chart that that matches the `tab` string\n * If no match is found, then sub-tab names will be searched and\n * navigation made to the first sub-tab that matches\n * the `tab` string. If no matches are found, no navigation will occur.\n */\nexport function openOrganizerTab(tab: string): void {\n try {\n window.APPLINK(0, 'Powerchart.exe', `/ORGANIZERTAB=^${tab}^`);\n } catch (e) {\n if (e instanceof ReferenceError) {\n console.warn(\n `We're likely not inside PowerChart. The input given would be: '0, \"Powerchart.exe\", \"/ORGANIZERTAB=^${tab}^\"'`\n );\n } else {\n throw e;\n }\n }\n}\n","/**\n * Attempts to open a tab with the name given to the `tab` variable in a\n * patients chart given in the context of a given encounter.\n * @param pid The patients person id.\n * @param eid The patients encounter id.\n * @param tab The string which represents the tab to open\n * (case insensitive). Navigation will be made to the first\n * upper-level tab in the chart that that matches the `tab` string\n * If no match is found, then sub-tab names will be searched and\n * navigation made to the first sub-tab that matches\n * the `tab` string. If no matches are found, no navigation will occur.\n * @param quickAdd {boolean} - If true, will attempt to open the window\n * in a quick add mode. E.g. if the Orders tab is connected to it will\n * attempt to launch the Add Order window so long as Enhanced Navigation is\n * supported by your installation.\n */\nexport function openPatientTab(\n pid: number,\n eid: number,\n tab: string,\n quickAdd: boolean\n): void {\n const args = `/PERSONID=${pid} /ENCNTRID=${eid} /FIRSTTAB=^${tab.toUpperCase()}${\n quickAdd ? '+' : ''\n }^`;\n\n try {\n window.APPLINK(1, '$APP_APPNAME$', args);\n } catch (e) {\n if (e instanceof ReferenceError) {\n console.warn(\n `We're likely not inside PowerChart. The input given would be: '1, \"$APP_NAME$\", ${args}'`\n );\n } else {\n throw e;\n }\n }\n}\n"],"names":["statusCodeMap","Map","set","MPageOrderEvent","this","_this","_orders","tab","tabDisplayFlag","_tabList","_personId","_encounterId","_powerPlanFlag","_defaultDisplay","_silentSignFlag","customizeOrderListProfile","launchOrderProfile","forPerson","id","forEncounter","addOrders","orders","Array","isArray","concat","enablePowerPlans","customizeMedicationListProfile","enablePowerOrders","launchOrderSearch","launchOrdersForSignature","signSilently","send","window","MPAGES_EVENT","toString","e","ReferenceError","console","warn","head","body","forEach","order","_orderAction","_orderId","_synonymId","_orderOrigination","_orderSentenceId","_nomenclatureId","_signTimeInteraction","_proto","willActivate","orderId","willCancelDiscontinue","willCancelReorder","willClear","willConvertInpatient","willConvertToPrescriptionOrder","willModify","willMakeNewOrder","synonymId","opts","isRxOrder","isSatelliteOrder","orderSentenceId","nomenclatureId","skipInteractionCheckUntilSign","Error","willRenewNonPrescription","willRenewPrescription","willCopyExistingOrder","willResumeSuspendedOrder","willSuspend","params","prg","paramsList","excludeMine","type","param","map","join","Promise","resolve","reject","request","XMLCclRequest","open","onreadystatechange","data","meta","responseText","status","statusText","get","undefined","JSON","parse","readyState","APPLINK","pid","eid","quickAdd","args","toUpperCase"],"mappings":"oEAyDA,IAAMA,EAA2C,IAAIC,IACrDD,EAAcE,IAAI,IAAK,WACvBF,EAAcE,IAAI,IAAK,sBACvBF,EAAcE,IAAI,IAAK,iBACvBF,EAAcE,IAAI,IAAK,mBACvBF,EAAcE,IAAI,IAAK,gBACvBF,EAAcE,IAAI,IAAK,iCC7DjBC,aAyBJ,wBAvBAC,eAAY,WAAA,OAAMC,EAAKC,SAEfF,cAAoD,CAC1DG,IAAK,EACLC,eAAgB,GAElBJ,gBAAa,WAAA,OAAMC,EAAKI,UAEhBL,eAAoB,EAC5BA,iBAAc,WAAA,OAAMC,EAAKK,WAEjBN,kBAAuB,EAC/BA,oBAAiB,WAAA,OAAMC,EAAKM,cAEpBP,oBAAyB,EACjCA,sBAAmB,WAAA,OAAMC,EAAKO,gBAEtBR,qBAA0B,EAClCA,uBAAoB,WAAA,OAAMC,EAAKQ,iBAEvBT,qBAA0B,EAClCA,uBAAoB,WAAA,OAAMC,EAAKS,iBAG7BV,KAAKE,QAAU,GACfF,KAAKK,SAAW,CAAEF,IAAK,EAAGC,eAAgB,GAE1CJ,KAAKQ,eAAiB,EAEtBR,KAAKK,SAASD,eAAiB,EAC/BJ,KAAKW,4BACLX,KAAKY,qBAELZ,KAAKU,gBAAkB,6BAGzBG,UAAA,SAAUC,G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JH,KAC2B,KAAzBJ,EAAQM,kBACJI,EACAC,KAAKC,MAAMZ,EAAQM,eAEA,IAAvBN,EAAQa,WACVf,EAAQM,GAERL,uBACuBC,EAAQO,0BAC3BP,EAAQa,kBACHvB,kBAAmBC,gCAAuCS,EAAQM,cACvE,sBAIR,MAAOvD,GACP,KAAIA,aAAaC,gBAKf,MAAMD,EAJNgD,mEACkER,WAAmBD,8CGlH5DnE,GAC/B,IACEyB,OAAOkE,QAAQ,EAAG,mCAAoC3F,OACtD,MAAO4B,GACP,KAAIA,aAAaC,gBAKf,MAAMD,EAJNE,QAAQC,8GACiG/B,mCCA/G,SACE4F,EACAC,EACA7F,EACA8F,GAEA,IAAMC,eAAoBH,gBAAiBC,iBAAkB7F,EAAIgG,eAC/DF,EAAW,IAAM,QAGnB,IACErE,OAAOkE,QAAQ,EAAG,gBAAiBI,GACnC,MAAOnE,GACP,KAAIA,aAAaC,gBAKf,MAAMD,EAJNE,QAAQC,0FAC6EgE"}
|
|
@@ -28,21 +28,11 @@ function makeCclRequest(opts) {
|
|
|
28
28
|
var prg = opts.prg,
|
|
29
29
|
excludeMine = opts.excludeMine,
|
|
30
30
|
params = opts.params;
|
|
31
|
-
var paramsList = (
|
|
32
|
-
var type = _ref.type,
|
|
33
|
-
param = _ref.param;
|
|
34
|
-
return type === 'string' ? "'" + param + "'" : param;
|
|
35
|
-
}).join(',');
|
|
31
|
+
var paramsList = processCclRequestParams(params, excludeMine || false);
|
|
36
32
|
return new Promise(function (resolve, reject) {
|
|
37
33
|
try {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return window.XMLCclRequest;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return _dummyXMLCclRequest;
|
|
44
|
-
}();
|
|
45
|
-
|
|
34
|
+
// @ts-ignore - From Powerchart context
|
|
35
|
+
var request = window.XMLCclRequest();
|
|
46
36
|
request.open('GET', "" + prg);
|
|
47
37
|
request.send(paramsList);
|
|
48
38
|
|
|
@@ -71,6 +61,28 @@ function makeCclRequest(opts) {
|
|
|
71
61
|
}
|
|
72
62
|
});
|
|
73
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* A function which processes the CCL request parameters, converting them to a string compatible with an XmlCclRequest.
|
|
66
|
+
* @param params {Array<CclCallParam>} An array of CclCallParam objects, each of which represents
|
|
67
|
+
* @param excludeMine {boolean} Determines whether or not to include the "MINE" parameter as the
|
|
68
|
+
* @returns {string} the XmlCclRequest compatible string.
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
function processCclRequestParams(params, excludeMine) {
|
|
72
|
+
params = params || [];
|
|
73
|
+
excludeMine = excludeMine || false;
|
|
74
|
+
var updatedParams = excludeMine ? [].concat(params) : [{
|
|
75
|
+
type: 'string',
|
|
76
|
+
param: 'MINE'
|
|
77
|
+
}].concat(params);
|
|
78
|
+
var paramString = updatedParams.map(function (_ref) {
|
|
79
|
+
var type = _ref.type,
|
|
80
|
+
param = _ref.param;
|
|
81
|
+
return type === 'string' ? "'" + param + "'" : param;
|
|
82
|
+
}).join(',');
|
|
83
|
+
return paramString;
|
|
84
|
+
}
|
|
85
|
+
|
|
74
86
|
/**
|
|
75
87
|
* Attempts to open a tab with the name given to the `tab` variable in a
|
|
76
88
|
* patients chart given in the context of a given encounter.
|
|
@@ -87,7 +99,6 @@ function makeCclRequest(opts) {
|
|
|
87
99
|
* attempt to launch the Add Order window so long as Enhanced Navigation is
|
|
88
100
|
* supported by your installation.
|
|
89
101
|
*/
|
|
90
|
-
|
|
91
102
|
function openPatientTab(pid, eid, tab, quickAdd) {
|
|
92
103
|
var args = "/PERSONID=" + pid + " /ENCNTRID=" + eid + " /FIRSTTAB=^" + tab.toUpperCase() + (quickAdd ? '+' : '') + "^";
|
|
93
104
|
|
|
@@ -101,49 +112,28 @@ function openPatientTab(pid, eid, tab, quickAdd) {
|
|
|
101
112
|
}
|
|
102
113
|
}
|
|
103
114
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
abort: function abort() {
|
|
125
|
-
throw new Error('Function not implemented.');
|
|
126
|
-
},
|
|
127
|
-
getAllResponseHeaders: function getAllResponseHeaders() {
|
|
128
|
-
throw new Error('Function not implemented.');
|
|
129
|
-
},
|
|
130
|
-
// @ts-ignore - dummy function
|
|
131
|
-
getResponseHeader: function getResponseHeader(header) {
|
|
132
|
-
throw new Error('Function not implemented.');
|
|
133
|
-
},
|
|
134
|
-
// @ts-ignore - dummy function
|
|
135
|
-
open: function open(method, url, async) {
|
|
136
|
-
throw new Error('Function not implemented.');
|
|
137
|
-
},
|
|
138
|
-
// @ts-ignore - dummy function
|
|
139
|
-
send: function send(data) {
|
|
140
|
-
throw new Error('Function not implemented.');
|
|
141
|
-
},
|
|
142
|
-
// @ts-ignore - dummy function
|
|
143
|
-
setRequestHeader: function setRequestHeader(name, value) {
|
|
144
|
-
throw new Error('Function not implemented.');
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Attempts to open a tab with the name given to the `tab` variable in at the chart organizer
|
|
118
|
+
* level.
|
|
119
|
+
* @param tab The string which represents the tab to open
|
|
120
|
+
* (case insensitive). Navigation will be made to the first
|
|
121
|
+
* upper-level tab in the chart that that matches the `tab` string
|
|
122
|
+
* If no match is found, then sub-tab names will be searched and
|
|
123
|
+
* navigation made to the first sub-tab that matches
|
|
124
|
+
* the `tab` string. If no matches are found, no navigation will occur.
|
|
125
|
+
*/
|
|
126
|
+
function openOrganizerTab(tab) {
|
|
127
|
+
try {
|
|
128
|
+
window.APPLINK(0, 'Powerchart.exe', "/ORGANIZERTAB=^" + tab + "^");
|
|
129
|
+
} catch (e) {
|
|
130
|
+
if (e instanceof ReferenceError) {
|
|
131
|
+
console.warn("We're likely not inside PowerChart. The input given would be: '0, \"Powerchart.exe\", \"/ORGANIZERTAB=^" + tab + "^\"'");
|
|
132
|
+
} else {
|
|
133
|
+
throw e;
|
|
134
|
+
}
|
|
145
135
|
}
|
|
146
|
-
}
|
|
136
|
+
}
|
|
147
137
|
|
|
148
138
|
var MPageOrderEvent = /*#__PURE__*/function () {
|
|
149
139
|
function MPageOrderEvent() {
|
|
@@ -560,5 +550,5 @@ var MPageOrder = /*#__PURE__*/function () {
|
|
|
560
550
|
return MPageOrder;
|
|
561
551
|
}();
|
|
562
552
|
|
|
563
|
-
export { MPageOrder, MPageOrderEvent, makeCclRequest, openPatientTab };
|
|
553
|
+
export { MPageOrder, MPageOrderEvent, makeCclRequest, openOrganizerTab, openPatientTab };
|
|
564
554
|
//# sourceMappingURL=fluent-cerner-js.esm.js.map
|