当手术计费弹窗中点击"签发"耗材时,因耗材的locationId(发放库房)为空导致后端异常。 在DoctorStationAdviceAppServiceImpl.handDevice方法中,当locationId为null时,使用登录用户的科室ID作为默认值, 与NurseBillingAppService中的处理方式保持一致。
182 lines
6.5 KiB
XML
Executable File
182 lines
6.5 KiB
XML
Executable File
<?xml version="1.0" encoding="UTF-8" ?>
|
||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||
<mapper namespace="com.openhis.web.datadictionary.mapper.ActivityDefinitionManageMapper">
|
||
<!-- 优化后的分页查询:减少JOIN,使用索引友好的写法 -->
|
||
<select id="getDiseaseTreatmentPage" parameterType="java.util.Map"
|
||
resultType="com.openhis.web.datadictionary.dto.DiagnosisTreatmentDto">
|
||
|
||
SELECT
|
||
T1.id,
|
||
T1.category_code,
|
||
T1.bus_no,
|
||
T1.name,
|
||
T1.py_str,
|
||
T1.wb_str,
|
||
T1.type_enum,
|
||
T1.permitted_unit_code,
|
||
T1.org_id,
|
||
T1.location_id,
|
||
T1.yb_flag,
|
||
T1.yb_no,
|
||
T1.yb_match_flag,
|
||
T1.status_enum,
|
||
T1.body_site_code,
|
||
T1.specimen_code,
|
||
T1.description_text,
|
||
T1.rule_id,
|
||
T1.tenant_id,
|
||
T1.chrgitm_lv,
|
||
T1.children_json,
|
||
T1.pricing_flag,
|
||
T1.sort_order,
|
||
T1.service_range,
|
||
T1.inspection_type_id,
|
||
T1.fee_package_id,
|
||
T1.sub_item_id,
|
||
T2.type_code as item_type_code,
|
||
T2.yb_type,
|
||
T2.price_code,
|
||
T2.price as retail_price,
|
||
T4.amount as maximum_retail_price,
|
||
T3.name as test_type,
|
||
T5.package_name,
|
||
T6.name as sub_item_name
|
||
FROM wor_activity_definition T1
|
||
/* 只JOIN必要的价格表,使用INNER JOIN避免笛卡尔积 */
|
||
INNER JOIN adm_charge_item_definition T2
|
||
ON T1.id = T2.instance_id
|
||
AND T2.instance_table = 'wor_activity_definition'
|
||
/* 检验类型关联 */
|
||
LEFT JOIN inspection_type T3
|
||
ON T1.inspection_type_id = T3.id
|
||
AND T3.valid_flag = 1
|
||
/* 最高零售价使用LEFT JOIN,因为可能不存在 */
|
||
LEFT JOIN adm_charge_item_def_detail T4
|
||
ON T4.definition_id = T2.id
|
||
AND T4.condition_code = '4'
|
||
/* 费用套餐关联 */
|
||
LEFT JOIN inspection_basic_information T5
|
||
ON T1.fee_package_id = T5.basic_information_id
|
||
AND T5.del_flag = false
|
||
/* 下级医技类型关联(inspection_type 子类) */
|
||
LEFT JOIN inspection_type T6
|
||
ON T1.sub_item_id = T6.id
|
||
AND T6.valid_flag = 1
|
||
<where>
|
||
T1.delete_flag = '0'
|
||
<if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
|
||
<choose>
|
||
<when test="ew.customSqlSegment.contains('tenant_id')">
|
||
${ew.customSqlSegment.replaceFirst('tenant_id', 'T1.tenant_id').replaceFirst('status_enum', 'T1.status_enum').replaceFirst('WHERE', 'AND')}
|
||
</when>
|
||
<otherwise>
|
||
${ew.customSqlSegment.replaceFirst('status_enum', 'T1.status_enum').replaceFirst('WHERE', 'AND')}
|
||
</otherwise>
|
||
</choose>
|
||
</if>
|
||
</where>
|
||
ORDER BY T1.id DESC
|
||
</select>
|
||
|
||
<!-- 诊疗目录下拉列表(轻量级,只查4个字段,1个JOIN) -->
|
||
<select id="getDiagnosisTreatmentSimpleList" resultType="com.openhis.web.datadictionary.dto.DiagnosisTreatmentDto">
|
||
SELECT
|
||
T1.id,
|
||
T1.bus_no,
|
||
T1.name,
|
||
T1.permitted_unit_code,
|
||
T2.price as retail_price
|
||
FROM wor_activity_definition T1
|
||
INNER JOIN adm_charge_item_definition T2
|
||
ON T1.id = T2.instance_id
|
||
AND T2.instance_table = 'wor_activity_definition'
|
||
WHERE T1.delete_flag = '0'
|
||
AND T1.status_enum = #{statusEnum}
|
||
AND T1.tenant_id = #{tenantId}
|
||
<if test="searchKey != null and searchKey != ''">
|
||
AND (
|
||
T1.name LIKE '%' || #{searchKey} || '%'
|
||
OR T1.bus_no LIKE '%' || #{searchKey} || '%'
|
||
OR T1.py_str LIKE '%' || #{searchKey} || '%'
|
||
)
|
||
</if>
|
||
ORDER BY T1.id DESC
|
||
<if test="searchKey != null and searchKey != ''">
|
||
LIMIT 1500
|
||
</if>
|
||
<if test="searchKey == null or searchKey == ''">
|
||
LIMIT 500
|
||
</if>
|
||
</select>
|
||
|
||
<select id="getDiseaseTreatmentOne" resultType="com.openhis.web.datadictionary.dto.DiagnosisTreatmentDto">
|
||
SELECT
|
||
T1.id,
|
||
T1.category_code,
|
||
T1.bus_no,
|
||
T1.name,
|
||
T1.py_str,
|
||
T1.wb_str,
|
||
T1.type_enum,
|
||
T1.permitted_unit_code,
|
||
T1.org_id,
|
||
T1.location_id,
|
||
T1.yb_flag,
|
||
T1.yb_no,
|
||
T1.yb_match_flag,
|
||
T1.status_enum,
|
||
T1.body_site_code,
|
||
T1.specimen_code,
|
||
T1.description_text,
|
||
T1.rule_id,
|
||
T1.tenant_id,
|
||
T2.type_code as item_type_code,
|
||
T2.yb_type,
|
||
T2.price_code,
|
||
T2.price as retail_price,
|
||
(
|
||
SELECT T4.amount
|
||
FROM adm_charge_item_definition T5
|
||
LEFT JOIN adm_charge_item_def_detail T4 ON T4.definition_id = T5.id
|
||
WHERE T4.condition_code = '4'
|
||
AND T5.instance_id = T1.id
|
||
AND T5.instance_table = 'wor_activity_definition'
|
||
) as maximum_retail_price,
|
||
T1.chrgitm_lv,
|
||
T1.children_json,
|
||
T1.pricing_flag,
|
||
T1.sort_order,
|
||
T1.service_range,
|
||
T1.inspection_type_id,
|
||
T1.fee_package_id,
|
||
T1.sub_item_id,
|
||
T3.name as test_type,
|
||
T6.package_name,
|
||
T7.name as sub_item_name
|
||
FROM wor_activity_definition T1
|
||
LEFT JOIN adm_charge_item_definition T2 ON T1.id = T2.instance_id
|
||
/* 检验类型关联 */
|
||
LEFT JOIN inspection_type T3 ON T1.inspection_type_id = T3.id AND T3.valid_flag = 1
|
||
/* 费用套餐关联 */
|
||
LEFT JOIN inspection_basic_information T6
|
||
ON T1.fee_package_id = T6.basic_information_id
|
||
AND T6.del_flag = false
|
||
/* 下级医技类型关联(inspection_type 子类) */
|
||
LEFT JOIN inspection_type T7
|
||
ON T1.sub_item_id = T7.id
|
||
AND T7.valid_flag = 1
|
||
<where>
|
||
T1.delete_flag = '0'
|
||
AND T2.instance_table = 'wor_activity_definition'
|
||
|
||
<if test="id!= null">
|
||
AND T1.id = #{id}
|
||
</if>
|
||
<if test="tenantId!= null">
|
||
AND T1.tenant_id = #{tenantId}
|
||
</if>
|
||
</where>
|
||
</select>
|
||
|
||
</mapper>
|