|
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.collections4.ListUtils;
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import thyyxxk.webserver.config.exception.BizException;
|
|
@@ -323,20 +324,6 @@ public class YiZhuLuRuServer {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void dischargeMedicineList(Map<String, List<XinZhenYzActOrder>> map, XinZhenYiZhu huanZheXinXi) {
|
|
|
- if (dao.obtainTheNumberOfDischargedDrugs(huanZheXinXi.getInpatientNo(), huanZheXinXi.getAdmissTimes()) > 4) {
|
|
|
- throw new BizException(ExceptionEnum.LOGICAL_ERROR, "出院带药医嘱不得超过 4 种,且不得超过 15 天。");
|
|
|
- }
|
|
|
- String userCode = TokenUtil.getTokenUserId();
|
|
|
- // 根据不同的药房,生成不同的单子.
|
|
|
- for (Map.Entry<String, List<XinZhenYzActOrder>> entry : map.entrySet()) {
|
|
|
- Integer pageNo = publicServer.getTheDrugListNo();
|
|
|
- dao.summarySheetOfDrugs(pageNo, huanZheXinXi, userCode, entry.getKey());
|
|
|
- dao.insertDetailedMedicineList(pageNo, huanZheXinXi, userCode, entry.getKey(), entry.getValue());
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 录入单条医嘱 新的 下面的保存医嘱的都无效了
|
|
|
*
|
|
@@ -1021,16 +1008,7 @@ public class YiZhuLuRuServer {
|
|
|
错误信息.add("出院带药天数不得超过 15 天,计算方式结束时间减去开始时间。");
|
|
|
}
|
|
|
}
|
|
|
- // 计算出院带药的领量
|
|
|
- Map<String, Short> numberOfTimesADay = dao.numberOfTimesADay(item.getFrequCode());
|
|
|
- int times = 1;
|
|
|
- for (Map.Entry<String, Short> entry : numberOfTimesADay.entrySet()) {
|
|
|
- if (entry.getValue() != null) {
|
|
|
- times += entry.getValue();
|
|
|
- }
|
|
|
- }
|
|
|
- // 最小天数一天
|
|
|
- BigDecimal total = new BigDecimal((day <= 0 ? 1 : day) * times);
|
|
|
+ BigDecimal total = getTotal(item, day);
|
|
|
if (StringUtil.notBlank(feiYongXinXi.getDrugWeightUnit()) && item.getDoseUnit().trim().equals(feiYongXinXi.getDrugWeightUnit().trim())) {
|
|
|
item.setDrugOcc(DecimalUtil.multiply(DecimalUtil.divide(item.getDose(), feiYongXinXi.getDrugWeight(), 2), total));
|
|
|
item.setDrugQuan(DecimalUtil.multiply(DecimalUtil.divide(item.getDose(), feiYongXinXi.getDrugWeight()), total));
|
|
@@ -1132,6 +1110,27 @@ public class YiZhuLuRuServer {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 计算总量
|
|
|
+ *
|
|
|
+ * @param item 药品信息
|
|
|
+ * @param day 天数
|
|
|
+ * @return 返回总数
|
|
|
+ */
|
|
|
+ @NotNull
|
|
|
+ private BigDecimal getTotal(XinZhenYzActOrder item, int day) {
|
|
|
+ // 计算出院带药的领量
|
|
|
+ Map<String, Short> numberOfTimesADay = dao.numberOfTimesADay(item.getFrequCode());
|
|
|
+ int times = 1;
|
|
|
+ for (Map.Entry<String, Short> entry : numberOfTimesADay.entrySet()) {
|
|
|
+ if (entry.getValue() != null) {
|
|
|
+ times += entry.getValue();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 最小天数一天
|
|
|
+ return new BigDecimal((day <= 0 ? 1 : day) * times);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/***
|
|
|
* 获取项目信息
|
|
@@ -1590,15 +1589,7 @@ public class YiZhuLuRuServer {
|
|
|
day = (int) (cha / nd);
|
|
|
}
|
|
|
// 计算出院带药的领量
|
|
|
- Map<String, Short> numberOfTimesADay = dao.numberOfTimesADay(item.getFrequCode());
|
|
|
- int tempTimes = 1;
|
|
|
- for (Map.Entry<String, Short> entry : numberOfTimesADay.entrySet()) {
|
|
|
- if (entry.getValue() != null) {
|
|
|
- tempTimes += entry.getValue();
|
|
|
- }
|
|
|
- }
|
|
|
- // 最小天数一天
|
|
|
- BigDecimal total = new BigDecimal((day <= 0 ? 1 : day) * tempTimes);
|
|
|
+ BigDecimal total = getTotal(item, day);
|
|
|
if (StringUtil.notBlank(feiYongXinXi.getDrugWeightUnit()) && item.getDoseUnit().trim().equals(feiYongXinXi.getDrugWeightUnit().trim())) {
|
|
|
item.setDrugOcc(DecimalUtil.multiply(DecimalUtil.divide(item.getDose(), feiYongXinXi.getDrugWeight(), 2), total));
|
|
|
item.setDrugQuan(DecimalUtil.multiply(DecimalUtil.divide(item.getDose(), feiYongXinXi.getDrugWeight()), total));
|
|
@@ -1639,5 +1630,21 @@ public class YiZhuLuRuServer {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 生成出院带药药单
|
|
|
+ *
|
|
|
+ * @param map 药房组
|
|
|
+ * @param huanZheXinXi 患者信息
|
|
|
+ */
|
|
|
+ private void dischargeMedicineList(Map<String, List<XinZhenYzActOrder>> map, XinZhenYiZhu huanZheXinXi) {
|
|
|
+ String userCode = TokenUtil.getTokenUserId();
|
|
|
+ // 根据不同的药房,生成不同的单子.
|
|
|
+ for (Map.Entry<String, List<XinZhenYzActOrder>> entry : map.entrySet()) {
|
|
|
+ Integer pageNo = publicServer.getTheDrugListNo();
|
|
|
+ dao.summarySheetOfDrugs(pageNo, huanZheXinXi, userCode, entry.getKey());
|
|
|
+ dao.insertDetailedMedicineList(pageNo, huanZheXinXi, userCode, entry.getKey(), entry.getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|