|
@@ -7,7 +7,6 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
import thyyxxk.webserver.config.exception.ExceptionEnum;
|
|
|
import thyyxxk.webserver.dao_his.markmtfees.MarkMtFeesDao;
|
|
|
-import thyyxxk.webserver.pojo.HrgResponse;
|
|
|
import thyyxxk.webserver.pojo.ResultVo;
|
|
|
import thyyxxk.webserver.pojo.markmtfees.*;
|
|
|
import thyyxxk.webserver.utils.*;
|
|
@@ -45,15 +44,15 @@ public class MarkMtFeesService {
|
|
|
Map<String, Object> data = new HashMap<>();
|
|
|
data.put("patientId", patientId);
|
|
|
data.put("times", times);
|
|
|
- int mtCount;
|
|
|
- if (param.getResponceType().equals("02")) {
|
|
|
- mtCount = dao.selectCountMtPartInfo(patientId, times);
|
|
|
- } else {
|
|
|
- mtCount = dao.selectCountMtPartInfoForSyb(patientId, times, param.getBizType());
|
|
|
- }
|
|
|
- if (mtCount > 0) {
|
|
|
- return ResultVoUtil.success(data);
|
|
|
- }
|
|
|
+// int mtCount;
|
|
|
+// if (param.getResponceType().equals("02")) {
|
|
|
+// mtCount = dao.selectCountMtPartInfo(patientId, times);
|
|
|
+// } else {
|
|
|
+// mtCount = dao.selectCountMtPartInfoForSyb(patientId, times, param.getBizType());
|
|
|
+// }
|
|
|
+// if (mtCount > 0) {
|
|
|
+// return ResultVoUtil.success(data);
|
|
|
+// }
|
|
|
param.setIdCard(socialNo);
|
|
|
param.setStaffId(TokenUtil.getTokenUserId());
|
|
|
RestTemplate template = new RestTemplate();
|
|
@@ -68,22 +67,20 @@ public class MarkMtFeesService {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, "服务器内部错误,查询门特身份信息失败。");
|
|
|
}
|
|
|
Map<String, Object> map = FilterUtil.cast(mapRet);
|
|
|
+ if (200 != (int) map.get("code")) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, map.get("message").toString());
|
|
|
+ }
|
|
|
if (param.getResponceType().equals("02")) {
|
|
|
- if (-1 == (int) map.get("code")) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, map.get("msg").toString());
|
|
|
- }
|
|
|
- List<Map<String, String>> spinfos = FilterUtil.cast(map.get("spinfo"));
|
|
|
+ Map<String, Object> hnsybRet = FilterUtil.cast(map.get("data"));
|
|
|
+ List<Map<String, String>> spinfos = FilterUtil.cast(hnsybRet.get("spinfo"));
|
|
|
Map<String, String> spinfo = spinfos.get(0);
|
|
|
String icd = spinfo.get("icd");
|
|
|
String serialApply = spinfo.get("serial_apply");
|
|
|
- spinfos = FilterUtil.cast(map.get("personinfo"));
|
|
|
+ spinfos = FilterUtil.cast(hnsybRet.get("personinfo"));
|
|
|
String balance = spinfos.get(0).get("last_balance");
|
|
|
dao.insertHnsybMtPartInfo(patientId, times, icd, balance, serialApply);
|
|
|
return ResultVoUtil.success(data);
|
|
|
}
|
|
|
- if (200 != (int) map.get("code")) {
|
|
|
- return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, map.get("message").toString());
|
|
|
- }
|
|
|
data.put("list", map.get("data"));
|
|
|
return ResultVoUtil.success(data);
|
|
|
}
|
|
@@ -93,33 +90,28 @@ public class MarkMtFeesService {
|
|
|
if (mtCount > 0) {
|
|
|
return ResultVoUtil.success();
|
|
|
}
|
|
|
+ param.setMzSerialNo(SnowFlakeId.instance().nextId());
|
|
|
dao.insertCssybMtPartInfo(param);
|
|
|
return ResultVoUtil.success();
|
|
|
}
|
|
|
|
|
|
public ResultVo<Map<String, Object>> getMtReceipts(String patientId, Integer times) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
-
|
|
|
List<MzPatient> mzPatients = dao.selectMzPatient(patientId, times);
|
|
|
if (null == mzPatients || mzPatients.isEmpty()) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "【门诊号:" + patientId + ",就诊次数:" +
|
|
|
times + "】未找到此患者的本次就诊信息,请核实。");
|
|
|
}
|
|
|
-
|
|
|
MzVisit mzVisit = dao.selectMzVisit(patientId, times);
|
|
|
-
|
|
|
if (null == mzVisit) {
|
|
|
return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "【门诊号:" + patientId + ",就诊次数:" +
|
|
|
times + "】未找到此患者的本次就诊信息,请核实。");
|
|
|
}
|
|
|
-
|
|
|
map.put("mzPatient", mzPatients.get(0));
|
|
|
map.put("mzVisit", mzVisit);
|
|
|
-
|
|
|
List<MzReceipt> mzReceipts = dao.selectMzReceipts(patientId, times, mzVisit.getReceiptNo());
|
|
|
mzReceipts.removeIf(item -> item.getBillItemCode().equals("TC") || item.getPayMark() != 5 || item.getChargeItemCode().equals("BILL99"));
|
|
|
// mzReceipts.removeIf(item -> item.getBillItemCode().trim().equals("TC") || item.getPayMark() == 5 || item.getChargeItemCode().equals("BILL99"));
|
|
|
-
|
|
|
Map<Integer, List<MzReceipt>> temp = new HashMap<>();
|
|
|
mzReceipts.forEach(item -> {
|
|
|
if (!temp.containsKey(item.getOrderNo())) {
|
|
@@ -150,7 +142,6 @@ public class MarkMtFeesService {
|
|
|
if (param.getResponceType().equals("02")) {
|
|
|
param.setYbType("13");
|
|
|
}
|
|
|
-
|
|
|
MzReceipt receipt = param.getReceipts().get(0);
|
|
|
int count = dao.selectFeeCount(receipt.getPatientId(), receipt.getTimes(),
|
|
|
receipt.getReceiptNo(), receipt.getOrderNo());
|
|
@@ -162,4 +153,21 @@ public class MarkMtFeesService {
|
|
|
param.getReceipts().forEach(dao::insertBatchedMtFeeInfo);
|
|
|
return ResultVoUtil.success();
|
|
|
}
|
|
|
+
|
|
|
+ public ResultVo<Object> cssybMtPreCal(String patientId, Integer times) {
|
|
|
+ JSONObject param = new JSONObject();
|
|
|
+ param.put("patientId", patientId);
|
|
|
+ param.put("times", times);
|
|
|
+ param.put("staffId", TokenUtil.getTokenUserId());
|
|
|
+ RestTemplate template = new RestTemplate();
|
|
|
+ Object mapRet = template.postForObject(YbActionLinks.normalLinks.get("cssybMtPreCal"), param, Object.class);
|
|
|
+ if (null == mapRet) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, "服务器内部错误,门特费用试算失败。");
|
|
|
+ }
|
|
|
+ Map<String, Object> map = FilterUtil.cast(mapRet);
|
|
|
+ if (200 != (int) map.get("code")) {
|
|
|
+ return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, map.get("message").toString());
|
|
|
+ }
|
|
|
+ return ResultVoUtil.success(map.get("data"));
|
|
|
+ }
|
|
|
}
|