解决合并冲突

This commit is contained in:
2025-12-10 14:20:24 +08:00
parent e1385cb3e6
commit 18f6a845e6
804 changed files with 61881 additions and 13577 deletions

View File

@@ -8,6 +8,14 @@ export function listPatient(query) {
})
}
export function devicePatientList(query) {
return request({
url: '/pharmacy-manage/device-dispense/encounter-list',
method: 'get',
params: query
})
}
export function listInit(query) {
return request({
url: '/pharmacy-manage/western-medicine-dispense/init',

View File

@@ -0,0 +1,334 @@
{
"panels": [
{
"index": 0,
"name": 1,
"paperType": "A5",
"height": 210,
"width": 148,
"paperNumberDisabled": true,
"paperNumberContinue": true,
"overPrintOptions": {
"content": "",
"opacity": 0.7,
"type": 1
},
"watermarkOptions": {
"content": "",
"fillStyle": "rgba(184, 184, 184, 0.3)",
"fontSize": "14px",
"rotate": 25,
"width": 200,
"height": 200,
"timestamp": false,
"format": "YYYY-MM-DD HH:mm"
},
"panelLayoutOptions": {},
"paperHeader": 0,
"paperFooter": 841.8897637795277,
"printElements": [
{
"options": {
"left": 169.5,
"top": 22.5,
"height": 12,
"width": 88.5,
"title": "长春大学医院",
"coordinateSync": false,
"widthHeightSync": false,
"fontSize": 13.5,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 189,
"top": 45,
"height": 9.75,
"width": 42,
"title": "处置单",
"coordinateSync": false,
"widthHeightSync": false,
"fontSize": 11.25,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 22.5,
"top": 67.5,
"height": 9.75,
"width": 120,
"title": "姓名",
"field": "patientName",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 157.5,
"top": 67.5,
"height": 9.75,
"width": 120,
"title": "年龄",
"field": "age",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 300,
"top": 67.5,
"height": 9.75,
"width": 120,
"title": "性别",
"field": "genderEnum_enumText",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 22.5,
"top": 94.5,
"height": 9.75,
"width": 96,
"title": "科室",
"field": "departmentName",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 156,
"top": 94.5,
"height": 9.75,
"width": 118.5,
"title": "费用性质",
"field": "contractName",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 300,
"top": 94.5,
"height": 9.75,
"width": 120,
"title": "日期",
"field": "reqTime",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 22.5,
"top": 121.5,
"height": 9.75,
"width": 123,
"title": "门诊号",
"field": "encounterNo",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 156,
"top": 121.5,
"height": 9.75,
"width": 120,
"title": "开单医生",
"field": "doctorName",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 18,
"top": 141,
"height": 9,
"width": 393,
"borderWidth": "1.5",
"title": "undefined+beforeDragIn",
"coordinateSync": false,
"widthHeightSync": false
},
"printElementType": {
"title": "横线",
"type": "hline"
}
},
{
"options": {
"left": 22.5,
"top": 156,
"height": 9.75,
"width": 24,
"title": "Rp",
"coordinateSync": false,
"widthHeightSync": false,
"fontSize": 12,
"qrCodeLevel": 0
},
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
"left": 22.5,
"top": 177,
"height": 36,
"width": 387,
"title": "undefined+beforeDragIn",
"coordinateSync": false,
"widthHeightSync": false,
"field": "adviceItemList",
"columns": [
[
{
"title": "项目名",
"titleSync": false,
"halign": "center",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"width": 180.11284430829235,
"field": "itemName",
"checked": true,
"columnId": "itemName",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "单价",
"titleSync": false,
"align": "right",
"halign": "center",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"formatter2": "function(value,row,index,options,rowIndex,column){ return value + ' 元'; }",
"width": 65.15543233883191,
"field": "unitPrice",
"checked": true,
"columnId": "unitPrice",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "数量",
"titleSync": false,
"align": "right",
"halign": "center",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"formatter2": "function(value,row,index,options,rowIndex,column){ return value + ' ' + row.unitCode_dictText; }",
"width": 61.720533008519084,
"field": "quantity",
"checked": true,
"columnId": "quantity",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"title": "执行次数",
"titleSync": false,
"align": "right",
"halign": "center",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"width": 80.01119034435662,
"field": "quantity",
"checked": true,
"columnId": "quantity",
"fixed": false,
"rowspan": 1,
"colspan": 1
}
]
]
},
"printElementType": {
"title": "表格",
"type": "table",
"editable": true,
"columnDisplayEditable": true,
"columnDisplayIndexEditable": true,
"columnTitleEditable": true,
"columnResizable": true,
"columnAlignEditable": true,
"isEnableEditField": true,
"isEnableContextMenu": true,
"isEnableInsertRow": true,
"isEnableDeleteRow": true,
"isEnableInsertColumn": true,
"isEnableDeleteColumn": true,
"isEnableMergeCell": true
}
}
]
}
]
}

View File

@@ -37,7 +37,7 @@
"top": 16.5,
"height": 22.5,
"width": 120,
"title": "医院",
"title": "长春大学医院",
"coordinateSync": false,
"widthHeightSync": false,
"fontFamily": "Microsoft YaHei",

View File

@@ -181,7 +181,15 @@
v-model="projectTypeCode"
placeholder="项目"
style="width: 160px"
@change="getMedicineList(currentRow.encounterId)"
:clearable="false"
@change="
() => {
getList();
if (currentRow) {
getMedicineList(currentRow?.encounterId);
}
}
"
>
<el-option label="全部" value="1" />
<el-option label="药品" value="2" />
@@ -355,28 +363,6 @@
@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">
@@ -393,6 +379,7 @@ import {
getReportRegisterInit,
deviceDispense,
deviceInvalid,
devicePatientList,
} from './components/api';
import { advicePrint } from '@/api/public';
import { formatDate, formatDateStr } from '@/utils/index';
@@ -400,14 +387,7 @@ import { debounce } from 'lodash-es';
import TraceNoDialog from '@/components/OpenHis/TraceNoDialog/index.vue';
// 使用window.hiprint不再从vue-plugin-hiprint导入
import templateJson from './components/templateJson.json';
// import disposalTemplate from './components/disposalTemplate.json';
import {
getPrinterList,
getCachedPrinter,
savePrinterToCache,
selectPrinterAndPrint,
executePrint,
} from '@/utils/his';
import disposalTemplate from './components/disposalTemplate.json';
const showSearch = ref(true);
const total = ref(0);
@@ -516,11 +496,37 @@ function getList() {
queryParams.value.receptionTimeETime = dateRange.value[1] + ' 23:59:59';
console.log('222', queryParams.value);
listPatient(queryParams.value).then((response) => {
console.log('Full response1:', response);
patientList.value = response.data.records;
total.value = response.data.total;
});
if (projectTypeCode.value == 2) {
listPatient(queryParams.value).then((response) => {
console.log('Full response1:', response);
patientList.value = response.data.records;
total.value = response.data.total;
});
} else if (projectTypeCode.value == 3) {
debugger;
devicePatientList(queryParams.value).then((response) => {
console.log('Full response1:', response);
patientList.value = response.data.records;
total.value = response.data.total;
});
} else {
Promise.all([listPatient(queryParams.value), devicePatientList(queryParams.value)]).then(
([patientRes, deviceRes]) => {
// 合并两个接口的数据
const patientRecords = patientRes.data.records || [];
const deviceRecords = deviceRes.data.records || [];
const combinedRecords = [...patientRecords, ...deviceRecords];
// 根据 encounterId 去重
const uniqueRecords = combinedRecords.filter(
(item, index, self) =>
index === self.findIndex((record) => record.encounterId === item.encounterId)
);
patientList.value = uniqueRecords;
// 合并总数量(如果需要精确数量,可能需要后端支持)
total.value = uniqueRecords.length;
}
);
}
listInit().then((response) => {
console.log('Full response2:', response);
departmentList.value = [{ value: null, label: '全部' }, ...response.data.departmentOptions];
@@ -531,6 +537,7 @@ function getList() {
});
}
//打印中西药处方
async function printPrescription() {
// async function printPrescription() {
// const selectedRows = tableRef.value.getSelectionRows();
// if (selectedRows.length === 0) {
@@ -664,6 +671,30 @@ async function getPrintData() {
proxy.$modal.msgWarning('未选择要打印的项目,请重新选择');
return null;
}
let requestIds = selectedRows.map((item) => item.requestId).join(',');
const result = [];
advicePrint({
requestIds: requestIds,
isPrescription: projectTypeCode.value == '3' ? undefined : '1',
}).then((res) => {
if (projectTypeCode.value == '3') {
const result = res.data;
const printElements = disposalTemplate;
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
hiprintTemplate.print2(result, {
height: 210,
width: 148,
});
} else {
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);
});
try {
// 获取打印数据
@@ -688,9 +719,15 @@ async function getPrintData() {
groupedRows[prescriptionNo].push(row);
});
console.log('按处方号分组的结果:', groupedRows);
// 如果您需要将分组后的数据转换为数组形式
const groupedArray = Object.values(groupedRows);
console.log('分组后的数组形式:', groupedArray);
const groupedArray = Object.values(groupedRows);
const result = [];
groupedArray.forEach((item, index) => {
groupedArray.forEach((item) => {
if (item && item.length > 0) {
// 从处方列表的第一个条目提取处方信息
@@ -817,6 +854,27 @@ async function previewAndPrint() {
previewHtml += '<td>' + usageInfo.join('<br/>') + '</td>';
previewHtml += '</tr>';
});
});
console.log(result, 'result');
const printElements = templateJson;
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
hiprintTemplate.print2(result, {
height: 210,
width: 148,
}); //开始打印
// 直接打印回调
// 发送任务到打印机成功
hiprintTemplate.on('printSuccess', function (e) {
console.log('打印成功');
});
// 发送任务到打印机失败
hiprintTemplate.on('printError', function (e) {
console.log('打印失败');
});
}
});
}
} else {
previewHtml += '<tr><td colspan="7" style="text-align: center;">暂无药品信息</td></tr>';
}
@@ -1185,11 +1243,7 @@ function handleQuery() {
queryParams.value.receptionTimeETime = null;
}
queryParams.value.pageNo = 1;
console.log('************', queryParams.value);
listPatient(queryParams.value).then((response) => {
patientList.value = response.data.records;
total.value = response.data.total;
});
getList();
}
function countGroupRows(data) {