343f5545 康伟

kangwei:厂级药耗分析总药耗趋势改为吨水药费趋势-后端

1 个父辈 f5a65866
......@@ -118,7 +118,6 @@ public class TestMetricInfoController {
//月数据
if (timeType.equals("3")) dataMap.put( metricInfoVO.getEquipmentCode()+"_ZT" ,JSUtils.subtract( 30*24*60, paramMap.get(metricInfoVO.getYxExpress()),paramMap.get(metricInfoVO.getGzExpress()) ) );//暂停
}
dataList.add( dataMap );
}
}
......
......@@ -34,6 +34,7 @@ public class DrugConsumptionAnalysisController {
result.setResult(data);
return result;
}
// 2411112:总药耗趋势 --->吨水药费
@AutoLog(value = "总药耗趋势")
@ApiOperation(value = "总药耗趋势", notes = "总药耗趋势")
@GetMapping("/data/drugConsumptionTrend")
......
......@@ -13,7 +13,7 @@ public interface IDrugConsumptionAnalysisService {
//数据展示
DrugConsumptionDisplayVO dataDisplay(String time, String departId);
//总药耗趋势
//总药耗趋势--->改为吨水药费用
List<DrugConsumptionTrendChartVO> drugConsumptionTrend(String time, String departId);
//吨水药耗趋势
List<DrugConsumptionTrendChartVO> consumptionTonOfWaterTrend(String time,String departId);
......
package com.skua.modules.equipment.service.impl;
import com.google.common.collect.Maps;
import com.skua.common.constant.ReportConstant;
import com.skua.common.report.ReportViewUtil;
import com.skua.core.context.SpringContextUtils;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.common.vo.DateVO;
import com.skua.modules.equipment.dto.*;
import com.skua.modules.equipment.mapper.ComprehensiveSupervisionMapper;
import com.skua.modules.equipment.service.IDrugConsumptionAnalysisService;
import com.skua.modules.equipment.vo.CorrelationAnalysisVO;
import com.skua.modules.equipment.vo.DrugConsumptionDisplayVO;
import com.skua.modules.equipment.vo.DrugConsumptionTrendChartVO;
import com.skua.modules.equipment.vo.MetricVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.dao.DataAccessException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
......@@ -24,7 +18,6 @@ import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@Service
......@@ -81,14 +74,37 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly
return displayVO;
}
//总药耗趋势
//总药耗趋势--->吨水药费
public List<DrugConsumptionTrendChartVO> drugConsumptionTrend(String time, String departId){
List<DrugConsumptionTrendChartVO> chartVOList = new ArrayList<>();
//查询当前时间往前推12个月的数据
String startTime=this.getMonthBytime(-25,time)+"-01";
String endTime=this.getMonthBytime(-1,time)+"-31";
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);
System.out.println("dataViewName3a24 ="+dataViewName3a24);
String dataViewName4411 = ReportViewUtil.buildView(ReportConstant.view4411,"YYH", departId, startTime,endTime);
String sql = "select sum(aaa.yyh) yyh,aaa.time from ( "+ dataViewName4411+") aaa group by aaa.time";
List<Map<String, Object> > dataList = getJdbcTemplate().queryForList(sql);
Map<String, String> dataMap = new HashMap<>();
if(dataList != null ){
for (Map<String,Object> map : dataList){
dataMap.put(map.get("time")+"", ConvertUtils.getString(map.get("yyh"),"0"));
}
}
//查询当前时间往前推12个月的数据
DrugConsumptionTrendChartVO chartVO = null;
List<String> months=this.getTwelve(time);
for (String month : months) {
String yesmonth=this.getMonthBytime(-12,month);//同比
chartVO = new DrugConsumptionTrendChartVO();
chartVO.setTime( month );
chartVO.setZyh( ConvertUtils.getDouble(dataMap.get(month),0d) );
chartVO.setTbzyh( ConvertUtils.getDouble(dataMap.get(yesmonth),0d) );
chartVOList.add( chartVO ) ;
}
return chartVOList;
/* 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);
StringBuffer sql2 = new StringBuffer("select DATE_FORMAT(aaa.time,'%Y-%m') 'time', ");
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 ");
sql2.append( " "+dataViewName3a24+" aaa group by DATE_FORMAT(aaa.time,'%Y-%m')");
......@@ -120,7 +136,7 @@ public class DrugConsumptionAnalusisServiceImpl implements IDrugConsumptionAnaly
}
chartVOList1.add( chartVOTemp) ;
}
return chartVOList1;
return chartVOList1;*/
}
//吨水药耗趋势
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!