版本更新
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 获取住院患者列表
|
||||
*/
|
||||
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
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<el-input placeholder="住院号/姓名">
|
||||
<template #append>
|
||||
<el-button icon="Search" @click="getPatientList" />
|
||||
</template>
|
||||
</el-input>
|
||||
</div>
|
||||
<el-tree
|
||||
ref="treeRef"
|
||||
:load="loadNode"
|
||||
lazy
|
||||
show-checkbox
|
||||
node-key="id"
|
||||
default-expand-all
|
||||
:props="{ label: 'name', children: 'children' }"
|
||||
@node-click="handleNodeClick"
|
||||
@check="handleCheckChange"
|
||||
@node-expand="onNodeExpand"
|
||||
>
|
||||
<template #default="{ node, data }">
|
||||
<div class="custom-tree-node" v-if="node.level === 2">
|
||||
<span>{{ data.bedName + ' / ' + node.label }}</span>
|
||||
<span class="tree-node-actions">
|
||||
{{ data.genderEnum_enumText + ' / ' + data.age }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-tree>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getPatientList, getWardList } from './api';
|
||||
import { updatePatientInfoList } from '../store/patient';
|
||||
import { nextTick, onMounted } from 'vue';
|
||||
|
||||
const treeRef = ref(null);
|
||||
const allNodesLoaded = ref(false);
|
||||
// 树节点加载完成后的回调
|
||||
function onTreeLoaded() {
|
||||
if (!allNodesLoaded.value && treeRef.value) {
|
||||
// 等待DOM更新后设置全选
|
||||
nextTick(() => {
|
||||
// 获取所有节点并设置为选中状态
|
||||
const allNodes = getAllNodes(treeRef.value.store.root.childNodes);
|
||||
const allKeys = allNodes.map((node) => node.key);
|
||||
|
||||
treeRef.value.setCheckedKeys(allKeys, true); // 第二个参数设为true表示级联选中
|
||||
allNodesLoaded.value = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 递归获取所有节点
|
||||
function getAllNodes(nodes) {
|
||||
let result = [];
|
||||
if (nodes && nodes.length > 0) {
|
||||
nodes.forEach((node) => {
|
||||
result.push(node);
|
||||
if (node.childNodes && node.childNodes.length > 0) {
|
||||
result = result.concat(getAllNodes(node.childNodes));
|
||||
}
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function loadNode(node, resolve) {
|
||||
// 初始加载:获取所有病区(父级节点)
|
||||
if (node.level === 0) {
|
||||
getWardList().then((res) => {
|
||||
// 确保病区节点不是叶子节点
|
||||
const wards = res.map((ward) => ({
|
||||
...ward,
|
||||
leaf: false,
|
||||
}));
|
||||
return resolve(wards);
|
||||
});
|
||||
}
|
||||
// 展开病区节点时:获取该病区下的患者列表
|
||||
else if (node.level === 1) {
|
||||
const wardId = node.data.id;
|
||||
getPatientList({ wardId: wardId }).then((res) => {
|
||||
let children = res.data.records.map((item) => {
|
||||
return {
|
||||
leaf: true, // 患者节点为叶子节点
|
||||
...item,
|
||||
name: item.patientName,
|
||||
};
|
||||
});
|
||||
return resolve(children);
|
||||
});
|
||||
}
|
||||
// 更深层级直接返回空数组
|
||||
else {
|
||||
return resolve([]);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取所有选中的子节点(叶子节点)
|
||||
function getCheckedLeafNodes() {
|
||||
if (!treeRef.value) return [];
|
||||
|
||||
// 获取所有选中的节点key
|
||||
const checkedKeys = treeRef.value.getCheckedKeys();
|
||||
// 获取所有半选中的节点key(父节点)
|
||||
const halfCheckedKeys = treeRef.value.getHalfCheckedKeys();
|
||||
|
||||
// 获取所有选中的节点数据
|
||||
const checkedNodes = treeRef.value.getCheckedNodes();
|
||||
|
||||
// 只返回叶子节点(患者节点)
|
||||
return checkedNodes.filter((node) => node.leaf === true);
|
||||
}
|
||||
|
||||
// 处理节点选中状态变化
|
||||
function handleCheckChange(data, checked) {
|
||||
// 可以在这里处理选中状态变化的逻辑
|
||||
let list = getCheckedLeafNodes();
|
||||
console.log(list, '2345678');
|
||||
|
||||
updatePatientInfoList(list);
|
||||
handleGetPrescription()
|
||||
}
|
||||
const handleGetPrescription = inject('handleGetPrescription')
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.custom-tree-node {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.tree-node-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
:deep(.el-tree-node__content) {
|
||||
height: 35px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,298 @@
|
||||
<template>
|
||||
<div style="height: calc(100vh - 126px)">
|
||||
<div
|
||||
style="
|
||||
height: 51px;
|
||||
border-bottom: 2px solid #e4e7ed;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
"
|
||||
>
|
||||
<div>
|
||||
<span class="descriptions-item-label">截止时间:</span>
|
||||
<el-date-picker
|
||||
v-model="deadline"
|
||||
type="datetime"
|
||||
format="YYYY/MM/DD HH:mm:ss"
|
||||
value-format="YYYY/MM/DD HH:mm:ss"
|
||||
:clearable="false"
|
||||
@change="handleGetPrescription"
|
||||
/>
|
||||
<el-radio-group v-model="therapyEnum" class="ml20" @change="handleRadioChange">
|
||||
<el-radio :value="undefined">全部</el-radio>
|
||||
<el-radio :value="1">长期</el-radio>
|
||||
<el-radio :value="2">临时</el-radio>
|
||||
</el-radio-group>
|
||||
<el-button class="ml20" type="primary" plain @click="handleGetPrescription">
|
||||
查询
|
||||
</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-button class="ml20" type="danger" plain> 不执行 </el-button>
|
||||
<el-button class="ml20" type="primary"> 皮试结果 </el-button>
|
||||
<el-button class="ml20 mr20" type="primary"> 执行选中 </el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
style="padding: 10px; background-color: #eef9fd; height: 100%; overflow-y: auto"
|
||||
v-loading="loading"
|
||||
>
|
||||
<el-collapse
|
||||
v-model="activeNames"
|
||||
expand-icon-position="left"
|
||||
v-if="prescriptionList.length > 0"
|
||||
style="
|
||||
border-bottom: 0px;
|
||||
border-top: 0px;
|
||||
border-radius: 0px;
|
||||
overflow-y: auto;
|
||||
max-height: calc(100vh - 200px);
|
||||
"
|
||||
>
|
||||
<el-collapse-item
|
||||
v-for="(item, index) in prescriptionList"
|
||||
:key="index"
|
||||
:name="item[0].encounterId"
|
||||
style="
|
||||
border: 2px solid #e4e7ed;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 10px;
|
||||
overflow: hidden;
|
||||
"
|
||||
>
|
||||
<template #title>
|
||||
<div style="display: flex; justify-content: space-between; align-items: center">
|
||||
<div>
|
||||
<span class="item-value">{{ item[0].badName }}</span>
|
||||
<span class="item-value">{{ '【' + item[0].busNo + '】' }}</span>
|
||||
<span class="item-value">{{ item[0].patientName + item[0].age }}</span>
|
||||
<span>{{ item[0].contractName }}</span>
|
||||
<span>{{ item[0].conditionNames }}</span>
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 20px;
|
||||
align-items: center;
|
||||
margin-right: 20px;
|
||||
"
|
||||
>
|
||||
<div style="display: inline-block; margin-right: 10px">
|
||||
<span class="descriptions-item-label">住院医生:</span>
|
||||
<span>{{ item[0].requesterId_dictText }}</span>
|
||||
</div>
|
||||
<div style="display: inline-block; margin-right: 10px">
|
||||
<div
|
||||
class="descriptions-item-label"
|
||||
style="height: 20px; line-height: 20px; text-align: center; margin: 0"
|
||||
>
|
||||
预交金额
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
text-align: center;
|
||||
font-size: 15px;
|
||||
color: #ec8c43;
|
||||
"
|
||||
>
|
||||
{{ item[0].balanceAmount?.toFixed(2) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-table :data="item" border :header-cell-style="{ background: '#eef9fd !important' }">
|
||||
<el-table-column type="selection" align="center" width="50" />
|
||||
<el-table-column label="类型" align="center" prop="therapyEnum_enumText" width="80">
|
||||
<template #default="scope">
|
||||
<span :style="scope.row.therapyEnum == '1' ? 'color: #a6745c' : 'color: #3787a5'">
|
||||
{{ scope.row.therapyEnum_enumText }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="医嘱内容" prop="adviceName" />
|
||||
<el-table-column label="开始/终止" prop="requestTime" width="230" />
|
||||
<el-table-column label="预计执行" prop="times">
|
||||
<template #default="scope">
|
||||
<div
|
||||
v-for="(item, timeIndex) in scope.row.times"
|
||||
:key="timeIndex"
|
||||
style="padding-bottom: 5px"
|
||||
>
|
||||
<span>{{ item }}</span>
|
||||
<el-checkbox-group
|
||||
v-model="scope.row.checkedRates[timeIndex]"
|
||||
style="display: inline-block; margin-left: 15px"
|
||||
>
|
||||
<el-checkbox
|
||||
v-for="(rateItem, rateIndex) in scope.row.rate"
|
||||
:key="rateIndex"
|
||||
:value="rateItem"
|
||||
border
|
||||
size="small"
|
||||
style="margin-right: 15px"
|
||||
>
|
||||
{{ rateItem }}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
<el-empty v-else description="点击查询获取患者医嘱信息"></el-empty>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getPrescriptionList } from './api';
|
||||
import { patientInfoList } from '../store/patient.js';
|
||||
import { formatDate, formatDateStr } from '@/utils/index';
|
||||
|
||||
const activeNames = ref([]);
|
||||
const prescriptionList = ref([]);
|
||||
const deadline = ref(formatDateStr(new Date(), 'YYYY-MM-DD') + ' 23:59:59');
|
||||
const therapyEnum = ref(undefined);
|
||||
const { proxy } = getCurrentInstance();
|
||||
const loading = ref(false);
|
||||
const props = defineProps({
|
||||
exeStatus: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
});
|
||||
|
||||
function handleRadioChange() {
|
||||
handleGetPrescription();
|
||||
}
|
||||
|
||||
function handleGetPrescription() {
|
||||
if (patientInfoList.value.length > 0) {
|
||||
loading.value = true;
|
||||
let encounterIds = patientInfoList.value.map((i) => i.encounterId).join(',');
|
||||
getPrescriptionList({
|
||||
encounterIds: encounterIds,
|
||||
pageSize: 10000,
|
||||
pageNo: 1,
|
||||
therapyEnum: therapyEnum.value,
|
||||
exeStatus: props.exeStatus,
|
||||
}).then((res) => {
|
||||
// try {
|
||||
// 根据encounterId分组
|
||||
const groupedPrescriptions = res.data.records.reduce((groups, prescription) => {
|
||||
// 获取当前医嘱全部执行频次
|
||||
let rate;
|
||||
let times;
|
||||
if (prescription.therapyEnum == 1) {
|
||||
rate = prescription.dayTimes?.split(',');
|
||||
times = getDateRange(prescription.requestTime, deadline.value);
|
||||
} else {
|
||||
rate = [formatDateStr(prescription.requestTime, 'HH:mm')];
|
||||
times = [formatDateStr(prescription.requestTime, 'MM-DD')];
|
||||
}
|
||||
|
||||
prescription.times = times;
|
||||
prescription.rate = rate;
|
||||
|
||||
// 添加复选框状态管理
|
||||
prescription.checkedRates = {};
|
||||
if (rate) {
|
||||
times.forEach((time, index) => {
|
||||
// 默认选中所有执行频次
|
||||
prescription.checkedRates[index] = [...rate];
|
||||
});
|
||||
}
|
||||
// 把相同encounterId的医嘱放在同一个数组中
|
||||
const encounterId = prescription.encounterId;
|
||||
if (!groups[encounterId]) {
|
||||
groups[encounterId] = [];
|
||||
}
|
||||
if (!activeNames.value.includes(encounterId)) {
|
||||
activeNames.value.push(encounterId);
|
||||
}
|
||||
groups[encounterId].push(prescription);
|
||||
return groups;
|
||||
}, {});
|
||||
|
||||
// 将分组结果转换为数组形式
|
||||
prescriptionList.value = Object.values(groupedPrescriptions);
|
||||
console.log(prescriptionList.value, '1111');
|
||||
loading.value = false;
|
||||
// } catch {
|
||||
// loading.value = false;
|
||||
// }
|
||||
});
|
||||
} else {
|
||||
prescriptionList.value = [];
|
||||
// proxy.$message.warning('请选择患者');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算两个日期之间的所有日期(包含起始和结束日期)
|
||||
* @param {string|Date} startDate - 开始日期
|
||||
* @param {string|Date} endDate - 结束日期
|
||||
* @returns {Array<string>} 格式为MM-DD的日期数组
|
||||
*/
|
||||
function getDateRange(startDate, endDate) {
|
||||
const start = new Date(startDate);
|
||||
const end = new Date(endDate);
|
||||
|
||||
// 重置时间部分,只保留日期
|
||||
start.setHours(0, 0, 0, 0);
|
||||
end.setHours(0, 0, 0, 0);
|
||||
|
||||
const dates = [];
|
||||
const current = new Date(start);
|
||||
|
||||
// 循环添加日期直到结束日期
|
||||
while (current <= end) {
|
||||
// 格式化为MM-DD
|
||||
const month = String(current.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(current.getDate()).padStart(2, '0');
|
||||
dates.push(`${month}-${day}`);
|
||||
|
||||
// 移动到下一天
|
||||
current.setDate(current.getDate() + 1);
|
||||
}
|
||||
return dates;
|
||||
}
|
||||
|
||||
// 处理后端返回的时间集合
|
||||
function handleTime() {}
|
||||
|
||||
defineExpose({
|
||||
handleGetPrescription,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-collapse-icon-position-left :deep(.el-collapse-item__header) {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
:deep(.el-collapse-item__wrap) {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
/* 表头背景色 */
|
||||
:deep(.prescription-table .el-table__header th) {
|
||||
background-color: #eef9fd !important;
|
||||
}
|
||||
|
||||
:deep(.el-table__row:hover > td) {
|
||||
background-color: #eef9fd !important;
|
||||
}
|
||||
|
||||
.item-value {
|
||||
color: #606266;
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,137 @@
|
||||
<template>
|
||||
<div style="display: flex; justify-content: space-between">
|
||||
<div style="width: 20%; height: 90vh; border-right: solid 2px #e4e7ed">
|
||||
<div
|
||||
style="
|
||||
height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
border-bottom: solid 2px #e4e7ed;
|
||||
"
|
||||
>
|
||||
<el-icon
|
||||
@click="refresh"
|
||||
class="refresh-icon"
|
||||
style="cursor: pointer; font-size: 20px; margin-right: 10px"
|
||||
>
|
||||
<Refresh />
|
||||
</el-icon>
|
||||
</div>
|
||||
<el-tabs v-model="active" class="demo-tabs centered-tabs tab-header" @tab-click="handleClick">
|
||||
<el-tab-pane label="在科" name="first" style="padding: 15px 10px">
|
||||
<PatientList />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="转科" name="second" style="padding: 0 10px">
|
||||
<PatientList />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
<div style="width: 100%">
|
||||
<el-tabs
|
||||
v-model="activeName"
|
||||
class="demo-tabs centered-tabs"
|
||||
@tab-change="handleClick"
|
||||
>
|
||||
<el-tab-pane
|
||||
v-for="tab in prescriptionTabs"
|
||||
:key="tab.name"
|
||||
:lazy="true"
|
||||
:label="tab.label"
|
||||
:name="tab.name"
|
||||
>
|
||||
<!-- 使用模板引用 -->
|
||||
<PrescriptionList
|
||||
:exeStatus="exeStatus"
|
||||
:ref="(el) => setPrescriptionRef(el, tab.name)"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getCurrentInstance } from 'vue';
|
||||
import PatientList from './components/patientList.vue';
|
||||
import PrescriptionList from './components/prescriptionList.vue';
|
||||
|
||||
const activeName = ref('preparation');
|
||||
const active = ref('first');
|
||||
const exeStatus = ref(1);
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
// 存储子组件引用的对象
|
||||
const prescriptionRefs = ref({});
|
||||
|
||||
// 定义处方列表tabs配置
|
||||
const prescriptionTabs = [
|
||||
{ label: '待执行', name: 'preparation' },
|
||||
{ label: '已执行', name: 'completed' },
|
||||
{ label: '不执行', name: 'stopped' },
|
||||
{ label: '取消执行', name: 'cancel' }
|
||||
];
|
||||
|
||||
// 设置处方组件引用
|
||||
function setPrescriptionRef(el, name) {
|
||||
if (el) {
|
||||
prescriptionRefs.value[name] = el;
|
||||
}
|
||||
}
|
||||
|
||||
function handleClick(tabName) {
|
||||
// tabName是tab的name属性值
|
||||
const activeTabName = tabName || activeName.value;
|
||||
|
||||
switch(activeTabName){
|
||||
case 'preparation':
|
||||
exeStatus.value = 1;
|
||||
break;
|
||||
case 'completed':
|
||||
exeStatus.value = 6;
|
||||
break;
|
||||
case 'stopped':
|
||||
exeStatus.value = 5;
|
||||
break;
|
||||
case 'cancel':
|
||||
exeStatus.value = 9;
|
||||
break;
|
||||
}
|
||||
|
||||
// 调用子组件方法
|
||||
nextTick(() => {
|
||||
if (prescriptionRefs.value[activeTabName] &&
|
||||
typeof prescriptionRefs.value[activeTabName].handleGetPrescription === 'function') {
|
||||
prescriptionRefs.value[activeTabName].handleGetPrescription();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
provide('handleGetPrescription', (value) => {
|
||||
prescriptionRefs.value[activeName.value].handleGetPrescription();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.centered-tabs :deep(.el-tabs__nav-wrap) {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.centered-tabs :deep(.el-tabs__nav-scroll) {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.tab-header :deep(.el-tabs__item) {
|
||||
height: 50px !important;
|
||||
}
|
||||
|
||||
.centered-tabs :deep(.el-tabs__nav) {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
:deep(.el-tabs__header) {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,12 @@
|
||||
// 选择患者信息
|
||||
export const patientInfo = ref()
|
||||
export function updatePatientInfo(info) {
|
||||
patientInfo.value = info
|
||||
}
|
||||
|
||||
// 多选患者
|
||||
export const patientInfoList = ref([])
|
||||
export function updatePatientInfoList(info) {
|
||||
patientInfoList.value = info
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user