diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/clinicalmanage/appservice/impl/SurgeryAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/clinicalmanage/appservice/impl/SurgeryAppServiceImpl.java index 3e67b3a03..dbe9bba32 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/clinicalmanage/appservice/impl/SurgeryAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/clinicalmanage/appservice/impl/SurgeryAppServiceImpl.java @@ -366,7 +366,7 @@ public class SurgeryAppServiceImpl implements ISurgeryAppService { serviceRequest.setTherapyEnum(TherapyTimeType.TEMPORARY.getValue());// 治疗类型 serviceRequest.setQuantity(BigDecimal.valueOf(1)); // 请求数量 serviceRequest.setUnitCode("次"); // 请求单位编码 - serviceRequest.setCategoryEnum(4); // 请求类型:4-手术 + serviceRequest.setCategoryEnum(24); // 请求类型:24-手术(新值域,避开 adviceType 碰撞) serviceRequest.setActivityId(surgeryId); // 手术ID作为诊疗定义id serviceRequest.setPatientId(surgeryDto.getPatientId()); // 患者 serviceRequest.setRequesterId(practitionerId); // 开方医生 diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/clinicalmanage/dto/OpScheduleDto.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/clinicalmanage/dto/OpScheduleDto.java index 267ddd0d8..9dacddc47 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/clinicalmanage/dto/OpScheduleDto.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/clinicalmanage/dto/OpScheduleDto.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.openhis.surgicalschedule.domain.OpSchedule; import lombok.Data; import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDate; @@ -16,6 +17,7 @@ import java.time.LocalDate; * @date 2026-01-28 */ @Data +@Accessors(chain = true) @EqualsAndHashCode(callSuper = true) public class OpScheduleDto extends OpSchedule { 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 2aac6ed67..b538ef63a 100755 --- 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 @@ -1549,7 +1549,18 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp deviceRequest.setLotNumber(adviceSaveDto.getLotNumber());// 产品批号 deviceRequest.setCategoryEnum(adviceSaveDto.getCategoryEnum()); // 请求类型 - deviceRequest.setDeviceDefId(adviceSaveDto.getAdviceDefinitionId());// 耗材定义id + // 🔧 BugFix #498: categoryEnum=22(检查) 走 ServiceRequest,不走 DeviceRequest + // 检查申请单的诊疗定义ID存在 activityId,不在 adviceDefinitionId + // deviceDefId 对应耗材定义ID,不能用诊疗定义ID填充 + if (adviceSaveDto.getCategoryEnum() == 22) { + log.info("handDevice skip - 检查申请单(categoryEnum=22) 走 ServiceRequest 路径,跳过 DeviceRequest 保存"); + continue; // 跳过本次循环,不走耗材请求路径 + } else if (adviceSaveDto.getAdviceDefinitionId() != null) { + deviceRequest.setDeviceDefId(adviceSaveDto.getAdviceDefinitionId());// 耗材定义id + } else { + log.warn("handDevice - deviceDefId 为空,adviceDefinitionId=null, categoryEnum={}", adviceSaveDto.getCategoryEnum()); + } + deviceRequest.setPatientId(adviceSaveDto.getPatientId()); // 患者 deviceRequest.setRequesterId(adviceSaveDto.getPractitionerId()); // 开方医生 deviceRequest.setOrgId(adviceSaveDto.getFounderOrgId());// 开方人科室 diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/IRequestFormManageAppService.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/IRequestFormManageAppService.java index 658e7540d..f865495d1 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/IRequestFormManageAppService.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/IRequestFormManageAppService.java @@ -63,4 +63,20 @@ public interface IRequestFormManageAppService { * @return 申请单 */ IPage getRequestFormPage(RequestFormDto requestFormDto); + + /** + * 删除申请单(仅待签发状态可删除) + * + * @param requestFormId 申请单ID + * @return 结果 + */ + R deleteRequestForm(Long requestFormId); + + /** + * 撤回申请单(已签发状态撤回至待签发) + * + * @param requestFormId 申请单ID + * @return 结果 + */ + R withdrawRequestForm(Long requestFormId); } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/AdviceManageAppServiceImpl.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/AdviceManageAppServiceImpl.java index 26afdbcd2..7f8f3028e 100755 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/AdviceManageAppServiceImpl.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/regdoctorstation/appservice/impl/AdviceManageAppServiceImpl.java @@ -761,6 +761,8 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService { if (is_sign) { deviceRequest.setReqAuthoredTime(authoredTime); // 医嘱签发时间 } + // 保存或签发时都需要设置耗材定义ID(防止 sign 分支 deviceDefId 为空触发 NOT NULL 约束) + deviceRequest.setDeviceDefId(regAdviceSaveDto.getAdviceDefinitionId()); // 保存时处理的字段属性 if (is_save) { deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4)); @@ -798,6 +800,8 @@ public class AdviceManageAppServiceImpl implements IAdviceManageAppService { if (is_sign) { deviceRequest.setReqAuthoredTime(authoredTime); // 医嘱签发时间 } + // 保存或签发时都需要设置耗材定义ID(防止 sign 分支 deviceDefId 为空触发 NOT NULL 约束) + deviceRequest.setDeviceDefId(regAdviceSaveDto.getAdviceDefinitionId()); // 保存时处理的字段属性 if (is_save) { deviceRequest.setBusNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 4)); 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 3c8974e9b..6948cd48d 100755 --- 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 @@ -1,6 +1,7 @@ package com.openhis.web.regdoctorstation.appservice.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; @@ -294,7 +295,7 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer surgeryServiceRequest.setTherapyEnum(TherapyTimeType.TEMPORARY.getValue()); surgeryServiceRequest.setQuantity(BigDecimal.valueOf(1)); surgeryServiceRequest.setUnitCode("次"); - surgeryServiceRequest.setCategoryEnum(4); // 4-手术 + surgeryServiceRequest.setCategoryEnum(24); // 24-手术(新值域,避开 adviceType 碰撞) // 优先从 activityList 获取手术 ID if (activityList != null && !activityList.isEmpty()) { Long activityId = activityList.get(0).getAdviceDefinitionId(); @@ -490,4 +491,90 @@ public class RequestFormManageAppServiceImpl implements IRequestFormManageAppSer return requestFormManageAppMapper.getRequestFormPage(requestFormDto, page); } + @Override + public R deleteRequestForm(Long requestFormId) { + if (requestFormId == null) { + return R.fail("申请单ID不能为空"); + } + RequestForm requestForm = iRequestFormService.getById(requestFormId); + if (requestForm == null) { + return R.fail("申请单不存在"); + } + String prescriptionNo = requestForm.getPrescriptionNo(); + + // 查询该申请单下所有 ServiceRequest(含子项) + List serviceRequests = iServiceRequestService.list( + new LambdaQueryWrapper() + .eq(ServiceRequest::getPrescriptionNo, prescriptionNo)); + if (serviceRequests == null || serviceRequests.isEmpty()) { + return R.fail("未找到关联的诊疗医嘱"); + } + + // 校验:只有待签发(status=0)的申请单可删除 + boolean allDraft = serviceRequests.stream() + .allMatch(sr -> RequestStatus.DRAFT.getValue().equals(sr.getStatusEnum())); + if (!allDraft) { + return R.fail("只有待签发状态的申请单可删除"); + } + + List serviceRequestIds = serviceRequests.stream() + .map(ServiceRequest::getId).collect(Collectors.toList()); + + // 1. 删除关联的费用项 + for (Long srId : serviceRequestIds) { + iChargeItemService.deleteByServiceTableAndId( + CommonConstants.TableName.WOR_SERVICE_REQUEST, srId); + } + // 2. 删除子项 ServiceRequest(parentId 非空) + iServiceRequestService.remove( + new LambdaQueryWrapper() + .in(ServiceRequest::getId, serviceRequestIds) + .isNotNull(ServiceRequest::getParentId)); + // 3. 删除主项 ServiceRequest + iServiceRequestService.removeByIds(serviceRequestIds); + // 4. 删除申请单 + iRequestFormService.removeById(requestFormId); + + log.info("检查申请单删除成功,requestFormId={}, prescriptionNo={}", requestFormId, prescriptionNo); + return R.ok("删除成功"); + } + + @Override + public R withdrawRequestForm(Long requestFormId) { + if (requestFormId == null) { + return R.fail("申请单ID不能为空"); + } + RequestForm requestForm = iRequestFormService.getById(requestFormId); + if (requestForm == null) { + return R.fail("申请单不存在"); + } + String prescriptionNo = requestForm.getPrescriptionNo(); + + // 查询该申请单下所有 ServiceRequest + List serviceRequests = iServiceRequestService.list( + new LambdaQueryWrapper() + .eq(ServiceRequest::getPrescriptionNo, prescriptionNo)); + if (serviceRequests == null || serviceRequests.isEmpty()) { + return R.fail("未找到关联的诊疗医嘱"); + } + + // 校验:只有已签发(status=2)的申请单可撤回 + boolean allActive = serviceRequests.stream() + .allMatch(sr -> RequestStatus.ACTIVE.getValue().equals(sr.getStatusEnum())); + if (!allActive) { + return R.fail("只有已签发状态的申请单可撤回"); + } + + // 将所有 ServiceRequest 状态改回待签发(DRAFT=0) + List serviceRequestIds = serviceRequests.stream() + .map(ServiceRequest::getId).collect(Collectors.toList()); + iServiceRequestService.update( + new ServiceRequest().setStatusEnum(RequestStatus.DRAFT.getValue()), + new LambdaUpdateWrapper() + .in(ServiceRequest::getId, serviceRequestIds)); + + log.info("检查申请单撤回成功,requestFormId={}, prescriptionNo={}", requestFormId, prescriptionNo); + return R.ok("撤回成功"); + } + } 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 eeaa6d707..e3e929fe3 100755 --- 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 @@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.*; import java.time.LocalDate; import java.util.List; +import java.util.Map; /** * 申请单管理 controller @@ -185,4 +186,26 @@ public class RequestFormManageController { public R> getRequestFormPage(@RequestBody RequestFormDto requestFormDto) { return R.ok(iRequestFormManageAppService.getRequestFormPage(requestFormDto)); } + + /** + * 删除申请单(仅待签发状态可删除) + * + * @param data 包含 requestFormId 的请求体 + * @return 结果 + */ + @PostMapping(value = "/delete") + public R deleteRequestForm(@RequestBody Map data) { + return iRequestFormManageAppService.deleteRequestForm(data.get("requestFormId")); + } + + /** + * 撤回申请单(已签发状态撤回至待签发) + * + * @param data 包含 requestFormId 的请求体 + * @return 结果 + */ + @PostMapping(value = "/withdraw") + public R withdrawRequestForm(@RequestBody Map data) { + return iRequestFormManageAppService.withdrawRequestForm(data.get("requestFormId")); + } } diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/inhospitalnursestation/ATDManageAppMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/inhospitalnursestation/ATDManageAppMapper.xml index ec68fc28e..b9e7ec3b1 100755 --- a/openhis-server-new/openhis-application/src/main/resources/mapper/inhospitalnursestation/ATDManageAppMapper.xml +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/inhospitalnursestation/ATDManageAppMapper.xml @@ -264,7 +264,6 @@ WHERE ael.status_enum = #{active} AND ael.delete_flag = '0' AND ael.form_enum = #{bed} - LIMIT 1 ) AS bed ON bed.encounter_id = ae.id LEFT JOIN ( SELECT ael.encounter_id, @@ -275,7 +274,6 @@ WHERE ael.status_enum = #{active} AND ael.delete_flag = '0' AND ael.form_enum = #{house} - LIMIT 1 ) AS house ON house.encounter_id = ae.id LEFT JOIN ( SELECT ael.encounter_id, @@ -286,7 +284,6 @@ WHERE ael.status_enum = #{active} AND ael.delete_flag = '0' AND ael.form_enum = #{ward} - LIMIT 1 ) AS ward ON ward.encounter_id = ae.id LEFT JOIN ( SELECT aep.encounter_id, diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/AdviceManageAppMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/AdviceManageAppMapper.xml index b26646eb2..0c5f93fb7 100755 --- a/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/AdviceManageAppMapper.xml +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/AdviceManageAppMapper.xml @@ -288,7 +288,7 @@ AND T1.refund_device_id IS NULL ORDER BY T1.status_enum) UNION ALL - (SELECT CASE WHEN T1.category_enum = 4 THEN 6 ELSE 3 END AS advice_type, + (SELECT CASE WHEN T1.category_enum IN (4, 24) THEN 6 ELSE 3 END AS advice_type, T1.id AS request_id, T1.id || '-3' AS unique_key, T1.requester_id AS requester_id, diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/RequestFormManageAppMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/RequestFormManageAppMapper.xml index 4a284cbfc..78017106d 100755 --- a/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/RequestFormManageAppMapper.xml +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/regdoctorstation/RequestFormManageAppMapper.xml @@ -13,7 +13,17 @@ drf.requester_id, drf.create_time, ap.NAME AS patient_name, - drf.status + CASE MIN(wsr.status_enum) + WHEN 1 THEN 0 + WHEN 2 THEN 1 + WHEN 3 THEN 4 + WHEN 4 THEN 4 + WHEN 5 THEN 5 + WHEN 6 THEN 5 + WHEN 7 THEN 5 + WHEN 8 THEN 6 + ELSE NULL + END AS status FROM doc_request_form AS drf LEFT JOIN adm_encounter AS ae ON ae.ID = drf.encounter_id AND ae.delete_flag = '0' @@ -31,7 +41,17 @@ AND drf.create_time <= (#{endDate}::date + INTERVAL '1 day' - INTERVAL '1 second') - AND drf.status = #{status}::integer + AND CASE MIN(wsr.status_enum) + WHEN 1 THEN 0 + WHEN 2 THEN 1 + WHEN 3 THEN 4 + WHEN 4 THEN 4 + WHEN 5 THEN 5 + WHEN 6 THEN 5 + WHEN 7 THEN 5 + WHEN 8 THEN 6 + ELSE NULL + END = #{status}::integer AND (drf.prescription_no ILIKE '%' || #{keyword} || '%' diff --git a/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/infectiousDiseaseReportDialog.vue b/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/infectiousDiseaseReportDialog.vue index 71990e8d5..4015bbfae 100755 --- a/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/infectiousDiseaseReportDialog.vue +++ b/openhis-ui-vue3/src/views/doctorstation/components/diagnosis/infectiousDiseaseReportDialog.vue @@ -49,6 +49,40 @@ + + + + 性别 + + + + 未知 + + + + 出生日期 +
+ + + + + + +
+
+ + 或 实足年龄 +
+ + + + + + +
+
+
+ @@ -1992,4 +2026,53 @@ defineExpose({ show, showReport, close: handleClose }); display: flex !important; justify-content: center !important; } + +/* 性别单选按钮组 */ +.gender-radio-group { + display: flex; + gap: 12px; + padding-top: 4px; +} + +/* 出生日期输入组 */ +.birth-input-group { + display: flex; + align-items: center; + gap: 2px; +} + +.birth-input { + text-align: center; +} + +.birth-input.year { + width: 70px; +} + +.birth-input.month, +.birth-input.day { + width: 50px; +} + +.birth-separator { + color: #606266; + font-size: 13px; + margin: 0 2px; +} + +/* 年龄输入组 */ +.age-input-group { + display: flex; + align-items: center; + gap: 6px; +} + +.age-input { + width: 70px; + text-align: center; +} + +.age-unit-select { + width: 65px; +} diff --git a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/examineApplication.vue b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/examineApplication.vue index 1ad323bbe..4b3786e8e 100755 --- a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/examineApplication.vue +++ b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/applicationShow/examineApplication.vue @@ -92,45 +92,42 @@ @@ -203,15 +200,102 @@ 关闭 + + + + + + + + + +
+ +
+ + {{ reportData.patientName || reportRow?.patientName || '-' }} + {{ reportData.prescriptionNo || reportRow?.prescriptionNo || '-' }} + {{ reportData.name || reportRow?.name || '-' }} + {{ reportData.reportTime || '-' }} + {{ reportData.diagnosis || reportData.conclusion || '-' }} + + + +
+
报告内容
+
{{ reportData.content }}
+
+ + +
+
+ 影像预览 + + + 打开PACS影像 + +
+