Эх сурвалжийг харах

feat(@six/wisdom-legacy): 成果管理 - 新药证书静态页面新增

Co-authored-by: Cursor <cursoragent@cursor.com>
cmj 2 өдөр өмнө
parent
commit
efde33d6dc

+ 1 - 0
apps/wisdom-legacy/src/api/outcome/index.ts

@@ -2,6 +2,7 @@ export * from './hospital-preparation.api';
 export * from './intellectual-property.api';
 export * from './medical-case-library.api';
 export * from './monograph.api';
+export * from './new-drug-certificate.api';
 export * from './paper.api';
 export * from './research-report.api';
 export * from './treatment-plan.api';

+ 134 - 0
apps/wisdom-legacy/src/api/outcome/new-drug-certificate.api.ts

@@ -0,0 +1,134 @@
+import type {
+  NewDrugCertificateSubmitVO,
+  NewDrugCertificateVO,
+} from './new-drug-certificate.schema';
+
+import type { PageQueryMethodArgs } from '#/request/schema';
+
+import { getEnvelopeData, httpClient } from '#/request';
+import {
+  pageQueryArgsTransform,
+  paginateTransform,
+  transform,
+} from '#/request/schema';
+
+import {
+  mockDeleteNewDrugCertificateMethod,
+  mockEditNewDrugCertificateMethod,
+  mockGetNewDrugCertificateMethod,
+  mockListNewDrugCertificateMethod,
+  USE_NEW_DRUG_CERTIFICATE_MOCK,
+} from './new-drug-certificate.mock';
+import {
+  decodeNewDrugCertificate,
+  encodeNewDrugCertificate,
+  encodeNewDrugCertificateQuery,
+} from './new-drug-certificate.schema';
+
+export { USE_NEW_DRUG_CERTIFICATE_MOCK } from './new-drug-certificate.mock';
+export type {
+  NewDrugCertificateQueryVO,
+  NewDrugCertificateSubmitVO,
+  NewDrugCertificateVO,
+  NewDrugType,
+} from './new-drug-certificate.schema';
+export {
+  formatValidUntil,
+  getNewDrugTypeLabel,
+  NEW_DRUG_TYPE_OPTIONS,
+  NewDrugCertificateVOSchema,
+} from './new-drug-certificate.schema';
+
+/** 新药证书分页列表 */
+export function listNewDrugCertificateMethod(...args: PageQueryMethodArgs) {
+  if (USE_NEW_DRUG_CERTIFICATE_MOCK) {
+    return mockListNewDrugCertificateMethod(...args) as any;
+  }
+
+  const { params, data } = pageQueryArgsTransform(
+    args,
+    encodeNewDrugCertificateQuery,
+  );
+  return httpClient.Post(
+    `/wis-pc/outcome/newDrugCertificateManage/page`,
+    { ...params, ...data },
+    {
+      params,
+      hitSource: /^outcome-new-drug-certificate:(edit|delete)/,
+      transform: paginateTransform(decodeNewDrugCertificate),
+    },
+  );
+}
+
+/** 新增新药证书 */
+export function createNewDrugCertificateMethod(vo: NewDrugCertificateSubmitVO) {
+  if (USE_NEW_DRUG_CERTIFICATE_MOCK) {
+    return mockEditNewDrugCertificateMethod(vo) as any;
+  }
+
+  return httpClient.Post(
+    `/wis-pc/outcome/newDrugCertificateManage/add`,
+    encodeNewDrugCertificate(vo),
+    {
+      name: 'outcome-new-drug-certificate:edit',
+      transform: getEnvelopeData<null | string>,
+    },
+  );
+}
+
+/** 修改新药证书 */
+export function updateNewDrugCertificateMethod(vo: NewDrugCertificateSubmitVO) {
+  if (USE_NEW_DRUG_CERTIFICATE_MOCK) {
+    return mockEditNewDrugCertificateMethod(vo) as any;
+  }
+
+  return httpClient.Post(
+    `/wis-pc/outcome/newDrugCertificateManage/update`,
+    encodeNewDrugCertificate(vo),
+    {
+      name: 'outcome-new-drug-certificate:edit',
+      transform: getEnvelopeData<null | string>,
+    },
+  );
+}
+
+/** 新增 / 修改新药证书 */
+export function editNewDrugCertificateMethod(vo: NewDrugCertificateSubmitVO) {
+  return vo.id
+    ? updateNewDrugCertificateMethod(vo)
+    : createNewDrugCertificateMethod(vo);
+}
+
+/** 新药证书详情 */
+export function getNewDrugCertificateMethod(vo: Partial<NewDrugCertificateVO>) {
+  if (USE_NEW_DRUG_CERTIFICATE_MOCK) {
+    return mockGetNewDrugCertificateMethod(vo) as any;
+  }
+
+  return httpClient.Post(
+    `/wis-pc/outcome/newDrugCertificateManage/detail/${vo.id}`,
+    {},
+    {
+      hitSource: /^outcome-new-drug-certificate:edit/,
+      transform: transform(decodeNewDrugCertificate),
+    },
+  );
+}
+
+/** 删除新药证书 */
+export function deleteNewDrugCertificateMethod(
+  vo: Pick<NewDrugCertificateVO, 'id'>,
+) {
+  if (USE_NEW_DRUG_CERTIFICATE_MOCK) {
+    return mockDeleteNewDrugCertificateMethod(vo) as any;
+  }
+
+  return httpClient.Post(
+    `/wis-pc/outcome/newDrugCertificateManage/delete/${vo.id}`,
+    {},
+    {
+      name: 'outcome-new-drug-certificate:delete',
+      meta: { ignoreError: true },
+    },
+  );
+}

