8 changed files with 885 additions and 11 deletions
@ -1,13 +1,64 @@ |
|||
package com.acupuncture.web.controller.web; |
|||
|
|||
import com.acupuncture.common.core.domain.JsonResponse; |
|||
import com.acupuncture.system.domain.dto.StatisticsDto; |
|||
import com.acupuncture.system.domain.vo.StatisticsVo; |
|||
import com.acupuncture.system.service.StatisticsService; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.validation.annotation.Validated; |
|||
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 javax.annotation.Resource; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zzc |
|||
* @Package com.acupuncture.web.controller.web |
|||
* @Date 2025/2/13 8:58 |
|||
* @description: |
|||
*/ |
|||
@Slf4j |
|||
@Api(tags = "统计相关") |
|||
@RestController |
|||
@RequestMapping("/statistic") |
|||
public class StatisticsController { |
|||
|
|||
@Resource |
|||
private StatisticsService statisticsService; |
|||
|
|||
@ApiOperation("患者统计") |
|||
@PostMapping("/patientTotal") |
|||
public JsonResponse<StatisticsVo.PatientVo> queryPatientStatistics(@RequestBody @Validated StatisticsDto.Query dto) { |
|||
return JsonResponse.ok(statisticsService.queryPatientStatistics(dto)); |
|||
} |
|||
|
|||
@ApiOperation("诊疗统计") |
|||
@PostMapping("/zlInfo") |
|||
public JsonResponse<StatisticsVo.TreamentVo> queryZlStatistics(@RequestBody @Validated StatisticsDto.Query dto) { |
|||
return JsonResponse.ok(statisticsService.queryZlStatistics(dto)); |
|||
} |
|||
|
|||
@ApiOperation("治疗类型统计") |
|||
@PostMapping("/zlType") |
|||
public JsonResponse<StatisticsVo.ZlTypeVo> queryZlTypeStatistics(@RequestBody @Validated StatisticsDto.Query dto) { |
|||
return JsonResponse.ok(statisticsService.queryZlTypeStatistics(dto)); |
|||
} |
|||
|
|||
@ApiOperation("随访分布统计") |
|||
@PostMapping("/sffb") |
|||
public JsonResponse<StatisticsVo.SffbVo> querySfStatistics(@RequestBody @Validated StatisticsDto.Query dto) { |
|||
return JsonResponse.ok(statisticsService.querySfStatistics(dto)); |
|||
} |
|||
|
|||
@ApiOperation("失访统计") |
|||
@PostMapping("/sftj") |
|||
public JsonResponse<List<StatisticsVo.SftjVo>> querySfTjStatistics(@RequestBody @Validated StatisticsDto.Query dto) { |
|||
return JsonResponse.ok(statisticsService.querySfTjStatistics(dto)); |
|||
} |
|||
|
|||
} |
|||
|
@ -0,0 +1,26 @@ |
|||
package com.acupuncture.system.domain.dto; |
|||
|
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @Author zzc |
|||
* @Package com.acupuncture.system.domain.dto |
|||
* @Date 2025/2/13 10:52 |
|||
* @description: |
|||
*/ |
|||
public class StatisticsDto { |
|||
|
|||
@Data |
|||
public static class Query { |
|||
@ApiModelProperty("开始时间") |
|||
private Date startTime; |
|||
@ApiModelProperty("结束时间") |
|||
private Date endTime; |
|||
@ApiModelProperty("统计方式 0:周 1:月 2:季 3:年") |
|||
private Integer timeType; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,79 @@ |
|||
package com.acupuncture.system.persist.dao; |
|||
|
|||
import com.acupuncture.system.domain.dto.StatisticsDto; |
|||
import com.acupuncture.system.domain.vo.StatisticsVo; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Author zzc |
|||
* @Package com.acupuncture.system.persist.dao |
|||
* @Date 2025/2/13 14:07 |
|||
* @description: |
|||
*/ |
|||
public interface StatisticsDao { |
|||
|
|||
/** |
|||
* 患者统计 |
|||
* |
|||
* @param dto |
|||
* @param tenantId |
|||
* @return |
|||
*/ |
|||
StatisticsVo.PatientVo.GenderVo queryGenderStatistics(@Param("dto") StatisticsDto.Query dto, |
|||
@Param("tenantId") Long tenantId); |
|||
|
|||
/** |
|||
* 年龄统计 |
|||
* |
|||
* @param dto |
|||
* @param tenantId |
|||
* @return |
|||
*/ |
|||
StatisticsVo.PatientVo.AgeVo queryAgeStatistics(@Param("dto") StatisticsDto.Query dto, |
|||
@Param("tenantId") Long tenantId); |
|||
|
|||
StatisticsVo.PatientVo.JwbzVo queryJwbzStatistics(@Param("dto") StatisticsDto.Query dto, |
|||
@Param("tenantId") Long tenantId); |
|||
|
|||
Integer queryTotalPatient(@Param("dto") StatisticsDto.Query dto, |
|||
@Param("tenantId") Long tenantId); |
|||
|
|||
StatisticsVo.TreamentVo.TxfbVo queryTxfbStatistics(@Param("dto") StatisticsDto.Query dto, |
|||
@Param("tenantId") Long tenantId); |
|||
|
|||
StatisticsVo.TreamentVo.ZytzVo queryZytzStatistics(@Param("dto") StatisticsDto.Query dto, |
|||
@Param("tenantId") Long tenantId); |
|||
|
|||
StatisticsVo.ZlTypeVo.Zllxtj queryZllxtjStatistics(@Param("dto") StatisticsDto.Query dto, |
|||
@Param("tenantId") Long tenantId); |
|||
|
|||
|
|||
StatisticsVo.ZlTypeVo.BzfffbVo.Fpz queryFpzStatistics(@Param("dto") StatisticsDto.Query dto, |
|||
@Param("tenantId") Long tenantId); |
|||
|
|||
StatisticsVo.ZlTypeVo.ZlxgVo queryZlxgStatistics(@Param("dto") StatisticsDto.Query dto, |
|||
@Param("tenantId") Long tenantId); |
|||
|
|||
StatisticsVo.ZlTypeVo.ZlfyVo queryZlfyStatistics(@Param("dto") StatisticsDto.Query dto, |
|||
@Param("tenantId") Long tenantId); |
|||
|
|||
List<StatisticsVo.SftjVo> querySftjStatistics(@Param("dto") StatisticsDto.Query dto, |
|||
@Param("tenantId") Long tenantId); |
|||
|
|||
List<StatisticsVo.SffbVo.DlVo> querySfStatistics(@Param("dto") StatisticsDto.Query dto, |
|||
@Param("tenantId") Long tenantId); |
|||
|
|||
StatisticsVo.TreamentVo.TtfbVo queryTtfbStatistics(@Param("dto") StatisticsDto.Query dto, |
|||
@Param("tenantId") Long tenantId); |
|||
|
|||
StatisticsVo.TreamentVo.SmfbVo querySmfbStatistics(@Param("dto") StatisticsDto.Query dto, |
|||
@Param("tenantId") Long tenantId); |
|||
|
|||
StatisticsVo.TreamentVo.JlfbVo queryJlfbStatistics(@Param("dto") StatisticsDto.Query dto, |
|||
@Param("tenantId") Long tenantId); |
|||
|
|||
StatisticsVo.ZlTypeVo.BzfffbVo.Smz querySmzStatistics(StatisticsDto.Query dto, Long tenantId); |
|||
} |
|||
|
@ -0,0 +1,287 @@ |
|||
<?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.acupuncture.system.persist.dao.StatisticsDao"> |
|||
|
|||
<select id="queryGenderStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$PatientVo$GenderVo"> |
|||
SELECT |
|||
IFNULL(SUM(CASE WHEN gender = 0 THEN 1 ELSE 0 END), 0) AS male, |
|||
IFNULL(SUM(CASE WHEN gender = 1 THEN 1 ELSE 0 END), 0) AS female, |
|||
IFNULL(SUM(CASE WHEN gender IS NULL OR gender NOT IN (0, 1) THEN 1 ELSE 0 END), 0) AS other |
|||
FROM |
|||
pms_patient |
|||
<where> |
|||
<if test="tenantId != null"> |
|||
AND tenant_id = #{tenantId} |
|||
</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="queryAgeStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$PatientVo$AgeVo"> |
|||
SELECT |
|||
IFNULL(SUM(CASE WHEN age BETWEEN 0 AND 40 THEN 1 ELSE 0 END), 0) as num1, |
|||
IFNULL(SUM(CASE WHEN age BETWEEN 41 AND 50 THEN 1 ELSE 0 END), 0) as num2, |
|||
IFNULL(SUM(CASE WHEN age BETWEEN 51 AND 60 THEN 1 ELSE 0 END), 0) as num3, |
|||
IFNULL(SUM(CASE WHEN age BETWEEN 61 AND 70 THEN 1 ELSE 0 END), 0) as num4, |
|||
IFNULL(SUM(CASE WHEN age BETWEEN 71 AND 80 THEN 1 ELSE 0 END), 0) as num5, |
|||
IFNULL(SUM(CASE WHEN age > 80 THEN 1 ELSE 0 END), 0) as num6 |
|||
FROM |
|||
pms_treatment |
|||
<where> |
|||
<if test="tenantId != null"> |
|||
AND tenant_id = #{tenantId} |
|||
</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="queryJwbzStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$PatientVo$JwbzVo"> |
|||
SELECT |
|||
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"高血压"') THEN 1 ELSE 0 END) AS gxy, -- 高血压 |
|||
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"脑血管病"') THEN 1 ELSE 0 END) AS nxgb, -- 脑血管病 |
|||
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"恶性肿瘤"') THEN 1 ELSE 0 END) AS exzl, -- 恶性肿瘤 |
|||
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"冠心病"') THEN 1 ELSE 0 END) AS gxb, -- 冠心病 |
|||
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"精神疾病"') THEN 1 ELSE 0 END) AS jsjb, -- 精神疾病 |
|||
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"胃和十二指肠溃疡"') THEN 1 ELSE 0 END) AS whsezcky, -- 胃和十二指肠溃疡 |
|||
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"肥胖症"') THEN 1 ELSE 0 END) AS fpz, -- 肥胖症 |
|||
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"骨质疏松症"') THEN 1 ELSE 0 END) AS gzssz, -- 骨质疏松症 |
|||
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"遗传性、先天性疾病"') THEN 1 ELSE 0 END) AS ycxXtxjb, -- 遗传性、先天性疾病 |
|||
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"糖尿病"') THEN 1 ELSE 0 END) AS tnb, -- 糖尿病 |
|||
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"慢性肺系疾病"') THEN 1 ELSE 0 END) AS mxfxjb, -- 慢性肺系疾病 |
|||
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"高脂血症"') THEN 1 ELSE 0 END) AS gzxz, -- 高脂血症 |
|||
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"肝脏疾病"') THEN 1 ELSE 0 END) AS gzjb, -- 肝脏疾病 |
|||
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"过敏性疾病"') THEN 1 ELSE 0 END) AS gmxjb, -- 过敏性疾病 |
|||
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"关节炎"') THEN 1 ELSE 0 END) AS gjy, -- 关节炎 |
|||
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"痛风"') THEN 1 ELSE 0 END) AS tf, -- 痛风 |
|||
SUM(CASE WHEN JSON_CONTAINS(current_illness_history, '"肾炎、肾病"') THEN 1 ELSE 0 END) AS sySb, -- 肾炎、肾病 |
|||
SUM(CASE WHEN |
|||
JSON_CONTAINS(current_illness_history, '"高血压"') = 0 AND |
|||
JSON_CONTAINS(current_illness_history, '"脑血管病"') = 0 AND |
|||
JSON_CONTAINS(current_illness_history, '"恶性肿瘤"') = 0 AND |
|||
JSON_CONTAINS(current_illness_history, '"冠心病"') = 0 AND |
|||
JSON_CONTAINS(current_illness_history, '"精神疾病"') = 0 AND |
|||
JSON_CONTAINS(current_illness_history, '"胃和十二指肠溃疡"') = 0 AND |
|||
JSON_CONTAINS(current_illness_history, '"肥胖症"') = 0 AND |
|||
JSON_CONTAINS(current_illness_history, '"骨质疏松症"') = 0 AND |
|||
JSON_CONTAINS(current_illness_history, '"遗传性、先天性疾病"') = 0 AND |
|||
JSON_CONTAINS(current_illness_history, '"糖尿病"') = 0 AND |
|||
JSON_CONTAINS(current_illness_history, '"慢性肺系疾病"') = 0 AND |
|||
JSON_CONTAINS(current_illness_history, '"高脂血症"') = 0 AND |
|||
JSON_CONTAINS(current_illness_history, '"肝脏疾病"') = 0 AND |
|||
JSON_CONTAINS(current_illness_history, '"过敏性疾病"') = 0 AND |
|||
JSON_CONTAINS(current_illness_history, '"关节炎"') = 0 AND |
|||
JSON_CONTAINS(current_illness_history, '"痛风"') = 0 AND |
|||
JSON_CONTAINS(current_illness_history, '"肾炎、肾病"') = 0 |
|||
THEN 1 ELSE 0 END) AS other -- 其他 |
|||
FROM |
|||
pms_patient |
|||
<where> |
|||
<if test="tenantId != null"> |
|||
AND tenant_id = #{tenantId} |
|||
</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="queryTotalPatient" resultType="java.lang.Integer"> |
|||
SELECT |
|||
COUNT(1) |
|||
FROM |
|||
pms_patient |
|||
<where> |
|||
<if test="tenantId != null"> |
|||
AND tenant_id = #{tenantId} |
|||
</if> |
|||
</where> |
|||
</select> |
|||
|
|||
<select id="queryTxfbStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$TreamentVo$TxfbVo"> |
|||
SELECT |
|||
COUNT(*) AS total, |
|||
SUM(CASE WHEN answer = '隐形肥胖型' THEN 1 ELSE 0 END) AS yxfpz, |
|||
SUM(CASE WHEN answer = '脂肪过多型' THEN 1 ELSE 0 END) AS zfgdx, |
|||
SUM(CASE WHEN answer = '肥胖型' THEN 1 ELSE 0 END) AS fpx, |
|||
SUM(CASE WHEN answer = '肌肉不足型' THEN 1 ELSE 0 END) AS jrbzx, |
|||
SUM(CASE WHEN answer = '健康匀称型' THEN 1 ELSE 0 END) AS jkjcx, |
|||
SUM(CASE WHEN answer = '超重肌肉型' THEN 1 ELSE 0 END) AS czjrx, |
|||
SUM(CASE WHEN answer = '消瘦型' THEN 1 ELSE 0 END) AS xsx, |
|||
SUM(CASE WHEN answer = '低脂肪型' THEN 1 ELSE 0 END) AS dzfx, |
|||
SUM(CASE WHEN answer = '运动员型' THEN 1 ELSE 0 END) AS ydyx |
|||
FROM |
|||
pms_treatment t |
|||
left join |
|||
pms_treatment_record r on t.id = r.treatment_id |
|||
WHERE |
|||
question_code = 'PG_RTCF_TXLX' |
|||
AND r.del_flag = 0 |
|||
and t.del_flag = 0 |
|||
<if test="tenantId != null"> |
|||
AND tenant_id = #{tenantId} |
|||
</if> |
|||
</select> |
|||
|
|||
<select id="queryZytzStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$TreamentVo$ZytzVo"> |
|||
SELECT |
|||
COUNT(*) AS total, |
|||
SUM(CASE WHEN answer = '平和质' THEN 1 ELSE 0 END) AS phz, |
|||
SUM(CASE WHEN answer = '气虚质' THEN 1 ELSE 0 END) AS qxz, |
|||
SUM(CASE WHEN answer = '阳虚质' THEN 1 ELSE 0 END) AS yangxz, |
|||
SUM(CASE WHEN answer = '阴虚质' THEN 1 ELSE 0 END) AS yinxz, |
|||
SUM(CASE WHEN answer = '痰湿质' THEN 1 ELSE 0 END) AS tsz, |
|||
SUM(CASE WHEN answer = '湿热质' THEN 1 ELSE 0 END) AS srz, |
|||
SUM(CASE WHEN answer = '血瘀质' THEN 1 ELSE 0 END) AS xyz, |
|||
SUM(CASE WHEN answer = '气郁质' THEN 1 ELSE 0 END) AS qyz, |
|||
SUM(CASE WHEN answer = '特禀质' THEN 1 ELSE 0 END) AS tlz |
|||
FROM |
|||
pms_treatment t |
|||
left join |
|||
pms_treatment_record r on t.id = r.treatment_id |
|||
WHERE |
|||
question_code = 'PG_TZBS_ZYTZ' |
|||
AND r.del_flag = 0 and t.del_flag = 0 |
|||
</select> |
|||
|
|||
<select id="queryZllxtjStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$ZlTypeVo$Zllxtj"> |
|||
SELECT |
|||
SUM( CASE WHEN answer = '中西医结合治疗' THEN 1 ELSE 0 END ) AS zxyjh, |
|||
SUM( CASE WHEN answer = '单纯中医治疗' THEN 1 ELSE 0 END ) AS czy |
|||
FROM |
|||
pms_treatment t |
|||
LEFT JOIN pms_treatment_record r ON t.id = r.treatment_id |
|||
WHERE |
|||
question_code = 'ZLFA_ZLLX' |
|||
AND t.del_flag = 0 |
|||
AND t.del_flag = 0 |
|||
</select> |
|||
|
|||
<select id="queryFpzStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$ZlTypeVo$BzfffbVo$Fpz"> |
|||
SELECT |
|||
COUNT( CASE WHEN question_code = 'ZLFA_XWXLGY' THEN 1 END ) AS xwxlg, |
|||
COUNT( CASE WHEN question_code = 'ZLFA_YDGY' THEN 1 END ) AS ydgy, |
|||
COUNT( CASE WHEN question_code = 'ZLFA_LCYYZL' THEN 1 END ) AS lcyyzl, |
|||
COUNT( CASE WHEN question_code = 'ZLFA_ZJ' THEN 1 END ) AS zjlf, |
|||
COUNT( CASE WHEN question_code = 'ZLFA_ZL' THEN 1 END ) AS ywzl |
|||
FROM |
|||
pms_treatment_record |
|||
WHERE |
|||
question_code IN ( 'ZLFA_XWXLGY', 'ZLFA_YDGY', 'ZLFA_LCYYZL', 'ZLFA_ZJ', 'ZLFA_ZL' ) |
|||
AND del_flag = 0 |
|||
</select> |
|||
|
|||
|
|||
|
|||
<select id="queryZlxgStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$ZlTypeVo$ZlxgVo"> |
|||
sELECT |
|||
SUM(CASE WHEN answer = '治愈' THEN 1 ELSE 0 END) AS zy, |
|||
SUM(CASE WHEN answer = '显效' THEN 1 ELSE 0 END) AS xx, |
|||
SUM(CASE WHEN answer = '好转' THEN 1 ELSE 0 END) AS hz, |
|||
SUM(CASE WHEN answer = '无效' THEN 1 ELSE 0 END) AS wx |
|||
FROM |
|||
pms_treatment t |
|||
LEFT JOIN pms_treatment_record r ON t.id = r.treatment_id |
|||
WHERE |
|||
question_code = 'ZLFA_ZLXG' |
|||
AND t.del_flag = 0 |
|||
and r.del_flag = 0 |
|||
</select> |
|||
|
|||
<select id="queryZlfyStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$ZlTypeVo$ZlfyVo"> |
|||
SELECT |
|||
SUM(CASE WHEN answer < 300 THEN 1 ELSE 0 END) AS score1, |
|||
SUM(CASE WHEN answer BETWEEN 300 AND 900 THEN 1 ELSE 0 END) AS score2, |
|||
SUM(CASE WHEN answer BETWEEN 901 AND 2000 THEN 1 ELSE 0 END) AS score3, |
|||
SUM(CASE WHEN answer BETWEEN 2001 AND 5000 THEN 1 ELSE 0 END) AS score4, |
|||
SUM(CASE WHEN answer > 5000 THEN 1 ELSE 0 END) AS score5 |
|||
FROM |
|||
pms_treatment t |
|||
LEFT JOIN pms_treatment_record r ON t.id = r.treatment_id |
|||
WHERE |
|||
question_code = 'ZLFA_ZTFY' |
|||
AND t.del_flag = 0 |
|||
and r.del_flag = 0 |
|||
AND answer REGEXP '^[0-9]+$'; |
|||
</select> |
|||
|
|||
<select id="querySftjStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$SftjVo"> |
|||
SELECT |
|||
COUNT(*) AS num, |
|||
lost_reason AS reason |
|||
FROM |
|||
fms_followup_task |
|||
WHERE |
|||
status = 2 |
|||
AND del_flag = 0 |
|||
GROUP BY |
|||
lost_reason |
|||
ORDER BY |
|||
num DESC |
|||
</select> |
|||
|
|||
<select id="querySfStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$SffbVo$DlVo"> |
|||
SELECT |
|||
queue_id as queueId, |
|||
COUNT(*) AS num, -- 总记录数 |
|||
SUM(CASE WHEN status = 0 AND followup_time IS NULL AND end_time > NOW() THEN 1 ELSE 0 END) AS dsf, -- 待随访 |
|||
SUM(CASE WHEN status = 0 AND followup_time IS NULL AND end_time BETWEEN DATE_SUB(NOW(), INTERVAL 2 DAY) AND DATE_ADD(NOW(), INTERVAL 2 DAY) THEN 1 ELSE 0 END) AS ljsf, -- 临近随访 |
|||
SUM(CASE WHEN (status = 0 AND followup_time IS NULL AND end_time < NOW()) OR (status = 1 AND followup_time > end_time) THEN 1 ELSE 0 END) AS cqsf, -- 超期随访 |
|||
SUM(CASE WHEN status = 1 AND followup_time <= end_time THEN 1 ELSE 0 END) AS zc -- 正常随访 |
|||
FROM |
|||
fms_followup_task |
|||
WHERE |
|||
del_flag = 0 |
|||
group by queue_id |
|||
</select> |
|||
|
|||
<select id="queryTtfbStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$TreamentVo$TtfbVo"> |
|||
SELECT |
|||
MAX( CASE WHEN answer = '1' THEN 1 ELSE 0 END ) AS score1, |
|||
MAX( CASE WHEN answer = '2' THEN 1 ELSE 0 END ) AS score2, |
|||
MAX( CASE WHEN answer = '3' THEN 1 ELSE 0 END ) AS score3, |
|||
MAX( CASE WHEN answer = '4' THEN 1 ELSE 0 END ) AS score4, |
|||
MAX( CASE WHEN answer = '5' THEN 1 ELSE 0 END ) AS score5 |
|||
FROM |
|||
pms_treatment t |
|||
left join |
|||
pms_treatment_record r on t.id = r.treatment_id |
|||
WHERE |
|||
question_code = 'PG_TT_TAPS_DF' |
|||
AND t.del_flag = 0 and r.del_flag = 0 |
|||
</select> |
|||
|
|||
<select id="querySmfbStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$TreamentVo$SmfbVo"> |
|||
SELECT COUNT(CASE WHEN answer BETWEEN 0 AND 4 THEN 1 END) AS score1, |
|||
COUNT(CASE WHEN answer BETWEEN 5 AND 9 THEN 1 END) AS score2, |
|||
COUNT(CASE WHEN answer BETWEEN 10 AND 14 THEN 1 END) AS score3, |
|||
COUNT(CASE WHEN answer BETWEEN 15 AND 19 THEN 1 END) AS score4, |
|||
COUNT(CASE WHEN answer BETWEEN 20 AND 27 THEN 1 END) AS score5 |
|||
FROM pms_treatment t |
|||
left join |
|||
pms_treatment_record r on t.id = r.treatment_id |
|||
WHERE question_code = 'PG_SM_PHQ_9_DF' |
|||
AND t.del_flag = 0 |
|||
and r.del_flag = 0 |
|||
</select> |
|||
|
|||
<select id="queryJlfbStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$TreamentVo$JlfbVo"> |
|||
SELECT COUNT(CASE WHEN answer < 8 THEN 1 END) AS score1, |
|||
COUNT(CASE WHEN answer BETWEEN 8 AND 20 THEN 1 END) AS score2, |
|||
COUNT(CASE WHEN answer BETWEEN 21 AND 35 THEN 1 END) AS score3, |
|||
COUNT(CASE WHEN answer > 35 THEN 1 END) AS score4 |
|||
FROM pms_treatment t |
|||
left join |
|||
pms_treatment_record r on t.id = r.treatment_id |
|||
WHERE question_code = 'PG_JL_HAMD_24_DF' |
|||
AND t.del_flag = 0 |
|||
and r.del_flag = 0 |
|||
</select> |
|||
|
|||
<select id="querySmzStatistics" resultType="com.acupuncture.system.domain.vo.StatisticsVo$ZlTypeVo$BzfffbVo$Smz"> |
|||
SELECT |
|||
COUNT( CASE WHEN question_code = 'ZLFA_SHXG' THEN 1 END ) AS xwxlg, |
|||
COUNT( CASE WHEN question_code = 'ZLFA_XLTS' THEN 1 END ) AS ydgy, |
|||
COUNT( CASE WHEN question_code = 'ZLFA_ZJ' THEN 1 END ) AS lcyyzl, |
|||
COUNT( CASE WHEN question_code = 'ZLFA_YW' THEN 1 END ) AS zjlf |
|||
FROM |
|||
pms_treatment_record |
|||
WHERE |
|||
question_code IN ( 'ZLFA_XWXLGY', 'ZLFA_YDGY', 'ZLFA_LCYYZL', 'ZLFA_ZJ', 'ZLFA_ZL' ) |
|||
AND del_flag = 0 |
|||
</select> |
|||
</mapper> |
Loading…
Reference in new issue