AutoMedinfo/backend/src/main/java/com/ipsen/medical/entity/KnowledgeBase.java

65 lines
1.5 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.ipsen.medical.entity;
import javax.persistence.*;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 知识库实体
*/
@Data
@Entity
@Table(name = "knowledge_bases")
public class KnowledgeBase {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false)
private String name; // 知识库名称
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private KnowledgeType type; // 知识库类型
@Column(columnDefinition = "TEXT")
private String description; // 描述
private String dataSource; // 数据源地址
private Integer priority; // 检索优先级(数字越小优先级越高)
private Boolean enabled; // 是否启用
@Column(columnDefinition = "TEXT")
private String configuration; // 配置信息JSON格式
@Column(nullable = false)
private LocalDateTime createdAt;
private LocalDateTime updatedAt;
@PrePersist
protected void onCreate() {
createdAt = LocalDateTime.now();
if (enabled == null) {
enabled = true;
}
}
@PreUpdate
protected void onUpdate() {
updatedAt = LocalDateTime.now();
}
public enum KnowledgeType {
INTERNAL, // 自有数据:企业研究、历史回复、文献等
PUBLIC, // 公开数据监管机构、知网、PubMed、EMBASE等
EXTENDED // 扩展数据:疾病、药物关联等
}
}