+ 232 - 0
apps/wisdom-legacy/src/api/outcome/new-drug-certificate.mock.ts

@@ -0,0 +1,232 @@
+import type {
+  NewDrugCertificateDTO,
+  NewDrugCertificateSubmitVO,
+  NewDrugCertificateVO,
+  NewDrugType,
+} from './new-drug-certificate.schema';
+
+import type { PageQueryMethodArgs } from '#/request/schema';
+import type { PageVO } from '#/request/schema/record';
+
+import { pageQueryArgsTransform } from '#/request/schema';
+
+import {
+  decodeNewDrugCertificate,
+  encodeNewDrugCertificate,
+  encodeNewDrugCertificateQuery,
+} from './new-drug-certificate.schema';
+
+/** 后端接口就绪后改为 false */
+export const USE_NEW_DRUG_CERTIFICATE_MOCK = true;
+
+type MethodLike<T> = PromiseLike<T> & {
+  send?: (force?: boolean) => PromiseLike<T>;
+};
+
+const MOCK_PDF_URL =
+  'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf';
+
+const SEED_RECORDS: Omit<
+  NewDrugCertificateDTO,
+  'createTime' | 'id' | 'personalStudioId' | 'updateTime'
+>[] = [
+  {
+    approvalNumber: '国药准字Z20050002',
+    name: '复方丹参滴丸',
+    drugType: 'tcm',
+    applicant: '天津天士力制药股份有限公司',
+    approvalDate: '2005-01-10',
+    longTerm: true,
+    fileUrl: MOCK_PDF_URL,
+  },
+  {
+    approvalNumber: '国药准字Z20040033',
+    name: '血必净注射液',
+    drugType: 'tcm_injection',
+    applicant: '天津红日药业股份有限公司',
+    approvalDate: '2004-06-18',
+    longTerm: true,
+    fileUrl: MOCK_PDF_URL,
+  },
+  {
+    approvalNumber: '国药准字Z20030139',
+    name: '参麦注射液',
+    drugType: 'tcm_injection',
+    applicant: '正大青春宝药业有限公司',
+    approvalDate: '2003-09-25',
+    validUntil: '2028-09-25',
+    longTerm: false,
+    fileUrl: MOCK_PDF_URL,
+  },
+  {
+    approvalNumber: '国药准字H20123456',
+    name: '阿莫西林胶囊',
+    drugType: 'chemical',
+    applicant: '华北制药股份有限公司',
+    approvalDate: '2012-05-20',
+    validUntil: '2027-05-20',
+    longTerm: false,
+    fileUrl: MOCK_PDF_URL,
+  },
+  {
+    approvalNumber: '国药准字S20210001',
+    name: '重组人胰岛素注射液',
+    drugType: 'biological',
+    applicant: '通化东宝药业股份有限公司',
+    approvalDate: '2021-03-15',
+    longTerm: true,
+    fileUrl: MOCK_PDF_URL,
+  },
+  {
+    approvalNumber: '国药准字Z20190088',
+    name: '连花清瘟胶囊',
+    drugType: 'tcm',
+    applicant: '石家庄以岭药业股份有限公司',
+    approvalDate: '2019-11-08',
+    longTerm: true,
+    fileUrl: MOCK_PDF_URL,
+  },
+];
+
+function createInitialStore(): NewDrugCertificateDTO[] {
+  const records: NewDrugCertificateDTO[] = [];
+  for (let index = 0; index < 12; index += 1) {
+    const seed = SEED_RECORDS[index % SEED_RECORDS.length] ?? SEED_RECORDS[0];
+    if (!seed) continue;
+    records.push({
+      ...seed,
+      id: String(index + 1),
+      personalStudioId: '327477138296832',
+      createTime: `2026-01-${String((index % 28) + 1).padStart(2, '0')}T10:00:00`,
+      updateTime: `2026-05-${String((index % 28) + 1).padStart(2, '0')}T10:00:00`,
+    });
+  }
+  return records;
+}
+
+let nextId = 100;
+let store = createInitialStore();
+
+function delay<T>(runner: () => Promise<T> | T, ms = 120): MethodLike<T> {
+  const run = async () => {
+    await new Promise((resolve) => setTimeout(resolve, ms));
+    return runner();
+  };
+  const promise = run();
+  return Object.assign(promise, { send: run });
+}
+
+function matchKeyword(record: NewDrugCertificateDTO, keyword?: string) {
+  if (!keyword) return true;
+  const text = [record.name, record.approvalNumber, record.applicant]
+    .filter(Boolean)
+    .join(' ');
+  return text.includes(keyword);
+}
+
+function matchWorkroom(record: NewDrugCertificateDTO, workroomId?: string) {
+  if (!workroomId) return true;
+  return String(record.personalStudioId ?? '') === String(workroomId);
+}
+
+function matchDrugType(record: NewDrugCertificateDTO, drugType?: NewDrugType) {
+  if (!drugType) return true;
+  return record.drugType === drugType;
+}
+
+function toVo(dto: NewDrugCertificateDTO): NewDrugCertificateVO {
+  return decodeNewDrugCertificate(dto);
+}
+
+export function mockListNewDrugCertificateMethod(...args: PageQueryMethodArgs) {
+  const { params, data } = pageQueryArgsTransform(
+    args,
+    encodeNewDrugCertificateQuery,
+  );
+  const pageNum = Number(params.pageNum ?? 1);
+  const pageSize = Number(params.pageSize ?? 10);
+  const keyword = data.mixture;
+  const workroomId = data.personalStudioId?.toString();
+  const drugType = data.drugType;
+
+  const filtered = store.filter(
+    (record) =>
+      matchKeyword(record, keyword) &&
+      matchWorkroom(record, workroomId) &&
+      matchDrugType(record, drugType),
+  );
+  const start = (pageNum - 1) * pageSize;
+  const items = filtered
+    .slice(start, start + pageSize)
+    .map((record) => toVo(record));
+
+  const result: PageVO<NewDrugCertificateVO> = {
+    total: filtered.length,
+    items,
+  };
+  return delay(() => result);
+}
+
+export function mockGetNewDrugCertificateMethod(
+  vo: Partial<NewDrugCertificateVO>,
+) {
+  return delay(() => {
+    const record = store.find((item) => String(item.id) === String(vo.id));
+    if (!record) {
+      throw new Error('新药证书不存在');
+    }
+    return toVo(record);
+  });
+}
+
+export function mockEditNewDrugCertificateMethod(
+  vo: NewDrugCertificateSubmitVO,
+) {
+  return delay(() => {
+    const dto = encodeNewDrugCertificate(vo);
+    const now = new Date().toISOString();
+
+    if (vo.id) {
+      const index = store.findIndex(
+        (item) => String(item.id) === String(vo.id),
+      );
+      if (index === -1) {
+        throw new Error('新药证书不存在');
+      }
+      store[index] = {
+        ...store[index],
+        ...dto,
+        updateTime: now,
+      };
+      return String(vo.id);
+    }
+
+    const id = String(nextId++);
+    store.unshift({
+      ...dto,
+      id,
+      createTime: now,
+      updateTime: now,
+    });
+    return id;
+  });
+}
+
+export function mockDeleteNewDrugCertificateMethod(
+  vo: Pick<NewDrugCertificateVO, 'id'>,
+) {
+  return delay(() => {
+    const before = store.length;
+    store = store.filter((item) => String(item.id) !== String(vo.id));
+    if (store.length === before) {
+      throw new Error('新药证书不存在');
+    }
+    return null;
+  });
+}
+
+/** 仅用于本地调试,重置 mock 数据 */
+export function resetNewDrugCertificateMockStore() {
+  nextId = 100;
+  store = createInitialStore();
+}

