fix: 医生管理

This commit is contained in:
2025-03-25 18:11:08 +08:00
parent 6eed8c41b0
commit e7c591d347
4 changed files with 337 additions and 136 deletions

View File

@@ -63,6 +63,13 @@ export async function getDoctorOrderList() {
return requestClient.get<any>(`${prefix}doctor-order-list`);
}
/**
* 获取我的诊所列表
*/
export async function getMyStoreListApi() {
return requestClient.get<any>(`${prefix}get-my-store-list`);
}
/**
* 接诊
*/
@@ -84,3 +91,11 @@ export async function endOfDiagnosisApi(id) {
export async function addWestPrescription(data: any) {
return requestClient.post<any>(`${prefix}add-west-prescription`, data);
}
/**
* 切换诊所
* @param data
*/
export async function switchStoreApi(data: any) {
return requestClient.post<any>(`${prefix}switch-store`, data);
}

View File

@@ -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"
/>
</Col>

View File

@@ -214,7 +214,6 @@ const decrypt = (str: string) => str; // 简单base64解码示例
<div class="price-info"></div>
<div class="price-info">总价: {{ item.total_pay_price }}</div>
<div class="validity">处方有效期: {{ item.valid_hours }}小时</div>
<div class="validity">处方有效期2: {{ item.auto_expire_time }}小时</div>
</div>
</div>
</Page>

View File

@@ -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({})
</script>
<template>
<div class="container-box">
<!-- 左侧患者列表 -->
<div class="patient-panel">
<Select class="w-full">
<SelectOption :value="1">测试诊所</SelectOption>
<Select class="w-full" v-model:value="myStoreId">
<SelectOption v-for="item in myStoreList" :value="item.id">{{ item.name }}</SelectOption>
</Select>
<RadioGroup v-model:value="listType" @change="updatePatientList" class="w-full" style="text-align: center">
<RadioButton class="w-1/2" :value="1">当前</RadioButton>
@@ -814,6 +992,9 @@ function addProducts(data) {
>
开具处方
</Button>
<Button v-if="receptionStatus === 2" class="mb-10 ml-10" type="primary" @click="endOfDiagnosis" danger >
结束诊断
</Button>
</div>
<div class="prescription-content">
<Descriptions
@@ -962,9 +1143,6 @@ function addProducts(data) {
<Button class="mb-10" type="primary" @click="tabType = 1">
返回上一页
</Button>
<Button class="mb-10 ml-10" type="primary" @click="endOfDiagnosis" danger >
结束诊断
</Button>
<div class="prescription-header">
<h2>{{ activePatient.name }} 的处方</h2>
@@ -986,8 +1164,8 @@ function addProducts(data) {
</div>
<div class="mt-5">
<Button type="primary" @click="openWesternModal"> 添加商品 </Button>
<RadioGroup v-model:value="category" class="ml-5">
<Button v-if="activeCategory !== 1" type="primary" @click="openWesternModal"> 添加商品 </Button>
<RadioGroup v-model:value="category" :class="activeCategory !== 1? 'ml-5': ''">
<RadioButton :value="1">自费</RadioButton>
<RadioButton :value="2">医保</RadioButton>
</RadioGroup>
@@ -1012,86 +1190,55 @@ function addProducts(data) {
<!-- 中药 -->
<div v-if="activeCategory === 1" class="mb-5 mt-3">
<Row>
<Col
:span="24">
<!-- 添加药品的卡片 -->
<Card title="" class="mt-2">
<template #extra>
</template>
<Popover v-model:open="searchChineseVisible" placement="bottom" trigger="click">
<Input
v-model:value="searchByChinese"
class="w-full"
placeholder="请输入药名或者拼音首拼"
@input="(e) => getDrugListByWesternModal(e.target.value)"
@click="searchChineseVisible = true"
allowClear
addon-before="检索中药:"
>
<!-- <textarea #addonBefore>-->
<!-- 检索中药:-->
<!-- </textarea>-->
</Input>
<!-- -->
<template #content>
<div v-if="searchByChinese !== ''">
<Row style="max-height: 400px; overflow: scroll; padding: 20px;" :gutter="12">
<Col v-for="itemDrug in drugList" :key="itemDrug.id" :span="drugList.length > 1? 4: 24">
<!-- 中药卡片 -->
<Card class="w-full mt-1" hoverable>
<p>{{ itemDrug.drug.drug_name}}</p>
<p>单价:{{itemDrug.price}}/g</p>
<div>
<InputNumber
v-model:value="itemDrug.drug.number"
class="w-full"
@blur="updateChineseNumber"
>
<template #addonAfter> g </template>
</InputNumber>
<Button class="w-full mt-2" type="primary" @click="addProducts(itemDrug)"> 添加到清单 </Button>
</div>
</Card>
</Col>
</Row>
</div>
<Empty v-else />
</template>
</Popover>
<!-- 用法:-->
<!-- 数量:-->
<!-- 单价:-->
</Card>
</Col>
<Col
v-for="(drug, index) in currentDrugs"
:key="drug.id"
:lg="4"
:md="4"
:sm="2"
:xl="8"
:xs="2"
:xxl="12"
:xl="12"
:lg="12"
:md="24"
:sm="24"
:xs="24"
>
<Card :title="drug.drug_name" class="mt-2">
<template #extra>
<Button type="link" @click="removeDrug(index)"> 删除 </Button>
</template>
<Card title="" class="mt-0">
<div>
<!-- <Input v-model:value="drug.drug_name" />-->
<p>
<span style="font-size: 20px; font-weight: bold">{{(index+1)}}、</span>
<Select
show-search
class="w-1/5 old-select-drug-name"
placeholder="药名"
:filter-option="false"
v-model:value="drug.id"
@change="selectOldDrugInfo"
@search="searchOption"
@dropdown-visible-change="setSelectChineseIndex(index, drug.id)"
>
<SelectOption v-if="drugList.length === 0" :value="drug.id">{{drug.drug_name}}</SelectOption>
<SelectOption
v-else
v-for="(value, index) in drugList"
:key="index"
:value="value.drug.id"
>
{{ value.drug.drug_name }}
</SelectOption>
</Select>
,
<InputNumber
v-model:value="drug.number"
:class="'w-1/5 ' + 'old-number-input-' + index"
@blur="updateChineseNumber"
>
<template #addonAfter> g </template>
</InputNumber>
,
<span
>用法:{{ drug.use_ways?.name || '煎服' }}{{ drug.number
}}{{ drug.unit.name }}</span>
单价: <span>{{ drug.price }}元</span>
</p>
</div>
<div class="mt-5">
<!-- 选择中药煎法-->
>
<Select
:value="drug?.way_id"
class="mt-3 w-full mb-2"
placeholder="煎服"
class="w-1/5"
placeholder="用法:煎服"
@change="selectDrugUseWayChange"
@dropdown-visible-change="
selectProductChange(drug.index_id)
@@ -1106,49 +1253,78 @@ function addProducts(data) {
{{ value.name }}
</SelectOption>
</Select>
<InputNumber
v-model:value="drug.number"
class="w-full"
@blur="updateChineseNumber"
>
<template #addonAfter> g </template>
</InputNumber>
,
</span>
¥<span>{{ (drug.price * drug.number).toFixed(2) }}元</span>
<Button style="margin-left: auto" type="link" @click="removeDrug(index)"><DeleteTwoTone /></Button>
</p>
</div>
</Card>
</Col>
<Col
:xxl="12"
:xl="12"
:lg="24"
:md="24"
:sm="12"
:xs="24"
>
<Card title="">
<div>
<p>
<span style="font-size: 20px; font-weight: bold">{{(currentDrugs.length+1)}}、</span>
<Select
show-search
class="w-1/5 new-select-drug-name"
placeholder="药名"
:filter-option="false"
v-model:value="newDrugInfo.id"
@change="selectNewDrugInfo"
@search="searchOption"
>
<SelectOption
v-for="(value, index) in drugList"
:key="index"
:value="value.drug_id"
>
{{ value.drug.drug_name }}
</SelectOption>
</Select>
<InputNumber
v-model:value="newDrugInfo.number"
class="w-1/5 new-number-input"
@blur="updateChineseNumber"
@keydown="selectDrugByNewDrugInfo($event, true)"
>
<template #addonAfter> g </template>
</InputNumber>
<span
>
<Select
v-model:value="newDrugInfo.way_id"
class="w-1/5"
placeholder="用法:煎服"
@keydown="selectDrugByNewDrugInfo($event, true)"
>
<SelectOption :value="0">煎服</SelectOption>
<SelectOption
v-for="(value, index) in drugUseWay"
:key="index"
:value="value.id"
>
{{ value.name }}
</SelectOption>
</Select>
</span>
¥<span>{{ ((newDrugInfo.price || 0) * (newDrugInfo.number || 1)).toFixed(2) }}元</span>
</p>
</div>
</Card>
</Col>
</Row>
<!-- <div
v-for="(drug, index) in currentDrugs"
:key="drug.id"
class="table-row"
>
<div>
<p>
<span>药品名称:{{ drug.drug_name }}</span>
</p>
<p>
<span
>用法:{{ drug.use_way?.name || '煎服' }}{{ drug.number
}}{{ drug.unit.name }}</span>
</p>
</div>
<div>
<div class="quantity-control">
<InputNumber
class="w-full"
v-model:value="drug.number"
@blur="updateChineseNumber"
>
<template #addonAfter> g </template>
</InputNumber>
</div>
</div>
<span>{{ drug.price }}</span>
<div>
<Button type="link" @click="removeDrug(index)">删除</Button>
</div>
</div>-->
</div>
<!-- 西(中成)药列表 -->
<div v-else class="selected-drugs">
@@ -1336,9 +1512,11 @@ function addProducts(data) {
</div>
<!-- 费用总计 -->
<div class="total-cost">加工费:¥{{ processingFee.toFixed(2) }}</div>
<div class="total-cost">商品价格:¥{{ totalProductCost.toFixed(2) }}</div>
<div class="total-cost">总计:¥{{ totalCost.toFixed(2) }}</div>
<div class="price-box">
<div class="total-cost">加工费:¥{{ processingFee.toFixed(2) }}</div>
<div class="total-cost">商品价格:¥{{ totalProductCost.toFixed(2) }}</div>
<div class="total-cost">总计:¥{{ totalCost.toFixed(2) }}</div>
</div>
</Page>
<div v-else-if="tabType === 0" class="prescription-panel">
<Empty />
@@ -1534,7 +1712,11 @@ function addProducts(data) {
.dark .diagnosis-area textarea {
border: 1px solid #333;
}
.price-box {
position: fixed;
right: 10px;
bottom: 62px;
}
.total-cost {
text-align: right;
font-size: 1.2em;