|
@@ -1,5 +1,8 @@
|
|
|
package thyyxxk.webserver.service.reports;
|
|
|
|
|
|
+import cn.hutool.core.io.IoUtil;
|
|
|
+import cn.hutool.poi.excel.BigExcelWriter;
|
|
|
+import cn.hutool.poi.excel.ExcelWriter;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -9,13 +12,19 @@ import thyyxxk.webserver.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.webserver.dao.his.reports.KeShiShouRuDao;
|
|
|
import thyyxxk.webserver.entity.ResultVo;
|
|
|
import thyyxxk.webserver.entity.datamodify.GetDropdownBox;
|
|
|
+import thyyxxk.webserver.entity.excel.ToolExcel;
|
|
|
import thyyxxk.webserver.entity.querydata.KeShiFeiiYongTongJi;
|
|
|
import thyyxxk.webserver.entity.querydata.QueryDrugsAndProjects;
|
|
|
import thyyxxk.webserver.entity.xc.XcPageHelp;
|
|
|
import thyyxxk.webserver.service.PublicServer;
|
|
|
import thyyxxk.webserver.utils.*;
|
|
|
|
|
|
+import javax.servlet.ServletOutputStream;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
+import java.net.URLEncoder;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -128,6 +137,15 @@ public class KeShiShouRuServer {
|
|
|
"a.ward_code,wardCodeName = (select rtrim(name) from zd_unit_code where code = a.ward_code),"));
|
|
|
qp.setTotal(page.getTotal());
|
|
|
break;
|
|
|
+ case 5:
|
|
|
+ qw.groupBy("a.inpatient_no,a.admiss_times");
|
|
|
+ qp.setData(dao.getZhuYuanFeiYongXiangMuFenLeiV2(page,
|
|
|
+ qw,
|
|
|
+ "a.inpatient_no as patient," +
|
|
|
+ "(select rtrim(name) from a_patient_mi where a.inpatient_no = a_patient_mi.inpatient_no) as patient_name," +
|
|
|
+ "a.admiss_times as times,"));
|
|
|
+ qp.setTotal(page.getTotal());
|
|
|
+ break;
|
|
|
default:
|
|
|
|
|
|
break;
|
|
@@ -192,6 +210,15 @@ public class KeShiShouRuServer {
|
|
|
"warn_dept as wardCode,wardCodeName = (select rtrim(name) from zd_unit_code where code = warn_dept),"));
|
|
|
qp.setTotal(page.getTotal());
|
|
|
break;
|
|
|
+
|
|
|
+ case 5:
|
|
|
+ qw.groupBy("patient_id,times,name");
|
|
|
+ qp.setData(dao.getMenZhenFeiYongXiangMuFenLeiV2(
|
|
|
+ page,
|
|
|
+ qw,
|
|
|
+ "rtrim(patient_id) as patient,times,rtrim(name) as patient_name,"));
|
|
|
+ qp.setTotal(page.getTotal());
|
|
|
+ break;
|
|
|
default:
|
|
|
|
|
|
break;
|
|
@@ -200,60 +227,6 @@ public class KeShiShouRuServer {
|
|
|
return ResultVoUtil.success(qp);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- private void pingJieZiDuanMingChen(KeShiFeiiYongTongJi qp, String huanZheBiao) {
|
|
|
- if (qp.getData() != null && !qp.getData().isEmpty()) {
|
|
|
- Set<String> huanZheHaoSet = new HashSet<>();
|
|
|
- Set<String> keShiSet = new HashSet<>();
|
|
|
- Set<String> xiangMuSet = new HashSet<>();
|
|
|
- Set<String> luRuRenSet = new HashSet<>();
|
|
|
-
|
|
|
- qp.getData().forEach(item -> {
|
|
|
- huanZheHaoSet.add(item.getPatient());
|
|
|
- keShiSet.add(item.getExecUnit());
|
|
|
- keShiSet.add(item.getWardCode());
|
|
|
- xiangMuSet.add(item.getChargeCodeMx());
|
|
|
- luRuRenSet.add(item.getOpIdCode());
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- Map<String, String> huanZheXingMingMap = dao.huanZheXingMing(huanZheHaoSet, huanZheBiao).stream().collect(Collectors.toMap(GetDropdownBox::getCode, GetDropdownBox::getName, (key1, key2) -> key1));
|
|
|
- Map<String, String> xiangMuMingChenMap = dao.xiangMuMingChen(xiangMuSet).stream().collect(Collectors.toMap(GetDropdownBox::getCode, GetDropdownBox::getName, (key1, key2) -> key1));
|
|
|
-
|
|
|
- Map<String, String> huoQuKeShiMap = dao.huoQuKeShiHuoRenYuan(keShiSet, "zd_unit_code").stream().collect(Collectors.toMap(GetDropdownBox::getCode, GetDropdownBox::getName, (key1, key2) -> key1));
|
|
|
-
|
|
|
- // 获取人员信息
|
|
|
- List<GetDropdownBox> RenYuan = dao.huoQuKeShiHuoRenYuan(luRuRenSet, "a_employee_mi");
|
|
|
- // 第一次用 code 匹配
|
|
|
- Map<String, String> luRuRenXingMingMap = RenYuan.stream().collect(Collectors.toMap(GetDropdownBox::getCode, GetDropdownBox::getName, (key1, key2) -> key1));
|
|
|
-
|
|
|
- // 第二次用 code_rs 匹配
|
|
|
- Map<String, String> luRuRenXingMingRenShiMap = RenYuan.stream().collect(Collectors.toMap(GetDropdownBox::getCodeRs, GetDropdownBox::getName, (key1, key2) -> key1));
|
|
|
-
|
|
|
- qp.getData().forEach(item -> {
|
|
|
- if (huanZheXingMingMap.containsKey(item.getPatient())) {
|
|
|
- item.setPatientName(huanZheXingMingMap.get(item.getPatient()));
|
|
|
- }
|
|
|
- if (xiangMuMingChenMap.containsKey(item.getChargeCodeMx())) {
|
|
|
- item.setChargeCodeName(xiangMuMingChenMap.get(item.getChargeCodeMx()));
|
|
|
- }
|
|
|
- if (huoQuKeShiMap.containsKey(item.getExecUnit())) {
|
|
|
- item.setExecUnitName(huoQuKeShiMap.get(item.getExecUnit()));
|
|
|
- }
|
|
|
- if (huoQuKeShiMap.containsKey(item.getWardCode())) {
|
|
|
- item.setWardCodeName(huoQuKeShiMap.get(item.getWardCode()));
|
|
|
- }
|
|
|
- if (luRuRenXingMingMap.containsKey(item.getOpIdCode())) {
|
|
|
- item.setOpName(luRuRenXingMingMap.get(item.getOpIdCode()));
|
|
|
- } else if (luRuRenXingMingRenShiMap.containsKey(item.getOpIdCode())) {
|
|
|
- item.setOpName(luRuRenXingMingRenShiMap.get(item.getOpIdCode()));
|
|
|
- } else {
|
|
|
- item.setOpName(item.getOpIdCode());
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
public void exportExcel(HttpServletResponse response, QueryDrugsAndProjects param) {
|
|
|
double pageSize = 1000;
|
|
|
double currentPage = param.getTotal() / pageSize;
|
|
@@ -264,39 +237,46 @@ public class KeShiShouRuServer {
|
|
|
param.setCurrentPage(i + 1);
|
|
|
keShiFeiiYongTongJisList.addAll(getKeShouFei(param).getData().getData());
|
|
|
}
|
|
|
+ ToolExcel excel = new ToolExcel();
|
|
|
|
|
|
- String[] title;
|
|
|
- if (param.getFenLei() == 3) {
|
|
|
- title = new String[]{"患者姓名", "住院/门诊号", "次数", "项目编码", "项目名称", "收费日期", "录入人", "执行科室", "申请科室", "金额", "数量", "来源"};
|
|
|
- } else {
|
|
|
- title = new String[]{param.getFenLei() == 0 ? "日期" : param.getFenLei() == 1 ? "录入人" : "项目编码", "金额", "数量", "来源"};
|
|
|
- }
|
|
|
- String[][] content = new String[keShiFeiiYongTongJisList.size()][];
|
|
|
- for (int i = 0; i < keShiFeiiYongTongJisList.size(); i++) {
|
|
|
- content[i] = new String[title.length];
|
|
|
- KeShiFeiiYongTongJi pojo = keShiFeiiYongTongJisList.get(i);
|
|
|
- if (param.getFenLei() == 3) {
|
|
|
- content[i][0] = pojo.getPatientName();
|
|
|
- content[i][1] = pojo.getPatient();
|
|
|
- content[i][2] = pojo.getTimes().toString();
|
|
|
- content[i][3] = pojo.getChargeCodeMx();
|
|
|
- content[i][4] = pojo.getChargeCodeName();
|
|
|
- content[i][5] = DateUtil.formatDatetime(pojo.getChargeDate());
|
|
|
- content[i][6] = pojo.getOpName();
|
|
|
- content[i][7] = pojo.getExecUnitName();
|
|
|
- content[i][8] = pojo.getWardCodeName();
|
|
|
- content[i][9] = pojo.getChargeFee().toString();
|
|
|
- content[i][10] = pojo.getChargeAmount().toString();
|
|
|
- content[i][11] = pojo.getSource();
|
|
|
- } else {
|
|
|
- content[i][0] = param.getFenLei() == 0 ? pojo.getChargeDateString() : param.getFenLei() == 1 ? pojo.getOpName() : pojo.getChargeCodeName();
|
|
|
- content[i][1] = pojo.getChargeFee().toString();
|
|
|
- content[i][2] = pojo.getChargeAmount().toString();
|
|
|
- content[i][3] = pojo.getSource();
|
|
|
- }
|
|
|
+ switch (param.getFenLei()) {
|
|
|
+ case 0:
|
|
|
+ excel.addTitle("chargeDateString", "收费日期", 21);
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ excel.addTitle("opName", "录入人");
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ excel.addTitle("chargeCodeMx", "项目编码")
|
|
|
+ .addTitle("chargeCodeName", "项目名称", 30);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ excel.addTitle("patientName", "姓名")
|
|
|
+ .addTitle("patient", "住院号")
|
|
|
+ .addTitle("times", "次数")
|
|
|
+ .addTitle("chargeCodeMx", "项目编码")
|
|
|
+ .addTitle("chargeCodeName", "项目名称", 30)
|
|
|
+ .addTitle("chargeDate", "执行日期", 21)
|
|
|
+ .addTitle("chargeDateString", "收费日期", 21)
|
|
|
+ .addTitle("opName", "录入人")
|
|
|
+ .addTitle("execUnitName", "执行科室")
|
|
|
+ .addTitle("wardCodeName", "申请科室");
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ excel.addTitle("wardCodeName", "申请科室");
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ excel.addTitle("patientName", "姓名")
|
|
|
+ .addTitle("patient", "住院号")
|
|
|
+ .addTitle("times", "次数");
|
|
|
+ break;
|
|
|
}
|
|
|
- ExcelUtil.exportExcel(response, title, content);
|
|
|
- }
|
|
|
|
|
|
+ excel.addTitle("chargeFee", "金额")
|
|
|
+ .addTitle("chargeAmount", "数量")
|
|
|
+ .addTitle("source", "来源")
|
|
|
+ .exportExcel(keShiFeiiYongTongJisList, response);
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
}
|