|
@@ -1,6 +1,7 @@
|
|
|
package thyyxxk.webserver.service.zhuyuanyiji;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -98,7 +99,7 @@ public class MenZhengXiangMuServer {
|
|
|
if (template.getList() == null) {
|
|
|
template.setList(new ArrayList<>());
|
|
|
}
|
|
|
- if (template.getChargeFee() == null || BigUtils.dengYu(template.getChargeFee(), BigDecimal.ZERO)) {
|
|
|
+ if (template.getChargeFee() == null) {
|
|
|
template.setChargeFee(new BigDecimal(BigInteger.ZERO));
|
|
|
}
|
|
|
template.setChargeFee(template.getChargeFee().add(item.getUnitPrice().multiply(item.getQuantity()).multiply(item.getDrugWin())));
|
|
@@ -129,44 +130,28 @@ public class MenZhengXiangMuServer {
|
|
|
if (ListUtil.notBlank(mz.getList()) && mz.getList().size() > 100) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "一次性操作不能大于 100 条,且不能为空。");
|
|
|
}
|
|
|
- Map<String, MzChargeDetail> map = dao.feiYongXinXi(mz.getRealNo(), mz.getPatientId(), mz.getTimes(), null).stream().collect(
|
|
|
- Collectors.toMap(item -> item.getPatientId() + item.getTimes() + item.getReceiptNo() + item.getOrderNo() + item.getItemNo() +
|
|
|
- item.getChargeItemCode(),
|
|
|
- a -> a, (k1, k2) -> k1
|
|
|
- ));
|
|
|
- List<MzChargeDetail> xuYaoBaoCunDeShuJu = new ArrayList<>();
|
|
|
- for (MzChargeDetail item : mz.getList()) {
|
|
|
- String key = item.getPatientId() + item.getTimes() + item.getReceiptNo() + item.getOrderNo() + item.getItemNo() +
|
|
|
- item.getChargeItemCode();
|
|
|
- MzChargeDetail mzChargeDetail = map.get(key);
|
|
|
- if (mzChargeDetail != null) {
|
|
|
- if (!item.getConfirmFlag().equals(mzChargeDetail.getConfirmFlag()) && item.getConfirmFlag() != 0) {
|
|
|
- xuYaoBaoCunDeShuJu.add(item);
|
|
|
- }
|
|
|
- if (item.getList() != null) {
|
|
|
- for (MzChargeDetail chargeDetail : item.getList()) {
|
|
|
- chargeDetail.setConfirmFlag(item.getConfirmFlag());
|
|
|
- String templateKey = chargeDetail.getPatientId() + chargeDetail.getTimes() + chargeDetail.getReceiptNo() + chargeDetail.getOrderNo()
|
|
|
- + chargeDetail.getItemNo() + chargeDetail.getChargeItemCode();
|
|
|
- MzChargeDetail template = map.get(templateKey);
|
|
|
- if (template != null) {
|
|
|
- if (!chargeDetail.getConfirmFlag().equals(mzChargeDetail.getConfirmFlag()) && chargeDetail.getConfirmFlag() != 0) {
|
|
|
- xuYaoBaoCunDeShuJu.add(chargeDetail);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- item.setList(null);
|
|
|
+ List<MzChargeDetail> confirmationFee = mz.getList();
|
|
|
+ List<MzChargeDetail> flatData = new ArrayList<>();
|
|
|
+ for (MzChargeDetail parentNode : confirmationFee) {
|
|
|
+ Integer confirmationSign = parentNode.getConfirmFlag();
|
|
|
+ List<MzChargeDetail> childNode = parentNode.getList();
|
|
|
+ parentNode.setList(null);
|
|
|
+ if (confirmationSign != null && confirmationSign != 0) {
|
|
|
+ flatData.add(parentNode);
|
|
|
+ if (ListUtil.notBlank(childNode)) {
|
|
|
+ childNode.forEach(item -> {
|
|
|
+ item.setConfirmFlag(confirmationSign);
|
|
|
+ flatData.add(item);
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (ListUtil.notBlank(xuYaoBaoCunDeShuJu)) {
|
|
|
- dao.xiangMuQueRenHuoQuXiao(xuYaoBaoCunDeShuJu, TokenUtil.getTokenUserId(), mz.getExecDept());
|
|
|
- dao.xiangMuQueRenYjReq(xuYaoBaoCunDeShuJu, TokenUtil.getTokenUserId(), mz.getExecDept());
|
|
|
- log.info("需要保存的数据:{}", JSON.toJSONString(xuYaoBaoCunDeShuJu));
|
|
|
+ if (ListUtil.notBlank(flatData)) {
|
|
|
+ dao.xiangMuQueRenHuoQuXiao(flatData, TokenUtil.getTokenUserId(), mz.getExecDept());
|
|
|
+ dao.xiangMuQueRenYjReq(flatData, TokenUtil.getTokenUserId(), mz.getExecDept());
|
|
|
return ResultVoUtil.success(ExceptionEnum.SUCCESS_AND_NOTIFICATION, "操作成功 L('ω')┘三└('ω')」");
|
|
|
}
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请选择需要操作的数据");
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|