请选择 进入手机版 | 继续访问电脑版
设为首页收藏本站

jeesite

 找回密码
 注册新会员
查看: 238|回复: 4

解决报表日期自动补全问题

[复制链接]
admin 发表于 2018-7-11 11:46:50 | 显示全部楼层 |阅读模式


  1. SELECT a.systolicPressure, a.diastolicPressure,  a.bloodSugar, a.waterQuantity, a.urineOutput, a.weight, a.heartRate, a.createDate
  2. FROM
  3. (SELECT  
  4. SUM(a.systolic_pressure) AS "systolicPressure",
  5. SUM(a.diastolic_pressure) AS "diastolicPressure",
  6. SUM(a.blood_sugar) AS "bloodSugar",
  7. SUM(a.water_quantity) AS "waterQuantity",
  8. SUM(a.urine_output) AS "urineOutput",
  9. SUM(a.weight) AS "weight",
  10. SUM(a.heart_rate) AS "heartRate",
  11. DATE_FORMAT( a.create_date, "%Y-%m-%d" ) AS "createDate"
  12. FROM maida_body_data a
  13. WHERE a.del_flag ='0' GROUP BY DATE_FORMAT( a.create_date, "%Y-%m-%d" )
  14. UNION
  15. SELECT  
  16. 0  AS "systolicPressure",
  17. 0 AS "diastolicPressure",
  18. 0 AS "bloodSugar",
  19. 0 AS "waterQuantity",
  20. 0 AS "urineOutput",
  21. 0 AS "weight",
  22. 0 AS "heartRate",datelist AS createDate FROM  calendar          WHERE datelist BETWEEN  '2018-07-03' AND  '2018-07-11'

  23. ) a
  24. GROUP BY createDate
  25.                

  26.        
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册新会员

x
回复

使用道具 举报

 楼主| admin 发表于 2018-7-11 12:13:57 | 显示全部楼层
  1. SELECT a.systolicPressure, a.diastolicPressure,  a.bloodSugar, a.waterQuantity, a.urineOutput, a.weight, a.heartRate, a.createDate
  2. FROM
  3. (SELECT  
  4. SUM(a.systolic_pressure) AS "systolicPressure",
  5. SUM(a.diastolic_pressure) AS "diastolicPressure",
  6. SUM(a.blood_sugar) AS "bloodSugar",
  7. SUM(a.water_quantity) AS "waterQuantity",
  8. SUM(a.urine_output) AS "urineOutput",
  9. SUM(a.weight) AS "weight",
  10. SUM(a.heart_rate) AS "heartRate",
  11. DATE_FORMAT( a.create_date, "%Y-%m-%d" ) AS "createDate"
  12. FROM maida_body_data a
  13. WHERE a.del_flag ='0' GROUP BY DATE_FORMAT( a.create_date, "%Y-%m-%d" )
  14. UNION
  15. SELECT  
  16. 0  AS "systolicPressure",
  17. 0 AS "diastolicPressure",
  18. 0 AS "bloodSugar",
  19. 0 AS "waterQuantity",
  20. 0 AS "urineOutput",
  21. 0 AS "weight",
  22. 0 AS "heartRate",datelist AS createDate FROM calendar WHERE datelist BETWEEN  '2018-07-03' AND  '2018-07-11'

  23. ) a
  24. GROUP BY createDate
  25.                

  26.        
复制代码
回复 支持 反对

使用道具 举报

 楼主| admin 发表于 2018-7-11 12:17:24 | 显示全部楼层
  1. SELECT a.actualQuantity, a.drainageQuantity,  a.ultrafiltrationQuantity, a.createDate
  2. FROM

  3. (
  4. SELECT
  5.                 SUM(a.actual_quantity) AS "actualQuantity",
  6.                 SUM(a.drainage_quantity) AS "drainageQuantity",
  7.                 SUM(a.ultrafiltration_quantity) AS "ultrafiltrationQuantity",
  8.                 DATE_FORMAT( a.create_date, "%Y-%m-%d" ) AS "createDate"
  9.                 FROM maida_dialysis_data a
  10.                
  11.                 WHERE a.del_flag = '0'
  12.                
  13.                 GROUP BY DATE_FORMAT( a.create_date, "%Y-%m-%d" )
  14.                
  15.                
  16.                 UNION
  17. SELECT  
  18. 0  AS "actualQuantity",
  19. 0 AS "drainageQuantity",
  20. 0 AS "ultrafiltrationQuantity",
  21. datelist AS createDate FROM calendar WHERE datelist BETWEEN  '2018-07-03' AND  '2018-07-11'


  22. )
  23. a
  24. GROUP BY createDate

复制代码
回复 支持 反对

使用道具 举报

 楼主| admin 发表于 2018-7-11 12:39:06 | 显示全部楼层
  1. SELECT a.actual_quantity AS "actualQuantity", a.drainage_quantity AS "drainageQuantity",  a.ultrafiltration_quantity AS "ultrafiltrationQuantity", a.create_date AS "createDate"
  2. FROM

  3. (
  4. SELECT
  5.                 SUM(a.actual_quantity) AS actual_quantity,
  6.                 SUM(a.drainage_quantity) AS drainage_quantity,
  7.                 SUM(a.ultrafiltration_quantity) AS ultrafiltration_quantity ,
  8.                     DATE_FORMAT( a.create_date, "%Y-%m-%d" ) AS create_date
  9.                 FROM maida_dialysis_data a
  10.                
  11.                 WHERE a.del_flag = '0'
  12.                
  13.                 GROUP BY DATE_FORMAT( a.create_date, "%Y-%m-%d" )
  14.                
  15.                
  16.                 UNION
  17. SELECT  
  18. 0  AS "actual_quantity",
  19. 0 AS "drainage_quantity",
  20. 0 AS "ultrafiltration_quantity",
  21. datelist AS create_date FROM calendar WHERE datelist BETWEEN  '2018-07-03' AND  '2018-07-11'


  22. )
  23. a
  24. GROUP BY createDate

复制代码
回复 支持 反对

使用道具 举报

 楼主| admin 发表于 2018-7-11 12:48:26 | 显示全部楼层
  1. SELECT a.actual_quantity AS "actualQuantity", a.drainage_quantity AS "drainageQuantity",  a.ultrafiltration_quantity AS "ultrafiltrationQuantity", a.create_date AS "createDate"
  2. FROM

  3. (
  4. SELECT
  5.                 SUM(a.actual_quantity) AS actual_quantity,
  6.                 SUM(a.drainage_quantity) AS drainage_quantity,
  7.                 SUM(a.ultrafiltration_quantity) AS ultrafiltration_quantity ,
  8.                     DATE_FORMAT( a.create_date, "%Y-%m-%d" ) AS create_date
  9.                 FROM maida_dialysis_data a
  10.                
  11.                 WHERE a.del_flag = '0'
  12.                
  13.                 GROUP BY DATE_FORMAT( a.create_date, "%Y-%m-%d" )
  14.                
  15.                
  16.                 UNION
  17. SELECT  
  18. 0  AS "actual_quantity",
  19. 0 AS "drainage_quantity",
  20. 0 AS "ultrafiltration_quantity",
  21. datelist AS create_date FROM calendar WHERE datelist BETWEEN  '2018-07-03' AND  '2018-07-11'


  22. )
  23. a
  24. GROUP BY a.create_date
复制代码
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册新会员

本版积分规则

QQ|手机版|小黑屋|Archiver|jeesite 官方论坛. ( 吉ICP备12004769号  

GMT+8, 2018-11-17 10:11 , Processed in 0.122070 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表