Compare commits

6 Commits

6 changed files with 117 additions and 51 deletions

View File

@@ -67,7 +67,7 @@ import { throttle } from 'lodash-es';
const props = defineProps({ const props = defineProps({
adviceQueryParams: { adviceQueryParams: {
type: Object, type: Object,
default: '', required: true
}, },
patientInfo: { patientInfo: {
type: Object, type: Object,
@@ -97,39 +97,25 @@ const throttledGetList = throttle(
watch( watch(
() => props.adviceQueryParams, () => props.adviceQueryParams,
(newValue) => { (newValue) => {
queryParams.value.searchKey = newValue.searchKey; console.log('adviceBaseList 接收到参数变化:', newValue);
// queryParams.value.adviceType = newValue.adviceType;
// 直接更新查询参数
queryParams.value.searchKey = newValue.searchKey || '';
// 处理类型筛选
if (newValue.adviceType) { if (newValue.adviceType) {
queryParams.value.adviceTypes = [newValue.adviceType].join(','); // 单个类型
queryParams.value.adviceTypes = newValue.adviceType.toString();
} else { } else {
// 全部类型
queryParams.value.adviceTypes = '1,2,3'; queryParams.value.adviceTypes = '1,2,3';
} }
throttledGetList();
},
{ deep: true }
);
getList(); console.log('发送请求参数:', queryParams.value);
function getList() { getList();
queryParams.value.organizationId = props.patientInfo.orgId; },
getAdviceBaseInfo(queryParams.value).then((res) => { { deep: true, immediate: true }
console.log('ssssssssss', res.data.records); );
if (res.data.records.length > 0) {
adviceBaseList.value = res.data.records.filter((item) => {
if (item.adviceType == 1 || item.adviceType == 2) {
return handleQuantity(item) != 0;
} else {
return true;
}
});
total.value = res.data.total;
nextTick(() => {
currentIndex.value = 0;
adviceBaseRef.value.setCurrentRow(adviceBaseList.value[0]);
});
}
});
}
// 从priceList列表中获取价格 // 从priceList列表中获取价格
function getPriceFromInventory(row) { function getPriceFromInventory(row) {
if (row.priceList && row.priceList.length > 0) { if (row.priceList && row.priceList.length > 0) {
@@ -138,6 +124,38 @@ function getPriceFromInventory(row) {
} }
return '-'; return '-';
} }
function getList() {
queryParams.value.organizationId = props.patientInfo.orgId;
console.log('发送API请求:', queryParams.value);
getAdviceBaseInfo(queryParams.value).then((res) => {
if (res.data.records && res.data.records.length > 0) {
adviceBaseList.value = res.data.records.filter((item) => {
if (item.adviceType == 1 || item.adviceType == 2) {
return handleQuantity(item) != 0;
} else {
return true;
}
});
console.log('过滤后数据显示:', adviceBaseList.value.length, '条');
total.value = res.data.total;
nextTick(() => {
currentIndex.value = 0;
if (adviceBaseList.value.length > 0) {
adviceBaseRef.value.setCurrentRow(adviceBaseList.value[0]);
}
});
} else {
adviceBaseList.value = [];
}
}).catch(error => {
console.error('获取数据失败:', error);
adviceBaseList.value = [];
});
}
// 处理键盘事件 // 处理键盘事件
const handleKeyDown = (event) => { const handleKeyDown = (event) => {
const key = event.key; const key = event.key;

View File

@@ -99,7 +99,7 @@
> >
<el-select v-model="scope.row.medTypeCode" placeholder=" " style="width: 150px"> <el-select v-model="scope.row.medTypeCode" placeholder=" " style="width: 150px">
<el-option <el-option
v-for="item in med_type" v-for="item in diag_type"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
@@ -235,7 +235,7 @@ const props = defineProps({
const emits = defineEmits(['diagnosisSave']); const emits = defineEmits(['diagnosisSave']);
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const userStore = useUserStore(); const userStore = useUserStore();
const { med_type } = proxy.useDict('med_type'); const { diag_type } = proxy.useDict('diag_type');
const rules = ref({ const rules = ref({
name: [{ required: true, message: '请选择诊断', trigger: 'change' }], name: [{ required: true, message: '请选择诊断', trigger: 'change' }],
medTypeCode: [{ required: true, message: '请选择诊断类型', trigger: 'change' }], medTypeCode: [{ required: true, message: '请选择诊断类型', trigger: 'change' }],

View File

@@ -10,23 +10,15 @@
<el-table <el-table
ref="emrHistoryRef" ref="emrHistoryRef"
:data="emrHistory" :data="emrHistory"
row-key="patientId" row-key="id"
highlight-current-row
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<!-- @cell-click="clickRow" -->
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column label="主诉" align="left" prop="name" :show-overflow-tooltip="true"/> <el-table-column label="主诉" align="left" prop="name" :show-overflow-tooltip="true"/>
<el-table-column label="时间" align="center" prop="createTime" width="180" :show-overflow-tooltip="true"/> <el-table-column label="时间" align="center" prop="createTime" width="180" :show-overflow-tooltip="true"/>
<el-table-column label="操作" align="center" width="80"> <el-table-column label="操作" align="center" width="80">
<template #default="scope"> <template #default="scope">
<!-- <el-button <el-button link type="primary" @click.stop="clickRow(scope.row)">复用</el-button>
link
type="primary"
@click.stop="handelDetail(scope.row)"
>详情
</el-button> -->
<el-button link type="primary" @click.stop="clickRow(scope.row)">复用 </el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -43,6 +35,7 @@
<script setup> <script setup>
import { formatDate, formatDateymd } from '@/utils/index'; import { formatDate, formatDateymd } from '@/utils/index';
import { getEmrHistoryList } from '../api'; import { getEmrHistoryList } from '../api';
const queryParams = ref({ const queryParams = ref({
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
@@ -51,13 +44,19 @@ const queryParams = ref({
const selectRow = ref({}); const selectRow = ref({});
const emrHistory = ref([]); const emrHistory = ref([]);
const emits = defineEmits(['selectRow']); const emits = defineEmits(['selectRow']);
const emrHistoryRef = ref(null);
const selectedRows = ref([]);
const total = ref(0);
getList(); getList();
function getList() { function getList() {
if (sessionStorage.getItem('patientId')) { if (sessionStorage.getItem('patientId')) {
queryParams.value.patientId = sessionStorage.getItem('patientId'); queryParams.value.patientId = sessionStorage.getItem('patientId');
getEmrHistoryList(queryParams.value).then((res) => { getEmrHistoryList(queryParams.value).then((res) => {
emrHistory.value = res.data.records; emrHistory.value = res.data.records;
total.value = res.data.total;
emrHistory.value.map((k) => { emrHistory.value.map((k) => {
k.name = JSON.parse(k.contextJson).chiefComplaint; k.name = JSON.parse(k.contextJson).chiefComplaint;
k.createTime = formatDate(k.createTime); k.createTime = formatDate(k.createTime);
@@ -66,6 +65,20 @@ function getList() {
} }
} }
function handleSelectionChange(selection) {
selectedRows.value = selection;
// 如果选择的行数大于1只保留最后一行
if (selection.length > 1) {
// 清除所有选择
emrHistoryRef.value?.clearSelection();
// 只选择最后一行
const lastSelected = selection[selection.length - 1];
emrHistoryRef.value?.toggleRowSelection(lastSelected, true);
selectedRows.value = [lastSelected];
}
}
function clickRow(row) { function clickRow(row) {
selectRow.value = JSON.parse(row.contextJson); selectRow.value = JSON.parse(row.contextJson);
emits('selectRow', selectRow.value); emits('selectRow', selectRow.value);

View File

@@ -43,7 +43,7 @@ const props = defineProps({
required: true, required: true,
}, },
}); });
// getList(); getList();
function getList() { function getList() {
queryParams.value.useScopeCode = 1; queryParams.value.useScopeCode = 1;
getEmrTemplateList(queryParams.value).then((res) => { getEmrTemplateList(queryParams.value).then((res) => {

View File

@@ -561,9 +561,20 @@
(value) => { (value) => {
expandOrder = []; expandOrder = [];
prescriptionList[scope.$index].adviceName = undefined; prescriptionList[scope.$index].adviceName = undefined;
adviceQueryParams.adviceType = value;
} // 直接更新查询参数
" adviceQueryParams.value.adviceType = value;
adviceQueryParams.value.searchKey = '';
console.log('医嘱类型改变为:', value, '查询参数:', adviceQueryParams.value);
// 确保弹窗重新打开
nextTick(() => {
row.showPopover = true;
handleFocus(scope.row, scope.$index);
});
}
"
> >
<el-option <el-option
v-for="item in adviceTypeList" v-for="item in adviceTypeList"
@@ -751,7 +762,10 @@ const prescriptionList = ref([]);
const form = ref({ const form = ref({
prescriptionList: prescriptionList.value, prescriptionList: prescriptionList.value,
}); });
const adviceQueryParams = ref({}); const adviceQueryParams = ref({
searchKey: '',
adviceType: ''
});
const rowIndex = ref(-1); const rowIndex = ref(-1);
const groupIndex = ref(1); const groupIndex = ref(1);
const groupIndexList = ref([]); const groupIndexList = ref([]);
@@ -933,6 +947,9 @@ function handleAddPrescription() {
return; return;
} }
isAdding.value = true; isAdding.value = true;
// 重置查询参数
adviceQueryParams.value = {};
// 在数组最前方添加一行,让新增行显示在最上边 // 在数组最前方添加一行,让新增行显示在最上边
prescriptionList.value.unshift({ prescriptionList.value.unshift({
uniqueKey: nextId.value++, uniqueKey: nextId.value++,
@@ -979,10 +996,17 @@ function handleDiagnosisChange(item) {
function handleFocus(row, index) { function handleFocus(row, index) {
rowIndex.value = index; rowIndex.value = index;
row.showPopover = true; row.showPopover = true;
// 确保查询参数与当前行类型一致
adviceQueryParams.value = {
adviceType: row.adviceType || '',
searchKey: adviceQueryParams.value.searchKey || ''
};
} }
function handleBlur(row) { function handleBlur(row) {
row.showPopover = false; setTimeout(() => {
row.showPopover = false;
}, 200);
} }
function handleChange(value) { function handleChange(value) {
@@ -1096,7 +1120,7 @@ function selectAdviceBase(key, row) {
prescriptionList.value[rowIndex.value].orgId = JSON.parse(JSON.stringify(row)).positionId; prescriptionList.value[rowIndex.value].orgId = JSON.parse(JSON.stringify(row)).positionId;
prescriptionList.value[rowIndex.value].unitPrice = row.priceList[0].price; prescriptionList.value[rowIndex.value].unitPrice = row.priceList[0].price;
} }
expandOrder.value = [key]; expandOrder.value = [key];
nextTick(() => { nextTick(() => {
if (row.adviceType == 1) { if (row.adviceType == 1) {
if (row.injectFlag == 1) { if (row.injectFlag == 1) {
@@ -1108,6 +1132,7 @@ function selectAdviceBase(key, row) {
inputRefs.value['quantity']?.focus(); inputRefs.value['quantity']?.focus();
} }
}); });
} }
function getOrgList() { function getOrgList() {

View File

@@ -69,7 +69,11 @@ import bindUser from "./bindUser";
import { getTenantUserPage, unbindTenantUser } from "@/api/system/tenant"; import { getTenantUserPage, unbindTenantUser } from "@/api/system/tenant";
// 在 <script setup> 顶部添加导入 // 在 <script setup> 顶部添加导入
import { ref, reactive, onMounted } from "vue"; // 补充 onMounted 导入 import { ref, reactive, onMounted } from "vue"; // 补充 onMounted 导入
import { useRoute, useRouter } from "vue-router"; // 添加 useRouter 导入
const route = useRoute(); const route = useRoute();
const router = useRouter(); // 创建 router 实例
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const { sys_normal_disable } = proxy.useDict("sys_normal_disable"); const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
@@ -100,8 +104,14 @@ function getList() {
} }
// 返回按钮 // 返回按钮
function handleClose() { function handleClose() {
const obj = { path: "/system/basicmanage/tenant" }; /* const obj = { path: "/system/basicmanage/tenant" };
proxy.$tab.closeOpenPage(obj); proxy.$tab.closeOpenPage(obj); 目前先注释掉改成返回上一级页面*/
// 先关闭当前标签页
const obj={ path: "/system/basicmanage/tenant" };
proxy.$tab.closeOpenPage(route).then(() => {
// 然后返回上一个页面
router.go(-1);
});
} }
/** 搜索按钮操作 */ /** 搜索按钮操作 */
function handleQuery() { function handleQuery() {