解决合并冲突

This commit is contained in:
2025-12-10 14:20:24 +08:00
parent e1385cb3e6
commit 18f6a845e6
804 changed files with 61881 additions and 13577 deletions

View File

@@ -0,0 +1,89 @@
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/medicine-summary/dispensing-form',
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 medicineSummary(data) {
return request({
url: '/nurse-station/medicine-summary/medicine-summary',
method: 'post',
data: data
})
}
/**
* 查询汇总领药单
*/
export function getMedicineSummary(param) {
return request({
url: '/nurse-station/medicine-summary/summary-form',
method: 'get',
params: param
})
}
/**
* 获取汇总单详细信息
*/
export function getMedicineSummaryDetail(param) {
return request({
url: '/nurse-station/medicine-summary/summary-form-detail',
method: 'get',
params: param
})
}

View File

@@ -0,0 +1,146 @@
<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>

View File

@@ -0,0 +1,327 @@
<template>
<div style="height: calc(100vh - 176px)">
<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>{{ item[0].bedName + '【' + item[0].busNo + '】' }}</span>
<span>
{{
item[0].patientName + ' / ' + item[0].genderEnum_enumText + ' / ' + item[0].age
}}
</span>
<el-tag style="margin-left: 10px">{{ item[0].contractName }}</el-tag>
<span style="margin-left: 30px; font-weight: 600">
{{ 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
:ref="'tableRef' + index"
: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">
<template #default="scope">
<span>
{{ scope.row.adviceName }}
</span>
<template v-if="scope.row.adviceTable == 'med_medication_request'">
<span>
{{ ' 【' + scope.row.volume + '】' }}
</span>
<span style="color: #447c95 !important">
{{
'(' +
scope.row.methodCode_dictText +
' ' +
scope.row.dose +
scope.row.doseUnitCode_dictText +
' ' +
scope.row.rateCode_dictText +
')'
}}
</span>
</template>
</template>
</el-table-column>
<el-table-column label="领药总量" prop="requestTime" width="150">
<template #default="scope">
{{ '1支' }}
</template>
</el-table-column>
<el-table-column label="取药科室" prop="requestTime" width="150">
<template #default="scope">
{{ scope.row.positionName }}
</template>
</el-table-column>
<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[item]"
style="display: inline-block; margin-left: 15px"
>
<el-checkbox
v-for="(rateItem, rateIndex) in scope.row.rate[item]"
:key="rateIndex"
:value="rateItem.rate"
@change="(value) => handleRateChange(value, rateItem, scope.row)"
border
size="small"
style="margin-right: 15px"
>
{{ rateItem.rate }}
<template v-if="rateItem.practitionerName">
{{ rateItem.practitionerName }}
</template>
</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, adviceExecute, adviceCancel, medicineSummary } from './api';
import { patientInfoList } from '../store/patient.js';
import { formatDate, formatDateStr } from '@/utils/index';
import { ref, getCurrentInstance } from 'vue';
import useUserStore from '@/store/modules/user';
const activeNames = ref([]);
const userStore = useUserStore();
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 chooseAll = ref(false);
const props = defineProps({
exeStatus: {
type: Number,
default: 1,
},
requestStatus: {
type: Number,
default: 1,
},
deadline: {
type: String,
},
});
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,
requestStatus: props.requestStatus,
}).then((res) => {
// try {
// 根据encounterId分组
const groupedPrescriptions = res.data.records.reduce((groups, prescription) => {
let times = new Set();
let rate = {};
let checkedRates = {};
// 汇总时间点 默认全部汇总
prescription.dispenseIds = [];
prescription.medicineSummaryParamList.forEach((item) => {
// 已汇总的时间点不需要显示
if (item.dispenseStatus != 8) {
prescription.dispenseIds.push({
dispenseId: item.dispenseId,
receiverId: userStore.id,
});
// 将全部的时间点拆分 把日期去重,页面显示示例 05-15 [01:30 02:30 03:30]
let time = item.dispenseTime.substring(5, 10);
let rateTime = item.dispenseTime.substring(11, 16);
times.add(time);
rate[time] = rate[time] || [];
rate[time].push({ rate: rateTime, dispenseId: item.dispenseId });
checkedRates[time] = checkedRates[time] || [];
checkedRates[time].push(rateTime);
}
});
prescription.times = Array.from(times);
prescription.rate = rate;
prescription.checkedRates = checkedRates;
// 把相同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);
loading.value = false;
// } catch {
// loading.value = false;
// }
});
chooseAll.value = false;
} else {
prescriptionList.value = [];
// proxy.$message.warning('请选择患者');
}
}
function handleMedicineSummary() {
let paramList = getSelectRows();
let ids = [];
paramList = paramList.forEach((item) => {
ids.push(...item.dispenseIds);
});
medicineSummary(ids).then((res) => {
if (res.code == 200) {
proxy.$message.success('操作成功');
}
});
}
function getSelectRows() {
// 获取选中的医嘱信息
let list = [];
prescriptionList.value.forEach((item, index) => {
list = [...list, ...proxy.$refs['tableRef' + index][0].getSelectionRows()];
});
return list;
}
function handleRateChange(value, item, row) {
// 拼接当前选中时间
if (value) {
row.dispenseIds.push({ dispenseId: item.dispenseId, receiverId: userStore.id });
} else {
row.dispenseIds.splice(
row.dispenseIds.findIndex((k) => {
return k.dispenseId === item.dispenseId;
}),
1
);
}
}
defineExpose({
handleGetPrescription,
handleMedicineSummary,
});
</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>

