fluent-cerner-js 1.1.1-0 → 1.2.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +136 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +161 -142
- package/dist/index.d.ts +161 -142
- package/dist/index.js +135 -123
- package/dist/index.js.map +1 -1
- package/package.json +21 -10
- package/src/getValidEncountersAsync.ts +1 -1
- package/src/index.ts +4 -0
- package/src/launchClinicalNoteAsync.ts +5 -3
- package/src/launchMOEWAsync.spec.ts +20 -0
- package/src/launchMOEWAsync.ts +41 -0
- package/src/openOrganizerTabAsync.spec.ts +21 -27
- package/src/openPatientTabAsync.spec.ts +21 -27
- package/src/submitOrdersAsync.spec.ts +63 -67
- package/src/submitOrdersAsync.ts +18 -7
- package/src/submitPowerOrdersAsync.spec.ts +5 -1
- package/src/submitPowerOrdersAsync.ts +3 -6
- package/src/utils/addNewOrdersToScratchPadAsync.ts +1 -1
- package/src/utils/addPowerPlanWithDetailsAsync.ts +1 -1
- package/src/utils/calculateMOEWBitmask.ts +1 -1
- package/src/utils/getOrdersPlacedAsync.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -25,6 +25,7 @@ __export(index_exports, {
|
|
|
25
25
|
getValidEncountersAsync: () => getValidEncountersAsync,
|
|
26
26
|
launchClinicalNoteAsync: () => launchClinicalNoteAsync,
|
|
27
27
|
launchDischargeProcessAsync: () => launchDischargeProcessAsync,
|
|
28
|
+
launchMOEWAsync: () => launchMOEWAsync,
|
|
28
29
|
launchPatientEducationAsync: () => launchPatientEducationAsync,
|
|
29
30
|
launchPowerFormAsync: () => launchPowerFormAsync,
|
|
30
31
|
launchPowerNoteAsync: () => launchPowerNoteAsync,
|
|
@@ -215,6 +216,139 @@ async function launchDischargeProcessAsync(patientId, encounterId, providerId) {
|
|
|
215
216
|
return retData;
|
|
216
217
|
}
|
|
217
218
|
|
|
219
|
+
// src/submitOrdersAsync.ts
|
|
220
|
+
var import_fast_xml_parser = require("fast-xml-parser");
|
|
221
|
+
|
|
222
|
+
// src/utils/createOrderString.ts
|
|
223
|
+
var _createOrderString = (action, id, opts) => {
|
|
224
|
+
const { orderSentenceId, nomenclatureIds, origination, interactionCheck } = opts || {};
|
|
225
|
+
let params = [orderActionMap.get(action)];
|
|
226
|
+
const nids = nomenclatureIds || [];
|
|
227
|
+
switch (action) {
|
|
228
|
+
case "launch moew":
|
|
229
|
+
params = params.concat(["0", "0", "0", "0", "0"]);
|
|
230
|
+
break;
|
|
231
|
+
case "new order":
|
|
232
|
+
if (!id)
|
|
233
|
+
throw new Error(
|
|
234
|
+
`id (as synonym ID) is required for the '${action}' action`
|
|
235
|
+
);
|
|
236
|
+
params = params.concat([
|
|
237
|
+
`${id}`,
|
|
238
|
+
`${originationMap.get(origination) || 0}`,
|
|
239
|
+
`${orderSentenceId || 0}`,
|
|
240
|
+
nids.length > 1 ? `[${nids.join("|")}]` : `${nids[0] || 0}`,
|
|
241
|
+
`${interactionMap.get(interactionCheck) || 0}`
|
|
242
|
+
]);
|
|
243
|
+
break;
|
|
244
|
+
default:
|
|
245
|
+
if (!id)
|
|
246
|
+
throw new Error(
|
|
247
|
+
`id (as the existing order ID) is required for the '${action}' action`
|
|
248
|
+
);
|
|
249
|
+
params = params.concat([`${id}`]);
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
return `{${params.join("|")}}`;
|
|
253
|
+
};
|
|
254
|
+
var orderActionMap = (/* @__PURE__ */ new Map()).set("launch moew", "ORDER").set("activate existing", "ACTIVATE").set("cancel-discontinue", "CANCEL DC").set("cancel-reorder", "CANCEL REORD").set("clear actions", "CLEAR").set("convert inpatient", "CONVERT_INPAT").set("convert prescription", "CONVERT_RX").set("modify", "MODIFY").set("new order", "ORDER").set("renew", "RENEW").set("renew prescription", "RENEW_RX").set("copy existing", "REPEAT").set("resume", "RESUME").set("suspend", "SUSPEND");
|
|
255
|
+
var originationMap = (/* @__PURE__ */ new Map()).set("satellite", "5").set("prescription", "1").set("normal", "0");
|
|
256
|
+
var interactionMap = (/* @__PURE__ */ new Map()).set("on sign", "1").set("default", "0");
|
|
257
|
+
var createOrderString = (action, id, opts) => _createOrderString(action, id, opts);
|
|
258
|
+
var LAUNCH_MOEW_ORDER_STRING = _createOrderString("launch moew");
|
|
259
|
+
|
|
260
|
+
// src/submitOrdersAsync.ts
|
|
261
|
+
var launchViewMap = (/* @__PURE__ */ new Map()).set("search", 8).set("profile", 16).set("signature", 32);
|
|
262
|
+
var tabsMap = (/* @__PURE__ */ new Map()).set("orders", { tab: 2, display: 0 }).set("power orders", { tab: 2, display: 127 }).set("medications", { tab: 3, display: 0 }).set("power medications", { tab: 3, display: 127 });
|
|
263
|
+
var submitOrdersAsync = async (patientId, encounterId, orders, opts) => {
|
|
264
|
+
let { targetTab, launchView, signSilently, dryRun } = opts || {};
|
|
265
|
+
if (!targetTab) targetTab = "orders";
|
|
266
|
+
if (!launchView) launchView = "signature";
|
|
267
|
+
const enablePowerPlans = targetTab === "power orders" || targetTab === "power medications";
|
|
268
|
+
const orderList = orders.length === 0 ? LAUNCH_MOEW_ORDER_STRING : orders.map(({ action, id, opts: opts2 }) => createOrderString(action, id, opts2)).join("");
|
|
269
|
+
let params = [`${patientId}`, `${encounterId}`, orderList];
|
|
270
|
+
params.push(enablePowerPlans ? "24" : "0");
|
|
271
|
+
const { tab, display } = tabsMap.get(targetTab) || { tab: 2, display: 127 };
|
|
272
|
+
params.push(`{${tab}|${display}}`);
|
|
273
|
+
params.push(`${launchViewMap.get(launchView) || 32}`);
|
|
274
|
+
params.push(`${signSilently ? "1" : "0"}`);
|
|
275
|
+
const eventString = params.join("|");
|
|
276
|
+
const retVal = {
|
|
277
|
+
eventString,
|
|
278
|
+
inPowerChart: true,
|
|
279
|
+
status: "success",
|
|
280
|
+
response: null,
|
|
281
|
+
ordersPlaced: null,
|
|
282
|
+
rawResponse: null
|
|
283
|
+
};
|
|
284
|
+
if (dryRun) {
|
|
285
|
+
retVal.status = "dry run";
|
|
286
|
+
return retVal;
|
|
287
|
+
}
|
|
288
|
+
try {
|
|
289
|
+
const response = await window.external.MPAGES_EVENT(
|
|
290
|
+
"ORDERS",
|
|
291
|
+
eventString
|
|
292
|
+
);
|
|
293
|
+
retVal.rawResponse = response;
|
|
294
|
+
if (response === null) {
|
|
295
|
+
retVal.status = "failed";
|
|
296
|
+
return retVal;
|
|
297
|
+
}
|
|
298
|
+
if (typeof response !== "string") {
|
|
299
|
+
retVal.status = "invalid data returned";
|
|
300
|
+
return retVal;
|
|
301
|
+
}
|
|
302
|
+
switch (response.trim()) {
|
|
303
|
+
case "":
|
|
304
|
+
retVal.status = "cancelled";
|
|
305
|
+
break;
|
|
306
|
+
default:
|
|
307
|
+
retVal.status = "success";
|
|
308
|
+
const parser = new import_fast_xml_parser.XMLParser();
|
|
309
|
+
try {
|
|
310
|
+
const parsed = parser.parse(response);
|
|
311
|
+
retVal.response = parsed;
|
|
312
|
+
if (!(parsed.Orders.Order instanceof Array)) {
|
|
313
|
+
parsed.Orders.Order = [parsed.Orders.Order];
|
|
314
|
+
}
|
|
315
|
+
retVal.ordersPlaced = parsed.Orders.Order.map((o) => ({
|
|
316
|
+
name: o.OrderedAsMnemonic,
|
|
317
|
+
oid: o.OrderId,
|
|
318
|
+
display: o.ClinDisplayLine
|
|
319
|
+
}));
|
|
320
|
+
} catch {
|
|
321
|
+
retVal.status = "xml parse error";
|
|
322
|
+
}
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
} catch (e) {
|
|
326
|
+
if (outsideOfPowerChartError(e)) {
|
|
327
|
+
retVal.inPowerChart = false;
|
|
328
|
+
retVal.status = "invalid data returned";
|
|
329
|
+
warnAttemptedOrdersOutsideOfPowerChart(eventString);
|
|
330
|
+
} else {
|
|
331
|
+
throw e;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
return retVal;
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
// src/launchMOEWAsync.ts
|
|
338
|
+
var launchMOEWAsync = async (patientId, encounterId, opts) => {
|
|
339
|
+
const {
|
|
340
|
+
targetTab = "power orders",
|
|
341
|
+
launchView = "search",
|
|
342
|
+
dryRun
|
|
343
|
+
} = opts || {};
|
|
344
|
+
return submitOrdersAsync(patientId, encounterId, [], {
|
|
345
|
+
targetTab,
|
|
346
|
+
launchView,
|
|
347
|
+
dryRun,
|
|
348
|
+
signSilently: false
|
|
349
|
+
});
|
|
350
|
+
};
|
|
351
|
+
|
|
218
352
|
// src/launchPatientEducationAsync.ts
|
|
219
353
|
async function launchPatientEducationAsync(patientId, encounterId, targetTab) {
|
|
220
354
|
const retData = {
|
|
@@ -450,124 +584,6 @@ async function openWebsiteByUrlAsync(url) {
|
|
|
450
584
|
return await openApplicationAsync("by url", url);
|
|
451
585
|
}
|
|
452
586
|
|
|
453
|
-
// src/submitOrdersAsync.ts
|
|
454
|
-
var import_fast_xml_parser = require("fast-xml-parser");
|
|
455
|
-
|
|
456
|
-
// src/utils/createOrderString.ts
|
|
457
|
-
var _createOrderString = (action, id, opts) => {
|
|
458
|
-
const { orderSentenceId, nomenclatureIds, origination, interactionCheck } = opts || {};
|
|
459
|
-
let params = [orderActionMap.get(action)];
|
|
460
|
-
const nids = nomenclatureIds || [];
|
|
461
|
-
switch (action) {
|
|
462
|
-
case "launch moew":
|
|
463
|
-
params = params.concat(["0", "0", "0", "0", "0"]);
|
|
464
|
-
break;
|
|
465
|
-
case "new order":
|
|
466
|
-
if (!id)
|
|
467
|
-
throw new Error(
|
|
468
|
-
`id (as synonym ID) is required for the '${action}' action`
|
|
469
|
-
);
|
|
470
|
-
params = params.concat([
|
|
471
|
-
`${id}`,
|
|
472
|
-
`${originationMap.get(origination) || 0}`,
|
|
473
|
-
`${orderSentenceId || 0}`,
|
|
474
|
-
nids.length > 1 ? `[${nids.join("|")}]` : `${nids[0] || 0}`,
|
|
475
|
-
`${interactionMap.get(interactionCheck) || 0}`
|
|
476
|
-
]);
|
|
477
|
-
break;
|
|
478
|
-
default:
|
|
479
|
-
if (!id)
|
|
480
|
-
throw new Error(
|
|
481
|
-
`id (as the existing order ID) is required for the '${action}' action`
|
|
482
|
-
);
|
|
483
|
-
params = params.concat([`${id}`]);
|
|
484
|
-
break;
|
|
485
|
-
}
|
|
486
|
-
return `{${params.join("|")}}`;
|
|
487
|
-
};
|
|
488
|
-
var orderActionMap = (/* @__PURE__ */ new Map()).set("launch moew", "ORDER").set("activate existing", "ACTIVATE").set("cancel-discontinue", "CANCEL DC").set("cancel-reorder", "CANCEL REORD").set("clear actions", "CLEAR").set("convert inpatient", "CONVERT_INPAT").set("convert prescription", "CONVERT_RX").set("modify", "MODIFY").set("new order", "ORDER").set("renew", "RENEW").set("renew prescription", "RENEW_RX").set("copy existing", "REPEAT").set("resume", "RESUME").set("suspend", "SUSPEND");
|
|
489
|
-
var originationMap = (/* @__PURE__ */ new Map()).set("satellite", "5").set("prescription", "1").set("normal", "0");
|
|
490
|
-
var interactionMap = (/* @__PURE__ */ new Map()).set("on sign", "1").set("default", "0");
|
|
491
|
-
var createOrderString = (action, id, opts) => _createOrderString(action, id, opts);
|
|
492
|
-
var LAUNCH_MOEW_ORDER_STRING = _createOrderString("launch moew");
|
|
493
|
-
|
|
494
|
-
// src/submitOrdersAsync.ts
|
|
495
|
-
var launchViewMap = (/* @__PURE__ */ new Map()).set("search", 8).set("profile", 16).set("signature", 32);
|
|
496
|
-
var tabsMap = (/* @__PURE__ */ new Map()).set("orders", { tab: 2, display: 0 }).set("power orders", { tab: 2, display: 127 }).set("medications", { tab: 3, display: 0 }).set("power medications", { tab: 3, display: 127 });
|
|
497
|
-
var submitOrdersAsync = async (patientId, encounterId, orders, opts) => {
|
|
498
|
-
let { targetTab, launchView, signSilently, dryRun } = opts || {};
|
|
499
|
-
if (!targetTab) targetTab = "orders";
|
|
500
|
-
if (!launchView) launchView = "signature";
|
|
501
|
-
const enablePowerPlans = targetTab === "power orders" || targetTab === "power medications";
|
|
502
|
-
const s = orders.map(
|
|
503
|
-
({ action, id, opts: opts2 }) => createOrderString(action, id, opts2)
|
|
504
|
-
);
|
|
505
|
-
let params = [`${patientId}`, `${encounterId}`, s.join("")];
|
|
506
|
-
params.push(enablePowerPlans ? "24" : "0");
|
|
507
|
-
const { tab, display } = tabsMap.get(targetTab) || { tab: 2, display: 127 };
|
|
508
|
-
params.push(`{${tab}|${display}}`);
|
|
509
|
-
params.push(`${launchViewMap.get(launchView) || 32}`);
|
|
510
|
-
params.push(`${signSilently ? "1" : "0"}`);
|
|
511
|
-
const eventString = params.join("|");
|
|
512
|
-
const retVal = {
|
|
513
|
-
eventString,
|
|
514
|
-
inPowerChart: true,
|
|
515
|
-
status: "success",
|
|
516
|
-
response: null,
|
|
517
|
-
ordersPlaced: null
|
|
518
|
-
};
|
|
519
|
-
if (dryRun) {
|
|
520
|
-
retVal.status = "dry run";
|
|
521
|
-
return retVal;
|
|
522
|
-
}
|
|
523
|
-
try {
|
|
524
|
-
const response = await window.external.MPAGES_EVENT(
|
|
525
|
-
"ORDERS",
|
|
526
|
-
eventString
|
|
527
|
-
);
|
|
528
|
-
if (response === null) {
|
|
529
|
-
retVal.status = "failed";
|
|
530
|
-
return retVal;
|
|
531
|
-
}
|
|
532
|
-
if (typeof response !== "string") {
|
|
533
|
-
retVal.status = "invalid data returned";
|
|
534
|
-
return retVal;
|
|
535
|
-
}
|
|
536
|
-
switch (response.trim()) {
|
|
537
|
-
case "":
|
|
538
|
-
retVal.status = "cancelled";
|
|
539
|
-
break;
|
|
540
|
-
default:
|
|
541
|
-
retVal.status = "success";
|
|
542
|
-
const parser = new import_fast_xml_parser.XMLParser();
|
|
543
|
-
try {
|
|
544
|
-
const parsed = parser.parse(response);
|
|
545
|
-
retVal.response = parsed;
|
|
546
|
-
if (!(parsed.Orders.Order instanceof Array)) {
|
|
547
|
-
parsed.Orders.Order = [parsed.Orders.Order];
|
|
548
|
-
}
|
|
549
|
-
retVal.ordersPlaced = parsed.Orders.Order.map((o) => ({
|
|
550
|
-
name: o.OrderedAsMnemonic,
|
|
551
|
-
oid: o.OrderId,
|
|
552
|
-
display: o.ClinDisplayLine
|
|
553
|
-
}));
|
|
554
|
-
} catch {
|
|
555
|
-
retVal.status = "xml parse error";
|
|
556
|
-
}
|
|
557
|
-
break;
|
|
558
|
-
}
|
|
559
|
-
} catch (e) {
|
|
560
|
-
if (outsideOfPowerChartError(e)) {
|
|
561
|
-
retVal.inPowerChart = false;
|
|
562
|
-
retVal.status = "invalid data returned";
|
|
563
|
-
warnAttemptedOrdersOutsideOfPowerChart(eventString);
|
|
564
|
-
} else {
|
|
565
|
-
throw e;
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
return retVal;
|
|
569
|
-
};
|
|
570
|
-
|
|
571
587
|
// src/utils/calculateMOEWBitmask.ts
|
|
572
588
|
var calculateMOEWBitmask = (targetTab, inputFlags) => {
|
|
573
589
|
let dwCustomizeFlag = 0;
|
|
@@ -912,11 +928,7 @@ async function signOrdersAsync(dcof, moewHandle) {
|
|
|
912
928
|
var submitPowerOrdersAsync = async (patientId, encounterId, orders, opts, moewFlags, targetTab) => {
|
|
913
929
|
opts = !opts ? { signSilently: false, interactionChecking: true } : opts;
|
|
914
930
|
moewFlags = !moewFlags ? [] : moewFlags;
|
|
915
|
-
const {
|
|
916
|
-
dwCustomizeFlag,
|
|
917
|
-
dwTabFlag,
|
|
918
|
-
dwTabDisplayOptionsFlag
|
|
919
|
-
} = calculateMOEWBitmask(targetTab || "orders tab", moewFlags);
|
|
931
|
+
const { dwCustomizeFlag, dwTabFlag, dwTabDisplayOptionsFlag } = calculateMOEWBitmask(targetTab || "orders tab", moewFlags);
|
|
920
932
|
let retData = {
|
|
921
933
|
inPowerChart: true,
|
|
922
934
|
status: "success",
|
|
@@ -1068,6 +1080,7 @@ var isStandaloneOrder = (o) => {
|
|
|
1068
1080
|
getValidEncountersAsync,
|
|
1069
1081
|
launchClinicalNoteAsync,
|
|
1070
1082
|
launchDischargeProcessAsync,
|
|
1083
|
+
launchMOEWAsync,
|
|
1071
1084
|
launchPatientEducationAsync,
|
|
1072
1085
|
launchPowerFormAsync,
|
|
1073
1086
|
launchPowerNoteAsync,
|