From ba654712582992ce3477adb75787340cd9b6707b Mon Sep 17 00:00:00 2001
From: sinake <sinake1@qq.com>
Date: 星期二, 15 九月 2026 09:27:34 +0800
Subject: [PATCH] 案例趋势相关统计

---
 ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceDonatebaseinfoReport.java   |    7 
 ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceTotals.java                 |   67 ++++++
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceTotalsController.java |   97 +++++++++
 ruoyi-project/src/main/java/com/ruoyi/project/mapper/ServiceTotalsMapper.java           |   70 +++++++
 ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceTotalsServiceImp.java |  107 ++++++++++
 ruoyi-project/src/main/java/com/ruoyi/project/service/iServiceTotalsService.java        |   60 ++++++
 ruoyi-project/src/main/resources/mapper/project/ServiceTotalsMapper.xml                 |  158 +++++++++++++++
 7 files changed, 566 insertions(+), 0 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceTotalsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceTotalsController.java
new file mode 100644
index 0000000..23a998e
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceTotalsController.java
@@ -0,0 +1,97 @@
+package com.ruoyi.web.controller.project;
+
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.Result;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.project.domain.ServiceTotals;
+import com.ruoyi.project.service.iServiceTotalsService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@Api(description = "opo缁熻",tags = {"opo缁熻"})
+@RestController
+@RequestMapping("/opo/totals")
+public class ServiceTotalsController extends BaseController
+    {
+        @Autowired
+        private iServiceTotalsService service;
+
+        @ApiOperation("妗堜緥瓒嬪娍")
+        @PostMapping("/caseTrend")
+        public Result caseTrend(@RequestBody ServiceTotals totals)
+        {
+            List<ServiceTotals> list = service.caseTrend(totals);
+            return Result.success(list);
+        }
+
+        @ApiOperation("妗堜緥瓒嬪娍鏈堜唤")
+        @PostMapping("/caseTrendMoon")
+        public Result caseTrendMoon(@RequestBody ServiceTotals totals)
+        {
+            List<ServiceTotals> list = service.caseTrendMoon(totals);
+            return Result.success(list);
+        }
+
+        @ApiOperation("妗堜緥瓒嬪娍鍖哄煙")
+        @PostMapping("/caseTrendArea")
+        public Result caseTrendArea(@RequestBody ServiceTotals totals)
+        {
+            List<ServiceTotals> list = service.caseTrendArea(totals);
+            return Result.success(list);
+        }
+
+        @ApiOperation("鎹愮尞鍣ㄥ畼缁熻鏄庣粏")
+        @PostMapping("/organ")
+        public Result organ(@RequestBody ServiceTotals totals)
+        {
+            List<ServiceTotals> list = service.organ(totals);
+            return Result.success(list);
+        }
+
+        @ApiOperation("鍣ㄥ畼鑾峰彇/绉绘瓒嬪娍")
+        @PostMapping("/organMoon")
+        public Result organMoon(@RequestBody ServiceTotals totals)
+        {
+            List<ServiceTotals> list = service.organMoon(totals);
+            return Result.success(list);
+        }
+
+        @ApiOperation("鍣ㄥ畼绫诲瀷鍒嗗竷")
+        @PostMapping("/organType")
+        public Result organType(@RequestBody ServiceTotals totals)
+        {
+            List<ServiceTotals> list = service.organType(totals);
+            return Result.success(list);
+        }
+
+        @ApiOperation("鎹愮尞鑰呭勾榫勬�у埆鍒嗗竷")
+        @PostMapping("/caseSex")
+        public Result caseSex(@RequestBody ServiceTotals totals)
+        {
+            List<ServiceTotals> list = service.caseSex(totals);
+            return Result.success(list);
+        }
+
+        @ApiOperation("骞冲潎骞撮緞")
+        @PostMapping("/caseAvgAge")
+        public Result caseAvgAge(@RequestBody ServiceTotals totals)
+        {
+            List<ServiceTotals> list = service.caseAvgAge(totals);
+            return Result.success(list);
+        }
+
+        @ApiOperation("鎬у埆涓庤鍨嬪垎甯�")
+        @PostMapping("/caseBloodType")
+        public Result caseBloodType(@RequestBody ServiceTotals totals)
+        {
+            List<ServiceTotals> list = service.caseBloodType(totals);
+            return Result.success(list);
+        }
+}
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceDonatebaseinfoReport.java b/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceDonatebaseinfoReport.java
index 720bebd..27007a2 100644
--- a/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceDonatebaseinfoReport.java
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceDonatebaseinfoReport.java
@@ -463,5 +463,12 @@
     @ApiModelProperty("闈炵鐞嗗憳ID")
     private String notAdminId;
 
