浏览代码

feat(@six/wisdom-legacy): 成果管理 - 诊疗方案静态页面新增

Co-authored-by: Cursor <cursoragent@cursor.com>
cmj 3 天之前
父节点
当前提交
6b31378fa7

+ 20 - 0
apps/wisdom-legacy/src/api/common/illness.api.ts

@@ -3,6 +3,10 @@ import type { PageQueryMethodArgs } from '#/request/schema';
 import { httpClient } from '#/request';
 import { pageQueryArgsTransform, paginateTransform } from '#/request/schema';
 
+import {
+  mockListTherapyMethod,
+  USE_TREATMENT_PLAN_MOCK,
+} from '../outcome/treatment-plan.mock';
 import {
   decodeDisease,
   decodeICD10,
@@ -47,3 +51,19 @@ export function listSymptomMethod(...args: PageQueryMethodArgs) {
     },
   );
 }
+
+export function listTherapyMethod(...args: PageQueryMethodArgs) {
+  if (USE_TREATMENT_PLAN_MOCK) {
+    return mockListTherapyMethod(...args) as any;
+  }
+
+  const { params, data } = pageQueryArgsTransform(args, encodeIllnessQuery);
+  return httpClient.Post(
+    `/wis-pc/knowledge/pageDiagnoseTherapy`,
+    { ...params, ...data },
+    {
+      params,
+      transform: paginateTransform(decodeSymptom),
+    },
+  );
+}

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

@@ -1 +1,2 @@
 export * from './medical-case-library.api';
+export * from './treatment-plan.api';

+ 123 - 0
apps/wisdom-legacy/src/api/outcome/treatment-plan.api.ts

@@ -0,0 +1,123 @@
+import type {
+  TreatmentPlanSubmitVO,
+  TreatmentPlanVO,
+} from './treatment-plan.schema';
+
+import type { PageQueryMethodArgs } from '#/request/schema';
+
+import { getEnvelopeData, httpClient } from '#/request';
+import {
+  pageQueryArgsTransform,
+  paginateTransform,
+  transform,
+} from '#/request/schema';
+
+import {
+  mockDeleteTreatmentPlanMethod,
+  mockEditTreatmentPlanMethod,
+  mockGetTreatmentPlanMethod,
+  mockListTreatmentPlanMethod,
+  USE_TREATMENT_PLAN_MOCK,
+} from './treatment-plan.mock';
+import {
+  decodeTreatmentPlan,
+  encodeTreatmentPlan,
+  encodeTreatmentPlanQuery,
+} from './treatment-plan.schema';
+
+export { USE_TREATMENT_PLAN_MOCK } from './treatment-plan.mock';
+export type {
+  TreatmentPlanSubmitVO,
+  TreatmentPlanVO,
+} from './treatment-plan.schema';
+export { TreatmentPlanVOSchema } from './treatment-plan.schema';
+
+/** 诊疗方案分页列表 */
+export function listTreatmentPlanMethod(...args: PageQueryMethodArgs) {
+  if (USE_TREATMENT_PLAN_MOCK) {
+    return mockListTreatmentPlanMethod(...args) as any;
+  }
+
+  const { params, data } = pageQueryArgsTransform(
+    args,
+    encodeTreatmentPlanQuery,
+  );
+  return httpClient.Post(
+    `/wis-pc/outcome/tpManage/page`,
+    { ...params, ...data },
+    {
+      params,
+      hitSource: /^outcome-tp:(edit|delete)/,
+      transform: paginateTransform(decodeTreatmentPlan),
+    },
+  );
+}
+
+/** 新增诊疗方案 */
+export function createTreatmentPlanMethod(vo: TreatmentPlanSubmitVO) {
+  if (USE_TREATMENT_PLAN_MOCK) {
+    return mockEditTreatmentPlanMethod(vo) as any;
+  }
+
+  return httpClient.Post(
+    `/wis-pc/outcome/tpManage/add`,
+    encodeTreatmentPlan(vo),
+    {
+      name: 'outcome-tp:edit',
+      transform: getEnvelopeData<null | string>,
+    },
+  );
+}
+
+/** 修改诊疗方案 */
+export function updateTreatmentPlanMethod(vo: TreatmentPlanSubmitVO) {
+  if (USE_TREATMENT_PLAN_MOCK) {
+    return mockEditTreatmentPlanMethod(vo) as any;
+  }
+
+  return httpClient.Post(
+    `/wis-pc/outcome/tpManage/update`,
+    encodeTreatmentPlan(vo),
+    {
+      name: 'outcome-tp:edit',
+      transform: getEnvelopeData<null | string>,
+    },
+  );
+}
+
+/** 新增 / 修改诊疗方案 */
+export function editTreatmentPlanMethod(vo: TreatmentPlanSubmitVO) {
+  return vo.id ? updateTreatmentPlanMethod(vo) : createTreatmentPlanMethod(vo);
+}
+
+/** 诊疗方案详情 */
+export function getTreatmentPlanMethod(vo: Partial<TreatmentPlanVO>) {
+  if (USE_TREATMENT_PLAN_MOCK) {
+    return mockGetTreatmentPlanMethod(vo) as any;
+  }
+
+  return httpClient.Post(
+    `/wis-pc/outcome/tpManage/detail/${vo.id}`,
+    {},
+    {
+      hitSource: /^outcome-tp:edit/,
+      transform: transform(decodeTreatmentPlan),
+    },
+  );
+}
+
+/** 删除诊疗方案 */
+export function deleteTreatmentPlanMethod(vo: Pick<TreatmentPlanVO, 'id'>) {
+  if (USE_TREATMENT_PLAN_MOCK) {
+    return mockDeleteTreatmentPlanMethod(vo) as any;
+  }
+
+  return httpClient.Post(
+    `/wis-pc/outcome/tpManage/delete/${vo.id}`,
+    {},
+    {
+      name: 'outcome-tp:delete',
+      meta: { ignoreError: true },
+    },
+  );
+}

