diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationAdviceAppService.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationAdviceAppService.java index 5d110c65..9a1201dd 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationAdviceAppService.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationAdviceAppService.java @@ -116,4 +116,12 @@ public interface IDoctorStationAdviceAppService { * @return 检查url相关参数 */ R getTestResult(Long encounterId); + + /** + * 获取当前科室已配置的药品类别列表 + * + * @param organizationId 科室id + * @return 已配置的药品类别编码列表 + */ + R getConfiguredCategories(Long organizationId); } 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 f2769e23..79e6ea93 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 @@ -155,6 +155,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp String safePricingFlag = pricingFlag != null ? pricingFlag.toString() : ""; String safePageNo = pageNo != null ? pageNo.toString() : ""; String safePageSize = pageSize != null ? pageSize.toString() : ""; + String safeCategoryCode = categoryCode != null ? categoryCode : ""; // 设置默认科室:仅当前端/调用方未传 organizationId 时才回退到登录人科室 // 否则会导致门诊划价等场景(按患者挂号科室查询)返回空 @@ -169,7 +170,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp String cacheKey = null; if (useCache) { // 生成缓存 key:无搜索关键字时按科室缓存 - cacheKey = ADVICE_BASE_INFO_CACHE_PREFIX + organizationId + ":" + safeAdviceTypesStr + ":" + safePageNo + ":" + safePageSize; + cacheKey = ADVICE_BASE_INFO_CACHE_PREFIX + organizationId + ":" + safeAdviceTypesStr + ":" + safeCategoryCode + ":" + safePageNo + ":" + safePageSize; // 先清除可能存在的无效缓存(JSONObject类型) if (redisCache.hasKey(cacheKey)) { @@ -281,6 +282,8 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp } String unitCode = ""; // 包装单位 Long chargeItemDefinitionId; // 费用定价主表ID + // 检查是否有取药科室配置(用于药品类型) + boolean hasPharmacyConfig = medLocationConfig != null && !medLocationConfig.isEmpty(); for (AdviceBaseDto baseDto : adviceBaseDtoList) { String tableName = baseDto.getAdviceTableName(); if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(tableName)) { // 药品 @@ -289,6 +292,9 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp .setSkinTestFlag_enumText(EnumUtils.getInfoByValue(Whether.class, baseDto.getSkinTestFlag())); // 是否为注射药物 baseDto.setInjectFlag_enumText(EnumUtils.getInfoByValue(Whether.class, baseDto.getInjectFlag())); + + // 设置是否缺少取药科室配置标志 + baseDto.setPharmacyConfigMissing(!hasPharmacyConfig); // fallthrough to 耗材处理逻辑(保持原有逻辑) // 每一条医嘱的库存集合信息 , 包装单位库存前端计算 @@ -2148,4 +2154,23 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp return searchKey.matches("[a-zA-Z]+"); } + /** + * 获取当前科室已配置的药品类别列表 + * + * @param organizationId 科室id + * @return 已配置的药品类别编码列表 + */ + @Override + public R getConfiguredCategories(Long organizationId) { + // 查询取药科室配置 + List medLocationConfig = doctorStationAdviceAppMapper.getMedLocationConfig(organizationId); + // 提取不重复的 categoryCode + List categoryCodes = medLocationConfig.stream() + .map(AdviceInventoryDto::getCategoryCode) + .filter(code -> code != null && !code.isEmpty()) + .distinct() + .collect(Collectors.toList()); + return R.ok(categoryCodes); + } + } 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 66bfaf6d..6d39727c 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 @@ -50,9 +50,10 @@ public class DoctorStationAdviceController { @RequestParam(value = "organizationId", required = false) Long organizationId, @RequestParam(value = "adviceTypes", defaultValue = "1,2,3") List adviceTypes, @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, + @RequestParam(value = "categoryCode", required = false) String categoryCode) { return R.ok(iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, searchKey, locationId, - adviceDefinitionIdParamList, organizationId, pageNo, pageSize, Whether.NO.getValue(), adviceTypes, null, null)); + adviceDefinitionIdParamList, organizationId, pageNo, pageSize, Whether.NO.getValue(), adviceTypes, null, categoryCode)); } /** @@ -186,4 +187,15 @@ public class DoctorStationAdviceController { return iDoctorStationAdviceAppService.getTestResult(encounterId); } + /** + * 获取当前科室已配置的药品类别列表 + * + * @param organizationId 科室id + * @return 已配置的药品类别编码列表 + */ + @GetMapping(value = "/configured-categories") + public R getConfiguredCategories(@RequestParam(value = "organizationId", required = false) Long organizationId) { + return iDoctorStationAdviceAppService.getConfiguredCategories(organizationId); + } + } diff --git a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceBaseDto.java b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceBaseDto.java index 3befa8fb..0d548de3 100644 --- a/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceBaseDto.java +++ b/openhis-server-new/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceBaseDto.java @@ -242,4 +242,9 @@ public class AdviceBaseDto { @Dict(dictCode = "chrgitm_lv") private String chrgitmLv; private String chrgitmLv_dictText; + + /** + * 是否缺少取药科室配置(仅药品类型使用) + */ + private Boolean pharmacyConfigMissing; } diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationAdviceAppMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationAdviceAppMapper.xml index 2de84415..046bf10e 100644 --- a/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationAdviceAppMapper.xml +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationAdviceAppMapper.xml @@ -46,7 +46,7 @@ abi.chrgitm_lv FROM ( - + (SELECT @@ -95,14 +95,29 @@ AND T2.delete_flag = '0' AND T2.status_enum = #{statusEnum} LEFT JOIN adm_supplier AS T3 ON T3.ID = t1.supply_id AND T3.delete_flag = '0' LEFT JOIN adm_charge_item_definition AS T5 ON T5.instance_id = t1.ID AND T5.delete_flag = '0' AND T5.status_enum = #{statusEnum} - LEFT JOIN adm_organization_location AS T6 ON T6.distribution_category_code = t1.category_code AND T6.delete_flag = '0' AND T6.item_code = '1' AND T6.organization_id = #{organizationId} AND (CURRENT_TIME :: time (6) BETWEEN T6.start_time AND T6.end_time) + INNER JOIN adm_organization_location AS T6 ON T6.distribution_category_code = t1.category_code AND T6.delete_flag = '0' AND T6.item_code = '1' AND T6.organization_id = #{organizationId} AND (CURRENT_TIME :: time (6) BETWEEN T6.start_time AND T6.end_time) WHERE t1.delete_flag = '0' AND T2.status_enum = #{statusEnum} AND 1 = 2 - AND t1.category_code = #{categoryCode} + + + + AND ( + -- 方式1:直接匹配 + t1.category_code = #{categoryCode} + OR + -- 方式2:通过字典转换匹配(当 distribution_category_code 存储的是中文时) + EXISTS ( + SELECT 1 FROM sys_dict_data sdd + WHERE sdd.dict_type = 'med_category_code' + AND sdd.status = '0' + AND sdd.dict_label = T6.distribution_category_code + AND sdd.dict_value = #{categoryCode} + ) + ) AND (t1.name ILIKE '%' || #{searchKey} || '%' OR t1.py_str ILIKE '%' || #{searchKey} || '%') @@ -185,11 +200,15 @@ UNION ALL - + (SELECT DISTINCT ON (T1.ID) T1.tenant_id, - 3 AS advice_type, + + CASE T1.category_code WHEN '手术' THEN 6 WHEN '24' THEN 6 ELSE 3 END + 6 + 3 + AS advice_type, T1.bus_no AS bus_no, T1.category_code AS category_code, '' AS pharmacology_category_code, @@ -213,7 +232,7 @@ WHEN '检验' THEN 1 WHEN '检查' THEN 2 WHEN '护理' THEN 3 - WHEN '手术' THEN 4 + WHEN '手术' THEN 4 WHEN '24' THEN 4 WHEN '其他' THEN 5 ELSE 0 END AS activity_type, @@ -250,6 +269,14 @@ AND (t1.pricing_flag = #{pricingFlag} OR t1.pricing_flag IS NULL) + + + AND (T1.category_code = '手术' OR T1.category_code = '24') + + + + AND T1.category_code != '手术' AND T1.category_code != '24' + AND (t1.name ILIKE '%' || #{searchKey} || '%' OR t1.py_str ILIKE '%' || #{searchKey} || '%') @@ -263,7 +290,7 @@ - + SELECT mmd.tenant_id, CAST(0 AS INTEGER) AS advice_type, diff --git a/openhis-server-new/openhis-application/src/main/resources/mapper/inpatientmanage/NursingRecordAppMapper.xml b/openhis-server-new/openhis-application/src/main/resources/mapper/inpatientmanage/NursingRecordAppMapper.xml index b0bfcd12..20975b02 100644 --- a/openhis-server-new/openhis-application/src/main/resources/mapper/inpatientmanage/NursingRecordAppMapper.xml +++ b/openhis-server-new/openhis-application/src/main/resources/mapper/inpatientmanage/NursingRecordAppMapper.xml @@ -27,6 +27,7 @@ T2.start_time AS admissionDate, --入院日期 T3.ward_admission_date AS wardAdmissionDate, --入科日期 T3.location_id AS ward_location_id, --病区 + T3.ward_admission_date AS wardAdmissionDate, --病区入院日期 T4.location_id AS bed_location_id --床号 FROM adm_patient AS T1 INNER JOIN adm_encounter AS T2 diff --git a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/adviceBaseList.vue b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/adviceBaseList.vue index 2b568c0b..a1ec01ab 100644 --- a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/adviceBaseList.vue +++ b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/adviceBaseList.vue @@ -23,26 +23,20 @@ @@ -234,8 +216,4 @@ defineExpose({ outline: 2px solid #409eff; } } - -.popover-table-wrapper:focus { - outline: 2px solid #409eff; -} diff --git a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/api.js b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/api.js index daf3b7a3..758595de 100644 --- a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/api.js +++ b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/api.js @@ -170,6 +170,22 @@ export function getAdviceBaseInfo(queryParams) { }); } +/** + * 获取当前科室已配置的药品类别列表 + */ +export function getConfiguredCategories(organizationId) { + // organizationId 为空时不发送该参数,避免后端 Long 类型转换 400 错误 + const params = {}; + if (organizationId !== undefined && organizationId !== null && organizationId !== '') { + params.organizationId = organizationId; + } + return request({ + url: '/doctor-station/advice/configured-categories', + method: 'get', + params: params, + }); +} + /** * 保存处方(单条) */ diff --git a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/index.vue b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/index.vue index b0d09dd7..b429bb5f 100644 --- a/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/index.vue +++ b/openhis-ui-vue3/src/views/inpatientDoctor/home/components/order/index.vue @@ -145,28 +145,40 @@