「已开处方」新增作废、医生电子签署身份两个按钮权限,按角色勾选

- 作废(tcm.prescription/void):未勾选的角色看不到按钮、接口也拒绝;开方/删除/审核权限不再隐含作废。
  勾选后仍只能作废本人开具的处方,具备审核角色的可作废数据范围内他人的处方;审核驳回作废不受影响
- 医生电子签署身份(tcm.prescription/esignDoctor):医生角色未勾选时,顶部下拉入口与签署面板「签署身份与证书」隐藏,
  服务端认证、快捷签授权一并拒绝(即不能签署处方);药师审核签署身份不受影响。桌面端入口同步按此权限判断
- 迁移 2026_11_27_prescription_void_esign_doctor_menu.sql:挂在「已开处方」下,默认不授予任何角色
- 重新构建管理后台
- 记录诊单 IM 聊天补拉改为独立系统 cron 的部署说明(原串行调度会被其阻塞数小时)

Co-Authored-By: Claude Opus 5 (1M context) <[EMAIL]>
This commit is contained in:
Your Name
2026-11-27 15:45:58 +08:00
co-authored by Claude Opus 5 (1M context)
parent 3451f43c22
commit dfe5768cd2
394 changed files with 472 additions and 377 deletions
@@ -159,6 +159,8 @@ import {
import EsignReviewPanel from '@/components/EsignReviewPanel.vue'
import EsignDoctorDialog from '@/components/EsignDoctorDialog.vue'
import useUserStore from '@/stores/modules/user'
import { DOCTOR_ESIGN_IDENTITY_PERMISSION } from '@/utils/prescription-esign'
import { hasPermission } from '@/utils/perm'
const props = defineProps<{ prescriptionId: number; initialState?: PrescriptionEsignStatus; audit?: boolean; reviewOrderId?: number }>()
const emit = defineEmits<{
@@ -346,7 +348,7 @@ const action = computed(() => {
}
return { label: '查询签署状态', run: refresh }
})
const canOpenCertificate = computed(() => confirmed.value
const canOpenCertificate = computed(() => confirmed.value && hasPermission([DOCTOR_ESIGN_IDENTITY_PERMISSION])
&& (canUseMethod(state.value, 'quick') || canUseMethod(state.value, 'sms')))
const pollInterval = 5000
@@ -41,6 +41,7 @@ import EsignDoctorDialog from '@/components/EsignDoctorDialog.vue'
import useUserStore from '@/stores/modules/user'
import feedback from '@/utils/feedback'
import { hasPermission } from '@/utils/perm'
import { DOCTOR_ESIGN_IDENTITY_PERMISSION } from '@/utils/prescription-esign'
const userStore = useUserStore()
const route = useRoute()
@@ -49,15 +50,11 @@ const userInfo = computed(() => userStore.userInfo)
const doctorEsignOpen = ref(false)
const reviewEsignOpen = ref(false)
const reviewEnabled = ref(false)
// These are the write grants accepted by the doctor eSign endpoints.
const prescriptionWritePermissions = [
'tcm.prescription/add', 'tcm.prescription/edit', 'cf.prescription/add', 'cf.prescription/edit',
'tcm.diagnosis/chufang', 'tcm.diagnosis/kaifang'
]
// 「医生电子签署身份」是独立按钮权限,需在角色权限中勾选(超级管理员的 * 权限同样通过)。
const canManageDoctorEsign = computed(() => {
const { role_ids, root } = userInfo.value
const { role_ids } = userInfo.value
return Boolean(userStore.token) && Array.isArray(role_ids) && role_ids.some((id) => Number(id) === 1)
&& (Number(root) === 1 || prescriptionWritePermissions.some((permission) => hasPermission([permission])))
&& hasPermission([DOCTOR_ESIGN_IDENTITY_PERMISSION])
})
const canManageReviewEsign = computed(() => Boolean(userStore.token) && reviewEnabled.value
&& [ 'tcm.prescriptionOrder/auditPrescription', 'tcm.prescription/audit', 'cf.prescription/audit' ]
+3
View File
@@ -7,6 +7,9 @@ import {
type PrescriptionEsignStatus
} from '@/api/tcm'
/** 「医生电子签署身份」按钮权限,与服务端 DoctorEsignIdentityService::DOCTOR_IDENTITY_PERMISSION 一致。 */
export const DOCTOR_ESIGN_IDENTITY_PERMISSION = 'tcm.prescription/esignDoctor'
const signingTimeFormatter = new Intl.DateTimeFormat('zh-CN', {
timeZone: 'Asia/Shanghai',
year: 'numeric',
@@ -284,6 +284,7 @@
</el-button>
<el-button
v-if="canVoidPendingPrescription(row)"
v-perms="['tcm.prescription/void']"
type="danger"
link
:loading="voidingPrescriptionId === Number(row.id)"
+6 -2
View File
@@ -117,7 +117,7 @@ function createDialog({ read = () => status(), start = () => authenticating(), c
}
}
test('account menu requires a signed-in doctor with a prescription write grant', async () => {
test('account menu requires a signed-in doctor with the signing identity button grant', async () => {
const store = vue.reactive({ token: 'synthetic', userInfo: { id: 21, role_ids: [2], root: 1 }, perms: ['*'] })
let mounted
const component = load(menuScript.script, {
@@ -128,7 +128,8 @@ test('account menu requires a signed-in doctor with a prescription write grant',
'@/components/EsignDoctorDialog.vue': {},
'@/stores/modules/user': { default: () => store },
'@/utils/feedback': {},
'@/utils/perm': { hasPermission: ([perm]) => store.perms.includes(perm) }
'@/utils/perm': { hasPermission: ([perm]) => store.perms.includes(perm) || store.perms.includes('*') },
'@/utils/prescription-esign': { DOCTOR_ESIGN_IDENTITY_PERMISSION: 'tcm.prescription/esignDoctor' }
}).default
const scope = vue.effectScope()
const menu = scope.run(() => component.setup({}, { expose() {} }))
@@ -145,6 +146,9 @@ test('account menu requires a signed-in doctor with a prescription write grant',
store.perms = ['cf.prescription/edit']
assert.equal(menu.reviewEsignOpen.value, false)
await menu.handleCommand('doctor-esign')
assert.equal(menu.doctorEsignOpen.value, false, 'a prescription write grant alone no longer opens the signing identity')
store.perms = ['cf.prescription/edit', 'tcm.prescription/esignDoctor']
await menu.handleCommand('doctor-esign')
assert.equal(menu.doctorEsignOpen.value, true)
store.userInfo.id = 23
assert.equal(menu.doctorEsignOpen.value, false)