|
|
@@ -8,10 +8,12 @@ import cn.hnthyy.thmz.comment.UserLoginToken;
|
|
|
import cn.hnthyy.thmz.common.Constants;
|
|
|
import cn.hnthyy.thmz.entity.MzException;
|
|
|
import cn.hnthyy.thmz.entity.his.*;
|
|
|
+import cn.hnthyy.thmz.entity.thmz.Mzmxsr;
|
|
|
import cn.hnthyy.thmz.entity.thmz.User;
|
|
|
import cn.hnthyy.thmz.enums.PayMarkEnum;
|
|
|
import cn.hnthyy.thmz.enums.YesNoEnum;
|
|
|
import cn.hnthyy.thmz.service.his.*;
|
|
|
+import cn.hnthyy.thmz.service.thmz.MzmxsrService;
|
|
|
import cn.hnthyy.thmz.service.thmz.UserService;
|
|
|
import cn.hnthyy.thmz.vo.*;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -46,7 +48,8 @@ public class ChargeFeeVoController {
|
|
|
private MzBillItemService mzBillItemService;
|
|
|
@Autowired
|
|
|
private MzPatientMiService mzPatientMiService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private MzmxsrService mzmxsrService;
|
|
|
/**
|
|
|
* 查询日结列表收费清单 未结账
|
|
|
*
|
|
|
@@ -1005,9 +1008,9 @@ public class ChargeFeeVoController {
|
|
|
resultMap.put("message", "查询门诊收费明细失败,结束时间为空");
|
|
|
return resultMap;
|
|
|
}
|
|
|
- if(DateTimeUtils.periodDays(DateTimeUtils.date2LocalDate(thmzmxsrParamsVo.getBeginDate()), DateTimeUtils.date2LocalDate(thmzmxsrParamsVo.getEndDate()))>31){
|
|
|
+ if (thmzmxsrParamsVo.getPageSize() == null) {
|
|
|
resultMap.put("code", -1);
|
|
|
- resultMap.put("message", "查询门诊收费明细失败,时间跨度不能大于一个月");
|
|
|
+ resultMap.put("message", "查询门诊收费明细失败,每页显示数据大小不能为空");
|
|
|
return resultMap;
|
|
|
}
|
|
|
List<MzPatientMi> mzPatientMis = mzPatientMiService.queryByCommonParams(thmzmxsrParamsVo.getCommonParams());
|
|
|
@@ -1040,13 +1043,19 @@ public class ChargeFeeVoController {
|
|
|
}
|
|
|
resultMap.put("code", 0);
|
|
|
resultMap.put("message", "查询门诊收费明细成功");
|
|
|
- thmzmxsrParamsVo.setHisData(YesNoEnum.NO);
|
|
|
- List<Map<String, Object>> thmzmxsrs = chargeFeeVoService.queryThmzmxsr(thmzmxsrParamsVo);
|
|
|
- thmzmxsrParamsVo.setHisData(YesNoEnum.YES);
|
|
|
- List<Map<String, Object>> thmzmxsrsHis = chargeFeeVoService.queryThmzmxsr(thmzmxsrParamsVo);
|
|
|
- BigDecimal totalAmount = fomartThmzmxsr(thmzmxsrs, thmzmxsrsHis);
|
|
|
- resultMap.put("data", thmzmxsrs);
|
|
|
- resultMap.put("totalAmount", totalAmount);
|
|
|
+ List<Mzmxsr> mzmxsrs=mzmxsrService.queryMzmxsrWithPage(thmzmxsrParamsVo);
|
|
|
+ fomartThmzmxsr(mzmxsrs);
|
|
|
+ resultMap.put("data", mzmxsrs);
|
|
|
+ Integer total =thmzmxsrParamsVo.getTotal();
|
|
|
+ if(total<0){
|
|
|
+ total=mzmxsrService.queryCountMzmxsr(thmzmxsrParamsVo);
|
|
|
+ }
|
|
|
+ resultMap.put("total", total);
|
|
|
+ BigDecimal amount=thmzmxsrParamsVo.getAmount();
|
|
|
+ if(amount==null){
|
|
|
+ amount=mzmxsrService.querySumAmount(thmzmxsrParamsVo);
|
|
|
+ }
|
|
|
+ resultMap.put("totalAmount",amount==null?BigDecimal.ZERO:amount .setScale(2, BigDecimal.ROUND_FLOOR));
|
|
|
return resultMap;
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -1058,61 +1067,42 @@ public class ChargeFeeVoController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private BigDecimal fomartThmzmxsr(List<Map<String, Object>> thmzmxsrs, List<Map<String, Object>> thmzmxsrsHis) {
|
|
|
- BigDecimal totalAmount = BigDecimal.ZERO;
|
|
|
- if (thmzmxsrs != null && thmzmxsrs.size() > 0) {
|
|
|
+ private void fomartThmzmxsr(List<Mzmxsr> mzmxsrs) {
|
|
|
+ Map<String, String> mzBillItemMap = null;
|
|
|
+ Map<String, String> employeeMap = null;
|
|
|
+ if (mzmxsrs != null && mzmxsrs.size() > 0) {
|
|
|
List<MzBillItem> mzBillItems = mzBillItemService.queryZyBillItem();
|
|
|
- Map<String, String> mzBillItemMap = null;
|
|
|
if (mzBillItems != null) {
|
|
|
mzBillItemMap = mzBillItems.stream().collect(Collectors.toMap(MzBillItem::getCode, MzBillItem::getName));
|
|
|
}
|
|
|
- Map<String, String> employeeMap = null;
|
|
|
List<Employee> employees = employeeService.queryAll();
|
|
|
if (employees != null) {
|
|
|
employeeMap = employees.stream().collect(Collectors.toMap(Employee::getEmployeeCode, Employee::getEmployeeName));
|
|
|
}
|
|
|
- Set<Date> repeatSet = new HashSet<>();
|
|
|
- for (Map<String, Object> map : thmzmxsrs) {
|
|
|
- repeatSet.add((Date) map.get("dcount_date"));
|
|
|
- totalAmount = getBigDecimal(totalAmount, mzBillItemMap, employeeMap, map);
|
|
|
- }
|
|
|
-
|
|
|
- for (Map<String, Object> map : thmzmxsrsHis) {
|
|
|
- if (repeatSet.contains(map.get("dcount_date"))) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- totalAmount = getBigDecimal(totalAmount, mzBillItemMap, employeeMap, map);
|
|
|
- thmzmxsrs.add(map);
|
|
|
+ }
|
|
|
+ if (mzmxsrs != null && mzmxsrs.size() > 0) {
|
|
|
+ for (Mzmxsr mzmxsr : mzmxsrs) {
|
|
|
+ getBigDecimal(mzBillItemMap, employeeMap, mzmxsr);
|
|
|
}
|
|
|
}
|
|
|
- return totalAmount.setScale(2, BigDecimal.ROUND_FLOOR);
|
|
|
}
|
|
|
|
|
|
- private BigDecimal getBigDecimal(BigDecimal totalAmount, Map<String, String> mzBillItemMap, Map<String, String> employeeMap, Map<String, Object> map) {
|
|
|
+ private void getBigDecimal(Map<String, String> mzBillItemMap, Map<String, String> employeeMap, Mzmxsr mzmxsr) {
|
|
|
if (mzBillItemMap != null) {
|
|
|
- map.put("parent_code", mzBillItemMap.get(map.get("parent_code")));
|
|
|
+ mzmxsr.setParentCode(mzBillItemMap.get(mzmxsr.getParentCode()));
|
|
|
}
|
|
|
- map.put("jz_sq_dept", zdUnitCodeService.queryDeptNameByIdInCache((String) map.get("jz_sq_dept")));
|
|
|
- map.put("exec_dept", zdUnitCodeService.queryDeptNameByIdInCache((String) map.get("exec_dept")));
|
|
|
- String jzSqDoctor = (String) map.get("jz_sq_doctor");
|
|
|
+ mzmxsr.setJzSqDept(zdUnitCodeService.queryDeptNameByIdInCache(mzmxsr.getJzSqDept()));
|
|
|
+ mzmxsr.setExecDept(zdUnitCodeService.queryDeptNameByIdInCache(mzmxsr.getExecDept()));
|
|
|
+ String jzSqDoctor = mzmxsr.getJzSqDoctor();
|
|
|
if (StringUtils.isNotBlank(jzSqDoctor)) {
|
|
|
jzSqDoctor = jzSqDoctor.trim();
|
|
|
}
|
|
|
- map.put("jz_sq_doctor", employeeMap.get(jzSqDoctor));
|
|
|
- BigDecimal price = (BigDecimal) map.get("price");
|
|
|
+ mzmxsr.setJzSqDoctor(employeeMap.get(jzSqDoctor));
|
|
|
+ BigDecimal price =mzmxsr.getPrice();
|
|
|
if (price == null) {
|
|
|
price = BigDecimal.ZERO;
|
|
|
}
|
|
|
- Double je = (Double) map.get("je");
|
|
|
- BigDecimal jeB;
|
|
|
- if (je == null) {
|
|
|
- jeB = BigDecimal.ZERO;
|
|
|
- } else {
|
|
|
- jeB = BigDecimal.valueOf(je);
|
|
|
- }
|
|
|
- totalAmount = totalAmount.add(jeB);
|
|
|
- map.put("price", price.setScale(2, BigDecimal.ROUND_FLOOR));
|
|
|
- return totalAmount;
|
|
|
+ mzmxsr.setPrice(price.setScale(2, BigDecimal.ROUND_FLOOR));
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1127,7 +1117,7 @@ public class ChargeFeeVoController {
|
|
|
public Map<String, Object> excelThmzmxsr(@RequestParam("commonParams") String commonParams, @RequestParam("caseType") String caseType, @RequestParam("beginDate") String beginDate,
|
|
|
@RequestParam("endDate") String endDate, @RequestParam("jzSqDept") String jzSqDept, @RequestParam("jzSqDoctor") String jzSqDoctor,
|
|
|
@RequestParam("execDept") String execDept, @RequestParam("hsm") String hsm,
|
|
|
- @RequestParam("parentCode") String parentCode, @RequestParam("xmm") String xmm, HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ @RequestParam("parentCode") String parentCode, @RequestParam("xmm") String xmm,@RequestParam("pageSize") String pageSize, HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
|
|
if (StringUtils.isBlank(caseType)) {
|
|
|
caseType = YesNoEnum.NO.code.toString();
|
|
|
@@ -1150,6 +1140,7 @@ public class ChargeFeeVoController {
|
|
|
if (StringUtils.isBlank(xmm)) {
|
|
|
xmm = null;
|
|
|
}
|
|
|
+ Map<String, Object> resultMap = new HashMap<>();
|
|
|
ThmzmxsrParamsVo thmzmxsrParamsVo = new ThmzmxsrParamsVo();
|
|
|
thmzmxsrParamsVo.setCommonParams(commonParams);
|
|
|
thmzmxsrParamsVo.setCaseType(caseType);
|
|
|
@@ -1161,6 +1152,16 @@ public class ChargeFeeVoController {
|
|
|
thmzmxsrParamsVo.setHsm(hsm);
|
|
|
thmzmxsrParamsVo.setParentCode(parentCode);
|
|
|
thmzmxsrParamsVo.setXmm(xmm);
|
|
|
+ if(DateTimeUtils.periodDays(DateTimeUtils.date2LocalDate(thmzmxsrParamsVo.getBeginDate()), DateTimeUtils.date2LocalDate(thmzmxsrParamsVo.getEndDate()))>180){
|
|
|
+ resultMap.put("code", -1);
|
|
|
+ resultMap.put("message", "查询门诊收费明细失败,时间跨度不能大于六个月");
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ Integer total =Integer.valueOf(pageSize);
|
|
|
+ if(total<0){
|
|
|
+ total=mzmxsrService.queryCountMzmxsr(thmzmxsrParamsVo);
|
|
|
+ }
|
|
|
+ thmzmxsrParamsVo.setPageSize(total);
|
|
|
List<MzPatientMi> mzPatientMis = mzPatientMiService.queryByCommonParams(commonParams);
|
|
|
if (mzPatientMis != null && mzPatientMis.size() > 0) {
|
|
|
List<String> patientIds = mzPatientMis.stream().filter(m -> StringUtils.isNotBlank(m.getPatientId())).map(m -> m.getPatientId()).collect(Collectors.toList());
|
|
|
@@ -1168,12 +1169,9 @@ public class ChargeFeeVoController {
|
|
|
thmzmxsrParamsVo.setPatientIds(patientIds);
|
|
|
}
|
|
|
}
|
|
|
- thmzmxsrParamsVo.setHisData(YesNoEnum.NO);
|
|
|
- List<Map<String, Object>> thmzmxsrs = chargeFeeVoService.queryThmzmxsr(thmzmxsrParamsVo);
|
|
|
- thmzmxsrParamsVo.setHisData(YesNoEnum.YES);
|
|
|
- List<Map<String, Object>> thmzmxsrsHis = chargeFeeVoService.queryThmzmxsr(thmzmxsrParamsVo);
|
|
|
- fomartThmzmxsr(thmzmxsrs, thmzmxsrsHis);
|
|
|
- ExcelUtil.exportExcelForThmzmxsrs(request, response, thmzmxsrs);
|
|
|
+ List<Mzmxsr> mzmxsrs=mzmxsrService.queryMzmxsrWithPage(thmzmxsrParamsVo);
|
|
|
+ fomartThmzmxsr(mzmxsrs);
|
|
|
+ ExcelUtil.exportExcelForThmzmxsrs(request, response, mzmxsrs);
|
|
|
return null;
|
|
|
}
|
|
|
}
|