Bläddra i källkod

诊间特殊门诊

lighter 1 år sedan
förälder
incheckning
b9019f701f

+ 1 - 1
pom.xml

@@ -10,7 +10,7 @@
     </parent>
     <groupId>thyyxxk</groupId>
     <artifactId>SiMzFeeOprnSystm</artifactId>
-    <version>2.2</version>
+    <version>2.3.8</version>
     <name>SiMzFeeOprnSystm</name>
     <description>SiMzFeeOprnSystm</description>
     <properties>

+ 1 - 4
src/main/java/thyyxxk/simzfeeoprnsystm/controller/SiMzApiController.java

@@ -1,9 +1,6 @@
 package thyyxxk.simzfeeoprnsystm.controller;
 
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import thyyxxk.simzfeeoprnsystm.pojo.MzVisit;
 import thyyxxk.simzfeeoprnsystm.pojo.ResultVo;
 import thyyxxk.simzfeeoprnsystm.service.SiMzApiMariadbService;

+ 5 - 0
src/main/java/thyyxxk/simzfeeoprnsystm/controller/SiMzFeeController.java

@@ -67,4 +67,9 @@ public class SiMzFeeController {
     public ResultVo<Integer> isPatientDuringSiSettle(@RequestParam("patientId") String patientId) {
         return service.isPatientDuringSiSettle(patientId);
     }
+
+    @GetMapping("/test")
+    public void test() {
+        service.test();
+    }
 }

+ 3 - 0
src/main/java/thyyxxk/simzfeeoprnsystm/dao/SiMzDao.java

