瀏覽代碼

feat(@six/smart-pharmacy): 智慧药事系统第二版-处方疗效评价静态页面新增

cmj 4 周之前
父節點
當前提交
b419a7bc0e

+ 10 - 0
apps/smart-pharmacy/public/database/menu.json

@@ -144,6 +144,16 @@
           "title": "满意度评价"
         },
         "component": "/patient-evaluation/satisfaction/list"
+      },
+      {
+        "id": "2602",
+        "path": "/patient-evaluation/efficacy",
+        "name": "PatientEvaluationEfficacy",
+        "meta": {
+          "icon": "mdi:medical-bag",
+          "title": "处方疗效评价"
+        },
+        "component": "/patient-evaluation/efficacy/list"
       }
     ]
   }

+ 460 - 0
apps/smart-pharmacy/src/api/method/patient-evaluation.ts

@@ -33,6 +33,36 @@ export namespace PatientEvaluationModel {
   export interface SatisfactionListQuery {
     dateRange?: [string, string];
   }
+
+  export type EfficacyResult = 'cured' | 'improved' | 'unchanged';
+
+  export interface EfficacyEvaluation extends TransformRecord {
+    prescriptionDate: string;
+    prescriptionNumber: string;
+    /** 关联处方 id,用于跳转处方详情 */
+    prescriptionId?: string;
+    medicalInstitution?: string;
+    campus?: string;
+    decoctionEnterprise?: string;
+    decoctionCenter?: string;
+    logisticsCompany?: string;
+    logisticsNumber?: string;
+    patientName?: string;
+    gender?: string;
+    age?: number | string;
+    patientPhone?: string;
+    /** 代煎代配 */
+    decoctionDispensing?: string;
+    efficacyResult: EfficacyResult;
+    evaluationTime: string;
+    /** 疗效评价详情 */
+    evaluationDetail?: string;
+    remark?: string;
+  }
+
+  export interface EfficacyListQuery {
+    dateRange?: [string, string];
+  }
 }
 
 export const SATISFACTION_SCORE_LABELS: Record<
@@ -483,3 +513,433 @@ export function exportSatisfactionEvaluationsMethod(
   URL.revokeObjectURL(url);
   return Promise.resolve(true);
 }
