feat(organization): 支持科室分类多选功能

- 修改前端界面组件支持科室分类多选下拉框
- 更新后端接口参数类型从Integer改为String以支持多选值
- 实现FIND_IN_SET查询方式处理多选分类条件
- 添加parseClassEnumValues函数处理字符串或数组格式转换
- 在医院住院对话框中扩展筛选条件支持多选分类
- 优化错误信息显示逻辑提供更详细的错误提示
- 在患者列表组件中添加入院日期和主治医生信息展示
- 修复多个服务调用中科室分类参数传递的数据类型问题
This commit is contained in:
2026-01-18 13:39:57 +08:00
parent 2fe6d45ad4
commit 59157fda56
19 changed files with 216 additions and 47 deletions

View File

@@ -23,7 +23,7 @@ public interface IOrganizationAppService {
* @param request 请求数据
* @return 机构树分页列表
*/
Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, String name, Integer typeEnum, Integer classEnum,
Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, String name, Integer typeEnum, String classEnum,
String sortField, String sortOrder, HttpServletRequest request);
/**

View File

@@ -39,7 +39,7 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
private AssignSeqUtil assignSeqUtil;
@Override
public Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, String name, Integer typeEnum, Integer classEnum,
public Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, String name, Integer typeEnum, String classEnum,
String sortField, String sortOrder, HttpServletRequest request) {
// 创建查询条件
LambdaQueryWrapper<Organization> queryWrapper = new LambdaQueryWrapper<>();
@@ -51,8 +51,14 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
if (typeEnum != null) {
queryWrapper.eq(Organization::getTypeEnum, typeEnum);
}
if (classEnum != null) {
queryWrapper.eq(Organization::getClassEnum, classEnum);
if (StringUtils.isNotEmpty(classEnum)) {
// 对于多选,需要处理逗号分隔的值
queryWrapper.and(wrapper -> {
String[] classEnums = classEnum.split(",");
for (String cls : classEnums) {
wrapper.or().apply("FIND_IN_SET(?, class_enum)", cls.trim());
}
});
}
// 创建Page对象
@@ -89,7 +95,7 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
OrganizationDto node = new OrganizationDto();
BeanUtils.copyProperties(record, node);
node.setTypeEnum_dictText(EnumUtils.getInfoByValue(OrganizationType.class, node.getTypeEnum()));
node.setClassEnum_dictText(EnumUtils.getInfoByValue(OrganizationClass.class, node.getClassEnum()));
node.setClassEnum_dictText(formatClassEnumDictText(node.getClassEnum()));
node.setActiveFlag_dictText(EnumUtils.getInfoByValue(AccountStatus.class, node.getActiveFlag()));
// 将当前节点加入映射
nodeMap.put(bNo, node);
@@ -130,7 +136,7 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
OrganizationDto organizationDto = new OrganizationDto();
BeanUtils.copyProperties(organization, organizationDto);
organizationDto.setTypeEnum_dictText(EnumUtils.getInfoByValue(OrganizationType.class, organizationDto.getTypeEnum()));
organizationDto.setClassEnum_dictText(EnumUtils.getInfoByValue(OrganizationClass.class, organizationDto.getClassEnum()));
organizationDto.setClassEnum_dictText(formatClassEnumDictText(organizationDto.getClassEnum()));
organizationDto.setActiveFlag_dictText(EnumUtils.getInfoByValue(AccountStatus.class, organizationDto.getActiveFlag()));
return R.ok(organizationDto, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"机构信息查询"}));
@@ -221,6 +227,35 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"机构信息停用"}));
}
/**
* 格式化多选的分类字典文本
*/
private String formatClassEnumDictText(String classEnum) {
if (StringUtils.isEmpty(classEnum)) {
return "";
}
String[] classEnums = classEnum.split(",");
List<String> dictTexts = new ArrayList<>();
for (String cls : classEnums) {
String trimmedCls = cls.trim();
if (StringUtils.isNotEmpty(trimmedCls)) {
try {
Integer enumValue = Integer.parseInt(trimmedCls);
String dictText = EnumUtils.getInfoByValue(OrganizationClass.class, enumValue);
if (dictText != null) {
dictTexts.add(dictText);
}
} catch (NumberFormatException e) {
// 如果转换失败,跳过该值
}
}
}
return String.join(",", dictTexts);
}
/**
* 校验字段是否为指定类中的有效属性
*/

View File

