diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationDiagnosisAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationDiagnosisAppServiceImpl.java index aaa7df64..97b5b099 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationDiagnosisAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationDiagnosisAppServiceImpl.java @@ -482,4 +482,4 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn return R.ok(encounterDiagnosis); } -} +} \ No newline at end of file diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/impl/PatientInformationServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/impl/PatientInformationServiceImpl.java index 7b60f299..fd72e0ca 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/impl/PatientInformationServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/patientmanage/appservice/impl/PatientInformationServiceImpl.java @@ -143,29 +143,35 @@ public class PatientInformationServiceImpl implements IPatientInformationService CommonConstants.FieldName.BusNo, CommonConstants.FieldName.PyStr, CommonConstants.FieldName.WbStr)), request); - // 查询当前用户对应的医生信息 - LambdaQueryWrapper practitionerQuery = new LambdaQueryWrapper<>(); - practitionerQuery.eq(com.openhis.administration.domain.Practitioner::getUserId, userId); - // 使用list()避免TooManyResultsException异常,然后取第一个记录 - List practitionerList = practitionerService.list(practitionerQuery); - com.openhis.administration.domain.Practitioner practitioner = practitionerList != null && !practitionerList.isEmpty() ? practitionerList.get(0) : null; + // 检查是否是精确ID查询(从门诊挂号页面跳转时使用) + boolean hasExactIdQuery = (patientBaseInfoDto.getId() != null); - // 如果当前用户是医生,添加医生患者过滤条件 - if (practitioner != null) { - // 查询该医生作为接诊医生(ADMITTER, code="1")和挂号医生(REGISTRATION_DOCTOR, code="12")的所有就诊记录的患者ID - List doctorPatientIds = patientManageMapper.getPatientIdsByPractitionerId( - practitioner.getId(), - Arrays.asList(ParticipantType.ADMITTER.getCode(), ParticipantType.REGISTRATION_DOCTOR.getCode())); + // 只有非精确ID查询时,才添加医生患者过滤条件 + if (!hasExactIdQuery) { + // 查询当前用户对应的医生信息 + LambdaQueryWrapper practitionerQuery = new LambdaQueryWrapper<>(); + practitionerQuery.eq(com.openhis.administration.domain.Practitioner::getUserId, userId); + // 使用list()避免TooManyResultsException异常,然后取第一个记录 + List practitionerList = practitionerService.list(practitionerQuery); + com.openhis.administration.domain.Practitioner practitioner = practitionerList != null && !practitionerList.isEmpty() ? practitionerList.get(0) : null; - if (doctorPatientIds != null && !doctorPatientIds.isEmpty()) { - // 添加患者ID过滤条件 - 注意:这里使用列名而不是表别名 - queryWrapper.in("id", doctorPatientIds); - } else { - // 如果没有相关患者,返回空结果 - queryWrapper.eq("id", -1); // 设置一个不存在的ID + // 如果当前用户是医生,添加医生患者过滤条件 + if (practitioner != null) { + // 查询该医生作为接诊医生(ADMITTER, code="1")和挂号医生(REGISTRATION_DOCTOR, code="12")的所有就诊记录的患者ID + List doctorPatientIds = patientManageMapper.getPatientIdsByPractitionerId( + practitioner.getId(), + Arrays.asList(ParticipantType.ADMITTER.getCode(), ParticipantType.REGISTRATION_DOCTOR.getCode())); + + if (doctorPatientIds != null && !doctorPatientIds.isEmpty()) { + // 添加患者ID过滤条件 - 注意:这里使用列名而不是表别名 + queryWrapper.in("id", doctorPatientIds); + } else { + // 如果没有相关患者,返回空结果 + queryWrapper.eq("id", -1); // 设置一个不存在的ID + } } + // 如果不是医生,查询所有患者 } - // 如果不是医生,查询所有患者 IPage patientInformationPage = patientManageMapper.getPatientPage(new Page<>(pageNo, pageSize), queryWrapper); diff --git a/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue b/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue index 2001d9b4..0408dd7f 100644 --- a/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue +++ b/openhis-ui-vue3/src/views/charge/outpatientregistration/index.vue @@ -961,7 +961,20 @@ async function handleReadCard(value) { /** 跳转到患者档案页面 */ function goToPatientRecord() { - router.push('/patient/patientmgr'); + // 如果已选择患者,则跳转到档案页面并定位到该患者 + if (form.value.patientId) { + // 使用患者ID作为查询参数传递到档案页面 + router.push({ + path: '/patient/patientmgr', + query: { + patientId: form.value.patientId, + patientName: form.value.name + } + }); + } else { + // 未选择患者时,直接跳转到档案页面 + router.push('/patient/patientmgr'); + } } /** 新增用户信息弹窗 */ diff --git a/openhis-ui-vue3/src/views/patientmanagement/patientmanagement/index.vue b/openhis-ui-vue3/src/views/patientmanagement/patientmanagement/index.vue index a3c8766b..f0c81478 100644 --- a/openhis-ui-vue3/src/views/patientmanagement/patientmanagement/index.vue +++ b/openhis-ui-vue3/src/views/patientmanagement/patientmanagement/index.vue @@ -118,9 +118,14 @@