sinake
2026-09-18 c9d33a3083bf4a226e736a447ce920a665409a06
ruoyi-project/src/main/resources/mapper/project/ServiceTotalsMapper.xml
@@ -7,8 +7,9 @@
    <select id="caseTrend" parameterType="com.ruoyi.project.domain.ServiceTotals"
            resultType="ServiceTotalsTrend">
        SELECT DATE_FORMAT(a.donatetime, '%Y-%m') donateTime, RegisterCountyName 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 where a.del_flag=0
        LEFT JOIN  service_donatecompletioninfo  b ON b.InfoID=a.id
        <where>
            a.del_flag=0
            <if test="area != null  and area != ''">and a.RegisterCountyName>=#{area}</if>
            <if test="startTime != null  and startTime != ''">and a.donatetime>=#{startTime}</if>
            <if test="endTime != null  and endTime != ''">and a.donatetime &lt;= #{endTime}</if>
@@ -19,8 +20,9 @@
    <select id="caseTrendMoon" parameterType="com.ruoyi.project.domain.ServiceTotals"
            resultType="ServiceTotalsTrend">
        SELECT DATE_FORMAT(a.donatetime, '%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 where a.del_flag=0
        LEFT JOIN  service_donatecompletioninfo  b ON b.InfoID=a.id
        <where>
            a.del_flag=0
            <if test="area != null  and area != ''">and a.RegisterCountyName>=#{area}</if>
            <if test="startTime != null  and startTime != ''">and a.donatetime>=#{startTime}</if>
            <if test="endTime != null  and endTime != ''">and a.donatetime &lt;= #{endTime}</if>
@@ -31,8 +33,9 @@
    <select id="caseTrendArea" parameterType="com.ruoyi.project.domain.ServiceTotals"
            resultType="ServiceTotalsTrend">
        SELECT RegisterCountyName 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 where a.del_flag=0
        LEFT JOIN  service_donatecompletioninfo  b ON b.InfoID=a.id
        <where>
            a.del_flag=0
            <if test="area != null  and area != ''">and a.RegisterCountyName>=#{area}</if>
            <if test="startTime != null  and startTime != ''">and a.donatetime>=#{startTime}</if>
            <if test="endTime != null  and endTime != ''">and a.donatetime &lt;= #{endTime}</if>
@@ -42,48 +45,53 @@
    <select id="organ" parameterType="com.ruoyi.project.domain.ServiceTotals"
            resultType="ServiceTotalsOrgan">
        SELECT DATE_FORMAT(a.OrganGetTime, '%Y-%m') donateTime,a.OrganName organName, COUNT(*) getCount,
        SELECT DATE_FORMAT(a.organ_start_time, '%Y-%m') donateTime,a.OrganName organName, COUNT(*) getCount,c.RegisterCountyName area,
        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  where a.del_flag=0
        LEFT JOIN  service_donatecomporgan b ON a.InfoID=b.InfoID AND a.OrganName=b.OrganName
        LEFT JOIN  service_donatebaseinfo c ON a.InfoID=c.ID
        <where>
            a.del_flag=0
            <if test="area != null  and area != ''">
                and a.InfoID in (select id FROM service_donatecompletioninfo where RegisterCountyName>=#{area} )
            </if>
            <if test="area != null  and area != ''">and c.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 &lt;= #{endTime}</if>
            <if test="startTime != null  and startTime != ''">and a.organ_start_time>=#{startTime}</if>
            <if test="endTime != null  and endTime != ''">and a.organ_start_time &lt;= #{endTime}</if>
        </where>
        GROUP BY DATE_FORMAT(a.OrganGetTime, '%Y-%m'),a.OrganName
        GROUP BY DATE_FORMAT(a.organ_start_time, '%Y-%m'),a.OrganName,c.RegisterCountyName
    </select>
    <select id="organMoon" parameterType="com.ruoyi.project.domain.ServiceTotals"
            resultType="ServiceTotalsOrgan">
        SELECT DATE_FORMAT(a.OrganGetTime, '%Y-%m') donateTime, COUNT(*) getCount,
        SELECT DATE_FORMAT(a.organ_start_time, '%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  where a.del_flag=0
        LEFT JOIN  service_donatecomporgan b ON a.InfoID=b.InfoID AND a.OrganName=b.OrganName
        <where>
            a.del_flag=0
            <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 &lt;= #{endTime}</if>
            <if test="startTime != null  and startTime != ''">and a.organ_start_time>=#{startTime}</if>
            <if test="endTime != null  and endTime != ''">and a.organ_start_time &lt;= #{endTime}</if>
        </where>
        GROUP BY DATE_FORMAT(a.OrganGetTime, '%Y-%m')
        GROUP BY DATE_FORMAT(a.organ_start_time, '%Y-%m')
    </select>
    <select id="organType" parameterType="com.ruoyi.project.domain.ServiceTotals"
            resultType="ServiceTotalsOrgan">
        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  where a.del_flag=0
        LEFT JOIN  service_donatecomporgan b ON a.InfoID=b.InfoID AND a.OrganName=b.OrganName
        <where>
            a.del_flag=0
            <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 &lt;= #{endTime}</if>
            <if test="startTime != null  and startTime != ''">and a.organ_start_time>=#{startTime}</if>
            <if test="endTime != null  and endTime != ''">and a.organ_start_time &lt;= #{endTime}</if>
        </where>
        GROUP BY a.OrganName
    </select>
@@ -91,8 +99,9 @@
    <select id="caseSex" parameterType="com.ruoyi.project.domain.ServiceTotals"
            resultType="ServiceTotalsSex">
        SELECT COUNT(sex) totalCount, COUNT(IF(sex=1, true, NULL)) manCount ,COUNT(IF(sex=2, true, NULL)) womanCount
        FROM service_donatebaseinfo where del_flag=0
        FROM service_donatebaseinfo
        <where>
            del_flag=0
            <if test="area != null  and area != ''">
                and  RegisterCountyName>=#{area}
            </if>
@@ -113,8 +122,9 @@
    <select id="caseAvgAge" parameterType="com.ruoyi.project.domain.ServiceTotals"
            resultType="ServiceTotals">
        SELECT AVG(age) avgAge FROM  service_donatebaseinfo where del_flag=0
        SELECT AVG(age) avgAge FROM  service_donatebaseinfo
        <where>
            del_flag=0
            <if test="area != null  and area != ''">
                and  RegisterCountyName>=#{area}
            </if>
@@ -135,8 +145,9 @@
    <select id="caseBloodType" parameterType="com.ruoyi.project.domain.ServiceTotals"
            resultType="ServiceTotalsBood">
        SELECT COUNT(BloodType) boodTypeCount,BloodType bloodType
        FROM service_donatebaseinfo where del_flag=0
        FROM service_donatebaseinfo
        <where>
            del_flag=0
            <if test="area != null  and area != ''">
                and  RegisterCountyName>=#{area}
            </if>
@@ -157,8 +168,8 @@
    <select id="totals" parameterType="com.ruoyi.project.domain.ServiceTotals"
            resultType="ServiceTotalsTotal">
        SELECT ( SELECT COUNT(*) FROM service_donatebaseinfo_report WHERE del_flag=0) totalPotential,
        (SELECT COUNT(*) FROM service_donatecompletioninfo WHERE del_flag=0) totalCompletion
        SELECT ( SELECT COUNT(*) FROM service_donatebaseinfo WHERE del_flag=0) totalPotential,
               (SELECT COUNT(*) FROM service_donatecompletioninfo WHERE del_flag=0 and complete_state=3) totalCompletion
    </select>
    <select id="trendList" parameterType="com.ruoyi.project.domain.ServiceTotals"
@@ -167,8 +178,8 @@
        (SELECT  GROUP_CONCAT(c.OrganName) FROM service_donateorgan c WHERE c.InfoId=a.id AND c.del_flag=0) OrganName
        FROM service_donatebaseinfo a
        LEFT JOIN service_deathinfo d ON d.InfoID=a.id
        where a.del_flag=0
        <where>
            a.del_flag=0
            <if test="area != null  and area != ''">and a.RegisterCountyName>=#{area}</if>
            <if test="startTime != null  and startTime != ''">and a.donatetime>=#{startTime}</if>
            <if test="endTime != null  and endTime != ''">and a.donatetime &lt;= #{endTime}</if>
@@ -176,4 +187,26 @@
    </select>
    <select id="trendCount" parameterType="com.ruoyi.project.domain.ServiceTotals"
            resultType="Long">
        SELECT count(*)
        FROM service_donatebaseinfo a
        LEFT JOIN service_deathinfo d ON d.InfoID=a.id
        <where>
            a.del_flag=0
            <if test="area != null  and area != ''">and a.RegisterCountyName>=#{area}</if>
            <if test="startTime != null  and startTime != ''">and a.donatetime>=#{startTime}</if>
            <if test="endTime != null  and endTime != ''">and a.donatetime &lt;= #{endTime}</if>
        </where>
    </select>
    <select id="organTotals" parameterType="com.ruoyi.project.domain.ServiceTotals"
            resultType="ServiceTotalsOrganTotals">
        SELECT ( SELECT COUNT(*) FROM service_donatecomporgan WHERE del_flag=0 AND transplantstate=1) totalTransplant,
               ( SELECT COUNT(*) FROM service_donatecomporgan WHERE del_flag=0 AND transplantstate=4) totalDiscard,
               (SELECT COUNT(*) FROM service_donationwitnessorgan WHERE del_flag=0 AND OrganState=3) totalGet,
               (SELECT COUNT(*) FROM service_donationwitnessorgan WHERE del_flag=0 AND OrganState=4) totalRecycle
    </select>
</mapper>