| ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceTotalsController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceDonatebaseinfoReport.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| ruoyi-project/src/main/java/com/ruoyi/project/domain/ServiceTotals.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| ruoyi-project/src/main/java/com/ruoyi/project/mapper/ServiceTotalsMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| ruoyi-project/src/main/java/com/ruoyi/project/service/iServiceTotalsService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| ruoyi-project/src/main/java/com/ruoyi/project/service/impl/ServiceTotalsServiceImp.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| ruoyi-project/src/main/resources/mapper/project/ServiceTotalsMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
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); } } 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; } 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; } 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); } 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); } 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); } } 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 <= #{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>