|
@@ -11,19 +11,16 @@ import thyyxxk.webserver.constants.Capacity;
|
|
|
import thyyxxk.webserver.constants.YesOrNo;
|
|
|
import thyyxxk.webserver.constants.sidicts.*;
|
|
|
import thyyxxk.webserver.dao.his.medicalinsurance.SiManageDao;
|
|
|
-import thyyxxk.webserver.dao.his.medicalinsurance.SiQueryDao;
|
|
|
import thyyxxk.webserver.dao.his.medicalinsurance.SiSetlinfoDao;
|
|
|
-import thyyxxk.webserver.dao.his.medicalinsurance.UpIdCollectionDao;
|
|
|
-import thyyxxk.webserver.dao.his.yibao.DismissDao;
|
|
|
import thyyxxk.webserver.entity.ResultVo;
|
|
|
import thyyxxk.webserver.entity.dictionary.PureCodeName;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.manage.*;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SiSetlinfo;
|
|
|
import thyyxxk.webserver.entity.medicalinsurance.setlinfo.SlctSetlPrm;
|
|
|
-import thyyxxk.webserver.service.PublicServer;
|
|
|
import thyyxxk.webserver.utils.*;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.nio.file.Files;
|
|
|
import java.nio.file.Paths;
|
|
|
import java.util.*;
|
|
@@ -44,27 +41,15 @@ public class SiManageService {
|
|
|
private final SiDownloadService dldService;
|
|
|
private final SiManageDao dao;
|
|
|
private final SiSetlinfoDao setlinfoDao;
|
|
|
- private final SiQueryDao queryDao;
|
|
|
-
|
|
|
- private final UpIdCollectionDao upIdCollectionDao;
|
|
|
-
|
|
|
- private final DismissDao dismissDao;
|
|
|
-
|
|
|
- private final PublicServer publicServer;
|
|
|
-
|
|
|
|
|
|
@Autowired
|
|
|
public SiManageService(ExecService exec, SiUploadService upldServcie,
|
|
|
- SiDownloadService dldService, SiManageDao dao, SiSetlinfoDao setlinfoDao, SiQueryDao queryDao, UpIdCollectionDao upIdCollectionDao, DismissDao dismissDao, PublicServer publicServer) {
|
|
|
+ SiDownloadService dldService, SiManageDao dao, SiSetlinfoDao setlinfoDao) {
|
|
|
this.exec = exec;
|
|
|
this.upldServcie = upldServcie;
|
|
|
this.dldService = dldService;
|
|
|
this.dao = dao;
|
|
|
this.setlinfoDao = setlinfoDao;
|
|
|
- this.queryDao = queryDao;
|
|
|
- this.upIdCollectionDao = upIdCollectionDao;
|
|
|
- this.dismissDao = dismissDao;
|
|
|
- this.publicServer = publicServer;
|
|
|
}
|
|
|
|
|
|
public ResultVo<String> uploadCatalogueContrast(CatalogueContrast prm) {
|
|
@@ -154,6 +139,25 @@ public class SiManageService {
|
|
|
}
|
|
|
|
|
|
public ResultVo<String> institutionSettlementLedgerCheck(InstStlLdgChk instStlLdgChk) {
|
|
|
+ String startdate = DateUtil.getDayStartTime(instStlLdgChk.getStmtBegndate());
|
|
|
+ String enddate = DateUtil.getDayEndTime(instStlLdgChk.getStmtEnddate());
|
|
|
+ List<InstSetlLdgChkBrf> brfs = dao.selectSetlChkBrfs(instStlLdgChk.getClrType(), instStlLdgChk.getInsutype(),
|
|
|
+ instStlLdgChk.getSetlOptins(), startdate, enddate);
|
|
|
+ BigDecimal medfeesum = new BigDecimal("0");
|
|
|
+ BigDecimal acctpaysum = new BigDecimal("0");
|
|
|
+ BigDecimal fundpaysum = new BigDecimal("0");
|
|
|
+ for (InstSetlLdgChkBrf brf : brfs) {
|
|
|
+ medfeesum = DecimalUtil.add(medfeesum, brf.getMedfeeSumamt());
|
|
|
+ acctpaysum = DecimalUtil.add(acctpaysum, brf.getAcctPay());
|
|
|
+ fundpaysum = DecimalUtil.add(fundpaysum, brf.getFundPaySumamt());
|
|
|
+ if (null != brf.getHospPay()) {
|
|
|
+ fundpaysum = DecimalUtil.minus(fundpaysum, brf.getHospPay());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ instStlLdgChk.setMedfeeSumamt(medfeesum);
|
|
|
+ instStlLdgChk.setAcctPay(acctpaysum);
|
|
|
+ instStlLdgChk.setFundPaySumamt(fundpaysum);
|
|
|
+ instStlLdgChk.setFixmedinsSetlCnt(brfs.size());
|
|
|
JSONObject input = exec.makeTradeHeader(SiFunction.INSTITUTION_SETTLEMENT_LEDGER_CHECK);
|
|
|
String ref = JSONObject.toJSONStringWithDateFormat(instStlLdgChk, "yyyy-MM-dd");
|
|
|
input.getJSONObject("input").put("data", JSONObject.parseObject(ref));
|
|
@@ -195,18 +199,38 @@ public class SiManageService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
|
|
|
}
|
|
|
|
|
|
- public ResultVo<List<InsSetlDetlChkRslt>> institutionSettlementDetailCheck(InsSetlDetlChkPrm prm) {
|
|
|
+ public ResultVo<List<InsSetlDetlChkRslt>> institutionSettlementDetailCheck(InsSetlDetlChk prm) {
|
|
|
String snowId = SnowFlakeId.instance().nextId();
|
|
|
String filename = snowId + ".txt";
|
|
|
StringBuilder fsIn = new StringBuilder();
|
|
|
- for (InsSetlDetlChkFile item : prm.getFsUploadIns()) {
|
|
|
+ String startdate = DateUtil.getDayStartTime(prm.getStmtBegndate());
|
|
|
+ String enddate = DateUtil.getDayEndTime(prm.getStmtEnddate());
|
|
|
+ List<InstSetlLdgChkBrf> brfs = dao.selectSetlChkBrfs(prm.getClrType(),
|
|
|
+ prm.getSetlOptins(), startdate, enddate);
|
|
|
+ BigDecimal medfeesum = new BigDecimal("0");
|
|
|
+ BigDecimal psnCashPay = new BigDecimal("0");
|
|
|
+ BigDecimal fundpaysum = new BigDecimal("0");
|
|
|
+ for (InstSetlLdgChkBrf brf : brfs) {
|
|
|
+ medfeesum = DecimalUtil.add(medfeesum, brf.getMedfeeSumamt());
|
|
|
+ psnCashPay = DecimalUtil.add(psnCashPay, brf.getPsnCashPay());
|
|
|
+ fundpaysum = DecimalUtil.add(fundpaysum, brf.getFundPaySumamt());
|
|
|
+ if (null != brf.getHospPay()) {
|
|
|
+ fundpaysum = DecimalUtil.minus(fundpaysum, brf.getHospPay());
|
|
|
+ brf.setFundPaySumamt(DecimalUtil.minus(brf.getFundPaySumamt(), brf.getHospPay()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ prm.setMedfeeSumamt(medfeesum);
|
|
|
+ prm.setCashPayamt(psnCashPay);
|
|
|
+ prm.setFundPaySumamt(fundpaysum);
|
|
|
+ prm.setFixmedinsSetlCnt(brfs.size());
|
|
|
+ for (InstSetlLdgChkBrf item : brfs) {
|
|
|
fsIn.append(item.getSetlId()).append("\t")
|
|
|
.append(item.getMdtrtId()).append("\t")
|
|
|
.append(item.getPsnNo()).append("\t")
|
|
|
.append(item.getMedfeeSumamt()).append("\t")
|
|
|
.append(item.getFundPaySumamt()).append("\t")
|
|
|
.append(item.getAcctPay()).append("\t")
|
|
|
- .append(prm.getData().getRefdSetlFlag()).append("\n");
|
|
|
+ .append(prm.getRefdSetlFlag()).append("\n");
|
|
|
}
|
|
|
try {
|
|
|
Files.write(Paths.get(filename), fsIn.toString().getBytes());
|
|
@@ -217,13 +241,13 @@ public class SiManageService {
|
|
|
ResultVo<String> uplRes = upldServcie.uploadFile(JSONObject.parseObject(fsUploadIn), filename);
|
|
|
ZipUtil.deleteFile(zipFile);
|
|
|
if (uplRes.getCode().equals(ExceptionEnum.SUCCESS.getCode())) {
|
|
|
- prm.getData().setFileQuryNo(uplRes.getData());
|
|
|
+ prm.setFileQuryNo(uplRes.getData());
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
log.error("医药机构费用结算对明细账出错", e);
|
|
|
}
|
|
|
JSONObject input = exec.makeTradeHeader(SiFunction.INSTITUTION_SETTLEMENT_DETAIL_CHECK);
|
|
|
- String ref = JSONObject.toJSONStringWithDateFormat(prm.getData(), "yyyy-MM-dd");
|
|
|
+ String ref = JSONObject.toJSONStringWithDateFormat(prm, "yyyy-MM-dd");
|
|
|
input.getJSONObject("input").put("data", JSONObject.parseObject(ref));
|
|
|
JSONObject result = exec.executeTrade(input, SiFunction.INSTITUTION_SETTLEMENT_DETAIL_CHECK);
|
|
|
log.info("【操作员:{}】,医药机构费用结算对明细账:\n参数:{},\n结果:{}", TokenUtil.getTokenUserId(), input, result);
|
|
@@ -259,8 +283,8 @@ public class SiManageService {
|
|
|
if (StringUtil.notBlank(prm.getInsutype())) {
|
|
|
wrapper.eq("insutype", prm.getInsutype());
|
|
|
}
|
|
|
- String begndate = DateUtil.formatDatetime(prm.getBegndate(), "yyyy-MM-dd") + " 00:00:00";
|
|
|
- String enddate = DateUtil.formatDatetime(prm.getEnddate(), "yyyy-MM-dd") + " 23:59:59";
|
|
|
+ String begndate = DateUtil.formatDatetime(prm.getStmtBegndate(), "yyyy-MM-dd") + " 00:00:00";
|
|
|
+ String enddate = DateUtil.formatDatetime(prm.getStmtEnddate(), "yyyy-MM-dd") + " 23:59:59";
|
|
|
wrapper.eq("setl_type", prm.getClrType());
|
|
|
wrapper.eq("revoked", YesOrNo.NO.getCode());
|
|
|
wrapper.apply("setl_time>='" + begndate + "'");
|