diff --git a/openhis-server-new/core-common/pom.xml b/openhis-server-new/core-common/pom.xml index 3c971656..a74a717e 100644 --- a/openhis-server-new/core-common/pom.xml +++ b/openhis-server-new/core-common/pom.xml @@ -21,13 +21,15 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.11.0 17 17 UTF-8 -parameters + --add-modules + java.base diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java index 282f3fa5..6754610a 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java @@ -956,6 +956,12 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp */ @Override public R getProofResult(Long encounterId) { + // 检查参数 + if (encounterId == null) { + log.warn("获取检验结果时就诊ID为空"); + return R.ok(new ArrayList<>()); + } + // LIS查看报告地址 String lisReportUrl = TenantOptionUtil.getOptionContent(TenantOptionDict.LIS_REPORT_URL); if (StringUtils.isEmpty(lisReportUrl)) { @@ -980,6 +986,12 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp */ @Override public R getTestResult(Long encounterId) { + // 检查参数 + if (encounterId == null) { + log.warn("获取检查结果时就诊ID为空"); + return R.ok(new ArrayList<>()); + } + // PACS查看报告地址 String pacsReportUrl = TenantOptionUtil.getOptionContent(TenantOptionDict.PACS_REPORT_URL); if (StringUtils.isEmpty(pacsReportUrl)) { diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationPtDetailsAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationPtDetailsAppServiceImpl.java index 15eb954f..989ce89a 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationPtDetailsAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationPtDetailsAppServiceImpl.java @@ -34,6 +34,10 @@ public class DoctorStationPtDetailsAppServiceImpl implements IDoctorStationPtDet */ @Override public R getPtDetails(Long encounterId) { + // 检查参数 + if (encounterId == null) { + return R.fail("就诊ID不能为空"); + } // 收费状态List(1:待收费,2:待结算,5:已结算) List statusList = new ArrayList<>(); @@ -49,6 +53,10 @@ public class DoctorStationPtDetailsAppServiceImpl implements IDoctorStationPtDet ChargeItemContext.ACTIVITY.getValue(), ClinicalStatus.ACTIVE.getValue(), LocationForm.BED.getValue(), ParticipantType.ADMITTER.getCode(), statusList); + if (patientDetailsDto == null) { + return R.fail("未找到患者详情信息"); + } + // 住院的场合,获取现在时间,计算住院天数 if (patientDetailsDto.getClassEnum() == EncounterClass.IMP.getValue()) { // 截至时间,用于计算当前时刻下显示的住院天数 diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationAdviceController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationAdviceController.java index f43e761e..41f5983a 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationAdviceController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationAdviceController.java @@ -106,7 +106,7 @@ public class DoctorStationAdviceController { * @return 医嘱请求数据 */ @GetMapping(value = "/request-base-info") - public R getRequestBaseInfo(@RequestParam Long encounterId) { + public R getRequestBaseInfo(@RequestParam(required = false) Long encounterId) { return iDoctorStationAdviceAppService.getRequestBaseInfo(encounterId); } @@ -114,10 +114,11 @@ public class DoctorStationAdviceController { * 查询历史医嘱请求数据 * * @param patientId 病人id + * @param encounterId 就诊id * @return 历史医嘱请求数据 */ @GetMapping(value = "/request-history-info") - public R getRequestHistoryInfo(@RequestParam Long patientId, Long encounterId) { + public R getRequestHistoryInfo(@RequestParam Long patientId, @RequestParam(required = false) Long encounterId) { return iDoctorStationAdviceAppService.getRequestHistoryInfo(patientId, encounterId); } @@ -138,7 +139,7 @@ public class DoctorStationAdviceController { * @return 就诊费用性质 */ @GetMapping(value = "/get-encounter-contract") - public R getEncounterContract(@RequestParam Long encounterId) { + public R getEncounterContract(@RequestParam(required = false) Long encounterId) { return iDoctorStationAdviceAppService.getEncounterContract(encounterId); } @@ -162,7 +163,7 @@ public class DoctorStationAdviceController { * @return 检验url相关参数 */ @GetMapping(value = "/proof-result") - public R getProofResult(@RequestParam(value = "encounterId") Long encounterId) { + public R getProofResult(@RequestParam(value = "encounterId", required = false) Long encounterId) { return iDoctorStationAdviceAppService.getProofResult(encounterId); } @@ -173,7 +174,7 @@ public class DoctorStationAdviceController { * @return 检查url相关参数 */ @GetMapping(value = "/test-result") - public R getTestResult(@RequestParam(value = "encounterId") Long encounterId) { + public R getTestResult(@RequestParam(value = "encounterId", required = false) Long encounterId) { return iDoctorStationAdviceAppService.getTestResult(encounterId); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationChineseMedicalController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationChineseMedicalController.java index 5cd1dedb..90a6efca 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationChineseMedicalController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationChineseMedicalController.java @@ -88,7 +88,7 @@ public class DoctorStationChineseMedicalController { * @return 中医就诊诊断信息 */ @GetMapping(value = "/get-tcm-encounter-diagnosis") - public R getTcmEncounterDiagnosis(@RequestParam Long encounterId) { + public R getTcmEncounterDiagnosis(@RequestParam(required = false) Long encounterId) { return iDoctorStationChineseMedicalAppService.getTcmEncounterDiagnosis(encounterId); } @@ -158,7 +158,7 @@ public class DoctorStationChineseMedicalController { * @return 医嘱请求数据 */ @GetMapping(value = "/tcm-request-base-info") - public R getTcmRequestBaseInfo(@RequestParam Long encounterId) { + public R getTcmRequestBaseInfo(@RequestParam(required = false) Long encounterId) { return iDoctorStationChineseMedicalAppService.getTcmRequestBaseInfo(encounterId); } @@ -170,7 +170,7 @@ public class DoctorStationChineseMedicalController { * @return 中医历史医嘱请求数据 */ @GetMapping(value = "/tcm-request-history-info") - public R getTcmRequestHistoryInfo(@RequestParam Long patientId, Long encounterId) { + public R getTcmRequestHistoryInfo(@RequestParam Long patientId, @RequestParam(required = false) Long encounterId) { return iDoctorStationChineseMedicalAppService.getTcmRequestHistoryInfo(patientId, encounterId); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationDiagnosisController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationDiagnosisController.java index 70d22ddf..2241b140 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationDiagnosisController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationDiagnosisController.java @@ -162,12 +162,12 @@ public class DoctorStationDiagnosisController { /** * 查询就诊诊断信息 - * + * * @param encounterId 就诊id * @return 就诊诊断信息 */ @GetMapping(value = "/get-encounter-diagnosis") - public R getEncounterDiagnosis(@RequestParam Long encounterId) { + public R getEncounterDiagnosis(@RequestParam(required = false) Long encounterId) { return iDoctorStationDiagnosisAppService.getEncounterDiagnosis(encounterId); } @@ -178,7 +178,7 @@ public class DoctorStationDiagnosisController { * @return 就诊诊断信息 */ @GetMapping(value = "/get-encounter-diagnosis-ele") - public R getEncounterDiagnosisByEncounterId(@RequestParam Long encounterId,@RequestParam String searchKey) { + public R getEncounterDiagnosisByEncounterId(@RequestParam(required = false) Long encounterId,@RequestParam String searchKey) { return iDoctorStationDiagnosisAppService.getEncounterDiagnosisByEncounterId(encounterId,searchKey); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationEmrController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationEmrController.java index 1d291704..cf1aabb2 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationEmrController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationEmrController.java @@ -56,7 +56,7 @@ public class DoctorStationEmrController { * @return 病历详情 */ @GetMapping("/emr-detail") - public R getEmrDetail(@RequestParam(value = "encounterId") Long encounterId) { + public R getEmrDetail(@RequestParam(value = "encounterId", required = false) Long encounterId) { return iDoctorStationEmrAppService.getEmrDetail(encounterId); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationPtDetailsController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationPtDetailsController.java index 1f40dfb5..f63724ec 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationPtDetailsController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationPtDetailsController.java @@ -32,7 +32,7 @@ public class DoctorStationPtDetailsController { * @return 患者详情 */ @GetMapping(value = "/patient-details") - public R getPtDetails(@RequestParam Long encounterId) { + public R getPtDetails(@RequestParam(required = false) Long encounterId) { return doctorStationPtDetailsAppService.getPtDetails(encounterId); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/TodayOutpatientController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/TodayOutpatientController.java index 0100be65..282c9204 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/TodayOutpatientController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/TodayOutpatientController.java @@ -89,15 +89,18 @@ public class TodayOutpatientController { /** * 获取患者就诊详情 - * + * * @param encounterId 就诊记录ID * @param request HTTP请求 * @return 患者就诊详情 */ @GetMapping("/patients/{encounterId}") public R getPatientDetail( - @PathVariable("encounterId") Long encounterId, + @PathVariable("encounterId") Long encounterId, HttpServletRequest request) { + if (encounterId == null) { + return R.fail("就诊记录ID不能为空"); + } TodayOutpatientPatientDto patient = todayOutpatientService.getPatientDetail(encounterId, request); return R.ok(patient); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/RequestFormManageAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/RequestFormManageAppServiceImpl.java index 5ceee725..eb60f766 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/RequestFormManageAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/RequestFormManageAppServiceImpl.java @@ -221,6 +221,11 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer */ @Override public List getRequestForm(Long encounterId, String typeCode) { + // 检查参数 + if (encounterId == null) { + return new java.util.ArrayList<>(); // 返回空列表而不是查询数据库 + } + List requestFormList = requestFormManageAppMapper.getRequestForm(encounterId, typeCode); for (RequestFormQueryDto requestFormQueryDto : requestFormList) { // 查询处方详情 diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/controller/RequestFormManageController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/controller/RequestFormManageController.java index a8af3302..87edc5ff 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/controller/RequestFormManageController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/controller/RequestFormManageController.java @@ -70,12 +70,15 @@ public class RequestFormManageController { /** * 查询检查申请单 - * + * * @param encounterId 就诊id * @return 检查申请单 */ @GetMapping(value = "/get-check") - public R getCheckRequestForm(@RequestParam Long encounterId) { + public R getCheckRequestForm(@RequestParam(required = false) Long encounterId) { + if (encounterId == null) { + return R.fail("就诊ID不能为空"); + } return R.ok(iRequestFormManageAppService.getRequestForm(encounterId, ActivityDefCategory.TEST.getCode())); } @@ -86,7 +89,10 @@ public class RequestFormManageController { * @return 检验申请单 */ @GetMapping(value = "/get-inspection") - public R getInspectionRequestForm(@RequestParam Long encounterId) { + public R getInspectionRequestForm(@RequestParam(required = false) Long encounterId) { + if (encounterId == null) { + return R.fail("就诊ID不能为空"); + } return R.ok(iRequestFormManageAppService.getRequestForm(encounterId, ActivityDefCategory.PROOF.getCode())); } @@ -97,7 +103,10 @@ public class RequestFormManageController { * @return 输血申请单 */ @GetMapping(value = "/get-blood-transfusion") - public R getBloodTransfusionRequestForm(@RequestParam Long encounterId) { + public R getBloodTransfusionRequestForm(@RequestParam(required = false) Long encounterId) { + if (encounterId == null) { + return R.fail("就诊ID不能为空"); + } return R.ok(iRequestFormManageAppService.getRequestForm(encounterId, ActivityDefCategory.METACHYSIS.getCode())); } @@ -108,7 +117,10 @@ public class RequestFormManageController { * @return 手术申请单 */ @GetMapping(value = "/get-surgery") - public R getSurgeryRequestForm(@RequestParam Long encounterId) { + public R getSurgeryRequestForm(@RequestParam(required = false) Long encounterId) { + if (encounterId == null) { + return R.fail("就诊ID不能为空"); + } return R.ok(iRequestFormManageAppService.getRequestForm(encounterId, ActivityDefCategory.PROCEDURE.getCode())); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/IPrintReportAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/IPrintReportAppServiceImpl.java index a4175d95..6951697c 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/IPrintReportAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/appservice/impl/IPrintReportAppServiceImpl.java @@ -45,6 +45,10 @@ public class IPrintReportAppServiceImpl implements IPrintReportAppService { */ @Override public R disposalPrint(Long encounterId) { + // 检查参数 + if (encounterId == null) { + return R.ok(new java.util.ArrayList<>()); // 返回空列表而不是错误 + } List disposalList = printReportMapper.getDisposalList(encounterId); @@ -71,6 +75,10 @@ public class IPrintReportAppServiceImpl implements IPrintReportAppService { */ @Override public R checkApplicationPrint(Long encounterId) { + // 检查参数 + if (encounterId == null) { + return R.ok(new java.util.ArrayList<>()); // 返回空列表而不是错误 + } List checkList = printReportMapper.getCheckInspectionList(encounterId, YbRxItemTypeCode.MEDICAL_IMAGING.getValue()); @@ -98,6 +106,11 @@ public class IPrintReportAppServiceImpl implements IPrintReportAppService { */ @Override public R inspectionApplicationPrint(Long encounterId) { + // 检查参数 + if (encounterId == null) { + return R.ok(new java.util.ArrayList<>()); // 返回空列表而不是错误 + } + List inspectionList = printReportMapper.getCheckInspectionList(encounterId, YbRxItemTypeCode.LAB_TEST.getValue()); @@ -125,6 +138,10 @@ public class IPrintReportAppServiceImpl implements IPrintReportAppService { */ @Override public R prescriptionPrint(String prescriptionNo, Long encounterId) { + // 检查参数 + if (encounterId == null) { + return R.ok(new java.util.ArrayList<>()); // 返回空列表而不是错误 + } List list = printReportMapper.getPrescriptionList(prescriptionNo, encounterId); // 获取所属医院id diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/controller/PrintReportController.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/controller/PrintReportController.java index 9e3e577d..1a50e682 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/controller/PrintReportController.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/reportmanage/controller/PrintReportController.java @@ -34,7 +34,7 @@ public class PrintReportController { * @return 处置单信息 */ @GetMapping(value = "/disposal-print") - public R disposalPrint(@RequestParam Long encounterId) { + public R disposalPrint(@RequestParam(required = false) Long encounterId) { return printReportService.disposalPrint(encounterId); } @@ -46,7 +46,7 @@ public class PrintReportController { * @return 检验申请单信息 */ @GetMapping(value = "/check-print") - public R checkApplicationPrint(@RequestParam Long encounterId) { + public R checkApplicationPrint(@RequestParam(required = false) Long encounterId) { return printReportService.checkApplicationPrint(encounterId); } @@ -57,7 +57,7 @@ public class PrintReportController { * @return 检验申请单信息 */ @GetMapping(value = "/inspection-print") - public R inspectionApplicationPrint(@RequestParam Long encounterId) { + public R inspectionApplicationPrint(@RequestParam(required = false) Long encounterId) { return printReportService.inspectionApplicationPrint(encounterId); } @@ -69,7 +69,7 @@ public class PrintReportController { * @return 处方单信息 */ @GetMapping(value = "/prescription-print") - public R prescriptionPrint(@RequestParam String prescriptionNo, @RequestParam Long encounterId) { + public R prescriptionPrint(@RequestParam String prescriptionNo, @RequestParam(required = false) Long encounterId) { return printReportService.prescriptionPrint(prescriptionNo, encounterId); } diff --git a/openhis-server-new/pom.xml b/openhis-server-new/pom.xml index bd4dc322..447c26f9 100644 --- a/openhis-server-new/pom.xml +++ b/openhis-server-new/pom.xml @@ -24,7 +24,7 @@ UTF-8 UTF-8 17 - 3.8.1 + 3.11.0 3.1.1 1.2.27 1.21 @@ -380,6 +380,8 @@ -parameters -Xlint:unchecked + --add-modules + java.base diff --git a/openhis-ui-vue3/src/views/doctorstation/components/api.js b/openhis-ui-vue3/src/views/doctorstation/components/api.js index 85283d85..9d12ca2a 100644 --- a/openhis-ui-vue3/src/views/doctorstation/components/api.js +++ b/openhis-ui-vue3/src/views/doctorstation/components/api.js @@ -801,6 +801,16 @@ export function getTestResult(queryParams) { * 获取检验申请单列表 */ export function getInspectionApplicationList(queryParams) { + // 确保参数有效 + if (!queryParams || !queryParams.encounterId) { + console.warn('获取检验申请单列表时缺少必要参数 encounterId'); + // 返回一个resolved的Promise,模拟空数据 + return Promise.resolve({ + code: 200, + data: [], + message: '参数不足,返回空数据' + }); + } return request({ url: '/reg-doctorstation/request-form/get-inspection', method: 'get', diff --git a/openhis-ui-vue3/src/views/doctorstation/components/hospitalizationDialog.vue b/openhis-ui-vue3/src/views/doctorstation/components/hospitalizationDialog.vue index 79cd3514..d1516405 100644 --- a/openhis-ui-vue3/src/views/doctorstation/components/hospitalizationDialog.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/hospitalizationDialog.vue @@ -244,21 +244,32 @@ const rules = reactive({ function openDialog() { console.log('orgId==========>', props.patientInfo.orgId); getOrgList().then((res) => { - // organization.value = res.data.records; - organization.value = res.data.records[0].children.filter( - (record) => record.typeEnum === 2 && record.classEnum === 2 - ); + // 确保数据结构正确 + if (res.data && res.data.records && res.data.records.length > 0) { + // 获取第一层级的子节点,筛选出类型为科室(typeEnum===2)且类别为住院(classEnum===2)的组织 + const firstLevelChildren = res.data.records[0]?.children || []; + organization.value = firstLevelChildren.filter( + (record) => record.typeEnum === 2 && record.classEnum === 2 + ); + + // 如果当前患者所属科室在筛选结果中,则默认选中 + if (props.patientInfo.orgId) { + submitForm.inHospitalOrgId = + organization.value.find((item) => item.id === props.patientInfo.orgId)?.id || ''; + } + } else { + organization.value = []; + } + console.log('organization==========>', organization.value); - submitForm.inHospitalOrgId = - organization.value.find((item) => item.id === props.patientInfo.orgId)?.id || ''; }); - // wardList().then((res) => { - // wardListOptions.value = res.data; - // }); + // 获取初始化数据 getInit().then((response) => { console.log(response, 'response'); - priorityLevelOptionOptions.value = response.data.priorityLevelOptionOptions; // 优先级 + if (response.data && response.data.priorityLevelOptionOptions) { + priorityLevelOptionOptions.value = response.data.priorityLevelOptionOptions; // 优先级 + } }); console.log(props.patientInfo, 'patientInfo'); getDiagnosisInfo(undefined); @@ -268,6 +279,7 @@ function openDialog() { diagnosisDefinitionId = props.mainDiagnosis.definitionId; diagnosisYbNo = props.mainDiagnosis.ybNo || ''; submitForm.medTypeCode = props.mainDiagnosis.medTypeCode; + submitForm.diagnosisDesc = props.mainDiagnosis.name || ''; // 设置诊断描述 diagnosisDefinitionList.value = [props.mainDiagnosis]; } } @@ -284,21 +296,53 @@ function handleDiagnosisChange(item) { } function handleNodeClick(orgInfo) { - wardList({ orgId: orgInfo.id }).then((res) => { - wardListOptions.value = res.data; - }); + // 确保传入正确的科室ID + if (orgInfo && orgInfo.id) { + wardList({ orgId: orgInfo.id }).then((res) => { + if (res && res.data) { + wardListOptions.value = res.data; + // 清空之前选择的病区 + submitForm.wardLocationId = undefined; + } else { + wardListOptions.value = []; + submitForm.wardLocationId = undefined; + } + }).catch(error => { + console.error('获取病区列表失败:', error); + wardListOptions.value = []; + submitForm.wardLocationId = undefined; + proxy.$modal.msgError('获取病区列表失败,请稍后重试'); + }); + } else { + wardListOptions.value = []; + submitForm.wardLocationId = undefined; + } } function handleChange(value) { if (!value) { wardListOptions.value = []; submitForm.wardLocationId = undefined; + } else { + // 当选择新科室时,清空病区选择 + submitForm.wardLocationId = undefined; } } function submit() { proxy.$refs['registerRef'].validate((valid) => { if (valid) { + // 验证必要字段 + if (!props.patientInfo.patientId) { + proxy.$modal.msgError('患者信息不完整,无法办理住院'); + return; + } + + if (!props.encounterId && !props.patientInfo.encounterId) { + proxy.$modal.msgError('就诊信息不完整,无法办理住院'); + return; + } + let saveData = { ...submitForm, diagnosisYbNo: diagnosisYbNo, @@ -307,7 +351,12 @@ function submit() { ambEncounterId: props.encounterId || props.patientInfo.encounterId, patientId: props.patientInfo.patientId, }; + console.log('提交住院数据:', saveData); + + // 显示加载状态 + const loading = proxy.$modal.loading('正在办理住院...'); + handleHospitalization(saveData).then((res) => { if (res.code == 200) { proxy.$modal.msgSuccess('办理成功'); @@ -318,7 +367,18 @@ function submit() { } }).catch(error => { console.error('提交出错:', error); - proxy.$modal.msgError('提交请求失败'); + let errorMsg = '提交请求失败'; + if (error.response) { + errorMsg += ` (${error.response.status}): ${error.response.data.message || error.response.statusText}`; + } else if (error.request) { + errorMsg += ': 网络请求失败,请检查网络连接'; + } else { + errorMsg += `: ${error.message}`; + } + proxy.$modal.msgError(errorMsg); + }).finally(() => { + // 关闭加载状态 + proxy.$modal.closeLoading(); }); } }); diff --git a/openhis-ui-vue3/src/views/doctorstation/components/inspection/inspectionApplication.vue b/openhis-ui-vue3/src/views/doctorstation/components/inspection/inspectionApplication.vue index 5910f625..5ea98ce0 100644 --- a/openhis-ui-vue3/src/views/doctorstation/components/inspection/inspectionApplication.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/inspection/inspectionApplication.vue @@ -581,20 +581,35 @@ const getFilteredItems = (categoryKey) => { function initData() { console.log('检验组件初始化,patientInfo:', props.patientInfo) if (props.patientInfo) { - queryParams.encounterId = props.patientInfo.encounterId + // 确保 encounterId 存在且有效,优先使用 encounterId,其次尝试 id,最后尝试 patientId + queryParams.encounterId = props.patientInfo.encounterId || props.patientInfo.id || props.patientInfo.patientId formData.patientName = props.patientInfo.patientName || '' formData.cardNo = props.patientInfo.cardNo || '' formData.departmentName = props.patientInfo.departmentName || '' formData.doctorName = props.patientInfo.doctorName || '' } - // 只有在存在 encounterId 时才调用接口 - if (queryParams.encounterId) { + + // 只有在存在有效的 encounterId 时才调用接口 + if (queryParams.encounterId && queryParams.encounterId !== 'undefined' && queryParams.encounterId !== 'null' && queryParams.encounterId !== '') { getInspectionList() + } else { + console.warn('缺少有效的就诊ID,无法获取检验申请单列表') + inspectionList.value = [] + total.value = 0 } } // 获取检验申请单列表 function getInspectionList() { + // 先检查是否有有效的encounterId + if (!queryParams.encounterId || queryParams.encounterId === 'undefined' || queryParams.encounterId === 'null') { + console.warn('缺少有效的就诊ID,无法获取检验申请单列表') + inspectionList.value = [] + total.value = 0 + loading.value = false + return + } + loading.value = true // 调用真实的API,只传递 encounterId 参数 @@ -605,13 +620,23 @@ function getInspectionList() { } else { inspectionList.value = [] total.value = 0 - ElMessage.error('获取检验申请单列表失败') + console.error('获取检验申请单列表失败:', res.message || res.msg) + ElMessage.error(res.message || res.msg || '获取检验申请单列表失败') } }).catch((error) => { console.error('获取检验申请单列表异常:', error) inspectionList.value = [] total.value = 0 - ElMessage.error('获取检验申请单列表异常') + // 提供更友好的错误信息 + let errorMessage = '获取检验申请单列表异常' + if (error.response) { + errorMessage += ` (${error.response.status}): ${error.response.data.message || error.response.statusText}` + } else if (error.request) { + errorMessage += ': 网络请求失败,请检查网络连接' + } else { + errorMessage += `: ${error.message}` + } + ElMessage.error(errorMessage) }).finally(() => { loading.value = false }) diff --git a/openhis-ui-vue3/src/views/doctorstation/index.vue b/openhis-ui-vue3/src/views/doctorstation/index.vue index 0dabf077..90672d62 100644 --- a/openhis-ui-vue3/src/views/doctorstation/index.vue +++ b/openhis-ui-vue3/src/views/doctorstation/index.vue @@ -408,7 +408,10 @@ function handleClick(tab) { tcmRef.value.getDiagnosisInfo(); break; case 'inspection': - // 检验tab点击处理逻辑可以在这里添加 + // 确保检验组件获取最新的患者信息 + if (patientInfo.value && patientInfo.value.encounterId) { + inspectionRef.value.getList(); + } break; case 'surgery': surgeryRef.value.getList(); @@ -529,31 +532,74 @@ function openDrawer() { } // 判断是否已经入院登记 const onHospitalization = async () => { - const diagnosisRes = await getEncounterDiagnosis(patientInfo.value.encounterId); - const hasDiagnosis = diagnosisRes.data?.length > 0; - if (!hasDiagnosis) { + // 检查是否有有效的就诊ID + if (!patientInfo.value?.encounterId) { ElMessage({ type: 'error', - message: '该患者暂无诊断信息,无法办理住院!', + message: '患者就诊信息不完整,无法办理住院!', }); return; } - const mainDiag = diagnosisRes.data.find((item) => item.maindiseFlag === 1); - if (!mainDiag) { - ElMessage({ type: 'error', message: '该患者暂无主诊断信息,无法办理住院!' }); - return; - } - mainDiagnosis.value = mainDiag; - const res = await isHospitalization({ - encounterId: patientInfo.value.encounterId, - }); - if (!res.data) { - openDialog.value = true; - } else { + + try { + const diagnosisRes = await getEncounterDiagnosis(patientInfo.value.encounterId); + + // 检查API调用是否成功 + if (diagnosisRes.code !== 200) { + ElMessage({ + type: 'error', + message: diagnosisRes.msg || '获取诊断信息失败,无法办理住院!', + }); + return; + } + + const hasDiagnosis = diagnosisRes.data?.length > 0; + if (!hasDiagnosis) { + ElMessage({ + type: 'error', + message: '该患者暂无诊断信息,无法办理住院!', + }); + return; + } + + const mainDiag = diagnosisRes.data.find((item) => item.maindiseFlag === 1); + if (!mainDiag) { + ElMessage({ + type: 'error', + message: '该患者暂无主诊断信息,无法办理住院!' + }); + return; + } + + mainDiagnosis.value = mainDiag; + + const res = await isHospitalization({ + encounterId: patientInfo.value.encounterId, + }); + + // 检查API调用是否成功 + if (res.code !== 200) { + ElMessage({ + type: 'error', + message: res.msg || '检查住院状态失败!', + }); + return; + } + + if (!res.data) { + openDialog.value = true; + } else { + ElMessage({ + type: 'error', + message: '该患者,已办理入院,不允许重复办理', + }); + } + } catch (error) { + console.error('办理住院检查过程中发生错误:', error); ElMessage({ type: 'error', - message: '该患者,已办理入院,不允许重复办理', - }); + message: '办理住院过程中发生错误,请稍后重试!', + }); } };