+ 160 - 0
apps/wisdom-legacy/src/api/outcome/new-drug-certificate.schema.ts

@@ -0,0 +1,160 @@
+import type {
+  AuditRecordDTO,
+  AuditRecordVO,
+} from '#/request/schema/audit-record';
+
+import { z } from '#/adapter/form';
+import { decodeList } from '#/request/schema';
+import { decodeAuditRecord } from '#/request/schema/audit-record';
+
+// ---------------------------------------------------------------------------
+// 枚举
+// ---------------------------------------------------------------------------
+
+export type NewDrugType =
+  | 'biological'
+  | 'chemical'
+  | 'other'
+  | 'tcm'
+  | 'tcm_injection';
+
+export const NEW_DRUG_TYPE_OPTIONS = [
+  { label: '中药', value: 'tcm', color: 'success' },
+  { label: '中药注射剂', value: 'tcm_injection', color: 'success' },
+  { label: '化学药', value: 'chemical', color: 'processing' },
+  { label: '生物制品', value: 'biological', color: 'processing' },
+  { label: '其他', value: 'other', color: 'default' },
+] as const satisfies ReadonlyArray<{
+  color: string;
+  label: string;
+  value: NewDrugType;
+}>;
+
+export function getNewDrugTypeLabel(type?: NewDrugType) {
+  return NEW_DRUG_TYPE_OPTIONS.find((item) => item.value === type)?.label ?? '';
+}
+
+export function formatValidUntil(validUntil?: string, longTerm?: boolean) {
+  if (longTerm) return '长期有效';
+  return validUntil || '-';
+}
+
+// ---------------------------------------------------------------------------
+// DTO
+// ---------------------------------------------------------------------------
+
+export interface NewDrugCertificateDTO extends AuditRecordDTO {
+  id?: number | string;
+  personalStudioId?: number | string;
+  approvalNumber?: string;
+  name?: string;
+  drugType?: NewDrugType;
+  applicant?: string;
+  approvalDate?: string;
+  validUntil?: string;
+  longTerm?: boolean;
+  fileUrl?: string;
+}
+
+export interface NewDrugCertificateQueryDTO {
+  mixture?: string;
+  personalStudioId?: number | string;
+  drugType?: NewDrugType;
+  pageNum?: number;
+  pageSize?: number;
+}
+
+// ---------------------------------------------------------------------------
+// VO
+// ---------------------------------------------------------------------------
+
+export interface NewDrugCertificateVO extends AuditRecordVO {
+  id?: string;
+  workroomId: string;
+  approvalNumber: string;
+  name: string;
+  drugType: NewDrugType;
+  applicant: string;
+  approvalDate: string;
+  validUntil?: string;
+  longTerm: boolean;
+  pdfUrl?: string;
+}
+
+export type NewDrugCertificateSubmitVO = NewDrugCertificateVO;
+
+export interface NewDrugCertificateQueryVO {
+  keyword?: string;
+  workroomId?: string;
+  drugType?: NewDrugType;
+}
+
+// ---------------------------------------------------------------------------
+// Schema
+// ---------------------------------------------------------------------------
+
+export const NewDrugCertificateVOSchema = z.object({
+  id: z.string().optional(),
+  workroomId: z.string().min(1, '工作室不能为空'),
+  approvalNumber: z.string().min(1, '请输入批准文号'),
+  name: z.string().min(1, '请输入新药名称'),
+  drugType: z.enum(
+    ['tcm', 'tcm_injection', 'chemical', 'biological', 'other'],
+    { message: '请选择新药类型' },
+  ),
+  applicant: z.string().min(1, '请输入申请单位'),
+  approvalDate: z.string().min(1, '请选择批准日期'),
+});
+
+// ---------------------------------------------------------------------------
+// 编解码
+// ---------------------------------------------------------------------------
+
+export function decodeNewDrugCertificate(
+  dto: NewDrugCertificateDTO,
+): NewDrugCertificateVO {
+  return {
+    ...decodeAuditRecord(dto),
+    id: dto.id?.toString(),
+    workroomId: dto.personalStudioId?.toString() ?? '',
+    approvalNumber: dto.approvalNumber ?? '',
+    name: dto.name ?? '',
+    drugType: dto.drugType ?? 'tcm',
+    applicant: dto.applicant ?? '',
+    approvalDate: dto.approvalDate ?? '',
+    validUntil: dto.validUntil,
+    longTerm: dto.longTerm ?? false,
+    pdfUrl: dto.fileUrl,
+  };
+}
+
+export function encodeNewDrugCertificateQuery(
+  query: Partial<NewDrugCertificateQueryVO & Record<string, unknown>>,
+): NewDrugCertificateQueryDTO {
+  return {
+    mixture: query.keyword || undefined,
+    personalStudioId: query.workroomId,
+    drugType: query.drugType || undefined,
+  };
+}
+
+export function encodeNewDrugCertificate(
+  vo: NewDrugCertificateSubmitVO,
+): NewDrugCertificateDTO {
+  return {
+    id: vo.id,
+    personalStudioId: vo.workroomId,
+    approvalNumber: vo.approvalNumber,
+    name: vo.name,
+    drugType: vo.drugType,
+    applicant: vo.applicant,
+    approvalDate: vo.approvalDate,
+    validUntil: vo.longTerm ? undefined : vo.validUntil,
+    longTerm: vo.longTerm,
+    fileUrl: vo.pdfUrl,
+  };
+}
+
+export function decodeNewDrugCertificateList(dto: NewDrugCertificateDTO[]) {
+  return decodeList(dto, decodeNewDrugCertificate);
+}