+
+export const EFFICACY_RESULT_LABELS: Record<
+  PatientEvaluationModel.EfficacyResult,
+  string
+> = {
+  cured: '痊愈',
+  improved: '好转',
+  unchanged: '无变化',
+};
+
+export function getEfficacyResultLabel(
+  result?: PatientEvaluationModel.EfficacyResult,
+): string {
+  if (!result) return '';
+  return EFFICACY_RESULT_LABELS[result] ?? '';
+}
+
+function withEfficacyDetailFields(
+  item: PatientEvaluationModel.EfficacyEvaluation,
+): PatientEvaluationModel.EfficacyEvaluation {
+  return {
+    ...item,
+    prescriptionId: item.prescriptionId ?? item.id,
+    logisticsNumber: item.logisticsNumber ?? '',
+    patientName: item.patientName ?? '',
+    gender: item.gender ?? '',
+    age: item.age ?? '',
+    patientPhone: item.patientPhone ?? '',
+    decoctionDispensing: item.decoctionDispensing ?? '',
+    evaluationDetail:
+      item.evaluationDetail ?? item.remark ?? MOCK_DETAIL_TEXT,
+  };
+}
+
+const MOCK_EFFICACY_EVALUATIONS: PatientEvaluationModel.EfficacyEvaluation[] =
+  [
+    {
+      id: 'e1',
+      prescriptionDate: '2023-09-23',
+      prescriptionNumber: '2023092323945',
+      prescriptionId: '1',
+      medicalInstitution: '蒋村社区卫生服务中心',
+      campus: '萧山馆',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      logisticsNumber: 'SF73648596038958987',
+      patientName: '张三',
+      gender: '男',
+      age: 52,
+      patientPhone: '13828394123',
+      decoctionDispensing: '代煎',
+      efficacyResult: 'cured',
+      evaluationTime: '2023-09-30 14:23:33',
+      evaluationDetail: MOCK_DETAIL_TEXT,
+    },
+    {
+      id: 'e2',
+      prescriptionDate: '2023-09-24',
+      prescriptionNumber: '2023092423946',
+      medicalInstitution: '同仁堂',
+      campus: '湖滨院区',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'improved',
+      evaluationTime: '2023-10-01 09:15:20',
+    },
+    {
+      id: 'e3',
+      prescriptionDate: '2023-09-25',
+      prescriptionNumber: '2023092523947',
+      medicalInstitution: '浙江省中医院',
+      campus: '湖滨院区',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'unchanged',
+      evaluationTime: '2023-10-02 16:40:11',
+    },
+    {
+      id: 'e4',
+      prescriptionDate: '2023-09-26',
+      prescriptionNumber: '2023092623948',
+      medicalInstitution: '蒋村社区卫生服务中心',
+      campus: '萧山馆',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'cured',
+      evaluationTime: '2023-10-03 11:22:45',
+    },
+    {
+      id: 'e5',
+      prescriptionDate: '2023-09-27',
+      prescriptionNumber: '2023092723949',
+      medicalInstitution: '同仁堂',
+      campus: '湖滨院区',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'improved',
+      evaluationTime: '2023-10-04 08:30:00',
+    },
+    {
+      id: 'e6',
+      prescriptionDate: '2023-09-28',
+      prescriptionNumber: '2023092823950',
+      medicalInstitution: '浙江省中医院',
+      campus: '萧山馆',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'unchanged',
+      evaluationTime: '2023-10-05 13:55:18',
+    },
+    {
+      id: 'e7',
+      prescriptionDate: '2023-09-29',
+      prescriptionNumber: '2023092923951',
+      medicalInstitution: '蒋村社区卫生服务中心',
+      campus: '湖滨院区',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'cured',
+      evaluationTime: '2023-10-06 10:10:33',
+    },
+    {
+      id: 'e8',
+      prescriptionDate: '2023-09-30',
+      prescriptionNumber: '2023093023952',
+      medicalInstitution: '同仁堂',
+      campus: '萧山馆',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'improved',
+      evaluationTime: '2023-10-07 15:20:44',
+    },
+    {
+      id: 'e9',
+      prescriptionDate: '2023-10-01',
+      prescriptionNumber: '2023100123953',
+      medicalInstitution: '浙江省中医院',
+      campus: '湖滨院区',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'cured',
+      evaluationTime: '2023-10-08 09:45:22',
+    },
+    {
+      id: 'e10',
+      prescriptionDate: '2023-10-02',
+      prescriptionNumber: '2023100223954',
+      medicalInstitution: '蒋村社区卫生服务中心',
+      campus: '萧山馆',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'unchanged',
+      evaluationTime: '2023-10-09 14:33:10',
+    },
+    {
+      id: 'e11',
+      prescriptionDate: '2023-10-03',
+      prescriptionNumber: '2023100323955',
+      medicalInstitution: '同仁堂',
+      campus: '湖滨院区',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'improved',
+      evaluationTime: '2023-10-10 11:18:55',
+    },
+    {
+      id: 'e12',
+      prescriptionDate: '2023-10-04',
+      prescriptionNumber: '2023100423956',
+      medicalInstitution: '浙江省中医院',
+      campus: '萧山馆',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'cured',
+      evaluationTime: '2023-10-11 16:02:30',
+    },
+    {
+      id: 'e13',
+      prescriptionDate: '2023-10-05',
+      prescriptionNumber: '2023100523957',
+      medicalInstitution: '蒋村社区卫生服务中心',
+      campus: '湖滨院区',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'improved',
+      evaluationTime: '2023-10-12 08:55:41',
+    },
+    {
+      id: 'e14',
+      prescriptionDate: '2023-10-06',
+      prescriptionNumber: '2023100623958',
+      medicalInstitution: '同仁堂',
+      campus: '萧山馆',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'unchanged',
+      evaluationTime: '2023-10-13 13:40:19',
+    },
+    {
+      id: 'e15',
+      prescriptionDate: '2023-10-07',
+      prescriptionNumber: '2023100723959',
+      medicalInstitution: '浙江省中医院',
+      campus: '湖滨院区',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'cured',
+      evaluationTime: '2023-10-14 10:25:08',
+    },
+    {
+      id: 'e16',
+      prescriptionDate: '2023-10-08',
+      prescriptionNumber: '2023100823960',
+      medicalInstitution: '蒋村社区卫生服务中心',
+      campus: '萧山馆',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'improved',
+      evaluationTime: '2023-10-15 15:12:37',
+    },
+    {
+      id: 'e17',
+      prescriptionDate: '2023-10-09',
+      prescriptionNumber: '2023100923961',
+      medicalInstitution: '同仁堂',
+      campus: '湖滨院区',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'cured',
+      evaluationTime: '2023-10-16 09:08:52',
+    },
+    {
+      id: 'e18',
+      prescriptionDate: '2023-10-10',
+      prescriptionNumber: '2023101023962',
+      medicalInstitution: '浙江省中医院',
+      campus: '萧山馆',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'unchanged',
+      evaluationTime: '2023-10-17 14:50:26',
+    },
+    {
+      id: 'e19',
+      prescriptionDate: '2023-10-11',
+      prescriptionNumber: '2023101123963',
+      medicalInstitution: '蒋村社区卫生服务中心',
+      campus: '湖滨院区',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'improved',
+      evaluationTime: '2023-10-18 11:35:14',
+    },
+    {
+      id: 'e20',
+      prescriptionDate: '2023-10-12',
+      prescriptionNumber: '2023101223964',
+      medicalInstitution: '同仁堂',
+      campus: '萧山馆',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'cured',
+      evaluationTime: '2023-10-19 16:28:03',
+    },
+    {
+      id: 'e21',
+      prescriptionDate: '2023-10-13',
+      prescriptionNumber: '2023101323965',
+      medicalInstitution: '浙江省中医院',
+      campus: '湖滨院区',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'improved',
+      evaluationTime: '2023-10-20 08:42:17',
+    },
+    {
+      id: 'e22',
+      prescriptionDate: '2023-10-14',
+      prescriptionNumber: '2023101423966',
+      medicalInstitution: '蒋村社区卫生服务中心',
+      campus: '萧山馆',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'unchanged',
+      evaluationTime: '2023-10-21 13:15:49',
+    },
+    {
+      id: 'e23',
+      prescriptionDate: '2023-10-15',
+      prescriptionNumber: '2023101523967',
+      medicalInstitution: '同仁堂',
+      campus: '湖滨院区',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'cured',
+      evaluationTime: '2023-10-22 10:03:28',
+    },
+    {
+      id: 'e24',
+      prescriptionDate: '2023-10-16',
+      prescriptionNumber: '2023101623968',
+      medicalInstitution: '浙江省中医院',
+      campus: '萧山馆',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'improved',
+      evaluationTime: '2023-10-23 15:47:56',
+    },
+    {
+      id: 'e25',
+      prescriptionDate: '2023-10-17',
+      prescriptionNumber: '2023101723969',
+      medicalInstitution: '蒋村社区卫生服务中心',
+      campus: '湖滨院区',
+      decoctionEnterprise: '重药煎药中心',
+      decoctionCenter: '重药煎药中心华东区',
+      logisticsCompany: '顺丰速运',
+      efficacyResult: 'cured',
+      evaluationTime: '2023-10-24 09:22:11',
+    },
+  ];
+
+function filterEfficacyEvaluations(
+  items: PatientEvaluationModel.EfficacyEvaluation[],
+  query?: PatientEvaluationModel.EfficacyListQuery,
+) {
+  const range = query?.dateRange;
+  if (!range?.length || range.length < 2 || !range[0] || !range[1]) {
+    return items;
+  }
+  const [start, end] = range;
+  return items.filter(
+    (item) => item.prescriptionDate >= start && item.prescriptionDate <= end,
+  );
+}
+
+/** 处方疗效评价列表(当前为本地 mock,后期对接后端分页接口) */
+export function listEfficacyEvaluationsMethod(
+  page = 1,
+  size = 10,
+  query?: PatientEvaluationModel.EfficacyListQuery,
+): Promise<TransformList<PatientEvaluationModel.EfficacyEvaluation>> {
+  const filtered = filterEfficacyEvaluations(MOCK_EFFICACY_EVALUATIONS, query);
+  const start = (page - 1) * size;
+  const items = filtered.slice(start, start + size);
+  return Promise.resolve({
+    items,
+    total: filtered.length,
+    data: { page, size, total: filtered.length },
+  });
+}
+
+/** 处方疗效评价详情(当前为本地 mock,后期对接后端接口) */
+export function getEfficacyEvaluationMethod(id: string) {
+  const item = MOCK_EFFICACY_EVALUATIONS.find((row) => row.id === id);
+  if (!item) {
+    return Promise.reject(new Error('评价记录不存在'));
+  }
+  return Promise.resolve(withEfficacyDetailFields(item));
+}
+
+/** 导出处方疗效评价(当前为本地 mock,后期对接后端导出接口) */
+export function exportEfficacyEvaluationsMethod(
+  query?: PatientEvaluationModel.EfficacyListQuery,
+) {
+  const filtered = filterEfficacyEvaluations(MOCK_EFFICACY_EVALUATIONS, query);
+  const headers = [
+    '处方日期',
+    '处方号',
+    '医疗机构',
+    '院区',
+    '煎药企业',
+    '煎药中心',
+    '物流公司',
+    '疗效评价',
+    '评价时间',
+    '评价备注',
+  ];
+  const rows = filtered.map((item) => [
+    item.prescriptionDate,
+    item.prescriptionNumber,
+    item.medicalInstitution ?? '',
+    item.campus ?? '',
+    item.decoctionEnterprise ?? '',
+    item.decoctionCenter ?? '',
+    item.logisticsCompany ?? '',
+    getEfficacyResultLabel(item.efficacyResult),
+    item.evaluationTime,
+    item.remark ?? '',
+  ]);
+  const csvContent = [headers, ...rows]
+    .map((row) =>
+      row.map((cell) => `"${String(cell).replaceAll('"', '""')}"`).join(','),
+    )
+    .join('\n');
+  const blob = new Blob([`\uFEFF${csvContent}`], {
+    type: 'text/csv;charset=utf-8;',
+  });
+  const url = URL.createObjectURL(blob);
+  const link = document.createElement('a');
+  link.href = url;
+  link.download = `处方疗效评价_${new Date().toISOString().slice(0, 10)}.csv`;
+  link.click();
+  URL.revokeObjectURL(url);
+  return Promise.resolve(true);
+}

