<template>
|
<div class="patient-medication-management">
|
<el-row :gutter="20">
|
<el-col :span="24" :xs="24">
|
<!-- 搜索区域 -->
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
|
<el-form-item label="患者姓名" prop="patientName">
|
<el-input
|
v-model="queryParams.patientName"
|
placeholder="请输入患者姓名"
|
clearable
|
style="width: 200px"
|
@keyup.enter.native="handleQuery"
|
/>
|
</el-form-item>
|
<el-form-item label="药品名称" prop="drugName">
|
<el-input
|
v-model="queryParams.drugName"
|
placeholder="请输入药品名称"
|
clearable
|
style="width: 200px"
|
@keyup.enter.native="handleQuery"
|
/>
|
</el-form-item>
|
<el-form-item label="用药状态" prop="medicationStatus">
|
<el-select v-model="queryParams.medicationStatus" placeholder="请选择状态" clearable style="width: 200px">
|
<el-option
|
v-for="item in statusOptions"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value"
|
/>
|
</el-select>
|
</el-form-item>
|
<el-form-item>
|
<el-button type="primary" icon="el-icon-search" size="medium" @click="handleQuery">搜索</el-button>
|
<el-button icon="el-icon-refresh" size="medium" @click="resetQuery">重置</el-button>
|
</el-form-item>
|
</el-form>
|
|
<!-- 操作按钮区域 -->
|
<el-row :gutter="10" class="mb8">
|
<el-col :span="1.5">
|
<el-button
|
type="primary"
|
plain
|
icon="el-icon-plus"
|
size="medium"
|
@click="handleAssignMedication"
|
>分配用药</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button
|
type="warning"
|
plain
|
icon="el-icon-close"
|
size="medium"
|
:disabled="multiple"
|
@click="handleStopMedication"
|
>停止用药</el-button>
|
</el-col>
|
<el-col :span="1.5">
|
<el-button
|
type="danger"
|
plain
|
icon="el-icon-delete"
|
size="medium"
|
:disabled="multiple"
|
@click="handleDelete"
|
>删除记录</el-button>
|
</el-col>
|
</el-row>
|
|
<!-- 数据表格 -->
|
<el-table v-loading="loading" :data="medicationList" @selection-change="handleSelectionChange">
|
<el-table-column type="selection" width="50" align="center" />
|
<el-table-column label="记录ID" align="center" prop="id" width="80" />
|
<el-table-column label="患者信息" align="center" width="200">
|
<template slot-scope="scope">
|
<div class="patient-info">
|
<div class="patient-name">{{ scope.row.patientName }}</div>
|
<div class="patient-details">
|
{{ scope.row.patientAge }}岁 / {{ scope.row.patientGender === '1' ? '男' : '女' }} / {{ scope.row.patientNo }}
|
</div>
|
</div>
|
</template>
|
</el-table-column>
|
<el-table-column label="过敏信息" align="center" width="120">
|
<template slot-scope="scope">
|
<el-tag
|
v-if="scope.row.allergyHistory"
|
type="danger"
|
size="small"
|
@click="showAllergyDetail(scope.row)"
|
>有过敏史</el-tag>
|
<span v-else class="no-allergy">无</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="药品信息" align="center" min-width="200">
|
<template slot-scope="scope">
|
<div class="drug-info">
|
<div class="drug-name">{{ scope.row.drugName }} ({{ scope.row.drugSpecification }})</div>
|
<div class="dosage-info">{{ scope.row.dosage }} {{ scope.row.dosageUnit }} / 次</div>
|
</div>
|
</template>
|
</el-table-column>
|
<el-table-column label="用法用量" align="center" width="150">
|
<template slot-scope="scope">
|
<div class="usage-info">
|
<div>{{ scope.row.frequency }}次/日</div>
|
<div>{{ scope.row.usageMethod }}</div>
|
</div>
|
</template>
|
</el-table-column>
|
<el-table-column label="用药时间" align="center" width="200">
|
<template slot-scope="scope">
|
<div class="time-info">
|
<div>开始: {{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</div>
|
<div v-if="scope.row.endTime">结束: {{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</div>
|
<div v-else>长期用药</div>
|
</div>
|
</template>
|
</el-table-column>
|
<el-table-column label="用药状态" align="center" width="100">
|
<template slot-scope="scope">
|
<el-tag
|
:type="getStatusTagType(scope.row.medicationStatus)"
|
size="small"
|
>
|
{{ getStatusText(scope.row.medicationStatus) }}
|
</el-tag>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作医生" align="center" width="120" prop="prescribingDoctor" />
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
|
<template slot-scope="scope">
|
<el-button
|
size="mini"
|
type="text"
|
icon="el-icon-edit"
|
@click="handleUpdate(scope.row)"
|
>修改</el-button>
|
<el-button
|
size="mini"
|
type="text"
|
icon="el-icon-close"
|
:class="{ 'stop-button': scope.row.medicationStatus === '1' }"
|
@click="handleSingleStop(scope.row)"
|
:disabled="scope.row.medicationStatus === '0'"
|
>{{ scope.row.medicationStatus === '1' ? '停止' : '已停止' }}</el-button>
|
<el-button
|
size="mini"
|
type="text"
|
icon="el-icon-view"
|
@click="handleViewDetail(scope.row)"
|
>详情</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
|
<pagination
|
v-show="total>0"
|
:total="total"
|
:page.sync="queryParams.pageNum"
|
:limit.sync="queryParams.pageSize"
|
@pagination="getList"
|
/>
|
</el-col>
|
</el-row>
|
|
<!-- 分配用药对话框 -->
|
<el-dialog :title="assignTitle" :visible.sync="assignOpen" width="900px" append-to-body>
|
<el-form ref="assignForm" :model="assignForm" :rules="assignRules" label-width="100px">
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="选择患者" prop="patientId">
|
<el-select
|
v-model="assignForm.patientId"
|
placeholder="请选择患者"
|
filterable
|
@change="handlePatientChange"
|
style="width: 100%"
|
>
|
<el-option
|
v-for="patient in patientOptions"
|
:key="patient.id"
|
:label="`${patient.name} (${patient.patientNo})`"
|
:value="patient.id"
|
/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="患者信息">
|
<div v-if="selectedPatient" class="patient-detail">
|
<div>姓名: {{ selectedPatient.name }}</div>
|
<div>年龄: {{ selectedPatient.age }}岁</div>
|
<div>病历号: {{ selectedPatient.patientNo }}</div>
|
<div v-if="selectedPatient.allergyHistory" class="allergy-warning">
|
过敏史: {{ selectedPatient.allergyHistory }}
|
</div>
|
</div>
|
<span v-else class="placeholder">请先选择患者</span>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="药品名称" prop="drugId">
|
<el-select
|
v-model="assignForm.drugId"
|
placeholder="请选择药品"
|
filterable
|
@change="handleDrugChange"
|
style="width: 100%"
|
>
|
<el-option
|
v-for="drug in drugOptions"
|
:key="drug.id"
|
:label="drug.name"
|
:value="drug.id"
|
>
|
<span>{{ drug.name }}</span>
|
<span style="float: right; color: #8492a6; font-size: 13px">
|
{{ drug.specification }} | 库存: {{ drug.stock }}
|
</span>
|
</el-option>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="药品规格">
|
<el-input v-model="selectedDrug.specification" readonly />
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20">
|
<el-col :span="8">
|
<el-form-item label="单次剂量" prop="dosage">
|
<el-input-number
|
v-model="assignForm.dosage"
|
:min="0.1"
|
:max="10"
|
:step="0.1"
|
controls-position="right"
|
style="width: 100%"
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="剂量单位" prop="dosageUnit">
|
<el-select v-model="assignForm.dosageUnit" style="width: 100%">
|
<el-option label="片" value="片" />
|
<el-option label="粒" value="粒" />
|
<el-option label="mg" value="mg" />
|
<el-option label="ml" value="ml" />
|
<el-option label="g" value="g" />
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="8">
|
<el-form-item label="用药频次" prop="frequency">
|
<el-select v-model="assignForm.frequency" style="width: 100%">
|
<el-option label="每日1次" value="1" />
|
<el-option label="每日2次" value="2" />
|
<el-option label="每日3次" value="3" />
|
<el-option label="每日4次" value="4" />
|
<el-option label="按需服用" value="0" />
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20">
|
<el-col :span="12">
|
<el-form-item label="用药方法" prop="usageMethod">
|
<el-select v-model="assignForm.usageMethod" style="width: 100%">
|
<el-option label="口服" value="口服" />
|
<el-option label="静脉注射" value="静脉注射" />
|
<el-option label="肌肉注射" value="肌肉注射" />
|
<el-option label="皮下注射" value="皮下注射" />
|
<el-option label="外用" value="外用" />
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="用药时间" prop="durationType">
|
<el-radio-group v-model="assignForm.durationType">
|
<el-radio label="1">长期用药</el-radio>
|
<el-radio label="2">指定周期</el-radio>
|
</el-radio-group>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<el-row :gutter="20" v-if="assignForm.durationType === '2'">
|
<el-col :span="12">
|
<el-form-item label="开始时间" prop="startTime">
|
<el-date-picker
|
v-model="assignForm.startTime"
|
type="datetime"
|
placeholder="选择开始时间"
|
style="width: 100%"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
/>
|
</el-form-item>
|
</el-col>
|
<el-col :span="12">
|
<el-form-item label="结束时间" prop="endTime">
|
<el-date-picker
|
v-model="assignForm.endTime"
|
type="datetime"
|
placeholder="选择结束时间"
|
style="width: 100%"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
|
<el-form-item label="用药说明" prop="instructions">
|
<el-input
|
type="textarea"
|
:rows="3"
|
v-model="assignForm.instructions"
|
placeholder="请输入用药注意事项、特殊说明等"
|
/>
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button type="primary" @click="submitAssignForm">确 定</el-button>
|
<el-button @click="cancelAssign">取 消</el-button>
|
</div>
|
</el-dialog>
|
|
<!-- 停止用药对话框 -->
|
<el-dialog :title="stopTitle" :visible.sync="stopOpen" width="600px" append-to-body>
|
<el-form ref="stopForm" :model="stopForm" :rules="stopRules" label-width="100px">
|
<el-form-item label="停止原因" prop="stopReason">
|
<el-select v-model="stopForm.stopReason" placeholder="请选择停止原因" style="width: 100%">
|
<el-option label="疗程结束" value="疗程结束" />
|
<el-option label="不良反应" value="不良反应" />
|
<el-option label="疗效不佳" value="疗效不佳" />
|
<el-option label="患者要求" value="患者要求" />
|
<el-option label="医生建议" value="医生建议" />
|
<el-option label="其他原因" value="其他" />
|
</el-select>
|
</el-form-item>
|
|
<el-form-item label="详细说明" prop="stopDescription">
|
<el-input
|
type="textarea"
|
:rows="4"
|
v-model="stopForm.stopDescription"
|
placeholder="请详细说明停止用药的原因和情况"
|
/>
|
</el-form-item>
|
|
<el-form-item label="停止时间" prop="stopTime">
|
<el-date-picker
|
v-model="stopForm.stopTime"
|
type="datetime"
|
placeholder="选择停止时间"
|
style="width: 100%"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
/>
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button type="primary" @click="submitStopForm">确 定</el-button>
|
<el-button @click="cancelStop">取 消</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import { parseTime } from '@/utils/ruoyi'
|
|
export default {
|
name: "PatientMedicationManagement",
|
dicts: ['sys_normal_disable'],
|
data() {
|
return {
|
// 遮罩层
|
loading: false,
|
// 选中数组
|
ids: [],
|
// 非单个禁用
|
single: true,
|
// 非多个禁用
|
multiple: true,
|
// 显示搜索条件
|
showSearch: true,
|
// 总条数
|
total: 0,
|
// 用药记录数据
|
medicationList: [
|
{
|
id: 1,
|
patientId: 'P1001',
|
patientName: '张清扬',
|
patientAge: 65,
|
patientGender: '1',
|
patientNo: '20241209001',
|
allergyHistory: '青霉素过敏',
|
drugId: 'D1001',
|
drugName: '阿司匹林肠溶片',
|
drugSpecification: '100mg*30片/盒',
|
dosage: 1,
|
dosageUnit: '片',
|
frequency: '1',
|
usageMethod: '口服',
|
startTime: '2024-12-01 08:00:00',
|
endTime: '',
|
durationType: '1',
|
instructions: '饭后服用,注意胃肠道反应。长期服用需定期检查血常规。',
|
medicationStatus: '1',
|
prescribingDoctor: '李成白',
|
stopReason: '',
|
stopDescription: ''
|
},
|
{
|
id: 2,
|
patientId: 'P1001',
|
patientName: '张清扬',
|
patientAge: 65,
|
patientGender: '1',
|
patientNo: '20241209001',
|
allergyHistory: '青霉素过敏',
|
drugId: 'D1002',
|
drugName: '阿托伐他汀钙片',
|
drugSpecification: '20mg*7片/盒',
|
dosage: 1,
|
dosageUnit: '片',
|
frequency: '1',
|
usageMethod: '口服',
|
startTime: '2024-11-20 20:00:00',
|
endTime: '',
|
durationType: '1',
|
instructions: '每晚睡前服用。注意监测肝功能,如有肌肉酸痛请及时就医。',
|
medicationStatus: '1',
|
prescribingDoctor: '李成白',
|
stopReason: '',
|
stopDescription: ''
|
},
|
{
|
id: 3,
|
patientId: 'P2001',
|
patientName: '王芳',
|
patientAge: 33,
|
patientGender: '0',
|
patientNo: '20241115002',
|
allergyHistory: '无',
|
drugId: 'D1003',
|
drugName: '泼尼松片',
|
drugSpecification: '5mg*100片/瓶',
|
dosage: 2,
|
dosageUnit: '片',
|
frequency: '3',
|
usageMethod: '口服',
|
startTime: '2024-12-05 09:00:00',
|
endTime: '2024-12-20 09:00:00',
|
durationType: '2',
|
instructions: '早、中、晚餐后服用。需严格遵医嘱逐渐减量,不可突然停药。',
|
medicationStatus: '0',
|
prescribingDoctor: '刘翊惠',
|
stopReason: '疗程结束',
|
stopDescription: '标准疗程用药完毕,血小板计数已恢复正常范围。'
|
},
|
{
|
id: 4,
|
patientId: 'P2001',
|
patientName: '王芳',
|
patientAge: 33,
|
patientGender: '0',
|
patientNo: '20241115002',
|
allergyHistory: '无',
|
drugId: 'D1004',
|
drugName: '多糖铁复合物胶囊',
|
drugSpecification: '150mg*10粒/盒',
|
dosage: 1,
|
dosageUnit: '粒',
|
frequency: '2',
|
usageMethod: '口服',
|
startTime: '2024-12-05 09:00:00',
|
endTime: '',
|
durationType: '1',
|
instructions: '餐后服用,可减轻胃肠道刺激。服药后可能出现黑便,属正常现象。',
|
medicationStatus: '1',
|
prescribingDoctor: '刘翊惠',
|
stopReason: '',
|
stopDescription: ''
|
},
|
{
|
id: 5,
|
patientId: 'P3001',
|
patientName: '李伟',
|
patientAge: 58,
|
patientGender: '1',
|
patientNo: '20241022005',
|
allergyHistory: '磺胺类药物过敏',
|
drugId: 'D1005',
|
drugName: '盐酸二甲双胍片',
|
drugSpecification: '0.5g*20片/板',
|
dosage: 1,
|
dosageUnit: '片',
|
frequency: '2',
|
usageMethod: '口服',
|
startTime: '2024-10-22 08:00:00',
|
endTime: '',
|
durationType: '1',
|
instructions: '随餐或餐后立即服用,以减少胃肠道不适。',
|
medicationStatus: '1',
|
prescribingDoctor: '张孟涵',
|
stopReason: '',
|
stopDescription: ''
|
},
|
{
|
id: 6,
|
patientId: 'P4001',
|
patientName: '赵磊',
|
patientAge: 70,
|
patientGender: '1',
|
patientNo: '20241202011',
|
allergyHistory: '海鲜过敏',
|
drugId: 'D1006',
|
drugName: '呋塞米片',
|
drugSpecification: '20mg*100片/瓶',
|
dosage: 1,
|
dosageUnit: '片',
|
frequency: '1',
|
usageMethod: '口服',
|
startTime: '2024-12-02 07:00:00',
|
endTime: '',
|
durationType: '1',
|
instructions: '晨起服用,避免夜间多次起夜。注意监测电解质水平。',
|
medicationStatus: '1',
|
prescribingDoctor: '吴思翰',
|
stopReason: '',
|
stopDescription: ''
|
},
|
{
|
id: 7,
|
patientId: 'P5001',
|
patientName: '周华',
|
patientAge: 52,
|
patientGender: '0',
|
patientNo: '20241128009',
|
allergyHistory: '无',
|
drugId: 'D1007',
|
drugName: '硝苯地平控释片',
|
drugSpecification: '30mg*7片/盒',
|
dosage: 1,
|
dosageUnit: '片',
|
frequency: '1',
|
usageMethod: '口服',
|
startTime: '2024-11-28 08:00:00',
|
endTime: '',
|
durationType: '1',
|
instructions: '整片吞服,不可嚼碎或掰开。',
|
medicationStatus: '1',
|
prescribingDoctor: '陈政倩',
|
stopReason: '',
|
stopDescription: ''
|
}
|
],
|
// 分配用药弹出层
|
assignOpen: false,
|
assignTitle: "",
|
// 停止用药弹出层
|
stopOpen: false,
|
stopTitle: "",
|
// 查询参数
|
queryParams: {
|
pageNum: 1,
|
pageSize: 10,
|
patientName: undefined,
|
drugName: undefined,
|
medicationStatus: undefined
|
},
|
// 分配用药表单
|
assignForm: {},
|
// 停止用药表单
|
stopForm: {},
|
// 选中患者信息
|
selectedPatient: null,
|
// 选中药品信息
|
selectedDrug: {},
|
// 患者选项
|
patientOptions: [
|
{
|
id: 'P1001',
|
name: '张三',
|
age: 65,
|
patientNo: '20241209001',
|
allergyHistory: '青霉素过敏'
|
}
|
],
|
// 药品选项
|
drugOptions: [
|
{
|
id: 'D1001',
|
name: '阿司匹林',
|
specification: '100mg',
|
stock: 150
|
}
|
],
|
// 状态选项
|
statusOptions: [
|
{ value: "1", label: "用药中" },
|
{ value: "0", label: "已停止" }
|
],
|
// 表单校验
|
assignRules: {
|
patientId: [
|
{ required: true, message: "请选择患者", trigger: "change" }
|
],
|
drugId: [
|
{ required: true, message: "请选择药品", trigger: "change" }
|
],
|
dosage: [
|
{ required: true, message: "请输入单次剂量", trigger: "blur" }
|
],
|
frequency: [
|
{ required: true, message: "请选择用药频次", trigger: "change" }
|
]
|
},
|
stopRules: {
|
stopReason: [
|
{ required: true, message: "请选择停止原因", trigger: "change" }
|
],
|
stopTime: [
|
{ required: true, message: "请选择停止时间", trigger: "change" }
|
]
|
}
|
};
|
},
|
created() {
|
this.getList();
|
},
|
methods: {
|
parseTime,
|
/** 查询用药记录列表 */
|
getList() {
|
this.loading = true;
|
// 模拟API调用
|
setTimeout(() => {
|
this.loading = false;
|
this.total = this.medicationList.length;
|
}, 500);
|
},
|
/** 搜索按钮操作 */
|
handleQuery() {
|
this.queryParams.pageNum = 1;
|
this.getList();
|
},
|
/** 重置按钮操作 */
|
resetQuery() {
|
this.resetForm("queryForm");
|
this.handleQuery();
|
},
|
// 多选框选中数据
|
handleSelectionChange(selection) {
|
this.ids = selection.map(item => item.id);
|
this.single = selection.length !== 1;
|
this.multiple = !selection.length;
|
},
|
/** 分配用药按钮操作 */
|
handleAssignMedication() {
|
this.resetAssignForm();
|
this.assignOpen = true;
|
this.assignTitle = "分配用药";
|
},
|
/** 停止用药按钮操作 */
|
handleStopMedication() {
|
if (this.ids.length === 0) {
|
this.$modal.msgError("请先选择要停止的用药记录");
|
return;
|
}
|
this.resetStopForm();
|
this.stopOpen = true;
|
this.stopTitle = "停止用药";
|
},
|
/** 单个停止用药 */
|
handleSingleStop(row) {
|
this.ids = [row.id];
|
this.resetStopForm();
|
this.stopForm.patientName = row.patientName;
|
this.stopForm.drugName = row.drugName;
|
this.stopOpen = true;
|
this.stopTitle = `停止用药 - ${row.patientName}`;
|
},
|
/** 提交分配用药表单 */
|
submitAssignForm() {
|
this.$refs["assignForm"].validate(valid => {
|
if (valid) {
|
// 模拟API调用
|
const newRecord = {
|
id: Math.max(...this.medicationList.map(item => item.id)) + 1,
|
...this.assignForm,
|
patientName: this.selectedPatient?.name,
|
patientAge: this.selectedPatient?.age,
|
patientGender: this.selectedPatient?.gender,
|
patientNo: this.selectedPatient?.patientNo,
|
allergyHistory: this.selectedPatient?.allergyHistory,
|
drugName: this.selectedDrug?.name,
|
drugSpecification: this.selectedDrug?.specification,
|
medicationStatus: '1',
|
prescribingDoctor: '当前用户',
|
startTime: this.assignForm.startTime || new Date().toISOString().replace('T', ' ').substr(0, 19)
|
};
|
|
this.medicationList.unshift(newRecord);
|
this.total = this.medicationList.length;
|
this.$modal.msgSuccess("分配成功");
|
this.assignOpen = false;
|
}
|
});
|
},
|
/** 提交停止用药表单 */
|
submitStopForm() {
|
this.$refs["stopForm"].validate(valid => {
|
if (valid) {
|
// 更新用药记录状态
|
this.medicationList.forEach(item => {
|
if (this.ids.includes(item.id)) {
|
item.medicationStatus = '0';
|
item.endTime = this.stopForm.stopTime;
|
item.stopReason = this.stopForm.stopReason;
|
item.stopDescription = this.stopForm.stopDescription;
|
}
|
});
|
|
this.$modal.msgSuccess("停止用药成功");
|
this.stopOpen = false;
|
this.getList();
|
}
|
});
|
},
|
/** 患者选择变化 */
|
handlePatientChange(patientId) {
|
this.selectedPatient = this.patientOptions.find(p => p.id === patientId) || null;
|
},
|
/** 药品选择变化 */
|
handleDrugChange(drugId) {
|
this.selectedDrug = this.drugOptions.find(d => d.id === drugId) || {};
|
},
|
/** 查看详情 */
|
handleViewDetail(row) {
|
this.$alert(
|
`<div>
|
<p><strong>患者信息:</strong>${row.patientName} (${row.patientNo})</p>
|
<p><strong>药品信息:</strong>${row.drugName} ${row.drugSpecification}</p>
|
<p><strong>用法用量:</strong>${row.dosage}${row.dosageUnit}/次,${row.frequency}次/日,${row.usageMethod}</p>
|
<p><strong>用药时间:</strong>${this.parseTime(row.startTime, '{y}-{m}-{d}')} - ${row.endTime ? this.parseTime(row.endTime, '{y}-{m}-{d}') : '长期'}</p>
|
<p><strong>用药说明:</strong>${row.instructions || '无'}</p>
|
${row.allergyHistory ? `<p><strong>过敏史:</strong><span style="color: red">${row.allergyHistory}</span></p>` : ''}
|
</div>`,
|
"用药详情",
|
{
|
dangerouslyUseHTMLString: true,
|
customClass: "medication-detail-dialog",
|
}
|
);
|
},
|
/** 显示过敏史详情 */
|
showAllergyDetail(row) {
|
if (row.allergyHistory) {
|
this.$alert(`患者 ${row.patientName} 的过敏史:${row.allergyHistory}`, "过敏史详情", {
|
confirmButtonText: "确定"
|
});
|
}
|
},
|
/** 获取状态标签类型 */
|
getStatusTagType(status) {
|
const statusMap = {
|
'1': 'success', // 用药中
|
'0': 'info' // 已停止
|
};
|
return statusMap[status] || 'info';
|
},
|
/** 获取状态文本 */
|
getStatusText(status) {
|
const statusMap = {
|
'1': '用药中',
|
'0': '已停止'
|
};
|
return statusMap[status] || '未知';
|
},
|
/** 重置分配用药表单 */
|
resetAssignForm() {
|
this.assignForm = {
|
patientId: undefined,
|
drugId: undefined,
|
dosage: 1,
|
dosageUnit: '片',
|
frequency: '3',
|
usageMethod: '口服',
|
durationType: '1',
|
startTime: new Date().toISOString().replace('T', ' ').substr(0, 19),
|
endTime: undefined,
|
instructions: ''
|
};
|
this.selectedPatient = null;
|
this.selectedDrug = {};
|
this.resetForm("assignForm");
|
},
|
/** 重置停止用药表单 */
|
resetStopForm() {
|
this.stopForm = {
|
stopReason: '',
|
stopDescription: '',
|
stopTime: new Date().toISOString().replace('T', ' ').substr(0, 19)
|
};
|
this.resetForm("stopForm");
|
},
|
/** 取消分配用药 */
|
cancelAssign() {
|
this.assignOpen = false;
|
this.resetAssignForm();
|
},
|
/** 取消停止用药 */
|
cancelStop() {
|
this.stopOpen = false;
|
this.resetStopForm();
|
}
|
}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.patient-medication-management {
|
padding: 20px;
|
}
|
|
.patient-info {
|
text-align: left;
|
.patient-name {
|
font-weight: bold;
|
margin-bottom: 4px;
|
}
|
.patient-details {
|
font-size: 12px;
|
color: #909399;
|
}
|
}
|
|
.drug-info {
|
text-align: left;
|
.drug-name {
|
font-weight: bold;
|
margin-bottom: 4px;
|
}
|
.dosage-info {
|
font-size: 12px;
|
color: #67C23A;
|
}
|
}
|
|
.usage-info, .time-info {
|
font-size: 12px;
|
line-height: 1.4;
|
}
|
|
.allergy-warning {
|
color: #F56C6C;
|
font-size: 12px;
|
}
|
|
.no-allergy {
|
color: #909399;
|
font-style: italic;
|
}
|
|
.patient-detail {
|
font-size: 12px;
|
line-height: 1.6;
|
padding: 8px;
|
background: #f5f7fa;
|
border-radius: 4px;
|
}
|
|
.placeholder {
|
color: #c0c4cc;
|
font-style: italic;
|
}
|
|
.stop-button {
|
color: #E6A23C;
|
&:hover {
|
color: #f56c6c;
|
}
|
}
|
|
::v-deep .medication-detail-dialog {
|
width: 500px;
|
}
|
</style>
|