+    /**
+     * 鍗忚皟鍛樺鍚�
+     */
+    @ApiModelProperty("鍦板尯")
+    @Excel(name = "鍦板尯", readConverterExp = "鍦板尯")
+    private String registerCountyName;
+
 }
 
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceTotals.java b/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceTotals.java
new file mode 100644
index 0000000..6b06f41
--- /dev/null
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceTotals.java
@@ -0,0 +1,67 @@
+package com.ruoyi.project.domain;
+
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+@ApiModel("opo缁熻")
+public class ServiceTotals {
+
+    @ApiModelProperty("寮�濮嬫椂闂�")
+    private String startTime;
+
+    @ApiModelProperty("缁撴潫鏃堕棿")
+    private String endTime;
+
+    @ApiModelProperty("鍖哄煙")
+    private String area;
+
+    @ApiModelProperty("鎬у埆")
+    private String sex;
+
+    @ApiModelProperty("琛�鍨�")
+    private String boodType;
+
+    @ApiModelProperty("骞撮緞娈�1:<17;2:18-49;3:50-69;4:>69")
+    private String ageGroup;
+
+    @ApiModelProperty("妗堜緥鏃堕棿")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date donateTime;
+
+    @ApiModelProperty("娼滃湪鎹愮尞鏁�")
+    private Integer potentialCount;
+
+    @ApiModelProperty("瀹屾垚鎹愮尞鏁�")
+    private Integer completeCount;
+
+    @ApiModelProperty("鍣ㄧ鍚嶇О")
+    private String organName;
+
+    @ApiModelProperty("鑾峰彇鏁�")
+    private Integer getCount;
+
+    @ApiModelProperty("绉绘鏁�")
+    private Integer useCount;
+
+    @ApiModelProperty("骞冲潎骞撮緞")
+    private Integer avgAge;
+
+    @ApiModelProperty("鎬绘暟")
+    private Integer totalCount;
+
+    @ApiModelProperty("鐢锋�ф暟")
+    private Integer manCount;
+
+    @ApiModelProperty("濂虫�ф暟")
+    private Integer womanCount;
+
+    @ApiModelProperty("琛�鍨嬫暟")
+    private Integer boodTypeCount;
+
+}
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/mapper/ServiceTotalsMapper.java b/ruoyi-project/src/main/java/com/ruoyi/project/mapper/ServiceTotalsMapper.java
new file mode 100644
index 0000000..329ae28
--- /dev/null
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/mapper/ServiceTotalsMapper.java
@@ -0,0 +1,70 @@
+package com.ruoyi.project.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.project.domain.GiApi;
+import com.ruoyi.project.domain.ServiceTasknum;
+import com.ruoyi.project.domain.ServiceTotals;
+import io.jsonwebtoken.impl.crypto.MacProvider;
+
+import java.util.List;
+import java.util.Map;
+
+public interface ServiceTotalsMapper extends BaseMapper<ServiceTotals> {
+
+    /**
+     * 妗堜緥瓒嬪娍
+     *
+     */
+    public List<ServiceTotals> caseTrend(ServiceTotals totals);
+
+    /**
+     * 妗堜緥瓒嬪娍鏈堜唤
+     *
+     */
+    public List<ServiceTotals> caseTrendMoon(ServiceTotals totals);
+
+    /**
+     * 妗堜緥瓒嬪娍鍖哄煙
+     *
+     */
+    public List<ServiceTotals> caseTrendArea(ServiceTotals totals);
+
+    /**
+     * 鎹愮尞鍣ㄥ畼缁熻鏄庣粏
+     *
+     */
+    public List<ServiceTotals> organ(ServiceTotals totals);
+
+    /**
+     * 鍣ㄥ畼鑾峰彇/绉绘瓒嬪娍
+     *
+     */
+    public List<ServiceTotals> organMoon(ServiceTotals totals);
+
+    /**
+     * 鍣ㄥ畼绫诲瀷鍒嗗竷
+     *
+     */
+    public List<ServiceTotals> organType(ServiceTotals totals);
+
+    /**
+     * 鎹愮尞鑰呭勾榫勬�у埆鍒嗗竷
+     *
+     */
+    public List<ServiceTotals> caseSex(ServiceTotals totals);
+
+    /**
+     * 骞冲潎骞撮緞
+     *
+     */
+    public List<ServiceTotals> caseAvgAge(ServiceTotals totals);
+
+    /**
+     * 鎬у埆涓庤鍨嬪垎甯�
+     *
+     */
+    public List<ServiceTotals> caseBloodType(ServiceTotals totals);
+
+
+
+}
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/service/iServiceTotalsService.java b/ruoyi-project/src/main/java/com/ruoyi/project/service/iServiceTotalsService.java
new file mode 100644
index 0000000..c76a242
--- /dev/null
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/service/iServiceTotalsService.java
@@ -0,0 +1,60 @@
+package com.ruoyi.project.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.project.domain.ServiceTotals;
+
+import java.util.List;
+
+public interface iServiceTotalsService extends IService<ServiceTotals>
+{
+
+    /**
+     * 妗堜緥瓒嬪娍
+     *
+     */
+    public List<ServiceTotals> caseTrend(ServiceTotals totals);
+
+    /**
+     * 妗堜緥瓒嬪娍鏈堜唤
+     *
+     */
+    public List<ServiceTotals> caseTrendMoon(ServiceTotals totals);
+
+    /**
+     * 妗堜緥瓒嬪娍鍖哄煙
+     *
+     */
+    public List<ServiceTotals> caseTrendArea(ServiceTotals totals);
+
+    /**
+     * 鎹愮尞鍣ㄥ畼缁熻鏄庣粏
+     *
+     */
+    public List<ServiceTotals> organ(ServiceTotals totals);
+    /**
+     * 鍣ㄥ畼鑾峰彇/绉绘瓒嬪娍
+     *
+     */
+    public List<ServiceTotals> organMoon(ServiceTotals totals);
+    /**
+     * 鍣ㄥ畼绫诲瀷鍒嗗竷
+     *
+     */
+    public List<ServiceTotals> organType(ServiceTotals totals);
+    /**
+     * 鎹愮尞鑰呭勾榫勬�у埆鍒嗗竷
+     *
+     */
+    public List<ServiceTotals> caseSex(ServiceTotals totals);
+    /**
+     * 骞冲潎骞撮緞
+     *
+     */
+    public List<ServiceTotals> caseAvgAge(ServiceTotals totals);
+    /**
+     * 鎬у埆涓庤鍨嬪垎甯�
+     *
+     */
+    public List<ServiceTotals> caseBloodType(ServiceTotals totals);
+}
+
diff --git a/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceTotalsServiceImp.java b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceTotalsServiceImp.java
new file mode 100644
index 0000000..9771445
--- /dev/null
+++ b/ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceTotalsServiceImp.java
@@ -0,0 +1,107 @@
+package com.ruoyi.project.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.project.domain.ServiceTotals;
+import com.ruoyi.project.mapper.ServiceTotalsMapper;
+import com.ruoyi.project.service.iServiceTotalsService;
+import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class ServiceTotalsServiceImp extends ServiceImpl<ServiceTotalsMapper, ServiceTotals> implements iServiceTotalsService
+{
+    @Autowired
+    ServiceTotalsMapper mapper;
+
+    /**
+     * 妗堜緥瓒嬪娍
+     *
+     */
+    @Override
+    public List<ServiceTotals> caseTrend(ServiceTotals totals) {
+        if(ObjectUtils.isNotEmpty(totals.getAgeGroup())){
+            switch (totals.getAgeGroup()) {
+                case "1": totals.setAgeGroup(" and age<=17 "); break;
+                case "2": totals.setAgeGroup(" and age>17 and age<=49 "); break;
+                case "3": totals.setAgeGroup(" and age>49 and age<=69 "); break;
+                case "4": totals.setAgeGroup(" and age>69 "); break;
+                default: break;
+            }
+        }
+        return mapper.caseTrend(totals);
+    }
+    /**
+     * 妗堜緥瓒嬪娍鏈堜唤
+     *
+     */
+    @Override
+    public List<ServiceTotals> caseTrendMoon(ServiceTotals totals) {
+        return mapper.caseTrendMoon(totals);
+    }
+
+    /**
+     * 妗堜緥瓒嬪娍鍖哄煙
+     *
+     */
+    @Override
+    public List<ServiceTotals> caseTrendArea(ServiceTotals totals) {
+        return mapper.caseTrendArea(totals);
+    }
+
+    /**
+     * 鎹愮尞鍣ㄥ畼缁熻鏄庣粏
+     *
+     */
+    @Override
+    public List<ServiceTotals> organ(ServiceTotals totals) {
+        return mapper.caseTrendArea(totals);
+    }
+
+    /**
+     * 鍣ㄥ畼鑾峰彇/绉绘瓒嬪娍
+     *
+     */
+    @Override
+    public List<ServiceTotals> organMoon(ServiceTotals totals) {
+        return mapper.caseTrendArea(totals);
+    }
+
+    /**
+     * 鍣ㄥ畼绫诲瀷鍒嗗竷
+     *
+     */
+    @Override
+    public List<ServiceTotals> organType(ServiceTotals totals) {
+        return mapper.caseTrendArea(totals);
+    }
+
+    /**
+     * 鎹愮尞鑰呭勾榫勬�у埆鍒嗗竷
+     *
+     */
+    @Override
+    public List<ServiceTotals> caseSex(ServiceTotals totals) {
+        return mapper.caseTrendArea(totals);
+    }
+
+    /**
+     * 骞冲潎骞撮緞
+     *
+     */
+    @Override
+    public List<ServiceTotals> caseAvgAge(ServiceTotals totals) {
+        return mapper.caseTrendArea(totals);
+    }
+    /**
+     * 鎬у埆涓庤鍨嬪垎甯�
+     *
+     */
+    @Override
+    public List<ServiceTotals> caseBloodType(ServiceTotals totals) {
+        return mapper.caseTrendArea(totals);
+    }
+
+}
diff --git a/ruoyi-project/src/main/resources/mapper/project/ServiceTotalsMapper.xml b/ruoyi-project/src/main/resources/mapper/project/ServiceTotalsMapper.xml
new file mode 100644
index 0000000..8df8714
--- /dev/null
+++ b/ruoyi-project/src/main/resources/mapper/project/ServiceTotalsMapper.xml
@@ -0,0 +1,158 @@
+<?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 &lt;= #{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 &lt;= #{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 &lt;= #{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 &lt;= #{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 &lt;= #{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 &lt;= #{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 &lt;= #{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 &lt;= #{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 &lt;= #{endTime}</if>
+        </where>
+        GROUP BY  BloodType
+    </select>
+
+</mapper>
\ No newline at end of file

--
Gitblit v1.9.3