在处方打印处增加患者信息
This commit is contained in:
@@ -165,7 +165,8 @@
|
|||||||
"widthHeightSync": false,
|
"widthHeightSync": false,
|
||||||
"qrCodeLevel": 0,
|
"qrCodeLevel": 0,
|
||||||
"fontSize": 9,
|
"fontSize": 9,
|
||||||
"field": "genderEnum_enumText"
|
"field": "gender",
|
||||||
|
"formatter": "function(title,value,options,templateData,target,paperNo){ return templateData.gender || templateData.sex || templateData.genderCode_dictText || '-' }"
|
||||||
},
|
},
|
||||||
"printElementType": {
|
"printElementType": {
|
||||||
"title": "文本",
|
"title": "文本",
|
||||||
@@ -219,7 +220,8 @@
|
|||||||
"widthHeightSync": false,
|
"widthHeightSync": false,
|
||||||
"qrCodeLevel": 0,
|
"qrCodeLevel": 0,
|
||||||
"fontSize": 9,
|
"fontSize": 9,
|
||||||
"field": "encounterNo"
|
"field": "visitNo",
|
||||||
|
"formatter": "function(title,value,options,templateData,target,paperNo){ return templateData.visitNo || templateData.patientNo || templateData.outpatientNo || templateData.encounterNo || '-' }"
|
||||||
},
|
},
|
||||||
"printElementType": {
|
"printElementType": {
|
||||||
"title": "文本",
|
"title": "文本",
|
||||||
@@ -255,7 +257,8 @@
|
|||||||
"widthHeightSync": false,
|
"widthHeightSync": false,
|
||||||
"qrCodeLevel": 0,
|
"qrCodeLevel": 0,
|
||||||
"fontSize": 9,
|
"fontSize": 9,
|
||||||
"field": "conditionName"
|
"field": "diagnosis",
|
||||||
|
"formatter": "function(title,value,options,templateData,target,paperNo){ return templateData.diagnosis || templateData.diagnosisName || templateData.diagnose || templateData.conditionName || '-' }"
|
||||||
},
|
},
|
||||||
"printElementType": {
|
"printElementType": {
|
||||||
"title": "文本",
|
"title": "文本",
|
||||||
@@ -273,7 +276,8 @@
|
|||||||
"widthHeightSync": false,
|
"widthHeightSync": false,
|
||||||
"qrCodeLevel": 0,
|
"qrCodeLevel": 0,
|
||||||
"fontSize": 9,
|
"fontSize": 9,
|
||||||
"field": "phone"
|
"field": "mobile",
|
||||||
|
"formatter": "function(title,value,options,templateData,target,paperNo){ return templateData.mobile || templateData.patientPhone || templateData.phone || templateData.contactPhone || '-' }"
|
||||||
},
|
},
|
||||||
"printElementType": {
|
"printElementType": {
|
||||||
"title": "文本",
|
"title": "文本",
|
||||||
@@ -291,7 +295,8 @@
|
|||||||
"widthHeightSync": false,
|
"widthHeightSync": false,
|
||||||
"qrCodeLevel": 0,
|
"qrCodeLevel": 0,
|
||||||
"fontSize": 9,
|
"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": {
|
"printElementType": {
|
||||||
"title": "文本",
|
"title": "文本",
|
||||||
|
|||||||
@@ -844,14 +844,30 @@ async function previewAndPrint() {
|
|||||||
printContainer.style.top = '-9999px';
|
printContainer.style.top = '-9999px';
|
||||||
printContainer.style.width = '800px';
|
printContainer.style.width = '800px';
|
||||||
|
|
||||||
// 添加打印样式,确保只打印药品信息
|
// 添加打印样式,包含患者信息和药品信息
|
||||||
const style = document.createElement('style');
|
const style = document.createElement('style');
|
||||||
style.textContent = `
|
style.textContent = `
|
||||||
/* 确保打印样式只应用于药品信息 */
|
/* 确保打印样式应用于患者信息和药品信息 */
|
||||||
.print-content {
|
.print-content {
|
||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
font-size: 12px;
|
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 {
|
.medicine-table {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
@@ -885,70 +901,100 @@ async function previewAndPrint() {
|
|||||||
// 设置容器ID以便CSS选择
|
// 设置容器ID以便CSS选择
|
||||||
printContainer.id = 'print-container';
|
printContainer.id = 'print-container';
|
||||||
|
|
||||||
// 仅构建药品信息表格
|
// 构建包含患者信息和药品信息的打印内容
|
||||||
let medicineHtml = '<div class="print-content">';
|
let printHtml = '<div class="print-content">';
|
||||||
|
|
||||||
result.forEach((prescription, index) => {
|
result.forEach((prescription, index) => {
|
||||||
if (!prescription) return;
|
if (!prescription) return;
|
||||||
const prescriptionList = Array.isArray(prescription.prescriptionList) ? prescription.prescriptionList : [];
|
const prescriptionList = Array.isArray(prescription.prescriptionList) ? prescription.prescriptionList : [];
|
||||||
|
|
||||||
// 只保留必要的药品信息
|
printHtml += '<div class="prescription-medicines">';
|
||||||
medicineHtml += '<div class="prescription-medicines">';
|
printHtml += '<h4>处方 ' + (index + 1) + '</h4>';
|
||||||
medicineHtml += '<h4>处方 ' + (index + 1) + '</h4>';
|
|
||||||
|
|
||||||
|
// 添加患者信息表格
|
||||||
|
printHtml += '<table class="patient-info-table">';
|
||||||
|
printHtml += '<tr>';
|
||||||
|
printHtml += '<td class="label">姓名:</td>';
|
||||||
|
printHtml += '<td>' + (prescription.patientName || '-') + '</td>';
|
||||||
|
printHtml += '<td class="label">性别:</td>';
|
||||||
|
printHtml += '<td>' + (prescription.genderEnum_enumText || prescription.gender || '-') + '</td>';
|
||||||
|
printHtml += '<td class="label">年龄:</td>';
|
||||||
|
printHtml += '<td>' + (prescription.age || '-') + '</td>';
|
||||||
|
printHtml += '<td class="label">处方号:</td>';
|
||||||
|
printHtml += '<td>' + (prescription.prescriptionNo || '-') + '</td>';
|
||||||
|
printHtml += '</tr>';
|
||||||
|
printHtml += '<tr>';
|
||||||
|
printHtml += '<td class="label">门诊号:</td>';
|
||||||
|
printHtml += '<td>' + (prescription.encounterNo || '-') + '</td>';
|
||||||
|
printHtml += '<td class="label">开具日期:</td>';
|
||||||
|
printHtml += '<td>' + (prescription.reqTime || prescription.adviceDate || prescription.createTime || '-') + '</td>';
|
||||||
|
printHtml += '<td class="label">医生:</td>';
|
||||||
|
printHtml += '<td>' + (prescription.doctorName || '-') + '</td>';
|
||||||
|
printHtml += '<td class="label">科室:</td>';
|
||||||
|
printHtml += '<td>' + (prescription.departmentName || '-') + '</td>';
|
||||||
|
printHtml += '</tr>';
|
||||||
|
printHtml += '<tr>';
|
||||||
|
printHtml += '<td class="label">临床诊断:</td>';
|
||||||
|
printHtml += '<td colspan="3">' + (prescription.conditionName || '-') + '</td>';
|
||||||
|
printHtml += '<td class="label">电话:</td>';
|
||||||
|
printHtml += '<td colspan="3">' + (prescription.phone || prescription.mobile || prescription.patientPhone || '-') + '</td>';
|
||||||
|
printHtml += '</tr>';
|
||||||
|
printHtml += '</table>';
|
||||||
|
|
||||||
|
// 添加药品信息表格
|
||||||
if (prescriptionList.length > 0) {
|
if (prescriptionList.length > 0) {
|
||||||
medicineHtml += '<table class="medicine-table">';
|
printHtml += '<table class="medicine-table">';
|
||||||
medicineHtml += '<thead>';
|
printHtml += '<thead>';
|
||||||
medicineHtml += '<tr>';
|
printHtml += '<tr>';
|
||||||
medicineHtml += '<th>药品名称</th>';
|
printHtml += '<th>药品名称</th>';
|
||||||
medicineHtml += '<th>规格</th>';
|
printHtml += '<th>规格</th>';
|
||||||
medicineHtml += '<th>单价</th>';
|
printHtml += '<th>单价</th>';
|
||||||
medicineHtml += '<th>数量</th>';
|
printHtml += '<th>数量</th>';
|
||||||
medicineHtml += '<th>金额</th>';
|
printHtml += '<th>金额</th>';
|
||||||
medicineHtml += '<th>用法用量</th>';
|
printHtml += '<th>用法用量</th>';
|
||||||
medicineHtml += '</tr>';
|
printHtml += '</tr>';
|
||||||
medicineHtml += '</thead>';
|
printHtml += '</thead>';
|
||||||
medicineHtml += '<tbody>';
|
printHtml += '<tbody>';
|
||||||
|
|
||||||
prescriptionList.forEach((item) => {
|
prescriptionList.forEach((item) => {
|
||||||
medicineHtml += '<tr>';
|
printHtml += '<tr>';
|
||||||
medicineHtml += '<td>' + (item.medicineName || item.itemName || 'N/A') + '</td>';
|
printHtml += '<td>' + (item.medicineName || item.itemName || 'N/A') + '</td>';
|
||||||
medicineHtml += '<td>' + (item.totalVolume || item.spec || '') + '</td>';
|
printHtml += '<td>' + (item.totalVolume || item.spec || '') + '</td>';
|
||||||
medicineHtml += '<td>' + (item.unitPrice || item.price || '0.00') + '</td>';
|
printHtml += '<td>' + (item.unitPrice || item.price || '0.00') + '</td>';
|
||||||
medicineHtml += '<td>' + (item.quantity || 'N/A') + ' ' + (item.unitCode_dictText || item.unit || '') + '</td>';
|
printHtml += '<td>' + (item.quantity || 'N/A') + ' ' + (item.unitCode_dictText || item.unit || '') + '</td>';
|
||||||
medicineHtml += '<td>' + (item.totalPrice || '0.00') + '</td>';
|
printHtml += '<td>' + (item.totalPrice || '0.00') + '</td>';
|
||||||
|
|
||||||
// 组合用法用量信息
|
// 组合用法用量信息
|
||||||
const usageInfo = [];
|
const usageInfo = [];
|
||||||
if (item.dose && item.doseUnitCode_dictText) usageInfo.push(item.dose + item.doseUnitCode_dictText);
|
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.methodCode_dictText || item.usage) usageInfo.push(item.methodCode_dictText || item.usage);
|
||||||
if (item.frequency) usageInfo.push(item.frequency);
|
if (item.frequency) usageInfo.push(item.frequency);
|
||||||
medicineHtml += '<td>' + usageInfo.join('<br/>') + '</td>';
|
printHtml += '<td>' + usageInfo.join('<br/>') + '</td>';
|
||||||
medicineHtml += '</tr>';
|
printHtml += '</tr>';
|
||||||
});
|
});
|
||||||
|
|
||||||
medicineHtml += '</tbody>';
|
printHtml += '</tbody>';
|
||||||
medicineHtml += '<tfoot>';
|
printHtml += '<tfoot>';
|
||||||
medicineHtml += '<tr>';
|
printHtml += '<tr>';
|
||||||
medicineHtml += '<td colspan="4" style="text-align: right; font-weight: bold;">总计:</td>';
|
printHtml += '<td colspan="4" style="text-align: right; font-weight: bold;">总计:</td>';
|
||||||
medicineHtml += '<td colspan="2" style="font-weight: bold;">' + (prescription.medTotalAmount || '0.00') + '</td>';
|
printHtml += '<td colspan="2" style="font-weight: bold;">' + (prescription.medTotalAmount || '0.00') + '</td>';
|
||||||
medicineHtml += '</tr>';
|
printHtml += '</tr>';
|
||||||
medicineHtml += '</tfoot>';
|
printHtml += '</tfoot>';
|
||||||
medicineHtml += '</table>';
|
printHtml += '</table>';
|
||||||
} else {
|
} else {
|
||||||
medicineHtml += '<p>暂无药品信息</p>';
|
printHtml += '<p>暂无药品信息</p>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分页符(最后一个处方除外)
|
// 分页符(最后一个处方除外)
|
||||||
if (index < result.length - 1) {
|
if (index < result.length - 1) {
|
||||||
medicineHtml += '<div class="page-break"></div>';
|
printHtml += '<div class="page-break"></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
medicineHtml += '</div>';
|
printHtml += '</div>';
|
||||||
});
|
});
|
||||||
|
|
||||||
medicineHtml += '</div>';
|
printHtml += '</div>';
|
||||||
printContainer.innerHTML = medicineHtml;
|
printContainer.innerHTML = printHtml;
|
||||||
|
|
||||||
// 添加到文档
|
// 添加到文档
|
||||||
document.body.appendChild(printContainer);
|
document.body.appendChild(printContainer);
|
||||||
|
|||||||
Reference in New Issue
Block a user