|
@ -20,6 +20,8 @@ import com.yihu.jw.restmodel.hospital.statistics.ScreenQvo;
|
|
|
import com.yihu.jw.rm.base.BaseRequestMapping;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
|
import jxl.format.VerticalAlignment;
|
|
|
import jxl.write.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@ -29,6 +31,8 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.transaction.Transactional;
|
|
|
import java.io.IOException;
|
|
|
import java.io.OutputStream;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.text.ParseException;
|
|
@ -5820,13 +5824,106 @@ public class StatisticsEsService {
|
|
|
return object;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 导出语句
|
|
|
*
|
|
|
* @param flag
|
|
|
* @param startDate
|
|
|
* @param endDate
|
|
|
* @param level
|
|
|
* @param area
|
|
|
* @param lowLevel
|
|
|
* @param lowCode
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public List<Map<String,Object>> selectArticleCountExcel(Integer flag, String startDate, String endDate,int level, String area, String lowLevel, String lowCode) throws Exception {
|
|
|
if (level==4){
|
|
|
List<Map<String,Object>> mapList = getArticleExcel(flag,startDate,endDate,level,area, "5", null);
|
|
|
for (Map<String,Object> map:mapList){
|
|
|
List<Map<String,Object>> maps= getArticleExcel(flag,startDate,endDate,5,map.get("code").toString(), "6", null);
|
|
|
map.put("doctors",maps);
|
|
|
}
|
|
|
return mapList;
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
public void pushArticleTotalExcel(OutputStream os, List<Map<String, Object>> list) throws Exception{
|
|
|
WritableWorkbook wwb = jxl.Workbook.createWorkbook(os);
|
|
|
try {
|
|
|
WritableSheet ws;
|
|
|
ws = wwb.createSheet("sheet", 1);
|
|
|
|
|
|
String[] header = {"科室","医生","发布类型","发布量","点赞量","收藏数","评论数"};
|
|
|
int k = 0;
|
|
|
for (String h : header) {
|
|
|
addCell(ws, 0, k, h);//表名,行,列,header
|
|
|
k++;
|
|
|
}
|
|
|
|
|
|
int i = 1;
|
|
|
String n = "";
|
|
|
|
|
|
|
|
|
for (Map<String, Object> m : list) {
|
|
|
addCell(ws, i, 0, m.get("name")!=null?m.get("name").toString():n);
|
|
|
addCell(ws, i, 1, "-");
|
|
|
addCell(ws, i, 2, m.get("publishTypeCount")!=null?m.get("publishTypeCount").toString():n);
|
|
|
addCell(ws, i, 3, m.get("total")!=null?m.get("total").toString():n);
|
|
|
addCell(ws, i, 4, m.get("dianzangCount")!=null?m.get("dianzangCount").toString():n);
|
|
|
addCell(ws, i, 5, m.get("collectCount")!=null?m.get("collectCount").toString():n);
|
|
|
addCell(ws, i, 6, m.get("pinglunCount")!=null?m.get("pinglunCount").toString():n);
|
|
|
i++;
|
|
|
List<Map<String,Object>> maps = (List<Map<String, Object>>) m.get("doctors");
|
|
|
for (Map<String,Object> map:maps){
|
|
|
addCell(ws, i, 0, m.get("name")!=null?m.get("name").toString():n);
|
|
|
addCell(ws, i, 1, map.get("name")!=null?map.get("name").toString():n);
|
|
|
addCell(ws, i, 2, map.get("publishTypeCount")!=null?map.get("publishTypeCount").toString():n);
|
|
|
addCell(ws, i, 3, map.get("total")!=null?map.get("total").toString():n);
|
|
|
addCell(ws, i, 4, map.get("dianzangCount")!=null?map.get("dianzangCount").toString():n);
|
|
|
addCell(ws, i, 5, map.get("collectCount")!=null?map.get("collectCount").toString():n);
|
|
|
addCell(ws, i, 6, map.get("pinglunCount")!=null?map.get("pinglunCount").toString():n);
|
|
|
i++;
|
|
|
}
|
|
|
}
|
|
|
wwb.write();
|
|
|
wwb.close();
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
if (wwb != null) wwb.close();
|
|
|
throw e;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//添加单元格内容
|
|
|
public void addCell(WritableSheet ws, int row, int column, String data) throws WriteException {
|
|
|
Label label = new Label(column, row, data);
|
|
|
WritableCellFormat cellFormat = new WritableCellFormat();
|
|
|
cellFormat.setAlignment(jxl.format.Alignment.CENTRE);
|
|
|
cellFormat.setVerticalAlignment(VerticalAlignment.CENTRE);
|
|
|
label.setCellFormat(cellFormat);
|
|
|
ws.addCell(label);
|
|
|
}
|
|
|
|
|
|
//添加单元格内容
|
|
|
public void addCell(WritableSheet ws, int row, int column, String data, String memo) throws WriteException {
|
|
|
Label label = new Label(column, row, data);
|
|
|
if (!org.springframework.util.StringUtils.isEmpty(memo)) {
|
|
|
WritableCellFeatures cellFeatures = new WritableCellFeatures();
|
|
|
cellFeatures.setComment(memo);
|
|
|
label.setCellFeatures(cellFeatures);
|
|
|
}
|
|
|
ws.addCell(label);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 全院统计
|
|
|
*
|
|
|
* @param flag 0自定义 1本月2近半年3本年
|
|
|
* @param startDate 开始时间
|
|
|
* @param endDate 结束时间
|
|
|
* @param level 等级 1 省 2 市 3 区县 4 机构 5团队
|
|
|
* @param level 等级 2 市 3区 4医院 5、科室 6医生
|
|
|
* @param area code 厦门市 350200 code 和level是对应的
|
|
|
* @param lowLevel
|
|
|
* @param lowCode
|