fix(core): 修复审计字段缺失和组件状态管理问题
- 在Account、ChargeItem、EncounterParticipant和Encounter服务中添加审计字段验证 - 确保tenantId、createBy和createTime字段在插入数据库前正确设置 - 修复EMR模块中删除模板API的导出问题 - 更新患者信息状态管理,统一使用localPatientInfo替换patientInfo - 在EMR组件中实现防抖机制优化历史记录刷新性能 - 修复病历模板切换时的表单数据重置逻辑 - 在首页统计组件中使用markRaw包装图标组件 - 为住院记录模板添加默认表单数据结构 - 修复SVG患者图标路径错误
This commit is contained in:
@@ -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, "收费成功");
|
||||
}
|
||||
|
||||
@@ -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<AccountMapper, Account> 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();
|
||||
}
|
||||
|
||||
@@ -66,6 +66,18 @@ public class ChargeItemServiceImpl extends ServiceImpl<ChargeItemMapper, ChargeI
|
||||
@Override
|
||||
public void saveChargeItemByRegister(ChargeItem 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 java.util.Date());
|
||||
}
|
||||
|
||||
baseMapper.insert(chargeItem);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.openhis.administration.service.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.common.enums.DelFlag;
|
||||
import com.openhis.administration.domain.EncounterParticipant;
|
||||
import com.openhis.administration.mapper.EncounterParticipantMapper;
|
||||
@@ -32,6 +33,17 @@ public class EncounterParticipantServiceImpl extends ServiceImpl<EncounterPartic
|
||||
*/
|
||||
@Override
|
||||
public void saveEncounterParticipant(EncounterParticipant encounterParticipant) {
|
||||
// 确保必需的审计字段被设置,防止违反NOT NULL约束
|
||||
if (encounterParticipant.getTenantId() == null) {
|
||||
encounterParticipant.setTenantId(SecurityUtils.getLoginUser().getTenantId());
|
||||
}
|
||||
if (encounterParticipant.getCreateBy() == null || encounterParticipant.getCreateBy().isEmpty()) {
|
||||
encounterParticipant.setCreateBy(SecurityUtils.getLoginUser().getUsername());
|
||||
}
|
||||
if (encounterParticipant.getCreateTime() == null) {
|
||||
encounterParticipant.setCreateTime(new Date());
|
||||
}
|
||||
|
||||
baseMapper.insert(encounterParticipant);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.core.common.utils.AssignSeqUtil;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.openhis.administration.domain.Encounter;
|
||||
import com.openhis.administration.dto.EncounterAccountDto;
|
||||
@@ -45,9 +46,9 @@ public class EncounterServiceImpl extends ServiceImpl<EncounterMapper, Encounter
|
||||
encounter.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.ENCOUNTER_NUM.getPrefix(), 4));
|
||||
}
|
||||
// 生成就诊序号:
|
||||
// 1) 若挂号医生已传入(registrarId 充当挂号医生 ID),按“科室+医生+当日”递增
|
||||
// 1) 若挂号医生已传入(registrarId 充当挂号医生 ID),按"科室+医生+当日"递增
|
||||
// Key 示例:ORG-123-DOC-456 -> 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<EncounterMapper, Encounter
|
||||
if (count > 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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user