解决合并冲突
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
"top": 16.5,
|
||||
"height": 22.5,
|
||||
"width": 120,
|
||||
"title": "医院",
|
||||
"title": "长春大学医院",
|
||||
"coordinateSync": false,
|
||||
"widthHeightSync": false,
|
||||
"fontFamily": "Microsoft YaHei",
|
||||
|
||||
@@ -0,0 +1,330 @@
|
||||
<template>
|
||||
<div
|
||||
class="app-container"
|
||||
style="border: 1px solid #e0e0e0; border-radius: 4px; box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.1)"
|
||||
>
|
||||
<el-row :gutter="10" justify="end" align="middle" style="margin-bottom: 10px">
|
||||
<el-button type="danger" plain icon="Refresh" @click="handleSendDrug" :disabled="!encounterId"
|
||||
>发药</el-button
|
||||
>
|
||||
<el-button type="primary" plain icon="Download" @click="handleExport" :disabled="!encounterId"
|
||||
>导出</el-button
|
||||
>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Refresh"
|
||||
@click="handleDispense"
|
||||
:disabled="!encounterId"
|
||||
>退药</el-button
|
||||
>
|
||||
</el-row>
|
||||
<div class="tableContainer">
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="displayTableData"
|
||||
style="width: 100%; height: 70vh"
|
||||
border
|
||||
stripe
|
||||
:header-cell-style="headerCellStyle"
|
||||
:row-style="rowStyle"
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- 基础信息 -->
|
||||
<el-table-column prop="itemName" label="项目名称" min-width="120" />
|
||||
<el-table-column prop="totalVolume" label="规格" min-width="100" />
|
||||
<el-table-column prop="locationName" label="发放药房" min-width="100" />
|
||||
<el-table-column prop="lotNumber" label="批次号" min-width="100" />
|
||||
<el-table-column prop="departmentName" label="科室" min-width="100" />
|
||||
<el-table-column prop="doctorName" label="开单医生" min-width="100" />
|
||||
<el-table-column prop="dispenseDoctorName" label="发药医生" min-width="100" />
|
||||
<el-table-column prop="itemType_dictText" label="项目类型" min-width="100">
|
||||
<template #default="scope">
|
||||
{{ scope.row.itemType_dictText || scope.row.itemType || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="statusEnum_enumText" label="发药状态" min-width="100">
|
||||
<template #default="scope">
|
||||
{{ scope.row.statusEnum_enumText || scope.row.statusEnum || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="conditionName" label="诊断名称" min-width="100" />
|
||||
<el-table-column prop="prescriptionNo" label="处方号" min-width="120" />
|
||||
|
||||
<!-- 用药信息 -->
|
||||
<el-table-column prop="dose" label="单次剂量" min-width="100" />
|
||||
<el-table-column prop="rateCode_dictText" label="用药频次" min-width="100">
|
||||
<template #default="scope">
|
||||
{{ scope.row.rateCode_dictText || scope.row.rateCode || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="methodCode_dictText" label="用法" min-width="100">
|
||||
<template #default="scope">
|
||||
{{ scope.row.methodCode_dictText || scope.row.methodCode || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="doseUnitCode_dictText" label="剂量单位" min-width="100">
|
||||
<template #default="scope">
|
||||
{{ scope.row.doseUnitCode_dictText || scope.row.doseUnitCode || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="unitCode_dictText" label="单位" min-width="80">
|
||||
<template #default="scope">
|
||||
{{ scope.row.unitCode_dictText || scope.row.unitCode || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="dispensePerQuantity" label="单次发药数" min-width="100" />
|
||||
<el-table-column prop="dispensePerDuration" label="每次发药供应天数" min-width="150" />
|
||||
<el-table-column prop="quantity" label="数量" min-width="80" />
|
||||
<el-table-column prop="unitPrice" label="单价" min-width="80" />
|
||||
<el-table-column prop="totalPrice" label="金额" min-width="80" />
|
||||
|
||||
<!-- 其他信息 -->
|
||||
<el-table-column prop="manufacturerText" label="生产厂家" min-width="150" />
|
||||
<el-table-column prop="traceNo" label="追溯码" min-width="120" />
|
||||
<el-table-column prop="encounterBusNo" label="就诊NO" min-width="120" />
|
||||
<el-table-column prop="reqAuthoredTime" label="开具日期" min-width="150">
|
||||
<template #default="scope">
|
||||
{{ formatDate(scope.row.reqAuthoredTime) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="skinTestFlag" label="皮试标志" min-width="100">
|
||||
<template #default="scope">
|
||||
{{ scope.row.skinTestFlag === 1 ? '是' : scope.row.skinTestFlag === 0 ? '否' : '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="tcmFlag" label="中药标识" min-width="100">
|
||||
<template #default="scope">
|
||||
{{ scope.row.tcmFlag === 1 ? '是' : scope.row.tcmFlag === 0 ? '否' : '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="itemTable" label="所在表" min-width="100" />
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { totalSendDrug, totalReturnDrug } from './api';
|
||||
import { getCurrentInstance } from 'vue';
|
||||
const { proxy } = getCurrentInstance();
|
||||
const emit = defineEmits(['call-medication-summary-detail']);
|
||||
// 定义props,接收父组件传递的表格数据和选中的ID
|
||||
const props = defineProps({
|
||||
tableData: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
encounterId: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
|
||||
// 定义响应式数据
|
||||
const selectedRows = ref([]);
|
||||
const loading = ref(false);
|
||||
|
||||
// 计算属性,直接使用props.tableData,并添加日志用于调试
|
||||
const displayTableData = computed(() => {
|
||||
return props.tableData;
|
||||
});
|
||||
|
||||
// 处理表格选择变化
|
||||
function handleSelectionChange(rows) {
|
||||
selectedRows.value = rows;
|
||||
}
|
||||
|
||||
// 格式化日期
|
||||
function formatDate(dateTime) {
|
||||
if (!dateTime) return '-';
|
||||
|
||||
const date = new Date(dateTime);
|
||||
if (isNaN(date.getTime())) return '-';
|
||||
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(date.getDate()).padStart(2, '0');
|
||||
const hours = String(date.getHours()).padStart(2, '0');
|
||||
const minutes = String(date.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(date.getSeconds()).padStart(2, '0');
|
||||
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
|
||||
// 监听props.tableData变化,当外部数据变化时清空选中状态
|
||||
watch(
|
||||
() => props.tableData,
|
||||
() => {
|
||||
selectedRows.value = [];
|
||||
}
|
||||
);
|
||||
|
||||
// 表格样式
|
||||
const headerCellStyle = {
|
||||
backgroundColor: '#f5f7fa',
|
||||
color: '#333',
|
||||
fontWeight: 'bold',
|
||||
height: '48px',
|
||||
textAlign: 'center',
|
||||
lineHeight: '48px',
|
||||
padding: '0',
|
||||
fontSize: '14px',
|
||||
};
|
||||
|
||||
const rowStyle = {
|
||||
height: '40px',
|
||||
};
|
||||
// 发药功能
|
||||
const handleSendDrug = () => {
|
||||
if (!props.encounterId) {
|
||||
ElMessage.warning('请先选择患者');
|
||||
return;
|
||||
}
|
||||
if (selectedRows.value.length === 0) {
|
||||
ElMessage.warning('请先选择需要发药的数据');
|
||||
return;
|
||||
}
|
||||
let data = [];
|
||||
selectedRows.value.forEach((row) => {
|
||||
data.push({
|
||||
dispenseId: row.dispenseId,
|
||||
});
|
||||
});
|
||||
loading.value = true;
|
||||
proxy.$modal
|
||||
.confirm('确定要发药吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(async () => {
|
||||
const response = await totalSendDrug(data);
|
||||
if (response.code === 200) {
|
||||
ElMessage.success('发药成功');
|
||||
loading.value = false;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
// 导出功能
|
||||
const handleExport = () => {
|
||||
if (!props.encounterId) {
|
||||
ElMessage.warning('请先选择患者');
|
||||
return;
|
||||
}
|
||||
if (displayTableData.value.length === 0) {
|
||||
ElMessage.warning('暂无数据可导出');
|
||||
return;
|
||||
}
|
||||
|
||||
if (selectedRows.value.length === 0) {
|
||||
ElMessage.warning('请先选择要导出的数据');
|
||||
return;
|
||||
}
|
||||
|
||||
// 这里可以实现导出逻辑
|
||||
console.log('导出数据:', selectedRows.value);
|
||||
ElMessage.success('导出成功');
|
||||
};
|
||||
|
||||
// 退药功能
|
||||
const handleDispense = () => {
|
||||
if (!props.encounterId) {
|
||||
ElMessage.warning('请先选择患者');
|
||||
return;
|
||||
}
|
||||
if (selectedRows.value.length === 0) {
|
||||
ElMessage.warning('请先选择需要退药的数据');
|
||||
return;
|
||||
}
|
||||
let data = [];
|
||||
selectedRows.value.forEach((row) => {
|
||||
data.push({
|
||||
dispenseId: row.dispenseId,
|
||||
});
|
||||
});
|
||||
loading.value = true;
|
||||
proxy.$modal
|
||||
.confirm('确定要退药吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(async () => {
|
||||
const response = await totalReturnDrug(data);
|
||||
emit('call-medication-summary-detail', props.encounterId);
|
||||
console.log(response);
|
||||
if (response.code === 200) {
|
||||
ElMessage.success('退药成功');
|
||||
loading.value = false;
|
||||
// 通知父组件刷新明细数据
|
||||
emit('call-medication-summary-detail', props.encounterId);
|
||||
} else {
|
||||
console.log(response.message);
|
||||
ElMessage.error('退药失败');
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
// 定义暴露给父组件的数据和方法
|
||||
defineExpose({
|
||||
selectedRows,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.medicationTableDetail {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.buttonGroup {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 10px 0;
|
||||
gap: 10px;
|
||||
margin-right: 20px;
|
||||
|
||||
:deep(.el-button) {
|
||||
padding: 6px 16px;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.tableContainer {
|
||||
flex: 1;
|
||||
overflow-x: auto; /* 启用横向滚动 */
|
||||
overflow-y: auto; /* 同时启用纵向滚动 */
|
||||
border: 1px solid #e0e0e0;
|
||||
border-radius: 4px;
|
||||
|
||||
:deep(.el-table) {
|
||||
height: 100%;
|
||||
|
||||
.el-table__header {
|
||||
th {
|
||||
background-color: #f5f7fa;
|
||||
height: 48px !important;
|
||||
line-height: 48px !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.el-table__row:hover {
|
||||
background-color: #f5f7fa;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,187 @@
|
||||
<template>
|
||||
<div
|
||||
class="app-container"
|
||||
style="border: 1px solid #e0e0e0; border-radius: 4px; box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.1)"
|
||||
>
|
||||
<el-row :gutter="10" justify="end" align="middle" style="margin-bottom: 10px">
|
||||
<el-button type="danger" plain icon="Refresh" @click="handleSendDrug" :disabled="!busNo">
|
||||
发药
|
||||
</el-button>
|
||||
<el-button type="primary" plain icon="Download" @click="handleExport" :disabled="!busNo">
|
||||
导出
|
||||
</el-button>
|
||||
</el-row>
|
||||
<div class="tableContainer">
|
||||
<el-table
|
||||
:data="tableData"
|
||||
style="width: 100%; height: 70vh"
|
||||
:header-cell-style="headerCellStyle"
|
||||
:row-style="rowStyle"
|
||||
:cell-style="{ textAlign: 'center' }"
|
||||
>
|
||||
<el-table-column prop="currentIndex" label="序号" min-width="60" />
|
||||
<el-table-column prop="itemName" label="项目名称" min-width="150">
|
||||
<template #default="scope">
|
||||
{{ scope.row.itemName || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="totalVolume" label="规格" min-width="120">
|
||||
<template #default="scope">
|
||||
{{ scope.row.totalVolume || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="lotNumber" label="批次号" min-width="100">
|
||||
<template #default="scope">
|
||||
{{ scope.row.lotNumber || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="quantity" label="数量" min-width="80" align="center">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.quantity" size="mini">
|
||||
{{ scope.row.quantity }}
|
||||
</el-tag>
|
||||
<el-tag v-if="scope.row.maxUnitCode_dictText" size="mini" type="danger">
|
||||
{{ scope.row.maxUnitCode_dictText }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sourceLocationName" label="发放地点" min-width="100">
|
||||
<template #default="scope">
|
||||
{{ scope.row.sourceLocationName || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="manufacturerText" label="生产厂家" min-width="120">
|
||||
<template #default="scope">
|
||||
{{ scope.row.manufacturerText || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="busNo" label="单据号" min-width="150">
|
||||
<template #default="scope">
|
||||
{{ scope.row.busNo || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { totalSendDrug } from './api.js';
|
||||
import { getCurrentInstance } from 'vue';
|
||||
const { proxy } = getCurrentInstance();
|
||||
// 定义组件属性
|
||||
const props = defineProps({
|
||||
tableData: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
selectedId: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
busNo: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
|
||||
// 定义响应式数据
|
||||
const selectedRows = ref([]);
|
||||
// 定义loading状态
|
||||
const loading = ref(false);
|
||||
|
||||
// 表格样式
|
||||
const headerCellStyle = {
|
||||
backgroundColor: '#f5f7fa',
|
||||
color: '#333',
|
||||
fontWeight: 'bold',
|
||||
height: '48px',
|
||||
textAlign: 'center',
|
||||
lineHeight: '48px',
|
||||
padding: '0',
|
||||
fontSize: '14px',
|
||||
};
|
||||
|
||||
const rowStyle = {
|
||||
height: '40px',
|
||||
};
|
||||
|
||||
// 发药功能
|
||||
const handleSendDrug = () => {
|
||||
if (!props.busNo) {
|
||||
ElMessage.warning('请先选择单据号');
|
||||
return;
|
||||
}
|
||||
let data = [{ busNo: props.busNo }];
|
||||
loading.value = true;
|
||||
proxy.$modal
|
||||
.confirm('确定要发药吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
})
|
||||
.then(async () => {
|
||||
const response = await totalSendDrug(data);
|
||||
if (response.code === 200) {
|
||||
ElMessage.success('发药成功');
|
||||
loading.value = false;
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
};
|
||||
|
||||
// 定义暴露给父组件的数据和方法
|
||||
defineExpose({
|
||||
selectedRows,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.medicationTableDetail {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.buttonGroup {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding: 10px 0;
|
||||
gap: 10px;
|
||||
margin-right: 20px;
|
||||
|
||||
:deep(.el-button) {
|
||||
padding: 6px 16px;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.tableContainer {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
border: 1px solid #e0e0e0;
|
||||
border-radius: 4px;
|
||||
|
||||
:deep(.el-table) {
|
||||
height: 100%;
|
||||
|
||||
.el-table__header {
|
||||
th {
|
||||
background-color: #f5f7fa;
|
||||
height: 48px !important;
|
||||
lineheight: 48px !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.el-table__row:hover {
|
||||
background-color: #f5f7fa;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,123 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
// 获取病区下拉选
|
||||
export function getPractitionerWard (queryParams) {
|
||||
return request ({
|
||||
url: '/app-common/practitioner-ward',
|
||||
method: 'get',
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
|
||||
// 住院汇总发药单左侧
|
||||
export function getFromSummaryList (queryParams) {
|
||||
return request ({
|
||||
url: 'pharmacy-manage/summary-dispense-medicine/from_summary-list',
|
||||
method: 'get',
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
|
||||
// 住院汇总发药单右侧
|
||||
export function getFromDetailList (queryParams) {
|
||||
return request ({
|
||||
url: 'pharmacy-manage/summary-dispense-medicine/from-list',
|
||||
method: 'get',
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
|
||||
// 明细左侧
|
||||
export function getEncounterList (queryParams) {
|
||||
return request ({
|
||||
url: '/pharmacy-manage/summary-dispense-medicine/encounter-list',
|
||||
method: 'get',
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
//明细 右侧
|
||||
export function getMedicationSummaryDetail (queryParams) {
|
||||
return request ({
|
||||
url: '/pharmacy-manage/summary-dispense-medicine/medication_summary-list',
|
||||
method: 'get',
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
//以下是组件的接口
|
||||
|
||||
/**
|
||||
* 获取住院患者列表
|
||||
*/
|
||||
export function getPatientList (queryParams) {
|
||||
return request ({
|
||||
url: '/nurse-station/advice-process/inpatient',
|
||||
method: 'get',
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前登录人管理病区
|
||||
*/
|
||||
export function getWardList (queryParams) {
|
||||
return request ({
|
||||
url: '/app-common/practitioner-ward',
|
||||
method: 'get',
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前选中患者全部医嘱
|
||||
*/
|
||||
export function getPrescriptionList (queryParams) {
|
||||
return request ({
|
||||
url: '/nurse-station/advice-process/inpatient-advice',
|
||||
method: 'get',
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行医嘱
|
||||
*/
|
||||
export function adviceExecute (data) {
|
||||
return request ({
|
||||
url: '/nurse-station/advice-process/advice-execute',
|
||||
method: 'post',
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消执行医嘱
|
||||
*/
|
||||
export function adviceCancel (data) {
|
||||
return request ({
|
||||
url: '/nurse-station/advice-process/advice-cancel',
|
||||
method: 'post',
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 明细发药
|
||||
*
|
||||
*/
|
||||
export function totalSendDrug (data) {
|
||||
return request ({
|
||||
url: '/pharmacy-manage/summary-dispense-medicine/summary-dispense-medicine',
|
||||
method: 'put',
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 明细退药
|
||||
*/
|
||||
export function totalReturnDrug (data) {
|
||||
return request ({
|
||||
url: '/pharmacy-manage/summary-dispense-medicine/medicine-return',
|
||||
method: 'put',
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,456 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="20" style="margin-bottom: 20px">
|
||||
<el-col :span="4" :xs="24">
|
||||
<el-button
|
||||
:type="selectType === 'total' ? 'primary' : 'default'"
|
||||
@click="handleSelectType('total')"
|
||||
>汇总</el-button
|
||||
>
|
||||
<el-button
|
||||
:type="selectType === 'drug' ? 'primary' : 'default'"
|
||||
@click="handleSelectType('drug')"
|
||||
>发药</el-button
|
||||
>
|
||||
</el-col>
|
||||
<!-- <el-col :span="18" :xs="24">
|
||||
<el-form ref="queryParams" label-width="100px" :model="queryParams" :inline="true">
|
||||
<el-form-item label="窗口" prop="windowDataText" label-width="120px">
|
||||
<el-select
|
||||
v-model="queryParams.windowDataText"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
filterable
|
||||
>
|
||||
<el-option
|
||||
v-for="item in windowData"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="摆药单" prop="medicationListText" label-width="120px">
|
||||
<el-select
|
||||
v-model="queryParams.medicationListText"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
filterable
|
||||
>
|
||||
<el-option
|
||||
v-for="item in medicationList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="范围" prop="time" label-width="100px">
|
||||
<el-radio-group v-model="queryParams.timeRange">
|
||||
<el-radio v-for="(item, index) in timeRangeList" :key="index" :value="item.value">
|
||||
{{ item.label }}
|
||||
</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="时间" prop="time" label-width="100px">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
type="datetimerange"
|
||||
range-separator="-"
|
||||
start-placeholder="开始时间"
|
||||
end-placeholder="结束时间"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col> -->
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6" class="left-container">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form
|
||||
:model="queryParamsPatient"
|
||||
ref="queryRef"
|
||||
v-show="showSearch"
|
||||
label-width="120"
|
||||
inline="true"
|
||||
>
|
||||
<el-form-item label="患者信息" prop="searchKey" label-width="120">
|
||||
<el-input
|
||||
v-model="queryParamsPatient.searchKey"
|
||||
placeholder="请输入姓名/证件号"
|
||||
clearable
|
||||
style="width: 240px"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
label="发药状态"
|
||||
prop="statusEnum"
|
||||
v-if="selectType !== 'drug'"
|
||||
label-width="120"
|
||||
>
|
||||
<el-select
|
||||
v-model="queryParamsPatient.statusEnum"
|
||||
placeholder="请选择"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 240px"
|
||||
@change="handleQuery"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in dispenseStatusOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="就诊日期" prop="startTime">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 240px"
|
||||
@keyup.enter="handleQuery"
|
||||
@change="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20" style="border-radius: 4px">
|
||||
<el-col :span="24">
|
||||
<el-table
|
||||
:data="patientList"
|
||||
border
|
||||
highlight-current-row
|
||||
style="height: cal(100%-200px); width: 100%"
|
||||
@row-click="handleCurrentChange"
|
||||
>
|
||||
<!-- 汇总状态下显示的字段 -->
|
||||
<template v-if="selectType === 'total'">
|
||||
<el-table-column prop="applicantName" label="申请人" align="center" />
|
||||
<el-table-column prop="sourceLocationName" label="发药药房" align="center" />
|
||||
<el-table-column prop="statusEnum_enumText" label="状态" align="center" />
|
||||
<el-table-column prop="applyTime" label="申请日期" align="center">
|
||||
<template #default="scope">
|
||||
{{ scope.row.applyTime ? parseTime(scope.row.applyTime, '{y}-{m}-{d}') : '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<!-- 明细状态下显示的字段 -->
|
||||
<template v-else>
|
||||
<el-table-column prop="patientName" label="姓名" align="center" />
|
||||
<el-table-column prop="genderEnum_enumText" label="性别" align="center" />
|
||||
<el-table-column prop="age" label="年龄" align="center" />
|
||||
<el-table-column prop="startTime" label="就诊日期" align="center">
|
||||
<template #default="scope">
|
||||
{{ scope.row.startTime ? parseTime(scope.row.startTime, '{y}-{m}-{d}') : '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</el-table>
|
||||
</el-col>
|
||||
<el-col :span="24" style="padding: 10px 12px 12px 12px">
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
<el-col :span="18" :xs="24">
|
||||
<!-- 根据当前选中的tab显示不同的表格组件 -->
|
||||
<MedicationTable v-if="selectType === 'total'" :tableData="tableData" :busNo="busNo" />
|
||||
<DetailMedicationTable
|
||||
v-else-if="selectType === 'drug'"
|
||||
:tableData="detailTableData"
|
||||
:encounterId="encounterId"
|
||||
@call-medication-summary-detail="callMedicationSummaryDetail"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import MedicationTable from './components/MedicationTable.vue';
|
||||
import DetailMedicationTable from './components/DetailMedicationTable.vue';
|
||||
import { getCurrentInstance } from 'vue';
|
||||
import {
|
||||
getFromSummaryList,
|
||||
getEncounterList,
|
||||
getMedicationSummaryDetail,
|
||||
getFromDetailList,
|
||||
} from './components/api';
|
||||
|
||||
// 响应式数据
|
||||
const loading = ref(false);
|
||||
const patientList = ref([]);
|
||||
const total = ref(0);
|
||||
const showSearch = ref(true);
|
||||
const { proxy } = getCurrentInstance();
|
||||
// 查询参数
|
||||
const queryParams = reactive({
|
||||
searchKey: '',
|
||||
statusEnum: '',
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
windowDataText: '',
|
||||
medicationListText: '',
|
||||
timeRange: 1,
|
||||
});
|
||||
const queryParamsPatient = ref({
|
||||
searchKey: '',
|
||||
statusEnum: '1',
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
// 日期范围
|
||||
const dateRange = ref([
|
||||
new Date().toISOString().split('T')[0],
|
||||
new Date().toISOString().split('T')[0],
|
||||
]);
|
||||
|
||||
// 发药状态选项
|
||||
const dispenseStatusOptions = ref([
|
||||
{ label: '待发药', value: '1' },
|
||||
{ label: '已发药', value: '2' },
|
||||
{ label: '全部', value: '0' },
|
||||
]);
|
||||
|
||||
// 加载患者列表数据
|
||||
async function getList() {
|
||||
if (dateRange.value == null) {
|
||||
proxy.$message.warning('请选择日期');
|
||||
return;
|
||||
}
|
||||
loading.value = true;
|
||||
try {
|
||||
let response;
|
||||
// 构建查询参数 - 只保留必要的分页和筛选条件
|
||||
const params = {
|
||||
searchKey: queryParamsPatient.value.searchKey,
|
||||
statusEnum: queryParamsPatient.value.statusEnum,
|
||||
pageNo: queryParamsPatient.value.pageNo,
|
||||
pageSize: queryParamsPatient.value.pageSize,
|
||||
startTime: dateRange.value[0],
|
||||
endTime: dateRange.value[1],
|
||||
};
|
||||
// 根据当前标签页调用不同的接口
|
||||
if (selectType.value === 'total') {
|
||||
// 汇总标签页
|
||||
response = await getFromSummaryList(params);
|
||||
patientList.value = response.data;
|
||||
total.value = response.data.length || 0;
|
||||
} else {
|
||||
// 明细标签页
|
||||
response = await getEncounterList(params);
|
||||
patientList.value = response.data.records;
|
||||
total.value = response.data.total || 0;
|
||||
}
|
||||
} catch (error) {
|
||||
patientList.value = [];
|
||||
total.value = 0;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索处理
|
||||
async function handleQuery() {
|
||||
queryParamsPatient.value.pageNo = 1; // 重置为第一页
|
||||
await getList();
|
||||
}
|
||||
const busNo = ref('');
|
||||
const encounterId = ref('');
|
||||
// 处理表格行点击
|
||||
function handleCurrentChange(row) {
|
||||
busNo.value = row.busNo;
|
||||
encounterId.value = row.encounterId;
|
||||
if (selectType.value === 'total') {
|
||||
// 汇总标签页
|
||||
callSummaryMedicationDetail(row.busNo);
|
||||
} else {
|
||||
// 明细标签页
|
||||
callMedicationSummaryDetail(row.encounterId);
|
||||
}
|
||||
}
|
||||
|
||||
// 明细标签页
|
||||
async function callMedicationSummaryDetail(encounterId) {
|
||||
console.log('点击明细标签页', encounterId);
|
||||
// 显示加载提示
|
||||
loading.value = true;
|
||||
try {
|
||||
const params = {
|
||||
encounterId,
|
||||
};
|
||||
|
||||
const response = await getMedicationSummaryDetail(params);
|
||||
// 处理药品汇总详情数据
|
||||
handleMedicationSummaryDetail(response.data);
|
||||
} catch (error) {
|
||||
ElMessage.error('获取药品汇总详情失败:' + (error.message || '未知错误'));
|
||||
// 发生错误时清空数据
|
||||
handleMedicationSummaryDetail([]);
|
||||
} finally {
|
||||
// 无论成功失败都关闭加载状态
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// 汇总标签页
|
||||
async function callSummaryMedicationDetail(busNo) {
|
||||
// 显示加载提示
|
||||
loading.value = true;
|
||||
try {
|
||||
const params = {
|
||||
busNo,
|
||||
};
|
||||
|
||||
const response = await getFromDetailList(params);
|
||||
|
||||
// 处理汇总药品详情数据
|
||||
handleMedicationSummaryDetail(response.data);
|
||||
} catch (error) {
|
||||
ElMessage.error('获取汇总药品详情失败:' + (error.message || '未知错误'));
|
||||
// 发生错误时清空数据
|
||||
handleMedicationSummaryDetail([]);
|
||||
} finally {
|
||||
// 无论成功失败都关闭加载状态
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
// 窗口数据
|
||||
const windowData = reactive([
|
||||
{
|
||||
label: '窗口1',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '窗口2',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '窗口3',
|
||||
value: 3,
|
||||
},
|
||||
]);
|
||||
|
||||
// 摆药单数据
|
||||
const medicationList = reactive([
|
||||
{
|
||||
label: '药单1',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '药单2',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '药单3',
|
||||
value: 3,
|
||||
},
|
||||
]);
|
||||
|
||||
// 时间范围选项
|
||||
const timeRangeList = [
|
||||
{
|
||||
label: '全部',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '长期',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '临时',
|
||||
value: 3,
|
||||
},
|
||||
];
|
||||
|
||||
// 表格类型
|
||||
const selectType = ref('total');
|
||||
|
||||
// 表格数据,用于显示右侧药品列表(汇总tab)
|
||||
const tableData = reactive([]);
|
||||
|
||||
// 明细表格数据,用于明细tab
|
||||
const detailTableData = reactive([]);
|
||||
|
||||
// 切换表格类型
|
||||
function handleSelectType(type) {
|
||||
selectType.value = type;
|
||||
reset();
|
||||
getList();
|
||||
}
|
||||
function reset() {
|
||||
busNo.value = '';
|
||||
encounterId.value = '';
|
||||
patientList.value = [];
|
||||
total.value = 0;
|
||||
// 保持响应式引用不变,逐字段还原默认
|
||||
queryParamsPatient.value.searchKey = '';
|
||||
queryParamsPatient.value.statusEnum = '1';
|
||||
queryParamsPatient.value.pageNo = 1;
|
||||
queryParamsPatient.value.pageSize = 10;
|
||||
}
|
||||
// 处理子组件传递的药品汇总详情数据
|
||||
function handleMedicationSummaryDetail(data) {
|
||||
// 检查数据是否为数组
|
||||
const medicationData = Array.isArray(data)
|
||||
? data
|
||||
: typeof data === 'object' && data !== null && Array.isArray(data.records)
|
||||
? data.records
|
||||
: [];
|
||||
|
||||
// 根据当前tab将数据分配到不同的表格
|
||||
if (selectType.value === 'total') {
|
||||
// 汇总tab - 清空表格数据
|
||||
tableData.splice(0, tableData.length);
|
||||
if (medicationData.length > 0) {
|
||||
medicationData.forEach((item, index) => {
|
||||
tableData.push({
|
||||
currentIndex: index + 1,
|
||||
...item,
|
||||
});
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// 明细tab - 将数据渲染到DetailMedicationTable组件
|
||||
detailTableData.splice(0, detailTableData.length);
|
||||
medicationData.forEach((item) => {
|
||||
detailTableData.push({
|
||||
...item,
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 组件挂载时初始化数据
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
<style scoped>
|
||||
.left-container {
|
||||
border-radius: 4px;
|
||||
border: 1px solid #f5f5f5;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||
padding: 20px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user