fix: 健康管理系统,健康总览接口开发。

This commit is contained in:
tianyongbao
2024-12-18 16:11:17 +08:00
parent 49ba22aab4
commit c63515d274
7 changed files with 365 additions and 140 deletions

View File

@@ -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>