diff --git a/apps/web-antd/src/views/doctor/doctor-reception/api/index.ts b/apps/web-antd/src/views/doctor/doctor-reception/api/index.ts index 0010b355..70e68141 100644 --- a/apps/web-antd/src/views/doctor/doctor-reception/api/index.ts +++ b/apps/web-antd/src/views/doctor/doctor-reception/api/index.ts @@ -63,6 +63,13 @@ export async function getDoctorOrderList() { return requestClient.get(`${prefix}doctor-order-list`); } +/** + * 获取我的诊所列表 + */ +export async function getMyStoreListApi() { + return requestClient.get(`${prefix}get-my-store-list`); +} + /** * 接诊 */ @@ -84,3 +91,11 @@ export async function endOfDiagnosisApi(id) { export async function addWestPrescription(data: any) { return requestClient.post(`${prefix}add-west-prescription`, data); } + +/** + * 切换诊所 + * @param data + */ +export async function switchStoreApi(data: any) { + return requestClient.post(`${prefix}switch-store`, data); +} diff --git a/apps/web-antd/src/views/doctor/doctor-reception/components/DiagnosisModal.vue b/apps/web-antd/src/views/doctor/doctor-reception/components/DiagnosisModal.vue index 35612e2f..295696a2 100644 --- a/apps/web-antd/src/views/doctor/doctor-reception/components/DiagnosisModal.vue +++ b/apps/web-antd/src/views/doctor/doctor-reception/components/DiagnosisModal.vue @@ -15,6 +15,7 @@ import { import { getDiseaseList, } from '#/views/doctor/doctor-reception/api'; +import { debounce } from 'lodash-es'; // 或者使用自定义防抖函数 const searchKey = ref(''); const diagnosisList = ref([]); @@ -67,6 +68,9 @@ function getDiagnosisList(searchKey = '') { }); } +const getDiagnosisListChage = debounce(async (searchText = '') => { + getDiagnosisList(searchText); +}, 300) /** * 选择诊断 * @param item @@ -102,6 +106,7 @@ function selectDiagnosis(item) { :model="searchKey" enter-button placeholder="请输想要搜索的内容..." + @input="(e) => getDiagnosisListChage(e.target.value)" @search="getDiagnosisList" /> diff --git a/apps/web-antd/src/views/doctor/doctor-reception/components/PrescrtionDetail.vue b/apps/web-antd/src/views/doctor/doctor-reception/components/PrescrtionDetail.vue index 5bd08cc9..59d9cc36 100644 --- a/apps/web-antd/src/views/doctor/doctor-reception/components/PrescrtionDetail.vue +++ b/apps/web-antd/src/views/doctor/doctor-reception/components/PrescrtionDetail.vue @@ -214,7 +214,6 @@ const decrypt = (str: string) => str; // 简单base64解码示例
总价: ¥{{ item.total_pay_price }}
处方有效期: {{ item.valid_hours }}小时
-
处方有效期2: {{ item.auto_expire_time }}小时
diff --git a/apps/web-antd/src/views/doctor/doctor-reception/index.vue b/apps/web-antd/src/views/doctor/doctor-reception/index.vue index 9acd88b2..b4cb6e87 100644 --- a/apps/web-antd/src/views/doctor/doctor-reception/index.vue +++ b/apps/web-antd/src/views/doctor/doctor-reception/index.vue @@ -4,7 +4,7 @@ import { computed, ref, watch } from 'vue'; import { Page, useVbenModal } from '@vben/common-ui'; import { debounce } from 'lodash-es'; // 或者使用自定义防抖函数 -import { MinusOutlined, PlusOutlined } from '@ant-design/icons-vue'; +import { MinusOutlined, PlusOutlined, DeleteTwoTone } from '@ant-design/icons-vue'; import { Badge, Button, @@ -32,7 +32,7 @@ import { import { getRegisterStatus } from '#/util/tool'; import { addWestPrescription, endOfDiagnosisApi, - getDrugUseList, + getDrugUseList, getMyStoreListApi, getPatientItem, getPatientList, getProcessRuleList, getProductListDoctorReception, @@ -43,6 +43,7 @@ import DiagnosisModal from './components/DiagnosisModal.vue'; import DoctorOrderModal from './components/DoctorOrderModal.vue'; import PrescrtionDetail from './components/PrescrtionDetail.vue'; import WesternModal from './components/WesternModal.vue'; +import {useUserStore} from "@vben/stores"; interface Patient { id: number; @@ -67,7 +68,6 @@ interface UserPatientHealthInquiry { is_delete: number; } -const searchByChinese = ref(''); const tabType = ref(0); const category = ref(1); const listType = ref(1); @@ -83,6 +83,23 @@ const drugUseType = ref([]); const drugUnit = ref([]); const drugTime = ref([]); const drugUseWay = ref([]); +const myStoreList = ref([]); + +/** + * 获取我的诊所列表 + */ +function getMyStoreList() { + getMyStoreListApi().then((res) => { + myStoreList.value = res; + }) +} + +getMyStoreList(); + +const userStore = useUserStore(); +const myStoreId = ref(userStore.userInfo.store_id) +// userStore.userInfo?.nick_name +console.log(userStore.userInfo.store_id); /** * 获取患者列表 @@ -139,7 +156,6 @@ const diagnosis = ref(''); const medicalAdvice = ref(''); const treatmentPrice = ref(0); const selectPatientId = ref(0); -const searchChineseVisible = ref(false); const ruleType = ref(1); const prescriptionList = ref([]); const drugList = ref([]); @@ -358,6 +374,10 @@ getCurrentDrugs(); * 发送处方 */ const sendPrescription = () => { + if (currentDrugs.value.length === 0) { + message.error('请选择药品'); + return; + } if (activeCategory.value === 1) { if (ruleType.value === 1) { if (packageMethodId.value == null) { @@ -427,14 +447,16 @@ const sendPrescription = () => { }).then(() => { message.success('处方已发送'); // 清空当前数据 - // currentDrugs.value = []; - // diagnosis.value = ''; - // medicalAdvice.value = ''; - // packageMethodId.value = 2; - // processRulePrice.value = ''; - // dosage.value = 1; - // dayDosage.value = 1; - // updateLocalStorage(); + currentDrugs.value = []; + diagnosis.value = ''; + medicalAdvice.value = ''; + packageMethodId.value = 2; + processRulePrice.value = 0; + dosage.value = 7; + dayDosage.value = 2; + tabType.value = 1; + newDrugInfo.value = {}; + updateLocalStorage(); }); }; @@ -455,6 +477,7 @@ watch( prescriptionList.value = value.prescription; }); } + newDrugInfo.value = {}; localStorage.setItem( `doctorReception-type`, // JSON.stringify(selectData), @@ -653,8 +676,8 @@ function selectPackageMethod(id) { packageMethodId.value = id; } // jishu -const dosage = ref(1); -const dayDosage = ref(1); +const dosage = ref(7); +const dayDosage = ref(2); function updateChineseNumber() { updateLocalStorage(); @@ -696,6 +719,159 @@ const getDrugListByWesternModal = debounce(async (searchText = '') => { } }, 300); +// getDrugListByWesternModal(); + +/** + * 选择药品 + * @param id + */ +function selectNewDrugInfo() { + // 如果是新药品输入框,调用添加新药品方法 + const check = currentDrugs.value.find((v) => v.id === newDrugInfo.value.id); + if (check) { + newDrugInfo.value.id = ''; + message.error('该药品已经在处方中了!'); + return; + } + + + const data = drugList.value.find((v) => v.drug_id === newDrugInfo.value.id); + newDrugInfo.value.price = data.price; + setTimeout(() => { + // 获取新药品卡片中的克数输入框并聚焦 + const newDrugNumberInput = document.querySelector('.new-number-input input'); + if (newDrugNumberInput) { + (newDrugNumberInput as HTMLElement).focus(); + } + }, 100); +} + +const selectChineseIndex = ref(-1); +const selectChineseId = ref(0); +/** + * 选择药品 + * @param id + */ +function selectOldDrugInfo(id) { + const check = JSON.parse( + localStorage.getItem(`prescriptionData${activePatient.value?.id}`) || '[]', + ).find((v) => v.id === id); + if (check) { + currentDrugs.value[selectChineseIndex.value].id = selectChineseId.value + drugList.value = []; + message.error('该药品已经在处方中了!'); + return; + } + let oldDrugInfo = currentDrugs.value[selectChineseIndex.value] + // 如果是新药品输入框,调用添加新药品方法 + const data = drugList.value.find((v) => v.drug_id === id); + + + // 创建新的商品对象(避免直接修改原始数据) + const newProduct = { + // 索引ID(用于在列表中查找) + index_id: data.id, + // 药品ID + id: data.drug.id, + // 药品名称 + drug_name: data.drug.drug_name, + // 药品数量 + number: data.drug.number, + // 药品使用数量信息 + use_num: drugTime.value.find((item) => item.id === data.drug.time_id), + // 药品使用类型信息 + use_type: drugUseType.value.find((item) => item.id === data.drug.type_id), + // 药品使用频率信息 + use_frequency: drugUseFrequency.value.find( + (item) => item.id === data.drug.frequency_id, + ), + // 药品单位信息 + unit: drugUnit.value.find((item) => item.id === data.drug.unit_id), + // 药品价格 + price: data.price, + // 药品使用方式ID + way_id: data.drug?.way_id, + // 药品使用方式信息 + use_ways: drugUseWay.value.find((item) => item.id === data.drug.way_id), + // 药品使用时间ID + time_id: data.drug.time_id, + // 药品类型ID + type_id: data.drug.type_id, + // 药品使用频率ID + frequency_id: data.drug.frequency_id, + // 药品单位ID + unit_id: data.drug.unit_id, + // 药品图片 + image: data.drug.image, + // 药品说明书 + instruction: data.drug.instruction, + // 药品类型 + type: data.drug.type, + }; + currentDrugs.value[selectChineseIndex.value] = newProduct + updateLocalStorage(); + // const data = drugList.value.find((v) => v.drug_id === id); + setTimeout(() => { + // 获取新药品卡片中的克数输入框并聚焦 + const newDrugNumberInput = document.querySelector('.old-number-input-' + selectChineseIndex.value + ' input'); + if (newDrugNumberInput) { + (newDrugNumberInput as HTMLElement).focus(); + } + }, 100); + return console.log(oldDrugInfo, data, 'ssssssssss') + +} + +/** + * 写入当前修改的下标 + * @param index + */ +function setSelectChineseIndex(index, id) { + selectChineseIndex.value = index + selectChineseId.value = id +} +/** + * 查询中药列表 + * @param inputValue + */ +function searchOption(inputValue) { + getDrugListByWesternModal(inputValue); +} + +/** + * 添加操作 + */ +function selectDrugByNewDrugInfo(event: KeyboardEvent, isNewDrug: boolean) { + // 如果按下的是回车键 + if (event.key === 'Enter') { + // 阻止默认行为(防止表单提交) + event.preventDefault(); + + if (isNewDrug) { + // 如果是新药品输入框,调用添加新药品方法 + const check = currentDrugs.value.find((v) => v.id === newDrugInfo.value.id); + if (check) { + message.error('该药品已经在处方中了!'); + return; + } + const data = drugList.value.find((v) => v.drug_id === newDrugInfo.value.id); + data.drug.number = newDrugInfo.value.number; + data.drug.way_id = newDrugInfo.value.way_id; + addProducts(data); + newDrugInfo.value = {}; + } else { + // 如果是已有药品输入框,调用更新数量方法 + updateChineseNumber(); + } + setTimeout(() => { + // 获取新药品卡片中的克数输入框并聚焦 + const newDrugNumberInput = document.querySelector('.new-select-drug-name input'); + if (newDrugNumberInput) { + (newDrugNumberInput as HTMLElement).focus(); + } + }, 100); + } +} /** * 添加商品到处方 @@ -764,14 +940,16 @@ function addProducts(data) { // 提示成功 message.success(`已将${newProduct.drug_name}添加到清单中!`); } + +const newDrugInfo = ref({})