|
@@ -22,17 +22,9 @@ public class SiChargeLimitService {
|
|
|
}
|
|
|
|
|
|
public String analyzeSiChargeLimit(SiLimitRequest request) {
|
|
|
- if (StringUtil.isBlank(request.getPatNo())) {
|
|
|
- return "参数错误:住院号不能为空!";
|
|
|
- }
|
|
|
- if (null == request.getTimes()) {
|
|
|
- return "参数错误:住院次数不能为空!";
|
|
|
- }
|
|
|
- if (null == request.getLedgerSn()) {
|
|
|
- return "参数错误:账页号不能为空!";
|
|
|
- }
|
|
|
- if (ListUtil.isBlank(request.getChargeList())) {
|
|
|
- return "参数错误:收费列表不能为空!";
|
|
|
+ String paramsError = checkRequestParams(request);
|
|
|
+ if (null != paramsError) {
|
|
|
+ return paramsError;
|
|
|
}
|
|
|
List<ZdChargeLimitation> limitations = dao.getChargeLimitations(request.getChargeList());
|
|
|
if (limitations.isEmpty()) {
|
|
@@ -54,7 +46,9 @@ public class SiChargeLimitService {
|
|
|
for (BriefChargeInfo charge : tempList) {
|
|
|
if (charge.getAmount().compareTo(BigDecimal.ZERO) < 0) {
|
|
|
Integer oriSn = getPairedOriSn(chargeList, charge);
|
|
|
- if (null != oriSn) {
|
|
|
+ if (null == oriSn) {
|
|
|
+ chargeList.remove(charge);
|
|
|
+ } else {
|
|
|
request.setOriSn(oriSn);
|
|
|
request.setSn(charge.getSn());
|
|
|
dao.updatePairSn(request);
|
|
@@ -64,16 +58,16 @@ public class SiChargeLimitService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Map<String, Integer> map = new HashMap<>();
|
|
|
+ List<String> dateList = new ArrayList<>();
|
|
|
for (BriefChargeInfo charge: chargeList) {
|
|
|
String date = charge.getDate();
|
|
|
- if (!map.containsKey(date)) {
|
|
|
- map.put(date, 1);
|
|
|
+ if (!dateList.contains(date)) {
|
|
|
+ dateList.add(date);
|
|
|
}
|
|
|
}
|
|
|
- if (map.size() >= limit.getLimitDay()) {
|
|
|
+ if (dateList.size() >= limit.getLimitDay()) {
|
|
|
String type = limit.getChargeCode().length() == 5 ? "药品【" : "项目【";
|
|
|
- String fact = map.size() == limit.getLimitDay() ? "即将超期支付。" : "已经超期支付。";
|
|
|
+ String fact = dateList.size() == limit.getLimitDay() ? "即将超期支付。" : "已经超期支付。";
|
|
|
builder.append(type)
|
|
|
.append(limit.getChargeName())
|
|
|
.append("(")
|
|
@@ -90,6 +84,22 @@ public class SiChargeLimitService {
|
|
|
return builder.toString();
|
|
|
}
|
|
|
|
|
|
+ private String checkRequestParams(SiLimitRequest request) {
|
|
|
+ if (StringUtil.isBlank(request.getPatNo())) {
|
|
|
+ return "参数错误:住院号不能为空!";
|
|
|
+ }
|
|
|
+ if (null == request.getTimes()) {
|
|
|
+ return "参数错误:住院次数不能为空!";
|
|
|
+ }
|
|
|
+ if (null == request.getLedgerSn()) {
|
|
|
+ return "参数错误:账页号不能为空!";
|
|
|
+ }
|
|
|
+ if (ListUtil.isBlank(request.getChargeList())) {
|
|
|
+ return "参数错误:收费列表不能为空!";
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
private Integer getPairedOriSn(LinkedList<BriefChargeInfo> list, BriefChargeInfo charge) {
|
|
|
for (BriefChargeInfo item : list) {
|
|
|
BigDecimal sum = item.getAmount().add(charge.getAmount());
|