版本更新
This commit is contained in:
@@ -31,4 +31,26 @@ export function getPrescriptionList(queryParams) {
|
||||
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
|
||||
})
|
||||
}
|
||||
@@ -29,9 +29,25 @@
|
||||
</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>
|
||||
<span class="descriptions-item-label">全选:</span>
|
||||
<el-switch v-model="chooseAll" @change="handelSwicthChange" />
|
||||
<el-button
|
||||
class="ml20"
|
||||
type="primary"
|
||||
@click="handleExecute"
|
||||
:disabled="props.exeStatus == 6"
|
||||
>
|
||||
执行选中
|
||||
</el-button>
|
||||
<el-button
|
||||
class="ml20 mr20"
|
||||
type="danger"
|
||||
:disabled="props.exeStatus != 6"
|
||||
plain
|
||||
@click="handleCancel"
|
||||
>
|
||||
取消执行
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
@@ -64,11 +80,16 @@
|
||||
<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>
|
||||
<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="
|
||||
@@ -105,7 +126,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-table :data="item" border :header-cell-style="{ background: '#eef9fd !important' }">
|
||||
<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">
|
||||
@@ -114,8 +140,31 @@
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="医嘱内容" prop="adviceName" />
|
||||
<el-table-column label="开始/终止" prop="requestTime" width="230" />
|
||||
<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="200" />
|
||||
<el-table-column label="预计执行" prop="times">
|
||||
<template #default="scope">
|
||||
<div
|
||||
@@ -129,14 +178,26 @@
|
||||
style="display: inline-block; margin-left: 15px"
|
||||
>
|
||||
<el-checkbox
|
||||
v-for="(rateItem, rateIndex) in scope.row.rate"
|
||||
v-for="(rateItem, rateIndex) in scope.row.rate[item]"
|
||||
:key="rateIndex"
|
||||
:value="rateItem"
|
||||
:value="rateItem.rate"
|
||||
@change="
|
||||
(value) =>
|
||||
handleRateChange(
|
||||
value,
|
||||
item,
|
||||
scope.row.checkedRates[timeIndex],
|
||||
scope.row
|
||||
)
|
||||
"
|
||||
border
|
||||
size="small"
|
||||
style="margin-right: 15px"
|
||||
>
|
||||
{{ rateItem }}
|
||||
{{ rateItem.rate }}
|
||||
<template v-if="rateItem.practitionerName">
|
||||
{{ rateItem.practitionerName }}
|
||||
</template>
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
@@ -151,7 +212,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getPrescriptionList } from './api';
|
||||
import { getPrescriptionList, adviceExecute, adviceCancel } from './api';
|
||||
import { patientInfoList } from '../store/patient.js';
|
||||
import { formatDate, formatDateStr } from '@/utils/index';
|
||||
import { ref, getCurrentInstance } from 'vue';
|
||||
@@ -162,11 +223,16 @@ 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,
|
||||
},
|
||||
});
|
||||
|
||||
function handleRadioChange() {
|
||||
@@ -183,6 +249,7 @@ function handleGetPrescription() {
|
||||
pageNo: 1,
|
||||
therapyEnum: therapyEnum.value,
|
||||
exeStatus: props.exeStatus,
|
||||
requestStatus: props.requestStatus,
|
||||
}).then((res) => {
|
||||
// try {
|
||||
// 根据encounterId分组
|
||||
@@ -191,22 +258,106 @@ function handleGetPrescription() {
|
||||
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.year = formatDateStr(prescription.requestTime, 'YYYY');
|
||||
// 初始化执行时间列表
|
||||
prescription.executeTimes = [];
|
||||
// 初始化取消执行Id列表
|
||||
prescription.procedureIds = [];
|
||||
// 添加复选框状态管理
|
||||
prescription.checkedRates = {};
|
||||
let exeTimeList = prescription.exePerformRecordList.map((item) => {
|
||||
return formatDateStr(item.occurrenceTime, 'YYYY-MM-DD HH:mm:ss');
|
||||
});
|
||||
let stopTimeList = prescription.stopPerformRecordList.map((item) => {
|
||||
return formatDateStr(item.occurrenceTime, 'YYYY-MM-DD HH:mm:ss');
|
||||
});
|
||||
let cancelTimeList = prescription.cancelPerformRecordList.map((item) => {
|
||||
return formatDateStr(item.occurrenceTime, 'YYYY-MM-DD HH:mm:ss');
|
||||
});
|
||||
if (rate) {
|
||||
times.forEach((time, index) => {
|
||||
// 默认选中所有执行频次
|
||||
prescription.checkedRates[index] = [...rate];
|
||||
// 拼成日期加全部时间点的形式,显示示例:03-01 [09:00, 10:00, 11:00]
|
||||
// 重构后的逻辑
|
||||
let validTimes = [];
|
||||
let validRates = {};
|
||||
let newCheckedRates = {};
|
||||
|
||||
times.forEach((time, timeIndex) => {
|
||||
let checkedRatesForTime = [];
|
||||
let rateItems = [];
|
||||
rate.forEach((rateItem) => {
|
||||
let dateStr = prescription.year + '-' + time + ' ' + rateItem + ':00';
|
||||
prescription.executeTimes.push(dateStr);
|
||||
switch (props.exeStatus) {
|
||||
case 1:
|
||||
// 如果该时间点未执行,则加入待选中列表
|
||||
if (!exeTimeList.includes(dateStr)) {
|
||||
rateItems.push({
|
||||
rate: rateItem,
|
||||
});
|
||||
checkedRatesForTime.push(rateItem);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
let index = exeTimeList.findIndex((item) => {
|
||||
return item == dateStr;
|
||||
});
|
||||
if (index != -1) {
|
||||
rateItems.push({
|
||||
procedureId: prescription.exePerformRecordList[index].procedureId,
|
||||
practitionerName: prescription.exePerformRecordList[index].practitionerName,
|
||||
rate: rateItem,
|
||||
});
|
||||
checkedRatesForTime.push(rateItem);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (stopTimeList.includes(dateStr)) {
|
||||
rateItems.push({
|
||||
rate: rateItem,
|
||||
});
|
||||
checkedRatesForTime.push(rateItem);
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
if (cancelTimeList.includes(dateStr)) {
|
||||
rateItems.push({
|
||||
rate: rateItem,
|
||||
});
|
||||
checkedRatesForTime.push(rateItem);
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
validRates[time] = rateItems;
|
||||
|
||||
// 只有当该时间点有待执行的项目时,才保留该时间点
|
||||
if (checkedRatesForTime.length > 0) {
|
||||
let newIndex = validTimes.length;
|
||||
validTimes.push(time);
|
||||
newCheckedRates[newIndex] = checkedRatesForTime;
|
||||
}
|
||||
});
|
||||
|
||||
console.log(validRates, '111');
|
||||
// 更新处方对象
|
||||
prescription.times = validTimes;
|
||||
prescription.rate = validRates;
|
||||
prescription.checkedRates = newCheckedRates;
|
||||
|
||||
// 处理已执行记录
|
||||
prescription.exePerformRecordList.forEach((item) => {
|
||||
if (prescription.executeTimes.includes(item.occurrenceTime)) {
|
||||
prescription.procedureIds.push(item.procedureId);
|
||||
}
|
||||
});
|
||||
}
|
||||
// 把相同encounterId的医嘱放在同一个数组中
|
||||
@@ -223,18 +374,61 @@ function handleGetPrescription() {
|
||||
|
||||
// 将分组结果转换为数组形式
|
||||
prescriptionList.value = Object.values(groupedPrescriptions);
|
||||
console.log(prescriptionList.value, '1111');
|
||||
loading.value = false;
|
||||
// } catch {
|
||||
// loading.value = false;
|
||||
// }
|
||||
});
|
||||
chooseAll.value = false;
|
||||
} else {
|
||||
prescriptionList.value = [];
|
||||
// proxy.$message.warning('请选择患者');
|
||||
}
|
||||
}
|
||||
|
||||
function handleExecute() {
|
||||
let list = getSelectRows();
|
||||
list = list.map((item) => {
|
||||
return {
|
||||
requestId: item.requestId,
|
||||
accountId: item.accountId,
|
||||
adviceTable: item.adviceTable,
|
||||
executeTimes: item.executeTimes,
|
||||
};
|
||||
});
|
||||
console.log(list, 'list');
|
||||
adviceExecute({ adviceExecuteDetailList: list }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
handleGetPrescription();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function handleCancel() {
|
||||
let list = getSelectRows();
|
||||
console.log(list, 'list');
|
||||
list = list.map((item) => {
|
||||
return {
|
||||
procedureId: item.procedureId,
|
||||
executeTimes: item.cancelTimes,
|
||||
};
|
||||
});
|
||||
adviceCancel({ adviceExecuteParam: list }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
handleGetPrescription();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getSelectRows() {
|
||||
// 获取选中的医嘱信息
|
||||
let list = [];
|
||||
prescriptionList.value.forEach((item, index) => {
|
||||
list = [...list, ...proxy.$refs['tableRef' + index][0].getSelectionRows()];
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算两个日期之间的所有日期(包含起始和结束日期)
|
||||
* @param {string|Date} startDate - 开始日期
|
||||
@@ -265,6 +459,23 @@ function getDateRange(startDate, endDate) {
|
||||
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() {}
|
||||
|
||||
|
||||
@@ -28,22 +28,19 @@
|
||||
</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"
|
||||
<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"
|
||||
:lazy="true"
|
||||
:label="tab.label"
|
||||
:name="tab.name"
|
||||
>
|
||||
<!-- 使用模板引用 -->
|
||||
<PrescriptionList
|
||||
:exeStatus="exeStatus"
|
||||
:ref="(el) => setPrescriptionRef(el, tab.name)"
|
||||
<PrescriptionList
|
||||
:exeStatus="exeStatus"
|
||||
:requestStatus="requestStatus"
|
||||
:ref="(el) => setPrescriptionRef(el, tab.name)"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
@@ -59,6 +56,7 @@ import PrescriptionList from './components/prescriptionList.vue';
|
||||
const activeName = ref('preparation');
|
||||
const active = ref('first');
|
||||
const exeStatus = ref(1);
|
||||
const requestStatus = ref(3);
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
// 存储子组件引用的对象
|
||||
@@ -69,7 +67,7 @@ const prescriptionTabs = [
|
||||
{ label: '待执行', name: 'preparation' },
|
||||
{ label: '已执行', name: 'completed' },
|
||||
{ label: '不执行', name: 'stopped' },
|
||||
{ label: '取消执行', name: 'cancel' }
|
||||
{ label: '取消执行', name: 'cancel' },
|
||||
];
|
||||
|
||||
// 设置处方组件引用
|
||||
@@ -82,10 +80,13 @@ function setPrescriptionRef(el, name) {
|
||||
function handleClick(tabName) {
|
||||
// tabName是tab的name属性值
|
||||
const activeTabName = tabName || activeName.value;
|
||||
|
||||
switch(activeTabName){
|
||||
|
||||
switch (activeTabName) {
|
||||
case 'preparation':
|
||||
// 执行状态待执行
|
||||
exeStatus.value = 1;
|
||||
// 请求状态已校对
|
||||
requestStatus.value = 3;
|
||||
break;
|
||||
case 'completed':
|
||||
exeStatus.value = 6;
|
||||
@@ -97,11 +98,13 @@ function handleClick(tabName) {
|
||||
exeStatus.value = 9;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// 调用子组件方法
|
||||
nextTick(() => {
|
||||
if (prescriptionRefs.value[activeTabName] &&
|
||||
typeof prescriptionRefs.value[activeTabName].handleGetPrescription === 'function') {
|
||||
if (
|
||||
prescriptionRefs.value[activeTabName] &&
|
||||
typeof prescriptionRefs.value[activeTabName].handleGetPrescription === 'function'
|
||||
) {
|
||||
prescriptionRefs.value[activeTabName].handleGetPrescription();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -31,4 +31,26 @@ export function getPrescriptionList(queryParams) {
|
||||
method: 'get',
|
||||
params: queryParams
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 医嘱校对通过
|
||||
*/
|
||||
export function adviceVerify(data) {
|
||||
return request({
|
||||
url: '/nurse-station/advice-process/advice-verify',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 医嘱退回
|
||||
*/
|
||||
export function cancel(data) {
|
||||
return request({
|
||||
url: '/nurse-station/advice-process/advice-reject',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
@@ -46,7 +46,6 @@ function onTreeLoaded() {
|
||||
// 获取所有节点并设置为选中状态
|
||||
const allNodes = getAllNodes(treeRef.value.store.root.childNodes);
|
||||
const allKeys = allNodes.map((node) => node.key);
|
||||
|
||||
treeRef.value.setCheckedKeys(allKeys, true); // 第二个参数设为true表示级联选中
|
||||
allNodesLoaded.value = true;
|
||||
});
|
||||
@@ -122,7 +121,10 @@ function handleCheckChange(data, checked) {
|
||||
console.log(list, '2345678');
|
||||
|
||||
updatePatientInfoList(list);
|
||||
handleGetPrescription();
|
||||
}
|
||||
|
||||
const handleGetPrescription = inject('handleGetPrescription');
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
</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>
|
||||
<el-switch v-model="chooseAll" @change="handelSwicthChange" />
|
||||
<el-button class="ml20" type="primary" @click="handleCheck"> 核对通过 </el-button>
|
||||
<el-button class="ml20 mr20" type="danger" @click="handleCancel"> 退回 </el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
@@ -54,11 +54,60 @@
|
||||
"
|
||||
>
|
||||
<template #title>
|
||||
<span>11床【202501010101】</span>
|
||||
<span>张先生/男/20岁</span>
|
||||
<span>自费</span>
|
||||
<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 :header-cell-style="{ background: '#eef9fd !important' }">
|
||||
<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">
|
||||
@@ -67,34 +116,32 @@
|
||||
</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">
|
||||
<el-table-column label="医嘱内容" prop="adviceName">
|
||||
<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>
|
||||
<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="positionName" width="230" />
|
||||
<el-table-column label="签发时间" prop="requestTime" width="230" />
|
||||
</el-table>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
@@ -102,11 +149,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getPrescriptionList } from './api';
|
||||
import { getPrescriptionList, adviceVerify, cancel } from './api';
|
||||
import { patientInfoList } from '../store/patient.js';
|
||||
import { formatDate, formatDateStr } from '@/utils/index';
|
||||
import { formatDateStr } from '@/utils/index';
|
||||
|
||||
const activeNames = ref([]);
|
||||
const prescriptionList = ref([]);
|
||||
@@ -114,54 +160,109 @@ const deadline = ref(formatDateStr(new Date(), 'YYYY-MM-DD') + ' 23:59:59');
|
||||
const type = ref(1);
|
||||
const { proxy } = getCurrentInstance();
|
||||
const loading = ref(false);
|
||||
const chooseAll = ref(false);
|
||||
const props = defineProps({
|
||||
requestStatus: {
|
||||
type: Number,
|
||||
default: 2,
|
||||
},
|
||||
});
|
||||
|
||||
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 }).then((res) => {
|
||||
getPrescriptionList({
|
||||
encounterIds: encounterIds,
|
||||
requestStatus: props.requestStatus,
|
||||
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;
|
||||
// 根据encounterId分组
|
||||
const groupedPrescriptions = res.data.records.reduce((groups, prescription) => {
|
||||
const encounterId = prescription.encounterId;
|
||||
if (!groups[encounterId]) {
|
||||
groups[encounterId] = [];
|
||||
}
|
||||
if (!activeNames.value.includes(encounterId)) {
|
||||
activeNames.value.push(encounterId);
|
||||
}
|
||||
groups[encounterId].push(prescription);
|
||||
return groups;
|
||||
}, {});
|
||||
|
||||
// 添加复选框状态管理
|
||||
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;
|
||||
// }
|
||||
// 将分组结果转换为数组形式
|
||||
prescriptionList.value = Object.values(groupedPrescriptions);
|
||||
console.log(prescriptionList.value, '1111');
|
||||
loading.value = false;
|
||||
});
|
||||
chooseAll.value = false;
|
||||
} else {
|
||||
proxy.$message.warning('请选择患者');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 核对通过
|
||||
*/
|
||||
function handleCheck() {
|
||||
let list = getSelectRows();
|
||||
if (list.length > 0) {
|
||||
adviceVerify(list).then((res) => {
|
||||
if (res.code == 200) {
|
||||
proxy.$modal.msgSuccess(res.msg);
|
||||
handleGetPrescription();
|
||||
}
|
||||
});
|
||||
console.log(list, 'list');
|
||||
} else {
|
||||
proxy.$message.warning('请先选择医嘱信息');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 退回
|
||||
*/
|
||||
function handleCancel() {
|
||||
let list = getSelectRows();
|
||||
if (list.length > 0) {
|
||||
cancel(list).then((res) => {
|
||||
if (res.code == 200) {
|
||||
proxy.$modal.msgSuccess(res.msg);
|
||||
handleGetPrescription();
|
||||
}
|
||||
});
|
||||
console.log(list, 'list');
|
||||
} else {
|
||||
proxy.$message.warning('请先选择医嘱信息');
|
||||
}
|
||||
}
|
||||
|
||||
function getSelectRows() {
|
||||
// 获取选中的医嘱信息
|
||||
let list = [];
|
||||
prescriptionList.value.forEach((item, index) => {
|
||||
list = [...list, ...proxy.$refs['tableRef' + index][0].getSelectionRows()];
|
||||
});
|
||||
return list.map((item) => {
|
||||
return {
|
||||
requestId: item.requestId,
|
||||
requestTable: item.adviceTable,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function handelSwicthChange(value) {
|
||||
prescriptionList.value.forEach((item, index) => {
|
||||
proxy.$refs['tableRef' + index][0].toggleAllSelection();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算两个日期之间的所有日期(包含起始和结束日期)
|
||||
* @param {string|Date} startDate - 开始日期
|
||||
@@ -194,6 +295,10 @@ function getDateRange(startDate, endDate) {
|
||||
|
||||
// 处理后端返回的时间集合
|
||||
function handleTime() {}
|
||||
|
||||
defineExpose({
|
||||
handleGetPrescription,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -211,6 +316,6 @@ function handleTime() {}
|
||||
}
|
||||
|
||||
:deep(.el-table__row:hover > td) {
|
||||
background-color: #eef9fd !important;
|
||||
background-color: #eef9fd !important;
|
||||
}
|
||||
</style>
|
||||
@@ -28,13 +28,20 @@
|
||||
</el-tabs>
|
||||
</div>
|
||||
<div style="width: 100%">
|
||||
<el-tabs v-model="activeName" class="demo-tabs centered-tabs" @tab-click="handleClick">
|
||||
<el-tab-pane label="未校对" name="first">
|
||||
<PrescriptionList />
|
||||
<el-tabs v-model="activeName" class="demo-tabs centered-tabs" @tab-change="handleTabClick">
|
||||
<el-tab-pane
|
||||
v-for="tab in prescriptionTabs"
|
||||
:key="tab.name"
|
||||
:lazy="true"
|
||||
:label="tab.label"
|
||||
:name="tab.name"
|
||||
>
|
||||
<!-- 使用模板引用 -->
|
||||
<PrescriptionList
|
||||
:requestStatus="requestStatus"
|
||||
:ref="(el) => setPrescriptionRef(el, tab.name)"
|
||||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="已校对" name="second">Config</el-tab-pane>
|
||||
<el-tab-pane label="已停止" name="third">Role</el-tab-pane>
|
||||
<el-tab-pane label="已作废" name="fourth">Task</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</div>
|
||||
@@ -44,8 +51,63 @@
|
||||
import PatientList from './components/patientList.vue';
|
||||
import PrescriptionList from './components/prescriptionList.vue';
|
||||
|
||||
const activeName = ref('first');
|
||||
const activeName = ref('unverified');
|
||||
const active = ref('first');
|
||||
const requestStatus = ref(2);
|
||||
|
||||
// 存储子组件引用的对象
|
||||
const prescriptionRefs = ref({});
|
||||
|
||||
// 定义处方列表tabs配置
|
||||
const prescriptionTabs = [
|
||||
{ label: '未校对', name: 'unverified' },
|
||||
{ label: '已校对', name: 'verified' },
|
||||
{ label: '已停止', name: 'stopped' },
|
||||
{ label: '已退回', name: 'cancelled' },
|
||||
];
|
||||
|
||||
// 设置处方组件引用
|
||||
function setPrescriptionRef(el, name) {
|
||||
if (el) {
|
||||
prescriptionRefs.value[name] = el;
|
||||
}
|
||||
}
|
||||
|
||||
function handleTabClick(tabName) {
|
||||
// tabName是tab的name属性值
|
||||
const activeTabName = tabName || activeName.value;
|
||||
|
||||
switch (activeTabName) {
|
||||
case 'unverified':
|
||||
requestStatus.value = 2;
|
||||
break;
|
||||
case 'verified':
|
||||
requestStatus.value = 3;
|
||||
break;
|
||||
case 'stopped':
|
||||
requestStatus.value = 6;
|
||||
break;
|
||||
case 'cancelled':
|
||||
requestStatus.value = 1;
|
||||
break;
|
||||
}
|
||||
// 调用子组件方法
|
||||
nextTick(() => {
|
||||
debugger;
|
||||
console.log(prescriptionRefs.value[activeTabName], '1');
|
||||
|
||||
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>
|
||||
@@ -59,16 +121,15 @@ const active = ref('first');
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.tab-header :deep(.el-tabs__item){
|
||||
height: 50px !important
|
||||
.tab-header :deep(.el-tabs__item) {
|
||||
height: 50px !important;
|
||||
}
|
||||
|
||||
.centered-tabs :deep(.el-tabs__nav) {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
:deep(.el-tabs__header){
|
||||
:deep(.el-tabs__header) {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user