|
|
@@ -1429,7 +1429,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
}
|
|
|
}
|
|
|
BigDecimal totalAmount = BigDecimal.ZERO;
|
|
|
- totalAmount = setSecondPartAndDrFeeForSavePrescription(birthDay, jcHalfFareMap, reqMap, reqAmountMap, totalAmount, mzYjReqMap);
|
|
|
+ totalAmount = setSecondPartAndDrFeeForSavePrescription(birthDay, jcHalfFareMap, reqMap, reqAmountMap, totalAmount, mzYjReqMap,mzPrescriptionVo.getVisitDeptCode());
|
|
|
BigDecimal amount = (BigDecimal) yjMap.get("amount");
|
|
|
amount = amount.add(totalAmount);
|
|
|
yjMap.put("amount", amount);
|
|
|
@@ -1458,7 +1458,15 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
List<String> supplyCodeList = new ArrayList<>();
|
|
|
supplyCodeList.addAll(supplyCodes);
|
|
|
for (MzChargeDetail mzChargeDetail : mzPrescriptionVo.getMzChargeDetailList()) {
|
|
|
- BigDecimal unitPrice = mzChargeDetail.getUnitPrice() == null ? BigDecimal.ZERO : mzChargeDetail.getUnitPrice().setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal unitPrice = mzChargeDetail.getUnitPrice() == null ? BigDecimal.ZERO : mzChargeDetail.getUnitPrice();
|
|
|
+ //计算科室折扣率
|
|
|
+ if(StringUtils.isNotBlank(mzPrescriptionVo.getVisitDeptCode())){
|
|
|
+ ZdUnitCode zdUnitCode=zdUnitCodeService.queryByCodeInCache(mzPrescriptionVo.getVisitDeptCode());
|
|
|
+ if(zdUnitCode!=null && zdUnitCode.getKsZkl()!=null && BigDecimal.ONE.compareTo(zdUnitCode.getKsZkl())!=0){
|
|
|
+ unitPrice=unitPrice.multiply(zdUnitCode.getKsZkl());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ unitPrice=unitPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
if (!Constants.TC.equals(mzChargeDetail.getBillItemCode()) && Constants.ZY_GROUP_NO.equals(mzChargeDetail.getGroupNo()) && BigDecimal.ZERO.compareTo(unitPrice) == 0) {
|
|
|
unitPrice = BigDecimal.valueOf(0.01D);
|
|
|
mzChargeDetail.setUnitPrice(unitPrice);
|
|
|
@@ -1798,15 +1806,16 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
|
|
|
/**
|
|
|
* 构造处方或者保存处方时设置第二部位半价或者DR费用
|
|
|
- *
|
|
|
* @param birthDay
|
|
|
* @param jcHalfFareMap
|
|
|
* @param reqMap
|
|
|
* @param reqAmountMap
|
|
|
* @param totalAmount
|
|
|
+ * @param mzYjReqMap
|
|
|
+ * @param visitDeptCode 就诊科室
|
|
|
* @return
|
|
|
*/
|
|
|
- private BigDecimal setSecondPartAndDrFeeForSavePrescription(Date birthDay, Map<String, Object> jcHalfFareMap, Map<String, List<ZdChargeItem>> reqMap, Map<String, BigDecimal> reqAmountMap, BigDecimal totalAmount, Map<String, MzYjReq> mzYjReqMap) {
|
|
|
+ private BigDecimal setSecondPartAndDrFeeForSavePrescription(Date birthDay, Map<String, Object> jcHalfFareMap, Map<String, List<ZdChargeItem>> reqMap, Map<String, BigDecimal> reqAmountMap, BigDecimal totalAmount, Map<String, MzYjReq> mzYjReqMap, String visitDeptCode) {
|
|
|
if (reqMap != null && reqMap.size() > 0) {
|
|
|
List<ZdChargeItem> otherList = new ArrayList<>();
|
|
|
for (String key : reqMap.keySet()) {
|
|
|
@@ -1887,7 +1896,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
} 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);
|
|
|
+ tempAmount = getRaisePrice(birthDay, tempAmount, tempZdChargeItem,visitDeptCode);
|
|
|
if (tempZdChargeItem.getPercentag2() != null) {
|
|
|
tempAmount = tempAmount.multiply(tempZdChargeItem.getPercentag2());
|
|
|
}
|
|
|
@@ -1897,7 +1906,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
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);
|
|
|
+ tempAmount = getRaisePrice(birthDay, tempAmount, tempZdChargeItem,visitDeptCode);
|
|
|
if (tempZdChargeItem.getPercentag2() != null) {
|
|
|
tempAmount = tempAmount.multiply(tempZdChargeItem.getPercentag2());
|
|
|
}
|
|
|
@@ -1906,7 +1915,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
} 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);
|
|
|
+ tempAmount = getRaisePrice(birthDay, tempAmount, tempZdChargeItem,visitDeptCode);
|
|
|
if (tempZdChargeItem.getPercentag2() != null) {
|
|
|
tempAmount = tempAmount.multiply(tempZdChargeItem.getPercentag2());
|
|
|
}
|
|
|
@@ -1916,7 +1925,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
}
|
|
|
} else {
|
|
|
tempAmount = (tempZdChargeItem.getChargeAmount() == null ? BigDecimal.ZERO : tempZdChargeItem.getChargeAmount()).multiply(tempZdChargeItem.getNum() == null ? BigDecimal.ONE : tempZdChargeItem.getNum());
|
|
|
- tempAmount = getRaisePrice(birthDay, tempAmount, tempZdChargeItem);
|
|
|
+ tempAmount = getRaisePrice(birthDay, tempAmount, tempZdChargeItem,visitDeptCode);
|
|
|
totalAmount = totalAmount.add(tempAmount);
|
|
|
}
|
|
|
}
|
|
|
@@ -1938,7 +1947,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
} 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);
|
|
|
+ tempAmount = getRaisePrice(birthDay, tempAmount, tempZdChargeItem,visitDeptCode);
|
|
|
if (tempZdChargeItem.getPercentag2() != null) {
|
|
|
tempAmount = tempAmount.multiply(tempZdChargeItem.getPercentag2());
|
|
|
}
|
|
|
@@ -1948,7 +1957,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
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);
|
|
|
+ tempAmount = getRaisePrice(birthDay, tempAmount, tempZdChargeItem,visitDeptCode);
|
|
|
if (tempZdChargeItem.getPercentag2() != null) {
|
|
|
tempAmount = tempAmount.multiply(tempZdChargeItem.getPercentag2());
|
|
|
}
|
|
|
@@ -1957,7 +1966,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
} 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);
|
|
|
+ tempAmount = getRaisePrice(birthDay, tempAmount, tempZdChargeItem,visitDeptCode);
|
|
|
if (tempZdChargeItem.getPercentag2() != null) {
|
|
|
tempAmount = tempAmount.multiply(tempZdChargeItem.getPercentag2());
|
|
|
}
|
|
|
@@ -1967,7 +1976,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
}
|
|
|
} else {
|
|
|
tempAmount = (tempZdChargeItem.getChargeAmount() == null ? BigDecimal.ZERO : tempZdChargeItem.getChargeAmount()).multiply(tempZdChargeItem.getNum() == null ? BigDecimal.ONE : tempZdChargeItem.getNum());
|
|
|
- tempAmount = getRaisePrice(birthDay, tempAmount, tempZdChargeItem);
|
|
|
+ tempAmount = getRaisePrice(birthDay, tempAmount, tempZdChargeItem,visitDeptCode);
|
|
|
if (tempZdChargeItem.getPercentag2() != null) {
|
|
|
tempAmount = tempAmount.multiply(tempZdChargeItem.getPercentag2());
|
|
|
}
|
|
|
@@ -1980,7 +1989,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
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);
|
|
|
+ tempAmount = getRaisePrice(birthDay, tempAmount, zd,visitDeptCode);
|
|
|
totalAmount = totalAmount.add(tempAmount);
|
|
|
}
|
|
|
}
|
|
|
@@ -1997,7 +2006,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
* @param tempZdChargeItem
|
|
|
* @return
|
|
|
*/
|
|
|
- private BigDecimal getRaisePrice(Date birthDay, BigDecimal tempAmount, ZdChargeItem tempZdChargeItem) {
|
|
|
+ private BigDecimal getRaisePrice(Date birthDay, BigDecimal tempAmount, ZdChargeItem tempZdChargeItem,String visitDeptCode) {
|
|
|
//项目加价且加收比例不为空
|
|
|
if (setUnitPrice && tempZdChargeItem.getCo() != null && YesNoEnum.YES.code.equals(tempZdChargeItem.getCo()) && tempZdChargeItem.getXlCode() != null && StringUtils.isNotBlank(tempZdChargeItem.getXlCode()) && birthDay != null) {
|
|
|
int age = DateUtil.getAge(birthDay);
|
|
|
@@ -2010,7 +2019,38 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return tempAmount;
|
|
|
+ //计算科室折扣率
|
|
|
+ if(StringUtils.isBlank(visitDeptCode)){
|
|
|
+ return tempAmount;
|
|
|
+ }
|
|
|
+ ZdUnitCode zdUnitCode=zdUnitCodeService.queryByCodeInCache(visitDeptCode);
|
|
|
+ if(zdUnitCode==null || zdUnitCode.getKsZkl()==null || BigDecimal.ONE.compareTo(zdUnitCode.getKsZkl())==0){
|
|
|
+ return tempAmount;
|
|
|
+ }
|
|
|
+ return tempAmount.multiply(zdUnitCode.getKsZkl());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 是否需要加价
|
|
|
+ *
|
|
|
+ * @param mzPatientMi
|
|
|
+ * @param zdChargeItem
|
|
|
+ * @param newMzChargeDetail
|
|
|
+ */
|
|
|
+ private void setUnitPrice(MzPatientMi mzPatientMi, ZdChargeItem zdChargeItem, MzChargeDetail newMzChargeDetail) {
|
|
|
+ //项目加价且加收比例不为空
|
|
|
+ if (setUnitPrice && mzPatientMi != null && mzPatientMi.getBirthDay() != null && zdChargeItem.getCo() != null && YesNoEnum.YES.code.equals(zdChargeItem.getCo()) && zdChargeItem.getXlCode() != null && StringUtils.isNotBlank(zdChargeItem.getXlCode())) {
|
|
|
+ int age = DateUtil.getAge(mzPatientMi.getBirthDay());
|
|
|
+ //6岁以内的小朋友费用上调50% 根据【湘医保发〔2020〕51 号】价格通知,6岁以内的小朋友费用上调50%!
|
|
|
+ if (age < 6) {
|
|
|
+ BigDecimal xlCode = new BigDecimal(zdChargeItem.getXlCode());
|
|
|
+ if (xlCode != null) {
|
|
|
+ xlCode = xlCode.add(BigDecimal.ONE);
|
|
|
+ newMzChargeDetail.setUnitPrice(newMzChargeDetail.getUnitPrice().multiply(xlCode));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ setDeptPlusPrice(newMzChargeDetail);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -2274,12 +2314,16 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
String jzFlag = orderNoMap.get(mzChargeDetail.getOrderNo());
|
|
|
if (jzFlag == null) {
|
|
|
if (mjSet.contains(mzChargeDetail.getChargeItemCode())) {
|
|
|
+ //麻精
|
|
|
jzFlag = "2";
|
|
|
} else if (jeSet.contains(mzChargeDetail.getChargeItemCode())) {
|
|
|
+ //精二
|
|
|
jzFlag = "3";
|
|
|
} else if (Constants.EMERGENCY_WARD_CODE.equals(mzPrescriptionVo.getVisitDeptCode())) {
|
|
|
+ //急诊处方
|
|
|
jzFlag = "1";
|
|
|
} else {
|
|
|
+ //普通处方
|
|
|
jzFlag = "0";
|
|
|
}
|
|
|
orderNoMap.put(mzChargeDetail.getOrderNo(), jzFlag);
|
|
|
@@ -2433,6 +2477,8 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
throw new MzException("保存处方失败,第" + itemNo + "行药品库存锁定失败,没有对应的药品记录");
|
|
|
}
|
|
|
}
|
|
|
+ //药品进行科室加收
|
|
|
+ setDeptPlusPrice(mzChargeDetail);
|
|
|
itemNo++;
|
|
|
}
|
|
|
}
|
|
|
@@ -3094,6 +3140,7 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
if (mzVisitTable == null) {
|
|
|
throw new MzException("病人就诊记录不存在!");
|
|
|
}
|
|
|
+ mzPrescriptionVo.setVisitDeptCode(mzVisitTable.getVisitDeptCode());
|
|
|
MzBlRecord mzBlRecord = mzBlRecordMapper.selectMzBlRecordByPatientIdAndTimes(patientId, times);
|
|
|
if (mzBlRecord == null) {
|
|
|
//throw new MzException("病人门诊病历记录不存在!");
|
|
|
@@ -5425,13 +5472,13 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
itemNo = setDjSupplyCharge(mzChargeDetails, itemNo, receiptNo, hadCountSupplyFeeSet, mcd, key, mzPatientMi);
|
|
|
//非口服用药方式,需要写入收费记录
|
|
|
itemNo = formatSupplyFee(mzChargeDetails, itemNo, receiptNo, hadCountSupplyFeeSet, mcd, key, mzPatientMi, trySet);
|
|
|
- if (Constants.YJ_GROUP_NO.equals(mcd.getGroupNo()) && !Constants.TC.equals(mcd.getBillItemCode())) {
|
|
|
- ZdChargeItem zdChargeItem = zdChargeItemService.queryZdChargeItemByCode(mcd.getChargeItemCode());
|
|
|
- if (zdChargeItem != null) {
|
|
|
- //是否需要加价
|
|
|
- setUnitPrice(mzPatientMi, zdChargeItem, mcd);
|
|
|
- }
|
|
|
- }
|
|
|
+// if (Constants.YJ_GROUP_NO.equals(mcd.getGroupNo()) && !Constants.TC.equals(mcd.getBillItemCode())) {
|
|
|
+// ZdChargeItem zdChargeItem = zdChargeItemService.queryZdChargeItemByCode(mcd.getChargeItemCode());
|
|
|
+// if (zdChargeItem != null) {
|
|
|
+// //是否需要加价
|
|
|
+// setUnitPrice(mzPatientMi, zdChargeItem, mcd);
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|
|
|
return itemNo;
|
|
|
}
|
|
|
@@ -5805,26 +5852,22 @@ public class MzChargeDetailServiceImpl implements MzChargeDetailService {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
- * 是否需要加价
|
|
|
- *
|
|
|
- * @param mzPatientMi
|
|
|
- * @param zdChargeItem
|
|
|
- * @param newMzChargeDetail
|
|
|
+ * 计算科室加收
|
|
|
+ * @param mzChargeDetail
|
|
|
*/
|
|
|
- private void setUnitPrice(MzPatientMi mzPatientMi, ZdChargeItem zdChargeItem, MzChargeDetail newMzChargeDetail) {
|
|
|
- //项目加价且加收比例不为空
|
|
|
- if (setUnitPrice && mzPatientMi != null && mzPatientMi.getBirthDay() != null && zdChargeItem.getCo() != null && YesNoEnum.YES.code.equals(zdChargeItem.getCo()) && zdChargeItem.getXlCode() != null && StringUtils.isNotBlank(zdChargeItem.getXlCode())) {
|
|
|
- int age = DateUtil.getAge(mzPatientMi.getBirthDay());
|
|
|
- //6岁以内的小朋友费用上调50% 根据【湘医保发〔2020〕51 号】价格通知,6岁以内的小朋友费用上调50%!
|
|
|
- if (age < 6) {
|
|
|
- BigDecimal xlCode = new BigDecimal(zdChargeItem.getXlCode());
|
|
|
- if (xlCode != null) {
|
|
|
- xlCode = xlCode.add(BigDecimal.ONE);
|
|
|
- newMzChargeDetail.setUnitPrice(newMzChargeDetail.getUnitPrice().multiply(xlCode));
|
|
|
- }
|
|
|
- }
|
|
|
+ private void setDeptPlusPrice(MzChargeDetail mzChargeDetail) {
|
|
|
+ //计算科室折扣率
|
|
|
+ if(StringUtils.isBlank(mzChargeDetail.getWarnDept())){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ ZdUnitCode zdUnitCode=zdUnitCodeService.queryByCodeInCache(mzChargeDetail.getWarnDept());
|
|
|
+ if(zdUnitCode==null || zdUnitCode.getKsZkl()==null || BigDecimal.ONE.compareTo(zdUnitCode.getKsZkl())==0){
|
|
|
+ return;
|
|
|
}
|
|
|
+ mzChargeDetail.setUnitPrice(mzChargeDetail.getUnitPrice().multiply(zdUnitCode.getKsZkl()));
|
|
|
}
|
|
|
|
|
|
|