feat(home): 添加医生专属患者统计和菜单跳转功能
- 在HomeStatisticsDto中新增我的患者数量和待写病历数量字段 - 实现医生患者查询功能,支持按租户隔离数据 - 更新首页统计服务,为医生用户提供专属患者统计数据 - 添加菜单名称点击跳转功能,支持路由导航和外部链接打开 - 修复首页统计数据显示,确保医生看到正确的患者数量 - 添加医保日结结算相关实体、服务和前端页面 - 配置前端路由控制器,支持Vue Router History模式
This commit is contained in:
@@ -59,4 +59,14 @@ public class HomeStatisticsDto {
|
||||
* 待审核数量
|
||||
*/
|
||||
private Integer pendingApprovals;
|
||||
|
||||
/**
|
||||
* 我的患者数量(医生专属)
|
||||
*/
|
||||
private Integer myPatients;
|
||||
|
||||
/**
|
||||
* 待写病历数量
|
||||
*/
|
||||
private Integer pendingEmr;
|
||||
}
|
||||
|
||||
@@ -136,6 +136,7 @@ public class PatientInformationServiceImpl implements IPatientInformationService
|
||||
// 获取登录者信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
Long userId = loginUser.getUserId();
|
||||
Integer tenantId = loginUser.getTenantId().intValue();
|
||||
|
||||
// 先构建基础查询条件
|
||||
QueryWrapper<PatientBaseInfoDto> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
@@ -159,8 +160,9 @@ public class PatientInformationServiceImpl implements IPatientInformationService
|
||||
if (practitioner != null) {
|
||||
// 查询该医生作为接诊医生(ADMITTER, code="1")和挂号医生(REGISTRATION_DOCTOR, code="12")的所有就诊记录的患者ID
|
||||
List<Long> doctorPatientIds = patientManageMapper.getPatientIdsByPractitionerId(
|
||||
practitioner.getId(),
|
||||
Arrays.asList(ParticipantType.ADMITTER.getCode(), ParticipantType.REGISTRATION_DOCTOR.getCode()));
|
||||
practitioner.getId(),
|
||||
Arrays.asList(ParticipantType.ADMITTER.getCode(), ParticipantType.REGISTRATION_DOCTOR.getCode()),
|
||||
tenantId);
|
||||
|
||||
if (doctorPatientIds != null && !doctorPatientIds.isEmpty()) {
|
||||
// 添加患者ID过滤条件 - 注意:这里使用列名而不是表别名
|
||||
|
||||
@@ -64,8 +64,10 @@ public interface PatientManageMapper extends BaseMapper<Patient> {
|
||||
*
|
||||
* @param practitionerId 医生ID
|
||||
* @param typeCodes 参与者类型代码列表
|
||||
* @param tenantId 租户ID
|
||||
* @return 患者ID列表
|
||||
*/
|
||||
List<Long> getPatientIdsByPractitionerId(@Param("practitionerId") Long practitionerId,
|
||||
@Param("typeCodes") List<String> typeCodes);
|
||||
List<Long> getPatientIdsByPractitionerId(@Param("practitionerId") Long practitionerId,
|
||||
@Param("typeCodes") List<String> typeCodes,
|
||||
@Param("tenantId") Integer tenantId);
|
||||
}
|
||||
|
||||
@@ -66,23 +66,34 @@ public class HomeStatisticsServiceImpl implements IHomeStatisticsService {
|
||||
Practitioner practitioner = practitionerList != null && !practitionerList.isEmpty() ? practitionerList.get(0) : null;
|
||||
|
||||
int totalPatients = 0;
|
||||
int myPatients = 0;
|
||||
|
||||
// 如果当前用户是医生,查询该医生接诊和被挂号的所有患者
|
||||
if (practitioner != null) {
|
||||
// 获取当前登录用户的租户ID
|
||||
Integer tenantId = SecurityUtils.getLoginUser().getTenantId().intValue();
|
||||
|
||||
// 查询该医生作为接诊医生(ADMITTER, code="1")和挂号医生(REGISTRATION_DOCTOR, code="12")的所有就诊记录的患者ID
|
||||
List<Long> doctorPatientIds = patientManageMapper.getPatientIdsByPractitionerId(
|
||||
practitioner.getId(),
|
||||
Arrays.asList(ParticipantType.ADMITTER.getCode(), ParticipantType.REGISTRATION_DOCTOR.getCode()));
|
||||
|
||||
totalPatients = doctorPatientIds != null ? doctorPatientIds.size() : 0;
|
||||
practitioner.getId(),
|
||||
Arrays.asList(ParticipantType.ADMITTER.getCode(), ParticipantType.REGISTRATION_DOCTOR.getCode()),
|
||||
tenantId);
|
||||
|
||||
myPatients = doctorPatientIds != null ? doctorPatientIds.size() : 0;
|
||||
|
||||
// 对于医生,"我的患者"数量即为该医生负责的患者数量
|
||||
statistics.setMyPatients(myPatients);
|
||||
} else {
|
||||
// 如果不是医生,查询所有患者(与患者管理页面逻辑保持一致)
|
||||
LambdaQueryWrapper<Patient> patientQuery = new LambdaQueryWrapper<>();
|
||||
patientQuery.eq(Patient::getDeleteFlag, "0");
|
||||
List<Patient> patientList = patientService.list(patientQuery);
|
||||
totalPatients = patientList != null ? patientList.size() : 0;
|
||||
// 如果不是医生,"我的患者"数量为0
|
||||
statistics.setMyPatients(0);
|
||||
}
|
||||
|
||||
// 查询所有患者作为总患者数
|
||||
LambdaQueryWrapper<Patient> patientQuery = new LambdaQueryWrapper<>();
|
||||
patientQuery.eq(Patient::getDeleteFlag, "0");
|
||||
List<Patient> patientList = patientService.list(patientQuery);
|
||||
totalPatients = patientList != null ? patientList.size() : 0;
|
||||
|
||||
statistics.setTotalPatients(totalPatients);
|
||||
|
||||
// 查询昨日在院患者数量(暂时简化处理)
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.openhis.web.system.controller;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.openhis.web.doctorstation.appservice.IDoctorStationEmrAppService;
|
||||
import com.openhis.web.dto.HomeStatisticsDto;
|
||||
import com.openhis.web.service.IHomeStatisticsService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -20,19 +22,21 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
public class HomeController {
|
||||
|
||||
private final IDoctorStationEmrAppService doctorStationEmrAppService;
|
||||
private final IHomeStatisticsService homeStatisticsService;
|
||||
|
||||
@ApiOperation("获取首页统计数据")
|
||||
@GetMapping("/statistics")
|
||||
public R<?> getStatistics() {
|
||||
// 这里可以返回各种统计数据
|
||||
// 为了简化,我们只返回待写病历数量
|
||||
// 获取基础统计数据
|
||||
HomeStatisticsDto statisticsDto = homeStatisticsService.getHomeStatistics();
|
||||
|
||||
// 获取待写病历数量
|
||||
Long userId = SecurityUtils.getLoginUser().getUserId();
|
||||
R<?> pendingEmrCount = doctorStationEmrAppService.getPendingEmrCount(userId);
|
||||
|
||||
// 构建返回数据
|
||||
java.util.Map<String, Object> data = new java.util.HashMap<>();
|
||||
data.put("pendingEmr", pendingEmrCount.getData());
|
||||
|
||||
return R.ok(data);
|
||||
|
||||
// 将待写病历数量添加到统计数据中
|
||||
statisticsDto.setPendingEmr((Integer) pendingEmrCount.getData());
|
||||
|
||||
return R.ok(statisticsDto);
|
||||
}
|
||||
}
|
||||
@@ -136,13 +136,13 @@
|
||||
<select id="getPatientIdsByPractitionerId" resultType="java.lang.Long">
|
||||
SELECT DISTINCT enc.patient_id
|
||||
FROM adm_encounter_participant AS ep
|
||||
LEFT JOIN adm_encounter AS enc ON ep.encounter_id = enc.ID AND enc.delete_flag = '0'
|
||||
INNER JOIN adm_encounter AS enc ON ep.encounter_id = enc.ID AND enc.delete_flag = '0'
|
||||
INNER JOIN adm_patient AS pt ON enc.patient_id = pt.id AND pt.delete_flag = '0'
|
||||
WHERE ep.delete_flag = '0'
|
||||
AND ep.practitioner_id = #{practitionerId}
|
||||
AND ep.tenant_id = 1
|
||||
AND enc.tenant_id = 1
|
||||
AND pt.tenant_id = 1
|
||||
AND ep.tenant_id = #{tenantId}
|
||||
AND enc.tenant_id = #{tenantId}
|
||||
AND pt.tenant_id = #{tenantId}
|
||||
<if test="typeCodes != null and !typeCodes.isEmpty()">
|
||||
AND ep.type_code IN
|
||||
<foreach collection="typeCodes" item="typeCode" open="(" separator="," close=")">
|
||||
|
||||
Reference in New Issue
Block a user