前端最新版本同步

This commit is contained in:
Zhang.WH
2025-09-25 10:36:07 +08:00
parent a3a06d6f3c
commit 1276dc4adb
117 changed files with 11964 additions and 2466 deletions

View File

@@ -18,7 +18,7 @@ export function listInit(query) {
export function listWesternmedicine(query) {
return request({
url: '/pharmacy-manage/western-medicine-dispense/prescription-list',
url: '/pharmacy-manage/western-medicine-dispense/medicine-order',
method: 'get',
params: query
})
@@ -40,14 +40,11 @@ export function prepareMedicion(data) {
}
export function backMedicion(prescriptionNo,notPerformedReasonEnum) {
export function backMedicion(data) {
return request({
url: '/pharmacy-manage/western-medicine-dispense/medicine-cancel',
method: 'put',
params: {
prescriptionNo: prescriptionNo,
notPerformedReasonEnum:notPerformedReasonEnum
}
data: data
})
}
//扫码枪返回追溯码筛选
@@ -56,4 +53,37 @@ export function itemTraceNo(params) {
url: '/app-common/item-trace-no?traceNoList=' + params,
method: 'get',
})
}
}
/**
* 耗材查询列表
*/
export function getReportRegisterInit(query) {
return request({
url: '/pharmacy-manage/device-dispense/device-order',
method: 'get',
params: query
})
}
/**
* 耗材发药
*/
export function deviceDispense(params) {
return request({
url: '/pharmacy-manage/device-dispense/device-dispense',
method: 'put',
data: params
})
}
/**
* 耗材作废
*/
export function deviceInvalid(data) {
return request({
url: '/pharmacy-manage/device-dispense/device-cancel',
method: 'put',
data: data
})
}

View File

