kangwei:厂级药耗分析总药耗趋势改为吨水药费趋势-后端
正在显示
4 个修改的文件
包含
29 行增加
和
13 行删除
... | @@ -118,7 +118,6 @@ public class TestMetricInfoController { | ... | @@ -118,7 +118,6 @@ public class TestMetricInfoController { |
118 | //月数据 | 118 | //月数据 |
119 | if (timeType.equals("3")) dataMap.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.subtract( 30*24*60, paramMap.get(metricInfoVO.getYxExpress()),paramMap.get(metricInfoVO.getGzExpress()) ) );//暂停 | 119 | if (timeType.equals("3")) dataMap.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.subtract( 30*24*60, paramMap.get(metricInfoVO.getYxExpress()),paramMap.get(metricInfoVO.getGzExpress()) ) );//暂停 |
120 | } | 120 | } |
121 | |||
122 | dataList.add( dataMap ); | 121 | dataList.add( dataMap ); |
123 | } | 122 | } |
124 | } | 123 | } | ... | ... |
... | @@ -34,6 +34,7 @@ public class DrugConsumptionAnalysisController { | ... | @@ -34,6 +34,7 @@ public class DrugConsumptionAnalysisController { |
34 | result.setResult(data); | 34 | result.setResult(data); |
35 | return result; | 35 | return result; |
36 | } | 36 | } |
37 | // 2411112:总药耗趋势 --->吨水药费 | ||
37 | @AutoLog(value = "总药耗趋势") | 38 | @AutoLog(value = "总药耗趋势") |
38 | @ApiOperation(value = "总药耗趋势", notes = "总药耗趋势") | 39 | @ApiOperation(value = "总药耗趋势", notes = "总药耗趋势") |
39 | @GetMapping("/data/drugConsumptionTrend") | 40 | @GetMapping("/data/drugConsumptionTrend") | ... | ... |
... | @@ -13,7 +13,7 @@ public interface IDrugConsumptionAnalysisService { | ... | @@ -13,7 +13,7 @@ public interface IDrugConsumptionAnalysisService { |
13 | //数据展示 | 13 | //数据展示 |
14 | DrugConsumptionDisplayVO dataDisplay(String time, String departId); | 14 | DrugConsumptionDisplayVO dataDisplay(String time, String departId); |
15 | 15 | ||
16 | //总药耗趋势 | 16 | //总药耗趋势--->改为吨水药费用 |
17 | List<DrugConsumptionTrendChartVO> drugConsumptionTrend(String time, String departId); | 17 | List<DrugConsumptionTrendChartVO> drugConsumptionTrend(String time, String departId); |
18 | //吨水药耗趋势 | 18 | //吨水药耗趋势 |
19 | List<DrugConsumptionTrendChartVO> consumptionTonOfWaterTrend(String time,String departId); | 19 | List<DrugConsumptionTrendChartVO> consumptionTonOfWaterTrend(String time,String departId); | ... | ... |
1 | package com.skua.modules.equipment.service.impl; | 1 | package com.skua.modules.equipment.service.impl; |
2 | 2 | ||
3 | import com.google.common.collect.Maps; | ||
4 | import com.skua.common.constant.ReportConstant; | 3 | import com.skua.common.constant.ReportConstant; |
5 | import com.skua.common.report.ReportViewUtil; | 4 | import com.skua.common.report.ReportViewUtil; |
6 | import com.skua.core.context.SpringContextUtils; | 5 | import com.skua.core.context.SpringContextUtils; |
7 | import com.skua.core.util.ConvertUtils; | 6 | import com.skua.core.util.ConvertUtils; |
8 | import com.skua.modules.common.vo.DateVO; | 7 | import com.skua.modules.common.vo.DateVO; |
9 | import com.skua.modules.equipment.dto.*; | ||
10 | import com.skua.modules.equipment.mapper.ComprehensiveSupervisionMapper; | ||
11 | import com.skua.modules.equipment.service.IDrugConsumptionAnalysisService; | 8 | import com.skua.modules.equipment.service.IDrugConsumptionAnalysisService; |
12 | import com.skua.modules.equipment.vo.CorrelationAnalysisVO; | 9 | import com.skua.modules.equipment.vo.CorrelationAnalysisVO; |
13 | import com.skua.modules.equipment.vo.DrugConsumptionDisplayVO; | 10 | import com.skua.modules.equipment.vo.DrugConsumptionDisplayVO; |
14 | import com.skua.modules.equipment.vo.DrugConsumptionTrendChartVO; | 11 | import com.skua.modules.equipment.vo.DrugConsumptionTrendChartVO; |
15 | import com.skua.modules.equipment.vo.MetricVo; | ||
16 | import lombok.extern.slf4j.Slf4j; | 12 | import lombok.extern.slf4j.Slf4j; |
17 | import org.apache.shiro.dao.DataAccessException; | ||
18 | import org.springframework.beans.factory.annotation.Autowired; | ||
19 | import org.springframework.jdbc.core.BeanPropertyRowMapper; | 13 | import org.springframework.jdbc.core.BeanPropertyRowMapper; |
20 | import org.springframework.jdbc.core.JdbcTemplate; | 14 | import org.springframework.jdbc.core.JdbcTemplate; |
21 | import org.springframework.stereotype.Service; | 15 | import org.springframework.stereotype.Service; |
... | @@ -24,7 +18,6 @@ import java.math.BigDecimal; | ... | @@ -24,7 +18,6 @@ import java.math.BigDecimal; |
24 | import java.text.ParseException; | 18 | import java.text.ParseException; |
25 | import java.text.SimpleDateFormat; | 19 | import java.text.SimpleDateFormat; |
26 | import java.util.*; | 20 | import java.util.*; |
27 | import java.util.stream.Collectors; | ||
28 | 21 | ||
29 | @Slf4j | 22 | @Slf4j |
30 | @Service | 23 | @Service |
... | @@ -81,14 +74,37 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly | ... | @@ -81,14 +74,37 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly |
81 | 74 | ||
82 | return displayVO; | 75 | return displayVO; |
83 | } | 76 | } |
84 | //总药耗趋势 | 77 | //总药耗趋势--->吨水药费 |
85 | public List<DrugConsumptionTrendChartVO> drugConsumptionTrend(String time, String departId){ | 78 | public List<DrugConsumptionTrendChartVO> drugConsumptionTrend(String time, String departId){ |
79 | List<DrugConsumptionTrendChartVO> chartVOList = new ArrayList<>(); | ||
86 | //查询当前时间往前推12个月的数据 | 80 | //查询当前时间往前推12个月的数据 |
87 | String startTime=this.getMonthBytime(-25,time)+"-01"; | 81 | String startTime=this.getMonthBytime(-25,time)+"-01"; |
88 | String endTime=this.getMonthBytime(-1,time)+"-31"; | 82 | String endTime=this.getMonthBytime(-1,time)+"-31"; |
89 | 83 | ||
90 | String dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view3a24,"PAMZ ,PAMF,PAMRJ,SCLPAMZ,SCLPAMF,NACLO,PACGT,PACYT,FESO4G,FESO4Y,H2O2,CH3COOH,SH,FECL3,HXT,PFS,CH3COONA,GXCLJ,YWL,RYXNJ,FHTY", departId, startTime,endTime); | 84 | String dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"YYH", departId, startTime,endTime); |
91 | System.out.println("dataViewName3a24 ="+dataViewName3a24); | 85 | String sql = "select sum(aaa.yyh) yyh,aaa.time from ( "+ dataViewName4411+") aaa group by aaa.time"; |
86 | List<Map<String, Object> > dataList = getJdbcTemplate().queryForList(sql); | ||
87 | |||
88 | Map<String, String> dataMap = new HashMap<>(); | ||
89 | if(dataList != null ){ | ||
90 | for (Map<String,Object> map : dataList){ | ||
91 | dataMap.put(map.get("time")+"", ConvertUtils.getString(map.get("yyh"),"0")); | ||
92 | } | ||
93 | } | ||
94 | //查询当前时间往前推12个月的数据 | ||
95 | DrugConsumptionTrendChartVO chartVO = null; | ||
96 | List<String> months=this.getTwelve(time); | ||
97 | for (String month : months) { | ||
98 | String yesmonth=this.getMonthBytime(-12,month);//同比 | ||
99 | chartVO = new DrugConsumptionTrendChartVO(); | ||
100 | chartVO.setTime( month ); | ||
101 | chartVO.setZyh( ConvertUtils.getDouble(dataMap.get(month),0d) ); | ||
102 | chartVO.setTbzyh( ConvertUtils.getDouble(dataMap.get(yesmonth),0d) ); | ||
103 | chartVOList.add( chartVO ) ; | ||
104 | } | ||
105 | return chartVOList; | ||
106 | /* String dataViewName3a24 = ReportViewUtil.buildView(ReportConstant.view3a24,"PAMZ ,PAMF,PAMRJ,SCLPAMZ,SCLPAMF,NACLO,PACGT,PACYT,FESO4G,FESO4Y,H2O2,CH3COOH,SH,FECL3,HXT,PFS,CH3COONA,GXCLJ,YWL,RYXNJ,FHTY", departId, startTime,endTime); | ||
107 | |||
92 | StringBuffer sql2 = new StringBuffer("select DATE_FORMAT(aaa.time,'%Y-%m') 'time', "); | 108 | StringBuffer sql2 = new StringBuffer("select DATE_FORMAT(aaa.time,'%Y-%m') 'time', "); |
93 | sql2.append(" round((aaa.PAMZ + aaa.PAMF+ aaa.PAMRJ+ aaa.SCLPAMZ+ aaa.SCLPAMF+ aaa.NACLO+ aaa.PACGT+ aaa.PACYT+ aaa.FESO4G+ aaa.FESO4Y+ aaa.H2O2+ aaa.CH3COOH+ aaa.SH+ aaa.FECL3+ aaa.HXT+ aaa.PFS+ aaa.CH3COONA+ aaa.GXCLJ+ aaa.YWL+ aaa.RYXNJ+ aaa.FHTY),2) 'zyh' from "); | 109 | sql2.append(" round((aaa.PAMZ + aaa.PAMF+ aaa.PAMRJ+ aaa.SCLPAMZ+ aaa.SCLPAMF+ aaa.NACLO+ aaa.PACGT+ aaa.PACYT+ aaa.FESO4G+ aaa.FESO4Y+ aaa.H2O2+ aaa.CH3COOH+ aaa.SH+ aaa.FECL3+ aaa.HXT+ aaa.PFS+ aaa.CH3COONA+ aaa.GXCLJ+ aaa.YWL+ aaa.RYXNJ+ aaa.FHTY),2) 'zyh' from "); |
94 | sql2.append( " "+dataViewName3a24+" aaa group by DATE_FORMAT(aaa.time,'%Y-%m')"); | 110 | sql2.append( " "+dataViewName3a24+" aaa group by DATE_FORMAT(aaa.time,'%Y-%m')"); |
... | @@ -120,7 +136,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly | ... | @@ -120,7 +136,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly |
120 | } | 136 | } |
121 | chartVOList1.add( chartVOTemp) ; | 137 | chartVOList1.add( chartVOTemp) ; |
122 | } | 138 | } |
123 | return chartVOList1; | 139 | return chartVOList1;*/ |
124 | } | 140 | } |
125 | 141 | ||
126 | //吨水药耗趋势 | 142 | //吨水药耗趋势 | ... | ... |
-
请 注册 或 登录 后发表评论