+ 3 - 0
apps/wisdom-legacy/src/locales/langs/zh-CN/outcome.json

@@ -19,5 +19,8 @@
   },
   "hospitalPreparation": {
     "name": "院内制剂"
+  },
+  "newDrugCertificate": {
+    "name": "新药证书"
   }
 }

+ 3 - 1
apps/wisdom-legacy/src/router/routes/modules/outcome.route.ts

@@ -11,6 +11,8 @@ const intellectualProperty = () =>
   import('#/views/outcome/IntellectualPropertyList.vue');
 const hospitalPreparation = () =>
   import('#/views/outcome/HospitalPreparationList.vue');
+const newDrugCertificate = () =>
+  import('#/views/outcome/NewDrugCertificateList.vue');
 
 const routes: RouteRecordRaw[] = [
   {
@@ -93,7 +95,7 @@ const routes: RouteRecordRaw[] = [
           icon: 'carbon:user',
           title: '新药证书',
         },
-        component: placeholder,
+        component: newDrugCertificate,
       },
       {
         path: '/outcome/continuing-education',

+ 237 - 0
apps/wisdom-legacy/src/views/outcome/NewDrugCertificateList.vue

@@ -0,0 +1,237 @@
+<script setup lang="ts">
+import type { NewDrugCertificateVO, NewDrugType } from '#/api/outcome';
+
+import { computed, ref, shallowRef, triggerRef, watch } from 'vue';
+
+import { Page } from '@vben/common-ui';
+import { Plus } from '@vben/icons';
+
+import {
+  Button,
+  Empty,
+  Input,
+  message,
+  Pagination,
+  Select,
+  Spin,
+} from 'ant-design-vue';
+import { storeToRefs } from 'pinia';
+
+import { useShell } from '#/adapter/shell';
+import { invokeMethod } from '#/adapter/vxe-table/proxy/invoke-method';
+import {
+  deleteNewDrugCertificateMethod,
+  listNewDrugCertificateMethod,
+  NEW_DRUG_TYPE_OPTIONS,
+} from '#/api/outcome';
+import { useWorkroomStore } from '#/stores';
+
+import NewDrugCertificateCard from './components/NewDrugCertificateCard.vue';
+import NewDrugCertificateEdit from './modules/NewDrugCertificateEdit.vue';
+
+const workroomStore = useWorkroomStore();
+const { workroomId } = storeToRefs(workroomStore);
+
+const keyword = ref('');
+const searchKeyword = ref('');
+const drugType = ref<'' | NewDrugType>('');
+const pageNum = ref(1);
+const pageSize = ref(10);
+const loading = ref(false);
+const pageData = ref<{ items: NewDrugCertificateVO[]; total: number }>({
+  total: 0,
+  items: [],
+});
+
+const deletingIds = shallowRef(new Set<string>());
+
+const drugTypeOptions = [
+  { label: '全部类别', value: '' },
+  ...NEW_DRUG_TYPE_OPTIONS,
+];
+
+async function loadList() {
+  if (!workroomId.value) {
+    pageData.value = { total: 0, items: [] };
+    loading.value = false;
+    return;
+  }
+
+  loading.value = true;
+  try {
+    pageData.value = await invokeMethod(
+      listNewDrugCertificateMethod(pageNum.value, pageSize.value, {
+        $filters: [],
+        $sorts: [],
+        keyword: searchKeyword.value || undefined,
+        workroomId: workroomId.value,
+        drugType: drugType.value || undefined,
+      }),
+      { force: true },
+    );
+  } finally {
+    loading.value = false;
+  }
+}
+
+const items = computed(() => pageData.value.items);
+const total = computed(() => pageData.value.total);
+
+const [Edit, editApi] = useShell('modal', {
+  connectedComponent: NewDrugCertificateEdit,
+});
+
+function isDeleting(id?: string) {
+  return id ? deletingIds.value.has(id) : false;
+}
+
+function setDeleting(id: string, value: boolean) {
+  if (value) {
+    deletingIds.value.add(id);
+  } else {
+    deletingIds.value.delete(id);
+  }
+  triggerRef(deletingIds);
+}
+
+async function openCreate() {
+  const result = await editApi
+    .setData({
+      workroomId: workroomId.value,
+      drugType: drugType.value || 'tcm',
+      longTerm: false,
+    } as NewDrugCertificateVO)
+    .open<{ id?: string }>(Promise.withResolvers());
+  if (result?.id) {
+    pageNum.value = 1;
+    await loadList();
+  }
+}
+
+async function openEdit(row: NewDrugCertificateVO) {
+  const result = await editApi
+    .setData(row)
+    .open<{ id?: string }>(Promise.withResolvers());
+  if (result?.id) {
+    await loadList();
+  }
+}
+
+function openView(row: NewDrugCertificateVO) {
+  if (row.pdfUrl) {
+    window.open(row.pdfUrl, '_blank');
+  } else {
+    message.warning('暂无附件');
+  }
+}
+
+async function handleDelete(row: NewDrugCertificateVO) {
+  if (!row.id || isDeleting(row.id)) return;
+  setDeleting(row.id, true);
+  try {
+    await invokeMethod(deleteNewDrugCertificateMethod(row), { force: true });
+    message.success('删除成功');
+    if (items.value.length <= 1 && pageNum.value > 1) {
+      pageNum.value -= 1;
+    }
+    await loadList();
+  } finally {
+    setDeleting(row.id, false);
+  }
+}
+
+function onSearch() {
+  searchKeyword.value = keyword.value.trim();
+  pageNum.value = 1;
+}
+
+function onPageChange(page: number, size: number) {
+  pageNum.value = page;
+  pageSize.value = size;
+}
+
+watch(drugType, () => {
+  pageNum.value = 1;
+});
+
+watch(workroomId, () => {
+  pageNum.value = 1;
+});
+
+watch(
+  [pageNum, pageSize, searchKeyword, drugType, workroomId],
+  () => {
+    void loadList();
+  },
+  { immediate: true },
+);
+</script>
+
+<template>
+  <Page auto-content-height title="新药证书管理">
+    <Edit />
+
+    <template #extra>
+      <Button type="primary" @click="openCreate()">
+        <Plus class="size-4" />
+        添加证书
+      </Button>
+    </template>
+
+    <div class="flex h-full flex-col gap-4">
+      <div class="flex flex-wrap items-center gap-3">
+        <Input.Search
+          v-model:value="keyword"
+          allow-clear
+          class="min-w-[240px] flex-1"
+          placeholder="搜索药品名称、批准文号或申请单位..."
+          @search="onSearch"
+        />
+        <Select
+          v-model:value="drugType"
+          :options="drugTypeOptions"
+          class="w-36"
+        />
+      </div>
+
+      <Spin :spinning="loading">
+        <div class="min-h-48">
+          <Empty
+            v-if="!loading && items.length === 0"
+            :image="Empty.PRESENTED_IMAGE_SIMPLE"
+            description="暂无新药证书数据"
+          >
+            <Button type="primary" @click="openCreate()">添加证书</Button>
+          </Empty>
+
+          <div v-else class="flex flex-col gap-4">
+            <NewDrugCertificateCard
+              v-for="item in items"
+              :key="item.id"
+              :data="item"
+              :deleting="isDeleting(item.id)"
+              @edit="openEdit"
+              @view="openView"
+              @delete="handleDelete"
+            />
+          </div>
+        </div>
+      </Spin>
+
+      <div
+        v-if="total > 0"
+        class="mt-auto flex flex-wrap items-center justify-between gap-3 border-t pt-4"
+      >
+        <span class="text-sm text-foreground/70">共 {{ total }} 条记录</span>
+        <Pagination
+          :current="pageNum"
+          :page-size="pageSize"
+          :total="total"
+          :show-size-changer="false"
+          show-less-items
+          @change="onPageChange"
+        />
+      </div>
+    </div>
+  </Page>
+</template>

+ 94 - 0
apps/wisdom-legacy/src/views/outcome/components/NewDrugCertificateCard.vue

@@ -0,0 +1,94 @@
+<script setup lang="ts">
+import type { NewDrugCertificateVO } from '#/api/outcome';
+
+import {
+  DeleteOutlined,
+  EditOutlined,
+  EyeOutlined,
+  SafetyCertificateOutlined,
+} from '@ant-design/icons-vue';
+import { Button, Card, Popconfirm, Tag } from 'ant-design-vue';
+
+import { formatValidUntil, getNewDrugTypeLabel } from '#/api/outcome';
+
+const { data, deleting } = defineProps<{
+  data: NewDrugCertificateVO;
+  deleting?: boolean;
+}>();
+
+const emit = defineEmits<{
+  delete: [NewDrugCertificateVO];
+  edit: [NewDrugCertificateVO];
+  view: [NewDrugCertificateVO];
+}>();
+</script>
+
+<template>
+  <Card class="new-drug-certificate-card" :bordered="true">
+    <div class="flex gap-4">
+      <div
+        class="flex size-14 shrink-0 items-center justify-center rounded-lg bg-orange-500/10"
+      >
+        <SafetyCertificateOutlined class="text-2xl text-orange-500" />
+      </div>
+
+      <div class="min-w-0 flex-1">
+        <div class="mb-3 flex items-start justify-between gap-3">
+          <h3 class="text-base font-semibold leading-6 text-foreground">
+            {{ data.name }}
+          </h3>
+          <Tag color="success" class="shrink-0">
+            {{ getNewDrugTypeLabel(data.drugType) }}
+          </Tag>
+        </div>
+
+        <div
+          class="mb-3 flex flex-wrap items-start justify-between gap-x-6 gap-y-2"
+        >
+          <div class="space-y-1 text-sm text-foreground/70">
+            <p>批准文号:{{ data.approvalNumber }}</p>
+            <p>申请单位:{{ data.applicant }}</p>
+            <p>批准日期:{{ data.approvalDate }}</p>
+          </div>
+          <p class="shrink-0 text-sm text-foreground/70">
+            有效期至:{{ formatValidUntil(data.validUntil, data.longTerm) }}
+          </p>
+        </div>
+
+        <div
+          class="flex flex-wrap items-center justify-end gap-1 border-t pt-3"
+        >
+          <Button type="link" class="!px-2" @click="emit('view', data)">
+            <EyeOutlined />
+            查看详情
+          </Button>
+          <Button
+            type="link"
+            class="!px-2 !text-primary"
+            @click="emit('edit', data)"
+          >
+            <EditOutlined />
+            编辑
+          </Button>
+          <Popconfirm
+            title="确定删除该新药证书吗?"
+            :ok-button-props="{ loading: deleting, danger: true }"
+            :cancel-button-props="{ disabled: deleting }"
+            @confirm="emit('delete', data)"
+          >
+            <Button type="link" danger class="!px-2" :disabled="deleting">
+              <DeleteOutlined />
+              删除
+            </Button>
+          </Popconfirm>
+        </div>
+      </div>
+    </div>
+  </Card>
+</template>
+
+<style scoped>
+.new-drug-certificate-card :deep(.ant-card-body) {
+  padding: 20px 24px;
+}
+</style>

+ 213 - 0
apps/wisdom-legacy/src/views/outcome/modules/NewDrugCertificateEdit.vue

@@ -0,0 +1,213 @@
+<script setup lang="ts">
+import type { UploadFile, UploadProps } from 'ant-design-vue';
+
+import type { NewDrugCertificateSubmitVO } from '#/api/outcome';
+
+import { ref, watch } from 'vue';
+
+import { getPopupContainer } from '@vben/utils';
+
+import { InboxOutlined } from '@ant-design/icons-vue';
+import {
+  Checkbox,
+  DatePicker,
+  message,
+  Upload,
+  UploadDragger,
+} from 'ant-design-vue';
+
+import { useEditShell } from '#/adapter/shell';
+import { invokeMethod } from '#/adapter/vxe-table/proxy/invoke-method';
+import { uploadFileMethod } from '#/api/common';
+import { useWorkroomStore } from '#/stores';
+
+import { newDrugCertificateForm } from '../new-drug-certificate.data';
+
+const workroomStore = useWorkroomStore();
+
+const PDF_MAX_SIZE = 50 * 1024 * 1024;
+
+const pdfFileList = ref<UploadFile[]>([]);
+const pdfUrl = ref<string>();
+const pdfUploading = ref(false);
+const validUntil = ref<string>();
+const longTerm = ref(false);
+
+function createUploadFile(url: string | undefined, name: string): UploadFile[] {
+  if (!url) return [];
+  return [
+    {
+      uid: '-1',
+      name,
+      status: 'done',
+      url,
+    },
+  ];
+}
+
+function resetUploads() {
+  pdfFileList.value = [];
+  pdfUrl.value = void 0;
+  pdfUploading.value = false;
+  validUntil.value = void 0;
+  longTerm.value = false;
+}
+
+async function uploadImmediately(file: File) {
+  const uploadFile: UploadFile = {
+    uid: `${Date.now()}`,
+    name: file.name,
+    status: 'uploading',
+    percent: 0,
+  };
+  pdfFileList.value = [uploadFile];
+  pdfUploading.value = true;
+
+  try {
+    const url = await invokeMethod(uploadFileMethod(file), { force: true });
+    if (!url) {
+      throw new Error('upload empty url');
+    }
+    pdfUrl.value = url;
+    pdfFileList.value = [
+      {
+        ...uploadFile,
+        status: 'done',
+        url,
+      },
+    ];
+  } catch {
+    pdfUrl.value = void 0;
+    pdfFileList.value = [
+      {
+        ...uploadFile,
+        status: 'error',
+      },
+    ];
+    message.error(`${file.name} 上传失败,请重试`);
+  } finally {
+    pdfUploading.value = false;
+  }
+}
+
+const { Form, Shell, api } = useEditShell<NewDrugCertificateSubmitVO>(
+  newDrugCertificateForm,
+  {
+    onLoaded(model) {
+      api.shell.setState({
+        title: model.id ? '编辑新药证书' : '添加新药证书',
+      });
+    },
+    handleLoad(model) {
+      resetUploads();
+      pdfUrl.value = model.pdfUrl;
+      pdfFileList.value = createUploadFile(model.pdfUrl, '证书附件.pdf');
+      validUntil.value = model.validUntil;
+      longTerm.value = model.longTerm ?? false;
+      return model;
+    },
+    handleSubmit(values) {
+      const workroomId = values.workroomId || workroomStore.workroomId;
+      if (!workroomId) {
+        message.error('请先选择工作室');
+        throw new Error('workroom required');
+      }
+      if (pdfUploading.value) {
+        message.warning('文件上传中,请稍候');
+        throw new Error('uploading');
+      }
+      if (!pdfUrl.value) {
+        message.error('请上传证书附件');
+        throw new Error('pdf required');
+      }
+      if (!longTerm.value && !validUntil.value) {
+        message.error('请选择有效期或勾选长期');
+        throw new Error('validUntil required');
+      }
+
+      return {
+        ...values,
+        workroomId,
+        pdfUrl: pdfUrl.value,
+        validUntil: longTerm.value ? undefined : validUntil.value,
+        longTerm: longTerm.value,
+      };
+    },
+    onClosed: resetUploads,
+  },
+);
+
+const beforePdfUpload: UploadProps['beforeUpload'] = (file) => {
+  const isPdf =
+    file.type === 'application/pdf' || file.name.toLowerCase().endsWith('.pdf');
+  if (!isPdf) {
+    message.error('仅支持PDF格式文件');
+    return Upload.LIST_IGNORE;
+  }
+  if (file.size > PDF_MAX_SIZE) {
+    message.error('文件大小不能超过50MB');
+    return Upload.LIST_IGNORE;
+  }
+  void uploadImmediately(file);
+  return false;
+};
+
+function onPdfRemove() {
+  pdfUrl.value = void 0;
+}
+
+watch(longTerm, (checked) => {
+  if (checked) {
+    validUntil.value = void 0;
+  }
+});
+</script>
+
+<template>
+  <Shell>
+    <div class="mx-4">
+      <Form />
+
+      <div class="pb-4">
+        <div class="mb-2 text-sm">
+          <span class="text-destructive mr-1">*</span>
+          有效期至
+        </div>
+        <div class="flex flex-wrap items-center gap-3">
+          <DatePicker
+            v-model:value="validUntil"
+            :disabled="longTerm"
+            class="min-w-[200px] flex-1"
+            format="YYYY/MM/DD"
+            placeholder="年/月/日"
+            value-format="YYYY-MM-DD"
+            :get-popup-container="getPopupContainer"
+          />
+          <Checkbox v-model:checked="longTerm"> 长期 </Checkbox>
+        </div>
+      </div>
+
+      <div class="pb-4">
+        <div class="mb-2 text-sm">
+          <span class="text-destructive mr-1">*</span>
+          附件
+        </div>
+        <UploadDragger
+          v-model:file-list="pdfFileList"
+          :before-upload="beforePdfUpload"
+          :max-count="1"
+          accept=".pdf,application/pdf"
+          @remove="onPdfRemove"
+        >
+          <p class="ant-upload-drag-icon">
+            <InboxOutlined />
+          </p>
+          <p class="ant-upload-text">点击上传或拖拽PDF文件到此处</p>
+          <p class="ant-upload-hint">
+            仅支持PDF格式文件,建议文件大小不超过50MB
+          </p>
+        </UploadDragger>
+      </div>
+    </div>
+  </Shell>
+</template>

+ 90 - 0
apps/wisdom-legacy/src/views/outcome/new-drug-certificate.data.ts

@@ -0,0 +1,90 @@
+import type { NewDrugCertificateVO } from '#/api/outcome';
+
+import { getPopupContainer } from '@vben/utils';
+
+import { defineEditShell } from '#/adapter/shell/edit';
+import {
+  editNewDrugCertificateMethod,
+  getNewDrugCertificateMethod,
+  NEW_DRUG_TYPE_OPTIONS,
+  NewDrugCertificateVOSchema,
+} from '#/api/outcome';
+
+export const newDrugCertificateForm = defineEditShell<NewDrugCertificateVO>({
+  scope: 'outcome.newDrugCertificate',
+  title: '新药证书',
+  submit: editNewDrugCertificateMethod,
+  load: getNewDrugCertificateMethod,
+  shell: {
+    type: 'modal',
+    class: '!w-[560px]',
+    confirmText: '确定',
+  },
+  form: {
+    layout: 'vertical',
+    wrapperClass: 'grid-cols-1',
+  },
+  schema: [
+    {
+      component: 'Input',
+      fieldName: 'approvalNumber',
+      label: '批准文号',
+      componentProps: {
+        placeholder: '请输入',
+      },
+      rules: NewDrugCertificateVOSchema.shape.approvalNumber,
+    },
+    {
+      component: 'Input',
+      fieldName: 'name',
+      label: '新药名称',
+      componentProps: {
+        placeholder: '请输入',
+      },
+      rules: NewDrugCertificateVOSchema.shape.name,
+    },
+    {
+      component: 'Select',
+      fieldName: 'drugType',
+      label: '新药类型',
+      defaultValue: 'tcm',
+      componentProps: {
+        options: [...NEW_DRUG_TYPE_OPTIONS],
+        placeholder: '请选择新药类型',
+        getPopupContainer,
+      },
+      rules: NewDrugCertificateVOSchema.shape.drugType,
+    },
+    {
+      component: 'Input',
+      fieldName: 'applicant',
+      label: '申请单位',
+      componentProps: {
+        placeholder: '请输入',
+      },
+      rules: NewDrugCertificateVOSchema.shape.applicant,
+    },
+    {
+      component: 'DatePicker',
+      fieldName: 'approvalDate',
+      label: '批准日期',
+      componentProps: {
+        class: 'w-full',
+        format: 'YYYY/MM/DD',
+        placeholder: '年/月/日',
+        valueFormat: 'YYYY-MM-DD',
+        getPopupContainer,
+      },
+      rules: NewDrugCertificateVOSchema.shape.approvalDate,
+    },
+    {
+      component: 'Input',
+      fieldName: 'workroomId',
+      dependencies: {
+        show: false,
+        triggerFields: ['workroomId'],
+      },
+      rules: NewDrugCertificateVOSchema.shape.workroomId,
+    },
+  ],
+});