diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientRegistrationAppService.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientRegistrationAppService.java index 528c24d0..2f79e2a8 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientRegistrationAppService.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientRegistrationAppService.java @@ -8,6 +8,7 @@ import com.openhis.web.chargemanage.dto.CurrentDayEncounterDto; import com.openhis.web.chargemanage.dto.OrgMetadata; import com.openhis.web.chargemanage.dto.PatientMetadata; import com.openhis.web.chargemanage.dto.PractitionerMetadata; +import com.openhis.web.chargemanage.dto.ReprintRegistrationDto; import com.openhis.web.paymentmanage.dto.CancelRegPaymentDto; import javax.servlet.http.HttpServletRequest; @@ -85,4 +86,12 @@ public interface IOutpatientRegistrationAppService { */ R cancelRegister(Long encounterId); + /** + * 补打挂号 + * + * @param reprintRegistrationDto 补打挂号信息 + * @return 结果 + */ + R reprintRegistration(ReprintRegistrationDto reprintRegistrationDto); + } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRegistrationAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRegistrationAppServiceImpl.java index 17fa7047..e9ddc973 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRegistrationAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRegistrationAppServiceImpl.java @@ -27,6 +27,7 @@ import com.openhis.web.chargemanage.dto.CurrentDayEncounterDto; import com.openhis.web.chargemanage.dto.OrgMetadata; import com.openhis.web.chargemanage.dto.PatientMetadata; import com.openhis.web.chargemanage.dto.PractitionerMetadata; +import com.openhis.web.chargemanage.dto.ReprintRegistrationDto; import com.openhis.web.chargemanage.mapper.OutpatientRegistrationAppMapper; import com.openhis.web.paymentmanage.appservice.IPaymentRecService; import com.openhis.web.paymentmanage.dto.CancelPaymentDto; @@ -283,7 +284,7 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra HttpServletRequest request) { // 构建查询条件 QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(null, searchKey, - new HashSet<>(Arrays.asList("patient_name", "organization_name", "practitioner_name", "healthcare_name")), + new HashSet<>(Arrays.asList("patient_name", "organization_name", "practitioner_name", "healthcare_name", "identifier_no")), request); // 手动处理 statusEnum 参数(用于过滤退号记录) @@ -330,4 +331,18 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra return R.ok("已取消挂号"); } + /** + * 补打挂号 + * 补打挂号不需要修改数据库,只需要返回成功即可,前端已有所有需要的数据用于打印 + * + * @param reprintRegistrationDto 补打挂号信息 + * @return 结果 + */ + @Override + public R reprintRegistration(ReprintRegistrationDto reprintRegistrationDto) { + // 补打挂号只是重新打印,不需要修改数据库 + // 可以在这里添加日志记录补打操作 + return R.ok(null, "补打挂号成功"); + } + } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRegistrationController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRegistrationController.java index 7733a7f9..7446fe09 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRegistrationController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRegistrationController.java @@ -8,6 +8,7 @@ import com.openhis.common.enums.PriorityLevel; import com.openhis.financial.domain.PaymentReconciliation; import com.openhis.web.chargemanage.appservice.IOutpatientRegistrationAppService; import com.openhis.web.chargemanage.dto.OutpatientRegistrationInitDto; +import com.openhis.web.chargemanage.dto.ReprintRegistrationDto; import com.openhis.web.paymentmanage.appservice.IEleInvoiceService; import com.openhis.web.paymentmanage.dto.CancelRegPaymentDto; import lombok.AllArgsConstructor; @@ -151,4 +152,15 @@ public class OutpatientRegistrationController { return R.ok(iOutpatientRegistrationAppService.getCurrentDayEncounter(searchKey, pageNo, pageSize, request)); } + /** + * 补打挂号 + * + * @param reprintRegistrationDto 补打挂号信息 + * @return 结果 + */ + @PostMapping(value = "/reprint") + public R reprintRegistration(@RequestBody ReprintRegistrationDto reprintRegistrationDto) { + return iOutpatientRegistrationAppService.reprintRegistration(reprintRegistrationDto); + } + } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/CurrentDayEncounterDto.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/CurrentDayEncounterDto.java index 6936eb87..d4eee1e3 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/CurrentDayEncounterDto.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/CurrentDayEncounterDto.java @@ -136,4 +136,9 @@ public class CurrentDayEncounterDto { */ private String phone; + /** + * 就诊卡号 + */ + private String identifierNo; + } diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRegistrationAppMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRegistrationAppMapper.xml index b34dea7b..910049ef 100644 --- a/openhis-server-new/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRegistrationAppMapper.xml +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRegistrationAppMapper.xml @@ -65,7 +65,8 @@ T9.charge_item_ids, T9.payment_id, T9.picture_url, - T9.birth_date + T9.birth_date, + T9.identifier_no from ( SELECT T1.tenant_id AS tenant_id, T1.id AS encounter_id, @@ -88,7 +89,8 @@ T13.charge_item_ids, T13.id AS payment_id, ai.picture_url AS picture_url, - T8.birth_date AS birth_date + T8.birth_date AS birth_date, + T18.identifier_no AS identifier_no FROM adm_encounter AS T1 LEFT JOIN adm_organization AS T2 ON T1.organization_id = T2.ID AND T2.delete_flag = '0' LEFT JOIN adm_healthcare_service AS T3 ON T1.service_type_id = T3.ID AND T3.delete_flag = '0' @@ -118,6 +120,18 @@ ON T1.ID = T6.encounter_id AND T6.delete_flag = '0' AND T6.encounter_flag = '1' LEFT JOIN fin_contract AS T7 ON T6.contract_no = T7.bus_no AND T7.delete_flag = '0' LEFT JOIN adm_patient AS T8 ON T1.patient_id = T8.ID AND T8.delete_flag = '0' + LEFT JOIN ( + SELECT patient_id, + identifier_no + FROM ( + SELECT patient_id, + identifier_no, + ROW_NUMBER() OVER (PARTITION BY patient_id ORDER BY create_time ASC) AS rn + FROM adm_patient_identifier + WHERE delete_flag = '0' + ) t + WHERE rn = 1 + ) AS T18 ON T8.id = T18.patient_id LEFT JOIN adm_charge_item AS T10 ON T1.id = T10.encounter_id AND T10.delete_flag = '0' LEFT JOIN adm_account AS T11 ON T10.account_id = T11.id AND T11.delete_flag = '0' LEFT JOIN adm_practitioner AS T12 ON T12.ID = T10.enterer_id AND T12.delete_flag = '0' diff --git a/openhis-ui-vue3/index.html b/openhis-ui-vue3/index.html index 639db44a..e10c558e 100644 --- a/openhis-ui-vue3/index.html +++ b/openhis-ui-vue3/index.html @@ -13,7 +13,7 @@ - + @@ -27,7 +27,7 @@ - + diff --git a/openhis-ui-vue3/src/main.js b/openhis-ui-vue3/src/main.js index bf9466cd..4b846eee 100644 --- a/openhis-ui-vue3/src/main.js +++ b/openhis-ui-vue3/src/main.js @@ -4,6 +4,7 @@ import Cookies from 'js-cookie'; // 导入 hiprint 并挂载到全局 window 对象 import {hiprint} from 'vue-plugin-hiprint'; + import ElementPlus, {ElDialog, ElMessage} from 'element-plus'; import zhCn from 'element-plus/es/locale/lang/zh-cn'; import 'element-plus/dist/index.css'; diff --git a/openhis-ui-vue3/src/views/charge/outpatientregistration/components/reprintDialog.vue b/openhis-ui-vue3/src/views/charge/outpatientregistration/components/reprintDialog.vue index 529aa9b2..88461f47 100644 --- a/openhis-ui-vue3/src/views/charge/outpatientregistration/components/reprintDialog.vue +++ b/openhis-ui-vue3/src/views/charge/outpatientregistration/components/reprintDialog.vue @@ -1,133 +1,241 @@ @@ -150,9 +258,12 @@ const emit = defineEmits(['close']); const dialogVisible = ref(false); const loading = ref(false); -const hasSearched = ref(false); -const registrationList = ref([]); const reprintFormRef = ref(null); +const selectDialogVisible = ref(false); +const recordList = ref([]); +const selectedRecord = ref(null); +const currentRecord = ref(null); // 保存当前选择的记录,用于打印 +const printPreviewVisible = ref(false); // 打印预览对话框显示状态 const searchForm = reactive({ cardNo: '', @@ -161,12 +272,19 @@ const searchForm = reactive({ const form = reactive({ cardNo: '', name: '', + idCard: '', + phone: '', organizationName: '', practitionerName: '', price: '', activityPrice: '', + medicalRecordFee: '', + serialNo: '', totalPrice: '', visitTime: '', + visitLocation: '', + statusText: '', + printTime: '', encounterId: '', }); @@ -197,34 +315,7 @@ watch(dialogVisible, (newVal) => { } }); -// 获取就诊卡号用于显示 -function getCardNoDisplay(row) { - // 调试信息,打印所有可能的卡号字段 - console.log('解析卡号字段:', { - identifierNo: row.identifierNo, - cardNo: row.cardNo, - patientId: row.patientId, - encounterNo: row.encounterNo, - visitNo: row.visitNo, - patient: row.patient ? { - identifierNo: row.patient.identifierNo, - cardNo: row.patient.cardNo - } : null - }); - - // 尝试所有可能的卡号字段 - const cardNo = - row.identifierNo || - row.cardNo || - (row.patient && (row.patient.identifierNo || row.patient.cardNo)) || - row.encounterNo || - row.visitNo || - '-'; - - return cardNo; -} - -// 搜索挂号记录 +// 搜索挂号记录并确认补打 async function handleSearch() { if (!searchForm.cardNo) { proxy.$modal.msgWarning('请输入就诊卡号'); @@ -232,11 +323,9 @@ async function handleSearch() { } loading.value = true; - hasSearched.value = true; - registrationList.value = []; try { - // 简化搜索逻辑,直接使用就诊卡号作为searchKey查询 + // 使用就诊卡号作为searchKey查询 const endDate = new Date(); const startDate = new Date(); startDate.setFullYear(startDate.getFullYear() - 1); @@ -246,71 +335,173 @@ async function handleSearch() { pageSize: 100, registerTimeSTime: formatDateStr(startDate, 'YYYY-MM-DD') + ' 00:00:00', registerTimeETime: formatDateStr(endDate, 'YYYY-MM-DD') + ' 23:59:59', - searchKey: searchForm.cardNo // 直接使用就诊卡号作为搜索关键字 + searchKey: searchForm.cardNo }; - console.log('搜索参数:', queryParams); - // 调用API查询挂号记录 const response = await getOutpatientRegistrationCurrent(queryParams); if (response.code === 200) { let records = response.data.records || response.data || []; - console.log('查询到的挂号记录数量:', records.length); - - // 记录原始数据用于调试 if (records.length > 0) { - console.log('查询到的记录详情:', records.map(r => ({ - id: r.id || r.encounterId, - identifierNo: r.identifierNo, - cardNo: r.cardNo, - patientName: r.patientName || r.name, - patient: r.patient - }))); - } - - // 显示所有查询到的记录,不进行严格过滤 - registrationList.value = records; - - if (records.length === 0) { + if (records.length === 1) { + // 只有一条记录,直接使用 + const row = records[0]; + currentRecord.value = row; // 保存记录用于打印 + fillForm(row); + await handleSubmit(); + } else { + // 多条记录,显示选择对话框 + recordList.value = records; + selectedRecord.value = records[0]; // 默认选择第一条 + selectDialogVisible.value = true; + loading.value = false; + } + } else { proxy.$modal.msgWarning('未查询到相关挂号记录,请检查就诊卡号是否正确'); + resetForm(); + loading.value = false; } } else { proxy.$modal.msgWarning('查询失败: ' + (response.msg || '接口返回异常')); + resetForm(); + loading.value = false; } } catch (error) { console.error('查询挂号记录异常:', error); proxy.$modal.msgError('查询出错: ' + (error.message || '网络异常')); - } finally { + resetForm(); loading.value = false; } } -// 点击表格行,自动填充表单 -function handleRowClick(row) { - console.log('点击的记录:', row); +// 填充表单 +function fillForm(row) { + console.log('fillForm row:', row); // 调试日志 - // 使用getCardNoDisplay函数获取就诊卡号,确保与表格显示一致 - const cardNo = getCardNoDisplay(row); - form.cardNo = cardNo !== '-' ? cardNo : ''; + // 就诊卡号 - 从 identifierNo 字段获取 + form.cardNo = row.identifierNo || row.cardNo || ''; - // 其他表单字段填充 - form.name = row.patientName || row.name || (row.patient ? row.patient.name : '') || ''; + // 病人姓名 - 从 patientName 字段获取 + form.name = row.patientName || row.name || ''; + + // 身份证号 - 从 idCard 字段获取,需要脱敏处理 + let idCard = row.idCard || ''; + if (idCard && idCard.length >= 10) { + // 只显示前6位和后4位,中间用*代替 + const prefix = idCard.substring(0, 6); + const suffix = idCard.substring(idCard.length - 4); + const stars = '*'.repeat(Math.max(0, idCard.length - 10)); + form.idCard = prefix + stars + suffix; + } else if (idCard) { + // 如果身份证号长度不足10位,只显示部分并用*代替 + if (idCard.length >= 6) { + const prefix = idCard.substring(0, 3); + const suffix = idCard.substring(idCard.length - 1); + form.idCard = prefix + '*'.repeat(idCard.length - 4) + suffix; + } else { + form.idCard = idCard; + } + } else { + form.idCard = ''; + } + + // 联系电话 - 从 phone 字段获取,需要脱敏处理 + let phone = row.phone || ''; + if (phone && phone.length >= 7) { + // 只显示前3位和后4位,中间用*代替 + const prefix = phone.substring(0, 3); + const suffix = phone.substring(phone.length - 4); + form.phone = prefix + '****' + suffix; + } else if (phone) { + // 如果手机号长度不足7位,部分脱敏 + if (phone.length >= 4) { + const prefix = phone.substring(0, 2); + const suffix = phone.substring(phone.length - 2); + form.phone = prefix + '**' + suffix; + } else { + form.phone = phone; + } + } else { + form.phone = ''; + } + + // 挂号科室 - 从 organizationName 字段获取 form.organizationName = row.organizationName || ''; + + // 医生姓名 - 从 practitionerName 字段获取 form.practitionerName = row.practitionerName || ''; - // 价格相关字段 - form.price = row.price ? parseFloat(row.price).toFixed(2) : (row.registrationFee ? parseFloat(row.registrationFee).toFixed(2) : '0.00'); - form.activityPrice = row.activityPrice ? parseFloat(row.activityPrice).toFixed(2) : (row.diagnosisFee ? parseFloat(row.diagnosisFee).toFixed(2) : '0.00'); - form.totalPrice = row.totalPrice ? parseFloat(row.totalPrice).toFixed(2) : '0.00'; + // 挂号费 - 如果没有单独的 price,将 totalPrice 作为挂号费 + // 实际系统中,可能需要查询更详细的费用明细 + form.price = row.price ? parseFloat(row.price).toFixed(2) : + (row.totalPrice ? parseFloat(row.totalPrice).toFixed(2) : '0.00'); - // 就诊时间设置为当前时间 - const now = new Date(); - form.visitTime = formatDateTime(now); + // 诊疗费 - API 未返回,暂时设为 0.00 + form.activityPrice = row.activityPrice ? parseFloat(row.activityPrice).toFixed(2) : '0.00'; + + // 病历费 - API 未返回,暂时设为 0.00 + form.medicalRecordFee = row.medicalRecordFee ? parseFloat(row.medicalRecordFee).toFixed(2) : '0.00'; + + // 流水号 - 使用 encounterId 的后3位,如果为空则生成001-999的序列号 + let serialNo = ''; + if (row.encounterId) { + // 使用 encounterId 的后3位作为流水号 + const idStr = String(row.encounterId); + const lastThree = idStr.slice(-3); + const num = parseInt(lastThree) || 0; + serialNo = String((num % 999) + 1).padStart(3, '0'); + } else { + // 如果 encounterId 为空,生成一个001-999的序列号 + const timestamp = Date.now(); + const serial = (timestamp % 999) + 1; + serialNo = String(serial).padStart(3, '0'); + } + form.serialNo = serialNo; + + // 合计 - 优先使用 totalPrice,否则计算各项费用之和 + if (row.totalPrice) { + form.totalPrice = parseFloat(row.totalPrice).toFixed(2); + } else { + const total = parseFloat(form.price || 0) + parseFloat(form.activityPrice || 0) + parseFloat(form.medicalRecordFee || 0); + form.totalPrice = total.toFixed(2); + } + + // 预约/挂号时间 - 从 registerTime 字段获取 + if (row.registerTime) { + form.visitTime = parseTime(row.registerTime, '{y}-{m}-{d} {h}:{i}:{s}'); + } else { + form.visitTime = formatDateTime(new Date()); + } + + // 就诊地点 - 暂时设为空,后续可根据实际需求填充 + form.visitLocation = row.visitLocation || row.locationName || ''; + + // 预约状态 - 从 statusEnum_enumText 字段获取,如果没有则根据 statusEnum 判断 + if (row.statusEnum_enumText) { + form.statusText = row.statusEnum_enumText; + } else if (row.statusEnum !== undefined) { + // 根据 statusEnum 判断状态 + // 状态枚举可能需要根据实际情况调整 + const statusMap = { + 1: '已预约', + 2: '已完成', + 3: '已取消', + 4: '进行中' + }; + form.statusText = statusMap[row.statusEnum] || '已预约'; + } else { + form.statusText = '已预约'; + } + + // 打印时间(当前时间) + form.printTime = formatDateTime(new Date()); + + // 保存encounterId用于提交 - 注意字段名是 encounterId form.encounterId = row.encounterId || row.id || ''; - console.log('填充的表单数据:', form); + console.log('fillForm form:', form); // 调试日志 } // 格式化日期时间 @@ -325,43 +516,62 @@ function formatDateTime(date) { } // 提交补打挂号 -function handleSubmit() { - reprintFormRef.value.validate((valid) => { - if (valid) { - loading.value = true; - const submitData = { - encounterId: form.encounterId, - cardNo: form.cardNo, - name: form.name, - organizationName: form.organizationName, - practitionerName: form.practitionerName, - price: parseFloat(form.price), - activityPrice: parseFloat(form.activityPrice), - totalPrice: parseFloat(form.totalPrice), - visitTime: form.visitTime, - }; - reprintRegistration(submitData) - .then((res) => { - if (res.code === 200) { - proxy.$modal.msgSuccess('补打挂号成功'); - emit('close', 'success'); - dialogVisible.value = false; - } else { - proxy.$modal.msgError(res.msg || '补打挂号失败'); - } - }) - .catch((error) => { - console.error('补打挂号失败:', error); - proxy.$modal.msgError('补打挂号失败'); - }) - .finally(() => { - loading.value = false; - }); +async function handleSubmit() { + if (!form.encounterId) { + proxy.$modal.msgWarning('请先搜索并选择挂号记录'); + loading.value = false; + return; + } + + try { + // 如果 reprintFormRef 不存在,跳过验证 + let valid = true; + if (reprintFormRef.value) { + valid = await reprintFormRef.value.validate().catch(() => false); } - }); + if (!valid) { + loading.value = false; + return; + } + + // 在提交前,验证表单数据是否已正确填充 + console.log('handleSubmit form before submit:', form); // 调试日志 + + const submitData = { + encounterId: form.encounterId, + cardNo: form.cardNo, + name: form.name, + organizationName: form.organizationName, + practitionerName: form.practitionerName, + price: parseFloat(form.price) || 0, + activityPrice: parseFloat(form.activityPrice) || 0, + medicalRecordFee: parseFloat(form.medicalRecordFee || 0), + totalPrice: parseFloat(form.totalPrice) || 0, + visitTime: form.visitTime, + }; + + console.log('handleSubmit submitData:', submitData); // 调试日志 + + const res = await reprintRegistration(submitData); + if (res.code === 200) { + proxy.$modal.msgSuccess('补打挂号成功'); + + // 不关闭补打对话框,直接显示打印预览 + // 这样可以确保 form 数据不会丢失 + loading.value = false; + showPrintPreview(); + } else { + proxy.$modal.msgError(res.msg || '补打挂号失败'); + loading.value = false; + } + } catch (error) { + console.error('补打挂号失败:', error); + proxy.$modal.msgError('补打挂号失败: ' + (error.message || '未知错误')); + loading.value = false; + } } -// 取消 +// 取消(实际执行提交操作,因为确认按钮触发搜索) function handleCancel() { dialogVisible.value = false; } @@ -371,12 +581,19 @@ function resetForm() { Object.assign(form, { cardNo: '', name: '', + idCard: '', + phone: '', organizationName: '', practitionerName: '', price: '', activityPrice: '', + medicalRecordFee: '', + serialNo: '', totalPrice: '', visitTime: '', + visitLocation: '', + statusText: '', + printTime: '', encounterId: '', }); if (reprintFormRef.value) { @@ -387,14 +604,328 @@ function resetForm() { // 重置搜索 function resetSearch() { searchForm.cardNo = ''; - registrationList.value = []; - hasSearched.value = false; } + +// 显示打印预览 +function showPrintPreview() { + // 直接使用浏览器打印预览,避免 hiprint 连接错误 + // 因为 hiprint 需要本地服务运行,如果服务未运行会导致连接失败 + // 确保 loading 已关闭 + loading.value = false; + + // 验证表单数据是否已正确填充 + console.log('showPrintPreview form:', form); // 调试日志 + console.log('showPrintPreview currentRecord:', currentRecord.value); // 调试日志 + + // 如果 form 的关键字段为空,尝试从 currentRecord 重新填充 + if (!form.name && currentRecord.value) { + console.log('重新填充表单数据...'); + fillForm(currentRecord.value); + } + + // 显示打印预览对话框 + printPreviewVisible.value = true; +} + +// 浏览器打印 +function handleBrowserPrint() { + const printContent = document.getElementById('print-content'); + if (!printContent) { + proxy.$modal.msgError('打印内容不存在'); + return; + } + + // 创建新窗口用于打印 + const printWindow = window.open('', '_blank'); + if (!printWindow) { + proxy.$modal.msgError('无法打开打印窗口,请检查浏览器弹窗设置'); + return; + } + + // 写入打印内容 + printWindow.document.write(` + + + + + 门诊预约挂号凭条 + + + + ${printContent.innerHTML} + + + `); + + printWindow.document.close(); + + // 等待内容加载完成后打印 + printWindow.onload = function() { + setTimeout(() => { + printWindow.print(); + // 打印后关闭窗口(可选) + // printWindow.close(); + }, 250); + }; +} + +// 选择挂号记录 +function handleRecordSelect(row) { + selectedRecord.value = row; +} + +// 确认选择记录 +async function handleConfirmSelect() { + if (!selectedRecord.value) { + proxy.$modal.msgWarning('请选择一条挂号记录'); + return; + } + + loading.value = true; + selectDialogVisible.value = false; + + try { + // 保存当前记录,用于打印 + currentRecord.value = selectedRecord.value; + + // 填充表单 - 确保数据正确填充 + fillForm(selectedRecord.value); + + // 等待一小段时间,确保 form 数据已更新 + await new Promise(resolve => setTimeout(resolve, 50)); + + // 验证表单数据是否已正确填充 + if (!form.encounterId) { + proxy.$modal.msgError('获取挂号记录ID失败,请重试'); + loading.value = false; + return; + } + + // 提交补打操作(handleSubmit 内部会管理 loading 状态) + await handleSubmit(); + } catch (error) { + console.error('确认选择记录失败:', error); + proxy.$modal.msgError('处理失败: ' + (error.message || '未知错误')); + loading.value = false; + } +} + +.print-section { + margin-bottom: 20px; +} + +.section-title { + font-size: 14px; + font-weight: bold; + margin-bottom: 10px; + border-bottom: 1px solid #ddd; + padding-bottom: 5px; +} + +.info-row { + margin-bottom: 8px; + font-size: 13px; +} + +.info-row .label { + display: inline-block; + width: 100px; + font-weight: bold; +} + +.info-row .value { + display: inline-block; +} + +.fee-table { + width: 100%; + border-collapse: collapse; + margin-top: 10px; +} + +.fee-table th, +.fee-table td { + border: 1px solid #ddd; + padding: 8px; + text-align: left; +} + +.fee-table th { + background-color: #f5f5f5; + font-weight: bold; +} + +.total-label { + font-weight: bold; + text-align: right; +} + +.total-value { + font-weight: bold; + color: red; +} + +.print-footer { + margin-top: 20px; + font-size: 12px; + color: #666; +} + +.reminder { + text-align: center; + padding: 10px; + background-color: #f9f9f9; + border-radius: 4px; +} + diff --git a/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue b/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue index 2001d9b4..0de63a26 100644 --- a/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue +++ b/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue @@ -4,9 +4,9 @@ @@ -617,6 +639,7 @@ import patientList from './components/patientList'; import {nextTick, onMounted, onUnmounted, ref} from 'vue'; import ChargeDialog from './components/chargeDialog.vue'; import RefundDialog from './components/refundDialog.vue'; +import ReprintDialog from './components/reprintDialog.vue'; import {handleColor} from '@/utils/his'; import useUserStore from '@/store/modules/user'; import {formatDateStr} from '@/utils/index'; @@ -709,7 +732,6 @@ const data = reactive({ contractNo: [{ required: true, message: '费用性质', trigger: 'blur' }], patientId: [{ required: true, message: '病人不能为空', trigger: 'blur' }], priorityEnum: [{ required: true, message: '优先级不能为空', trigger: 'blur' }], - serviceTypeId: [{ required: true, message: '挂号类型不能为空', trigger: 'blur' }], organizationId: [{ required: true, message: '优先级不能为空', trigger: 'blur' }], orgId: [{ required: true, message: '就诊科室不能为空', trigger: 'blur' }], practitionerId: [{ required: true, message: '医生不能为空', trigger: 'blur' }], @@ -1026,10 +1048,18 @@ function getList() { outpatientRegistrationList.value = res.data.records; total.value = res.data.total; - // 调试:查看返回的数据结构(仅退号记录查询时) - if (queryType.value === 'returned' && res.data.records && res.data.records.length > 0) { - console.log('退号记录数据结构:', res.data.records[0]); + // 调试:查看返回的数据结构,查找就诊卡号字段 + if (res.data.records && res.data.records.length > 0) { + console.log('当日已挂号数据结构:', res.data.records[0]); console.log('所有字段:', Object.keys(res.data.records[0])); + // 查找可能的就诊卡号字段 + const firstRecord = res.data.records[0]; + const possibleCardFields = ['identifierNo', 'cardNo', 'card', 'patientCardNo', 'identifier', 'medicalCardNo']; + possibleCardFields.forEach(field => { + if (firstRecord[field] !== undefined) { + console.log(`找到可能的就诊卡号字段 ${field}:`, firstRecord[field]); + } + }); } }); } diff --git a/openhis-ui-vue3/src/views/maintainSystem/checkprojectSettings/components/PackageSettings.vue b/openhis-ui-vue3/src/views/maintainSystem/checkprojectSettings/components/PackageSettings.vue index 3faf153f..776e2f8e 100644 --- a/openhis-ui-vue3/src/views/maintainSystem/checkprojectSettings/components/PackageSettings.vue +++ b/openhis-ui-vue3/src/views/maintainSystem/checkprojectSettings/components/PackageSettings.vue @@ -1144,6 +1144,7 @@ async function handleSave() { remark: formData.remark || '', createDate: formData.createDate, items: detailData.value.map((item, index) => ({ + // 基本字段(与检查套餐 CheckPackageDetail 对应) itemCode: item.code || '', itemName: item.itemName || '', checkItemId: item.itemId || null, @@ -1157,7 +1158,13 @@ async function handleSave() { serviceCharge: parseFloat(item.serviceCharge) || 0, total: parseFloat(item.total) || 0, origin: item.origin || '', - orderNum: index + 1 + orderNum: index + 1, + // 兼容字段(部分日志/历史代码使用的命名:dosage/route/serviceFee/totalAmount) + // 后端当前不会用到这些别名字段,但保留便于排查和兼容 + dosage: item.dose || '', + route: item.method || '', + serviceFee: parseFloat(item.serviceCharge) || 0, + totalAmount: parseFloat(item.total) || 0 })) }