+ 4 - 1
apps/smart-pharmacy/src/api/model/menu.ts

@@ -47,7 +47,10 @@ export const HARDCODED_MENU_TREE_SELECT: TreeSelectMenuNode[] = [
   {
     id: '2600',
     label: '患者评价',
-    children: [{ id: '2601', label: '满意度评价' }],
+    children: [
+      { id: '2601', label: '满意度评价' },
+      { id: '2602', label: '处方疗效评价' },
+    ],
   },
 ];
 

+ 95 - 0
apps/smart-pharmacy/src/views/patient-evaluation/efficacy/data.ts

@@ -0,0 +1,95 @@
+import type { VxeTableGridOptions } from '@vben/plugins/vxe-table';
+
+import type { VbenFormSchema } from '#/adapter/form';
+import type { OnActionClickFn } from '#/adapter/vxe-table';
+import type { PatientEvaluationModel } from '#/api/method/patient-evaluation';
+
+import { getEfficacyResultLabel } from '#/api/method/patient-evaluation';
+
+export function useEfficacySearchFormSchema(): VbenFormSchema[] {
+  return [
+    {
+      component: 'RangePicker',
+      fieldName: 'dateRange',
+      label: '日期范围',
+      componentProps: {
+        valueFormat: 'YYYY-MM-DD',
+        style: { width: '100%' },
+        placeholder: ['开始日期', '结束日期'],
+        inputReadOnly: true,
+      },
+    },
+  ];
+}
+
+export function useEfficacyTableColumns(
+  onActionClick?: OnActionClickFn<PatientEvaluationModel.EfficacyEvaluation>,
+): VxeTableGridOptions<PatientEvaluationModel.EfficacyEvaluation>['columns'] {
+  return [
+    { type: 'seq', title: '序号', width: 60 },
+    {
+      field: 'prescriptionDate',
+      minWidth: 110,
+      title: '处方日期',
+    },
+    {
+      field: 'prescriptionNumber',
+      minWidth: 130,
+      title: '处方号',
+    },
+    {
+      field: 'medicalInstitution',
+      minWidth: 160,
+      title: '医疗机构',
+    },
+    {
+      field: 'campus',
+      minWidth: 100,
+      title: '院区',
+    },
+    {
+      field: 'decoctionEnterprise',
+      minWidth: 140,
+      title: '煎药企业',
+    },
+    {
+      field: 'decoctionCenter',
+      minWidth: 120,
+      title: '煎药中心',
+    },
+    {
+      field: 'logisticsCompany',
+      minWidth: 100,
+      title: '物流公司',
+    },
+    {
+      field: 'efficacyResult',
+      minWidth: 100,
+      title: '疗效评价',
+      slots: {
+        default: ({ row }) => getEfficacyResultLabel(row.efficacyResult),
+      },
+    },
+    {
+      field: 'evaluationTime',
+      minWidth: 160,
+      title: '评价时间',
+    },
+    {
+      align: 'center',
+      cellRender: {
+        name: 'CellOperation',
+        options: [{ code: 'view', text: '查看' }],
+        attrs: {
+          nameField: 'prescriptionNumber',
+          nameTitle: '处方疗效评价',
+          onClick: onActionClick,
+        },
+      },
+      field: 'operation',
+      fixed: 'right',
+      title: '操作',
+      width: 80,
+    },
+  ];
+}

