diff --git a/openhis-ui-vue3/src/views/pharmacymanagement/westernmedicine/components/templateJson.json b/openhis-ui-vue3/src/views/pharmacymanagement/westernmedicine/components/templateJson.json index 448daf24..eecf0cb2 100644 --- a/openhis-ui-vue3/src/views/pharmacymanagement/westernmedicine/components/templateJson.json +++ b/openhis-ui-vue3/src/views/pharmacymanagement/westernmedicine/components/templateJson.json @@ -165,7 +165,8 @@ "widthHeightSync": false, "qrCodeLevel": 0, "fontSize": 9, - "field": "genderEnum_enumText" + "field": "gender", + "formatter": "function(title,value,options,templateData,target,paperNo){ return templateData.gender || templateData.sex || templateData.genderCode_dictText || '-' }" }, "printElementType": { "title": "文本", @@ -219,7 +220,8 @@ "widthHeightSync": false, "qrCodeLevel": 0, "fontSize": 9, - "field": "encounterNo" + "field": "visitNo", + "formatter": "function(title,value,options,templateData,target,paperNo){ return templateData.visitNo || templateData.patientNo || templateData.outpatientNo || templateData.encounterNo || '-' }" }, "printElementType": { "title": "文本", @@ -255,7 +257,8 @@ "widthHeightSync": false, "qrCodeLevel": 0, "fontSize": 9, - "field": "conditionName" + "field": "diagnosis", + "formatter": "function(title,value,options,templateData,target,paperNo){ return templateData.diagnosis || templateData.diagnosisName || templateData.diagnose || templateData.conditionName || '-' }" }, "printElementType": { "title": "文本", @@ -273,7 +276,8 @@ "widthHeightSync": false, "qrCodeLevel": 0, "fontSize": 9, - "field": "phone" + "field": "mobile", + "formatter": "function(title,value,options,templateData,target,paperNo){ return templateData.mobile || templateData.patientPhone || templateData.phone || templateData.contactPhone || '-' }" }, "printElementType": { "title": "文本", @@ -291,7 +295,8 @@ "widthHeightSync": false, "qrCodeLevel": 0, "fontSize": 9, - "field": "reqTime" + "field": "createTime", + "formatter": "function(title,value,options,templateData,target,paperNo){ return templateData.createTime || templateData.createDate || templateData.orderDate || templateData.confirmTime || templateData.reqTime || '-' }" }, "printElementType": { "title": "文本", diff --git a/openhis-ui-vue3/src/views/pharmacymanagement/westernmedicine/index.vue b/openhis-ui-vue3/src/views/pharmacymanagement/westernmedicine/index.vue index 21f88931..5fbced0d 100644 --- a/openhis-ui-vue3/src/views/pharmacymanagement/westernmedicine/index.vue +++ b/openhis-ui-vue3/src/views/pharmacymanagement/westernmedicine/index.vue @@ -844,14 +844,30 @@ async function previewAndPrint() { printContainer.style.top = '-9999px'; printContainer.style.width = '800px'; - // 添加打印样式,确保只打印药品信息 + // 添加打印样式,包含患者信息和药品信息 const style = document.createElement('style'); style.textContent = ` - /* 确保打印样式只应用于药品信息 */ + /* 确保打印样式应用于患者信息和药品信息 */ .print-content { font-family: Arial, sans-serif; font-size: 12px; } + /* 患者信息表格样式 */ + .patient-info-table { + width: 100%; + border-collapse: collapse; + margin-bottom: 15px; + } + .patient-info-table td { + padding: 4px 8px; + border: 1px solid #ddd; + font-size: 12px; + } + .patient-info-table .label { + font-weight: bold; + background-color: #f9f9f9; + } + /* 药品表格样式 */ .medicine-table { width: 100%; border-collapse: collapse; @@ -885,70 +901,100 @@ async function previewAndPrint() { // 设置容器ID以便CSS选择 printContainer.id = 'print-container'; - // 仅构建药品信息表格 - let medicineHtml = ''; + printContainer.innerHTML = printHtml; // 添加到文档 document.body.appendChild(printContainer);