@@ -6,6 +6,28 @@
"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": {
"layoutType": "column",
"layoutRowGap": 0,
"layoutColumnGap": 0
},
"paperHeader": 6,
"paperFooter": 595.2755905511812,
"printElements": [
@@ -15,7 +37,7 @@
"top": 16.5,
"height": 22.5,
"width": 120,
"title": "长春大学医院",
"title": "医院",
"coordinateSync": false,
"widthHeightSync": false,
"fontFamily": "Microsoft YaHei",
@@ -24,7 +46,10 @@
"textContentVerticalAlign": "middle",
"qrCodeLevel": 0
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
@@ -39,7 +64,10 @@
"textAlign": "justify",
"qrCodeLevel": 0
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
@@ -53,7 +81,10 @@
"qrCodeLevel": 0,
"fontSize": 9
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
@@ -67,7 +98,10 @@
"qrCodeLevel": 0,
"fontSize": 9
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
@@ -82,7 +116,10 @@
"fontSize": 9,
"field": "contractName"
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
@@ -97,7 +134,10 @@
"fontSize": 9,
"field": "prescriptionNo"
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
@@ -109,7 +149,10 @@
"coordinateSync": false,
"widthHeightSync": false
},
"printElementType": { "title": "横线", "type": "hline" }
"printElementType": {
"title": "横线",
"type": "hline"
}
},
{
"options": {
@@ -124,7 +167,10 @@
"fontSize": 9,
"field": "genderEnum_enumText"
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
@@ -139,7 +185,10 @@
"fontSize": 9,
"field": "age"
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
@@ -154,7 +203,10 @@
"fontSize": 9,
"field": "patientName"
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
@@ -167,9 +219,12 @@
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9,
"field": "encounterId"
"field": "encounterNo"
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
@@ -182,9 +237,12 @@
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9,
"field": "organizationName"
"field": "departmentName"
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
@@ -199,7 +257,10 @@
"fontSize": 9,
"field": "conditionName"
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
@@ -214,7 +275,10 @@
"fontSize": 9,
"field": "phone"
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
@@ -227,9 +291,12 @@
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9,
"field": "reqAuthoredTime"
"field": "reqTime"
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
@@ -241,7 +308,10 @@
"coordinateSync": false,
"widthHeightSync": false
},
"printElementType": { "title": "横线", "type": "hline" }
"printElementType": {
"title": "横线",
"type": "hline"
}
},
{
"options": {
@@ -256,7 +326,10 @@
"fontWeight": "500",
"qrCodeLevel": 0
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
@@ -281,110 +354,127 @@
"columns": [
[
{
"width": 86.5148548770295,
"title": "名称",
"titleSync": false,
"field": "medicineName",
"checked": true,
"columnId": "medicineName",
"fixed": false,
"rowspan": 1,
"colspan": 1,
"vAlign": "top",
"renderFormatter": "function(value,row,colIndex,options,rowIndex){ return value + '<br/>' + '用法用量'; }",
"styler2": "function(value,row,index,options){ return {padding: '5px 5px' }; }",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": ""
"tableSummary": "",
"renderFormatter": "function(value,row,colIndex,options,rowIndex){ return value + '<br/>' + '用法用量'; }",
"styler2": "function(value,row,index,options){ return {padding: '5px 5px' }; }",
"width": 86.5148548770295,
"field": "itemName",
"checked": true,
"columnId": "itemName",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"width": 87.49337048145199,
"title": "规格",
"titleSync": false,
"vAlign": "top",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"renderFormatter": "function(value,row,colIndex,options,rowIndex){ return value + '<br/>'+ '每次:' + row.dose + row.doseUnitCode_dictText + ' ' + row.methodCode_dictText; }",
"styler2": "function(value,row,index,options){ return {padding: '5px 5px' }; }",
"width": 87.49337048145199,
"field": "totalVolume",
"checked": true,
"columnId": "totalVolume",
"fixed": false,
"rowspan": 1,
"colspan": 1,
"vAlign": "top",
"renderFormatter": "function(value,row,colIndex,options,rowIndex){ return value + '<br/>'+ row.dose + row.doseUnitCode_dictText + ' ' + row.methodCode_dictText; }",
"styler2": "function(value,row,index,options){ return {padding: '5px 5px' }; }",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": ""
"colspan": 1
},
{
"width": 42.00221340893656,
"title": "单价",
"titleSync": false,
"vAlign": "top",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"renderFormatter": "function(value,row,colIndex,options,rowIndex){ return value + '<br/>' + '' }",
"styler2": "function(value,row,index,options){ return {padding: '5px 5px' }; }",
"width": 42.00221340893656,
"field": "unitPrice",
"checked": true,
"columnId": "unitPrice",
"fixed": false,
"rowspan": 1,
"colspan": 1,
"vAlign": "top",
"renderFormatter": "function(value,row,colIndex,options,rowIndex){ return value + '<br/>' + '' }",
"styler2": "function(value,row,index,options){ return {padding: '5px 5px' }; }",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": ""
"colspan": 1
},
{
"width": 56.015045170547694,
"title": "数量",
"titleSync": false,
"vAlign": "top",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"renderFormatter": "function(value,row,colIndex,options,rowIndex){ return value + ' ' + row.unitCode_dictText + '<br/>' + '' }",
"styler2": "function(value,row,index,options){ return {padding: '5px 5px' }; }",
"width": 56.015045170547694,
"field": "quantity",
"checked": true,
"columnId": "quantity",
"fixed": false,
"rowspan": 1,
"colspan": 1,
"vAlign": "top",
"renderFormatter": "function(value,row,colIndex,options,rowIndex){ return value + '<br/>' + '' }",
"styler2": "function(value,row,index,options){ return {padding: '5px 5px' }; }",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": ""
"colspan": 1
},
{
"width": 52.006536852055035,
"title": "金额",
"titleSync": false,
"vAlign": "top",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"renderFormatter": "function(value,row,colIndex,options,rowIndex){ return value + '<br/>' + '' }",
"styler2": "function(value,row,index,options){ return {padding: '5px 5px' }; }",
"width": 52.006536852055035,
"field": "totalPrice",
"checked": true,
"columnId": "totalPrice",
"fixed": false,
"rowspan": 1,
"colspan": 1,
"vAlign": "top",
"renderFormatter": "function(value,row,colIndex,options,rowIndex){ return value + '<br/>' + '' }",
"styler2": "function(value,row,index,options){ return {padding: '5px 5px' }; }",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": ""
"colspan": 1
},
{
"width": 56.96797920997919,
"title": "等级",
"titleSync": false,
"vAlign": "top",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"renderFormatter": "function(value,row,colIndex,options,rowIndex){ return value + '<br/>' + row.rateCode_dictText }",
"styler2": "function(value,row,index,options){ return {padding: '5px 5px' }; }",
"width": 56.96797920997919,
"field": "contractName",
"checked": true,
"columnId": "contractName",
"fixed": false,
"rowspan": 1,
"colspan": 1,
"vAlign": "top",
"renderFormatter": "function(value,row,colIndex,options,rowIndex){ return value + '<br/>' + row.rateCode_dictText }",
"styler2": "function(value,row,index,options){ return {padding: '5px 5px' }; }",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": ""
"colspan": 1
},
{
"title": "名称",
"titleSync": false,
"vAlign": "top",
"tableQRCodeLevel": 0,
"tableSummaryTitle": true,
"tableSummary": "",
"renderFormatter": "function(value,row,colIndex,options,rowIndex){ return value + '<br/>' + '用法用量'; }",
"styler2": "function(value,row,index,options){ return {padding: '5px 5px' }; }",
"width": 86.5148548770295,
"field": "medicineName",
"checked": false,
"columnId": "medicineName",
"fixed": false,
"rowspan": 1,
"colspan": 1
},
{
"width": 79.2099792099792,
"title": "等级",
"width": 79.2099792099792,
"checked": false,
"fixed": false,
"rowspan": 1,
@@ -417,13 +507,17 @@
"top": 520.5,
"height": 12,
"width": 79.5,
"title": "医师",
"title": "医师",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9
"fontSize": 9,
"field": "doctorName"
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
@@ -431,13 +525,17 @@
"top": 520.5,
"height": 12,
"width": 79.5,
"title": "发药:高艳敏",
"title": "发药",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9
"fontSize": 9,
"field": "dispenseDoctorName"
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
@@ -445,13 +543,16 @@
"top": 520.5,
"height": 12,
"width": 79.5,
"title": "划价:",
"title": "划价:张思怡",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
@@ -459,13 +560,17 @@
"top": 520.5,
"height": 12,
"width": 79.5,
"title": "调配:宋丹丹",
"title": "调配",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0,
"fontSize": 9
"fontSize": 9,
"field": "preparerDoctorName"
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
@@ -477,7 +582,10 @@
"coordinateSync": false,
"widthHeightSync": false
},
"printElementType": { "title": "横线", "type": "hline" }
"printElementType": {
"title": "横线",
"type": "hline"
}
},
{
"options": {
@@ -487,7 +595,10 @@
"width": 120,
"title": "注1.本处方当日作废"
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
@@ -495,9 +606,16 @@
"top": 553.5,
"height": 9.75,
"width": 120,
"title": "总金额"
"title": "总金额",
"field": "medTotalAmount",
"coordinateSync": false,
"widthHeightSync": false,
"qrCodeLevel": 0
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
},
{
"options": {
@@ -507,27 +625,12 @@
"width": 120,
"title": "2.延长处方用量时间原因"
},
"printElementType": { "title": "文本", "type": "text" }
"printElementType": {
"title": "文本",
"type": "text"
}
}
],
"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": {
"layoutType": "column",
"layoutRowGap": 0,
"layoutColumnGap": 0
}
]
}
]
}
}

