fix: 常用方、患者管理
This commit is contained in:
@@ -332,15 +332,15 @@ function openCommonPrescriptionModal() {
|
||||
/**
|
||||
* 处理选择常用方
|
||||
* @param data 常用方数据,包含prescription和recipes
|
||||
* @param type 类型:1-中药,2-西药,3-颗粒药
|
||||
* @param type 类型:1-西药,2-中药,3-颗粒药
|
||||
* @description 选择常用方后,将药品列表填充到当前处方中
|
||||
*/
|
||||
function handleSelectCommonPrescription(data: any, type: number) {
|
||||
async function handleSelectCommonPrescription(data: any, type: number) {
|
||||
const { prescription, recipes } = data;
|
||||
|
||||
// 根据类型处理不同的药品数据
|
||||
if (type === 2) {
|
||||
// 西药(中成药)处方
|
||||
if (type === 1) {
|
||||
// 西药处方
|
||||
recipes.forEach((recipe: any) => {
|
||||
const newProduct = {
|
||||
index_id: recipe.drug_id || recipe.id,
|
||||
@@ -389,13 +389,34 @@ function handleSelectCommonPrescription(data: any, type: number) {
|
||||
prescriptionStore.currentDrugs.push(newProduct);
|
||||
}
|
||||
});
|
||||
|
||||
// 写入规则类型和剂量信息(中药)- 使用 ?? 运算符提供默认值
|
||||
prescriptionStore.ruleType = prescription.rule_type ?? 1;
|
||||
prescriptionStore.dosage = prescription.dosage ?? 7;
|
||||
prescriptionStore.dayDosage = prescription.day_dosage ?? 2;
|
||||
prescriptionStore.packageMethodId = prescription.package_method_id ?? 2;
|
||||
|
||||
// 如果是委托调剂,写入完整加工规则配置 - 只有有效值才写入(大于0),级联加载
|
||||
if (prescription.process_rule_id && prescription.process_rule_id > 0) {
|
||||
prescriptionStore.processRuleId = prescription.process_rule_id;
|
||||
// 加载煎法选项
|
||||
await prescriptionStore.getProcessRuleListData(prescription.process_rule_id, 0);
|
||||
}
|
||||
if (prescription.child_process_rule_id && prescription.child_process_rule_id > 0) {
|
||||
prescriptionStore.childProcessRuleId = prescription.child_process_rule_id;
|
||||
// 加载备注选项
|
||||
await prescriptionStore.getProcessRuleListData(0, prescription.child_process_rule_id);
|
||||
}
|
||||
if (prescription.process_rule_note_id && prescription.process_rule_note_id > 0) {
|
||||
prescriptionStore.processRuleNoteId = prescription.process_rule_note_id;
|
||||
}
|
||||
}
|
||||
|
||||
// 更新诊断和医嘱
|
||||
if (prescription.clinical_diagnose) {
|
||||
// 更新诊断和医嘱 - 允许空字符串覆盖
|
||||
if (prescription.clinical_diagnose !== undefined && prescription.clinical_diagnose !== null) {
|
||||
prescriptionStore.diagnosis = prescription.clinical_diagnose;
|
||||
}
|
||||
if (prescription.doctor_order) {
|
||||
if (prescription.doctor_order !== undefined && prescription.doctor_order !== null) {
|
||||
prescriptionStore.medicalAdvice = prescription.doctor_order;
|
||||
}
|
||||
|
||||
|
||||
@@ -288,6 +288,18 @@ function getDrugCount(recipes: any[]): number {
|
||||
<span class="font-medium text-muted-foreground">医嘱:</span>
|
||||
<span>{{ item.doctor_order }}</span>
|
||||
</p>
|
||||
<p class="mb-2 leading-relaxed">
|
||||
<span class="font-medium text-muted-foreground">调配方式:</span>
|
||||
<span>{{ item.rule_type === 1 ? '自制剂' : '委托调剂' }}</span>
|
||||
<span class="ml-4">剂量:{{ item.dosage || 7 }}天/剂</span>
|
||||
<span class="ml-4">频次:{{ item.day_dosage || 2 }}次/天</span>
|
||||
</p>
|
||||
<p v-if="item.rule_type === 2" class="mb-2 leading-relaxed">
|
||||
<span class="font-medium text-muted-foreground">委托调剂:</span>
|
||||
<span v-if="item.process_rule_name">制剂:{{ item.process_rule_name }}</span>
|
||||
<span v-if="item.child_process_rule_name" class="ml-4">煎法:{{ item.child_process_rule_name }}</span>
|
||||
<span v-if="item.process_rule_note_name" class="ml-4">备注:{{ item.process_rule_note_name }}</span>
|
||||
</p>
|
||||
<p class="mb-2 leading-relaxed">
|
||||
<span class="font-medium text-muted-foreground">药品:</span>
|
||||
<span class="text-primary">{{
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
DeleteTwoTone,
|
||||
MinusOutlined,
|
||||
PlusOutlined,
|
||||
SaveOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
import {
|
||||
Button,
|
||||
@@ -17,6 +18,7 @@ import {
|
||||
Empty,
|
||||
Image,
|
||||
ImagePreviewGroup,
|
||||
Input,
|
||||
InputNumber,
|
||||
message,
|
||||
RadioButton,
|
||||
@@ -24,7 +26,7 @@ import {
|
||||
Row,
|
||||
Select,
|
||||
SelectOption,
|
||||
Modal,
|
||||
Modal as AntModal,
|
||||
Tag,
|
||||
Textarea,
|
||||
Timeline,
|
||||
@@ -54,6 +56,11 @@ import RefusalOfTreatmentModal
|
||||
from "#/views/doctor/doctor-reception/components/RefusalOfTreatmentModal.vue";
|
||||
// 常用方选择弹窗组件
|
||||
import CommonPrescriptionModal from './components/CommonPrescriptionModal.vue';
|
||||
// 保存常用方API
|
||||
import {
|
||||
saveChineseCommonPrescriptionApi,
|
||||
saveWestCommonPrescriptionApi,
|
||||
} from '#/views/doctor/settings/api';
|
||||
|
||||
interface Patient {
|
||||
id: number;
|
||||
@@ -171,6 +178,14 @@ const ruleType = ref(1);
|
||||
const prescriptionList = ref([]);
|
||||
const drugList = ref([]);
|
||||
|
||||
// ==================== 保存常用方相关状态 ====================
|
||||
/** 保存常用方弹窗是否显示 */
|
||||
const showSaveCommonPrescriptionModal = ref(false);
|
||||
/** 常用方名称输入 */
|
||||
const commonPrescriptionName = ref('');
|
||||
/** 是否正在保存常用方 */
|
||||
const isSavingCommonPrescription = ref(false);
|
||||
|
||||
/**
|
||||
* 获取药品使用方式列表
|
||||
*/
|
||||
@@ -680,7 +695,7 @@ function openCommonPrescriptionModal() {
|
||||
* @param type 类型:1-西药,2-中药,3-颗粒药
|
||||
* @description 选择常用方后,将药品列表填充到当前处方中
|
||||
*/
|
||||
function handleSelectCommonPrescription(data: any, type: number) {
|
||||
async function handleSelectCommonPrescription(data: any, type: number) {
|
||||
const { prescription, recipes } = data;
|
||||
|
||||
// 根据类型处理不同的药品数据
|
||||
@@ -735,19 +750,150 @@ function handleSelectCommonPrescription(data: any, type: number) {
|
||||
currentDrugs.value.push(newProduct);
|
||||
}
|
||||
});
|
||||
|
||||
// 写入规则类型和剂量信息(中药)- 使用 ?? 运算符提供默认值
|
||||
ruleType.value = prescription.rule_type ?? 1;
|
||||
dosage.value = prescription.dosage ?? 7;
|
||||
dayDosage.value = prescription.day_dosage ?? 2;
|
||||
packageMethodId.value = prescription.package_method_id ?? 2;
|
||||
|
||||
// 如果是委托调剂,写入完整加工规则配置 - 只有有效值才写入(大于0),级联加载
|
||||
if (prescription.process_rule_id && prescription.process_rule_id > 0) {
|
||||
processRuleId.value = prescription.process_rule_id;
|
||||
// 加载煎法选项
|
||||
await loadProcessRuleData(prescription.process_rule_id, 0);
|
||||
}
|
||||
if (prescription.child_process_rule_id && prescription.child_process_rule_id > 0) {
|
||||
childProcessRuleId.value = prescription.child_process_rule_id;
|
||||
// 加载备注选项
|
||||
await loadProcessRuleData(0, prescription.child_process_rule_id);
|
||||
}
|
||||
if (prescription.process_rule_note_id && prescription.process_rule_note_id > 0) {
|
||||
processRuleNoteId.value = prescription.process_rule_note_id;
|
||||
}
|
||||
}
|
||||
|
||||
// 更新诊断和医嘱
|
||||
if (prescription.clinical_diagnose) {
|
||||
// 更新诊断和医嘱 - 允许空字符串覆盖
|
||||
if (prescription.clinical_diagnose !== undefined && prescription.clinical_diagnose !== null) {
|
||||
diagnosis.value = prescription.clinical_diagnose;
|
||||
}
|
||||
if (prescription.doctor_order) {
|
||||
if (prescription.doctor_order !== undefined && prescription.doctor_order !== null) {
|
||||
medicalAdvice.value = prescription.doctor_order;
|
||||
}
|
||||
|
||||
// 保存到本地存储
|
||||
updateLocalStorage();
|
||||
}
|
||||
|
||||
// ==================== 保存常用方相关方法 ====================
|
||||
|
||||
/**
|
||||
* 打开保存常用方弹窗
|
||||
* @description 检查是否有药品可保存,然后打开弹窗
|
||||
*/
|
||||
const openSaveCommonPrescriptionModal = () => {
|
||||
// 检查是否有药品
|
||||
if (currentDrugs.value.length === 0) {
|
||||
message.warning('请先添加药品后再保存为常用方');
|
||||
return;
|
||||
}
|
||||
// 清空输入框
|
||||
commonPrescriptionName.value = '';
|
||||
// 打开弹窗
|
||||
showSaveCommonPrescriptionModal.value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 保存当前处方为常用方
|
||||
* @description 根据当前药品类型(中药/西药)调用不同的保存接口
|
||||
*/
|
||||
const saveAsCommonPrescription = async () => {
|
||||
// 验证名称
|
||||
if (!commonPrescriptionName.value.trim()) {
|
||||
message.warning('请输入常用方名称');
|
||||
return;
|
||||
}
|
||||
|
||||
// 验证是否有药品
|
||||
if (currentDrugs.value.length === 0) {
|
||||
message.warning('没有可保存的药品');
|
||||
return;
|
||||
}
|
||||
|
||||
isSavingCommonPrescription.value = true;
|
||||
|
||||
try {
|
||||
// 根据处方类型选择不同的保存接口
|
||||
if (activeCategory.value === 1) {
|
||||
// 中药处方 - 构建药品详细信息数组
|
||||
const drugs = currentDrugs.value.map((drug) => ({
|
||||
drug_id: drug.id,
|
||||
drug_name: drug.drug_name,
|
||||
number: drug.number || 1,
|
||||
price: drug.price || 0,
|
||||
way_id: drug.way_id || 0,
|
||||
}));
|
||||
|
||||
await saveChineseCommonPrescriptionApi({
|
||||
name: commonPrescriptionName.value.trim(),
|
||||
drugs,
|
||||
store_id: myStoreId.value,
|
||||
clinical_diagnose: diagnosis.value || '',
|
||||
doctor_order: medicalAdvice.value || '',
|
||||
category: String(category.value),
|
||||
dosage: dosage.value,
|
||||
day_dosage: dayDosage.value,
|
||||
rule_type: ruleType.value,
|
||||
package_method_id: ruleType.value === 1 ? packageMethodId.value : undefined,
|
||||
process_rule_id: ruleType.value === 2 ? (processRuleId.value || undefined) : undefined,
|
||||
child_process_rule_id: ruleType.value === 2 ? (childProcessRuleId.value || undefined) : undefined,
|
||||
process_rule_note_id: ruleType.value === 2 ? (processRuleNoteId.value || undefined) : undefined,
|
||||
});
|
||||
} else {
|
||||
// 西药处方 - 构建药品详细信息数组
|
||||
const drugs = currentDrugs.value.map((drug) => ({
|
||||
drug_id: drug.id,
|
||||
drug_name: drug.drug_name,
|
||||
number: drug.number || 1,
|
||||
price: drug.price || 0,
|
||||
image: drug.image || '',
|
||||
instruction: drug.instruction || '',
|
||||
use_type_id: drug.use_type?.id || 0,
|
||||
use_frequency_id: drug.use_frequency?.id || 0,
|
||||
use_time_id: drug.use_num?.id || 0,
|
||||
unit_id: drug.unit?.id || 0,
|
||||
select_number: drug.select_number || 1,
|
||||
}));
|
||||
|
||||
await saveWestCommonPrescriptionApi({
|
||||
name: commonPrescriptionName.value.trim(),
|
||||
drugs,
|
||||
store_id: myStoreId.value,
|
||||
clinical_diagnose: diagnosis.value || '',
|
||||
doctor_order: medicalAdvice.value || '',
|
||||
category: String(category.value),
|
||||
});
|
||||
}
|
||||
|
||||
message.success('常用方保存成功');
|
||||
showSaveCommonPrescriptionModal.value = false;
|
||||
commonPrescriptionName.value = '';
|
||||
} catch (error) {
|
||||
console.error('保存常用方失败:', error);
|
||||
message.error('保存常用方失败,请稍后重试');
|
||||
} finally {
|
||||
isSavingCommonPrescription.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 取消保存常用方
|
||||
*/
|
||||
const cancelSaveCommonPrescription = () => {
|
||||
showSaveCommonPrescriptionModal.value = false;
|
||||
commonPrescriptionName.value = '';
|
||||
};
|
||||
|
||||
const openWesternModal = () => {
|
||||
// 打开西药处方模态框逻辑
|
||||
WesternDrugModalApi.setData({
|
||||
@@ -863,28 +1009,19 @@ const processRuleId = ref();
|
||||
const processRuleNoteId = ref();
|
||||
const childProcessRuleId = ref();
|
||||
|
||||
function getProcessRuleListByDoctor(pid = 0, ruleId = 0) {
|
||||
let data = {};
|
||||
data =
|
||||
ruleId === 0
|
||||
? {
|
||||
pid,
|
||||
}
|
||||
: {
|
||||
rule_id: ruleId,
|
||||
};
|
||||
getProcessRuleList(data).then((value) => {
|
||||
if (ruleId !== 0) {
|
||||
processRuleNoteList.value = value;
|
||||
} else if (pid === 0) {
|
||||
processRuleList.value = value;
|
||||
} else {
|
||||
childProcessRuleList.value = value;
|
||||
}
|
||||
});
|
||||
async function loadProcessRuleData(pid = 0, ruleId = 0) {
|
||||
const data = ruleId === 0 ? { pid } : { rule_id: ruleId };
|
||||
const value = await getProcessRuleList(data);
|
||||
if (ruleId !== 0) {
|
||||
processRuleNoteList.value = value;
|
||||
} else if (pid === 0) {
|
||||
processRuleList.value = value;
|
||||
} else {
|
||||
childProcessRuleList.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
getProcessRuleListByDoctor();
|
||||
loadProcessRuleData();
|
||||
|
||||
/**
|
||||
* 选择煎法
|
||||
@@ -1556,6 +1693,14 @@ watch(
|
||||
>
|
||||
选择常用方
|
||||
</Button>
|
||||
<Button
|
||||
type="default"
|
||||
class="ml-3"
|
||||
@click="openSaveCommonPrescriptionModal"
|
||||
>
|
||||
<SaveOutlined />
|
||||
保存常用方
|
||||
</Button>
|
||||
<RadioGroup
|
||||
v-model:value="category"
|
||||
class="ml-5"
|
||||
@@ -2160,7 +2305,7 @@ watch(
|
||||
<Modal v-model:open="showNewDrugModal" @ok="newDrugModalOk">
|
||||
要把【{{ newDrugInfo.name }}】添加到清单吗?
|
||||
</Modal>
|
||||
<Modal title="二次签名" v-model:open="doctorSecondSignModal" @ok="doctorSecondSignModalOk">
|
||||
<AntModal title="二次签名" v-model:open="doctorSecondSignModal" @ok="doctorSecondSignModalOk">
|
||||
<div class="doctor-second-sign-title">有毒:</div>
|
||||
<p v-for="item in checkData.message.poisonous || []">【{{ item }}】</p>
|
||||
<div class="doctor-second-sign-title">十八反:</div>
|
||||
@@ -2168,7 +2313,34 @@ watch(
|
||||
<div class="doctor-second-sign-title">十九畏:</div>
|
||||
<p v-for="item in checkData.message.conflict || []">【{{ item }}】</p>
|
||||
<p class="mt-5" style="color: red;">如需继续开方需要二次签名,确认要二次签名吗?</p>
|
||||
</Modal>
|
||||
</AntModal>
|
||||
|
||||
<!-- 保存常用方确认模态框 -->
|
||||
<AntModal
|
||||
v-model:open="showSaveCommonPrescriptionModal"
|
||||
title="保存为常用方"
|
||||
:confirm-loading="isSavingCommonPrescription"
|
||||
@ok="saveAsCommonPrescription"
|
||||
@cancel="cancelSaveCommonPrescription"
|
||||
>
|
||||
<div class="py-4">
|
||||
<p class="mb-4 text-gray-600">
|
||||
将当前处方({{ currentDrugs.length }}种药品)保存为常用方模板
|
||||
</p>
|
||||
<div class="flex items-center">
|
||||
<span class="mr-2 whitespace-nowrap">常用方名称:</span>
|
||||
<Input
|
||||
v-model:value="commonPrescriptionName"
|
||||
placeholder="请输入常用方名称"
|
||||
:maxlength="50"
|
||||
allow-clear
|
||||
/>
|
||||
</div>
|
||||
<p class="mt-2 text-xs text-gray-400">
|
||||
类型:{{ activeCategory === 1 ? '中药' : '西药(中成药)' }}
|
||||
</p>
|
||||
</div>
|
||||
</AntModal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -161,6 +161,16 @@ export async function saveChineseCommonPrescriptionApi(data: {
|
||||
dosage?: number;
|
||||
/** 每日次数(可选,默认2) */
|
||||
day_dosage?: number;
|
||||
/** 规则类型 1=自制剂,2=委托调剂(可选,默认1) */
|
||||
rule_type?: number;
|
||||
/** 加工规则ID(制剂,可选) */
|
||||
process_rule_id?: number;
|
||||
/** 子加工规则ID(煎法,可选) */
|
||||
child_process_rule_id?: number;
|
||||
/** 加工规则备注ID(备注,可选) */
|
||||
process_rule_note_id?: number;
|
||||
/** 包装方式ID(可选,默认2) */
|
||||
package_method_id?: number;
|
||||
}) {
|
||||
return requestClient.post<any>(
|
||||
`${commonPrescriptionPrefix}save-chinese`,
|
||||
@@ -245,6 +255,16 @@ export interface UpdateChineseCommonPrescriptionParams extends UpdateCommonPresc
|
||||
dosage?: number;
|
||||
/** 每日次数(可选) */
|
||||
day_dosage?: number;
|
||||
/** 规则类型 1=自制剂,2=委托调剂(可选) */
|
||||
rule_type?: number;
|
||||
/** 加工规则ID(制剂,可选) */
|
||||
process_rule_id?: number;
|
||||
/** 子加工规则ID(煎法,可选) */
|
||||
child_process_rule_id?: number;
|
||||
/** 加工规则备注ID(备注,可选) */
|
||||
process_rule_note_id?: number;
|
||||
/** 包装方式ID(可选) */
|
||||
package_method_id?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -51,6 +51,7 @@ import {
|
||||
import {
|
||||
getDrugUseList,
|
||||
getProductListDoctorReception,
|
||||
getProcessRuleList,
|
||||
} from '#/views/doctor/doctor-reception/api';
|
||||
|
||||
// 引入诊断和医嘱选择弹窗组件
|
||||
@@ -131,6 +132,38 @@ const dosage = ref(7);
|
||||
*/
|
||||
const dayDosage = ref(2);
|
||||
|
||||
/**
|
||||
* 规则类型:1=自制剂,2=委托调剂
|
||||
*/
|
||||
const ruleType = ref(1);
|
||||
|
||||
/**
|
||||
* 包装方式ID(自制剂时使用)
|
||||
*/
|
||||
const packageMethodId = ref(2);
|
||||
|
||||
/**
|
||||
* 加工规则ID(委托调剂时使用)
|
||||
*/
|
||||
const processRuleId = ref<number | null>(null);
|
||||
|
||||
/**
|
||||
* 子加工规则ID(委托调剂时使用)
|
||||
*/
|
||||
const childProcessRuleId = ref<number | null>(null);
|
||||
|
||||
/**
|
||||
* 加工规则备注ID(委托调剂时使用)
|
||||
*/
|
||||
const processRuleNoteId = ref<number | null>(null);
|
||||
|
||||
/**
|
||||
* 委托调剂选项列表
|
||||
*/
|
||||
const processRuleList = ref<any[]>([]);
|
||||
const childProcessRuleList = ref<any[]>([]);
|
||||
const processRuleNoteList = ref<any[]>([]);
|
||||
|
||||
/**
|
||||
* 保存成功后的回调函数
|
||||
*/
|
||||
@@ -206,11 +239,18 @@ const [Modal, modalApi] = useVbenModal({
|
||||
drugList.value = [];
|
||||
dosage.value = 7;
|
||||
dayDosage.value = 2;
|
||||
ruleType.value = 1;
|
||||
packageMethodId.value = 2;
|
||||
processRuleId.value = null;
|
||||
childProcessRuleId.value = null;
|
||||
processRuleNoteId.value = null;
|
||||
|
||||
onSaveCallback = data?.onSave || null;
|
||||
|
||||
// 加载药品使用方式数据
|
||||
loadDrugUseData();
|
||||
// 加载委托调剂选项(第一级:制剂)
|
||||
loadProcessRuleData(0, 0);
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -236,6 +276,49 @@ async function loadDrugUseData() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载委托调剂选项数据
|
||||
*/
|
||||
async function loadProcessRuleData(pid = 0, ruleId = 0) {
|
||||
try {
|
||||
const data = ruleId === 0 ? { pid } : { rule_id: ruleId };
|
||||
const res = await getProcessRuleList(data);
|
||||
if (ruleId !== 0) {
|
||||
processRuleNoteList.value = res;
|
||||
} else if (pid === 0) {
|
||||
processRuleList.value = res;
|
||||
} else {
|
||||
childProcessRuleList.value = res;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载委托调剂选项失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 制剂选择变化
|
||||
*/
|
||||
function handleProcessRuleChange(id: number) {
|
||||
childProcessRuleId.value = null;
|
||||
processRuleNoteId.value = null;
|
||||
childProcessRuleList.value = [];
|
||||
processRuleNoteList.value = [];
|
||||
if (id) {
|
||||
loadProcessRuleData(id, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 煎法选择变化
|
||||
*/
|
||||
function handleChildProcessRuleChange(id: number) {
|
||||
processRuleNoteId.value = null;
|
||||
processRuleNoteList.value = [];
|
||||
if (id) {
|
||||
loadProcessRuleData(0, id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换常用方类型
|
||||
*/
|
||||
@@ -597,6 +680,11 @@ async function handleSave() {
|
||||
category: '1',
|
||||
dosage: dosage.value,
|
||||
day_dosage: dayDosage.value,
|
||||
rule_type: ruleType.value,
|
||||
package_method_id: ruleType.value === 1 ? packageMethodId.value : undefined,
|
||||
process_rule_id: ruleType.value === 2 ? (processRuleId.value || undefined) : undefined,
|
||||
child_process_rule_id: ruleType.value === 2 ? (childProcessRuleId.value || undefined) : undefined,
|
||||
process_rule_note_id: ruleType.value === 2 ? (processRuleNoteId.value || undefined) : undefined,
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -726,6 +814,87 @@ async function handleSave() {
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<!-- 中药规则类型选择 -->
|
||||
<Row v-if="prescriptionType === 'chinese'" :gutter="16" class="mb-4">
|
||||
<Col :span="24">
|
||||
<FormItem label="调配方式">
|
||||
<RadioGroup v-model:value="ruleType" button-style="solid">
|
||||
<RadioButton :value="1">自制剂</RadioButton>
|
||||
<RadioButton :value="2">委托调剂</RadioButton>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<!-- 自制剂包法选择 -->
|
||||
<Row v-if="prescriptionType === 'chinese' && ruleType === 1" :gutter="16" class="mb-4">
|
||||
<Col :span="12">
|
||||
<FormItem label="包法">
|
||||
<Select v-model:value="packageMethodId" style="width: 100%">
|
||||
<SelectOption :value="1">袋包</SelectOption>
|
||||
<SelectOption :value="2">剂包</SelectOption>
|
||||
</Select>
|
||||
</FormItem>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<!-- 委托调剂选择 -->
|
||||
<Row v-if="prescriptionType === 'chinese' && ruleType === 2" :gutter="16" class="mb-4">
|
||||
<Col :span="8">
|
||||
<FormItem label="制剂">
|
||||
<Select
|
||||
v-model:value="processRuleId"
|
||||
placeholder="请选择制剂"
|
||||
style="width: 100%"
|
||||
@change="handleProcessRuleChange"
|
||||
>
|
||||
<SelectOption
|
||||
v-for="item in processRuleList"
|
||||
:key="item.id"
|
||||
:value="item.id"
|
||||
>
|
||||
{{ item.name }}
|
||||
</SelectOption>
|
||||
</Select>
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col :span="8">
|
||||
<FormItem label="煎法">
|
||||
<Select
|
||||
v-model:value="childProcessRuleId"
|
||||
placeholder="请选择煎法"
|
||||
style="width: 100%"
|
||||
@change="handleChildProcessRuleChange"
|
||||
>
|
||||
<SelectOption
|
||||
v-for="item in childProcessRuleList"
|
||||
:key="item.id"
|
||||
:value="item.id"
|
||||
>
|
||||
{{ item.name }}
|
||||
</SelectOption>
|
||||
</Select>
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col :span="8">
|
||||
<FormItem label="备注">
|
||||
<Select
|
||||
v-model:value="processRuleNoteId"
|
||||
placeholder="请选择备注"
|
||||
style="width: 100%"
|
||||
>
|
||||
<SelectOption
|
||||
v-for="item in processRuleNoteList"
|
||||
:key="item.id"
|
||||
:value="item.id"
|
||||
>
|
||||
{{ item.note }}
|
||||
</SelectOption>
|
||||
</Select>
|
||||
</FormItem>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<!-- 西药搜索 -->
|
||||
<FormItem v-if="prescriptionType === 'west'" label="添加药品">
|
||||
<DrugSearchSelect
|
||||
|
||||
@@ -50,6 +50,7 @@ import {
|
||||
import {
|
||||
getDrugUseList,
|
||||
getProductListDoctorReception,
|
||||
getProcessRuleList,
|
||||
} from '#/views/doctor/doctor-reception/api';
|
||||
|
||||
// 引入诊断和医嘱选择弹窗组件
|
||||
@@ -131,6 +132,38 @@ const dosage = ref(7);
|
||||
*/
|
||||
const dayDosage = ref(2);
|
||||
|
||||
/**
|
||||
* 规则类型:1=自制剂,2=委托调剂
|
||||
*/
|
||||
const ruleType = ref(1);
|
||||
|
||||
/**
|
||||
* 包装方式ID(自制剂时使用)
|
||||
*/
|
||||
const packageMethodId = ref(2);
|
||||
|
||||
/**
|
||||
* 加工规则ID(委托调剂时使用)
|
||||
*/
|
||||
const processRuleId = ref<number | null>(null);
|
||||
|
||||
/**
|
||||
* 子加工规则ID(委托调剂时使用)
|
||||
*/
|
||||
const childProcessRuleId = ref<number | null>(null);
|
||||
|
||||
/**
|
||||
* 加工规则备注ID(委托调剂时使用)
|
||||
*/
|
||||
const processRuleNoteId = ref<number | null>(null);
|
||||
|
||||
/**
|
||||
* 委托调剂选项列表
|
||||
*/
|
||||
const processRuleList = ref<any[]>([]);
|
||||
const childProcessRuleList = ref<any[]>([]);
|
||||
const processRuleNoteList = ref<any[]>([]);
|
||||
|
||||
/**
|
||||
* 保存成功后的回调函数
|
||||
*/
|
||||
@@ -205,7 +238,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
async onConfirm() {
|
||||
await handleSave();
|
||||
},
|
||||
onOpenChange(isOpen: boolean) {
|
||||
async onOpenChange(isOpen: boolean) {
|
||||
if (isOpen) {
|
||||
// 获取传入的参数
|
||||
const data = modalApi.getData<{
|
||||
@@ -231,10 +264,31 @@ const [Modal, modalApi] = useVbenModal({
|
||||
_key: Date.now() + index, // 添加唯一标识
|
||||
}));
|
||||
|
||||
// 初始化规则类型相关数据(中药)
|
||||
if (data.type === 'chinese') {
|
||||
dosage.value = data.prescription.dosage || 7;
|
||||
dayDosage.value = data.prescription.day_dosage || 2;
|
||||
ruleType.value = data.prescription.rule_type || 1;
|
||||
packageMethodId.value = data.prescription.package_method_id || 2;
|
||||
processRuleId.value = data.prescription.process_rule_id || null;
|
||||
childProcessRuleId.value = data.prescription.child_process_rule_id || null;
|
||||
processRuleNoteId.value = data.prescription.process_rule_note_id || null;
|
||||
}
|
||||
|
||||
onSaveCallback = data.onSave || null;
|
||||
|
||||
// 加载药品使用方式数据
|
||||
loadDrugUseData();
|
||||
// 加载委托调剂选项(第一级:制剂)
|
||||
await loadProcessRuleData(0, 0);
|
||||
|
||||
// 如果有已保存的委托调剂配置,需要级联加载(顺序执行)
|
||||
if (processRuleId.value) {
|
||||
await loadProcessRuleData(processRuleId.value, 0);
|
||||
}
|
||||
if (childProcessRuleId.value) {
|
||||
await loadProcessRuleData(0, childProcessRuleId.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -261,6 +315,49 @@ async function loadDrugUseData() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载委托调剂选项数据
|
||||
*/
|
||||
async function loadProcessRuleData(pid = 0, ruleId = 0) {
|
||||
try {
|
||||
const data = ruleId === 0 ? { pid } : { rule_id: ruleId };
|
||||
const res = await getProcessRuleList(data);
|
||||
if (ruleId !== 0) {
|
||||
processRuleNoteList.value = res;
|
||||
} else if (pid === 0) {
|
||||
processRuleList.value = res;
|
||||
} else {
|
||||
childProcessRuleList.value = res;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载委托调剂选项失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 制剂选择变化
|
||||
*/
|
||||
function handleProcessRuleChange(id: number) {
|
||||
childProcessRuleId.value = null;
|
||||
processRuleNoteId.value = null;
|
||||
childProcessRuleList.value = [];
|
||||
processRuleNoteList.value = [];
|
||||
if (id) {
|
||||
loadProcessRuleData(id, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 煎法选择变化
|
||||
*/
|
||||
function handleChildProcessRuleChange(id: number) {
|
||||
processRuleNoteId.value = null;
|
||||
processRuleNoteList.value = [];
|
||||
if (id) {
|
||||
loadProcessRuleData(0, id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开诊断选择弹窗
|
||||
*/
|
||||
@@ -610,6 +707,11 @@ async function handleSave() {
|
||||
drugs,
|
||||
dosage: dosage.value,
|
||||
day_dosage: dayDosage.value,
|
||||
rule_type: ruleType.value,
|
||||
package_method_id: ruleType.value === 1 ? packageMethodId.value : undefined,
|
||||
process_rule_id: ruleType.value === 2 ? (processRuleId.value || undefined) : undefined,
|
||||
child_process_rule_id: ruleType.value === 2 ? (childProcessRuleId.value || undefined) : undefined,
|
||||
process_rule_note_id: ruleType.value === 2 ? (processRuleNoteId.value || undefined) : undefined,
|
||||
});
|
||||
break;
|
||||
}
|
||||
@@ -730,6 +832,87 @@ async function handleSave() {
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<!-- 中药规则类型选择 -->
|
||||
<Row v-if="prescriptionType === 'chinese'" :gutter="16" class="mb-4">
|
||||
<Col :span="24">
|
||||
<FormItem label="调配方式">
|
||||
<RadioGroup v-model:value="ruleType" button-style="solid">
|
||||
<RadioButton :value="1">自制剂</RadioButton>
|
||||
<RadioButton :value="2">委托调剂</RadioButton>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<!-- 自制剂包法选择 -->
|
||||
<Row v-if="prescriptionType === 'chinese' && ruleType === 1" :gutter="16" class="mb-4">
|
||||
<Col :span="12">
|
||||
<FormItem label="包法">
|
||||
<Select v-model:value="packageMethodId" style="width: 100%">
|
||||
<SelectOption :value="1">袋包</SelectOption>
|
||||
<SelectOption :value="2">剂包</SelectOption>
|
||||
</Select>
|
||||
</FormItem>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<!-- 委托调剂选择 -->
|
||||
<Row v-if="prescriptionType === 'chinese' && ruleType === 2" :gutter="16" class="mb-4">
|
||||
<Col :span="8">
|
||||
<FormItem label="制剂">
|
||||
<Select
|
||||
v-model:value="processRuleId"
|
||||
placeholder="请选择制剂"
|
||||
style="width: 100%"
|
||||
@change="handleProcessRuleChange"
|
||||
>
|
||||
<SelectOption
|
||||
v-for="item in processRuleList"
|
||||
:key="item.id"
|
||||
:value="item.id"
|
||||
>
|
||||
{{ item.name }}
|
||||
</SelectOption>
|
||||
</Select>
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col :span="8">
|
||||
<FormItem label="煎法">
|
||||
<Select
|
||||
v-model:value="childProcessRuleId"
|
||||
placeholder="请选择煎法"
|
||||
style="width: 100%"
|
||||
@change="handleChildProcessRuleChange"
|
||||
>
|
||||
<SelectOption
|
||||
v-for="item in childProcessRuleList"
|
||||
:key="item.id"
|
||||
:value="item.id"
|
||||
>
|
||||
{{ item.name }}
|
||||
</SelectOption>
|
||||
</Select>
|
||||
</FormItem>
|
||||
</Col>
|
||||
<Col :span="8">
|
||||
<FormItem label="备注">
|
||||
<Select
|
||||
v-model:value="processRuleNoteId"
|
||||
placeholder="请选择备注"
|
||||
style="width: 100%"
|
||||
>
|
||||
<SelectOption
|
||||
v-for="item in processRuleNoteList"
|
||||
:key="item.id"
|
||||
:value="item.id"
|
||||
>
|
||||
{{ item.note }}
|
||||
</SelectOption>
|
||||
</Select>
|
||||
</FormItem>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<!-- 西药搜索 -->
|
||||
<FormItem v-if="prescriptionType === 'west'" label="添加药品">
|
||||
<DrugSearchSelect
|
||||
|
||||
@@ -577,9 +577,21 @@ const createDoctorOrder = () => {
|
||||
<p v-if="item.doctor_order">
|
||||
<span class="font-medium">医嘱:</span>{{ item.doctor_order }}
|
||||
</p>
|
||||
<p>
|
||||
<span class="font-medium">调配方式:</span>
|
||||
{{ item.rule_type === 1 ? '自制剂' : '委托调剂' }}
|
||||
<span class="ml-4">剂量:{{ item.dosage || 7 }}天/剂</span>
|
||||
<span class="ml-4">频次:{{ item.day_dosage || 2 }}次/天</span>
|
||||
</p>
|
||||
<p v-if="item.rule_type === 2">
|
||||
<span class="font-medium">委托调剂配置:</span>
|
||||
<span v-if="item.process_rule_name">制剂:{{ item.process_rule_name }}</span>
|
||||
<span v-if="item.child_process_rule_name" class="ml-4">煎法:{{ item.child_process_rule_name }}</span>
|
||||
<span v-if="item.process_rule_note_name" class="ml-4">备注:{{ item.process_rule_note_name }}</span>
|
||||
</p>
|
||||
<p>
|
||||
<span class="font-medium">药品:</span>
|
||||
{{ getDrugNames(commonPrescriptionData.chinese[index], 'name') }}
|
||||
{{ getDrugNames(commonPrescriptionData.chinese[index], 'drug_name') }}
|
||||
</p>
|
||||
<div class="mt-4 flex justify-end gap-2">
|
||||
<Button
|
||||
|
||||
@@ -60,6 +60,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
medical_device_license_image: values.medical_device_license_image || '',
|
||||
food_license_image: values.food_license_image || '',
|
||||
pharmacist_certificate_image: values.pharmacist_certificate_image || '',
|
||||
internet_drug_license_image: values.internet_drug_license_image || '',
|
||||
sort_order: values.sort_order ?? 0,
|
||||
status: values.status ?? 1,
|
||||
store_id: values.store_id ?? null,
|
||||
@@ -76,6 +77,7 @@ const [Modal, modalApi] = useVbenModal({
|
||||
medical_device_license_image: '',
|
||||
food_license_image: '',
|
||||
pharmacist_certificate_image: '',
|
||||
internet_drug_license_image: '',
|
||||
sort_order: 0,
|
||||
status: 1,
|
||||
store_id: null,
|
||||
|
||||
@@ -53,6 +53,12 @@ export const modalFormProps: VbenFormProps = {
|
||||
label: '药师资格证',
|
||||
formItemClass: 'col-span-4',
|
||||
},
|
||||
{
|
||||
component: 'Avatar',
|
||||
fieldName: 'internet_drug_license_image',
|
||||
label: '互联网药品经营许可证',
|
||||
formItemClass: 'col-span-4',
|
||||
},
|
||||
{
|
||||
component: 'InputNumber',
|
||||
componentProps: {
|
||||
|
||||
@@ -9,6 +9,7 @@ interface RowType {
|
||||
medical_device_license_image: string;
|
||||
food_license_image: string;
|
||||
pharmacist_certificate_image: string;
|
||||
internet_drug_license_image: string;
|
||||
store_id: number | null;
|
||||
sort_order: number;
|
||||
status: number;
|
||||
@@ -66,6 +67,13 @@ export const gridOptions: VxeGridProps<RowType> = {
|
||||
slots: { default: 'pharmacist_certificate_image' },
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
field: 'internet_drug_license_image',
|
||||
align: 'left',
|
||||
title: '互联网药品经营许可证',
|
||||
slots: { default: 'internet_drug_license_image' },
|
||||
width: 180,
|
||||
},
|
||||
{ field: 'store_id', align: 'left', title: '门店ID', width: 120 },
|
||||
{ field: 'sort_order', align: 'left', title: '排序', width: 100 },
|
||||
{
|
||||
|
||||
@@ -196,6 +196,17 @@ const deleteQualificationsApi = (row: any) => {
|
||||
/>
|
||||
<span v-else>暂无</span>
|
||||
</template>
|
||||
<template #internet_drug_license_image="{ row }">
|
||||
<Image
|
||||
v-if="row.internet_drug_license_image"
|
||||
:src="row.internet_drug_license_image"
|
||||
height="30"
|
||||
width="30"
|
||||
:preview="{ src: row.internet_drug_license_image }"
|
||||
style="cursor: pointer;"
|
||||
/>
|
||||
<span v-else>暂无</span>
|
||||
</template>
|
||||
<template #toolbar-tools></template>
|
||||
<template #action="{ row }">
|
||||
<TableAction
|
||||
|
||||
Reference in New Issue
Block a user