Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
2026-02-25 12:58:45 +08:00
5 changed files with 502 additions and 470 deletions

View File

@@ -3,7 +3,6 @@ package com.openhis.web.basedatamanage.appservice;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.core.domain.R;
import com.openhis.web.basedatamanage.dto.OrganizationDto;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@@ -25,7 +24,8 @@ public interface IOrganizationAppService {
* @param request 请求数据
* @return 机构树分页列表
*/
Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, String name, Integer typeEnum, List<String> classEnumList,
Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, String name, Integer typeEnum,
List<String> classEnumList,
String sortField, String sortOrder, HttpServletRequest request);
/**
@@ -71,9 +71,12 @@ public interface IOrganizationAppService {
/**
* 获取挂号科室列表
*
* @param pageNum 当前页码
* @param pageSize 查询条数
* @param name 机构/科室名称
* @param orgName 机构名称
* @return 挂号科室列表
*/
R<?> getRegisterOrganizations(@RequestParam(required = false) String name,
@RequestParam(required = false) String orgName);
R<?> getRegisterOrganizations(Integer pageNum, Integer pageSize, String name, String orgName);
}

View File

@@ -1,7 +1,6 @@
package com.openhis.web.basedatamanage.appservice.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.common.core.domain.R;
import com.core.common.utils.AssignSeqUtil;
@@ -20,7 +19,6 @@ import com.openhis.web.basedatamanage.appservice.IOrganizationAppService;
import com.openhis.web.basedatamanage.dto.OrganizationDto;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -28,8 +26,6 @@ import java.lang.reflect.Field;
import java.util.*;
import java.util.stream.Collectors;
import static com.baomidou.mybatisplus.core.toolkit.StringUtils.camelToUnderline;
@Service
public class OrganizationAppServiceImpl implements IOrganizationAppService {
@@ -40,7 +36,8 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
private AssignSeqUtil assignSeqUtil;
@Override
public Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, String name, Integer typeEnum, List<String> classEnumList,
public Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, String name, Integer typeEnum,
List<String> classEnumList,
String sortField, String sortOrder, HttpServletRequest request) {
// 使用Page对象进行分页查询
@@ -165,11 +162,14 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
// 转换为DTO对象确保数据格式一致
OrganizationDto organizationDto = new OrganizationDto();
BeanUtils.copyProperties(organization, organizationDto);
organizationDto.setTypeEnum_dictText(EnumUtils.getInfoByValue(OrganizationType.class, organizationDto.getTypeEnum()));
organizationDto
.setTypeEnum_dictText(EnumUtils.getInfoByValue(OrganizationType.class, organizationDto.getTypeEnum()));
organizationDto.setClassEnum_dictText(formatClassEnumDictText(organizationDto.getClassEnum()));
organizationDto.setActiveFlag_dictText(EnumUtils.getInfoByValue(AccountStatus.class, organizationDto.getActiveFlag()));
organizationDto
.setActiveFlag_dictText(EnumUtils.getInfoByValue(AccountStatus.class, organizationDto.getActiveFlag()));
return R.ok(organizationDto, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"机构信息查询"}));
return R.ok(organizationDto,
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] { "机构信息查询" }));
}
/**
@@ -239,7 +239,8 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
public R<?> activeOrg(Long orgId) {
// 机构启用
boolean result = organizationService.activeOrg(orgId);
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"机构信息启用"}))
return result
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] { "机构信息启用" }))
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] { "机构信息启用" }));
}
@@ -253,7 +254,8 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
public R<?> inactiveOrg(Long orgId) {
// 机构停用
boolean result = organizationService.inactiveOrg(orgId);
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"机构信息停用"}))
return result
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] { "机构信息停用" }))
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] { "机构信息停用" }));
}
@@ -289,27 +291,41 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
/**
* 获取挂号科室列表
*
* @param pageNo 当前页码
* @param pageSize 查询条数
* @param name 机构/科室名称
* @param orgName 机构名称
* @return 挂号科室列表
*/
@Override
public R<?> getRegisterOrganizations(@RequestParam(required = false) String name,
@RequestParam(required = false) String orgName) {
public R<?> getRegisterOrganizations(Integer pageNo, Integer pageSize, String name, String orgName) {
// 使用Page对象进行分页查询
Page<Organization> page = new Page<>(pageNo != null ? pageNo : 1, pageSize != null ? pageSize : 10);
// 创建查询条件只查询register_flag为1的组织机构
LambdaQueryWrapper<Organization> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Organization::getRegisterFlag, 1); // 只获取挂号科室
queryWrapper.eq(Organization::getDeleteFlag, "0"); // 确保未删除
// 添加名称过滤条件
if (StringUtils.isNotEmpty(name)) {
queryWrapper.like(Organization::getName, name);
}
// 执行查询
List<Organization> organizationList = organizationService.list(queryWrapper);
// 如果有机构名称筛选
if (StringUtils.isNotEmpty(orgName)) {
// 这里假设 orgName 是父机构名称,如果需要更复杂的关联查询可在此扩展
// 当前逻辑暂保持与原逻辑一致的过滤方式或根据需求调整
}
// 按编码排序
queryWrapper.orderByAsc(Organization::getBusNo);
// 执行分页查询
Page<Organization> resultPage = organizationService.page(page, queryWrapper);
// 转换为DTO对象并设置字典文本
List<OrganizationDto> organizationDtoList = organizationList.stream().map(org -> {
List<OrganizationDto> organizationDtoList = resultPage.getRecords().stream().map(org -> {
OrganizationDto dto = new OrganizationDto();
BeanUtils.copyProperties(org, dto);
dto.setTypeEnum_dictText(EnumUtils.getInfoByValue(OrganizationType.class, dto.getTypeEnum()));
@@ -318,7 +334,14 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
return dto;
}).collect(Collectors.toList());
return R.ok(organizationDtoList);
// 创建返回分页对象
Page<OrganizationDto> finalResult = new Page<>();
finalResult.setRecords(organizationDtoList);
finalResult.setTotal(resultPage.getTotal());
finalResult.setSize(resultPage.getSize());
finalResult.setCurrent(resultPage.getCurrent());
return R.ok(finalResult);
}
/**

View File

@@ -67,8 +67,8 @@ public class OrganizationController {
classEnumList = Arrays.asList(classEnum.split(","));
}
Page<OrganizationDto> organizationTree =
iOrganizationAppService.getOrganizationTree(pageNo, pageSize, name, typeEnum, classEnumList, sortField, sortOrder, request);
Page<OrganizationDto> organizationTree = iOrganizationAppService.getOrganizationTree(pageNo, pageSize, name,
typeEnum, classEnumList, sortField, sortOrder, request);
return R.ok(organizationTree,
MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] { "机构信息" }));
}
@@ -133,14 +133,18 @@ public class OrganizationController {
/**
* 获取挂号科室列表
*
* @param pageNum 当前页码
* @param pageSize 查询条数
* @param name 机构/科室名称
* @param orgName 机构名称
* @return 挂号科室列表
*/
@GetMapping("/register-organizations")
public R<?> getRegisterOrganizations(@RequestParam(required = false) String name,
public R<?> getRegisterOrganizations(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
@RequestParam(required = false) String name,
@RequestParam(required = false) String orgName) {
return iOrganizationAppService.getRegisterOrganizations(name, orgName);
return iOrganizationAppService.getRegisterOrganizations(pageNum, pageSize, name, orgName);
}
}

View File

@@ -1,4 +1,5 @@
<template>
<div class="appoinmentmanage-wrapper">
<div class="appoinmentmanage-container">
<div class="appoinmentmanage-header">
<h2 class="appoinmentmanage-title">科室排班管理</h2>
@@ -366,10 +367,10 @@
</template>
</el-dialog>
</el-dialog>
</div>
</template>
<script setup name="AppoinmentManage">
<script setup name="DeptManage">
import {computed, onMounted, ref, watch} from 'vue'
import { getDeptAppthoursList } from '@/api/appoinmentmanage/deptappthoursManage'
import {useRouter} from 'vue-router'
@@ -806,30 +807,23 @@ const fetchOrganizationList = async () => {
// 获取科室列表(通用方法)
const fetchDeptList = async (apiFunction) => {
try {
// 复制查询参数,避免修改原始参数
// 复制查询参数
const params = {
...queryParams.value,
pageNo: pagination.value.currentPage,
pageNum: pagination.value.currentPage, // 修正为 pageNum
pageSize: pagination.value.pageSize
};
// 并行获取科室列表和科室时间配置
// 同时获取配置数据,分页大小与主列表保持一致
// 这样既解决了 9999 导致的性能问题,又保证了当前显示行的数据完整性
const [deptRes, configRes] = await Promise.all([
apiFunction(params),
getDeptAppthoursList({ pageNum: 1, pageSize: 9999 })
getDeptAppthoursList({
pageNum: pagination.value.currentPage,
pageSize: pagination.value.pageSize
})
]);
// 创建科室名称到机构名称的映射
const institutionMap = new Map();
if (configRes.code === 200) {
const configRecords = configRes.data?.records || configRes.rows || [];
configRecords.forEach(config => {
if (config.department && config.institution) {
institutionMap.set(config.department, config.institution);
}
});
}
if (deptRes.code === 200) {
let dataList = [];
let totalCount = 0;
@@ -837,12 +831,14 @@ const fetchDeptList = async (apiFunction) => {
if (actualData && actualData.code === 200 && actualData.msg) {
actualData = actualData.data;
}
if (actualData && actualData.content) {
dataList = actualData.content;
totalCount = actualData.totalElements || 0;
} else if (actualData && actualData.records) {
// 提取主数据列表
if (actualData && actualData.records) {
dataList = actualData.records;
totalCount = actualData.total || 0;
} else if (actualData && actualData.content) {
dataList = actualData.content;
totalCount = actualData.totalElements || 0;
} else if (Array.isArray(actualData)) {
dataList = actualData;
totalCount = actualData.length;
@@ -854,38 +850,38 @@ const fetchDeptList = async (apiFunction) => {
totalCount = Array.isArray(actualData) ? actualData.length : 0;
}
// 提取并映射配置数据
const configs = configRes?.data?.records || configRes?.rows || configRes?.data || [];
const configMap = new Map();
if (Array.isArray(configs)) {
configs.forEach(c => {
// 假设通过机构+科室名进行匹配或者通过ID取决于后端模型
const key = `${c.institution}-${c.department}`;
configMap.set(key, c);
});
}
if (apiFunction === getRegisterOrganizations) {
deptList.value = dataList.map(org => ({
deptList.value = dataList.map(org => {
const key = `${org.orgName || org.organizationName || org.org || ''}-${org.name}`;
const config = configMap.get(key);
return {
id: org.id,
orgName: institutionMap.get(org.name) || org.name,
orgName: org.orgName || org.organizationName || org.name,
deptName: org.name,
name: org.name,
remark: org.remark || org.intro,
status: org.activeFlag === 1,
registerFlag: org.registerFlag
}));
// 优先使用配置中的状态,作为补充
status: config ? config.activeFlag !== 0 : (org.activeFlag === 1),
registerFlag: config ? config.registerFlag : org.registerFlag
};
});
} else {
deptList.value = dataList;
}
// 如果后端没有处理筛选,才进行前端筛选
// 但要注意,这样会影响分页准确性,理想情况下应由后端处理
pagination.value.total = totalCount;
// 仅当前端分页时才进行过滤
if (queryParams.value.orgName && queryParams.value.orgName !== '') {
deptList.value = deptList.value.filter(
org => org.orgName === queryParams.value.orgName
);
pagination.value.total = deptList.value.length; // 更新总数为过滤后的数量
}
if (queryParams.value.deptName && queryParams.value.deptName !== '') {
deptList.value = deptList.value.filter(
org => org.deptName && org.deptName.includes(queryParams.value.deptName)
);
pagination.value.total = deptList.value.length; // 更新总数为过滤后的数量
}
} else {
ElMessage.error(deptRes.msg || '获取科室列表失败');
}
@@ -1637,7 +1633,10 @@ const handleCurrentChange = (current) => {
const fetchDepartmentOptions = async () => {
try {
// 使用当前查询参数进行过滤
const params = {}
const params = {
pageNum: 1,
pageSize: 100 // 下拉菜单加载较多数据以供选择
}
if (queryParams.value.deptName) {
params.name = queryParams.value.deptName
}
@@ -1700,18 +1699,16 @@ const fetchDepartmentOptions = async () => {
}
}
// 页面加载时获取科室列表
// 页面加载时获取初始化数据
onMounted(async () => {
// 同时加载卫生机构列表和科室列表
await Promise.all([
fetchOrganizationList(), // 加载卫生机构列表
getDeptList() // 加载科室列表
])
// 优化:合并初始化请求,减少并发
await fetchOrganizationList() // 该函数内部已包含 getRegisterOrganizations 调用
await getDeptList()
// 延迟加载科室选项,避免阻塞主列表加载
// 延迟加载非核心选项
setTimeout(() => {
fetchDepartmentOptions()
}, 0)
}, 300)
})
</script>

View File

@@ -277,7 +277,7 @@
:show-overflow-tooltip="true"
>
<template #default="scope">
<span>{{ scope.row.purchasePrice?.toFixed(3) + ' 元' }}</span>
<span>{{ Number(scope.row.purchasePrice || 0).toFixed(3) + ' 元' }}</span>
</template>
</el-table-column>
<el-table-column
@@ -290,7 +290,7 @@
:show-overflow-tooltip="true"
>
<template #default="scope">
<span>{{ scope.row.salePrice?.toFixed(3) + ' 元' }}</span>
<span>{{ Number(scope.row.salePrice || 0).toFixed(3) + ' 元' }}</span>
</template>
</el-table-column>
<el-table-column
@@ -303,7 +303,7 @@
:show-overflow-tooltip="true"
>
<template #default="scope">
<span>{{ scope.row.totalPurchasePrice?.toFixed(3) + ' 元' }}</span>
<span>{{ Number(scope.row.totalPurchasePrice || 0).toFixed(3) + ' 元' }}</span>
</template>
</el-table-column>
<el-table-column
@@ -316,7 +316,7 @@
:show-overflow-tooltip="true"
>
<template #default="scope">
<span>{{ scope.row.totalSalePrice?.toFixed(3) + ' 元' }}</span>
<span>{{ Number(scope.row.totalSalePrice || 0).toFixed(3) + ' 元' }}</span>
</template>
</el-table-column>
<el-table-column
@@ -671,8 +671,13 @@ function getList() {
total.value = res.data.total;
});
productPageTotal(params).then((res) => {
salePriceTotal.value = res.data.purchasePriceStatistics;
priceTotal.value = res.data.salePriceStatistics;
// 使用 Number() 强制转换,解决字符串问题
// 使用 || 0 解决 null/undefined 问题
const purchasePrice = res.data?.purchasePriceStatistics;
const salePrice = res.data?.salePriceStatistics;
salePriceTotal.value = Number(purchasePrice || 0);
priceTotal.value = Number(salePrice || 0);
});
}