From a5efb6250f59524d54b47b0690b7d1368e18575f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Mon, 3 Nov 2025 04:15:01 +0800 Subject: [PATCH] =?UTF-8?q?feat(clinic):=20=E5=AE=8C=E5=96=84=E5=A4=84?= =?UTF-8?q?=E6=96=B9=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 处方模型增加患者基本信息字段(姓名、性别、年龄、身高、体重)- 处方列表页优化UI展示,增加处方类型、状态标签和药品数量显示 - 实现处方分页查询功能,替换原有列表查询接口 - 添加处方编辑和删除功能,支持跳转到编辑页面 - 处方列表项增加诊断结果、治疗方案、订单金额等信息展示 -优化空状态提示文案和新增按钮样式 - 页面标题文案调整,统一为“处方”相关表述 - 在医生端首页添加跳转到处方管理页面的入口 - 移除冗余的订单创建逻辑,专注处方核心功能 - 在应用配置中注册处方相关页面路由 --- .../clinic/clinicPrescription/model/index.ts | 10 + src/app.config.ts | 4 +- src/clinic/clinicPrescription/add.config.ts | 3 +- src/clinic/clinicPrescription/index.config.ts | 3 +- src/clinic/clinicPrescription/index.tsx | 237 ++++++++++++++++-- src/clinic/index.tsx | 2 +- src/doctor/orders/add.tsx | 1 - src/doctor/orders/confirm.tsx | 25 +- 8 files changed, 232 insertions(+), 53 deletions(-) diff --git a/src/api/clinic/clinicPrescription/model/index.ts b/src/api/clinic/clinicPrescription/model/index.ts index abe8786..d4fc3c0 100644 --- a/src/api/clinic/clinicPrescription/model/index.ts +++ b/src/api/clinic/clinicPrescription/model/index.ts @@ -10,6 +10,16 @@ export interface ClinicPrescription { id?: number; // 患者 userId?: number; + // 姓名 + realName?: string; + // 性别 0男 1女 + sex?: number; + // 年龄 + age?: string; + // 身高 + height?: string; + // 体重 + weight?: string; // 医生 doctorId?: number; // 订单编号 diff --git a/src/app.config.ts b/src/app.config.ts index a8305de..cdb3fac 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -105,7 +105,9 @@ export default { "pages": [ "index", "clinicPatientUser/add", - "clinicDoctorUser/add" + "clinicDoctorUser/add", + "clinicPrescription/index", + "clinicPrescription/add", ] }, { diff --git a/src/clinic/clinicPrescription/add.config.ts b/src/clinic/clinicPrescription/add.config.ts index fc61b82..50a889b 100644 --- a/src/clinic/clinicPrescription/add.config.ts +++ b/src/clinic/clinicPrescription/add.config.ts @@ -1,5 +1,4 @@ export default definePageConfig({ - navigationBarTitleText: '新增处方主表 -', + navigationBarTitleText: '新增处方主表', navigationBarTextStyle: 'black' }) diff --git a/src/clinic/clinicPrescription/index.config.ts b/src/clinic/clinicPrescription/index.config.ts index d901939..10c2660 100644 --- a/src/clinic/clinicPrescription/index.config.ts +++ b/src/clinic/clinicPrescription/index.config.ts @@ -1,5 +1,4 @@ export default definePageConfig({ - navigationBarTitleText: '处方主表 -管理', + navigationBarTitleText: '处方', navigationBarTextStyle: 'black' }) diff --git a/src/clinic/clinicPrescription/index.tsx b/src/clinic/clinicPrescription/index.tsx index d4904ad..9663e95 100644 --- a/src/clinic/clinicPrescription/index.tsx +++ b/src/clinic/clinicPrescription/index.tsx @@ -1,20 +1,26 @@ import {useState} from "react"; import Taro, {useDidShow} from '@tarojs/taro' -import {Button, Cell, CellGroup, Space, Empty, ConfigProvider, Divider} from '@nutui/nutui-react-taro' -import {Dongdong, ArrowRight, CheckNormal, Checked} from '@nutui/icons-react-taro' -import {View} from '@tarojs/components' +import {Button, Cell, CellGroup, Space, Empty, ConfigProvider, Tag, Divider} from '@nutui/nutui-react-taro' +import {Del, Edit} from '@nutui/icons-react-taro' +import {View, Text} from '@tarojs/components' import {ClinicPrescription} from "@/api/clinic/clinicPrescription/model"; -import {listClinicPrescription, removeClinicPrescription, updateClinicPrescription} from "@/api/clinic/clinicPrescription"; +import { + pageClinicPrescription, + removeClinicPrescription +} from "@/api/clinic/clinicPrescription"; +import FixedButton from "@/components/FixedButton"; const ClinicPrescriptionList = () => { const [list, setList] = useState([]) + const [loading, setLoading] = useState(false) const reload = () => { - listClinicPrescription({ + setLoading(true) + pageClinicPrescription({ // 添加查询条件 }) .then(data => { - setList(data || []) + setList(data?.list || []) }) .catch(() => { Taro.showToast({ @@ -22,44 +28,231 @@ const ClinicPrescriptionList = () => { icon: 'error' }); }) + .finally(() => { + setLoading(false) + }) } + const onDel = async (item: ClinicPrescription) => { + const res = await Taro.showModal({ + title: '确认删除', + content: `确定要删除处方编号「${item.orderNo}」吗?`, + }) - const onDel = async (id?: number) => { - await removeClinicPrescription(id) - Taro.showToast({ - title: '删除成功', - icon: 'success' - }); - reload(); + if (res.confirm) { + try { + await removeClinicPrescription(item.id) + Taro.showToast({ + title: '删除成功', + icon: 'success' + }); + reload(); + } catch (error) { + Taro.showToast({ + title: '删除失败', + icon: 'error' + }); + } + } + } + + const onEdit = (item: ClinicPrescription) => { + Taro.navigateTo({ + url: `/clinic/clinicPrescription/add?id=${item.id}` + }) + } + + // 获取处方类型文本 + const getPrescriptionTypeText = (type?: number) => { + return type === 0 ? '中药' : type === 1 ? '西药' : '未知' + } + + // 获取状态文本 + const getStatusText = (status?: number) => { + switch (status) { + case 0: + return '正常' + case 1: + return '已完成' + case 2: + return '已支付' + case 3: + return '已取消' + default: + return '未知' + } + } + + // 获取状态颜色 + const getStatusType = (status?: number): 'primary' | 'success' | 'danger' | 'warning' | 'default' => { + switch (status) { + case 0: + return 'primary' + case 1: + return 'success' + case 2: + return 'success' + case 3: + return 'danger' + default: + return 'default' + } + } + + const getSexName = (sex?: number) => { + return sex === 0 ? '男' : sex === 1 ? '女' : '' } useDidShow(() => { reload() }); - if (list.length == 0) { + if (list.length === 0 && !loading) { return ( -
- - + + -
+
) } return ( <> - {list.map((item, _) => ( - + {list.map((item) => ( + + + + {item.realName} + {item.age}岁 + {getSexName(item.sex)} + + + + {getStatusText(item.status)} + + + } + /> + + {getPrescriptionTypeText(item.prescriptionType)} + + } + /> + {item.diagnosis && ( + + {item.diagnosis.length > 20 + ? `${item.diagnosis.substring(0, 20)}...` + : item.diagnosis} + + } + /> + )} + {item.treatmentPlan && ( + + {item.treatmentPlan.length > 20 + ? `${item.treatmentPlan.substring(0, 20)}...` + : item.treatmentPlan} + + } + /> + )} + + ¥{item.orderPrice || '0.00'} + + } + /> + {item.items && item.items.length > 0 && ( + + 共 {item.items.length} 味药 + + } + /> + )} + + {item.createTime} + + } + /> + {item.comments && ( + + {item.comments.length > 30 + ? `${item.comments.substring(0, 30)}...` + : item.comments} + + } + /> + )} + + + + + + + + + ))} + + + Taro.navigateTo({url: '/clinic/clinicPrescription/add'})} + /> + + ) +} + +export default ClinicPrescriptionList; diff --git a/src/clinic/index.tsx b/src/clinic/index.tsx index b093750..fbbf059 100644 --- a/src/clinic/index.tsx +++ b/src/clinic/index.tsx @@ -163,7 +163,7 @@ const DealerIndex: React.FC = () => { - navigateToPage('/doctor/orders/index')}> + navigateToPage('/clinic/clinicPrescription/index')}> diff --git a/src/doctor/orders/add.tsx b/src/doctor/orders/add.tsx index d19db9e..6a09cc4 100644 --- a/src/doctor/orders/add.tsx +++ b/src/doctor/orders/add.tsx @@ -19,7 +19,6 @@ import {ClinicPatientUser} from "@/api/clinic/clinicPatientUser/model"; import {ClinicPrescription} from "@/api/clinic/clinicPrescription/model"; import {TenantId} from "@/config/app"; import {getClinicPatientUser} from "@/api/clinic/clinicPatientUser"; -import {addClinicOrder} from "@/api/clinic/clinicOrder"; // 图片数据接口 interface UploadedImageData { diff --git a/src/doctor/orders/confirm.tsx b/src/doctor/orders/confirm.tsx index 671e2ab..7b2dc22 100644 --- a/src/doctor/orders/confirm.tsx +++ b/src/doctor/orders/confirm.tsx @@ -139,30 +139,7 @@ const DoctorOrderConfirm = () => { console.log('处方明细创建成功') } - // 第三步:创建订单记录,关联处方ID - console.log('开始创建订单记录...') - const clinicOrderData = { - userId: orderData.patient.userId, - doctorId: doctorId, - type: 0, // 订单类型:诊所订单 - title: `${orderData.patient.realName}的处方订单`, - totalPrice: getTotalPrice(), - payPrice: getTotalPrice(), - buyerRemarks: `诊断:${orderData.diagnosis}`, - merchantRemarks: orderData.treatmentPlan, - comments: JSON.stringify({ - prescriptionId: prescriptionId, // 关联处方ID - prescriptionNo: createdPrescription.orderNo, // 处方编号 - patientName: orderData.patient.realName, - patientAge: orderData.patient.age - }), - payStatus: '0', // 未付款 - orderStatus: 0, // 待支付 - deliveryStatus: 10, // 未发货 - } - - await addClinicPrescription(clinicOrderData) - console.log('订单创建成功') + console.log('处方创建完成,处方ID:', prescriptionId) // 清除临时数据 Taro.removeStorageSync('tempOrderData')