fix: 自测问题修复,用药统计代码提交。
This commit is contained in:
@@ -3,6 +3,73 @@
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.health.mapper.StatisticAnalysisMapper">
|
||||
<resultMap type="HealthMarRecordVo" id="HealthMarRecordResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="type" column="type" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="healthRecordId" column="health_record_id" />
|
||||
<result property="dosingTime" column="dosing_time" />
|
||||
<result property="dosage" column="dosage" />
|
||||
<result property="personId" column="person_id" />
|
||||
<result property="resource" column="resource" />
|
||||
<result property="place" column="place" />
|
||||
<result property="medicineId" column="medicine_id" />
|
||||
<result property="unit" column="unit" />
|
||||
<result property="content" column="content" />
|
||||
<result property="contentUnit" column="content_unit" />
|
||||
<result property="personName" column="person_name" />
|
||||
<result property="healthRecordName" column="health_record_name" />
|
||||
|
||||
</resultMap>
|
||||
<select id="selectMarRecordList" parameterType="HealthMarRecordDto" resultMap="HealthMarRecordResult">
|
||||
select
|
||||
count(*) as count,
|
||||
sum(hmr.dosage) as dosage,
|
||||
hmr.medicine_id,
|
||||
hmb."short_name"||'-'||hmb."brand"||'('||hmb.packaging||')' as name,
|
||||
hmr.unit ,
|
||||
hmr.person_id ,
|
||||
hp."name" as person_name,
|
||||
hmr.health_record_id as health_record_id,
|
||||
hr."name" as health_record_name
|
||||
from
|
||||
health_mar_record hmr
|
||||
left join health_medicine_basic hmb on
|
||||
hmb.id = hmr.medicine_id
|
||||
left join health_person hp on
|
||||
hp.id = hmr.person_id
|
||||
left join health_record hr on
|
||||
hr.id = hmr.health_record_id
|
||||
<where>
|
||||
hmr.del_flag = '0'
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hmr.dosing_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and to_char(hmr.dosing_time, 'yyyy-MM-dd')>=#{startTime}
|
||||
</if>
|
||||
<if test="healthRecordId != null and healthRecordId != ''"> and hmr.health_record_id = #{healthRecordId}</if>
|
||||
<if test="personId != null "> and hmr.person_id = #{personId}</if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
group by
|
||||
hmr.medicine_id,
|
||||
hmb."short_name" ,
|
||||
hmr.person_id ,
|
||||
hp.name ,
|
||||
hmr.health_record_id,
|
||||
hr."name",
|
||||
hmr.unit ,
|
||||
hmb."brand",
|
||||
hmb.packaging
|
||||
order by hmb."short_name" desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user