diff --git a/src/api/clinic/clinicPatientUser/model/index.ts b/src/api/clinic/clinicPatientUser/model/index.ts index ea0847b..0799c7b 100644 --- a/src/api/clinic/clinicPatientUser/model/index.ts +++ b/src/api/clinic/clinicPatientUser/model/index.ts @@ -12,6 +12,8 @@ export interface ClinicPatientUser { userId?: number; // 姓名 realName?: string; + // 头像 + avatar?: string; // 年龄 age?: string; // 性别 diff --git a/src/api/clinic/clinicPrescription/model/index.ts b/src/api/clinic/clinicPrescription/model/index.ts index 78561b0..abe8786 100644 --- a/src/api/clinic/clinicPrescription/model/index.ts +++ b/src/api/clinic/clinicPrescription/model/index.ts @@ -24,6 +24,8 @@ export interface ClinicPrescription { treatmentPlan?: string; // 煎药说明 decoctionInstructions?: string; + // 图片 + image?: string; // 订单总金额 orderPrice?: string; // 单价 diff --git a/src/doctor/orders/add.tsx b/src/doctor/orders/add.tsx index 705ccf2..752c75f 100644 --- a/src/doctor/orders/add.tsx +++ b/src/doctor/orders/add.tsx @@ -1,16 +1,25 @@ import {useEffect, useState, useRef} from "react"; import {useRouter} from '@tarojs/taro' -import {Loading, CellGroup, Input, Form, Cell,Button, Avatar, Tag, TextArea, ImagePreview} from '@nutui/nutui-react-taro' +import { + Loading, + Button, + Form, + Cell, + Avatar, + Input, + Space, + TextArea +} from '@nutui/nutui-react-taro' import {ArrowRight} from '@nutui/icons-react-taro' import {View, Text} from '@tarojs/components' import Taro from '@tarojs/taro' import FixedButton from "@/components/FixedButton"; import navTo from "@/utils/common"; -import {getUser} from "@/api/system/user"; -import {User} from "@/api/system/user/model"; 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 { @@ -24,24 +33,24 @@ interface UploadedImageData { const AddClinicOrder = () => { const {params} = useRouter(); - const [toUser, setToUser] = useState() + const [toUser, setToUser] = useState() const [loading, setLoading] = useState(false) - const formRef = useRef(null) - const [disabled, setDisabled] = useState(false) + const formRef = useRef() const [fileList, setFileList] = useState([]) // 图片文件列表 - const [showBdImgPreview, setShowBdImgPreview] = useState(false) - const [fileList2, setFileList2] = useState([]) // 图片文件列表 // 患者和处方状态 - const [selectedPatient, setSelectedPatient] = useState(null) - const [selectedPrescription, setSelectedPrescription] = useState(null) + const [selectedPatient, setSelectedPatient] = useState() + const [selectedPrescription, setSelectedPrescription] = useState() // 表单数据 - const [formData, setFormData] = useState({ + const [formData, setFormData] = useState({ + userId: undefined, + doctorId: undefined, diagnosis: '', treatmentPlan: '', + orderPrice: '', decoctionInstructions: '', - content: '', + items: [], image: '' // 添加image字段 }) @@ -51,7 +60,7 @@ const AddClinicOrder = () => { const reload = async () => { if (toUserId) { - getUser(Number(toUserId)).then(data => { + getClinicPatientUser(Number(toUserId)).then(data => { setToUser(data) }) } @@ -60,6 +69,8 @@ const AddClinicOrder = () => { // 设置选中的患者(供其他页面调用) // @ts-ignore const setSelectedPatientFunc = (patient: ClinicPatientUser) => { + console.log('设置选中的患者:', patient) + setToUser(patient) setSelectedPatient(patient) } @@ -77,7 +88,6 @@ const AddClinicOrder = () => { })) } - // 选择并上传图片 const handleChooseImage = () => { if (fileList.length >= 5) { // 修正最大图片数量为5 @@ -218,10 +228,16 @@ const AddClinicOrder = () => { return false; } - // 判断内容是否为空 - if (!values.content) { + if (!values.diagnosis) { Taro.showToast({ - title: `请输入消息内容`, + title: `请输入诊断结果`, + icon: 'error' + }); + return false; + } + if (!values.treatmentPlan) { + Taro.showToast({ + title: `请输入治疗方案`, icon: 'error' }); return false; @@ -252,7 +268,7 @@ const AddClinicOrder = () => { } // 执行新增或更新操作 - // await addClinicOrder({}); + await addClinicOrder({}); Taro.showToast({ title: `发送成功`, @@ -327,70 +343,73 @@ const AddClinicOrder = () => { return ( <> {/* 显示已选择的用户(如果有的话) */} - {toUser && ( - - - - {toUser.alias || toUser.nickname} - {toUser.mobile} - + + + + {toUser?.realName || '请选择'} + {toUser?.phone} - )} extra={( - - )}/> - )} - - {/* 选择患者 */} - - {selectedPatient.realName || '未知患者'} - - - ) : ( - 请选择患者 - )} - onClick={() => navTo(`/doctor/orders/selectPatient`, true)} + + )} extra={( + + )} onClick={() => navTo(`/doctor/orders/selectPatient`, true)} /> - {/* 诊断结果 */} - - -