fix: 健康管理系统,统计页面接口开发及功能完善。
This commit is contained in:
@@ -66,7 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="hospitalName != null and hospitalName != ''"> and a.hospital_name like '%'|| #{hospitalName}||'%'</if>
|
||||
<if test="departments != null and departments != ''"> and a.departments = #{departments}</if>
|
||||
<if test="doctor != null and doctor != ''"> and a.doctor = #{doctor}</if>
|
||||
<if test="healthRecordId != null and healthRecordId != ''"> and a.health_record_id = #{healthRecordId}</if>
|
||||
<if test="healthRecordId != null"> and a.health_record_id = #{healthRecordId}</if>
|
||||
<if test="visitingTime != null "> and a.visiting_time = #{visitingTime}</if>
|
||||
<if test="personId != null "> and a.person_id = #{personId}</if>
|
||||
<if test="type != null and type != ''"> and a.type = #{type}</if>
|
||||
|
||||
@@ -60,6 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="state != null and state != ''"> and a.state = #{state}</if>
|
||||
<if test="etiology != null and etiology != ''"> and a.etiology = #{etiology}</if>
|
||||
<if test="personId != null "> and a.person_id = #{personId}</if>
|
||||
<if test="healthRecordId != null "> and a.id = #{healthRecordId}</if>
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(a.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
|
||||
@@ -84,31 +84,64 @@
|
||||
order by hmb."short_name" desc
|
||||
</select>
|
||||
|
||||
<select id="selectHospitalCount" parameterType="HealthRecordDto" resultType="int">
|
||||
<select id="selectHospitalCount" parameterType="HealthMarRecordDto" resultType="int">
|
||||
select
|
||||
count(distinct hospital_name)
|
||||
from
|
||||
health_doctor_record hmr
|
||||
where 1=1
|
||||
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(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and to_char(hr.occur_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}
|
||||
</select>
|
||||
<select id="selectDoctorCount" parameterType="HealthRecordDto" resultType="int">
|
||||
<select id="selectDoctorCount" parameterType="HealthMarRecordDto" resultType="int">
|
||||
select
|
||||
count(distinct doctor )
|
||||
from
|
||||
health_doctor_record hmr
|
||||
where 1=1
|
||||
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(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and to_char(hr.occur_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}
|
||||
</select>
|
||||
|
||||
<select id="selectDistinctMedicalCount" parameterType="HealthRecordDto" resultType="int">
|
||||
<select id="selectDistinctMedicalCount" parameterType="HealthMarRecordDto" resultType="int">
|
||||
select
|
||||
count(distinct medicine_id )
|
||||
from
|
||||
health_mar_record hmr
|
||||
where 1=1
|
||||
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(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and to_char(hr.occur_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}
|
||||
</select>
|
||||
@@ -119,13 +152,14 @@
|
||||
count(hmr."type" ) as count
|
||||
from
|
||||
health_mar_record hmr
|
||||
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')
|
||||
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and to_char(hmr.dosing_time, 'yyyy-MM-dd')>=#{startTime}
|
||||
and to_char(hr.occur_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>
|
||||
@@ -143,13 +177,14 @@
|
||||
count(to_char(hmr.dosing_time, 'yyyy-MM-dd')) as count
|
||||
from
|
||||
health_mar_record hmr
|
||||
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')
|
||||
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and to_char(hmr.dosing_time, 'yyyy-MM-dd')>=#{startTime}
|
||||
and to_char(hr.occur_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>
|
||||
@@ -161,12 +196,23 @@
|
||||
order by to_char(hmr.dosing_time, 'yyyy-MM-dd')
|
||||
</select>
|
||||
|
||||
<select id="selectMarDayCount" parameterType="HealthRecordDto" resultType="int">
|
||||
<select id="selectMarDayCount" parameterType="HealthMarRecordDto" resultType="int">
|
||||
select
|
||||
count(distinct to_char(hmr.dosing_time, 'yyyy-MM-dd') )
|
||||
from
|
||||
health_mar_record hmr
|
||||
where 1=1
|
||||
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(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and to_char(hr.occur_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}
|
||||
</select>
|
||||
@@ -176,7 +222,18 @@
|
||||
count(distinct to_char(hmr.measure_time, 'yyyy-MM-dd') )
|
||||
from
|
||||
health_temperature_record hmr
|
||||
where hmr.temperature>=37
|
||||
left join health_record hr on hr.id=hmr.health_record_id
|
||||
<where>
|
||||
hmr.del_flag = '0' and hmr.temperature>=37
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and to_char(hr.occur_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}
|
||||
</select>
|
||||
@@ -266,4 +323,280 @@
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
<select id="selectHealthRecordCostList" parameterType="HealthRecordDto" resultType="com.ruoyi.health.domain.vo.HealthRecordVo">
|
||||
select
|
||||
(
|
||||
select
|
||||
case
|
||||
when sum(hdr.total_cost) is null then 0
|
||||
else sum(hdr.total_cost)
|
||||
end
|
||||
from
|
||||
health_doctor_record hdr
|
||||
where
|
||||
hdr.health_record_id = hr.id
|
||||
and hdr.del_flag = '0') as doctorCost,
|
||||
hr.id ,
|
||||
hr."name",
|
||||
hr.person_id
|
||||
from
|
||||
health_record hr
|
||||
<where>
|
||||
hr.del_flag = '0'
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime}
|
||||
</if>
|
||||
<if test="healthRecordId != null and healthRecordId != ''"> and hr.id = #{healthRecordId}</if>
|
||||
<if test="personId != null "> and hr.person_id = #{personId}</if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
order by hr.occur_time
|
||||
</select>
|
||||
|
||||
<select id="selectHealthRecordList" parameterType="HealthRecordDto" resultType="com.ruoyi.health.domain.vo.HealthRecordVo">
|
||||
select
|
||||
(
|
||||
select
|
||||
count(distinct hdr.hospital_name)
|
||||
from
|
||||
health_doctor_record hdr
|
||||
where
|
||||
hdr.health_record_id = hr.id
|
||||
and hdr.del_flag = '0') as hospitalCount,
|
||||
(
|
||||
select
|
||||
count(distinct hdr.doctor)
|
||||
from
|
||||
health_doctor_record hdr
|
||||
where
|
||||
hdr.health_record_id = hr.id
|
||||
and hdr.del_flag = '0') as doctorTotalCount,
|
||||
(
|
||||
select
|
||||
count(*)
|
||||
from
|
||||
health_doctor_record hdr
|
||||
where
|
||||
hdr.health_record_id = hr.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.health_record_id = hr.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.health_record_id = hr.id
|
||||
and hmr.del_flag = '0') as marDayCount,
|
||||
(
|
||||
select
|
||||
count(*)
|
||||
from
|
||||
health_mar_record hmr
|
||||
where
|
||||
hmr.health_record_id = hr.id
|
||||
and hmr.del_flag = '0') as marCount,
|
||||
(
|
||||
select
|
||||
count(*)
|
||||
from
|
||||
health_process_record hmr
|
||||
where
|
||||
hmr.health_record_id = hr.id
|
||||
and hmr.del_flag = '0') as processCount,
|
||||
(
|
||||
select
|
||||
count(distinct hmr."medicine_id")
|
||||
from
|
||||
health_mar_record hmr
|
||||
where
|
||||
hmr.health_record_id = hr.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.health_record_id = hr.id
|
||||
and hmr.temperature >= 37) as feverDayCount,
|
||||
hr.id ,
|
||||
hr."name",
|
||||
hr.occur_time as occurTime,
|
||||
hr.rehabilitation_time as rehabilitationTime,
|
||||
hr.person_id as personId
|
||||
from
|
||||
health_record hr
|
||||
|
||||
<where>
|
||||
hr.del_flag = '0'
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and #{endTime}>=to_char(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime}
|
||||
</if>
|
||||
<if test="healthRecordId != null and healthRecordId != ''"> and hr.id = #{healthRecordId}</if>
|
||||
<if test="personId != null "> and hr.person_id = #{personId}</if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
order by hr.occur_time desc
|
||||
</select>
|
||||
<select id="selectDoctorRecordList" parameterType="HealthDoctorRecordDto" resultType="com.ruoyi.health.domain.vo.HealthDoctorRecordVo">
|
||||
select
|
||||
hmr.id,
|
||||
hmr.health_record_id as healthRecordId,
|
||||
hmr.total_cost as totalCost
|
||||
from
|
||||
health_doctor_record hmr
|
||||
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(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and to_char(hr.occur_time, 'yyyy-MM-dd')>=#{startTime}
|
||||
</if>
|
||||
<if test="healthRecordId != null and healthRecordId != ''"> and hr.id = #{healthRecordId}</if>
|
||||
<if test="personId != null "> and hr.person_id = #{personId}</if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
</select>
|
||||
|
||||
<select id="selectMarCount" parameterType="HealthMarRecordDto" resultType="int">
|
||||
select
|
||||
count(*)
|
||||
from
|
||||
health_mar_record hmr
|
||||
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(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and to_char(hr.occur_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}
|
||||
</select>
|
||||
|
||||
<select id="selectProcessCount" parameterType="HealthMarRecordDto" resultType="int">
|
||||
select
|
||||
count(*)
|
||||
from
|
||||
health_process_record hmr
|
||||
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(hr.occur_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and to_char(hr.occur_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}
|
||||
</select>
|
||||
|
||||
<select id="selectHospitalStaticList" parameterType="HealthDoctorRecordDto" resultType="com.ruoyi.health.domain.vo.HealthDoctorRecordVo">
|
||||
select
|
||||
count(hmr.hospital_name) as count,
|
||||
hmr.hospital_name as hospitalName
|
||||
from
|
||||
health_doctor_record hmr
|
||||
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.visiting_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and to_char(hmr.visiting_time, 'yyyy-MM-dd')>=#{startTime}
|
||||
</if>
|
||||
<if test="healthRecordId != null"> and hmr.health_record_id = #{healthRecordId}</if>
|
||||
<if test="personId != null "> and hr.person_id = #{personId}</if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
group by hmr.hospital_name
|
||||
order by count(hmr.hospital_name) desc
|
||||
</select>
|
||||
|
||||
<select id="selectDoctorStaticList" parameterType="HealthDoctorRecordDto" resultType="com.ruoyi.health.domain.vo.HealthDoctorRecordVo">
|
||||
select
|
||||
count(hmr.doctor) as count,
|
||||
hmr.doctor,
|
||||
hmr.hospital_name as hospitalName
|
||||
from
|
||||
health_doctor_record hmr
|
||||
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.visiting_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and to_char(hmr.visiting_time, 'yyyy-MM-dd')>=#{startTime}
|
||||
</if>
|
||||
<if test="healthRecordId != null"> and hmr.health_record_id = #{healthRecordId}</if>
|
||||
<if test="personId != null "> and hr.person_id = #{personId}</if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
group by hmr.hospital_name,hmr.doctor
|
||||
order by count(hmr.doctor) desc
|
||||
</select>
|
||||
|
||||
<select id="selectDepartStaticList" parameterType="HealthDoctorRecordDto" resultType="com.ruoyi.health.domain.vo.HealthDoctorRecordVo">
|
||||
select
|
||||
count(hmr.departments) as count,
|
||||
hmr.departments as departments
|
||||
from
|
||||
health_doctor_record hmr
|
||||
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.visiting_time, 'yyyy-MM-dd')
|
||||
</if>
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and to_char(hmr.visiting_time, 'yyyy-MM-dd')>=#{startTime}
|
||||
</if>
|
||||
<if test="healthRecordId != null"> and hmr.health_record_id = #{healthRecordId}</if>
|
||||
<if test="personId != null "> and hr.person_id = #{personId}</if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
group by hmr.departments
|
||||
order by count(hmr.departments) desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user