fix: 健康管理系统,健康总览接口开发。
This commit is contained in:
@@ -19,10 +19,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="height" column="height" />
|
||||
<result property="weight" column="weight" />
|
||||
<result property="ranking" column="ranking" />
|
||||
<result property="sex" column="sex" />
|
||||
<result property="identityCard" column="identity_card" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectHealthPersonVo">
|
||||
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.birthday, a.nick_name, a.height, a.weight, a.ranking from health_person a
|
||||
select a.id, a.name,a.sex,a.identity_card, a.type, a.create_by, a.create_time, a.update_by, a.update_time, a.del_flag, a.remark, a.birthday, a.nick_name, a.height, a.weight, a.ranking from health_person a
|
||||
</sql>
|
||||
|
||||
<select id="selectHealthPersonList" parameterType="HealthPersonDto" resultMap="HealthPersonResult">
|
||||
@@ -60,6 +62,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="height != null">height,</if>
|
||||
<if test="weight != null">weight,</if>
|
||||
<if test="ranking != null">ranking,</if>
|
||||
<if test="sex != null and sex != ''">sex,</if>
|
||||
<if test="identityCard != null and identityCard != ''">identity_card,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
@@ -76,6 +80,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="height != null">#{height},</if>
|
||||
<if test="weight != null">#{weight},</if>
|
||||
<if test="ranking != null">#{ranking},</if>
|
||||
<if test="sex != null and sex != ''">#{sex},</if>
|
||||
<if test="identityCard != null and identityCard != ''">#{identityCard},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -95,6 +101,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="height != null">height = #{height},</if>
|
||||
<if test="weight != null">weight = #{weight},</if>
|
||||
<if test="ranking != null">ranking = #{ranking},</if>
|
||||
<if test="sex != null and sex != ''">sex = #{sex},</if>
|
||||
<if test="identityCard != null and identityCard != ''">identity_card = #{identityCard},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
<result property="personName" column="person_name" />
|
||||
<result property="healthRecordName" column="health_record_name" />
|
||||
<result property="useDays" column="useDays" />
|
||||
|
||||
<result property="count" column="count" />
|
||||
<result property="dosingTimeStr" column="dosingTimeStr" />
|
||||
</resultMap>
|
||||
<select id="selectMarRecordList" parameterType="HealthMarRecordDto" resultMap="HealthMarRecordResult">
|
||||
select
|
||||
@@ -112,4 +113,157 @@
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
<select id="selectMarTypeList" parameterType="HealthMarRecordDto" resultMap="HealthMarRecordResult">
|
||||
select
|
||||
hmr."type" ,
|
||||
count(hmr."type" ) as count
|
||||
from
|
||||
health_mar_record hmr
|
||||
<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."type"
|
||||
order by count(hmr."type" ) desc
|
||||
</select>
|
||||
|
||||
<select id="selectMarDayCountList" parameterType="HealthMarRecordDto" resultMap="HealthMarRecordResult">
|
||||
select
|
||||
to_char(hmr.dosing_time, 'yyyy-MM-dd') as dosingTimeStr,
|
||||
count(to_char(hmr.dosing_time, 'yyyy-MM-dd')) as count
|
||||
from
|
||||
health_mar_record hmr
|
||||
<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
|
||||
to_char(hmr.dosing_time, 'yyyy-MM-dd')
|
||||
order by to_char(hmr.dosing_time, 'yyyy-MM-dd')
|
||||
</select>
|
||||
|
||||
<select id="selectMarDayCount" parameterType="HealthRecordDto" resultType="int">
|
||||
select
|
||||
count(distinct to_char(hmr.dosing_time, 'yyyy-MM-dd') )
|
||||
from
|
||||
health_mar_record hmr
|
||||
where 1=1
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
<select id="selectFeverDayCount" parameterType="HealthRecordDto" resultType="int">
|
||||
select
|
||||
count(distinct to_char(hmr.measure_time, 'yyyy-MM-dd') )
|
||||
from
|
||||
health_temperature_record hmr
|
||||
where hmr.temperature>=37
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
<select id="selectStaticPersonList" parameterType="HealthRecordDto" resultType="com.ruoyi.health.domain.vo.HealthStaticPersonVo">
|
||||
select
|
||||
hp."name" as personName,
|
||||
(
|
||||
select
|
||||
count(*)
|
||||
from
|
||||
health_record hr
|
||||
where
|
||||
hr.person_id = hp.id
|
||||
and hr.del_flag = '0') as healthRecordCount,
|
||||
(
|
||||
select
|
||||
count(distinct hdr.hospital_name)
|
||||
from
|
||||
health_doctor_record hdr
|
||||
where
|
||||
hdr.person_id = hp.id
|
||||
and hdr.del_flag = '0') as hospitalCount,
|
||||
(
|
||||
select
|
||||
count(distinct hdr.doctor)
|
||||
from
|
||||
health_doctor_record hdr
|
||||
where
|
||||
hdr.person_id = hp.id
|
||||
and hdr.del_flag = '0') as doctorTotalCount,
|
||||
(
|
||||
select
|
||||
count(*)
|
||||
from
|
||||
health_doctor_record hdr
|
||||
where
|
||||
hdr.person_id = hp.id
|
||||
and hdr.del_flag = '0') as doctorCount,
|
||||
(
|
||||
select
|
||||
case when sum(hdr.total_cost) is null then 0
|
||||
else sum(hdr.total_cost)
|
||||
end
|
||||
from
|
||||
health_doctor_record hdr
|
||||
where
|
||||
hdr.person_id = hp.id
|
||||
and hdr.del_flag = '0') as doctorCost,
|
||||
(
|
||||
select
|
||||
count(distinct to_char(hmr.dosing_time, 'yyyy-MM-dd') )
|
||||
from
|
||||
health_mar_record hmr
|
||||
where
|
||||
hmr.person_id = hp.id
|
||||
and hmr.del_flag = '0') as marDayCount,
|
||||
(
|
||||
select
|
||||
count(*)
|
||||
from
|
||||
health_mar_record hmr
|
||||
where
|
||||
hmr.person_id = hp.id
|
||||
and hmr.del_flag = '0') as marCount,
|
||||
(
|
||||
select
|
||||
count(distinct hmr."medicine_id")
|
||||
from
|
||||
health_mar_record hmr
|
||||
where
|
||||
hmr.person_id = hp.id
|
||||
and hmr.del_flag = '0') as marTypeCount,
|
||||
|
||||
(
|
||||
select
|
||||
count(distinct to_char(hmr.measure_time, 'yyyy-MM-dd') )
|
||||
from
|
||||
health_temperature_record hmr
|
||||
where
|
||||
hmr.person_id = hp.id
|
||||
and hmr.temperature >= 37) as feverDayCount
|
||||
from
|
||||
health_person hp
|
||||
where 1=1
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user