完善医生常用语管理功能

### 后端修改
1. 实体类DoctorPhrase:字段/注解调整
2. 枚举完善:新增DoctorPhraseAppTypeEnum/DoctorPhraseBizTypeEnum,统一业务分类
3. 服务实现类:修正类名拼写(DoctorPhraesAppS → DoctorPhraseAppServiceImpl
### 前端修改
1. 常用语管理页面(doctorphrase/index.vue):
   业务分类硬编码替换为枚举(主诉/现病史/术前/术后/既往史)
This commit is contained in:
sindir
2026-01-19 15:43:34 +08:00
parent 97f04d0b15
commit 9cba8fea12
4 changed files with 228 additions and 219 deletions

View File

@@ -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;

View File

@@ -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);
}
}