版本更新

This commit is contained in:
Zhang.WH
2025-10-16 17:38:08 +08:00
parent f515bb8fbb
commit e4c5f36f2e
488 changed files with 41436 additions and 2901 deletions

View File

@@ -6,6 +6,8 @@
"paperType": "A5",
"height": 210,
"width": 148,
"paperHeader": 6,
"paperFooter": 592.4409448818898,
"paperNumberDisabled": true,
"paperNumberContinue": true,
"overPrintOptions": {
@@ -28,8 +30,6 @@
"layoutRowGap": 0,
"layoutColumnGap": 0
},
"paperHeader": 6,
"paperFooter": 595.2755905511812,
"printElements": [
{
"options": {
@@ -519,24 +519,6 @@
"type": "text"
}
},
{
"options": {
"left": 126,
"top": 520.5,
"height": 12,
"width": 79.5,
"title": "发药",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9,
"field": "dispenseDoctorName"
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 228,
@@ -560,12 +542,28 @@
"top": 520.5,
"height": 12,
"width": 79.5,
"title": "调配",
"title": "调配:高艳敏",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9,
"field": "preparerDoctorName"
"fontSize": 9
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 124.5,
"top": 522,
"height": 12,
"width": 79.5,
"title": "发药:宋丹丹",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9
},
"printElementType": {
"title": "文本",

View File

@@ -231,7 +231,7 @@
<!-- <el-table-column prop="quantity" label="发药数量" width="100" align="center" /> -->
<el-table-column prop="totalVolume" label="规格" width="100" align="center" />
<!-- <el-table-column prop="unitCode_dictText" label="单位" width="100" align="center" /> -->
<el-table-column
<!-- <el-table-column
prop="doseUnitCode_dictText"
label="单次剂量"
width="80"
@@ -241,7 +241,7 @@
<template #default="scope">
{{ scope.row.dose }}{{ scope.row.doseUnitCode_dictText }}
</template>
</el-table-column>
</el-table-column> -->
<el-table-column
prop="traceNo"
label="追溯码"
@@ -274,6 +274,7 @@
header-align="center"
/>
<el-table-column prop="locationName" label="发药药房" width="90" align="center" />
<el-table-column prop="manufacturerText" label="生产厂家" width="200" align="center" />
<el-table-column prop="doctorName" label="开单医生" width="100" align="center" />
<el-table-column prop="conditionName" label="诊断" width="120" align="center" />
<!-- <el-table-column prop="dose" label="剂量" width="100" align="center" /> -->
@@ -354,6 +355,28 @@
@cancel="openTraceNoDialog = false"
/>
</div>
<el-dialog title="选择打印机" v-model="showPrinterDialog" width="400px" append-to-body>
<el-form>
<el-form-item label="请选择打印机:">
<el-select v-model="selectedPrinter" placeholder="请选择打印机" style="width: 100%">
<el-option
v-for="printer in printerList"
:key="printer.name"
:label="printer.name"
:value="printer.name"
/>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="cancelPrinter"> </el-button>
<el-button type="primary" @click="confirmPrinter"> </el-button>
</span>
</template>
</el-dialog>
</template>
<script setup name="westernmedicine">
@@ -377,6 +400,14 @@ import { debounce } from 'lodash-es';
import TraceNoDialog from '@/components/OpenHis/TraceNoDialog/index.vue';
import { hiprint } from 'vue-plugin-hiprint';
import templateJson from './components/templateJson.json';
// import disposalTemplate from './components/disposalTemplate.json';
import {
getPrinterList,
getCachedPrinter,
savePrinterToCache,
selectPrinterAndPrint,
executePrint,
} from '@/utils/his';
const showSearch = ref(true);
const total = ref(0);
@@ -408,7 +439,7 @@ const groups = ref({});
const openTraceNoDialog = ref(false);
const ypName = ref('');
const medicineTotalPrice = ref(0);
const projectTypeCode = ref('1');
const projectTypeCode = ref('2');
const selectedRow = ref(null);
const { proxy } = getCurrentInstance();
@@ -500,127 +531,215 @@ function getList() {
});
}
//打印中西药处方
// async function printPrescription() {
// const selectedRows = tableRef.value.getSelectionRows();
// if (selectedRows.length === 0) {
// proxy.$modal.msgWarning('未选择要打印的项目,请重新选择,打印失败');
// return;
// }
// let requestIds = selectedRows.map((item) => item.requestId).join(',');
// const result = [];
// advicePrint({ requestIds: requestIds, isPrescription: '1' }).then((res) => {
// const groupedRows = {};
// res.data.adviceItemList.forEach((row) => {
// const prescriptionNo = row.prescriptionNo;
// if (!groupedRows[prescriptionNo]) {
// groupedRows[prescriptionNo] = [];
// }
// row.contractName = res.data.contractName;
// groupedRows[prescriptionNo].push(row);
// });
// console.log('按处方号分组的结果:', groupedRows);
// // 如果您需要将分组后的数据转换为数组形式
// const groupedArray = Object.values(groupedRows);
// console.log('分组后的数组形式:', groupedArray);
// groupedArray.forEach((item, index) => {
// const total = item.reduce((sum, item) => {
// return sum + (item.totalPrice || 0);
// }, 0);
// result.push({
// ...res.data,
// medTotalAmount: total,
// prescriptionList: item,
// });
// });
// console.log(result, 'result');
// const printElements = templateJson;
// var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
// hiprintTemplate.print2(result, {
// title: '打印标题',
// height: 210,
// width: 148,
// }); //开始打印
// // 直接打印回调
// // 发送任务到打印机成功
// hiprintTemplate.on('printSuccess', function (e) {
// console.log('打印成功');
// });
// // 发送任务到打印机失败
// hiprintTemplate.on('printError', function (e) {
// console.log('打印失败');
// });
// });
// // 计算总价
// // const result = {
// // data: selectedRows.map((item) => ({
// // ...item,
// // patientName: personInfo.value.patientName,
// // genderEnum_enumText: personInfo.value.genderEnum_enumText,
// // age: personInfo.value.age,
// // phone: personInfo.value.phone,
// // hospitalName: personInfo.value.hospitalName,
// // patientBusNo: personInfo.value.patientBusNo,
// // quantity: item.quantity,
// // unitCode_dictText: item.unitCode_dictText,
// // organizationName: personInfo.value.organizationName,
// // })),
// // };
// // 按 prescriptionNo 分组
// // const groupedRows = {};
// // selectedRows.forEach(row => {
// // const prescriptionNo = row.prescriptionNo;
// // if (!groupedRows[prescriptionNo]) {
// // groupedRows[prescriptionNo] = [];
// // }
// // row.contractName = personInfo.value.contractName;
// // groupedRows[prescriptionNo].push(row);
// // });
// // console.log('按处方号分组的结果:', groupedRows);
// // // 如果您需要将分组后的数据转换为数组形式
// // const groupedArray = Object.values(groupedRows);
// // console.log('分组后的数组形式:', groupedArray);
// // const result = [];
// // groupedArray.forEach((item, index) => {
// // const total = item.reduce((sum, item) => {
// // return sum + (item.totalPrice || 0);
// // }, 0);
// // result.push({
// // ...personInfo.value,
// // medTotalAmount: total,
// // doctor: item[0].doctorName,
// // prescriptionNo: item[0].prescriptionNo,
// // reqAuthoredTime: item[0].reqAuthoredTime,
// // prescriptionList: item,
// // })
// // })
// // 将对象转换为 JSON 字符串
// // let jsonString = JSON.stringify(result, null, 2);
// // 模板对象获取
// // await CefSharp.BindObjectAsync('boundAsync');
// // await boundAsync
// // .printReport('西药(中成药)处方笺.grf', jsonString)
// // .then((response) => {
// // //返回结果是jsonString可判断其调用是否成功
// // console.log(response, 'response');
// // var res = JSON.parse(response);
// // if (!res.IsSuccess) {
// // proxy.$modal.msgError('调用打印插件失败:' + res.ErrorMessage);
// // }
// // })
// // .catch((error) => {
// // proxy.$modal.msgError('调用打印插件失败:' + error);
// // });
// }
// 新增打印机相关变量
const printerList = ref([]); // 打印机列表
const selectedPrinter = ref(''); // 选中的打印机
const showPrinterDialog = ref(false); // 显示打印机选择对话框
// 修改printPrescription方法强制显示打印机选择弹窗
async function printPrescription() {
const selectedRows = tableRef.value.getSelectionRows();
if (selectedRows.length === 0) {
proxy.$modal.msgWarning('未选择要打印的项目,请重新选择,打印失败');
return;
}
let requestIds = selectedRows.map((item) => item.requestId).join(',');
const result = [];
advicePrint({ requestIds: requestIds, isPrescription: '1' }).then((res) => {
const groupedRows = {};
res.data.adviceItemList.forEach((row) => {
const prescriptionNo = row.prescriptionNo;
if (!groupedRows[prescriptionNo]) {
groupedRows[prescriptionNo] = [];
}
row.contractName = res.data.contractName;
groupedRows[prescriptionNo].push(row);
});
console.log('按处方号分组的结果:', groupedRows);
try {
// 获取打印数据
let requestIds = selectedRows.map((item) => item.requestId).join(',');
// 如果您需要将分组后的数据转换为数组形式
const groupedArray = Object.values(groupedRows);
console.log('分组后的数组形式:', groupedArray);
groupedArray.forEach((item, index) => {
const total = item.reduce((sum, item) => {
return sum + (item.totalPrice || 0);
}, 0);
result.push({
...res.data,
medTotalAmount: total,
prescriptionList: item,
advicePrint({ requestIds: requestIds, isPrescription: '1' }).then((res) => {
const groupedRows = {};
res.data.adviceItemList.forEach((row) => {
const prescriptionNo = row.prescriptionNo;
if (!groupedRows[prescriptionNo]) {
groupedRows[prescriptionNo] = [];
}
row.contractName = res.data.contractName;
groupedRows[prescriptionNo].push(row);
});
const groupedArray = Object.values(groupedRows);
const result = [];
groupedArray.forEach((item) => {
const total = item.reduce((sum, item) => {
return sum + (item.totalPrice || 0);
}, 0);
result.push({
...res.data,
medTotalAmount: total,
prescriptionList: item,
});
});
// 获取打印机列表
const printers = getPrinterList();
if (printers.length === 0) {
proxy.$modal.msgWarning('未检测到可用打印机');
return;
}
// 强制显示打印机选择对话框,无论是否有缓存
// 设置打印机列表
printerList.value = printers;
// 显示对话框
showPrinterDialog.value = true;
// 保存当前打印数据到临时变量
window.currentPrintData = result;
});
console.log(result, 'result');
const printElements = templateJson;
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
hiprintTemplate.print2(result, {
title: '打印标题',
height: 210,
width: 148,
}); //开始打印
// 直接打印回调
// 发送任务到打印机成功
hiprintTemplate.on('printSuccess', function (e) {
console.log('打印成功');
});
// 发送任务到打印机失败
hiprintTemplate.on('printError', function (e) {
console.log('打印失败');
});
});
// 计算总价
// const result = {
// data: selectedRows.map((item) => ({
// ...item,
// patientName: personInfo.value.patientName,
// genderEnum_enumText: personInfo.value.genderEnum_enumText,
// age: personInfo.value.age,
// phone: personInfo.value.phone,
// hospitalName: personInfo.value.hospitalName,
// patientBusNo: personInfo.value.patientBusNo,
// quantity: item.quantity,
// unitCode_dictText: item.unitCode_dictText,
// organizationName: personInfo.value.organizationName,
// })),
// };
// 按 prescriptionNo 分组
// const groupedRows = {};
// selectedRows.forEach(row => {
// const prescriptionNo = row.prescriptionNo;
// if (!groupedRows[prescriptionNo]) {
// groupedRows[prescriptionNo] = [];
// }
// row.contractName = personInfo.value.contractName;
// groupedRows[prescriptionNo].push(row);
// });
// console.log('按处方号分组的结果:', groupedRows);
// // 如果您需要将分组后的数据转换为数组形式
// const groupedArray = Object.values(groupedRows);
// console.log('分组后的数组形式:', groupedArray);
// const result = [];
// groupedArray.forEach((item, index) => {
// const total = item.reduce((sum, item) => {
// return sum + (item.totalPrice || 0);
// }, 0);
// result.push({
// ...personInfo.value,
// medTotalAmount: total,
// doctor: item[0].doctorName,
// prescriptionNo: item[0].prescriptionNo,
// reqAuthoredTime: item[0].reqAuthoredTime,
// prescriptionList: item,
// })
// })
// 将对象转换为 JSON 字符串
// let jsonString = JSON.stringify(result, null, 2);
// 模板对象获取
// await CefSharp.BindObjectAsync('boundAsync');
// await boundAsync
// .printReport('西药(中成药)处方笺.grf', jsonString)
// .then((response) => {
// //返回结果是jsonString可判断其调用是否成功
// console.log(response, 'response');
// var res = JSON.parse(response);
// if (!res.IsSuccess) {
// proxy.$modal.msgError('调用打印插件失败:' + res.ErrorMessage);
// }
// })
// .catch((error) => {
// proxy.$modal.msgError('调用打印插件失败:' + error);
// });
} catch (error) {
console.error('打印过程出错:', error);
proxy.$modal.msgError('打印失败: ' + error.message);
}
}
// 使用保存的打印数据执行打印
function confirmPrinter() {
if (!selectedPrinter.value) {
proxy.$modal.msgWarning('请选择打印机');
return;
}
// 使用his.js中的savePrinterToCache保存选择
savePrinterToCache(selectedPrinter.value);
// 使用his.js中的executePrint方法执行打印
if (window.currentPrintData) {
executePrint(window.currentPrintData, templateJson, selectedPrinter.value)
.then(() => {
showPrinterDialog.value = false;
// 清除临时数据
window.currentPrintData = null;
})
.catch((error) => {
proxy.$modal.msgError(error.message || '打印失败');
showPrinterDialog.value = false;
window.currentPrintData = null;
});
}
}
/** 重置按钮操作 */
function resetQuery() {
setDefaultDateRange();
@@ -791,7 +910,7 @@ function getMedicineList(encounterId) {
proxy.$modal.msgError('获取数据失败');
});
} else if (projectTypeCode.value == 2) {
// 只调用listWesternmedicine接口
// 只调用listWesternmedicine接口
listWesternmedicine({
pageNo: 1,
pageSize: 100,