diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/PaymentRecServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/PaymentRecServiceImpl.java index f6d10d96..1b34b9f6 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/PaymentRecServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/paymentmanage/appservice/impl/PaymentRecServiceImpl.java @@ -1419,6 +1419,19 @@ public class PaymentRecServiceImpl implements IPaymentRecService { } } + // 确保所有PaymentRecDetail对象的审计字段被设置,防止违反NOT NULL约束 + for (PaymentRecDetail detail : paymentRecDetails) { + if (detail.getTenantId() == null) { + detail.setTenantId(SecurityUtils.getLoginUser().getTenantId()); + } + if (detail.getCreateBy() == null || detail.getCreateBy().isEmpty()) { + detail.setCreateBy(SecurityUtils.getLoginUser().getUsername()); + } + if (detail.getCreateTime() == null) { + detail.setCreateTime(new Date()); + } + } + paymentRecDetailService.saveBatch(paymentRecDetails); } @@ -1754,6 +1767,17 @@ public class PaymentRecServiceImpl implements IPaymentRecService { BeanUtils.copyProperties(outpatientRegistrationAddParam.getChargeItemFormData(), chargeItem); chargeItem.setContextEnum(ChargeItemContext.REGISTER.getValue());// 挂号 + // 确保必需的审计字段被设置,防止违反NOT NULL约束 + if (chargeItem.getTenantId() == null) { + chargeItem.setTenantId(SecurityUtils.getLoginUser().getTenantId()); + } + if (chargeItem.getCreateBy() == null || chargeItem.getCreateBy().isEmpty()) { + chargeItem.setCreateBy(SecurityUtils.getLoginUser().getUsername()); + } + if (chargeItem.getCreateTime() == null) { + chargeItem.setCreateTime(new Date()); + } + YbPsnSetlWay finCategory = YbPsnSetlWay.getByValue(outpatientRegistrationAddParam.getYbPsnSetlWay()); if (finCategory == null) { throw new ServiceException("请选择收费方式"); @@ -1818,11 +1842,23 @@ public class PaymentRecServiceImpl implements IPaymentRecService { // 保存就诊信息 Encounter encounter = new Encounter(); BeanUtils.copyProperties(encounterFormData, encounter); - // 将挂号医生ID提前塞入 encounter 的 registrarId,便于生成“科室+医生+当日”序号 + // 将挂号医生ID提前塞入 encounter 的 registrarId,便于生成"科室+医生+当日"序号 if (encounterParticipantFormData.getPractitionerId() != null) { encounter.setRegistrarId(encounterParticipantFormData.getPractitionerId()); } encounter.setBusNo(outpatientRegistrationSettleParam.getBusNo()); + + // 确保必需的审计字段被设置,防止违反NOT NULL约束 + if (encounter.getTenantId() == null) { + encounter.setTenantId(SecurityUtils.getLoginUser().getTenantId()); + } + if (encounter.getCreateBy() == null || encounter.getCreateBy().isEmpty()) { + encounter.setCreateBy(SecurityUtils.getLoginUser().getUsername()); + } + if (encounter.getCreateTime() == null) { + encounter.setCreateTime(new Date()); + } + // 就诊ID Long encounterId = iEncounterService.saveEncounterByRegister(encounter); // 保存就诊位置信息 @@ -1920,6 +1956,18 @@ public class PaymentRecServiceImpl implements IPaymentRecService { .setChargeItemIds(chargeItemIdList.stream().map(String::valueOf).collect(Collectors.joining(","))) .setTenderedAmount(chargeItem.getTotalPrice()).setDisplayAmount(paymentResult.getPsnPartAmt()) .setReturnedAmount(new BigDecimal("0.0")).setEncounterId(encounter.getId()); + + // 确保必需的审计字段被设置,防止违反NOT NULL约束 + if (payment.getTenantId() == null) { + payment.setTenantId(SecurityUtils.getLoginUser().getTenantId()); + } + if (payment.getCreateBy() == null || payment.getCreateBy().isEmpty()) { + payment.setCreateBy(SecurityUtils.getLoginUser().getUsername()); + } + if (payment.getCreateTime() == null) { + payment.setCreateTime(new Date()); + } + // 保存付款信息 paymentReconciliationService.save(payment); // 保存付款详情 @@ -1938,6 +1986,18 @@ public class PaymentRecServiceImpl implements IPaymentRecService { invoice.setPatientId(encounter.getPatientId()).setStatusEnum(InvoiceStatus.DRAFT) .setReconciliationId(payment.getId()).setTypeCode(InvoiceType.ISSUING_INVOICES.getValue()) .setChargeItemIds(payment.getChargeItemIds().toString()); + + // 确保必需的审计字段被设置,防止违反NOT NULL约束 + if (invoice.getTenantId() == null) { + invoice.setTenantId(SecurityUtils.getLoginUser().getTenantId()); + } + if (invoice.getCreateBy() == null || invoice.getCreateBy().isEmpty()) { + invoice.setCreateBy(SecurityUtils.getLoginUser().getUsername()); + } + if (invoice.getCreateTime() == null) { + invoice.setCreateTime(new Date()); + } + iInvoiceService.save(invoice); return R.ok(payment, "收费成功"); } diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/impl/AccountServiceImpl.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/impl/AccountServiceImpl.java index 78a34430..28f96ba1 100644 --- a/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/impl/AccountServiceImpl.java +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/impl/AccountServiceImpl.java @@ -2,6 +2,7 @@ package com.openhis.administration.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.core.common.utils.SecurityUtils; import com.openhis.administration.domain.Account; import com.openhis.administration.mapper.AccountMapper; import com.openhis.administration.service.IAccountService; @@ -32,6 +33,18 @@ public class AccountServiceImpl extends ServiceImpl impl @Override public Long saveAccountByRegister(Account account) { account.setEncounterFlag(Whether.YES.getValue()); + + // 确保必需的审计字段被设置,防止违反NOT NULL约束 + if (account.getTenantId() == null) { + account.setTenantId(SecurityUtils.getLoginUser().getTenantId()); + } + if (account.getCreateBy() == null || account.getCreateBy().isEmpty()) { + account.setCreateBy(SecurityUtils.getLoginUser().getUsername()); + } + if (account.getCreateTime() == null) { + account.setCreateTime(new java.util.Date()); + } + baseMapper.insert(account); return account.getId(); } diff --git a/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/impl/ChargeItemServiceImpl.java b/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/impl/ChargeItemServiceImpl.java index 3f912c99..740feb07 100644 --- a/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/impl/ChargeItemServiceImpl.java +++ b/openhis-server-new/openhis-domain/src/main/java/com/openhis/administration/service/impl/ChargeItemServiceImpl.java @@ -66,6 +66,18 @@ public class ChargeItemServiceImpl extends ServiceImpl 1、2、3... - // 2) 否则按“科室+当日”递增 + // 2) 否则按"科室+当日"递增 String preFix; if (encounter.getRegistrarId() != null) { preFix = "ORG-" + encounter.getOrganizationId() + "-DOC-" + encounter.getRegistrarId(); @@ -62,6 +63,18 @@ public class EncounterServiceImpl extends ServiceImpl 0L) { encounter.setFirstEnum(EncounterType.FOLLOW_UP.getValue()); } + + // 确保必需的审计字段被设置,防止违反NOT NULL约束 + if (encounter.getTenantId() == null) { + encounter.setTenantId(SecurityUtils.getLoginUser().getTenantId()); + } + if (encounter.getCreateBy() == null || encounter.getCreateBy().isEmpty()) { + encounter.setCreateBy(SecurityUtils.getLoginUser().getUsername()); + } + if (encounter.getCreateTime() == null) { + encounter.setCreateTime(new Date()); + } + baseMapper.insert(encounter); return encounter.getId(); } diff --git a/openhis-ui-vue3/src/assets/icons/svg/patient.svg b/openhis-ui-vue3/src/assets/icons/svg/patient.svg index 0c57c683..dd5edd04 100644 --- a/openhis-ui-vue3/src/assets/icons/svg/patient.svg +++ b/openhis-ui-vue3/src/assets/icons/svg/patient.svg @@ -1,4 +1,4 @@ - + diff --git a/openhis-ui-vue3/src/router/index.js b/openhis-ui-vue3/src/router/index.js index ca7cf1ac..26010cfa 100644 --- a/openhis-ui-vue3/src/router/index.js +++ b/openhis-ui-vue3/src/router/index.js @@ -97,21 +97,6 @@ export const constantRoutes = [ // 动态路由,基于用户权限动态去加载 export const dynamicRoutes = [ - { - path: '/basicmanage', - component: Layout, - redirect: '/basicmanage/invoice-management', - name: 'BasicManage', - meta: { title: '基础管理', icon: 'component' }, - children: [ - { - path: 'invoice-management', - component: () => import('@/views/basicmanage/InvoiceManagement/index.vue'), - name: 'invoice-management', - meta: { title: '发票管理' } - } - ] - }, { path: '/system/tenant-user', diff --git a/openhis-ui-vue3/src/template/inHospitalRecord.vue b/openhis-ui-vue3/src/template/inHospitalRecord.vue index f491d7a0..0da2a4cb 100644 --- a/openhis-ui-vue3/src/template/inHospitalRecord.vue +++ b/openhis-ui-vue3/src/template/inHospitalRecord.vue @@ -490,6 +490,61 @@ const formData = reactive({ signDate: '', }); +// 默认表单数据 +const defaultFormData = { + // 基础信息 + patientName: patient?.name || '', + hospitalNo: patient?.busNo || '', + gender: patient?.genderEnum_enumText || '', + age: patient?.age || '', + nation: '', + occupation: '', // 职业 + marriage: '', // 婚姻状况 + birthplace: '', // 出生地 + admissionTime: '', // 入院时间 + recordTime: '', // 记录时间 + historyReporter: '', // 病史陈述者 + reliability: '可靠', // 可靠程度 + // 病史信息 + complaint: '', // 主诉 + presentIllness: '', // 现病史 + pastIllness: '', // 既往史 + personalHistory: '', // 个人史 + allergyHistory: '', // 过敏史 + pastHistory: '', // 既往史 + familyHistory: '', // 家族史 + maritalHistory: '', // 婚姻史 + menstrualHistory: '', // 月经史 + // 中医信息 + tcmInfo: '', + + // 体格检查 + temp: '', + pulse: '', + respiration: '', + bp: '', + height: '', + weight: '', + bmi: '', + general: '', + skin: '', + chest: '', + abdomen: '', + limbsNervous: '', + + // 辅助检查 + auxExam: '', + + // 诊断信息 + tcmDiagnosis: '', + westernDiagnosis: '', + + // 签名信息 + doctorSign: '', + superiorSign: '', + signDate: '', +}; + // 表单校验规则 const rules = reactive({ name: [{ required: true, message: '请填写姓名', trigger: ['blur', 'submit'] }], @@ -623,8 +678,19 @@ const handleReset = () => { // 表单数据赋值 const setFormData = (data) => { - if (data) { + if (data && Object.keys(data).length > 0) { + // 如果有数据,则合并到表单中 Object.assign(formData, data); + } else { + // 如果没有数据或数据为空,则重置为默认值 + // 保留患者基础信息(来自props) + Object.assign(formData, { + ...defaultFormData, + patientName: patient?.name || formData.patientName, + hospitalNo: patient?.busNo || formData.hospitalNo, + gender: patient?.genderEnum_enumText || formData.gender, + age: patient?.age || formData.age, + }); } }; diff --git a/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue b/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue index 2d127da2..e944cca8 100644 --- a/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue +++ b/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue @@ -438,7 +438,7 @@ :show-overflow-tooltip="true" />