|
@@ -6,14 +6,19 @@ import org.springframework.util.ObjectUtils;
|
|
|
import thyyxxk.webserver.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.webserver.dao.his.ybkf.YbStatDao;
|
|
|
import thyyxxk.webserver.entity.ResultVo;
|
|
|
+import thyyxxk.webserver.entity.HeadInfo;
|
|
|
import thyyxxk.webserver.entity.ybkf.YbStatDto;
|
|
|
import thyyxxk.webserver.entity.ybkf.YbStatResult;
|
|
|
import thyyxxk.webserver.utils.DateUtil;
|
|
|
+import thyyxxk.webserver.utils.DecimalUtil;
|
|
|
+import thyyxxk.webserver.utils.ExcelUtil;
|
|
|
import thyyxxk.webserver.utils.ResultVoUtil;
|
|
|
-import thyyxxk.webserver.utils.StringUtil;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* @ClassName YbStatService
|
|
@@ -32,13 +37,11 @@ public class YbStatService {
|
|
|
}
|
|
|
|
|
|
public ResultVo<List<YbStatResult>> selectYbStatInfo(YbStatDto dto){
|
|
|
- String beginTime = dto.getMonth() + "-01 00:00:00.000";
|
|
|
- String endTime = DateUtil.getMonthEndtime(dto.getMonth());
|
|
|
+ String beginTime = dto.getStartTime();
|
|
|
+ String endTime = DateUtil.getMonthEndtime(dto.getEndTime());
|
|
|
String insurType = dto.getInsurType();
|
|
|
String setlType = dto.getSetlType();
|
|
|
- if (StringUtil.isBlank(insurType)) {
|
|
|
- insurType = "%%";
|
|
|
- }
|
|
|
+
|
|
|
// 统筹区域
|
|
|
List<String> insuplcAdmdvs = new ArrayList<>();
|
|
|
// 险种类型
|
|
@@ -47,6 +50,7 @@ public class YbStatService {
|
|
|
List<String> med_type = new ArrayList<>();
|
|
|
// 返回结果
|
|
|
List<YbStatResult> ybStatResult = new ArrayList<>();
|
|
|
+
|
|
|
if("21".equals(setlType)){
|
|
|
// 住院
|
|
|
if("43010031001".equals(insurType) || "99".equals(insurType)){
|
|
@@ -56,6 +60,7 @@ public class YbStatService {
|
|
|
insuplcAdmdvs.add("430104");
|
|
|
insuplcAdmdvs.add("430105");
|
|
|
insuplcAdmdvs.add("430111");
|
|
|
+ insuplcAdmdvs.add("430112");
|
|
|
insuplcAdmdvs.add("430140");
|
|
|
insuplcAdmdvs.add("430199");
|
|
|
insurtype.add("310");
|
|
@@ -79,6 +84,7 @@ public class YbStatService {
|
|
|
insuplcAdmdvs.add("430104");
|
|
|
insuplcAdmdvs.add("430105");
|
|
|
insuplcAdmdvs.add("430111");
|
|
|
+ insuplcAdmdvs.add("430112");
|
|
|
insuplcAdmdvs.add("430140");
|
|
|
insuplcAdmdvs.add("430199");
|
|
|
insurtype.add("390");
|
|
@@ -102,6 +108,7 @@ public class YbStatService {
|
|
|
insuplcAdmdvs.add("430104");
|
|
|
insuplcAdmdvs.add("430105");
|
|
|
insuplcAdmdvs.add("430111");
|
|
|
+ insuplcAdmdvs.add("430112");
|
|
|
insuplcAdmdvs.add("430140");
|
|
|
insuplcAdmdvs.add("430199");
|
|
|
insurtype.add("340");
|
|
@@ -125,6 +132,7 @@ public class YbStatService {
|
|
|
insuplcAdmdvs.add("430104");
|
|
|
insuplcAdmdvs.add("430105");
|
|
|
insuplcAdmdvs.add("430111");
|
|
|
+ insuplcAdmdvs.add("430112");
|
|
|
insuplcAdmdvs.add("430140");
|
|
|
insuplcAdmdvs.add("430199");
|
|
|
med_type.add("52");
|
|
@@ -361,6 +369,7 @@ public class YbStatService {
|
|
|
insuplcAdmdvs.add("430104");
|
|
|
insuplcAdmdvs.add("430105");
|
|
|
insuplcAdmdvs.add("430111");
|
|
|
+ insuplcAdmdvs.add("430112");
|
|
|
insuplcAdmdvs.add("430140");
|
|
|
insuplcAdmdvs.add("430199");
|
|
|
insuplcAdmdvs.add("430121");
|
|
@@ -453,4 +462,578 @@ public class YbStatService {
|
|
|
return ResultVoUtil.success(ybStatResult);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ *@Author hsh
|
|
|
+ *@Description // 计算同比/环比
|
|
|
+ *@Date 2022/6/29 16:01
|
|
|
+ *@Param [dto]
|
|
|
+ *@Return thyyxxk.webserver.entity.ResultVo<java.util.List<java.util.Map<java.lang.String,java.lang.Object>>>
|
|
|
+ **/
|
|
|
+ public ResultVo<List<Map<String, Object>>> selectYbStatRatio(YbStatDto dto){
|
|
|
+ String beginTime = dto.getStartTime();
|
|
|
+ String endTime = DateUtil.getMonthEndtime(dto.getEndTime());
|
|
|
+ String setlType = dto.getSetlType();
|
|
|
+ String selectType = dto.getSelectType();
|
|
|
+
|
|
|
+ String year = beginTime.substring(0,4);
|
|
|
+ int lastYear = Integer.valueOf(year) - 1;
|
|
|
+ // 开始月份
|
|
|
+ String mouthS = beginTime.startsWith("10", 5) ? "10" : beginTime.substring(5,7).replace("0", "") ;
|
|
|
+ int m = Integer.parseInt(mouthS);
|
|
|
+ // 结束月份
|
|
|
+ String mouthE = endTime.startsWith("10", 5) ? "10" : endTime.substring(5,7).replace("0", "") ;
|
|
|
+ // 数据月份
|
|
|
+ int le = Integer.parseInt(mouthE) - Integer.parseInt(mouthS) ;
|
|
|
+
|
|
|
+ List<Map<String, Object>> ybStatRatio = new ArrayList<>();
|
|
|
+
|
|
|
+ // 查询本年数据
|
|
|
+ List<YbStatResult> result1 = dao.selectYbStatRatio(beginTime, endTime, setlType);
|
|
|
+ Map<String, YbStatResult> mapYf1 = new HashMap<>();
|
|
|
+ for(YbStatResult r : result1){
|
|
|
+ mapYf1.put(r.getYf(), r);
|
|
|
+ }
|
|
|
+
|
|
|
+ if("second".equals(selectType)) {
|
|
|
+ // 查询同比
|
|
|
+ // 查询上年数据
|
|
|
+ String beginTimeLast = DateUtil.getLastYearDate(beginTime, null);
|
|
|
+ String endTimeLast = DateUtil.getLastYearDate(endTime, null);
|
|
|
+ List<YbStatResult> result2 = dao.selectYbStatRatio(beginTimeLast, endTimeLast, setlType);
|
|
|
+ Map<String, YbStatResult> mapYf2 = new HashMap<>();
|
|
|
+ for(YbStatResult r : result2){
|
|
|
+ mapYf2.put(r.getYf(), r);
|
|
|
+ }
|
|
|
+
|
|
|
+ for(int i = m; i <= m + le; i++){
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ String yf1 = "";
|
|
|
+ String yf2 = "";
|
|
|
+ String yf3 = calCNMonth(i);
|
|
|
+ result.put("month", yf3);
|
|
|
+ if(i < 10){
|
|
|
+ yf1 = year + "-0"+ i;
|
|
|
+ yf2 = lastYear + "-0"+ i;
|
|
|
+ } else {
|
|
|
+ yf1 = year + "-" + i;
|
|
|
+ yf2 = lastYear + "-" + i;
|
|
|
+ }
|
|
|
+ YbStatResult r1 = mapYf1.get(yf1);
|
|
|
+ YbStatResult r2 = mapYf2.get(yf2);
|
|
|
+
|
|
|
+ if(!ObjectUtils.isEmpty(r1) && Double.parseDouble(r1.getTotalFee()) > 0){
|
|
|
+ result.put("zfy_jn", r1.getTotalFee());
|
|
|
+ result.put("zjj_jn", r1.getAllFunds());
|
|
|
+ result.put("ypf_jn", r1.getDrugFee());
|
|
|
+ result.put("clf_jn", r1.getMatFee());
|
|
|
+
|
|
|
+ if(!ObjectUtils.isEmpty(r2) && Double.parseDouble(r2.getTotalFee()) > 0){
|
|
|
+ result.put("zfy_qn", r2.getTotalFee());
|
|
|
+ result.put("zjj_qn", r2.getAllFunds());
|
|
|
+ result.put("ypf_qn", r2.getDrugFee());
|
|
|
+ result.put("clf_qn", r2.getMatFee());
|
|
|
+
|
|
|
+ // 都有值的时候计算同比增长率(同比增长速度=(本期发展水平-同期水平)/同期发展水平×100%)
|
|
|
+ if(Double.parseDouble(r2.getTotalFee()) > 0){
|
|
|
+ String zfyTb = DecimalUtil.percentage(DecimalUtil.minus(r1.getTotalFee(), r2.getTotalFee()), r2.getTotalFee());
|
|
|
+ result.put("zfy_tb", zfyTb);
|
|
|
+ } else {
|
|
|
+ result.put("zfy_tb", "");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(Double.parseDouble(r2.getAllFunds()) > 0){
|
|
|
+ String zjjTb = DecimalUtil.percentage(DecimalUtil.minus(r1.getAllFunds(), r2.getAllFunds()), r2.getAllFunds());
|
|
|
+ result.put("zjj_tb", zjjTb);
|
|
|
+ } else {
|
|
|
+ result.put("zjj_tb", "");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(Double.parseDouble(r2.getDrugFee()) > 0){
|
|
|
+ String ypfTb = DecimalUtil.percentage(DecimalUtil.minus(r1.getDrugFee(), r2.getDrugFee()), r2.getDrugFee());
|
|
|
+ result.put("ypf_tb", ypfTb);
|
|
|
+ } else {
|
|
|
+ result.put("ypf_tb", "");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(Double.parseDouble(r2.getMatFee()) > 0){
|
|
|
+ String clfTb = DecimalUtil.percentage(DecimalUtil.minus(r1.getMatFee(), r2.getMatFee()), r2.getMatFee());
|
|
|
+ result.put("clf_tb", clfTb);
|
|
|
+ } else {
|
|
|
+ result.put("clf_tb", "");
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ result.put("zfy_qn", "");
|
|
|
+ result.put("zjj_qn", "");
|
|
|
+ result.put("ypf_qn", "");
|
|
|
+ result.put("clf_qn", "");
|
|
|
+ result.put("zfy_tb", "");
|
|
|
+ result.put("zjj_tb", "");
|
|
|
+ result.put("ypf_tb", "");
|
|
|
+ result.put("clf_tb", "");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if(!ObjectUtils.isEmpty(r2) && Double.parseDouble(r2.getTotalFee()) > 0){
|
|
|
+ result.put("zfy_qn", r2.getTotalFee());
|
|
|
+ result.put("zjj_qn", r2.getAllFunds());
|
|
|
+ result.put("ypf_qn", r2.getDrugFee());
|
|
|
+ result.put("clf_qn", r2.getMatFee());
|
|
|
+ result.put("zfy_jn", "");
|
|
|
+ result.put("zjj_jn", "");
|
|
|
+ result.put("ypf_jn", "");
|
|
|
+ result.put("clf_jn", "");
|
|
|
+ result.put("zfy_tb", "");
|
|
|
+ result.put("zjj_tb", "");
|
|
|
+ result.put("ypf_tb", "");
|
|
|
+ result.put("clf_tb", "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ybStatRatio.add(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ // 查询环比
|
|
|
+ for(int i = m; i <= m + le; i++){
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ String yf1 = "";
|
|
|
+ // 上一个月
|
|
|
+ String yf2 = "";
|
|
|
+ String yf3 = calCNMonth(i);
|
|
|
+ result.put("month", yf3);
|
|
|
+ int s = i-1;
|
|
|
+ if(i < 10){
|
|
|
+ yf1 = year + "-0"+ i;
|
|
|
+ yf2 = year + "-0"+ s;
|
|
|
+ } else {
|
|
|
+ yf1 = year + "-" + i;
|
|
|
+ yf2 = year + "-"+ s;
|
|
|
+ }
|
|
|
+ YbStatResult r1 = mapYf1.get(yf1);
|
|
|
+ if(i == m){
|
|
|
+ if(!ObjectUtils.isEmpty(r1) && Double.parseDouble(r1.getTotalFee()) > 0){
|
|
|
+ result.put("zfy", r1.getTotalFee());
|
|
|
+ result.put("zjj", r1.getAllFunds());
|
|
|
+ result.put("ypf", r1.getDrugFee());
|
|
|
+ result.put("clf", r1.getMatFee());
|
|
|
+ result.put("zfy_hb", "");
|
|
|
+ result.put("zjj_hb", "");
|
|
|
+ result.put("ypf_hb", "");
|
|
|
+ result.put("clf_hb", "");
|
|
|
+ } else {
|
|
|
+ result.put("zfy", "0");
|
|
|
+ result.put("zjj", "0");
|
|
|
+ result.put("ypf", "0");
|
|
|
+ result.put("clf", "0");
|
|
|
+ result.put("zfy_hb", "");
|
|
|
+ result.put("zjj_hb", "");
|
|
|
+ result.put("ypf_hb", "");
|
|
|
+ result.put("clf_hb", "");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ YbStatResult r2 = mapYf1.get(yf2);
|
|
|
+ if(!ObjectUtils.isEmpty(r1) && Double.parseDouble(r1.getTotalFee()) > 0){
|
|
|
+ result.put("zfy", r1.getTotalFee());
|
|
|
+ result.put("zjj", r1.getAllFunds());
|
|
|
+ result.put("ypf", r1.getDrugFee());
|
|
|
+ result.put("clf", r1.getMatFee());
|
|
|
+ // 都有值的时候计算环比增长率(环比增长速度=(本月发展水平-上月发展水平)/上月发展水平×100%)
|
|
|
+ if(Double.parseDouble(r2.getTotalFee()) > 0){
|
|
|
+ String hb = DecimalUtil.percentage(DecimalUtil.minus(r1.getTotalFee(), r2.getTotalFee()), r2.getTotalFee());
|
|
|
+ result.put("zfy_hb", hb);
|
|
|
+ } else {
|
|
|
+ result.put("zfy_hb", "");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(r2.getAllFunds() != null && Double.parseDouble(r2.getAllFunds()) > 0){
|
|
|
+ String hb = DecimalUtil.percentage(DecimalUtil.minus(r1.getAllFunds(), r2.getAllFunds()), r2.getAllFunds());
|
|
|
+ result.put("zjj_hb", hb);
|
|
|
+ } else {
|
|
|
+ result.put("zjj_hb", "");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(r2.getDrugFee() != null && Double.parseDouble(r2.getDrugFee()) > 0){
|
|
|
+ String hb = DecimalUtil.percentage(DecimalUtil.minus(r1.getDrugFee(), r2.getDrugFee()), r2.getDrugFee());
|
|
|
+ result.put("ypf_hb", hb);
|
|
|
+ } else {
|
|
|
+ result.put("ypf_hb", "");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(r2.getMatFee() != null && Double.parseDouble(r2.getMatFee()) > 0){
|
|
|
+ String hb = DecimalUtil.percentage(DecimalUtil.minus(r1.getMatFee(), r2.getMatFee()), r2.getMatFee());
|
|
|
+ result.put("clf_hb", hb);
|
|
|
+ } else {
|
|
|
+ result.put("clf_hb", "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ ybStatRatio.add(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return ResultVoUtil.success(ybStatRatio);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *@Author hsh
|
|
|
+ *@Description // 根据数字转换中文月份
|
|
|
+ *@Date 2022/6/29 16:55
|
|
|
+ *@Param [i]
|
|
|
+ *@Return java.lang.String
|
|
|
+ **/
|
|
|
+ private String calCNMonth(int i) {
|
|
|
+ String yf;
|
|
|
+ switch (i){
|
|
|
+ case 1:
|
|
|
+ yf = "一 月";
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ yf = "二 月";
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ yf = "三 月";
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ yf = "四 月";
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ yf = "五 月";
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ yf = "六 月";
|
|
|
+ break;
|
|
|
+ case 7:
|
|
|
+ yf = "七 月";
|
|
|
+ break;
|
|
|
+ case 8:
|
|
|
+ yf = "八 月";
|
|
|
+ break;
|
|
|
+ case 9:
|
|
|
+ yf = "九 月";
|
|
|
+ break;
|
|
|
+ case 10:
|
|
|
+ yf = "十 月";
|
|
|
+ break;
|
|
|
+ case 11:
|
|
|
+ yf = "十一月";
|
|
|
+ break;
|
|
|
+ case 12:
|
|
|
+ yf = "十二月";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ yf = "";
|
|
|
+ }
|
|
|
+ return yf;
|
|
|
+ }
|
|
|
+
|
|
|
+ public ResultVo<String> exportYbStatRatioExcel(HttpServletResponse response, YbStatDto dto){
|
|
|
+ String beginTime = dto.getStartTime();
|
|
|
+ String endTime = DateUtil.getMonthEndtime(dto.getEndTime());
|
|
|
+ String setlType = dto.getSetlType();
|
|
|
+ String selectType = dto.getSelectType();
|
|
|
+ ResultVo<List<Map<String, Object>>> rs = selectYbStatRatio(dto);
|
|
|
+ List<Map<String, Object>> list = rs.getData();
|
|
|
+
|
|
|
+ if(null == list){
|
|
|
+ String log = "导出没有数据";
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.NO_DATA_EXIST, log);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 计算合计
|
|
|
+ // 查询今年数据
|
|
|
+ YbStatResult r1 = dao.selectYbStatRatioTotal(beginTime, endTime, setlType);
|
|
|
+ // 查询上年数据
|
|
|
+ String beginTimeLast = DateUtil.getLastYearDate(beginTime, null);
|
|
|
+ String endTimeLast = DateUtil.getLastYearDate(endTime, null);
|
|
|
+ YbStatResult r2 = dao.selectYbStatRatioTotal(beginTimeLast, endTimeLast, setlType);
|
|
|
+
|
|
|
+ // 计算合计
|
|
|
+ Map<String, Object> result = calTotalInfo(r1, r2, selectType);
|
|
|
+ list.add(result);
|
|
|
+
|
|
|
+ // 导出标题
|
|
|
+ String exportName = dto.getExportName();
|
|
|
+
|
|
|
+ // 组装表头
|
|
|
+ List<HeadInfo> headInfoList = calHeadList(selectType);
|
|
|
+
|
|
|
+ // 导出
|
|
|
+ ExcelUtil.exportExcelReport(response, list, headInfoList, exportName);
|
|
|
+
|
|
|
+ String log = "导出成功";
|
|
|
+ return ResultVoUtil.success(log);
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<HeadInfo> calHeadList(String selectType) {
|
|
|
+ List<HeadInfo> headInfoList = new ArrayList<>();
|
|
|
+ if("second".equals(selectType)){
|
|
|
+ HeadInfo headInfo = new HeadInfo();
|
|
|
+ headInfo.setDisplay("月份");
|
|
|
+ headInfo.setName("month");
|
|
|
+ headInfoList.add(headInfo);
|
|
|
+
|
|
|
+ headInfo = new HeadInfo();
|
|
|
+ headInfo.setDisplay("总费用");
|
|
|
+ headInfo.setName("zfy");
|
|
|
+
|
|
|
+ List<HeadInfo> headInfoList1 = new ArrayList<>();
|
|
|
+ HeadInfo headInfo1 = new HeadInfo();
|
|
|
+ headInfo1.setDisplay("今年");
|
|
|
+ headInfo1.setName("zfy_jn");
|
|
|
+ headInfoList1.add(headInfo1);
|
|
|
+
|
|
|
+ headInfo1 = new HeadInfo();
|
|
|
+ headInfo1.setDisplay("去年");
|
|
|
+ headInfo1.setName("zfy_qn");
|
|
|
+ headInfoList1.add(headInfo1);
|
|
|
+
|
|
|
+ headInfo1 = new HeadInfo();
|
|
|
+ headInfo1.setDisplay("同比");
|
|
|
+ headInfo1.setName("zfy_tb");
|
|
|
+ headInfoList1.add(headInfo1);
|
|
|
+
|
|
|
+ headInfo.setColumns(headInfoList1);
|
|
|
+ headInfoList.add(headInfo);
|
|
|
+
|
|
|
+ headInfo = new HeadInfo();
|
|
|
+ headInfo.setDisplay("全部基金");
|
|
|
+ headInfo.setName("zjj");
|
|
|
+
|
|
|
+ headInfoList1 = new ArrayList<>();
|
|
|
+ headInfo1 = new HeadInfo();
|
|
|
+ headInfo1.setDisplay("今年");
|
|
|
+ headInfo1.setName("zjj_jn");
|
|
|
+ headInfoList1.add(headInfo1);
|
|
|
+
|
|
|
+ headInfo1 = new HeadInfo();
|
|
|
+ headInfo1.setDisplay("去年");
|
|
|
+ headInfo1.setName("zjj_qn");
|
|
|
+ headInfoList1.add(headInfo1);
|
|
|
+
|
|
|
+ headInfo1 = new HeadInfo();
|
|
|
+ headInfo1.setDisplay("同比");
|
|
|
+ headInfo1.setName("zjj_tb");
|
|
|
+ headInfoList1.add(headInfo1);
|
|
|
+
|
|
|
+ headInfo.setColumns(headInfoList1);
|
|
|
+ headInfoList.add(headInfo);
|
|
|
+
|
|
|
+ headInfo = new HeadInfo();
|
|
|
+ headInfo.setDisplay("药品费用");
|
|
|
+ headInfo.setName("ypf");
|
|
|
+
|
|
|
+ headInfoList1 = new ArrayList<>();
|
|
|
+ headInfo1 = new HeadInfo();
|
|
|
+ headInfo1.setDisplay("今年");
|
|
|
+ headInfo1.setName("ypf_jn");
|
|
|
+ headInfoList1.add(headInfo1);
|
|
|
+
|
|
|
+ headInfo1 = new HeadInfo();
|
|
|
+ headInfo1.setDisplay("去年");
|
|
|
+ headInfo1.setName("ypf_qn");
|
|
|
+ headInfoList1.add(headInfo1);
|
|
|
+
|
|
|
+ headInfo1 = new HeadInfo();
|
|
|
+ headInfo1.setDisplay("同比");
|
|
|
+ headInfo1.setName("ypf_tb");
|
|
|
+ headInfoList1.add(headInfo1);
|
|
|
+
|
|
|
+ headInfo.setColumns(headInfoList1);
|
|
|
+ headInfoList.add(headInfo);
|
|
|
+
|
|
|
+ headInfo = new HeadInfo();
|
|
|
+ headInfo.setDisplay("耗材费用");
|
|
|
+ headInfo.setName("clf");
|
|
|
+
|
|
|
+ headInfoList1 = new ArrayList<>();
|
|
|
+ headInfo1 = new HeadInfo();
|
|
|
+ headInfo1.setDisplay("今年");
|
|
|
+ headInfo1.setName("clf_jn");
|
|
|
+ headInfoList1.add(headInfo1);
|
|
|
+
|
|
|
+ headInfo1 = new HeadInfo();
|
|
|
+ headInfo1.setDisplay("去年");
|
|
|
+ headInfo1.setName("clf_qn");
|
|
|
+ headInfoList1.add(headInfo1);
|
|
|
+
|
|
|
+ headInfo1 = new HeadInfo();
|
|
|
+ headInfo1.setDisplay("同比");
|
|
|
+ headInfo1.setName("clf_tb");
|
|
|
+ headInfoList1.add(headInfo1);
|
|
|
+
|
|
|
+ headInfo.setColumns(headInfoList1);
|
|
|
+ headInfoList.add(headInfo);
|
|
|
+ } else {
|
|
|
+ HeadInfo headInfo = new HeadInfo();
|
|
|
+ headInfo.setDisplay("月份");
|
|
|
+ headInfo.setName("month");
|
|
|
+ headInfoList.add(headInfo);
|
|
|
+
|
|
|
+ headInfo = new HeadInfo();
|
|
|
+ headInfo.setDisplay("总费用");
|
|
|
+ headInfo.setName("zfys");
|
|
|
+
|
|
|
+ List<HeadInfo> headInfoList1 = new ArrayList<>();
|
|
|
+ HeadInfo headInfo1 = new HeadInfo();
|
|
|
+ headInfo1.setDisplay("费用");
|
|
|
+ headInfo1.setName("zfy");
|
|
|
+ headInfoList1.add(headInfo1);
|
|
|
+
|
|
|
+ headInfo1 = new HeadInfo();
|
|
|
+ headInfo1.setDisplay("环比");
|
|
|
+ headInfo1.setName("zfy_hb");
|
|
|
+ headInfoList1.add(headInfo1);
|
|
|
+
|
|
|
+ headInfo.setColumns(headInfoList1);
|
|
|
+ headInfoList.add(headInfo);
|
|
|
+
|
|
|
+ headInfo = new HeadInfo();
|
|
|
+ headInfo.setDisplay("全部基金");
|
|
|
+ headInfo.setName("zjjs");
|
|
|
+
|
|
|
+ headInfoList1 = new ArrayList<>();
|
|
|
+ headInfo1 = new HeadInfo();
|
|
|
+ headInfo1.setDisplay("费用");
|
|
|
+ headInfo1.setName("zjj");
|
|
|
+ headInfoList1.add(headInfo1);
|
|
|
+
|
|
|
+ headInfo1 = new HeadInfo();
|
|
|
+ headInfo1.setDisplay("环比");
|
|
|
+ headInfo1.setName("zjj_hb");
|
|
|
+ headInfoList1.add(headInfo1);
|
|
|
+
|
|
|
+ headInfo.setColumns(headInfoList1);
|
|
|
+ headInfoList.add(headInfo);
|
|
|
+
|
|
|
+ headInfo = new HeadInfo();
|
|
|
+ headInfo.setDisplay("药品费用");
|
|
|
+ headInfo.setName("ypfs");
|
|
|
+
|
|
|
+ headInfoList1 = new ArrayList<>();
|
|
|
+ headInfo1 = new HeadInfo();
|
|
|
+ headInfo1.setDisplay("费用");
|
|
|
+ headInfo1.setName("ypf");
|
|
|
+ headInfoList1.add(headInfo1);
|
|
|
+
|
|
|
+ headInfo1 = new HeadInfo();
|
|
|
+ headInfo1.setDisplay("环比");
|
|
|
+ headInfo1.setName("ypf_hb");
|
|
|
+ headInfoList1.add(headInfo1);
|
|
|
+
|
|
|
+ headInfo.setColumns(headInfoList1);
|
|
|
+ headInfoList.add(headInfo);
|
|
|
+
|
|
|
+ headInfo = new HeadInfo();
|
|
|
+ headInfo.setDisplay("耗材费用");
|
|
|
+ headInfo.setName("clfs");
|
|
|
+
|
|
|
+ headInfoList1 = new ArrayList<>();
|
|
|
+ headInfo1 = new HeadInfo();
|
|
|
+ headInfo1.setDisplay("费用");
|
|
|
+ headInfo1.setName("clf");
|
|
|
+ headInfoList1.add(headInfo1);
|
|
|
+
|
|
|
+ headInfo1 = new HeadInfo();
|
|
|
+ headInfo1.setDisplay("环比");
|
|
|
+ headInfo1.setName("clf_hb");
|
|
|
+ headInfoList1.add(headInfo1);
|
|
|
+
|
|
|
+ headInfo.setColumns(headInfoList1);
|
|
|
+ headInfoList.add(headInfo);
|
|
|
+ }
|
|
|
+ return headInfoList;
|
|
|
+ }
|
|
|
+
|
|
|
+ private Map<String, Object> calTotalInfo(YbStatResult r1, YbStatResult r2, String selectType) {
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ if("second".equals(selectType)){
|
|
|
+ if(!ObjectUtils.isEmpty(r1) && Double.parseDouble(r1.getTotalFee()) > 0){
|
|
|
+ result.put("zfy_jn", r1.getTotalFee());
|
|
|
+ result.put("zjj_jn", r1.getAllFunds());
|
|
|
+ result.put("ypf_jn", r1.getDrugFee());
|
|
|
+ result.put("clf_jn", r1.getMatFee());
|
|
|
+
|
|
|
+ if(!ObjectUtils.isEmpty(r2) && Double.parseDouble(r2.getTotalFee()) > 0){
|
|
|
+ result.put("zfy_qn", r2.getTotalFee());
|
|
|
+ result.put("zjj_qn", r2.getAllFunds());
|
|
|
+ result.put("ypf_qn", r2.getDrugFee());
|
|
|
+ result.put("clf_qn", r2.getMatFee());
|
|
|
+
|
|
|
+ // 都有值的时候计算同比增长率(同比增长速度=(本期发展水平-同期水平)/同期发展水平×100%)
|
|
|
+ String zfyTb = DecimalUtil.percentage(DecimalUtil.minus(r1.getTotalFee(), r2.getTotalFee()), r2.getTotalFee());
|
|
|
+ result.put("zfy_tb", zfyTb);
|
|
|
+
|
|
|
+ if(Double.parseDouble(r2.getAllFunds()) > 0){
|
|
|
+ String zjjTb = DecimalUtil.percentage(DecimalUtil.minus(r1.getAllFunds(), r2.getAllFunds()), r2.getAllFunds());
|
|
|
+ result.put("zjj_tb", zjjTb);
|
|
|
+ } else {
|
|
|
+ result.put("zjj_tb", "");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(Double.parseDouble(r2.getDrugFee()) > 0){
|
|
|
+ String zjjTb = DecimalUtil.percentage(DecimalUtil.minus(r1.getDrugFee(), r2.getDrugFee()), r2.getDrugFee());
|
|
|
+ result.put("ypf_tb", zjjTb);
|
|
|
+ } else {
|
|
|
+ result.put("ypf_tb", "");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(Double.parseDouble(r2.getMatFee()) > 0){
|
|
|
+ String zjjTb = DecimalUtil.percentage(DecimalUtil.minus(r1.getMatFee(), r2.getMatFee()), r2.getMatFee());
|
|
|
+ result.put("clf_tb", zjjTb);
|
|
|
+ } else {
|
|
|
+ result.put("clf_tb", "");
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ result.put("zfy_qn", "");
|
|
|
+ result.put("zjj_qn", "");
|
|
|
+ result.put("ypf_qn", "");
|
|
|
+ result.put("clf_qn", "");
|
|
|
+ result.put("zfy_tb", "");
|
|
|
+ result.put("zjj_tb", "");
|
|
|
+ result.put("ypf_tb", "");
|
|
|
+ result.put("clf_tb", "");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if(!ObjectUtils.isEmpty(r2) && Double.parseDouble(r2.getTotalFee()) > 0){
|
|
|
+ result.put("zfy_qn", r2.getTotalFee());
|
|
|
+ result.put("zjj_qn", r2.getAllFunds());
|
|
|
+ result.put("ypf_qn", r2.getDrugFee());
|
|
|
+ result.put("clf_qn", r2.getMatFee());
|
|
|
+ result.put("zfy_jn", "");
|
|
|
+ result.put("zjj_jn", "");
|
|
|
+ result.put("ypf_jn", "");
|
|
|
+ result.put("clf_jn", "");
|
|
|
+ result.put("zfy_tb", "");
|
|
|
+ result.put("zjj_tb", "");
|
|
|
+ result.put("ypf_tb", "");
|
|
|
+ result.put("clf_tb", "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if(!ObjectUtils.isEmpty(r1) && Double.parseDouble(r1.getTotalFee()) > 0) {
|
|
|
+ result.put("zfy", r1.getTotalFee());
|
|
|
+ result.put("zjj", r1.getAllFunds());
|
|
|
+ result.put("ypf", r1.getDrugFee());
|
|
|
+ result.put("clf", r1.getMatFee());
|
|
|
+ result.put("zfy_tb", "");
|
|
|
+ result.put("zjj_tb", "");
|
|
|
+ result.put("ypf_tb", "");
|
|
|
+ result.put("clf_tb", "");
|
|
|
+ } else {
|
|
|
+ result.put("zfy", 0);
|
|
|
+ result.put("zjj", 0);
|
|
|
+ result.put("ypf", 0);
|
|
|
+ result.put("clf", 0);
|
|
|
+ result.put("zfy_tb", "");
|
|
|
+ result.put("zjj_tb", "");
|
|
|
+ result.put("ypf_tb", "");
|
|
|
+ result.put("clf_tb", "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ result.put("month", "合计");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
}
|