版本更新

This commit is contained in:
Zhang.WH
2025-09-03 15:54:41 +08:00
parent 0b93d16b64
commit 8f82322d10
3290 changed files with 154339 additions and 23829 deletions

View File

@@ -0,0 +1,216 @@
<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>
<el-radio-group v-model="type" class="ml20" @change="handleRadioChange">
<el-radio :label="1">全部</el-radio>
<el-radio :label="2">长期</el-radio>
<el-radio :label="3">临时</el-radio>
</el-radio-group>
<el-button class="ml20" type="primary" plain @click="handleGetPrescription">
查询
</el-button>
</div>
<div>
<span class="descriptions-item-label">全选</span>
<el-switch/>
<el-button class="ml20" type="primary"> 核对通过 </el-button>
<el-button class="ml20 mr20" type="danger"> 退回 </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>
<span>11202501010101</span>
<span>张先生//20</span>
<span>自费</span>
</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 type = ref(1);
const { proxy } = getCurrentInstance();
const loading = ref(false);
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 }).then((res) => {
// try {
// 根据encounterId分组
const groupedPrescriptions = res.data.records.reduce((groups, prescription) => {
// 获取当前医嘱全部执行频次
let rate = prescription.dayTimes?.split(',');
let times = getDateRange(prescription.requestTime, deadline.value);
prescription.times = times;
prescription.rate = rate;
// 添加复选框状态管理
prescription.checkedRates = {};
if (rate) {
times.forEach((time, index) => {
// 默认选中所有执行频次
prescription.checkedRates[index] = [...rate];
});
}
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 {
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() {}
</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;
}
</style>