|
@@ -21,6 +21,9 @@ import java.util.*;
|
|
|
|
|
|
import static hnthyyxxk.cssybuploadfees.utils.DTool.betweenAutoUpload;
|
|
|
|
|
|
+/**
|
|
|
+ * @author dj
|
|
|
+ */
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
public class UploadFeeService {
|
|
@@ -65,7 +68,7 @@ public class UploadFeeService {
|
|
|
if (null == param.getSid()) {
|
|
|
return DJRet.fail(ExceptionEnum.LOGICAL_ERROR, "未检测到连接id,请刷新页面。");
|
|
|
}
|
|
|
- if (!param.getSid().equals("autoUpload") && DTool.betweenAutoUpload()) {
|
|
|
+ if (!"autoUpload".equals(param.getSid()) && DTool.betweenAutoUpload()) {
|
|
|
return DJRet.fail(ExceptionEnum.LOGICAL_ERROR, "01:55:00 至 08:00:00 为自动上传时间,请勿在此时间段内做上传操作!");
|
|
|
}
|
|
|
param.setFeeSize(dao.queryFeeSize(param.getInpatientNo(), param.getAdmissTimes()));
|
|
@@ -88,40 +91,42 @@ public class UploadFeeService {
|
|
|
Queue<Fee> fees = flag == 1 ?
|
|
|
dao.getCssybProjectFee(param.getInpatientNo(), param.getAdmissTimes()) :
|
|
|
dao.getCssybMedicineFee(param.getInpatientNo(), param.getAdmissTimes());
|
|
|
-
|
|
|
SimpleResponse response = new SimpleResponse();
|
|
|
if (null == fees || fees.isEmpty()) {
|
|
|
response.setCode(0);
|
|
|
return response;
|
|
|
}
|
|
|
-
|
|
|
List<Integer> refundDetailSn = new ArrayList<>();
|
|
|
JSONObject socketMsg = new JSONObject();
|
|
|
-
|
|
|
while (!fees.isEmpty()) {
|
|
|
Fee fee = fees.poll();
|
|
|
- if (null == fee.getYbCode() || fee.getYbCode().trim().equals("")) {
|
|
|
+ if (null == fee.getYbCode() || "".equals(fee.getYbCode().trim())) {
|
|
|
String message = "项目/药品【" + fee.getName() + "】未匹配,请联系物价科进行匹配,内线电话:2104";
|
|
|
sendUploadFeeResponse(param.getInpatientNo(), param.getName(),
|
|
|
fee.getDetailSn(), message, param.getSid());
|
|
|
}
|
|
|
- fee.setAmount(flag == 1 ? fee.getAmount() : fee.getChargeAmount());
|
|
|
- if (fee.getAmount().startsWith("-") && !refundDetailSn.contains(fee.getDetailSn())) {
|
|
|
+ String amount = fee.getAmount();
|
|
|
+ if (null == amount || "".equals(amount.trim())) {
|
|
|
+ amount = fee.getChargeAmount();
|
|
|
+ }
|
|
|
+ if (null == amount || "".equals(amount.trim())) {
|
|
|
+ log.info("项目/药品数量不正确:{}", fee);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (amount.startsWith("-") && !refundDetailSn.contains(fee.getDetailSn())) {
|
|
|
refundDetailSn.add(fee.getDetailSn());
|
|
|
fees.offer(fee);
|
|
|
log.info("退费项目,安排到末尾 >>> {}", fee);
|
|
|
continue;
|
|
|
}
|
|
|
- fee.setPrice(DTool.mathDivide(fee.getChargeFee(), fee.getAmount()));
|
|
|
+ fee.setPrice(DTool.mathDivide(fee.getChargeFee(), amount));
|
|
|
log.info("[ 操作员:{} ] - [ 患者{} ] - 费用上传>>> {}", param.getStaffId(),
|
|
|
param.getMainInfo(), JSON.toJSONString(fee));
|
|
|
String stmt = getUploadFuncId(param.getYbType().trim()) + "^43010150145^" + param.getStaffId() + "^^" +
|
|
|
SnowFlakeId.getInstance().nextId() + "^0000^" + param.getYbJlh() + "|" + fee.getYbClass() + "|" +
|
|
|
fee.getYbBillCode() + "|" + fee.getDetailSn() + "|" + formatChargeDate(fee.getChargeDate()) + "|"
|
|
|
+ fee.getChargeCode() + "|" + fee.getYbCode() + "|" + fee.getName() + "|" +
|
|
|
- fee.getPrice() + "|" + fee.getAmount() +
|
|
|
- "|||||||||||||" + fee.getStatusFlag() + "|^";
|
|
|
-
|
|
|
+ fee.getPrice() + "|" + amount + "|||||||||||||" + fee.getStatusFlag() + "|^";
|
|
|
response = executeSybTrade(param.getStaffId(), stmt);
|
|
|
log.info("[ 操作员:{} ] - [ 患者{} ] - 费用上传回执>>> {}", param.getStaffId(), param.getMainInfo(), response);
|
|
|
if ((response.getCode() == 0) || (response.getMessage().contains("主键重复"))) {
|
|
@@ -202,7 +207,7 @@ public class UploadFeeService {
|
|
|
}
|
|
|
|
|
|
private String getUploadFuncId(String ybType) {
|
|
|
- final boolean isGs = ybType.equals("42") || ybType.equals("44");
|
|
|
+ final boolean isGs = "42".equals(ybType) || "44".equals(ybType);
|
|
|
return isGs ? "2330" : "2310";
|
|
|
}
|
|
|
|