@@ -54,7 +54,7 @@ public class OrganizationController {
@RequestParam(value = "pageSize", defaultValue = "100") Integer pageSize,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "typeEnum", required = false) Integer typeEnum,
@RequestParam(value = "classEnum", required = false) Integer classEnum,
@RequestParam(value = "classEnum", required = false) String classEnum,
@RequestParam(value = "sortField", required = false) String sortField,
@RequestParam(value = "sortOrder", required = false) String sortOrder, HttpServletRequest request) {
Page<OrganizationDto> organizationTree =

View File

@@ -3,6 +3,7 @@
*/
package com.openhis.web.basedatamanage.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
@@ -39,7 +40,8 @@ public class OrganizationDto {
private String typeEnum_dictText;
/** 机构分类枚举 */
private Integer classEnum;
@JsonFormat(shape = JsonFormat.Shape.STRING)
private String classEnum;
private String classEnum_dictText;
/** 拼音码 */

View File

@@ -157,7 +157,7 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra
@Override
public List<OrgMetadata> getOrgMetadata() {
List<Organization> list =
iOrganizationService.getList(OrganizationType.DEPARTMENT.getValue(), OrganizationClass.CLINIC.getValue());
iOrganizationService.getList(OrganizationType.DEPARTMENT.getValue(), String.valueOf(OrganizationClass.CLINIC.getValue()));
List<OrgMetadata> orgMetadataList = new ArrayList<>();
OrgMetadata orgMetadata;
for (Organization organization : list) {

View File

@@ -187,7 +187,7 @@ public class PatientHomeAppServiceImpl implements IPatientHomeAppService {
@Override
public List<OrgMetadata> getCaty() {
List<Organization> list = iOrganizationService.getList(OrganizationType.DEPARTMENT.getValue(),
OrganizationClass.INPATIENT.getValue());
OrganizationClass.INPATIENT.getCode());
List<OrgMetadata> orgMetadataList = new ArrayList<>();
OrgMetadata orgMetadata;
for (Organization organization : list) {

View File

@@ -94,7 +94,7 @@ public class MedicalDeviceDispenseAppServiceImpl implements IMedicalDeviceDispen
// 获取科室下拉选列表
List<Organization> organizationList
= organizationService.getList(OrganizationType.DEPARTMENT.getValue(), OrganizationClass.CLINIC.getValue());
= organizationService.getList(OrganizationType.DEPARTMENT.getValue(), String.valueOf(OrganizationClass.CLINIC.getValue()));
List<DispenseInitDto.DepartmentOption> organizationOptions = organizationList.stream()
.map(organization -> new DispenseInitDto.DepartmentOption(organization.getId(), organization.getName()))
.collect(Collectors.toList());

View File

@@ -130,7 +130,7 @@ public class ReturnMedicineAppServiceImpl implements IReturnMedicineAppService {
// 获取科室下拉选列表
List<Organization> organizationList
= iOrganizationService.getList(OrganizationType.DEPARTMENT.getValue(), OrganizationClass.CLINIC.getValue());
= iOrganizationService.getList(OrganizationType.DEPARTMENT.getValue(), String.valueOf(OrganizationClass.CLINIC.getValue()));
List<ReturnMedicineInitDto.DepartmentOption> organizationOptions = organizationList.stream().map(
organization -> new ReturnMedicineInitDto.DepartmentOption(organization.getId(), organization.getName()))
.collect(Collectors.toList());

View File

@@ -127,7 +127,7 @@ public class WesternMedicineDispenseAppServiceImpl implements IWesternMedicineDi
// 获取科室下拉选列表
List<Organization> organizationList
= organizationService.getList(OrganizationType.DEPARTMENT.getValue(), OrganizationClass.CLINIC.getValue());
= organizationService.getList(OrganizationType.DEPARTMENT.getValue(), String.valueOf(OrganizationClass.CLINIC.getValue()));
List<DispenseInitDto.DepartmentOption> organizationOptions = organizationList.stream()
.map(organization -> new DispenseInitDto.DepartmentOption(organization.getId(), organization.getName()))
.collect(Collectors.toList());

View File

@@ -52,7 +52,7 @@ public class RegisterReportAppServiceImpl implements IRegisterReportAppService {
RegisterReportInitDto initDto = new RegisterReportInitDto();
// 查询科室列表
List<Organization> organizationList =
organizationService.getList(OrganizationType.DEPARTMENT.getValue(), OrganizationClass.CLINIC.getValue());
organizationService.getList(OrganizationType.DEPARTMENT.getValue(), String.valueOf(OrganizationClass.CLINIC.getValue()));
// 科室
List<RegisterReportInitDto.longCommonStatusOption> departmentOptions = organizationList.stream()
.map(organization -> new RegisterReportInitDto.longCommonStatusOption(organization.getId(),