|
@@ -1,5 +1,7 @@
|
|
|
package thyyxxk.webserver.service.zhuyuanyisheng.yizhuverify;
|
|
|
|
|
|
+import cn.hutool.core.convert.Convert;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
|
import lombok.Getter;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -7,6 +9,7 @@ import thyyxxk.webserver.config.envionment.YzConfig;
|
|
|
import thyyxxk.webserver.constants.Capacity;
|
|
|
import thyyxxk.webserver.dao.his.zhuyuanyisheng.YiZhuLuRuDao;
|
|
|
import thyyxxk.webserver.entity.login.UserInfo;
|
|
|
+import thyyxxk.webserver.entity.yzcheck.ChargeLimitations;
|
|
|
import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.XinZhenYiZhu;
|
|
|
import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.XinZhenYzActOrder;
|
|
|
import thyyxxk.webserver.entity.zhuyuanyisheng.yizhuluru.YzZdOrderItemConfirm;
|
|
@@ -22,7 +25,6 @@ public class YiZhuCheckData {
|
|
|
private final ExtraCache extraCache = SpringUtil.getBean(ExtraCache.class);
|
|
|
private final YzConfig yzConfig = SpringUtil.getBean(YzConfig.class);
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 医嘱数组
|
|
|
*/
|
|
@@ -43,6 +45,16 @@ public class YiZhuCheckData {
|
|
|
*/
|
|
|
private final CacheOnce<List<XinZhenYzActOrder>> project = new CacheOnce<>();
|
|
|
|
|
|
+ /**
|
|
|
+ * 医嘱
|
|
|
+ */
|
|
|
+ private final CacheOnce<XinZhenYzActOrder> yzItem = new CacheOnce<>();
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 医保限制
|
|
|
+ */
|
|
|
+ private final CacheOnce<ChargeLimitations> yiBaoLimitation = new CacheOnce<>();
|
|
|
+
|
|
|
/**
|
|
|
* 患者信息
|
|
|
*/
|
|
@@ -62,6 +74,8 @@ public class YiZhuCheckData {
|
|
|
private Boolean passTheAudit = true;
|
|
|
private final List<String> groupList = Arrays.asList("71", "73");
|
|
|
|
|
|
+ private boolean checkForRestrictedMedication = false;
|
|
|
+
|
|
|
/**
|
|
|
* 全排斥医嘱
|
|
|
*/
|
|
@@ -92,7 +106,6 @@ public class YiZhuCheckData {
|
|
|
}
|
|
|
|
|
|
public Map<String, Object> startCheck(Consumer<XinZhenYzActOrder> action) {
|
|
|
-
|
|
|
for (XinZhenYzActOrder item : list) {
|
|
|
clearErrorMessage();
|
|
|
if (strictVerification) {
|
|
@@ -141,6 +154,14 @@ public class YiZhuCheckData {
|
|
|
|
|
|
private void itemCheck(XinZhenYzActOrder item) {
|
|
|
List<XinZhenYzActOrder> projectDetails = project.get(item.getOrderCode(), dao::itemDataOne);
|
|
|
+ XinZhenYzActOrder yzItemInio = yzItem.get(item.getOrderCode(), dao::yzItem);
|
|
|
+
|
|
|
+ if (yzItemInio != null) {
|
|
|
+ if (yzItemInio.getDelFlag() == 1) {
|
|
|
+ errorMessage.add("该医嘱已被停用,请联系物价。");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
List<String> ZK_CODE_LIST = new ArrayList<>();
|
|
|
Map<String, YzZdOrderItemConfirm> specialMedicalAdvice = new HashMap<>();
|
|
@@ -214,8 +235,8 @@ public class YiZhuCheckData {
|
|
|
item.setDrugOcc(item.getDrugQuan());
|
|
|
}
|
|
|
|
|
|
- private void drugCheck(XinZhenYzActOrder item) {
|
|
|
|
|
|
+ private void drugCheck(XinZhenYzActOrder item) {
|
|
|
if (StringUtil.isBlank(item.getGroupNo())) {
|
|
|
errorMessage.add("没有药房请重新开。");
|
|
|
return;
|
|
@@ -283,6 +304,7 @@ public class YiZhuCheckData {
|
|
|
if (BigUtils.bigDaYu(item.getDrugQuan(), detailsOfDrugs.getStockAmount())) {
|
|
|
errorMessage.add("药品领量大于药品的库存,当前库存量" + detailsOfDrugs.getStockAmount().stripTrailingZeros().toPlainString());
|
|
|
}
|
|
|
+ // 严格校验
|
|
|
if (strictVerification) {
|
|
|
if (detailsOfDrugs.getDeptRestrictions() > 0) {
|
|
|
errorMessage.add("该药品禁止在患者所在的科室使用。");
|
|
@@ -300,6 +322,7 @@ public class YiZhuCheckData {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ 校验医保限制用药(item);
|
|
|
}
|
|
|
String 出院带药 = "007";
|
|
|
if (item.getSupplyCode() != null && 出院带药.equals(item.getSupplyCode())) {
|
|
@@ -316,6 +339,41 @@ public class YiZhuCheckData {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ void 校验医保限制用药(XinZhenYzActOrder item) {
|
|
|
+ if (!checkForRestrictedMedication) return;
|
|
|
+ // 自费不管
|
|
|
+ if ("1".equals(item.getYbSelfFlag())) return;
|
|
|
+
|
|
|
+ ChargeLimitations chargeLimitations = yiBaoLimitation.get(item.getOrderCode(), dao::hasCharge);
|
|
|
+
|
|
|
+ if (chargeLimitations == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ChargeLimitations> data = dao.getChargeDay(patientInformation.getInpatientNo(),
|
|
|
+ patientInformation.getAdmissTimes(),
|
|
|
+ patientInformation.getLedgerSn(),
|
|
|
+ item.getOrderCode());
|
|
|
+
|
|
|
+ // 已经使用
|
|
|
+ int usedAlready = ListUtil.isBlank(data) ? 0 : data.size();
|
|
|
+ //可以使用天数
|
|
|
+ int canBeUsed = chargeLimitations.getLimitDay() - usedAlready;
|
|
|
+
|
|
|
+ Date latestNumberOfDays = DateUtil.addNaturalDays(item.getStartTime(), canBeUsed);
|
|
|
+ int compare = DateUtil.compare(item.getEndTime(), latestNumberOfDays);
|
|
|
+ if (item.getEndTime() == null) {
|
|
|
+ errorMessage.add(StrUtil.format(
|
|
|
+ "医保限制:【{}】天,请设置停止时间,不得超过【{}】",
|
|
|
+ chargeLimitations.getLimitDay(), DateUtil.formatDate(latestNumberOfDays, DateUtil.DEFAULT_PATTERN)));
|
|
|
+ } else if (compare > 0) {
|
|
|
+ errorMessage.add(StrUtil.format(
|
|
|
+ "医保限制:【{}】天,请设置停止时间,不得超过【{}】",
|
|
|
+ chargeLimitations.getLimitDay(), DateUtil.formatDate(latestNumberOfDays, DateUtil.DEFAULT_PATTERN)));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void strictVerificationFunc(XinZhenYzActOrder item) {
|
|
|
if (item.getParentNo() != null && item.getActOrderNo() != null) {
|
|
|
if (BigUtils.bigXiaoYu(item.getActOrderNo(), item.getParentNo())) {
|
|
@@ -417,4 +475,9 @@ public class YiZhuCheckData {
|
|
|
return repel.getCount() > 1;
|
|
|
}
|
|
|
|
|
|
+ public YiZhuCheckData checkForRestrictedMedication() {
|
|
|
+ checkForRestrictedMedication = true;
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
}
|