@@ -172,6 +172,9 @@ public interface SiMzDao {
     @Select("select acct_pay from t_si_presetlinfo where mdtrt_id=#{mdtrtId}")
     Double selectAcctPayInPreSettle(@Param("mdtrtId") String mdtrtId);
 
+    @Select("select rtrim(social_no) from mz_patient_mi where patient_id=#{patNo}")
+    String selectSocialNo(@Param("patNo") String patNo);
+
     @Select("select a.psn_no,a.insutype,chrgBchno=a.pat_no+'_'+cast(a.times as varchar)+'_1', " +
             "medOrgOrd=a.pat_no+'_'+cast(a.times as varchar)+'_'+a.mdtrt_id, " +
             "b.visit_date as begntime,a.mdtrt_id,a.med_type,acctUsedFlag='0', " +

+ 17 - 1
src/main/java/thyyxxk/simzfeeoprnsystm/pojo/DirectionRegParam.java

@@ -1,6 +1,7 @@
 package thyyxxk.simzfeeoprnsystm.pojo;
 
 import lombok.Data;
+import thyyxxk.simzfeeoprnsystm.utils.StringUtil;
 
 @Data
 public class DirectionRegParam {
@@ -8,11 +9,26 @@ public class DirectionRegParam {
     private String patientId;
     private Integer times;
 
+    // 11-普通门诊;14-门诊慢特病
+    private String medType;
+    // 慢特病病种编码
+    private String opspDiseCode;
+    // 慢特病病种名称
+    private String opspDiseName;
+
     // 个人账户使用标志:1-使用,0-不使用
     private Integer acctUsedFlag;
     // 读卡类型:01-电子凭证,02-身份证,3-社保卡
     private String readCardType;
     private String readCardResult;
-
     private String expContent;
+    private Boolean straitSettle;
+
+    public Boolean getStraitSettle() {
+        return null != straitSettle && straitSettle;
+    }
+
+    public String getMedType() {
+        return StringUtil.isBlank(medType) ? "11" : medType;
+    }
 }

+ 9 - 3
src/main/java/thyyxxk/simzfeeoprnsystm/pojo/MzPatientInfo.java

@@ -26,7 +26,7 @@ public class MzPatientInfo {
     private String mdtrtId;
     private String medType;
     private String psnType;
-    private String acctUsedFlag;
+    private Integer acctUsedFlag;
     private Date visitDate;
     private String doctorCode;
     private String doctorName;
@@ -45,15 +45,21 @@ public class MzPatientInfo {
     private String readCardBizType;
     private String expContent;
 
+    private Boolean straitSettle;
+
+    public Boolean getStraitSettle() {
+        return null != straitSettle && straitSettle;
+    }
+
     public Boolean needRevokeRegistration() {
         return null != revokeRegistration && revokeRegistration;
     }
 
     public String getAcctUsedFlag() {
-        return StringUtil.isBlank(acctUsedFlag) ? "0" : acctUsedFlag;
+        return null == acctUsedFlag ? "0" : String.valueOf(acctUsedFlag);
     }
 
-    public String getRealAcctUsedFlag() {
+    public Integer getRealAcctUsedFlag() {
         return acctUsedFlag;
     }
 

+ 44 - 13
src/main/java/thyyxxk/simzfeeoprnsystm/service/SiMzFeeService.java

@@ -345,8 +345,9 @@ public class SiMzFeeService {
                 mzPreSetlmt.setMdtrtCertNo(out[2]);
                 mzPreSetlmt.setCardSn(out[3]);
             } else if (mdtrtCertType.getCode().equals(MdtrtCertType.ELECTRONIC_VOUCHER.getCode())) {
+                String socialNo = mzDao.selectSocialNo(p.getPatNo());
                 JSONObject qrinfo = JSONObject.parseObject(p.getReadCardResult());
-                if (!p.getSocialNo().trim().equals(qrinfo.getString("idNo").trim())) {
+                if (!Objects.equals(socialNo, qrinfo.getString("idNo").trim())) {
                     return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "电子医保凭证身份证与HIS身份证不一致,请确认是否人证相符。");
                 }
                 mzPreSetlmt.setMdtrtCertNo(qrinfo.getString("ecToken"));
@@ -445,8 +446,9 @@ public class SiMzFeeService {
                 setlmt.setMdtrtCertNo(out[2]);
                 setlmt.setCardSn(out[3]);
             } else if (mdtrtCertType.getCode().equals(MdtrtCertType.ELECTRONIC_VOUCHER.getCode())) {
+                String socialNo = mzDao.selectSocialNo(p.getPatNo());
                 JSONObject qrinfo = JSONObject.parseObject(p.getReadCardResult());
-                if (!p.getSocialNo().trim().equals(qrinfo.getString("idNo").trim())) {
+                if (!Objects.equals(socialNo, qrinfo.getString("idNo").trim())) {
                     return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "电子医保凭证身份证与HIS身份证不一致,请确认是否人证相符。");
                 }
                 setlmt.setMdtrtCertNo(qrinfo.getString("ecToken"));
@@ -456,17 +458,16 @@ public class SiMzFeeService {
         setlmt.setPsnSetlway(PsnSetlWay.SETTLE_BY_ITEMS.getCode());
         setlmt.setChrgBchno(p.getPatNo() + "_" + p.getTimes());
 
-        String acctUsedFlag = p.getRealAcctUsedFlag();
-        if (StringUtil.isBlank(acctUsedFlag)) {
+        Integer acctUsedFlag = p.getRealAcctUsedFlag();
+        if (null == acctUsedFlag) {
             Double acctPay = mzDao.selectAcctPayInPreSettle(setlmt.getMdtrtId());
             if (null != acctPay && acctPay > 0) {
-                acctUsedFlag = "1";
+                acctUsedFlag = 1;
             } else {
-                acctUsedFlag = "0";
+                acctUsedFlag = 0;
             }
         }
-
-        setlmt.setAcctUsedFlag(acctUsedFlag);
+        setlmt.setAcctUsedFlag(String.valueOf(acctUsedFlag));
         setlmt.setInvono(SnowFlakeId.getInstance().nextId());
         setlmt.setExpContent(p.getExpContent());
         String ref = JSONObject.toJSONString(setlmt);
@@ -507,7 +508,7 @@ public class SiMzFeeService {
                     setlEntity.getMedinsSetlId(), input.getString("msgid"));
             webHisService.saveCumInfo(webHisUrl, setlEntity);
 
-            if (BigDecimal.ZERO.compareTo(BigDecimal.valueOf(setlEntity.getPsnCashPay())) == 0) {
+            if (!p.getStraitSettle() && BigDecimal.ZERO.compareTo(BigDecimal.valueOf(setlEntity.getPsnCashPay())) == 0) {
                 ResultVo<String> mzChargeResponse = mzHisChargeProcess(p.getPatNo(), p.getTimes(),
                         String.valueOf(setlEntity.getMedfeeSumamt()));
                 if (mzChargeResponse.getCode() != ExceptionEnum.SUCCESS.getCode()) {
@@ -515,6 +516,7 @@ public class SiMzFeeService {
                     return ResultVoUtil.fail(ExceptionEnum.INTERNAL_SERVER_ERROR, mzChargeResponse.getMessage());
                 }
             }
+
             setlinfoDao.deletePreSettleInfo(p.getPatNo(), p.getTimes());
             return getFundDetailFromSetlinfo(setlEntity);
         }
@@ -651,8 +653,9 @@ public class SiMzFeeService {
         mzptnt.setStaffId(param.getStaffId());
         mzptnt.setPatNo(param.getPatientId());
         mzptnt.setTimes(param.getTimes());
-        mzptnt.setMedType("11");
-        mzptnt.setAcctUsedFlag(String.valueOf(param.getAcctUsedFlag()));
+        mzptnt.setMedType(param.getMedType());
+        mzptnt.setAcctUsedFlag(param.getAcctUsedFlag());
+        mzptnt.setStraitSettle(param.getStraitSettle());
 
         // 生成医保费用
         String mzReceipts = generateSiMzFees(mzptnt);
@@ -694,6 +697,8 @@ public class SiMzFeeService {
         siPatInfo.setFromDirectReg(true);
         SpcChrDiseAcct spcChrDiseAcct = new SpcChrDiseAcct();
         spcChrDiseAcct.setStaffId(param.getStaffId());
+        spcChrDiseAcct.setOpspDiseCode(param.getOpspDiseCode());
+        spcChrDiseAcct.setOpspDiseName(param.getOpspDiseName());
         spcChrDiseAcct.setExpContent(param.getExpContent());
         ResultVo<String> upldMdtrtRes = uploadOutpatientInfo(spcChrDiseAcct, siPatInfo);
         if (upldMdtrtRes.getCode() != ExceptionEnum.SUCCESS.getCode()) {
@@ -711,9 +716,24 @@ public class SiMzFeeService {
             revokeOutpatientRegistration(mzptnt);
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, upldFeeRes.getMessage());
         }
-        // 试算并返回试算结果
+
+        // 如果是退费重收,直接结算
+        if (param.getStraitSettle()) {
+            return outpatientSettlement(mzptnt);
+        }
+
+        // 如果试算个人现金支付为0,直接结算
         mzptnt.setReadCardBizType(ReadCardBizType.SETTLEMENT.getCode());
-        return outpatientPreSettlement(mzptnt);
+        ResultVo<FundDetail> presetlResponse = outpatientPreSettlement(mzptnt);
+        if (presetlResponse.getCode() == ExceptionEnum.SUCCESS.getCode()) {
+            FundDetail fundDetail = presetlResponse.getData();
+            BigDecimal cashpay = new BigDecimal(fundDetail.getCashPay());
+            if (cashpay.compareTo(BigDecimal.ZERO) == 0) {
+                return outpatientSettlement(mzptnt);
+            }
+        }
+
+        return presetlResponse;
     }
 
     private String generateSiMzFees(MzPatientInfo mzptnt) {
@@ -799,4 +819,15 @@ public class SiMzFeeService {
             revokeOutpatientRegistration(p);
         }
     }
+
+    public void test() {
+        JSONObject input = exec.makeTradeHeaderWithInsureArea(SiFunction.REVOKE_OUTPATIENT_SETTLEMENT, "430105", "01897");
+        JSONObject data = new JSONObject();
+        data.put("setl_id", "421253439");
+        data.put("mdtrt_id", "758032270");
+        data.put("psn_no", "43000020100034025147");
+        input.getJSONObject("input").put("data", data);
+        JSONObject result = exec.executeTrade(input, SiFunction.REVOKE_OUTPATIENT_SETTLEMENT);
+        log.info("【操作员:01897】门诊结算撤销:\n参数:{},\n结果:{}",input, result);
+    }
 }

+ 1 - 1
src/main/resources/application.yml

@@ -13,7 +13,7 @@ spring:
     cache: false
   datasource:
     dynamic:
-      primary: dev
+      primary: his
       strict: false
       datasource:
         his: