【丽水】随访查询页面-统计调整 * total: 患者服务总量
* wxsf: 无需随访数量 sendstate != 4
* xsf: 需随访数量 sendstate = 4
* dsf: 待随访数量 sendstate = 1L, 2L, 3L, 5L, 7L
* ywc: 已完成数量 sendstate = 6L
* yc: 异常数量 excep = '1'
* yc: 警告数量 excep = '2'
| | |
| | | // MyBatis 的 SUM 在没有匹配行时会返回 null |
| | | result.putIfAbsent("wzx", 0); |
| | | result.putIfAbsent("ysf", 0); |
| | | result.putIfAbsent("yc", 0); |
| | | result.putIfAbsent("jg", 0); |
| | | result.putIfAbsent("fssb", 0); |
| | | result.putIfAbsent("yfs", 0); |
| | | result.putIfAbsent("blq", 0); |
| | | result.putIfAbsent("dsf", 0); |
| | | result.putIfAbsent("total", 0); |
| | | result.putIfAbsent("wxsf", 0); |
| | | result.putIfAbsent("xsf", 0); |
| | | result.putIfAbsent("dsf", 0); |
| | | result.putIfAbsent("ywc", 0); |
| | | result.putIfAbsent("yc", 0); |
| | | result.putIfAbsent("jg", 0); |
| | | } |
| | | return result; |
| | | } |
| | |
| | | <!-- 优化的统计查询:直接在数据库层完成聚合计算 --> |
| | | <select id="countByCondition" parameterType="com.smartor.domain.entity.ServiceSubtaskEntity" resultType="map"> |
| | | SELECT |
| | | SUM(CASE WHEN sendstate = 4 THEN 1 ELSE 0 END) AS wzx, |
| | | SUM(CASE WHEN sendstate != 4 AND sendstate != 2 THEN 1 ELSE 0 END) AS ysf, |
| | | SUM(CASE WHEN sendstate = 5 THEN 1 ELSE 0 END) AS fssb, |
| | | SUM(CASE WHEN sendstate >= 3 OR sendstate = 1 THEN 1 ELSE 0 END) AS yfs, |
| | | SUM(CASE WHEN sendstate = 1 THEN 1 ELSE 0 END) AS blq, |
| | | SUM(CASE WHEN sendstate != 4 THEN 1 ELSE 0 END) AS wxsf, |
| | | SUM(CASE WHEN sendstate = 4 THEN 1 ELSE 0 END) AS xsf, |
| | | SUM(CASE WHEN (sendstate = 1 OR sendstate = 2 OR sendstate = 3 OR sendstate = 5 OR sendstate = 7 ) THEN 1 ELSE 0 END) AS dsf, |