Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c79128ca1 | ||
|
|
52416c5af2 |
@@ -195,11 +195,9 @@ class HandlerEscortRecord {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static buildShippingAddress(service, source, profile) {
|
static buildShippingAddress(source, profile) {
|
||||||
|
// 地址选填:跑腿/买药未填时由客服线下确认,仅保存快照
|
||||||
const address = String(source?.address || "").trim();
|
const address = String(source?.address || "").trim();
|
||||||
if (service.booking?.requiresAddress && !address) {
|
|
||||||
return { error: "请填写完整收货地址" };
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
shippingAddress: {
|
shippingAddress: {
|
||||||
recipientName: profile.profile?.name || "",
|
recipientName: profile.profile?.name || "",
|
||||||
@@ -349,8 +347,7 @@ class HandlerEscortRecord {
|
|||||||
body.schedule?.startTime
|
body.schedule?.startTime
|
||||||
);
|
);
|
||||||
if (scheduleResult.error) return ResponseUtil.badRequest(ctx, scheduleResult.error);
|
if (scheduleResult.error) return ResponseUtil.badRequest(ctx, scheduleResult.error);
|
||||||
const addressResult = HandlerEscortRecord.buildShippingAddress(service, body.shippingAddress, profile);
|
const addressResult = HandlerEscortRecord.buildShippingAddress(body.shippingAddress, profile);
|
||||||
if (addressResult.error) return ResponseUtil.badRequest(ctx, addressResult.error);
|
|
||||||
|
|
||||||
const payload = HandlerEscortRecord.pickFields(body);
|
const payload = HandlerEscortRecord.pickFields(body);
|
||||||
// 陪诊员分配由平台决定:用户下单时提交的 attendant 一律丢弃,防止自选/伪造陪诊员
|
// 陪诊员分配由平台决定:用户下单时提交的 attendant 一律丢弃,防止自选/伪造陪诊员
|
||||||
@@ -690,6 +687,16 @@ class HandlerEscortRecord {
|
|||||||
effectivePayment = fresh?.payment || effectivePayment;
|
effectivePayment = fresh?.payment || effectivePayment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 只有「未确认且未收款」的订单取消后直接物理删除;
|
||||||
|
// 已确认订单即使未收款也需保留记录供后续追溯
|
||||||
|
if (effectivePaymentStatus === "unpaid" && existing.status === "pending") {
|
||||||
|
const deletedRecord = await DBModel.EscortRecord.deleteRecord(id);
|
||||||
|
if (!deletedRecord) {
|
||||||
|
return ResponseUtil.error(ctx, "陪诊记录不存在", null, 404);
|
||||||
|
}
|
||||||
|
return ResponseUtil.success(ctx, { record: deletedRecord, deleted: true }, "订单已取消");
|
||||||
|
}
|
||||||
|
|
||||||
const update = {
|
const update = {
|
||||||
cancelStatus: "cancelled",
|
cancelStatus: "cancelled",
|
||||||
cancelledAt: new Date(),
|
cancelledAt: new Date(),
|
||||||
|
|||||||
@@ -80,11 +80,11 @@ const buildFudanFields = (fudan) => ({
|
|||||||
/**
|
/**
|
||||||
* Hospital Schema
|
* Hospital Schema
|
||||||
* 医院基础信息:名称、主体名称、昵称、拼音、省市、地址、电话、科室、等级、复旦综合榜档位。
|
* 医院基础信息:名称、主体名称、昵称、拼音、省市、地址、电话、科室、等级、复旦综合榜档位。
|
||||||
* 分院/院区按独立医院记录,不设 parentId;名称约定为「主体名称-分院名称」。
|
* 分院/院区按独立医院记录,不设 parentId;本院 name 为主体名称,分院约定为「主体名称-分院名称」。
|
||||||
*/
|
*/
|
||||||
const HospitalSchema = mongoose.Schema(
|
const HospitalSchema = mongoose.Schema(
|
||||||
{
|
{
|
||||||
name: { type: String, required: true, comment: "医院名称,约定为「主体名称-分院名称」" },
|
name: { type: String, required: true, comment: "医院名称;本院为主体名称本身,分院约定为「主体名称-分院名称」" },
|
||||||
entityName: { type: String, default: "", index: true, comment: "主体名称;为空时自动取 name 分隔符前的部分" },
|
entityName: { type: String, default: "", index: true, comment: "主体名称;为空时自动取 name 分隔符前的部分" },
|
||||||
nicknames: { type: [String], default: [], comment: "医院常用昵称;同一主体下的院区共享" },
|
nicknames: { type: [String], default: [], comment: "医院常用昵称;同一主体下的院区共享" },
|
||||||
pinyin: { type: String, default: "", index: true, comment: "医院名称全拼(小写无分隔)" },
|
pinyin: { type: String, default: "", index: true, comment: "医院名称全拼(小写无分隔)" },
|
||||||
|
|||||||
+10
-9
@@ -8,7 +8,7 @@
|
|||||||
* - sessions:可预约时段列表。
|
* - sessions:可预约时段列表。
|
||||||
* · 非 flexible:起止时刻固定,用户选的是「班次」,order 的 start/end 直接取该时段;
|
* · 非 flexible:起止时刻固定,用户选的是「班次」,order 的 start/end 直接取该时段;
|
||||||
* · flexible=true:开始时刻可在区间内选择,结束时刻由 durationMinutes 推算。
|
* · flexible=true:开始时刻可在区间内选择,结束时刻由 durationMinutes 推算。
|
||||||
* - requiresAddress:是否需要填写收货地址,后端据此强制校验地址快照。
|
* - requiresAddress:是否需要展示收货地址栏(跑腿/买药),地址为选填,仅随订单保存快照。
|
||||||
*
|
*
|
||||||
* 说明:这些字段不得在前端另行硬编码,前端只读不写;
|
* 说明:这些字段不得在前端另行硬编码,前端只读不写;
|
||||||
* 后端以本目录为准派生订单的 schedule.duration / schedule.endTime 并校验预约时段。
|
* 后端以本目录为准派生订单的 schedule.duration / schedule.endTime 并校验预约时段。
|
||||||
@@ -361,18 +361,18 @@ const services = [
|
|||||||
id: 6,
|
id: 6,
|
||||||
title: '跑腿服务',
|
title: '跑腿服务',
|
||||||
// 原「…等一小时陪诊服务」把跑腿说成陪诊,与列表页把它归入「就医代办」组自相矛盾;
|
// 原「…等一小时陪诊服务」把跑腿说成陪诊,与列表页把它归入「就医代办」组自相矛盾;
|
||||||
// 本项是按次计时的代办,故直接写出时长「2小时/次」(列表页规格签同步改为 2小时/次)。
|
// 本项是按次计时的代办,故直接写出时长「1小时/次」(列表页第二组五项均不展示规格签,无同步点)。
|
||||||
// 「买药」改为「取药」:国标 8.1 允许的是「代买或代取基础医疗用品」(示例为轮椅、陪护床、口罩)
|
// 「买药」改为「取药」:国标 8.1 允许的是「代买或代取基础医疗用品」(示例为轮椅、陪护床、口罩)
|
||||||
// 与「领取药物」,药品只有"凭处方代领"这一条路;写成「买药」会被读成代为选购药品,
|
// 与「领取药物」,药品只有"凭处方代领"这一条路;写成「买药」会被读成代为选购药品,
|
||||||
// 擦 8.2「提供医疗建议」「代替服务对象选择用药方案」,也与 id 8「代取药品」的口径打架
|
// 擦 8.2「提供医疗建议」「代替服务对象选择用药方案」,也与 id 8「代取药品」的口径打架
|
||||||
subtitle: '送资料/代排队/取药/取报告等,2小时/次',
|
subtitle: '送资料/代排队/取药/取报告等,1小时/次',
|
||||||
price: '160.00',
|
price: '150.00',
|
||||||
image: '/images/pt.jpg',
|
image: '/images/pt.jpg',
|
||||||
icon: 'usergroup',
|
icon: 'usergroup',
|
||||||
tag: '',
|
tag: '',
|
||||||
booking: {
|
booking: {
|
||||||
advanceDays: 1,
|
advanceDays: 1,
|
||||||
durationMinutes: 120,
|
durationMinutes: 60,
|
||||||
requiresAddress: true,
|
requiresAddress: true,
|
||||||
sessions: [{ start: '08:00', end: '18:00', flexible: true }]
|
sessions: [{ start: '08:00', end: '18:00', flexible: true }]
|
||||||
},
|
},
|
||||||
@@ -421,8 +421,9 @@ const services = [
|
|||||||
'需经您同意并授权后,陪诊师方可持您的证件和材料代您办理',
|
'需经您同意并授权后,陪诊师方可持您的证件和材料代您办理',
|
||||||
'请详细说明代办事项和特殊要求',
|
'请详细说明代办事项和特殊要求',
|
||||||
'需要提供办理所需的相关证件和材料',
|
'需要提供办理所需的相关证件和材料',
|
||||||
// 时长由 1 小时改为 2 小时,与副标题一致;本项自身均价 160/2h=80 元/h,与超时单价齐平
|
// 时长与副标题一致,均为 1 小时/次;本项自身均价 150/1h=150 元/h,远高于超时单价 80 元/h,
|
||||||
'服务时长为2小时,超出时间按每小时80元计费',
|
// 逻辑与 id 7 同理(多待 1 小时比另买 1 小时便宜,不会鼓励超时)
|
||||||
|
'服务时长为1小时,超出时间按每小时80元计费',
|
||||||
// 句式与 id 1-8 统一(原「服务费用不包含…」)
|
// 句式与 id 1-8 统一(原「服务费用不包含…」)
|
||||||
'服务费不包含药品费、检查费等医疗费用',
|
'服务费不包含药品费、检查费等医疗费用',
|
||||||
// 本项是「本人不到场」的形态——8.1 的动作与 9.3.2.1 的核对、9.3.3.1 的当面签收
|
// 本项是「本人不到场」的形态——8.1 的动作与 9.3.2.1 的核对、9.3.3.1 的当面签收
|
||||||
@@ -484,8 +485,8 @@ const services = [
|
|||||||
notices: [
|
notices: [
|
||||||
// 「全站超时统一 80 元/h」的单列例外:本项自身均价 500/4h=125 元/h,
|
// 「全站超时统一 80 元/h」的单列例外:本项自身均价 500/4h=125 元/h,
|
||||||
// 若也按 80 元/h 收超时,多待 1 小时会比提前买 1 小时便宜 45 元,逻辑倒挂且像鼓励超时。
|
// 若也按 80 元/h 收超时,多待 1 小时会比提前买 1 小时便宜 45 元,逻辑倒挂且像鼓励超时。
|
||||||
// 原 150 元/h 与全天/半天不一致,故降到与自身均价齐平的 125 元/h
|
// 原 150 元/h 与全天/半天不一致,故降到与自身均价齐平的 100 元/h
|
||||||
'服务时长为4小时,超出时间按每小时125元计费',
|
'服务时长为4小时,超出时间按每小时100元计费',
|
||||||
'夜间就诊请提前1天预约',
|
'夜间就诊请提前1天预约',
|
||||||
// 9.1.1 应提供服务变更手续,与 id 1/2/3/5 统一为「改期或取消」(原只有取消)
|
// 9.1.1 应提供服务变更手续,与 id 1/2/3/5 统一为「改期或取消」(原只有取消)
|
||||||
'如需改期或取消订单,请至少提前1天联系客服',
|
'如需改期或取消订单,请至少提前1天联系客服',
|
||||||
|
|||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/**
|
||||||
|
* 一次性清理:删除「未确认(pending)、未支付且已取消」的陪诊订单。
|
||||||
|
*
|
||||||
|
* 只有未确认且未收款的订单取消才物理删除;已确认订单即使未收款也要保留。
|
||||||
|
*
|
||||||
|
* 用法(在 api/health 下):
|
||||||
|
* node scripts/delete_unpaid_cancelled_escort_records.js # 仅统计,不删除
|
||||||
|
* node scripts/delete_unpaid_cancelled_escort_records.js --apply # 实际删除
|
||||||
|
*/
|
||||||
|
import { DBModel } from "../models/index.js";
|
||||||
|
|
||||||
|
DBModel.init();
|
||||||
|
const conn = DBModel.dbConnection;
|
||||||
|
const apply = process.argv.includes("--apply");
|
||||||
|
|
||||||
|
async function cleanup() {
|
||||||
|
// 旧数据把取消写在 status 里(status=cancelled),无法判断取消前是否已确认,不纳入清理
|
||||||
|
const filter = {
|
||||||
|
status: "pending",
|
||||||
|
"payment.status": "unpaid",
|
||||||
|
cancelStatus: "cancelled",
|
||||||
|
};
|
||||||
|
|
||||||
|
const records = await DBModel.EscortRecord.find(filter, {
|
||||||
|
_id: 1,
|
||||||
|
userId: 1,
|
||||||
|
status: 1,
|
||||||
|
cancelStatus: 1,
|
||||||
|
"payment.status": 1,
|
||||||
|
}).lean();
|
||||||
|
|
||||||
|
console.log(`matched pending+unpaid+cancelled escort records: ${records.length}`);
|
||||||
|
records.forEach((record) => {
|
||||||
|
console.log(
|
||||||
|
` ${record._id} userId=${record.userId} status=${record.status} cancelStatus=${record.cancelStatus || "none"}`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!apply) {
|
||||||
|
console.log("dry-run only. re-run with --apply to delete.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (records.length > 0) {
|
||||||
|
const result = await DBModel.EscortRecord.deleteMany(filter);
|
||||||
|
console.log(`deleted: ${result.deletedCount}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanup()
|
||||||
|
.catch((error) => {
|
||||||
|
console.error(error);
|
||||||
|
process.exitCode = 1;
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
conn.close();
|
||||||
|
});
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
/**
|
||||||
|
* 一次性数据修复:本院记录的 name 不应带「-分院名称」后缀。
|
||||||
|
*
|
||||||
|
* 背景:约定 name 为「主体名称-分院名称」,但部分本院记录也带了院区后缀,
|
||||||
|
* 如「中国医学科学院北京协和医院-王府井帅府园院区」实为本院,应改为「中国医学科学院北京协和医院」。
|
||||||
|
*
|
||||||
|
* 用法(在 api/health 下执行):
|
||||||
|
* 1. 默认 dry-run:只列出疑似本院记录(带分隔符后缀、且同主体下没有 name == entityName 的记录)
|
||||||
|
* node scripts/fix_main_campus_name.js
|
||||||
|
* 2. 确认后,在下方 RENAMES 填入「旧名称 -> 新名称」,执行:
|
||||||
|
* node scripts/fix_main_campus_name.js --apply
|
||||||
|
*
|
||||||
|
* 改名走模型静态方法,自动重算 entityName / pinyin / nicknames / fudanRank。
|
||||||
|
*/
|
||||||
|
import { DBModel } from "../models/index.js";
|
||||||
|
|
||||||
|
// 确认后的改名清单(dry-run 输出确认后填写)
|
||||||
|
const RENAMES = [
|
||||||
|
// { from: "中国医学科学院北京协和医院-王府井帅府园院区", to: "中国医学科学院北京协和医院" },
|
||||||
|
];
|
||||||
|
|
||||||
|
const APPLY = process.argv.includes("--apply");
|
||||||
|
const ENTITY_SEPARATOR = /[--—–]/;
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
const Hospital = DBModel.Hospital;
|
||||||
|
const hospitals = await Hospital.find({}).select("name entityName address").lean();
|
||||||
|
|
||||||
|
// 同主体下是否已存在「name == entityName」的本院记录
|
||||||
|
const hasMainRecord = new Set();
|
||||||
|
for (const h of hospitals) {
|
||||||
|
if (h.entityName && h.name === h.entityName) hasMainRecord.add(h.entityName);
|
||||||
|
}
|
||||||
|
|
||||||
|
const candidates = hospitals
|
||||||
|
.filter((h) => {
|
||||||
|
if (!h.entityName || h.name === h.entityName) return false;
|
||||||
|
// name 超出 entityName 的部分即为「分院名称」,本院记录不应有
|
||||||
|
return h.name.startsWith(h.entityName) && h.name.length > h.entityName.length
|
||||||
|
&& ENTITY_SEPARATOR.test(h.name.slice(h.entityName.length, h.entityName.length + 1));
|
||||||
|
})
|
||||||
|
.filter((h) => !hasMainRecord.has(h.entityName));
|
||||||
|
|
||||||
|
console.log(`total=${hospitals.length}, candidates=${candidates.length}`);
|
||||||
|
for (const h of candidates) {
|
||||||
|
console.log(`- name: ${h.name}\n entityName: ${h.entityName}\n address: ${h.address || "-"}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!APPLY) {
|
||||||
|
console.log("\n[dry-run] 未做任何修改。确认后填写 RENAMES 并加 --apply 执行。");
|
||||||
|
await DBModel.dbConnection.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (RENAMES.length === 0) {
|
||||||
|
console.log("[apply] RENAMES 为空,跳过。");
|
||||||
|
await DBModel.dbConnection.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const { from, to } of RENAMES) {
|
||||||
|
const doc = await Hospital.findOne({ name: from }).exec();
|
||||||
|
if (!doc) {
|
||||||
|
console.warn(`[skip] 未找到: ${from}`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
doc.name = to;
|
||||||
|
doc.entityName = ""; // 触发 pre-save 重新派生
|
||||||
|
doc.pinyin = "";
|
||||||
|
doc.pinyinFL = "";
|
||||||
|
await doc.save();
|
||||||
|
console.log(`[ok] ${from} -> ${doc.name} (entityName=${doc.entityName})`);
|
||||||
|
}
|
||||||
|
|
||||||
|
await DBModel.dbConnection.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
DBModel.init();
|
||||||
|
const conn = DBModel.dbConnection;
|
||||||
|
if (conn.readyState === 1) {
|
||||||
|
main().catch((e) => { console.error(e); process.exit(1); });
|
||||||
|
} else {
|
||||||
|
conn.once("connected", () => main().catch((e) => { console.error(e); process.exit(1); }));
|
||||||
|
conn.once("error", (e) => { console.error(e); process.exit(1); });
|
||||||
|
}
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
/**
|
||||||
|
* 生成「本院记录改名」提案:用 doc/hospitals 的本院档案(无字母后缀的编号文件)
|
||||||
|
* 里的官方名称 + 主院区地址,去匹配库里的院区记录。
|
||||||
|
*
|
||||||
|
* 用法:node scripts/propose_main_campus_rename.js
|
||||||
|
* 输出 PROPOSED / UNRESOLVED 清单,人工确认后把 PROPOSED 填进
|
||||||
|
* scripts/fix_main_campus_name.js 的 RENAMES 执行。
|
||||||
|
*/
|
||||||
|
import { readdirSync, readFileSync } from "node:fs";
|
||||||
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
import { DBModel } from "../models/index.js";
|
||||||
|
|
||||||
|
const DOC_DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), "../../../doc/hospitals");
|
||||||
|
|
||||||
|
const normalize = (s) =>
|
||||||
|
String(s || "")
|
||||||
|
.replace(/([^)]*)/g, "")
|
||||||
|
.replace(/\([^)]*\)/g, "")
|
||||||
|
.replace(/北京市/g, "")
|
||||||
|
.replace(/[\s,、。;;,]/g, "");
|
||||||
|
|
||||||
|
// 解析本院档案:文件名不带字母后缀(01_xxx.md),取标题与主院区地址
|
||||||
|
function loadMainDocs() {
|
||||||
|
const docs = [];
|
||||||
|
for (const file of readdirSync(DOC_DIR)) {
|
||||||
|
if (!/^\d+_.*\.md$/.test(file)) continue;
|
||||||
|
const text = readFileSync(path.join(DOC_DIR, file), "utf-8");
|
||||||
|
const title = (text.match(/^#\s+(.+)$/m) || [])[1]?.trim() || "";
|
||||||
|
const addr = (text.match(/主院区地址[::]\s*(.+)/) || [])[1]?.trim() || "";
|
||||||
|
docs.push({ file, title, addr: normalize(addr) });
|
||||||
|
}
|
||||||
|
return docs;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 地址匹配:归一后一方包含另一方,或共同尾部 >= 4 字
|
||||||
|
function addrMatch(a, b) {
|
||||||
|
if (!a || !b) return false;
|
||||||
|
if (a.includes(b) || b.includes(a)) return true;
|
||||||
|
const n = Math.min(a.length, b.length);
|
||||||
|
for (let k = n; k >= 4; k--) {
|
||||||
|
if (a.slice(-k) === b.slice(-k)) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
const docs = loadMainDocs();
|
||||||
|
const Hospital = DBModel.Hospital;
|
||||||
|
const hospitals = await Hospital.find({}).select("name entityName address").lean();
|
||||||
|
|
||||||
|
const hasMainRecord = new Set(
|
||||||
|
hospitals.filter((h) => h.entityName && h.name === h.entityName).map((h) => h.entityName)
|
||||||
|
);
|
||||||
|
|
||||||
|
// 按主体聚合「带后缀」的记录
|
||||||
|
const groups = new Map();
|
||||||
|
for (const h of hospitals) {
|
||||||
|
if (!h.entityName || h.name === h.entityName) continue;
|
||||||
|
if (!hasMainRecord.has(h.entityName)) {
|
||||||
|
if (!groups.has(h.entityName)) groups.set(h.entityName, []);
|
||||||
|
groups.get(h.entityName).push(h);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const proposed = [];
|
||||||
|
const unresolved = [];
|
||||||
|
|
||||||
|
for (const [entityName, records] of groups) {
|
||||||
|
// 找本院档案:标题与主体名称互相包含
|
||||||
|
const doc = docs.find(
|
||||||
|
(d) => d.title && (d.title === entityName || d.title.includes(entityName) || entityName.includes(d.title))
|
||||||
|
);
|
||||||
|
|
||||||
|
if (records.length === 1 && !doc) {
|
||||||
|
// 只有一条记录且无档案:视为本院
|
||||||
|
proposed.push({ from: records[0].name, to: entityName, why: "仅一条记录" });
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!doc || !doc.addr) {
|
||||||
|
unresolved.push({ entityName, records: records.map((r) => `${r.name} @ ${r.address || "-"}`), reason: "未找到本院档案或档案无主院区地址" });
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const hit = records.find((r) => addrMatch(normalize(r.address), doc.addr));
|
||||||
|
if (hit) {
|
||||||
|
proposed.push({ from: hit.name, to: entityName, why: `地址匹配档案 ${doc.file}` });
|
||||||
|
} else {
|
||||||
|
unresolved.push({
|
||||||
|
entityName,
|
||||||
|
docAddr: doc.addr,
|
||||||
|
records: records.map((r) => `${r.name} @ ${r.address || "-"}`),
|
||||||
|
reason: "档案地址匹配不上任何记录",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`=== PROPOSED (${proposed.length}) ===`);
|
||||||
|
for (const p of proposed) console.log(`- ${p.from}\n -> ${p.to} # ${p.why}`);
|
||||||
|
console.log(`\n=== UNRESOLVED (${unresolved.length}) ===`);
|
||||||
|
for (const u of unresolved) {
|
||||||
|
console.log(`- ${u.entityName} # ${u.reason}`);
|
||||||
|
if (u.docAddr) console.log(` 档案地址: ${u.docAddr}`);
|
||||||
|
for (const r of u.records) console.log(` ${r}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
await DBModel.dbConnection.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
DBModel.init();
|
||||||
|
const conn = DBModel.dbConnection;
|
||||||
|
if (conn.readyState === 1) {
|
||||||
|
main().catch((e) => { console.error(e); process.exit(1); });
|
||||||
|
} else {
|
||||||
|
conn.once("connected", () => main().catch((e) => { console.error(e); process.exit(1); }));
|
||||||
|
conn.once("error", (e) => { console.error(e); process.exit(1); });
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user