fix(doctorstation): 解决参数验证和数据获取问题
- 在前端api.js中添加encounterId参数验证,避免无效参数导致的错误 - 在后端服务层添加参数检查,当encounterId为空时返回空数据而非报错 - 修改控制器参数注解,将required设置为false以允许空值传递 - 优化住院办理流程中的错误处理和参数验证 - 改进检验申请单获取时的数据验证和错误提示 - 更新maven编译器插件版本并添加必要的模块参数 - 统一错误处理机制,提供更友好的用户提示信息
This commit is contained in:
@@ -21,13 +21,15 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<version>3.11.0</version>
|
||||
<configuration>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
<compilerArgs>
|
||||
<arg>-parameters</arg>
|
||||
<arg>--add-modules</arg>
|
||||
<arg>java.base</arg>
|
||||
</compilerArgs>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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<Integer> 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()) {
|
||||
// 截至时间,用于计算当前时刻下显示的住院天数
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -89,15 +89,18 @@ public class TodayOutpatientController {
|
||||
|
||||
/**
|
||||
* 获取患者就诊详情
|
||||
*
|
||||
*
|
||||
* @param encounterId 就诊记录ID
|
||||
* @param request HTTP请求
|
||||
* @return 患者就诊详情
|
||||
*/
|
||||
@GetMapping("/patients/{encounterId}")
|
||||
public R<TodayOutpatientPatientDto> 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);
|
||||
}
|
||||
|
||||
@@ -221,6 +221,11 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer
|
||||
*/
|
||||
@Override
|
||||
public List<RequestFormQueryDto> getRequestForm(Long encounterId, String typeCode) {
|
||||
// 检查参数
|
||||
if (encounterId == null) {
|
||||
return new java.util.ArrayList<>(); // 返回空列表而不是查询数据库
|
||||
}
|
||||
|
||||
List<RequestFormQueryDto> requestFormList = requestFormManageAppMapper.getRequestForm(encounterId, typeCode);
|
||||
for (RequestFormQueryDto requestFormQueryDto : requestFormList) {
|
||||
// 查询处方详情
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
|
||||
|
||||
@@ -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<DisposalDto> 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<CkInspAppDto> 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<CkInspAppDto> 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<PrescriptionPrintDto> list = printReportMapper.getPrescriptionList(prescriptionNo, encounterId);
|
||||
// 获取所属医院id
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>17</java.version> <!-- 将21改为17 -->
|
||||
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
|
||||
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
|
||||
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
||||
<druid.version>1.2.27</druid.version>
|
||||
<bitwalker.version>1.21</bitwalker.version>
|
||||
@@ -380,6 +380,8 @@
|
||||
<compilerArgs>
|
||||
<arg>-parameters</arg>
|
||||
<arg>-Xlint:unchecked</arg>
|
||||
<arg>--add-modules</arg>
|
||||
<arg>java.base</arg>
|
||||
</compilerArgs>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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
|
||||
})
|
||||
|
||||
@@ -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: '办理住院过程中发生错误,请稍后重试!',
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user