+ 100 - 0
apps/smart-pharmacy/src/views/patient-evaluation/efficacy/list.vue

@@ -0,0 +1,100 @@
+<script lang="ts" setup>
+import type {
+  OnActionClickParams,
+  VxeTableGridOptions,
+} from '#/adapter/vxe-table';
+import type { PatientEvaluationModel } from '#/api';
+
+import { Page, useVbenModal } from '@vben/common-ui';
+
+import { Button, message } from 'ant-design-vue';
+
+import { useVbenVxeGrid } from '#/adapter/vxe-table';
+import {
+  exportEfficacyEvaluationsMethod,
+  listEfficacyEvaluationsMethod,
+} from '#/api';
+
+import {
+  useEfficacySearchFormSchema,
+  useEfficacyTableColumns,
+} from './data';
+import Detail from './modules/detail.vue';
+
+const [DetailModal, detailModalApi] = useVbenModal({
+  connectedComponent: Detail,
+  destroyOnClose: true,
+});
+
+const [Grid, gridApi] = useVbenVxeGrid({
+  formOptions: {
+    schema: useEfficacySearchFormSchema(),
+    submitOnChange: false,
+    wrapperClass: 'efficacy-search-form',
+  },
+  gridOptions: {
+    columns: useEfficacyTableColumns(onActionClick),
+    height: 'auto',
+    keepSource: true,
+    pagerConfig: {
+      pageSize: 5,
+      layouts: ['PrevPage', 'Jump', 'NextPage'],
+    },
+    proxyConfig: {
+      ajax: {
+        query({ page }, formValues) {
+          return listEfficacyEvaluationsMethod(
+            page.currentPage,
+            page.pageSize,
+            formValues,
+          );
+        },
+      },
+    },
+    rowConfig: {
+      keyField: 'id',
+    },
+    stripe: true,
+  } as VxeTableGridOptions<PatientEvaluationModel.EfficacyEvaluation>,
+});
+
+function onActionClick(
+  e: OnActionClickParams<PatientEvaluationModel.EfficacyEvaluation>,
+) {
+  switch (e.code) {
+    case 'view': {
+      onViewHandle(e.row);
+      break;
+    }
+  }
+}
+
+function onViewHandle(row: PatientEvaluationModel.EfficacyEvaluation) {
+  detailModalApi.setData(row).open();
+}
+
+async function onExport() {
+  const formValues = await gridApi.formApi.getValues();
+  try {
+    await exportEfficacyEvaluationsMethod(formValues);
+    message.success('导出成功');
+  } catch (error: any) {
+    message.error(error.message || '导出失败');
+  }
+}
+</script>
+<template>
+  <Page auto-content-height class="efficacy-page">
+    <DetailModal />
+    <Grid>
+      <template #toolbar-tools>
+        <Button type="link" @click="onExport">导出</Button>
+      </template>
+    </Grid>
+  </Page>
+</template>
+<style scoped>
+.efficacy-page :deep(.efficacy-search-form) {
+  margin-bottom: 0;
+}
+</style>