+ 249 - 0
apps/wisdom-legacy/src/api/outcome/treatment-plan.mock.ts

@@ -0,0 +1,249 @@
+import type {
+  TreatmentPlanDTO,
+  TreatmentPlanSubmitVO,
+  TreatmentPlanVO,
+} from './treatment-plan.schema';
+
+import type { PageQueryMethodArgs } from '#/request/schema';
+import type { PageVO } from '#/request/schema/record';
+
+import { pageQueryArgsTransform } from '#/request/schema';
+
+import {
+  decodeTreatmentPlan,
+  encodeTreatmentPlan,
+  encodeTreatmentPlanQuery,
+} from './treatment-plan.schema';
+
+/** 后端接口就绪后改为 false */
+export const USE_TREATMENT_PLAN_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 MOCK_THERAPY_OPTIONS = [
+  '温中健脾,和胃止痛',
+  '益气补血,健脾养心',
+  '平肝潜阳,滋阴降火',
+  '疏肝理气,活血化瘀',
+  '清热利湿,通淋排石',
+  '补肾填精,强筋壮骨',
+] as const;
+
+const SEED_RECORDS: Omit<
+  TreatmentPlanDTO,
+  'createTime' | 'id' | 'personalStudioId' | 'updateTime'
+>[] = [
+  {
+    disease: '慢性胃炎',
+    syndrome: '脾胃虚寒型',
+    therapy: '温中健脾,和胃止痛',
+    prescription: '理中汤加减',
+    createBy: '王刚',
+    fileUrl: MOCK_PDF_URL,
+  },
+  {
+    disease: '失眠',
+    syndrome: '心脾两虚型',
+    therapy: '益气补血,健脾养心',
+    prescription: '归脾汤加减',
+    createBy: '张许',
+    fileUrl: MOCK_PDF_URL,
+  },
+  {
+    disease: '高血压',
+    syndrome: '肝阳上亢型',
+    therapy: '平肝潜阳,滋阴降火',
+    prescription: '天麻钩藤饮加减',
+    createBy: '李虎',
+    fileUrl: MOCK_PDF_URL,
+  },
+  {
+    disease: '糖尿病',
+    syndrome: '气阴两虚型',
+    therapy: '益气养阴,生津止渴',
+    prescription: '生脉散合玉液汤加减',
+    createBy: '王刚',
+    fileUrl: MOCK_PDF_URL,
+  },
+  {
+    disease: '咳嗽',
+    syndrome: '风寒袭肺型',
+    therapy: '疏风散寒,宣肺止咳',
+    prescription: '三拗汤加减',
+    createBy: '张许',
+    fileUrl: MOCK_PDF_URL,
+  },
+  {
+    disease: '头痛',
+    syndrome: '肝阳上亢型',
+    therapy: '平肝潜阳,滋阴降火',
+    prescription: '天麻钩藤饮加减',
+    createBy: '李虎',
+    fileUrl: MOCK_PDF_URL,
+  },
+];
+
+function createInitialStore(): TreatmentPlanDTO[] {
+  const records: TreatmentPlanDTO[] = [];
+  for (let index = 0; index < 58; index += 1) {
+    const seed = SEED_RECORDS[index % SEED_RECORDS.length] ?? SEED_RECORDS[0];
+    if (!seed) continue;
+    const day = String((index % 28) + 1).padStart(2, '0');
+    const month = String((index % 12) + 1).padStart(2, '0');
+    records.push({
+      ...seed,
+      id: String(index + 1),
+      personalStudioId: '327477138296832',
+      createTime: `2026-${month}-${day}T10:00:00`,
+      updateTime: `2026-05-${day}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: TreatmentPlanDTO, keyword?: string) {
+  if (!keyword) return true;
+  const text = [
+    record.disease,
+    record.syndrome,
+    record.therapy,
+    record.prescription,
+    record.createBy,
+  ]
+    .filter(Boolean)
+    .join(' ');
+  return text.includes(keyword);
+}
+
+function matchWorkroom(record: TreatmentPlanDTO, workroomId?: string) {
+  if (!workroomId) return true;
+  return String(record.personalStudioId ?? '') === String(workroomId);
+}
+
+function toVo(dto: TreatmentPlanDTO): TreatmentPlanVO {
+  return decodeTreatmentPlan(dto);
+}
+
+export function mockListTreatmentPlanMethod(...args: PageQueryMethodArgs) {
+  const { params, data } = pageQueryArgsTransform(
+    args,
+    encodeTreatmentPlanQuery,
+  );
+  const pageNum = Number(params.pageNum ?? 1);
+  const pageSize = Number(params.pageSize ?? 10);
+  const keyword = data.mixture;
+  const workroomId = data.personalStudioId?.toString();
+
+  const filtered = store.filter(
+    (record) =>
+      matchKeyword(record, keyword) && matchWorkroom(record, workroomId),
+  );
+  const start = (pageNum - 1) * pageSize;
+  const items = filtered
+    .slice(start, start + pageSize)
+    .map((record) => toVo(record));
+
+  const result: PageVO<TreatmentPlanVO> = {
+    total: filtered.length,
+    items,
+  };
+  return delay(() => result);
+}
+
+export function mockGetTreatmentPlanMethod(vo: Partial<TreatmentPlanVO>) {
+  return delay(() => {
+    const record = store.find((item) => String(item.id) === String(vo.id));
+    if (!record) {
+      throw new Error('诊疗方案不存在');
+    }
+    return toVo(record);
+  });
+}
+
+export function mockEditTreatmentPlanMethod(vo: TreatmentPlanSubmitVO) {
+  return delay(() => {
+    const dto = encodeTreatmentPlan(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,
+      createBy: dto.createBy ?? '当前用户',
+      createTime: now,
+      updateTime: now,
+    });
+    return id;
+  });
+}
+
+export function mockDeleteTreatmentPlanMethod(vo: Pick<TreatmentPlanVO, '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;
+  });
+}
+
+export function mockListTherapyMethod(...args: PageQueryMethodArgs) {
+  const { params, data } = pageQueryArgsTransform(args);
+  const pageNum = Number(params.pageNum ?? 1);
+  const pageSize = Number(params.pageSize ?? 10);
+  const keyword = String(data.keyWord ?? data.keyword ?? '').trim();
+
+  const items = MOCK_THERAPY_OPTIONS.filter((name) =>
+    keyword ? name.includes(keyword) : true,
+  ).map((name, index) => ({
+    id: String(index + 1),
+    name,
+    code: String(index + 1),
+  }));
+
+  const start = (pageNum - 1) * pageSize;
+  const result: PageVO<(typeof items)[number]> = {
+    total: items.length,
+    items: items.slice(start, start + pageSize),
+  };
+  return delay(() => result);
+}
+
+/** 仅用于本地调试,重置 mock 数据 */
+export function resetTreatmentPlanMockStore() {
+  nextId = 100;
+  store = createInitialStore();
+}

+ 126 - 0
apps/wisdom-legacy/src/api/outcome/treatment-plan.schema.ts

@@ -0,0 +1,126 @@
+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';
+
+// ---------------------------------------------------------------------------
+// DTO
+// ---------------------------------------------------------------------------
+
+/** 诊疗方案 DTO,对应 `OutcomeTreatmentPlanDetail` */
+export interface TreatmentPlanDTO extends AuditRecordDTO {
+  id?: number | string;
+  personalStudioId?: number | string;
+  fileUrl?: string;
+  disease?: string;
+  syndrome?: string;
+  therapy?: string;
+  prescription?: string;
+}
+
+export interface TreatmentPlanQueryDTO {
+  mixture?: string;
+  personalStudioId?: number | string;
+  pageNum?: number;
+  pageSize?: number;
+}
+
+// ---------------------------------------------------------------------------
+// VO
+// ---------------------------------------------------------------------------
+
+export interface TreatmentPlanVO extends AuditRecordVO {
+  id?: string;
+  workroomId: string;
+  disease: {
+    name: string;
+  };
+  syndrome: {
+    name: string;
+  };
+  therapy: {
+    name: string;
+  };
+  prescription: string;
+  pdfUrl?: string;
+}
+
+export type TreatmentPlanSubmitVO = TreatmentPlanVO;
+
+export interface TreatmentPlanQueryVO {
+  keyword?: string;
+  workroomId?: string;
+}
+
+// ---------------------------------------------------------------------------
+// Schema
+// ---------------------------------------------------------------------------
+
+export const TreatmentPlanVOSchema = z.object({
+  id: z.string().optional(),
+  workroomId: z.string().min(1, '工作室不能为空'),
+  disease: z.object({
+    name: z.string().min(1, '请选择病名'),
+  }),
+  syndrome: z.object({
+    name: z.string().optional(),
+  }),
+  therapy: z.object({
+    name: z.string().optional(),
+  }),
+  prescription: z.string().optional(),
+});
+
+// ---------------------------------------------------------------------------
+// 编解码
+// ---------------------------------------------------------------------------
+
+export function decodeTreatmentPlan(dto: TreatmentPlanDTO): TreatmentPlanVO {
+  return {
+    ...decodeAuditRecord(dto),
+    id: dto.id?.toString(),
+    workroomId: dto.personalStudioId?.toString() ?? '',
+    disease: {
+      name: dto.disease ?? '',
+    },
+    syndrome: {
+      name: dto.syndrome ?? '',
+    },
+    therapy: {
+      name: dto.therapy ?? '',
+    },
+    prescription: dto.prescription ?? '',
+    pdfUrl: dto.fileUrl,
+  };
+}
+
+export function encodeTreatmentPlanQuery(
+  query: Partial<TreatmentPlanQueryVO>,
+): TreatmentPlanQueryDTO {
+  return {
+    mixture: query.keyword,
+    personalStudioId: query.workroomId,
+  };
+}
+
+export function encodeTreatmentPlan(
+  vo: TreatmentPlanSubmitVO,
+): TreatmentPlanDTO {
+  return {
+    id: vo.id,
+    personalStudioId: vo.workroomId,
+    fileUrl: vo.pdfUrl,
+    disease: vo.disease.name,
+    syndrome: vo.syndrome.name,
+    therapy: vo.therapy.name,
+    prescription: vo.prescription,
+  };
+}
+
+export function decodeTreatmentPlanList(dto: TreatmentPlanDTO[]) {
+  return decodeList(dto, decodeTreatmentPlan);
+}

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

@@ -1,5 +1,8 @@
 {
   "medicalCaseLibrary": {
     "name": "医案"
+  },
+  "treatmentPlan": {
+    "name": "诊疗方案"
   }
 }

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

@@ -3,6 +3,7 @@ import type { RouteRecordRaw } from 'vue-router';
 const placeholder = () => import('#/views/outcome/Placeholder.vue');
 const medicalCaseLibrary = () =>
   import('#/views/outcome/MedicalCaseLibraryList.vue');
+const treatmentPlan = () => import('#/views/outcome/TreatmentPlanList.vue');
 
 const routes: RouteRecordRaw[] = [
   {
@@ -31,7 +32,7 @@ const routes: RouteRecordRaw[] = [
           icon: 'carbon:user',
           title: '诊疗方案',
         },
-        component: placeholder,
+        component: treatmentPlan,
       },
       {
         path: '/outcome/paper',

+ 51 - 0
apps/wisdom-legacy/src/views/outcome/TreatmentPlanList.vue

@@ -0,0 +1,51 @@
+<script setup lang="ts">
+import type { TreatmentPlanVO } from '#/api/outcome';
+
+import { watch } from 'vue';
+
+import { Page } from '@vben/common-ui';
+import { Plus } from '@vben/icons';
+
+import { message } from 'ant-design-vue';
+import { storeToRefs } from 'pinia';
+
+import { editModal, useGridPage } from '#/adapter/vxe-table';
+import { deleteTreatmentPlanMethod } from '#/api/outcome';
+import { useWorkroomStore } from '#/stores';
+
+import TreatmentPlanEdit from './modules/TreatmentPlanEdit.vue';
+import { treatmentPlanGrid } from './treatment-plan.data';
+
+const workroomStore = useWorkroomStore();
+const { workroomId } = storeToRefs(workroomStore);
+
+const { Grid, Edit, actions, grid } = useGridPage(treatmentPlanGrid, {
+  params: { workroomId: () => workroomId.value },
+  edit: editModal(TreatmentPlanEdit),
+  delete: deleteTreatmentPlanMethod,
+  view: ({ row }: { row: TreatmentPlanVO }) => {
+    if (row.pdfUrl) {
+      window.open(row.pdfUrl, '_blank');
+    } else {
+      message.warning('暂无PDF文件');
+    }
+    return void 0;
+  },
+});
+
+watch(workroomId, () => grid.reload());
+</script>
+
+<template>
+  <Page auto-content-height>
+    <Edit />
+    <Grid table-title="诊疗方案管理">
+      <template #toolbar-tools>
+        <a-button type="primary" @click="actions.create()">
+          <Plus class="size-5" />
+          新建方案
+        </a-button>
+      </template>
+    </Grid>
+  </Page>
+</template>

+ 149 - 0
apps/wisdom-legacy/src/views/outcome/modules/TreatmentPlanEdit.vue

@@ -0,0 +1,149 @@
+<script setup lang="ts">
+import type { UploadFile, UploadProps } from 'ant-design-vue';
+
+import type { TreatmentPlanSubmitVO } from '#/api/outcome';
+
+import { ref } from 'vue';
+
+import { InboxOutlined } from '@ant-design/icons-vue';
+import { 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 { treatmentPlanForm } from '../treatment-plan.data';
+
+const workroomStore = useWorkroomStore();
+
+const pdfFileList = ref<UploadFile[]>([]);
+const pdfUrl = ref<string>();
+const pdfUploading = 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;
+}
+
+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 } = useEditShell<TreatmentPlanSubmitVO>(treatmentPlanForm, {
+  handleLoad(model) {
+    resetUploads();
+    pdfUrl.value = model.pdfUrl;
+    pdfFileList.value = createUploadFile(model.pdfUrl, '诊疗方案.pdf');
+    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('请上传诊疗方案PDF文件');
+      throw new Error('pdf required');
+    }
+
+    return {
+      ...values,
+      workroomId,
+      pdfUrl: pdfUrl.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;
+  }
+  void uploadImmediately(file);
+  return false;
+};
+
+function onPdfRemove() {
+  pdfUrl.value = void 0;
+}
+</script>
+
+<template>
+  <Shell>
+    <div class="mx-4 max-h-[70vh] overflow-y-auto pr-1">
+      <Form />
+
+      <div class="pb-4">
+        <div class="mb-2 text-sm">诊疗方案文档</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格式</p>
+        </UploadDragger>
+      </div>
+    </div>
+  </Shell>
+</template>

+ 142 - 0
apps/wisdom-legacy/src/views/outcome/treatment-plan.data.ts

@@ -0,0 +1,142 @@
+import type { TreatmentPlanVO } from '#/api/outcome';
+
+import { getPopupContainer } from '@vben/utils';
+
+import { defineEditShell } from '#/adapter/shell/edit';
+import { defineGrid } from '#/adapter/vxe-table';
+import {
+  listDiseaseMethod,
+  listSymptomMethod,
+  listTherapyMethod,
+} from '#/api/common';
+import {
+  editTreatmentPlanMethod,
+  getTreatmentPlanMethod,
+  listTreatmentPlanMethod,
+  TreatmentPlanVOSchema,
+} from '#/api/outcome';
+
+export const treatmentPlanGrid = defineGrid<TreatmentPlanVO>({
+  scope: 'outcome.treatmentPlan',
+  query: listTreatmentPlanMethod,
+  form: {
+    showCollapseButton: false,
+    wrapperClass: 'grid-cols-1',
+  },
+  fields: [
+    {
+      component: 'Input',
+      fieldName: 'keyword',
+      labelWidth: 0,
+      componentProps: {
+        allowClear: true,
+        placeholder: '搜索病名、证型或治法...',
+      },
+    },
+  ],
+  columns: (col) => [
+    col.seq({ title: '编号', width: 80 }),
+    {
+      field: 'disease.name',
+      title: '病名',
+      minWidth: 100,
+    },
+    {
+      field: 'syndrome.name',
+      title: '证型',
+      minWidth: 140,
+    },
+    {
+      field: 'therapy.name',
+      title: '治法',
+      minWidth: 160,
+    },
+    {
+      field: 'prescription',
+      title: '方剂',
+      minWidth: 140,
+    },
+    {
+      field: 'createdBy',
+      title: '创建者',
+      width: 100,
+    },
+    {
+      field: 'updatedAt',
+      title: '更新时间',
+      width: 120,
+      formatter: ({ cellValue }) =>
+        cellValue ? String(cellValue).slice(0, 10) : '',
+    },
+    col.actions(['view', 'edit', 'delete'], 160),
+  ],
+});
+
+export const treatmentPlanForm = defineEditShell<TreatmentPlanVO>({
+  scope: 'outcome.treatmentPlan',
+  title: '诊疗方案',
+  submit: editTreatmentPlanMethod,
+  load: getTreatmentPlanMethod,
+  shell: {
+    type: 'modal',
+    class: '!w-[640px]',
+  },
+  form: {
+    layout: 'vertical',
+    wrapperClass: 'grid-cols-1',
+  },
+  schema: [
+    {
+      component: 'ApiSelectPageList',
+      fieldName: 'disease.name',
+      label: '病名',
+      componentProps: {
+        api: listDiseaseMethod,
+        fieldNames: { label: 'name', value: 'name' },
+        placeholder: '请选择病名',
+        getPopupContainer,
+      },
+      rules: TreatmentPlanVOSchema.shape.disease.shape.name,
+    },
+    {
+      component: 'ApiSelectPageList',
+      fieldName: 'syndrome.name',
+      label: '证型',
+      componentProps: {
+        api: listSymptomMethod,
+        fieldNames: { label: 'name', value: 'name' },
+        placeholder: '请选择证型',
+        getPopupContainer,
+      },
+    },
+    {
+      component: 'ApiSelectPageList',
+      fieldName: 'therapy.name',
+      label: '治法',
+      componentProps: {
+        api: listTherapyMethod,
+        fieldNames: { label: 'name', value: 'name' },
+        placeholder: '请选择治法',
+        getPopupContainer,
+      },
+    },
+    {
+      component: 'Textarea',
+      fieldName: 'prescription',
+      label: '方剂',
+      componentProps: {
+        placeholder: '请输入方剂名称',
+        rows: 3,
+      },
+    },
+    {
+      component: 'Input',
+      fieldName: 'workroomId',
+      dependencies: {
+        show: false,
+        triggerFields: ['workroomId'],
+      },
+      rules: TreatmentPlanVOSchema.shape.workroomId,
+    },
+  ],
+});