View File

@@ -78,6 +78,7 @@
>
<el-table-column prop="patientName" label="姓名" width="130" align="center" />
<el-table-column prop="genderEnum_enumText" label="性别" width="80" align="center" />
<el-table-column prop="age" label="年龄" width="80" align="center" />
<el-table-column prop="receptionTime" label="就诊日期" align="center">
<template #default="scope">
{{ scope.row.receptionTime ? formatDate(scope.row.receptionTime) : '-' }}
@@ -100,7 +101,7 @@
<!-- <el-button type="success" plain @click="print" icon="Printer" style="margin-left: 30px;">打印</el-button> -->
<!-- </div> -->
<div class="top">
<el-descriptions :column="4" title="患者基本信息">
<!-- <el-descriptions :column="4" title="患者基本信息">
<el-descriptions-item label="姓名:">{{ personInfo.patientName }}</el-descriptions-item>
<el-descriptions-item label="性别:">
{{ personInfo.genderEnum_enumText }}
@@ -119,7 +120,7 @@
<el-descriptions-item label="总金额:">
{{ personInfo.totalPrice ? personInfo.totalPrice.toFixed(2) : '0.00' }}
</el-descriptions-item>
</el-descriptions>
</el-descriptions> -->
<!-- <el-row>
<el-col :span="4">姓名{{ personInfo.patientName }}</el-col>
<el-col :span="3">性别{{ personInfo.genderEnum_enumText }}</el-col>
@@ -173,6 +174,19 @@
:value="item.value"
/>
</el-select>
<span style="color: #606266; font-size: 14px; font-weight: 700; margin-right: 15px">
项目
</span>
<el-select
v-model="projectTypeCode"
placeholder="项目"
style="width: 160px"
@change="getMedicineList(currentRow.encounterId)"
>
<el-option label="全部" value="1" />
<el-option label="药品" value="2" />
<el-option label="耗材" value="3" />
</el-select>
<el-button
:disabled="medicineInfoList && medicineInfoList.length == 0"
type="primary"
@@ -182,13 +196,12 @@
批量发药
</el-button>
<el-button type="primary" @click="handleScan()" style="margin-left: 30px"> 扫码 </el-button>
<el-button
type="primary"
@click="printPrescription()"
style="margin-left: 30px"
>
<el-button type="primary" @click="printPrescription()" style="margin-left: 30px">
处方打印
</el-button>
<div style="position: absolute; top: 30px; right: 25px">
总金额{{ medicineTotalPrice ? medicineTotalPrice.toFixed(2) : '0.00' }}
</div>
</div>
<el-table
:data="medicineInfoList"
@@ -200,8 +213,8 @@
ref="tableRef"
>
<el-table-column type="selection" width="55" align="center" fixed="left" />
<el-table-column prop="prescriptionNo" label="处方号" width="140" align="center" />
<el-table-column prop="medicineName" label="药品名称" width="180" align="center" />
<el-table-column prop="prescriptionNo" label="处方号" width="120" align="center" />
<el-table-column prop="itemName" label="项目名称" width="160" align="center" />
<el-table-column prop="statusEnum_enumText" label="发药状态" width="100" align="center">
<template #default="scope">
<el-tag :type="tagType(scope.row.statusEnum)">
@@ -221,7 +234,7 @@
<el-table-column
prop="doseUnitCode_dictText"
label="单次剂量"
width="100"
width="80"
align="center"
v-if="tcmFlag == '0'"
>
@@ -260,7 +273,7 @@
align="right"
header-align="center"
/>
<el-table-column prop="departmentName" label="科室" width="90" align="center" />
<el-table-column prop="locationName" label="发药药房" width="90" 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,7 +367,11 @@ import {
backMedicion,
prepareMedicion,
itemTraceNo,
getReportRegisterInit,
deviceDispense,
deviceInvalid,
} from './components/api';
import { advicePrint } from '@/api/public';
import { formatDate, formatDateStr } from '@/utils/index';
import { debounce } from 'lodash-es';
import TraceNoDialog from '@/components/OpenHis/TraceNoDialog/index.vue';
@@ -390,6 +407,9 @@ const isManualSelection = ref(false);
const groups = ref({});
const openTraceNoDialog = ref(false);
const ypName = ref('');
const medicineTotalPrice = ref(0);
const projectTypeCode = ref('1');
const selectedRow = ref(null);
const { proxy } = getCurrentInstance();
const medCategoryCode = ref([
@@ -411,6 +431,7 @@ const data = reactive({
condition: null,
departmentId: null,
statusEnum: 3,
classEnum: 2,
},
});
const { queryParams } = toRefs(data);
@@ -475,7 +496,7 @@ function getList() {
backReason.value = response.data.notPerformedReasonOptions;
dispenseStatusOptions.value = response.data.dispenseStatusOptions;
preparerDoctorOptions.value = response.data.preparerDoctorOptions;
preparerDoctor.value = preparerDoctorOptions.value[1].value;
preparerDoctor.value = preparerDoctorOptions.value[0].value;
});
}
//打印中西药处方
@@ -485,7 +506,53 @@ async function printPrescription() {
proxy.$modal.msgWarning('未选择要打印的项目,请重新选择,打印失败');
return;
}
console.log(selectedRows, personInfo, 'selectedRows');
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) => ({
@@ -502,55 +569,41 @@ async function printPrescription() {
// })),
// };
// 按 prescriptionNo 分组
const groupedRows = {};
selectedRows.forEach(row => {
const prescriptionNo = row.prescriptionNo;
if (!groupedRows[prescriptionNo]) {
groupedRows[prescriptionNo] = [];
}
groupedRows[prescriptionNo].push(row);
});
console.log('按处方号分组的结果:', groupedRows);
// 如果您需要将分组后的数据转换为数组形式
const groupedArray = Object.values(groupedRows);
console.log('分组后的数组形式:', groupedArray);
// const groupedRows = {};
// selectedRows.forEach(row => {
// const prescriptionNo = row.prescriptionNo;
// if (!groupedRows[prescriptionNo]) {
// groupedRows[prescriptionNo] = [];
// }
// row.contractName = personInfo.value.contractName;
// groupedRows[prescriptionNo].push(row);
// });
const result = [];
groupedArray.forEach((item, index) => {
result.push({
...personInfo.value,
prescriptionNo: item[0].prescriptionNo,
reqAuthoredTime: item[0].reqAuthoredTime,
prescriptionList: item,
})
})
// 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);
console.log(result, 'result');
// 模板对象获取
const printElements = templateJson;
var hiprintTemplate = new hiprint.PrintTemplate({ template: printElements }); // 定义模板
const printerList = hiprintTemplate.getPrinterList();
console.log(hiprintTemplate, '打印机列表');
hiprintTemplate.print2(result, {
printer: 'Microsoft Print to PDF',
title: '打印标题',
height: 210,
width: 148,
}); //开始打印
// 直接打印回调
// 发送任务到打印机成功
hiprintTemplate.on('printSuccess', function (e) {
console.log('打印成功');
})
// 发送任务到打印机失败
hiprintTemplate.on('printError', function (e) {
console.log('打印失败');
})
// 模板对象获取
// await CefSharp.BindObjectAsync('boundAsync');
// await boundAsync
@@ -632,25 +685,27 @@ function getRowMarkers(groupCounts, data) {
function spanMethod({ row, column, rowIndex, columnIndex }) {
// 定义需要合并的列范围前6列包括selection列
const columnsToMerge = [1, 16]; // 假设selection列是第0列其他列依次是1, 2, 3, 4, 5
console.log(row);
// 检查当前列是否在需要合并的列范围内
if (columnsToMerge.includes(columnIndex)) {
const prescriptionNo = row.prescriptionNo;
if (row.prescriptionNo) {
if (columnsToMerge.includes(columnIndex)) {
const prescriptionNo = row.prescriptionNo;
// 查找当前处方号在列表中第一次出现的索引
const firstRowIndex = medicineInfoList.value.findIndex(
(item) => item.prescriptionNo === prescriptionNo
);
// 如果当前行是该处方号的首行则合并count行
if (rowIndex === firstRowIndex) {
// 计算该处方号的总行数
const count = medicineInfoList.value.filter(
// 查找当前处方号在列表中第一次出现的索引
const firstRowIndex = medicineInfoList.value.findIndex(
(item) => item.prescriptionNo === prescriptionNo
).length;
return [count, 1]; // 合并count行1列
} else {
return [0, 0]; // 其他行不显示
);
// 如果当前行是该处方号的首行则合并count行
if (rowIndex === firstRowIndex) {
// 计算该处方号的总行数
const count = medicineInfoList.value.filter(
(item) => item.prescriptionNo === prescriptionNo
).length;
return [count, 1]; // 合并count行1列
} else {
return [0, 0]; // 其他行不显示
}
}
}
@@ -661,7 +716,7 @@ function spanMethod({ row, column, rowIndex, columnIndex }) {
function handleSelectionChange(selectedRows, currentRow) {
medicineInfoList.value
.filter((item) => {
return item.prescriptionNo == currentRow.prescriptionNo;
return item.dispenseId == currentRow.dispenseId;
})
.forEach((item, index) => {
tableRef.value.toggleRowSelection(item, selectedRows.includes(currentRow));
@@ -696,76 +751,190 @@ function handleCurrentChange(row) {
}
function getMedicineList(encounterId) {
listWesternmedicine({
encounterId: encounterId,
statusEnum: queryParams.value.statusEnum,
tcmFlag: tcmFlag.value,
}).then((response) => {
console.log('121212', response);
personInfo.value = response.data.prescriptionPatientInfoDto;
medicineInfoList.value = Array.isArray(response.data.prescriptionMedicineInfoDtoList)
? response.data.prescriptionMedicineInfoDtoList
: [response.data.prescriptionMedicineInfoDtoList];
// 创建分组映射表
const groupMap = {};
medicineInfoList.value.forEach((item) => {
const groupId = item.groupId; // 确保属性名一致
if (groupId != null) {
// 过滤掉null/undefined
groupMap[groupId] = groupMap[groupId] || [];
groupMap[groupId].push(item);
}
});
// 根据projectTypeCode的值决定调用哪些接口
if (projectTypeCode.value == 1) {
// 同时调用两个接口并将数据合并显示
Promise.all([
listWesternmedicine({
pageNo: 1,
pageSize: 100,
encounterId: encounterId,
statusEnum: queryParams.value.statusEnum,
tcmFlag: tcmFlag.value,
}),
getReportRegisterInit({
pageNo: 1,
pageSize: 100,
encounterId: encounterId,
statusEnum: queryParams.value.statusEnum,
tcmFlag: tcmFlag.value,
}),
])
.then(([westernRes, reportRes]) => {
// 合并两个接口的数据
let westernData = Array.isArray(westernRes.data.records)
? westernRes.data.records
: [westernRes.data.records];
// 处理每个分组
Object.values(groupMap).forEach((group) => {
const count = group.length;
if (count === 2) {
group[0].flag = '┓';
group[1].flag = '┛';
} else if (count > 2) {
group[0].flag = '┓';
group.slice(1, -1).forEach((item) => (item.flag = '┃')); // 中间元素
group[group.length - 1].flag = '┛';
}
});
let reportData = Array.isArray(reportRes.data.records)
? reportRes.data.records
: [reportRes.data.records];
// 处理没有分组的项
medicineInfoList.value.forEach((item) => {
if (item.groupId == null) {
// 确保属性名一致
item.flag = '';
} else if (!item.flag) {
// 确保所有项都有flag属性
item.flag = '';
}
});
// 合并数据
medicineInfoList.value = [...westernData, ...reportData];
diagnoses.value = medicineInfoList.value.map((item) => item.诊断 || '无').join(', ');
// 处理合并后的数据
processMedicineListData();
})
.catch((error) => {
console.error('获取数据失败:', error);
proxy.$modal.msgError('获取数据失败');
});
} else if (projectTypeCode.value == 2) {
// 只调用listWesternmedicine接口
listWesternmedicine({
pageNo: 1,
pageSize: 100,
encounterId: encounterId,
statusEnum: queryParams.value.statusEnum,
tcmFlag: tcmFlag.value,
}).then((response) => {
console.log('121212', response);
// personInfo.value = response.data.prescriptionPatientInfoDto;
medicineInfoList.value = Array.isArray(response.data.records)
? response.data.records
: [response.data.records];
// 处理数据
processMedicineListData();
});
} else if (projectTypeCode.value == 3) {
// 只调用getReportRegisterInit接口
getReportRegisterInit({
encounterId: encounterId,
statusEnum: queryParams.value.statusEnum,
tcmFlag: tcmFlag.value,
}).then((response) => {
medicineInfoList.value = Array.isArray(response.data.records)
? response.data.records
: [response.data.records];
// 处理数据
processMedicineListData();
});
}
}
// 提取公共的数据处理逻辑
function processMedicineListData() {
// 创建分组映射表
const groupMap = {};
medicineTotalPrice.value = 0;
medicineInfoList.value.forEach((item) => {
const groupId = item.groupId; // 确保属性名一致
medicineTotalPrice.value = medicineTotalPrice.value + item.totalPrice;
if (groupId != null) {
// 过滤掉null/undefined
groupMap[groupId] = groupMap[groupId] || [];
groupMap[groupId].push(item);
}
});
// 处理每个分组
Object.values(groupMap).forEach((group) => {
const count = group.length;
if (count === 2) {
group[0].flag = '┓';
group[1].flag = '┛';
} else if (count > 2) {
group[0].flag = '┓';
group.slice(1, -1).forEach((item) => (item.flag = '┃')); // 中间元素
group[group.length - 1].flag = '┛';
}
});
// 处理没有分组的项
medicineInfoList.value.forEach((item) => {
if (item.groupId == null) {
// 确保属性名一致
item.flag = '';
} else if (!item.flag) {
// 确保所有项都有flag属性
item.flag = '';
}
});
diagnoses.value = medicineInfoList.value.map((item) => item.诊断 || '无').join(', ');
}
function submitMedicine(saveList) {
prepareMedicion(saveList).then((res) => {
if (res.code == 200) {
updateMedicion(saveList).then((response) => {
proxy.$modal.msgSuccess('发药成功');
listWesternmedicine({
encounterId: currentRow.value.encounterId,
statusEnum: queryParams.value.statusEnum,
tcmFlag: tcmFlag.value,
}).then((response) => {
medicineInfoList.value = Array.isArray(response.data.prescriptionMedicineInfoDtoList)
? response.data.prescriptionMedicineInfoDtoList
: [response.data.prescriptionMedicineInfoDtoList];
// 统计每个 prescriptionNo 的行数
const groupCounts = countGroupRows(medicineInfoList.value);
// 设置每行的标记
markers.value = getRowMarkers(groupCounts, medicineInfoList.value);
});
});
console.log(saveList);
if (projectTypeCode.value == 1) {
// 根据itemTable分类数据
const deviceList = saveList.filter((item) => item.itemTable === 'adm_device_definition');
const medicineList = saveList.filter((item) => item.itemTable === 'med_medication_definition');
// 并行处理两种类型的发药
const promises = [];
// 如果有耗材数据调用deviceDispense接口
if (deviceList.length > 0) {
promises.push(
deviceDispense(deviceList).then((res) => {
if (res.code != 200) {
throw new Error('耗材发药失败');
}
return res;
})
);
}
});
// 如果有药品数据调用prepareMedicion接口
if (medicineList.length > 0) {
promises.push(
prepareMedicion(medicineList).then((res) => {
if (res.code != 200) {
throw new Error('药品发药失败');
}
return res;
})
);
}
// 等待所有发药接口完成
Promise.all(promises)
.then(() => {
// 所有发药都成功后,调用更新接口
if (medicineList.length > 0) {
return updateMedicion(medicineList);
}
})
.then((response) => {
proxy.$modal.msgSuccess('发药成功');
// 重新获取数据
getMedicineList(currentRow.value.encounterId);
})
.catch((error) => {
console.error('发药失败:', error);
proxy.$modal.msgError('发药失败: ' + error.message);
});
} else if (projectTypeCode.value == 2) {
prepareMedicion(saveList).then((res) => {
if (res.code == 200) {
updateMedicion(saveList).then((response) => {
proxy.$modal.msgSuccess('发药成功');
getMedicineList(currentRow.value.encounterId);
});
}
});
} else {
deviceDispense(saveList).then((res) => {
if (res.code == 200) {
proxy.$modal.msgSuccess('发药成功');
getMedicineList(currentRow.value.encounterId);
}
});
}
}
const throttledGetList = debounce(handelTraceNo, 500);
const traceNoInput = debounce(handleTraceNoInput, 500);
@@ -815,7 +984,7 @@ function handleBatch(row) {
if (row) {
saveList = medicineInfoList.value
.filter((item) => {
return item.prescriptionNo === row.prescriptionNo;
return item.dispenseId === row.dispenseId;
})
.map((item) => {
return {
@@ -824,6 +993,7 @@ function handleBatch(row) {
traceNo: item.traceNo,
prescriptionNo: item.prescriptionNo,
preparerId: preparerDoctor.value,
itemTable: item.itemTable,
};
});
} else {
@@ -835,6 +1005,7 @@ function handleBatch(row) {
traceNo: item.traceNo,
prescriptionNo: item.prescriptionNo,
preparerId: preparerDoctor.value,
itemTable: item.itemTable,
};
});
}
@@ -846,7 +1017,8 @@ function handleBatch(row) {
function backMedicine(row) {
showDialog.value = true;
selectedPrescriptionNo.value = row.prescriptionNo;
selectedPrescriptionNo.value = row.dispenseId;
selectedRow.value = row;
console.log('作废原因:', selectedPrescriptionNo.value, row.prescriptionNo);
}
@@ -855,24 +1027,26 @@ function handleConfirm() {
ElMessage.error('请选择作废原因');
return;
}
backMedicion(selectedPrescriptionNo.value, notPerformedReasonEnum.value).then((response) => {
proxy.$modal.msgSuccess('作废成功');
});
listWesternmedicine({
encounterId: currentRow.value.encounterId,
statusEnum: queryParams.value.statusEnum,
tcmFlag: tcmFlag.value,
}).then((response) => {
console.log('1212*******12', response);
medicineInfoList.value = Array.isArray(response.data.prescriptionMedicineInfoDtoList)
? response.data.prescriptionMedicineInfoDtoList
: [response.data.prescriptionMedicineInfoDtoList];
// medicineInfoList.value = response.data;
// 统计每个 prescriptionNo 的行数
const groupCounts = countGroupRows(medicineInfoList.value);
// 设置每行的标记
markers.value = getRowMarkers(groupCounts, medicineInfoList.value);
});
if (selectedRow.value.itemTable != 'adm_device_definition') {
backMedicion([
{
dispenseId: selectedPrescriptionNo.value,
notPerformedReasonEnum: notPerformedReasonEnum.value,
},
]).then((response) => {
proxy.$modal.msgSuccess('作废成功');
});
} else {
deviceInvalid([
{
dispenseId: selectedPrescriptionNo.value,
notPerformedReasonEnum: notPerformedReasonEnum.value,
},
]).then((response) => {
proxy.$modal.msgSuccess('作废成功');
});
}
getMedicineList(currentRow.value.encounterId);
showDialog.value = false;
notPerformedReasonEnum.value = ''; // 清空选择
}