|
@ -0,0 +1,203 @@
|
|
|
package com.yihu.wlyy.controller.manager.datastatic;
|
|
|
|
|
|
import com.yihu.wlyy.controller.BaseController;
|
|
|
import com.yihu.wlyy.entity.prescription.PrescriptionPayVO;
|
|
|
import com.yihu.wlyy.entity.wechat.WechatSignVO;
|
|
|
import com.yihu.wlyy.service.manager.sign.SignFamilyService;
|
|
|
import com.yihu.wlyy.service.prescription.PrescriptionService;
|
|
|
import com.yihu.wlyy.vo.SignPayVO;
|
|
|
import jxl.Workbook;
|
|
|
import jxl.write.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
import java.io.OutputStream;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* 支付统计报表导出
|
|
|
* @author huangwenjie
|
|
|
* @date 2017/12/12 20:20
|
|
|
*/
|
|
|
@Controller
|
|
|
@RequestMapping(value = "/admin/static/pay")
|
|
|
public class PayStaticController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private SignFamilyService signFamilyService;
|
|
|
|
|
|
@Autowired
|
|
|
private PrescriptionService prescriptionService;
|
|
|
|
|
|
//页面跳转(主页面)
|
|
|
@RequestMapping(value = "initial")
|
|
|
public String listInit() {
|
|
|
return "static/static_pay";
|
|
|
}
|
|
|
|
|
|
//导出签约支付报表
|
|
|
@RequestMapping(value="signpayToExcel",method = RequestMethod.POST,produces = "application/json;charset=UTF-8" )
|
|
|
public void signPayExport(
|
|
|
@RequestParam(value = "beginDate",required = false)String beginDate,
|
|
|
@RequestParam(value = "endDate",required = false)String endDate,
|
|
|
HttpServletResponse response){
|
|
|
try {
|
|
|
List<SignPayVO> datalist = signFamilyService.geSignPayDataList(beginDate,endDate);
|
|
|
response.setContentType("octets/stream");
|
|
|
response.setHeader("Content-Disposition", "attachment; filename="+ new String( "signPayDataList.xls"));
|
|
|
OutputStream os = response.getOutputStream();
|
|
|
this.signPayWrite(os,datalist);
|
|
|
}catch (Exception ex){
|
|
|
error(ex);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//导出长处方支付报表
|
|
|
@RequestMapping(value="prescriptionToExcel",method = RequestMethod.POST,produces = "application/json;charset=UTF-8" )
|
|
|
public void prescriptionPayExport(
|
|
|
@RequestParam(value = "beginDate",required = false)String beginDate,
|
|
|
@RequestParam(value = "endDate",required = false)String endDate,
|
|
|
HttpServletResponse response){
|
|
|
try {
|
|
|
List<PrescriptionPayVO> datalist = prescriptionService.getPrescriptionPayDataList(beginDate,endDate);
|
|
|
response.setContentType("octets/stream");
|
|
|
response.setHeader("Content-Disposition", "attachment; filename="+ new String( "prescriptionPayDataList.xls"));
|
|
|
OutputStream os = response.getOutputStream();
|
|
|
this.prescriptionPayWrite(os,datalist);
|
|
|
}catch (Exception ex){
|
|
|
error(ex);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void prescriptionPayWrite(OutputStream os, List ls) throws Exception{
|
|
|
WritableWorkbook wwb = Workbook.createWorkbook(os);
|
|
|
try {
|
|
|
WritableSheet ws;
|
|
|
ws = wwb.createSheet("sheet",1);
|
|
|
|
|
|
String[] header = {"业务支付流水号","续方号","支付时间","患者", "身份证","签约社区",
|
|
|
"openID", "主体社保卡","实际社保卡","交易总金额 单位分",
|
|
|
"医保支付金额,单位分","自付金额,单位分","交易状态 成功1 失败0",
|
|
|
"本次报销总额 单位分","个人现金支付,单位分",
|
|
|
"个人账户支付,单位分","健康账户支付,单位分","公务员补助,单位分",
|
|
|
"基金支付,单位分","保健基金支付,单位分","商业保险支付,单位分",
|
|
|
"共济账户支付,单位分","民政补助金额,单位分","乙类支付金额,单位分",
|
|
|
"非医保费用,单位分","超封顶线金额,单位分","个人账户余额,单位分","健康账户余额,单位分"};
|
|
|
int k = 0;
|
|
|
for (String h : header) {
|
|
|
addCell(ws, 0, k, h);//表名,行,列,header
|
|
|
k++;
|
|
|
}
|
|
|
|
|
|
int i = 1;
|
|
|
for (PrescriptionPayVO m : (List<PrescriptionPayVO>) ls) {
|
|
|
addCell(ws, i, 0, m.getCode(),"");
|
|
|
addCell(ws, i, 1, m.getPrescription_code(),"");
|
|
|
addCell(ws, i, 2, m.getCreate_time(),"");
|
|
|
addCell(ws, i, 3, m.getUser_name(),"");
|
|
|
addCell(ws, i, 4, m.getId_no(),"");
|
|
|
addCell(ws, i, 5, m.getHospital_name(),"");
|
|
|
addCell(ws, i, 6, m.getOpenid(),"");
|
|
|
addCell(ws, i, 7, m.getCard_no(),"");
|
|
|
addCell(ws, i, 8, m.getPrincipal_card_no(),"");
|
|
|
addCell(ws, i, 9, m.getTotal_amount(),"");
|
|
|
addCell(ws, i, 10, m.getInsurance_amount(),"");
|
|
|
addCell(ws, i, 11, m.getSelf_pay_amount(),"");
|
|
|
addCell(ws, i, 12, m.getTrade_status(),"");
|
|
|
addCell(ws, i, 13, m.getMi_total_fee(),"");
|
|
|
addCell(ws, i, 14, m.getSelf_pay(),"");
|
|
|
addCell(ws, i, 15, m.getAccount_pay(),"");
|
|
|
addCell(ws, i, 16, m.getHeath_pay(),"");
|
|
|
addCell(ws, i, 17, m.getCadres_pay(),"");
|
|
|
addCell(ws, i, 18, m.getFund_pay(),"");
|
|
|
addCell(ws, i, 19, m.getHealth_care_pay(),"");
|
|
|
addCell(ws, i, 20, m.getCommerce_pay(),"");
|
|
|
addCell(ws, i, 21, m.getFamily_pay(),"");
|
|
|
addCell(ws, i, 22, m.getCivil_pay(),"");
|
|
|
addCell(ws, i, 23, m.getBdrug_pay(),"");
|
|
|
addCell(ws, i, 24, m.getUnless_amount(),"");
|
|
|
addCell(ws, i, 25, m.getExceed_amount(),"");
|
|
|
addCell(ws, i, 26, m.getAccount_balance(),"");
|
|
|
addCell(ws, i, 27, m.getHealth_balance(),"");
|
|
|
i++;
|
|
|
}
|
|
|
wwb.write();
|
|
|
wwb.close();
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
if (wwb != null) wwb.close();
|
|
|
throw e;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void signPayWrite(OutputStream os, List ls) throws Exception{
|
|
|
WritableWorkbook wwb = Workbook.createWorkbook(os);
|
|
|
try {
|
|
|
WritableSheet ws;
|
|
|
ws = wwb.createSheet("sheet",1);
|
|
|
|
|
|
String[] header = {"业务支付流水号","签约号","支付时间","患者", "身份证","患者code",
|
|
|
"openID", "主体社保卡", "实际社保卡","签约医院","交易总金额,单位分",
|
|
|
"自费金额,单位分","医保支付金额,单位分","交易状态0 成功 1 失败款",
|
|
|
"民政补助金额","个人现金支付","个人账户支付",
|
|
|
"健康账户支付","保健基金支付","本次报销总额","公务员补助"};
|
|
|
int k = 0;
|
|
|
for (String h : header) {
|
|
|
addCell(ws, 0, k, h);//表名,行,列,header
|
|
|
k++;
|
|
|
}
|
|
|
|
|
|
int i = 1;
|
|
|
for (SignPayVO m : (List<SignPayVO>) ls) {
|
|
|
addCell(ws, i, 0, m.getCode(),"");
|
|
|
addCell(ws, i, 1, m.getCharge_relation(),"");
|
|
|
addCell(ws, i, 2, m.getCreate_time(),"");
|
|
|
addCell(ws, i, 3, m.getName(),"");
|
|
|
addCell(ws, i, 4, m.getId_no(),"");
|
|
|
addCell(ws, i, 5, m.getPatient(),"");
|
|
|
addCell(ws, i, 6, m.getOpenid(),"");
|
|
|
addCell(ws, i, 7, m.getSsc(),"");
|
|
|
addCell(ws, i, 8, m.getPrincipal_ssc(),"");
|
|
|
addCell(ws, i, 9, m.getHospital_name(),"");
|
|
|
addCell(ws, i, 10, m.getTotal_amount(),"");
|
|
|
addCell(ws, i, 11, m.getSelfpay_amount(),"");
|
|
|
addCell(ws, i, 12, m.getInsurance_amount(),"");
|
|
|
addCell(ws, i, 13, m.getTrade_status(),"");
|
|
|
addCell(ws, i, 14, m.getCivil_pay(),"");
|
|
|
addCell(ws, i, 15, m.getSelf_pay(),"");
|
|
|
addCell(ws, i, 16, m.getAccount_pay(),"");
|
|
|
addCell(ws, i, 17, m.getHeath_pay(),"");
|
|
|
addCell(ws, i, 18, m.getHealth_care_pay(),"");
|
|
|
addCell(ws, i, 19, m.getMi_total_fee(),"");
|
|
|
addCell(ws, i, 20, m.getCadres_pay(),"");
|
|
|
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);
|
|
|
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);
|
|
|
}
|
|
|
}
|