fix: 药品实时库存,代码提交。

This commit is contained in:
tianyongbao
2024-10-22 20:28:52 +08:00
parent bf5efee7b5
commit 29a63f9966
6 changed files with 119 additions and 48 deletions

View File

@@ -32,34 +32,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectHealthMarRecordVo">
select
a.id,
a.name,
a.type,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.del_flag,
a.remark,
a.health_record_id,
a.dosing_time,
a.dosage,
a.person_id,
a.resource,
a.place,
a.place,
a.medicine_id,
a.unit,
a.content,
a.content_unit,
hp."name" as person_name ,
hr."name" as health_record_name
a.id,
a.type,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.del_flag,
a.remark,
a.health_record_id,
a.dosing_time,
a.dosage,
a.person_id,
a.resource,
a.place,
a.place,
a.medicine_id,
a.unit,
a.content,
a.content_unit,
hp."name" as person_name ,
hr."name" as health_record_name,
hmb.short_name || '-' || hmb.brand || '(' || hmb.packaging || ')' as name
from
health_mar_record a
left join health_person hp on
hp.id = a.person_id
left join health_record hr on
hr.id = a.health_record_id
health_mar_record a
left join health_person hp on
hp.id = a.person_id
left join health_record hr on
hr.id = a.health_record_id
left join health_medicine_basic hmb on
hmb.id = a.medicine_id
</sql>
<select id="selectHealthMarRecordList" parameterType="HealthMarRecordDto" resultMap="HealthMarRecordResult">

View File

@@ -56,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.purchase_address,
a.unit,
a.total_price,
hmb."name" as medicine_name,
hmb.short_name || '-' || hmb.brand || '(' || hmb.packaging || ')' as medicine_name,
a.package_unit,
a.total_count
from
@@ -173,7 +173,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="ageWeight != null">age_weight = #{ageWeight},</if>
<if test="unit != null">unit = #{unit},</if>
<if test="packageUnit != null">package_unit = #{packageUnit},</if>
<if test="totalCount != null">total_count = #{packageUnit},</if>
<if test="totalCount != null">total_count = #{totalCount},</if>
</trim>
where id = #{id}
</update>
@@ -198,4 +198,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</update>
<select id="selectHealthMedicineRealtimeList" parameterType="HealthMedicineStockInDto" resultMap="HealthMedicineStockInResult">
select
a.medicine_id,
sum(a.left_count) as left_count,
sum(a.total_count) as total_count,
a.unit,
hmb.short_name || '-' || hmb.brand || '(' || hmb.packaging || ')' as medicine_name
from
health_medicine_stock_in a
left join health_medicine_basic hmb on
hmb.id = a.medicine_id
<where>
a.del_flag='0'
and a.left_count>0
<if test="medicineId != null "> and a.medicine_id = #{medicineId}</if>
</where>
<!-- 数据范围过滤 -->
${params.dataScope}
group by
a.medicine_id,
a.left_count,
a.unit,
hmb.short_name,
a.package_unit,
hmb.brand,
hmb.packaging,
a.total_count
</select>
</mapper>