+ 202 - 0
apps/smart-pharmacy/src/views/patient-evaluation/efficacy/modules/detail.vue

@@ -0,0 +1,202 @@
+<script lang="ts" setup>
+import type { PatientEvaluationModel } from '#/api/method/patient-evaluation';
+
+import { computed, ref } from 'vue';
+import { useRouter } from 'vue-router';
+
+import { useVbenModal } from '@vben/common-ui';
+
+import { Spin } from 'ant-design-vue';
+
+import { getEfficacyEvaluationMethod } from '#/api';
+import { getEfficacyResultLabel } from '#/api/method/patient-evaluation';
+import { maskPhone } from '#/utils/mask-phone';
+
+const router = useRouter();
+const loading = ref(false);
+const detail = ref<PatientEvaluationModel.EfficacyEvaluation>(
+  {} as PatientEvaluationModel.EfficacyEvaluation,
+);
+
+const efficacyResultText = computed(() => {
+  const label = getEfficacyResultLabel(detail.value.efficacyResult);
+  if (!label) return '-';
+  return `处方疗效评价:${label}`;
+});
+
+const [Modal, modalApi] = useVbenModal({
+  class: 'efficacy-detail-modal',
+  showConfirmButton: false,
+  async onOpenChange(isOpen) {
+    if (!isOpen) {
+      detail.value = {} as PatientEvaluationModel.EfficacyEvaluation;
+      return;
+    }
+    const data = modalApi.getData<PatientEvaluationModel.EfficacyEvaluation>();
+    if (!data?.id) return;
+    loading.value = true;
+    try {
+      detail.value = await getEfficacyEvaluationMethod(data.id);
+    } finally {
+      loading.value = false;
+    }
+  },
+});
+
+function displayValue(value?: number | string) {
+  if (value === undefined || value === null || value === '') return '';
+  return String(value);
+}
+
+function goPrescriptionDetail() {
+  const prescriptionId = detail.value.prescriptionId ?? detail.value.id;
+  if (!prescriptionId) return;
+  modalApi.close();
+  router.push(`/prescription/detail/${prescriptionId}`);
+}
+</script>
+<template>
+  <Modal title="处方疗效评价详情">
+    <Spin :spinning="loading">
+      <div class="efficacy-detail">
+        <div class="info-grid">
+          <div class="info-item">
+            <span class="info-label">处方号:</span>
+            <a
+              v-if="detail.prescriptionNumber"
+              class="info-link"
+              @click.prevent="goPrescriptionDetail"
+            >
+              {{ detail.prescriptionNumber }}
+            </a>
+            <span v-else>-</span>
+          </div>
+          <div class="info-item">
+            <span class="info-label">处方日期:</span>
+            <span>{{ displayValue(detail.prescriptionDate) || '-' }}</span>
+          </div>
+          <div class="info-item">
+            <span class="info-label">医疗机构:</span>
+            <span>{{ displayValue(detail.medicalInstitution) || '-' }}</span>
+          </div>
+          <div class="info-item">
+            <span class="info-label">院区:</span>
+            <span>{{ displayValue(detail.campus) || '-' }}</span>
+          </div>
+          <div class="info-item">
+            <span class="info-label">煎药企业:</span>
+            <span>{{ displayValue(detail.decoctionEnterprise) || '-' }}</span>
+          </div>
+          <div class="info-item">
+            <span class="info-label">煎药中心:</span>
+            <span>{{ displayValue(detail.decoctionCenter) || '-' }}</span>
+          </div>
+          <div class="info-item">
+            <span class="info-label">物流公司:</span>
+            <span>{{ displayValue(detail.logisticsCompany) || '-' }}</span>
+          </div>
+          <div class="info-item">
+            <span class="info-label">物流单号:</span>
+            <span>{{ displayValue(detail.logisticsNumber) || '-' }}</span>
+          </div>
+          <div class="info-item">
+            <span class="info-label">患者姓名:</span>
+            <span>{{ displayValue(detail.patientName) || '-' }}</span>
+          </div>
+          <div class="info-item">
+            <span class="info-label">性别:</span>
+            <span>{{ displayValue(detail.gender) || '-' }}</span>
+          </div>
+          <div class="info-item">
+            <span class="info-label">年龄:</span>
+            <span>{{ displayValue(detail.age) || '-' }}</span>
+          </div>
+          <div class="info-item">
+            <span class="info-label">患者电话:</span>
+            <span>{{ maskPhone(detail.patientPhone) || '-' }}</span>
+          </div>
+          <div class="info-item">
+            <span class="info-label">代煎代配:</span>
+            <span>{{ displayValue(detail.decoctionDispensing) || '-' }}</span>
+          </div>
+        </div>
+
+        <div class="efficacy-result">{{ efficacyResultText }}</div>
+
+        <div class="detail-block">
+          <div class="detail-block-title">疗效评价详情:</div>
+          <div class="detail-block-content whitespace-pre-line">
+            {{ detail.evaluationDetail || '-' }}
+          </div>
+        </div>
+      </div>
+    </Spin>
+  </Modal>
+</template>
+<style scoped>
+.efficacy-detail {
+  padding: 8px 24px 12px;
+}
+
+.info-grid {
+  display: grid;
+  grid-template-columns: repeat(4, minmax(0, 1fr));
+  gap: 14px 16px;
+}
+
+.info-item {
+  min-width: 0;
+  line-height: 1.6;
+  word-break: break-all;
+}
+
+.info-label {
+  color: rgb(0 0 0 / 85%);
+}
+
+.info-link {
+  color: #1677ff;
+  cursor: pointer;
+}
+
+.info-link:hover {
+  color: #4096ff;
+}
+
+.efficacy-result {
+  margin: 28px 0 24px;
+  color: #52c41a;
+  font-size: 16px;
+  line-height: 1.6;
+  text-align: center;
+}
+
+.detail-block {
+  margin-bottom: 20px;
+  text-align: center;
+}
+
+.detail-block:last-child {
+  margin-bottom: 0;
+}
+
+.detail-block-title {
+  margin-bottom: 8px;
+  color: rgb(0 0 0 / 85%);
+  line-height: 1.6;
+}
+
+.detail-block-content {
+  color: rgb(0 0 0 / 65%);
+  line-height: 1.8;
+  text-align: center;
+  white-space: pre-line;
+}
+</style>
+<style>
+/* 弹框 Teleport 到 body,scoped 无法命中;勿用 Tailwind 任意 w-[Npx](易与 w-full 冲突) */
+.efficacy-detail-modal {
+  width: 920px !important;
+  max-width: calc(100% - 48px);
+}
+</style>