fix: tenant_super_admin 纳入身份证明文查看口径 + 建档失败清理评估副本孤儿对象
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
c18187e658
commit
bbf87b2805
@ -105,21 +105,29 @@ export class ElderService extends BaseCrudService {
|
|||||||
}
|
}
|
||||||
const treatStatus = resolveInitialStatus(dto.benefitStart, dto.benefitEnd);
|
const treatStatus = resolveInitialStatus(dto.benefitStart, dto.benefitEnd);
|
||||||
const { idCardNo: _idCardNo, ...dtoRest } = dto;
|
const { idCardNo: _idCardNo, ...dtoRest } = dto;
|
||||||
const created = await super.create({
|
try {
|
||||||
...dtoRest,
|
const created = await super.create({
|
||||||
idCardNoHash: hash(idCardNo),
|
...dtoRest,
|
||||||
idCardNoEnc: encrypt(idCardNo),
|
idCardNoHash: hash(idCardNo),
|
||||||
birthDate: toDateOnly(birthDate),
|
idCardNoEnc: encrypt(idCardNo),
|
||||||
treatStatus,
|
birthDate: toDateOnly(birthDate),
|
||||||
statusSource: 'manual',
|
treatStatus,
|
||||||
benefitStart: toDateOnly(dto.benefitStart),
|
statusSource: 'manual',
|
||||||
benefitEnd: toDateOnly(dto.benefitEnd),
|
benefitStart: toDateOnly(dto.benefitStart),
|
||||||
assessDate: toDateOnly(dto.assessDate),
|
benefitEnd: toDateOnly(dto.benefitEnd),
|
||||||
insurVerifyDate: toDateOnly(dto.insurVerifyDate),
|
assessDate: toDateOnly(dto.assessDate),
|
||||||
hospStart: toDateOnly(dto.hospStart),
|
insurVerifyDate: toDateOnly(dto.insurVerifyDate),
|
||||||
hospEnd: toDateOnly(dto.hospEnd),
|
hospStart: toDateOnly(dto.hospStart),
|
||||||
});
|
hospEnd: toDateOnly(dto.hospEnd),
|
||||||
return this.presentIdCard(created, false);
|
});
|
||||||
|
return this.presentIdCard(created, false);
|
||||||
|
} catch (err) {
|
||||||
|
// 建档失败时清理已上传的评估结论副本(避免 MinIO 孤儿对象)。
|
||||||
|
if (dto.assessEvidenceFile) {
|
||||||
|
await this.storage.delete(dto.assessEvidenceFile).catch(() => undefined);
|
||||||
|
}
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 详情:admin/qc(或平台超管)返回身份证明文并显式写审计;否则掩码。 */
|
/** 详情:admin/qc(或平台超管)返回身份证明文并显式写审计;否则掩码。 */
|
||||||
@ -202,7 +210,7 @@ export class ElderService extends BaseCrudService {
|
|||||||
where: { tenantCode: ctx.tenantCode, userId: ctx.userId },
|
where: { tenantCode: ctx.tenantCode, userId: ctx.userId },
|
||||||
select: { roleCode: true },
|
select: { roleCode: true },
|
||||||
});
|
});
|
||||||
return rows.some((r) => r.roleCode === 'admin' || r.roleCode === 'qc');
|
return rows.some((r) => r.roleCode === 'admin' || r.roleCode === 'qc' || r.roleCode === 'tenant_super_admin');
|
||||||
}
|
}
|
||||||
|
|
||||||
private async assertIdCardUnique(idCardNo: string) {
|
private async assertIdCardUnique(idCardNo: string) {
|
||||||
|
|||||||
@ -32,4 +32,9 @@ export class StorageService {
|
|||||||
async presignGet(key: string, expiry = 3600): Promise<string> {
|
async presignGet(key: string, expiry = 3600): Promise<string> {
|
||||||
return this.client.presignedGetObject(this.bucket, key, expiry);
|
return this.client.presignedGetObject(this.bucket, key, expiry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 删除对象(幂等:对象不存在不抛错)。 */
|
||||||
|
async delete(key: string): Promise<void> {
|
||||||
|
await this.client.removeObject(this.bucket, key).catch(() => undefined);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user