|
@@ -467,34 +467,37 @@ public class DismissService {
|
|
|
|
|
|
private int setHisStatusOut(MedinsSettleFee settle) {
|
|
|
final Date disDate;
|
|
|
+ String patNo = settle.getInpatientNo();
|
|
|
+ int times = settle.getAdmissTimes();
|
|
|
if ("zy_actpatient".equals(settle.getTable())) {
|
|
|
- disDate = dao.selectActOrderDisDate(settle.getInpatientNo(), settle.getAdmissTimes());
|
|
|
+ disDate = dao.selectActOrderDisDate(patNo, times);
|
|
|
} else {
|
|
|
- disDate = dao.selectActOrderDisDate2(settle.getInpatientNo(), settle.getAdmissTimes());
|
|
|
+ disDate = dao.selectActOrderDisDate2(patNo, times);
|
|
|
}
|
|
|
- if (dao.updateZyActpatient(settle.getInpatientNo(), settle.getAdmissTimes(),
|
|
|
+ if (dao.updateZyActpatient(patNo, times,
|
|
|
disDate, settle.getStaffId(), settle.getTable()) < 1) {
|
|
|
return -1;
|
|
|
}
|
|
|
if ("zy_actpatient".equals(settle.getTable())) {
|
|
|
- dao.deleteZyInactpatient(settle.getInpatientNo(), settle.getAdmissTimes());
|
|
|
- if (dao.insertZyInactpatient(settle.getInpatientNo(), settle.getAdmissTimes()) < 1) {
|
|
|
+ dao.deleteZyInactpatient(patNo, times);
|
|
|
+ if (dao.insertZyInactpatient(patNo, times) < 1) {
|
|
|
return -2;
|
|
|
}
|
|
|
}
|
|
|
- final String patNo1 = settle.getInpatientNo() + "$1";
|
|
|
- final String patNo6 = settle.getInpatientNo() + "$6";
|
|
|
- dao.updateZyActpatientAgain(patNo1, patNo6, settle.getAdmissTimes(), disDate, settle.getTable());
|
|
|
+ final String patNo1 = patNo + "$1";
|
|
|
+ final String patNo6 = patNo + "$6";
|
|
|
+ dao.updateZyActpatientAgain(patNo1, patNo6, times, disDate, settle.getTable());
|
|
|
if ("zy_actpatient".equals(settle.getTable())) {
|
|
|
- dao.insertZyInactpatientAgain(patNo1, patNo6, settle.getAdmissTimes());
|
|
|
+ dao.insertZyInactpatientAgain(patNo1, patNo6, times);
|
|
|
}
|
|
|
- if (dao.updateZyAdt(settle.getInpatientNo(), settle.getAdmissTimes(), settle.getWardCode(), settle.getDeptCode(),
|
|
|
+ if (dao.updateZyAdt(patNo, times, settle.getWardCode(), settle.getDeptCode(),
|
|
|
settle.getBedNo(), disDate) < 1) {
|
|
|
return -3;
|
|
|
}
|
|
|
- dao.updateZyBedMi(settle.getInpatientNo(), settle.getAdmissTimes());
|
|
|
- dao.deleteZyActpatient(settle.getInpatientNo());
|
|
|
- dao.deleteZyActpatientAgain(patNo1, patNo6, settle.getAdmissTimes());
|
|
|
+ dao.updateZyBedMi(patNo, times);
|
|
|
+ dao.deleteZyActpatient(patNo);
|
|
|
+ dao.deleteZyActpatientAgain(patNo1, patNo6, times);
|
|
|
+ dao.deleteZjdzSettleDeposit(patNo, times);
|
|
|
return insertNewZyWorkLog(settle);
|
|
|
}
|
|
|
|
|
@@ -506,15 +509,27 @@ public class DismissService {
|
|
|
}
|
|
|
|
|
|
private int hisMiddleSettle(MedinsSettleFee param) {
|
|
|
- param.setLedgerSn(dao.getLedgerSn(param.getInpatientNo(), param.getAdmissTimes()));
|
|
|
- int newLedgerSn = param.getLedgerSn() + 1;
|
|
|
- dao.updateTimesBilledByIncreaseOne(param.getInpatientNo(), param.getAdmissTimes(), param.getTable());
|
|
|
- dao.insertNewLedgerFile(param.getInpatientNo(), param.getAdmissTimes(), newLedgerSn);
|
|
|
- dao.updateFeesLedgerSn(param.getInpatientNo(), param.getAdmissTimes(), newLedgerSn,
|
|
|
- param.getLedgerSn(), param.getZjdzDatetime());
|
|
|
- dao.updateZyLedgerFileTotalCharge(param.getInpatientNo(), param.getAdmissTimes(), param.getLedgerSn());
|
|
|
- dao.updateZyLedgerFileTotalCharge(param.getInpatientNo(), param.getAdmissTimes(), newLedgerSn);
|
|
|
- dao.clearMedinsInfo(param.getInpatientNo(), param.getAdmissTimes(), DateUtil.addOneSecond(param.getZjdzDatetime()));
|
|
|
+ String patNo = param.getInpatientNo();
|
|
|
+ int times = param.getAdmissTimes();
|
|
|
+ int currentLedgerSn = dao.getLedgerSn(patNo, times);
|
|
|
+ int newLedgerSn = currentLedgerSn + 1;
|
|
|
+
|
|
|
+ dao.updateTimesBilledByIncreaseOne(patNo, times, param.getTable());
|
|
|
+ dao.insertNewLedgerFile(patNo, times, newLedgerSn);
|
|
|
+ dao.updateFeesLedgerSn(patNo, times, newLedgerSn, currentLedgerSn, param.getZjdzDatetime());
|
|
|
+ dao.updateZyLedgerFileTotalCharge(patNo, times, currentLedgerSn);
|
|
|
+ dao.updateZyLedgerFileTotalCharge(patNo, times, newLedgerSn);
|
|
|
+
|
|
|
+ DepositFile depositFile = dao.selectLatestDepositFile(patNo, times);
|
|
|
+ if (null == depositFile) {
|
|
|
+ depositFile = new DepositFile(patNo, times, newLedgerSn);
|
|
|
+ }
|
|
|
+ depositFile.initZjdzSettleDeposit(dao.selectLastLedgerSettle(patNo, times, currentLedgerSn));
|
|
|
+ dao.insertNewDeposit(depositFile);
|
|
|
+
|
|
|
+ dao.clearMedinsInfo(patNo, times, DateUtil.addOneSecond(param.getZjdzDatetime()));
|
|
|
+
|
|
|
+ param.setLedgerSn(currentLedgerSn);
|
|
|
return insertNewZyWorkLog(param);
|
|
|
}
|
|
|
|