View File

@@ -0,0 +1,199 @@
<template>
<div style="height: calc(100vh - 176px)">
<div
style="padding: 10px; background-color: #eef9fd; height: 100%; overflow-y: auto"
v-loading="loading"
>
<el-table
:data="medicineSummaryFormList"
border
:ref="'tableRef' + index"
:header-cell-style="{ background: '#eef9fd !important' }"
>
<el-table-column label="单据号" prop="busNo" align="center" width="180" />
<el-table-column label="申请时间" align="center" prop="applyTime" />
<el-table-column label="发药时间" align="center" prop="dispenseTime" />
<el-table-column label="药房" align="center" prop="locationName" />
<el-table-column label="申请人" align="center" prop="applicantName" />
<el-table-column label="领药人" align="center" prop="receiverName" />
<el-table-column label="发药状态" align="center" prop="statusEnum_enumText" />
<el-table-column label="操作" width="100" align="center">
<template #default="scope">
<el-button link type="primary" @click="getDetail(scope.row)">详情</el-button>
</template>
</el-table-column>
</el-table>
</div>
<el-dialog v-model="dialogVisible" title="汇总单详情" width="900">
<el-table
:data="medicineSummaryFormDetails"
border
:header-cell-style="{ background: '#eef9fd !important' }"
>
<el-table-column label="序号" type="index" align="center" width="60" />
<el-table-column label="药品名称" prop="itemName" align="center" />
<el-table-column label="规格" prop="totalVolume" align="center" width="180" />
<el-table-column label="批次号" prop="lotNumber" align="center" width="180" />
<el-table-column label="数量" prop="itemQuantity" align="center" width="180">
<template #default="scope">
<span>{{ scope.row.itemQuantity + ' ' + scope.row.minUnitCode_dictText }}</span>
</template>
</el-table-column>
</el-table>
<template #footer>
<el-button @click="dialogVisible = false">关闭</el-button>
</template>
</el-dialog>
</div>
</template>
<script setup>
import { getMedicineSummary, getMedicineSummaryDetail } from './api';
import { patientInfoList } from '../store/patient.js';
import { ref, getCurrentInstance } from 'vue';
const medicineSummaryFormList = ref([]);
const medicineSummaryFormDetails = ref([]);
const dialogVisible = ref(false);
const { proxy } = getCurrentInstance();
const loading = ref(false);
const props = defineProps({
exeStatus: {
type: Number,
default: 1,
},
requestStatus: {
type: Number,
default: 1,
},
});
handleGetPrescription();
function handleGetPrescription() {
loading.value = true;
let encounterIds = patientInfoList.value.map((i) => i.encounterId).join(',');
getMedicineSummary({}).then((res) => {
medicineSummaryFormList.value = res.data.records;
loading.value = false;
});
}
// 获取发药单详情
function getDetail(row) {
getMedicineSummaryDetail({ summaryNo: row.busNo }).then((res) => {
medicineSummaryFormDetails.value = res.data;
dialogVisible.value = true;
});
}
function handleExecute() {
let list = getSelectRows();
list = list.map((item) => {
return {
requestId: item.requestId,
accountId: item.accountId,
adviceTable: item.adviceTable,
executeTimes: item.executeTimes,
};
});
}
function handleCancel() {
let list = getSelectRows();
console.log(list, 'list');
list = list.map((item) => {
return {
procedureId: item.procedureId,
executeTimes: item.cancelTimes,
};
});
}
function getSelectRows() {
// 获取选中的医嘱信息
let list = [];
prescriptionList.value.forEach((item, index) => {
list = [...list, ...proxy.$refs['tableRef' + index][0].getSelectionRows()];
});
return list;
}
/**
* 计算两个日期之间的所有日期(包含起始和结束日期)
* @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 handleRateChange(value, date, time, row) {
// 拼接当前选中时间
let tiemStr = row.year + '-' + date + ' ' + time + ':00';
if (value) {
row.executeTimes.push(tiemStr);
} else {
row.executeTimes.splice(row.executeTimes.indexOf(tiemStr), 1);
}
console.log(row.executeTimes, 'row.executeTimes');
}
function handelSwicthChange(value) {
prescriptionList.value.forEach((item, index) => {
proxy.$refs['tableRef' + index][0].toggleAllSelection();
});
}
// 处理后端返回的时间集合
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>