诊疗下没有项目功能完善
This commit is contained in:
@@ -65,4 +65,11 @@ public interface IChargeItemDefDetailService extends IService<ChargeItemDefDetai
|
||||
* @return 批号售价信息
|
||||
*/
|
||||
List<ChargeItemDefDetail> getLotNumberPriceByDefIds(List<Long> chargeItemDefIdList);
|
||||
|
||||
/**
|
||||
* 批量设置必需的字段(tenant_id、create_by、create_time),确保插入时不为null
|
||||
*
|
||||
* @param chargeItemDefDetailList 费用定价详情对象列表
|
||||
*/
|
||||
void setRequiredFieldsBatch(List<ChargeItemDefDetail> chargeItemDefDetailList);
|
||||
}
|
||||
@@ -2,6 +2,8 @@ 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.core.domain.model.LoginUser;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.common.enums.DelFlag;
|
||||
import com.openhis.administration.domain.ChargeItemDefDetail;
|
||||
import com.openhis.administration.mapper.ChargeItemDefDetailAppMapper;
|
||||
@@ -9,6 +11,7 @@ import com.openhis.administration.service.IChargeItemDefDetailService;
|
||||
import com.openhis.common.enums.ConditionCode;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -55,6 +58,8 @@ public class ChargeItemDefDetailServiceImpl extends ServiceImpl<ChargeItemDefDet
|
||||
if (chargeItemDefDetail.getId() != null) {
|
||||
return false;
|
||||
} else {
|
||||
// 显式设置创建者、创建时间和租户ID,确保插入时不为null
|
||||
setRequiredFields(chargeItemDefDetail);
|
||||
return baseMapper.insert(chargeItemDefDetail) > 0;
|
||||
}
|
||||
}
|
||||
@@ -102,4 +107,35 @@ public class ChargeItemDefDetailServiceImpl extends ServiceImpl<ChargeItemDefDet
|
||||
.eq(ChargeItemDefDetail::getConditionCode, ConditionCode.LOT_NUMBER_PRICE.getCode())
|
||||
.eq(ChargeItemDefDetail::getDeleteFlag, DelFlag.NO.getCode()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRequiredFieldsBatch(List<ChargeItemDefDetail> chargeItemDefDetailList) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置必需的字段(tenant_id、create_by、create_time),确保插入时不为null
|
||||
*
|
||||
* @param chargeItemDefDetail 费用定价详情对象
|
||||
*/
|
||||
private void setRequiredFields(ChargeItemDefDetail chargeItemDefDetail) {
|
||||
String createBy = "system";
|
||||
Integer tenantId = null;
|
||||
try {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null) {
|
||||
createBy = loginUser.getUsername();
|
||||
tenantId = loginUser.getTenantId();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 如果获取失败,使用默认值
|
||||
}
|
||||
chargeItemDefDetail.setCreateBy(createBy != null ? createBy : "system");
|
||||
chargeItemDefDetail.setTenantId(tenantId != null ? tenantId : 1);
|
||||
if (chargeItemDefDetail.getCreateTime() == null) {
|
||||
chargeItemDefDetail.setCreateTime(new Date());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.openhis.administration.service.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.core.common.core.domain.model.LoginUser;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.common.enums.DelFlag;
|
||||
import com.core.common.utils.DateUtils;
|
||||
import com.openhis.administration.domain.ChargeItemDefDetail;
|
||||
@@ -21,6 +23,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -71,6 +74,8 @@ public class ChargeItemDefinitionServiceImpl extends ServiceImpl<ChargeItemDefin
|
||||
if (chargeItemDefinition.getId() != null) {
|
||||
return false;
|
||||
} else {
|
||||
// 显式设置创建者、创建时间和租户ID,确保插入时不为null
|
||||
setRequiredFields(chargeItemDefinition);
|
||||
return baseMapper.insert(chargeItemDefinition) > 0;
|
||||
}
|
||||
}
|
||||
@@ -104,6 +109,8 @@ public class ChargeItemDefinitionServiceImpl extends ServiceImpl<ChargeItemDefin
|
||||
if (healthcareService.getId() != null) {
|
||||
chargeItemDefinition.setInstanceTable(CommonConstants.TableName.ADM_HEALTHCARE_SERVICE);
|
||||
chargeItemDefinition.setInstanceId(healthcareService.getId());
|
||||
// 显式设置创建者、创建时间和租户ID,确保插入时不为null
|
||||
setRequiredFields(chargeItemDefinition);
|
||||
return baseMapper.insert(chargeItemDefinition) > 0;
|
||||
} else {
|
||||
return false;
|
||||
@@ -133,6 +140,8 @@ public class ChargeItemDefinitionServiceImpl extends ServiceImpl<ChargeItemDefin
|
||||
.setStatusEnum(PublicationStatus.ACTIVE.getValue()).setOrgId(orgId).setInstanceTable(instanceTable)
|
||||
.setInstanceId(instanceId).setEffectiveStart(DateUtils.getNowDate()).setTypeCode(typeCode).setYbType(ybCode)
|
||||
.setConditionFlag(Whether.YES.getValue()).setPrice(retailPrice);
|
||||
// 显式设置创建者、创建时间和租户ID,确保插入时不为null
|
||||
setRequiredFields(chargeItemDefinition);
|
||||
this.save(chargeItemDefinition);
|
||||
List<ChargeItemDefDetail> chargeItemDefDetailList = new ArrayList<>();
|
||||
// 购入价子表(购入价不一定存在)
|
||||
@@ -151,6 +160,10 @@ public class ChargeItemDefinitionServiceImpl extends ServiceImpl<ChargeItemDefin
|
||||
= new ChargeItemDefDetail().setDefinitionId(chargeItemDefinition.getId())
|
||||
.setConditionCode(ConditionCode.LIMIT.getCode()).setAmount(maximumRetailPrice);
|
||||
chargeItemDefDetailList.add(defDetailMaximumRetail);
|
||||
|
||||
// 批量设置必需字段(tenant_id、create_by、create_time)
|
||||
setRequiredFieldsForDetailList(chargeItemDefDetailList);
|
||||
|
||||
chargeItemDefDetailService.saveBatch(chargeItemDefDetailList);
|
||||
}
|
||||
|
||||
@@ -184,4 +197,85 @@ public class ChargeItemDefinitionServiceImpl extends ServiceImpl<ChargeItemDefin
|
||||
return this.baseMapper.getProductPrice(statusEnum, instanceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置必需的字段(tenant_id、create_by、create_time),确保插入时不为null
|
||||
*
|
||||
* @param chargeItemDefinition 费用定价对象
|
||||
*/
|
||||
private void setRequiredFields(ChargeItemDefinition chargeItemDefinition) {
|
||||
String createBy = "system";
|
||||
Integer tenantId = null;
|
||||
try {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null) {
|
||||
createBy = loginUser.getUsername();
|
||||
tenantId = loginUser.getTenantId();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 如果获取失败,使用默认值
|
||||
}
|
||||
chargeItemDefinition.setCreateBy(createBy != null ? createBy : "system");
|
||||
chargeItemDefinition.setTenantId(tenantId != null ? tenantId : 1);
|
||||
if (chargeItemDefinition.getCreateTime() == null) {
|
||||
chargeItemDefinition.setCreateTime(new Date());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置费用定价详情列表的必需字段(tenant_id、create_by、create_time)
|
||||
*
|
||||
* @param chargeItemDefDetailList 费用定价详情对象列表
|
||||
*/
|
||||
private void setRequiredFieldsForDetailList(List<ChargeItemDefDetail> chargeItemDefDetailList) {
|
||||
String createBy = "system";
|
||||
Integer tenantId = null;
|
||||
try {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null) {
|
||||
createBy = loginUser.getUsername();
|
||||
tenantId = loginUser.getTenantId();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 如果获取失败,使用默认值
|
||||
}
|
||||
Date now = new Date();
|
||||
for (ChargeItemDefDetail detail : chargeItemDefDetailList) {
|
||||
detail.setCreateBy(createBy != null ? createBy : "system");
|
||||
detail.setTenantId(tenantId != null ? tenantId : 1);
|
||||
if (detail.getCreateTime() == null) {
|
||||
detail.setCreateTime(now);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量设置费用定价列表的必需字段(tenant_id、create_by、create_time),确保插入时不为null
|
||||
*
|
||||
* @param chargeItemDefinitionList 费用定价对象列表
|
||||
*/
|
||||
public void setRequiredFieldsBatch(List<ChargeItemDefinition> chargeItemDefinitionList) {
|
||||
if (chargeItemDefinitionList == null || chargeItemDefinitionList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
String createBy = "system";
|
||||
Integer tenantId = null;
|
||||
try {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null) {
|
||||
createBy = loginUser.getUsername();
|
||||
tenantId = loginUser.getTenantId();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 如果获取失败,使用默认值
|
||||
}
|
||||
Date now = new Date();
|
||||
for (ChargeItemDefinition definition : chargeItemDefinitionList) {
|
||||
definition.setCreateBy(createBy != null ? createBy : "system");
|
||||
definition.setTenantId(tenantId != null ? tenantId : 1);
|
||||
if (definition.getCreateTime() == null) {
|
||||
definition.setCreateTime(now);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.openhis.sys.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.core.common.core.domain.model.LoginUser;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.openhis.sys.domain.OperationRecord;
|
||||
@@ -10,6 +12,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -44,6 +47,10 @@ public class OperationRecordServiceImpl extends ServiceImpl<OperationRecordMappe
|
||||
operationRecord.setDbOpType(dbOpType);
|
||||
operationRecord.setTableName(tableName);
|
||||
operationRecord.setParamJson(paramJson);
|
||||
|
||||
// 统一补全必填字段(create_by、tenant_id、create_time)
|
||||
setRequiredFields(operationRecord);
|
||||
|
||||
baseMapper.insert(operationRecord);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
@@ -65,6 +72,10 @@ public class OperationRecordServiceImpl extends ServiceImpl<OperationRecordMappe
|
||||
operationRecord.setDbOpType(dbOpType);
|
||||
operationRecord.setTableName(tableName);
|
||||
operationRecord.setParamJson(paramJson);
|
||||
|
||||
// 统一补全必填字段(create_by、tenant_id、create_time)
|
||||
setRequiredFields(operationRecord);
|
||||
|
||||
baseMapper.insert(operationRecord);
|
||||
}
|
||||
|
||||
@@ -80,4 +91,28 @@ public class OperationRecordServiceImpl extends ServiceImpl<OperationRecordMappe
|
||||
return objectMapper.writeValueAsString(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置操作记录的必需字段(tenant_id、create_by、create_time),确保插入时不为null
|
||||
*
|
||||
* @param operationRecord 操作记录对象
|
||||
*/
|
||||
private void setRequiredFields(OperationRecord operationRecord) {
|
||||
String createBy = "system";
|
||||
Integer tenantId = null;
|
||||
try {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null) {
|
||||
createBy = loginUser.getUsername();
|
||||
tenantId = loginUser.getTenantId();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 如果获取失败,使用默认值
|
||||
}
|
||||
operationRecord.setCreateBy(createBy != null ? createBy : "system");
|
||||
operationRecord.setTenantId(tenantId != null ? tenantId : 1);
|
||||
if (operationRecord.getCreateTime() == null) {
|
||||
operationRecord.setCreateTime(new Date());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,9 @@ package com.openhis.workflow.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.core.common.core.domain.model.LoginUser;
|
||||
import com.core.common.enums.DelFlag;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.common.enums.PublicationStatus;
|
||||
import com.openhis.medication.dto.AdjustPriceMedListDto;
|
||||
import com.openhis.workflow.domain.ActivityDefinition;
|
||||
@@ -14,6 +16,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -46,6 +49,10 @@ public class ActivityDefinitionServiceImpl extends ServiceImpl<ActivityDefinitio
|
||||
if (activityDefinitions.size() > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 统一补全必填字段(create_by、tenant_id、create_time)
|
||||
setRequiredFields(activityDefinition);
|
||||
|
||||
// 新增诊疗项目
|
||||
int insert = activityDefinitionMapper.insert(activityDefinition);
|
||||
if (insert != 1) {
|
||||
@@ -101,4 +108,30 @@ public class ActivityDefinitionServiceImpl extends ServiceImpl<ActivityDefinitio
|
||||
DelFlag.NO.getCode());
|
||||
return baseMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置诊疗定义对象的必需字段(tenant_id、create_by、create_time),确保插入时不为null
|
||||
*
|
||||
* @param activityDefinition 诊疗定义对象
|
||||
*/
|
||||
private void setRequiredFields(ActivityDefinition activityDefinition) {
|
||||
String createBy = "system";
|
||||
Integer tenantId = null;
|
||||
try {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null) {
|
||||
createBy = loginUser.getUsername();
|
||||
tenantId = loginUser.getTenantId();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 如果获取失败,使用默认值
|
||||
}
|
||||
// 强制设置,确保不为null
|
||||
activityDefinition.setCreateBy(createBy != null ? createBy : "system");
|
||||
activityDefinition.setTenantId(tenantId != null ? tenantId : 1); // 默认租户ID为1
|
||||
// 确保创建时间不为null
|
||||
if (activityDefinition.getCreateTime() == null) {
|
||||
activityDefinition.setCreateTime(new Date());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user