fix(core): 修复审计字段缺失和组件状态管理问题
- 在Account、ChargeItem、EncounterParticipant和Encounter服务中添加审计字段验证 - 确保tenantId、createBy和createTime字段在插入数据库前正确设置 - 修复EMR模块中删除模板API的导出问题 - 更新患者信息状态管理,统一使用localPatientInfo替换patientInfo - 在EMR组件中实现防抖机制优化历史记录刷新性能 - 修复病历模板切换时的表单数据重置逻辑 - 在首页统计组件中使用markRaw包装图标组件 - 为住院记录模板添加默认表单数据结构 - 修复SVG患者图标路径错误
This commit is contained in:
@@ -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