Files
pasd_java/pasd-healthcare/target/classes/com/ruoyi/os/mapper/DrugArchivesVoMapper.xml

114 lines
6.9 KiB
XML
Raw Permalink Normal View History

2025-07-28 14:58:32 +08:00
<?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.ruoyi.os.mapper.DrugArchivesVoMapper">
<resultMap type="DrugArchivesVO" id="drugInventoryListResult">
<!-- 药品 档案 -->
<result property="archiveId" column="da_id" />
<!-- 商品名称 -->
<result property="medicineName" column="da_medicine_name" />
<!-- 生产厂家 -->
<result property="manufacturer" column="da_manufacturer" />
<!-- 商品条码 -->
<result property="barcode" column="da_barcode" />
<!-- 商品规格 -->
<result property="specification" column="da_specification" />
<!-- 零售价 -->
<result property="retailPrice" column="da_retail_price" />
<!-- 是否允许拆分 -->
<result property="isSplit" column="da_is_split" />
<!-- 用于判断是否为固态或者液态用0,1表示 -->
<result property="state" column="da_state" />
<!-- 剂量(成分含量) -->
<result property="dosageForm" column="da_dosage_form" />
<!-- 剂量单位 -->
<result property="dosageUnit" column="da_dosage_unit" />
<!-- 容量 -->
<result property="volume" column="da_volume" />
<!-- 容量单位 -->
<result property="volumeUnit" column="da_volume_unit" />
<!-- 最小包装数量 -->
<result property="unitQuantity" column="da_unit_quantity" />
<!-- 最小包装单位 -->
<result property="splitUnit" column="da_split_unit" />
<!-- 包装单位 -->
<result property="packageUnit" column="da_package_unit" />
<!-- 最小单位数量 -->
<result property="minNumber" column="da_min_number" />
<!-- 药品 批次 库存 -->
<result property="filingId" column="df_id" />
<!-- 药品编号 -->
<result property="medicineCode" column="df_medicineCode" />
<!-- 批次 -->
<result property="batch" column="df_batch" />
<!-- 有效期至 -->
<result property="expiryDate" column="df_expiryDate" />
<!-- 盒数 -->
<result property="boxCount" column="df_box_count" />
<!-- 包数 -->
<result property="packCount" column="df_pack_count" />
<!-- 零售价 -->
<result property="filingRetailPrice" column="df_retail_price" />
<!-- 最小单位价格 -->
<result property="minNumberRetailPrice" column="df_min_price" />
<!-- 入库点 名称 -->
<result property="entryPoint" column="is_storeroom_name" />
</resultMap>
<!-- 药品 库存 -->
<sql id="selectHealthcareDrugFilingVo">
healthcare_drug_filing.id df_id , healthcare_drug_filing.archive_id df_archive_id , healthcare_drug_filing.storeroom_id df_storeroom_id , healthcare_drug_filing.medicineCode df_medicineCode ,
healthcare_drug_filing.batch df_batch , healthcare_drug_filing.expiryDate df_expiryDate , healthcare_drug_filing.box_count df_box_count ,
healthcare_drug_filing.inventoryUnit df_inventoryUnit , healthcare_drug_filing.pack_count df_pack_count , healthcare_drug_filing.retail_price df_retail_price ,
healthcare_drug_filing.min_price df_min_price , healthcare_drug_filing.create_time df_create_time ,
healthcare_drug_filing.create_by df_create_by , healthcare_drug_filing.update_by df_update_by , healthcare_drug_filing.update_time df_update_time ,
healthcare_drug_filing.remark df_remark
</sql>
<!-- 药品 档案 -->
<sql id="selectHealthcareDrugArchiveVo">
healthcare_drug_archive.id da_id , healthcare_drug_archive.medicine_name da_medicine_name , healthcare_drug_archive.manufacturer da_manufacturer ,
healthcare_drug_archive.barcode da_barcode , healthcare_drug_archive.specification da_specification , healthcare_drug_archive.retail_price da_retail_price ,
healthcare_drug_archive.is_split da_is_split , healthcare_drug_archive.min_number da_min_number , healthcare_drug_archive.state da_state ,
healthcare_drug_archive.dosage_form da_dosage_form , healthcare_drug_archive.dosage_unit da_dosage_unit , healthcare_drug_archive.volume da_volume ,
healthcare_drug_archive.volume_unit da_volume_unit , healthcare_drug_archive.unit_quantity da_unit_quantity , healthcare_drug_archive.split_unit da_split_unit ,
healthcare_drug_archive.package_unit da_package_unit , healthcare_drug_archive.create_time da_create_time , healthcare_drug_archive.create_by da_create_by ,
healthcare_drug_archive.update_by da_update_by , healthcare_drug_archive.update_time da_update_time , healthcare_drug_archive.remark da_remark
</sql>
<!-- 库房 -->
<sql id="selectHealthcareInventoryStoreroomVo">
healthcare_inventory_storeroom.id is_id , healthcare_inventory_storeroom.storeroom_name is_storeroom_name , healthcare_inventory_storeroom.location is_location ,
healthcare_inventory_storeroom.admin_userid is_admin_userid ,healthcare_inventory_storeroom.remarks is_remarks , healthcare_inventory_storeroom.created_at is_created_at ,
healthcare_inventory_storeroom.updated_at is_updated_at
</sql>
<!-- -->
<select id="selectDruyInventoryList" parameterType="DrugArchivesVO" resultMap="drugInventoryListResult">
select
<include refid="selectHealthcareDrugFilingVo"/>
,
<include refid="selectHealthcareDrugArchiveVo"/>
,
<include refid="selectHealthcareInventoryStoreroomVo"/>
,
<if test="currentTime != null">
TIMESTAMPDIFF(MINUTE, #{currentTime}, expiryDate) AS time_diff_minutes
</if>
from healthcare_drug_filing
left join healthcare_drug_archive
on healthcare_drug_archive.id = healthcare_drug_filing.archive_id
left join healthcare_inventory_storeroom
on healthcare_inventory_storeroom.id = healthcare_drug_filing.storeroom_id
<where>
<if test="medicineName != null and medicineName != ''"> and healthcare_drug_archive.medicine_name like concat('%', #{medicineName}, '%')</if>
<if test="barcode != null and barcode != ''"> and healthcare_drug_archive.barcode like concat('%', #{barcode}, '%')</if>
<if test="batch != null and batch != ''"> and healthcare_drug_filing.batch = #{batch}</if>
<if test="storeroomId != null " >and healthcare_drug_filing.storeroom_id = #{storeroomId}</if>
</where>
ORDER BY
time_diff_minutes ASC
</select>
</mapper>