|
|
@@ -1,7 +1,15 @@
|
|
|
<template>
|
|
|
- <el-dialog title="医生开方" :visible.sync="dialogVisible" width="95%" top="5vh" :close-on-click-modal="false" @close="handleClose" append-to-body>
|
|
|
- <!-- 步骤导航,带类型提示 -->
|
|
|
- <el-steps :active="activeStep" finish-status="success" align-center style="margin-bottom: 30px;">
|
|
|
+ <el-dialog
|
|
|
+ :title="dialogTitle"
|
|
|
+ :visible.sync="dialogVisible"
|
|
|
+ width="95%"
|
|
|
+ top="5vh"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ @close="handleClose"
|
|
|
+ append-to-body
|
|
|
+ >
|
|
|
+ <!-- 步骤导航(仅编辑模式显示) -->
|
|
|
+ <el-steps v-if="!readonly" :active="activeStep" finish-status="success" align-center style="margin-bottom: 30px;">
|
|
|
<el-step title="选择处方类型" />
|
|
|
<el-step title="填写处方内容">
|
|
|
<template slot="title" v-if="isCombined && activeStep === 1">
|
|
|
@@ -15,8 +23,8 @@
|
|
|
</el-step>
|
|
|
</el-steps>
|
|
|
|
|
|
- <!-- 步骤1:选择处方类型 -->
|
|
|
- <div v-show="activeStep === 0">
|
|
|
+ <!-- 步骤1:选择处方类型(仅编辑模式显示) -->
|
|
|
+ <div v-if="!readonly && activeStep === 0">
|
|
|
<el-form label-width="120px">
|
|
|
<el-form-item label="处方类型" required>
|
|
|
<el-radio-group v-model="selectedPrescribeType" @change="onPrescribeTypeChange">
|
|
|
@@ -26,12 +34,17 @@
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
+ <!-- 新增红色提示文字 -->
|
|
|
+ <div style="color: #f56c6c; font-size: 12px; margin-top: 8px; text-align: center;">
|
|
|
+ 处方类型选择后不可修改,请谨慎选择!
|
|
|
+ </div>
|
|
|
</div>
|
|
|
|
|
|
<!-- 步骤2:处方内容(基本信息 + 药品信息) -->
|
|
|
- <div v-show="activeStep === 1">
|
|
|
+ <!-- 编辑模式:按步骤显示;只读模式:直接显示所有内容(无步骤按钮) -->
|
|
|
+ <div v-if="!readonly && activeStep === 1">
|
|
|
<el-tabs v-model="activeTab" type="border-card">
|
|
|
- <!-- 2.1 基本信息 -->
|
|
|
+ <!-- 基本信息 -->
|
|
|
<el-tab-pane label="基本信息" name="basic">
|
|
|
<el-form ref="basicForm" :model="prescribeForm" :rules="basicRules" label-width="120px">
|
|
|
<el-row :gutter="20">
|
|
|
@@ -70,7 +83,7 @@
|
|
|
</el-form>
|
|
|
</el-tab-pane>
|
|
|
|
|
|
- <!-- 2.2 处方药品信息 -->
|
|
|
+ <!-- 处方药品信息 -->
|
|
|
<el-tab-pane label="处方药品信息" name="drug">
|
|
|
<div class="drug-split-layout">
|
|
|
<div class="drug-left-panel">
|
|
|
@@ -136,8 +149,8 @@
|
|
|
</el-tabs>
|
|
|
</div>
|
|
|
|
|
|
- <!-- 步骤3(组合处方专用:中药处方) -->
|
|
|
- <div v-show="activeStep === 2 && isCombined">
|
|
|
+ <!-- 步骤3(组合处方专用:中药处方) - 仅编辑模式显示 -->
|
|
|
+ <div v-if="!readonly && activeStep === 2 && isCombined">
|
|
|
<el-tabs v-model="secondActiveTab" type="border-card">
|
|
|
<el-tab-pane label="中药处方" name="drugSecond">
|
|
|
<div class="drug-split-layout">
|
|
|
@@ -197,17 +210,126 @@
|
|
|
</el-tabs>
|
|
|
</div>
|
|
|
|
|
|
+ <!-- 只读模式:直接展示所有内容(无步骤导航) -->
|
|
|
+ <div v-if="readonly" class="readonly-content">
|
|
|
+ <el-tabs v-model="activeTab" type="border-card">
|
|
|
+ <el-tab-pane label="基本信息" name="basic">
|
|
|
+ <el-form label-width="120px">
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="8"><el-form-item label="患者姓名">{{ prescribeForm.patientName }}</el-form-item></el-col>
|
|
|
+ <el-col :span="8"><el-form-item label="患者年龄">{{ prescribeForm.patientAge }}岁</el-form-item></el-col>
|
|
|
+ <el-col :span="8"><el-form-item label="患者性别">{{ patientGenderText }}</el-form-item></el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="12"><el-form-item label="是否有过敏史">{{ prescribeForm.isHistoryAllergic }}</el-form-item></el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-form-item label="过敏史" v-if="prescribeForm.isHistoryAllergic === '是'">
|
|
|
+ {{ prescribeForm.historyAllergic }}
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="处方药品信息" name="drug">
|
|
|
+ <div class="drug-split-layout">
|
|
|
+ <div class="drug-left-panel">
|
|
|
+ <el-form label-width="80px">
|
|
|
+ <el-form-item label="诊断">{{ prescribeForm.diagnose }}</el-form-item>
|
|
|
+ <el-form-item label="医嘱">{{ prescribeForm.remark }}</el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <el-table :data="currentDrugList" border stripe max-height="400">
|
|
|
+ <el-table-column label="药品名称" prop="drugName" />
|
|
|
+ <el-table-column label="规格" prop="drugSpec" width="100" />
|
|
|
+ <el-table-column label="使用方法" prop="usageMethod" width="100" />
|
|
|
+ <el-table-column label="频次" prop="usageFrequencyUnit" width="80" />
|
|
|
+ <el-table-column label="每次用量" prop="usagePerUseCount" width="100" />
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ <div class="drug-right-panel">
|
|
|
+ <!-- 处方图片展示 -->
|
|
|
+ <div class="prescription-scroll-wrapper">
|
|
|
+ <div v-if="prescribeForm.prescribeImgUrl" class="real-prescription-wrapper">
|
|
|
+ <img :src="prescribeForm.prescribeImgUrl" class="prescription-image" alt="处方图片" />
|
|
|
+ </div>
|
|
|
+ <div v-else class="prescription-preview-container">
|
|
|
+ <img src="/ysy_prescribe.jpg" class="prescription-bg-image" alt="处方背景" />
|
|
|
+ <div class="prescription-overlay">
|
|
|
+ <div class="prescribe-code">{{ prescribeForm.prescribeCode }}</div>
|
|
|
+ <div class="patient-info">
|
|
|
+ <div class="prescribe-patientName">{{ prescribeForm.patientName }}</div>
|
|
|
+ <div class="prescribe-patientGender">{{ patientGenderText }}</div>
|
|
|
+ <div class="prescribe-patientAge">{{ prescribeForm.patientAge }}岁</div>
|
|
|
+ </div>
|
|
|
+ <div class="diagnose">{{ prescribeForm.diagnose }}</div>
|
|
|
+ <div class="drugs">
|
|
|
+ <div v-for="(drug, idx) in currentDrugList" :key="idx" class="drug-item">
|
|
|
+ {{ drug.drugName }} {{ drug.drugSpec }}
|
|
|
+ <span class="usage">用法:{{ drug.usageMethod }} {{ drug.usageFrequencyUnit }} {{ drug.usagePerUseCount }}{{ drug.usagePerUseUnit || '' }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="remark">{{ prescribeForm.remark }}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ <!-- 如果是组合处方,单独显示中药部分 -->
|
|
|
+ <el-tab-pane v-if="isCombined" label="中药处方" name="drugSecondReadonly">
|
|
|
+ <div class="drug-split-layout">
|
|
|
+ <div class="drug-left-panel">
|
|
|
+ <el-form label-width="80px">
|
|
|
+ <el-form-item label="诊断">{{ prescribeForm.diagnose }}</el-form-item>
|
|
|
+ <el-form-item label="医嘱">{{ prescribeForm.remark }}</el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <el-table :data="secondDrugList" border stripe max-height="400">
|
|
|
+ <el-table-column label="药品名称" prop="drugName" />
|
|
|
+ <el-table-column label="规格" prop="drugSpec" />
|
|
|
+ <el-table-column label="使用方法" prop="usageMethod" />
|
|
|
+ <el-table-column label="频次" prop="usageFrequencyUnit" />
|
|
|
+ <el-table-column label="每次用量" prop="usagePerUseCount" />
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ <div class="drug-right-panel">
|
|
|
+ <div class="prescription-scroll-wrapper">
|
|
|
+ <div class="prescription-preview-container">
|
|
|
+ <img :src="prescribeForm.prescribeImgStoreUrl || '/ysy_prescribe.jpg'" class="prescription-bg-image" alt="处方背景" />
|
|
|
+ <div class="prescription-overlay">
|
|
|
+ <div class="prescribe-code">{{ prescribeForm.prescribeCode }}</div>
|
|
|
+ <div class="patient-info">
|
|
|
+ <div class="prescribe-patientName">{{ prescribeForm.patientName }}</div>
|
|
|
+ <div class="prescribe-patientGender">{{ patientGenderText }}</div>
|
|
|
+ <div class="prescribe-patientAge">{{ prescribeForm.patientAge }}岁</div>
|
|
|
+ </div>
|
|
|
+ <div class="diagnose">{{ prescribeForm.diagnose }}</div>
|
|
|
+ <div class="drugs">
|
|
|
+ <div v-for="(drug, idx) in secondDrugList" :key="idx" class="drug-item">
|
|
|
+ {{ drug.drugName }} {{ drug.drugSpec }}
|
|
|
+ <span class="usage">用法:{{ drug.usageMethod }} {{ drug.usageFrequencyUnit }} {{ drug.usagePerUseCount }}{{ drug.usagePerUseUnit || '' }}</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="remark">{{ prescribeForm.remark }}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ </div>
|
|
|
+
|
|
|
<!-- 底部按钮 -->
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="dialogVisible = false">取消</el-button>
|
|
|
- <el-button v-if="activeStep === 0" type="primary" @click="nextStep" :disabled="!selectedPrescribeType">下一步</el-button>
|
|
|
- <el-button v-if="activeStep === 1 && isCombined" type="primary" @click="goToSecondPart" :loading="submitLoading">下一步</el-button>
|
|
|
- <el-button v-if="activeStep === 1 && !isCombined" type="primary" @click="submitCurrentPart" :loading="submitLoading">确认处方</el-button>
|
|
|
- <el-button v-if="activeStep === 2 && isCombined" type="primary" @click="submitSecondPart" :loading="submitLoading">确认中药处方</el-button>
|
|
|
- <el-button v-if="activeStep > 0" @click="prevStep">上一步</el-button>
|
|
|
+ <el-button @click="dialogVisible = false">关闭</el-button>
|
|
|
+ <!-- 编辑模式下的操作按钮 -->
|
|
|
+ <template v-if="!readonly">
|
|
|
+ <el-button v-if="activeStep === 0" type="primary" @click="nextStep" :disabled="!selectedPrescribeType">下一步</el-button>
|
|
|
+ <el-button v-if="activeStep === 1 && isCombined" type="primary" @click="goToSecondPart" :loading="submitLoading">下一步</el-button>
|
|
|
+ <el-button v-if="activeStep === 1 && !isCombined" type="primary" @click="submitCurrentPart" :loading="submitLoading">确认处方</el-button>
|
|
|
+ <el-button v-if="activeStep === 2 && isCombined" type="primary" @click="submitSecondPart" :loading="submitLoading">确认中药处方</el-button>
|
|
|
+ <el-button v-if="activeStep > 0" @click="prevStep">上一步</el-button>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
|
|
|
- <!-- 药品新增/编辑对话框 -->
|
|
|
+ <!-- 药品新增/编辑对话框(只读模式下不会弹出,因为按钮已隐藏,可保留) -->
|
|
|
<el-dialog :title="drugDialogTitle" :visible.sync="drugDialogVisible" width="600px" append-to-body>
|
|
|
<el-form ref="drugFormRef" :model="currentDrug" label-width="120px">
|
|
|
<el-form-item label="药品名称" prop="drugName"><el-input v-model="currentDrug.drugName" /></el-form-item>
|
|
|
@@ -256,7 +378,7 @@
|
|
|
|
|
|
<script>
|
|
|
import { getPrescribeScrmDetail, submitBasicInfo, submitPrescribeScrm } from "@/api/his/scrmPrescribe";
|
|
|
-import { listScrmPrescribeDrug,addScrmPrescribeDrug,updateScrmPrescribeDrug,deleteScrmPrescribeDrug } from "@/api/his/scrmPrescribeDrug";
|
|
|
+import { listScrmPrescribeDrug, addScrmPrescribeDrug, updateScrmPrescribeDrug, deleteScrmPrescribeDrug } from "@/api/his/scrmPrescribeDrug";
|
|
|
import { getCommonDrugList } from "@/api/commonlyDrug";
|
|
|
import { getCommonDiagnoseList } from '@/api/commonlyDiagnose';
|
|
|
|
|
|
@@ -266,7 +388,8 @@ export default {
|
|
|
visible: Boolean,
|
|
|
prescribeId: Number,
|
|
|
doctorId: Number,
|
|
|
- drugDoctorId: Number
|
|
|
+ drugDoctorId: Number,
|
|
|
+ readonly: { type: Boolean, default: false }
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -331,6 +454,9 @@ export default {
|
|
|
},
|
|
|
currentDrugList() {
|
|
|
return this.drugList;
|
|
|
+ },
|
|
|
+ dialogTitle() {
|
|
|
+ return this.readonly ? "查看处方" : "医生开方";
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -368,7 +494,8 @@ export default {
|
|
|
if (data.prescribeType) {
|
|
|
this.selectedPrescribeType = data.prescribeType;
|
|
|
this.isCombined = (this.selectedPrescribeType === 3);
|
|
|
- this.activeStep = 1;
|
|
|
+ // 只读模式下不需要步骤,直接加载数据即可
|
|
|
+ this.activeStep = this.readonly ? 1 : 1; // 只读模式也设置 activeStep 以便展示内容
|
|
|
this.loadDrugsForCurrentPart();
|
|
|
}
|
|
|
} catch (error) {
|
|
|
@@ -376,21 +503,13 @@ export default {
|
|
|
this.$message.error('获取处方信息失败');
|
|
|
}
|
|
|
},
|
|
|
- // 获取当前步骤对应的药品类型(1:西药, 2:中药)
|
|
|
getCurrentDrugType() {
|
|
|
- if (this.commonDrugForSecond) {
|
|
|
- return 2; // 组合处方的第二部分(中药)
|
|
|
- }
|
|
|
- if (this.isCombined && !this.secondPartActive && this.activeStep === 1) {
|
|
|
- return 1; // 组合处方第一步(西药)
|
|
|
- }
|
|
|
- if (this.isCombined && this.secondPartActive && this.activeStep === 2) {
|
|
|
- return 2; // 组合处方第二步(中药)
|
|
|
- }
|
|
|
- // 非组合处方
|
|
|
+ if (this.commonDrugForSecond) return 2;
|
|
|
+ if (this.isCombined && !this.secondPartActive && this.activeStep === 1) return 1;
|
|
|
+ if (this.isCombined && this.secondPartActive && this.activeStep === 2) return 2;
|
|
|
if (this.selectedPrescribeType === 1) return 1;
|
|
|
if (this.selectedPrescribeType === 2) return 2;
|
|
|
- return 1; // 默认西药
|
|
|
+ return 1;
|
|
|
},
|
|
|
onPrescribeTypeChange(val) {
|
|
|
this.isCombined = (val === 3);
|
|
|
@@ -425,25 +544,17 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
getDrugList() {
|
|
|
- // 确定当前要查询的药品类型
|
|
|
let drugType = null;
|
|
|
- if (this.isCombined && !this.secondPartActive) {
|
|
|
- drugType = 1; // 组合处方第一步,西药
|
|
|
- } else if (this.selectedPrescribeType === 1) {
|
|
|
- drugType = 1;
|
|
|
- } else if (this.selectedPrescribeType === 2) {
|
|
|
- drugType = 2;
|
|
|
- } else {
|
|
|
- drugType = this.selectedPrescribeType;
|
|
|
- }
|
|
|
+ if (this.isCombined && !this.secondPartActive) drugType = 1;
|
|
|
+ else if (this.selectedPrescribeType === 1) drugType = 1;
|
|
|
+ else if (this.selectedPrescribeType === 2) drugType = 2;
|
|
|
+ else drugType = this.selectedPrescribeType;
|
|
|
this.drugQuery.prescribeId = this.prescribeId;
|
|
|
this.drugQuery.drugType = drugType;
|
|
|
listScrmPrescribeDrug(this.drugQuery).then(res => {
|
|
|
this.drugList = res.rows || [];
|
|
|
this.drugTotal = res.total || 0;
|
|
|
- }).catch(() => {
|
|
|
- this.$message.error('获取药品列表失败');
|
|
|
- });
|
|
|
+ }).catch(() => this.$message.error('获取药品列表失败'));
|
|
|
},
|
|
|
getSecondDrugList() {
|
|
|
this.secondDrugQuery.prescribeId = this.prescribeId;
|
|
|
@@ -451,14 +562,19 @@ export default {
|
|
|
listScrmPrescribeDrug(this.secondDrugQuery).then(res => {
|
|
|
this.secondDrugList = res.rows || [];
|
|
|
this.secondDrugTotal = res.total || 0;
|
|
|
- }).catch(() => {
|
|
|
- this.$message.error('获取中药列表失败');
|
|
|
- });
|
|
|
+ }).catch(() => this.$message.error('获取中药列表失败'));
|
|
|
},
|
|
|
async goToSecondPart() {
|
|
|
let valid = true;
|
|
|
await this.$refs.basicForm.validate().catch(() => valid = false);
|
|
|
- await this.$refs.drugForm.validate().catch(() => valid = false);
|
|
|
+ await this.$refs.drugForm.validate().catch((errors) => {
|
|
|
+ valid = false;
|
|
|
+ if (errors && errors[0] && errors[0].message) {
|
|
|
+ this.$message.warning(errors[0].message);
|
|
|
+ } else {
|
|
|
+ this.$message.warning('请完整填写表单信息');
|
|
|
+ }
|
|
|
+ });
|
|
|
if (!valid) return;
|
|
|
if (this.drugList.length === 0) {
|
|
|
this.$message.warning('请至少添加一种西药药品');
|
|
|
@@ -499,9 +615,7 @@ export default {
|
|
|
deleteScrmPrescribeDrug(row.drugId).then(() => {
|
|
|
this.$message.success('删除成功');
|
|
|
this.getDrugList();
|
|
|
- }).catch(() => {
|
|
|
- this.$message.error('删除失败');
|
|
|
- });
|
|
|
+ }).catch(() => this.$message.error('删除失败'));
|
|
|
});
|
|
|
},
|
|
|
saveDrug() {
|
|
|
@@ -514,14 +628,9 @@ export default {
|
|
|
request.then(() => {
|
|
|
this.$message.success('保存成功');
|
|
|
this.drugDialogVisible = false;
|
|
|
- if (!this.isEditingSecond) {
|
|
|
- this.getDrugList();
|
|
|
- } else {
|
|
|
- this.getSecondDrugList();
|
|
|
- }
|
|
|
- }).catch(() => {
|
|
|
- this.$message.error('保存失败');
|
|
|
- });
|
|
|
+ if (!this.isEditingSecond) this.getDrugList();
|
|
|
+ else this.getSecondDrugList();
|
|
|
+ }).catch(() => this.$message.error('保存失败'));
|
|
|
},
|
|
|
handleAddDrugSecond() {
|
|
|
this.isEditingSecond = true;
|
|
|
@@ -540,9 +649,7 @@ export default {
|
|
|
deleteScrmPrescribeDrug(row.drugId).then(() => {
|
|
|
this.$message.success('删除成功');
|
|
|
this.getSecondDrugList();
|
|
|
- }).catch(() => {
|
|
|
- this.$message.error('删除失败');
|
|
|
- });
|
|
|
+ }).catch(() => this.$message.error('删除失败'));
|
|
|
});
|
|
|
},
|
|
|
openCommonDiagnose() {
|
|
|
@@ -583,7 +690,6 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
applyCommonDrug(drug) {
|
|
|
- // 明确当前药品类型
|
|
|
const drugType = this.getCurrentDrugType();
|
|
|
const newDrug = {
|
|
|
drugName: drug.drugName,
|
|
|
@@ -597,7 +703,6 @@ export default {
|
|
|
};
|
|
|
addScrmPrescribeDrug(newDrug).then(() => {
|
|
|
this.$message.success('添加成功');
|
|
|
- // 添加成功后重置分页为第一页并刷新对应列表
|
|
|
if (!this.commonDrugForSecond) {
|
|
|
this.drugQuery.pageNum = 1;
|
|
|
this.getDrugList();
|
|
|
@@ -606,7 +711,7 @@ export default {
|
|
|
this.getSecondDrugList();
|
|
|
}
|
|
|
this.commonDrugDialogVisible = false;
|
|
|
- }).catch((error) => {
|
|
|
+ }).catch(error => {
|
|
|
console.error('添加常用药品失败', error);
|
|
|
this.$message.error('添加药品失败,请重试');
|
|
|
});
|