feat(organization): 优化科室分类查询功能
- 修改 getOrganizationTree 方法参数,将 classEnum 字符串改为 classEnumList 列表 - 实现多选科室分类的精确匹配查询逻辑 - 添加分页查询时只显示未删除记录的过滤条件 - 更新控制器中对逗号分隔参数的解析逻辑 - 修复查询条件构造中的逻辑错误 - 配置 Lombok 注解处理器路径 - 重命名诊断服务方法名以提高可读性 - 修复医保模块中诊断查询方法调用 - 修复集合初始化语法错误
This commit is contained in:
@@ -112,6 +112,13 @@
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.core.common.core.domain.R;
|
||||
import com.openhis.web.basedatamanage.dto.OrganizationDto;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Organization 应该服务类
|
||||
@@ -17,13 +18,13 @@ public interface IOrganizationAppService {
|
||||
* @param pageSize 查询条数
|
||||
* @param name 科室名称
|
||||
* @param typeEnum 科室类型
|
||||
* @param classEnum 科室分类
|
||||
* @param classEnumList 科室分类列表(逗号分隔的值)
|
||||
* @param sortField 排序字段
|
||||
* @param sortOrder 排序方向
|
||||
* @param request 请求数据
|
||||
* @return 机构树分页列表
|
||||
*/
|
||||
Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, String name, Integer typeEnum, String classEnum,
|
||||
Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, String name, Integer typeEnum, List<String> classEnumList,
|
||||
String sortField, String sortOrder, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
|
||||
@@ -39,50 +39,69 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
|
||||
@Override
|
||||
public Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, String name, Integer typeEnum, String classEnum,
|
||||
public Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, String name, Integer typeEnum, List<String> classEnumList,
|
||||
String sortField, String sortOrder, HttpServletRequest request) {
|
||||
|
||||
// 使用Page对象进行分页查询
|
||||
Page<Organization> page = new Page<>(pageNo, pageSize);
|
||||
|
||||
// 创建查询条件
|
||||
LambdaQueryWrapper<Organization> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Organization::getDeleteFlag, "0"); // 只查询未删除的记录
|
||||
|
||||
// 添加查询条件
|
||||
if (StringUtils.isNotEmpty(name)) {
|
||||
queryWrapper.like(Organization::getName, name);
|
||||
}
|
||||
if (typeEnum != null) {
|
||||
queryWrapper.eq(Organization::getTypeEnum, typeEnum);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(classEnum)) {
|
||||
// 对于多选,需要处理逗号分隔的值
|
||||
if (classEnumList != null && !classEnumList.isEmpty()) {
|
||||
// 使用OR条件来匹配class_enum字段中包含任一值的记录
|
||||
queryWrapper.and(wrapper -> {
|
||||
String[] classEnums = classEnum.split(",");
|
||||
for (String cls : classEnums) {
|
||||
String trimmedCls = cls.trim();
|
||||
// 使用OR连接多个条件来匹配逗号分隔的值
|
||||
wrapper.or().and(subWrapper -> {
|
||||
subWrapper.eq(Organization::getClassEnum, trimmedCls)
|
||||
.or()
|
||||
.likeRight(Organization::getClassEnum, trimmedCls + ",")
|
||||
.or()
|
||||
.likeLeft(Organization::getClassEnum, "," + trimmedCls)
|
||||
.or()
|
||||
.like(Organization::getClassEnum, "," + trimmedCls + ",");
|
||||
for (int i = 0; i < classEnumList.size(); i++) {
|
||||
String classEnum = classEnumList.get(i);
|
||||
if (i == 0) {
|
||||
// 第一个条件
|
||||
wrapper.and(subWrapper -> {
|
||||
subWrapper.eq(Organization::getClassEnum, classEnum) // 精确匹配
|
||||
.or() // 或者
|
||||
.likeRight(Organization::getClassEnum, classEnum + ",") // 以"值,"开头
|
||||
.or() // 或者
|
||||
.likeLeft(Organization::getClassEnum, "," + classEnum) // 以",值"结尾
|
||||
.or() // 或者
|
||||
.like(Organization::getClassEnum, "," + classEnum + ","); // 在中间,被逗号包围
|
||||
});
|
||||
} else {
|
||||
// 后续条件使用OR连接
|
||||
wrapper.or(subWrapper -> {
|
||||
subWrapper.eq(Organization::getClassEnum, classEnum) // 精确匹配
|
||||
.or() // 或者
|
||||
.likeRight(Organization::getClassEnum, classEnum + ",") // 以"值,"开头
|
||||
.or() // 或者
|
||||
.likeLeft(Organization::getClassEnum, "," + classEnum) // 以",值"结尾
|
||||
.or() // 或者
|
||||
.like(Organization::getClassEnum, "," + classEnum + ","); // 在中间,被逗号包围
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 创建Page对象
|
||||
Page<Organization> page = new Page<>(pageNo, pageSize);
|
||||
|
||||
// 执行分页查询
|
||||
page = organizationService.page(page, queryWrapper);
|
||||
Page<Organization> resultPage = organizationService.page(page, queryWrapper);
|
||||
|
||||
List<Organization> organizationList = page.getRecords();
|
||||
// 将机构列表转为树结构
|
||||
// 将查询结果转为DTO并构建树结构
|
||||
List<Organization> organizationList = resultPage.getRecords();
|
||||
List<OrganizationDto> orgTree = buildTree(organizationList);
|
||||
Page<OrganizationDto> orgQueryDtoPage = new Page<>(pageNo, pageSize, page.getTotal());
|
||||
orgQueryDtoPage.setRecords(orgTree);
|
||||
return orgQueryDtoPage;
|
||||
|
||||
// 创建结果分页对象
|
||||
Page<OrganizationDto> result = new Page<>();
|
||||
result.setRecords(orgTree);
|
||||
result.setTotal(resultPage.getTotal());
|
||||
result.setSize(resultPage.getSize());
|
||||
result.setCurrent(resultPage.getCurrent());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@ package com.openhis.web.basedatamanage.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.web.basedatamanage.appservice.IOrganizationAppService;
|
||||
@@ -16,6 +17,8 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 机构管理controller
|
||||
@@ -43,7 +46,7 @@ public class OrganizationController {
|
||||
* @param pageSize 查询条数
|
||||
* @param name 科室名称
|
||||
* @param typeEnum 科室类型
|
||||
* @param classEnum 科室分类
|
||||
* @param classEnum 科室分类(支持多选,逗号分隔)
|
||||
* @param sortField 排序字段
|
||||
* @param sortOrder 排序方向
|
||||
* @param request 请求对象
|
||||
@@ -57,8 +60,15 @@ public class OrganizationController {
|
||||
@RequestParam(value = "classEnum", required = false) String classEnum,
|
||||
@RequestParam(value = "sortField", required = false) String sortField,
|
||||
@RequestParam(value = "sortOrder", required = false) String sortOrder, HttpServletRequest request) {
|
||||
|
||||
// 解析classEnum参数,支持逗号分隔的多个值
|
||||
List<String> classEnumList = null;
|
||||
if (StringUtils.isNotBlank(classEnum)) {
|
||||
classEnumList = Arrays.asList(classEnum.split(","));
|
||||
}
|
||||
|
||||
Page<OrganizationDto> organizationTree =
|
||||
iOrganizationAppService.getOrganizationTree(pageNo, pageSize, name, typeEnum, classEnum, sortField, sortOrder, request);
|
||||
iOrganizationAppService.getOrganizationTree(pageNo, pageSize, name, typeEnum, classEnumList, sortField, sortOrder, request);
|
||||
return R.ok(organizationTree,
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"机构信息"}));
|
||||
}
|
||||
|
||||
@@ -23,6 +23,14 @@
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.openhis.administration.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.openhis.administration.domain.Organization;
|
||||
import com.openhis.administration.dto.OrgDataDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
@@ -24,4 +25,5 @@ public interface OrganizationMapper extends BaseMapper<Organization> {
|
||||
**/
|
||||
List<OrgDataDto> searchOrgDataByHealth();
|
||||
|
||||
|
||||
}
|
||||
@@ -45,13 +45,13 @@ public interface IEncounterDiagnosisService extends IService<EncounterDiagnosis>
|
||||
List<EncounterDiagnosis> getDiagnosisList(Long encounterId);
|
||||
|
||||
/**
|
||||
* 查询 EncounterDiagnosis
|
||||
* 查询特定类型的诊断
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @param ybIptDiseTypeCode 诊断类型
|
||||
* @return 诊断集合
|
||||
*/
|
||||
List<EncounterDiagnosis> getDiagnosisList(Long encounterId, YbIptDiseTypeCode ybIptDiseTypeCode);
|
||||
List<EncounterDiagnosis> getDiagnosisListByType(Long encounterId, YbIptDiseTypeCode ybIptDiseTypeCode);
|
||||
|
||||
/**
|
||||
* 查询 EncounterDiagnosis
|
||||
|
||||
@@ -55,4 +55,5 @@ public interface IOrganizationService extends IService<Organization> {
|
||||
* @return List<OrgDataDto>
|
||||
**/
|
||||
List<OrgDataDto> searchOrgDataByHealth();
|
||||
|
||||
}
|
||||
@@ -95,14 +95,14 @@ public class EncounterDiagnosisServiceImpl extends ServiceImpl<EncounterDiagnosi
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询 EncounterDiagnosis
|
||||
* 查询特定类型的诊断
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @param ybIptDiseTypeCode 诊断类型
|
||||
* @return 诊断集合
|
||||
*/
|
||||
@Override
|
||||
public List<EncounterDiagnosis> getDiagnosisList(Long encounterId, YbIptDiseTypeCode ybIptDiseTypeCode) {
|
||||
public List<EncounterDiagnosis> getDiagnosisListByType(Long encounterId, YbIptDiseTypeCode ybIptDiseTypeCode) {
|
||||
LambdaQueryWrapper<EncounterDiagnosis> queryWrapper =
|
||||
new LambdaQueryWrapper<EncounterDiagnosis>().eq(EncounterDiagnosis::getEncounterId, encounterId);
|
||||
if (ybIptDiseTypeCode != null) {
|
||||
|
||||
@@ -101,4 +101,5 @@ public class OrganizationServiceImpl extends ServiceImpl<OrganizationMapper, Org
|
||||
public List<OrgDataDto> searchOrgDataByHealth() {
|
||||
return this.organizationMapper.searchOrgDataByHealth();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2032,7 +2032,7 @@ public class YbDao {
|
||||
}
|
||||
}
|
||||
Yb2301InputFeeDetail yb2301InputFeeDetail;
|
||||
List<Yb2301InputFeeDetail> yb2301InputFeeDetailList = new ArrayList();
|
||||
List<Yb2301InputFeeDetail> yb2301InputFeeDetailList = new ArrayList<>();
|
||||
// int i = 1;
|
||||
for (ChargeItemBaseInfoDto chargeItemBaseInfoDto : chargeItemBaseInfoDtosList) {
|
||||
yb2301InputFeeDetail = new Yb2301InputFeeDetail();
|
||||
@@ -2378,7 +2378,7 @@ public class YbDao {
|
||||
// throw new ServiceException("未查询到患者的医保信息");
|
||||
// }
|
||||
List<EncounterDiagnosis> diagnosisList
|
||||
= iEncounterDiagnosisService.getDiagnosisList(encounterId, YbIptDiseTypeCode.DISCHARGE_DIAGNOSIS);
|
||||
= iEncounterDiagnosisService.getDiagnosisListByType(encounterId, YbIptDiseTypeCode.DISCHARGE_DIAGNOSIS);
|
||||
if (diagnosisList.isEmpty()) {
|
||||
throw new ServiceException("未查询到出院诊断信息");
|
||||
}
|
||||
@@ -2558,7 +2558,7 @@ public class YbDao {
|
||||
// throw new ServiceException("未查询到患者的医保信息");
|
||||
// }
|
||||
List<EncounterDiagnosis> diagnosisList
|
||||
= iEncounterDiagnosisService.getDiagnosisList(encounterId, YbIptDiseTypeCode.DISCHARGE_DIAGNOSIS);
|
||||
= iEncounterDiagnosisService.getDiagnosisListByType(encounterId, YbIptDiseTypeCode.DISCHARGE_DIAGNOSIS);
|
||||
if (diagnosisList.isEmpty()) {
|
||||
throw new ServiceException("未查询到出院诊断信息");
|
||||
}
|
||||
|
||||
@@ -920,7 +920,7 @@ public class YbManager {
|
||||
}
|
||||
|
||||
Yb2301InputFeeDetail yb2301InputFeeDetail;
|
||||
List<Yb2301InputFeeDetail> yb2301InputFeeDetailList = new ArrayList();
|
||||
List<Yb2301InputFeeDetail> yb2301InputFeeDetailList = new ArrayList<>();
|
||||
BigDecimal quantity = BigDecimal.ZERO;
|
||||
// 分组分类
|
||||
Map<String, List<ChargeItemBaseInfoDto>> groupByTable
|
||||
|
||||
@@ -14,4 +14,5 @@
|
||||
GROUP BY heal.offered_org_id)
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user