|
@ -3915,33 +3915,64 @@ public class StatisticsESService {
|
|
|
* @param type 1.自取,2.快递配送,3.健管师配送
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Map<String, Object>> getPrescriptionDispatchingHistogram(int level, String area, String disease, String type) throws Exception {
|
|
|
String index62 = "62";//统计长处方配送方式和疾病维度
|
|
|
String index67 = "67";//统计长处方配送方式维度
|
|
|
public List<Map<String, Object>> getPrescriptionDispatchingHistogram(int level, String area, String disease, String type,int interval) throws Exception {
|
|
|
//统计长处方配送方式和疾病维度
|
|
|
String index62 = "62";
|
|
|
//统计长处方配送方式维度
|
|
|
String index67 = "67";
|
|
|
|
|
|
String startTime = "";
|
|
|
String endTime = "";
|
|
|
|
|
|
List<Map<String, Object>> rs = new ArrayList<>();
|
|
|
Calendar dd = Calendar.getInstance();//定义日期实例
|
|
|
//定义日期实例
|
|
|
Calendar dd = Calendar.getInstance();
|
|
|
Date endDate = new Date();
|
|
|
dd.setTime(endDate);
|
|
|
|
|
|
for (int i = 1; i < 7; i++) {
|
|
|
Map<String, Object> mc = new HashedMap();
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
|
|
String date = sdf.format(dd.getTime());
|
|
|
mc.put("month", date);
|
|
|
mc.put("count", 0.0D);
|
|
|
dd.add(Calendar.MONTH, -1);
|
|
|
rs.add(mc);
|
|
|
//六个月前的开始时间
|
|
|
Date startDate = DateUtil.getNextMonthReturnDate(endDate,-6);
|
|
|
if (interval==1){
|
|
|
rs = DateUtil.findDates(startDate,endDate);
|
|
|
//加入当天数据
|
|
|
Map<String,Object> dateMap = new HashedMap();
|
|
|
dateMap.put("date",dateFormat.format(endDate));
|
|
|
dateMap.put("avg",0);
|
|
|
dateMap.put("count", 0.0D);
|
|
|
rs.add(dateMap);
|
|
|
}
|
|
|
if (interval==2){
|
|
|
rs = DateUtil.findDateASWeeks(startDate,endDate);
|
|
|
String MondayWeekDateStr = DateUtil.getMondayOfThisDate(startDate);
|
|
|
Date MondayWeekDate = dateFormat.parse(MondayWeekDateStr);
|
|
|
if (startDate.compareTo(MondayWeekDate)==1){
|
|
|
//开始时间不是当周的周一,则加入本周周一的时间
|
|
|
Map<String,Object> dateMap = new HashedMap();
|
|
|
dateMap.put("date",MondayWeekDateStr);
|
|
|
dateMap.put("avg",0);
|
|
|
dateMap.put("count", 0.0D);
|
|
|
rs.add(0,dateMap);
|
|
|
}
|
|
|
startTime = dateFormat.format(startDate);
|
|
|
endTime = dateFormat.format(endDate);
|
|
|
}else if (interval==3){
|
|
|
for (int i = 1; i < 7; i++) {
|
|
|
Map<String, Object> mc = new HashedMap();
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
|
|
String date = sdf.format(dd.getTime());
|
|
|
mc.put("month", date);
|
|
|
mc.put("count", 0.0D);
|
|
|
dd.add(Calendar.MONTH, -1);
|
|
|
rs.add(mc);
|
|
|
}
|
|
|
startTime = DateUtil.dateToStr(dd.getTime(), "YYYY-MM-dd HH:mm:ss");
|
|
|
endTime = DateUtil.dateToStr(new Date(), "YYYY-MM-dd HH:mm:ss");
|
|
|
}
|
|
|
|
|
|
String startTime = DateUtil.dateToStr(dd.getTime(), "YYYY-MM-dd HH:mm:ss");
|
|
|
String endTime = DateUtil.dateToStr(new Date(), "YYYY-MM-dd HH:mm:ss");
|
|
|
|
|
|
List<SaveModel> resultList = new ArrayList<>();
|
|
|
if (StringUtils.isNotBlank(disease)) {
|
|
|
resultList = elasticsearchUtil.findLineChartDateQuotaLevel2(startTime, endTime, area, level, index62, SaveModel.timeLevel_ZL, SaveModel.interval_month, type,disease);
|
|
|
resultList = elasticsearchUtil.findLineChartDateQuotaLevel2(startTime, endTime, area, level, index62, SaveModel.timeLevel_ZL, String.valueOf(interval), type,disease);
|
|
|
} else {
|
|
|
resultList = elasticsearchUtil.findLineChartDateQuotaLevel1(startTime, endTime, area, level, index67, SaveModel.timeLevel_ZL, SaveModel.interval_month, type);
|
|
|
resultList = elasticsearchUtil.findLineChartDateQuotaLevel1(startTime, endTime, area, level, index67, SaveModel.timeLevel_ZL, String.valueOf(interval), type);
|
|
|
}
|
|
|
|
|
|
for (Map<String, Object> m : rs) {
|
|
@ -3949,9 +3980,16 @@ public class StatisticsESService {
|
|
|
while (iterator.hasNext()) {
|
|
|
SaveModel saveModel = (SaveModel) iterator.next();
|
|
|
if (saveModel.getQuotaDate() != null) {
|
|
|
String monthKey = (String) m.get("month");
|
|
|
String monthKeyEs = DateUtil.changeQuotaDate(saveModel.getQuotaDate());
|
|
|
if (monthKey.equals(monthKeyEs)) {
|
|
|
String key = "";
|
|
|
String EsKey ="";
|
|
|
if (interval != 3){
|
|
|
key=String.valueOf(m.get("date"));
|
|
|
EsKey = DateUtil.dateToStr(saveModel.getQuotaDate(),"yyyy-MM-dd");
|
|
|
}else {
|
|
|
key=String.valueOf(m.get("month"));
|
|
|
EsKey = DateUtil.changeQuotaDate(saveModel.getQuotaDate());
|
|
|
}
|
|
|
if (key.equals(EsKey)) {
|
|
|
m.put("count", saveModel.getResult2());
|
|
|
}
|
|
|
}
|
|
@ -4628,6 +4666,17 @@ public class StatisticsESService {
|
|
|
return jo;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 线上缴费的情况
|
|
|
* @param area
|
|
|
* @param level
|
|
|
* @param index
|
|
|
* @param sort
|
|
|
* @param lowLevel
|
|
|
* @param year
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public JSONArray getLowLevelSignPayOnline(String area, int level, String index, int sort, String lowLevel, String year) throws Exception {
|
|
|
|
|
|
String timeKey = "";
|