fix:问题修复
This commit is contained in:
parent
552dc546be
commit
6185f89f95
@ -1121,6 +1121,15 @@ async function auditDiagnosis(item, db) {
|
||||
if (passList.length) {
|
||||
let successRxList = [];
|
||||
const auditTime = Date.now();
|
||||
// uploadRx2His 内部会按处方 id 从 MongoDB 重新读取记录并生成 PDF,
|
||||
// 因此不能只在内存 rx 对象中补签名,必须先写入数据库。
|
||||
await db.collection("diagnostic-record").updateMany(
|
||||
{
|
||||
_id: { $in: passList.map(i => i.rx._id) },
|
||||
status: status.init,
|
||||
},
|
||||
{ $set: { pharmacistSignImg: pharmacistCAUserId } }
|
||||
);
|
||||
const uploadResult = await Promise.all(passList.map(i => uploadRx2His({ ...i.rx, auditTime }, i.order)));
|
||||
uploadResult.forEach(i => {
|
||||
if (i.success) {
|
||||
@ -1465,7 +1474,7 @@ async function reUploadDiagnosticRecord({ _id }) {
|
||||
const data = await db
|
||||
.collection("diagnostic-record")
|
||||
.findOne({ _id: new ObjectId(_id) });
|
||||
console.log(data)
|
||||
console.log(data)
|
||||
if (!data) return { success: false, message: "处方不存在" };
|
||||
const base64 = await getpdfbase64({ id: data._id.toString() }, db);
|
||||
const payload = formatUploadRxData(data, { pdf: base64 });
|
||||
|
||||
@ -129,8 +129,11 @@ function safeDataImage(value) {
|
||||
}
|
||||
|
||||
function getUploadRoot() {
|
||||
// 与 upload.js 使用相同的共享上传目录,拒绝任意文件系统路径。
|
||||
return path.resolve(__dirname, "../../../upload-files");
|
||||
// 源码运行时:<repo>/hn-hlw-service/hlw/prescription-pdf -> <repo>/upload-files。
|
||||
// esbuild 后 __dirname 为 /opt/apps(bundle_pro.js 所在目录),上传目录则为 /opt/apps/upload-files。
|
||||
return process.env.IS_BUILDED === "YES"
|
||||
? path.resolve(__dirname, "../upload-files")
|
||||
: path.resolve(__dirname, "../../../upload-files");
|
||||
}
|
||||
|
||||
function getImageMimeType(buffer, contentType = "") {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user