Update index.js
This commit is contained in:
parent
ad8cca11c2
commit
b886d6d836
@ -817,7 +817,7 @@ async function resolvePrescriptionDrugs(db, order) {
|
|||||||
const unit = matchConfig(unitList, requested.unit || master.unit, requested.unit || master.unit);
|
const unit = matchConfig(unitList, requested.unit || master.unit, requested.unit || master.unit);
|
||||||
const dosage = Number(requested.dosage);
|
const dosage = Number(requested.dosage);
|
||||||
const quantity = Number(requested.quantity);
|
const quantity = Number(requested.quantity);
|
||||||
const days = Number(master.days);
|
const days = Number(requested.days || master.days);
|
||||||
|
|
||||||
if (!usage || !frequency || !dosageUnit || !unit) {
|
if (!usage || !frequency || !dosageUnit || !unit) {
|
||||||
throw new AutomationError(`药品“${master.name}”的用法用量配置无法匹配`);
|
throw new AutomationError(`药品“${master.name}”的用法用量配置无法匹配`);
|
||||||
@ -826,7 +826,7 @@ async function resolvePrescriptionDrugs(db, order) {
|
|||||||
throw new AutomationError(`药品“${master.name}”的剂量或数量不正确`);
|
throw new AutomationError(`药品“${master.name}”的剂量或数量不正确`);
|
||||||
}
|
}
|
||||||
if (!(days > 0) || !Number.isInteger(days)) {
|
if (!(days > 0) || !Number.isInteger(days)) {
|
||||||
throw new AutomationError(`药品“${master.name}”未维护有效的用药天数`);
|
throw new AutomationError(`药品“${master.name}”用药天数不正确`);
|
||||||
}
|
}
|
||||||
if (!master.erpId || !master.insurance_code) {
|
if (!master.erpId || !master.insurance_code) {
|
||||||
throw new AutomationError(`药品“${master.name}”缺少HIS所需编码`);
|
throw new AutomationError(`药品“${master.name}”缺少HIS所需编码`);
|
||||||
@ -855,7 +855,7 @@ async function resolvePrescriptionDrugs(db, order) {
|
|||||||
forceSelfPay: master.forceSelfPay === "Y" ? "Y" : "N",
|
forceSelfPay: master.forceSelfPay === "Y" ? "Y" : "N",
|
||||||
limitUsageScope:
|
limitUsageScope:
|
||||||
typeof master.usage_restriction_desc === "string" &&
|
typeof master.usage_restriction_desc === "string" &&
|
||||||
master.usage_restriction_desc.trim()
|
master.usage_restriction_desc.trim()
|
||||||
? "Y"
|
? "Y"
|
||||||
: "N",
|
: "N",
|
||||||
};
|
};
|
||||||
@ -895,7 +895,7 @@ async function buildAutoPrescriptionParams(db, order) {
|
|||||||
: "storeMedicinePurchase";
|
: "storeMedicinePurchase";
|
||||||
const medicinePurchaseRxDuration =
|
const medicinePurchaseRxDuration =
|
||||||
Number.isInteger(config.medicinePurchaseRxDuration) &&
|
Number.isInteger(config.medicinePurchaseRxDuration) &&
|
||||||
config.medicinePurchaseRxDuration > 0
|
config.medicinePurchaseRxDuration > 0
|
||||||
? config.medicinePurchaseRxDuration
|
? config.medicinePurchaseRxDuration
|
||||||
: 30;
|
: 30;
|
||||||
|
|
||||||
@ -1106,8 +1106,8 @@ async function processClaimedTask(db, task) {
|
|||||||
error instanceof AutomationError
|
error instanceof AutomationError
|
||||||
? error
|
? error
|
||||||
: new AutomationError(error.message || "自动化任务执行失败", {
|
: new AutomationError(error.message || "自动化任务执行失败", {
|
||||||
retryable: true,
|
retryable: true,
|
||||||
});
|
});
|
||||||
if (automationError.cancelReason === TASK_CANCEL_REASONS.HIGH_RISK_DRUG) {
|
if (automationError.cancelReason === TASK_CANCEL_REASONS.HIGH_RISK_DRUG) {
|
||||||
const marked = await markTask(db, task, TASK_STATUS.CANCELLED, {
|
const marked = await markTask(db, task, TASK_STATUS.CANCELLED, {
|
||||||
lastError: automationError.message,
|
lastError: automationError.message,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user