医嘱类别耗材项目从耗材目录获取数据
This commit is contained in:
@@ -61,7 +61,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { nextTick } from 'vue';
|
import { nextTick } from 'vue';
|
||||||
import { getAdviceBaseInfo } from './api';
|
import { getAdviceBaseInfo, getDeviceList } from './api';
|
||||||
import { throttle } from 'lodash-es';
|
import { throttle } from 'lodash-es';
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@@ -136,49 +136,122 @@ function getList() {
|
|||||||
|
|
||||||
console.log('发送API请求:', queryParams.value);
|
console.log('发送API请求:', queryParams.value);
|
||||||
|
|
||||||
getAdviceBaseInfo(queryParams.value).then((res) => {
|
// 判断是否是耗材类型(adviceType = 2 表示耗材)
|
||||||
if (res.data.records && res.data.records.length > 0) {
|
const isConsumables = queryParams.value.adviceTypes === '2' || queryParams.value.adviceTypes === 2;
|
||||||
let filteredRecords = res.data.records.filter((item) => {
|
|
||||||
// 后端已经根据adviceTypes参数进行了筛选,这里只需要进行前端补充筛选
|
|
||||||
|
|
||||||
// 过滤库存(药品和耗材需要检查库存,诊疗不需要检查库存)
|
if (isConsumables) {
|
||||||
if (item.adviceType == 1 || item.adviceType == 2) {
|
// 调用耗材目录接口
|
||||||
if (handleQuantity(item) == 0) {
|
const deviceQueryParams = {
|
||||||
return false;
|
pageNo: queryParams.value.pageNum || 1,
|
||||||
|
pageSize: queryParams.value.pageSize || 100,
|
||||||
|
searchKey: queryParams.value.searchKey || '',
|
||||||
|
statusEnum: 2, // 只查询启用状态的耗材
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log('调用耗材目录接口:', deviceQueryParams);
|
||||||
|
|
||||||
|
getDeviceList(deviceQueryParams).then((res) => {
|
||||||
|
if (res.data && res.data.records && res.data.records.length > 0) {
|
||||||
|
// 将耗材目录数据转换为医嘱基础信息格式
|
||||||
|
const convertedRecords = res.data.records.map((item) => {
|
||||||
|
return {
|
||||||
|
adviceName: item.name || item.busNo, // 器材名称
|
||||||
|
adviceType: 2, // 耗材类型(后端接口中耗材的adviceType是2,但前端显示为4)
|
||||||
|
unitCode: item.unitCode || '', // 包装单位
|
||||||
|
unitCode_dictText: item.unitCode_dictText || '',
|
||||||
|
minUnitCode: item.minUnitCode || item.unitCode || '',
|
||||||
|
minUnitCode_dictText: item.minUnitCode_dictText || item.unitCode_dictText || '',
|
||||||
|
volume: item.size || item.totalVolume || '', // 规格
|
||||||
|
partPercent: item.partPercent || 1, // 拆零比
|
||||||
|
priceList: item.price ? [{ price: item.price }] : (item.retailPrice ? [{ price: item.retailPrice }] : []),
|
||||||
|
inventoryList: [], // 耗材可能没有库存列表,需要根据实际情况处理
|
||||||
|
adviceDefinitionId: item.id,
|
||||||
|
chargeItemDefinitionId: item.id,
|
||||||
|
positionId: item.locationId,
|
||||||
|
positionName: item.locationId_dictText || '',
|
||||||
|
// 其他可能需要的字段
|
||||||
|
dose: 0,
|
||||||
|
doseUnitCode: item.minUnitCode || item.unitCode || '',
|
||||||
|
doseUnitCode_dictText: item.minUnitCode_dictText || item.unitCode_dictText || '',
|
||||||
|
injectFlag: 0,
|
||||||
|
injectFlag_enumText: '否',
|
||||||
|
skinTestFlag: 0,
|
||||||
|
skinTestFlag_enumText: '否',
|
||||||
|
categoryCode: item.categoryCode || '',
|
||||||
|
// 耗材特有字段
|
||||||
|
deviceId: item.id, // 耗材ID
|
||||||
|
deviceName: item.name, // 耗材名称
|
||||||
|
// 保留原始数据以便后续使用
|
||||||
|
...item,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
adviceBaseList.value = convertedRecords;
|
||||||
|
total.value = res.data.total || convertedRecords.length;
|
||||||
|
|
||||||
|
console.log('耗材目录数据转换后:', adviceBaseList.value.length, '条');
|
||||||
|
|
||||||
|
nextTick(() => {
|
||||||
|
currentIndex.value = 0;
|
||||||
|
if (adviceBaseList.value.length > 0) {
|
||||||
|
adviceBaseRef.value.setCurrentRow(adviceBaseList.value[0]);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
} else {
|
||||||
// 如果设置了categoryCode筛选条件,进行筛选(用于区分西药和中成药)
|
adviceBaseList.value = [];
|
||||||
// categoryCode = '1' 表示中成药,categoryCode = '2' 表示西药
|
total.value = 0;
|
||||||
// 注意:只有药品类型(adviceType=1)才需要根据categoryCode筛选
|
}
|
||||||
if (queryParams.value.categoryCode && item.adviceType == 1) {
|
}).catch(error => {
|
||||||
// 只筛选药品类型
|
console.error('获取耗材目录数据失败:', error);
|
||||||
if (item.categoryCode != queryParams.value.categoryCode) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
|
|
||||||
adviceBaseList.value = filteredRecords;
|
|
||||||
|
|
||||||
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 = [];
|
adviceBaseList.value = [];
|
||||||
}
|
total.value = 0;
|
||||||
}).catch(error => {
|
});
|
||||||
console.error('获取数据失败:', error);
|
} else {
|
||||||
adviceBaseList.value = [];
|
// 调用医嘱基础信息接口(药品、诊疗等)
|
||||||
});
|
getAdviceBaseInfo(queryParams.value).then((res) => {
|
||||||
|
if (res.data.records && res.data.records.length > 0) {
|
||||||
|
let filteredRecords = res.data.records.filter((item) => {
|
||||||
|
// 后端已经根据adviceTypes参数进行了筛选,这里只需要进行前端补充筛选
|
||||||
|
|
||||||
|
// 过滤库存(药品和耗材需要检查库存,诊疗不需要检查库存)
|
||||||
|
if (item.adviceType == 1 || item.adviceType == 2) {
|
||||||
|
if (handleQuantity(item) == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果设置了categoryCode筛选条件,进行筛选(用于区分西药和中成药)
|
||||||
|
// categoryCode = '1' 表示中成药,categoryCode = '2' 表示西药
|
||||||
|
// 注意:只有药品类型(adviceType=1)才需要根据categoryCode筛选
|
||||||
|
if (queryParams.value.categoryCode && item.adviceType == 1) {
|
||||||
|
// 只筛选药品类型
|
||||||
|
if (item.categoryCode != queryParams.value.categoryCode) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
adviceBaseList.value = filteredRecords;
|
||||||
|
|
||||||
|
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) => {
|
||||||
|
|||||||
@@ -223,6 +223,17 @@ export function getAdviceBaseInfo(queryParams) {
|
|||||||
params: queryParams
|
params: queryParams
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取耗材目录列表
|
||||||
|
*/
|
||||||
|
export function getDeviceList(queryParams) {
|
||||||
|
return request({
|
||||||
|
url: '/data-dictionary/device/information-page',
|
||||||
|
method: 'get',
|
||||||
|
params: queryParams
|
||||||
|
})
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 保存处方(单条)
|
* 保存处方(单条)
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user