|
@@ -372,11 +372,17 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
for (JcJyItemCharge jcJyItemCharge : jcJyItemCharges) {
|
|
|
Integer count = jyjcCount.get(jcJyItemCharge.getCode());
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
- itemNo = formatYjDetailChargeDetail(mzChargeDetail, mzChargeDetails, maxOrderNo, mzPatientMi, itemNo, mzYjReqMap, jcJyItemCharge, tcNoMap, priceId, priceTime, receiptNo,jcHalfFareMap);
|
|
|
+ itemNo = formatYjDetailChargeDetail(mzChargeDetail, mzChargeDetails, maxOrderNo, mzPatientMi, itemNo, mzYjReqMap, jcJyItemCharge, tcNoMap, priceId, priceTime, receiptNo, jcHalfFareMap);
|
|
|
}
|
|
|
}
|
|
|
+ Map<String, Object> zdChargeItemMap = jcHalfFareMap.get("zdChargeItemMap");
|
|
|
//划价 1、数字化摄影(DR) 曝光次数同一时间最高不超过4次(160元); 其他是第二部位打折,折扣率在字典里维护
|
|
|
+ //DR曝光次数
|
|
|
+ int drCount = 0;
|
|
|
for (String key : jcHalfFareMap.keySet()) {
|
|
|
+ if (key.equals("zdChargeItemMap")) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
Map<String, Object> tempMap = jcHalfFareMap.get(key);
|
|
|
if (tempMap == null) {
|
|
|
continue;
|
|
@@ -386,19 +392,41 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
continue;
|
|
|
}
|
|
|
if (Constants.AUDIT_ITEM_DR.equals(key)) {
|
|
|
- if (tempList.size() <= 3) {
|
|
|
- //曝光次数同一时间最高不超过4次 所以第二部位集合只能有3个
|
|
|
- continue;
|
|
|
+ MzChargeDetail first = (MzChargeDetail) tempMap.get("first");
|
|
|
+ drCount += first.getQuantity().intValue();
|
|
|
+ if (drCount > 4) {
|
|
|
+ //曝光次数同一时间最高不超过4次
|
|
|
+ first.setQuantity(4D);
|
|
|
}
|
|
|
- for (int i = 3; i < tempList.size(); i++) {
|
|
|
+ for (int i = 0; i < tempList.size(); i++) {
|
|
|
MzChargeDetail tempMzChargeDetail = tempList.get(i);
|
|
|
- tempMzChargeDetail.setUnitPrice(BigDecimal.ZERO);
|
|
|
+ if (drCount >= 4) {
|
|
|
+ //曝光次数同一时间最高不超过4次
|
|
|
+ //tempMzChargeDetail.setUnitPrice(BigDecimal.ZERO);
|
|
|
+ tempMzChargeDetail.setQuantity(0D);
|
|
|
+ } else {
|
|
|
+ if (Double.valueOf(1).equals(tempMzChargeDetail.getQuantity())) {
|
|
|
+ drCount++;
|
|
|
+ } else if (tempMzChargeDetail.getQuantity().intValue() > 1) {
|
|
|
+ if (drCount + tempMzChargeDetail.getQuantity().intValue() > 4) {
|
|
|
+ tempMzChargeDetail.setQuantity(Double.valueOf(4 - drCount));
|
|
|
+ drCount = 4;
|
|
|
+ } else {
|
|
|
+ drCount += tempMzChargeDetail.getQuantity();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
//替换收费项目
|
|
|
for (int i = 0; i < tempList.size(); i++) {
|
|
|
MzChargeDetail tempMzChargeDetail = tempList.get(i);
|
|
|
- tempMzChargeDetail.setUnitPrice(tempMzChargeDetail.getUnitPrice().multiply(new BigDecimal("0.5")));
|
|
|
+ ZdChargeItem zdChargeItem = (ZdChargeItem) zdChargeItemMap.get(tempMzChargeDetail.getChargeItemCode());
|
|
|
+ BigDecimal percentag2 = BigDecimal.ONE;
|
|
|
+ if (zdChargeItem != null && zdChargeItem.getPercentag2() != null) {
|
|
|
+ percentag2 = zdChargeItem.getPercentag2();
|
|
|
+ }
|
|
|
+ tempMzChargeDetail.setUnitPrice(tempMzChargeDetail.getUnitPrice().multiply(percentag2));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -947,7 +975,8 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
Map<String, Object> yjMap = new HashMap<>();
|
|
|
yjMap.put("amount", BigDecimal.ZERO);
|
|
|
List<String> detail = new ArrayList<>();
|
|
|
- // Map<String, Map<String, Object>> jcHalfFareMap=new HashMap<>();
|
|
|
+ Map<String, Object> jcHalfFareMap = new HashMap<>();
|
|
|
+ List<ZdChargeItem> fullZdChargeItemList = new ArrayList<>();
|
|
|
for (int i = 0; i < mzPrescriptionVo.getMzYjReqList().size(); i++) {
|
|
|
MzYjReq mzYjReq = mzPrescriptionVo.getMzYjReqList().get(i);
|
|
|
int index = i + 1;
|
|
@@ -965,75 +994,140 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
List<ZdChargeItem> zdChargeItemList = null;
|
|
|
zdChargeItemList = jcJyItemChargeService.queryJcJyItemChargeByCode(mzYjReq.getOrderCode());
|
|
|
if (zdChargeItemList != null && zdChargeItemList.size() > 0) {
|
|
|
- BigDecimal totalAmount = BigDecimal.ZERO;
|
|
|
- for (ZdChargeItem zd : zdChargeItemList) {
|
|
|
-
|
|
|
-
|
|
|
-// if (!"3".equals(mzYjReq.getReqType())) {
|
|
|
-// continue;
|
|
|
-// }
|
|
|
-// String auditCode = zd.getAuditCode();
|
|
|
-// if (auditCode == null || StringUtils.isBlank(auditCode)) {
|
|
|
-// continue;
|
|
|
-// }
|
|
|
-// Map<String, Object> tempMap = jcHalfFareMap.get(auditCode);
|
|
|
-// if (tempMap == null) {
|
|
|
-// tempMap = new HashMap<>();
|
|
|
-// jcHalfFareMap.put(auditCode, tempMap);
|
|
|
-// }
|
|
|
-// //项目编码和项目的map集合
|
|
|
-// Map<String, Object> zdChargeItemMap = jcHalfFareMap.get("zdChargeItemMap");
|
|
|
-// if (zdChargeItemMap == null) {
|
|
|
-// zdChargeItemMap = new HashMap<>();
|
|
|
-// jcHalfFareMap.put("zdChargeItemMap", zdChargeItemMap);
|
|
|
-// }
|
|
|
-// zdChargeItemMap.put(zdChargeItem.getCode(), zdChargeItem);
|
|
|
-// MzChargeDetail first = (MzChargeDetail) tempMap.get("first");
|
|
|
-// if (first == null) {
|
|
|
-// first=newMzChargeDetail;
|
|
|
-// tempMap.put("first", first);
|
|
|
-// } else {
|
|
|
-// List<MzChargeDetail> second = (List<MzChargeDetail>) tempMap.get("second");
|
|
|
-// if (second == null) {
|
|
|
-// second = new ArrayList<>();
|
|
|
-// tempMap.put("second", second);
|
|
|
-// }
|
|
|
-// if (first.getUnitPrice().compareTo(newMzChargeDetail.getUnitPrice()) == -1) {
|
|
|
-// ZdChargeItem firstZdChargeItem = (ZdChargeItem) zdChargeItemMap.get(first.getChargeItemCode());
|
|
|
-// if (Constants.AUDIT_ITEM_DR.equals(firstZdChargeItem.getAuditCode()) || (firstZdChargeItem != null && firstZdChargeItem.getPercentag2().compareTo(BigDecimal.ONE) == -1)) {
|
|
|
-// //当该项目时DR 或者( 当原第一部位的金额小于新的收费项目的,第一项目换成当前的项目,且当原第一项目的第二部位折扣率小于1的时候),才放进折扣队列,因为如果没有折扣的话,是不需要进行替换原项目的
|
|
|
-// second.add(first);
|
|
|
-// }
|
|
|
-// tempMap.put("first", newMzChargeDetail);
|
|
|
-// } else {
|
|
|
-// if (Constants.AUDIT_ITEM_DR.equals(zdChargeItem.getAuditCode()) || zdChargeItem.getPercentag2().compareTo(BigDecimal.ONE) == -1) {
|
|
|
-// //当该项目时DR 或者 当前目的第二部位折扣率小于1的时候 ,才放进折扣队列,因为如果没有折扣的话,是不需要进行替换原项目的
|
|
|
-// second.add(newMzChargeDetail);
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
- totalAmount = totalAmount.add(zd.getTotalAmount() == null ? BigDecimal.ZERO : zd.getTotalAmount());
|
|
|
- //项目加价且加收比例不为空
|
|
|
- if (zd.getCo() != null && YesNoEnum.YES.code.equals(zd.getCo()) && zd.getXlCode() != null && StringUtils.isNotBlank(zd.getXlCode()) && birthDay != null) {
|
|
|
- int age = DateUtil.getAge(birthDay);
|
|
|
- //6岁以内的小朋友费用上调50% 根据【湘医保发〔2020〕51 号】价格通知,6岁以内的小朋友费用上调50%!
|
|
|
- if (age < 6) {
|
|
|
- BigDecimal xlCode = new BigDecimal(zd.getXlCode());
|
|
|
- if (xlCode != null) {
|
|
|
- xlCode = xlCode.add(BigDecimal.ONE);
|
|
|
- totalAmount = totalAmount.multiply(xlCode);
|
|
|
+ fullZdChargeItemList.addAll(zdChargeItemList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ BigDecimal totalAmount = BigDecimal.ZERO;
|
|
|
+ if (fullZdChargeItemList.size() > 0) {
|
|
|
+ List<ZdChargeItem> otherList = new ArrayList<>();
|
|
|
+ for (ZdChargeItem zd : fullZdChargeItemList) {
|
|
|
+ if (zd.getChargeAmount() == null) {
|
|
|
+ zd.setChargeAmount(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ if (!Constants.JC_CLASS_CODE.equals(zd.getClassCode())) {
|
|
|
+ otherList.add(zd);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String auditCode = zd.getAuditCode();
|
|
|
+ if (auditCode == null || StringUtils.isBlank(auditCode)) {
|
|
|
+ otherList.add(zd);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Map<String, Object> tempMap = (Map<String, Object>) jcHalfFareMap.get(auditCode);
|
|
|
+ if (tempMap == null) {
|
|
|
+ tempMap = new HashMap<>();
|
|
|
+ jcHalfFareMap.put(auditCode, tempMap);
|
|
|
+ }
|
|
|
+ ZdChargeItem first = (ZdChargeItem) tempMap.get("first");
|
|
|
+ if (first == null) {
|
|
|
+ first = zd;
|
|
|
+ tempMap.put("first", first);
|
|
|
+ } else {
|
|
|
+ List<ZdChargeItem> second = (List<ZdChargeItem>) tempMap.get("second");
|
|
|
+ if (second == null) {
|
|
|
+ second = new ArrayList<>();
|
|
|
+ tempMap.put("second", second);
|
|
|
+ }
|
|
|
+ if (first.getChargeAmount().compareTo(zd.getChargeAmount()) == -1) {
|
|
|
+ second.add(first);
|
|
|
+ tempMap.put("first", zd);
|
|
|
+ } else {
|
|
|
+ second.add(zd);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //划价 1、数字化摄影(DR) 曝光次数同一时间最高不超过4次(160元); 其他是第二部位打折,折扣率在字典里维护
|
|
|
+ //DR曝光次数
|
|
|
+ int drCount = 0;
|
|
|
+ BigDecimal tempAmount;
|
|
|
+ for (String key : jcHalfFareMap.keySet()) {
|
|
|
+ Map<String, Object> tempMap = (Map<String, Object>) jcHalfFareMap.get(key);
|
|
|
+ if (tempMap == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ ZdChargeItem first = (ZdChargeItem) tempMap.get("first");
|
|
|
+ if (first == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ tempAmount = (first.getChargeAmount() == null ? BigDecimal.ZERO : first.getChargeAmount()).multiply(first.getNum() == null ? BigDecimal.ONE : first.getNum());
|
|
|
+ //项目加价且加收比例不为空
|
|
|
+ tempAmount = getRaisePrice(birthDay, tempAmount, first);
|
|
|
+ totalAmount = totalAmount.add(tempAmount);
|
|
|
+ if (Constants.AUDIT_ITEM_DR.equals(key)) {
|
|
|
+ drCount = first.getNum().intValue();
|
|
|
+ if (drCount > 4) {
|
|
|
+ //曝光次数同一时间最高不超过4次
|
|
|
+ first.setNum(BigDecimal.valueOf(4));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<ZdChargeItem> tempList = (List<ZdChargeItem>) tempMap.get("second");
|
|
|
+ if (tempList == null || tempList.size() == 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (Constants.AUDIT_ITEM_DR.equals(key)) {
|
|
|
+ for (int i = 0; i < tempList.size(); i++) {
|
|
|
+ ZdChargeItem tempZdChargeItem = tempList.get(i);
|
|
|
+ if (drCount >= 4) {
|
|
|
+ //曝光次数同一时间最高不超过4次
|
|
|
+ //tempZdChargeItem.setTotalAmount(BigDecimal.ZERO);
|
|
|
+ tempZdChargeItem.setNum(BigDecimal.ZERO);
|
|
|
+ } else {
|
|
|
+ if (tempZdChargeItem.getNum().intValue() == 1) {
|
|
|
+ tempAmount = (tempZdChargeItem.getChargeAmount() == null ? BigDecimal.ZERO : tempZdChargeItem.getChargeAmount()).multiply(tempZdChargeItem.getNum() == null ? BigDecimal.ONE : tempZdChargeItem.getNum());
|
|
|
+ tempAmount = getRaisePrice(birthDay, tempAmount, tempZdChargeItem);
|
|
|
+ if (tempZdChargeItem.getPercentag2() != null) {
|
|
|
+ tempAmount = tempAmount.multiply(tempZdChargeItem.getPercentag2());
|
|
|
+ }
|
|
|
+ totalAmount = totalAmount.add(tempAmount);
|
|
|
+ drCount++;
|
|
|
+ } else if (tempZdChargeItem.getNum().intValue() > 1) {
|
|
|
+ if (drCount + tempZdChargeItem.getNum().intValue() > 4) {
|
|
|
+ tempZdChargeItem.setNum(BigDecimal.valueOf(4 - drCount));
|
|
|
+ tempAmount = (tempZdChargeItem.getChargeAmount() == null ? BigDecimal.ZERO : tempZdChargeItem.getChargeAmount()).multiply(tempZdChargeItem.getNum() == null ? BigDecimal.ONE : tempZdChargeItem.getNum());
|
|
|
+ tempAmount = getRaisePrice(birthDay, tempAmount, tempZdChargeItem);
|
|
|
+ if (tempZdChargeItem.getPercentag2() != null) {
|
|
|
+ tempAmount = tempAmount.multiply(tempZdChargeItem.getPercentag2());
|
|
|
+ }
|
|
|
+ totalAmount = totalAmount.add(tempAmount);
|
|
|
+ drCount = 4;
|
|
|
+ } else {
|
|
|
+ drCount += tempZdChargeItem.getNum().intValue();
|
|
|
+ tempAmount = (tempZdChargeItem.getChargeAmount() == null ? BigDecimal.ZERO : tempZdChargeItem.getChargeAmount()).multiply(tempZdChargeItem.getNum() == null ? BigDecimal.ONE : tempZdChargeItem.getNum());
|
|
|
+ tempAmount = getRaisePrice(birthDay, tempAmount, tempZdChargeItem);
|
|
|
+ if (tempZdChargeItem.getPercentag2() != null) {
|
|
|
+ tempAmount = tempAmount.multiply(tempZdChargeItem.getPercentag2());
|
|
|
+ }
|
|
|
+ totalAmount = totalAmount.add(tempAmount);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- BigDecimal amount = (BigDecimal) yjMap.get("amount");
|
|
|
- amount = amount.add(totalAmount);
|
|
|
- yjMap.put("amount", amount);
|
|
|
+ } else {
|
|
|
+ for (int i = 0; i < tempList.size(); i++) {
|
|
|
+ ZdChargeItem tempZdChargeItem = tempList.get(i);
|
|
|
+ tempAmount = (tempZdChargeItem.getChargeAmount() == null ? BigDecimal.ZERO : tempZdChargeItem.getChargeAmount()).multiply(tempZdChargeItem.getNum() == null ? BigDecimal.ONE : tempZdChargeItem.getNum());
|
|
|
+ tempAmount = getRaisePrice(birthDay, tempAmount, tempZdChargeItem);
|
|
|
+ if (tempZdChargeItem.getPercentag2() != null) {
|
|
|
+ tempAmount = tempAmount.multiply(tempZdChargeItem.getPercentag2());
|
|
|
+ }
|
|
|
+ totalAmount = totalAmount.add(tempAmount);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(otherList.size()>0){
|
|
|
+ for(ZdChargeItem zd:otherList){
|
|
|
+ tempAmount = (zd.getChargeAmount() == null ? BigDecimal.ZERO : zd.getChargeAmount()).multiply(zd.getNum() == null ? BigDecimal.ONE : zd.getNum());
|
|
|
+ //项目加价且加收比例不为空
|
|
|
+ tempAmount = getRaisePrice(birthDay, tempAmount, zd);
|
|
|
+ totalAmount = totalAmount.add(tempAmount);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
+ BigDecimal amount = (BigDecimal) yjMap.get("amount");
|
|
|
+ amount = amount.add(totalAmount);
|
|
|
+ yjMap.put("amount", amount);
|
|
|
yjMap.put("detail", detail);
|
|
|
zlPrescription.add(yjMap);
|
|
|
}
|
|
@@ -1274,6 +1368,30 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
mzPrescriptionVo.getMzBlRecord().setEmrProcess(sbd.toString());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 儿童加收
|
|
|
+ *
|
|
|
+ * @param birthDay
|
|
|
+ * @param tempAmount
|
|
|
+ * @param tempZdChargeItem
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private BigDecimal getRaisePrice(Date birthDay, BigDecimal tempAmount, ZdChargeItem tempZdChargeItem) {
|
|
|
+ //项目加价且加收比例不为空
|
|
|
+ if (tempZdChargeItem.getCo() != null && YesNoEnum.YES.code.equals(tempZdChargeItem.getCo()) && tempZdChargeItem.getXlCode() != null && StringUtils.isNotBlank(tempZdChargeItem.getXlCode()) && birthDay != null) {
|
|
|
+ int age = DateUtil.getAge(birthDay);
|
|
|
+ //6岁以内的小朋友费用上调50% 根据【湘医保发〔2020〕51 号】价格通知,6岁以内的小朋友费用上调50%!
|
|
|
+ if (age < 6) {
|
|
|
+ BigDecimal xlCode = new BigDecimal(tempZdChargeItem.getXlCode());
|
|
|
+ if (xlCode != null) {
|
|
|
+ xlCode = xlCode.add(BigDecimal.ONE);
|
|
|
+ tempAmount = tempAmount.multiply(xlCode);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return tempAmount;
|
|
|
+ }
|
|
|
+
|
|
|
private int getIndex(List<Map<String, Object>> prescription, StringBuilder sbd, int index) {
|
|
|
if (prescription.size() > 0) {
|
|
|
for (Map<String, Object> map : prescription) {
|
|
@@ -4023,10 +4141,11 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
zdChargeItemMap = new HashMap<>();
|
|
|
jcHalfFareMap.put("zdChargeItemMap", zdChargeItemMap);
|
|
|
}
|
|
|
+
|
|
|
zdChargeItemMap.put(zdChargeItem.getCode(), zdChargeItem);
|
|
|
MzChargeDetail first = (MzChargeDetail) tempMap.get("first");
|
|
|
if (first == null) {
|
|
|
- first=newMzChargeDetail;
|
|
|
+ first = newMzChargeDetail;
|
|
|
tempMap.put("first", first);
|
|
|
} else {
|
|
|
List<MzChargeDetail> second = (List<MzChargeDetail>) tempMap.get("second");
|