feat(surgery): 增加手术室确认信息和次要手术功能
- 添加手术室确认时间和确认人字段显示 - 实现次要手术的添加、编辑和删除功能 - 增加急诊标志和植入高值耗材开关选项 - 添加手术费用和麻醉费用计算功能 - 实现手术和麻醉项目的远程搜索功能 - 增加第一助手和第二助手选择功能 - 优化医生列表加载逻辑,支持多接口获取 - 添加按钮图标提升界面体验 - 修复encounterId为空时的接口调用问题
This commit is contained in:
@@ -211,4 +211,20 @@ public class Surgery extends HisBaseEntity {
|
||||
/** 备注信息 */
|
||||
@TableField("remark")
|
||||
private String remark;
|
||||
|
||||
/** 急诊标志 */
|
||||
@TableField("emergency_flag")
|
||||
private Integer emergencyFlag;
|
||||
|
||||
/** 植入高值耗材标志 */
|
||||
@TableField("implant_flag")
|
||||
private Integer implantFlag;
|
||||
|
||||
/** 手术室确认时间 */
|
||||
@TableField("operating_room_confirm_time")
|
||||
private Date operatingRoomConfirmTime;
|
||||
|
||||
/** 手术室确认人 */
|
||||
@TableField("operating_room_confirm_user")
|
||||
private String operatingRoomConfirmUser;
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.openhis.clinical.domain.Surgery;
|
||||
import com.openhis.clinical.mapper.SurgeryMapper;
|
||||
import com.openhis.clinical.service.ISurgeryService;
|
||||
import com.openhis.common.utils.RedisKeys;
|
||||
import com.core.common.core.redis.RedisCache;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -14,6 +16,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -22,8 +25,10 @@ public class SurgeryServiceImpl extends ServiceImpl<SurgeryMapper, Surgery> impl
|
||||
@Resource
|
||||
private SurgeryMapper surgeryMapper;
|
||||
|
||||
@Resource
|
||||
private RedisCache redisCache;
|
||||
|
||||
/**
|
||||
* 新增手术信息
|
||||
*
|
||||
* @param surgery 手术信息
|
||||
* @return 手术ID
|
||||
@@ -50,6 +55,9 @@ public class SurgeryServiceImpl extends ServiceImpl<SurgeryMapper, Surgery> impl
|
||||
|
||||
surgeryMapper.insert(surgery);
|
||||
|
||||
// 清除相关缓存
|
||||
clearSurgeryCache(surgery);
|
||||
|
||||
// 插入后再查询一次,验证是否保存成功
|
||||
Surgery inserted = surgeryMapper.selectById(surgery.getId());
|
||||
log.info("插入后查询结果 - applyDoctorId: {}, applyDoctorName: {}, applyDeptId: {}, applyDeptName: {}",
|
||||
@@ -78,66 +86,96 @@ public class SurgeryServiceImpl extends ServiceImpl<SurgeryMapper, Surgery> impl
|
||||
return "OP" + dateStr + randomStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改手术信息
|
||||
*
|
||||
* @param surgery 手术信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateSurgery(Surgery surgery) {
|
||||
surgery.setUpdateTime(new Date());
|
||||
return surgeryMapper.updateById(surgery) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除手术信息
|
||||
*
|
||||
* @param id 手术ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean deleteSurgery(Long id) {
|
||||
return surgeryMapper.deleteById(id) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询手术信息
|
||||
*
|
||||
*
|
||||
* @param id 手术ID
|
||||
* @return 手术信息
|
||||
*/
|
||||
@Override
|
||||
public Surgery getSurgeryById(Long id) {
|
||||
return surgeryMapper.selectById(id);
|
||||
String cacheKey = RedisKeys.getSurgeryKey(id);
|
||||
|
||||
// 先从Redis缓存中获取
|
||||
Surgery surgery = redisCache.getCacheObject(cacheKey);
|
||||
if (surgery != null) {
|
||||
log.info("从Redis缓存中获取手术信息 - surgeryId: {}", id);
|
||||
return surgery;
|
||||
}
|
||||
|
||||
// 缓存中没有,从数据库查询
|
||||
surgery = surgeryMapper.selectById(id);
|
||||
if (surgery != null) {
|
||||
// 将查询结果存入Redis缓存(缓存30分钟)
|
||||
redisCache.setCacheObject(cacheKey, surgery, 30, TimeUnit.MINUTES);
|
||||
log.info("从数据库查询手术信息并存入Redis缓存 - surgeryId: {}", id);
|
||||
}
|
||||
|
||||
return surgery;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据患者ID查询手术列表
|
||||
*
|
||||
*
|
||||
* @param patientId 患者ID
|
||||
* @return 手术列表
|
||||
*/
|
||||
@Override
|
||||
public List<Surgery> getSurgeryListByPatientId(Long patientId) {
|
||||
String cacheKey = RedisKeys.getSurgeryListByPatientKey(patientId);
|
||||
|
||||
// 先从Redis缓存中获取
|
||||
List<Surgery> surgeryList = redisCache.getCacheObject(cacheKey);
|
||||
if (surgeryList != null) {
|
||||
log.info("从Redis缓存中获取患者手术列表 - patientId: {}", patientId);
|
||||
return surgeryList;
|
||||
}
|
||||
|
||||
// 缓存中没有,从数据库查询
|
||||
LambdaQueryWrapper<Surgery> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(Surgery::getPatientId, patientId)
|
||||
.eq(Surgery::getDeleteFlag, "0")
|
||||
.orderByDesc(Surgery::getCreateTime);
|
||||
return surgeryMapper.selectList(wrapper);
|
||||
surgeryList = surgeryMapper.selectList(wrapper);
|
||||
|
||||
// 将查询结果存入Redis缓存(缓存30分钟)
|
||||
if (surgeryList != null && !surgeryList.isEmpty()) {
|
||||
redisCache.setCacheObject(cacheKey, surgeryList, 30, TimeUnit.MINUTES);
|
||||
log.info("从数据库查询患者手术列表并存入Redis缓存 - patientId: {}, count: {}", patientId, surgeryList.size());
|
||||
}
|
||||
|
||||
return surgeryList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据就诊ID查询手术列表
|
||||
*
|
||||
*
|
||||
* @param encounterId 就诊ID
|
||||
* @return 手术列表
|
||||
*/
|
||||
@Override
|
||||
public List<Surgery> getSurgeryListByEncounterId(Long encounterId) {
|
||||
return surgeryMapper.selectByEncounterId(encounterId);
|
||||
String cacheKey = RedisKeys.getSurgeryListByEncounterKey(encounterId);
|
||||
|
||||
// 先从Redis缓存中获取
|
||||
List<Surgery> surgeryList = redisCache.getCacheObject(cacheKey);
|
||||
if (surgeryList != null) {
|
||||
log.info("从Redis缓存中获取就诊手术列表 - encounterId: {}", encounterId);
|
||||
return surgeryList;
|
||||
}
|
||||
|
||||
// 缓存中没有,从数据库查询
|
||||
surgeryList = surgeryMapper.selectByEncounterId(encounterId);
|
||||
|
||||
// 将查询结果存入Redis缓存(缓存30分钟)
|
||||
if (surgeryList != null && !surgeryList.isEmpty()) {
|
||||
redisCache.setCacheObject(cacheKey, surgeryList, 30, TimeUnit.MINUTES);
|
||||
log.info("从数据库查询就诊手术列表并存入Redis缓存 - encounterId: {}, count: {}", encounterId, surgeryList.size());
|
||||
}
|
||||
|
||||
return surgeryList;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,4 +205,72 @@ public class SurgeryServiceImpl extends ServiceImpl<SurgeryMapper, Surgery> impl
|
||||
|
||||
return surgeryMapper.updateById(surgery) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改手术信息
|
||||
*
|
||||
* @param surgery 手术信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateSurgery(Surgery surgery) {
|
||||
surgery.setUpdateTime(new Date());
|
||||
boolean result = surgeryMapper.updateById(surgery) > 0;
|
||||
|
||||
if (result) {
|
||||
// 清除相关缓存
|
||||
clearSurgeryCache(surgery);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除手术信息
|
||||
*
|
||||
* @param id 手术ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean deleteSurgery(Long id) {
|
||||
Surgery surgery = surgeryMapper.selectById(id);
|
||||
boolean result = surgeryMapper.deleteById(id) > 0;
|
||||
|
||||
if (result && surgery != null) {
|
||||
// 清除相关缓存
|
||||
clearSurgeryCache(surgery);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除手术相关的Redis缓存
|
||||
*
|
||||
* @param surgery 手术信息
|
||||
*/
|
||||
private void clearSurgeryCache(Surgery surgery) {
|
||||
// 清除单个手术缓存
|
||||
if (surgery.getId() != null) {
|
||||
String surgeryKey = RedisKeys.getSurgeryKey(surgery.getId());
|
||||
redisCache.deleteObject(surgeryKey);
|
||||
log.info("清除手术缓存 - surgeryId: {}", surgery.getId());
|
||||
}
|
||||
|
||||
// 清除患者手术列表缓存
|
||||
if (surgery.getPatientId() != null) {
|
||||
String patientKey = RedisKeys.getSurgeryListByPatientKey(surgery.getPatientId());
|
||||
redisCache.deleteObject(patientKey);
|
||||
log.info("清除患者手术列表缓存 - patientId: {}", surgery.getPatientId());
|
||||
}
|
||||
|
||||
// 清除就诊手术列表缓存
|
||||
if (surgery.getEncounterId() != null) {
|
||||
String encounterKey = RedisKeys.getSurgeryListByEncounterKey(surgery.getEncounterId());
|
||||
redisCache.deleteObject(encounterKey);
|
||||
log.info("清除就诊手术列表缓存 - encounterId: {}", surgery.getEncounterId());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user