前端最新版本同步
This commit is contained in:
@@ -12,7 +12,27 @@
|
||||
</div>
|
||||
|
||||
<div class="search-area">
|
||||
<el-input v-model="patientSearch" placeholder="搜索患者" clearable class="search-input" />
|
||||
<el-input
|
||||
v-model="queryParams.searchKey"
|
||||
style="width: 45%; margin-bottom: 10px"
|
||||
placeholder="搜索患者"
|
||||
clearable
|
||||
class="search-input"
|
||||
@keydown.enter="getPatientList"
|
||||
>
|
||||
<template #append>
|
||||
<el-button icon="Search" @click="getPatientList" />
|
||||
</template>
|
||||
</el-input>
|
||||
<el-date-picker
|
||||
v-model="receptionTime"
|
||||
@change="getPatientList"
|
||||
type="daterange"
|
||||
style="width: 55%; margin-bottom: 10px"
|
||||
placeholder="挂号时间"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</div>
|
||||
<el-table
|
||||
:data="patientList"
|
||||
@@ -46,11 +66,14 @@
|
||||
<i class="el-icon-first-aid-kit"></i>
|
||||
<h2>处置项目</h2>
|
||||
<el-button type="primary" plain @click="printBottleLabel()">打印瓶签</el-button>
|
||||
<el-button type="primary" plain @click="printBloodBarcode()">打印采血条码</el-button>
|
||||
<el-button type="primary" plain @click="printPrescription()">打印处方</el-button>
|
||||
<el-button type="primary" plain @click="printDisposal()">打印处置单</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<el-table
|
||||
:data="activityList"
|
||||
ref="activityListRef"
|
||||
height="calc(100% - 60px)"
|
||||
style="width: 100%"
|
||||
border
|
||||
@@ -76,6 +99,11 @@
|
||||
}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="size" label="数量" width="100">
|
||||
<template #default="scope">
|
||||
{{ scope.row.quantity + ' ' + scope.row.unitCode_dictText }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" prop="size" label="规格" width="100" />
|
||||
<el-table-column align="center" prop="executeNum" label="执行次数" width="90" />
|
||||
<el-table-column align="center" label="已执行次数" width="90">
|
||||
@@ -114,7 +142,11 @@
|
||||
<el-table-column align="center" prop="serviceStatus_enumText" label="状态" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag type="primary" size="small">
|
||||
{{ row.serviceStatus_enumText }}
|
||||
{{
|
||||
row.serviceStatus_enumText
|
||||
? row.serviceStatus_enumText
|
||||
: row.chargeStatus_enumText
|
||||
}}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -185,15 +217,33 @@
|
||||
|
||||
<script setup>
|
||||
import { getCurrentInstance } from 'vue';
|
||||
import { getList, getDisposalList, execute, cancel, getPerformRecord } from './components/api';
|
||||
import {
|
||||
getList,
|
||||
getDisposalList,
|
||||
execute,
|
||||
cancel,
|
||||
getPerformRecord,
|
||||
listWesternmedicine,
|
||||
printBloodCode,
|
||||
} from './components/api';
|
||||
import PerformRecordDialog from './components/performRecordDialog';
|
||||
|
||||
import templateJson from './components/template.json';
|
||||
import prescriptionTemplate from './components/prescriptionTemplate.json';
|
||||
import bloodTemplate from './components/bloodTemplate.json';
|
||||
import disposalTemplate from './components/disposalTemplate.json';
|
||||
import { formatDateStr } from '@/utils';
|
||||
import { hiprint } from 'vue-plugin-hiprint';
|
||||
import { advicePrint } from '@/api/public';
|
||||
import useUserStore from '@/store/modules/user';
|
||||
// 患者搜索
|
||||
const patientSearch = ref('');
|
||||
const queryParams = ref({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
});
|
||||
const receptionTime = ref([
|
||||
formatDateStr(new Date(), 'YYYY-MM-DD'),
|
||||
formatDateStr(new Date(), 'YYYY-MM-DD'),
|
||||
]);
|
||||
const total = ref(0);
|
||||
// 患者数据
|
||||
const patientList = ref([]);
|
||||
@@ -201,12 +251,16 @@ const patientList = ref([]);
|
||||
const activityList = ref([]);
|
||||
// 耗材列表
|
||||
const deviceList = ref([]);
|
||||
// 诊疗项目 + 耗材 打印处置单用
|
||||
const deviceActivityList = ref([]);
|
||||
const userStore = useUserStore();
|
||||
|
||||
// 当前选中的患者
|
||||
const currentPatient = ref({});
|
||||
const recordList = ref([]);
|
||||
const openDialog = ref(false);
|
||||
const loading = ref(false);
|
||||
const activityListRef = ref(null);
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
@@ -225,6 +279,8 @@ const totalCost = computed(() => {
|
||||
});
|
||||
getPatientList();
|
||||
function getPatientList() {
|
||||
queryParams.value.receptionTimeSTime = receptionTime.value[0] + ' 00:00:00';
|
||||
queryParams.value.receptionTimeETime = receptionTime.value[1] + ' 23:59:59';
|
||||
getList(queryParams.value).then((res) => {
|
||||
patientList.value = res.data.records;
|
||||
total.value = res.data.total;
|
||||
@@ -234,6 +290,7 @@ function getPatientList() {
|
||||
function handlePatientSelect(row) {
|
||||
console.log(row, 3456789);
|
||||
loading.value = true;
|
||||
currentPatient.value = row;
|
||||
getDisposalList(row.encounterId).then((res) => {
|
||||
deviceList.value = res.data.records.filter((item) => {
|
||||
return item.requestTable == 'wor_device_request';
|
||||
@@ -243,6 +300,9 @@ function handlePatientSelect(row) {
|
||||
item.requestTable == 'wor_service_request' || item.requestTable == 'med_medication_request'
|
||||
);
|
||||
});
|
||||
deviceActivityList.value = res.data.records.filter((item) => {
|
||||
return item.deviceCategory == '7' || item.serviceCategory == '21';
|
||||
});
|
||||
loading.value = false;
|
||||
console.log(activityList.value, 345678);
|
||||
});
|
||||
@@ -317,6 +377,77 @@ function operationSpanMethod({ row, column, rowIndex, columnIndex }) {
|
||||
return [1, 1];
|
||||
}
|
||||
|
||||
function printPrescription() {
|
||||
// 取出状态为已收费已发药的requestId
|
||||
let requestIds = activityList.value
|
||||
.filter((item) => {
|
||||
return item.chargeStatus == 5 && item.dispenseStatus == 4;
|
||||
})
|
||||
.map((item) => {
|
||||
return item.requestId;
|
||||
})
|
||||
.join(',');
|
||||
advicePrint({ requestIds: requestIds, isPrescription: 1 }).then((res) => {
|
||||
// 按 sortNumber 排序
|
||||
const sortedList = res.data.adviceItemList.sort((a, b) => {
|
||||
return (a.sortNumber || 0) - (b.sortNumber || 0);
|
||||
});
|
||||
|
||||
// 为每个项目分配新的排序号,相同 groupId 的项目使用相同排序号
|
||||
const groupIdToSortNumber = new Map();
|
||||
let group = 1;
|
||||
|
||||
sortedList.forEach((item) => {
|
||||
if (item.dispensePerDuration > 1) {
|
||||
item.quantity = item.quantity / item.dispensePerDurations;
|
||||
item.totalPrice = item.quantity * item.unitPrice;
|
||||
}
|
||||
item.contractName = res.data.contractName;
|
||||
if (item.groupId) {
|
||||
if (!groupIdToSortNumber.has(item.groupId)) {
|
||||
groupIdToSortNumber.set(item.groupId, group++);
|
||||
}
|
||||
item.group = groupIdToSortNumber.get(item.groupId);
|
||||
} else {
|
||||
item.group = group++;
|
||||
}
|
||||
});
|
||||
console.log('sortedList', sortedList);
|
||||
|
||||
const result = {
|
||||
...res.data,
|
||||
prescriptionList: sortedList,
|
||||
};
|
||||
// 将对象转换为 JSON 字符串
|
||||
console.log(result, 'result');
|
||||
// 模板对象获取
|
||||
const printElements = prescriptionTemplate;
|
||||
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
|
||||
hiprintTemplate.print2(result, {
|
||||
title: '打印标题',
|
||||
height: 210,
|
||||
width: 148,
|
||||
}); //开始打印
|
||||
});
|
||||
}
|
||||
|
||||
function printDisposal() {
|
||||
let requestIds = deviceActivityList.value
|
||||
.map((item) => {
|
||||
return item.requestId;
|
||||
})
|
||||
.join(',');
|
||||
advicePrint({ requestIds: requestIds }).then((res) => {
|
||||
const result = res.data;
|
||||
const printElements = disposalTemplate;
|
||||
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
|
||||
hiprintTemplate.print2(result, {
|
||||
height: 210,
|
||||
width: 148,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 判断是否为组内的第一行
|
||||
function isFirstRowInGroup(rowIndex) {
|
||||
const row = activityList.value[rowIndex];
|
||||
@@ -338,6 +469,25 @@ function isFirstRowInGroup(rowIndex) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function printBloodBarcode() {
|
||||
const selectedRows = activityListRef.value.getSelectionRows();
|
||||
if (selectedRows.length === 0) {
|
||||
proxy.$modal.msgWarning('未选择要打印的项目');
|
||||
} else if (selectedRows.length > 1) {
|
||||
proxy.$modal.msgWarning('只能选择一个项目');
|
||||
} else {
|
||||
printBloodCode({ requestId: selectedRows[0].requestId }).then((res) => {
|
||||
const result = res.data;
|
||||
const printElements = bloodTemplate;
|
||||
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
|
||||
hiprintTemplate.print2(result, {
|
||||
height: 210,
|
||||
width: 148,
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function handleCancel(row) {
|
||||
let data = {
|
||||
requestId: row.requestId,
|
||||
@@ -364,6 +514,92 @@ function handleCancel(row) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function printBottleLabel() {
|
||||
let result = [];
|
||||
// 过滤出全部输液药品
|
||||
let printLiist = activityList.value.filter((item) => {
|
||||
return item.medCategory == '2';
|
||||
});
|
||||
// 按照groupId分组,但将多天的项目展开为独立项目
|
||||
let expandedList = [];
|
||||
|
||||
printLiist.forEach((item) => {
|
||||
// 如果用药天数大于1,则创建多个项目
|
||||
if (item.dispensePerDuration && item.dispensePerDuration > 1) {
|
||||
// 为每一天创建一个项目
|
||||
for (let i = 0; i < item.dispensePerDuration; i++) {
|
||||
// 克隆项目并调整数量
|
||||
const clonedItem = {
|
||||
...item,
|
||||
// 数量除以天数
|
||||
quantity: item.quantity ? item.quantity / item.dispensePerDuration : item.quantity,
|
||||
// 可以添加一个字段表示是第几天
|
||||
dayIndex: i + 1,
|
||||
totalDays: item.dispensePerDuration,
|
||||
data: item.itemName + ' ' + item.size + ' ' + item.methodCode_dictText,
|
||||
};
|
||||
|
||||
// 获取当前时间做执行日期,如果用药天数大于1,依次累加
|
||||
const date = new Date();
|
||||
date.setDate(date.getDate() + i);
|
||||
clonedItem.performDateTime = formatDateStr(date, 'YYYY-MM-DD');
|
||||
|
||||
// 将克隆的项目添加到展开列表中,不按groupId分组
|
||||
expandedList.push(clonedItem);
|
||||
}
|
||||
} else {
|
||||
// 天数为1或没有设置天数,直接使用原项目
|
||||
item.data = item.itemName + ' ' + item.size + ' ' + item.methodCode_dictText;
|
||||
expandedList.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
// 重新按groupId分组,但每个展开的项目都是独立的
|
||||
const groupedByGroupId = expandedList.reduce((acc, item) => {
|
||||
// 为展开的项目生成新的唯一groupId
|
||||
const groupId = item.dayIndex
|
||||
? `${item.groupId || item.requestId}_day${item.dayIndex}`
|
||||
: item.groupId || item.requestId;
|
||||
|
||||
if (!acc[groupId]) {
|
||||
acc[groupId] = [];
|
||||
}
|
||||
acc[groupId].push(item);
|
||||
return acc;
|
||||
}, {});
|
||||
const resultList = Object.values(groupedByGroupId);
|
||||
console.log(resultList, '23456789');
|
||||
|
||||
result = resultList.map((item) => {
|
||||
return {
|
||||
patientName: currentPatient.value.patientName,
|
||||
prepareName: userStore.nickName,
|
||||
genderEnum_enumText: currentPatient.value.genderEnum_enumText,
|
||||
age: currentPatient.value.age,
|
||||
date: item[0].performDateTime,
|
||||
infuseData: item,
|
||||
};
|
||||
});
|
||||
const printElements = templateJson;
|
||||
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
|
||||
console.log(result, '打印机列表');
|
||||
hiprintTemplate.print2(result, {
|
||||
printer: 'Xprinter XP-365B',
|
||||
height: 210,
|
||||
width: 148,
|
||||
});
|
||||
// 直接打印回调
|
||||
// 发送任务到打印机成功
|
||||
hiprintTemplate.on('printSuccess', function (e) {
|
||||
console.log('打印成功');
|
||||
});
|
||||
// 发送任务到打印机失败
|
||||
hiprintTemplate.on('printError', function (e) {
|
||||
console.log('打印失败');
|
||||
});
|
||||
}
|
||||
|
||||
function getRecord(row) {
|
||||
getPerformRecord({ reqId: row.requestId }).then((res) => {
|
||||
recordList.value = res.data;
|
||||
|
||||
Reference in New Issue
Block a user