Sfoglia il codice sorgente

优化门诊共济

lighter 2 anni fa
parent
commit
2e75551442

+ 1 - 0
src/main/java/thyyxxk/simzfeeoprnsystm/pojo/MzPatientInfo.java

@@ -37,6 +37,7 @@ public class MzPatientInfo {
     private String icdText;
     private Integer needSaving;
     private Integer saved;
+    private Integer needRevokeRegistration;
 
     private String mdtrtCertType;
     private String mdtrtCertNo;

+ 19 - 1
src/main/java/thyyxxk/simzfeeoprnsystm/service/SiMzFeeService.java

@@ -21,6 +21,7 @@ import java.math.RoundingMode;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 
 @Slf4j
 @Service
@@ -142,11 +143,11 @@ public class SiMzFeeService {
             diag.setDiagCode(indise.getOpspDiseCode());
             diag.setDiagName(indise.getOpspDiseName());
             diseinfo.add(diag);
-            mzDao.updatePatDiseinfo(siPatInfo.getPatNo(), siPatInfo.getTimes(), diag.getDiagCode(), diag.getDiagName());
         } else {
             if (siPatInfo.getFromDirectReg()) {
                 String icdCodeNew = mzDao.selectIcdCodeNew(siPatInfo.getPatNo(), siPatInfo.getTimes());
                 if (StringUtil.isBlank(icdCodeNew)) {
+                    log.info("【{}】 上传就诊信息失败,门诊诊断为空。", siPatInfo.getPatNo());
                     return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "患者的门诊诊断为空,请联系医生填写。");
                 }
                 diseinfo = new ArrayList<>();
@@ -172,6 +173,7 @@ public class SiMzFeeService {
             } else {
                 diseinfo = mzDao.selectMzDiags(siPatInfo.getPatNo(), siPatInfo.getTimes());
                 if (null == diseinfo || diseinfo.isEmpty()) {
+                    log.info("【{}】 上传就诊信息失败,门诊诊断为空。", siPatInfo.getPatNo());
                     return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "患者的门诊诊断为空,请联系医生填写,或者自行补录。");
                 }
             }
@@ -193,6 +195,7 @@ public class SiMzFeeService {
         Integer infcode = result.getInteger(RESULT_CODE);
         logDao.insert(new SiLog(input, result, siPatInfo.getPatNo(), siPatInfo.getTimes(), infcode, siPatInfo.getPsnNo()));
         if (result.getIntValue(RESULT_CODE) == 0) {
+            mzDao.updatePatDiseinfo(siPatInfo.getPatNo(), siPatInfo.getTimes(), indise.getOpspDiseCode(), indise.getOpspDiseName());
             return ResultVoUtil.success("门诊就诊信息上传成功。");
         }
         return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
@@ -312,6 +315,13 @@ public class SiMzFeeService {
     }
 
     public ResultVo<FundDetail> outpatientPreSettlement(MzPatientInfo p) {
+        while (MzgjUtil.inProcessing(p.getPatNo())) {
+            try {
+                TimeUnit.SECONDS.sleep(1);
+            } catch (InterruptedException e) {
+                throw new RuntimeException(e);
+            }
+        }
         if (null == p.getTimes()) {
             p.setTimes(mzDao.selectMaxTimes(p.getPatNo()));
         }
@@ -481,6 +491,9 @@ public class SiMzFeeService {
         SiSetlinfo setlinfo = mzDao.selectSettledInfo(p.getPatNo(), p.getTimes(), 0);
         if (null == setlinfo) {
             setlinfo = mzDao.selectSettledInfo(p.getPatNo(), p.getTimes(), 1);
+            if (null == setlinfo) {
+                return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "没有此患者的已结算数据。");
+            }
             return getFundDetailFromSetlinfo(setlinfo);
         }
         JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.REVOKE_OUTPATIENT_SETTLEMENT,
@@ -504,6 +517,10 @@ public class SiMzFeeService {
             mzDao.deleteSetlInfo(p.getPatNo(), p.getTimes());
             mzDao.deleteSetlDetail(p.getPatNo(), p.getTimes());
             mzDao.updateRvkSetlMsgid(p.getPatNo(), p.getTimes(), input.getString("msgid"));
+            if (null != p.getNeedRevokeRegistration() && p.getNeedRevokeRegistration() == 1) {
+                revokeOutpatientFeeDetails(p);
+                revokeOutpatientRegistration(p);
+            }
             return getFundDetailFromSetlinfo(setlinfo);
         }
         return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, result.getString(ERROR_MESSAGE));
@@ -537,6 +554,7 @@ public class SiMzFeeService {
     public ResultVo<FundDetail> directRegistration(DirectionRegParam param) {
         log.info("门诊共济:{}", param);
         if (MzgjUtil.inProcessing(param.getPatientId())) {
+            log.info("【{}】此患者上一次的共济流程尚未结束,请稍后再试。", param.getPatientId());
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "此患者上一次的共济流程尚未结束,请稍后再试。");
         }
         ResultVo<FundDetail> setlfund = getFundDetailByPatientInfo(param.getPatientId(), param.getTimes());