fluent-cerner-js 0.1.1 → 0.1.2
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/README.md +1 -1
- package/dist/fluent-cerner-js.cjs.development.js +3 -2
- 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 +3 -2
- package/dist/fluent-cerner-js.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/utils/index.ts +5 -2
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ A fluent `MPAGE_EVENT` string generation library.
|
|
|
4
4
|
|
|
5
5
|
| Environment | CI | Publish |
|
|
6
6
|
| ----------- | ------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------- |
|
|
7
|
-
| Production |  |  |  |
|
|
8
8
|
| Development |  | Not Applicable |
|
|
9
9
|
|
|
10
10
|
## Resources
|
|
@@ -443,11 +443,12 @@ function makeCclRequest(opts) {
|
|
|
443
443
|
request.send(paramsList);
|
|
444
444
|
|
|
445
445
|
request.onreadystatechange = function () {
|
|
446
|
+
var data = JSON.parse(request.responseText);
|
|
447
|
+
|
|
446
448
|
if (request.readyState === 4 && request.status === 200) {
|
|
447
|
-
var data = JSON.parse(request.responseText);
|
|
448
449
|
resolve(data);
|
|
449
450
|
} else {
|
|
450
|
-
reject("error with status " + request.status + " and readyState " + request.readyState + " on " + prg + " with params " + paramsList);
|
|
451
|
+
reject("error with status " + request.status + " and readyState " + request.readyState + " on " + prg + " with params " + paramsList + " returning response text: " + (request.responseText || 'no response text'));
|
|
451
452
|
}
|
|
452
453
|
};
|
|
453
454
|
} catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluent-cerner-js.cjs.development.js","sources":["../src/MPageOrderEvent.ts","../src/MPageOrder.ts","../src/utils/index.ts"],"sourcesContent":["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 // @ts-ignore\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","import { NewOrderOpts } from './types';\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","import { CclOpts } from '../types';\n\n/**\n * A generic wrapper function for `XMLCclRequest` which simplifies it's use.\n * @param {CclOpts} opts - Required options for the CCL request.\n * @returns a promise of type `T` where `T` is the type or interface which represents\n * the resolved data from the CCL request.\n * @resolves the resolved data of type `T` from the CCL request.\n * @rejects with an error message if the CCL request fails.\n */\nexport function makeCclRequest<T>(opts: CclOpts): Promise<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 // @ts-ignore - exists in PowerChart\n const request = new window.XMLCclRequest();\n request.open('GET', `${prg}`);\n request.send(paramsList);\n request.onreadystatechange = function() {\n if (request.readyState === 4 && request.status === 200) {\n const data: T = JSON.parse(request.responseText);\n resolve(data);\n } else {\n reject(\n `error with status ${request.status} and readyState ${request.readyState} on ${prg} with params ${paramsList}`\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"],"names":["MPageOrderEvent","_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","tail","MPageOrder","_orderAction","_orderId","_synonymId","_orderOrigination","_orderSentenceId","_nomenclatureId","_signTimeInteraction","willActivate","orderId","willCancelDiscontinue","willCancelReorder","willClear","willConvertInpatient","willConvertToPrescriptionOrder","willModify","willMakeNewOrder","synonymId","opts","isRxOrder","isSatelliteOrder","orderSentenceId","nomenclatureId","skipInteractionCheckUntilSign","Error","willRenewNonPrescription","willRenewPrescription","willCopyExistingOrder","willResumeSuspendedOrder","willSuspend","makeCclRequest","prg","excludeMine","params","paramsList","map","type","param","join","Promise","resolve","reject","request","XMLCclRequest","open","onreadystatechange","readyState","status","data","JSON","parse","responseText"],"mappings":";;;;IAEMA;AAyBJ;;;AAvBA,kBAAA,GAAY;AAAA,aAAM,KAAI,CAACC,OAAX;AAAA,KAAZ;;AAEQ,iBAAA,GAAoD;AAC1DC,MAAAA,GAAG,EAAE,CADqD;AAE1DC,MAAAA,cAAc,EAAE;AAF0C,KAApD;;AAIR,mBAAA,GAAa;AAAA,aAAM,KAAI,CAACC,QAAX;AAAA,KAAb;;AAEQ,kBAAA,GAAoB,CAApB;;AACR,oBAAA,GAAc;AAAA,aAAM,KAAI,CAACC,SAAX;AAAA,KAAd;;AAEQ,qBAAA,GAAuB,CAAvB;;AACR,uBAAA,GAAiB;AAAA,aAAM,KAAI,CAACC,YAAX;AAAA,KAAjB;;AAEQ,uBAAA,GAAyB,CAAzB;;AACR,yBAAA,GAAmB;AAAA,aAAM,KAAI,CAACC,cAAX;AAAA,KAAnB;;AAEQ,wBAAA,GAA0B,CAA1B;;AACR,0BAAA,GAAoB;AAAA,aAAM,KAAI,CAACC,eAAX;AAAA,KAApB;;AAEQ,wBAAA,GAA0B,CAA1B;;AACR,0BAAA,GAAoB;AAAA,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hB;AACAD,MAAAA,OAAO,CAACE,IAAR,CAAa,KAAb,OAAuBb,GAAvB;AACAW,MAAAA,OAAO,CAACvD,IAAR,CAAa+C,UAAb;;AACAQ,MAAAA,OAAO,CAACG,kBAAR,GAA6B;AAC3B,YAAIH,OAAO,CAACI,UAAR,KAAuB,CAAvB,IAA4BJ,OAAO,CAACK,MAAR,KAAmB,GAAnD,EAAwD;AACtD,cAAMC,IAAI,GAAMC,IAAI,CAACC,KAAL,CAAWR,OAAO,CAACS,YAAnB,CAAhB;AACAX,UAAAA,OAAO,CAACQ,IAAD,CAAP;AACD,SAHD,MAGO;AACLP,UAAAA,MAAM,wBACiBC,OAAO,CAACK,MADzB,wBACkDL,OAAO,CAACI,UAD1D,YAC2Ef,GAD3E,qBAC8FG,UAD9F,CAAN;AAGD;AACF,OATD;AAUD,KAfD,CAeE,OAAO3C,CAAP,EAAU;AACV,UAAIA,CAAC,YAAYC,cAAjB,EAAiC;AAC/BiD,QAAAA,MAAM,oEAC4DP,UAD5D,gBAC+EH,GAD/E,QAAN;AAGD,OAJD,MAIO;AACL,cAAMxC,CAAN;AACD;AACF;AACF,GAzBM,CAAP;AA0BD;;;;;;"}
|
|
1
|
+
{"version":3,"file":"fluent-cerner-js.cjs.development.js","sources":["../src/MPageOrderEvent.ts","../src/MPageOrder.ts","../src/utils/index.ts"],"sourcesContent":["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 // @ts-ignore\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","import { NewOrderOpts } from './types';\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","import { CclOpts } from '../types';\n\n/**\n * A generic wrapper function for `XMLCclRequest` which simplifies it's use.\n * @param {CclOpts} opts - Required options for the CCL request.\n * @returns a promise of type `T` where `T` is the type or interface which represents\n * the resolved data from the CCL request.\n * @resolves the resolved data of type `T` from the CCL request.\n * @rejects with an error message if the CCL request fails.\n */\nexport function makeCclRequest<T>(opts: CclOpts): Promise<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 // @ts-ignore - exists in PowerChart\n const request = new window.XMLCclRequest();\n request.open('GET', `${prg}`);\n request.send(paramsList);\n request.onreadystatechange = function() {\n const data: T = JSON.parse(request.responseText);\n if (request.readyState === 4 && request.status === 200) {\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"],"names":["MPageOrderEvent","_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","tail","MPageOrder","_orderAction","_orderId","_synonymId","_orderOrigination","_orderSentenceId","_nomenclatureId","_signTimeInteraction","willActivate","orderId","willCancelDiscontinue","willCancelReorder","willClear","willConvertInpatient","willConvertToPrescriptionOrder","willModify","willMakeNewOrder","synonymId","opts","isRxOrder","isSatelliteOrder","orderSentenceId","nomenclatureId","skipInteractionCheckUntilSign","Error","willRenewNonPrescription","willRenewPrescription","willCopyExistingOrder","willResumeSuspendedOrder","willSuspend","makeCclRequest","prg","excludeMine","params","paramsList","map","type","param","join","Promise","resolve","reject","request","XMLCclRequest","open","onreadystatechange","data","JSON","parse","responseText","readyState","status"],"mappings":";;;;IAEMA;AAyBJ;;;AAvBA,kBAAA,GAAY;AAAA,aAAM,KAAI,CAACC,OAAX;AAAA,KAAZ;;AAEQ,iBAAA,GAAoD;AAC1DC,MAAAA,GAAG,EAAE,CADqD;AAE1DC,MAAAA,cAAc,EAAE;AAF0C,KAApD;;AAIR,mBAAA,GAAa;AAAA,aAAM,KAAI,CAACC,QAAX;AAAA,KAAb;;AAEQ,kBAAA,GAAoB,CAApB;;AACR,oBAAA,GAAc;AAAA,aAAM,KAAI,CAACC,SAAX;AAAA,KAAd;;AAEQ,qBAAA,GAAuB,CAAvB;;AACR,uBAAA,GAAiB;AAAA,aAAM,KAAI,CAACC,YAAX;AAAA,KAAjB;;AAEQ,uBAAA,GAAyB,CAAzB;;AACR,yBAAA,GAAmB;AAAA,aAAM,KAAI,CAACC,cAAX;AAAA,KAAnB;;AAEQ,wBAAA,GAA0B,CAA1B;;AACR,0BAAA,GAAoB;AAAA,aAAM,KAAI,CAACC,eAAX;AAAA,KAApB;;AAEQ,wBAAA,GAA0B,CAA1B;;AACR,0BAAA,GAAoB;AAAA,aAAM,KAAI,CAACC,eAAX;AAAA,KAApB;;AAGE,SAAKR,OAAL,GAAe,EAAf;AACA,SAAKG,QAAL,GAAgB;AAAEF,MAAAA,GAAG,EAAE,CAAP;AAAUC,MAAAA,cAAc,EAAE;AAA1B,KAAhB;;AAEA,SAAKI,cAAL,GAAsB,CAAtB;;AAEA,SAAKH,QAAL,CAAcD,cAAd,GAA+B,CAA/B;AACA,SAAKO,yBAAL;AACA,SAAKC,kBAAL;;AAEA,SAAKF,eAAL,GAAuB,CAAvB;AACD;;;;SAEDG,YAAA,mBAAUC,EAAV;AAC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P;AACD,SAFD,MAEO;AACLL,UAAAA,MAAM,wBACiBC,OAAO,CAACS,MADzB,wBAEFT,OAAO,CAACQ,UAFN,YAGGnB,GAHH,qBAGsBG,UAHtB,mCAG6DQ,OAAO,CAACO,YAAR,IAC/D,kBAJE,EAAN;AAMD;AACF,OAZD;AAaD,KAlBD,CAkBE,OAAO1D,CAAP,EAAU;AACV,UAAIA,CAAC,YAAYC,cAAjB,EAAiC;AAC/BiD,QAAAA,MAAM,oEAC4DP,UAD5D,gBAC+EH,GAD/E,QAAN;AAGD,OAJD,MAIO;AACL,cAAMxC,CAAN;AACD;AACF;AACF,GA5BM,CAAP;AA6BD;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=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 r=t.prototype;return r.forPerson=function(t){return this._personId=t,this},r.forEncounter=function(t){return this._encounterId=t,this},r.addOrders=function(t){return Array.isArray(t)||(t=[t]),this._orders=this._orders.concat(t),this},r.enablePowerPlans=function(){return this._powerPlanFlag=24,this},r.customizeOrderListProfile=function(){return this._tabList.tab=2,this},r.customizeMedicationListProfile=function(){return this._tabList.tab=3,this},r.enablePowerOrders=function(){return this._tabList.tabDisplayFlag=127,this},r.launchOrderSearch=function(){return this._defaultDisplay=8,this},r.launchOrderProfile=function(){return this._defaultDisplay=16,this},r.launchOrdersForSignature=function(){return this._defaultDisplay=32,this},r.signSilently=function(){return this._silentSignFlag=1,this},r.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())}},r.toString=function(){var t=this._personId+"|"+this._encounterId+"|",r="";return this._orders.forEach((function(t){r+=t.toString()})),""+t+r+"|"+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 r=t.prototype;return r.willActivate=function(t){return this._orderAction="ACTIVATE",this._orderId=t,this},r.willCancelDiscontinue=function(t){return this._orderAction="CANCEL DC",this._orderId=t,this},r.willCancelReorder=function(t){return this._orderAction="CANCEL REORD",this._orderId=t,this},r.willClear=function(t){return this._orderAction="CLEAR",this._orderId=t,this},r.willConvertInpatient=function(t){return this._orderAction="CONVERT_INPAT",this._orderId=t,this},r.willConvertToPrescriptionOrder=function(t){return this._orderAction="CONVERT_RX",this._orderId=t,this},r.willModify=function(t){return this._orderAction="MODIFY",this._orderId=t,this},r.willMakeNewOrder=function(t,r){var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=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 r=t.prototype;return r.forPerson=function(t){return this._personId=t,this},r.forEncounter=function(t){return this._encounterId=t,this},r.addOrders=function(t){return Array.isArray(t)||(t=[t]),this._orders=this._orders.concat(t),this},r.enablePowerPlans=function(){return this._powerPlanFlag=24,this},r.customizeOrderListProfile=function(){return this._tabList.tab=2,this},r.customizeMedicationListProfile=function(){return this._tabList.tab=3,this},r.enablePowerOrders=function(){return this._tabList.tabDisplayFlag=127,this},r.launchOrderSearch=function(){return this._defaultDisplay=8,this},r.launchOrderProfile=function(){return this._defaultDisplay=16,this},r.launchOrdersForSignature=function(){return this._defaultDisplay=32,this},r.signSilently=function(){return this._silentSignFlag=1,this},r.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())}},r.toString=function(){var t=this._personId+"|"+this._encounterId+"|",r="";return this._orders.forEach((function(t){r+=t.toString()})),""+t+r+"|"+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 r=t.prototype;return r.willActivate=function(t){return this._orderAction="ACTIVATE",this._orderId=t,this},r.willCancelDiscontinue=function(t){return this._orderAction="CANCEL DC",this._orderId=t,this},r.willCancelReorder=function(t){return this._orderAction="CANCEL REORD",this._orderId=t,this},r.willClear=function(t){return this._orderAction="CLEAR",this._orderId=t,this},r.willConvertInpatient=function(t){return this._orderAction="CONVERT_INPAT",this._orderId=t,this},r.willConvertToPrescriptionOrder=function(t){return this._orderAction="CONVERT_RX",this._orderId=t,this},r.willModify=function(t){return this._orderAction="MODIFY",this._orderId=t,this},r.willMakeNewOrder=function(t,r){var e=r||{},i=e.isRxOrder,n=e.isSatelliteOrder,s=e.orderSentenceId,o=e.nomenclatureId,a=e.skipInteractionCheckUntilSign;if(i&&n)throw new Error("must select either isRxOrder or isSatelliteOrder");return this._orderAction="ORDER",this._synonymId=t,this._orderSentenceId=s||0,this._nomenclatureId=o||0,this._signTimeInteraction=a?1:0,this._orderOrigination=n?5:i?1:0,this},r.willRenewNonPrescription=function(t){return this._orderAction="RENEW",this._orderId=t,this},r.willRenewPrescription=function(t){return this._orderAction="RENEW_RX",this._orderId=t,this},r.willCopyExistingOrder=function(t){return this._orderAction="REPEAT",this._orderId=t,this},r.willResumeSuspendedOrder=function(t){return this._orderAction="RESUME",this._orderId=t,this},r.willSuspend=function(t){return this._orderAction="SUSPEND",this._orderId=t,this},r.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=t,exports.makeCclRequest=function(t){var r=t.prg,e=(t.excludeMine?"":"'MINE',")+t.params.map((function(t){var r=t.param;return"string"===t.type?"'"+r+"'":r})).join(",");return new Promise((function(t,i){try{var n=new window.XMLCclRequest;n.open("GET",""+r),n.send(e),n.onreadystatechange=function(){var s=JSON.parse(n.responseText);4===n.readyState&&200===n.status?t(s):i("error with status "+n.status+" and readyState "+n.readyState+" on "+r+" with params "+e+" returning response text: "+(n.responseText||"no response text"))}}catch(t){if(!(t instanceof ReferenceError))throw t;i("We're likely not inside PowerChart. We cannot send request: \""+e+'" to "'+r+'"')}}))};
|
|
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/MPageOrderEvent.ts","../src/MPageOrder.ts","../src/utils/index.ts"],"sourcesContent":["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 // @ts-ignore\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","import { NewOrderOpts } from './types';\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","import { CclOpts } from '../types';\n\n/**\n * A generic wrapper function for `XMLCclRequest` which simplifies it's use.\n * @param {CclOpts} opts - Required options for the CCL request.\n * @returns a promise of type `T` where `T` is the type or interface which represents\n * the resolved data from the CCL request.\n * @resolves the resolved data of type `T` from the CCL request.\n * @rejects with an error message if the CCL request fails.\n */\nexport function makeCclRequest<T>(opts: CclOpts): Promise<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 // @ts-ignore - exists in PowerChart\n const request = new window.XMLCclRequest();\n request.open('GET', `${prg}`);\n request.send(paramsList);\n request.onreadystatechange = function() {\n if (request.readyState === 4 && request.status === 200) {\n const data: T = JSON.parse(request.responseText);\n resolve(data);\n } else {\n reject(\n `error with status ${request.status} and readyState ${request.readyState} on ${prg} with params ${paramsList}`\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"],"names":["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","send","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","Error","willRenewNonPrescription","willRenewPrescription","willCopyExistingOrder","willResumeSuspendedOrder","willSuspend","prg","paramsList","excludeMine","params","map","param","type","join","Promise","resolve","reject","request","XMLCclRequest","open","onreadystatechange","readyState","status","data","JSON","parse","responseText"],"mappings":"wEAEMA,oDAEQ,kBAAMC,EAAKC,uBAEqC,CAC1DC,IAAK,EACLC,eAAgB,mBAEL,kBAAMH,EAAKI,yBAEI,mBACd,kBAAMJ,EAAKK,6BAEM,sBACd,kBAAML,EAAKM,kCAEK,wBACd,kBAAMN,EAAKO,qCAEI,yBACd,kBAAMP,EAAKQ,sCAEG,yBACd,kBAAMR,EAAKS,sBAGxBR,QAAU,QACVG,SAAW,CAAEF,IAAK,E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CD,MAAWA,KAC7DE,KAAK,YACH,IAAIC,SAAQ,SAACC,EAASC,WAGnBC,EAAU,IAAInD,OAAOoD,cAC3BD,EAAQE,KAAK,SAAUb,GACvBW,EAAQpD,KAAK0C,GACbU,EAAQG,mBAAqB,cACA,IAAvBH,EAAQI,YAAuC,MAAnBJ,EAAQK,OAAgB,KAChDC,EAAUC,KAAKC,MAAMR,EAAQS,cACnCX,EAAQQ,QAERP,uBACuBC,EAAQK,0BAAyBL,EAAQI,kBAAiBf,kBAAmBC,IAIxG,MAAOtC,QACHA,aAAaC,sBAKTD,EAJN+C,mEACkET,WAAmBD"}
|
|
1
|
+
{"version":3,"file":"fluent-cerner-js.cjs.production.min.js","sources":["../src/MPageOrderEvent.ts","../src/MPageOrder.ts","../src/utils/index.ts"],"sourcesContent":["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 // @ts-ignore\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","import { NewOrderOpts } from './types';\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","import { CclOpts } from '../types';\n\n/**\n * A generic wrapper function for `XMLCclRequest` which simplifies it's use.\n * @param {CclOpts} opts - Required options for the CCL request.\n * @returns a promise of type `T` where `T` is the type or interface which represents\n * the resolved data from the CCL request.\n * @resolves the resolved data of type `T` from the CCL request.\n * @rejects with an error message if the CCL request fails.\n */\nexport function makeCclRequest<T>(opts: CclOpts): Promise<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 // @ts-ignore - exists in PowerChart\n const request = new window.XMLCclRequest();\n request.open('GET', `${prg}`);\n request.send(paramsList);\n request.onreadystatechange = function() {\n const data: T = JSON.parse(request.responseText);\n if (request.readyState === 4 && request.status === 200) {\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"],"names":["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","send","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","Error","willRenewNonPrescription","willRenewPrescription","willCopyExistingOrder","willResumeSuspendedOrder","willSuspend","prg","paramsList","excludeMine","params","map","param","type","join","Promise","resolve","reject","request","XMLCclRequest","open","onreadystatechange","data","JSON","parse","responseText","readyState","status"],"mappings":"wEAEMA,oDAEQ,kBAAMC,EAAKC,uBAEqC,CAC1DC,IAAK,EACLC,eAAgB,mBAEL,kBAAMH,EAAKI,yBAEI,mBACd,kBAAMJ,EAAKK,6BAEM,sBACd,kBAAML,EAAKM,kCAEK,wBACd,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EAA6BZ,EAA7BY,IACFC,GAD+Bb,EAAxBc,YAEI,GAAK,WAFed,EAAXe,OAIrBC,KAAI,gBAASC,IAAAA,YAAsB,aAA5BC,SAA2CD,MAAWA,KAC7DE,KAAK,YACH,IAAIC,SAAQ,SAACC,EAASC,WAGnBC,EAAU,IAAInD,OAAOoD,cAC3BD,EAAQE,KAAK,SAAUb,GACvBW,EAAQpD,KAAK0C,GACbU,EAAQG,mBAAqB,eACrBC,EAAUC,KAAKC,MAAMN,EAAQO,cACR,IAAvBP,EAAQQ,YAAuC,MAAnBR,EAAQS,OACtCX,EAAQM,GAERL,uBACuBC,EAAQS,0BAC3BT,EAAQQ,kBACHnB,kBAAmBC,gCAAuCU,EAAQO,cACvE,sBAIR,MAAOvD,QACHA,aAAaC,sBAKTD,EAJN+C,mEACkET,WAAmBD"}
|
|
@@ -439,11 +439,12 @@ function makeCclRequest(opts) {
|
|
|
439
439
|
request.send(paramsList);
|
|
440
440
|
|
|
441
441
|
request.onreadystatechange = function () {
|
|
442
|
+
var data = JSON.parse(request.responseText);
|
|
443
|
+
|
|
442
444
|
if (request.readyState === 4 && request.status === 200) {
|
|
443
|
-
var data = JSON.parse(request.responseText);
|
|
444
445
|
resolve(data);
|
|
445
446
|
} else {
|
|
446
|
-
reject("error with status " + request.status + " and readyState " + request.readyState + " on " + prg + " with params " + paramsList);
|
|
447
|
+
reject("error with status " + request.status + " and readyState " + request.readyState + " on " + prg + " with params " + paramsList + " returning response text: " + (request.responseText || 'no response text'));
|
|
447
448
|
}
|
|
448
449
|
};
|
|
449
450
|
} catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fluent-cerner-js.esm.js","sources":["../src/MPageOrderEvent.ts","../src/MPageOrder.ts","../src/utils/index.ts"],"sourcesContent":["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 // @ts-ignore\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","import { NewOrderOpts } from './types';\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","import { CclOpts } from '../types';\n\n/**\n * A generic wrapper function for `XMLCclRequest` which simplifies it's use.\n * @param {CclOpts} opts - Required options for the CCL request.\n * @returns a promise of type `T` where `T` is the type or interface which represents\n * the resolved data from the CCL request.\n * @resolves the resolved data of type `T` from the CCL request.\n * @rejects with an error message if the CCL request fails.\n */\nexport function makeCclRequest<T>(opts: CclOpts): Promise<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 // @ts-ignore - exists in PowerChart\n const request = new window.XMLCclRequest();\n request.open('GET', `${prg}`);\n request.send(paramsList);\n request.onreadystatechange = function() {\n if (request.readyState === 4 && request.status === 200) {\n const data: T = JSON.parse(request.responseText);\n resolve(data);\n } else {\n reject(\n `error with status ${request.status} and readyState ${request.readyState} on ${prg} with params ${paramsList}`\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"],"names":["MPageOrderEvent","_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","tail","MPageOrder","_orderAction","_orderId","_synonymId","_orderOrigination","_orderSentenceId","_nomenclatureId","_signTimeInteraction","willActivate","orderId","willCancelDiscontinue","willCancelReorder","willClear","willConvertInpatient","willConvertToPrescriptionOrder","willModify","willMakeNewOrder","synonymId","opts","isRxOrder","isSatelliteOrder","orderSentenceId","nomenclatureId","skipInteractionCheckUntilSign","Error","willRenewNonPrescription","willRenewPrescription","willCopyExistingOrder","willResumeSuspendedOrder","willSuspend","makeCclRequest","prg","excludeMine","params","paramsList","map","type","param","join","Promise","resolve","reject","request","XMLCclRequest","open","onreadystatechange","readyState","status","data","JSON","parse","responseText"],"mappings":"IAEMA;AAyBJ;;;AAvBA,kBAAA,GAAY;AAAA,aAAM,KAAI,CAACC,OAAX;AAAA,KAAZ;;AAEQ,iBAAA,GAAoD;AAC1DC,MAAAA,GAAG,EAAE,CADqD;AAE1DC,MAAAA,cAAc,EAAE;AAF0C,KAApD;;AAIR,mBAAA,GAAa;AAAA,aAAM,KAAI,CAACC,QAAX;AAAA,KAAb;;AAEQ,kBAAA,GAAoB,CAApB;;AACR,oBAAA,GAAc;AAAA,aAAM,KAAI,CAACC,SAAX;AAAA,KAAd;;AAEQ,qBAAA,GAAuB,CAAvB;;AACR,uBAAA,GAAiB;AAAA,aAAM,KAAI,CAACC,YAAX;AAAA,KAAjB;;AAEQ,uBAAA,GAAyB,CAAzB;;AACR,yBAAA,GAAmB;AAAA,aAAM,KAAI,CAACC,cAAX;AAAA,KAAnB;;AAEQ,wBAAA,GAA0B,CAA1B;;AACR,0BAAA,GAAoB;AAAA,aAAM,KAAI,CAACC,eAAX;AAAA,KAApB;;AAEQ,wBAAA,GAA0B,CAA1B;;AACR,0BAAA,GAAoB;AAAA,aAAM,KAAI,CAACC,eAAX;AAAA,KAApB;;AAGE,SAAKR,OAAL,GAAe,EAAf;AACA,SAAKG,QAAL,GAAgB;AAAEF,MAAAA,GAAG,EAAE,CAAP;AAAU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CAACG,kBAAR,GAA6B;AAC3B,YAAIH,OAAO,CAACI,UAAR,KAAuB,CAAvB,IAA4BJ,OAAO,CAACK,MAAR,KAAmB,GAAnD,EAAwD;AACtD,cAAMC,IAAI,GAAMC,IAAI,CAACC,KAAL,CAAWR,OAAO,CAACS,YAAnB,CAAhB;AACAX,UAAAA,OAAO,CAACQ,IAAD,CAAP;AACD,SAHD,MAGO;AACLP,UAAAA,MAAM,wBACiBC,OAAO,CAACK,MADzB,wBACkDL,OAAO,CAACI,UAD1D,YAC2Ef,GAD3E,qBAC8FG,UAD9F,CAAN;AAGD;AACF,OATD;AAUD,KAfD,CAeE,OAAO3C,CAAP,EAAU;AACV,UAAIA,CAAC,YAAYC,cAAjB,EAAiC;AAC/BiD,QAAAA,MAAM,oEAC4DP,UAD5D,gBAC+EH,GAD/E,QAAN;AAGD,OAJD,MAIO;AACL,cAAMxC,CAAN;AACD;AACF;AACF,GAzBM,CAAP;AA0BD;;;;"}
|
|
1
|
+
{"version":3,"file":"fluent-cerner-js.esm.js","sources":["../src/MPageOrderEvent.ts","../src/MPageOrder.ts","../src/utils/index.ts"],"sourcesContent":["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 // @ts-ignore\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","import { NewOrderOpts } from './types';\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","import { CclOpts } from '../types';\n\n/**\n * A generic wrapper function for `XMLCclRequest` which simplifies it's use.\n * @param {CclOpts} opts - Required options for the CCL request.\n * @returns a promise of type `T` where `T` is the type or interface which represents\n * the resolved data from the CCL request.\n * @resolves the resolved data of type `T` from the CCL request.\n * @rejects with an error message if the CCL request fails.\n */\nexport function makeCclRequest<T>(opts: CclOpts): Promise<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 // @ts-ignore - exists in PowerChart\n const request = new window.XMLCclRequest();\n request.open('GET', `${prg}`);\n request.send(paramsList);\n request.onreadystatechange = function() {\n const data: T = JSON.parse(request.responseText);\n if (request.readyState === 4 && request.status === 200) {\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"],"names":["MPageOrderEvent","_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","tail","MPageOrder","_orderAction","_orderId","_synonymId","_orderOrigination","_orderSentenceId","_nomenclatureId","_signTimeInteraction","willActivate","orderId","willCancelDiscontinue","willCancelReorder","willClear","willConvertInpatient","willConvertToPrescriptionOrder","willModify","willMakeNewOrder","synonymId","opts","isRxOrder","isSatelliteOrder","orderSentenceId","nomenclatureId","skipInteractionCheckUntilSign","Error","willRenewNonPrescription","willRenewPrescription","willCopyExistingOrder","willResumeSuspendedOrder","willSuspend","makeCclRequest","prg","excludeMine","params","paramsList","map","type","param","join","Promise","resolve","reject","request","XMLCclRequest","open","onreadystatechange","data","JSON","parse","responseText","readyState","status"],"mappings":"IAEMA;AAyBJ;;;AAvBA,kBAAA,GAAY;AAAA,aAAM,KAAI,CAACC,OAAX;AAAA,KAAZ;;AAEQ,iBAAA,GAAoD;AAC1DC,MAAAA,GAAG,EAAE,CADqD;AAE1DC,MAAAA,cAAc,EAAE;AAF0C,KAApD;;AAIR,mBAAA,GAAa;AAAA,aAAM,KAAI,CAACC,QAAX;AAAA,KAAb;;AAEQ,kBAAA,GAAoB,CAApB;;AACR,oBAAA,GAAc;AAAA,aAAM,KAAI,CAACC,SAAX;AAAA,KAAd;;AAEQ,qBAAA,GAAuB,CAAvB;;AACR,uBAAA,GAAiB;AAAA,aAAM,KAAI,CAACC,YAAX;AAAA,KAAjB;;AAEQ,uBAAA,GAAyB,CAAzB;;AACR,yBAAA,GAAmB;AAAA,aAAM,KAAI,CAACC,cAAX;AAAA,KAAnB;;AAEQ,wBAAA,GAA0B,CAA1B;;AACR,0BAAA,GAAoB;AAAA,aAAM,KAAI,CAACC,eAAX;AAAA,KAApB;;AAEQ,wBAAA,GAA0B,CAA1B;;AACR,0BAAA,GAAoB;AAAA,aAAM,KAAI,CAACC,eAAX;AAAA,KAApB;;AAGE,SAAKR,OAAL,GAAe,EAAf;AACA,SAAKG,QAAL,GAAgB;AAAEF,MAAAA,GAAG,EAAE,CAAP;AAAUC,MAAAA,cAAc,EAAE;AAA1B,KAAhB;;AAEA,SAAKI,cAAL,GAAsB,CAAtB;;AAEA,SAAKH,QAAL,CAAcD,cAAd,GAA+B,CAA/B;AACA,SAAKO,yBAAL;AACA,SAAKC,kBAAL;;AAEA,SAAKF,eAAL,GAAuB,CAAvB;AACD;;;;SAEDG,YAAA,mBAAUC,EAAV;AACE,SAAKR,SAAL,GAAiBQ,EAAjB;AACA,WAAO,IAAP;AACD;;SAEDC,eAAA,sBAAaD,EAAb;AACE,SAAKP,YAAL,GAAoBO,EAApB;AACA,WAAO,IAAP;AACD;;SA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CAACO,YAAR,IAC/D,kBAJE,EAAN;AAMD;AACF,OAZD;AAaD,KAlBD,CAkBE,OAAO1D,CAAP,EAAU;AACV,UAAIA,CAAC,YAAYC,cAAjB,EAAiC;AAC/BiD,QAAAA,MAAM,oEAC4DP,UAD5D,gBAC+EH,GAD/E,QAAN;AAGD,OAJD,MAIO;AACL,cAAMxC,CAAN;AACD;AACF;AACF,GA5BM,CAAP;AA6BD;;;;"}
|
package/package.json
CHANGED
package/src/utils/index.ts
CHANGED
|
@@ -22,12 +22,15 @@ export function makeCclRequest<T>(opts: CclOpts): Promise<T> {
|
|
|
22
22
|
request.open('GET', `${prg}`);
|
|
23
23
|
request.send(paramsList);
|
|
24
24
|
request.onreadystatechange = function() {
|
|
25
|
+
const data: T = JSON.parse(request.responseText);
|
|
25
26
|
if (request.readyState === 4 && request.status === 200) {
|
|
26
|
-
const data: T = JSON.parse(request.responseText);
|
|
27
27
|
resolve(data);
|
|
28
28
|
} else {
|
|
29
29
|
reject(
|
|
30
|
-
`error with status ${request.status} and readyState ${
|
|
30
|
+
`error with status ${request.status} and readyState ${
|
|
31
|
+
request.readyState
|
|
32
|
+
} on ${prg} with params ${paramsList} returning response text: ${request.responseText ||
|
|
33
|
+
'no response text'}`
|
|
31
34
|
);
|
|
32
35
|
}
|
|
33
36
|
};
|