解决合并冲突
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user