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 = '
| 姓名: | '; + printHtml += '' + (prescription.patientName || '-') + ' | '; + printHtml += '性别: | '; + printHtml += '' + (prescription.genderEnum_enumText || prescription.gender || '-') + ' | '; + printHtml += '年龄: | '; + printHtml += '' + (prescription.age || '-') + ' | '; + printHtml += '处方号: | '; + printHtml += '' + (prescription.prescriptionNo || '-') + ' | '; + printHtml += '
| 门诊号: | '; + printHtml += '' + (prescription.encounterNo || '-') + ' | '; + printHtml += '开具日期: | '; + printHtml += '' + (prescription.reqTime || prescription.adviceDate || prescription.createTime || '-') + ' | '; + printHtml += '医生: | '; + printHtml += '' + (prescription.doctorName || '-') + ' | '; + printHtml += '科室: | '; + printHtml += '' + (prescription.departmentName || '-') + ' | '; + printHtml += '
| 临床诊断: | '; + printHtml += '' + (prescription.conditionName || '-') + ' | '; + printHtml += '电话: | '; + printHtml += '' + (prescription.phone || prescription.mobile || prescription.patientPhone || '-') + ' | '; + printHtml += '||||
| 药品名称 | '; - medicineHtml += '规格 | '; - medicineHtml += '单价 | '; - medicineHtml += '数量 | '; - medicineHtml += '金额 | '; - medicineHtml += '用法用量 | '; - medicineHtml += '
|---|---|---|---|---|---|
| 药品名称 | '; + printHtml += '规格 | '; + printHtml += '单价 | '; + printHtml += '数量 | '; + printHtml += '金额 | '; + printHtml += '用法用量 | '; + printHtml += '
|---|---|---|---|---|---|
| ' + (item.medicineName || item.itemName || 'N/A') + ' | '; - medicineHtml += '' + (item.totalVolume || item.spec || '') + ' | '; - medicineHtml += '' + (item.unitPrice || item.price || '0.00') + ' | '; - medicineHtml += '' + (item.quantity || 'N/A') + ' ' + (item.unitCode_dictText || item.unit || '') + ' | '; - medicineHtml += '' + (item.totalPrice || '0.00') + ' | '; + printHtml += '|
| ' + (item.medicineName || item.itemName || 'N/A') + ' | '; + printHtml += '' + (item.totalVolume || item.spec || '') + ' | '; + printHtml += '' + (item.unitPrice || item.price || '0.00') + ' | '; + printHtml += '' + (item.quantity || 'N/A') + ' ' + (item.unitCode_dictText || item.unit || '') + ' | '; + printHtml += '' + (item.totalPrice || '0.00') + ' | '; // 组合用法用量信息 const usageInfo = []; if (item.dose && item.doseUnitCode_dictText) usageInfo.push(item.dose + item.doseUnitCode_dictText); if (item.methodCode_dictText || item.usage) usageInfo.push(item.methodCode_dictText || item.usage); if (item.frequency) usageInfo.push(item.frequency); - medicineHtml += '' + usageInfo.join(' ') + ' | ';
- medicineHtml += '' + usageInfo.join(' ') + ' | ';
+ printHtml += '';
});
- medicineHtml += '';
- medicineHtml += '';
- medicineHtml += '
| 总计: | '; - medicineHtml += '' + (prescription.medTotalAmount || '0.00') + ' | '; - medicineHtml += '||||
暂无药品信息
'; + printHtml += '暂无药品信息
'; } // 分页符(最后一个处方除外) if (index < result.length - 1) { - medicineHtml += ''; + printHtml += ''; } - medicineHtml += '