<?xml version="1.0" encoding="UTF-8" ?>
|
<!DOCTYPE mapper
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.ruoyi.project.mapper.ServiceTotalsMapper">
|
|
<select id="caseTrend" parameterType="com.ruoyi.project.domain.ServiceTotals"
|
resultType="ServiceTotals">
|
SELECT DATE_FORMAT(a.ReportTime, '%Y-%m') donateTime, residencecountyname area, COUNT(*) potentialCount,COUNT(IF(complete_state=3, true, null)) completeCount FROM service_donatebaseinfo_report a
|
LEFT JOIN service_donatecompletioninfo b ON b.InfoID=a.id and a.del_flag=0 and b.del_flag=0
|
<where>
|
<if test="area != null and area != ''">and residencecountyname>=#{area}</if>
|
<if test="startTime != null and startTime != ''">and a.ReportTime>=#{startTime}</if>
|
<if test="endTime != null and endTime != ''">and a.ReportTime <= #{endTime}</if>
|
</where>
|
GROUP BY residencecountyname, DATE_FORMAT(a.ReportTime, '%Y-%m')
|
</select>
|
|
<select id="caseTrendMoon" parameterType="com.ruoyi.project.domain.ServiceTotals"
|
resultType="ServiceTotals">
|
SELECT DATE_FORMAT(a.ReportTime, '%Y-%m') donateTime, COUNT(*) potentialCount,COUNT(IF(complete_state=3, true, null)) completeCount FROM service_donatebaseinfo a
|
LEFT JOIN service_donatecompletioninfo b ON b.InfoID=a.id and a.del_flag=0 and b.del_flag=0
|
<where>
|
<if test="area != null and area != ''">and residencecountyname>=#{area}</if>
|
<if test="startTime != null and startTime != ''">and a.ReportTime>=#{startTime}</if>
|
<if test="endTime != null and endTime != ''">and a.ReportTime <= #{endTime}</if>
|
</where>
|
GROUP BY DATE_FORMAT(a.ReportTime, '%Y-%m')
|
</select>
|
|
<select id="caseTrendArea" parameterType="com.ruoyi.project.domain.ServiceTotals"
|
resultType="ServiceTotals">
|
SELECT residencecountyname area, COUNT(*) potentialCount,COUNT(IF(complete_state=3, true, null)) completeCount FROM service_donatebaseinfo a
|
LEFT JOIN service_donatecompletioninfo b ON b.InfoID=a.id and a.del_flag=0 and b.del_flag=0
|
<where>
|
<if test="area != null and area != ''">and residencecountyname>=#{area}</if>
|
<if test="startTime != null and startTime != ''">and a.ReportTime>=#{startTime}</if>
|
<if test="endTime != null and endTime != ''">and a.ReportTime <= #{endTime}</if>
|
</where>
|
GROUP BY residencecountyname
|
</select>
|
|
<select id="organ" parameterType="com.ruoyi.project.domain.ServiceTotals"
|
resultType="ServiceTotals">
|
SELECT DATE_FORMAT(a.OrganGetTime, '%Y-%m') donateTime,a.OrganName organName, COUNT(*) getCount,
|
COUNT(IF(transplantstate=3, true, NULL)) useCount FROM service_donationwitnessorgan a
|
LEFT JOIN service_donatecomporgan b ON a.InfoID=b.InfoID AND a.OrganName=b.OrganName and a.del_flag=0 and b.del_flag=0
|
<where>
|
<if test="area != null and area != ''">
|
and a.InfoID in (select id FROM service_donatecompletioninfo where RegisterCountyName>=#{area} )
|
</if>
|
<if test="organName != null and organName != ''">and a.OrganName>=#{organName}</if>
|
<if test="startTime != null and startTime != ''">and a.OrganGetTime>=#{startTime}</if>
|
<if test="endTime != null and endTime != ''">and a.OrganGetTime <= #{endTime}</if>
|
</where>
|
GROUP BY DATE_FORMAT(a.OrganGetTime, '%Y-%m'),a.OrganName
|
</select>
|
|
<select id="organMoon" parameterType="com.ruoyi.project.domain.ServiceTotals"
|
resultType="ServiceTotals">
|
SELECT DATE_FORMAT(a.OrganGetTime, '%Y-%m') donateTime, COUNT(*) getCount,
|
COUNT(IF(transplantstate=3, true, NULL)) useCount FROM service_donationwitnessorgan a
|
LEFT JOIN service_donatecomporgan b ON a.InfoID=b.InfoID AND a.OrganName=b.OrganName and a.del_flag=0 and b.del_flag=0
|
<where>
|
<if test="area != null and area != ''">
|
and a.InfoID in (select id FROM service_donatecompletioninfo where RegisterCountyName>=#{area} )
|
</if>
|
<if test="organName != null and organName != ''">and a.OrganName>=#{organName}</if>
|
<if test="startTime != null and startTime != ''">and a.OrganGetTime>=#{startTime}</if>
|
<if test="endTime != null and endTime != ''">and a.OrganGetTime <= #{endTime}</if>
|
</where>
|
GROUP BY DATE_FORMAT(a.OrganGetTime, '%Y-%m')
|
</select>
|
|
<select id="organType" parameterType="com.ruoyi.project.domain.ServiceTotals"
|
resultType="ServiceTotals">
|
SELECT a.OrganName organName, COUNT(*) getCount,
|
COUNT(IF(transplantstate=3, true, NULL)) useCount FROM service_donationwitnessorgan a
|
LEFT JOIN service_donatecomporgan b ON a.InfoID=b.InfoID AND a.OrganName=b.OrganName and a.del_flag=0 and b.del_flag=0
|
<where>
|
<if test="area != null and area != ''">
|
and a.InfoID in (select id FROM service_donatecompletioninfo where RegisterCountyName>=#{area} )
|
</if>
|
<if test="organName != null and organName != ''">and a.OrganName>=#{organName}</if>
|
<if test="startTime != null and startTime != ''">and a.OrganGetTime>=#{startTime}</if>
|
<if test="endTime != null and endTime != ''">and a.OrganGetTime <= #{endTime}</if>
|
</where>
|
GROUP BY a.OrganName
|
</select>
|
|
<select id="caseSex" parameterType="com.ruoyi.project.domain.ServiceTotals"
|
resultType="ServiceTotals">
|
SELECT COUNT(sex) totalCount, COUNT(IF(sex=1, true, NULL)) manCount ,COUNT(IF(sex=2, true, NULL)) womanCount
|
FROM service_donatebaseinfo
|
<where>
|
<if test="area != null and area != ''">
|
and RegisterCountyName>=#{area}
|
</if>
|
<if test="bloodType != null and bloodType != ''">
|
and BloodType>=#{bloodType}
|
</if>
|
<if test="sex != null and sex != ''">
|
and sex>=#{sex}
|
</if>
|
<if test="ageGroup != null and ageGroup != ''">
|
and ${ageGroup}
|
</if>
|
<if test="startTime != null and startTime != ''">and a.donatetime>=#{startTime}</if>
|
<if test="endTime != null and endTime != ''">and a.donatetime <= #{endTime}</if>
|
</where>
|
GROUP BY sex
|
</select>
|
|
<select id="caseAvgAge" parameterType="com.ruoyi.project.domain.ServiceTotals"
|
resultType="ServiceTotals">
|
SELECT AVG(age) avgAge FROM service_donatebaseinfo
|
<where>
|
<if test="area != null and area != ''">
|
and RegisterCountyName>=#{area}
|
</if>
|
<if test="bloodType != null and bloodType != ''">
|
and BloodType>=#{bloodType}
|
</if>
|
<if test="sex != null and sex != ''">
|
and sex>=#{sex}
|
</if>
|
<if test="ageGroup != null and ageGroup != ''">
|
and ${ageGroup}
|
</if>
|
<if test="startTime != null and startTime != ''">and a.donatetime>=#{startTime}</if>
|
<if test="endTime != null and endTime != ''">and a.donatetime <= #{endTime}</if>
|
</where>
|
</select>
|
|
<select id="caseBloodType" parameterType="com.ruoyi.project.domain.ServiceTotals"
|
resultType="ServiceTotals">
|
SELECT COUNT(BloodType) boodTypeCount,BloodType bloodType
|
FROM service_donatebaseinfo
|
<where>
|
<if test="area != null and area != ''">
|
and RegisterCountyName>=#{area}
|
</if>
|
<if test="bloodType != null and bloodType != ''">
|
and BloodType>=#{bloodType}
|
</if>
|
<if test="sex != null and sex != ''">
|
and sex>=#{sex}
|
</if>
|
<if test="ageGroup != null and ageGroup != ''">
|
and ${ageGroup}
|
</if>
|
<if test="startTime != null and startTime != ''">and a.donatetime>=#{startTime}</if>
|
<if test="endTime != null and endTime != ''">and a.donatetime <= #{endTime}</if>
|
</where>
|
GROUP BY BloodType
|
</select>
|
|
</mapper>
|