完善医生常用语管理功能
### 后端修改 1. 实体类DoctorPhrase:字段/注解调整 2. 枚举完善:新增DoctorPhraseAppTypeEnum/DoctorPhraseBizTypeEnum,统一业务分类 3. 服务实现类:修正类名拼写(DoctorPhraesAppS → DoctorPhraseAppServiceImpl ### 前端修改 1. 常用语管理页面(doctorphrase/index.vue): 业务分类硬编码替换为枚举(主诉/现病史/术前/术后/既往史)
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
package com.openhis.template.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@@ -28,8 +30,13 @@ public class DoctorPhrase {
|
||||
private Integer phraseType;
|
||||
|
||||
/** 业务分类(主诉/现病史等) */
|
||||
@NotBlank(message = "业务分类不能为空")
|
||||
private String phraseCategory;
|
||||
|
||||
// 非数据库字段,用于前端展示名称
|
||||
@TableField(exist = false)
|
||||
private String businessTypeName;
|
||||
|
||||
/** 模板内容 */
|
||||
private String phraseContent;
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.openhis.template.enums;
|
||||
|
||||
// 枚举类不需要任何Lombok注解(@Data/@AllArgsConstructor/@NoArgsConstructor都删掉)
|
||||
public enum DoctorPhraseBizTypeEnum {
|
||||
// 1. 枚举项:直接传值(不用code:xxx,直接写字符串)
|
||||
MAIN_COMPLAINT("MAIN_COMPLAINT", "主诉"),
|
||||
PRESENT_HISTORY("PRESENT_HISTORY", "现病史"),
|
||||
PRE_OPERATION("PRE_OPERATION", "术前"),
|
||||
POST_OPERATION("POST_OPERATION", "术后"),
|
||||
PAST_HISTORY("PAST_HISTORY", "既往史");
|
||||
|
||||
// 2. 定义枚举的成员变量(private final 保证不可变)
|
||||
private final String code; // 数据库存储的编码
|
||||
private final String name; // 前端展示的名称
|
||||
|
||||
// 3. 手动写私有构造器(枚举构造器必须私有,且要给变量赋值)
|
||||
DoctorPhraseBizTypeEnum(String code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
// 4. 提供getter方法(枚举没有setter,因为枚举项是常量,不能改)
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
// 【可选】添加工具方法:根据code找对应的枚举(前端传code时,后端快速匹配)
|
||||
public static DoctorPhraseBizTypeEnum getByCode(String code) {
|
||||
for (DoctorPhraseBizTypeEnum enumObj : values()) {
|
||||
if (enumObj.getCode().equals(code)) {
|
||||
return enumObj;
|
||||
}
|
||||
}
|
||||
return null; // 或抛异常:throw new IllegalArgumentException("无效的业务分类编码:" + code);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user