|
@ -99,69 +99,53 @@ public class PayInfoNoticeService {
|
|
|
}
|
|
|
|
|
|
//导出es查询数据
|
|
|
public void exportEsPrescription(OutputStream os, List<Map<String,Object>> list) throws Exception{
|
|
|
public void exportEsPrescription(OutputStream os, List<Map<String,Object>> totallist,List<Map<String,Object>> listDay) throws Exception{
|
|
|
|
|
|
WorkbookSettings settings = new WorkbookSettings();
|
|
|
settings.setWriteAccess(null);
|
|
|
settings.setEncoding("UTF-8");
|
|
|
WritableWorkbook wwb = jxl.Workbook.createWorkbook(os,settings);
|
|
|
List<Map<String,Object>> totallist = new ArrayList<>();
|
|
|
if (null!=list&&list.size()>0){
|
|
|
totallist =list;
|
|
|
}
|
|
|
/* HSSFWorkbook workbook = new HSSFWorkbook();
|
|
|
HSSFSheet sheet = workbook.createSheet("shee1");
|
|
|
//headers表示excel表中第一行的表头
|
|
|
HSSFRow row = sheet.createRow(0);
|
|
|
//在excel表中添加表头
|
|
|
String[] header = {"医生姓名", "出诊科室", "接诊数量", "开方数量", "物流数量"};
|
|
|
for(int i=0;i<header.length;i++){
|
|
|
HSSFCell cell = row.createCell(i);
|
|
|
HSSFRichTextString text = new HSSFRichTextString(header[i]);
|
|
|
cell.setCellValue(text);
|
|
|
}
|
|
|
workbook.write(os);
|
|
|
//接诊 +开方+物流
|
|
|
List<Map<String,Object>> totallist = new ArrayList<>();
|
|
|
if (null!=list&&list.size()>0){
|
|
|
totallist =list;
|
|
|
}
|
|
|
int rowNum = 1;
|
|
|
if (null!=totallist&&totallist.size()>0){
|
|
|
for (int n=0;n<totallist.size();n++) {
|
|
|
Map<String,Object> object = totallist.get(n);
|
|
|
HSSFRow row1 = sheet.createRow(rowNum);
|
|
|
row1.createCell(0).setCellValue(object.get("doctorName").toString());
|
|
|
row1.createCell(1).setCellValue(null==object.get("deptName")?"":object.get("deptName").toString());
|
|
|
row1.createCell(2).setCellValue(null==object.get("pickNum")?"":object.get("pickNum").toString());
|
|
|
row1.createCell(3).setCellValue(null==object.get("preNum")?"":object.get("preNum").toString());
|
|
|
row1.createCell(4).setCellValue(null==object.get("wlNum")?"":object.get("wlNum").toString());
|
|
|
rowNum++;
|
|
|
}
|
|
|
}
|
|
|
workbook.write(os);*/
|
|
|
try {
|
|
|
WritableSheet ws;
|
|
|
ws = wwb.createSheet("sheet", 1);
|
|
|
|
|
|
String[] header = {"医生姓名", "出诊科室", "接诊数量", "开方数量", "物流数量"};
|
|
|
int k = 0;
|
|
|
WritableSheet ws2 = wwb.createSheet("sheet2", 2);
|
|
|
String[] header = {"医生姓名", "出诊科室","发起问诊", "接诊数量", "开方数量", "物流数量"};
|
|
|
String[] header2 = {"时间", "发起问诊", "接诊数量", "开方数量", "物流数量"};
|
|
|
int k = 0;
|
|
|
int m =0;
|
|
|
for (String h : header) {
|
|
|
addCell(ws, 0, k, h);//表名,行,列,header
|
|
|
k++;
|
|
|
}
|
|
|
for (String h : header2) {
|
|
|
addCell(ws2, 0, m, h);//表名,行,列,header
|
|
|
m++;
|
|
|
}
|
|
|
int i = 1;
|
|
|
if (null!=totallist&&totallist.size()>0){
|
|
|
for (int n=0;n<totallist.size();n++) {
|
|
|
Map<String,Object> object = totallist.get(n);
|
|
|
addCell(ws, i, 0, object.get("doctorName").toString(), "");
|
|
|
addCell(ws, i, 1, null==object.get("deptName")?"":object.get("deptName").toString(),"");
|
|
|
addCell(ws, i, 2, null==object.get("pickNum")?"":object.get("pickNum").toString(),"");
|
|
|
addCell(ws, i, 3, null==object.get("preNum")?"":object.get("preNum").toString(),"");
|
|
|
addCell(ws, i, 4, null==object.get("wlNum")?"":object.get("wlNum").toString(),"");
|
|
|
addCell(ws, i, 2, null==object.get("total")?"":object.get("total").toString(),"");
|
|
|
addCell(ws, i, 3, null==object.get("pickNum")?"":object.get("pickNum").toString(),"");
|
|
|
addCell(ws, i, 4, null==object.get("preNum")?"":object.get("preNum").toString(),"");
|
|
|
addCell(ws, i, 5, null==object.get("wlNum")?"":object.get("wlNum").toString(),"");
|
|
|
i++;
|
|
|
}
|
|
|
}
|
|
|
int j =1;
|
|
|
if (null!=listDay&&listDay.size()>0){
|
|
|
for (int n=0;n<listDay.size();n++){
|
|
|
Map<String,Object> object = listDay.get(n);
|
|
|
addCell(ws2, j, 0, object.get("daliy").toString(), "");
|
|
|
addCell(ws2, j, 1, null==object.get("total")?"":object.get("total").toString(),"");
|
|
|
addCell(ws2, j, 2, null==object.get("pickNum")?"":object.get("pickNum").toString(),"");
|
|
|
addCell(ws2, j, 3, null==object.get("preNum")?"":object.get("preNum").toString(),"");
|
|
|
addCell(ws2, j, 4, null==object.get("wlNum")?"":object.get("wlNum").toString(),"");
|
|
|
j++;
|
|
|
}
|
|
|
}
|
|
|
wwb.write();
|
|
|
wwb.close();
|
|
|
} catch (IOException e) {
|
|
@ -195,7 +179,8 @@ public class PayInfoNoticeService {
|
|
|
"\tcount(*) as \"total\" \n" +
|
|
|
"FROM\n" +
|
|
|
"\t wlyy_outpatient t \n" +
|
|
|
"WHERE 1=1 and t.doctor is not null\n" ;
|
|
|
"WHERE 1=1 and t.doctor is not null\n " +
|
|
|
" AND t.doctor!='402803816babc778016babd0dee21112'" ;
|
|
|
//接诊量
|
|
|
String sqlDoctorOut = "SELECT\n" +
|
|
|
"\tt.doctor as \"doctor\",\n" +
|
|
@ -204,7 +189,8 @@ public class PayInfoNoticeService {
|
|
|
"\tcount(*) as \"total\" \n" +
|
|
|
"FROM\n" +
|
|
|
"\t wlyy_outpatient t \n" +
|
|
|
"WHERE 1=1 and t.doctor is not null\n";
|
|
|
"WHERE 1=1 and t.doctor is not null\n" +
|
|
|
" AND t.doctor!='402803816babc778016babd0dee21112'";
|
|
|
//开具处方量
|
|
|
String sqlPrescription = "SELECT\n" +
|
|
|
"\tt.doctor as \"doctor\",\n" +
|
|
@ -213,7 +199,8 @@ public class PayInfoNoticeService {
|
|
|
"\tcount(*) as \"total\" \n" +
|
|
|
"FROM\n" +
|
|
|
"\t wlyy_prescription t \n" +
|
|
|
"WHERE 1=1 and t.doctor is not null\n" ;
|
|
|
"WHERE 1=1 and t.doctor is not null\n" +
|
|
|
" AND t.doctor!='402803816babc778016babd0dee21112'" ;
|
|
|
//物流量
|
|
|
String sqlWL = "SELECT\n" +
|
|
|
"\to.doctor as \"doctor\",\n" +
|
|
@ -224,7 +211,8 @@ public class PayInfoNoticeService {
|
|
|
" base.wlyy_prescription_expressage t\n" +
|
|
|
"LEFT JOIN base.wlyy_prescription b ON b.outpatient_id = t.outpatient_id\n" +
|
|
|
"LEFT JOIN base.wlyy_outpatient o ON o.id= b.outpatient_id\n" +
|
|
|
"WHERE 1=1 and o.doctor is not null\n" ;
|
|
|
"WHERE 1=1 and o.doctor is not null\n" +
|
|
|
" AND o.doctor!='402803816babc778016babd0dee21112'" ;
|
|
|
if (StringUtils.isNotEmpty(beginTime)){
|
|
|
wxId="xx";
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
@ -296,7 +284,7 @@ public class PayInfoNoticeService {
|
|
|
"AND b.drug_fee !=0\n" +
|
|
|
"AND b.real_order IS not NULL"+
|
|
|
"\tGROUP BY o.doctor_name,\n" +
|
|
|
"\to.dept_name,o.doctor";;
|
|
|
"\to.dept_name,o.doctor";
|
|
|
List<Map<String,Object>> result = new ArrayList<>();
|
|
|
List<Map<String,Object>> outPatient=hibenateUtils.createSQLQuery(sqlOutPatient);
|
|
|
List<Map<String,Object>> docPickup=hibenateUtils.createSQLQuery(sqlDoctorOut);
|
|
@ -330,5 +318,94 @@ public class PayInfoNoticeService {
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
//按天分组查询
|
|
|
public List<Map<String,Object>> dealSqlQueryGroupDay(String beginTime,String endTime){
|
|
|
|
|
|
String sqlDemo = "SELECT\n" +
|
|
|
"\tdate_format( t.create_time, '%Y-%m-%d' ) as \"daliy\",\n" +
|
|
|
"\tcount( * ) as \"total\" \n" +
|
|
|
"FROM\n" ;
|
|
|
//发起复诊量
|
|
|
String outPatinet =sqlDemo+ "\twlyy_outpatient t where 1=1 AND t.doctor!='402803816babc778016babd0dee21112' and " +
|
|
|
"t.STATUS IN ( 0,1,2,3 )";
|
|
|
//接诊
|
|
|
String outPick =sqlDemo+ "\twlyy_outpatient t where 1=1 AND t.doctor!='402803816babc778016babd0dee21112' " +
|
|
|
" and t.STATUS IN (1,2,3) and t.doctor is not null ";
|
|
|
//处方
|
|
|
String pre = sqlDemo+"\twlyy_prescription t where 1=1 AND t.doctor!='402803816babc778016babd0dee21112'";
|
|
|
//物流
|
|
|
String wl =sqlDemo+" base.wlyy_prescription_expressage t\n" +
|
|
|
"LEFT JOIN base.wlyy_prescription b ON b.outpatient_id = t.outpatient_id\n" +
|
|
|
"LEFT JOIN base.wlyy_outpatient o ON o.id= b.outpatient_id\n" +
|
|
|
"WHERE t.oneself_pickup_flg = 0\n" +
|
|
|
"AND b.`status`IN(20,32,100)\n" +
|
|
|
"AND b.drug_fee !=0\n" +
|
|
|
"AND b.real_order IS not NULL" +
|
|
|
" AND o.doctor!='402803816babc778016babd0dee21112'";
|
|
|
String deltime = "";
|
|
|
if (StringUtils.isNotEmpty(beginTime)){
|
|
|
wxId="xx";
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
if (flag){
|
|
|
deltime+=" and t.create_time > '" + beginTime + " 00:00:00' ";
|
|
|
|
|
|
}else {
|
|
|
deltime+=" and t.create_time > to_date('" + beginTime + " 00:00:00', 'yyyy-mm-dd hh24:mi:ss') ";
|
|
|
|
|
|
}
|
|
|
}else{
|
|
|
deltime+=" and t.create_time > '" + beginTime + " 00:00:00'";
|
|
|
}
|
|
|
}
|
|
|
if (StringUtils.isNotEmpty(endTime)){
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
if (flag){
|
|
|
deltime+=" and t.create_time<'" + endTime + " 23:59:59'";
|
|
|
|
|
|
}else {
|
|
|
deltime+=" and t.create_time< to_date('" + endTime + " 23:59:59','yyyy-mm-dd hh24:mi:ss')";
|
|
|
}
|
|
|
}else{
|
|
|
deltime+=" and t.create_time<'" + endTime + " 23:59:59'";
|
|
|
}
|
|
|
}
|
|
|
deltime+=" group by date_format(t.create_time, '%Y-%m-%d');";
|
|
|
outPatinet+=deltime;
|
|
|
outPick +=deltime;
|
|
|
pre +=deltime;
|
|
|
wl+=deltime;
|
|
|
List<Map<String,Object>> result = new ArrayList<>();
|
|
|
List<Map<String,Object>> outPatient=hibenateUtils.createSQLQuery(outPatinet);
|
|
|
List<Map<String,Object>> docPickup=hibenateUtils.createSQLQuery(outPick);
|
|
|
List<Map<String,Object>> prescription=hibenateUtils.createSQLQuery(pre);
|
|
|
List<Map<String,Object>> wls=hibenateUtils.createSQLQuery(wl);
|
|
|
if(null!=outPatient&&outPatient.size()>0){
|
|
|
for (Map<String,Object> map:outPatient){
|
|
|
if (docPickup!=null&&docPickup.size()>0){
|
|
|
for (Map<String,Object> pickMap:docPickup){
|
|
|
if (pickMap.get("daliy").toString().equalsIgnoreCase(map.get("daliy").toString())){
|
|
|
map.put("pickNum",null==pickMap.get("total")?"":pickMap.get("total").toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (prescription!=null&&prescription.size()>0){
|
|
|
for (Map<String,Object> preMap:prescription){
|
|
|
if (preMap.get("daliy").toString().equalsIgnoreCase(map.get("daliy").toString())){
|
|
|
map.put("preNum",null==preMap.get("total")?"":preMap.get("total").toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (wl!=null&&wls.size()>0){
|
|
|
for (Map<String,Object> wMap:wls){
|
|
|
if (wMap.get("daliy").toString().equalsIgnoreCase(map.get("daliy").toString())){
|
|
|
map.put("wlNum",null==wMap.get("total")?"":wMap.get("total").toString());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
result.add(map);
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|