ソースを参照

优化门诊共济

lighter 3 年 前
コミット
edd50feb26

+ 9 - 2
src/main/java/thyyxxk/simzfeeoprnsystm/dao/SiMzDao.java

@@ -10,11 +10,18 @@ import java.util.List;
 
 @Mapper
 public interface SiMzDao {
-    @Update("delete from t_si_pat_info where pat_no=#{patNo} and times=#{times}; " +
-            "update t_si_pat_info set times=#{times} where pat_no=#{patNo} and times=-1")
+    @Select("select count(1) from t_si_pat_info where pat_no=#{patNo} and times=#{times}")
+    int selectExistCount(@Param("patNo") String patNo,
+                         @Param("times") int times);
+
+    @Update("update t_si_pat_info set times=#{times} where pat_no=#{patNo} and times=-1")
     void updateMzTimes(@Param("patNo") String patNo,
                       @Param("times") int times);
 
+    @Delete("delete from t_si_pat_info where pat_no=#{patNo} and times=-1")
+    void deleteTempPatinfo(@Param("patNo") String patNo,
+                           @Param("times") int times);
+
     @Select("select * from t_si_pat_info where pat_no=#{patNo} and times=#{times}")
     SiPatInfo selectSiPatInfoForMz(@Param("patNo") String patNo,
                                    @Param("times") int times);

+ 7 - 6
src/main/java/thyyxxk/simzfeeoprnsystm/service/SiMzFeeService.java

@@ -543,20 +543,21 @@ public class SiMzFeeService {
 
     public ResultVo<FundDetail> directRegistration(DirectionRegParam param) {
         log.info("门诊共济:{}", param);
-        mzDao.updateMzTimes(param.getPatientId(), param.getTimes());
+        if (mzDao.selectExistCount(param.getPatientId(), param.getTimes()) == 0) {
+            mzDao.updateMzTimes(param.getPatientId(), param.getTimes());
+        }
+        mzDao.deleteTempPatinfo(param.getPatientId(), param.getTimes());
         MzPatientInfo mzptnt = new MzPatientInfo();
         mzptnt.setStaffId(param.getStaffId());
         mzptnt.setPatNo(param.getPatientId());
         mzptnt.setTimes(param.getTimes());
         mzptnt.setAcctUsedFlag(String.valueOf(param.getAcctUsedFlag()));
-
         SiPatInfo siPatInfo = mzDao.selectSiPatInfoForMz(mzptnt.getPatNo(), mzptnt.getTimes());
         mzptnt.setInsuplcAdmdvs(siPatInfo.getInsuplcAdmdvs());
         mzptnt.setInsutype(siPatInfo.getInsutype());
         mzptnt.setPsnType(siPatInfo.getPsnType());
         mzptnt.setName(siPatInfo.getPsnName());
         mzptnt.setSocialNo(siPatInfo.getCertno());
-
         if (StringUtil.notBlank(param.getReadCardResult())) {
             MdtrtCertType mdtrtCertType = MdtrtCertType.get(param.getReadCardType());
             mzptnt.setMdtrtCertType(mdtrtCertType.getLabel());
@@ -577,7 +578,6 @@ public class SiMzFeeService {
         siPatInfo.setFromDirectReg(true);
         SpcChrDiseAcct spcChrDiseAcct = new SpcChrDiseAcct();
         ResultVo<String> upldMdtrtRes = uploadOutpatientInfo(spcChrDiseAcct, siPatInfo, param.getStaffId());
-        log.info("上传就诊信息:{}", upldMdtrtRes);
         if (null == upldMdtrtRes) {
             revokeOutpatientRegistration(mzptnt);
             return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
@@ -589,7 +589,6 @@ public class SiMzFeeService {
 
         // 上传就诊信息成功后生成门诊医保费用
         ResultVo<List<Map<String, Object>>> getMzRcptRes = webHisSrvc.getMzReceipts(webHisUrl, mzptnt);
-        log.info("获取门诊处方:{}", getMzRcptRes);
         if (null == getMzRcptRes) {
             revokeOutpatientRegistration(mzptnt);
             return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);
@@ -605,8 +604,10 @@ public class SiMzFeeService {
                 mzReceipts.addAll(entry.getValue());
             }
         }
+        if (mzReceipts.isEmpty()) {
+            return ResultVoUtil.fail(ExceptionEnum.NULL_POINTER, "没有可以上传到医保的费用。");
+        }
         ResultVo<String> insertSiMzFeeRes = webHisSrvc.insertSiMzFeesForThmz(webHisUrl, mzReceipts);
-        log.info("生成医保费用:{}", insertSiMzFeeRes);
         if (null == insertSiMzFeeRes) {
             revokeOutpatientRegistration(mzptnt);
             return ResultVoUtil.fail(ExceptionEnum.NETWORK_ERROR);